#arma3_scripting
1 messages · Page 171 of 1
I wasn't talking about that, just the use of scheduled code in general.
nice nice i see awsome m8
So no real way to influence it with scripting.
see i told you guys Dart is a super pro dam Dart your awsome m8
Sadly
insteresting to say the least
just play it smart ^^ then you can edit everything you want
❤
and i would love to see a bed after 32 hours ...
fucking 32c3 ....
Huh, is some one marathon streaming or what?
Well yes. That's also what I said. Terrain objects without a type aren't included. But there are also houses and other terrain objects which do have types
your a good guy also @little raptor
you helped me also alot
oh btw my PC is running like fast as hell WooHoo Arma3
Is there any way to find out why my extension is crashing arma 3?
the moment callextension gets called for the first time arma just crashes with no logs and no crash dumps
Did you attach a debugger to see where it crashes?
Or do you mean the game crashes before reaching your extension?
In which language is the extension written?
cpp, its a fork of extDB3. I'm trying to update the mariadb connector version
seem to have gotten it working, no clue what I changed 
Now we just hope it doesn't break
Can't figure this one out: how to clear the "STOP" state from AI units, by script, after giving them a STOP order from the UI. I'm working on a custom "Rush" command that I want to override cases where the AI units are stopped.
Not hopeful after finding this... https://feedback.bistudio.com/T126933
HEllo Arma3 coders 🙂 Anyone coding SQF with VSCode and plugin SQF Language By Armitex and SQFLint for parse erros and debug rpt files? I want talk with someone using this setup in Visual Studio Code and find the right parse error parameter Plugins setup. Thanks in advanced for who will answer and wish happy coding to everyone!
I have a spaceship that is animated to 'fly' across the map. I want units on the ground within 1-2km to hear the Engine Noise effect in 3D. Unfortunately, I cannot seem to change the settings to hear the noise past 40-50m. Any ideas? All relevant details are above/below! (Spaceship object, Sound init script, Trigger script)
https://community.bistudio.com/wiki/playSound3D
- you do not need to
remoteExecplaySound3D, it is Global Effect and will cause the sound to be played on all machines, regardless of which machine it is executed on. playSound3Duses the file path of the sound, not a CfgSounds class name- maximum audible distance is controlled by the 7th argument for
playSound3D.
Also playSound3D doesn't attach to and follow the source object, it just stays at the initial position. You're probably looking for say3D.
I tried 'say3D' before this, hence the shoddy implementation of 'playSound3D', but even by increasing the volume and maxDistance value, I could not get the noise to be audible past 40-50m
My implementation of 'playSound3D' was my last attempt based on documentation and my own devices 😦
Did you try specifying the max distance in the say3D call itself, rather than just using the CfgSounds definition?
_object say3D ["soundName", 2000, 1, false, 0, true];```
Thank you! Is the 2000 value the volume or maxDistance? Also, being multiplayer, do I not require remoteExec?
https://community.bistudio.com/wiki/say3D
2000 is the distance, say3D does not contain a volume control. You do need the CfgSounds definition for that.
Whether you need remoteExec depends on the trigger. I can't see the rest of it so I don't know for sure.
If it's a Server Only trigger then you do need remoteExec. If it's not a Server Only trigger then you might need remoteExec, depending on the condition, but it's likely you don't.
Be careful with non-Server Only triggers, because they exist separately on every machine. Anything that's Global Effect in the trigger will be duplicated by the number of machines where the condition is satisfied. e.g. if it's a BLUFOR Present, that's a condition that will be satisfied on every machine at once, and every machine will activate their own local copy of the trigger. This is OK for local-only stuff, but anything that gets broadcast will be broadcast by every machine.
Also, JIP machines have their own copy of the trigger too, fresh and ready to go when they connect, which will cause another activation even if other machines have already activated theirs.
I've tested it and it worked, so thank you very much! The trigger is evaluated on Server, thus do I need to include the remoteExec? And if so, would you possibly point me in the right direction? I'm new to scripting, making my first mission, so I'm sorry for my uselessness in the matter
If the trigger is set to Server Only, you do need the remoteExec, because say3D is Local Effect - without it, only the server would hear the sound. remoteExec will make the server tell all the other machines to do the say3D as well.
remoteExec is formatted like this:
_leftArg command _rightArg;
[_leftArg, _rightArg] remoteExec ["command", _targets, _jip];```
Now we don't need to worry about the targets and JIP arguments. They're optional, and the defaults (all machines, no JIP handling) are exactly what we need. So:
```sqf
_object say3D ["sound", 2000, ... ];
[_object, ["sound", 2000, ... ]] remoteExec ["say3D"];```
Ah, okay, so to format remote exec, target object comes first, then the parameters of the function, then remote Exec command. Thank you!
It's [_leftArgs, _rightArgs] remoteExec ["functionOrCommand", _target]
(say3D's a command, not a function - sounds pedantic but the difference matters)
In this case it's "target first, then other arguments" but that's because say3D is laid out like that already. It's left, right regardless of what left and right actually are; position is what matters.
Can anyone help me with UnitPlay? I'm using the code below in an sqf, and it attempting to activate it via execVM "go.sqf";
_Unit1fire = [];
_Unit1replay = [Unit1, _Unit1move] spawn BIS_fnc_UnitPlay;
[Unit1, _Unit1fire] spawn BIS_fnc_UnitPlayFiring;```
Upon calling any trigger for execution, nothing happens. Can anyone tell me what I'm doing wrong?
Activate it from where?
Also why do you call unitPlayFiring?
To make sure your script is running at all, put a hint or systemChat at the top.
If it does run, I guess the issue is related to unitPlayFiring. Remove it
any ideas on how i could get the Init code of a 3den editor object into a hashmap?
Why? Is my first question
because i am NAIVE and BARBARIC.
but this may clue you in:
i have this:
keysarray = [];
objectdetails = [];
{
private ["_pos","_dir","_object"];
_object = typeOf _x;
_pos = getposatl _x;
_dir = getdir _x;
_hascode = tostring ((get3DENSelected "object" select 0) get3DENAttribute "init");
objectdetails pushback [_object,_pos,_dir,_hascode];
keysarray pushback _foreachindex;
} foreach get3DENSelected "object";
myhashmap = keysarray createHashMapFromArray objectdetails;
but all i get in return is this:
right.... it would appear that way... but:
on one object i get what i need...
What are you even trying, is my next question
to make POI prefabs for my server
Okay, let me rephrase. What do these codes supposed to behave/achieve
[classname, position, direction, event handler code]
Okay, let me rephrase once again. What am I supposed to understand from your last picture
I've done as suggested and am left with this:
_Unit1move = [bunch_of_numbers];
_Unit1replay = [Unit1, _Unit1move] spawn BIS_fnc_UnitPlay;```
When called via a trigger set to Radio Alpha, I see the hint appear, but the UnitPlay still does not work, and my helicopter remains motionless 😦
well it works for one object but for many every value in the [key,[value]] pairs comes out as ""
What one object, what part of the picture confirms something is not working
in the picture at the bottom hascode returns the code from the init field of the object
but when done on large scale, everything is just""
[[1,[""]],[128,[""]],[136,[""]],[148,[""]],[156,[""]],[160,[""]],[172,[""]],[180,[""]],[184,[""]],[32,[""]],[34,[""]],[37,[""]],[39,[""]],[40,[""]],[43,[""]],[45,[""]],[46,[""]],[47,[""]],[49,[""]],[51,[""]],[52,[""]],[54,[""]],[57,[""]],[58,[""]],[60,[""]],[64,[""]],[68,[""]],[74,[""]],[78,[""]],[80,[""]],[86,[""]],[90,[""]],[92,[""]],[94,[""]],[98,[""]],[102,[""]],[104,[""]],[108,[""]],[114,[""]],[116,[""]],[120,[""]],[131,[""]],[143,[""]],[151,[""]],[159,[""]],[167,[""]],[175,[""]],[179,[""]],[183,[""]],[0,[""]],[142,[""]],[150,[""]],[154,[""]],[166,[""]],[174,[""]],[178,[""]],[71,[""]],[75,[""]],[77,[""]],[83,[""]],[87,[""]],[89,[""]],[93,[""]],[97,[""]],[99,[""]],[101,[""]],[105,[""]],[111,[""]],[113,[""]],[117,[""]],[123,[""]],[127,[""]],[9,[""]],[11,[""]],[12,[""]],[14,[""]],[18,[""]],[19,[""]],[21,[""]],[22,[""]],[24,[""]],[25,[""]],[28,[""]],[31,[""]],[129,[""]],[137,[""]],[157,[""]],[161,[""]],[181,[""]],[3,[""]],[6,[""]],[7,[""]],[132,[""]],[140,[""]],[144,[""]],[152,[""]],[164,[""]],[168,[""]],[176,[""]],[33,[""]],[35,[""]],[36,[""]],[38,[""]],[41,[""]],[42,[""]],[44,[""]],[48,[""]],[50,[""]],[53,[""]],[55,[""]],[56,[""]],[59,[""]],[61,[""]],[62,[""]],[63,[""]],[66,[""]],[70,[""]],[72,[""]],[76,[""]],[82,[""]],[84,[""]],[88,[""]],[96,[""]],[100,[""]],[106,[""]],[110,[""]],[112,[""]],[118,[""]],[122,[""]],[124,[""]],[126,[""]],[135,[""]],[139,[""]],[147,[""]],[155,[""]],[163,[""]],[171,[""]],[130,[""]],[134,[""]],[138,[""]],[146,[""]],[158,[""]],[162,[""]],[170,[""]],[182,[""]],[65,[""]],[67,[""]],[69,[""]],[73,[""]],[79,[""]],[81,[""]],[85,[""]],[91,[""]],[95,[""]],[103,[""]],[107,[""]],[109,[""]],[115,[""]],[119,[""]],[121,[""]],[125,[""]],[8,[""]],[10,[""]],
etcetera
on a single object it actually returns the code though.
[[0,["this addEventHandler [""handledamage"",{
params [""_unit"", ""_selection"", ""_damage"", ""_source"", ""_projectile"", ""_hitIndex"", ""_instigator"", ""_hitPoint"", ""_directHit"", ""_context""];
_olddamage = _damage;
switch (_projectile) do
{
case ""DemoCharge_Remote_Ammo"": {_damage = _damage+0.5};
case ""SatchelCharge_Remote_Ammo"": {_damage = _damage+1};
default {_damage = getDammage _obj};
};
hint format [""%1,\n%2,\n%3,\n%4"",_projectile,_olddamage,_damage,getDammage _unit];
_damage;
}];"]]]```
_hascode = tostring ((get3DENSelected "object" select 0) get3DENAttribute "init");```Because it is not referencing to `_x`?
im pushing it into _y?
I see no _y reference there even
this is to create the hasmap. im not using foreach alternate syntax
i want to pack all the relevant information into the hashmap so i can put it into an array in a different mission and run a loop that will iterate through and create the POI without having to do this:
it works with
_hascode = ((get3DENSelected "object" select 0) get3DENAttribute "init");
its string already.
The point I say there is, (get3DENSelected "object" select 0) is an object, not _x, it is referencing one particular object all the time
True
keysarray = [];
objectdetails = [];
{
private ["_pos","_dir","_object"];
_object = typeOf _x;
_pos = getposatl _x;
_dir = getdir _x;
hascode = (_x get3DENAttribute "init");
objectdetails pushback [_object,_pos,_dir,hascode];
keysarray pushback _foreachindex;
} foreach get3DENSelected "object";
myhashmap = keysarray createHashMapFromArray objectdetails;
myhashmap;```
there it is. im sorry.
keysarray = [];
objectdetails = [];
{
private ["_pos","_dir","_object"];
_object = typeOf _x;
_pos = getposatl _x;
_dir = getdir _x;
_hascode = _x get3DENAttribute "init" select 0; //return array
objectdetails pushback [_object,_pos,_dir,_hascode];
keysarray pushback _foreachindex;
} foreach get3DENSelected "object";
myhashmap = keysarray createHashMapFromArray objectdetails;
myhashmap
[[0,["C_Offroad_01_repair_F",[6766.78,4493.62,-0.000293255],0,"systemChat ""hello"";
hint ""test"";"]]]
if you want string of init
THAT is what i was trying to do. THANK YOU!
sorry if i frustrated you @warm hedge
I'm not even asked you to say sorry even
?
so im stuck again. i was trying to get this to work earlier so i took out the if statement and the nilstring var, and now i get nothing where the init string should be.
keysarray = [];
objectdetails = [];
nilstring == "";
{
private ["_pos","_dir","_object"];
_object = typeOf _x;
_pos = getposatl _x;
_dir = getdir _x;
objectdetails pushback [_object,_pos,_dir];
_hascode = (_x get3DENAttribute "init" select 0);
if (!(_hascode == nilsting)) then
{objectdetails pushback _hascode;},{};
keysarray pushback _foreachindex;
} foreach get3DENSelected "object";
myhashmap = keysarray createHashMapFromArray objectdetails;
myhashmap;
nilstring is undefined
shouldnt the foreach loop inherit from the scope it was executed from? so line 3?
== is not declare
What is unit1?
Also can you show the first few elements of your capture data?
nilstring == "";
if (!(_hascode == nilsting))
2 different variable.
and you can do just.
_hascode = (_x get3DENAttribute "init" select 0);
if (_hascode != "") then {
objectdetails pushback _hascode;
};
What is ,{}; after if?
picked up on it here: https://community.bistudio.com/wiki/Control_Structures#if-Statement
alternate syntax?
if (!(_hascode == nilsting)) then
{objectdetails pushback _hascode;},{};
keysarray pushback _foreachindex; ```Prisoner asked about this chunk of your code
And as he pointed out:
nilstring == "";
Does not mean assignment. It's a comparison
that would be the else code block.
yes that was made clear.
If (true) then {
// To true stuff
} else {
//Do false stuff
};
Another thing that I don't see being pointed out, is that you're creating global variables which don't seem to be needed
which ones? im not good at this. i am the equivalent of a caveman with a howitzer. if i bash my head on the button board enough i might have a semblance of a thought.
if (true) then [{...},{...}];
aparently i was doing it wrong again
The first 3 vars. e.g. nilstring should be _nilstring
which is why it wasnt working in the first place.
in the debug console i leave them global so i can watch and hopefully glean why the code doesnt work
ok
my pc after running code full of bugs i unknowingly put in there:
so if i run this the values of the hashmap that should have a 4th element are instead replaced with the contents of _hascode why?
keysarray = [];
objectdetails = [];
nilstring = "";
{
private ["_pos","_dir","_object"];
_object = typeOf _x;
_pos = getposatl _x;
_dir = getdir _x;
objectdetails pushback [_object,_pos,_dir];
_hascode = (_x get3DENAttribute "init" select 0);
if (!(_hascode == nilstring)) then
{objectdetails pushback _hascode;} else {};
keysarray pushback _foreachindex;
} foreach get3DENSelected "object";
myhashmap = keysarray createHashMapFromArray objectdetails;
myhashmap;
29 is good, 30 is just the string:
[29,["Land_Mil_WallBig_4m_lxWS",[23234.6,18699,2.38419e-07],179.946]],[30,"this addEventHandler [""handledamage"",{
params [""_unit"", ""_selection"", ""_damage"", ""_source"", ""_projectile"", ""_hitIndex"", ""_instigator"", ""_hitPoint"", ""_directHit"", ""_context""];
_olddamage = _damage;
switch (_projectile) do
{
case ""DemoCharge_Remote_Ammo"": {_damage = _damage+0.5};
case ""SatchelCharge_Remote_Ammo"": {_damage = _damage+1};
default {_damage = getDammage _obj};
};
hint format [""%1,\n%2,\n%3,\n%4"",_projectile,_olddamage,_damage,getDammage _unit];
_damage;
}];"]```
this works though:
keysarray = [];
objectdetails = [];
nilstring = "";
{
private ["_pos","_dir","_object"];
_object = typeOf _x;
_pos = getposatl _x;
_dir = getdir _x;
_hascode = (_x get3DENAttribute "init" select 0);
if (!(_hascode == nilstring)) then
{objectdetails pushback [_object,_pos,_dir,_hascode];} else {objectdetails pushback [_object,_pos,_dir];};
keysarray pushback _foreachindex;
} foreach get3DENSelected "object";
myhashmap = keysarray createHashMapFromArray objectdetails;
myhashmap;
can pushback not be used with a single element?
You could do that easier.
myHashMap = createHashmap;
{
private ["_pos","_dir","_object"];
_object = typeOf _x;
_pos = getposatl _x;
_dir = getdir _x;
_hascode = (_x get3DENAttribute "init" select 0);
private _content = [_object,_pos,_dir];
if (_hascode != "") then
{
_content pushback _hascode;
};
myHashMap set [_foreachindex,_content];
} foreach get3DENSelected "object";
myHashMap
is kronsky.info a safe website to learn scripts at
They sell scripts , right?
I would not pay.
You can learn from the bohemian wiki,
You can learn here by asking for help.
#arma3_scripting message
There is where you could start.
No its basically a website where you can download some scripts and put them into your mission
It's hard to make an SQF script that's actually dangerous, since they can't control anything outside the game without an extension (you should be very careful installing extensions for this reason). Doesn't guarantee the scripts are good though.
Okay
Its the ups script
I just discovered that my SOG AI mod initialization code never runs if the workshop mission includes an Intro mission. When I look at the .RPT file I see my mod initialization script is ran for the Intro mission (where it is not needed), and never runs for the actual mission that starts after Intro concludes. This is the config.cpp entry that runs my initialization script for my mod:
class CfgFunctions { class JBOY { class JBOY_sogAI { class sogAI_init { file = "\SOG_AI\JBOY\init_sogai.sqf"; postInit = 1; }; }; }; };
How do I ensure that my mod init code runs for main mission when the mission includes an Intro?
“VillageThree” SetMarkerAlpha 0;
It gives me the error that there is an invalid number. dunno why, anybody in here knows?
its code within a trigger
Send the error message from RPT-file.
thats right.....
Most likely yes, unless this line is typed manually.
"Most likely" I can literally see that the quotes characters are wrong
The same for me, but "there is an invalid number" message asked me to request the full error message.
is it still not possible to make a player look (aim) at a certain position?
"invalid number" almost always means "some weird character I didn't recognise", such as wrong quotes or comments in a non-preprocessed context. It very rarely refers to an actual number.
Anyway, the line could have been typed manually, but everything in the code could have been correct.
I assume this is still not possible?
Trying to make a Dead Eye script for singleplayer
Not exactly certain if I understand the description in player wiki entry regarding intro/outro, but can you waitUntil {!isnull player} or similar
Possible use of OnUserSelectedPlayer event handler?
for whatever reason, I can't link either one of these wiki entries in this post
Make sure you've accepted the #rules . Some Discord privileges are locked behind that for spam prevention.
I thought I did, as I thought you had to previous to posting
Well, double-check; you don't have the acknowledged-rules role.
Only within a turret with a screen. Now if you are doing a deadeye script, you could just change the trajectory of the bullets after they are fired.
Add some draw3D to simulate some accuracy circles on enemies on the screen, etc.
Just automatically kill the player after they activate Deadeye, before they can shoot. It's accurate to the source material and you don't have to deal with the aiming 
remoteExec questions if anyone knows:
- Does targeting just the server only send a packet to the server?
- Does targeting a client from the server only broadcast to the one client?
- Does targeting a client from a client only go to the client (even if it has to pass through the server)?
- Does targeting an object broadcast to broadcast everywhere and then is evaluated where it's local, or some other method to ensure something happens where an object is local?
1.) yes
2.) yes
3.) yes
4.) goes to the client that owns it
Also, if say you remote exec something that already meets the local requirements, nothing is broadcast and it runs it locally.
Thanks
Unit1 is a UH-60 from the RHSUSAF mod.
_Unit1move = [[[5,[2348.07,1420.19,5.08734],[-0.969117,-0.246602,-0.000264401],[-0.000256384,-6.46148e-05,1],[-0.000202733,-9.72703e-05,-0.000468135]]...
how can i tel if a player has their inventory open via displayctrl
isNull (findDisplay 602) Will give you if the inventory is open or not.
isNull (findDisplay 602 displayCtrl 610) if you absolutely need to use displayCtrl
For helis with turrets this will report "" back if you use the "manual fire" action as driver/pilot.
currentMuzzle driver vehicle player```
It works for the Pawnee but not for the Blackfoot.
Any alternative to get the muzzle?
currentMuzzle is:
Returns a unit's current weapon muzzle. Does not work on vehicles.
This may help: https://community.bistudio.com/wiki/currentWeaponTurret
oh well, I thought I could simulate the player character looking at targets (i.e switching between them) as they are shooting them
because it will look weird when the fire towards the second enemy but it kills the first enemy (because I only edited the bullet trajectory) or fire on a wall but the enemy is on the building
seems to have extra bracket compared to what BIS_fnc_unitCapture outputs for me [[0,[2490.96,5434.09,7.07523],[0.0328678,0.993771,-0.106479],[0.00210529,0.106467,0.994314],[0.00684595,0.64196,2.97112]],.... Don't add extra brackets 
That was the problem, thank you. The template I was referencing already had empty brackets there, so I assumed I just needed to paste between them ☹️
i need a script for a trigger that changes a players side to independent
ive been trying all kinds of things but i cant seem to get it to change my side
You can't
i was able to with another script but it was changing every player
?
0 = [] spawn {
while {true} do {
{
call {
if (_x inArea trigWEST) exitWith {
if (side (_x getVariable ["actualGrp",grpNull]) != WEST) then {_x setVariable ["actualGrp", createGroup WEST]};
};
if (_x inArea trigEAST) exitWith {
if (side (_x getVariable ["actualGrp",grpNull]) != EAST) then {_x setVariable ["actualGrp", createGroup EAST]};
};
if (side (_x getVariable ["actualGrp",grpNull]) != CIVILIAN) exitWith {
_x setVariable ["actualGrp", createGroup CIVILIAN];
};
};
if (side _x != side (_x getVariable "actualGrp")) then {
_oldGrp = group _x;
[_x] joinSilent (_x getVariable "actualGrp");
if (count units _oldgrp == 0) then {deleteGroup _oldGrp};
};
} forEach allPlayers;
sleep 2;
};
};
Well join or joinSilent etc can be a workaround indeed
would setSide not work?
setSide is not even a command for that
im playing around with the command but its not really working idk how to use it properly XD
player is not a location
Read the biki then
https://community.bistudio.com/wiki/setSide
Even BIKi clearly states it
would this work then?
[this] joinSilent createGroup EAST;
Maybe
just tried it it didnt work
Maybe because the context is wrong
how would i change it?
im placing it in the activation part of the trigger im also as a extra test putting in the execute section on myself in eden
Then this is pointing not an unit
wa
?
idk wat this means
Do you mean this, literally, as a word, or this, in script context
this as in im new to scripting and idk what you were trying to say
What you need to know in this context is, this is not pointing a unit (eg player unit) in that context (On Activation)
"join this to newly created EAST group" + "this is not a player" = "player isn't joined"
ok i think im understanding this is refering to a unit like a random ai you can place but doesnt refer to the unit that players control or somethign like that
IVE GOT IT I FINALLY FIGURED IT OUT
[player] joinSilent createGroup EAST
that changed my side
and it works in the trigger
@tough sapphire description.ext is not autogenerated, you need to make it yourself.
Good day. I'm trying to create empty ammo object and attach it to vehicle
- Are there any other options besides
createSimpleObjectwith ammo's '*.p3d' ? - If I go with simple object, I see attaching it works fine in the editor, but will it work in MP? I always though simple objects support static placement only
👋 Hi peeps, I need some help
I'm working on scripting the big NATO AA SAM launcher ( MIM-145 Defender) at a targeet object, however I cant get the launcher(s) to look at the object correctly
I'm trying to use doWatch to have the launcher look at the targets, however they flip right back to looking straight ahead before the missile can even fire
Pie_Radar_AntiShipLauncher_Right reveal [Pie_Convoy_Target_2, 4];
Pie_Radar_AntiShipLauncher_Right doWatch Pie_Convoy_Target_2;
sleep 2;
Pie_Radar_AntiShipLauncher_Right fireAtTarget [Pie_Convoy_Target_2];
Try lockCameraTo
Hm that doesnt seem to do anything, atlhough I might be getting the turret path parameter wrong
Tried
Pie_Radar_AntiShipLauncher_Right lockCameraTo [Pie_Convoy_Target_2, [0,0]];
and
Pie_Radar_AntiShipLauncher_Right lockCameraTo [Pie_Convoy_Target_2, Pie_Radar_AntiShipLauncher_Right unitTurret (gunner Pie_Radar_AntiShipLauncher_Right) ];
Ooh ok just tried teleporting myself into the vehicle to be the gunner and then the command works
Does anyone know what script is involved in setting up the commanding menu (shown when the `~ key is pressed). Config item is RscGroupRootMenu, which I can add items to just fine, but I also want to control where in the menu the new items show up.
Ayy using Pie_Radar_AntiShipLauncher_Right lockCameraTo [Pie_Convoy_Target_2, Pie_Radar_AntiShipLauncher_Right unitTurret (gunner Pie_Radar_AntiShipLauncher_Right), false]; worked 
Thanku <3
Fah.
Trying to make a half-assed patch for Ace Medical in low pop servers because my groups always insist on running full ACE and playing Mike Force (Why yes, we do burn out instantly when one casualty brings the game to a halt, how did you know).
I'm getting somewhere, but I keep getting weird behaviour. Like I use the ACE_medical_treatment_fnc_fullHeallocal command, but the player remains unconscious.
Are you running the function local to that player?
I've done just about every variant I can think of; even ran the non-local version (ACE_medical_treatment_fnc_fullHeal) remoteexec'd to every machine.
It heals the player just fine, but they're locked in an INCAPACIATED state, not even the Zeus heal module will fix them.
even ran the non-local version (ACE_medical_treatment_fnc_fullHeal) remoteexec'd to every machine.
fullHealhandles the networking for you, do not remoteExec it
What exactly are you doing and how are you running it, showing your script would be more helpful
Aye, hold on, lemme clean it up a bit.
Hrr. Thought I had a typo to clean up, tested a bit, finally got some diagnostic feedback from the fullheal module, 'failed to wake up patient'. Not that that helps :/
Also error: unit not local or null.
Alright, lemme post what I'm working with.
So you're either running it on a remote unit (other players will always be remote), or a unit that doesn't exist (or was deleted)
I'm on a loopbacked server, using a second Arma instance to test on.
The module, outside of my scripting, works on reviving the unit when downed.
Not positive that sent, Discord sent an error message. Huh.
It didn't
[] SPAWN
{
while {true} do {
Sleep 3;
private _players = allPlayers - entities "HeadlessClient_F";
_unconPlayers = _players select {_x getvariable "ACE_isUnconscious" AND {!(_x getvariable "SRD_TEST")} };
[_x] spawn srd_fnc_HAM_Start} foreach _unconPlayers;
};
srd_fnc_HAM_Start =
{
params ["_player"];
systemchat format ["HAM active on %1",name _player];
_player setVariable ["SRD_TEST",true,true];
[
_player,
"Heal",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
"_this distance _target < 3 && lifestate _target == 'INCAPACITATED'",
"_caller distance _target < 3",
{_caller playMoveNow "acts_treatingWounded_in"; _caller playmove "acts_treatingwounded02"},
{},
{
_caller playMoveNow "acts_treatingWounded_out";
[_target] call ACE_medical_treatment_fnc_fullHealLocal;
_target setVariable ["SRD_TEST",false,true];
},
{},
[],
6,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, _player];
};
There we go.
You're missing a brace at your forEach
Blah, spawn had an extra }
However, that just applies the action.
When I add the action manually, it still doesn't work. Still, good to know why it wasn't adding the action the last few tests.
No, it was missing one
You're missing two, one before the [_x] in the forEach and the closing brace for the spawn
Yup, caught that just now.
I stg I had the timer set up properly just a bit ago... mustve messed with something and didn't think about it.
Anyways; even with the timer functioning, and the action being applied automatically, it still heals the player but fails to wake them up.
Because you're not running it on a local unit
A player is only ever local to their own machine
Why even do this whole loop over all players thing anyway.
Just add the action to all players, and only check if they're awake in the condition.
For JIP and respawns. This is going to be executed on top of an existing scenario, I won't have access to initplayer files. Still, I could change it to check and apply action as you suggest, stretch out the sleep timer a good bit.
Hrr. My test dummy woke up now. Granted, its taking like 10-15 seconds, but that's better than permanent naptime.
Alternatively, just add it on the ace_unconscious event
https://gist.github.com/DartRuffian/2720016d56bc88ee7fb2cc2dec761ab0
That might be an option, but I just had a breakthrough by remoteexec-ing the heal action directly aimed at the _target of the action.
You don't need to remoteExec it, period
Just use ace_medical_treatment_fnc_fullHeal.
It handles the networking for you
https://github.com/acemod/ACE3/blob/master/addons/medical_treatment/functions/fnc_fullHeal.sqf#L26
I know, you said as such and I believe you. But in this use case, apparently it doesn't, and remoteexecing the local version does work.
It does
Yes, the medic and the patient
Optionally a third parameter to disable the message added to the patient's log, but that's not in the release build
There we go, that did it. I was not passing the medic info to the non-local version.
You were only passing the medic, it's the first parameter
Meaning that there wasn't any value for _patient, hence: "Not local or null unit"
Yeah, I've been operating with the local version for too much.
But that particular error (undefined variable) wasn't showing up in my log because I was using the local version.
Bluh. Whatever, it seems to be working much more fluidly now. Thank you!
Is there anyway to script so after a specific amount of time a marker will show up
Yeah, just use a sleep / CBA_fnc_waitAndExecute
Yes but the code to make it show up
The same way you'd create a marker normally
When making markers, always use the local versions of each command and only sync it at the end to save network traffic
E.g.
_marker = createMarkerLocal ["markername",[_Xpos,_Ypos]];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerType "DOT"; // This updates the entire marker
Where do i put the y and x
and the _
Read the page for createMarkerLocal
Ok
Doesnt work
It does
Thats because its an .txt
You need to provide your code, how you are doing it.
Just saying "doesn't work" doesn't tell anyone anything
not a .sqf
It was named .sqf not .txt
Still doesnt work here is my code
_markerstr = createMarkerLocal ["Bandits reported",[9344.78_Xpos,8605.91_Ypos]];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerType "Unknown";
9344.78_Xpos is not a number
Your file name is MySuperscript.sqf.txt ?
If you are using windows, change from view setting show file extensions
Yes i know
i just did
Good
Where am i supposed to place the coordinates
Your format is correct, but you kept the _Xpos and _Ypos
Those are variables in the example code on the wiki, just use the numbers themselves
Doesnt work
Just saying "doesn't work" doesn't tell anyone anything
Oh right heres the code
_markerstr = createMarkerLocal ["Bandits reported",[9344.78,8605.91]];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerType "Unknown";
You're saving the marker as _markerstr, but then trying to set the shape and type of a marker called _marker
Wait
what does that mean
What do you think it means?
That means you're using commands incorrectly, so read BIKI.
What does it mean that im saving it
You're creating a variable called _markerstr
No, it's just a wrong variable name
That's irrelevant to the command being used
Do i need the _
Yes if you're using local vars.
It's already local
You're creating a variable called _markerstr. That's what _markerstr = createMarkerLocal ["Bandits reported",[9344.78,8605.91]]; is doing.
Your next line is _marker setMarkerShapeLocal "ICON";. Which uses a variable called _marker.
Still doesnt work
_Bandits Reported = createMarkerLocal ["Bandits reported",[9344.78,8605.91]];
_Bandits Reported setMarkerShapeLocal "ICON";
_Bandits Reported setMarkerType "Unknown";
Do you see the issue?
You can't have spaces in variable names
Someone haven't read BIKI: https://community.bistudio.com/wiki/Variables
Still doesnt work
_Mark = createMarkerLocal ["Mark",[9344.78,8605.91]];
_Mark setMarkerShapeLocal "ICON";
_Mark setMarkerType "Unknown";
What "doesn't work"
The maker
Does it not create a marker at all, does it not set the shape, does it not set the type?
marker
There is no such shape. I'm asking again, have you read BIKI: https://community.bistudio.com/wiki/setMarkerTypeLocal ?
Doesnt create a marker
Oh wait
sec
Are you sure?
createMarkerLocal returns an empty string ("") if no marker was created
You need to test stuff to try and figure out what doesn't work
I am testing it
nothing pops up
Wait a minute
A marker not being visible is not the same as not existing
I found out why
it wasnt in an initserver 💀
Works now
Is there anyway to hide a marker
setMarkerAlpha/Local
I want to add music to a mission, but for some reason, the mission files don't have the description.ext file. What should I do?
Create the description.ext file.
It's not automatically created, you make it yourself
so you need to create a text document named description.ext in the mission folder and write the script there
In description.ext file you can define your sounds.
see
https://community.bistudio.com/wiki/Description.ext#CfgSounds
and if you want use them in mission, there is many ways to use those sounds.
you need just tell how and where
the file needs to be in ogg format?
Config is not the same as a script
yes.
Is there any way to add action in a .sqf
Found out how
is there any event handler for weaponAccessories?
You mean for when you add/remove an attachment on a weapon?
yea
oh nice thank you
2.18 added extra parameter for the weapon that had its attachment changed (if it was an attachment, obviously)
is there anything more specific to only weapon slots changed?
yea, ok thanks
Is there a way to get 3DEN's layer parent layer? 🤔
get3DENParent
layers aren't objects though?
hey, it really works with layer IDs get3DENParent 2 returns 0 when layers are parented that way 
So it returns number or object?
Or does it return entity id always.
get3DEParent <number> returned <number> when numbers are Layer IDs
nah, game is down already and i need to go
Ok.
Oooh
I was looking at wiki and though it was for objects only too
Yes you've deleted your post, indeed
sorry i'll post what i did for anybody else lol
had a script spawning AI and was wanting it to sync to the support module, but i was syncing the player to the module instead of the AI
[_vehiclespawn, SUPPORT, SUPPORT_CAS] call BIS_fnc_addSupportLink;
[_vehiclespawn, SUPPORT, SUPPORT_TRANS] call BIS_fnc_addSupportLink;````
thats the corrected code
so after playing with enfusions layers. i recently realised we can use layers in A3, for years I've made dynamic aos by spawning markers and generating ai and entities around areas.
is it possible just to create and hide layers? eg on a mission init get it to just pick and load a random layer / or select a layer with its enities and tasks modules. if i wanted to create a somewhat dynamic mission? how would that affect performance? if they are hidden and simulation is turned off. and only one layer is loaded? compared to me having scripts randomly generate everything?
yes
Yes, you can do that. Not so much choosing a layer to load, but you can hide and disable simulation for everything on every layer and then pick one to re-enable.
I would say it definitely depends how complex you're going to get, though. Stuff does still exist in the mission.sqm when it's hidden and sim-disabled, which can dramatically increase the file size when there's a lot of it. Also, hidden objects can still be picked up by script commands. So there's a balance of "Editor convenience" vs. "it's more efficient to procedurally generate this". A script to spawn enemies is a lot more compact than specific information about 300 existing enemy units.
So let's say I make my objective entities and tasks in a layer. But I could just reuse my ai spawn script. To just spawn units in selected area/layer.. rather than load everything in a layer and hide it.
That would be better practice?
I'd say so
Hi!
Is there a way to get a list of files in my PRO using sqf?
in your PRO…
Project?
I assume PBO, to my knowledge you can’t do it easily with just SQF, but you can do it with an extension that’s what I’ve done before
Didn’t know about that one, only knew about the fileExists one
Sorry, PBO
Thanks
i guess profileNamespace getvariable is reading variables from memory and not from harddrive?
is there a way to store a number with higher precision?
If i try to store UIDs with something like 123456789 i'll get 1.2345e10 for example
keep them as string?
Yeah i guess
aren't UIDs string already anyway?
They are yeah
isnt that just printing thing? https://community.bistudio.com/wiki/toFixed
the number is a float beyond its "integer precision". toFixed can't do anything here
humm, in that case nvm
I mostly wanted it for visual/readability/stupid-proofing reasons, to avoid needeeding to surround uids with quote strings; since im making something people are copy/pasting UIDs into an editor module for
when it gets read by the parsesimplearray if it isnt a string it'll get turned into floating 1.234e10
hello, friends: how do i stop a script from being exec until its done running
is there a way to do this
scotty i dont understand the question, to exec script is same as to run script
well yes thats what i mean if the script is running i want not to be able to run it until its done
like not allow re-run until its done?
yes roger
waituntil { scriptdone _scriptHandle };
ahhh nice awsome m8
you get _scriptHandle from return of either execvm or spawn
so that line would go at that start of the script
it goes after execvm or spawn
ok roger got it
awsome m8 thx alot
i love you guys so much lol
so this is what iv come up with is this correct
_scriptHandle = ["Scripts\NEKY_PickUp\NEKY_Init.sqf"] execVM "scriptname.sqf";
waitUntil { scriptDone _scriptHandle };
looks good to me
coool awsome m8
hello all,
trying to figure out if this engine bug
I am creating "Land_ClutterCutter_small_F" via createVehicleLocal, then creating createSimpleObject with local atribute and attaching it to Land_ClutterCutter_small_F, and when i try to move the Land_ClutterCutter_small_F i get colission with my self and the simpleobject.
_preview = "someclassname";
_helper_item = "Land_ClutterCutter_small_F" createVehicleLocal (screenToWorld [0.5,0.5]);
_preview_item = createSimpleObject [_preview, (screenToWorld [0.5,0.5]), true];
_preview_item allowDamage false;
_center = boundingCenter _preview_item;
_preview_item attachTo [_helper_item,[0,0,_center select 2]];
CTI_COIN_CAMCONSTRUCT camSetTarget _helper_item;
CTI_COIN_CAMCONSTRUCT camCommit 0;
I'd suggest using setPhysicsCollisionFlag now that it exists, it's much more flexible than disableCollisionWith
Aa, nice. Didn't know that exists 👍
Has anyone used the Database Interceptor?
https://github.com/intercept/intercept-database
Is it possible to send requests synchronously?
simpleobjectlocal doesnt support physics per wiki
So...
CoreDatabaseServer_val_Connection = dbCreateConnection "development";
_response = CoreDatabaseServer_val_Connection dbExecuteAsync dbPrepareQuery "SELECT 1, NOW()";
_response = dbWaitForResult _response;
_response = dbResultToParsedArray _response;
hint str _response;
It doesn't support physics in the sense that the object itself won't fall over, even if it's a movable object in normal life. But it still has collision bounding boxes, like a static building - other things will bounce off it.
Unless you do setPhysicsCollisionFlag on it, of course.
Try this?
{
waitUntil { !isNull findDisplay 46 };
[] execVM "SOG_AI\JBOY\init_sogai.sqf"; // execute SOG AI in mission
};
I found by looking through posts a month ago but I still can't post links within this discord!!!!
Intro is idd 47
I tried that after a bit of googling per your previous post, and it did not work.
I haven't tried your suggestion for OnUserSelectedPlayer EH yet...
FWIW, search intro in intro in this discord and find Dedmen post which is what I was kinda going off of (since I still cannot post the link)
You cannot just post inline link, URL itself is fine
there is a function called
inputController -1
is there an equivilent function to reliably check for the presence or use of hotas/joystick
Hey peeps is there a reasonable way to show the drone feed using the custom info panels to all players in a mission, or should I just use bis fnc livefeed?
wierd question... if i were to make a variable that i only wanted to be different on a particular units machine(Ex: p10), would ```sqf
owner p10 publicvariableclient "myvariable";
make the variable available on whomever connects and assigns themselves to that unit?
Should do
ok secondary question. if there were no player assigned to the unit at the time the variable was made public, would the server technically own the unit and thus only make the variable public to the server machine? essentially i just want to know if the variable follows the owner of the unit, or is it sent to the machine only ance and forgotten?
i want to know if i am reading it right.
what i understand is that publicvariable is a JIP command that will hold the contents of the variable and the argument of the machine that it was supposed to be sent to, at the time of the commands execution, and upon a player joining, if the player will now own the unit p10, the variable will be sent?
NVM i read the notes and it will not do that. publicvariable will though. thats sad
can i use format to create a dynamic variablename?
Well you can. But for what?
im writing a script that will dynamically create an array in the communication menu that will create an entry for each of the units in the players group, and upon selecting one of the units in said menu will either add or remove the referenced unit from an array..... if that makes any sense
Ah so, 0-8
fnc_squadMenu = {
squadHud = [["SquadHud",false]]; {squadHud pushback [format ["Toggle %1",name _x],[_forEachIndex +2],"",-5,[["expression","if (_x in escapeGroupMarkers) then {escapeGroupMarkers deleteAt (escapeGroupMarkers find _x);} else {escapeGroupMarkers pushback _x;};"]],"1","1"]} foreach ((units group player)-[player]); 0 spawn {sleep 0.05; showCommandingMenu "#USER:squadHud"};
};
this is what i have so far and i can get the menu to show the units names, but selecting them does nothing, i presume because the quoted text "CODE" will be run in a seperate scope which will not receive the _x variable of the foreach loop.
so i wanted to set _x to a dynamic varible that i could create with format to make the reference work
Kinda tricky, but I'd not to use _x but store the unit somewhere else
Well that's your point, but... let me think, store the unit into an array and reference it?
Could format the netID of the object you want to reference into the script and just use objectFromNetID. NetID's will never duplicate and are constant across network too.
ex.
format ["_obj = objectFromNetID '%1'; if (_obj in escapeGroupMarkers) then {escapeGroupMarkers deleteAt (escapeGroupMarkers find _obj);} else {escapeGroupMarkers pushback _obj;};", netID _x]
how do you call a case using remoteexec
Call a case?
like i got a switch script for the player choosing a vehicle which is usually _shopper = [4, player] execVM "scripts\blabla.sqf"
[ 4, player, "scripts\blabla.sqf"] remoteExec ["execVM", 0, true];
would it be like that?
No, the [4, player] needs to remain an array of its own. Remember:
_left command _right;
[_left, _right] remoteExec ["command"];
[4, player] execVM "script";
[[4, player], "script"] remoteExec ["execVM"];```
Cautions:
playeris evaluated on the sending machine before the remoteExec is sent. If you want to target the receiver'splayer, you need to restructure.- I suggest using https://community.bistudio.com/wiki/Arma_3:_Functions_Library instead of
execVMall the time.
well i'm trying to figure out why i cant get certain things to work on multiplayer
support requester so far has been about a week of trying to get it to sync and work to anybody but the admin, and I have a chinook thats supposed to trigger a script but on multiplayer it just fails
this isnt happening in an MP scope, its purly local to the client, but that does appear useful.
Iirc, the netID command works in local since 2.18, so should work all the same
would a hasmap be better? could i store the unit as the value and use the _foreachindex as the key? and just pass _foreachindex through format to the string and write the string like: myhashmap get %1 instead of _x?
how can i close a hashmap?
What do you mean "close" a hash map? Like delete it?
yes
DeleteAt - https://community.bistudio.com/wiki/deleteAt
Will still work for deleting key value pairs in the hash map. As far as deleting it, I believe as long as its not referenced anywhere (the scope it was defined in no longer exists, or you just re-define the variable = nil), it will get cleaned up by the engine.
that worked
i made an array and then populated it in the foreach loop
then used format and replaced _x with (squadMenuUnits select %1)
A technical challenge, because I want to see if theres a better method than what I have in mind and Im endlessly fascinated by Best Practices.
Last night on Reddit, there was a post about respawn mechanics; specifically, they wanted respawn on a vehicle with a single seat (cryopod, for lore reasons). However, if multiple people attempted to respawn at the same time, the second onwards would instead be placed nearby as expected - but unfortunately, 'nearby' is empty space 10km in the sky.
My initial suggestion was to just forget the cryopod idea (K.I.S.S. and all), but that it would be possible through some not terribly difficult scripting.
If presented with that kind of goal, how would you propose resolving it such that there is only one selectable respawn point, but even if its occupied you would still spawn in an adjacent vehicle that is not tagged as the respawn point?
Not entirely sure how your respawn system works, but I would suggest using a nearestObjects at your spawn position, going through all the same vehicles in the area and just using moveIn if the are empty? If you run the script and you're still not in the vehicle, just run it again.
Im assuming a completely vanilla respawn system, tho OP did not specify.
The respawn point is a nearby dummy object or 3D position, not actually the cryopod itself. As part of the respawn handling (onPlayerRespawn.sqf, respawn template, respawn EH etc) the player checks for nearby cryopods and is instantly moved into one if it's available. I'd suggest having a couple of cryopods. If none are available then you either have a fallback vehicle to move them into, or just leave them on the dummy position, which could be sensibly located on the floor next to the cryopod.
Hey thanks for the info. I had said so earlier but i didn't post. I will dig into this on the next work session.
Now this is what I wanted to see - I wasnt even thinking about decoupling the respawn point and starting from there, and overlooked the OnPlayerRespawn option in favor of the EH (and associated headache trying to sort out how to re/apply it)
EHs on a respawning unit persist across respawn, so you don't need to worry about reapplying it
hello for the faction of republic of korea in the vietnam dlc i would like to change the class voice from kor to dlc chinese
the pbo config
#include "BIS_AddonInfo.hpp"
class CfgPatches
{
class ChinaKorVoice
{
units[]={};
weapons[]={};
requiredVersion=1.0;
requiredAddons[]=
{
"Extended_EventHandlers"
};
};
};
class Extended_PreInit_EventHandlers {
ChinaKor_Init = "ChinaKor_Var = [] execVM ""\ChinaKorVoice\preinit.sqf""";
};
the preinit
{if (speaker _x == "kor") then {_x setspeaker (selectRandom ["male01chi","male02chi","male03chi"]);};} foreach allunits;
but it dont work in game
kor is the faction voice in game
but they are on mute from the dlc and that i will change
Why isnt this working when i load in no error pops up the script just doesnt work (its in a initserver
You can add an event handler to units themselves, rather than looping over all units
T1 this etc. is invalid
I got the disable to work but yes
Thats 100% why let me fix
Also instead of writing code like that, you should learn to use loops and parameters
Also for your requiredAddons, just use "cba_main".
class Extended_Init_EventHanlders {
class CAManBase {
class ChinaKorVoice {
init = "..."; // then just do your check and set your speaker here
};
};
};
for example:
{
_x disableAI "MOVE";
_x addAction ["Recruit", "recruit.sqf"];
} forEach [t1,t2,t3,t4];
in "recruit.sqf":
params ["_unit", "_caller"];
[_unit] join group _caller;
or you could ditch the recruit.sqf because it's so small it's not even worth using a separate file for it:
{
_x disableAI "MOVE";
_x addAction ["Recruit", {
params ["_unit", "_caller"];
[_unit] join group _caller;
}];
} forEach [t1,t2,t3,t4];
since player cannot look around in the intro phase, can I somehow script his unit to look somewhere? Looking for an alternative to using separate camera
Okay i will check it thank you!
maybe you can switch to another temp unit, and use "doWatch" on the original player
oh because switchPlayer did not move the camera to the new unit right?
yeah it shouldn't, but even if it does you can use switchCamera
hey, anyone know why this doesnt seem to do anything?
[civ1, "ApanPknlMstpSnonWnonDnon_G01"] remoteExec ["switchMove"];
its being called in initServer.sqf and civ1 is the variable name of a civilian unit placed using the Eden editor.
Huh, strange, it "worked" but only after the civ ran like 300m away from where i placed him lol
try using 2 as the remoteExec target because now you are executing it everywhere
use the alternative syntax. it's better
[civ1, ["ApanPknlMstpSnonWnonDnon_G01"]] remoteExec ["switchMove", 2];
appreciate it. my code seems to work but with like, 10 seconds of delay which is strange but ill use the new code
though you dont really need remoteExec if its run at server anyways
How do i do that
How do i make my soldiers join my squad when i add an action
as he showed you
see his recruit.sqf
Ohh
Thank you
Didnt see that
But in the recruit.sqf i need it to be seperate
so i can actually choose what i want to recruit
They are separate
That script takes two parameters, the unit that should join, and the unit whose group should be joined
I need it to enable movement
and if i recruit one it would enable all movement
if i understand it correctly
No?
Ill do some testing on it later to get an understanding on it
All that script does is disable movement for t1, t2, t3, and t4. Then it adds an action to each unit to make them join the player's group
{
_x disableAI "MOVE";
_x addAction ["Recruit", {
params ["_unit", "_caller"];
[_unit] join group _caller;
}];
} forEach [t1, t2, t3, t4];
Ohhh
well you can add it to. I forgot
{
_x disableAI "MOVE";
_x addAction ["Recruit", {
params ["_unit", "_caller"];
[_unit] join group _caller;
_unit enableAI "MOVE";
}];
} forEach [t1, t2, t3, t4];
as Dart explained, the script disables movement for each unit, and adds an action to each one that makes that specific unit join group/enable movement
if that was true coding would be a nightmare 
is there a sorta best practice accepted way to get a list of units that knowAbout a given target, or even just a list of all west units that are currently tracked by any east unit trying to make something otherwise basic but requires switching on when they opfor can see any of the player units
I'm looking for information on how to create the little popup on the screen where you press the "H" key to get more information on something. Does anyone know what this is called, and where I can find info on how to add it to a mission?
It's probably this: https://community.bistudio.com/wiki/BIS_fnc_advHint
look for targets in the wiki. like https://community.bistudio.com/wiki/nearTargets https://community.bistudio.com/wiki/targets etc
Seems like that's it, I'll check it out, thanks.
Yeah saw that, but it's all verymuch a which targets does this individual group or unit have
No way to go the other way and ask given a unit/group which enemies can see it/have it as a target
Obviously I can loop all red AI groups within range and check them and build it manually, but mostly curious if there is a best practices way to do it as I have no clue which of the various ways to get targets are more performant etc
ok i see what you mean now, i guess there is no command to get the targets other way around
I need it so it will delete the action for each unit after i click recruit
Yes i know
but how do i set it in to the code
already made
(btw it works)
Look at the parameters it takes and the example of how its used
{
_x disableAI "MOVE";
_x addAction ["Recruit", {
params ["_unit", "_caller", "_id"];
[_unit] join group _caller;
_unit enableAI "MOVE";
_unit removeAction _id;
}];
} forEach [t1, t2, t3, t4];
Ive only used parametsers for disable group
Thank you
params ["_unit", "_caller", "_id"];
yeah correct. I forgot how it went
darnit you cant remove default Actions ah man
You can remove some from CfgActions, but that's config
oh ok isee its not that pressing that i do just wanted to know thx Dart
The best you can do with scripting is just disable some, but they're still visible
I'm looking to replace an element in an array within an array. You could probably do something like
_a = array1 select 1;
_a set [0,5];
array1 set [1, _a];```
but there's gotta be an easier way, right?
array1 # 1 set [0, 5]
how can i check to see if my mod ran its code? i have the mod compiled but the code either hasnt done anything, or it didnt load right
Just add a systemChat, hint, diag_log, etc.
i have diag_log at the first line of the functions that are supposed to run postinit. but there is nothing in the RPT file
im trying to find the cfgfunctions biki page but i cant find it all i can find is the config.cpp description page, and there is nothing there that is useful
Could you show what you have?
If you look in-game, are they defined in CfgFunctions?
Actually, your category path is wrong
It should start with a pbo path
I.e. like file = "\APSSupport\functions";
Also that's not how you use exitWith
It's just:
if (_condition) exitWith {};
should the functions show in the functions viewer or cfg viewer?
Both
OOPS.
Yeah that'd also do it
YAY time to debug my error vomit
one of the scripts is running without errors for once though... interesting
Well you still have spots where you're using exitWith incorrectly
that is literally the ONLY spot
Then the file wasn't saved, or some kind of similar issue

If you use VS Code, just make it save files on focus change
Other editors should have similar settings
sublime text
I'd poke around or do some googling
i like sublime for its regex stuff
is there a way i can check to see if an array is empty?
i used isnil and its throwing an error
If you want to check if a variable is nil (i.e. undefined), you'd put the variable name in a string.
An empty array isn't undefined though, so just check if the variable is equal to an empty array
if (_someArray isEqualTo []) then {
// ...
};
Also, local variables require an underscore at the start of their name.
A variable without a leading underscore will be saved to the current namespace (like missionNamespace, uiNamespace, etc.)
i thought the underscore made it private to the script it was created in, but i have two scripts running in paralell
Private =/= local
SQF is also entirely synchronous, your scripts aren't running in parallel
You should always make variables local and private unless otherwise needed.
private _someVar = 0;
so i have this section of script running on the server via a server mod. it doesn't work at the beggining of the mission, but it does work if the player quits to role selection,and then click ok again in role selection, to "rejoin the mission"
You should probably just wait until the game display is ready
Also:
- Just use CfgFunctions, there's no reason to just define your function as a global variable.
- Your function is also missing a prefix, this is handled for you by using CfgFunctions; but all global variables should have a prefix or "tag".
doneis a global variable in your script, which is likely unintentional.- If your goal is to run this code on each player that joins, why run it on the server at all? Just run it in something like an initPlayerLocal.sqf file from the missio
1: i had so many issues getting the mod to even load that i havn't gotten around to that yet.
i also have not figued out how exactly to call the functions from inside the init script. so i thats another hurdle
2: the done variable is a remnant that i wanted to keep global to be able to kill the while loop later on when a certain mission event happened. this is still very much a WIP
3: two reasons
the mission is MASSIVE and finding the right place to put these little bits of code has never worked for me, for some reason or another. whover made this mission left a boatload of errors that took me close to a month to iron out.
after i had debugged the mission, since it is shared among clients somehow, someone connected to my server, stole the mission and started poaching our player base. they were removed from the community shortly after.
The entire mission is downloaded to clients, this code is still available to anyone who downloads the mission
right, which is why i wanted the code i want to keep "mine" to be run from a server only mod via the command line option -servermod=
But that code is still available to clients
how? the server is still sending the mod to the clients?
or do you mean by the server making the code chunks global variables?
In order for you to remoteExec your function, the client has to have the function defined
You can't (shouldn't) send code over the network, you need to define the function on all machines and then use the name of the function as a string for the remoteExec.
[/*function arguments*/] remoteExecCall ["myTag_fnc_myFunction"];
Global =/= Public (i.e. synced across the network)
https://community.bistudio.com/wiki/remoteExec
in my case im useing example 5.
im just using the examples on the biki to my advantage. i understand there are issues with running code over the network, and my community is fine with the 1 second that it adds to their client load times.
my #1 goal is to protect this mod from the people that plagiarize my teams work, and remove any credit associated to the original authors and myself, to instead take it all for themselves.
how would i wait for that?
my #1 goal is to protect this mod from the people that plagiarize my teams work, and remove any credit associated to the original authors and myself, to instead take it all for themselves.
Then don't play Arma.
It is very easy for someone who knows what they are doing to rip stuff, you cannot prevent it entirely.
Wait until findDisplay 46 returns not-null
i could make it as hard as i can.
"As hard as you can" can be solved by googling how to open a pbo file
right but to do that they have to get the unpublished mod from the server to take it apart, right? is a mod that ONLY exists on the server transmitted to the clients?
No the mod itself is not downloaded to clients, but in you trying to protect it, you force yourself to send the entire function over the network. Anyone could add some mod to view the value of the function and see all of its code
if someone is going to hack it out of their client, there isnt any thing i can do about that. however its hard to steal the other half of the code that isnt broadcast over the network, not for this peice in particular, but for other functions, that dont transmit, they can rmain relatively safe.
Im looking to track (edit:) all buildings and add some event handlers to them. Im looking to mainly add them to actual buildings, but some extra objects is fine too.
Im looking at using XEH event handlers with one of these classes Static Building NonStrategic HouseBase
Any tips?
Which of those classes would be the best catch for buildings?
if you mean the static buildings in the map you should take a look here: https://community.bistudio.com/wiki/nearestTerrainObjects
definitely not that for the whole map. It lags out.
well if you use it only once it shouldnt be too bad
Any other functions that get terrain objects?
https://community.bistudio.com/wiki/nearestTerrainObjects
but with the proper filters
if it takes time, it's because the terrain is big
disable sorting for faster results
Another tip -- use markers within which terrain objects should be hidden.
So some objects cant be found?
what are your filters in nearestTerrainObjects?
right now nothing, pos is center of base, radius 500
and what cant be found?
the dome and the office/barracks building
are you running the code in the editor?
What code you really run
yeah the dome and barracks are definitely returned
Watching demon hunter, but i came back and was looking through it. I figured it out. It does return, but those buildings dont destroy when disabling damage effects using setDamage
Would it be possible to use setTerrainGrid so i can have no grass on a certain area but the rest of the map has it?
No, but you can try creating and moving grass-cutter object.
ok thank you
I believe you must leave the grass cutter there. example: sqf createSimpleObject ["Land_ClutterCutter_large_F", _pos, false];
Every object can be found
Maybe your radius is too small
^
Ah didn't see that
Thanks tho!
Anyone familar with ace_interact_menu_fnc_createAction that could sense check some code for me? Everything appears to work fine but im getting a undefined variable error for some reason
private _droneName = getText(configOf _drone >> "displayName");
if (local (_drone)) then {
[_drone, "", [], false] call bis_fnc_initVehicle;
};
if (isClass(configFile >> "CfgPatches" >> "ace_main")) then { //ACE Interaction if the addon is loaded..
private _action = ["gx_drone_pickup", format["Pickup %1", _droneName], "a3\ui_f\data\igui\rscingameui\rscunitinfoairrtdfull\ico_insp_hand_ca.paa",
{[_this#0, _this#1] call GX_fnc_drone40_pickup;}, {[_this#0, _this#1] call GX_fnc_drone40_canPickup;}, {}, [], [0,0,0], 2] call ace_interact_menu_fnc_createAction;
[_drone, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
} else { //Add vanilla option to pick up.
private _actionID = _drone addAction [
format["Pickup %1", _droneName], {[_this#0, _this#1] call GX_fnc_drone40_pickup;}, [], 1, true, false, "", format ["[_target, _this] call GX_fnc_drone40_canPickup;"], 2, false, "", ""
];
};
looks right to me.
Do you have an ace mod that comes with ace interaction?
That if statement should have ace_interact_menu instead of ace_main.
Your functions are correctly defined?
Ace add action ->
https://ace3.acemod.org/wiki/framework/interactionmenu-framework#33-fnc_addactiontoobject
I suppose its worth mentioning this error only shows when i load a scenario in editor with my drones placed down. This initialization code is called on postinit
And your own GX functions ?
Maybe you could debug that your functions exist (condition and statement)
And you can call in statement and condition just
{
call GX_fnc_drone40_canPickUp
},
My functions exist when i load into the game, as in the pickup action and conditions behave as intended, i suppose they may just not exist immediately when i load into editor or something?
with this called from where?
postinit of the class (drone) using event handlers
How do you add the postinit functionality?
postinit = "[_this#0] spawn GX_fnc_drone40_init;";
};```
Okay... so remove that
Thats in the vehicle definition, right?
Aye.
So this has a little bit to do with how CBA works. I suspect that code is getting called before CBA code is running.
Add your post init functionality as such. This goes in the base of your config.cpp file
https://github.com/CBATeam/CBA_A3/wiki/Extended-Event-Handlers-(new)#extended_initpost_eventhandlers
class Extended_InitPost_EventHandlers {
class Drone_Config_Class_Or_BaseClass {
class YourAddon {
init = "_this spawn GX_fnc_drone40_init;";
};
};
};
hello friends how To remoteExec a funtion from a addAction ?
There was good example
#arma3_scripting message
Ah, this is useful thank you! 🙂
cool thx ill check it out
So
[ARGS] remoteExec ["your_fnc_superevent", _targets, _isJip];
nice thx man @stable dune
If you are making a mod that uses CBA, you probably should not add eventHandlers through the vanilla vehicle EH config. It causes an issue with CBA and when ran alongside any CBA stuff, the run order is not what you would expect. One example is that vanilla cfgFunctions preinit does not run in 3den iirc, but CBA XEH preinit does.
From PabstMirror over in the ACE discord helping me with a similar issue:
if you write out the full inheritance, you can use vanilla EHs with no conflicts with CBA (not tested but I think this is right)
clas CfgVehicles {
class All {
class EventHandlers {}; // CBA adds XEH to this
};
class Thing: All {};
class ThingX: Thing {};
class ReammoBox_F: ThingX {
class EventHandlers: EventHandlers {
class myThing {}:
};
};
};
(or maybe even add ACE interaction from the config to skip this chicanery) 
Maybe I'll go that path, was mainly wanting to ensure this mod works without ace loaded and just wont run any of the ace compatability stuff
Assume doing it through config on vanilla will just ignore all the interaction bits included/won't error right
having ACE things in config when ACE isn't loaded doesn't break anything
(as long as it's not "actively calling ACE functions" things)
I get this error for this code gimme a sec
Something I did with one of my recent mods for that ace/no-ace compatibility:
#if __has_include("\z\ace\addons\interaction\script_component.hpp")
class ReammoBox_F {
class ACE_Actions {
class ACE_MainActions;
};
};
#else
class ReammoBox_F;
#endif
class Bax_DuffelBags_Duffel_Base: ReammoBox_F {
//config stuff
#if __has_include("\z\ace\addons\interaction\script_component.hpp")
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
class BAX_CheckOwner {
// ace action config
};
};
};
#else
class UserActions {
class BAX_CheckOwner {
// User Action config
};
};
#endif
};
don't randomly move "_id" in params to the right
https://community.bistudio.com/wiki/addAction calls for params ["_target", "_caller", "_actionId", "_arguments"];
?
I dont understand
Hey shining!
doc says that ID is 3rd argument (counting from 1). You try to get it from 4th argument in your code.
I dont understand anything
_actionId is always the fourth Param slot. By changing the order of params in your code, you tried to pass the _arguments parameter to be removedAction'd.
You can name it whatever you want, but the fourth param slot will always be the action ID.
So what do i do
#2nd/third, not "fourth"
do i just move it?
Aye, aye, arrays and all :p trying to keep it simple.
params ["_unit", "_caller", "_id"];, not params ["_unit", "_caller", "", "_id"];
Works ty
So this has a little bit to do with how CBA works. I suspect that code is getting called before CBA code is running.
It's not, they're overwriting the EventHandlers class so their object doesn't have XEH enabled, which ACE's interaction system requires
Oki I could use some help again
I'm working on a script to let players shoot missiles at ships and have it mostly working, however I'm using bis fnc livefeed to have a live feed pop up of the ship thats being shot at, since its a good bit away (around 2-2.5km) both the effects of the missiles hitting and custom emitters place by me arent rendering in the live feed camera, is there a way to fix that by extending the render distance via script or making the effects load in some other way?
bis fnc livefeed view:
actual view when nearby:
Maybe https://community.bistudio.com/wiki/preloadCamera ?
Never had to use it before, but may be useful
Random thought; if you spawn in an explosion with scripting, instead of relying on a player launched projectile, would that show through liveFeed?
Dont think so, I'm spawning in fire emitters and those dont load either
Mhh might be worth a try
is there a 3den command for a setting a object to be the cargo of another vehicle (vehicle in vehicle cargo: https://community.bistudio.com/wiki/Arma_3:_Vehicle_in_Vehicle_Transport)
I already tried using the regular ViV command and saving. Unless there is an additional special step after using setVehicleCargo, it does not work for 3den
doing this but with script instead of cursor:
so you mean moving it to cargo 'live' in 3den rather than just on init?
yeah
Let me rephrase though. there isnt a 3den command.
But how would I add a vehicle to a vehicles cargo in 3den via script?
I tried setVehicleCargo and then doing save3denInventory on them, but that doesnt work. (unless there is some other step i need to do)
How do i make a respawn mechanic for the player
By reading BIKI: https://community.bistudio.com/wiki/Arma_3:_Respawn
@cosmic lichen 
I tried searching it up
Doesnt tell me how
What you are asking is rather complicated, or at the very least is very tedious.
That wiki page has everrything you need to interface a new respawn system into a mission.
Biggest thing is respawn templates and onKilled and onRespawn functions
What is an id
Use base or instant
Idk what you are talking about.
Is it this?
It tells you in the 3rd column
I am so confused
so what exactly am i supposed to do
I put the code in the description.ext
maybe start with setting the respawn up in 3DEN's multiplayer attributes menu
Its fine since you are confused, but you are essentially asking us to write you the respawn system. You are going to have to trial and error this.
Oh
And yeah, if you cant figure it out, it took me a while too. Start with using 3den stuff
Good idea
Doesnt work
only works in multiplayer (duh)
How do i set it up in singleplayer
@frank lynx https://www.youtube.com/watch?v=zyLEt5kZwi8
oh right, i forgot about that. You dont 🙃 Singleplayer does not have respawn. It automatically ends when you die.
singleplayer does have respawn
Oh? ill have to look into that more then.
When i alt tab out of the game sometimes i cant go into the game again and i lose all my progress
hey im a bit new to arma scripting but could use some help.
first of all something really simple ive done before but since ive been on a new pc cant find it for the life of me.
i like to have local only markers for the zeus and cozeus (they have a defined variable name) OR a marker that is inviisble for everyone except the zeus and co-zeus.
second of all i have a trigger condition that is fully working except when the zeus crashes and theres only a cozeus, then he can only use the backup triggers, yes i can prob do another else, but im wondering if i can write it better (not a big priority atm)
(see picture for current code)
(And yes im aware its cursed to use the variable name ZEUSUWU)
(if this is the wrong channel for this dont be afraid to bonk me and point me in the right direction btw)
this does not work with mines, it is a common issue
does anybody have workaround ? don't want to re-invent a wheel
_zeusModule addCuratorEditableObjects [allMines, true];
not sure if its opart of zeus enhanced, but if i need to edit mines later i often right click the ground and then press add editibale objects in X range
that makes em pop up for me although its manual zeus labour.
an armed mine is a projectile right? and we cant have projectiles added to curator display, right?
my next question was that if it work with UXOs
was thinking to replace mines with *_script_ammo suffix, that zeus can interact with
tried with EZ, using this method does not work
side note: using AT mines, already armed
seems about to sum up problem I am trying to solve
found an answer to my first question,
doing this
_marker = createMarker ["markername", [4368.18,7044.96,0.00256538]];
_marker setMarkerType "hd_dot";
"markername" setMarkerText "You are here.";
works if put in init of the people i want to see the marker (this is painfully slow to do though but its fine)
if theres anyone able to help with the second question that would be lovely or have a faster way then this.
(the co-ordinates i can link with getpos varname of trigger so theres no issues there)
Yes.
Make array of units.
Use for each loop.
Create marker for every unit (_x) position.
well thats the only way i could find, again new to coding not smart, having to constantly change i think 4 variables as i need 50 of these markers
(making a 8 mission campaign and ill constantly grab and use what i need) so if theres a faster way i want it XD
in the most basic sense, use apply or forEach. Remember that markers need a unique name, so we make a name using the unit object.
private _myArrayOfUnits = [/* something */];
_myArrayOfUnits apply {
private _unit = _x;
private _markerName = format["BAR_UnitMarker_%1", _unit];
private _marker = createMarker [_markerName, getPosATL _unit];
_marker setMarkerType "hd_dot";
_marker setMarkerText format["%1", name _unit];
};
you can then expand it to add/remove markers if the unit is alive, or changes position or dead on a loop, etc
so this is the stuff i wanted to learn, i still dont know exactly how it works with that alone, could u explain it a little more?
(yes im that new to coding i was already proud of the trigger condition)
an array is like a list (or rather in other languages, a list is like an array lol)
what apply or forEach do is take all the things inside of that list, and "apply" the same code to everything in that list. in Arma, the specific thing it is currently doing work on in the list is represented by _x
then what does the private in that code entail and what needs to be done with the /* something*/
i think i get tge gist of the rest
C# example
string[] cars = {"Volvo", "BMW", "Ford"};
foreach (string car in cars)
{
// do the same thing to each of the cars, each car is placed in the variable "car"
};
also the text on each marker will be different and the location but the rest can stay the same (i can even make the name of the marker and the location the same using get pos)
hmm that i dont fully get ill be honest
ok... say we have a book with a bunch of chapters. a global variable would be one that exists in the entire book. a local variable in each chapter, a private local variable in each paragraph
honestly act like youre explaining this to a very dumb person
i like know what strings and booleans are and stuff like that but not much more
okay that i can get but how to manipulate it and how that works in that script is where im a little lost
start here and give it a good read, then let me know if you have any questions:
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
i will do that, thanks for all the help so far!
Hi all.
I wonder if there's a script I could use for this...
I'd like a MP script for use in a coop event where the script would look for any OPFOR/EAST units and swap their headgear from an array of headgear classnames?
I tried ChatGPT, and it made something, but it just spams errors in mission and I have zero clue what's wrong. I have no scripting knowlage. :S
What ChatGPT spat out.
// Define the array of Christmas hats
private _christmasHats = [
"Christmas_Hat_Stars_Wearable",
"Christmas_Hat_Plain_Wearable",
"Christmas_Hat_Reindeer_Wearable",
"Christmas_Hat_Mistake_Wearable",
"Santa_Beard_GE","Santa01_BeardHair_GE",
"Gold_Beard_GE","Grey_Beard_GE",
"Christmas_Hat_Side_Wearable",
"Snowman_Hat_Wearable",
"Snowman_Bucket_Wearable",
"Snowman_Enemy_Wearable",
"Snowman_Hat_Wearable_M",
"Snowman_Bucket_Wearable_M",
"Snowman_Enemy_Wearable_M",
"Turkey_Helmet_GE",
"GreenHead_GE"
];
// Function to replace headgear for OPFOR units
private _replaceHeadgear = {
params ["_unit"];
// Check if the unit belongs to the OPFOR side
if (side _unit == east) then {
// Remove the current headgear
removeHeadgear _unit;
// Select a random hat from the array
private _randomHat = selectRandom _christmasHats;
// Add the new headgear to the unit
_unit addHeadgear _randomHat;
};
};
// Add an event handler to process each unit upon spawn
// Works with multiplayer-compatible spawning events
"remoteExec" addEventHandler ["EntityCreated", {
params ["_entity"];
// Check if the entity is a unit (man class)
if ((typeOf _entity) in ["Man"] && {isPlayer _entity == false}) then {
// Delay for script execution to ensure unit is fully initialized
[_entity, _replaceHeadgear] remoteExec ["call", 0, _entity];
};
}];```
Is there any difference between some vehicle turrets ?
Test with "Armed blackfish": I can manipulate the turret [1] but not [2]. 
TestEFEH = addMissionEventHandler ["EachFrame",
{
_allCurrentMuzzles = (vehicle player weaponsTurret [1]);
{(vehicle player) setWeaponReloadingTime [player, _x, 0.01]} forEach _allCurrentMuzzles;
}];
Just use forEach
Apply should only be used if you want make changes to the array and have a new array returned
Don't use ChatGPT, it is comically bad at writing code.
Also
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
I'm aware of that, but in a few cases it has managed to make me a simple script here and there that worked, so I gave it a try.
You could use something like this in an initServer.sqf script.
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
if (_entity isKindOf "CAManBase" && side group _entity == east) then {
_entity addHeadgear (selectRandom _christmasHats);
};
}];
What it gave you is complete garbage
THANKS!! I'll give it a try as soon as I get to my PC
Just define _christmasHats in the event handler as well, I wasn't going to write out that huge list on my phone
OK. Thank you a lot man. If you ever have any 3d modeling/texturing questions I can help you, but with coding...I'm useless.
how can I make a Zeus' "camera" trigger dynamic simulation? Is it even possible?
Anyone here familiar with the Support Provider: Supply Drop module?
random question but is there any reason not to use remoteExec assuming theres nothing you want done locally?
Wastes time checking if the target is local if what you're doing is already local to what you want
Why write out a remoteExec(Call) if it's not necessary
Also not every command needs to be run locally to whatever object, if the object can be remote, then you waste time sending it over the network
alright so just performance?
Performance and remoteExec spam looks bad
Anyone happen to know if theres a local version of createAgent?
https://community.bistudio.com/wiki/createAgent
Looking to reduce as much possible network as I can, and I know environment like rabbits/snakes etc are all local agents, but cant find a way to manually do something similar. createVehicleLocal won't work for what I want due to it requiring the use of setDestination or similar.
makes sense. im just slow asf when it comes to locality lol its taking me forever to learn how it works fully
Well snakes can drive vehicles it seems... But I still can't create a local agent without ambient life 
is it possible to check if a player is an admin/host of a session? im trying to make an addAction only show up for admins/hosts
https://community.bistudio.com/wiki/admin must be used on server
i tried call BIS_fnc_admin == 2 but that doesnt seem to work
so admin clientOwner == 2 in the addAction's condition?
nope you can't do it that way with the engine command because the command only works on the server, and actions are local client
what is BIS_fnc_admin returning for you (this one is local for clients)
lemme check rq
0
that was done in the debug console on a locally hosted server where i am the host
BIS_fnc_admin uses serverCommandAvailable, specifically #logout and #exec which is not available for listen servers.
ah i see
attach invisible unit to it would be my only idea
so instead, make your own function that uses something that is available to Server Hosts, like #kick or something
If that doesn't work for any reason, the extremely ugly option would be to run a loop that periodically gets nearby units and turns off dynamic simulation for them (and turns it back on for non-nearby units)
If I put !alive ["a", ... "f"]; into the "Condition" section of a Trigger, will it trigger if any variables a through f are dead? Or will it only check when ALL of them are dead?
It won't run at all, because alive doesn't take an array
Especially not an array of strings
Oh okay, thanks
It you want to filter a list of objects by checking if they're alive, then you'd do something like:
private _aliveObjects = _objects select { alive _x };
why the hell would you use ChatGPT when we have guys like Mr Dart around, hes my ChatGPT all day long WooHoo Arma 3 Yeah
thx you again Mr Drat love you man
my game works so good because of you
and some others too
or should i say my missions
Question is to what do I actually have to attach it? What's the variable name for Zeus's camera? In editor I recall it's attached to some floating helper orb but couldn't find anything more about it
Did you try https://community.bistudio.com/wiki/triggerDynamicSimulation on the camera ?
I don't think camera has any side and it is not a player unit, so it won't trigger anything but I'll try
Ye doesn't work, tested it real quick.
Is there a way to set ui control idc via script?
i dont think so , only if you create the control via script
But I assume if you create a dummy unit and move it to the camera you can use that command on the dummy
Hey guys. Is there a way to have a vehicle driving down the road and when it reaches a certain marker you teleport it via setpos to another location while its direction and speed remains the same?
_oldDirection = [vectorDir _veh, vectorUp _veh];
_oldVelocity = velocityModelSpace _veh;
_veh setPosASL _newPosition;
_veh setVectorDirAndUp _oldDirection;
_veh setVelocityModelSpace _oldVelocity;
That should do it.
The script should run on the owner (driver) of the vehicle's machine, for best results.
how can I make it "stick" to the camera? sqf private _zeus = curatorCamera; cmdr attachTo [_zeus, [0, 0, 1]] freezes it at a last position rather than keep it attached. Is there a different object I should be attaching the unit to or do I have to onEachFrame it?
I guess onEachFrame it is then:
onEachFrame {cmdr setPosWorld getPosWorld curatorCamera;}
(Using the EachFrame mission EH is better tho)
Indeed attachTo is slightly slow so you really need to do it manually/each frame
this causes the unit to not trigger the dynamic simulation anymore 
Did you check if the unit is actually there?
what do you mean? I can see unit's shoes right on my camera object
enemy AI is definitely shooting at "me" so the unit should be where the camera is. It does not trigger the simulation anymore though
No clue why it doesn't work anymore then 
What if you try another command? Try attachTo again
addMissionEventHandler ["EachFrame", {
private _zeus = curatorCamera;
cmdr attachTo [_zeus, [0, 0, 1]]
}];``` this loop works
Well try the code in the EH in debug console to see how fast it is
If it's fast enough you can keep it
If not try other commands too. Such as setVelocityTransformation and setVehiclePosition
👋 I have a follow up question, any chance you know of a way to raise/lower the turret thats compatible with that command?
Why not use this command to target something lower/higher?! 😅
Or do you mean how to do that?
It doesn't seem to want to go lower 
Just shoots in a straight line, should be within turret depression range I think
Last I checked it was working properly.
Which turret are you using?
Him defender, the big chonky NATO SAM
Also you use alt syntax right?
I mean this syntax:
vehicle lockCameraTo [target, turretPath, temporary]
Yeah should be
_pie_launcherLeft lockCameraTo [_pie_destroyerTarget1, _pie_launcherLeft unitTurret (gunner _pie_launcherLeft), false];
Target entity is an invisible target added by CBA
CBA_O_InvisibleTargetVehicle (Pie_Destroyer_Target_1)
Dunno. It should work. Try supplying its position instead to see if it makes any difference
A_pie_launcherLeft lockCameraTo [aimPos _pie_destroyerTarget1, _pie_launcherLeft unitTurret (gunner _pie_launcherLeft), false];
Oh wait
the HIM defender actually just has much less depression than I thought I remembered
like practically none at all
Thats on me then 😅 , thanku still though <3
I guess I could try EH'ing it and deleting the real rocket and replacing it with an angled one in some form or shape, but I'm props just gonna try to raise the ships and hide it 😄
Can I find out the ID of the event being called inside BIS_fnc_addScriptedEventHandler?
_thisEventHandler is an undefined variable
I find _thisScriptedEventHandler in chat history
wiki agrees https://community.bistudio.com/wiki/BIS_fnc_addScriptedEventHandler
code: Code or String - the code that is executed when the EH fires. The magic variable _thisScriptedEventHandler can be used to access the event handler ID within the code.
Anyone have any clue why these actions are not showing up on a dedicated server?
skipTime (5 - daytime);}];
this addAction ["Sleep until Midnight", {
skipTime (24 - daytime);}];
```
Im setting up a zeus module that needs to be ran on an entity.
I know I set this in config: curatorCanAttach = 1;
how do I get the unit I placed the module on? is the unit synchronized to the logic? The config says attach so would I use attachedTo instead of the syncObjs command?
https://community.bistudio.com/wiki/Modules
addAction is local effect, running it on a server won't do anything
this version runs just fin
call{this addAction ["Talk", {hint format ["This is what will be shown in the hint"];}, [], 6, true, true, "", "", 6];}call{this addAction ["Talk", {hint format ["This is what will be shown in the hint"];}, [], 6, true, true, "", "", 6];}
is there something im not doing in the first that i should bed oing?
is that in the object init?
Yes
Thjis too right?
What do you mean it isnt showing up on a dedicated server? object inits run for every person, so this should unless you are doing something to block it.
A dedicated server also isnt a player and cant see/use an action, so do you mean self hosted?
Yeah it is, I'm not doing anything to block it. When I pls see the object on a server I can't view it as a player
It's driving me nuts lol
Is this object being placed in the Editor or as a Zeus saved composition?
The difference is important.
For Editor-placed objects, the init field runs on every machine, so the action will be added on every machine.
For Zeus-placed objects, the init field only runs on the machine that did the placing, so the action will only be added for the Zeus who placed it.
oh my god i feel like an idiot
i knew that
Try a little dash of if (local this) then { and remoteExec
Thank you!
okay this is drving me crazy now - the time will change, but then immediately change again
I split the commands across 2 seperate items to see if it would help andhad no change
https://community.bistudio.com/wiki/skipTime
skipTime requires server execution. If you execute it on a client (i.e. the client that activates the action) their time will change locally, then immediately be overwritten by a sync message from the server.
The action should remoteExec skipTime with target 2.
God bless
How do I make a module show up in zeus?
Create a config for it and make sure you set the scope correctly iirc
Like in the spawn menu? Its scopeCurator config attribute, I think.
In the world after script-spawning it? addCuratorEditableObjects, probably
* some modules auto-delete themselves rather than persisting, so the second one might not always be possible
thanks
this addAction "Sleep until Dawn"; remoteExec [skipTime (5 - daytime), 2, true];
im doing something wrong here i know it
Yes, several things
I want to smack my head looking at that
Yeah.... i was live editing that as i was looking for code errors....
That's not how remoteExec works
if (local this) then {
[this, ["Sleep until dawn", { [5 - dayTime] remoteExec ["skipTime",2] }]] remoteExec ["addAction", 0, true];
};```
some days i feel really stupid trying to understand sqf
thanks @hallow mortar
_leftArgument command _rightArgument;
[_leftArgument, _rightArgument] remoteExec ["command"];```
hey im trying to make certain slots in my multiplayer mission have different loadouts, is there a good way of doing this? i tried this but it doesnt seem to work for the trainer (works fine for the trainees though):
trainer = objNull;
{
[_x, "loadoutTrainee"] call BIS_fnc_addRespawnInventory;
} forEach units trainees;
if (alive trainer) then {
[trainer, "loadoutTrainer"] call BIS_fnc_addRespawnInventory;
};
trainer is the variable name for a unit placed in the eden editor.
Well... You are making trainer now reference a null object
So it's always going to be not alive
thanks for all the help, and with a bunch of reading, trying failing, and just a tiny bit of chat gpt (i put the for each before the code not after for example cuz im very smart)
i ended up using this, as i always use the same name formatting for my triggers and all i needed now where personalised markers for the zeus only on the debug triggers (these are always trigger one or trigger 0 for me) this makes me only have to put in the names once for each marker.
very glad i went here earlier to ask help!
{
_name = _x;
_markerName = format ["%1marker", _name];
_triggerName = format ["%1trigger1", _name];
_trigger = missionNamespace getVariable [_triggerName, objNull];
if (!isNull _trigger) then {
_marker = createMarker [_markerName, getPos _trigger];
_marker setMarkerType "hd_dot";
_marker setMarkerText _name;
};
} forEach ["Ditolak", "Hijausub"];
Hey guys, I am trying to setPosATL of an object on a memory point located within the players weapon.
Is there any way to have it reference a memory point on the weapon and attach it to the memory point or only on memory points of the unit itself,
For example attaching a helper item to the rifles muzzle.
No direct way.
- fetch the weapon P3D
- create simple object
- check simple object's memory
- use it
so theoretically I could make an invisible simple object, with said memory point, then use that for setting position?
That literally is what I suggested, yes
But wouldn't that simple object also need to be attached to the player anyway
You can offset it and just attachTo
I'm using this script to make an ACE "missile" follow the correct ballistic path of a shell when fired out of artillery. Works fine In local testing, but in use on a MP server, its causing the round to explode immediately. Any ideas as to why? I've doubled checkd most of it, nothing looks like its falling into the issue of local/remote issues
_ammo = _this select 4;
_gun = _this select 0;
_laserCode = [_gun] call ace_laser_fnc_getLaserCode;
if ( _ammo == "habfuze_155mm_m712") then {
_mode = _this select 3;
_projectile = _this select 6;
_carrier = "Sh_155mm_AMOS" createVehicle (getPos _projectile);
_projDir = vectorDir _projectile;
_carrier setVectorDir _projDir;
_carrier setPosWorld getPosWorld _carrier;
_initialVel = velocity _projectile;
switch (_mode) do {
case "Single1": {
_carrier setVelocity (_initialVel vectorMultiply .19);
_projectile setVelocity (_initialVel vectorMultiply .19);
_projectile attachTo [_carrier];
};
case "Single2": {
_projectile setVelocity (_initialVel vectorMultiply .3);
_carrier setVelocity (_initialVel vectorMultiply .3);
_projectile attachTo [_carrier];
};
case "Single3": {
_projectile setVelocity (_initialVel vectorMultiply .48);
_carrier setVelocity (_initialVel vectorMultiply .48);
_projectile attachTo [_carrier];
};
case "Single4": {
_projectile setVelocity (_initialVel vectorMultiply .8);
_carrier setVelocity (_initialVel vectorMultiply .8);
_projectile attachTo [_carrier];
};
case "Single5": {
_projectile setVelocity (_initialVel vectorMultiply 1);
_carrier setVelocity (_initialVel vectorMultiply 1);
_projectile attachTo [_carrier];
};
};
[_gun, _projectile, _carrier, _laserCode] spawn {
_projectile = _this select 1;
_carrier = _this select 2;
_laserCode = _this select 3;
waitUntil {
_spot = [getPosASL _projectile, velocity _projectile, 70, 2000, [1500, 1550], _laserCode] call ace_laser_fnc_seekerFindLaserSpot;
!isNil{_spot select 0}
};
_newVel = velocity _carrier;
detach _projectile;
deleteVehicle _carrier;
_projectile setVelocity _newVel;
};
};
}];```
I'd rather you come here than chatgpt. While it may be okayish for other languages, it is very poor at sqf. (Small sample size and majority of public code is kinda crappy for it to learn from)
And SQF is cursed in of itself
yeah i just use it from time to time to figure out stupid spelling mistakes or other small mistakes
wich in this case was only the for each needing to be at the end of thee script and me missing a bracket
anyone got a sample code for a simple 3D Hint? It's been used in a few Reaction Forces missions (Air Control FOB - recruitment terminal, arsenal ect.). I've been beating my head against the wall trying to recreate it. There appears to be no documentation on functions required for it on BIS wiki.
still far from the end goal but at least it's on the right track.
That's what syntax checkers are for, why would you ever use Chat GPT to check syntax
is the 2nd example on vectorAdd wrong? if not, can someone explain to me why there is an additional 0 in the array?
especially when further down:
if i was more knowledgeable about coding in general i would most likely agree
the reason im doing it is becouse rn i dont know any better as im still new and have no clue about everything thats available, i use notepadd ++ and while doing so sometimes ask an ai to print out whats written to check for rookie mistakes that a rookie as myself will make a lot of
aka im using it becouse im not knowledgable yet
aka im dumb
thats why im learning
Just use something that's going to actually check for basic syntax mistakes like missing brackets or quotes
I think it was because at first, vectorAdd was planned for 3 items array only
example further down might be wrong indeed - (can you please check? :3 so I can fix)
notepad ++ does that but when i misplace one (so it still exists) i sometimes fail to spot that, or know ehre to start and end
if you have good suggestion on what i can use besides notepadd++ i would love to hear it
I personally just use VS Code
ill take a look at that
VSCode + SQF plugin = wonders
It has a lot of nice extentions, including a couple arma specific ones like HEMTT's VS Code extention and some SQF languages as well
hummm
thanks!
looks like the example is wrong
Fixeded! thanks
First provides some information on SQF commands when hovering over them and lets you view PAA files in VS Code
Second gives you an SQF "language" in VS Code for stuff like syntax highlighting.
Third adds a keybind (Ctrl+Alt+R) to open your last RPT file
this is very helpfull, ill take a look at it next time i work at my mission
i dont even know what a PAA file is XD
im mostly using scripts to safe on general performance when mission making and automating some tasks.
for example when i spawn garrisons theyre nearly all the same code and enemies, just locations are different so those are the only ones that need to be defined.
and when theyre on a trigger it takes less resources then me zeusing 3 areas ahead so i cna place things where i want them to be or have them invisible and make them visible later
but again thanks for the help, ill take a look at vs studio, its prob gonna work a lot better then doing things on the notepad and then asking an ai to print it out to see if i missed something
PAA is a texture file
VS Code
Visual Studio is a different program
aaaah makes sense
yes i know, but notepad++ was very limited in some regards, so anything is welcome
Correct, I'm saying that VS Code and Visual Studio are very different programs from each other
VS Code is a text editor that has plugins for many languages/
Visual Studio is full IDE meant for more "traditional" programming languages (and also one that I can't stand personally).
i love how it just pops up the wrong one immediately even though i google for vscode
Originally meant for working with positions, so would convert 2D to 3D for safety. Changed in 2.14 when the vector commands gained the ability to work with any array size.
Can I do "" if I don't need a parameter? Or is it better to do select?
_curTime params ["","","","_hour","_min","_sec"];
(I know dayTime is a thing, but I wanna get irl time for something xP)
Yes, you can do that
then I remember selectRandom is a thing
oh- hmm- I wonder if this is gonna run too late and it'll just blow up xP
I wanna have a game logic and I sync items to it. Selects random items to make be present, the rest are not. Current thinking, have them all synced and then it just removes all be 1-
Maybe I could use eden presence thing? idk how tho-
Maybe synchronizedObjects with selectRandom
Start with simulation disabled so nothing explodes, then you have all the time you need
@winter rose additional examples might be good using a 3 value vector as the receptor side and adding 2 and 3 value vectors to that to clarify on what Nikko just mentioned
wait, aren't there already examples like this?
Is there any way to retrieve a returned value from a spawned command?
You could put the command in a function, and make the function save the return to a variable, and then spawn the function.
or make the spawned code set a global variable 🙂
Specifically talking about a returned value, Ill take that as a no. I was just asking because there was a comment about returning a value in a spawned function on the modules wiki page.
Why would it be good practice?
spawn returns the script handle
to not return nil's i guess
ugh idk to have your functions return something , looks good 😉
There's nothing technically preventing someone from using call with that function instead of spawn (it would be incorrect but not impossible to do). In that case, the return value could matter (not much, but in theory). That's what that's about.
Fair. As personal practice, any function I need spawned, I always add
if (!canSuspend) exitWith {
_this spawn bax_fnc_function;
};
Could cause some confusion, but this is usually for my own internal functions.
null=[]spawn {
Jack sideChat "Hi there";
sleep 1;
Jack sideChat "Thanks for finding me";
sleep 3;
Jack sideChat "Santa crashed just North-West of here, but I'm guessing you guys already found that crashsite";
sleep 5;
Jack sideChat "I got captured trying to stop that bastard";
sleep 2;
Jack sideChat "He is trying to indoctrinate those little children with those communist ideas of him";
sleep 5;
Jack sideChat "He and his little goons placed some presents in the villages around here";
sleep 6;
Jack sideChat "We have to destroy those presents before those children open them";
sleep 5;
"VillageOne" setMarkerAlpha 1;
"VillageTwo" setMarkerAlpha 1;
"VillageThree" setMarkerAlpha 1;
Jack sideChat "I'll come with you and help fight those commies off";
sleep 1;
ATLAS sideChat "Your maps are updated with your new tasks, help Jack Frost to the best of your abilities";
};
So I ran this code in an operation. I didn't run it due to planning interferance, but the running zeus told me the dialogue would only get triggered for one person only?
This code was put into a trigger, one activated with radio and the other with player activation.
This is only one of the codes but it follows the same principle
Does anybody know what went wrong?
sideChat has a local effect; meaning it only appears on the machine that called that command
Ah, do you happen to know the global one?
(also, what if Jack dies, the markers will still appear 😜)
That is a problem I realised when the op was already running ;-; But yeah easy fix, lmao
I would do a quick'n'dirty
{
if (not alive Jack) exitWith {};
_x params ["_text", "_delay"];
[Jack, _text] remoteExec ["sideChat"];
sleep _delay;
}
forEach
[
["Hi there", 1],
["Thanks for finding me", 3],
["Santa crashed just North-West of here, but I'm guessing you guys already found that crashsite", 5],
["I got captured trying to stop that bastard", 2],
["He is trying to indoctrinate those little children with those communist ideas of him", 5],
["He and his little goons placed some presents in the villages around here", 6],
["We have to destroy those presents before those children open them", 5]
];
if (not alive Jack) exitWith {};
{ _x setMarkerAlpha 1 } forEach ["VillageOne", "VillageTwo", "VillageThree"];
[Jack, "I'll come with you and help fight those commies off"] remoteExec ["sideChat"];
sleep 1;
[ATLAS, "Your maps are updated with your new tasks, help Jack Frost to the best of your abilities"] remoteExec ["sideChat"];
improvable on the network side, but this will definitely work
That looks a lot more advanced than I did it xD, but thanks a lot. Ill analyse the code and put it to good use
question, is there any way to directly add a magazine to a launcher?
You asked in ace too but might as well:
https://community.bistudio.com/wiki/addWeaponItem
woops, didnt see your response
It's fine, I just posted it in both
Hey folks, I have a question about the "namespace getVariable / setVariable" functions. I have a mission template with a rather large amount of public variables and I was hoping to reduce the network traffic in a way that, the variables are known on the server and the players only get the variables they need when they need them, and not all of them.
So, this is setting and getting a Variable that is limited to the namespace. Depending on the locality of the namespace it differs where the variable is known. For example
player setVariable ["test",true];
is only known on the Players machine. If the code would be executed on another players machine, it would be in this players namespace.
So far, so good. But what is with global namespaces like missionnamespace.
When using a setVariable on missionnamespace I would think that when I use getVariable on missionnamespace on another machine, I should get the valua from setVariable.
Example:
//in initServer.sqf
missionnamespace setVariable ["test","This is a test"];
//in script on a players machine
missionnamespace setVariable ["test","Haha, no test"];
//in script on another machine
private _result = missionnamespace getVariable "test";
hint _result // Should show "Haha, no test"
Is that how it works? And if so, why is there a public parameter for the setVariable command?
Is that for the case when you use the namespace of an object that is on all machines and would promote the parameter to all other machines where this object exists?
Sorry if this is somewhat of a noob question but I really would like all your input on this.
You still need to make a variable global if you want to have the same data on every client.
//in initServer.sqf
missionnamespace setVariable ["test","This is a test",true];
Okay,
this would suggest that every player/machine has it's on instance of missionnamespace from the start of a mission and when it changes overtime, this also needs to be propagated through all the network?
This would mean there is no benefit from using
missionnamespace setVariable ["Test",Testvalue",true]
over:
test = "Test Variable";
publicVariable "test";
Is that correct?
Not a big difference i guess, in depth only a arma dev can answer that.
If you want to reduce network traffic you can use this for example in certain cases.
player setVariable ["VarName",_object, 2];
This will only set the var on the server and not on all other clients.
you can object setVariable ["name", value, true]; which isn't possible with publicVariable. You have way more convenient granular control for when you don't want to make stuff public to everyone.
@sharp grotto Okay, thanks, I didn't think about that.
@south swan
Yeah, okay, so that is the real advantage of using setVariable / getVariable.
Okay, then next question (I'm sorry 😬 ):
Could I optimise the sheer amount of publicVariables in another way. Would ther ebe someway to create Variables on the server and then let the players get only the variables over network when they need them?
I know there are Mission Config Values that I could get via getMissionConfigValue but I always feared that this would be more performence heavy.
I always feared that this would be more performence heavy
It really shouldn't. At least ingame. Because config cannot be updated ingame but only in its initialization stage (even before init.sqf etc)
You could also make a network function and send the data via remoteExec, but i doubt it has an advantage.
Only if you really hit the "JIP queue threshold" were it starts to affect the server, then you would probably profit from that.
#perf_prof_branch message
Even if there is an advantage, you cannot really see how better it is
Okay, so you also would recommend trying this with missionConfigValues instead of publicVariables? To clarify, we are talking about some 600 to 800 values.
At that amount, I would suggwst to use config.
You can also define those vars in a sqf file that you call in pre init. That way you don't have to worry about the performance either.
(I'm assuming you're talking about constant variables)
Okay, that sounds also good. Didn't know you could do this. How would I create these variables "pre init" ?
What exactly do you need it for? Why you want to have a var preinit, over a network?
This is also important to know yeah
You mean like why pre init or why variables at all?
-
Pre Init: I dont want it, it it was just suggested as alternative.
-
Why Variables: Configuring a role dependent loadout system for players in a mission.
Well, next question is, do you need it dynamically (aka does it really needed to be synced over network)
No, its just configured once and then the players machines only need to read the configurated values.
Then you can maybe use config or even init.sqf etc
Okay, I will switch from the public variable solution to config.
Init would be overload as the players only need like 20 or so variables from the config but should be able to switch dynamically.
"Just" declaring a variable won't lag anything, too
I thought so as well but I had a few missions on different dedicated servers where a variable, even though I used "publicVariable" was not changed on the server. I was thinking that might be because of the large use of publicVariables in my loadout system and wanted to explore other possibilities
config is worse than defining a global variable
Not sure where to ask this but uh- Why are my screenshots like this? The sky isn't right 😅
wait-
oh- right- ignore me, I forgot the command does transparency
screenshot? It shouldn't though
?
what- wait what file extension should it be?
screenshot (_picName + "_1.png"); gives a transparent image. And that'd be fine, except I just realized if it's a night shot- well it isn't fine xP
err
what it's supposed to be
same thing on stratis
Is it actually transparent?
There's a longstanding issue with screenshot where it uses incorrect gamma values, resulting in the image being much brighter than it should be.
wait-
PPAA
Disabled gives it a transparent background. Otherwise, it actually renders the haze (Or whatever xP) on the sky
Well that sounds like an issue
indeed
This isn't a transparent image. Part of the terrain is transparent, the image is not.
No, the sky
It's generating the image with the sky as transparent
Unless a cloud is blocking
these are the same image, but one, in paint dot net, I made a background layer that's full white, and the other full black.
So I'd need to do some color corrections to make up for the fact PPAA makes it a little brighter.
same image, but with one having disabled (and white background to see transparency) and the other having PPAA not disabled.