#arma3_scripting
1 messages ยท Page 199 of 1
tried them, CombatModeChanged should've done it but it doesnt trigger for combat modes, just behaviour
nope, pretty sure i tried all the group EHs and none of them did it
k
Hi everyone.
Do you know how can I create an automatic Ship from sea to the seaport.
Do i need to juste createUnit & do a setPos in a for loop with config ? Or can i use something more optimised
Hey guys I have an issue with scripting a cutscene in the editor. Anyone have any solutions? The characters are all different (not copy paste), they all have the same animation, but they all go to a random direction when the scenario is loaded. The only way to fix it is to turn of simulation, but then it removes their "life-like" motions in the cutscene, as they are static.
pm me please if you find something, or know a solution
I bet a single channel release will reach people here. And if you share your code, what are you using for units?
didnt know exactly what channel to put it in, so threw it in the 3 i thought would most fit
let me grab it for you
this switchMove "Acts_AidlPercMstpSnonWnonDnon_warmup_8_loop";
@stable dune
and the sitting ones have
this switchMove "ace_sitting_HubSittingChairA_idle1";
and that is just in the Init for each unit
Some animations have a different base direction. Look in the animation viewer to see how it changes. Not everything is zeroed to a units y axis direction.
If this is the case, you'll have to modify the direction before playing the animation.
@fair drum How can I do that, tried various commands from the Wiki and none worked
also any idea why one of the two standing faces a different direction than the others even tho he has the same animation
Im pretty new to this thats why I am asking yall
this disableAi "ALL"; maybe?
WMV still exists as a format?
Keep in mind that units will try to orient themselves to match their group leader. You can try ungrouping them if they're in a group, or using disableAI "MOVE" to stop them turning. (disableAI "ALL" is an option, but it also disables their animation AI which could interfere with what you're doing)
thank you, let me try both of these rq. and i guess it does. tried to change file format to see if discord would let me have it play here but idk didnt work
@hallow mortar
disableAI "MOVE";
this switchMove "Acts_AidlPercMstpSnonWnonDnon_warmup_8_loop";
I did this and it has an error
this switchMove "Acts_AidlPercMstpSnonWnonDnon_warmup_8_loop";```
https://community.bistudio.com/wiki/disableAI
You still have to provide a unit to target with the command
oh right
sorry oops
THAT WORKS GOD BLESS, ive been trying to fix this for 2 days
thank yall
much love <3
I am spawning a bomb with a script and I want it to have an initial downward velocity. In my mind, the following should work, but the speed doesn't seem to get applied (the bomb spawns just fine).
waitUntil {alive _target};
private _height = 400;
private _fallSpeed = 500;
sleep _delay;
private _spawnPos = (getPosASL _target) vectorAdd [0, 0, _height];
private _bomb = "Bo_GBU12_LGB" createVehicle _spawnPos;
sleep 1;
_bomb setVelocity [0, 0, -_fallSpeed];
This won't be what's causing your velocity issue but it is something you need to watch out for: you're calculating the spawn position using ASL altitude, but createVehicle doesn't use ASL altitude. This means that in certain circumstances, the bomb could be spawned at the wrong altitude. You should either convert your position to ATL, or use setPosASL on the bomb immediately after creating it.
Bombs do have aerodynamic flight profiles. I'd kind of expect a 500m/s launch to overcome it to some extent, but it is possible that the bomb is simply too resistant to lateral movement. You might need to rotate the bomb so that it's pointing in the direction you want it to go.
Your waitUntil {alive _target} doesn't make a ton of sense to me. If the target is created before this script is spawned, then...it's already alive, unless it died in the meantime in which case you've just created an endless waitUntil. If it's not created before this script is spawned, you can't possibly be passing a reference to it. That waitUntil is almost certainly doing absolutely nothing of use.
If the target dying before this script is spawned is a concern, use if !(alive _target) exitWith {}; instead.
I intend to run it from an object's init field (so I can have a carpet bombing run saved as a composition), and I worry that the object may take a few frames to inialize.
Great idea, I'll try that ๐
Is there a way to script UAV to have unlimited battery life? I have enemy drones I want to do patrols but dont want to constantly refill their fuel.
I was told it has something to do with the terrain, but I'm asking if anyone knows any method to resolve this
rotate vector up with bis function
[vectorUp _bomb, nn, n] call BIS_fnc_rotateVector3D;
use
_bomb = "Bo_GBU12_LGB" createVehicle _spawnPos;
sleep 0.01;
Rot=vectorUp _bomb;
_bomb enableSimulationGlobal false;
myb = _bomb;
after this can check how look rotations and find correct numbers
[Rot, 90, 2] call BIS_fnc_rotateVector3D;
BIS_fnc_rotateVector3D first array its current rotation and functions for vectors have problems with calculating exact values so it is best to test through vector values at initialization or write an array with values equal to 0 in advance (Default object's vectorUp is [0,0,1]).
[[0,0,1], 90, 2] call BIS_fnc_rotateVector3D; For vector up
Because of problems with calculating vectors, I had to write the following code in my code for creating object compositions
//_r - reference object;
//_veh - created object;
//vhRot = [vectordir _r , vectorup _r];
//_direction = 0-360; // <- just dir
_vhRotDir=_vhRot#0;
_vhRotUp= _vhRot#1;
_veh setvectordirandup [_vhRotDir,_vhRotUp];
_v=[_vhRotDir,_direction, 2] call BIS_fnc_rotateVector3D;
_veh setvectordir _v;
After doing this, it doesn't matter how you rotated the reference object, the new object will always be rotated correctly.
Object init fields don't run until after the object has been created. Otherwise this wouldn't work.
yeah its better to stay away from the functions and use the vector commands directly with vector transformations.
Still trying to get the hideobjects to work with all the power poles and lines on the Malden map via script, because doing it manually, placing hideobject modules does work but would take ages to do on the entire map.
According to @molten elk I am looking to hide the following objects "PowerLines_Small_base_F", "PowerLines_base_F", "PowerLines_Wires_base_F", "PowerCable_01_base_F", but @proven charm did point out yesterday that nearestTerrainObjects would not work, so the following is not the way to go
nearestTerrainObjects [getPosWorld this, ["PowerLines_Small_base_F", "PowerLines_base_F", "PowerLines_Wires_base_F", "PowerCable_01_base_F"],10] apply {hideObject _x}```
You need isKindOf
but did you not say that it is not how it works yesterday?
@drifting badge maybe something like this? ```sqf
_lines = (getposATL player) nearObjects 50 select
{ // Select all power lines
_o = _x;
{ _o iskindof _x } count ["PowerLines_Small_base_F", "PowerLines_base_F", "PowerLines_Wires_base_F", "PowerCable_01_base_F"] > 0
};
{ _x hideObjectGlobal true; } foreach _lines;
nearestobjects uses iskindof check
This command matches objects using isKindOf comparison instead of direct class name == comparison. As a result, if a class type is a parent, the search will return all objects that inherit from the parent as well as parent itself. This command also only finds objects that are entities. If you are looking for non-entity objects, see nearObjects, nearestObject.
_lines = nearestObjects [player, ["PowerLines_Small_base_F", "PowerLines_base_F", "PowerLines_Wires_base_F", "PowerCable_01_base_F"], 50];
if (_lines isNotEqualTo []) then {
{
_x hideObjectGlobal true;
} forEach _lines;
} else {
hint "No power lines found within 50 meters.";
};
ah nice didnt notice there was nearestObjects command as well. well both codes work ๐
yours is faster though
is there a way to make the scroll menu not disappear over time?
or make it reappear
showCommandingMenu "RscGroupRootMenu";
showCommandingMenu "";
i tried that already but it doesnt work ๐ฆ
i mean the menu where addAction items are
@stable dune - oh brilliant, thank you very much that is exactly what I have been looking for!
You are welcome
trying to place machinegun to arrow position seems to be bit tricky. I tried ```sqf
_a = createVehicleLocal ["B_HMG_01_high_F", getposATL at, [], 0, "CAN_COLLIDE"];
_a setposATL (getposATL at);
Maybe an offset based on getCenterOfMass
like ```sqf
_cen = getCenterOfMass _gun;
_cen set [2,0];
_pos = _cen vectorAdd (getposATL at);
Something like that, if CoM is actually where you want over the arrow. also world offset will change based on direction so set that first.
ok thx
Hey fellas, trying to make a script to โsaveโ a vest (and all inventory items in it), replace it via script with another vest, then restore the original one.
The save + swap + restore works for the vest itself, but I have no idea how to save and restore original vestโs inventory. Any hint?
i have a question with some scripting on arma 3 mission I'm doing I'm using conda economy script and I've made some changes here is my init.sqf https://gist.github.com/Demandingking/afb5d91ede0aed0a3f34e6cd8be8e55e now I'm trying to add a shop where players can sell inventory items the issue is the script currently only searches for items in players hands not what's on there shirt/vest/backpack etc what would need to change in order for the shop script to do this here is shop script i currently have this is in the init.sqf as well https://gist.github.com/Demandingking/f8c6c18623e6df987f60bc2113da0d68
Even better, there is https://community.bistudio.com/wiki/vestItems
Nailed it! Thanks
also the players need to receive the money of that item they sell with the current money system in script. and the current HUD works i can see the items in shop just says i don't have items in inventory even though i do
You can just get the loadout with getUnitLoadout, replace the vest class name, and just re-apply the loadout
No need to manually re-add items
(Just in case what Revo was implying wasn't clear)
well @tough abyss ... if isEqualTo returns true for any null object, then thats an error too ๐
Is this a custom terrain?
Check the cfgsurfaces, ensure friction is defined with a suitable value.
I've got a fire script included in a mod I'm making, but for some strange reason the smoke particles do not appear for other players, but the fire and everything else appears just fine for all players when on a server.
Any ideas why only the smoke would not be showing up for all players?
Below is the code used to spawn the smoke segment of the script..
private _cssmokespread = "#particlesource" createVehicle position _ThermiteDevice;
_cssmokespread setParticleParams [["warfxWeps\ParticleEffects\Universal\smoke_02.p3d",1,0,1,1],"","Billboard",1,12,[0,0,0],[0,0,1.2],0,0.05,0.04,0.1,[0.8,9],[[0.1,0.1,0.1,0.04],[0.2,0.2,0.2,0.04],[0.2,0.2,0.2,0.02],[0.3,0.3,0.3,0.01],[0.4,0.4,0.4,0.005]],[1.5,0.5],0.4,0.15,"","","",0,false,0,[[0,0,0,0]],[0,1,0]];
_cssmokespread setParticleRandom [4,[5,5.2,5],[0.15,0.15,0.2],10,0.1,[0,0,0,0],0.1,0.05,1,0];
_cssmokespread setParticleCircle [0,[0,0,0]];
_cssmokespread setParticleFire [0,0,0];
_cssmokespread setDropInterval 0.025;
_cssmokespread setPos [(getPos _ThermiteDevice select 0) + (_i * 0.5), (getPos _ThermiteDevice select 1), 0];
For some reason this part is only appearing locally for the person using the function
https://community.bistudio.com/wiki/Particles_Tutorial
Particles are handled entirely locally. You'll note that commands like setParticleParams are Local Effect.
You should use createVehicleLocal and have this function run on every machine.
Dur I should have remembered this. Thanks. So just remote exec the whole function after switching all particles to createvehiclelocal then?
That's what I would do
Remember you'll also need to handle deletion locally (if you want to delete the source)
Alright. I got confused down the line somewhere about locality because strangely enough the fire particles spawn fine when we tested on the server but all smoke particles did not so this makes sense.
If deletion is included later in the same function that is being called across all machines would this be suitable?
This whole thing is jammed into one function lol
Yes, that's fine. It's just that you have to remember each machine has a different local particle source, so one machine's object reference can't be used to delete the source on other machines.
Okay makes sense. Thank you
Need some help.
Some time ago my dedicated server started to hang after some time.
I added some forces (addforce) for bodies in HitPart EH, and I think the problem is related to it, but I can't figure out why and how I can solve it.
In almost all cases the server hangs when I shoot somebody, and last log entries say that the force was applied.
Visually all objects stuck at their places, and there are no output for any console command, but I can walk around and shoot with no problems. The server process needs to be killed manually.
Interesting fact, that it never happens when I host the mission locally, so most likely no recursion/cycle problems.
How can I inspect the server in some ways, to known what can cause it.
NB. The force is added with command like
[_unit, [_finalforce, _pos]] remoteexeccall ["addForce",owner _unit];
Where is the hitPart EH running?
https://community.bistudio.com/wiki/owner
owner only produces accurate results when run on the server. On any other machine, it returns 0 - meaning if this EH fires on a non-server machine, it will remoteExec that addForce to everyone. That could cause problems.
Btw, not that it makes much difference beyond saving you a few letters, but remoteExec already executes commands in an unscheduled environment. remoteExecCall is only different when it comes to functions, so it's not needed here.
"Where is the hitPart EH running?"
It comes from my client, of course.
"owner only produces accurate results when run on the server."
Thanks, I almost forgot about it, but actually when I tested forces, I added it on all machines (target 0) for large amount of units simultaneously without any problems.
Trying to get a little radio at base to just loop this song, and I'm getting issues. Originally, it would start a new track for every JIP so I moved the scripting from the init to serverInit. Now, it seems it just doesn't loop correctly and starts overlapping itself after a hile.
In serverInit.sqf
while {true} do {
homeBaseRadio say3D "baseMusic";
sleep 170;
};
The track is 168 seconds long so it shouldn't be overlapping itself.
Well if you just use _unit instead of owner _unit it will avoid any potential for problems
If it's some sort of networking stall then you'll probably get some info in the RPT.
but yeah, _unit is vastly less traffic than 0.
that's because you're in scheduled, execution timing isnt guarnateed and that tends to be inconsistent with timing especially if you're using many mods, better to resort to a CBA per frame handler instead with a 170 second interval
also serverInit is only for the server, unless you're remotely executing that command its not gonna trigger for all players
Man scheduled/unscheduled is like Greek to me. What alternatives do I have to make this work? Where would I need to run this code instead of serverInit?
to run unscheduled you just gotta do either cba's directCall or wrap your code in an isNil code block, then just run it in initPlayerLocal instead of initServer and check if the second param fed to initPlayerLocal is false (meaning they're not JIP)
Hmm, that sleep should never trigger before 170 seconds.
Or you can add SFX sound and create source
Maybe if it's SP with pausing? Not sure what say3d does in that case.
CBA_fnc_directCall is also greek to me looking at the documentation
Trying this in initPlayerLocal.sqf using isNil
isNil {
while {true} do {
homeBaseRadio say3D "baseMusic";
sleep 170;
};
};
};```
Nope that was very bad
@granite sky Nothing exceptional in rpt, even with debug mode in profiling branch.
It can ends with "Road not found ...", or "Warning Message: You cannot play/edit this mission ...", or with any other script-related messages, but nothing that would looks suspicious for me, as there are was many similar messages before.
Good advice, I revised all my code for such possible problems, but in this case no, unfortunately it is not related.
{
while {true} do {
homeBaseRadio say3D "baseMusic";
sleep 170;
};
} call CBA_fnc_directCall;
};```
Also is bad. Game lags heavily on loading in, then plays the audio really loudly. Also get a popup about "Suspending not allowed"
The original code is correct and you need to diagnose the problem properly.
At least put a diag_log into the loop and find out when it's being executed.
Forgive me, I'm really not sure where to start. Most of my arma coding experience is in configs, not scripting.
Well, for a start, what's the test setup and what are the exact symptoms?
this cba function is unscheduled no?
Should be, yeah.
no but john is right here it shouldn't be happening early - i saw timing issue and immediately jumped to it's delayed; that said it must be something else
even if you have a billion scheduled mods running crap it would only delay the execution not make it happen early
What's odd with that one is that the say3d wiki claims that the same object can't play multiple sounds simultaneously, which is what's happening if the sound "plays really loud".
can someone else reproduce this?
The lag part is expected because what it's doing is running the infinite while loop 10k times and then quitting.
I can give more details when I'm home but, here's what I can report.
Before any changes made today, there was a radio item at base. In the radios's init, I ran an execVM calling a script file with the first code snippet I sent, the while true loop. This would work fine for the first play, but then after a period of time which I assume is near the length of the audio, the song loops and begins overlapping itself.
Are you sure you calculated the length of the audio correctly?
Stopwatch the thing. See when it's actually looping.
Can do when I'm home
maybe Arma just plays it slow :P
Something less important I've noticed is that there's a noticable doppler effect walking towards or away from the radio
Not a big deal but kinda funny
For the record, the song is this (not the exact file used, but same source)
I'm kinda dumb at scripting, how would I patch in my own edit to an existing mod function to use in my mission?
If the mod uses compileFinal for its function, you can't overwrite it from a mission
Coming back to this, I don't even think I could do this unscheduled because of needing to suspend
You can do anything unscheduled. You are just going to be getting into frame handlers, doing calculations with frame no and timing, etc instead of suspension commands
Does this mean I need to get the FPS the server is running at and then use that for the calcs?
Your case, don't bother with unscheduled. It's not timing important.
Did you post all of your code at some point above?
Yeah basically.
I've tried this as a script called by an execVM in the radio's init, I've also tried it in initServer
homeBaseRadio say3D "baseMusic";
sleep 170;
};```
and then I tried those experimental examples with isNil and the CBA directCall without really knowing what I was doing
Ill address this in like... 30 min If you are still on
Thank you, yes I should still be around
before I show you my example, do you want the answer, or do you want me to point you in the direction of the answer?
As much as I'd love to learn from the ground up, if I can see the answer, it will help me figure it out for future references
i'm making two assumptions. radio doesn't move, and you have this sound in CfgSounds in the description.ext
Yes and yes
in either init.sqf, initServer.sqf (can remove the server check), or the init attribute of the radio object in editor:
if (isServer) then {
0 spawn {
TUBA_HomeBaseRadioPlay = true;
private _soundCfgArray = getArray (missionConfigFile >> "CfgSounds" >> "baseMusic" >> "sound");
_soundCfgArray params [["_filePath", ""], ["_volume", 1], ["_pitch", 1], ["_maxDistance", 100]];
while {TUBA_HomeBaseRadioPlay} do {
private _sound = playSound3D [_filePath, homeBaseRadio, false, getPosASL homeBaseRadio, _volume, _pitch, _maxDistance];
waitUntil { soundParams _sound isEqualTo [] };
sleep 1;
};
};
};
Can't you just wait until entity returned by say3D is null?
Still, I'm clueless how new JIP player makes it restart the song 
you can, I removed all locality stuff since I don't know how familiar he is with it
Isn't say3D fully local?
playSound3D lets you be global
now server can time it, and its the same for every client instead of letting each client deal with it
Hmm, you can also solve that by offset in say3D
serverTime % 170 or something like that
Still I wonder why his original script doesn't work
i like the accuracy of waiting for soundparams instead of a arbitrary sleep
Originally, it would start a new track for every JIP so I moved the scripting from the init to serverInit
This is what I don't get
New track for every JIP? As in each client hears it anew on each new join?
yeah i didn't really consider JIP. it would just be silent until the next iteration in this current example
while {true} do {
private _sound = homeBaseRadio say3D "baseMusic";
waitUntil{isNull _sound};
};
```in radio init could be most basic solution unless I'm missing something about `say3D` and multiplayer
Is there a way to get sound length?
168 seconds
using a soundID command and soundparams you can
and get current sound time of play
Syntax:
soundParams id
Parameters:
id: Number - id returned by playSoundUI and playSound3D commands
Return Value:
Array in format [path, curPos, length, time, volume], where:
path: String - the path to the played sound file
curPos: Number - current play position in 0...1 range
length: Number - total sound duration in seconds
time: Number - time passed since the start of playback
volume: Number - playback volume
you can sync it using that for JIP
Oh you have to play it first to use the command, no way to do it beforehand
yup
I was just trying to come up with neat way to play it locally with offset by global timer so each client always hears same part
But I have no idea how playback works during pause or during say game being frozen? Does it skip by freeze amount, does it continue?
i mean you can set playSound3D to local only and use a CBA jip event and send the current pos of the sound to the client
in MP, it continues oh you mean locally, locally I believe it pauses. on the server, its going to continue
look what you did @tacit lion lol
let me get you down the path of JIP syncing like we are talking about
I have to think about this for a few min
Just tried it, when game freezes the sound keeps playing
Still it makes the song end earlier
How could it overlap at all if its 168 seconds long and sleep is 170 
Really not sure. When I have a sec, I'll do a recording and see if I can't catch it
player say3D "AlarmCar";
0 spawn {sleep 0.1; isNil{_freeze_until = diag_tickTime + 1; for "_i" from 1 to 2 do {_i = [1,2] select (diag_tickTime > _freeze_until);};}};
```Forced freeze for 1s, sound keeps playing
my current thought process, if continuing to use a soundParams compatible command, is to create an event subscription on the server that sends the current playback position of the sound back to the requestor. The requestor will call this event when joining JIP to get that value, then play their sound locally starting with that time. The next iteration should link up when server sends it
Could work but maybe it can be done simplier with no networking
Or... @tacit lion doesn't care if all clients are at different points in the song?
For the purposes of this mission file, it doesn't really matter. It's just ambient base music.
If it's not synced, that's fine, so long as it at least plays for each player - JIP or not
But what if one player says: "Here's the best part" and it will be at the worst part of the song for another player? ๐ซฃ
Then they will hear the worst part ๐
"is the time I'm going to put into this going to be recognized by the player"
What did you mean by "init" btw?
Which init exactly it was for that script to run
Init field in the editor?
yes
Sort of*
The first draft had execVM "scriptpath" an sqm file I made that was the while loop you saw above
Is there ANY way say3D can be paused in multiplayer? I can't think of any
I'm just trying to wrap my head around how you could have the song overlapping with that basic loop
stacking scripts. he never said he was filtering his init attribute
filtering init attribute?
since its global. I didn't see him mention any local filters to prevent the while loop from being created again on a JIP client connect
since he said he was execVM'ing a file from the init
Yeah, orc code on my end
JIP shouldn't call init on other clients again as object is not created again on existing clients
Okay, here is init script that will properly loop the song AND play it at the same place for every client
waitUntil {alive player};
private _sound_time = 170;
while {true} do {
private _offset = serverTime % _sound_time;
private _end_at = serverTime - _offset + _sound_time;
private _sound = homeBaseRadio say3D ["baseMusic", 100, 1, 0, _offset];
waitUntil {serverTime >= _end_at};
deleteVehicle _sound;
};
Minus some scheduled lag offset
At least in Arma 3 the basics are simple, i just recently tried playing a sound with Reforger while being clueless about it (Game, engine, tools, OOP).
8 hours wasted and no progress xD
You can upgrade that to get _sound_time from soundParams but I decided to make it simple
it does. second client (JIP) spawns a 3rd vehicle
But that's JIP client spawning it, existing player doesn't call init again
Otherwise you'd have 4 cars
Reforger frustrations make me come back to this channel and finally come up with something that works
Where should this be placed? The object's init? Server init?
Put it into script, execVM it from object's editor Init field.
Reforger is very frustrating currently. Just finished up ACE defibrillator for it and it was quite a pain with networking
We end up doing so much through the player controller due to ownership to call things on the server from a client
I still haven't really touched replication there, but I feel I have plenty more frustration to come
yup, you're right, was misunderstanding
just wait... trying to replicate a class that doesn't support replication and you have to build your own encoder (for each class you want to do it with!). absolute pain.
Testing now, seems to be working. Will let the song play out and see if it loops well enough
The doppler effect is still silly
Loop seems good, no overlap
Need to test it in full MP with others but this feels good
yeah i don't think you can take off that doppler effect
Kinda silly but no big deal
Did a test with 2 clients, sound is always playing same part for everyone
Thank you both, greatly appreciated
@meager granite did you try out the layer editor on reforger yet? do you like it better than doing GUI in a3?
I did, liking it very much, solves a lot of problems that you could've only solved through script in A3
More specifically listing objects one after another, you had to script all that but now you can just wrap it into layout and it positions it automatically
Haven't done any real projects with it yet though, but so far definitely an upgrade
Few things are missing though, no subpixel shadows on images for example
i only made a little calculator so far to figure out how it worked. never did well with spanning when I tried to learn js/html/css so its kinda annoying visualizing it in my head. but I like that its immediate feedback
A3 shadows are always the same though but often that was enough, Reforger image shadows are whole pixel and they're useless unless you're doing very thick shadow
I've been doing web dev since a long time ago so its all natural for me
In A3 its all absolute (unless in controls group) and you have to calculate everything yourself what comes after what
How do I set a unit to be unconsious at the start of a scenario? I tried _unit setUnconsious but it doesn't seem to be working
Are there any workarounds these days to allow a "helmet cam" be on a soldier and then have that soldier fly a plane or drive a vehicle without the camera view stuttering?
Try adding a bit of delay?
I remember also encountering this issue myself, still haven't fully solved it
One of my ideas that I haven't tried was finding unit proxy offset in the vehicle and work from that
- Get unit seat
- Find proxy of that unit
- Get proxy offset in the vehicle
- Vehicle position + Proxy offset + selectionPosition of unit + camera offset
Something like that
You can setPos'ing camera each frame. Reliable to me except the audio stutters
The issue is that unit positions you get with position commands are wrong, they're lagging behind and jumping all over the place
There is no way to get real rendered unit position inside vehicle
Hm, I realized my case attached cam to vehicle not unit
it'll be something to do with render scope vs simulation
Render time scope commands on units inside vehicles still return simulation time scope positions it seems
Can you even get seat proxy position in the vehicle?
Vehicle render scope position + Proxy offset + Unit selectionPosition offset + Needed camera offset
Something like that
Or maybe @still forum could figure out why engine does it and fix it properly
^
{sleep 1;
_unit2 setUnconscious true;
};
Still doesn't work. Should it be in the Object: Init or a waypoint?
Post full code snippet
Why waypoint, didn't you want it at start of scenario?
That's the full code I put into the init for the unit, with variable named to unit2. Pretty much, I'm wanting them to keel over with little health, it's a downed helo situation, starting downed
Why do you wrap it in {}?
Google AI leading me astray, apparently
Init field in editor:
if(isServer) then {
this spawn {
sleep 1;
_this setUnconscious true;
};
};
LLM can barely code in languages that are x1000 more present online for it to learn from, they're absolutely useless for SQF, don't even bother
perfect, thank you
does anyone know if its possible to prevent the scroll menu from fading away? I mean the menu with addActions
Some helpful tips though @meager granite and @warm hedge. I'll explore, thank you!
I need help with a trigger: I want the trigger to fire when OPFOR knows about the present of BLUFOR (or the Player in a Multiplayer mission).
Trigger:
Type: None
Activation: None
Condition: east knowsAbout player
On Activation: hint "Trigger has fired"
I only get the error: Condition: Type Number, expected Bool
Using DEVBranch and the Eden Editor!
How can I in arma 3 disable unit name randomization so it uses the name i provide in the properties?
Am I right that there is no way to remove or replace main road textures (those that are on the map/terrain, not placed in Eden) via scripts? Am trying to make a historical Malden island for a mission and this is the final modern thing that I somehow need to fix (i.e. the modern roads - especially the main highway, etc.), and it would help if one is able ot somehow replace those with dirt roads or even just grass? Could the nearRoads detection be of use as it apparently is able to "find the road segments within the circle of the given radius" (according to the wiki), in combination with custom texture creation in those area?
I also did check on the workshop, but did not see any Eden extension that allows one to place something like large grass objects/ground textures to be able to "hide" the road below.
Any ideas how it could be achieved?
you mean like https://community.bistudio.com/wiki/setIdentity ?
hello all: how do i delete soundSource , after i created a soundSource, ```sqf
_flameSFX1 = createSoundSource ["Sound_Fire", position F5, [], 0];
it's literally in the Example #2 https://community.bistudio.com/wiki/createSoundSource
Is there any way to pass a nonglobal variable into an event handler? Both this post: #arma3_scripting message and ChatGPT (nothing on BIKI as far as I can find) leads me to believe that this should work:
params ["_bomb", "_pos", "_bombLethalRange"];
{
if (
alive _x &&
isNull objectParent _x &&
!(_x isKindOf "Animal") &&
_x distance _pos < _bombLethalRange
) then {
for "_k" from 1 to (floor random 4) do {
[
_x,
selectrandom [0.25,0.5,0.75],
selectrandom ["head","body","hand_l","hand_r","leg_l","leg_r"],
"explosive"
] call ace_medical_fnc_addDamageToUnit;
};
};
} forEach allUnits;
{
if (
alive _x &&
_x isKindOf "AllVehicles" &&
!(_x isKindOf "Man") &&
_x distance _pos < (_bombLethalRange / 1.5)
) then {
private _hitPoints = getAllHitPointsDamage _x select 0;
{
_x setHitPointDamage [_x, selectRandom [0, 0.2, 0.5, 0.8]];
} forEach _hitPoints;
};
} forEach vehicles;
}, [_bombLethalRange]];```
It gives the expected results when I specify _bombLethalRange inside the EH, but I want to be able to assign it outside the EH to make the script work for different types of ordinance.
https://community.bistudio.com/wiki/addEventHandler
Normal EHs do not support custom arguments.
Mission EHs do, but the arguments are made available in _thisArgs, not _this.
You could use setVariable and getVariable to store your variable in the bomb's namespace and then retrieve it
yes but im setting identity via editor UI... and the name isnt egistering when i play scenario
ooo, smart
Am i dumb or something. This:
!alive rt1;
does not fire after the destruction of said variable.
Gotta give a bit more context. alivechecks if given object is alive or not
not if a variable was destructed.
The destruction of the variable would mean that it is no longer alive.
Not really
Then please elaborate, because in every other situation i've used alive, when said thing is no longer "alive". Aka Dead man, or destroyed object. The trigger fires.
variable != object.
And I still have no clue where you check it, in a trigger, in a loop in an event...
yes
Yeah, I seem to mix them up sometimes..
Happens
When you double click on a Unit in ARMA3 Eden editor theres a category Identity, with field name
When you type in a name, the name gets overridden by something in game
So either its a mod, or its the game doing it
It works for me. So it could be a mod.
player names override it in mp iirc
Nevermind....I guess Activation: BLUFOR and Activation Condition: Detected by OPFOR should do the trick, hu?
QUestion on object setVariable.. What's the desired limit of objects with setVariables on them? If I have lots and lots of objects with variables set on the,, will have have noticable effect on performance and network usage? cheers
@spring stone knowsAbout returns a number [0-1]
@tough abyss (random 1000) isEqualTo (random 1000) ? xD
how do i write a sleep command inside a trigger that works in a dedicated server?
i need to put sleeps inbetween some BIS_fnc_spawnGroup for server proformence reasons
i unloaded all the mods
and still in vanilla arma 3, the identity name field, doesnt do anything
pls someone halp
seems towork out of the blue now
@polar radish just use []execVM "yourSpawnScript.sqf" beginning with sleep or whatever u need and put it in the trigger
Or just wrap it into spawn
0 spawn {
grp1 = ... call BIS_fnc_spawnGroup;
sleep 1;
grp2 = ... call BIS_fnc_spawnGroup;
};
Change 0 to trigger variables (thisList or such) if needed so its passed to thread
how to make a group stop stalking and go to position after some time ?
private _stalking = [_staticgrp, (group player), 10, 0, {sleep 600; true;}, "usa_base_area"] spawn BIS_fnc_stalk;
cannot use sleep in this context error ....
Sleep need scheduled environment
@stable dune I read about scheduler but how to make them go to the marker after some time?
Check the function. There is probably an exit condition for the stalking. Then assign them a new waypoint.
_staticgrp setVariable ["stalking_now", true];
private _stalking = [_staticgrp, (group player), 10, 0, {!(_staticgrp getVariable "stalking_now")}, "usa_base_area"] spawn BIS_fnc_stalk;
sleep 600;
_staticgrp setVariable ["stalking_now", false];
or you can use some global variable to make it even more basic
Also can't you just kill the thread? Not sure how that function works.
Probably gonna have to do waypoint cleanup manually
@meager granite hmm with this stalking groups doesn not start to stalk at all ...
sleep 180; //need this to make them deffend an ammo ceche ofr a bit
_staticgrp setVariable ["stalking_now", true];
private _stalking = [_staticgrp, (group player), 10, 0, {!(_staticgrp getVariable "stalking_now")}, "usa_base_area"] spawn BIS_fnc_stalk;
sleep 180;
_staticgrp setVariable ["stalking_now", false];
finally I had to use scripted waypoint
private _wp = _staticgrp addWaypoint [flg_us,0];
_wp setWaypointType "SAD";
[_staticgrp, 1] setWaypointSpeed "FULL";
[_staticgrp, 1] setWaypointBehaviour "COMBAT";
[_staticgrp, 1] setWaypointCombatMode "RED";
sleep 180;
{_x enableAI "PATH"} forEach units _staticgrp;
no stalking, they go directly to us base to drink some blood ๐
is there some simple way to get the current road surface type that i am standing on? we have surfaceType which returns the current terrain surface but ignores roads. we can check if player is on a road and then grab nearest road.. but that seems unnecessarily complicated? am i missing something or do i really have to find the nearest road to then read the material?
basically i just want to know if i am on an asphalt or dirt road or something else
Myb this just shoot it from player down ? https://community.bistudio.com/wiki/lineIntersectsSurfaces
getRoadInfo roadAt maybe?
Not sure if dirt roads are "TRACK" or that's something else
hm. lineintersectssurfaces gives me just the terrain surface again. unless i'm doing something wrong
ok i'll just use getroadinfo in combination with roadat. should do the trick
Can someone explain how does "setVectorDirAndUp" works? I cant figure out what reference to feed, in order to tilt in the desired direction.
Objective is to tilt a tree towards a player and "hit him with the tree".
it will be somewhere in a forest, so it needs to be able to tilt in every direction.
I call my script inside a trigger with anyPlayer and present condition. it is repeatable and server only (and currently hosted on lan)
[thisList select 0, truck_tree1] execVM "scripts\trees\hitting.sqf"; //yee i will only hit the first player that enters the trigger, but thats okay and reduces complexety by a lot i think
_playerDir = getDir _player; //easier to look at
_treeDir = 0; //i dont know how to make vars global to script but not to mission, so this is my solution
if (_playerDir > 180) then //i argue that my goal is, to rotate my tree towards to the player and then tilt forward.
{ //so figuring out, in what direction my tree needs to be rotated
_treeDir = _playerDir - 180;
}
else
{
_treeDir = _playerDir + 180;
};
for "_i" from 1 to 90 step 1 do
{
_tree setPos (getPos _tree vectorAdd[0, -0.03, -0.03]); //my test tree has it center somewhere in the middle, so at somepoint, roots are going to be in the air. im trying to fix that with small teleports
_tree setVectorDirAndUp [[sin _treeDir, cos _treeDir, -sin _i],[0 , 0, sin _i]]; //HELP HERE PLEASE. i have no idea what vectorUp to feed, so it will tilt forward till it lays on the ground (so 90ยฐ)
sleep 0.01; //prevent that it happens instantly and make it atleast look like its falling
};```
Regarding the animation, you will likely need to make it run on each frame to make it smooth. And in a single cycle, you would calculate the angular distance (the fall of the tree) by multiplying your desired speed and the time that passed between the current and the last frame.
You can use setDamage alt syntax to control the direction of fall. Does that not suit your need?
Yeah, or simply letting the tree fall by destroying it. ๐
You probably can do it through https://community.bistudio.com/wiki/setVelocityTransformation
There is an issue of locality though, it might look shitty over the network
i think that is too much for me ๐
it sounds really nice, but i understand only half of what your are saying ๐
Use the setDamage as @digital hollow suggests. That is very easy.
kinda, wiki says it will fall away from the "killer". i want to have it fall towards the killer.
wait
so just create something invis, pass it as killer and good to go?
Yes.
deleteVehicle testo;
testo = createVehicle ["Flag_Vrana_F", player modelToWorld [0,8,0], [], 0, "CAN_COLLIDE"];
[player, testo] spawn {
params ["_player", "_tree"];
private _fall_time = 2;
private _fall_till = diag_tickTime + _fall_time;
private _pos = getPosASL _tree;
private _vec = _pos vectorFromTo getPosWorldVisual player;
_tree setDir (_vec # 0 atan2 _vec # 1);
private _start_vd = vectorDir _tree;
private _start_vu = vectorUp _tree;
waitUntil {
private _vec = _pos vectorFromTo getPosWorldVisual player;
private _dir = _vec # 0 atan2 _vec # 1;
systemChat str _dir;
_tree setVelocityTransformation [
_pos
,_pos
,[0,0,0]
,[0,0,0]
,_start_vd
,[0,0,-1]
,_start_vu
,[sin _dir, cos _dir, 0]
,1 - ((_fall_till - diag_tickTime) / _fall_time)
];
diag_tickTime > _fall_till;
};
};
Try that
Haven't tried myself
I feel like ChatGPT coming out with SQF code without even testing it
If this works you can upgrade it to make it fall faster at the end and such
Feed it through sin or cos or something
fixed interval being the wrong way
Messed up var names (start and from), fixed
I'd run A3 to test it but I think it closes Reforger and I'm in a queue
thank you, but first i will try the setDamage idea
Ok it works but getDir spazzes out if objects are too close
You can simply calculate the differrence between the player position and the tree position (which rersults in a direction vector), then invert the resulting direction vector to point in the opposite direction from the tree position and place a game logic (invisible object) there. You can probably find an easier solution with getDir and getPos and distance commands avoiding all the vector work. Edit: the vector is [X,Y,Z], not just [X,Y].
Edited my script to be a testable snippet
You can go from there
Updated even more, much better now
You can do some more through animate with https://community.bistudio.com/wiki/bezierInterpolation
So tree jumps a bit after fall, etc
What is this error?
[BIS_fnc_respawnBackpack] RespawnCamps: Cannot assign camp to a player, camp deleted!
What is the context where it happens?
hearts and minds modded
There is not much information on how this system work:
https://community.bistudio.com/wiki/BIS_fnc_respawnBackpack
but I fixed, it was a parameter that had 0 that means disabled and not unlimited timer.
class btc_p_rallypointTimer { // Time before rallypoint self-destruction:
title = __EVAL(format [" %1", localize "STR_BTC_HAM_RESP_RALLYTIMER"]);
values[]={0,5,10,30,60};
texts[]={$STR_DISABLED,"5 min","10 min","30 min","60 min"};
default = 999999999;//actually unlimited
};
I'm currently trying to update a running mission on a dedicated server with live weather data, but I can't figure out where to put the files in order to access them via loadFile or preProcessfile.
So I have a initServer.sqf to randomly place objects and playerstarts based on a getMarkerpos. Apparently it only works LAN. How would I make this usable for a dedicated server?
I have came across several posts that look like they might offer a solution, but they all lead to the BI forums which are still down.
are you trying to teleport all players to the marker when they first join? and is the marker pre-placed in eden editor?
if so, i think the simplest option would be moving your marker spawn to initPlayerLocal.sqf
https://community.bistudio.com/wiki/Event_Scripts#initPlayerLocal.sqf
Yes, I am trying the get the players to spawn at one of six random spots designated by a marker (an empty) pre-placed in the editor. _startPos = getMarkerpos (SelectRandom ["m1","m2","m3","m4","m5","m6"]);
should it handle players respawning too?
no
then just initPlayerLocal.sqf should be sufficient, move that _startPos and anything else referencing it to there
that runs locally on every player, excluding the dedicated server itself since it doesn't have a player
oh to clarify, are you looking for the players to be randomly distributed across all markers, or spawn all together at one marker?
all together\
that'll take a bit of extra effort, since selectRandom and other random commands don't produce the same results on each client
i suggest having the server decide on a marker, broadcast the marker in a global variable, then have players teleport to the marker in said variable
essentially something like: ```sqf
// initServer.sqf
David_startPos = getMarkerPos selectRandom [...];
publicVariable "David_startPos";
// initPlayerLocal.sqf
player setPosATL David_startPos;```
i think this alone would be unreliable on non-JIP players though
Thanks, I will try and implement this. I appreciate your taking the time.
Yeah, might be unreliable on inital start
Gotta add waitUntil or something
for the var to arrive
does anyone have a Patrol Ops 4 map config for Chernarus 2020?
me
could you share it please?
or if youre willing to share the map data generator project, i wouldnt mind spending a couple hours on further perfecting it, if thats even possible
Hihi, does anyone know the script to put on an object to grant players like, medic, EOD, Engineer perms through scroll wheel?
https://community.bistudio.com/wiki/addAction
and
https://community.bistudio.com/wiki/setUnitTrait
So add action to your object,
and to player trait what you want
If using ace, you will also need to use its systems instead of vanilla
Vanilla medic trait won't do anything, and vanilla engineer will bypass ace repair
// 0 = untrained, 1 = medic, 2 = doctor
_unit setVariable ["ace_medical_medicClass", 1, true];
// 0 = untrained, 1 = engineer, 2 = advanced engineer
_unit setVariable ["ace_isEngineer", 1, true];
// false = not eod, true = eod
_unit setVariable ["ace_isEOD", true, true];
True.
Thank you both <3
anybody know the script to put a live map on an object?
Like the in game map? You'll need to make a control that uses RscMap or related controls.
yeah like the ingame map. iโve seen it done by like holding space on the object and then you can move the map wherever you want.
They likely use the "UI on Texture" function from this page. At a basic level you grab the control for the map and apply it to the hiddenselection of your object
https://community.bistudio.com/wiki/Procedural_Textures
how would i execute that
Theres a variety of ways to do it, for your case it might be easiest to execute a mission scrip fromt he objects init
tracking, so iโd just do #(rgb,width,height,mipCount)ui("displayClassName","uniqueName","texType"); ?
Has anyone tested this event.
When an object in remotexec with a JIP disappears from the world, will this JIP be deleted if the object does not exist?
example
[_object,2] remoteexec ["setAnimSpeedCoef",0,true];
When an object is deleted during the game, will everyone who enters the server call setAnimSpeedCoef for a non-existent object in the world?
In this case, won't I have to add EH Deleted for the object with the JIP ID string argument?
If you don't want it to complain a bit, yes.
Can this be checked through say https://community.bistudio.com/wiki/exportJIPMessages ?
Not sure if I ever tried
I would be surprised if it had that depth of filtering.
If you use an object as the JIP parameter then that JIP entry will be deleted when the object is deleted, but that's a much easier lookup.
You only get one of those per object unfortunately.
Quick question does anybody know how to create custom category for compositions are you doing that with scripts or how ?
compositions are a different system. they are stored in your user profile folder. the header.sqe file contains the category.
if you want something everyone can see in your mod, you have to use the standard faction system under the yellow props tab
I just want it for myself to have custom category name so i dont have to remember in witch category i put it in.
then look in the compositions folder in your user profile for the header.sqe file connected to your specific composition
Yea i found it do i just change the name here to what ever i want or ?
category="EdSubcat_SideSlot";
I don't know all the different categories, so you'll have to experiment. for instance, i have some in EdSubcat_Default
I'm sure they are listed in the config somewhere
No i dont want premade category i want a custom composition category. Something like:
Legions Test compositions or what ever ?
You create a class in CfgEditor(Sub)Categories
"configFile" >> "CfgEditorSubcategories"
mod that
Is it possible to create a custom info panel in the mission description.ext file?
Long story short, I want to create a custom info panel (the panels that are on the left/right side of the screen such as GPS, radar, SLA, etc) that will be used for basically a helmet cam script. Id rather just use those panels as opposed to creating an overlay through the conventional means that people ususally with cutRSC
Yea i was hopeing there was a way to create a custom category name with out makeing a mod but oh well.
What's the best way to add music to an object around a radius? For example a radio sitting on a desk.
is there a way to exclude all parachutes from helicopters
I'm making a no fly zone and since parachutes are helicopters they get targeted by the script
maybe with a not iskindof parachutebase
or inheritsfrom
do you mean remove parachutes from helicopters ?
or did you want this "Steerable_Parachute_F"
oh i see you want to be able to Para jump into the no fly zone
i remember i did this before, and i just made it so helicopters, can't fly in the no Fly zone
but that was way back in Arma 2 !(_unit isKindOf "Parachute") or you can make the unit can not get damaged while in the chute (vehicle _player) allowDamage false;
I want in case someone ejects over it they don't get pelted by missiles while landing'
Does any one know any scripting to help AI planes Taxi properly on Altis largest airport .
where can I see the inheritance for kindof
Eg Air contains heli and plane
Vanilla parachutes?
scotty's thing worked
I did this here
(["ParachuteBase", "UAV_06_base_F", "UAV_01_base_F", "UAV_02_Base_lxWS", "UAV_RC40_Base_RF"] findIf { vehicle _x isKindOf _x } == -1
cause I want many things to be excluded
You can exclude this stuff much more efficiently with simulation checks
Also you can't do vehicle _x there as _x is a string
You can do
toLowerANSI getText (configOf _vehicle >> "simulation") in ["parachute", "paraglide"]
UAVs can be checked with isUAV flag, but this also includes large uavs
You can neatly exclude all backpack UAVs with some config checks
count getArray(configOf _vehicle >> "assembleInfo" >> "dissasembleTo") > 0
``` will be `true` for anything that can be disassembled into a backpack
wow awsome
{
(vehicle _x) in thisList &&
(vehicle _x isKindOf "Air") &&
(side (crew _x select 0) == WEST) &&
(["ParachuteBase", "UAV_06_base_F", "UAV_01_base_F", "UAV_02_Base_lxWS", "UAV_RC40_Base_RF"] findIf { vehicle _x isKindOf _x } == -1) &&
((getPosATL (vehicle _x)) select 2 > 10)
} count allUnits > 0
So for this I do this?
{
(vehicle _x) in thisList &&
(vehicle _x isKindOf "Air") &&
(side (crew _x select 0) == WEST) &&
!(vehicle _x isKindOf "UAV_RC40_Base_RF") &&
(count getArray (configOf vehicle _x >> "assembleInfo" >> "dissasembleTo") == 0) &&
!(toLowerANSI getText (configOf vehicle _x >> "simulation") in ["parachute", "paraglide"]) &&
((getPosATL (vehicle _x)) select 2 > 10)
} count allUnits > 0
fixing it
Whatever is more convenient for you, but doing config checks is always more universal than listing classes
in case you'll add mods later or something like that
that one is special cause it's the RF uav 40mm drone
man lol, i just made a Para Eject script,
where the player don't get damaged till he or she is on the ground
Yeah, its not disassemble-able, I wonder if it has some other trait. Or you can just keep it as a special case, yeah
thats really cool stuff guys Awsome @meager granite @polar belfry
The no fly zone was made cause my players would find creative ways to long shot a radar
i see, yeah i had to do lots of stuff also, to stop players from doing stuff , i didnt want them to do, thats just part of the game i guess
Quick question. The CustomWaypoint (Shift+LMB) on the Map... There is no way to set and/or delete this waypoint with code?
ummm maybe by radio trigger ?
i really don't use any way points ever, so i'm just guessing kinda
Thanks. But a Radio Trigger won't help much, if there is no actual command to set it.
i forget can you even name way points
if you can name it you can delete it
i remember scripting waypoints then its easy to delete them
The CustomWaypoint is not one of them
//WP0_Sub1
wp0 = _Uboatgrp addWaypoint [getMarkerPos "WP0_Sub1",0];
wp0 setWaypointType "Move";
wp0 setWaypointSpeed "FULL";
//WP1_Sub1
wp1 = _Uboatgrp addWaypoint [getMarkerPos "WP1_Sub1",0];
wp1 setWaypointType "Move";
wp1 setWaypointSpeed "FULL";
//WP2_Sub1
wp2 = _Uboatgrp addWaypoint [getMarkerPos "WP2_Sub1",0];
wp2 setWaypointType "Cycle";
wp2 setWaypointSpeed "FULL";
But thats a normal waypoint, not the one to Shift+Mapclick
yeah i wounder can you name waypoints that you mapClick in the editor
i guess they get named as you click them
Have you tested whether there is a customWayPoint waypoint https://community.bistudio.com/wiki/Waypoint
waypoints player;
No. But I dont see how that would help. The custom waypoint is either set and has a position (in this case it overrules the normal waypoint) or is deleted/NULL.
But thanks.
is there a get or to command to get something that has all (Eg above water to be ASLW, above ground to be ATL)
Use max command etc to find which is higher
and use that?
Do whatever you want
Hey there :D
Im into building into variable problems. Maybe someone can help me.
I want to give a publicVar to every typeOf an object I place down.
Thats the way Im going:
addMissionEventHandler ["EntityCreated", {
params ["_newEntity"];
if (typeOf _newEntity isEqualTo "rhs_2b14_82mm_vmf"
) then {
_newEntity setVariable ["Mortar", "Mortar", true];
publicVariable "Mortar";
_mortarCrew = east createVehicleCrew Mortar;
...
...
...
Im meanwhile into try and error because I cant explain it to myself
Why, is the first question
Because I need this object with this var
simple, right?
What do you want to do with that "Mortar"?
Shoot automaticly after beein placed
Thing is, anyways, your first two lines, both don't define "Mortar" in missionNamespace (aka default namespace)
AI generated script?
So at first: a variable is defined and stored in missionNamesapce wich is also the main/default one?
just curious
My brain is learning. Im the AI connection neurons
hmmm
Mortar = _newEntity
This defines Mortar in missionNamespace
publicVariable "Mortar"
so the variable is synced to every client
Copy confirm
Simple as genius
I tried similar but failed like always a centimeter from goal away haha
_newEntity setVariable ...
is basically defining a variable within the entity, not missionNamespace
The variable is "Mortar" string, though
Not the object
Okay thats not easy because I cant imagine a usage of a var inside the localization of an object.
tldr, you were wrong
Even though, that script you really want to execute may not require publicVariable etc, at least my glance says, but that's different story to this question
But it wont spawn a crew inside still
But the target for createVehicleCrew is given, thats what confuses me
Spawning crew in EntityCreated is very wrong
Spawn it where you spawn the mortar itself
This pretty much forbids you from ever spawning an empty mortar if you'll ever need it or something else does
All good
I have multiple "skins/versions"? thats okay https://community.bistudio.com/wiki/createVehicleCrew
look at screen
Anyways, I would make sure if the script is actually running
Wich?
This one?
I dont know as well haha
But I need a mortar with the name "Mortar"
and a invisible helipad named MortarTarget
No, "but" is not the question
Bro
all good
thank you
i will wait for my people if your in a bad mood at the moment
Nah nah, I am saying just hint it
There is nothing to hint in my eyes
To make sure your code is at least running
Thats why I feel kinda trolled
The chance is, the entire code may simply not running
I know... but I think that we cant know because the code stops with the crew spawning thing
And that's why I say hint
Debug 101: use a obvious command to see if the code is actually running or not. If yes, pull your hair. If not, pull your hair
Sorry for my reaction but I think I got you know
if (typeOf _newEntity isEqualTo "rhs_2b14_82mm_vmf"
) then {
Mortar = _newEntity;
publicVariable "Mortar";
hint "Var granted";
_mortarCrew = east createVehicleCrew Mortar;
if (alive _mortarCrew
You mean like that?
I thought that I can skip that because the AI isnt getting spawned in the mortar
Basically yeah
no hint shows up
don't fight over code! fight code
That means, your method/theory before the if or if itself is somehow wrong
I'm not mad, unlike the entire task you just try to step in is
Welcome to the Bald Club
hahahaha
Okay so another solution is needed to give the mortar typeOf its classname in namespace/ missionNamespace
Do you have an idea? Mine is dead now. Even if the only way has to be connected with the EventHandler.
I know no other way to detect a placed down object
Make sure if the EntityCreated is even running
It is, Im getting an error by placing the podnos
But the error is created after the hint is not getting launched
If the skript needs to change to stop mode.
That includes that the player killed the gunner and the MortarTarget doesent needs to be there anymore
your are checking Group not object with alive check
Check if given vehicle/person/building is alive (i.e. not dead or destroyed).
So you need check if xx unit in crew is alive.
So get gunner of "vehicle" mortar, and check that.
I think Ive fixed that ->
(alive ((units _mortarCrew) select 0);
Well, you just spawned the group?
I used createVehicleCrew
Yes, you just spawned them, so they (theoretically) cannot be dead
100%
So they start
But if the gunner is dead becuase he got killed the script needs to stop
If you are using your while loop with 60sec delay, you only can check every 60sec is your gunner dead,
private _time = time;
while {alive gunner Mortar} do {
if (_time < time) then
//Spawn your stuff
_time = time + 60;
};
sleep 1;
}
It will check every 1 sec is your gunner alive, and every 60 sec move target
you could use an event handler on the gunner or the turret
Having a bit of an issue with the following simple script that I need to work in an MP environment:
_groupleader setUnitPos "UP";
_groupleader disableAI "MOVE";
_groupleader playMoveNow "AmovPercMstpSnonWnonDnon";
I wanted the AI to just move on in the direction it is facing when the player tells it to do so (it is in an addaction), but while it does play the animation and makes a few steps it breaks off the animation and then returns to the standard stance and stops. Do I need to put in some kind of loop?
That would be enough, the mortar is stop shooting with the dead of the gunner. I just want to stop the clock and delete the helipad marker for next usage and deleting traffic
I try to do it on the gunner but fail on reading it out because Im looking at the group at the moment not the unit itself because Im not that good into brackets
no worries, this channel is here for that as well :)
Ah figured it out, it works if I include a disableAI "ANIM";
Hello! Does anyone have a description for PvP missions? I need it so that when the blue team wins, the red team gets an image and text showing they failed. Similarly for the blue team โ if the red team wins.
I wrote the description manually, but it didnโt function correctly for some reason
You could start sharing what you have now and where is point where do you need help
How can I make the turn towards the new "heading" (in this case 22.5) being incremental (so it looks a bit more natural) and not immediate (as it is at the moment)?
_newdir = [vectorDir _groupleader, 22.5, 2] call BIS_fnc_rotateVector3D;
_groupleader setvectordir _newdir;
I would use the command for, and within a really small sleep like 0.05
Wouldn't a while loop be more flexible (i.e. if the change between current and wanted heading varies)?
I think it would be the same, for directions you need to be careful to rotate the entity in the right direction, I mean, like taking a "shortcut" (I'm not native english speaker lmao), because if the entity is 10ยบ and you want it to rotate to 310ยบ, if you're using positive numbers, it will rotate all the way to 310ยบ which is silly
I guess you could check the difference between the two values (higher value/angle - lower value/angle) and if it's larger than 180ยฐ, turn to the opposite direction instead
like:
for _i from 0 to 22.5 do {
_groupleader setVectordir _newdir;
sleep 0.05;
};```
yeah I think so
maybe you can use (https://community.bistudio.com/wiki/setVelocityTransformation) for the dir
oh like I mentioned above the initial code works just fine and exaclty like it should - but I just want it not to be instant but incremental (as in somewhat "smoother" than instant snapping to the new heading)
okay, we were just thinking about a more dynamic way to do it
so you could use in other examples
Any scrips out there for AI planes to follow taxi ways properly
From the base, you don't need any scripts for that
if the airport is registered in the map as default, you just place the airplane in the taxi way and the AI do the job, you just need to check if it's the right direction for taxiing
My planes do alot of cross country to get to the take off point from the Gates .Iv resorted in trying my hand with coding ,and I can't code .
make a dynamic airport then
Where would I find info on how to achieve that .Im new to arma 3
Thank you kindly
I've never done myself a dynamic airport, but take the carrier config example in the link, and take the positions of the map (array format [X,Y]) and edit each format position for taxi and ILS
only ilsDirection you need to take Z pos into account
Is it possible to temporarily disable thermal imaging in binoculars, either through some post-processing effect or via script commands?
I will give it a try ,would i have to place objects to plot the positions light lights for the AI to follow
you just need to get the positions from the map, it's like the waypoint that the AI will follow
you can place objects, markers... anything to get the positions
Then expand on that code ,what file do I place it in Init.sqf?
I think this is a config thing, so on description.ext
I already have a finished description that shows one side's victory, but I need separate text and an image for each side (Blufor, Opfor).
Example
do the same for both teams
Idk what is the condition to end your mission, but the onAct code should be the same idea
not sure what channel to post this, anyone knoinw why?
Trying to check if there's a body of water between two positions or if AI can path find from one pos to another using a land vehicle, just can't quiet figure it out, any pointers?
did try calculatePath, not sure that's a suitable approach a recurring check however
I recalling seeing a command to check if two locations were connected, but can't quiet find it again, if it ever existed lol
its a little triky
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#PathCalculated
you need to use that eh
spawn an unit ( agent ideally), add the eh to it, tell him to go to some point, get the result, and delete the unit
will be nice to have an command to do this more efficiently tho
ded? 
@signal flume No
Variables are only synced on changes and only if you make them public (using the third argument on setVariable) --> JIP players might see a big impact but that should not be from interest for you
There is also no realistic limit on how many variables you can use (as Quiksilver already did, you just can throw random numbers in the room until one tries) but what is known: they can have an impact on the speed that they get resolved
more variables might result in longer access time for them (we talk about ms here)
In the end, your biggest concern should be the object count
many objects might mean many syncs of their position (if it is AI) but thats the usual thing
to finalize this lil post:
Forget about the variables and just code normally
Objects/Vehicles/Units (however you want to call em) will get your problem
not the variables
@thin fox - thanks for your input earlier, everything worked well with using "for"
great!
Just had a test with a friend and noticed that my addactions (currently placed in the INIT field of an AI unit), that do work in singleplayer, do nothing in multiplayer (only for me but for nobody else).
this addaction ["<t color='#f5d442'>Forward!</t>","scripts\forwardTEST1.sqf",[],1,true,true,"","_this distance _target < 20"];
Do I need to use that remoteExec somehow? I do have difficulties transfering the addaction I have in SP to the remoteexec one, because
[_target, ["TEST FOR MP MOVEMENT", "scripts\forwardTEST1.sqf"]] remoteExec ["addAction", _target];
does not even show up? Am definitely doing something very wrong here.
remoteExec addAction is a local effect.
Change your remoteExec to global via 0 instead of _target.
If you are adding addaction via init of unit attributes,
You don't need remoteExec it.
But if your script , that you are calling in addaction statement is local, that is what you need remoteExec.
Which part didnt work.
Addaction didn't not show up for all or your event didn't now affect for all clients.
So you need
#arma3_scripting message
@stable dune - the addactions did show up for everyone but I was the only one who could initiate them (i.e. see the unit move and execute the command of the sqf file)
I have a probably stupid question but here it goes.
On an official zeus server can I have a script offload some amount of processing to a non-local client. It seems from the docs that I probably can only remoteExec built in functions, and/or the client would need to already have the function I want to run defined. If this is the case is there a way to provide a function to a client from the server without the client needing to explicitly load a mod? Is there a way to see what CfgRemoteExec looks like on an official server or just trial and error?
If its not possible on an official server, what about one I can configure?
I understand on a public server giving /anyone/ the ability to run /anything/ on a client is asking for trouble so I get it if there is no way to do so. Realistically what I want to do is see if I can offload single execution computationally heavy to something like a headless client to prevent server lag while processing and ideally not requiring client side mods and minimal server specific configuration. I only mention official server because I would like to maintain compatability in pub zeus too but its not strictly a requirement.
so if I get you right it is not the addaction but the script that is broken
Yes.
script: String or Code -
Will run there where addaction is called, so it will only run client who uses addaction
so if my simple "forwardTEST1.sqf" script has only the following
_groupleader = man1
_groupleader playMoveNow "AmovPercMwlkSnonWnonDf";
the addaction in the init field would still remain
this addaction ["<t color='#f5d442'>Forward!</t>","scripts\forwardTEST1.sqf",[],1,true,true,"","_this distance _target < 20"];
but how do I integrate the code you linked
[[...], "script.sqf"] remoteExec ["execVM", 0]
into the "forwardTEST1.sqf" script? I feel like I am missing something important here.
"forwardTEST1.sqf" remoteExec ["execVM",0];
Hey folks, I've written a simple wave defence system and i'm running into a small niggle. Spawned enemy groups just stand in place, despite me giving them a 'Destroy' waypoint upon creation. I've read that the 'Combat' behaviour can cause this, but that doesn't seem to be the case for me. Any ideas?
["<t size='2.5' color='#ffffff' font='PuristaMedium' >The Horde Approaches!</t>",0,0.2,3,1] spawn bis_fnc_dynamictext;
currentTime = 0;
waitTime = 10;
_spawnWave =
{
groupSize = [4, 10] call BIS_fnc_randomInt;
currentGroupSize = 0;
_grp = createGroup East;
posToSpawn = leader Guards2 getPos [100, random 360];
while {currentGroupSize < groupSize} do
{
_newUnit = _grp createUnit ["Zombie_O_Walker_Civ", posToSpawn, [], 10, "NONE"];
currentGroupSize = currentGroupSize + 1;
};
_wp = _grp addWaypoint [getPosASL leader Guards2, -1];
_wp setWaypointType "DESTROY";
_grp setBehaviour "AWARE";
};
while {currentTime < waitTime} do
{
call _spawnWave;
_waitTime = random 40;
currentTime = currentTime + _waitTime;
sleep _waitTime;
};
["<t size='2.5' color='#ffffff' font='PuristaMedium' >You have survived for now!</t>",0,0.2,3,1] spawn bis_fnc_dynamictext;
And if it helps, the leader remains stationary while the rest of the group either moves around randomly, or on the occasion I've directly given them a new waypoint in zeus, moved to the waypoint, leaving the leader behind
is there any way to make a script to make people join to my server through the middle box ? and removing the others two?
yes
check it out this mod
https://github.com/ArmaForces/Mods
I thought about showing on the map what another client who is in the camera "camera" camcreate is looking at. And I would like to know, is the camera object created locally or in the network? Is it possible to create a camera so that other players could track the position and view of the camera that was created by another client?
camCreate is Local Effect, so the camera only exists on the machine where the command was executed.
To get around this, you could (not an exhaustive list):
- create cameras on all machines with the same parameters (works well for cameras that are static, script-controlled, or attached to things, not so much for player-controlled free cameras)
- have the camera-owning machine publish information about its position and orientation using e.g.
setVariable(works OK for free cameras, but update rate could be an issue)
So setVariable with "true" is like "publicVariable" ?
yeah it's what I was hoping to avoid having to do, seems like it's the only option i guess
Can't you create global camera with createVehicle? Not sure if I tried. Still, it might not have interpolation and it could be easier to just do your own.
thanks brother
Read the wiki.
https://community.bistudio.com/wiki/remoteExec
Only being able to have a single one is quite annoying
Kind of. PublicVariable being in missionNamespace and setVariable setting it to the namespace of an object
Hello. I almost have no experience at Arma scripting and I'm curious if I am checking TaskState properly.
{
hqdriver sideChat "Yes, Got it. Looks like they are restoring the power in the area. Beware of the patrols which are coming into your area. The extraction is waiting for you in the marked location.";
}
else
{
hqdriver sideChat "Yes, Got it. I'm glad you've managed to find these docs and survive without disabling the light. Anyways - I've overheard that two patrols are coming into your area. Extraction awaits for you in the marked location.";
};```
looks like it , if optgen is infact a task
How does it work internally? Some hash table for "JIP" value and it searches for object netid on deletion there to remove that RE message?
Or does it go through entire RE stack and does exact string comparison
It iterates over every message in the JIP queue, for every object thats being deleted. Checking the object ID's on every JIP message that has one
Some time ago I was suggesting to allow multiple REs per object by having object id as prefix in string instead of full match
object id is a number, not a string. Can't really have a prefix or something
Meant netid
netid is also not a string
We could add a extra variable onto it to store some string suffix/prefix for jipID separately
123 remoteExec ["func", 0, player];
321 remoteExec ["func", 0, netid player]; // overwrites above JIP RE
123 remoteExec ["func", 0, player];
321 remoteExec ["func", 0, format ["%1 something", netid player]]; // No longer overwrites but also applies to prefixed netid
something like this
something like that, theoretically possible
123 remoteExec ["func", 0, player];
321 remoteExec ["func", 0, [player, "something"]]; // Convenience, have remoteExec function treat array as prefix and suffix
This way mods could add JIP REs to entities without fearing overwriting mission or other mod JIP REs
123 remoteExec ["func", 0, player];
321 remoteExec ["func", 0, [player, "MYMOD_init"]];
333 remoteExec ["func", 0, [player, "MYMOD_somethingelse"]];
(forgot to remove format)
When I want to change player sides on respawn, what would be the recommended course of action. EZ mode creating a group on the target side and then making sure (group player) is used everything, or using createUnit and selectPlayer on that.
My code for displaying the laser at the exit point does not track the rotation of the proxy SIDE. I need to somehow add the result of dirandup from the weapon object here, but I do not understand mathematical matrices.
//simpleObjects ow = weapon, oa = pointer
_p=oW selectionPosition ["proxy:\a3\data_f\proxies\weapon_slots\side.001", 1];//pos proxy
oa setPosWorld (ow modelToWorldWorld _p);//pointer on side pos
_a=ow selectionVectorDirAndUp ["proxy:\a3\data_f\proxies\weapon_slots\side.001", 1];
oa setvectordirandup _a;//pointer rotate how must be.
the screenshot shows that the pointer is tilted and also rotated 180 degrees along the Y axis (probably Y, I don't know). The proxyWeapon rotation is taken into account, but the proxySide rotation should also be taken into account, but I don't understand where to add this rotation to find the position relative to the rotation of both the weapon and ProxySide.
#arma3_scripting message
My code with part format.
/*
_DataLaser = [["CUP\Weapons\CUP_Weapons_FNFAL\CUP_fnfal5063_ris.p3d","\A3\weapons_f\acc\accv_pointer_F",[-0.0424448,0.000860501,0.0175099]]]
_DataWeapons = [["CUP\Weapons\CUP_Weapons_FNFAL\CUP_fnfal5063_ris.p3d",[-0.289515,0.0159688,0.128267],[[-5.96046e-08,-0.886978,-0.461812],[-8.9407e-08,0.461812,-0.886978]]]]
_DataWeapons#0#2 == vectorDirAndUp selection Proxy SIDE;
need use _DataWeapons#0#2 for apply vectorDirAndUp
*/
_proxy = format ["proxy:\a3\characters_f\proxies\%1.001",_type];
_posData=(_DataLaser#0#2) vectoradd (_DataWeapons#0#1);
_posData = _posData apply {[_x]};
_unit selectionVectorDirAndUp [_proxy, 1] params ["_vy", "_vz"];
private _pos = selectionPosition [_unit,_proxy,0,true,"FirstPoint"];
private _posDir = +_pos;
private _vx = _vy vectorCrossProduct _vz;
private _mat = matrixTranspose [_vx, _vy, _vz];
//Retrieve position data
private _offsetLa = _posData;
private _directionLa = +_offsetLa;
//Compute position of memory point
private _posOffLa = +(_pos vectorAdd flatten(_mat matrixMultiply _offsetLa));
private _p1La = _unit modelToWorldVisualWorld _posOffLa;
//Compute direction point and vector
private _directionTLa = _directionLa #0 #0;
_directionTLa = _directionTLa - 10;
(_directionLa #0) set [0,_directionTLa];
private _posDirLa = +(_posDir vectorAdd flatten(_mat matrixMultiply _directionLa));
private _p2La = _unit modelToWorldVisualWorld _posDirLa;
private _v2La = _p1La vectorFromTo _p2La;
drawLaser [_p1La, _v2La, [1000, 0, 0], [], 0.1, 0.35, -1, false];
In this screenshot I removed the offset inversion for the pointer.
The starting point is higher only because the position needs to be moved relative to the ProxySide rotation and not the default rotation [[0,1,0],[0,0,1]]
If this problem is solved then most weapons will be able to correctly support laser pointer positions via drawLaser. (I don't understand why they didn't give us a command that would allow us to get laser pos and laser dir on weapons without these hundreds of checks and calculations on the client side with crutch created by simpleObject...)
Instead of all this there would be such a beautiful line of code. โค๏ธ
//getWeaponItemSelectionInfo - return [ASL POS laser start, laser direction vector]
drawLaser ((_unit getWeaponItemSelectionInfo CurrentWeapon _unit) +[ [1000, 0, 0], [], 0.1, 0.35, -1, false]);
It can even be used to check for collisions to simulate the fact that the bot noticed the laser and received information about where the one using the laser is standing. It doesn't even matter if it's IR or visible
I hope someone can correctly calculate the vectors for the laser start position in my piece of code. 
||After I test it, I will be able to post the full code that can be launched with any mod without any configs or templates. (The problem of laser collision with a large model size (usually machine guns) will not be solved)||
It doesn't work even though ["optgen"] call BIS_fnc_taskExists returns "true". No matter how I type optgen - it doesn't work. It says "Undefined variable" or "Received Type/Array, expected Task"
I used BIS_fnc_taskState and it worked.
i think the BIS_fnc_ task functions are a different system (and old) from actual task objects/commands
At least it worked. I tried the default taskState and it always ended up with an error and refused to work.
I think taskState doesn't work in SQF as intended
yeah taskState takes the task object, created with https://community.bistudio.com/wiki/createTask
Have you created tasks with BIS_fnc_Task.. ?
but the bis fnc stuff creates a string id
No, I've created them with 3DEN editor
/*
Author: Thomas Ryan
Description:
Create Task module function
*/
which uses -->
..
call BIS_fnc_taskCreate;
it seems the editor task module uses the BIS_fnc_ functions
Yeap. it does
Is it really the reason taskState didn't work? It sounds funny, they do the same thing!
yes.
In-game, you can hold alt and drag on a user created marker to move it around. is this functionality to move markers available for scripts, somewhere, or will it work if I make the marker as a _USER_DEFINED marker? I'm trying to make markers spawned by scripts be player movable in a more simple way than my original plan of handlers for mouse movement on map
it is part of the name yes
Or well. Yes and no (but also yes).
The moving around is a feature from ACE mod.
But afaik it also checks that.
And that user defined thing, does the showing players name as tooltip, and being able to delete the marker
Is there a way to detect if a vic is on a road and if it goes off the road it starts taking slow % damage so players are required to keep it on the road?
Is isOnRoad a command or am I miss remembering that?
I see it in the wiki, I will give that a try. Thanks
there is any documentation on how "swiming" works in arma?
i wanted to do currents in water, so if you want to cross a river, make it more difficult, on vehicles you can use addforce, but on players... you cant ( since it ragdols), and if you try to use setVelocity, animation will be like running
i guess i can do a "swiming" script, and use the set velocity there...
I know Drongo's Dynamic Weather mod has wind that pushes your player if its too strong but you cant move when its doing it. So maybe there is a way.
Works perfect, thanks for pointing it out. Now my players will have to stay on the road and can't constantly go off-roading across the map.
yea probably is bc of that
Gonna try again here. Having a bit of issue with this wave spawner script, spawned enemies don't follow the waypoint I add to them, they just stand around, but if I give them a waypoint in zeus, they move towards it. Any ideas what's going on? Cheers
P.s. the units are zombies from WebKnight's Zombies and Creatures if it helps!
["<t size='2.5' color='#ffffff' font='PuristaMedium' >The Horde Approaches!</t>",0,0.2,3,1] spawn bis_fnc_dynamictext;
currentTime = 0;
waitTime = 10;
_spawnWave =
{
groupSize = [4, 10] call BIS_fnc_randomInt;
currentGroupSize = 0;
_grp = createGroup East;
posToSpawn = leader Guards2 getPos [100, random 360];
while {currentGroupSize < groupSize} do
{
_newUnit = _grp createUnit ["Zombie_O_Walker_Civ", posToSpawn, [], 10, "NONE"];
currentGroupSize = currentGroupSize + 1;
};
_wp = _grp addWaypoint [getPosASL leader Guards2, -1];
_wp setWaypointType "MOVE";
_grp setCurrentWaypoint [_grp, 1];
};
while {currentTime < waitTime} do
{
call _spawnWave;
_waitTime = random 40;
currentTime = currentTime + _waitTime;
sleep _waitTime;
};
["<t size='2.5' color='#ffffff' font='PuristaMedium' >You have survived for now!</t>",0,0.2,3,1] spawn bis_fnc_dynamictext;
Try it with like CSAT guys and see if they follow the waypoint. Ive seen the Zombies have trouble following waypoints if pre placed.
there shouldnt be need for setCurrentWaypoint but you can try zero there
Messed around with it and for some reason the move waypoint spawns in the middle of the ocean
Both with zombies and some Nato guys
Guards2 not a valid group at the point that you run the code, I guess. Should throw an error too. Make sure you enable "show script errors" in the launcher params.
Ah gotcha. Guards2 is a group i have placed in the eden editor, with Guards2 as variable name. Is there any way I can reference this group or do I just have to input the actual position?
You reference it using Guards2 if that's what you used
I feel this may be at odds with the previous comment, the code runs during runtime, in the activation field of a trigger, which itself is activated by interacting with a civilian on a hold action
Is it normal and intended behavior for mission scripts to run and diag_log prior to
16:14:31 Starting mission:
16:14:31 Mission file: <mission name>
16:14:31 Mission world: <mission world>
16:14:31 Mission directory: <mission directory>
In a multiplayer mission? Or is this a bug from the new profiling? Not sure where that is supposed to fall in initialization order
If you use guards2 in the variable attribute on the group in the editor, this reference is made during object init, which is before your mission even starts.
Are you modifying the group at all? Or changing the units to a different group at all? During the mission before this trigger activation?
Oh I see you have a previous comment, let me look at it
Ever since profiling update yesterday we've had players experiencing issues with respawning but not sure yet if that is a race condition in our mission or something wrong with the new build. Just don't wanna put something in #arma3_feedback_tracker if it's an us issue ๐
Are you doing any logging with this? Like John said, does guards2 still exist or do they get killed off by the time this triggers?
Still exist. Guards2 are a group whom the spawned enemies are supposed to move towards and kill
Do some logging. See what guards2 is returning as at that time. Same with the positions you are using. This is something logging can easily find. On phone so I can't write anything easily for you.
I haven't noticed any issues spawning, both in vanilla respawn systems and my custom ones. What issues are you having with respawning
@round hazel Type units Guards2 into the debug console and see what it returns.
And does it go away when going back to stable branch?
[B Alpha 1-2:1,B Alpha 1-2:2,B Alpha 1-2:3,B Alpha 1-2:4,B Alpha 1-2:5,B Alpha 1-2:6,B Alpha 1-2:7]
Position of waypoint is origin
However the units spawn in a 100m radius around guards as intended
Wait, I was misreading the problem anyway
You said later about the waypoint spawning in the ocean.
Original code was just not following the waypoint, but it was in the right place?
That was a later discovery, the waypoint spawns close/at the maps origin. I've been testing and believe it could be to do with getPosASL
Wasn't that after you used setCurrentWaypoint with 0?
0 waypoint is often at [0,0] for some reason.
It has been changed to '1'
I have to go eat but I will return, thanks for the help so far everyone!
A player put in a bug report that he was unable to respawn using a custom system within our mission. When I took a look at his attached RPT it looked like he hit an exitWith we had for the script already being active. I looked into it further and it looked like other systems of ours were executing prior to initialization causing a widely used var of ours to become undefined.
I think I've at least seen four or five people with the issue myself but just not sure if it's an actual issue with profiling. We spawn some of those scripts on initialization so could also just as easily be our own apeish fault for having some of that stuff spawned as it's execution order wouldn't be guaranteed.
I guess TLDR is I am certain it is being caused by profiling but just not sure yet if it is due to a race condition within our mission or some larger issue with the profiling update
Perhaps a silly question, but does Arma 3 have a method to detect what day the server host currently has in real life? I am wanting to make it so on weekends the missions themselves change.
systemTime or systemTimeUTC
@austere granite createUnit
you should not mix up blufor units with non-blufor units
@jade abyss it is even worse! <NAMESPACE> setVariable [<STRING>, <ANY>, true] is even better then public variable as you just need one command ๐
I have been wondering about this for a while now, if you have a group of lets say 5 soldiers (either lead by and AI or by a player) is it possible to select the various soldiers according to their position in the group without giving them a dedicated name in Eden? Like if you do a thislist on the group (not sure if there is a better way than thislist) and then go "select 0" for the leader, "select 1" for soldier 1 (which the player would select using F1), "select 2" for the soldier 2,...
The reason I ask is I want to transform some of the scripts I have, which use named units, to a more general script that I can more easily copy paste or use on "created units" (i.e. not placed in the editor but those spawned via scripts).
The second thing I have been wondering, if you have a
{...some code...} forEach units group this;
can you exclude one of the units doing something like
{...some code...} forEach units group this (-leader group);
or with the thislist above lets say to exclude soldier 5
...forEach units group this (-(thislist (select 4))
because I tried but could not get that to work (so I got to wonder if that is even possible).
Thanks guys.
oh thanks @stable dune did not know about deleteAt, that is neat!
That log appears before the mission loading starts, before the terrain gets loaded.
Its logged before objects are created, and before init.sqf is ran
does anyone know if its possible to take a tent object from CUP and put the redcross texture from other tent (that looks the same) to it?
poor GenCoder8
?
I think they already removed the spam ๐
joking as if you have been the spam ;-p
oh ok ๐
problem solved
the tent i mean
If the object has hiddenSelections set up, then you can probably do it with setObjectTexture/Global. If not, then...not.
cant take texture from other tent? (which has similar model)
If the object doesn't have hiddenSelections set up, you can't change its textures. There are no selections to target with the new texture. Doesn't matter where the new texture came from.
If it does have hiddenSelections set up, it's likely the other tent's texture will fit, and you can use setObjectTexture to apply it.
ok thx. I tried selectionNames if thats what you mean? it returned empty array
rightclick > inspect in Config Viewer > does hiddenSelections attribute exist
cant see it
this
ah thx prisoner i was looking from wrong place. so I guess that means a no
related question, what about hiding parts of the object, where are those options listed?
hmm arma just froze when trying to start mission. it must not like CUP or IFA
Oh boy
You probably mean the AnimationSources class / animationList
animationList is used for garage options, which just shows/hides things in AnimationSources
is that same what you get with selectionNames command? because I get lot of entries from there, just dont know how to hide them
Not necessarily
Things in AnimationSources will use points on the model, but not everything from selectionNames would have an animation source
ok the object im working on doesnt have anything on AnimationSources
Doesn't seem like you can hide any of it then
even selectionNames gives a list? ๐ค
Pretty sure animate(Source) commands still need the config setup
You can try if you'd like though
https://community.bistudio.com/wiki/animate
https://community.bistudio.com/wiki/animateSource
ok thx
Noticed something weird - am using the following code in a "gamelogic" to remove a percentage of trees on a custom map that has way, way too many trees on it (making the forrest area unusable by players).
0 spawn {
sleep 10;
_tree_perc = 66.66;
_tree_fac = round (100 / _tree_perc);
_trees = nearestTerrainObjects [[worldSize/2, worldSize/2], ["TREE"], (worldSize * 1.41) , true, true];
{
if((_forEachIndex + 1) % _tree_fac isEqualTo 0) then {_x hideObject true;};
} forEach _trees;
};
Weirdly enough if I go above 66.66 percent it removes all the trees for some reason.
I then figured ok I just use a second gamelogic with the same code and change the last portion to include a check if the objects are not hidden && (!isObjectHidden _x) as well as as forEachReversed _trees; on the tree array:
{
if(((_forEachIndex + 1) % _tree_fac isEqualTo 0) && (!isObjectHidden _x)) then {_x hideObject true;};
} forEachReversed _trees;
...but for some reason I do not see additional trees getting removed (even put in a different "sleep" time so I can observe the changes. I then tried the same without the isObjectHidden check and also no difference.
Any idea what is wrong?
Weirdly enough if I go above 66.66 percent it removes all the trees for some reason.
round (100 / 66.66) = 2
round (100 / 66.67) = 1
Well yeah a modulo of 1 is not gonna do anything. Every full number is divisible by 1
Your 66.66% deletes every second tree.
Your factor calculation is just wrong
I would structure the code differently.
Get all trees.
numberToDelete = count _trees * percentage
Then delete that many tree's.
You can random shuffle the array and delete the first numberToDelete trees, or a for loop with selectRandom, or a forEach loop deleting every Nth tree.
every Nth tree (as you've been doing) is gonna be annoying, because N will not be a whole number
If you have 500 tree's and want to delete 66.67, you'd want to delete 333 tree's, every 1.5 tree's. That's annoying
Ah actually I want to delete more than 66.66 but if I go like 80 percent in the above used code, it deletes all the trees for some reason (i.e. if I only go to 66.67 it will delete all, so anything above the value of 66.66 will delete every tree).
I just told you the reason, and how to fix it.. Did you not read my message?
Cheers thanks ๐
what about these which selectionNames gives, are they any good? ```["proxy:\ca\misc3\fort_bagfence_long.001","proxy:\ca\misc3\fort_bagfence_long.002","proxy:\ca\misc2\table\table.001","proxy:\ca\misc2\table\chair.001","proxy:\ca\misc3\fort_bagfence_long.003","proxy:\ca\misc3\fort_bagfence_long.004","proxy:\ca\misc3\fort_bagfence_long.005","proxy:\ca\misc3\fort_bagfence_long.006","proxy:\ca\misc3\fort_bagfence_long.007","proxy:\ca\misc3\fort_bagfence_long.008","proxy:\ca\misc3\fort_bagfence_long.009","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.001","proxy:\ca\misc2\table\table.002","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.002","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.003","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.004","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.005","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.006","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.007","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.008","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.009","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.010","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.011","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.012","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.013","proxy:\ca\wheeled2\hmmwv\m997a2_ambulance\data\stretcher\stretcher.014","\ca\misc3\tent_east.001","\ca\misc3\powergenerator\powergenerator.001"]
In vanilla arma 3 there's a artillery support requester module, how can i make it so that all blufor units can request artillery?
you probably have to sync the requester module player synchronizeObjectsAdd [req] then player has it
Hey Folks, I have a question because I don't seem to understand something completely here.
I would love to place a Hammer Turret on a Ship and through some ambient fire onto the coast while the players insert into the ao.
Checking the Hammer, it has an artillery computer and when asking with getArtilleryAmmo I get a nice array back. So, this is artillery right? Well, if I try using it with doArtilleryFire nothing happens.
Okay, well, maybe its a bit special, like the vls turret, so I make it watch a target and then give a simple doFire command. Well, it turns somewhat into the direction where the target should be and then it fires, but the shot drops into the water after a few meters.
Well the last problem is obviously because the fire mode is on "Close". Did anyone ever get this working via script and can someone explain what is wrong with using doArtilleryFire?
Here is the call with doWatch and fireatTarget:
west reportRemoteTarget [vlsTarget_1,2000];
hammer doWatch vlsTarget_1;
waitUntil {sleep 1; unitReady hammer};
hammer fireAtTarget [vlsTarget_1];
And here my do Artillery call;
hammer doArtilleryFire [_pos,1,"magazine_ShipCannon_120mm_HE_shells_x32"];
the doArtilleryFire syntax should be this
unit doArtilleryFire [position, type, rounds] you've placed the ammo type in the last parameter and the rounds in the second one
you want also VLS plataform to fire?
Argh, what a stupid reading mistake. Thank you.
Happens
VLS platform fires with the doWatch fireAtTarget combo. ^^
nice, I thought it 100% required laser targetting
Yeah, that was my first version until I realised I don't need that ^^
@still forum - thanks for your help and input earlier, much appreciated (am not that good at math and coding and it takes a while for me to understand how to do things). I still wonder though why 66 percent works and everything above that number does delete everything with the code I had so far. In any case I will try to insert your suggestion and see if I can get it to work :)
Hi ,Im still trying to create a dynamic airport for Altis ,the large
Airport.
I tried using the Dynamic airport code in wiki ,asked AI to assist with code building ect but it's never going to work.Been at this for a week now everyday almost ,does anyone know of anything or anyone I can chat to regarding this goal.
you don't need to create anything for the altis main airport if you want AI to use it
My planes cross country and dont use any of the taxi ways .
it because it doesn't work like that, you need to put the airplanes besides the main taxiway
place an airplane in the editor, in Air/flying, then in its init, put this landAt 0 and see what the plane does
Will do .Thank you .If i wanted to edit it and place more points on the airfield
anybody knows how to add an button in the map screen on the upper right corner, sort of config.cpp class enhancement or something maybe
โฌdit: found out by myself -> configfile >> "RscDisplayMainMap" >> "controls" >> "TopRight" >> "controls" >> "ButtonPlayer"
is there a do { ... } while (x); in sqf?
while {} do {};
that still does execute the do block once before first check of the condition? @warm hedge
What is the point you want to achieve
I prefer the former, but its fine.
do {
{
_containerIdCharacters pushBack switch (_x) do {
case "A" : { selectRandom _characters; };
case "0" : { selectRandom _numbers; };
};
} forEach _containerIdPattern;
_containerIdString = _containerIdCharacters joinString "";
} while (_usedContainerIdStrings pushBackUnique _containerIdString == -1);
while (_usedContainerIdStrings findIf { _x == _containerIdString } > -1) do {
{
_containerIdCharacters pushBack switch (_x) do {
case "A" : { selectRandom _characters; };
case "0" : { selectRandom _numbers; };
};
} forEach _containerIdPattern;
_containerIdString = _containerIdCharacters joinString "";
};
So at least do something once is just the point?
yeah pretty much
generate a unique number, check if it matches any of the previously generated numbers, if so try again
// whatever
if (condition) exitWith {};
};```
the former just lets me use the side effect of pushBackUnique to both do the check and for the number already existing and update the list of used numbers instead of the the latters findIf is a little less immediately obvious
I'm wondering, is there a way to scale an object in Arma 3 ? I'm making combvat rations and i'd like to have the expiration date on the box. I'm hesitating in between adding hiddenselections or attach a scaled object with appropriate textures
setObjectScale
nice, thanks that i think its better to attach an scaled object with the text. It's flexible and reusable on other objects
Does the array reference behave like a smart pointer in C++? For example, if I declare a private array in a function A and pass it to another function B, and the function A ends right after, will B still have access to the array? Thanks
ye
Thanks. ๐
How would I setup BIS_fnc_showSubtitles in order for it to work on MP?
Is a marker a data type (object) in SQF or is it just a string name? Thanks
It's just a string
Thanks.
with animationSourcePhase "rpm" I can tell wat the rpm of a vehicle is, is there away to get what gear its in? ik theres nothing for gearbox for model cfg (and the only gear is for like landing gear)
Will this successfully terminate a spawned function?
isNil
{
if (true) then {terminate _thisScript;};
};
//Don't execute beyond this line...
Or like this?
scopeName "fnc";
isNil
{
if (true) then {breakOut "fnc";};
};
//Don't execute beyond this line...
I know there were/are some issues regarding exitting functions from within isNil.
Thanks.
I think for it to properly terminate, you need to force it to suspend.
So add a sleep 0.001 after the isNil
I'm pretty sure the terminate is one layer above the actual execution loop, so while inside the loop it wouldn't see it
@torn hemlock
That's cheating
Helloh peeps, a friend asked me how to do something for an op he wants to do
Hey Pi, question. If I wanted something for an OP of my own that could be activated mid-game that would cause everyone outside a certain radius to instantly drop dead, and then can be turned off, how would I do that, if any that you know of?
my first idea on how to do it is to use 2 nearObjects checks
my first guess would be 2 sets of nearObjets checks, one that only checks the radius you dont want to kill and then another one that checks further outside that area and you subtract the smaller one from the big one
any better/other ideas or recommendations?
_inArea = _allUnits inAreaArray [...]
_unitsToKill = _allUnits - _inArea;
kill them
its unclear what "everyone" means. I consider that as everybody which means units. So no need for nearObjects scanning all objects, you can trivially retrieve a list of all units, and let inAreaArray do the filtering
["Alexander Viscera", "We've arrived back to the 'Union' camp. Give me the document.", 0],
["Bobr", "Here.", 5],
["Bobr", "Anyways, what is in there?", 7]
["Alexander Viscera", "How do I know? I've only got it! I'll tell you all you need before another operation.", 12],
["Bobr", "Another one?", 17],
["Alexander Viscera", "Yes, but I hope we won't need to go on another 'unplanned' operation. Call me at the morning. Now get out.", 21],
] spawn BIS_fnc_EXP_camp_playSubtitles;```
Help me, I did everything as said in BIS wiki and it still throws an error which I can't understand. It says that "]" is missing at the 12th line (fifth in this code block) but its structure is the same as in the previous lines.
you missed a comma
Ah! Thank you! Didn't notice it. Now it works.
on the third line
since it'd be a multiplayer mission allUnits should props be avoided to not kill zeuses and people in base waiting to respawn etc.
You can get all units ,
And exclude units who are in the respawn area,
Who is Zeus, etc.
ye I can do that but then I might as well just use the original idea of 2 radiusses... radius-i? i dunno but you get what I mean
radii, iirc ^^
Ye that works
Thanks for your help.
Does getText return "" empty string when it doesn't find anything (no config or no config attribute exists)? Thank you
yep
Thanks.
I assume that this won't work, right? Using a string as an argument representing a name of a class when it expects a config type.
//fn_someFunction
params [
["_classNameString", "SomeDefaultClass", [configNull]]
];
//Then call it like:
["SomeClass"] call fn_someFunction; //Error: a config type expected.
Thanks
strings and configs dont mix ๐ฌ
but you could do ```
params [
["_classNameString", missionConfigFile >> "SomeDefaultClass", [configNull]]
];
Yeah, so the user would need to call it also like [ConfigFile >> "SomeClass"] call fn_someFunction;, right?
I guess I will have to manually validate the input then.
Because this is not really user firendly.
Is there a way to check if a location is in the playerโs view before spawning units?
Maybe something with lS but other peeps props have better ideas https://community.bistudio.com/wiki/lineIntersects
he meant lineIntersects
but you could also try with lineIntersectsObjs, terrainIntersectASL, checkVisibility,
checkVisibility will work, but you have to adjust the threshold, it can also take into account the foliage. Or you can use lineIntersectsObjs. If you are planning to place a bigger object there, like a tank, then it is a good idea to cast more then one ray to check also the far left/right/top edges of the area, not just the spot on the ground, which is usually not visible.
you can give string to the function and do ConfigFile >> _thePassedString inside the fnc
nearestTerrainObjects BIS_fnc_inAngleSector
Thanks.
This will be good for fast, rough estimation, but it doesn't check the actual visibility.
I dont want units spawned in view of the playerโฆthats all Im going for.
b = false? ๐
In this case is false equal to false which is true :3 At least if I think right!
use lineIntersectsObjs
How do I setup an evac marker to appear when a task is completed? This is my current code for it, but it's not behaving if (triggerAcivated demoF) then {"Evac" setMarkerAlpha 1};
if is a one-time check. Unless this code is running in a loop, this will check whether the trigger is activated, once, see that it isn't, and then give up.
You could use waitUntil instead - or change the marker alpha in the same code that completes the task
I was putting it in the condition field on the marker, which says it checks constantly
I don't think markers have condition fields
Could be 3den enhanced or something, I'll try using the task succeded trigger
Yes, added by a mod
Put triggerActivated demoF in the marker's condition field
The condition field will be "the condition to unhide the marker". You don't need to unhide the marker yourself in that code, you just need to make a condition that will return true or false. When it returns true, the mod will unhide the marker.
if it doesn't work in the trigger I synced the task state succeed to, I'll try that. I'm also trying to figure out how I can have an area trigger check for a deployed turret
Make sure that the condition returns a Boolean.
I synced the task state success to a trigger which is linked to the evac task create, I put the setMarkerAlpha code into the OnActivation of the trigger, so I'm pretty sure I set it up right. I was going to test once I figure out this turret code for another task
and as a bonus, (-0) isEqualTo (0) returns true as well
I'm trying to use an exec to get the name of the deployed turret using unitTurret, but it's not returning anything
_vehicle unitTurret player
Example two, would give you return.
vehicle player unitTurret player;```
thought I tried that and it didn't like it. I'll try again in abit
Well it returned a [0], which..... seems not helpful
Return Value:
Array format Turret Path - [-1] is returned if the gunner is also the driver. When no units are in any of vehicle's turret, empty array [] is returned.
So that is 1st turret
Okay, so that's not what I was trying to do. I was trying to emulate that allMines deal to get the classname of the deployed turret so I can have a trigger area check for if the turret is deployed in it's area
What command would I use to look for a vehicle classname in the trigger area?
Cuase if I start with it in a backpack on a unit, I can't exactly give it a variable name, so if I can have the trigger look for the classname, that should work afaik
perfect, thank you
Now if i want a task to only create once two other tasks are complete, I want to use triggerActivated, but do I set it up as triggerActivated demoF, triggerActivated locateF or something else
okay, so and instead of the comma
fwiw depending on your mission setup it might be nicer/simpler to just have the units either be dynamic sim or fully simulation disabled until players get within x radius and then you enable their simulation
then you wont have to worry about players seeing them spawn in but they also wont start blasting the player too early
I need it for a spawn script - spawning ai around the player
Ah fair
hi guys
how can i sync support requester to any unit? any blufor unit
With scripts, not using editor, just syn to all BLUFOR units
I already posted this... player synchronizeObjectsAdd [req]
yes i tried but it didnt work
when i switch to another unit it doesnt have access to support
you mean like team switch or respawn?
team switch
it works if u select and spawn in with chosen unit
but if u switch to another unit in ur team and do it, then it doesnt sync
maybe ```
onTeamSwitch { player synchronizeObjectsAdd [req]; };
hmm i feel like this module can only be attached to one person?
dunno
do u know any mod for fire support ?
no
try my code?
i tried and it didnt sync
the onTeamSwitch code?
yeah
oh
what about onTeamSwitch { _to synchronizeObjectsAdd [req]; };
There is eh
addMissionEventHandler ["TeamSwitch", {
params ["_previousUnit", "_newUnit"];
}];
It's possible/likely that the module registers all its stuff when it's created, and syncing new units later won't cause it to do it again
e.g. on init it goes "okay, here are my synchronised units, add all the support actions etc to them" and then it's done, mission complete. Syncing a new unit doesn't inherently make it rerun its code, there is no EH for detecting synchronisation, and the module is probably not constantly checking to see if anything new got added
any way to find flat terrain not using BIS_fnc_randomPos ?
_uberPos = [["enemy_area"], ["usa_base_area"], {true}] call BIS_fnc_randomPos;
@proven charm I don't want to use BIS_fnc_findSafePos because it gives me 2D position and in lot of spawning script I need 3D pos
other reason is I have an area marker where I want enemies to spawn, with BIS_fnc_findSafePos I can only blacklist area marker
for what do you need Z coords?
ye ... well @tough abyss
its the same thing with if <ANY>
the for command just marks the following value --> waste of command
@thin fox I looked again my code and actually I don't need Z for anything ... ๐ everything is working with BIS_fnc_findSafePos ...
๐คฃ
I swear it didn't worked with it yesterday ...
I was going to say that you can add Z coords later in the code
I can just add it to the position array ...
*should be the same
maybe the marking fucks up the string
hell i know
only thing is: for & if and many other commands are doing nothing else but marking the value
Hello. Can someone help me please? I don't understand why player's side is not changing (playerSide always returns EAST)
_PlayerArray joinSilent (createGroup independent);```
(bobr is the player's unit variable)
"bobr" is not an object but a string, bobr might be the object you look for
This code should return an error anyways
I tried writing it as an object and it doesn't return any error no matter how I write "bobr"
Just found out that it is not returning error. It shouldn't work anyways
But anyways sidePlyer is not actually updating while side player is
Oh, it shows that my code works. Thank you!
And to be sure to check side group player
It also has changed player's group so the code says that player's group side is GUER.
GUER == independent
https://community.bistudio.com/wiki/Side
I know it, I figured it out when I'd been trying to understand what side names are in SQF. Independent is also resistance. (anyways, I thank you all!)
Sorry guys but I am really struggling a lot with grasping addaction in MP and making those work for everyone. Things work just fine in SP, but in MP the actions only work for me as the host (i.e. if I execute the action, the other players see something happen, if they execute it, things happen for them, but do not translate to me AND it seems that the object reverts to the previous state, before executing the action, for them). It also seems the "actions" are "doubling" too for some reason (so instead of one entry I get two, when testing with one other player).
So if my test sqf works in SP, do I really have to remoteexec every line of the code inside the sqf to make it work for all players?
Or is it enough to add the following remoteExec at the top of the sqf file (assuming it will then execute it for everyone?):
"scripts\moveforward.sqf" remoteExec ["execVM",0];
_groupleader = man1
_groupleader playMoveNow "AmovPercMwlkSnonWnonDf";
(did try other variations yesterday, putting that line in at the bottom, but did not get around to test this latest one)
(or do I have to put a "isServer" in somewhere maybe?)
I am desperately trying to make mixed motorized group (veh+infantry) to move with the same speed
{_x limitSpeed 20} forEach units _qrfgrp;
Vehicle always go into drag race leaving infantrymen behind ๐คท
is it possible in arma3 formations to have a specific squad member be in a specific position within a formation?
not sure but i think its possible to slowdown the vehicle with _groupOne setSpeedMode "LIMITED";
arma is little difficult when it comes to locality and remoteExec , you have to check each command to learn how they must be executed. Running sqf file simply on all players + server may or may not work
works! thanks man ๐
Can getPos syntax 3 handle correctly negative and out of the range compass headings like -400, or + 400? Thank you
origin getPos [distance, heading]
If you need to handle those kind of numbers, I guess you could just calculate the modulo of the direction: ```sqf
heading mod 360
Thanks, I know how to do these calculations, but I would like to know if these calculations are necessary or redundant.
I think you can pretty fast check it,
Test with and without mod 360, and does it return to the same position or not.
everybody typing but no messages pop up ๐
me when I'm not sure of the answer ๐
how to select mission params for single player missions? Is there any way?
remoteExec ["execVM", 0] means that it'll execute that script file on every machine that's currently connected. This is almost certainly not what you want, because you also want to add the action to players who haven't yet connected (JIP, join in progress).