#arma3_scripting
1 messages Β· Page 29 of 1
Hm, not sure
should be logging something
unless _art_object_name isn't an object or some other condition is wrong
i cant get the minigun memory point for the qilin can anyone help
The Nearby Units: B Alpha 1-2:1 is working fine as it picks up the unit in the radius - the allowdamage is where the problem lies
@tough abyss so the issue with AI teleporting happens regardless of whether or not I'm in the same squad as them, in SP or MP. the function is called as:
ace_player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
if (_muzzle isEqualTo "Six12th_GravityGrenade_Muzzle") exitWith {
_projectile addEventHandler ["Deleted", {
params ["_entity"];
{
//_x allowDamage false;
_x setPosASL (getPosASL _x vectorAdd [0,0,0.1]);
[_x, _entity, (_x distance _entity)] call Six12th_fnc_setVelToward;
} forEach nearestObjects [_entity, ["Man"], 10];
}]
};}]``` with just the if check copy pasted for antigrav grenade at the moment but the away function where I just switch some of the object variables around so they're propelled away
Also happens regardless of how many entities are influenced by the grenade so it's not an issue with the number of them π€
Just checked, it's not a mod conflict either
This has the allowDamage true being done immediately after the bomb is created. Is it possible this is simply arriving before the bomb actually detonates?
Also, if I'm reading this correctly, this code doesn't do any damage handling if _isLethal is passed as false (presumably allowing the bomb to be lethal), and does do damage handling if _isLethal is passed as true (presumably causing the bomb to be not lethal). So _isLethal being true means a non-lethal bomb and _isLethal being false means a lethal bomb. This isn't strictly broken code but it is counterintuitive and could cause problems later.
It was just a cleaned up version of what he already posted, wasn't trying to do major improvements
it likely has some issues like what you describe
I mentioned that message because it's the latest version of the code and I assume that's what they're currently using, not because I'm trying to critique your input
Mhm, good points
@sullen sigil switch your if statement from if !(_islethal) to if (_islethal)
Hm?
Wrong person, that's not me :p
oh my bad
@finite bone I think
getting mixed up, no sleep, apologies
Yeah no worries man lol
Try switching from if !(_islethal) to if(_islethal)
@sullen sigil As for your issue, try changing the remoteExec in the setVelToward code to remoteExecCall
shouldn't really matter but meh
then again we already fixed it for locality so shouldn't be the problem
In SP all the units should be local, right?
yup
I'll throw a systemchat into the local one
Yup, it's just setvelocity on them as intended π€
It's not an issue with using call for the function instead of anything else, is it?
The issue happens for both, anti-grav just demonstrates it better
Because obviously with grav they're all bunched together :p
Fair enough
I have a feeling it may have something to do with them being AI
Does the same thing happen when it does it to you?
Nope, though it also doesn't happen to AI who are in a squad by themselves as far as I can tell now
Yup, split them all of into squads and it doesn't happen whatsoever now
May be something to do with their formation then, if I had to guess
They are on careless AI π€
no fucking way
Think it was because they were on careless
Yup, not happening at all now
Is there any way to test the locality bits without having to update dedi server etc
Nothing will give you realistic results other than doing actual dedi testing
local MP behaves differently
Yeah, fair
Oh wait I would need someone else to place AI with zeus wouldn't I
or just put them down on the mission file initially
Can also just spawn them serverside w/ debug console and server exec
I have no idea how to grab debug console in dedi server
Yeah, I'll have to do that then once I update this and my medical pbo
Debug console availability is controlled per-mission by the Attributes:General:States section in the Editor. It's set to Editor-only by default.
Need fancy noises now too
Ah, I'll change that then, thanks π
Works perfectly now :)
Very nice
Q: about BIS_fnc_sortBy... re: parameters...
According to the docs, these are relayed magically using variables _input0, _input1, and so on, to the algorithm, correct?
Are they also relayed in the usual params manner?
Are they also relayed to the filter in the same manner?
https://community.bistudio.com/wiki/BIS_fnc_sortBy
https://community.bistudio.com/wiki/params
Thanks...
Unrelated question, if I want to find out whether the object is 'valid', i.e. created on a MP server, i.e. machine ID 2, that would be owner _object == 2, correct? And perhaps some other criteria involving a mix of hasInterface, isServer, or what not.
if isServer && local obj
something like that
because owner is a server-side command iirc
can I add a check box attribute to an object in zeus via mission sqf code?
i doubt it
They are relayed through the magic variables for both algorithm and filter. You can get them through _this, but they aren't passed in the manner you'd expect if using params.
If you use _this in the algorithm or filter, it's actually the full parameters that you passed to BIS_fnc_sortBy, not just the magic vars
So if you want to put the magic vars you passed through params, you'll need to do (_this#1) params [...];
ive removed that check entirely to see if thats the problem and no
the logic works fine
with code, it's possible with a hacky ui approach
but mod is the proper way
sync if you mean with the editor sync thing, no
Latest code?
oh wait, what about if I make the game logic items be 'replaced' by markers-
so in other words, the parameters as a unit is passed as the second argument... got it. thank you.
wait
?
hey
any one knows how to make capture a point script?
trying to make a multiplayer scenario where if blufor stands on the opfor's base for 5 minutes the marker on the map changes to blue
from red
and the scenario will be with zeus
so im trying to make a button that makes the zones change
so i made this
this addAction ["changecolor", marker1 setMarkerColor "ColorRed"];
and it just doesn't work
Because that's invalid use of addAction
check the syntax, the code to run needs to be in {}
It shows an error
m1 is the name of the marker
The setMarkerColor code
what?
mhm
undifined variuable expresion
maybe you didnt change the name of the marker to marker1π€·ββοΈ
well i created just now a marker that is named marker1
and it says there is no marker1
and that it misses }
What's the code currently
this but change ColorRed to ColorBlue
nvm
its just the code above
And marker2 exists?
well that's why your code is complaining about marker2 not existing
because it doesn't exist
lol
marker name in quotes
i didnt know arma could show errors like that
i don't have an object yet. π
_icon = (getTextRaw (configFile >> "CfgMarkers" >> _markerClass >> "icon"));
if(count _icon == 0)then{
_icon = _markerClass;
};
I think this might work tho
Ok, and in theory, I can pass "" to the _markerClass and just have text if I want to have text without a marker
What are you drying to achieve ?
hey everyone, I have a dumb problem that I can't solve because I'm not experienced in arma3 scripting.
I want to make a super simple "kill every player that is out of a trigger zone" trigger. So I created a trigger:
type: none
activation: any player
activation type: not present
repeatable
condition: this
on activation:
hint format ["%1", thisList];
{_x setDamage 1} forEach thisList;
When I leave the trigger area I get the hint (so trigger works) but thisList is an empty array so I'm not being killed (that's my guess)
How do I fix this? Thanks in advance!
Have you checked what it outputs when there's one player in the zone and one out?
thisList is a list of objects in the trigger
oh, got you thanks. Is there any way to reference something that triggered that trigger?
private _headlessClients = entities "HeadlessClient_F";
private _humanPlayers = allPlayers - _headlessClients;
{_humanPlayers deleteAt (_humanPlayers find _x)} forEach thisList;
{_x setDamage 1} forEach _humanPlayers;
place this on activation, and change the activation type to present.
Could simplify to allPlayers - (entities "HeadlessClient_F") - thisList
Is there a way to give a turret of a helicopter a turret stabiliser?
I know you can give different weapons but idk what the stabiliser classifies as
Didn't work.
This time thisList is not empty and contains my id (or whatever that bis_o2_somenumbers means) every time I enter the trigger area, but I'm not dying. I think that it doesn't work because trigger cannot be activated when you leave the trigger area as the only player. And if you go back and activate it you won't die either because , well, you are back in the area.
I guess I'll do something like a while loop based on your piece of code. Thanks guys
not present should work with that code, assuming that it triggers when players are outside and thisList contains players who are inside.
Which is pretty weird behaviour, but hey, it's Arma.
But I wouldn't put you off the while loop solution.
It does work with activation type "not present" and my brain is totally confused rn, because thisList is empty when I leave the trigger area.
I'm guessing that if there's one player in and one player out, thisList contains the players in the area, even if the activation type is "not present".
Whether the turret has stabilisation is controlled by the turret's config, which can't be changed by scripting.
If it has a "pilot camera stabiliser" (that is, the ability to lock on to a point on the ground, like a targeting pod camera) then you can turn that off and on using enableDirectionStabilization - but only if that property is set up in the config. If it doesn't have one in config you can't turn it on.
thank you
Again a sound related question, I try to make the radioman emit radio sounds when he is browsing the map, so I thought I could use visibleMap, however it did not work, and when Iβm opening the map with the wiki line nothing happens;
if (visibleMap) then {hint βtestβ};
this script is one-time event only; you may want to add a map event for the game to run a script at that moment
Ah I have this in the player init
yeah nope, this ^ code will only check if the player has the map open right at the beginning (which he won't)
params ["_mapIsOpened", "_mapIsForced"];
if (_mapIsOpened) then
[] spawn {
waitUntil {
rto playSound3D "radio_noise.ogg"
};
};
}];```
Something like this? @winter rose
almost
addMissionEventHandler ["Map", {
params ["_mapIsOpened", "_mapIsForced"];
if (!_mapIsOpened) exitWith {};
rto say "radio_noise.ogg";
}];
```note that this will make `rto` say that sound **once** every time the map is opened π¬
Yea I'm using quite a long sound from the SOG dlc
the sound won't stop when you close the map
I don't think there is an event handler for when a player opens the support tab?
that I don't know
Ah I hoped that with waitUntil it would stop when the map is closed
nope
If I'm correct I need to add rto in front of addMissionEventHandler to make sure it only triggers when the rto opens the map?
no.
addMissionEventHandler ["Map", {
params ["_mapIsOpened", "_mapIsForced"];
if (_mapIsOpened) then
{
STRUDEL_RadioSource = rto say "radio_noise.ogg";
}
else // map is closed
{
if (not isNil "STRUDEL_RadioSource") then
{
deleteVehicle STRUDEL_RadioSource;
STRUDEL_RadioSource = nil;
};
};
}];
if that's a MP thing, it will be a tad more complex I'm afraid.
It will be a hosted MP, I think I'll tell the RTO to use a scroll menu action to make some noise while calling in supports π
Perhaps I can try to achieve a similar effect by putting something in the support requester module, Iβll try that tomorrow
I joined the discord just to ask this, haha.
I'm getting frustrated with the online documentation for a lot of the scripting, which, while useful much of the time, has a tendency of only being willing to meet you halfway if you're trying to figure out how things work.
I've been figuring things out fine, except for one thing: Zeus can see itself (or rather, its virtual entity), and as the mission I'm making is a customised Zeus sandbox for me to run ops for some friends, having a giant red and grey splotch on my screen when I'm trying to work on things will be a massive pain :P
So here's the situation: I have a virtual Zeus entity called corp and a Game Master module called corp_gm. I've been trying to run removeCuratorEditableObjects on corp so that it doesn't appear from the curator view, but to no success. So far, I've been running variations on this removeCuratorEditableObjects [[this], true]; in the corp init (using Eden), though I've also tried replacing the first this at the start of the line with corp_gm in case I was referring to the wrong object. None of this has worked, and infuriatingly, I haven't been getting any forms of error or feedback when running the mission as a test instance, regardless of what I put in there, so I have no idea what to change or where.
No amount of Googling has ever let me find a single other person who is trying to make it so Zeus can't see themselves, so I must ask for help myself. What am I doing wrong orz
@twin heron how about corp removeCuratorEditableObjects [[corp], true];
In the corp init? I'll try, though I'd imagine it'd have the same results as this, no?
Still visible, unfortunately.
How about the original code but with
Actually, no
Let's try this
[this] spawn {
(_this#0) removeCuratorEditableObjects [[_this#0], true];
};
Trying now. I admit I don't know the syntax you're using here, especially this#0.
[this] spawn {
params ["_obj"];
waitUntil {!isNull _obj};
_obj removeCuratorEditableObjects [[_obj], true];
};
Still no dice with this one.
Hm
Really wish BI let us crack open the premade Zeus sandboxes so we could see the way they implement everything. Would make it far faster, haha.
I know you can decompile it through some means, but it's not the same
Okay, thank you!
No problem
@twin heron This should work, in corp_gm's init
this spawn {
private _editableCurators = [];
waitUntil {
_editableCurators = (curatorEditableObjects _this) select {_x isKindOf "VirtualCurator_F"};
count _editableCurators != 0
};
_this removeCuratorEditableObjects [_editableCurators, true];
};
It's beautiful.
Thank you so much.
Do you think it wasn't removing properly because the objects initialised at slightly different times so it never quite executed right?
The closest thing to working was corp_gm removeCuratorEditableObjects [[corp], true];
but yes, it has to do w/ initialization times
curators can't edit virtual curators by default, something else is adding it to the editable objects
so this just waits for it to appear and removes it
I think ZEN automatically adds all playable entities + vehicles into the Zeus editable list - I remember a few years ago when messing around I had the same issues, though back then I used Achilles.
Well there you go, then
Indeed. Just a hypothesis really, though it would explain it handily.
Thanks again, I am finally at peace!
No problem, glad I could help
Hello guys,
Is there any way to disable the nvgs overlay p3d so I can load custom overlays with titles?
I wish to avoid creating inherited nvgs just to change the overlay π¦
or if nightVision action can be overrode, how to do it?
It seems like using the addAction method having the shortcut as the action name doesnt work for it like it does for defaultAction
or if nightVision action can be overrode, how to do it?
Are you trying to "skip over" Night Vision, or just overwrite it when it's activated?
I experimented with just this today and yesterday to remove FLIR without changing equipment in a mission, so I can help somewhat depending on what you need.
I guess overwrite it is the best answer here, the purpose is to avoid getting the overlay itself, and if I have to do my own nvg effects im down for that, I actually have functional scripted nvgs right now, but I have the issue of the action itself, I want to be able to either disable the action/replace it with mine or remove the overlay
Hmm, I haven't found a way to prevent the action from switching layers at all, but if it's something simple you want to overwrite it with, you could use a Draw3D handler?
Something like
{
if (currentVisionMode player == 1) then
{
if (isNil "MyOverlay") then
{
"MyOverlay" cutText ["PLACEHOLDER NIGHTVISION", "BLACK", 0.001, false];
MyOverlay = true;
};
}
else
{
if (!isNil "MyOverlay") then
{
"MyOverlay" cutText ["", "PLAIN", 0.001, false];
MyOverlay = nil;
};
};
}];```
i wonder if you can actually overwrite the action itself by defining another action in cfgActions with the same shortcut
I think the most likely outcome would be that both take effect at once.
Which isn't a bad thing.
The end result of aforementioned experiments was finding a way to 'undo' FLIRs, so mixing a "no NVGs" script with that outcome would be a fine way to do it IMO.
so what this does is just intercept everything drawn until you change the nv mode?
wouldn't it be better to actually use the nv eventhandler itself?
I don't know if you can inject code into the NV eventhandler TBH, I never got that far
I know that the code I use is
while {playerside == west} do {
waitUntil {sleep 0.1; currentVisionMode player > 1};
player action ["nvGogglesOff", player]
};
};```
Which can be trivially repurposed for "ignoring" NV if you want to overload the action, but it *does* draw a few frames of NV first of course since it only checks once every 0.1 seconds.
you can, im actually applying my changes like that, im just missing the removal of the mf overlay
this is not effective, as it actually fires the nv eventhandlers
Yeah, I never figured out intercepting the actual event firing.
No problem, sorry I couldn't help more effectively~
so this code spawns a helicopter in the air with a crew and its own group, it has a seperate group inside of it (in this case just one rifleman), well iam trying to get the helicopter land at the helipad "land2" but it just gets close above and wont land on it π¦
_crw = createVehicleCrew _veh;
_wp1 = _crw addWaypoint [getPos land1, 0];
_wp1 setWaypointType "TR UNLOAD";
_rfl =[getPosATL spawn2, west, []]call BIS_fnc_spawnGroup;
"vn_b_men_army_15" createUnit [getPosATL spawn2, _rfl, "myUnit = this"];
myUnit moveInAny _veh;
_wp2 = _rfl addWaypoint [getmarkerpos "wp1", 0];
_wp2 setWaypointType "MOVE";
_wp2 setWaypointBehaviour"AWARE";
any idea what it could be?
or does _wp1 setWaypointType "TR UNLOAD"; not include landing?
thanks!
_crw = createVehicleCrew _veh;
_rfl =[getPosATL spawn2, west, []]call BIS_fnc_spawnGroup;
"vn_b_men_army_15" createUnit [getPosATL spawn2, _rfl, "myUnit = this"];
myUnit moveInAny _veh;
_wp2 = _crw addWaypoint [getmarkerpos "approach1", 0]; //_wp2 setWaypointType "TR UNLOAD";
_wp1 = _rfl addWaypoint [getmarkerpos "wp1", 0];
_wp1 setWaypointType "SAD";
waitUntil {getpos _veh inArea [getPosATL land1, 300, 300, 500, false, -1]};
_veh land "GET OUT";
waitUntil {getpos _veh inArea [getPosATL land1, 2, 2, 1, false, -1]};
_rfl leaveVehicle _veh;
_wp3 = _crw addWaypoint [getPosATL spawn2, 0];
//moveOut myUnit;
waitUntil {getpos _veh inArea [getpos spawn2, 100, 100, 500, false, -1]};
deleteVehicleCrew _veh;
deleteVehicle _veh;```
made it work, if anyone cares π
kudos for that's very kind of you to post the solution, to not be a "yes I fixed it" without explaining! π
Why does this always give constant damage to all hitpoints even with randomization present in the loop?
_vehicle = _x;
_damage = random(_max_damage);
_vichitpoints = getAllHitPointsDamage _vehicle; _vichitpoints = _vichitpoints select 0;
{
_damage = random(_max_damage);
_vehicle setHitPointDamage [_x, (_vehicle getHitPointDamage _x) + _damage];
} foreach _vichitpoints;
does randomize alright on my machine. What vehicle are you running this on?
is _vehicle local to the executing machine?
yes
{
if ((_x isKindOf "LandVehicle") or (_x isKindOf "Air")) then
{
_vehicle = _x;
_damage = random(_max_damage);
_vichitpoints = getAllHitPointsDamage _vehicle; _vichitpoints = _vichitpoints select 0;
{
_damage = random(_max_damage);
_vehicle setHitPointDamage [_x, (_vehicle getHitPointDamage _x) + _damage];
} foreach _vichitpoints;
_vehicle setdamage (damage _vehicle + _max_damage);
};
} foreach _nearbyunits;
``` could it be that this => ``_vehicle setdamage (damage _vehicle + _max_damage); `` overwrites the random damage?
yes
why do you setDamage there anyway? the hitpoint calculation is totally pointless then, as setDamage does it's own whatever stuff on hitpoints
because sometimes the hitpoints damage does not reflect the 'damaged' state of the vehicle
it still looks 'fresh'
then set the hitpoints that "show" damage the most to max damage
usually its the HitHull in vanilla vehicles
Gotcha
I added to my addAction the animations in order but I needed the character during the animation attachTo object "keyboard_hack" but after animation list done player stuck attachEd to keyboard any way to disable it after animation done?
Code:
this addAction ["Hack",{truck5 removeAction (_this select 2);
player attachTo [keyboard_hack, [0,-0.59,-0.9]];
player switchMove "Acts_Accessing_Computer_in";
sleep 0.8;
player switchMove "Acts_Accessing_Computer_loop";
sleep 10;
player switchMove "Acts_Accessing_Computer_Out_short";
}];
Thanks, and i tried to find keyboard animations without a weapon, do they exist or are they only with a weapon in hand?
what's the difference between the init in the eden editor mission attributes and the init.sqf?
Expressions of Eden Editor scenario attributes are called oh I didn't see that one xD
How'd you apply ace damage to parachuting units?
get the passenger of the parachute then apply normally
i have a question of my own now
is there any way to either change or hide the reticule on players' optics via scripting
Hello all. After much googling, searching on this server and asking others I am posting this.
I am trying to set up a system in which a person who is loaded into a medevac helicopter receives a full ACE heal after 30 seconds. I keep running into issues trying to get it to work.
No heal happens when I enter the vehicle and upon loading into the mission I see the hint pop up despite not being anywhere near the helicopter.
Any suggestions?
sleep 30;
can't suspend in unscheduled https://community.bistudio.com/wiki/Scheduler
foreach thislist;
do you definethisListanywhere?
_x call ace_medical_treatment_fnc_fullHealLocal
if this is for a MP scenario, this is wrong, you need to run that where_xis local
I do not. The thisList works on triggers and the such. Should I change it to fullCrew?
Sounds good, I appreciate the help. I will look at the scheduler. In the meantime does the getIn function work if you ace load a patient in? Or would I need another action there. Searching through the ace side atm but haven't found anything in particular
they use the moveInXX commands, i'm not sure what events fire for what, you can add an event handler to this event though https://github.com/acemod/ACE3/blob/master/addons/common/functions/fnc_loadPerson.sqf#L45
(fires locally)
Looks good. Thank you for the resources bud, this has been stumping me for half of the day.
Hi, is there a way to change the owner of an unit without a bug that remove every items this unit had ? Because sometimes when i'm changing the owner of an unit like this : ```sqf
[(group (_unit)), 2] remoteExecCall ["setGroupOwner", 2, false];
sometimes the units in the group have their inventory completely cleared so is there a way to avoid that ?
oh yeah thank you. I checked the notes of the "setOwner" but not the group owner so yeah thank you a lot π
I usually do while loop, this will however stop after 10 000 iterations. I am trying to keep sleep 1 for counters inside loop. Can I rewrite this to something that will last more than 10 000 iterations ? maybe infinite for loop, keeping alive player condition ?
while { alive player } do
{
// do stuff
sleep 1;
};
10k sounds like unscheduled looping limit, but if it is in unscheduled - then it will pop error/warning at sleep π€
my bad, read it wrong in wiki, in scheduled there is no limit
is there a cleaner way I can write this?
units hyp_opf_sf_1 findIf {
private _unit = _x;
["exfil_1", "exfil_2", "exfil_3", "exfil_4"] findIf {
_unit distance getMarkerPos _x <= 50
} != -1
} != -1 &&
"exfiltrate" call BIS_fnc_taskExists;
Better than the double loop:
["exfil_1", "exfil_2", "exfil_3", "exfil_4"] findIf {
units hyp_opf_sf_1 inAreaArray [markerPos _x, 50, 50] isNotEqualTo [];
} != -1
2d distance by default, change it if you need to.
tyty
disregard me, i've misread the code
oh, my code missed an actual condition :P
its alright, got the idea
also check task first, then lazy eval the other part
What would be a good way to pass an object from an addaction within an addaction without creating a variable for the object? Is there a pipeline type concept within SQF?
this addAction [
"Put Safety Flag on Back", {
params ["_target", "_caller", "_actionId", "_arguments"];
_target attachTo [player, [0.1, 0.35, 2.9]];
_flag = _this;
[_flag] spawn {
player addAction [
"Detach Flag", {
params ["_target", "_caller", "_actionId", "_arguments", "_flag"];
_flag attachTo [player, [0.1, -0.35, 2.9]];
detach _flag;
player removeaction _actionId;
}
];
};
}
];```
Can we call a function when a vanilla keybind (like binoculars) is pressed so we can avoid hardcoding keybind fixes to vanilla systems?
Hey, I am receiving an error message that I don't understand:
private _newPosition = selectBestPlaces [(leader reconGroup) getPos [_maxDistanceToMove / 4, _directionFromTarget - 180], 50, "forest + 2*trees", 5, 5];
private _waypoint = [(_newPosition # 0) # 0, (_newPosition # 0) # 1, 0];
systemChat format ["Unable to see target. Moving %1 meters to %2 to get a better view", (leader reconGroup) distance _waypoint, mapGridPosition _waypoint];
Error:
23:11:52 Error in expression <get a better view", (leader reconGroup) distance _waypoint, mapGridPosition _way>
23:11:52 Error position: <distance _waypoint, mapGridPosition _way>
23:11:52 Error Type Array, expected Number
You can use actionKeys to get the user's keybind dynamically.
Perfect, thank you!
Use systemChat str _newPosition to see that _newPosition is something like [[[0, 0], 0], [[1, 1], 1]], so you need to do more # in the private _waypoint = ... expression.
https://community.bistudio.com/wiki/addAction
Use the arguments parameter.
I wanna be able to land or park a certain vehicle in or a landing pad and then be able to use a set piece (like a console or computer you have to walk up too) to delete it, Does anyone know any scripts like that?
(Context: im using spyder addons to spawn the vehicles now i want something i can do to delete the vehicles if brought back to the same location)
Like a script or something set to a computer or crate
If you know the position of the landing pad then use addAction with nearestObjects for your effect
How then do I get it to delete it? my bad just new at this
And do you mind giving me and example of the code in use?
There are wayyy better ways of doing this - so use it as a reference
if (isSerrver) then {
_deleteobj = nearestObjects [[x,y,z], ["LandVehicle", "Air"], 5]; // x,y,z is the location of ur landing pad while '5' is the scan radius.
private _object = "your_computer_or_crate" createVehicle [x, y, z]; // x,y,z is the location of ur object
[_object, ["Delete vehicle", {
hint "Vehicle Deleted";
deleteVehicle _deleteobj;
}
]] remoteExec ["addAction"];
};
Thank you so much, so do I just set this to a set piece like a console or pc
put it in initServer.sqf
aight
you can optimize this even better but im all tired so maybe someone else can assist you meanwhile
Was gonna see if I could put it in Init of the screen item but get some sleep, dont wanna keep you up
there is another way too - like u stated by putting it in the init field
- setup a trigger area around the landing pad
- In the
OnActivationfield:
waitUntil {!isNil "delete_the_vic"};
{
deleteVehicle _x;
} foreach thisList;
delete_the_vic = nil;
- In the
initfield of ur computer
[_this, ["Delete Vehicle", { delete_the_vic = true; }]] remoteExec ["addAction"];
typing from mobile is pretty shit but eh
Ideally u are looking at these three
https://community.bistudio.com/wiki/nearestObjects
https://community.bistudio.com/wiki/addAction
https://community.bistudio.com/wiki/deleteVehicle
im off to sleep so gl
You can add El Pepe's first code to an object's init field if you adjust it slightly (and fix the coding-while-π΄ errors he made):
this addAction ["Delete Vehicle", {
private _deleteObjs = nearestObjects [[x, y, z], ["LandVehicle", "Air"], 5];
if (count _deleteObjs == 0) then {
systemChat "There are no vehicles to delete.";
} else {
deleteVehicle (_deleteObjs # 0);
};
}];
cool, cuz im triyng to do it with spyder addons as the spawner (and im using the OPTRE mod so that might not be able to coincide with it but will try and get it to work)
what's the point of that trigger? just do the deletion within the action itself, or atleast use the trigger condition thing for checking the variable 
can I create a link to a diary record from a task description?
try it like you would with diaries
i think you can do the expression thing in task descriptions, so you could do https://community.bistudio.com/wiki/processDiaryLink
Does anybody have a definitive answer as to why BIS_fnc_replaceWithSimpleObject should not be used in MP games? Can I use createSimpleObject instead?
I am unclear what disabling simulation does versus simple object so presume simple object is always better for optimisation
Dynamically replacing stuff with simple objects may be very heavy on network spam compared to disabling simulation.
What if it's just upon mission start
shrugs
What's even the difference between simulation disabled and simple object for network performance? All I know is simple object only sends traffic upon position/orientation etc change
I haven't read the function. I would have thought that replacing with simple objects permanently is acceptable but using them instead of simulation toggling is not.
Yeah, that's not what I'm intending on using it for -- just using it for the sake of optimising any way possible as I'm at several thousand mission objects, a lot of which can't be local only
what sort of objects are we talking about here?
simulation = house objects effectively, mostly flat platforms
i know the wiki says theres very little difference but any difference with that many will add up
What's the best way to make an AI heli hover without reacting to getting shot?
setting the AI to careless
you shouldn't be changing position/orientation of simple objects. make them and leave them. it essentially makes that object into a terrain object which decreases performance demand by a TON. for 1000s of objects, use simple objects.
also, just create your own simple object conversion script
but in general, try not using so many objects. for multiplayer missions for example, you don't need 1000 objects in a building to show that it is a barracks. just some beds and the players will understand what it is. players don't care for aesthetics as much as long as the FPS doesn't poop out, which people will have a problem with.
Not sure if this is the right place to ask but how can I add or edit the select fire modes for firearms in A3?
So i have a CRAM placed in my mission as Anti-Air defense and sometimes it decides to shoot at infantry even tho it shouldn't.
Is there any way to "intercept" the target detection with a EH or so to detect if the target is infantry and then abort shooting?
You could try running forgetTarget with this thing: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#EnemyDetected
It'll probably spam though.
Problem is there is no _target param, so i can't check if it's infranty or not and i have to add more code to check for enemies 
_newTarget?
Doesn't seem to work π¦
_group0 addEventHandler ["EnemyDetected", {
params ["_group", "_newTarget"];
if(isNull objectParent _newTarget) then
{
_group forgetTarget _newTarget;
};
}];
add debug lines
Is yours group created
private _group0 = createGroup [west, true];
Or is just your varName to group group0
_group0 = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
well it seems to kinda work, but not enough π€
when i gun that on an infantry unit it starts shooting, then forgets about the target and dumps the rest of the burst kinda in that general direction 
For some reason the EH doesn't even fire for me
added some diag_logs and nothing
//Airspace entry denial
_gun0 = [];
_group0 = [];
_group0 = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
_group0 setVariable ["lambs_danger_enableGroupReinforce", false];
_group0 setVariable ["Vcm_Disable",true];
_gun0 = createVehicle ["B_AAA_System_01_F",[0,0,1000],[], 0, "CAN_COLLIDE"];
_gun0 setDir 295.668;
_gun0 setpos [14527.2,3819.85,49.1919];
_gun0 removeWeaponTurret ["weapon_Cannon_Phalanx",[0]];
_gun0 addWeaponTurret ["Gatling_30mm_Plane_CAS_01_F",[0]];
_gun0 addMagazineTurret ["1000Rnd_Gatling_30mm_Plane_CAS_01_F",[0]];
_gun0 lock 2;
_gun0 allowCrewInImmobile true;
_gun0 addEventHandler ["Fired",{_this spawn {uiSleep 15; (_this select 0) setVehicleAmmo 1}}];
_group0 addVehicle _gun0;
private _unit = [_group0,_pos,_side,"assault",east,"Static"] call DMS_fnc_SpawnAISoldier;
_unit moveInGunner _gun0;
_unit setVariable ["lambs_danger_disableGroupAI", true];
reload _unit;
_unit setUnitPos "UP";
_unit setVariable ["DMS_AssignedVeh",_gun0];
_unit allowDamage true;
_group0 addEventHandler ["EnemyDetected", {
params ["_group", "_newTarget"];
diag_log format ["DEBUGGY: ENEMY DETECTED %1",_newTarget];
if(isNull objectParent _newTarget) then
{
_group forgetTarget _newTarget;
diag_log format ["DEBUGGY: _newTarget %1",_newTarget];
diag_log "DEBUGGY: FORGOT ENEMY INFRANTRY";
};
}];
I'm having a hard time visualizing setVectorDirAndUp especially with things like doing a 30* tilt forward which says it should be [[0,0.66,-0.33],[0,0.33,0.66]]
why do I need to change multiple axis when all I want to do is rotate on the X axis?
Because you're working with the vectorDir and vectorUp, not axes
still lost on how to get any result I want and calculating it
If you're just working with the standard X, Y, and Z axes, use this
https://community.bistudio.com/wiki/BIS_fnc_rotateVector3D
do I think of up as if I'm standing up its where a string from the top my head is pointing?
Alternatively, if you want to use yaw, pitch, and roll you can use
https://community.bistudio.com/wiki/BIS_fnc_transformVectorDirAndUp
here, i've visualized that for you
https://cdn.discordapp.com/attachments/737175675818999898/1039058191402672218/image.png
why do I get different values than what the wiki says?
//goal - pitch an object down 30 degrees
_y = 0; _p = -30; _r = 0;
private _wiki = [[0,0.66,-0.33], [0,0.33,0.66]]; //using setVectorDirAndUp
private _math = [[sin _y * cos _p, cos _y * cos _p, sin _p],[[sin _r, -sin _p, cos _r * cos _p], -_y] call BIS_fnc_rotateVector2D];
private _function = [[[0,1,0],[0,0,1]], 0, -30, 0] call BIS_fnc_transformVectorDirAndUp;
[_wiki, _math, _function];
//returns - vector3D
[
[[0,0.66,-0.33],[0,0.33,0.66]],
[[0,0.866025,-0.5],[0,0.5,0.866025]],
[[0,0.866025,-0.5],[0,0.5,0.866025]]
]
Because wiki is derped and 0.33,0.66 is not 30 degrees, probably
it's 26.565... degrees :3
gah i want to be able to figure it out from scratch without using functions but I'm not great at math
There are key eventhandlers
oof, a minute timeout for the link to biki. Or is it for two messages with link in a timeframe?
i'm confirmed slowpokeactionKeys would probably fit your needs help with that
Which he has already been told.
But now I'm curious, why do you think that? That gets him the key associated with the action, but then what?
"when vanilla keybind is pressed". actionKeys to get a key to check in EH
Is it addUserActionEventHandler? I think that's the name
Ah now i see, he asked for a way to get the key and not a way to execute code when the key is pressed.
Well should probably move that old code over to the new eventhandlers
the filters need tweaking
Hello, I'm trying to synchronize the animation with the sound and display of the intel at the right moment when testing how I can use everything beautifully, but after implementing it into the main script, it falls apart and the character is not able to properly transition into the correct animation.. see the video.
here are the scripts:
it can be, but creating/deleting objects has a network cost, as each object is added to Join-In-Progress data (and not removed, even when destroyed)
If you're creating an object and then converting to simple object (deleting an object and then creating another), you should just skip the "createvehicle" and go straight to "createsimpleobject"
with the chart above, you can see that the higher the simulation cost of the object, the more benefit from simple object state
a sandbag wall with "createvehicle + disable simulation" is basically as good as "createsimpleobject"
@trail smelt please use https://sqfbin.com/ for big parts of code, thanks
- however, that chart was created in editor. the network cost was not measured. i suspect MP is where simple objects really shine, as they have a less frequent network update too
targets detected with datalink/radar do not trigger the groups "enemy detection"
and then you tick "Local only" for 100% network cost benefit
yes this is the way
pretty much tick local only for everything not relevant to AI .. a sandbag wall, leave as global .. a desk + chair = local only, etc
(first half video) Main script:
https://sqfbin.com/egutuyukinasigocamir
(second half video) testing script:
https://sqfbin.com/dezevetucovujisaqocu
Video:
https://www.youtube.com/watch?v=CthrFOH285U
//edit//
I think solve the problem.. (I have disable simulation on object where is this init scripts...)
That's what I'm thinking too, though I hadn't taken JIP data into account
Still trying to produce radio noise, I think Iβm on to something but currently every player can activate the radio noise on the rto when opening their map
I have a trigger owner synced to rto
With the condition
if (visibleMap) and hasWeapon "vn_b_pack_prc77_01" then {rto say βvn_macv_radio_1β};
But it gives the error βmissing ;β
Condition
if (visibleMap) and (hasWeapon "vn_b_pack_prc77_01") then {rto say βvn_macv_radio_1"}; gives the error 'missing )β
Without hasWeapon every player can activate the trigger, I try to use it so only the player with a radio backpack can activate the trigger
Is there a way to make only the player βrtoβ be able to trigger the trigger condition if (visibleMap) then {rto say βvn_macv_radio_1β}; ?
- the condition of the if statement is formatted wrong. You need to enclose everything between
ifandthenin one outer set of brackets,if (condition) then { - this isn't how you use triggers. The trigger condition is basically an if statement, you don't need one inside the condition. And the trigger activation statement is where the "then" stuff goes, don't put that in the condition
A trigger is not really the best way to do this. For example, triggers exist on all clients (or just the server but let's skip that bit for now) so visibleMap is being checked on every machine. You should use an event handler that's only added on the RTO's machine.
this is basically the same thing about the really big hashes/arrays over the network, its better to have the client do this operations than having them be done over the network, as you say
// in initPlayerLocal.sqf
addMissionEventHandler ["Map",{ // when a map event happens...
params ["_mapIsOpened","_mapIsForced"];
if (_mapIsOpened && {player == rto}) then { // check if the map was opened or closed and we are the right player
while {visibleMap} do { // we know the map is now open, so as long as it remains so...
[rto,["vn_macv_radio_1",50]] remoteExec ["say3D"]; // broadcast a positional sound
sleep 2; // wait the duration of the sound in seconds before doing it again
};
};
}];```
But I understood eventhandlers donβt work in multiplayer
For what reason?
What? Event handlers absolutely work in MP. Who told you they didn't?
AFAIK you can't sleep in unscheduled execution
This conversation @hallow mortar
Not explicitly but I tried to brew up something with event handler map and it did not work
I don't recall whether this EH is unscheduled or not
This says "it will be more complex" not that EHs don't work in MP
Well Iβll try this first, thanks for the suggestion
If as M1keSK says, sleep doesn't work in this EH, you will need to adjust as follows:
// in initPlayerLocal.sqf
addMissionEventHandler ["Map",{ // when a map event happens...
params ["_mapIsOpened","_mapIsForced"];
if (_mapIsOpened && {player == rto}) then { // check if the map was opened or closed and we are the right player
[] spawn { // create a scheduled scope so we can use sleep
while {visibleMap} do { // we know the map is now open, so as long as it remains so...
[rto,["vn_macv_radio_1",50]] remoteExec ["say3D"]; // broadcast a positional sound
sleep 2; // wait the duration of the sound in seconds before doing it again
};
};
};
}];```
^ just spawn the section to sleep as Nikko says
general Q: in terms of switch syntax... is this allowed?
switch (_state) do {
case 0: {};
case 1; default {};
};
generally, I know you can string together multiple cases with one CODE body in response. But note that trailing into default. Not sure if that is allowed.
Thanks...
Why would you need to? Just don't define case 1 and 1 will fall into default anyway, that's how default works.
well logically speaking true, I was just wanting some self documenting cases, plus default, but true.
Thanks i guess i try a cfg patch π€
https://community.bistudio.com/wiki/Arma_3:_Targeting_config_reference
If that is the case for the "B_AAA_System_01_F"
airLock = 0; // Cannot target air units
airLock = 1; // Can target air and ground units
airLock = 2; // Can target air units ONLY
This is the one that works! Thanks Nikko and @real tartan !
Perfect, this is definitely what I was looking for. I'm reworking a lot of the old exile code (from 2015 - 2017) on a server from when things were a lot less fleshed out in the engine. I'm already wiring up all the custom keybinds into the new Modded Keybinds system (awesome by the way) but I needed to set up a way to save the weapon fire mode when players swap to binos/rangefinders so I still needed to hook into the vanilla keybinds somehow
Sounds like this is a great moment to bring up Single Responsibility Principal, right? Maybe write a function for the code body for default/case 1 and just call the function in both and name it appropriately. That way it's still self documentation without having an unreachable case. And, it's of course more flexible for the future
Hey, is there a quick way of getting the classname of a weapon I've just fired? Say for example if I drop a bomb from a plane. I've looked around the config viewer, but if I'm being honest, I can't find anything and its really quite difficult for me to get my head around haha.
Thanks π
I know next to nothing about scripting and triggers. That being said, I'm trying to either find or make a script that will completely heal someone upon entering an area. Just walking in and voila, healing has been done. Found something on the workshop that apparently used a trigger area, but it didn't work when I tested it on the editor.
Fired event handler https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
Off of this, would I need to get _ammo or _magazine, sorry?
Nvm, just tried both, guess I should have done that first really haha, thank you! π
https://community.bistudio.com/wiki/setDamage
Also works on players
_weapon returns the classname of the weapon itself (e.g. the gun, or "launcher" in the case of missiles/bombs GBU12BombLauncher). _magazine returns...the magazine loaded in that weapon (e.g. 2Rnd_GBU12_LGB), and _ammo returns the type of projectile that was actually fired (e.g. Bo_GBU12_LGB)
So which one you want depends on what you want to do with the result.
@winter rose Just putting this in here so you or someone else can edit it into the wiki, but if you're creating modules via script DO NOT USE createAgent it does NOT work the way you expect it to
for some reason createUnit will (correctly) not run the init on a runtime-created module but createAgent will run it, but only on the machine where it's created, as far as I can tell?
Thanks (for the next time there is #community_wiki π) I will see where to amend
@winter rose would recommend https://community.bistudio.com/wiki/Modules#Spawning_a_Module_by_script
also noted, will put it there next time
also maybe on the page for createAgent
I realized I previously put this in #arma3_ai but:
Is there a mod / way to set placing a backpack (like the deployable mortars) to a keybind?
true, sure. thanks...
Was hoping for some good old help with some custom sounds...
Wrote these up for a custom sound, but encountering some errors.
description.ext:
class CfgSounds {
sounds [] = {};
class crash {
name="crash";
sound[]={"sounds\crash.ogg";
titles[]={};
};
};
init.sqf:
[] Spawn {
playSound "crash";
Everytime I attempt to load and play the scenario I get two issues:
FileC:\Users\Liam\Documents\Arma 3 - Other Profiles\Monklie\missions\Operations%3a%20Conquistatdor.126map\description.ext, line 1: '/CfgSounds.sounds': '[' encountered instead of '='
and when playing
Sound crash not found
- You have a space between sounds and [].
- You have no terminating } after the crash.ogg string.
- Your init.sqf has no terminating } for the spawn.
What's the best way to dump variables to the RPT? Is there a way I could get the variable names as a string without using the preprocessor method? For instance, looping through all the variables in an array and getting the variable names
I don't understand. Variables in an array don't have names, they have indices.
I mean the literal name of the variable. For example in:
private _someVariable = "";
I want to get the text: _someVariable
From what?
What I'm looking to do is loop through an array of variables and print them to the RPT in this format: <variable name> : <variable value>
That sounds very much like a preprocessor task to me.
What would you recommend as far as a preprocessor method goes?
Just quote the variables to get their names as strings?
maybe something like #define VARANDVAL(v) [#v, v]
Yeah, these don't seem to work in a loop unfortunately. They just print the "_x"
DEBUG 1. |-> _x : arifle_SPAR_03_blk_F | _x : true
well yeah
you'd have to use them when creating the array, like [VARANDVAL(_someVar1), VARANDVAL(_someVar2)]
Yeah, that's why I was initially trying to avoid the preprocessor
At that point I might as well just make it:
[["_varOne", _varOne]]
and avoid the preprocessor altogether
you can shorten it to VV though :P
Fair point, but not particularly descriptive
The init had lines later that donβt affect the sound.
But thank you for the other two!
After trying it with
[["_varOne", _varOne], ["_varTwo", _varTwo]]
I definitely agree with you, I think the preprocessor way is cleaner. That gets out of hand real quick! Anyways, thanks for the help!
Does anyone know of a way to put a primary weapon on your back without making you stand up from the crouched or prone position?
player action ["SwitchWeapon", player, player, 100];
// and
player action ["SwitchWeapon", player, player, -1];
Both of these make you stand up if you're crouched or prone and use them to put your primary weapon away
done there & createAgent
nice!
How would I get the cbrn showers working
Whats the hierarchical tree to check the load capacities of backpacks? nvm found it here: https://community.bistudio.com/wiki/getContainerMaxLoad
heyo, why would this work when our mission is unpacked, but once packed into a PBO it stops working?
[this] execVM "arsenal.sqf";
this will need more details.
what are you using to pack it?
I'm using ```sqf
player addEventHandler [
"HandleDamage",
{
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
private _previousDamage = [_unit getHit _selection, damage _unit] select (_selection isEqualTo "");
private _newDamage = _damage - _previousDamage;
(_previousDamage + ((_newDamage * 0.7) min 0.8))
}
];``` to reduce any damage I take, however I'm still being killed with one hit by Hunter HMG or any other turret. Is damage applied more than once if projectile is higher caliber than normal gun or am I missing something?
You can be hit in multiple selections by one shot. A .50 seems like the kind of gun that would do that (although smaller guns can do it too)
how would I mitigate this? Like reduce or completely ignore the follow-up damage as long as it's from one projectile
I believe they will (mostly) be processed in some kind of order so you can make a delay before new damage is accepted.
maybe combine it with a check on who the last shooter was so if two people shoot at once they still die
PBO Manager
such as? script being called? this code is put into the init of a few objects
yeah well, don't use that
use Eden export
also restart the server after replacing the file so it is not cached
Question: When you're playing and the AI is calling out targets, yelling I'm hit and stuff like that, does that only happen when a human player is present?
I suppose more relevant to scripting, is it possible to listen for and get a copy of that chat if it does happen?
gotcha ill give that a shot, when I hit export it says <Arma 3>/MPmissions, where is that? Every arma 3 directory I check doesnt have it
nvm found it
it was in the arma 3 install directory
@jade acorn Isn't the problem there that the damage value can go way above 1.0?
oh, I guess it's still two-shot.
min 0.8 in ((_newDamage * 0.7) min 0.8) is supposed to limit the damage from single hit to 80%
but yeah, multiple impacts per bullet.
That's interesting though because it implies that the damage on those selections isn't independent.
this disableAI "PATH";
this addMPEventHandler ["MPHit", {
params ["_unit", "_causedBy", "_damage", "_instigator"];
[_unit] joinSilent createGroup EAST;
_unit allowDamage true;
_unit removeAllMPEventHandlers "MPHit";
_unit switchMove "IMS_Die_Spec_1";
_unit playMoveNow "IMS_Die_Spec_1";
sleep 6;
_unit setDir (getDir player);
_unit switchMove "IMS_Crawling_Away_Start";
_unit playMoveNow "IMS_Crawling_Away_Start";
sleep 1.4;
_unit switchMove "IMS_Crawling_Away";
_unit playMoveNow "IMS_Crawling_Away";
sleep 10;
if (alive _unit) then {
_unit switchMove "IMS_Crawling_Away_Stop";
_unit playMoveNow "IMS_Crawling_Away_Stop";
_unit setDamage 1;
};
}
];
Can someone point out the error here? Converting from a regular event handler to MP one and it's just completely stopped working.
No shown errors just continuously shooting the target and nothing happens.
Given that you have sleeps in an event handler and it's not complaining, I'm guessing that it's not firing at all.
any idea why it wouldn't be firing?
This is with unit damage disabled? Possibly MPHit doesn't trigger on no-damage hits. Not clear from the documentation.
If you know the unit's locality then just use Hit.
Damage is not disabled
Multiplayer mission, units just a random soldier.
why are you setting allowDamage true in the handler then?
And also:
No shown errors just continuously shooting the target and nothing happens
Shouldn't they be dying at some point?
Was originally a Hit Eventhandler with damage disabled. That line was removed when i converted it to mp
Well yes.
Nothing from the SCRIPT is happening. Unit dies after being shot enough as normal
So what's your test case here? SP? localhost? DS+client?
I assume the code's in a unit init box given that it has this in it.
Secondary and latter.
And yeah, its in the units init with an ifServer check. Just saves me further cluttering my functions folder
Actually and single player.
Didn't work in any of the above
Did a basic editor test of MPHit in init box, worked fine.
Maybe break your stuff down a bit.
Use systemChat or diag_log to tell if each step is working.
Weird.
trying to get right offset for center position of object in drawIcon3D depending on if it is vehicle, house or unit
// this is close to what I want to achieve
private _pos = [_object, _object modelToWorldVisual ( _object selectionPosition "Spine3" )] select ( _object isKindOf "CaManBase" );
// this shows position on the ground
private _pos = visiblePosition _object;
drawIcon3D ["icon", "color", _pos, ...];
any suggestions ? note, using render position within Draw3D event handler
so I am also trying to do boundingBoxReal height / 2 for object
private _pos = _object modelToWorldVisual [0, 0, abs ( ( ( boundingBoxReal _object select 1 ) select 2 ) - ( ( boundingBoxReal _object select 0 ) select 2) ) / 2];
also looking at boundingCenter
for center of buildings I use this: https://sqfbin.com/qowaniqekavifasequza if that's what you are looking for
why no this? https://community.bistudio.com/wiki/boundingCenter
IIRC it doesn't give accurate center
it's just some type of model center
Is there a way to change what is display on the map for a unit/vehicle?
This should be quite simple but I keep running into bracket errors;
_radiosound = rto say "vn_macv_radio_1"; //the sound of the radio
_radiostate = false; //the state of the radio
if (radiostate) then //happens when radio is on
{
rto addAction
[
"Turn off radio"
{
deleteVehicle _radiosound //deletes the radio sound
}
];
_radiostate == false; //radiostate is updated
}
else //happens when radio is off
{
rto addAction
[
"Turn on radio"
{
_radiosound spawn {} //spawns the radio sound
}
];
_radiostate == true; //radiostate is updated
};```
not without modding it.
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
also you are missing commas.
darn- oh also, I had a realization. If it's just for a fun self project, can I use and modify to make new icons from the game's resources? π
I took the civilian plane map icon and messed with it a little- but then I realize now- am I allowed to do this? xD
i feel like i am not and i might wanna delete the icon now-
Although it's just for personal use, not like ima use it in a mod pack or something-
IDK, but I would think so as long as it remains in Arma
I am also curious if I could add metadata to the paa file. Something to say "Hey, this is not original, just modified"
but anyway yea, I made a taxi icon thing :P
private _radioSound = rto say "vn_macv_radio_1"; // the sound of the radio
private _radioState = false; // the state of the radio
if (radiostate) then // happens when radio is on
{
rto addAction ["Turn off radio",
{
deleteVehicle _radioSound; // deletes the radio sound - _radioSound does not exist here
}
];
_radioState == false; // radiostate is updated
}
else // happens when radio is off
{
rto addAction ["Turn on radio",
{
_radioSound spawn {}; // spawns the radio sound - _radioSound does not exist here - also DOES NOTHING
}
];
_radioState == true; // radiostate is updated
};
Ah I thought script within addAction didn't need the ;
comma ,
; on the last instruction of the script isn't strictly necessary, but is probably a good practice in multiline scripts anyways π€·ββοΈ
Ah that I could've known but I overlooked it π
oh and the game crashed xD
mission resources are \image\map_icon.paa or image\map_icon.paa?
So 'private' in front of my variables prevents them from being called in other scripts right? Trying to understand it's purpose but don't really understand much from the 'private' wiki page (https://community.bistudio.com/wiki/private)
it's about scopes; see https://community.bistudio.com/wiki/Variables#Scopes
an underscore-prefixed variable is local to its script anyway
oh my- something is spamming the log file with "Some of the magazines weren't stored in soldier Vest or Uniform?"
Huh- is there a way to check is a texture was able to be loaded?
or rather, is there a way to load a texture, then resuse what was loaded. I ask b/c every draw frame it was trying to load the texture, and since it wasn't there, every draw frame, it was sending "Cannot load texture" into the log file
This is just kinda something that happens. I believe it's caused by loadouts (including vanilla default loadouts) containing more mags than actually fit in the unit's containers. It's probably not something you've done.
fileExists oh?
fileExists got you bro
you mean like https://community.bistudio.com/wiki/disableMapIndicators ?
Why does playSound work with spawn but say does not?
https://community.bistudio.com/wiki/say returns nothing
https://community.bistudio.com/wiki/playSound returns the sound source
and, as I commented, your code won't do what you want it to do
yes, except for only 1 thing xD
That I noticed π
I may have run into an issue-
_color = [1,2,3];
if(count _color < 3)then{
_color = [1,1,1,1]
};
if(count _color == 3)then{
reverse _color;
_color pushBack 1;
reverse _color;
};
_color;
What is the issue?
one sec sorry
It seems pushBack and reverse aren't being done how/when I want
Altho, probably a better way to do what I want-
What's the best way to add a value to the end of a table? :P
oh wait no im dumb
sometimes i like to think im smart π€€
don't worry, take a break, have a drink, write what you want to do in human language then write code
other people are as dumb, they are just persistent π
and take breaks (and drinks) when you don't see us
i just didn't realize ya could do array set [3,1] xD
unless this thing is bein weird, I mean
I thought it wasn't possible to add to the end easily
it was meant to be making a rgb value into a rgba value
pushBack
adding to the front is a bit harder, though :3
123 should become 321, push back with a 1, then reverse again
123 -> 321 -> 1321 -> 1231
back is the last element. First element is start
oh
[1,2,3] pushBack 1 gives [1,2,3,1]
What you're actually doing is:
123 -> 321 -> 3211 > 1123
right, im even more dumb :P
dumber*
exactly
ouch, that's like hitting someone who's already done π
I admit to shooting at the ambulance your Honour
awww i can't post images :(
wanted to show how horrible my map looks now after I'm done with my debugging xD
preview for image links work, though. You can post is somewhere else (even in DM with some annoying Discord bot) and send the link here, it should show 
I was doing that with gyazo links. but I just tried and got timed out xD
that's what you get for using gyazo
it is a little weird to me though that ya can't post images. If you're script is doing something weird in game, ya can't show what it is

several people are typing
It's to stop the meme overflow (and to get people to post code instead of pictures of code). If it's something important there are ways to send images and video, it just takes a little more work.
yea, but now the gyazo link doesn't work.
yes, that is it. I tried posting and it timed me out π
anyway! So yea, tons of symbols and multicolored and stuff xD
[player,"loc_hospital","Test",.1,[1,0.5,0],24,24,true] would give a marker that is like a map/location marker. Puts it at the given object's location, sets the icon to be loc_hospital, text is "Test", and then it's the map zoom you can see it at. Zooming out past .1, it's not drawn. Then there's the color, size x and y, and if the object is "active" or not. Active meaning if it should follow the object's position and rotation
Makes a procedural texture, checks if icon is a blank string. if yes, use the procedural texture, if not, it does ([<input>] call BIS_fnc_textureVehicleIcon) call BIS_fnc_textureMarker; and then checks if the file exists. if no, set the color to be pink. Otherwise, use the new texture.
Then, the drawIcon thing uses the color, thus the generated texture is white.
do EventHandlers persist between eden editor and single player testing?
ah ok, appears that's a no. Yay :P
i have realized I was making a new drawing event for each and every icon I made xD
Instead I want to check if the icon array is made yet. If not, make the array and the event. Then, add the icon tot he array. If it is made, JUST add the icon to the array
guys I have a question. I'm trying to do something like this in mp:
if (bluefor detects any player from the group) then {do stuff}
so I went to my initServer.sqf and wrote this:
// this works
private _plrs = allPlayers - (entities "HeadlessClient_F");
// this doesn't work
if {(blufor knowsAbout _x) > 0} then {
hint Str(_x);
chinookGroup_1 setCurrentWaypoint [chinookGroup_1, 2];
} forEach _plrs;
I imagine you'd need to remote execute the hint?
oh and the current waypoint
weird, setCurrentWaypoint is local-
But yea, I'd try to do a remoteExec
unless it also doesn't work in single player, in which case- haha- no clue sorry π
if (), not if {}
also⦠no need to repeat the same setCurrentWaypoint operation for each players?
yeah i figured out syntax error, I also need to put if inside {} to forEach to work
but npcs still don't go to the waypoint
well, that's because the check is done once
it's in a while loop
first news
how to do counter in event handler that runs every frame ?
addMissionEventHandler ["EachFrame", {
if ( condition) then
{
// if condition is true for 5 seconds, do stuff
}:
}];
a) save the previous state of condition
b) if previous is false and current is true - save the time (rising)
c) if the condition is still true when time = saved_time + 5 - do the stuff
π€·ββοΈ
so, your smallest repro code?
while { true } do
{
private _plrs = allPlayers - (entities "HeadlessClient_F");
{if ((blufor knowsAbout _x) > 0) then {
chinookGroup_1 setCurrentWaypoint [chinookGroup_1, 2];
}} forEach _plrs;
};
waypoint 2 is "get in" waypoint. Waypoint 1 is "dismissed" if that matters π€·ββοΈ
and I'm not sure how it will work if I will remove "forEach" loop, because I want this waypoint stuff to happen if any of the players were detected
make a timer with diag_deltaTime
that's not how it works, that's not what you did
if (_plrs findIf {blufor knowsAbout _x > 0} > -1) then { // if at least one player is detected
chinookGroup_1 setCurrentWaypoint [chinookGroup_1, 2];
};```
can drawIcon use any paa file or does it need to be marked with something or
Dont know if this is the right channel but, I got arma 3 working splitscreen with goldberg+nucleuscoop but no mods or dlc load, current launch options are ("-noPause -noPauseAudio -window -noLauncher") and ive tried -mod=@RHS (example) and it doesnt show up in game.
I got steam scenarios working by getting the pbo and extracting the folder into the editor.
If anyone knows how mods are loaded and if I can get mods/dlc loading without steam or launcher please tell me. EDIT:Know how to load mods via launcher, want a more technical explanation of how mods are loaded.
apart from fact that npc a-holes are still chilling around being dismissed it works
It's currentwayPoint,
if (_plrs findIf {blufor knowsAbout _x > 0} > -1) then { // if at least one player is detected
_chinoWp = chinookGroup_1 setCurrentWaypoint [chinookGroup_1, 2];
_chinoWp = chinookGroup_1 setWaypointType "MOVE";
};
addMissionEventHandler ["EachFrame", {
private _timer = missionNameSpace getVariable ["MY_timer", 0];
if ( condition ) then
{
_timer = _timer + diag_deltaTime;
missionNamespace setVariable ["MY_timer", _timer];
if ( _timer > 5 ) then
{
// do stuff if condition is true for 5 seconds
};
}
else
{
missionNamespace setVariable ["MY_timer", 0];
};
}];
can I do better ?
if ( condition) then {
what condition?
cursorObject is same object as previous frame ( holding target for 5 seconds )
yeah it looks fine, but no need for the set/getVariable
in some init script do MY_timer = 0; and simply use that in your frame handler
small typo, 1st declaration should be private _timer = missionNameSpace getVariable ["MY_timer", 0];
getVariable instead of setVariable
need to store timer outside of loop (iteration of event) somehow
huh?
if I do private _timer = 0; at start of event, it will reset counter every time event runs
you don't need to use any local variables here
put MY_timer = 0; in an init script, and use that in the EH
i.e., MY_timer over missionNameSpace getVariable ["MY_timer", 0];
can I do counter via something more local to player ? want to have different delay per player
more local?
It will be player-specific, that's a global (scope) variable, not a global (network) variable
local ho event handler
MY_timer = 0;
MY_delay = 5;
addMissionEventHandler ["EachFrame", {
if ( condition ) then
{
MY_timer = MY_timer + diag_deltaTime;
if ( MY_timer > MY_delay ) then
{
// do stuff if condition is true for 5 seconds
};
}
else
{
MY_timer = 0;
};
}];``` 
I don't understand 
we assign _chinoWp nothing, because setCurrentWaypoint doesn't return anything
and then we are setting waypoint type to a group when it expects a waypoint. I'm totally confused rn
EachFrame runs some code every frame on the machine it was added, there is nothing "global" here
fileExists seems to dislike absolute paths- and it seems I need an absolute path for mission icons to work so horray
mission icons to work so horray
wat? why do you need absolute path for that?
mission icons should be in your mission (root)(sub)directory, which you would navigate with a relative path
It doesn't wanna work with drawIcon
I tell it to drawIcon with "Images\aaaa.paa" and it does a pink box. I do it with full path, it works fine.
for drawIcon use https://community.bistudio.com/wiki/getMissionPath
that was nonsensical
I give it relative path. How would it know if it needs to give the rest of the path or not
private _myPath = "...";
if fileExists _myPath then {
drawIcon [getMissionPath _myPath, ...
}
can't you just do this?
not if I want to use other icons as well
well obviously
for them you don't need getMissionPath anymore
yes, but how would I know if I need it unless I tell it with another parameter?
store two paths then, virtual and absolute
that you then check, and draw if they exist
but i don't get it, why would you need to check if they exist?
just check if a mod is loaded
it's drawing on the map. So it'd fill the log file if it didn't exist
and if it is, add it's paths
it's not just for a mod tho π supposed to be user friendly, basically xD
"Call this function and it will make an icon for ya"
what if-
What if I make it accept a string and a table for the icon?
string is just what it's doing now. But if a table, it will check if 2nd spot exists. If it does, set the icon to be first spot plus second spot
Just so we're clear, when you say table, do you mean array?
Well on my ai group script i use setCurrentWayPoint to position of their vehicle and type get in, and another way point position x type get out and after that to move by walk i use setCurrentWayPoint last position and move. And that works good
yea, sorry, I started messing with programming via lua, so xD
after almost 10 years, everything is still a table to me xD
can you allow for both an absolute path and a relative path and check if the string contains a :?
if it's a relative path you can check if the file exists and add the mission path
Yea, similar thing to what I'm planning on doing
is there a way to access the cursor via script?
access in what way
the weapon cursor. just access it in any way
access?
weaponDirection?
Thanks everyone. The problem was in the "dismissed" waypoint. For some reason NPC's don't want to change waypoint from dismissed to any other π€·ββοΈ
Hey everyone. Is it possible to create own commands? For example, I have this following code:
titleCut ["","White In",0.2]; playSound "OMCameraPhoto";
numberOfPhotos = numberOfPhotos +1;
hint format["You have %1 photos",numberOfPhotos];
Can I make this something simple like "takePhoto"
I guess you could write a function in a global scope
Can I do it through Eden editor?
Yes, using the Mission Init field in the mission attributes, but the better way is to use the Functions Library https://community.bistudio.com/wiki/Arma_3:_Functions_Library
So I changed to 'say3D' because it returns an object contrary to 'say', which should be compatible with 'spawn' and 'deleteVehicle'
private _radioSound = rto say3D "vn_macv_radio_1";
private _radioState = false;
if (_radioState) then
{
rto addAction ["Turn off radio",
{
deleteVehicle _radioSound;
}
];
_radioState == false;
}
else
{
rto addAction ["Turn on radio",
{
_radioSound spawn {};
}
];
_radioState == true;
};```
However it still returns a variable error with _radioSound
From the comments of Lou I understand that _radioSound is not recognized within the addAction, but I don't know how to make it recognized
One way to do radio is use setVariable, if you want play and stop when you want
_target = rto;
_target setVariable ["music","stop"];
_target addAction ["Play music",
{
params ["_target", "_caller", "_actionId"];
[_target] spawn {
params ["_target"];
_time = 100;
_pos = getPos _target;
_mySoundSource = "#particlesource" createVehicle _pos;
_target setVariable ["source",_mySoundSource];
_target setVariable ["music","playing"];
[_mySoundSource, ["vn_macv_radio_1",500,1]] remoteExec ["say3D"];
sleep _time;
deleteVehicle _mySoundSource;
_target setVariable ["music","stop"];
};
},nil,1.5,true,true,"", "_target getVariable 'music' == 'stop'", 4,false,"",""];
_target addAction ["Stop music",
{
params ["_target", "_caller", "_actionId"];
_mySoundSource = _target getVariable "source";
deleteVehicle _mySoundSource;
_target setVariable ["music","stop"];
},nil,1.5,true,true,"", "
_target getVariable 'music' == 'playing'", 4,false,"",""];
Is there a way to assign an inventory crate to a player and restrict everyone else? Im not good with scripting
is it possible to make a script to give a specific UAV drone a mine detector functionality?
I just need an on/off function
strdl_radioSound = rto say3D "vn_macv_radio_1";
if !(alive strdl_radioSound) then
{
rto addAction ["Turn on radio",
{
strdl_radioSound spawn {};
}
];
}
else
{
if (alive strdl_radioSound) then
{
rto addAction ["Turn off radio",
{
deleteVehicle strdl_radioSound;
}
];
}
};```
This is what I have now, however: sound is playing on start, and when turned off it can't be turned on anymore
@frail vault What, like if the drone goes near a mine then it reveals it to a side?
no, like giving it a mine detector screen like a demining drone
but, just on a regular AR-2 drone
Sounds more like a config editing thing.
found on BI forums:
player addaction ["Open " ,{player action ["GEAR",BOX_1]},[], 0, true, false, "", "(_this distance box_1)<4"];
anyone know how to hide/disable the contact HUD compass?
can you pass an argument into a select {} expression?
don't u just use a global variable for that?
hmm
uhh, why would you need to pass anything in there?
say you want to select all classnames with some config value above a dynamically chosen value
local variables carry into select scope, just define it outside the select?
I tested that, kinda works but t disables other stuff too
showHUD [FALSE, true, true, true, true, true, true, true, true];
with this I can get rid of that HUD compass, but also disables HUD GPS/MAP L&R panels
I just need the IDD so I can disable it...
shouldn't it be listed here?
I am strongly suspicious that that is part of a mod or custom game mode and not one of the vanilla HUD elements
Is there a way to stop a player from swimming while they're underwater? I.E make them walk on the ocean floor
My presumption is no however I am often wrong
maybe experiment with mass of the player?
is there any script for spawning "building supplies"?
what are "building supplies"
H-Barriers, Sandbags walls, Sandbag Bunkers, Camo Nets etc
Hi, does anyone know of a reliable manner in which a scripted flight path can be played in multiplayer, that doesn't break the entire mission?
I attempted to use unitCapture/unitPlay to do a cinematic intro with two helicopters for a Zeus mission. Unfortunately, there were lots of stuttering and desync issues and even a complete inability to exit the helicopter, soft locking the players.
My method was to initiate the unitPlay inside of the helicopter init with this:
[_this, flightdata] spawn bis_fnc_unitPlay;
I was then hitting OK with it set to global exec in the Zeus interface. I would not be surprised if this approach is wholly wrong somehow. flightdata would be the pasted data from the unitCapture but it's far too long to post here.
This works flawlessly in the editor but on a dedicated server the above desync/soft locking issues happened. I would just like to know if this is the nature of the function or if there's a better alternative. Thanks :) I am super novice regarding anything SQF and arma scripting btw.
initiate the unitPlay inside of the helicopter init with this
don't do that - otherwise all the machines are trying to do this, creating the stutter
only the server should run that
try
if (isServer) then { [_this, flightdata] spawn bis_fnc_unitPlay; }; // _this, or βthisβ?
```@shut gate
would you say this can be run via the execute code module in the zeus interface, or should i put it in a sqf file? would it make a difference?
thank you by the way I will test asap
I have no knowledge about modules
thank you regardless
strdl_radioOff = true;
rto addAction
[
"Turn on radio",
{
strdl_radioSound = rto say3D selectRandom //random sound for variation
[
"vn_macv_radio_1",
"vn_macv_radio_2",
"vn_macv_radio_3",
"vn_macv_radio_4",
"vn_macv_radio_5",
"vn_macv_radio_6",
"vn_macv_radio_7",
"vn_macv_radio_8",
"vn_macv_radio_9"
];
strdl_radioOff = false; //updates radio state
},
nil,
1.5,
false, //prevents action always on mouse
true,
"",
"(strdl_radioOff)", //condition for action to show
50,
false,
"",
""
];
rto addAction
[
"Turn off radio",
{
deleteVehicle strdl_radioSound;
strdl_radioOff = true;
},
nil,
1.5,
false,
true,
"",
"!(strdl_radioOff)",
50,
false,
"",
""
];```
After a good night of sleep I managed to figure something out π
It works but I'm curious if it could be more compact, or otherwise improved
_sandbag = createvehicle ["Land_HBarrier_Big_F",(position player) getrelpos [15,0]]; _sandbag setdir (getdir player);
how can I get a list of all groups from a specific side that is within X meters of a another group?
I could loop through allGroups, but that feels very inefficient so there must be some better way.
select + inAreaArray
going through allgroups and filtering accordingly is the best way, in the end is a finite amount of groups, just 288
ah alright, thank you both!
Hello, i have some question of Arma III Multi Player server, I try to the Trigger event get be attribute to the Arma III Multi Player host server but can't setting of i wanted, So how possiable server forcitiy getting Trigger event active authority?
you fill it locally for that player using the non global version of the commands
having a hard time trying to figure out what you are asking
If a user other than the host touches a trigger on the server, it does not work
so you want a trigger to fire only if the person is currently the host of the server?
No, I want the server host to work, but I want the users who connect to the server to work when they touch the trigger However, I'm making an SQF file, but I don't know how to make an SQF file script
From pins
#arma3_scripting message
I've been referring to that wiki, but it's not working properly, so I'm here to get script advice I made initServer.sqf and initPlayerServer.sqf related to the server, but it didn't work properly, so can I see an example of that?
By any chance, is the checkbox in the trigger attributes called "Server Only" ticked?
If it is, that might be your issue, other than that, I can think that:
a) your trigger is not repeatable
b) your activation parameters are not correctly set-up
of
c) your code is not MP compatible
For any doubt regarding triggers you can check this link to the wiki itself
Triggers are checked for server only and repeat is also checked However, I created init.sqf with the SQF file to be applied to the trigger, but it didn't work properly, so I'm fixing the script But it's not working properly
To list the problems,
- Trigger does not recognize you
- SQF files are being produced to properly recognize the user
I don't know if I'm making it properly
This is the script code inside the SQF file that I'm currently making βββ
{
updatingPlayerConnected = false;
playerConnected = addMissionEventHandler ["PlayerConnected",
{
_this spawn
{
params ["_unit", "_id", "_uid", "_name"];
waitUntil {!(allPlayers select {getPlayerUID _x isEqualTo _playerUID} isEqualTo [])};
_playerObject = allPlayers select {getPlayerUID _x isEqualTo _playerUID} select 0;
waitUntil {!updatingPlayerConnected};
updatingPlayerConnected = true;
_globalServerVariable = missionNamespace getVariable ["globalServerVariable",[]];
_globalServerVariable pushBack [_playerID,_playerUID,_playerName,_playerObject];
missionNamespace setVariable ["globalServerVariable",_globalServerVariable];
updatingPlayerConnected = false;
};
}];
};
\\\\\\\\\\\\\\\\\
addMissionEventHandler ["HandleDisconnect",{
params ["_unit", "_id", "_uid", "_name"];
_unit = _this select 0;
deleteVehicle _unit;
}];
is there any way to open a crate and have the crate locally load gear?
https://community.bistudio.com/wiki/addItemCargo to only add contents to the crate on a specific machine
thanks
addMissionEventHandler ["HandleDisconnect",{
params ["_unit", "_id", "_uid", "_name"];
_unit = _this select 0;
deleteVehicle _unit;
}];
Why do you do this? _unit = _this select 0;
_unit is already there.
Hey, here's a smaller/snipped version of a script I have which should simply add a marker on all units, but it throws the error "Error Type Any, expected Number". I'm presuming the eventHandler doesn't like being used with the _x variable, but how would I go around/fix this issue.
drawIcon3D ["\A3\ui_f\data\map\groupicons\selector_selectedEnemy_ca.paa", [1,0,0,1], [getPosATL _x select 0, getPosATL _x select 1, (getPosATL _x select 2) + 1.3], 1, 1, 45];
}];
} forEach allUnits;```
_x isn't defined inside the EH
you either need to move {} forEach loop inside the EH, or you need to pass the _x variable into the EH via its argument
I presumed as much, but currently I just can't put my finger on how to do so, as EHs are a completely new thing to me.
addMissionEventHandler ["Draw3D", {
{
drawIcon3D ["\A3\ui_f\data\map\groupicons\selector_selectedEnemy_ca.paa", [1,0,0,1], [getPosATL _x select 0, getPosATL _x select 1, (getPosATL _x select 2) + 1.3], 1, 1, 45];
} forEach allUnits;
}];
Ah, now it seems to function. I put the forEach loop within the eventHandler and I believe this should be enough to fix the full script as well.
// or
{ addMissionEventHandler ["Draw3D", {
private _x = _thisArgs#0;
drawIcon3D ["\A3\ui_f\data\map\groupicons\selector_selectedEnemy_ca.paa", [1,0,0,1], [getPosATL _x select 0, getPosATL _x select 1, (getPosATL _x select 2) + 1.3], 1, 1, 45];
}, [_x]];
} forEach allUnits;```
This does the trick perfectly for the actual script I have, as it uses a different variable for the units that are selected and used for it. Thanks
getPosATL _x select 0, getPosATL _x select 1, (getPosATL _x select 2) + 1.3
vectorAdd
I have this piece of code:
if (!(newTicker in tickerNews) and newTicker != "") then { tickerNews = tickerNews + [newTicker]; };
}; ```
In another function, I want to define a new `newTicker` each time a task is succeeded. However, I want to do this dynamically based on the task/trigger names instead of manually adding it. Is it possible to do something similar? Can I make up my own config file which maps strings to other strings then use it here? (Sorry I am very new to all this)
This is literally my second day in dabbling Arma 3 scripts so please explain to me like I am an idiot π
or should I use HashMap for this as I already know the task names?
Can anyone explain why pushing all blufor groups in array leads to array length bigger than actual count of blufor groups in editor? God I'm getting stuck on such simple stuff and it drives me insane.
private _entireWestSide = [];
{
if (side _x isEqualTo blufor) then {
_entireWestSide pushBack _x
}
} forEach allGroups;
copyToClipboard Str(_entireWestSide);
so I paste the result in some txt file and get this result:
[B Alpha 2-4,B Alpha 1-2,B Alpha 1-3,B Alpha 1-4,B Alpha 1-5,B Alpha 1-6,B Alpha 2-1,B Alpha 2-2,B Alpha 2-3,B Alpha 1-1,B Alpha 2-5]
but the actual amount of groups in editor is 9
it's not even 9, it's actually 4 because radar and defenders AA's are grouped as well
It's possible there is one extra group which is the side HQ unit - an invisible rifleman created at [0,0,0] for the game's internal use.
It's also plausible that some groups were created for the turret AI and not actually deleted when you regrouped them.
Well, and for another thing, you could simplify it down to a simple array select:
private _entireWestSide = allGroups select {side _x isEqualTo blufor};
copyToClipboard str _entireWestSide;
Don't forget you can inspect the mission.sqm in a text editor to see all the groups the game thinks actually exist at mission start. (Any group which is not present in mission.sqm but appears when the mission is played, is one that's created post-start by a mod or script)
You can also use units to see what all those groups actually contain
can I play sound that is probably not defined with class, but exist in game and I know path ?
for example, want to play "A3\Sounds_F\arsenal\weapons_static\Missile_Launcher\Locking_Titan.wss" with playSound command
to be local to player only
Not with playSound. playSound3D will accept a path though.
However, you can create your own CfgSounds classes in the mission description.ext, and point those at the sounds in the game files. https://community.bistudio.com/wiki/Description.ext#CfgSounds
I was already checking playSound3D in mean time, and since 2.06, there is last param
local: Boolean - (Optional, default false) If true the sound will not be broadcast over network
so I will use that probably
when I disable simulation of ModuleSmoke_F the smoke stops to generate (what I want to achieve), however sound from the smoke grenade is still emitted. Can I somehow mute the emitted sound or destroy the emitter without deleting the grenade or module itself (and placing new one later)?
Thanks, solved my question 
it seems that each "Praetorian 1C" turret has it's own group that is not visible in editor. In mission.sqm each praetorian 1c entry is followed by a group that has 1 object with some "B_UAV_AI" type
Yes, UAVs all have their own groups that aren't normally visible in the Editor (every unit is in a group and UAV AIs are units). You can make them appear by giving them waypoints.
You can look at the module's config (right-click on the object in the Editor and go to Find in Config Viewer) to find out what function it executes under the hood. Then you can have a look at that function (in the Functions Viewer) to see how the sound is created, and then you can determine if there is a way to interact with the sound source.
I did that and module itself doesn't have any sound parameter as it spawns a grenade that produces the smoke grenade sound. disabling simulation on the module disables creating smoke particles from the grenade but not the sound
Does deleting the grenade stop the sound?
You could use https://community.bistudio.com/wiki/createSimpleObject to replace the original grenade with a Simple Object if you want to keep the model around for visual purposes.
is there a way to make the default value of a param the value of another param?
For example
params ["_element1", ["_element2", str _element1]];
Above example is what I want to do but it is incorrect.
using {str _element1} might do it. If not, you can pretty easily do this outside of the params itself:
params ["_element1", ["_element2", objNull]];
if (isNull _element2) then {
_element2 = str _element1;
};```
yeah, I did that workaround. Just curious if there was a cleaner way. Thx
try using a particle, although a particle will last a certain amount of time without you being able to delete it
Could anyone help my figure out why this script is running on mission start instead of when I activate it?
player addAction ["Load Objects", call J3FF_fnc_LoadObjects, nil, 999, false, true];
The call seems to be happening on the mission loading in and then wont call any time I try and activate it
problem solved, needed to add {} surrounding the script bit
How can i alter this to include editor placed roads?
private _roads = [worldSize/2,worldSize/2] nearRoads worldSize;
How would I do that? I was reading about locality on BI but not sure how to apply it
"Local Effect" means the change only happen on the client (or server) where you run that specific script on.
"Global Effect" means the change would be replicated on all machines (client and server) in the mission automagically.
If you use local effect inventory commands (like https://community.bistudio.com/wiki/addItemCargo) on client, the items added would only be present on this specific client. And no other machine (client or server) would be able to (directly) interact with them (to see them in the inventory or take them away).
Can i run arma 3 in this system?
CPU: Intel(R) Core(TM) 13-6100 CPU @ 3.70GHz
RAM: 3971 megabytes
GPU: Intel(R) HD Graphics 530
GPU RAM: 1985 megabytes
OS: Windows 10 (10.0.0) 64bit
Threads: 4 logical processors
Version: 65786
literally the same question is answered at #arma3_questions message
even has the same typo
not scripting related, either
and googling that same configuration word-to-word including the typo gives at least two instances of the same question on different websites. In Persian if i believe google translate. 
is this some kind of meme?
help my
go to #arma3_questions, please, the answer to your question is literally less than a screen away from the bottom now
Anybody has experience with using scripts of TPW mods in a singleplayer mission? Whenever I try to execvm tpw_core.sqf I get undefined variable in expression _x in several places.
For example first line of this piece of code:
{
tpw_core_hats set [_i, -1];
};
} foreach tpw_core_blacklist;```
Any ideas what could be the problem?
Is there a { before that line? One is required for that forEach to be complete, which is what makes _x work.
Otherwise I might suspect that tpw_core_blacklist has not been defined; you would probably have to consult the mod's documentation to find out what that's supposed to be.
If tpw_core_blacklist needs to be user-defined it's a little odd that they didn't make a fallback for if the user didn't do that, instead of letting it just script error, but hey ho
Aah, it might be about the parameters I am using to call it, I will test now
Yes, it is user defined through parameters and I wasn't putting anything. Thank you!
That solved this problem and now I have a new one XD
As is tradition
Hi
Is there command to check if explosion has done damage via
this addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
}];
I know, i have already explosion EH, but if i want add like specific gun (_projectile == "big gun ammo") EH, do i thought if i could attach these both in same EH / check these in one
Does it just go off the first person that accesses that inventory to assign it locally to them?
define "go off"
code runs on a machine you run it on. And code with local effect only changes game world state on machine it runs on.
I have this set to an eventhandler for 'man', when he gets hit, it runs this script. my problem is that when he gets hit, it's not checking the damage but if the unit dies then it works. Really confused as to why
if (_dammage > 0) then {
hint "Ouch! Ive stopped";
man allowDamage false;
man setDamage 0;
man disableAI "PATH";
sleep 20;
hint "I'm moving again";
man allowDamage true;
man enableAI "PATH";
};```
you cannot sleep or suspend in any way in an event handler; this is an unscheduled environment
i seee thank you ill fix that, but still the first hint shjould still show everytime the man is hit, but it doesnt, only when the unit dies
I am trying to use TPW scripts for a SP mission and this part of the code seems to be not working as intended:
{
if (isClass ((_cfg select _i) ) ) then
{
_cfgName = configName (_cfg select _i);
if ( (_cfgName isKindOf "camanbase") && {getNumber ((_cfg select _i) >> "scope") == 2} && {[_str,str _cfgname] call BIS_fnc_inString}) then
{
tpw_core_civs set [count tpw_core_civs,_cfgname];
};
};
}; ```
I tracked down the problem until `tpw_core_civs ` and it seems it doesn't change at all here. What could be the problem?
If this is the case, would you by chance know of any other way of achieving the same effect as what i have in the script?
provide your whole EH please?
singleplayer or multiplayer?
Just to remove ai pathing for a little time and make them invincible
coop
so multiplayer
is the same object assigned man variable name?
yep
seems to work on my machine. If poor bastard isn't killed instantly - he gets healed and immune to damage π€ What's your result and what are you expecting?
my result is that when i hit the guy, it doesnt trigger the if statement
only when i kill the guy
O_o
so im suuper confused cos like theres no reason for it to not work
"hit the guy" as in "bullet to the knee"?
yea
bullet anywhere but head
cos usually head just kills
like any wounding shot
i do have mods on, not sure if thats impacting it
tried this ```private _dammage = getDammage man;
if (_dammage > 0) then {
hint "Ouch! Ive stopped";
man setDamage 0;
};``` and still same effect
like im confident there are no errors in this
idk if bug or something
maybe add some systemChats inside the EH body and script file. See if EH get executed at all. See if file gets executed at all. See if damage on the unit actually changes. Or maybe even use diag_log instead of systemChat if you test the stuff on the dedicated server π€
Yea ok so the EH is working properly
Just not the contents of the script???
script gets called
Something with the If statement or how _dammage is setup
π€·ββοΈ change it to if (true) then { and see if the rest gets called
Are you sure that the man is the object?
and not group
cant send a screenshot proof but yes
imgur or #offtopic_bot_cmds and verify
done
i think you're right i did man wrong somehow
but it worked for you @south swan ?
literally copied from the chat into file/mission and run like that
yea idk
Don't forget you can use a handleDamage EH rather than hit to nullify incoming damage, preventing the unit from being accidentally killed instead of stunned
It might be worth trying a different variable name for your unit. man is a pretty generic name and it's possible some other script is also using and overwriting it.
ill look into handleDamage, thank you for that
Unfortunately made no difference
Are you using ace?
Then you need use ace damage
That could be one, not sure, but some times ace does things what you do not know
ACE Medical does indeed override all vanilla damage with 0. Not sure about interaction with vanilla "Hit" EH, but it's likely to conflict
But that should work because i use ace and i have in script
(getdammage (driver bombcar1)) >0.5)
And that works
This
Mmm im readin on a Ace medical handleDamage
but it seems even they use it
player setVariable ["ace_medical_allowDamage", true];
// set damage head
player spawn {
_damageHead = (player getHitPointDamage "HitHead") + (player_damage select 0);
[player, _damageHead, "head" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};
// set damage body
player spawn {
_damageBody = (player getHitPointDamage "HitBody") + (player_damage select 1);
[player, _damageBody, "body" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};
// set damage right arm
player spawn {
_damageRArm = (player getHitPointDamage "HitRightArm") + (player_damage select 2);
[player, _damageRArm, "hand_r" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};
// set damage left arm
player spawn {
_damageLArm = (player getHitPointDamage "HitLeftArm") + (player_damage select 3);
[player, _damageLArm, "hand_l" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};
// set damage right leg
player spawn {
_damageRLeg = (player getHitPointDamage "HitRightLeg") + (player_damage select 4);
[player, _damageRLeg, "leg_r" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};
// set damage left leg
player spawn {
_damageLLeg = (player getHitPointDamage "HitLeftLeg") + (player_damage select 5);
[player, _damageLLeg, "leg_l" , "bullet"] call ace_medical_fnc_addDamageToUnit;
};``` this for example
player_damage is not damage player, though
_bodyPart = ["Head", "RightLeg", "LeftArm", "Body", "LeftLeg", "RightArm"] selectRandomWeighted [0.47,0.69,0.59,0.55,0.61,0.58];
_dmgType = selectRandom ["backblast", "bullet", "explosive", "grenade", "burning", "falling"];
[player, _damage_you_need, _bodyPart, _dmgType ] remoteExec ["ace_medical_fnc_addDamageToUnit", player];```
this way you avoid locality issues
Wow, thank you
now that i actually think, damage/getDammage are pretty goddamn sure to get screwed by the ACE Medical
Yea ngl the more i think about it and read into it i think you're righ
what is it are you trying to achieve exactly?
maybe check for https://community.bistudio.com/wiki/isDamageAllowed then to prevent parallel waits :3
When an object health gets too low, they will not take damage, reset their health and disable PATH for like 20 seconds or so, then enable damage and enable PATH
So like they're stunned
like monster chasing after you, you shoot, instead of kill it stops for a bit
so you can run away before it comes and gets you agaion
ok even disabling ace didnt work, still the same issue
_object addEventHandler ["Hit", {
_unit=_this#0;
_obj_current_health = damage _unit;
if (_obj_current_health < 0.2) then
{
_unit allowDamage false;
_unit setDamage 0;
_unit disableAI "PATH";
sleep 20;
_unit allowDamage true;
_unit enableAI "PATH";
};
}];
See apparently sleep doesnt work during event handlers
you might need to spawn the inside functions for sleep
according to Lou who mentioned it previously
Because what you wrote was essentially what i originally had before i gutted everything to try and debug
_object addEventHandler ["Hit", {
_unit=_this#0;
if (damage _unit < 0.2) then
{
_unit spawn {
params ["_unit"];
_unit allowDamage false;
_unit setDamage 0;
_unit disableAI "PATH";
sleep 20;
_unit allowDamage true;
_unit enableAI "PATH";
};
};
}];
this should accommodate sleep - alternatively, you can use public variables for the whole shebang
Riiiiight
Testing it now, first test worked
nvm, still being damaged through the 20s grace period
you'll probably need to add in another check to see if it already has a spawn running
if ACE Medical is still in use - it can disregard vanilla setDamage π€·ββοΈ
im not using Ace for the moment
original probelm persisted even with it not enabled
im having trouble adding another check to spawn, im pretty new sorry
Consider this example ```sqf
_hp_curr_object = damage _unit;
_object setVariable ["object_dmg_total", 0];
_object setVariable ["object_dmg_increase", _hp_curr_object];
_object removeAllEventHandlers "hit";
_object addEventHandler ["Hit", {
_unit=_this#0;
_object_curr_dmg = (_unit getVariable "object_dmg_total") + (_unit getVariable "object_dmg_increase");
_unit setVariable ["object_dmg_total", _object_curr_dmg];
if ((_unit getVariable "object_dmg_total") > 0.8) then
{
_unit spawn {
params ["_unit"];
_unit setDamage 0;
_unit disableAI "PATH";
waitUntil { diag_tickTime > 20 + diag_tickTime};
_unit enableAI "PATH";
};
};
}];
_object removeAllEventHandlers "Handledamage";
_object addEventHandler ["Handledamage", {0}];
_unit setVariable ["object_dmg_total", _object_curr_dmg]; doesn't need a second set of "
then its
this will prevent the object from getting any damage until the damage threshold has reached and then kill the unit if so
gimme a sec while i formulate an answer
Yea its setting damage to 1 if it goes over
but 1 is dead isnt it?
Like this is checking if theres overkill then reducing it to 1?
Thats my understanding of it
Ohh so you modified the threshold now
To being the desired health
This seems a lot more robust
too
Only thing i dont understand is the handle damage EH
oh wait thats literally the EH
nvm
modified it with sleep waitUntil
i seeee, diag_tickTime is a timestamp
If the goal is to override damage I'm not sure why the Hit EH is being used instead of HandleDamage
a slightly better code i guess - dont know if waitUntil can run inside EH unlike sleep which requires spawn
waitUntil requires a scheduled environment, just like sleep
anything that suspends the execution environment needs to be scheduled
then off to spawn we go 
haha
I guess its from the original probelsm i was facing
but true handle damage can be used in more robust way
I would go for HandleDamage instead
if it wasn't working before, it's not because HandleDamage won't work for this - something else was wrong.
Overriding the damage value w/ the Hit EH is an easy way to end up with weird behavior
yea i didnt know that prior to this conversation
I think its what we're exploring now
I do have to sleep right now but i want to say thank you to everyone who jumped in on this, i really really appreciate it and actually learnt a few things
such an amazing community
Will try again soon and maybe rethink on how to do the problem in the first place
oh while you are here @tough abyss - the article problem still persists 
ah I see
if (_enable_diary) then
{
if (!_tempvar && {_sides isEqualTo []} && {_groups isEqualTo []} && {_players isEqualTo []}) exitWith {
["ERROR - Select a side/group/unit"] call zen_common_fnc_showMessage;
};
// waitUntil { not isNull player };
// if (((side player) in _sides) || ((group player) in _groups) || (player in _players)) then
{
// if !(local _x) then { continue };
_x createDiaryRecord
[
"diary",
[
_diary_title,
format ["<execute expression='
[] spawn
{
disableSerialization;
[
[
[""title"", ""%1""],
[""meta"",[""%2"",""%3"",""%4""]],
[""textbold"",""%5""],
[""image"",[""%6"",""%7""]],
[""text"",""%8""],
[""textlocked"",[""%9"",""%10""]],
[""author"",[""%11"",""%12""]]
],findDisplay 46,true
] call bis_fnc_showAANArticle;
}
'>""AAN Article""</execute>", _title, _editor, _new_date, _timezone, _subhead, _main_img, _main_img_desc, _body, _body_locked, _lock_msg, _editor_img, _editor_info]
]
];
// };
} forEach ((call CBA_fnc_players) select {(side _x) in _sides || {(group _x) in _groups} || {_x in _players}});
``` this does not seem to work and returns the 'empty' diary record thread....
essentially im trying to make this diary record only for players/groups/side
I see
firstly, you'll want to format your if statement differently if you want short-circuit eval to be most efficient
if (!_tempvar && {_sides isEqualTo [] && {_groups isEqualTo [] && {_players isEqualTo []}}})
^ like so
notice each consecutive condition after the first is nested in the previous {}
isEqualTo is cheap, lazy eval might make that more expensive
yeah good point
if you're going to do lazy eval in general, though, the way I presented is usually the most efficient iirc
now, as for why it's not working...
I'm going to assume you have _enable_diary and _tempvar set to true for this testing, yes?
enable diary yes, tempvar is false - essentially yes the variables defined work as expected (with the initial if statement going through)
well, I guess _tempvar doesn't matter as long as the sides, groups, and players aren't empty
yeah alright
Does it work as expected without the forEach? I seem to remember it working fine when it was on its own.
yes when i run it as player createDiaryRecord locally it works fine
oh and its running on if (!hasinterface) exitwith {};
should i perhaps run it in server with remoteexec sqf?
trying to create a diary record for remote player with _x createDiaryRecord still sounds iffy
yeah createDiaryRecord has local argument
this is something you'd want to run serverside
so really your check should be if (!isServer) exitwith {};
and then do some remoteExecs for each player
like I expressed last time, it would probably be a good idea to have that entire "createDiaryRecord" code chunk in a function called fnc_createRecord or something similar
then define that in cfgFunctions and remoteExec that for each player
i did try that too with #include path to your functions.hpp
I remember you trying it with an #include but I don't recall writing an hpp
either way it'd be best to not beat around the bush and just put it in a cfgFunctions proper
having a .hpp is unnecessary
either that, or, you can just go the somewhat gross route of remoteExec'ing the entire block as a call
but that's not exactly network-friendly and is unnecessarily gross
class CfgFunctions
{
class ELP
{
class functions
{
tag = "ELP";
file = "\PBOName\functions";
class createRecord {};
}
}
}
can be as simple as this in a config.cpp, would just need to replace PBOName accordingly
then can call the function as ELP_fnc_createRecord from the functions dir in the PBO
file as \PBOName\functions\fn_createRecord.sqf
ah great
it depends in the grand picture of what you are trying to achieve, filling them locally will just fill them when the command is executed for them, if you want to constantly add stuff for example, when you open or close the box, you can probably use event handlers for those. Now, if the purpose if to fill the box arbitrarily for everyone at the same time but only let them have their own inventory for example, you remote execute the function which you will prepare to fill them all, everyone will see the inventory which will be local to each and wont sync to a player. Alternatively, a "local only" box will only show inventory relevant to the player using it, as it doesnt syncs over the network
Thank you
still no go
the sqf is being executed proper but the display is not
for ref
Note: Arma 2 OA! What does actually happen if I use callExtension in scheduled context? Does the game jump into unscheduled context because it's calling an extension or can it handle the extension call in scheduled context? (My extension is already working but it's causing heavy lags for players and on server despite of being executed in scheduled context, so that made me wonder about it)
This command is blocking, meaning that the game will wait for the extension to return before continuing.
makes me think it overrides the scheduler totally and can cause waits longer than the maximum allowed script time allowance π€