#arma3_scripting
1 messages · Page 624 of 1
while loop
I think the waituntil is there to block the loop from running again until the condition is true, so it sleeps and checks every 2 seconds before continuing
@proud carbon Are you sure? If so, you can try using an object that is hidden by default (i.e. no resolution lod)
yeah. im using a football that I made hidden.
what are you trying to achieve, if you don't mind me asking?
ok. I a demon chases the player around. you can't see the demon but you can hear the demon.
once it gets close enough it'll kill the player
why does it have to face toward you?!
@solid raptor are you doing a waituntil IN a while loop? Seems like you would be better off just doing sleep at the end of the while loop and then instead of doing while true -> while {condition}
no because the intent here isn't to sleep for a pre-determined time
its to sleep until a condition is met
the player is running away from it.
though I wonder if theres a better way to do that
a waituntil in a while loop is basically double just saying
by face you mean direction yeah?
yes
well im trying to get it so you can hear it's position. I'm using getRelPos and setpos to achieve the moving aspect of this
if that makes sense?
I recommend vectorFromTo and setPosWorld/getPosWorld instead.
I still don't understand where direction comes into play
The good thing about the world pos is that you can achieve the desired velocity for your "demon"
As for making it closer:
_p1 = getPosWorld _demom;
_p2 = eyePos player;
_demon setPosWorld (_p1 vectorAdd (_p1 vectorFromTo _p2 vectorMultiply (_speed*diag_deltaTime)));
yeah and that would work if it wasn't for the fact making the object hidden for some reason stop the object from getting a vector.
It doesnt
i've tried it
It still has a position
its to sleep until a condition is met
@solid raptor isnt that basically the waitUntil command?
@proud carbon Try a hidden object
Suspends execution of scheduled script until the given condition satisfied.
Do you have CBA?
yeah but the loop is needed because theres more stuff inside it than just the waituntil
sorry if I didnt make that clear
No sadly.
I just didn't want to spam the channel with a block of code
the structure though is
while loop
code
waituntil
@proud carbon I'm not in the game right now. But you can go to B_TargetSoldier in config viewer (under cfgVehicles). Use its model to create a simple object
You can then use this hidden object
It doesn't have a res lod, so its hidden by default
That just checks the condition every 2 seconds instead of each frame
I think the reason is performance
ok. i'll be right back and i'll give it a test.
Waituntil by default checks condition every frame
it waits until the track is done and then processes the next one
Nearly every frame. Depends on the number of scripts in the scheduler and their execution time
i'll try it out next restart
for "_i" from 0 to (count _categories min 10) do {
_curr_cat = _categories select _i;
_catName = _curr_cat select 0;
if (_catName == _item) exitWith {
_tracks = _curr_cat select 1;
if (count _tracks > 0) then {
//Pick the first one from the list
_new_track = _tracks select 0;
_track_duration = _new_track call fsh_getTrackDuration;
//Update the list for next time
_tracks = _tracks call fsh_arrayCycle;
_curr_cat set [1, _tracks];
_categories set [_i, _curr_cat];
};
};
};
That bit of code was essentially saying this
Not sure what the point of that weird method was anyway
it can still be written in a better way
but meh
Hey guys, if i remoteExec a hint command and set the JIP parameter to true, will JIP players still see a hint if they join after the script has finished executing?
Or only if they join while its still executing
first case
Thx lou 👍
@proud carbon
createSimpleObject ["A3\Structures_F\Training\InvisibleTarget_F.p3d", _pos];
Use that as your hidden object
I've tested it and it works
can arma read sounds from a pbo? or do they need to be stored in a folder
yes
sweet
https://discordapp.com/channels/105462288051380224/105462984087728128/766048898896232468
Still haven't found a solution to this, it just doesn't seem to work whatever I try. For whatever reason it just doesn't work as described in the wiki. Am I missing something?
I just tried putting a unit in the middle of nowhere and it really does work as it should wtf
does setWaypointPosition take into account buildings or something?
@proud carbon
Test this in editor
demon = createSimpleObject ["A3\Structures_F\Training\InvisibleTarget_F.p3d", getPosASL player vectorAdd [0,0,10]];
onEachFrame {
_speed = 1;
_p1 = getPosWorld demon;
_p2 = eyePos player;
demon setPosWorld (_p1 vectorAdd (_p1 vectorFromTo _p2 vectorMultiply (_speed*diag_deltaTime)));
}
@loud python Are you trying to have the group move about randomly?
jesus that is fast man
I had to set the speed to 0.002; just so the player doesn't insta dies lol
Thanks man
np
@loud python Are you trying to have the group move about randomly?
@little raptor exactly. Well, not a group, a single unit, but same thing.
And the wp position is within a set radius?
?
which one?
I want the unit to move around within the radius, if that's what you're asking
The random position
yes
pick random position within radius, go there, repeat
but it doesn't do that; instead it just picks random positions within a very small area to one side of the center position
one thing I should point out is that whether the unit moves there depends on whether a path can be generated to that point
hmmm...
well this is all within a village, so I don't see that being the problem
and there's plenty of space all around the area
If the position falls inside a building, it may not work
anyway, something you can do is:
_angle = random 360;
_r = random _radius;
_center resize 2; //2D pos; in case it's not AGL
_randomPos = _center vectorAdd [_r * cos _angle, _r * sin _angle, 0];
[group this, 1] setWaypointPosition [AGLtoASL _randomPos, -1];
you have to define _center and _radius
About the new HandleChatMessage EH, if I just want to log some messages to the RPT of the server, do I need to add the EH only to the server and what exactly do I have to return? Just [from, text] with the original from and text I presume?
depends what channel you want to capture. for example, the server will fire for global chat, but not side chat (from what i've noticed).
mmh, all channels because I want to check who's running #login So on all clients and remote exec diag_log then I guess
login already logs to the rpt though doesnt it? shows successful and failed attempts
yea, we want to know what passwords they're trying with
ah, well the event wont help you
you need to capture the text on the chat input before it closes
Yea, that's what I'm doing now, using longbow's chatcom
private _ctrlText = findDisplay 24 displayCtrl 101;
if (_ctrlText find "#login " == 0) then {
// log _ctrlText to server
};
@wispy cave quite sure the EH is local on client. Didn't test on server.
It gets chat messages that are SHOWN in chat, #login is not
Mmh, I guess I'll keep using what I'm using then, thanks for the help
I am trying to make a trigger that when activated spawns an enemy and a helicopter and then puts the enemy in the helicopter this is what I'm putting in the activation box of the trigger.
It is spawning the enemy and the helicopter but is not putting the enemy in the helicopter.
I think the broken part is the enemy's name is not getting assigned properly so its not putting him in the helicopter with "enemy1 moveInDriver helione;"
I don't know this coding stuff very well but any help is appreciated cheers.
_sol = "O_Soldier_unarmed_F" createUnit [getMarkerPos "spawn1", group eastt]; // I make a soldier on my marker "spawn1"
_sol setVehicleVarName "enemy1"; // I try to give the soldier a name?
enemy1 = _sol; // I try to give the soldier a name?
_veh = createVehicle ["O_Heli_Light_02_dynamicLoadout_F", getMarkerPos "spawn1", [], 0, "NONE"]; // I make a chopper at my marker "spawn1"
_veh setVehicleVarName "helione"; // I name the chopper
helione = _veh; // I name the chopper
enemy1 moveInDriver helione; // I try to move the soldier into the chopper
_veh setVehicleVarName ""; // I clear the name for next time it spawns
_sol setVehicleVarName ""; // I clear the name for next time it spawns```
I don't know tbh
and when you paste code here, please use
code
sqf has to be next to the three `
not in the next line
is there a way to change it now?
yes, edit it
oh there we go
so would you happen to know how I can move the player I spawn into the chopper I spawn?
setVehicleVarName is not especially useful
also, moveInDriver
_sol = (createGroup east) createUnit ["O_Soldier_unarmed_F", getMarkerPos "spawn1", [], 0, "NONE"];
_veh = createVehicle ["O_Heli_Light_02_dynamicLoadout_F", getMarkerPos "spawn1", [], 0, "FLY"];
_sol moveInDriver _veh;
anyway, something you can do is:
_angle = random 360; _r = random _radius; _center resize 2; //2D pos; in case it's not AGL _randomPos = _center vectorAdd [_r * cos _angle, _r * sin _angle, 0]; [group this, 1] setWaypointPosition [AGLtoASL _randomPos, -1];you have to define _center and _radius
@little raptor I will try that later when I'm back in the editor, but thanks a lot for the code 😄
I had though of doing something like that but didn't want to look up the commands for all the vector math
@winter rose
'setVehicleVarName' is not especially useful
It is useful in a way. If you want to stringinze the object, it will work:
_veh setVehicleVarName "Somename";
call compile format ["%1 setPos [0,0,0]", _veh];
I know, I meant here
ok 😅
thanks leopard that makes heaps more sense than the gibberish I had
so I have a script that plays audio. but for some reason the audio clip repeats 3 times. the other lines work and aren't different from the other spawn calls.
//here it is
[_RD, ["RD_part_of_the_first_team", 150]] remoteExec ["say",0];
//this one works fine
[_RD, ["RD_Yes_Weird_Things", 150]] remoteExec ["say",0];
most likely comes from:
- your sound file that is 3× what you want (unlikely)
- you remoteExec'ing a script that remoteExecs the sound, multiplying by the number of connected players + server
I've checked the sound file. we're good on that front.
it also does the same thing in SP with the remoteExec.
then you trigger it multiple times?
tried to replace this specific sound usage with another one in the exact same conditions?
Got a problem regarding animations. I have a little function
NIC_HealMePlayAnim = {
params ["_unit", "_anim"];
_unit playMove _anim;
waitUntil {animationState _unit == _anim || !alive _unit};
waitUntil {animationState _unit != _anim || !alive _unit};
};```
Which I call like so:
```sqf
[_x, "AinvPknlMstpSnonWnonDnon_medic_1"] call NIC_HealMePlayAnim;
[_x, "AinvPknlMstpSnonWnonDnon_medic_2"] call NIC_HealMePlayAnim;
Problem: The animation is stuck after 1. call. What am I doing wrong?
@languid oyster First of all, you can do this using event handlers.
second of all, what do you mean stuck? The unit doesn't move at all?
Yes, the unit remains stuck at the end of 1. animation and will not move until switchMove "";
Is it an AI?
yes
Have you used disableAI "ANIM"?
uhm. No
Then it's an interpolation/connection issue.
and how to resolve this issue?
You can't.
I recommend that you use a differenet function
That passes the animations as a sequence
And use event handlers
Could you give me the link to an example?
I don't have one. But I can write a quick example
That would be very nice
if (_unit getVariable ["TAG_AnimDone_EH", -1] == -1) then {
_EH = _unit addEventHandler ["AnimDone", {
params ["_unit", "_anim"];
_anims = _unit getVariable ["AnimSequence", []];
_anims deleteAt 0;
if (count _anims > 0) then {
_unit switchMove _anims#0;
_unit playMoveNow _anims#0;
} else {
_unit removeEventHandler ["AnimDone", _thisEventHandler];
_unit setVariable ["TAG_AnimDone_EH", -1];
};
}];
_unit setVariable ["TAG_AnimDone_EH", _EH];
};
_sequence = _unit getVariable ["AnimSequence", []];
_sequence append ["AinvPknlMstpSnonWnonDnon_medic_1", "AinvPknlMstpSnonWnonDnon_medic_2"]; //add the new animations
_unit setVariable ["AnimSequence", _sequence];
_unit playMoveNow _sequence#0; //play the first anim from the list
this works (according to my tests)
and you only need one event handler. don't mistakenly pile them up
Many thanks, will test this immediately
I updated the code to the full version.
I'm trying use the script below to make a mod to place a 3D marker when using shift+left click, and it works fine in singleplayer, however in multiplayer the mission never loads. It just gets stuck on the loading screen with the green bar progress all the way to the right. Any idea how to fix this?
if (hasInterface) then { waitUntil {!isNull (findDisplay 12)};
_mapDisplay = findDisplay 12;
_mapControl = _mapDisplay displayCtrl 51;
_mapControl ctrlAddEventHandler ["MouseMoving", {
TRN_var_mainMapMouseOverCustomMark = "customMark" in (ctrlMapMouseOver (_this select 0));
}];
["TRN", "onMapSingleClick", {
if (_shift) then {
TRN_var_customMarkLocation = _pos;
};
}] call BIS_fnc_addStackedEventHandler;
_mapDisplay displayAddEventHandler ["KeyDown", {
if (!isNil "TRN_var_mainMapMouseOverCustomMark" && {TRN_var_mainMapMouseOverCustomMark} && {(_this select 1) == 211}) then {
TRN_var_customMarkLocation = nil;
};
}];
addMissionEventHandler ["Draw3D", {
if (!isNil "TRN_var_customMarkLocation") then {
drawIcon3D ["\A3\ui_f\data\igui\cfg\cursors\customMark_ca.paa", [1,1,1,0.8], [TRN_var_customMarkLocation select 0, TRN_var_customMarkLocation select 1, (TRN_var_customMarkLocation select 2) + 2], 1.5, 1.5, 0, "", 1, 0, "TahomaB", "", true];
};
}];
};```
@little raptor it works 😃 ! Many thanks! You're awesome!
Cool, I even added more animations, and everything works. Why this is not working 'out of the box' like stated here https://community.bistudio.com/wiki/playMove by placing multiple playMoves, is beyond me. On the other hand, I lack knowledge to tell any better way. Once more, any thanks for the solution.
hi, is there a way to get the type of roadway (from an object roadway lod) on which the player is standing ?
Maybe https://community.bistudio.com/wiki/getRoadInfo ? @sonic linden
is it still dev branch only ? have dev installed and it would take some time to pach back and forth
Oh excuse me. It does included in current public, forgot to update the article
Added: New command getRoadInfo - FT-T147630
Dont think its dev branch
Ye its in stable now
thanks will try it
thanks
When playing with ACE mod, and a helicopter is hit by some AA, it often occurs, that people only get unconscious,. I am trying to do some 'rescue' thing in case the player gets unconscious, and there is a medic aboard. The idea is: The medic grabs the unconscious player, and jumps out of the destroyed heli. Here the part of my script doing this.
unassignvehicle _medic;
_medic allowDamage false;
moveout _medic;
unassignvehicle player;
player allowDamage false;
moveout player;
waitUntil {vehicle player == player && vehicle _medic == _medic};
player attachTo [_medic, [0, 0, -1]];
sleep 2;
_medic allowDamage true;
player allowDamage true;
waitUntil {getpos _medic select 2 < 120};
private _backpack = backpack _medic;
private _backpackcontents = backpackItems _medic;
if (_backpack != "" && _backpack != "B_Parachute") then {
removeBackpack _medic;
sleep 0.1;
};
_medic addBackpack "B_Parachute";
Problem: The player is not attached to the medic. He falls to his death. How do I attach the player to the falling medic?
Hm is it possible to display hints in the main menu?
@little raptor Sorry to ping you again but the script you helped me with doesnt work for me anymore
the heli just yeets itself back to air once it lands
@languid oyster
Why this is not working 'out of the box' like stated here https://community.bistudio.com/wiki/playMove by placing multiple playMoves, is beyond me
The AI have their own movement system. It's like when you press WASD. So what you added using playMove gets overridden.
@cold cloak I'm not sure what's wrong. The script should work if implemented correctly.
Did you get it to work?
I mean
I use a different trigger now but
I fixed that in the sqf file
and put the line of script to the wanted triggers activation
what about the heli?
its the MY_HELI
So no changes?
Yeah
other than the trigger name
but it didnt even work when I had it with the original names
and you spawn the code?
task4d
On activation:
_WP = (group MY_HELI) addWaypoint [getPosASL thisTrigger, -1];
_WP setWaypointStatements ["true", "[] execVM 'land.sqf'"];
MY_HELI enablesimulationglobal true;
what was the script again?
_landPad = createVehicle ["Land_HelipadEmpty_F", ASLtoAGL getPosASL task4d];
MY_HELI land "GET OUT";
waitUntil {
sleep 1;
units group player findIf {alive _x && !(_x in MY_HELI )} == -1
};
deleteVehicle _landPad;
MY_HELI land "NONE"; //take off
what about task4d?
To make the heli not take off until the player group is in
task4d is the trigger that activates it
is everyone in the player's group?
no need
the heli is a separate group
that's not related.
ah
yeah
I just put the landing waypoint to the helipad with no changes to it and a move marker after the land
it's because the helicopter might have a move order or waypoint after that
How do you add the waypoint?
After landing
Add it using a script
@cold cloak
basically:
_landPad = createVehicle ["Land_HelipadEmpty_F", ASLtoAGL getPosASL task4d];
MY_HELI land "GET OUT";
waitUntil {
sleep 1;
units group player findIf {alive _x && !(_x in MY_HELI )} == -1
};
deleteVehicle _landPad;
MY_HELI land "NONE"; //take off
_WP = (group MY_HELI) addWaypoint [_extractionZone, -1];
_extractionZone is a position
You can either define it in the script, or use a helper object and get its position (like getPosASL helperObj)
And of course, if you want more waypoints, you can add them using the same technique. Just add them in a chain one after the other.
@little raptor So is the extractionzone where it will go or?
yeah. just a position
I explained
You can just use some objects with enableSimulation false
I just have a invisible helipad with the enablesimulation false
that works too
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
This one is old but works for beginners
https://www.armaholic.com/page.php?id=20465
do I need to add the waypoint script to the object itself or?
Just put it at the end of land.sqf like I showed you above
the invisible helipad
Never put _ at the beginning of variables if they're global
ah
Name it: helperObject1
_WP = (group MY_HELI) addWaypoint [getPosASL helperObject1, -1];
what
i mean whats the error
Which script gives you that error? None of them run at startup
what did you change it to?
helpedobject1
- helperObject1
- It still doesnt explain the error
lemme dm u
ill send u screenshot
oh yeah
i had actually misspelled the thin
wait
error message is no more
When I script a spawned squad to board a player vehicle/aircraft, they get it but then immediately get out. How to I get them to stay in?
how do you tell them to get in?
I have them get in using:
S1W1 = Squad1 addWaypoint [_Pickup1, 1];
S1W1 synchronizeWaypoint [Raven1P];
S1W1 setWaypointType "GETIN";
do you add any other waypoints after that?
I've tried both. Added additional waypoint or left blank for later trigger.
if they have any additional waypoints, they'll get out to continue to that waypoint (unless they can drive the vehicle)
I see. So should I delete the waypoint at the end?
the get in one?
Yes. Like:
S1W1 = Squad1 addWaypoint [_Pickup1, 1];
S1W1 synchronizeWaypoint [Raven1P];
S1W1 setWaypointType "GETIN";
deletewaypoint [S1W1];
apart from what you wrote being wrong (deletewaypoint S1W1) I don't think it's necessary. It should delete automatically
Thanks. I'll try to make it a simple as possible with no additional waypoints for the group or player and see is they still get out. I appreciate the help and responses.
@minor tulip If they still do, you can try:
https://community.bistudio.com/wiki/setWaypointStatements
And add the other waypoints using a script
That is interesting. Thanks!
You can also create a manual get in order using that (put a waypoint near the vehicle, then have them mount it using a script)
I ended up with one script for the spawn and loading of the AI squad. A trigger that detects the player and squad in the aircraft with a deactivation script to assign new waypoint to GETOUT for the AI. Work ok so far. Maybe not the best approach but it works.
Thanks again @little raptor .
np
Question, did any one get lip files working with say3d? So far I have generated them and they are right next to the ogg files, same name except the file extension.
however them lips ain't moving
yup, I believe it has been broken somewhere during Arma 3's lifetime
I believe .lib files only work with KBTell.
Only thing that you can use with say/say2D/``say3D` is ```sqf
unit setRandomLip true;
any idea why
backpackcontainer player setObjectTextureglobal [0, ""];```
no longer works, but
```sqf
backpackcontainer player setObjectTexture [0, ""];```
does work, but it only to the player it is executed on.
was fine before update
They probably broke it. Report it
@unique sundial ^ ?
@trail wedge what u trying? reset to default?
u sure that worked before?
Yes
re lip files, man i really wanted to avoid setRandomLip...
@still forum Yep it worked for ages before update, backpacks for police and nhs were invisible for immersion on our altis life server 😄
use kbTell… sadly the "less" trouble (@digital jacinth)
@ionic anchor immersion?! You can still see the shadow!
negative 🤨
(i also am using say3d return value, so kbtell is a nono) oh well
funny lip movement it is
@little raptor it hides the shadow as well (just tested)
We clearly play different games! :)
https://cdn.discordapp.com/attachments/329978448938532868/766379492074979388/20201015224804_1.jpg
@unique sundial ^ ?
@still forum its supposed to make things invisible
indeed 🤷♂️
Maybe yours doesn't have any shadow lod
it's a vanilla one and yes, it casts a shadow on the ground.
I'm using the carryall backpack MTP
either way, global is broken now for invisible
yeah that one looks fine for me too
because “” is not a texture so it can’t find it since we forced it to look for textures properly to avoid missing texture errors in mp. Easy to replace “”. with transparent procedural texture , can do this directly inside command as special case
That's reasonable
Is there a pre-existing transparent procedural texture?
procedural textures can be generated by yourself
oic
@unique sundial He's right. 🤷♂️
i'm never right, let me look further.... 😆
even a basic backpackcontainer player setObjectTextureglobal [0, "#(rgb,1,1,1)color(1,1,1,0)"]; (or even 0,0,0,0) just do black the alpha attribute does not apply
tried rgba argb?
well I believe because the backpack will not be (semi-)transparent
so set texture "" is an exception for "don't show this texture"
this latest update caused this issue, the problem is applied tosetObjectTextureGlobal, it works fine in setObjectTexture
Just create an empty png and be done with it!
png works local, not global
20:49:34 Warning Message: Cannot load texture mpmissions\__cur_mp.altis\rr_textures\misc\backpack.png.```
I meant paa. Create an empty png and convert it to paa. I thought that's self explanatory
but not png
yeah thats the first thing i tried this afternoon, still turns black
ill give it another try
What are the proper setting to implement escape-like spawning?
I can't seem to be able to move the respawn marker
that or getMarkerPos is broken (or there's some context that I don't know of)
based on the script presented on this page: http://killzonekid.com/arma-scripting-tutorials-forced-ragdoll/
why does this not work?
my_unit = cursorObject;
if (player distance my_unit > 2) exitWith {};
private "_rag";
_rag = "Land_Can_V3_F" createVehicle [0,0,0];
_rag setMass 1e10;
_rag attachTo [my_unit, [0,0,0], "Spine3"];
_rag setVelocity [0,0,6];
my_unit allowDamage false;
detach _rag;
0 = _rag spawn {
deleteVehicle _this;
my_unit allowDamage true;
};
because it's attached
attached objects attain the same velocity and position as the "attachee"
setUnconscious true/false triggers a ragdoll
oh! but it works on player... will try setUnconcious
.png -> paa still black
@winter rose The unit immediately switches back to the animation tho
maybe give it half a second then
Still, not a true "ragdoll"
I mean, when you get hit, the unit stays down for a couple of seconds.
_groupPos = [[spawn_area], ["water"]] call BIS_fnc_randomPos;
{
_x setPos ([_groupPos, 0, 10, 1, 0, 0.5, 0, nil, [_groupPos, _groupPos]] call BIS_fnc_findSafePos);
_x setDir (random 360);
} forEach (units survivors);
"respawn_west" setMarkerPos _groupPos;
null = [] spawn
{
_count = 0;
_pos = getMarkerPos "respawn_west";
{
_pos = _pos vectorAdd (getPos _x);
_count = _count + 1;
} forEach (units survivors);
if (_count isEqualTo 0) then
{
_count = 1;
};
_pos = _pos vectorMultiply ( 1 / _count);
_pos deleteAt 2;
"respawn_west" setMarkerPos _pos;
sleep 10;
};
hmm, I believe it used to last longer than the set sleep time though 🤔 did the behaviour change now…
Any idea why this results in spawning in the ocean?
It's defined in initServer.sqf
marker with variable name respawn_west of course exists
did you check the value of _groupPos ?
Yeah that works just fine
No I want to calculate the average position
the average should start from [0,0,0]
what are you trying to achieve?
A respawn point that follows the squad
and why did you add a sleep at the end?
God damn it, beautiful arithmetic error 😄
@little raptor so that it's not consuming CPU all the time
A respawn point that follows the squad
What do you mean follow?
@little raptor literally that? A respawn point that follows the squad around
God damn it, beautiful arithmetic error 😄
SO fixed now?
so that it's not consuming CPU all the time
It's at the end of your script. You're making it last for no reason
@little raptor ... it's spawn
so?
You think that's the only thing I have running?
It's pointless anyway. Spawn doesn't run all the time
It terminates after 3ms
The sooner it gets done the better
eh
I'm not sure whatcha mean but spawn runs as long as it does
If you mean there's a maximum time to yield that's a different thing
keeping a spawned code in the scheduler only because "you don't want it to consume CPU" is wrong. If it's not "heavy" get it over with.
wat
did you even measure its performance?
Ah lol I'm missing the fucking while loop
@amber lantern Also, if you're trying to add "weight" to your average the first position must have a weight too
_count = 0;
You're starting at 0 weight
_count = 1;
You didn't read further :3
Anycase, here's the shit as it probably should
null = [] spawn
{
while {true} do
{
_count = 0;
_pos = [0, 0, 0];
{
_pos = _pos vectorAdd (getPos _x);
_count = _count + 1;
} forEach (units survivors);
if (_count isEqualTo 0) then
{
_pos = getMarkerPos "respawn_west";
_count = 1;
};
_pos = _pos vectorMultiply ( 1 / _count);
"respawn_west" setMarkerPos _pos;
sleep 1;
};
};
You didn't read further :3
that's what I said in the first place
hmm, and apparently [leader this, getPos (leader this), 100] call BIS_fnc_taskPatrol; doesn't work with dynamically simulated enemies/groups?
or is it super important to place the code into the group leader instead of into the group?
Is it possible to find a marker that a player placed? For example, I would like a player to put down a marker with specific description and have a script use it for a waypoint.
try allMapMarkers, user-defined ones start with a _USER_DEFINED
Thanks. I'll give it a go.
allMapMarkers*, edited.
https://community.bistudio.com/wiki/allMapMarkers @minor tulip
why do some mods have stuff like z\ and x\ as prefixes in their includes?
ah I just suck
Hmm my vehicles aren't moving
Waaait
is there a simulation limit?
@solid raptor a byproduct of setting up with filepatching from the work folder in mind
ace/acre/mmfw/etc all use a prefix folder and a link to point to the work folder of say a github directory so built pbos can point to the loose files within the same dir
https://ace3mod.com/wiki/development/setting-up-the-development-environment.html If you are interested
Arma2OA, me host and player MP. After respawning, a function is not able to get the correct value for a variable with getVariable. It only appears to be able to get the value of that variable from before I respawned, even if it has since been set to a different value. The function is called by a player from a radio trigger.
@drifting sky This is pure speculation, but is the variable set on the player that respawns? It might be something like you're accessing the variable on the old unit, but setting the variable on the new unit.
Unfortunately, A2 was before I got into Arma scripting, so can't offer much more of a suggestion than that!
@trail wedge We are going to allow "" again, but I have a question for you, why dont you use hideobject/hideobjectglobal with backpack to hide it? Looks like it works fine
You can use the same “” method to hide parts of a vehicle or clothing with multiple hiddenSelections
why do some mods have stuff like z\ and x\ as prefixes in their includes?
@solid raptor
Just a standard that was devised more than a dozen years ago.
Arma has a3/
Not really about filepatching
And why lots of classes in the game config end with _F ?
F- Futura - internal name for Arma 3
Huh, nifty
Hm, any chance anyone knows how I can figure out the names of the standard main menu spotlight tiles?
As in the ones that are added by the game/dlcs
I would assume you could find them in the config of "RscDisplayMain" >> "controls" >> "InfoDLCs"
Ah I found it under "CfgMainMenuSpotlight", thank you @dusk gust 

How about to delete them?
Also probably you're looking for #arma3_config
Ooh yeah true
Condition = "false"
I have problems with addPublicVariableEventHandler. Anyone here that could help me catch that last pesky bit in a player initiated respawn? Posted in the forums https://forums.bohemia.net/forums/topic/231207-help-with-player-initiated-respawn-mp-dedi/
@trail wedge We are going to allow "" again, but I have a question for you, why dont you use hideobject/hideobjectglobal with backpack to hide it? Looks like it works fine
@unique sundial many servers will really appreciate this, and as someone else stated, it is used In more places than just a backpack. I will test that method out though.
@tight narwhal where is your publicvariableserver
i see the eventhandler but not the trigger
or publicvariableclient
I don't have one, so I guess thats's my problem. On the wiki now, but the description is a bit sparse. How and where should this be used?
trying to write a push script, a sort of melee action. staggers target with a small chance of ragdolling. been trying to setvelocity on ragdoll (should fall away from player pos) but i can't get any effect out of it.
both by direct call to setvelocity on target after setUnconscious and creating object, attaching it to target and set ITS velocity (and mass)
@proper sail To my understanding the servers missionNamespace setVariable ["playertorespawn", _name, true];will make the variable public for the client's addPublicVariableEventHandler to catch?
unsure
i forgot
try manually to see if it fires with publicvariable(client/server)
also as its a3, isnt that depreceated anyway and shouldnt you use remotexec
im only familiar with a2
Does anyone know how to make an invisible unit that can still be shot? Until the latest patch I was using _spook setObjectTextureGlobal[0,""];
@whole light same, but with remoteExec and setObjectTexture
doesn't setObjectTextureGlobal do that for you?
So the problem is in the empty String, not the command itself?
I'm asking because I tend to rely on global commands when they exist instead of calling a global remoteExec
the problem is in the command's behaviour change
to hide a backpack, you can still use hideObjectGlobal
@winter rose God bless you man, I was tearing my hair out. Thank you. I'm about to release and suddenly things stopped working.
@whole light There are also invisible men in Arma: VirtualMan_F
I'm attempting to create a dynamically updating scoreboard that would show up in-game on a billboard or something similar. I have a web backend that generates an image of the scoreboard, is there any way to have that displayed in-game? I was able to use the Example 3 in htmlLoad biki page to show a fullscreen webpage but I'd prefer it to be visible for all players in the 3D world. I don't have much experience in working with custom displays, would somehow be possible to make that into a texture on a billboard? Alternatively, I would be able to place the image file on the root of the arma server and load it from there, but I wasn't able to figure out a way to transfer the texture from the server to the clients. TL;DR: I'd like to show a dynamic image from the internet on a billboard, is that possible?
@little raptor If they are using the invisible uniform, unfortunately they can't be shot or otherwise damaged. The empty textures method allows them to still take damage.
Right. Didn't realize that
Would anyone be able to tell me how to write a script that would hide roads? I about the nearestTerrainObjects command, but I can figure out how to script it so it only hides roads.
well, how do you call it?
nearRoads?
[worldSize/2,worldSize/2] nearRoads worldSize/2 apply {_x hideObject true}
This probably only works with bridges
may I have a little help formatting this,
_buildingARR = [_buildingARR, [], {_x distance _centre}, "ASCEND",{ (count _x buildingPos)>2 }] call BIS_fnc_sortBy;
_buildingARR is an array of nearby buildings. I want to filter out buildings with no building position and sort by nearest. Any ideas?
_buildingARR = [_buildingARR, [], {_x distance _centre}, "ASCEND",{count (_x buildingPos -1) == 0}] call BIS_fnc_sortBy;
You mean you want to exclude buildings with no pos? The above includes them.
If so:
_buildingARR = [_buildingARR, [], {_x distance _centre}, "ASCEND",{count (_x buildingPos -1) > 0}] call BIS_fnc_sortBy;
right, so I'm left with an array of nearby buildings with available building positions
Use the second one
thanks so much!
Yes, how do you call it. I’ll try your script @little raptor. Thank you.
Okay will do. Much appreciated!
Hello i have question for delete word in the string, I have look compile or split string but that does not solve my problem
_tomate = "sauce ketchup mayonaise";```
and i want to delete just ketchup
https://forums.bohemia.net/forums/topic/216673-quick-stringreplace/ @grizzled lagoon
another one by Terra
https://forums.bohemia.net/forums/topic/203623-function-replace-string/
splitString deleteRange joinString or toArray deleteRange toString or select + select
thanks @winter rose
Thanks @unique sundial but for my script i want delete name player in public variable and is not position is name
you can find in string (but a replace command would be nice 😛 *hint, hint*)
did addAction get changed after 2.0? Or ever had issues working with default mission objects?
seems to be working flawlessly with spawned in objects via createVehicle/createVehicleLocal tho.
I don't think so, why?
I'm trying to use an addAction on a default mission object, doesn't seem to work at all. Then I tried using createVehicle/createVehicleLocal with the same object classname and it worked perfectly.
even when I return the cursorObject on the default mission object, it returned the same classname I was wanting? so idk
default mission object
terrain object? editor object?
terrain
maybe that one is a simpleObject? IDK
returns false for isSimpleObject tho hmmm
@robust brook if typeOf cursorObject returns "" you cannot add an action.
It doesn't, but I already found the issue, thanks for your help. 🙂
(coding issue?)
side check 🤦♂️
🔨😄
How to add the menu which provides to the player: Virtual Arsenal, Repair vehicle, rearm, refuel, etc ?
Depending on what kind of "menu" you want, you can use:
https://community.bistudio.com/wiki/showCommandingMenu
https://community.bistudio.com/wiki/addAction
https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd
Where must I add them ? @little raptor
Any way to reliably detect player changing his view from 1st_person to 3rd_person?
possibly this
findDisplay 46 displayAddEventHandler ["KeyDown",{
if (_this#1 in actionKeys "personView") then {
// view changed
};
}]
And what if tricky player maps the 3rd_person key to a mouse?
i guess you could use a loop.
That's definitely a bulletproof solution, but I was hoping for something more elegant
i thought there was an event for changing view but i cant seem to find anything 🤷
@tough abyss ty. I found it. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#PlayerViewChanged
Anyone know if isNotEqualTo made it into 2.00?
it did not
https://community.bistudio.com/wiki/isNotEqualTo
hover over the dev branch icon and it says which version it was introduced in (2.01 in this case)
@quartz pebble you can try using inputAction instead inside onkeydown and onmousedown ehs
hello i want to add a jump function to my server so i can jump when i press space does someone have a good script for this?
I once wrote something for fun. But you shouldn't use it as it is. It is just something to help you get started.
Call this in the debug console:
initV = (velocity player select [0,2]) + [0];
onEachFrame {
if !(isTouchingGround player) exitWith {
onEachFrame {
if (isTouchingGround player || velocity player select 2 <= 0) exitWith {
onEachFrame "";
player setVelocity ( velocity player vectorDiff [0,0,0.5]);
player playMoveNow "amovpercmstpsraswrfldnon"
};
}
};
player setVelocity (initV vectorAdd [0,0,5.5]);
};
player switchMove "afalpknlmstpsraswrfldnon";
@unique sundial new command “getAllUnitTraits”
@tough abyss @still forum <----
@unique sundial I could not make inputAction work with mouse. I.e. if someone binds an action to RMB, then inputAction always returns 0 when RMB pressed.
it was personView
ok thx
If I want to receive a control (combobox) in param, by what should I replace ""
params [
["_comboboxTexture", "", [""]]
];
is there a type for controls?
typeName controlNull
Thank you.
Hello everyone, how to add a menu which provides to the player: Virtual Arsenal, Repair vehicle, rearm, refuel, etc ?
@minor elbow https://community.bistudio.com/wiki/addAction
- Add a Virtual Arsenal: https://community.bistudio.com/wiki/Arma_3_Arsenal#Modding
- Repair Vehicle: https://community.bistudio.com/wiki/setDamage
- Rearm: https://community.bistudio.com/wiki/setVehicleAmmoDef
- Refuel: https://community.bistudio.com/wiki/setFuel
- etc: etc
oh
Thanks a lot but where do I add these codes ?
Do you even know any SQF?
Nop
So how do you hope to use them anyway?
What you ask for requires writing code in sqf. Without knowing any sqf, you can't do it.
Anyway, you can use addAction and add it to the player:
https://community.bistudio.com/wiki/addAction.
https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd
You write the action code and put it in the player's init box.
You can create commanding menus. And add a keybinding to open it:
https://community.bistudio.com/wiki/showCommandingMenu
https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onKeyDown
And for the repair, etc. codes, see Terra's reply.
Thanks a lot, I'll learn that
@tough abyss is there a command to get the value of a custom trait?
can you show example of getAllUnitTraits output how it looks like when your value is missing?
@still forum Custom traits are broken anyway.
example:
player setUnitTrait ["Trait", 1, true];
player getUnitTrait "Trait"; //-> Returns: true
getAllUnitTraits player //-> contains ["Trait", "Custom"]
player setUnitTrait ["Trait", true, true];
player getUnitTrait "Trait"; //-> Returns: true
getAllUnitTraits player //-> contains ["Trait", "Custom"]
player setUnitTrait ["Trait", false, true];
player getUnitTrait "Trait"; //-> Returns: false
getAllUnitTraits player //-> Misses "Trait"
Yeah I'm pretty sure they are only stored as "set"/"not-set"
and don't actually have any value
https://community.bistudio.com/wiki/setUnitTrait
I mean.. I should already know some people are unable to read.
Oh my god I am losing my mind. Does rscTitles not work with Ace?
But somehow i still have faith in people it seems. I should stop that
Yeah. You can always use setVariable to have real "custom traits" .
But I think if it returned true instead of "custom" it would be better.
how do you differentiate from bool traits that are not custom then
and now is a bit late for that
Aren't they (vanilla ones) always constant? Every time I test I get:
getAllUnitTraits player apply {_x#0};
//gives:
["Medic","Engineer","ExplosiveSpecialist","UavHacker","CamouflageCoef","AudibleCoef","LoadCoef"+custom traits]
So the first 7 ones are vanilla. In that exact order.
anyway, I don't use them so it doesn't matter to me either way.
Does RV game loop update physics of objects at fixed or varied time step?
Just wondering
Hey! Why does this script complain about the last then ("No syntax for 'VARIABLE then'" error)? (NOTE: Arma 2: OA v1.64)
private ["_unit","_weapon","_rocket","_ammo","_missile","_currentMag","_ammoCount"];
_unit = _this select 0;
_weapon = currentWeapon _unit;
_muzzle = currentMuzzle (gunner (vehicle _unit));
_ammo = _this select 4;
_rocket = nearestObject [_unit,_ammo];
if (isNull _rocket || ({isPlayer _x} count (crew _unit) == 0)) exitwith {};
_missile = ["M_AT5_AT","M_AT13_AT","M_TOW_AT","M_TOW2_AT"];
if (!(_ammo in _missile)) exitWith {};
_unitStartZDeg = atan ((vectorDir _unit) select 2);
_rocketStartZDegDiff = ((atan ((vectorDir _rocket) select 2)) - _unitStartZDeg);
_rocketZDegDiffMax = -500;
if (_rocketStartZDegDiff > 25) then {
while {!isNull _rocket} do {
sleep 0.1;
_currentRocketZDeg = atan ((vectorDir _rocket) select 2);
_currentRocketZDegDiff = _rocketStartZDegDiff - (_currentRocketZDeg - _unitStartZDeg);
if (_currentRocketZDegDiff > _rocketZDegDiffMax) then {
_rocketZDegDiffMax = _currentRocketZDegDiff;
};
};
if (_rocketZDegDiffMax > 25) then {
["WARNING", Format["Player with UID [%1] was detected to be possibly missile glitching. (Max angle difference in [Z,(X,Y)] plane: [%2°]", srt (getPlayerUID _unit), _rocketZDegDiffMax]] Call WFBE_CO_FNC_LogContent;
};
};
dunno about any issues with then, but i do notice in that scope you have srt instead of str
I'm using the IntelliJ IDEA SQF plugin, so it might be the syntax checker itself that's faulty
@robust hollow Oh ffs lol! It fixed the issue 😄
Thanks!
Sometimes the dumbest things make stuff crash 
such as?
…the user 😄
Lol
Not necessarily related to scripting but this looks like the most relevant channel. But anyway i am in need of a developer to help me start my arma 3 server/altis life i think. can anyone help me?
Hello, I am currently working on a simple mission that spawns the enemys when you are close to the area. This is the code i have https://pastebin.pl/view/07498808 works in SP but not on my dedicated server. Also i am not a star at scripting so i dont know what the problem is, i think its to do with the waitUntil {player distance area1 < 1000};
Can somone see the issue here?
@latent crystal I think that's more: #creators_recruiting
@warm hemlock Why don't you simply use triggers?
The issue is what you said. Player is not defined on a dedicated server
I would need to place down a lot of tiggers, wanted to try it this way
How would i define it so that when any player gets close it will activate
I would need to place down a lot of tiggers,
There's only one area (?!)
I still recommend triggers.
But if you insist:
waitUntil {allPlayers findIf {_x distance area1 < 1000} != -1};
Unless your players can move at 500~1000 m/s (1800 - 3600 km/h!), you're wasting way too much performance there. I recommend that you add delay to the code:
waitUntil {
sleep 1;
allPlayers findIf {_x distance area1 < 1000} != -1
};
The area is big enough for that sleep number.
Okey, check it out. Thank you!
@warm hemlock the same thing goes for the loop at the end
Use an event handler or something. You don't need loops to know when a unit is dead
The wonderful thing about tiggers, is tiggers are wonderful things
Yes, I'm a father of young children
I know i would normaly use triggers, but for this i wanted to try it this way
@warm hemlock You know you can create triggers dynamically right? You don't have to place them down in the editor
I did not
You can do everything you do in the editor with these scripting commands, and even more
Cool, ill us this then
Is it possible to check if a rope is tight or if it has slack?
You can still ask her?
Seems what I can do is check if the ropeLength minus the distance from the end positions is greater then some threshold
Haha
Hi, i using "player setPos (getMarkerPos "tele_1");" for teleport in trigger zone but i need teleport all people from blufor after some one step in trigger zone how to change it this code ? thanks.
Loop over all players, and TP them one by one
eh in this trigger zone is more events like skipTime ..
Does deleteGroup count toward reducing the total group count for a faction? It seems my groups stop respawning after a while, even when deleting the empty groups.
yes it does
Actually, reading the wiki suggests I may have been making the error of trying to delete the group before dead units had been removed from it.
I presume that means that units group_name must have a count of zero
and that there aren't any other requirements, such as assigned vehicles.
you can set groups to delete once they are empty
Is there a way to reduce the knowsAbout value ?
Sorry, I'm in Arma2OA
oh
I am thinking about something like ```sqf
_unit reveal [player, 0];
yea just wait for count units group == 0 then
alright, thanks
Hi! I was wondering if there was a way that I can have a trigger loop through and turn on and off a red light until someone steps out of the trigger area. I Googled it and I couldn't really find too much. I would also want to make sure that every player can see the light changing and that it's not just client side. How would I go about this? Thanks!
Is it somehow possible to retrieve vehicleClass info of an object? For example the vehicleClass of a vest (that should be "ItemsVests")
typeOf
Thanks KK. I was already playing with typeOf but guess I'm just using it the wrong way in my case. And the wrong way in this case is that I'm using it to compare to a string and yeah, the game already told me that🥲
@forest ore BIS_fnc_returnParents ?
Hi all, is it any way to rotate an object created with the "createSimpleObject" command?
@winter rose Was looking a way to pull information from object configs. While there are ways it occurred slowly to me that it's difficult to pull info that isn't there to begin with
@light badge setDir?
ah yes, for the type of "item" (vest/helmet/accessory/etc) you have to check other values in the class @forest ore
@winter rose great, ll tru later
Lou, indeedly seems to be so. Going to have to find another approach to do the comparing I'm looking to do
which is?
Complicated? ☺️ (as per usual)
Maybe if you explained what you're trying to do you could get more help. Maybe you want something extremely simple and you're just making it harder for yourself because you don't know where to look.
Is there any good tutorial how to write custom editor modules?
not really, because a module can really be whatever you want it to be!
I mean for the internals, how to setup simple module to just print hello world on load for all synced units for example.
if you want to create a module, you have to know scripting
only then can you check module functions to see how to organise your code
Creating the module object itself (what is shown in editor) is easy tho
I was looking at https://community.bistudio.com/wiki/Modules.
But I'm not sure if I need to make it addon, is it possible to create it in mission only first (for faster development)?
Describe module in description.ext for example.
A module is essentially an object that executes its predefined codes when placed down
why make it a module, if you can script it for the mission?
So for "testing" you just need to make a function that works
sure, that's what I can prepare
But I would like to get some insight how the synced objects are passed in modulized version.
for example
synchronizedObjects _module?
ahh, so it is not passed anywhere, you need to get it like that
👍
Anyway any idea if you can use mission description.ext to define module or do you need to make addon with config.cpp?
addon mandatory
I'm not sure, but I don't think so. If you're using the dev build, they have introduced an import function that allows you to modify the config. But I'm not sure if it's compatible with cfgVehicles.
what do you think Lou?
Looking at https://community.bistudio.com/wiki/import. I can test in few minutes.
that import seems javascriptish/pythonish 😮
what do you think Lou?
I think thatCfgModulesis not listed in https://community.bistudio.com/wiki/Description.ext and you cannot create vehicle classes on the fly with it either, so no dice
is CfgModules a thing?!
might actually not be 😄
I couldn't find anything on it! Not even in the game config!
as for if import works for CfgVehicles, yes (with from)
see https://community.bistudio.com/wiki/import
I mean does the vehicle "register"? As in can you actually create it?
Actually the reason I'm trying to go without addon for now is code reloading.
But as I see it could be not problem if you have proper setup. 🤔
code reloading
?
you can import, but you cannot create a new vehicle class in description.ext no
hmm. What I thought
Once I change some sqf file in addon I would like to prevent repacking pbo and restarting game.
@sleek sail mission scope = function (CfgFunctions)
^
an addon is a dependency for clients that then have to download it, you have to update it etc
just clutter, when everything could be compacted into one pbo, the mission one
That's ok actually. We do have custom addon for our missions already.
Also, if you're not trying to create something for someone else (as in a mission creator, like ALIVE), don't use modules. Just use normal code
modules are for easy Eden usage, but are heavier than just functions
they create a Logic entity, etc
I think for my purpose I can actually create empty markers and sync them together. That could be possible as well.
You could develop your sqf code against arbitrary dummy module values (some hardcoded position instead of module position for example) until your code works and then introduce the actual module after that.
Later I can pack it as an addon modulized.
what are you trying to do, if you don't mind me asking?
I'm from Warfare RE community, my plan is to rebuild a simple CTI using as much as possible from modules in game.
I was looking at Warlords modules.
params [
["_markers", [], [[]]]
];
if !(_markers isEqualTypeAll "") exitWith { ["Arguments must be marker names"] call BIS_fnc_error };
// code
``````sqf
// calling
[["marker1", "marker2", "marker3"]] call RET_fnc_myFunction;
you can make the function first, and make the module use it then
yup, I'll do that, thanks for the insight
we didn't know from outside if your goal was to create a module set or if it was a way to reach your goal ^_^
My goal is to make it possible for non-scripting guys to create another map layout easily later. They usually add a lot of objects (bunkers, outposts, ...) to map to make it more immersive regarding our theme on the map.
My idea was to introduce main game logic module and "sub-modules" synced to main module for fighting sectors (cities) with ability to select (for example) resistance strength (infantry only or light vehicles, tanks, helis) from module custom options (dropdown).
But yeah, I can start with markers and passing options as a parameters to executed functions onInit for example.
That's how we do it right now actually. It is probably still too soon to make it modules.
Hi, I have in a dialog class :
onLBSelChanged = "[_this] call test_onLbSelChanged;";
and in my function
params ["_control", "_selectedIndex"]; //according to wiki
diag_log format ["index [%1]", _selectedIndex];
But _selectedIndex is undefined ?
Am I supposed to add an event handler on the ctrl to use these variables ?
@compact maple ```sqf
onLBSelChanged = "call test_onLbSelChanged;";
or ```sqf
onLBSelChanged = "_this call test_onLbSelChanged;";
This one is redundant tho
you're putting the params (aka _this) in an array
also, when not sure, log _this too
You could've figured it out if you simply tried:
diag_log str _this;
Is it possible to get a list of all folders in the missions folder? (similar to the dialog that opens when you want to open/save the mission)
I just want to see the folders that the game sees there! aka mission folders

file access is impossible without extensions unfortunately
Have they changed the unscheduled environment error handling?
To my surprise I don't get an error with:
waitUntil {true}
in debug console (?!)
Basically, if the condition is satisfied immediately, it doesn't throw an error.
Like
waitUntil {time > 0}
Was it like this before?
Basically, if the condition is satisfied immediately, it doesn't throw an error.
I think I've read somewhere a long time before that waituntil works like this in unscheduled
Huh. I always thought that the game will freak out as soon as it sees waitUntil in unscheduled environment!
Where do I put function suggestions
I would enjoy an infantry version of addWeaponWithAttachmentsCargoGlobal - perhaps addWeaponWithAttachments 😄
@torn juniper You can do that with several already existing commands, unlike addWeaponWithAttachmentsCargoGlobal which wasn't possible before its introduction (without insane bs)
@meager granite just for a cleaner implementation is all, my main trouble is adding in specific ammo count to a weapon.. if they already have that type in their inventory it will use the other mags first when adding a weapon
Reworking my mod with updated commands does help with removing a lot of duping methods it caused though lol
Yes
But if you add the weapon first, it takes inventory ammo
So you lose a mag since on fail it doesn’t add to inventory
(Fail being ammo already there)
I currently do a check to see if the weapon has a current mag then add it in inv if so, weapon if not
I am going to try this command to see if it accepts array/ammo count like addWeaponItem does : https://community.bistudio.com/wiki/addPrimaryWeaponItem I wont get my hopes up but at least there it returns false if it fails 😛
Btw, you can use trickery we had to use before addWeaponWithAttachmentsCargoGlobal
But the other way
Have some local container somewhere, create weapon there, then do TakeWeapon action
Alternatively use some existing uniform\vest\backpack container
Though if is already such a weapon there it might take wrong one
Downside is that player plays "take" animation
but maybe you can break\prevent it with some another trickery
(Before that command we had to spawn AI that was creating a weapon with needed attachments and magazines and then DropWeapon it into needed container lol)
Oof
Yea I see what you mean
I was leaning towards using setplayerloadout
Read in current inventory and just replace it as a whole
Hopefully there isn’t much shock change with setting a new loadout, but I will test it a bit
Plus that way it stays in the same format as addweaponw/attachment to cargo
My whole mod is a hack of how arma works, one other thing wont hurt
Was it like this before?
@little raptor was always this way
hey guys, how do i make this work on MP server for every client?
_aiai = [a1,a2,a3,a4,a5]
for "_i" from 0 to (count _aiai - 1) do {
_this = _aiai select _i;
_this playAction "Salute";
};
sp1 Say3D ["lagunegaraku",350];
sp2 Say3D ["lagunegaraku",350];
sp3 Say3D ["lagunegaraku",350];
sp4 Say3D ["lagunegaraku",350];
It is executed by addAction. Problem is the say3D only run on the client that click on it and not for every client.
And the salute doesnt happen on dedicated server but is okay on 3den's mp
Execute say3D globally
Execute playAction on the appropriate target machine
These commands are the exact opposite of each other (in terms of locality)
You can check a command's local/global effect via this button on the wiki page for the command: https://image.prntscr.com/image/XvzRNC33TcafH-S221cNFw.png
For me say3d is global even without remoteexec 
It can't be
nvm it was playsound3D
thanks guys i got the say3D remoteExec thing but executing playAction for every player? i need to loop every player?
_allPlayers = call BIS_fnc_listPlayers;
{
for "_i" from 0 to (count _aiai - 1) do {
_this = _aiai select _i;
_this playAction "saluteOff";
};
} forEach _allPlayers;
this does not work either
playAction needs to execute on the machine where the unit is local.
for "_i" from 0 to (count _aiai - 1) do {
_this = _aiai select _i;
[_this,"saluteOff"] remoteExec ["playAction",_this];
};
ohhh so target it using remoteExec, cool. thanks again
Is there a way to make a attach item follow the drawer animations in the rugged desk?
I noticed if I just do the usual attachto, it just stays in it's specific spot even if animations played
what is the most efficient workflow for playing around with custom scripting on a dedicated-server? It seems there's gotta be something better than make change -> export -> upload .pbo -> restart server -> join -> fail -> redo..I'm pretty new with doing this on a server so sorry if its a super simple question
depends on what you're doing exactly.
if you use a local dedicated server for testing you don't need to upload the pbo, just move it to the server mpmissions folder.
if you dev with filepatching enabled you only need to recompile functions instead of repacking the pbo and starting the mission again.
or alternatively you can use debug console to execute changed code until you have it right.
I'm working on a remote server, it seems like the best option would be to setup a local dev environment and work there, but to be honest I don't know much about filepatching
@tough abyss utils 5
Huh. I always thought that the game will freak out as soon as it sees
waitUntilin unscheduled environment!
@little raptor
The game freaks out when you try to suspend in a non-suspendable environment. You are skipping the suspend here, thus no error.
@still forum Yeah. I realized that after seeing it throws no error. I always thought that the suspension part occurs before the condition. So waitUntil {condition} is essentially the exact equivalent of this, right?
while {!condition} do {uiSleep 0.001};
i guess so yeah
I'd imagine the force to be in newtons
Yep
Could someone check, if https://community.bistudio.com/wiki/getAllHitPointsDamage updates on a Dedicated Server? 🤔
how do I make an AI to continue following waypoints after stop/doStop/commandStop etc ?
commandFollow or doFollow I believe
its syntax is unitName doFollow unitName2 so I don't believe this is it
Also is used to resume unit formation after doStop, just doFollow leader even if it is the leader himself you want to resume (see Example 2).
Players who want to connect to the server cannot connect to the server due to the missing mode and they get this error. http://prntscr.com/v2erc5 Is there a script that notifies the player when the mod is missing? A custom missing mod warning script that will appear instead of the error in the photo ?
no
For example: You have the missing mod. Please try again by adding the @BreakingPointWeapons mod
yeah, but no ^^
because of file loading
you could do it by checking with configFile / isClass
You'd have to query the allowed mods on the server. There's no command for that
How often does dedicated server has language set to non-english actual local language? How does it work? Or is DS always english? i am wondering how good it is to localize strings server-side.
(or https://community.bistudio.com/wiki/allAddonsInfo @digital plover)
@winter rose
You'd have to query the allowed mods on the server. There's no command for that
not on the server, no
client-side only compared to a hardcoded list, yes
also, one can make a function to get server mods 🙂
Can you help me how to do this? @little raptor
I don't have much code knowledge.
If you show an example I can edit it for myself
also, one can make a function to get server mods 🙂
How? @winter rose
I don't know myself. Lou is the one who said it's possible. I say it's not.
Does this code work for me?
https://community.bistudio.com/wiki/getLoadedModsInfo
_loadedMods = getLoadedModsInfo;
[
["CUP Units DEV Version r710 (r710-r710 UNITSSVN) (12|Jun|2020)","@[DEV] CUP Units",false,false,"GAME DIR","f3fb8a4c62443ac799c7c0e00f645b1f32cf1376","c96577b4","F:\Steam\SteamApps\common\Arma 3\!Workshop\@[DEV] CUP Units",0],
["CUP Weapons DEV Version r1486 (r1481-r1486 WEAPONSSVN) (12|Jun|2020)","@[DEV] CUP Weapons",false,false,"GAME DIR","6dbd7c052ce2ae68803e10f6a3653d0b046881d8","bb1c4965","F:\Steam\SteamApps\common\Arma 3\!Workshop\@[DEV] CUP Weapons",0],
["Community Base Addons v3.15.1","@CBA_A3",false,false,"GAME DIR","33eef5c0ed583d1222319460b184090513193287","131bbb64","F:\Steam\SteamApps\common\Arma 3\!Workshop\@CBA_A3",0],
["Arma 3 Contact (Platform)","enoch",true,true,"GAME DIR","a4ee0aa9675b9578de2c2742dfa75f14b463b311","2c003588","F:\Steam\SteamApps\common\Arma 3\enoch",1.02179e+006],
["Arma 3 Tanks","tank",true,true,"GAME DIR","f20f91e6d4de2f912c9aef10440b9f7cdd9186ba","ee2006c9","F:\Steam\SteamApps\common\Arma 3\tank",798390],
["Arma 3 Tac-Ops","tacops",true,true,"GAME DIR","e173f6dac22cbfba9a80f06ab6274f283a79ccf1","99fbe961","F:\Steam\SteamApps\common\Arma 3\tacops",744950],
["Arma 3 Laws of War","orange",true,true,"GAME DIR","483d1b17bba31a73aca3382baca90726e5fb3b27","85779468","F:\Steam\SteamApps\common\Arma 3\orange",571710]
]
@little raptor @digital plover
save the output of server-side allAddonsInfo in a global variable and publicVariable it, or use BIS_fnc_getServerVariable, or maybe many other ways
What about someone who's not connected to the server yet?
What do you mean by work in this context?
@little raptor I am only talking about someone that is connected; outside of the server, no can do (but parse the -addons server parameter)
well I think that's what he's asking (and what I mean by not possible)
then indeed - that's game-side, nothing scriptable
I thought it was about a sudden "this mod is required" in a mission that does not list its dependencies (e.g modded vehicle created with createVehicle)
And why would you want to know if you're missing mods if you're already connected?!
The server wouldn't let you join in the first place!
I am asking exactly this.I want to give a missing mode warning for someone who has never connected to the server
in a mission that does not list its dependencies (e.g modded vehicle created with createVehicle)
@little raptor
some servers are weirdly configured…
@digital plover anyway - join using the launcher, it will d/l the mods for you
from the server? I actually never tried that. I always join in-game
from Steam
what about non-Steam mods?
no cigar
for example:http://prntscr.com/v2f9oc
yeah, but no
If you want to change that message, you can simply remove the control and place a new control there!
If you want to change that message, you can simply remove the control and place a new control there!
I don't know the IDD of that display/IDC of that control tho
ok i will ask another question
runs away 😄
how @winter rose
by using your legs, one step after another?
sorry i misunderstood
I think you guys are both misunderstanding each other!
Ok last question. How can i change this screen ? http://prntscr.com/v2fei1
I don't know the IDD of that display/IDC of that control tho
If I did I would help you get rid of the message in the first place!
change the background? …with a mod 😄
long story short, find the IDD, replace the background image (a control) with another image
I wish I had more knowledgeable players 🙂
Most players trying to connect to my server try to login without downloading mods.
yeah well, if you need a mod to tell them to get a mod… you see the issue I suppose
They can see the list of mods in the server browser too!
Only 1 mod seehttp://prntscr.com/v2fhol
Why doesn't she list the other two mods here?(
scroll up?
not see
mods are always at the bottom afaik
But it should still show the mod. That's weird
Do I have to write special code into my server mode to show it here?
My Own Server Mod..
[_vehicle,(_vInfo select 8)] remoteExecCall ["colorVehicle",_unit];
[_vid,_pid,_vehicle,_unit] remoteExec ["spawnVehicleColor",2];
is it possible that the second line is finished before the first one end ?
I shortenen them because they are so long
it shouldnt ? but it is possible ?
The first line apply a texture to a vehicle, the second line apply custom color to the vehicle if the custom color exists.
It happens than the second line is executed before the first line end, so the texture override the custom color, Idk if I'm clear.
I have a question: Is it possible to change vehicleconfig values via script? Specifically the maxspeed variable, which (If my understanding is correct) only forces a maximum speed to the AI driving the vehicle?
no
see https://community.bistudio.com/wiki/forceSpeed to… well, you get it 😁
do yo uwant a speed limiter for players?
Not players
limitSpeed then?
I'm working on a "one man" tank, so i need to limit the AI crewman under the player's control
I think limitspeed should do the trick, thank you!
AI obeys limitSpeed
I'll tie that to to a bunch of actions with different speeds, should work as a "max speed" selector of sorts
Trying to set Dynamic Simulation on via script.
if (side _x == INDEPENDENT) then {
_x setskill ["aimingAccuracy",0.1];
_x setskill ["aimingShake",0.5];
_x setskill ["aimingSpeed",0.5];
_x setskill ["spotDistance",0.2];
_x setskill ["spotTime",0.2];
_x setskill ["courage",1.0];
_x setskill ["commanding",1.0];
_x setskill ["reloadSpeed",0.2];
_x allowFleeing 0;
_x enableDynamicSimulation true;
};```
Should that work, or do I have to get the group of _x and set it that way?
dynsim works on group level for units.
So then I'd need a couple extra lines to get the group and set it that way. As simple as
_xy = group _x;
_xy enableDynamicSimulation true;
``` I hope?
most likely yes
use allGroups if needed, faster than allUnits
Can I setskill on groups? If not, I think I need to stick with forEach allUnits;
you can setSkill forEach units _group
https://pastebin.com/HcXY8QUF is what I'm working with. Would it be as straightforward as changing the forEach there, or would I need to redo it a bit more than that?
{
_x enableDynamicSimulation true;
{
_x setSkill [....];
} forEach units _x;
} forEach allGroups;
What's the point of the sleep 10 at the end?
Even 10 is probably shorter than it needs to be, really.
I mean it's not even a loop or anything. (?!)
Is that a small part of the whole script?
Also:
if (side _x == _side) exitWith {...}
Why do you keep checking the side?
Of course, the more optimized version is to use call ([{...},{...},{...},{...}]#(_sides find _side)) , (with both arrays pre defined instead of making it like this) but meh
It's a script being called with execVM in the init script. The idea is to give the settings to any new AI that get spawned in later.
is there a reliable way to use handleDamage EH without manipulating damage at all? Alternatively, is there a more efficient MP friendly EH I can use that returns hitpoint, damage, and projectile data?
you can return a passed value in handleDamage to prevent overriding any normal behaviour
I was under the impression returning any numerical value would override normal behavior
yes - but if you return the provided damage value, no changes
return _damage and that's it
ah so if i simply return the _damage value it will apply as normal?
yep
gotcha
(dang, I have negative ping)
is there a better method than just exitwith?
exitWith doesn't really work properly in EH iirc
use if then else
hmm
exitWith inside handle damage body clousure will break the chain of handlers
and stop other handlers from execution
yeah def dont want that
wrap in call
I have two if statements evaluated and then the function is complete so ill probably just use else on the latter statement and return that
_object addEventHandler ["HandleDamage", {
call {
params ["_whatever"];
if (something) exitWith {123};
};
}];
just don't "exitWith" the handler scope and you will be fine.
so if my function is executed using spawn, can I still use call inside of that function?
yes, call is blocking spawn creates a new thread. But if you spawn the function inside the handler you will not be able to get the return value.
now that I'm looking at it, I should probably switch to call anyways, seems inefficient using spawn in conjunction with HandleDamage
ty for the quick assistance guys
@tough abyss don't ask to ask, just ask
well i am kind of brand new in scripting
sooooo....need help with the basics
of scripting
we have a wonderful "nexus" for that - see
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
ok im back with one more HandleDamage question
I managed to resolve my issue by simply returning _damage at the end of the function
but I want to make sure that wont interfere with other HandleDamage EHs (like ACE Medical specifically)
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
Notes:
Multiple "HandleDamage" event handlers can be added to the same unit. If multiple EHs return damage value for custom damage handling, only last returned value will be considered by the engine.
is there a way for me to prioritize ACE's HandleDamage over my own?
_HvT = player getVariable ["xpcash",0] >= 100000 && alive player;
if (_HvT) then
{
if (side player == playerSide) then {
_marker = createMarker [_markerName, getPosWorld player];
_marker setMarkerColor "Colorgreen";
_marker setMarkerText format ["HVT - PROTECT : %1",_markerName];
_marker setMarkerSize [.60,.60];
_marker setMarkerShape "ICON";
_marker setMarkerType "mil_warning";
}else {
_marker setMarkerColor "ColorRed";
_marker setMarkerText format ["HVT - ELIMINATE : %1",_markerName];
};
};
```i would like the following: if hvt is on player side then the map marker will show (protect) and if the hvt is an enemy then show (eliminate).
_hvt is a number boolean here
it's a bool (?!)
I stopped at getVariable… I is tired.
@harsh vine where is your HvT on which we could get the side value?
also, your variable name _HvT is misleading (assuming HvT is an object)
side player == playerSide wat?
lol be nice mr leo
Yeah. I just realized
but still, inappropriate code in this context here
lol be nice mr leo
I meant it doesn't have anything to do with what you're asking ^
hi, i have created a gui with an RscTreeSearch but i don't see the search bar https://pastebin.com/bZerpFNr
You need to make one
Ok but why the game have an "RscTreeSearch" ?
because in the config we have "idcSearch = -1;"
oh so i need to create an "RscEdit" and i need to put his "idc" ?
idcSearch = 645;
so i need to have an rscedit with idc 645 ?
Yes
oh ok i will test it
so i need to have an rscedit with idc 645 ?
any idc is fine
🤷 never heard of it
Can anyone help me with a respawning respawn vehicle? I am using "Simple Vehicle Respawn Script v1.81 for Arma 3" and am trying to get it to also use [west, this, "HMMWV M1151 M2"] call BIS_fnc_addRespawnPosition on it.
Vehicle.sqf says :
If you you want to set the INIT field of the respawned vehicle, first set all other values, then set init commands.
Those must be inside quotations.
Like this:
veh = [this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf"
but when i try
veh = [this, 15, 10, 5, TRUE, FALSE, "[west, this, "HMMWV M1151 M2"] call BIS_fnc_addRespawnPosition"] execVM "vehicle.sqf"
i get missing ] error
hope this is the right place!?!
Never heard of the script but HMMWV M1151 M2 is not the right value to pass
@warm hedge thx it worked we need to create an RscEdit with "idc 1896" example and put "1896" in idcSearch 1896 so yes and thx
@solemn citrus
probably what they meant:
[this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf";
[west, this, "HMMWV M1151 M2"] call BIS_fnc_addRespawnPosition
(replace ? with your something)
That is the Name it will show in the respawn Menu and that works
Ahm, is that a marker?
https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition
name (optional):
String - respawn name, can be text or link to localization key
If there's a string like: "abc "def""
the engine will recognize it like a string "abc " and the rest def"" can't be recognized as anything, so it's an error
String inside a string requires two "
Or, '
Yup
[this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf";
[west, this, "HMMWV M1151 M2"] call BIS_fnc_addRespawnPosition
(I prefer ' tho)
shame on you
Wha-
😄
linting throws errors!
will the part after the ; be set into the init when the vehicle respawns?
(I prefer ' tho)
Me too. But if there's more than two inner strings (string within a string within a string) you have to use that
From what i understood it has to be part of the text calling vehicle.sqf to be set again
sorry if i sound strange, english is not my native language
Neither 🙂
k
@solemn citrus
[this, 15, 10, 5, TRUE, FALSE, "[west, this, 'HMMWV M1151 M2'] call BIS_fnc_addRespawnPosition"] execVM "vehicle.sqf"
gonna try
It works! Thanky you all.
Is there any way to disallow AI to enter the vehicle. I am using ALIVE and everytime i start the server there is 1 AI spawning into the gunners seat...
solution so far is to kill him, but ...
lockTurret? deleteVehicleCrew?
that why i came up with that "this deleteVehicleCrew gunner". Is that the right way?
can i put a sleep in front of that?
beware, gunner is a command
sleep 5; this deleteVehicleCrew gunner; [this, 15, 10, 5, TRUE, FALSE, "[west, this, 'HMMWV M1151 M2'] call BIS_fnc_addRespawnPosition"] execVM "vehicle.sqf"
so it could be gunner this (as in "get this vehicle's gunner")
sleep 5; this deleteVehicleCrew gunner this; [this, 15, 10, 5, TRUE, FALSE, "[west, this, 'HMMWV M1151 M2'] call BIS_fnc_addRespawnPosition"] execVM "vehicle.sqf"
this is so confusing. i am quite new to this stuff
hi new to this stuff, I'm dad!
😄
Hi peeps, any chance anyone knows if its possible to open a link from within arma?
structured text maybe, extension can definitely do it
Yeah structured text has hyperlinks but I'm not sure if I can generate text on the main menu, propably not
ideally I could press the spotlight button and that opens the link in a browser
Buttons have an url attribute (https://community.bistudio.com/wiki/DialogControls-Buttons#CT_BUTTON.3D1) which will open well... an url and when Arma 3 2.02 will come out, you will be able to change that by script with https://community.bistudio.com/wiki/ctrlSetURL
Hello there. I have a problem with a script adding a dialog. I make createDialog and the Dialog got opened (said by debug lines) but it wont show up for the player. No Errors in the logs. ctrlVisible and ctrlShow are returning true. Position of the Dialog is in the area of the player, so im confused why it wont show up. Anyone an idea? If you need more infos, then feel free to ask 🙂
19:53:00 "_display1: Display #468220"
19:53:00 "_control1: Control #46923"
19:53:00 "_pos1: [0.207484,0.6092,0.294992,0.06]"
19:53:00 "_visible1: true"
19:53:00 "_shown1: true"
19:53:00 "_display2: Display #468220"
19:53:00 "_control2: Control #46923"
19:53:00 "_pos2: [0.207484,0.6092,0.294992,0.06]"
19:53:00 "_visible2: true"
19:53:00 "_shown2: true"
19:53:00 "Dialog Overview is opened"```
These are my debug lines. _1 is directly after the createDialog and _2 means at the end of my function
I do this whole script in a fuction executed by the initPlayerLocal.
that doesn't tell us anything. Post the display config too
ive found a workaround, but first i want to test it in the next hours and give you feedback on how ive done this 👍
Question probably simple but I am a tad new. Is there a way to export the contents of a cargo box to a script that uses addItemCargo or at least get all of the Item numbers from the inentory of a crate
Apologies if this is easily answered but I have only found ways to export the load outs of players or copy contents not get the specific codes
Right now I have to copy them all manually while viewing in zeus enhanced
Yeah you've got to search through scripting commands related to cargo:
https://community.bistudio.com/wiki/itemCargo
https://community.bistudio.com/wiki/getItemCargo
https://community.bistudio.com/wiki/backpackCargo
and similar
comment "Remove existing items";
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
comment "Add weapons";
_rifle = ["rhs_weap_m4a1_blockII", 0.48, "rhs_weap_m4a1_blockII_KAC", 0.48, "rhs_weap_m4a1", 0.02, "rhs_weap_mk18", 0.02] call BIS_fnc_selectRandomWeighted;
player addWeapon _rifle;```
How am I suppose to find the variable names of items that I don’t know?
Is there a way to hide player names from popping up when they're talking on VON? VonID difficulty setting doesn't seem to do anything on my server.
🤔 it should
Weird. I have a custom difficulty setup on the server which has VonID=0; and the server.cfg also uses ForcedDifficulty="Custom"; but I still see VON ID. Maybe a bug?
@violet gull what
hint str (difficultyOption "vonid");
shows?
there you go you don’t have difficulty set as you think
there is also stream friendly option you can try if this is for you and you don’t want it shown on video
class DifficultyPresets
{
class CustomDifficulty
{
class Options
{
groupIndicators=1;
friendlyTags=0;
enemyTags=0;
detectedMines=0;
commands=1;
waypoints=0;
tacticalPing=0;
weaponInfo=1;
stanceIndicator=1;
staminaBar=1;
weaponCrosshair=0;
visionAid=0;
thirdPersonView=1;
cameraShake=1;
scoreTable=0;
deathMessages=0;
vonID=0;
mapContent=0;
autoReport=0;
multipleSaves=0;
};
aiLevelPreset=3;
};
class CustomAILevel
{
skillAI=0.2;
precisionAI=0.2;
};
};```