#arma3_scripting
1 messages · Page 714 of 1
oh, yeah that makes sense
are they supposed to be in like a special folder or smth or what
the path to the .paa is 100% correct
what is it?
"\pictures\icons\holdAction_documents_ca.paa",
that's wrong
how come
remove \
the first?
yeah 
i execVM files like that, no problems there 
Arma 3 sometimes requires \, sometimes hate \, sometimes doesn't care \ 
well it's either that, or it takes absolute paths
define absolute path 
C:\blabla\file.sqf
for the "muzzle" parameter on certain commands such as ammo, is that just the same as the player's current weapon?
yes
unless its like a vehicle turret or something
actually no
or like a Type 115
just use currentMuzzle
Why does the following code throw a Generic Error at the sleep 5?
o1 addEventHandler ["Killed", {
o1 removeEventHandler ["Killed", _thisEventHandler];
e1 setCombatBehaviour "AWARE";
e2 setCombatBehaviour "AWARE";
["Cpt. Campbell", "What the hell, Givens!? I told you not to shoot him!"] spawn BIS_fnc_showSubtitle;
sleep 5;
["endF2", false, true, true, true] call BIS_fnc_endMission;
}];
You can't sleep in the context
I execVM it by the way.
Inside of an EH can't use suspend commands
spawn
you execVMed the whole script, not what's inside the event handler
so, should i execVM only what's inside the EH?
e.g
o1 addEventHandler ["Killed", {
execVM "script.sqf"
}];
:(
i thought ur saying that that's the proper way of doing it nvm
and I'd shown you that before
yeye all g
that's the bad way of doing it
Does anyone have a script for refueling vehicles in a certain radius?
As in if a jet or something got close to a trigger it would get refueled and resupplied
see setFuel
Thanks
how can i do a respanw based on weneaver all of your group is dead,or 3 min have passed?
for a multiplayer game
try setPlayerRespawnTime, but you will need scripting skills
That's my curse,have little skill on script
i know how to code it
i mean
how it would be structured
but no idea on how to actually code it
Okay, so how would you structure it?
first of all,the game would check if the group members are dead,if all are dead,then automatically all respanw at the same time
and a individual clock of a desired time that counts donw when somebody died,when it runs out,it automatically respanws that player individually
with this,if all died rougthly at the same time,they would respanw all at once
so you encourage more focus on keeping the players alive
rather than using then as a disposal tool
this is meant for a TvT setting
so either all die rougthly at the same time (eg:an explosion,or something like that)
or they focus on keeping the injured alive
this would punish strats based on constant respaning to overwhelm a post
For checking all members of a group at once, take a look at the wiki page for findIf
checking seeems count funcion is better for this purpose
and then add a normal 3 min respanw timer
or how much time do you want
the issue yet again
i not how is writteng
or how do you write scripts
the syntax,not on what do i have to do
onPlayerKilled.sqf (this script is automatically executed by the game when the player dies):
if ({alive _x} count units PlayerGroup == 0) then {
0 remoteExec ["setPlayerRespawnTime", PlayerGroup];
} else {
setPlayerRespawnTime (3 * 60);
};
```At some point before the player dies (and while he is in the correct group) you have to do `PlayerGroup = group player;` (because dead units have no group).
Not entirely sure if this really works, I've never tried.
thx so much,i'll test it,and feedback any issues
also,any guide on the syntax for scripting?
Every single command syntax (and more) is available on https://community.bistudio.com/wiki/Main_Page, general SQF syntax is described on https://community.bistudio.com/wiki/SQF_Syntax and a (currently very incomplete) introduction is available at https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting.
Speaking of respawn
Is there a way to set different respawn times for different respawn positions?
maybe with checking selected respawn position, dunno
but yeah you'll have to script it yourself
hi all! - is it posible to put a addon pbo inside the mission folder and load it from there? - it´s a pure script addon , best reguards
no
:/ thx
If its just a script you can probably integrate it into the mission somehow.
But you cannot just put a mod into a mission, even if the mod "only" contains scripts
had a stupid idea after looking at https://steamcommunity.com/sharedfiles/filedetails/?id=2565965887&searchtext= again
would there be an FPS gain from using intercept to run a viewculling algorithm locally in a separate process?
It's not even possible afaik
yeah I was thinking about it more and the stuff you'd need probably isn't in shared memory anyway
dedmen said the reason that mod even has any fps improvement is likely an edge case bug that he's planning on fixing
Not sure which channel to ask, but does anyone know how Savage did the "Skip Travel" stuff in the SOG COOP campaign at all? Cant seem to find module or anything on google, cheers.
Skip Travel?
It's a part of the "aiHeliTransport" function.
There's AI transporting you big distances via heli, you can sit in there, listen to music and enjoy the view, or use hold action to basically skip to the end of the journey.
Yeah I've not long returned to ArmA mission making and i found this on the SOG wiki, https://wiki.sogpf.com/index.php/VN_ms_fnc_aiHeliTransportSkip However i cannot seem to figure out how to make it work, ive tried activating though WP completeion, trigger, and player init box, aswell as a add action, but nothing seems to work and the add action dues not seem to add it to the heli.
check the function in the function viewer, idk why but the main function is not on the wiki.
VN_ms_fnc_aiHeliTransport
Yhea I have no idea, that is way over my head like i said, i just got back in to it, so i have forgotten alot of SQF stuff
Parameter(s):
_group - AI group to pilot the heli, needs pilot and co-pilot [GROUP, defaults to grpNull]
_vehicle - Vehicle that will be piloted [OBJECT, defaults to objNull]
_route - Array of marker names or positions to go through [ARRAY, defaults to []]
_lz - Description [STRING|OBJECT|ARRAY, defaults to nil]
_goCondition - Condition to start, _this is equal to the _vehicle [CODE, defaults to {sleep 30; true}]
_unlock - Should heli pilot/co-pilot be unlocked after AI is done with transport [BOOL, defaults to true]
Returns:
Insertion completed [BOOL]
Example(s):
[myGroup, myVehicle, ["marker1", "marker2"], myHelipad, {true}] call vn_ms_fnc_aiHeliTransport
from the function header
Sorry i should have made it clearer, I found it in the functions viewer, however I am unsure on how to implement it, IE if i put it in the player init i get error messages that appear too fast to read, I havnt touched arma in 3 or 4 years. So i guess explain to me like a five year old.
if i put it in the player init
what do you put?
so copy and pasting it from the func viewer i change it to the following
[player, h1, ["marker1", "marker2"], hp1 {true}] call vn_ms_fnc_aiHeliTransport
missing ,
I end up with this as the error message. https://imgur.com/a/VL2PmOR
the first arg is a group
not object
you're putting player
which is an object
so in this cased change player > Alpha 1-2?
group player
Alpha 1-2 is not even valid
It makes no sense to run this on player group as the script tells AI to do the flying.
¯_(ツ)_/¯
I don't see why tho
oh
first arg is the AI pilot grp
nvm
then whom does it transport?! 
so change it to the var name of the AI pilot group
if you have _vehicle, why do you need group then? 
AI sits ouside the heli in SOG coop missions.
Player pilots can join last minute
and fly the heli.
If everybody boarded the heli and there's no player pilots then AI will take care of transporting you to the LZ.
okay great so i got the ai to get in and fly to the markers, I just now need to add the skip travel stuff in aswell, im sorry for being shit
It should be in there by default. It's disabled when you're close to the LZ.
It doesnt appear to be, ive put the helo in the corner of camlaonam, and the option never appears
I did, but i gotta go work now....
Ill figure it out after, thank you for the help
how can i put down a weapon which cant be picked up in eden?
the weapons should be available as vehicles in 3den
So, Yeah i got the add action to show, and it works which is great but once the helo lands and the players get out, it never flies back? From what i can tell its supposed to leave after 30 seconds.
No, it's only A to B, not A to B to A. You need to script them going back.
the script finishes once they reach the destination so you can do it easily by calling it in scheduled script.
ah okay, i misunderstood the code then, cheers for all your help aswell as @little raptor
You can basically run the same script again with starting point as LZ to have them go back.
Yup, thank you dude.
You need to set damage to 1 on whatever the weapon is being held by. Yes talking about weapon holder or ground holder whatever it is..
ive set the damage of the gun to 0% and it did it
depends. afaik foreign error means error caused by external libraries
Before I put something in feedback tracker as a request for the future, is there no way to locally change an animation source in MP to improve network performance / animation lag?
locally

so yeah no, no way
now is it worth a ticket…
people most likely do not want desync of some things (e.g a bargate)
what's your issue, "just" saving network comm for a cockpit animation?
The primary issue is a significant lag (only updating every 5-10 seconds or so) for user animations in multiplayer within the cockpit. In a 2 seat helicopter the animations are practically live for the pilot (person who the aircraft is local to) but not for the gunner (who it isn't.)
My first thought would be to fix this by having the animation sources be local (since it's in the cockpit, desync doesn't matter because neither can see each other) but there may be better solutions
For example, in this clip the moving map should be updating at near-real-time. https://youtu.be/iTQ1Bo5eWpU?t=51
I am not sure such things should be done via animateSource, but I am not a modder so i don't know much about selections etc
these would update locally
Yeah, it felt dirty to me too, but I couldn't find a way to do it other than that. Selections allow for you to change the textures (which is what I use to set the map background) but the transformations used to move / rotate them are done via UVAnimations (https://community.bistudio.com/wiki/Arma_3:_UVAnimations) which require you to use animateSource to control them.
To fix issues like these I am in the process of moving as much as I can across to the new MFD system (the mod had its start in A2 so it is doing it currently all using modelling and textures) but I can't move all of it across unfortunately, this being one of the parts - hence my interest
I understand, thanks!
Thanks for the help! If anyone has any recommendations to me on either ways to improve this lag, or other ways of getting the same output.
I have even tried making tiny MPD objects that are createVehicleLocaled and attachedToed the screens in the model, which shouldn't have the network lag issue that the others do but unfortunately when you're in a vehicle its LOD is always drawn on-top of everything else even if the MPD object is closer, which stops that from working.
Another option could be having it so different animation sources could be "local" to different turrets. Not sure!
Hmm... vectorAdd, etc, only support at most three elements? [1,2,3] vectorAdd [0,0,0,4] isEqualTo [1,2,3] 😦
unfortunate... I have a case where 4 would be great.
you can still use BIS_fnc_vectorAdd
We can support any length without negative performance impact, but has not been a priority so never been done
out of the box? today?
I'll check it out, thanks...
no not today, was never implemented beyond one performance test
no worries, thank you; the BIS functions seem to be just fine.
Speaking of those... when should one use a BIS function and when the "normal version" of it?
function existed for earlier versions of the engine, and was kept for backward compat
now you should use the command for performance
Is there a way to display the satellite or terrain map on an object? Something that would always display the terrain used, regardless which one? Trying to find a way to avoid having to make textures (as paa files) for all kinds of maps.
Probably use the texture that used in the Editor's select Map menu?
hm woudln't that be named differently for each map as well? I mean it would still be easier than making them again myself.
Defined in config. Should be easy
Ok thx I'll give it a look 🙂
Q: the command? i.e. vectorAdd... again my objective there is to support 3+ elements; vectorAdd trims off to 3, so 4+ is not working in this case.
the BIS functions are the correct answer.
I was answering to BT's more general question
I saw that. hopefully it clarifies a bit the constraints I was up against.
@winter rose @little raptor saw you guys got a call out in the BI blogpost! pretty cool
it is always nice knowing I can post something here and you two will point out if I'm doing something incredibly stupid :^)
oh we do quite stupid stuff ourselves too don't worry 😄
adding @cosmic lichen to the batch, as he hasn't been mentioned :p
🎉
Yeah, you three helped a lot to us small-time Arma scripting hobbyists, you worth the mention, thanks a lot.
I just haven't talked with him a lot so I wanted to ping the two that'd helped me the most, but you're right big ups to all 3 of you
Hi! I was hoping i could get some help, figuring out what I need to do.
I'm using a script that creates a Trigger (createTrigger). This script is executed in the Eden Editor.
Problem: The Trigger does not show up in the editor i.e I can't see or move it around, however if I start the mission the trigger activates as wanted. Thanks!
see https://community.bistudio.com/wiki/create3DENEntity for Eden triggers 🙂
Thanks! Must have flown over my head... I'll check that out! 👍
Is there a way to create an object at the exact center position of the player's screen where it intersects with the terrain, or an object? And at a set distance when pointing at the sky with nothing in the way?
screenToWorld doesn't work for objects, or when you're pointing at the sky, the lineIntersects commands require an endpoint (which kind of defeats the purpose since that's what I am trying to find out in the first place)
screenToWorld works for terrain intersection
I am aware
other than that, you can use camera position + camera direction + vector multiplication to get what you want
Object OR terrain intersection I have used before:
_target = (lineIntersectsSurfaces [_camPos,AGLToASL screenToWorld [0.5,0.5],player,vehicle player,true,1,"FIRE","VIEW"] select 0) select 0;
if (isNil "_target") then {_target = screenToWorld [0.5,0.5];};
what is _camPos?
The origin of the line, such as player eyepos when using screenToWorld, you could use ```sqf
eyePos player
BIS functions are scripts. You never use them when there's a command that does the same thing
Doesn't seem to work. The object being created just gets place away from the object I am looking at, rather than the point on the object I am looking at
Wait, probably just need to set the position after the createVehicle command
forgot about that
Seems to work with some objects, while ignoring others. It also always chooses the closest object to the player position, but I might be able to force it to use the cursor object
the function version is there for backwards compatibility in most cases, usage is what Leopard said
Can server-side scripts be recompiled while in a mission using file patching?
can you use any of the functions in the BIS sector control stuff outside of it?
i want to use the function that tells you which side has a sector without using the entire rest of the module
hey i have a side in an array which is in a config, when i select the array the side is a string, is there any better way then call compile the string to get back the side?
https://forums.bohemia.net/forums/topic/210585-side-from-string/
The solution with find would be fine but find is case sensitive so this is less ideal for me
if you find it, yes
lol fair
if you don't want it, have the config use a number
actually tbf since im using alive i think i cant use that anyway
does anyone knows why this doesnt work?
[player, "eject", vehicle player] remoteExec ["action", side _caller, true];
inside of an addAction function, whereas _caller is the one who called the action, the rest of the code works fine.
intent is to make everyone from the side who called the action eject one's vehicle
see the pinned messages
well I still cant figure out whats wrong with the code
Another Example: a binary command with multiple arguments in the
rightArgarray_unit addAction ["hello", {code}] ``` ^1 ^2 ^3 ```sqf [_unit, ["hello", {code}] ] remoteExec ["addAction", 0]; //add the action to everyone
is it missing brackets on the "eject", vehicle player?
yes
got it, thanks
because the original version is:
player action ["eject", vehicle player]
but this code seems wrong anyway...
what do you mean?
inside of an addAction function, whereas _caller is the one who called the action
why are you even trying to remoteExec that?
to exec for each player on the side of the caller, is there a better way to do it?
you want to eject all players from their vehicles?
from one side, yes
then your code is wrong
what you wrote is taking player from your computer
not others
so you're just ejecting yourself on all computers
I've tried to use _this, but couldnt manage to get it to work, outputs an array
select 0 works sometimes, but not always
how can I make it work?
first of all, I'm not sure if the command even needs remote execution
second of all: #arma3_scripting message
it has nothing to do with _this and _caller and stuff
anyway, you can try this:
{
if (isPlayer _x) then {
_x action ["eject", vehicle _x];
};
} forEach units side _caller;
if it doesn't work use remote exec
i guess this will problaly work
but even tho
if it wouldnt work, how could I do it?
Quick question, is there any advantage to using a MissionConfig instead of variables?
no
you can only store string and number constants (and arrays of these) in missionConfig
not variables
I know, but lets say I got a few constants like ```sqf
6mm guns = ["Gun1", "gun2", "gun3"];
Helmets = ["HelmetName1", "HelmetName2"];
So is there any performance gain to using Config instead of variables?
no. if anything there's a performance loss
because you have to fetch them from the config
but I think config variables take up less memory
Is there anything obviously wrong with this? ```sqf
_ret = nil;
if ((count _result == 1) && {(_result select 0 select 1) > 0}) then {
_ret = (_result select 0) select 0;
} else {
if (count _result == 0) then {
_ret = [_objective, "lastOwner", nil] call ALiVE_fnc_hashGet;
};
};
_ret```
it keeps saying _ret is an unknown variable on line 4
or can I not return nil like this?
yeah this doesn't work for returning nil lol
Just whatever Leo says...
Is your purpose to just declare the variable without anything in it, initially?
If so, there is no problem in here. It makes sense. But you should of course check at the end if it is still nil after the code in between is executed.
nil is not a value, so you cannot return it. Instead you should just check if it is nil , by using isNil "_ret" (do not forget you dont give variable but variable name)
yeah I figured it out
you can return nil
but not in scheduled environment
it throws an error
What exactly do we mean by returning nil exactly? From my knowledge, nil is just anything/nothing.
_b = call {
_a = nil;
_a
};
isNil "_b"
I return _a
What do you return in _a though?
nil
Ok I accept I wrote that out wrong, you can, yes, return a value indeed. Because it holds a value "any" but I just tried to say that you cannot return it simply by calling the variable name.
you cannot return it simply by calling the variable name.
you can
I called _a
the only place where "calling a nil variable name" is invalid is scheduled environment
Eh whatever, I just woke up and wont be able to go into philosophy, I assume I understood what he wanted to ask and responded according to that without confusing based on what I have understood.
Here I changed my answer.
How would I use a variable as a selection index? For example:
_magazines = [["5Rnd_127x108_Mag",5],["100Rnd_65x39_caseless_black_mag",100],["7Rnd_408_Mag",7]]
_Index = 2;
_magClass = _magazines select _Index select 0;
_ammoCount = _magazines select _Index select 1;
The _magazines and _Index variables get populated elsewhere and I need to select from the array accordingly.
first of all, your strings are wrong
second of all, what?
The above is just an example. The _magazines array is populated from a DB query. The _index variable is populated by a onLBDblClick EH. I need to use the _index variable to decide which element in the array will be selected.
onLBDblClick EH already gives you the index
Yes, but it doesn't populate the array. That I have to get from a DB query since uniformMagazines, vestMagazines, and backpackMagazines are broken.
If those guys actually worked, I wouldn't have to involve the DB, but as of now I think I have to.
what DB?
Exile mySQL
why do you use a database? just use getUnitLoadout and check if they're magazines in the config
plus using a database means that it won't support all mods that the user is running
config reading can be done dynamically
This script needs to interact with a specific magazine in a players inventory. When the item is double clicked, it fires the EH with the container idc (uniform, vest, backpack) and the index. I need to track that specific mag through the script. Not just a similar class. If uniformMagazines or the others worked, II could use a switch statement evaluating the container idc and use that index to select from the array passed. Since those don't work, I have to use the array in the DB and the index. The data is the same, the source isn't. Either way, I still need a way to use the index number passed by the EH to reference the array and select the right mag.
Exile is all about the DB.
The index/array will provide not just the class, but the current ammo count in the mag.
if you're not in a hurry:
https://community.bistudio.com/wiki/magazinesAmmoFull
mag id and creator have been added
ok I see what you mean now. I didn't know what you wanted to use the db for
but I still don't understand how a db can help you with that problem
I'm trying to push this with a big update next week, so...
It provides the array of magazines in that specific container. The DB array matches the index passed by the EH There are DB columns mags, weapons, items, etc for each container type. So I query the vestMagazines column for that player and it provides every mag in that containers inventory. If I can tkae the EH index and use it as a selection index for the array everything works great. I just need to figure out how to format that.
onLBDblClick only provides the 2 arguments.
I don't really understand what you mean
can you just show me an example of how you intend to populate your array, and how you want to use the index?
config.cpp
class VestContainer: UniformContainer
{
idc = 638;
onLBDblClick = "_this call ExileClient_gui_inventory_event_onItemDoubleClick";
x = "20.5 * (0.03) + (-0.25)";
y = "13 * (0.04) + (-0.25)";
w = "12 * (0.03)";
h = "14 * (0.04)";
colorBackground[] = {0,0,0,0};
sizeEx = "0.8 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};```
ExileClient_gui_inventory_event_onItemDoubleClick:
private["_itemControl", "_itemControlIndex", "_itemClassName", "_itemDisplayName", "_configName", "_configSearch","_type","_magazines","_mag","_ammoCount"];
_itemControl = _this select 0; // Passed from EH
_itemControlIndex = _this select 1; // Passed from EH
_itemClassName = _itemControl lbData _itemControlIndex;
_itemDisplayName = _itemControl lbText _itemControlIndex;
_configName = "";
switch (_itemControl) do
{
case "#633": {
_type = "uniform";
["LoadMags",[getPlayerUID player,_type ]] call ExileClient_system_network_send;
};
case "#638": {
_type = "vest";
["LoadMags",[getPlayerUID player,_type ]] call ExileClient_system_network_send;
};
case "#619": {
_type = "backpack";
["LoadMags",[getPlayerUID player,_type ]] call ExileClient_system_network_send;
};
};
while {true} do
{
isNil { player getVariable "bsf_mags" };
};
_magazines = player getVariable ["bsf_mags"]; // Gets all mags in container
_mag = _magazines select _itemControlIndex select 0;
_ammoCount = _magazines select _itemControlIndex select 1;
... other stuff```
ExileServer_BSF_network_LoadMags
params ["_sessionID", "_parameters","_mags"];
_sessionID = _this select 0;
_parameters = _this select 1;
_playerUID = _parameters select 0;
_type = _parameters select 1;
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
switch (_type) do {
case "uniform": {
_mags = format["BSF_uniform_mags:%1", _playerUID] call ExileServer_system_database_query_selectSingle;
};
case "vest": {
_mags = format["BSF_vest_mags:%1", _playerUID] call ExileServer_system_database_query_selectSingle;
};
case "backpack": {
_mags = format["BSF_backpack_mags:%1", _playerUID] call ExileServer_system_database_query_selectSingle;
};
};
_playerObject setVariable ["BSF_Mags", _mags, false];```
The switch statement in ExileClient_gui_inventory_event_onItemDoubleClick decides triggers the DB query in ExileServer_BSF_network_LoadMags which uses it's on switch to determine which query to send. The result is then assigned to a variable on the player. ExileClient_gui_inventory_event_onItemDoubleClick waits for that and gets back to work.
The whole DB and player variable thing is a workaround because of those broken functions that you reported on Sunday.
The reason that this is broken up into the 2 scripts is a security measure. The DB functions are run from the server while the rest on is the client.
while {true} do
{
isNil { player getVariable "bsf_mags" };
};
this loop does nothing and it's just eating scheduler cycles
I haven't actually done that yet.
so you just need _itemControl then?
_playerObject setVariable ["BSF_Mags", _mags, true];
why are you broadcasting a whole array to all clients?
do you have any idea how expensive that is?
_itemControl is the container idc - #633, #638, or #619.
_itemControlIndex is the array index.
I need to use _itemControlIndex to make a selection from the array returned to _magazines = player getVariable ["bsf_mags"];
I won't be. Right now I'm beating my head against the wall just trying to sort this out and haven't cleaned up yet.
There's been a shitload of trial and error.
I need to use _itemControlIndex to make a selection from the array returned to
but you already are doing that...
_mag = _magazines select _itemControlIndex select 0;
_ammoCount = _magazines select _itemControlIndex select 1;
params ["_sessionID", "_parameters","_mags"];
_sessionID = _this select 0;
_parameters = _this select 1;
wai 
But it doesn't work. Using _itemControlIndex as a selection index throws an error.
then what you stored in database doesn't match the number of items in your listbox
that or _itemControlIndex < 0
It's not though. I've been checking the output to those variables and they've always been accurate. So SHOULD _mag = _magazines select _itemControlIndex select 0; work as far as you know?
yes
well shit.
Ok, I'll tidy up and do a round of logging and see if there's something else going on. Knowing that it should work as written is a big help.
but your approach to the problem is kinda bad. you're fetching the array from the db when the user double clicks, but you don't update the listbox
and I still have no idea why you're using a database... 
you can just do this on the client's PC
Is it just that _sessionID doesn't need to be defined here? I'm learning from analyzing other code and inheriting whatever mistakes were made there as well as making a bunch of my own.
this is what sharp meant:
_sessionID = _this select 0;
_parameters = _this select 1;
you already have them:
params ["_sessionID", "_parameters",
How?
The thing that I keep running into is matching the specific mag and ammo count.
how is what you're storing in the database any different from what the user already has in his inventory and can access locally?
you're just saving a bunch of stuff in the database
with unnecessary network traffic
just use:
https://community.bistudio.com/wiki/magazinesAmmoFull
what difference does it make if two mags have identical class and cnt?
private _containers = ["Vest", "Uniform", "Backpack"];
private _allMags = magazinesAmmoFull [_unit, true];
private _magCategories = [[], [], []];
{
_x params ["_mag", "_cnt", "_loaded", "_type", "_container"];
private _containerID = _containers find _container;
if (_containerID >= 0) then {
_magCategories#_containerID pushBack [_mag, _cnt];
};
} forEach _allMags;
use that in a loop every few seconds to update the inventory mags
then just do:
if (_magCategories isNotEqualTo _lastMagCat) then { //inventory changed
lbClear _lb;
...
//update listbox
};
also you can store information in each listbox item
using lbSetData and lbSetValue
The player will be disassembling the mags and receiving components based on the ammo count. If a 30 round mag has 7 rounds in it, that specific mag has to be removed from the player's inventory.
so?
what does it have to do with what I said?
you just want the first instance of a mag that matches your class and cnt in the corresponding container
then you remove it
Not exactly. When a player opens their inventory and double-clicks on an item, it opens a new display with details, ammo count, recipes, etc. They start by interacting with a specific mag and seeing it's count. If a player has 20 different mag classes and they are all partially full, I don't see how to track that without using the array and index.
you already have them. lets say I have 1000 mags with the same class and cnt in my backpack:
[
["class", 7], ["class", 7], ["class", 7], ....
]
when index is 1, you just give user the second item. this is also how you populated the listbox
but when you modify the inventory, it doesn't matter which mag you modified. it can be any of those 1000 same mags
Yes, I understand that. It's when you have
[
["classA", 7], ["classA", 9], ["clasB", 1], ["classC", 23], ["classA", 1], ["classC", 22], ["classB", 3], ....
]```
Which is more likely when a player is using this script.
But for now, I need to get some sleep. I appreciate your input as usual.
I'll play with the code you posted and see what I can do.
guys, is there a reason why
west addScoreSide 100;
resistance addScoreSide 100;
will only work for host? code inside initServer.sqf and outside of any functions or code blocks; wiki says addScoreSide has global effect
Does this command have green Se icon?
thaaat's a yes!
I want to allow user to cancel mission loading by pressing ESC but don't know which dialog should get the displayAddEventHandler. any tips?
Hello, guys! Does anyone know if one can get current ambient sound path or class? I think livonia's wind sound is way to loud but cant find exactly which sound shader i hear.
but for some reason it only works for the host, scoreSide locally returns 0
you said addScoreSide
do you mean that you are doing addScoreSide on the server, and scoreSide on the client returns 0?
yes
ah, then if so, it should be noted on the https://community.bistudio.com/wiki/scoreSide page
I mean, I execute the addScoreSide on the initServer, it works for the host; but when I try to get scoreSide locally it returns 0
server: ```sqf
// initServer.sqf
blufor addScoreSide 1234;
systemChat format ["server score: %1", scoreSide blufor]; // "server score: 1234"
// init.sqf, client-side
systemChat format ["client score: %1", scoreSide blufor]; // "client score: 0"
yes, something like that, the clientside part is actually inside an addAction in onPlayerRespawn, but the rest of the code works fine, so I guess it's not it
how can I spawn fire ?
I tried this, but it does not hurt units.
private _fire = "test_EmptyObjectForFireBig" createVehicle _position;
Hey, quick question for scripters
How does isTouchingGround work?
Does it work by if you're standing on something (i.e. could be a building), or if you are actually on the natural terrain of a map?
Question for you: I see people using spotlight scripts, but the armaholic for them has disappeared long ago. Is there a simple way to achieve spotlight cones for AA, searchlights, etc?
Armaholic may have been a thing, but the workshop and the forums are still one 🙂
Found what you're referencing. I had seen it before, but finding the tutorial PBO and learning how to extract it took some doing. Thank you 🙂
We need more such example tutorial scripts on wiki with good explanation
no
Hm. Here's one for you that's kind of interesting.
I'm designing a mission for a StarSim unit. Said unit uses custom planes that, for whatever reason, the AI just don't want to shoot at with AA guns.
SAM? Sure. They'll fire surface-to-air missiles until the cows come home, but they -won't- fire anything - Shilka, Praetorian, none of it seems to care that there's a plane in VTOL mode sitting right in front of them. Is there anything I can do about that from a script level?
it would be more of a config issue
True, that would be the ideal fix, although I can't modify the modpack for obvious reasons - I've reported it though. I was hoping there might be something I could do on a script level. Sounds like probably not
Only returns true if you're touching the terrain or roadway LOD of an object
Is there a way to set the init of an object, spawned by script via function?
does anyone knows why this is happening? cant find anything related on docs
Nah. Should work just fine.
Do you spawn the object?
Have a look at https://community.bistudio.com/wiki/setVehicleInit. Read the Description and the last note carefully 🙂
Or someone else?
So the object will be spawned, via a zeus module, I have a script which works in the editor for pre-placed objects. I can provide the function sqf I am using if that helps?
Did you write the module?
Aye
Then what do you need init for?
Just execute the code immediately after creating the object
Basically the module spawns a barrel, which I want to lay dormant after its spawn, until it is shot at by a player (MPEventHandler), which it will then set alight and explode
Yeah. You don't need init
Like I said, do that after creating the object in the module function
It's exactly the same as init
Will try now and report
_activated = _this param [2,true,[true]];
if (_activated) then {
_this spawn {
params ["_logic", "_units"];
_pos = getPos _logic;
if !(isnull (attachedto _logic)) then {_pos = getposatl (attachedto _logic);};
_dir = _logic getvariable ["dir",random 360];
_h = _pos param [2,0];
_h = _h + 0;
_pos set [2, _h];
_ExploBar = "Barrel1" createVehicle [0,0,0];
_ExploBar setPosATL _pos;
_this addMPEventHandler ["MPHit", { params ["_unit", "_causedBy", "_damage", "_instigator"];
if !(_instigator in allplayers) exitWith {false};
private _hitCount = (_unit getVariable ["you_hitCount", 0])+1;
_unit setVariable ["you_hitCount", _hitCount];
if (_hitCount >1) then {
_unit removeMPEventHandler ["MPHit", _thisEventHandler];
_unit spawn {
private _emitter = "#particlesource" createVehicle position _this;
_emitter setParticleClass "MediumDestructionFire";
sleep ((round random 3) +3);
"HelicopterExploSmall" createVehicle position _this;
{
deleteVehicle _x;
} forEach [_emitter, _this];
}
}
}];
deleteVehicle _logic;
{
_x addCuratorEditableObjects
[
entities [["Barrel1"],["Logic"], true /* Include vehicle crew */,true /* Exclude dead bodies */],
true
];
} count allCurators;
};
};
true
This is the function, still getting errors, although this time it is Type array, expected Object
Because of _this addMPEh
_this is an array
You should've used _barrelblabla
@little raptor Say the getPos thing!
Also stop using getPos and position
Was about to 🤣
I guess you need a lesson to learn why. Just put your barrel on top of a building, and then shoot it...
Ok, so this now throws up no errors..... however the barrel no longer will explode :/
How would you go about it, willing to learn 🙂
I've explained on the wiki page for getPos. Look it up
instead use setPosASL/getPosASL
or ATL
but ASL is better
This part is also not good yet:
{
_x addCuratorEditableObjects
[
entities [["Barrel1"],["Logic"], true /* Include vehicle crew */,true /* Exclude dead bodies */],
true
];
} count allCurators;
````addCuratorEditableObjects` has to run on the server, but the module function is not guaranteed to run on the server.
Additionally, you know exactly which object (i.e. which barrel) you want to add to the Zeus interfaces, so there is no need to use `entities`.
Thanks, how would I tidy this up?
DS_fnc_addToAllCurators:
params ["_objectsArray", "_addCrew"];
{
_x addCuratorEditableObjects [_objectsArray, _addCrew];
} forEach allCurators; //Using count instead of forEach is a performance optimization.
```Slightly modify the module function:
```sqf
...
deleteVehicle _logic;
[[_exploBar], false] remoteExec ["DS_fnc_addToAllCurators", 2];
...
Thanks, just tried it out and the edit doesn't add the Barrel to the curator panel :/
allCurators doesn't necessarily return all curator modules
it's kinda broken
Locality issues are also in here:
_this addMPEventHandler ["MPHit", { params ["_unit", "_causedBy", "_damage", "_instigator"];
if !(_instigator in allplayers) exitWith {false};
private _hitCount = (_unit getVariable ["you_hitCount", 0])+1;
_unit setVariable ["you_hitCount", _hitCount];
if (_hitCount >1) then {
_unit removeMPEventHandler ["MPHit", _thisEventHandler];
_unit spawn {
private _emitter = "#particlesource" createVehicle position _this;
_emitter setParticleClass "MediumDestructionFire";
sleep ((round random 3) +3);
"HelicopterExploSmall" createVehicle position _this;
{
deleteVehicle _x;
} forEach [_emitter, _this];
}
}
}];
```The MP EH fires on every machine. That is good for your particle effect (because that needs to be created locally on each client), but bad for your `HelicopterExploSmall` explosion - because every machine creates its own explosion, meaning you'll get as many explosions as you have machines.
I'm not sure how you intended the `you_hitCount` object namespace variable, but it's local to each machine, so it only counts how many times the local player has shot the barrel (instead of how many times the barrel has been shot by players in total).
So to fix this, would you close the MPEh after the emitter then spawn the explosion?
I think ...
...
if (isServer) then {
"HelicopterExploSmall" createVehicle getPosASL _this;
};
...
```... should be enough.
but saying that, the explosion isn't actually working now since not getting the Type array, expected Object error
Actually really confused now :/, would you like the sqf as it now looks?
Sure.
_activated = _this param [2,true,[true]];
if (_activated) then {
_this spawn {
params ["_logic", "_units"];
_pos = getPosATL _logic;
if !(isnull (attachedto _logic)) then {_pos = getposatl (attachedto _logic);};
_dir = _logic getvariable ["dir",random 360];
_h = _pos param [2,0];
_h = _h + 0;
_pos set [2, _h];
_ExploBar = "Barrel1" createVehicle [0,0,0];
_ExploBar setPosATL _pos;
_ExploBar addMPEventHandler ["MPHit", { params ["_unit", "_causedBy", "_damage", "_instigator"];
if !(_instigator in allplayers) exitWith {false};
private _hitCount = (_unit getVariable ["you_hitCount", 0])+1;
_unit setVariable ["you_hitCount", _hitCount];
if (_hitCount >1) then {
_unit removeMPEventHandler ["MPHit", _thisEventHandler];
_unit spawn {
private _emitter = "#particlesource" createVehicle position _this;
_emitter setParticleClass "MediumDestructionFire";
sleep ((round random 3) +3);
if (isServer) then {
"HelicopterExploSmall" createVehicle getPosASL _this;
};
{
deleteVehicle _x;
} forEach [_emitter, _this];
}
}
}];
deleteVehicle _logic;
[[_exploBar], false] remoteExec ["DS_fnc_addToAllCurators", 2];
};
};
true
Can you run it with some systemChats to see if the MP EH is actually added and fired?
_h = _pos param [2,0];
_h = _h + 0;
_pos set [2, _h];
it's doing nothing
uhhh.... never used that before :/ how would I add that?
I can fully remove this?
yes. but why did you even add it in the first place?! 🙃
Tbh, I lifted it from another function I created for a parachute resupply, where it was needed to provide a spawn height XD, guess I can snippy snip 🙂
Just put in an occasional systemChat "Step 1"; at points of interest, or a systemChat str _this; when you want to know what _this currently is.
Then you run the code, test it and if you expected to read Step 3 but it doesn't appear, you know that the line with systemChat "Step 3"; is never reached, helping you find out why the code doesn't behave as expected.
Awesome, just loading it now.
Out of curiosity rather than killing the game, updating the file -->new PBO--> new local mod --> restart the game, is there anyway to do it on the fly for a "local mod" or shortcuts, as all these iterations are killing me XD
don't update the function in your pbo. you only need the module object
the function can be added/updated in the mission you're testing
once the mod is done you can put the function in the mod
_activated = _this param [2,true,[true]];
if (_activated) then {
_this spawn {
params ["_logic", "_units"];
_pos = getPosATL _logic;
if !(isnull (attachedto _logic)) then {_pos = getposatl (attachedto _logic);};
_dir = _logic getvariable ["dir",random 360];
_ExploBar = "Barrel1" createVehicle [0,0,0];
_ExploBar setPosATL _pos;
systemChat "Step 1";
_ExploBar addMPEventHandler ["MPHit", { params ["_unit", "_causedBy", "_damage", "_instigator"];
if !(_instigator in allplayers) exitWith {false};
private _hitCount = (_unit getVariable ["you_hitCount", 0])+1;
_unit setVariable ["you_hitCount", _hitCount];
systemChat "Step 2";
if (_hitCount >1) then {
_unit removeMPEventHandler ["MPHit", _thisEventHandler];
_unit spawn {
private _emitter = "#particlesource" createVehicle position _this;
_emitter setParticleClass "MediumDestructionFire";
sleep ((round random 3) +3);
systemChat "Step 3";
if (isServer) then {
"HelicopterExploSmall" createVehicle getPosATL _this;
};
systemChat "Step 4";
{
deleteVehicle _x;
} forEach [_emitter, _this];
}
}
}];
systemChat "Step 5";
deleteVehicle _logic;
systemChat "Step 6";
[[_exploBar], false] remoteExec ["DS_fnc_addToAllCurators", 2];
systemChat "Step 7";
};
};
true
1,5,6,7 Load on spawn
2 after shooting it
3,4 never come :/
Potential Lifesaver alert!
I presume you'd have to specify the config to read it from the mission file folder?
yeah. in description.ext:
#include "my_mod\config.cpp"
then just put the mod folder (named my_mod in above example) in the mission folder
I think the only suitable way of saying thank you, is that I'll have your babies
Still need to figure out why It dies between Step 2 to 5 🤣
Did you shoot it multiple times?
instead of systemChat "Step 2" put something better. like systemChat str _hitCount
Did you get Step 2 every time you shot the barrel?
just the once
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MPHit
The description is convoluted, but I'm starting to get the feeling that the MPHit EH is the reason for this.
Perhaps the barrel dies after the first hit and thus the EH stops firing?
do I need to make it temporarily invincible?
do barrels even die?! 
Does not fire when a unit is set to allowDamage false. However it will fire with "HandleDamage" EH added alongside stopping unit from taking damage (
unit addEventHandler ["HandleDamage", {0}];. Will not trigger once the unit is dead.
Maybe, not sure if that will help. Also seems to depend on what kind of invincible 🤷♂️
I don't know, but I assume that they have health like any other vehicle, so presumably, they should also lose health when they get hit.
bear with just translating it to read from the mission file rather than a mod
almost there
@little raptor I have the mission folder way of doing mod iterations, and I've set it to include the mod folder, but this does not seem to add the mod to the zeus interface, have I missed any steps?
you still need the pbo
minus the functions
you can't add new objects (inc. modules) after the game is launched
Ok will go for a re-try
Did the systemChat str _hitCount and it only registers 1 :/
I attempted to put in the handle damage, will show
...
private _hitCount = (_unit getVariable ["you_hitCount", 0])+1;
_unit setVariable ["you_hitCount", _hitCount];
_unit addEventHandler ["HandleDamage",{0}];
systemChat str _hitCount;
if (_hitCount >1) then {
...
Why are you adding a new event handler with every hit? 
whats really weird is that it will count up to 2, but only if I manually add it to curator objects
^^
He didn't say add it inside the eh
big confuse
Could someone point out what I've done wrong with my switch/case? I had this as separate if statements but decided to try a switch instead and it returns "error foreign error: invalid switch block" but I'm not sure what I've done wrong.
(It's called with an event handler when the player gets into a vehicle)
VehicleType = "";
switch (true) do {
case (vehicle player isKindOf "Land"): {VehicleType = "Land"};
case (vehicle player isKindOf "Ship"): {VehicleType = "Ship"};
case (vehicle player isKindOf "Air"): {VehicleType = "Air"};
};
hint VehicleType;
VehicleType = nil;
I don't see anything wrong with that
except using switch! 
and using global variable
is there a good way to return out of a script immediately, regardless of scope?
breakOut
ok
Would there be a better alternative to switch? I thought it'd be more efficient than the if statements i had before. Also yeah variables are just for testing 😅
do I have to name the parent scope to break out of?
yeah. if exitWith
I'll look into that! thank you 🙂
you can make your own switch based on that:
#define switch(x) private __switch__ = x; call
#define case(x) if (x == __switch__) exitWith
switch(_bla) {
case(_blabla) {
};
};
yeah
Anyone have any suggestions on how to do a progress bar while taking an objective?
RscProgress + ctrlSetProgress (or something, see the wiki)
My quick + dirty way of doing it is just getting a list of units in the objective + remote execing a hint of how long remains
thats probably better
is there an example of how to use that? I can't find it on the wiki
yeah that 
in your case you could use findIf like so:
private _types = ["", "Land", "Ship", "Air"];
private _vehicle = vehicle player;
private _type = _types select (_types findIf { _vehicle isKindOf _x }) + 1;
oooh thank you for sharing
Hey so I was just looking at BIS_fnc_saveInventory in the wiki and there's this example at the bottom
//--- save it
[player, [missionNamespace, "Var_SavedInventory"]] call BIS_fnc_saveInventory;
//--- load it
[player, [missionNamespace, "Var_SavedInventory"]] call BIS_fnc_loadInventory;
now if I changed that from missionNamespace to profileNamespace will that essentially mean I can have players save gear at the end of one zeus mission, and then I could load it from the initPlayerLocal.sqf so they start the next mission with the same gear they ended the last with?
how can I make AI "forget" about the player or any enemy unit? It seems that as long as the enemy is alive, even not visible for them (or far away) they still stay in combat mode. When the enemy dies, they turn to Aware. When I change their status to careless and then back to Safe, they immediately turn to the aware/combat mode
_unit reveal [_target,0] should do, IIRC
forgetTarget
Yes, but you should save the loadouts on the server to prevent players from editing their loadouts.
Cool thanks for that
can you read input during mission preload?
what input?
check if ESC is pressed
if you mean during the loading screen, I think so?
but not sure. you should try
I was trying to use finddisplay and displayAddEventHandler "keydown" but don't know which disp ID I should use
yes the loading screen
I'm using startLoadingScreen
tried putting the (custom) load screen display to the keydown EH but to no avail
I referenced that page so that you'd see the display
it's "RscDisplayNotFreeze"
ah that's the default screen what about it?
so just use that
but if this doesn't work then it probably won't work with that either
yeah
you can still try it:
_disp = uiNamespace getVariable ["RscDisplayNotFreeze", displayNull];
But I have custom loading screen
_loadScreen = (uiNamespace getVariable ['gcCtiLoadScrn', displayNull]);
_loadCtrl = _loadScreen displayCtrl 1200;
_loadScreen displayAddEventHandler ["KeyDown",
{
diag_log "INPUT!!!";
}];
doesnt work
do you register your display with that name in uinamespace?
yes and the variables are valid (_loadScreen etc)
Due the nature/purpose of loading screen, user input may not be available. Also in startLoadingScreen page, it says user control is disabled, but Im not 100% sure if it means for your case although I would assume so.
hmm ok
maybe there's some dialog that could take input but I dont know that dialog ID
Are you running that on the server?
i don't think a group can become actually null, it can become empty group(at which point it shows null group, but its actually joinable), or it can be non existant which is == grpNull. I don't think it can become null if it wasn't null beforehand, maybe some network issue 
hosted server
same for 2.04 stable or perf build
with just hosted server its fine
however with the additional client, this super funky stuff happens
happens even with vanilla CP
or starting the vanilla COOP you loose immediately
somehow this local host plus client from the same data (but different profile) seems to break the player/system init
even breaks it when you JIP with the client into a running mission (as the playable units/groups get wiped)
seems somehow caused by our mod, or some startup parameter
trying to narrow it down atm
@velvet merlin check count allGroups
= 0
you broke the game 

maybe something deletes the group after a unit joins a group, or after a unit is spawned
ok seems if i am running my DevCon on both hosted and the client
but group should be not deletable if it contains units... 

#blameDedmen
seems even just on the client is enough (in a hosted session - DS should be fine)
Hi guys just a quick one init.sqf dosnt say if it gets executed for just server or server and client on a dedicated server, which I think it does but can anyone confirm?
I know Serverinit.sqf is executed server side only but im wondering if init.sqf is executed server and locally for each client.
it's executed for everyone/everywhere
Thought so just recently got into arma scripting editing a mission from the workshop to add some bits and founds bugs because of this cheers 😄
how does one execute something on a JIP unit from the server these days?
via forum i found this recommended:
addMissionEventHandler ["PlayerConnected",
{
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
diag_log ["PlayerConnected - _id",_id];
diag_log ["PlayerConnected - _uid",_uid];
diag_log ["PlayerConnected - _name",_name];
diag_log ["PlayerConnected - _jip",_jip];
diag_log ["PlayerConnected - _owner",_owner];
diag_log ["PlayerConnected - _idstr",_idstr];
{
diag_log ["PlayerConnected - _x",_x];
diag_log ["PlayerConnected - owner _x",owner _x];
// if ((owner _x) == _uid) exitWith
if (_x isEqualTo _owner) exitWith
{
_unit = _x;
diag_log ["RemoveItems - initServer - PlayerConnected",time,diag_tickTime,LIB_CadetMode,_unit getVariable ["BIS_UnitClass",""],_unit];
if (_unit getVariable ["BIS_UnitClass",""] == "") then
{
[_unit,BIS_infantryPlayer] call WW2_MissionUtilityFunctions_fnc_SetUnitLoadout;
//remove items on veteran/hardcore
if (!(LIB_CadetMode)) then
{
[_unit,true,true,true] spawn WW2_MissionUtilityFunctions_fnc_RemoveItems;
};
};
};
} forEach allPlayers;
}];```
but there is no matching data:
17:21:46 ["PlayerConnected - _id",1.46288e+009]
17:21:46 ["PlayerConnected - _uid","76561198009068539"]
17:21:46 ["PlayerConnected - _name","test"]
17:21:46 ["PlayerConnected - _jip",true]
17:21:46 ["PlayerConnected - _owner",5]
17:21:46 ["PlayerConnected - _idstr","1462881321"]17:21:46 ["PlayerConnected - _x",bis_o2_6344]
17:21:46 ["PlayerConnected - owner _x",2]
or rather the JIP unit is not yet part of allPlayers as it seems
PlayerConnected is connect to server, not selected into a body, but you can remoteExec to its ownerid (5) as target?
absolutely no issue on my end
you most likely have another issue somewhere else (missing {}?)
anyway yes, don't use switch as others stated```sqf
onEachFrame {
_vehicleType = "";
switch (true) do
{
case (vehicle player isKindOf "Land"):
{ _vehicleType = "Land" };
case (vehicle player isKindOf "Ship"):
{ _vehicleType = "Ship" };
case (vehicle player isKindOf "Air"):
{ _vehicleType = "Air" };
};
hintSilent _vehicleType;
};
What is the easiest way to add an action to an object for everyone.
I assume putting it in serverinit.sqf wont work as theres no UI so it wont add it so I guess just putting the addaction in initPlayerlocal.sqf would be best?
any reason why not to use remoteExec?
this is getting me mad, it works but only for the host, tried remoteExec too but it wont work for anyone
again, it's not serverinit.sqf
it is initServer.sqf!
you can also add the action in the object's init (ugh, it pains me to say so 😄 but this is one case where it makes sense)
don't get mad
make a ticket
Oh Durr ofc I could just use that and put the code in {} I have used this before but defined the code as a function inside "initPlayerlocal.sqf" (as it was called dynamically through't the mission on difference objects passed in) but this one I just want to add once.
I find putting code in {} for a remote execute dirty but I guess there is no point defining a function for it as it will be used once.
dont think this is a game bug, someone would probably notice it, that's what making it 100x times worse 😅
if it is not a bug, it is a server-side only command
sooo work around it 😬
you can use addAction without sending it as a call remoteExec 🤨
wait your saying just addaction on serverinit.sqf would add the action for everyone?
serverInit? no.
but you can remoteExec without sending it "as code" as you stated earlier
I think I'll just stop using the builtin score system and write a custom one, tried to work around using remoteExec as target 0 or 2 but neither would work, perhaps is something related to LAN, don't think its the case
it is server-side, so ofc you cannot
hence why I would write a ticket to have the getter work on clients 😄
wont remoteExec with target 2work?
I… what
I don't get what you mean by that, do you happen to have an example?
this should work```sqf
[west, 100] remoteExec ["addScoreSide", 2]; // NOT jip, dang it - otherwise each new JIP adds 100 points to the west
Im a bit confused on what you mean here but i think you mean this right? I think ive seen this before unsure if its written right tho.
myPole addAction ["a useless action that does nothing", {}] call remoteExec;
…how do you usually write your remoteExec, can you show?
_vehicle remoteExecCall["DeleteVic",BLUFOR ,true];
and DeleteVic is a in line function defined in "initPlayerlocal.sqf"
but that is defined as a function as I use it alot with different params. I just want to add an action for everyone once at mission start (and all JIPs) but if possible keep the code server side.
people really need to understand what is this true/false JIP flag 😵💫
Boolean - If true, a unique JIP ID is generated and the remoteExecCall statement is added to the JIP queue from which it will be executed for every JIP.
yeah, this wont work too, is there any chance this is a LAN problem, maybe something related to the fact that I have a Zeus module in the mission?
its this it adds the code to be run for any person that joins after its run i thought?
yes, true means: the code will re-execute for a new JIP client
but my remark is based on an assumption, if "deleteVic" deletes a vehicle, no need for a JIP thing, right?
(no need for a remoteExec either, afaik)
"deleteVic" adds an action button to any Vehicle dynamically spawned via a spawn system I have for people to spawn whatever they want. So if they leave without deleting there vehicles afterwards anyone that has joined can just walk up and will have the delete button too.
then it is a proper usage of the JIP flag; apologies for my defensive stance!
I tend to see it more wrongly than well used, that's why
I don't think so, maybe some remoteExec limitations through CfgRemoteExec something?
so```sqf
[theObject, [theActionParameters]] remoteExec ["addAction", 0, true];
won't work in singleplayer
there isnt any Cfg files in my mission folder, is it located any other place?
No worries I understand hate it when things are used wrong 😄 just people kept getting annoyed with shit left everywhere and they cant delete it haha.
Ah cheers 😄
yeah Ive been trying with my friend, the score system works for me (host) but not for him, seems like its a client function tbh
try in a completely empty mission if you want to debug things: have the simplest case scenario 😉
I've emptied the whole files in the folder, but to be honest didn't try to create a new scenario, I had CBA and 3den enhanced installed when I've created this one, maybe thats it
Probably going to open too big of a can of worms for myself right now….
Is there anyway to script and create a link between a discord group and a dedicated server?
I would like (if possible) to create a script which will read certain ‘roles’ assigned to a user on discord, to be interpreted by a dedicated server, to perform specific actions on specific players when they log into the dedicated server?
I’m anticipating that this’ll be a no, or super complex, but just want a pointer in the right direction to see if this was possible to script?
Seems possible but you will have to do some research
Like find a way to link someones discord to their steam profile
can I use the setFace command safely in unit's init for a MP scenario? the if (isServer) then {[_unit, "HeadClassName"] remoteExec ["setFace", 0, _unit]}; example
Is there any reason as to why this script wouldn't work? I had pretty much the exactly same script just a moment ago and it worked, but then suddenly it felt like it wasn't initialized anymore.
sleep 2;
if (isNull flagOwner Redflag) then {
} else {
systemChat "Red flag has been captured";
}```
That's in FlagRed.sqf
init.sqf has execVM "FlagRed.sqf"; in it.
in unit's init directly, without remoteExec
you're missing something: }
indent properly and you see it 😉
Oh, damn. No wonder it worked perfectly fine just a moment ago, I went ahead and deleted about 50% of it and I guess ones of those } got caught up in it. Welp, thanks mate, I'm off to continue my spaghetti.
I think the part that was most puzzling was the fact I tried putting that code directly into the ingame console and it worked somehow
any idea how to force the watch gui?
I did a CQB map for single player where you can reset blown up walls and hide/show killhouses. I never tested it on a server but a friend did and says it doesn't work. Me being a complete idiot when it comes to MP scripting i have no idea how to make it work online. All the codes are pretty much the same it just changes the variable names. What could i do to make it work on a dedicated server?
initPlayerLocal.sqf
////////////////////////////BRAVO///////////////////////////////////////////
cqbbdoor = {
cqb_b_d1 setdamage 0;
cqb_b_d2 setdamage 0;
cqb_b_d3 setdamage 0;
cqb_b_d4 setdamage 0;
cqb_b_d5 setdamage 0;
};
//Resets
sign_cqb_b addAction ["Reset Portas", cqbbdoor];
//Hide & Show
hidecqbbravo ={
sign_cqb_b hideObject true;
};
showcqbbravo ={
sign_cqb_b hideObject false;
};
laptop1 addAction ["<t color='#00c72f'>Remover Complexo Bravo</t>", hidecqbbravo];
laptop1 addAction ["<t color='#00c72f'>Construir Complexo Bravo</t>", showcqbbravo]; ```
what "doesn't work"?
from what I read, only the hide/show thing
hi guys in Eden editor if I create objects via debug console is there a way to make them editable in eden afterwards? I thought there was a eden add objects command (like Zues) but couldn't find anything here.
https://community.bistudio.com/wiki/Category:Command_Group:_Eden_Editor
create them via create3DENEntity
@winter rose the building reset cqb_b_d1 setdamage 0;
I was reading the wiki and i should change hideobject for hideObjectGlobal right?
yes, but you need to remoteExec it on the server
Only the hideobject part or everything?
setDamage has a global effect
hideObjectGlobal too - but it needs to run on the server, setDamage does not
Ok, thanks for the help!
mmm, those new lasers look hawt. I was looking into it only a few weeks ago because I wanted to script a laser defence system to replace the CRAM system we disabled(due to lag from crams firing)
Hello everyone, i got a small problem
i trying to get the cpmpatibleItems of my weapon but it dose not work with the way im using
_weaponClass = currentWeapon player; getArray(configFile >> "CfgWeapons" >> _weaponClass >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems");
this is waht im trying
but i get an empty string
"[]"
group_1 = createGroup west;
"B_Soldier_F" createUnit [
getMarkerPos "spawn1",
group_1,
[],
0,
"MAJOR"
];
group_1 (getMarkerPos "move1");
Can you tell where I made mistake? Whenever I try to run this code I'll get an error.
https://community.bistudio.com/wiki/createUnit#Alternative_Syntax init argument is wrong, and group_1 (getMarkerPos "move1"); is nonsense
@winter rose I changed all the Hideobjects to global and changed the addaction to [laptop1, ["Remover Complexo Alpha", hidecqbalpha]] remoteExec ["addAction", 0, true]; didn't test it on a dedicated server yet but it works on SP. Is this right? Or the remotexec should be in the hideobject code?
what you wrote will add the action to everyone, sure
now the hideObjectGlobal itself should be remoteExecuted towards the server
1- added the action to everyone
2- make that the action execs hideObjectGlobal on the server through remoteExec
The action was already being added to everyone, as the original code is initPlayerLocal.sqf.
Every player executes initPlayerLocal.sqf when joining, meaning every player executes the remoteExec statement, meaning every time a player joins, another Remover Complexo Alpha action is added to the laptop for every player (plus the JIP queue).
First player joins, executes initPlayerLocal.sqf: This adds the action to the laptop once and adds the same addAction statement to the JIP queue.
Second player joins, executes initPlayerLocal.sqf: The JIP queue already had an addAction statement, i.e. there already is an action on the laptop, but now initPlayerLocal.sqf adds another one - not just for the second player, but for the first player too, and to the JIP queue as well.
oh ok, so the addaction was fine as it was and i need to remotexec all the hideobject codes?
if so, is there a easier/faster way to do it? Its about 1300 lines
Yes.
You have a script file with 1300 hideObject statements?
yes, they are not run at the same time. Its 5 CQB training areas that i wanted to be able to "delete" to create something else in those places
and if needed making them show up again
so its duplicades because i suck at this and made hideObject 0 and hideObject 1 for each object
are images allowed here?
Well, luckily for you, remote execution is versatile 🙂
Aside from not writing hideObject several hundred times (instead I recommend using a forEach-loop), here's what I would do:
1️⃣ Mass-replace hideObject with hideObjectGlobal using a capable text editor.
2️⃣ Create a separate function for each training area, then place the hideObjectGlobal code in those functions accordingly.
3️⃣ Simply use remote execution for those functions in initPlayerLocal.sqf:
laptop1 addAction ["<t color='#00c72f'>Remover Complexo Bravo</t>", { remoteExec ["KER_fnc_hideCQBbravo", 2]; }];
laptop1 addAction ["<t color='#00c72f'>Construir Complexo Bravo</t>", { remoteExec ["KER_fnc_showCQBbravo", 2]; }];
You can upload them to a trusty image host of your choice and then share the link here.
is imgur trusted?
Well, I'm not afraid to click on imgur links 
Correct.
Ok cool, that was already done so i just need to fix the addaction code to the one you showed
btw can the functions also be in the initplayerlocal or should they be seperate?
It should even work with the MyFunction = { ... }; kind of functions (as long as MyFunction is a global variable).
Ah, but that will give you trouble with dedicated servers, because those don't execute initPlayerLocal.sqf, so they never create the functions you declare in that file.
sorry for asking so many questions. To turn it into a global variable i need to rename them to have _ at the start?
GlobalVariable = "Global variables look like this.";
_localVariable = "Local variables look like this.";
what is the best place to declare functions? in the init.sqf?
This is the best way: https://community.bistudio.com/wiki/Arma_3:_Functions_Library
Heyyy Guys, does someone has a idea, about how to open a storage box from the other side of the map, without teleporting it close to the player
so I used a function added to Zues by a mod to get objects in a certain radius returning all objects as the below. so they can be saved and added back later. (this is just 1 object pulled out). Im trying to take something that was made in Zues and turn it into something I can spawn in eden to make permanent my current issue is the rotation and position.
_object0 = createVehicle ["Land_BagFence_Long_F", [0, 0, 0], [], 0, "CAN_COLLIDE"];
_object0 setVectorDirAndUp [[-0.761385,-0.62988,-0.153437],[-0.123516,-0.0914017,0.988124]];
_object0 setPosASL [13759.5,12832,11.419];
I changed the above into:
_object0 = create3DENEntity ["Object","Land_BagFence_Long_F", [0, 0, 0]];
_object0 setVectorDirAndUp [[-0.761385,-0.62988,-0.153437],[-0.123516,-0.0914017,0.988124]];
_object0 set3DENAttribute ["Position",[13759.5,12832,11.419]];
This creates the object ok in eden editor but it is high above the ground and once the game is run the object turns to rotation [0,0,0] because the position attribute is not set.
Issue:
Position: The object is always put high above where it was copied from.
Rotation: the command to set the objects rotation when spawned via zues again (shown above) has 2 3D vectors and im unsure which values to take to put into the eden rotation attribute to make it work.
Yes, by animating its doors
@little raptor what ?
what what?
I don't understand what you mean by that
didn't you say you wanted to open a storage box?
Yes
or do you mean like its inventory?
Yes, player action ["GEAR",OBJECT] dosent work on longer distance
yeah. inventory ui has a check and it disables when you're far from the container
not that I know of. but you can create a helper unit, teleport the unit to the container and open the unit's inventory instead. when the unit's inventory changes, apply the change to yourself
Anyone have a config template to implement uniforms? a video would help too
Make own UI, because engine Inventory checks the range
Any ideas on this appreciated! 🙂
isn't there a "Direction" Eden attribute?
also, if objects are above/below ground, it is most likely a wrong isage of getPos/getPosATL/getPosASL vs setPos/setPosATL/setPosASL
Ill have a play with the different Pos functions but Im only able to change the set not the get as its a function added by a mod unless I write my own function which could be easier 🤔
Regarding "Direction" or "Rotation" there is only rotation for object attributes which I can set but I am unsure which values to use from the 2 3D vectors that the function returns.
https://community.bistudio.com/wiki/Eden_Editor:_Setting_Attributes#Attributes
Im only able to change the set not the get as its a function added by a mod unless I write my own function which could be easier 🤔
yeah trysetPosASLorsetPosATL, see which one fits (most likelysetPosATLgiven what you said)
if none works then use yourself thegetPosASLon the object
as for "Rotation", it is a bit weird as there is usually vectorUp + vectorDir, try either one, I don't know
ok cheers, yeah rotation does seem wierd as using one or the other (vectorUp or vectorDir) sets the object facing a certain way. For vectorUp its along the Y axis and for Dir its along the Z axis but ill have a play more and try figure it out cheers.
engine coordinates are reversed according to Dedmen. they're xzy, not xyz
not sure if it's affecting the 3den commands tho
Shouldn't be relevant for script commands
only a couple of them are impacted indeed, afaik
oh im unsure, I think there not I think the issue is just the commands used to get the rotation values are setting it facing along 1 axis but setting the rest of the rotation correctly.
so to get it 100% you have to use "setVectorDirAndUp" but that dosnt help for only 1 3D vector in eden editor haha
only 1 3D vector
wdym?
why 1?
Eden only has 1 rotation 3D vector
and how do you get it?
I am unsure what commands are used because im using a module added to zues by a mod that creates the below code for the object to be created 😦
_object0 = createVehicle ["Land_BagFence_Long_F", [0, 0, 0], [], 0, "CAN_COLLIDE"];
_object0 setVectorDirAndUp [[-0.761385,-0.62988,-0.153437],[-0.123516,-0.0914017,0.988124]];
_object0 setPosASL [13759.5,12832,11.419];
Might be worth just writing my own function
I am unsure what commands
then how did you say there's only 1 rotation vector?
It sets the rotation correct on first spawn but once you load into the mission it screws it up because the rotation attribute of the object is not set. My problem is trying to find which vector values from the 2 3D vetors to use in the 1 3D vector the eden has.
_object0 = create3DENEntity ["Object","Land_BagFence_Long_F", [0, 0, 0]];
_object0 setVectorDirAndUp [[-0.761385,-0.62988,-0.153437],[-0.123516,-0.0914017,0.988124]];
_object0 set3DENAttribute ["Position",[13759.5,12832,11.419]];
if it's only 1 vector it's probably the individual rotation angles
which are in radians btw
How would you get the correct rotation angles then? What command would you use as I assume the script it using "VectorDir" and "VectorUp" these are not getting the values eden needs.
of course not
first give me that "1 3D vector"
as in give me an example of what it is
(err not at the PC with the code at current haha but valus out of the sky)
[23.532,28.4623,39.463]
seem like angles in degrees
well I don't know what rotation system eden uses
you can try this:
_dir = [0, 1, 0];
_up = [0, 0, 1];
{
_dir = [_dir, _x, _forEachIndex] call BIS_fnc_rotateVector3D;
_up = [_up , _x, _forEachIndex] call BIS_fnc_rotateVector3D;
} forEach _thatVector;
that would require me to have the rotation from eden tho no?
I am trying to create the object in eden by getting values of an object placed in zues and then making code to create it in eden at the same position and rotation.
if you have the object itself, you can get its position/direction/etc yourself
that would take a while for 150 objects though thats the pain im trying to avoid
…forEach?
Just be careful. Rotation values in Eden Editor are different from those in Zeus/Scenario
yes ofc... but I mean that code leopard20 gave requires me to have the eden rotation already? "_thatVector" is the eden vector i gave him but I need to acheive it the only way around getting the rotation of the object from zues and create the it in eden so I wont have the eden object rotation
exactly this is what im trying to get around haha
I see
AFAIK all these don't get saved in a mission. You'd want to use the Eden attributes commands for setting up objects in the editor.
…I don't understand your problem here
if you have all the objects in an array, you can use a forEach on them, no need for a "Zeus anything"
I guess he places them in Zeus and wants to import them into eden editor!?!?
I don't know!!1!1§1!
exactly
this
trying to write code to takes objects placed in zues and generate code to place them all in eden
sounds painful - but I'll be off this convo I think
It is applogies for that haha 😅 enjoy your day and thanks for the help
You need to loop through all units / vehicles and get their position and rotation, store them in an array in uiNamespace
Back in Eden you just loop over that array and use set3DENAttribute/s
the issue is rotation and position what command can I use to get it tha will work when pluged into eden rotation attribute.
Just try getPos (don't hit me leo)
for the Eden rotation I am not sure, I guess it's just some fixed offset or something. Trial and error I guess
yeah rotation is the main issue because of how "vectorDir" and "vectorUp" work
its a combination of the 2 vectors to get 1 that wil work in eden lol but I am unsure how to transform them
Yep, I know. No clue why it's different
oh well thank you everyone for the comments its just going to be a big pain of trial and error for a few days 😄
g2g now. Lunch is almost over. Back to work I guess 😩
…use Eden Editor? 😬
runs away
hahahahahahha xD we have a mod that allows players to build in our milsim we have a base building team we want the bases they build to become permanent so not possible but nice try 😉
i need help
I have it working another way but its generated via code in a .sqf file rather than being in eden editor itself just was hoping to add it to eden so we could edit it if we wanted. Seems alot more effort than its worth so I might stick with how it is but thanks for all the help guys.
how do i open the debug menu becuase i close it a while ago and i been trying to search online how to re open it so i can stop infi loading when my friends join me but i cant find anything on how to reopen it
debug console: " ` " or Ctrl+D, depending on if you have CBA loaded
if you mean during a mission, you can't unless you allow it
what about in game does it work bc i use that to open it in the editor but it doesnt load up in the game
if you mean during a mission, you can't unless you allow it
again applogies for the headache ive probably caused but all of you guys are amazing for helping us all out 😄
trying to get all cars that are occupied by players
private _cars = vehicles select { ( fullCrew [_x, "driver", true] ) isNotEqualTo [] };
there are no players ref here?
allPlayers select { not isNull objectParent _x } apply { vehicle _x };
```something like this
iterating vehicles is probably better, then you don't have to filter duplicates
vehicles select {crew _x findIf {isPlayer _x} != -1} 
can i change the locality of a unit, f.e. a tank by using "_tank setOwner 2"?
want to make sure my tank is serverside before the script runs, to avoid any funky stuff
you'd need to run that on tank's driver i think, perhaps using "Local" event handler 🤔
@spark turret cant you just remoteexec the script
it would be… better, yes
otherwise the tank might belong to some player, or you are running a race condition expecting the ownership transfer to happen before you run the other code, etc
can i dump an units loadout into a box
surely the animation for grabbing in crouch class must be a typo?
AmovPknlMstpSnonWnonDnon_AinvPknlMstpSnonWnonDnon_Putdown
or putting and grabbing share the same animation
just made me giggle 
Hey, anyone know how to disable manual respawning via description.ext?
Yes, the wiki 😃
Thank you- I've already been looking through the description.ext article, and since it's quite a long article and I haven't been able to find what I'm looking for in the fifteen or so minutes I've already spent looking, I was hoping some friendly soul here would be able to point me in the right direction to save some valuable free time 🙂
the page is indeed quite big, but
https://community.bistudio.com/wiki/Description.ext#Respawn.2FRevive
there is a full Respawn/Revive section
respawnButton = 0;
```is what you are after
I'm afraid this isn't what I'm looking for- I'm looking for a way to disable manual player respawn (i.e. from the ESC menu screen). There's a setting for it in 3den, but since our group standardizes description.ext for ease of maintenance, I need to figure out the description.ext equivalent
respawnButton
Enable or disable the respawn button in the menu for INSTANT and BASE respawn types.
I don't know what to say…? 😅
Is it possible to tweak existing base game addactions? I'd like to modify an existing action for unload incapacitated, I'm wanting to modify the visual scroll text with a format or outright hide it so i can create my own with the same text and not have redundant addactions.
This one disables the big "RESPAWN" button from the Respawn screen (i.e. while you are dead and waiting to respawn), not the "Respawn" button to kill yourself from the ESC menu while not dead
huh… are you sure about that 
Yes, I've just tested it myself in 3den
With it off, the only option is the ticker for the autorespawn
I'd send screenshots but I can't easily paste in here :/
what is your respawn type? respawn =
respawn = 3
Ah, my idiocy appears to know no bounds
I think you may be right
It was an issue elsewhere in my description.ext file causing issues
no probz, glad it's sorted ^^
Wait no, even more counter-idiocy, as I seem to be right about it, it only changes the big respawn button
That said
I found a workaround for it, so
Problem failed successfully?
Anyhow, thanks for your time and help!
You won't get away that easily!!

You can
So I know there is a way to disable weapon drop on death, But I cant remember how... Any help?
I'm trying to spawn a Fire effects module on an arbitrary position. I'm doing it like this:
private _moduleGroup = createGroup sideLogic;
"ModuleEffectsFire_F" createUnit [
getPosATL o_wreck,
_moduleGroup,
"newUnit = this; this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];"
];```
The module is being created at the appropriate position, but it doesn't seem to create a fire effect. What am I missing?
Maybe you need to set some other parameters via setVariable like most modules? 🤔
I looked at it in the function viewer and it appears to assume a reasonable set of default parameters (the same as it uses when placed in the Editor)
Did you try running the init func manually? 
I was hoping to avoid it. After all, if I have to run it manually, I might as well just use a generic logic and not bother with the module at all :U
Yea but just to see if that's the issue is what i meant
anyone know if its possible to set an init to change an entire factions identity?
or, rather set their speaker to all be the same
Use init.sqf (NOT a unit init field).
For a whole side (east, west, or resistance)
{_x setSpeaker "speaker_name_here"} forEach (units east);```
For a specific faction(s)
```sqf
{_x setSpeaker "speaker_name_here"} forEach (allUnits select {faction _x in ["faction_one","faction_two"]});```
*fixed typo in second one
While trying that, I determined that it works (with or without calling the function explicitly) when executed from the debug console, but not when executed in initServer.sqf, which is what I was initially doing
awesome, thank you
Works when a sleep is added. It must be that the function doesn't work before the mission starts.
Hey, i have a small question regarding sounds / playing sounds in arma.
My Problem: I am trying to recreate the default arma "Play Sound" Zeus Module, because we are using a mod with a ton of ambient sounds for immersion. The default arma sound selection dialog lacks the ability to search for sound by name/classname, so i created a dialog and made the list of all sounds searchable. This works without problems. After selecting a sound, the sound will be attached to the created logic, this also works without any problems. Now my Problem i can't get the sound preview to play while the dialog is open:
I tried: playMusic, playSound and say (i know this is a global function). But the sound is never found. I tried it with the sound-filepath, the name of the class in the CfgSfx.hpp and also the Class of the sound from CfgVehicles.hpp
Is there any possibility to preview the sound to the Zeus User in the dialog? OR Does anybody know how arma previews those sounds? I also thought about creating a temporary soundclass in runtime but i don't know if this would work
SOLVED: We found a solution in the RscAttributesSound.sqf, creating an empty trigger with soundEffect is the solution
Basically yes. If your code is not time-critical and you don't need a value to be returned you can safely let it run scheduled.
Hello, anybody could help me trigger a Task with units under show/hide moduel?
I use triggerActivated to trigger my next Task; however, next task related to hided unit, and it having trouble complete the task
I use this code to finish the task, basicly to destroy a four men crewed tank
and I use "!alive D1 && !alive D2 && !alive D3 && !alive D4; "to complete the task, but it doesn't work. Anybody could help me ?
-1 means all dead?
Hello guys,
I'm trying to play an air raid siren through a large amount of objects (speakers), 20 in total. I'd like to define an array of all the speaker objects which have variables (sp1 to sp20) and then reference this in-game with
playsound3D ["soundfile", object];
I'm guessing that I can reference an array here aswell, right? So it plays from all the objects inside the array.
How do I go about defining that array? What file inside my mission folder do I have to put this? Thank you already for your help 🙂
huh, this is an interesting function, what's it doing, modding or something into server time for a stochastic feeling meter? BIS_fnc_pulsate
https://community.bistudio.com/wiki/BIS_fnc_pulsate
wat?
you don't need an array
since they're named sequentially
for "_i" from 1 to 20 do {
private _obj = missionNamespace getVariable ["sp" + str _i, objNull];
playsound3D ["soundfile", _obj];
}
I wish there is a command to convert string into identifier so bad, when I see such code
you can define your own macro! 😛
#define QUOTE(x) ##x
#define APPEND(x,y) x#y
#define MAKEVAR(x,y) (missionNamespace getVariable QUOTE(APPEND(x,y)))
_obj = MAKEVAR(sp,1)
gniiii
you are the fucking BOMB my man

thank you!!!
Follow-up question, I can do this via zeus so its not big of a deal, but I'm wondering:
I know how to loop a sound indefinitely, but If I'd like to loop a sound maybe 5 times or for a certain amount of seconds, how would I go about that?
for loop
can you go into a little more detail? I dont have much experience with for arguments
...
for "_i" from 1 to 5 do { //5 times
playSound3D ["somefile", _blabla];
sleep _soundDuration;
};
Okay I guess I am acutally stupid. Im really sorry, so bear with me:
I took that code what you wrote and tried incorporating it with the code you posted above and got this
for "_i" from 1 to 20 do {
private _obj = missionNamespace getVariable ["sp" + str _i, objNull];
for "_i" from 1 to 5 do {
playSound3D ["a3\data_f_curator\sound\cfgsounds\air_raid.wss", _obj];
sleep _soundduration;
};
};
because I guess I still have to define the _obj array, correct? Otherwise the game doesn't know what I'm referencing.
But for some reason it plays only once, just like before. Yeah, I don't have much to do with this stuff, I'm sorry.
Wat? _obj is not an array. It's an object. And no, you don't have to touch anything in that part
And you can't do it like that
You have to reverse the two loops
and you have to define sound duration
i think unary getvariable would be a good idea, that would implicitly target current namespace
otherwise maybe some string "variable" interpolation operator(that doesn't actually make a command call in sqf), but that needs extra steps in parser level, and extra behaviour in the inst
Also you have two _is
they're conflicting
it's private to each for scope, no? i think its fine 🤔 not sure though 
The wiki says they can be safely nested without having to worry about recursion
that's not what were talking about
alright alright ill keep my mouth shut 😂
in most languages, what you have will be using the same _i in both loops, meaning both of them will be incrementing it, and causing unexpected behaviour
but in sqf, it might not be the case 
yeah, the _i variable is private to the for scope, and has no influence on the parent scopes
unfortunately, Task trigger can not be activated
any ideas about this one? 'what' exactly does it do? or have I got it more or less accurate?
It's probably used for flickering lights and stuff
Why don't you open it in function viewer?
My guess is that it uses frame no or time
And applies it to a sin, with the requested frequency
my 6th task can not be activated, I guess because I show/hide them, any idea?
triggerActivated does not seemed to work for hide/showed unit
returns: nothing? nonsense...
wat?
so... this is a helpful representation, https://www.imgpaste.net/image/KdCd2z
https://community.bistudio.com/wiki/BIS_fnc_pulsate
Yeah it's a sine wave like I said
right, I'm just wrapping my head around it, what sort of applications it might have, i.e. a stochastic period in which to trigger some event, action, etc...
you can use it for flickering/pulsating stuff, using a sine wave, based on time
if you don't know how that's useful you don't need it 
sure, it's one of those things; if you don't know you have a tool, you don't know what you don't know. anyway, thanks...
Well, triggerActivated only works with Triggers 
So i have a script that does vinilla damage and I was wondering how I could tell it to do ace damage
anything see obviously wrong with this script? it's supposed to make a progress bar ctrl if it doesn't exist and then set it to the passed progress amount, then set it back to 0 once the player is far enough away from a position
params ["_progress", "_position", "_distance"];
disableSerialization;
private _bar = uiNamespace getVariable "capture_bar";
if (isNil "_bar") then {
disableSerialization;
bar = findDisplay 46 ctrlCreate ["RscProgress", -1];
uiNamespace setVariable ["capture_bar", bar];
bar ctrlSetPosition [safeZoneX, safezoneY + safezoneH * 0.02, safezoneW, safezoneH * 0.01];
bar ctrlCommit 0;
bar progressSetPosition 0.0;
};
_bar = uiNamespace getVariable "capture_bar";
_bar progressSetPosition _progress;
private _waiting_on_obj_leave = uiNamespace getVariable ["in_obj", false];
if !(_waiting_on_obj_leave) then {
[_position, _distance, _bar] spawn {
params ["_position", "_distance", "_bar"];
disableSerialization;
uiNamespace setVariable ["in_obj", true];
while {((position player) distance _position) < _distance} do {
sleep 1;
};
_bar progressSetPosition 0.0;
uiNamespace setVariable ["in_obj", false];
};
};
uiNamespace setvariable ["capture_bar", nil];
ctrlDelete _bar;```
Hi guys I feel im being dumb here 😅
When do objects from the eden editor exist before or after the initServer.sqf? I have the below code which works except the "MHQ1StartPos" and "MHQ1StartDir" are empty but running the same code in debug it works. So the issue is the variable not getting the value.
MHQ1StartPos = getPos MHQ1;
MHQ1StartDir = getDir MHQ1;
[myPole, ["Return MHQ 1 to Base", {MHQ1 setPos (_this select 3 select 0); MHQ1 setDir (_this select 3 select 1);}, [MHQ1StartPos, MHQ1StartDir]]] remoteExecCall ["addAction", 0, true];
from the below link I think its before but the variable are still empty.
Quick question. If I have the server assign a variable to a player (_player setVariable ["blah_blah", "some-value"), could the client (using a script mod) also check this by using player getVariable "blah_blah"?
yes, if set publicly
_unit setVariable ["name", "value"]; // local
_unit setVariable ["name", "value", true]; // publicly set, on all machines and future JIP
Thanks I'll give this a try. Much appreciated
Objects placed in the Editor do exist when initServer.sqf is executed. Your MHQ1Start* variables only exist on the server (because initServer.sqf only runs on the server), but as far as I can think of right now, the remoteExecCall statement should still work.
how would I get the amount of cargo seats from the config of a vehicle I tried
_TotalSeats = count (getArray (configfile >> "CfgVehicles" >> _VehType >> "cargoProxyIndexes"));
however for some vehicles for example the CUP CH-47 returns []
the alternative syntax offers an includeEmpty parameter
private _cargoSeatsNum = count fullCrew [_myCH47, "cargo", true];
```perhaps
you have to create the vehicle keep that in mind(unless u already have it created), i think ace or cba does something like that
No dice on my end. Any chance you could look over this and see if I'm missing something? I'm stepping into the unknown here. Any help would be greatly appreciated
Client side SQF (in a mod, in the postInit)
if(isNil { player getVariable "_testVariable" }) then {
// Logic
};
Server side (in initPlayerLocal.sqf (in the mpMissions folder))
params ["_playerUnit", "_didJIP"];
_playerUnit setVariable["_testVariable", "testing", true];
initPlayerLocal.sqf is not server, initServer.sqf is
that's more of a #arma3_config thing @misty quail
rgr @winter rose thank you
it shouldnt matter that the values are only avaiable server side right? Because they are passed in as parameters to the remote execute so it should have them?
Does anyone know a good persistent save script out there ( for mp dedicated server )
Why can’t you use the built in save system
Any idea why loading triggers from a sqf automatically trigger?
I want it to be automatic so after every 6 hours restart the player gear position base and car will saved
That's mission-dependent then, and no "does-it-all" script can know and do all this
_obj2 in not at [0,0,0], but at the end of the code _obj1 can be in [0,0,0]. It happens sometimes.
//SHCEDULED CODE
_obj1 setPosASL getPosASL _obj2;
deleteVehicle _obj2;
```Scheduled code.
Like if line one was _obj1 setPosASL getPosASL objNull.
sorry, is it a question, an answer to someone, ?
@winter rose no, i'm just talking about this strange thing i found.
Btw, i'm not sure.
anyone know why the transport unload waypoint isn't work with groups created with BIS_fnc_SpawnGroup
are you sure that _obj2 cannot be null there? if its scheduled, you can have various race conditions
@copper raven i will check it better.
It has nothing to do with how the group was created. You're doing something else wrong
are you sure because I tried adding the waypoint with a group added in the editor and it worked
yes
Say what?
this works, but im trying to set it so it runs with CuratorObjectPlaced, dont really know what im doing so it isnt working
this addEventHandler ['CuratorObjectPlaced',{_x setSpeaker "ENG5"} forEach (allUnits select {faction _x in ["I_AGR_SC"]})];
I have an sqf that loads on select from strategic map but when it loads, the triggers inside the sqf instantly trigger causing events to occur even when they don't meet the criteria
You need 3 ` for code blocks
Making it work with curatorObjectPlaced is more complex than I want to type on my phone, but in short:
- curatorObjectPlaced gives you a reference to the unit placed, so you don't need to run the command for every unit every time (you could but it's wasteful)
- curatorObjectPlaced only triggers on the curator client, but setSpeaker needs to be run on every client, so you need remoteExec
this is good info ty
_BossMech setPosWorld (_p1 vectorAdd (_p1 vectorFromTo _p2 vectorMultiply (_LowSpeed*diag_deltaTime)));
So when I call this within a loop function. I am getting odd behaviour.
The best way to describe this behaviour is processed by a demon. it does not go after the player like I want to instead it hovers the ground. actually when I hit escape key to bring up the debug I notice it kind of shifts or i guess tps a few inchs to the left or the right.
_p1 = getPosWorld _BossMech; _p2 = eyePos player; I have these that interact if that helps understand what I am trying to achieve.
you must have done something wrong
As far as I'm aware, that should be correct.
If you had done ...
[myPole, ["Return MHQ 1 to Base", { MHQ1 setPos MHQ1StartPos; MHQ1 setDir MHQ1StartDir; }]] remoteExecCall ["addAction", 0, true];
```... it would be a problem, because the `MHQ1Start*` variables would be resolved on the client (where they don't exist).
But the way you've done it seems correct to me, the variables should all be resolved on the server.
What kind of loop?
you must use a per frame loop
Also use getPosWorldVisual
While loop with true
well that's one problem then
the other is getPosWorld
like I said it should be getPosWorldVisual
ok so here is what I have.
_Passes = _Passes + 1;
systemChat str _Passes;
_LowSpeed = 0.01;
_p1 = getPosWorldVisual _BossMech;
_p2 = eyePos player;
_BossMech setPosWorld (_p1 vectorAdd (_p1 vectorFromTo _p2 vectorMultiply (_LowSpeed*diag_deltaTime)));
};
that's terrible
is it?
never use a while loop without sleep
and a while loop is not suitable here
as I said already
yeah but this is going to be call exec
yeah but sleep doesn't work with call
also if it was unscheduled your object wouldn't move at all
it can
how?
no
Where code starts scheduled
init.sqf initServer.sqf initPlayerLocal.sqf initPlayerServer.sqf functions with postInit attribute (although suspension is allowed, any long term suspension will halt the mission loading until suspension has finished) code executed with spawn code executed with execVM code executed with exec code executed with **call from a scheduled environment**
Where code starts unscheduled
Debug Console Triggers Waypoints (condition and activation) All pre-init code executions including functions with preInit attribute FSM conditions Event Handlers on units and in GUI EachFrame code (Event Handler / Scripted EH / onEachFrame) Object initialization fields Expressions of Eden Editor entity/mission attributes Code execution with **call from an unscheduled environment** Code executed with remoteExecCall Code inside isNil SQF code called from SQS code Conversation Event Handler Code inside collect3DENHistory
I think I understand. so my use case is to have the _BossMech move directly to a player, this is called when a script calls this script/function.
this is unscheduled yeah?
oh so when the while is on the game stops if it was unscheduled.
that would be true, but while in unscheduled can only run up to 10000 times
so it would eventually end
but your game would freeze for a second or so until the while is done
anyway, you should use an EachFrame EH, like this:
https://community.bistudio.com/wiki/BIS_fnc_addStackedEventHandler
["boss_move_EH", "onEachFrame", {
params ["_player", "_BossMech"];
_LowSpeed = 0.01;
_p1 = getPosWorldVisual _BossMech;
_p2 = eyePos _player;
_BossMech setPosWorld (_p1 vectorAdd (_p1 vectorFromTo _p2 vectorMultiply (_LowSpeed*diag_deltaTime)));
}, [player, _BossMech]] call BIS_fnc_addStackedEventHandler
yes, if you execute it locally
ok. what kind of effect that would have if say I have 20 players on?
and would it sync?
wdym? performance wise?
yes
that too
lol, the script is making me surf.
I'm creating a sector control King of the Hill game that counts up, not down (since it ending the game on 0 tickets is breaking my dedicated server)
One element of the game mode is when you capture the point the enemy team loses 50 tickets. (there is only east and west)
||it's a dumb gamemode that's meant to go on for hours||
I want to run this on a sector's expression parameter but I'm lacking any examples for formatting and I'm not quite sure how I should lay it out.
if (_this #2 == west && [west,0] call BIS_fnc_respawnTickets >= 51) //if the previous owner was west, and they have more than 51 tickets
{
[west, -50] call BIS_fnc_respawnTickets; //remove 50 tickets from west
};
if else (_this #2 == east && [east,0] call BIS_fnc_respawnTickets >= 51) //if the previous owner was west, and they have more than 51 tickets
{
[east, -50] call BIS_fnc_respawnTickets; //remove 50 tickets from east
};
else
{
// I'm not quite sure if I need to put anything here if I want nothing to happen
};
what on earth is that? 
i know haha
if (_this #2 == west && {[west, 0] call BIS_fnc_respawnTickets > 50}) exitWith //if the previous owner was west, and they have more than 51 tickets
{
[west, -50] call BIS_fnc_respawnTickets; //remove 50 tickets from west
};
if else (_this #2 == east && {[east, 0] call BIS_fnc_respawnTickets > 50}) exitWith //if the previous owner was west, and they have more than 51 tickets
{
[east, -50] call BIS_fnc_respawnTickets; //remove 50 tickets from east
};
Now the mech isn't moving at all
if else
throwing me a missing ";"
just deleted you comments and put the code in incase it tried to read them, this is a copy paste of what's in the expression field. I'll be real it doesn't look like it is missing any hmmmm
if (_this #2 == west && {[west, 0] call BIS_fnc_respawnTickets > 50}) exitWith
{
[west, -50] call BIS_fnc_respawnTickets;
};
if else (_this #2 == east && {[east, 0] call BIS_fnc_respawnTickets > 50}) exitWith
{
[east, -50] call BIS_fnc_respawnTickets;
};
dafuq @cosmic lichen 😄 ☕
edit: ah, was not your own code to begin with 😄
if (...) then
{
...
}
else
{
...
};
```@torpid quartz
giving it a try now
ok works with just the else statement, however it doesn't have the safety net then of the check to make sure the other team has at least 50 tickets before it takes them away. (also i now see i have it checking the wrong side when it's doing the ticket check lol) wait no i didn't lol
So i do need to do an else if check still.
i'll just add another "else" after the else if with nothing in it and see if that's good one moment
no
stop
no
please
aw it didn't work lol
if (_this select 2 == west && { [west, 0] call BIS_fnc_respawnTickets > 50 }) exitWith
{
[west, -50] call BIS_fnc_respawnTickets;
};
if (_this select 2 == east && { [east, 0] call BIS_fnc_respawnTickets > 50 }) exitWith
{
[east, -50] call BIS_fnc_respawnTickets;
};
(the pound sign # is greying out Discord's syntax highlighting btw)
only while typing... 
stoopid Discord is stoopid anyway
by joe it works.
Once again I owe you my life.
||I really really need to go and learn how to use that colour feature with code lol||
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Good thing you solved it @winter rose 😄
Hey how do I get a thing to look directly at another thing?
setVectorDirAndUp
if you mean "face" another thing
Is there any way to use the Zeus "Custom Objective"-screen in the High Command onTaskCreated code?
https://community.bistudio.com/wiki/Arma_3:_High_Command#Code_for_Create_Task
okthnxbai! 👋
anyway jokes aside, what's wrong with it?

