#arma3_scripting
1 messages · Page 694 of 1
ok
but then your script is just wrong, you're suspending forEach with the while, so only the first unit will be playing the animation(until he's dead, etc)
it worked with all the units listed
its working now
the while alive _x just makes sure the animation only plays on the living guys... idk i got that part from someone elses script because i couldnt figure it out on my own
i have like 40 bohemia wiki tabs open
i'm guessing you're in unscheduled, and that while acts +- like an if
otherwise it's not possible what you're saying, so technically it's just nonsense
yo bros does animated briefing work in MP? since it uses timeline
if you spawn your script, you will see the problem
don't know how it works, but looking at the wiki page, i don't see why it wouldn't
even if it doesn't, it for sure can be adapted to MP
im running the mission in sp and hitting the trigger makes it work fine
change while {alive _x} do {_x playmovenow "AmovPercMrunSnonWnonDf"}, to if alive _x then {_x playmovenow "AmovPercMrunSnonWnonDf"}
it will work the same way, but it will be proper now
ok
will {_x disableAI "anim"; if {alive _x} do {_x playmovenow "AmovPercMrunSnonWnonDf"}} foreach RunningODST; [R21, "USMCa"] remoteExec ["say3d"];
sleep 20; if {alive _x} do {_x playmovenow "AmovPercMstpSnonWnonDnon_exercisePushup"} work to make them run for 20 seconds and then do pushups
if {alive _x} do {_x playmovenow "AmovPercMstpSnonWnonDnon_exercisePushup"} _x is undefined
you need to use forEach again
and that sleep will throw error if you keep executing this in unscheduled, wrap your code into [] spawn { ... } https://community.bistudio.com/wiki/Scheduler
so just wrap my code in the editor and hit go?
yes, wrap the part where sleep starts, till the end
unscheduled good - scheduled bad
yeah, that's what i said
ohhh, im blind 
i don't think there is ever a scenario where you need to use scheduled code
nope
Is there any way to save data from a mission to a file? Is there a scripting command by chance?
you mean write to a file from sqf?
Yeah
use an extension
How does that work?
you might be able to find something already compiled for use, i think there are a few made
it wouldnt run with if i switched back to if and even ran it on a server and it works fine sharp, idk why ill ask the guy who made it when i see him though, i think _x is probably a catchall of all units affected by the code thats built into the game.
send the code
i think _x is probably a catchall of all units affected by the code thats built into the game.
_xis just the current value that is being iterated byforEach
//print 1 2 3
{
systemChat str _x;
} forEach [1, 2, 3];
_x
Represents the current element during a loop with: apply, count, configClasses, configProperties, findIf, forEach, select.
- bohemia wiki
its a magic variable
yo bros is it possible to run a script during briefing screen? init.sqf seems to pause in the brieifing screen?
waitUntil{
{[_x,0] spawn BIS_fnc_hideMarker} forEach ["tengah", "kanan1", "kiri1"];
{[_x,0] spawn BIS_fnc_showMarker} forEach ["kanan1", "kiri1"];
sleep 1;
{[_x,0] spawn BIS_fnc_hideMarker} forEach ["kanan1", "kiri1"];
{[_x,0] spawn BIS_fnc_showMarker} forEach ["kanan2", "kiri2"];
sleep 1;
{[_x,0] spawn BIS_fnc_hideMarker} forEach ["kanan2", "kiri2"];
{[_x,0] spawn BIS_fnc_showMarker} forEach ["kanan3", "kiri3"];
sleep 1;
{[_x,0] spawn BIS_fnc_hideMarker} forEach ["kanan3", "kiri3"];
{[_x,0] spawn BIS_fnc_showMarker} forEach ["tengah", "kanan1", "kiri1"];
hint "done!";
sleep 1;
(time>50);
}
want to make some kind of slide show animation in the briefing screen, but loop seems to only work after game is started
If I were you I'd use a while-loop and I'd do some investigating as to how time behaves in the briefing screen.
why use while loop?
wiki example says
Wait until mission fully started:
waitUntil { time > 0 };
so i assume in the briefing it will stay below 0?
Because you are not waiting until something happens, you are doing something while a condition is met 😅
i am waiting until the mission fully started?
its only for the brieifing
it should be (time>0) at the end of the script, i used 50 to test whether the loop will execute in game after the briefing and it does, but it paused during the brieifng
Give it a try with uiSleep instead of sleep
ok 1 sec
omg ur genius!
i forgot sleep doesnt work when the game is paused like in the briefing screen xD
thanks a lot
btw do you think theres a better way to optimize that code?
[_x,0] spawn BIS_fnc_showMarker with a 0 duration, seems like you could just set the alpha to 0/1 synchronously
i.e. _x setMarkerAlphaLocal 0;
then you don't need to spawn 400 threads
you're right
could the foreach ones be optimized?
my brain still learning the logic
well instead of [_x,0] spawn BIS_fnc_hideMarker} forEach ["tengah", "kanan1", "kiri1"]
you can write
"tengah" setMarkerAlphaLocal 0;
"kanan1" setMarkerAlphaLocal 0;
"kiri1" setMarkerAlphaLocal 0;
it'll probably be faster but it might be otherwise worse
not that you'd be able to notice the difference between the two
ok thanks mate
i'll go with this
waitUntil{
{_x setMarkerAlphaLocal 0} forEach ["tengah", "kanan1", "kiri1"];
{_x setMarkerAlphaLocal 1} forEach ["kanan1", "kiri1"];
uisleep 1;
{_x setMarkerAlphaLocal 0} forEach ["kanan1", "kiri1"];
{_x setMarkerAlphaLocal 1} forEach ["kanan2", "kiri2"];
uisleep 1;
{_x setMarkerAlphaLocal 0} forEach ["kanan2", "kiri2"];
{_x setMarkerAlphaLocal 1} forEach ["kanan3", "kiri3"];
uisleep 1;
{_x setMarkerAlphaLocal 0} forEach ["kanan3", "kiri3"];
{_x setMarkerAlphaLocal 1} forEach ["tengah", "kanan1", "kiri1"];
hint "done!";
uisleep 1;
(time>1);
}
Well to me this code is still more about doing something and less about waiting, so reading while (time < 50) do { ... } would make a lot more sense to me 😛
probably while { time == 0 } do {} is what you want
one more thing, would having a lot of markers have any performance impact? just making sure lol
Nah
I believe so, but only when the map is open
You can't possible place enough markers to make that an issue
Might also have been with some scripted-live-marker-stuff like BLUFOR tracking; can't remember.
if your while do can be replaced by do while (which is technically what waitUntil does), you should always replace it, because you run one code instance less per iteration
One code instance?
you omit the while condition call
Wow 😅
thank you everyone 
you cannot spawn things "on" a unit. Scripts aren't assigned to any unit.
but you write player. That means the script runs locally on the players computer.
if the player exits his Arma or disconnects from your server, scripts on his computer don't run anymore.
So you don't really have to care about it exiting or not.
local variables are local. They are only visible in the current scope.
A second different eventhandler is not the current scope.
um im trying to move some of my Triggered Sound Clips to Scripts and the code im using works when i have it on the activation for the trigger ([Cmac, "Cmac"] remoteExec ["say3d"];) but when i use it in the script as (if (triggerActivated Trigger1) then {
[_cmac, "Cmac"] remoteExec ["say3d"];
};) it does nothing
should i be using while instead of if
to create a while do setup
nvm while do works for reference
#arma3_scripting message can i get a response to this question if its possible? i just want to know if its a bug.
On one hand it could be a bug.
On the other hand I know the code and know that the list gets updated/re-rendered every frame
idk.. I remember using this command in the past and it worked perfectly. i tried with the 2 available syntax.
lbSetText [123, _selectedIndex, "Updated Text"];
or
_control lbSetText [_selectedIndex, "Updated Text"];
if someone can test it and confirm its not a bug, that would be perfect
I just tested it
but only with "dynamically filled" lb
and there's no bug
it does update
(dev branch; v2.05.147802)
i test it on the main branch
Works fine
I still don't think there is a bug
you're probably not doing it right
don't use lnbSetText 😛
you can show us your code. maybe we can spot something
i can't bc i removed all the code with the lbSetText for use lbSetTextRight instead, but i just wanted to know if that was a bug or was my error. Thanks anyways 😄
Is there any way to load files outside of the arma3 directory? Such as a path "C:/Temp/image.paa"?
using an extension, yes
though if you want the engine to use it somehow, then no
If you add actions to objects via configs, how do you pass the soldier that interacted with the item into a function?
the same way as normal actions I would assume
see addAction
Is it actually possible to turn off the runway lights? I was checking out C_EB (Game Over / last mission in campaign) and I noticed they have code to do so...but it doesn't actually turn the lights off...they are on...
What did you do?
set damage maybe
otherwise, hide them?
IIRC either did work
The BIS example is using {_x setDamage 1}
For add action it's params ["_target", "_caller", "_actionId", "_arguments"]; but when adding stuff via config all that is written on wiki is just this with refers to the interacted item.
Other lights are {_x setDamage 0.95] and they are out...the rest of altis is dark except for gas stations for some odd reason...
So to hide it I would use {hideobject _x} ?
or {_x hideObject true;} ?
seems not to be possible
https://community.bistudio.com/wiki/UserActions
Scratch this whole converstation. BI forgot they added 3 new types of lights to the runway and never fixed C_EB. Worth the bug report?
nope, SQF won't be fixed I believe
Posted as "minor"
fair enough 😊
I loved Game Over. I hacked the mission so I could save and went on a 72 hour rampage...
@past gazelle Yes. SetDamage 0.9 for each lamp.
In fact, i discovered that blowing up an Orca near the AFF heliport near the swamp....for WHATEVER reason...completely resets your kill statistics...
It's such a weird bug...
daheck 😄
Alright...now to fix the gas station lights...gonna just leave on the red lights for the wind turbines, assuming they are powered by emergency batteries...
Hmm...doesn't appear to be working because they are structures and not just lights...
lol, ok, got the price/feed lights...however..the ceiling and sign lights are appearantly NOT lights but textures that have a minimum brightness set...
Maybe easier/more practical just to detonate a cruise missile at the gasoline stations...
@past gazelle What is the problem to hide unwanted signs by script?
I got the runway lights turned off properly now, but I can't turn off the FuelStation lights...using setDamage 0.95 also removed the feeds/pumps so...
Sorry, the ceiling/sign lights look like they turn off, but the textures actually glow in the dark...
but the textures actually glow in the dark...
Ah. So, looks like you need an alternative model.
As for me, I removed all modern lights from Altis 🙂
If you really need it, you can auto-replace all fuel station parts with a proper models.
Actually I was thinking of simulating a cruise missile attack so blowing them up might be a better idea. What bomb in Arma would emulate a cruise missile?
or maybe a naval bombardment?
Hmm.. anyone know what the difference between 32Rnd_155mm_Mo_shells and 32Rnd_155mm_Mo_shells_O is?
one has _O at the end
Guess there's only one way to find out which one kills me when I spawn at the station...
_O suffix is usually for OPFOR, so it might be an exact copy/paste but for CSAT weapons
see the config browser maybe 🙂
Ahh ok...
https://drive.google.com/file/d/12C30MkLo0P4396xHvV9H_M52i85gZ9vB/view?usp=sharing Gas Station with lights turned off...
Note: you can't actually see the ground...because the lights are off...
if you shoot them, are they "broken"?
I dropped a bomb_3 which took out the pumps, it missed the signs though...
I mean, if you use your pew pew on the shiny thingy, does it unshine?
Should 150 rounds of 5.56 destroy a gasoline sign?
In my personal experience...a decent slingshot could do it. 😛
(No the sign is not destroyable by 5.56 ammunition)
i suspect the material has some luminosity. maybe you can use setObjectMaterial
@past gazelle Create an invisible soldier with an mg, who can move between gas stations and shoot signs. If it is still shining, then he drop a bomb.
@past gazelle To be serious. Replace shining signs with simple objects. Do you need an example?
Yeah an example would help, otherwise I was gonna just code up bomb drops at about half the gas stations in the game...
I have something like this: bomb = "32Rnd_155mm_Mo_shells_O" createVehicle getMarkerPos "IE_FUEL_1";
Just wondering what would make a bigger boom to get the signs...
tens of them 😄
Actually yeah I'll take your code otherwise I'm gonna be carpet bombing altis and thats a violation of...well nobody gives a damn anyway...
what is this anti-gasoline sentiment 🤣
Oh I'm remaking Game Over into an alternate storyline using ALiVE to simulate moving troop movements for a solo player...
I really liked the scouting missions on Stratis where you just go around and do whatever with no objectives/markers/communications so I'm writing the scenario so that CSAT jams conventional radio and uses a listening-net they placed on altis to auto-target military radio communications with cruise missiles thus shutting down communication completely...
@past gazelle Firstly, find needed objects.
I.e., the object is _replacement:
_replacetree = (_replacement call BIS_fnc_simpleObjectData) select 1;
Then save its coords and dir, and then:
_simpleobject = createSimpleObject [_replacement, _coords];
Then setdir and setPos + vectorUp or pitchBank if needed (mostly it doesn't)
oh tree as in binary tree not thing with leaves, right?
Guys I am trying to script my way to faster Swimming and Ladder movement, it works great and the animations are indeed sped up but it seems like the actual speed for both is still the same. Is there another thing limiting the speed on those actions besides animation speed?
// Faster Animations Feature
if (vPARAMS_Player2xSwimLad isEqualTo 0) then {
//Speed up certain animations that are too slow by default (Ladder Climing and Swimming)
switch (true) do {
case (animationState _unit select [1,3] in ["bdv","bsw","dve","sdv","ssw","swm"]): {_unit setAnimSpeedCoef (playerBaseAnimSpeed * 1.5);};
case (animationState _unit isEqualTo "ladderciviluploop"): {_unit setAnimSpeedCoef (playerBaseAnimSpeed * 1.5);};
case (animationState _unit isEqualTo "laddercivildownloop"): {_unit setAnimSpeedCoef (playerBaseAnimSpeed * 1.5);};
case (animationState _unit isEqualTo "laddercivilstatic"): {_unit setAnimSpeedCoef (playerBaseAnimSpeed * 1.5);};
case (animationState _unit isEqualTo "ladderrifleuploop"): {_unit setAnimSpeedCoef (playerBaseAnimSpeed * 1.5);};
case (animationState _unit isEqualTo "ladderrifledownloop"): {_unit setAnimSpeedCoef (playerBaseAnimSpeed * 1.5);};
case (animationState _unit isEqualTo "ladderriflestatic"): {_unit setAnimSpeedCoef (playerBaseAnimSpeed * 1.5);};
default {_unit setAnimSpeedCoef playerBaseAnimSpeed;};
};
};```
ok so the objects should be Land_fs_sign_F and Land_fs_roof_F
@past gazelle It is from my script, the name doesn't matter 🙂
And no, it is not a binary tree.
Btw, to find objects I use:
(nearestTerrainObjects [[worldSize/2, worldSize/2],["HIDE","WALL","HOUSE","FENCE","TREE","SMALL TREE","POWERSOLAR","TRANSMITTER","POWERWAVE","TOURISM","POWERWIND","SHIPWRECK","POWER LINES"],18000,false])
Set classes to fit your needs.
"ok so the objects should be"
Object classes, not objects. Objects are objects, they have ids and so.
Yeah actually I was staring at the code for nearestTerrainObjects about an hour ago and couldn't figure out which class lights would be in...
"figure out which class lights would be in..."
For active lights, and other active objects, you need to use nearObjects.
[worldSize/2, worldSize/2] nearObjects ["Your class here", 18000]
worldSize/(sqrt 2) no? so it covers the angles in case of a land terrain (and not an island)
As for me, with 18k it covers all the Altis.
yeah, no don't mind me I thought about [worldSize/2, worldSize/2] being x & y 
but you could replace 18k with worldSize/sqrt 2 as well
I got a feeling this is gonna take all night for me...those lights are bomb proof 🙂
Actually, could I just drop a trigger at each gas station light?
Drop a trigger instead of bomb? 🙂 Why?
No no, bombs don't work.
Those lights...are battle hardened...
Oddly, gas stations look really stupid without the fuel pumps too
Oh, I suppose arma has a really decent crater texture I could replace them with?
I think the only way is to recreate signs with simple objects. Try it.
I have working scripts with global auto-replacement, so you can ask me - just need to pull it out of the mission.
You can examine it by yourself in Overthrow WW2.
There is a script that replaces all lamps with simple objects at day, and vise versa at nights:
fn_poweroff.sqf and fn_poweron.sqf
Sorry I had the wrong term, Game Logic is what I've used to destroy military towers...
Do you have a recommendation for a nice broken sign or crater?
Nope, I'm working on another time period 🙂
https://www.youtube.com/watch?v=FD_PgAm3h64
FSSign setDamage 1```
So I have something like this..but obviously setDamage isn't working...
How could I just delete the signs?
@past gazelle Firstly, if you want to switch off the LIGHT, that is not the object itself, do only setDamage 0.9 (or so)
No no, I've already got all lights on altis turned off...
including these, I just need to change out the models
Then if you want to remove the sign, _object hideobjectglobal true;
And if I want to replace the gas station building/pumps with a a crater what could I use?
I found a crater I just need to get the sqf to find the object name
What object name? If you're talking about the object in editor, then RMB - copy class names in a clipboard or so.
Of in a script, then start foreach loop, find needed objects, save its coords and other params, then create needed objects at that coords.
Ok, different approach: can AI use actions added with addAction commands?
@thorn saffron AFAIK no, but why? You can easily run that code in action for needed units. Actions are the GUI parts, it is only for human players.
Oh, does creating an object overwrite the existing object?
@unreal scroll I want AI to be able to interact with an object. Problem is, AFAIK you cannot pass who interacted with an object in user actions you add in configs, you can only pass what object was interacted. That is why I'm asking if maybe AI is able to use addaction actions
Thats not achievable over actions . You need to write the ai, you cant just feed it an action and hope they know what to do with it
@past gazelleOverwrite? 🙂 No, it just creates an object.
You can even create it at the same place.
@thorn saffron"That is why I'm asking if maybe AI is able to use addaction actions"
If you press a button, it is not a script, it is your own decision.
AI have no "decisions", but can be scripted. So you don't need to add "decision simulation", but scripting knowledge.
You need to find a needed soldier with the script, and do the same action.
Shortly, the task is to find the unit, and it can be scripted the same way as the action.
You do realize that you can order your AI squad memebers to use actions when they are able to do so, right?
Most likely it is hardcoded. So don't count on it.
Theoretically you can make a wrapper for, say, ACE actions, to be executed via actions - but it makes no sense 🙂 Only if you have nothing to do at all.
FYI there is literally a config value for userActions that allows you to expose the action for use by the AI. My problem is you cannot pass who did the interaction and the alternative addAction action is not available to AI, with pretty much means I'm unable to do what I wanted.
Man no luck. I've been trying nearestObject with all sorts of stuff...
I don't get why this code works for the military towers but not when I replace the object name...
Show your code
["House_F","House","HouseBase","NonStrategic","Building","Static","All"] Maybe it's because FuelStation isn't actually listed?
This is what I found in the Splendid Config Viewer
I mean, show your script
I'm using a Game Logic entity just to try to remove one sign for now: FSSign = nearestObject [position this, "House"]; FSSign hideObject true;
hmm? I thought FSSign was just any variable name
oh oops!
What should that be then?
Yeah...that's what I had in!
oh wait
you mean it needs to be Land_fs_sign_F = nearestObject [position this, "Land_fs_sign_F"]; ?
No. typeof FSSign == "Land_fs_sign_F"
Sorry, i thought sqf scripting allowed variable name creation on the fly...
Hey guess what!
Another bug!
I tried it with Land_fs_roof_F and it deleted the gas station roof!
But it doesn't appear to work at all with Land_fs_price_F or Land_fs_sign_F
that or you made a mistake somewhere 😄
I'll try again, I'm not smart...but I'm a persistant bastard...
which is quite an important trait!
Ok so yeah, spawned Slammer UP too, cannot run these signs over...
At least the ones in Zaros are 100% indestructable...
Thanks for the help, I at least got the gas station ceiling, not sure what I'm going to do with Land_fs_sign_F though...
Gas station building was also 100% indestructable...
Ok, yeah, I copied BIS's game logic for destroying buildings, got rid of the gas station building...
@unreal scroll Please let me know when you get around to updating the gas stations for your WWII mod. I'm very interested to see how it goes...
@sage dawn the moveOut fix is now available
You can use a QPATH_SOUND to an ogg file packed into a PBO and put that directly into playSound3D without a need to produce CfgSound config and presumably that might work with filepatching to make those available from that very specific place on the system but however the custom code is getting packaged and distributed (mission, mod PBO) is probably the best place for the sound itself.
It plays from the initial location for the length of the sound that is indeed the case.
say3D ?
I mean, that works for characters that are walking afaik.
Why a directory? Are you using this for music?
Will only the player hear this? or will it be from a vehicle?
Well, I got tired of setting up cfgSounds too, so I just made a huge simple numbered list and then renamed the files to 1.ogg 2.ogg 3.ogg
as long as they are tagged you should still be able to see the info in Windows Explorer if you need to swap out a song...
It's dirty but it works, if you need to you could pre-code for 99 tracks and then just duplicate the files....
no
the only command that can do that for you is say3D
which doesn't take file paths
I asked for that feature but I don't think anyone is gonna implement it
@unreal scroll Hey! I got rid of the signs using the hideTerrain module in Eden. Not sure why this works but it does.
yeah it seems to work pretty well now, I can moveOut a dead body from a destroyed vehicle easily
I actually swam to a friendly nato boat whose soldiers were dead...and was surprised to see my character just dump the bodies..guns and all in the ocean every time I moved a seat...
that's not what we mean tho 
it's always been like that
Yeah I know. I just think it's the first time i've actually gone to a boat with dead friendlies aboard...dumping them in the water seemed kind of cruel... 🙂
on the topic of dead bodies, is there a way to tell if a dead body is from a player or not?
isPlayer returns false then
what about inside a killed EH?
not sure, the script I need is in a vehicle's killed EH
or actually that did give me an idea, I could put it in the unit EH
that might even work better
oh yeah it does return the player name
now how do I know if that name is of a player?
compare it to allPlayers?
you can or you can set global variable on every human player and check it on dead body
i will have a look if player identity still accessible via dead body then perhaps add alt syntax to isPlayer
this seems to work sqf ((allPlayers apply {name _x}) find (name theBody)) >= 0
allPlayers findIf {name _x isEqualTo name _deadbody} > -1
uhhh what if _deadBody was already a _x inside a forEach
_x is local scope so should be no problem
but then the _x inside the findIf won't be the _x from the forEach
but I mean, if it becomes allPlayers findIf {name _x isEqualTo name _x} > -1 that's not going to work
I guess I'll have to store the forEach _x as a variable first
you have to save that one into a variable
yeah that 
but then also is there really much of a difference between ((allPlayers apply {name _x}) find (name theBody)) >= 0 and allPlayers findIf {name _x isEqualTo name _deadbody} > -1?
it is
apply will first iterate over the allPlayers array and then findIf will loop over it again
Thing is, findIf will stop looping as soon as it finds a match
Which is faster. In your case allPlayers will never be big enough to make a difference though
why not just use setVariable ["is_player", true] in onPlayerRespawn/initPlayerLocal/server?
yes not like that, inside the findIf _x will be allplayers player
@past gazelle "Please let me know when you get around to updating the gas stations for your WWII mod."
I'm not using gas stations, only gas tanks placed on military based - so I replaced all gas stations parts with buildings/ruins.
But, as I said, I made the trick with simple objects with street lamps.
"Hey! I got rid of the signs using the hideTerrain module in Eden. Not sure why this works but it does."
It works the same way as hideobjectglobal.
any suggestions on how to draw text on the map? I have markers drawn on the map for objectives but I want to have text on them a la sector control
but i can't find a way to just write text on the map
ctrlCreate
but I just recommend using a marker
is there by chance an empty marker?
idk. but you can set its alpha to 0
doesnt that also make the text invis
oh 
that was the problem i ran into
this would have all been avoided if you could just write text in ellipse markers using their text field..
is 62 the empty mark
61
EmptyIcon ?
Empty
whats the damage event handle that is initiated before the damage is calculated by the game?
HandleDamage
Hello people, does anyone know its possible to test if a script is not running, i.e. if a script handler exists?
scriptNull isEqualTo script_handler
isNull script_handler
Both will throw an error if the script_handler has not yet been executed.
thought that too, thanks lol
scriptDone (missionNamespace getVariable ["script_handler", scriptNull])
so If I do damage _unit, it will give me the damage before the unit gets damaged?
yes
and if you look at the event handler arguments on the wiki, _damage is the damage that will be added to that value
yeah thanks
@sage dawn added alt syntax to isPlayer, next dev https://community.bistudio.com/wiki/isPlayer
question: I have a group that can have only units or vehicle with units. I want to count number of units in group, but if group contain vehicle, count group units as 1.
private _count = units _group;
found this: BIS_fnc_groupVehicles
@real tartan
If it is supposed all units should be inside vehicle(s)
private _count = [{alive _x} count units _group, 1] select ((units _group findif {isNull objectParent _x}) == -1);
or, if any unit is inside a vehicle:
private _count = [1, {alive _x} count units _group] select ((units _group findif {!(isNull objectParent _x)}) == -1);
note: group only contains vehicle with units inside, or just units
@real tartan "group only contains vehicle with units inside"
To be precise, group cannot contain empty vehicles. So, group contains units without vehicle, or group contains units in vehicle(s)
yes, * in vehicle. if group contains vehicle, it is just one
I need to improve my Green Team AI scripts. I want to set randomized AI spawns that frustrate my players. I'd like to increase the size of the AI groups based on number of players. I like the idea of preloading the npcs and setting their gear and referencing them by name.
Anyone have a decent AI spawn script.
And how do you like to trigger it? I'm thinking when a player is nearby but I need a way to prevent multiple groups spawning. So I need a despawn script or something that prevents another group from spawning until the other group is dead.
I understand how to create the array of individual units, but how can I call array size, randomized, but based on number of players in the area.
Like 1 player= 2 enemies, 2 players = 4, 3 or 4 will be a larger group of say, 10 or something.
I guess I can do it the easy way of an if, else if structure:
if players <= 1 then do this
If <= 2 do this, etc
@unreal scroll thx, I used it like this:
private _groupUnits = [units _group, [(units _group) select 0]] select ((units _group findif {isNull objectParent _x}) == -1);
would be nice to have driver instead of first unit in group [(units _group) select 0] tho
private _groupUnits = [units _group, [driver (([_group, true] call BIS_fnc_groupVehicles) select 0)]] select ((units _group findif {isNull objectParent _x}) == -1);
you think it's possible to set the text of a marker to center justified?
this addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
{
_n = damage _unit;
sleep 0.1;
if (isPlayer _source) then {_unit setDamage (_n + 0.01);};
};
}];
when I try to change the damage value casued by a player to a certain character, it goes invincible (it won't take damage)
is there a way to fix?
EHs are unscheduled
Why do you sleep in the first place?
Hehe
I assume it didn't complain about the suspension in unscheduled environment?
Probably because you are returning code
I wanted to wait until the game calculates the damage, then set the damage back to the value I wanted
it gives no error but the unit receives no damage
of course I checked isDamageallowed and stuff
returning? how exactly, I'm not returning values but returning code is something new lol
SQF is evil
anyone got ideas on a vehicle/soldier spawner script that isnt spyder's addons? it's not a bad one I just want a different one if possible
@drifting portal
You can return the damage.
this addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
if (isPlayer _source) then {_damage = damage _unit + 0.01};
_damage
}];
if I do it this way
there is not point in it
because the unit will not die too lol
In SQF, the last value is always the return value, whether you want / need it or not.
//_result will be 2:
private _result = call {
private _a = 1 + 1;
_a //This is the return statement!
};
```The semicolon can be left out or added for the return statement, it makes no difference (but in my opinion it makes sense to omit it when you actually *want* to return the value, just for readability).
well
man if only the antistasi vehicle spawning system was like. easily copyable. that'd be nice imo
what does returning value have to do with the fact that its not setting damage for the unit? lol
I'm confused
like its not executing _unit setDamage (_n + 0.01); as it seems
because damage stays as 0
Now your EH code is ...
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
{ //Return value start
_n = damage _unit;
sleep 0.1;
if (isPlayer _source) then { _unit setDamage (_n + 0.01); };
}; //Return value end
```... and the last value there is what's inside the curly brackets. It's just code (as in data type) and it is never executed, because there is no `call` or `spawn` to go with the curly brackets.
hmm
I tried spawning everything
but no change
should I only spawn the setDamage?
So in total you want to deal the default value plus 0.01 damage?
no
so
HandleDamage EH occurs before damage is calculated
and I'm trying to get the damage of the unit before the damage is calculated
and add 0.01 to that
If code provided returns a numeric value, this value will overwrite the default damage of given selection after processing.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
Presumably, that would be the _damage parameter provided by the EH
Isn't that for the damage caused by the bullet?
not the damage of the unit as a whole?
Ah, yes, probably.
so If I do _n = 0.01 only without any other commands, will that work?
nope
this increases the damage by 0.01 (if I am not wrong)
this addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
damage _unit + 0.01
}];
oh yeah forgot the damage part, thanks lol
Going off of this I think you might be after something like this:
this addEventHandler ["HandleDamage", {
params ["_unit", "", "", "_source"];
if (isPlayer _source) then { //Might need to use _instigator (too)
_unit setDamage (damage _unit + 0.01);
0
};
}];
in this case I was just setting it to 0.1 continuously
thanks @willow hound @brave creek
if you dont do it right, players will heal eachother using it
“shoot me to heal me”
im using say3d on a unit and for some reason if the player is looking directly at the unit it is silent, but if you stand with your head facing away from unit you can hear it
is this an issue with say3d or something else because the other say3d commands i have are working find
that's a new one I haven't seen before
whats your distance setting for the say3d
Hey, this is the code I use to spawn single enemy unit on trigger
group_1 = creategroup east; enemy1 = group_1 createunit ["LOP_ChDKZ_Infantry_TL",getmarkerpos "sp1",[],0,"form"]; enemy1 domove (getmarkerpos "wp1")
Only problem is that they all face north/0 degree. Is there a way they spawn facing a custom direction? The number 0 in there represents how many meters they will be away from their spawn point, not the direction they are facing.
so you can use setDir, but its important to create the unit at something like [0,0,0] first, setDir, then move to where you want it.
@fair drum i fixed it i hope, just the syntax vers i was using has an issue for some reason, i altered the syntax and it fixed it
Currently the code reads
[] spawn {
{_x disableAI "anim"} foreach RunningODST;
{_x playMovenow "AmovPercMrunSnonWnonDf"} foreach
RunningODST;
[R21, "USMCa"] remoteExec ["say3D"];
sleep 60;
{_x playMovenow "AmovPercMstpSnonWnonDnon_exercisePushup"} foreach
RunningODST;
sleep 60;
{_x enableAI "anim"} foreach RunningODST;
{RunningODST setSpeedMode "LIMITED"; RunningODST domove (getmarkerpos "M2")};
};
and it runs great up to the point that the second sleep60 ends, i want them to smoothly transition to standing but the animation just ends abruptly instead
and then they still wont actually move to M2
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
'''sqf
//[] spawn {
{_x disableAI "anim"} foreach RunningODST;
{_x playMovenow "AmovPercMrunSnonWnonDf"} foreach RunningODST;
[R21, "USMCa"] remoteExec ["say3D"];
sleep 60;
{_x playMovenow "AmovPercMstpSnonWnonDnon_exercisePushup"} foreach RunningODST;
sleep 60;
{_x playMovenow "AmovPercMstpSnonWnonDnon"} foreach RunningODST;
{_x enableAI "anim"} foreach RunningODST;
{RunningODST setSpeedMode "LIMITED"; RunningODST domove (getmarkerpos "M2")};
};
'''
No quotes?
[] spawn {
{_x disableAI "anim"} foreach RunningODST;
{_x playMovenow "AmovPercMrunSnonWnonDf"} foreach RunningODST;
[R21, "USMCa"] remoteExec ["say3D"];
sleep 60;
{_x playMovenow "AmovPercMstpSnonWnonDnon_exercisePushup"} foreach RunningODST;
sleep 60;
{_x playMovenow "AmovPercMstpSnonWnonDnon"} foreach RunningODST;
{_x enableAI "anim"} foreach RunningODST;
{RunningODST setSpeedMode "LIMITED"; RunningODST domove (getmarkerpos "M2")};
};
there you go
that my current code
i need to drop the now from that last playmove
wait, no i dont
use just playMove
it doesnt throw any errors its just that
sleep 60;
{_x playMovenow "AmovPercMstpSnonWnonDnon"} foreach RunningODST;
{_x enableAI "anim"} foreach RunningODST;
{RunningODST setSpeedMode "LIMITED"; RunningODST domove (getmarkerpos "M2")};
};
``` doesnt work
it doesnt work correctly i should say
{RunningODST setSpeedMode "LIMITED"; RunningODST domove (getmarkerpos "M2")} what is this? a code blob that never gets executed?
and also setSpeedMode doesn't take array
ok ill fix that, currently in that code i just sent the sleep 60 passes, and the unit ends its previous animation, but it just terminates instead of transitioning smoothly to the standing animation "AmovPercMstpSnonWnonDnon", and then of course i need to fix SetSpeedMode
i can just limit their speed in editor i think as the domove animation will override it anyways and when they exit the animation they should still have limited speed
Let's leave out the doMove option -
group_1 = creategroup east; enemy1 = group_1 createunit ["LOP_ChDKZ_Infantry_TL",getmarkerpos "sp1",[],0,"form"];
Now how do they spawn facing a custom direction? They will remain stationary at that spawn point
default direction is 0 and will be unless otherwise specified
you could write a script that selects a value for their direction from an array of 1-360 using bsi_fnc_random
Using _x to select a value for all units affected by the script
Just to be clear, the 0 in that script is their position away from the spawn point. Like, you put 20 in their, AI spawns 20 meters away at a random pos
I'm aware. Direction is default going to be 0 like I said.
you need to use setDir in addition
Copy that
and if the unit is part of a multi unit group, you need to use setFormDir
i still cant get the group to execute the domove
i got the animation sort of smoothed out by making the sleep the length of the animx4 so it plays 4 times and the cut is less noticable
does anyone know if there is some getter for TI mode similar to this https://community.bistudio.com/wiki/currentVisionMode ?
yea
I wanted to use it on vehicle so I guess I could hack one of the UI idcs ( CA_FlirMode ) then
did you remove the curly braces where i mentioned? and did you fix the left argument for the setSpeedMode?
what do you need, PM me plz
I cannot get a trigger to run a function. I have this condition:
this and ((getPos (thisList select 0)) select 2 < 1);
And this in the activation:
(thisList select 0) spawn KER_fnc_repair;
But it will not run. How can I do this simple thing? There must be a trick to this I am missing. And yes KER_fnc_repair is defined in CfgFunctions. This works when I use execvm, but I do not want to do it that way.
if it works with execVm, then the trigger has nothing to do with it, you probably just setup cfgFunctions incorrectly
But I tested it and this works fine.
[cursorObject] spawn KER_fnc_repair;
@leaden haven You're using round brackets in the trigger but square brackets for the test.
Around the argument for the function that is.
OK, this works, I forgot to set trigger to EAST and repeatable.
[thisList # 0] spawn KER_fnc_repair;
Now I can finish my mission.
I am coding when I am tired.
yo bros, just me or is the sound that plays when u use hint really quiet?
It is. Just spam the hint command!
does anyone know how to trigger a keyframe animation via trigger or script?
got a link?
actually. what is a timeline?
There doesn't seem to be any documentation other than the functions
hmm that page has no links leading to the timeline function group
yea thats why i got confused too
so basically
a timeline is apparently the core module of a keyframe animation
it should be possible to create a timeline purely from sqf, right?
I am just thinking of a way to make a connection between the Key Frame page and the timeline function group
Anyone know how I can script something to deduct from the CP from warlords?
I'd like to write an addiction for something at the HQ where a player can basically buy defending AI. It will need to deduct from CP to prevent spam and offer another defensive option.
Not sure what that command would be if at all possible.
And I'm still trying to figure out how to make a purchasable crate with a predefined inventory in the warlord request menu...
WL CPs are handled in the player's variable, so setVariable
Ah ok. So can I generically deduct from it or would I need to grab the value, return the value and set an if/then statement to deduct from it?
@warm hedge I'm assuming I can find the actual variable in my mission.sqm right?
can you use https://community.bistudio.com/wiki/setPlayerRespawnTime to allow something like fast redeploying? Like, if I used this can I make it so that there's an action that sets the player's respawn time to 0, kills them silently, and then they can choose any respawn position immediately?
yes
or you can just move them instead of killing
right but I wanna reuse the vanilla respawn position thing because it works well enough and I'm lazy
yo bros is there a way to freeze animations on a player other than disabling simulation? like for AIs you can disableAI "anim" but humans they always return to the gun animation
@ripe sapphire also trying to figure this out pls let me know if you figure it out
maybe play the AidlPercMstpSnonWnonDnon_AI animation
I'm trying to get forcerespawn to work without the sound of a guy falling over dead
so far the only way i know is to enablesimulation false when player reaches the pose you want during the anim
throw them in the air first! 🤣
lmao
i might actually have to end up doing something like that
or setPos them like really high up in the air
yeah this is what I mean
or just delete them 🤣
yeah I tried doing deleteVehicle right after the forceRespawn but I don't think it worked
lemme test that again
store the player unit first
_unit = player;
it looks like
actually lemme just post the code
params ["_caller"];
if !(local _caller) exitWith {
[_caller] remoteExec ["SG_fnc_redeploy", _caller];
};
setPlayerRespawnTime 0.5;
_caller enableSimulation false;
forceRespawn _caller;
hideObject _caller;
deleteVehicle _caller;
[] spawn {
while {!(alive player)} do {
sleep 0.5;
};
setPlayerRespawnTime 20;
};```
this still makes the body crumpling sound
or the water splashing sound
even if I set the height of the _caller obj to 99999
then the sound is created by the respawn system 
so i assume that means theres no way of getting around it?
what if you switch the camera to another object temporarily?
switchCamera
Can some one help me learn the game I just got it
Ok thank you
or maybe #looking_for_game
I think it was possible using anim event handlers
np have fun!
@little raptor this works but the map disappears
like I get the 'cannot connect to the positioning system' screen
how? coz if you run switchmove every time animchanged then its basically gonna be a looping animation
i assume theres probably a way to force enable the map that I dont know about

dunno then. disable the sound 
thats what I'm trying to do lmao
0 fadesound 0? lol
well that changes all volume right
i guess yeah
thats probably the least dumb way of doing it
it makes sense for sound in the deploy screen to be muted anyway
use the animChanged event handler
and playMoveNow
yea but it wont freeze right
its gonna keep looping it?
i believe AIs with disableAI "ANIM" they freeze at the end of the anim
@little raptor @ripe sapphire this works well enough, thanks for the help!
yeah
leopard if i give a unit a name, say thisunit, and then in MP the player who controls that unit respawns, will variable thisunit return the new respawned object?
I am looking to create a projectile with a given velocity, is there a createVehicle like command for projectiles?
afaik no. but you can create a self-hosted mission and test
ok
yes. createVehicle 
i remember theres a command to sync respawned objects to their new bodies but forgot the name
Will that work for a non cfgVehicle class though?
cfgVehicles + cfgAmmo
Thank you. Now to figure out why I cannot get that to work. Thanks.
leopard how do u sync the respawned objects with their variable?
i think its very funny how the wiki says you can do ctrl+shift+c in the arsenal to copy loadouts in config form to put in cfgrespawninventories but neglects to point out that this is wrong because the code that runs to serialize inventories doesn't include weapon scopes
use a respawn event handler
Hi, i am doing a mission in the vietnam tunnels
but as the spawns of the enemy garrison is random i need my players to spawn in without beeing onehitted by a randomly spawned enemy
therefore i set the player characters to captive mode when spawning
now i want to make a trigger, that disables their captive mode if they progress in the tunnels
i tried: If {(captive _x) then {_x setCaptive false}} forEach allUnits;
but it gives me an error ingame- any tipps?
If {(captive _x) then {_x setCaptive false}} forEach allUnits;
What is this? You need to learn syntax.
{if (captive _x) then {_x setCaptive false}} forEach allUnits;
just a code i found online, in the past i managed to create small scripts by copying and editing stuff i found
im a complete newby when it comes to coding. so is there maybe a simpler way to remove captive for each unit that passes through the trigger?
The simpler way is the way that works 🙂
https://community.bistudio.com/wiki/setTriggerStatements
thisList is the variable that passes to activation and deactivation.
So you can do in activation:
{if (captive _x) then {_x setCaptive false}} forEach thisList;
so thislist would refer to all units ("any player") as selected in the trigger settings?
thanks! appreciate the fast response
working perfectly now:)
any difference in (get/set) PosATL and PosASL when units are on land?
other than the Z value
Hey lads,
Can I get some help with scripting
I don't do scripting at all so I'm gonna need someone to help me.
DM me.
My problem is this:
I'm trying to put in my own music into the game, but I just cannot get it right because the tutorials being too hard for me to understand.
Or ping me.
I've read what they did, the music doesn't play now.
Explain more than not working. Like actual codes
published a small script to deal with flying tanks
Have this code block sitting un-used on my PC , might as well publish. Mainly for scenarios with player-driven armored vehicles where flying tanks is an issue. Problem: - Tracked vehicles can go flying with unfortunate collision with other objects Solution: - Periodically save the tanks position ...
but if I WANT to have this amazing arma feature! lol
How would i go about deleting the supply crate after a timer. I am using the support request supply drop and trying to use
_this, deleteVehicle;
and variations of that
I tried
deleteVehicle _this;
as well
Latter is the correct syntax
ok im going to try it again without the timer to see what happens.
I have a preloaded crate with an inventory, and I am calling that inventory in the crate init field on the supplydrop porvider module (virtual). I want the box to land and last say, 300 seconds so it will despawn and not clutter things.
yup that didnt work lol
"Error Invalid number in expression"
this is currently in my :vehicle init" field on my support provider: supply Drop
[ _this, ImperialSupplyCrate getvariable "loadout" ] call BIS_fnc_initAmmobox; deleteVehicle, _this;
Hey people can anyone tell me with getting artillery fire to different positions and lets say 3 rounds on a base 2 rounds on a group of infantry etc with the fire mission waypoint
are you using zues or trying to script it?
zues is easy as hell you just spawn it lol
trying to script it
for a mission
ah ok. well the way i am using artillery support is through the support request module
so the player can use the commands to call it in on their target location
Oh ok thanks
thres videos how to do that
Yeah ik but i wasn't really trying to do that but it will work out
if you want you can also setup waypoints and script out spawning the artillery, then have it fir at the waypoint
but id have to look up the actual HOW to do that
Aight
youtube a script theres tons out there
Alright thanks bro
i just want to delete this damn crate after my box lands lol
[ _this, ImperialSupplyCrate getvariable "loadout" ] call BIS_fnc_initAmmobox; deleteVehicle, _this;
sleep 300;
{deletevehicle _x} Foreach _this;
what about my first delete this?
nope
idk why it works but _x is what i use for everything lol
you mind if i PM you about some AI scripts?
I have some that work but i want better, more randomized and dynamic ones
im trying to call in a MAC strike as an action on a computer that triggers on player interaction, i know that i need to use the addaction fn but i dont know the fn to just spawn the mac round
sure
add me
Thanks, tho actually after testing in a server it seems the variable name is already automatically assigned to the new respawned object
if ((velocity _This select 2) = 0) then {sleep 300; {deletevehicle _x} foreach _This;};
isnt working for us
help
yesh...halp us!
(velocity _This select 2) = 0 that's an assignment, not a comparison
we changed it to <1
so all is well now?
nope
shes still nonfunctional
its a head scratcher
we tried that like 8 iterations ago
uhuh... and do you get an error?
yes
other than the Z value
what? that's all that matters. otherwise all position commands return (almost) the same X and Y
all you need is a CfgMusic class.
https://community.bistudio.com/wiki/Description.ext#CfgMusic
that's just wrong and makes zero sense
velocity _This select 2
foreach _This;
wat? so which one is it? an array or a vehicle?
yes.
its an array with only that vehicles name in it because we had to have it like that
im putting this into the crate init field of my support request supply drop (virtual)
I want the crate to despawn itself after a period of time so it doesnt persist in the world and clutter things.
if (((velocity _this) select 2) < 0.1) then {sleep 300; {deletevehicle _this}};
Supposed that it is a scheduled environment.
yo bros im trying to make player blow up a crashed plane with its simulation disabled, and after player detonates a satchel near the plane, then the plane's simulation will be enabled and it will be destroyed.
question how do i check if a satchel is detonated inside a certain area
You can try to add MPKilled or Killed EH to satchel, and get coords from passed object, then do the check.
then your code is wrong
ok but what if satchel is player placed
no event handler works on CfgAmmo
@ripe sapphire Then only to fin it with a loop check.
Or do a trick I did with bombs - add a small destroyable object to a satchel with a loop. Then you can detect the explosion.
thoguht about something like this too, maybe place it somewhere near the plane
Maybe allmines?
what object did u use?
no
"Land_Balloon_01_air_F" 🙂
just capture the placed explosive with a FiredMan event handler
if the explosive is within your "area", start the loop
all you have to check inside the loop is when it's dead
Yes, this is the best way.
got it got it
if player dies does the EH get removed?
yeah
also if something is hidden with hideObject, can it still be destroyed?
"if the explosive is within your "area", start the loop"
it is better to catch it with Killed EH, 'cause the loop could hang.
"also if something is hidden with hideObject, can it still be destroyed?"
What you want to hide?
crashed plane
you can't destroy it with your satchel at all
like I said, event handlers don't work on CfgAmmo
We're not talking about ammo, see above.
a satchel is an ammo
no, its an actual UAV, just disabled simulation and adjusted to make it look crashed
"Land_Balloon_01_air_F" is the destroyable object. It can be attached under the ammo.
it can be blown up
if its simulation is disabled, it can't
yea i wanna hide the balloon
i know, thats why i have to detect if satchel is detonated, then enable its sim
"yea i wanna hide the balloon"
You don't need to hide it with hideobject
which won't work
because the explosive "effect" is already calculated by the engine
"because the explosive "effect" is already calculated by the engine"
He can just setDamage to needed object 🙂 Effects won't be missed.
yes. but what I'm saying is "you can't destroy it with your satchel at all"
you can script it of course
Depends on pov, because the common "destruction" is the script too 😉
no, it's handled by the engine. it's not a script
The program is a script. It does only one thing - shows you something on a screen. So everything is a script/program. I don't think he would actually care about what caused the destruction, if it looks the same ))
@ripe sapphire "i wanna hide the balloon"
This is my script to simulate trees damage on bomb explosion:
_veh addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
if ("bomb" in tolower _ammo) then {
_proxy = "Land_Balloon_01_air_F" createVehicle getpos _projectile;
_proxy attachTo [_projectile,[0,0,0]];
_proxy addEventHandler ["Killed", {
params ["_unit"];
private _objects = nearestTerrainObjects [getpos _unit,["TREE","SMALL TREE"],20,false,true];
{
_x setdamage 1;
} foreach _objects;
}];
};
}];
You can attach your object below the projectile, and it should be hide.
But, of course, you can also use hideobject - all attached objects will be destroyed too with the root.
no, a program is not a script
maybe googling "scripting vs programming" can help you understand the difference
As I said, depends on pov. If something acts and looks the same, then it has absolutely no difference for player. Explosion --> vehicle destroyed.
"maybe googling "scripting vs programming" can help you understand the difference"
I understand the "difference", don't worry. You don't understand my point.
your point was
you can script it of course
which I said it myself.
but this:
the common "destruction" is the script too
is nonsense
which was my point
It is not if you read what I said about player interaction.
Without it this dispute is pure formalism and makes no sense.
😳
i was thinking if i can put something thats hidden but can still be destroyed by the explosion
so i can easily check for the explosion with !alive hiddenthing
//Arma Script For Dynamic Unit Spawning
setVariable ["last_activation", time];
_Marker = ["Mark1"]; //Add more marks for more spawns
_group = ["_1group"];
_Enemy_Class = ["LM_OPCAN_CMA_Engineer"];
if [last_activation > Time -10] do
{
setVariable ["last_activation", time];
_Ai_Selected = selectRandom _Enemy_Class;
_Marker_R = selectRandom _Marker;
_1group = creategroup [independent, true];
{
_unit = _1group createunit [_x, getmarkerpos "_Marker_R",[],0,[]];
_unit domove (getmarkerpos "Group1M");
} forEach ["LM_OPCAN_CMA_Engineer"];
};
``` This is supposed to spawn a random unit at the marker, right now i only have the one opcan guy in the array but im getting an error and idk why
it works because its jammed into the ground, and when sim is enabled it explodes right away bcs game thinks it collided with ground
@ripe sapphire "i was thinking if i can put something thats hidden but can still be destroyed by the explosion"
If you're talking about the attached object, then it should be destroyed with the root, not with explosion. Just correcting.
"so i can easily check for the explosion with"
Do you need the condition, or event? If event, then add a Killed EH to the hidden object.
If you need a condition, then you don't need to add something to that ammo object.
Just save it in FiredMan EH and check later.
no, i was thinking of not using EHs, but instead an actual eden editor object, that is hidden, placed directly on the plane, but can still be destroyed when the satchel explodes
i mean i can easily place like for example an ammobox right beside the plane, then check whether its alive or not, and a satchel will definitily blow it up
but i dont want an ammobox there, so i was asking if hidden objects with enabled simulation can still be destroyed
To be sure: what hidden object do you want to be destroyed?
doesnt matter
it just there so that a trigger can check whether its alive or no
but i want this hidden object to be able to be destroyed by a satchel
It does, because it is attached to something, as I said, it will be destroyed with the root.
I thought you're talking about "proxy-object".
So, another question: what is the reason to destroy hidden objects (to understand your mission design). Sorry if I missed some conversation before.
no, im not using your script with attachtos
so basically
a satchel will definitely destroy an ammobox right
i place ammobox right beside plane, now i can use this ammobox, to detect, if a satchel has been detonated near the plane
but i dont want an ammobox to be showing beside plane, therefore hideObject
question, can this ammobox still be destroyed by satchel
Wait... Why? You have an attached object. So to detect the explosion, just use the Killed EH 🙂
Give the ammobox an unique name, and destroy it within that EH. It is the simplest way I believe.
what is the attached object?
"no, im not using your script with attachtos"
The destroyable object you attached to the satchel.
no
im not attaching anything
basically what im asking "can a hidden object with hideobject true be destroyed by a satchel
@ripe sapphire We told you before, several times 🙂
Hidden objects cannot be destroyed by usual explosion, handled by the engine.
That is why I gave you the way to destroy it using attachable object 🙂
i already asked this and your answer was what you want to hide :/
"I thought you're talking about "proxy-object".
ok, thanks anyways, guess using EHs are the only way
It is the most effective and reliable way. You can have many issues with loops, and it is could be much more complex.
ok just tested in gamne
hidden object just got destroyed by a satchel 😳
makes my life easier
"hidden object"
Hmm... Are you sure it is really hidden? Or just placed inside other object?
Ah... Yes, I remember. One I had a guard tower ruins appeared after an arty explosion nearby 🙂
So in my script I have simulation disabled for hidden objects. In that case it was enabled.
yup, since simulation is enabled it can still be killed i guess 
I suppose the engine handles the hidden object damage as it was on the same place.
Leopard20, am I right?
Once I needed to have a destroyable radar, but what I had is only a simple object from IFA3. But there was also a truck with almost the same geometry, so I attached the radar to the truck, and hid the truck with enabled simulations.
And I wasn't able to destroy the truck with explosion, until I moved the radar ~0.1-0.2 m by Y axis.
So I decided that the truck's collision mesh was still in place, and after such moves it became vulnerable for explosion from one side.
idk why but my code auto crashes arma 😄
Edit: trying to access an empty array at idx 0 is probably the cause
params[
["_units",[],[[]]],
["_primaryWeapon",true,[true]],
["_secondaryWeapon",true,[true]],
["_handgunWeapon",true,[true]],
["_uniform",true,[true]],
["_vest",true,[true]],
["_backpack",true,[true]],
["_helmet",true,[true]],
["_facewear",true,[true]],
["_magazines",true,[true]],
["_clothes",true,[true]]
];
if (_units isEqualTo []) exitWith {
["units is null, cant collect loadouts."] call BIS_fnc_error;
};
_primaryWeapons = createHashMap;
_secondaryWeapons = createHashMap;
_handgunWeapons = createHashMap;
//_uniform
//_vest
//_backpack
//_helmet
//_facewear
//_magazines
//_clothes
private ["_loadout"];
{
//get loadout, add it to array
_unit = _x;
_loadout = getUnitLoadout [_unit,true];
diag_log["unit: ",typeOf _unit];
{
//get gun name
_map = _x select 1;
_idx = _x select 0;
_name = _loadout select _idx select 0;
diag_log["_name",_name," idx: ", _idx];
_guns = ((_map getOrDefault [_name,[]]) + ([_loadout select _idx]));
_map set [_name,_guns];
} forEach [[0,_primaryWeapons],[1,_secondaryWeapons],[2,_handgunWeapons]];
} forEach _units;
probably because _name is nil and you're trying to put nil into the hashmap
yep thats my guess too. interestingly arma doesnt throw any error if you do
[] select 0
to prevent it do this:
_name = (_loadout select _idx) param [0, ""];
if (count (_loadout select _idx) > 0) then {
does too
i wish i had a "continue;" statement for the loop
wait
you do?
what the hell since when
2.02 iirc
since a couple of updates ago
thanks, memory
can we get a twitterbot tweeting sqf updates 😄
usually all these changes are listed under "Engine" in changelog
if you read them
can someone confirm that
values _myMap;
return a double nested array:
[[v1,v2,v3]] ?
okay its not armas fault, im doing something wrong
lul 😋
You have many errors
setVariable: ❌
if: ❌
createUnit: ❌
very weird. The map set crashed. _name is bad in some way.
But i just tried both passing nil and string type nil and both don't crash 
I know why it crashed so I'll just add a check, but no idea how you did that
Ah
Got it
[] select 1 is a special weird kind of nil that has no data
found more stuff going on.
if (true) then {hint "hi";
fails silently without printing errors.
Same for
selectRandom []
has that always been the case or did error logging just break recently?
in the debug console *
also in a compiled function. the whole function doesnt execute then without any trace as to why
That's how it's always been
you scripted well until now? 😛
I'll give that a shot. My script was very close to that
you can do it with waypoints (I think)
give them two waypoints
one up to where you want them to run to
set their behavior to careless, combat mode to Do not fire, and speedmode to full
then another waypoint which changes their behavior to combat and allows them to fire
Just ask here
it is i little much to write and i am from Germany and my english is not that good for a text massage
to talk is easy for me
Would this work fine to execute a code for all non-zeus players?
{
// Whatever code here
} forEach allPlayers - allCurators;
I want to have a sound played, when a player is killed by a player, but it doesnt work - i guess, that it is not possible to check "isPlayer _unit" when _unit is dead?
// This works, whenever a player is killing an AI
params ["_unit", "_killer", "_instigator", "_useEffects"];
if ( (isPlayer _killer ) && (!isPlayer _unit) ) then {
[_killer, "friendlyfire"] remoteExec ["say3D"];
};
// Is not working, the sound is not played when a player kills a player
params ["_unit", "_killer", "_instigator", "_useEffects"];
if ( (isPlayer _killer ) && (isPlayer _unit) ) then {
[_killer, "friendlyfire"] remoteExec ["say3D"];
};
from my experience people rarely answer to "DM please"
if your English is not good it's fine. we have German speakers here.
Just write your message in German
Then copy paste it into google translate
Then post your original message + translation (to follow the #rules ) here.
no
allCurators returns a list of curator logics
you need a list of players.
I have a server. On the server I have several spawn points that I can select when spawning.I would like that if I choose one of them to spawn on predetermined random points, for example a pvp arena and I press spawn that is randomly selected between, for example, 5 different spawn points
yeah. when the unit is dead isPlayer returns false
🤔
one idea I have is this:
create several areas (triggers) around each spawn point
inside each area, place markers for each random spawn point
then in onPlayerRespawn.sqf do this:
params ["_player"];
if (_player inArea spawn_1) exitWith { //1st respawn position
_randomMarker = selectRandom ["spawn_1_1", "spawn_1_2", "spawn_1_3"];
_player setPos markerPos [_randomMarker, true];
};
if (_player inArea spawn_2) exitWith { //2nd respawn position
// similar to above
...
}
in that example, spawn_1 is the name of the trigger around one of the spawn positions.
spawn_1_1 to 3 are the markers
do the same thing for the other spawn points
How about side ... is this preserved when _unit is dead? Or do it change to CIV?
nope
I recommend using a variable for now
KK said he would fix it in the next update
_curatorUnit = getAssignedCuratorUnit (allCurators select 0);
{
// Whatever code here
} forEach allPlayers - _curatorUnit;
Would this work if I had 1 zeus then?
no
just do this:
_curators = allCurators apply {getAssignedCuratorUnit _x};
{
// Whatever code here
} forEach allPlayers - _curators;
so _curators is an array here?
note that afaik, allCurators doesn't work on curators that are not assigned as playable in Eden
yes
in your case it would work if you did this:
allPlayers - [_curatorUnit];
```but only for 1 unit
So you mean like when the main zeus promotes another player using "Promote to Zeus" module
in Zeus Enhanced*
@tough abyss by a variable I mean like this:
in onPlayerRespawn.sqf and initPlayerLocal, add:
params ["_player"];
_player setVariable ["is_player", true, true];
not sure tbh
but I remember it didn't work when I created a Zeus module in the mission using a script
you can try it. if it doesn't work I have a trick
Alright, thanks for the help
I don't understand that correctly - do I have to use another EventHandler, because I can't use _unit in any way, because from the moment the _unit is dead, I can't access it in any way (i.e. if it is a player, the side etc.)?
Oh sorry
the variables that you assign to the unit are still valid after it's dead
Thanks a lot i'll give it a try
@little raptor thanks works
np
Hello, Q: concerning global object variables. I need to know when those are actually published, especially with respect to say, raising CBA global or target events.
In particular, can we depend on those variables having arrived at their destinations prior to handling those events, for instance?
what's BIS_phase? I can't find anything on the internet about it
If you publicVariable them, they get published.
Yes they are in order
actually, I mean more like, _object setVariable ['variablename', _value, _global], followed by an event, maybe that event also includes the object or an array of them as an argument.
I imagine the same sort of internal bookkeeping is happening, but I just needed to clarify, because it will be critical to this approach I am taking.
publicVariableEventHandler for public variables only but that's kind of already obsolete really so meh - change your design maybe?
how i do it for 2 seperrat markers
for like 2 pvp areas
Yes thats what I meant too
so to recap, when _object setVariable [..., ..., public], Boolean - When true, the variable broadcast is global and persistent, that gets published, would be before the event got raised.
that's what I am depending on, knock on wood.
"would be before the event got raised." what event?
huh? even with remoteExec or remoteExecCall, not sure what you mean?
CBA? Yes all CBA events, publicVariable, remoteExec is ordered
any event, custom CBA event, either global or target, etc, from server to clients.
what I said is applicable to as many respawn markers as you want
cba event is public variable
i fixed it it was my mistake
ok. I added some comments to the code (just in case)
you asked for an event handler
no, I was asking about the synchronization of public variables, in the missionNamespace is one, but more importantly via setVariable.
vis-a-vis raising events such as cia CBA, as a key scenario.
yes, and that's why I said "no it doesn't exist in vanilla", maybe you want to change your design?
I think I got it clarified however; thanks...
you must be doing something super complicated 😄
so perhaps to rephrase, when we make an object variable public, can we expect that value to be synced up, i.e. when we turn around and raise a CBA global or target event?
I have no idea what you mean by
when we turn around and raise a CBA global or target event?
sorry 😅
you can still use a function to do that for you
global events which occur server+client, target event which can target, say, a player instance.
[myObject, "varName", "value"] call MIC_fnc_setPublicVariable;
```?
and you could trigger/subscribe to its scripted EHs
hrm, I am not asking to sub to public variable changes themselves.
it's okay... I think @still forum clarified adequately.

ok ^^ I'll shut it so I don't waste your time 😅 still didn't get it (and I don't use CBA so it doesn't help)
now that I have you thoroughly confused right? LOL
I tried to turn my brain on, it flashed and fried. will try tomorrow
me neither 😄
my goal really is to reduce the number of extraneous events, messages, etc, if possible. and to leverage the intrinsic objects, public variables, etc, to the hilt.
I think I can achieve that with smarter use of public, sometimes targeted, variables.
…or remoteExec 😄 🤣
well, when I must; but if a var is already inherently public, that's extraneous, then, isn't it?
you can remoteExec an effect to a targeted client?
what is the difference between using execVM and spawn?
execVM = good for one usage
i don't know if this is what you were asking, but if you run a public setVariable followed by a CBA event, the variable will already be broadcasted when that event occurs, these things are ordered(as people have mentinoed previously), and a CBA event is just a publicVariable/publicVariableEventHandler
execVM is the same as:
spawn compile preprocessFileLinenumbers "script.sqf";
as you see, it compiles the script every time
so as Lou said, it's for one time use
It was preprocessFile without linenumbers.
But I wanted to fix that so maybe I did
but I'm pretty sure I did see which line the error occurred at? 🤔
if you don't have includes I think it doesn't matter
includes don't really matter, a line number won't get shown regardless if you use preprocessFile
Then I probably fixed it
I'm pretty sure it always did that 
unless you fixed it a long time ago
probably early last year
thanks
thanks
I'm trying to use vehicleChat to have the pilot of a heli and the co-pilot have a small conversation. I have gotten it to where the pilot can say things by using vehicle player vehicleChat "<Thing I want the pilot to say>"; But the documentation for vehicleChat doesn't show how to have others in the vehicle talk. Alternatively, if it does say it, I couldn't find it.
Any idea on what to do for the co-pilot to talk as well?
Change vehicle player part
To the variable name of the co-pilot?
Yes
If I change the vehicle player part to what I have below, It still only has the pilot talking.
vehicle playerHeliPilot vehicleChat "Shit";
uiSleep 3;
vehicle playerHeliCo vehicleChat "Militia must have a camp near by, we getting locked on to.";
uiSleep 6;
vehicle playerHeliPilot vehicleChat "Going to try to get us through.";```
If I don't have the vehicle bit at the beginning, no text shows up at all.
i need a script to spawn 2 Ai for each player in the trigger, currently i have gotten it to spawn the AI but i dont know how to get it to calculate the number of people in the trigger and then loop or adjust to the amount of AI needed
Thislist select {_x isplayer} or sth
For each?
Foreach loop. Biki it up
@spark turret so ```sqf
[my script here] foreach [thislist select {_x isplayer}]
Without brackets around thislist. Its already an array
yeah but i need it to pull the list of the trigger zone from the script as its running in a .sqf file not from the activation box of the trigger
because im using it in several triggers
is there any event handler that can be added to a bomb that would go off when it explodes?
like on a GBU or something that I spawn with createVehicle
I thought a Killed EH would work like that but it doesn't seem to trigger when it explodes
No
People usually use a helper object for that
use a helper object how?
like, attach something to the bomb?
that would get killed when the bomb explodes?
Yes.
I'll try that
The other method is a loop ofc
what might be a good object for it?
idk. Something that has hidden selections
So you can hide it using setObjectTexture
Just use a fast loop
so i have an issue with scripting
basically
i am using execvm to trigger .sqf scripts
which i somehow forgot didnt work on a non dedicated server
so how do i make it work through server?
is there a function for it?
i saw remoteexec but i need to make an entirely new function for that
It does work
But it depends what the script does
No you don't
so it has a bit of a system
basically
you have the holdaction thing to trigger a set of lines
which are
gateStart = 1;
[time3, false] call BIS_fnc_timeline_setPause;
time3 call BIS_fnc_timeline_play;
so that activates a certain trigger
and makes the object with the holdaction move
in the gateStart trigger there is another set of lines that activates
which are
[time1, false] call BIS_fnc_timeline_setPause;
time1 call BIS_fnc_timeline_play;
gate1 say3D ["SRB_Rumble", 100, 1, false];```
which opens a stone gate
and plays a rumbling sound
once the door is opened
you will see a buddhist icon
idol
whatever its called
which has another holdaction function
and once that's completed
it triggers another trigger
and in this trigger
there is
"curse.sqf" call BIS_fnc_execVM;
"earthquakes.sqf" call BIS_fnc_execVM; ```
very messy
i know
anyway
once you use the holdaction things
the objects just disappear
in MP at least
in singleplayer everything works fine
and the curse.sqf and earthquakes.sqf dont trigger either
it seems that the triggers dont activate at all since the last trigger is supposed to play music and an SFX too but it doesnt
but
it does work flawlessly in SP
You have to learn how stuff work in MP
Just read the wiki page on Multiplayer Scripting. You can google it (I'm on my phone so I can't link it rn)
Obviously you're using many things that have local effect
Such as holdActions
So you'll need a good system of remoteExecs to do what you want in MP
what i noticed with remoteExec from the wiki tho is that you need a new function
or something like that
like
how would i activate an SQF
through remoteExec
and also the holdAction is from 3den enhanced
i didnt know that was local though
good to know
If that script is to execute many times, making it a function is better anyway
But no you don't need to
its supposed to be executed once though
It's global but one time use only
yes but for some reason it doesnt work
what it might be tho
is the fact that the timelines im using are paused
and i might need to unpause them
because maybe the unpausing in the script causes them to disappear
but it still does work in SP
which is strange
[[], "script.sqf"] remoteExec ["execVM", 0]
That's an example of using execVM
see the wiki and the pinned messages for more info
When I begun scripting and even many months after, this was the holy grail I kept looking for many many hours
I am guessing the engine is telling the other clients to run the code inside that sqf file and not sending the whole of the code trough the network
It's just sending the string (and arguments, if there are any)
Perfect, so it is almost as fast as telling the clients to remoteExec a Function
works like a charm
thanks a lot
however
we have an issue now where the animation of the keyframe sequence only shows up to me
while it does work now
its as if the animation is a constant change for the other clients
which is strange
Hey, I trying to make some sort of function that will determine what is the highest point in an area(800x800) that has a line of sight to the center of said area.
Any suggestions?
So far my I was thinking about creating some object in the midle and use getposASL for each time I move him to the next point in the grid
Ok
to answer my own question lol
Fnc_GridCHeck = {
Params ["_Pos"];
Ycenter = [];
Xcenter = [];
_Pos = [_Pos select 0, (_Pos select 1) - 800, _Pos select 2];
for "_i" from -8 to 8 do {
_height = (floor getTerrainHeightASL _Pos);
Ycenter PushbackUnique _height;
_Pos = [_Pos select 0, (_Pos select 1) +100, _pos select 2];
};
Ycenter};
This is what I've got so far it check the height and returns an array
So next step would be figuring out how to use that information to guide the AI to the best position
then use ```sqf
checkVisibility
To check the validity of each posible position
Is it possible to detect (e.g. by EH) when someone creates a new map marker?
Yep
That is a mission eh, so it should be placed on the initserver.sqf file
(Fires locally)
Then from that one you can use RemoteExec to do whatever you want to whichever client that made the marker
or just
Deletemarker
oh perfect, that's exactly what I needed, thanks
I know there's the Tanoa Tidesystems and ArmAGeddon mods; is there any way to script the water level to rise without a full .pbo?
Nope
Why must this game always find a way to crush my dreams T_T
Blame very early days of AIs
I think Ded ever said AI pathfinding based on tides/sea altitude so cannot be changed dynamically
... Okay, fair, but frustrating.
#arma4wen
Geeze programmers, the games been out for 8 years and has recieved unprecedented support and updates, get it together xD
Note: the engine was based on 22 yo engine
any mention of this somewhere ? source ? maybe ticket ?
have you tried
Pushback
PushBackunique
?
That's a script command not config command
