#arma3_scripting
1 messages · Page 40 of 1
oh
Oh right -- I assume you just run it as scheduled if it's a slower script?
It'll still run top down etc won't it?
top down?
line by line
everything always runs line by line
unless you're talking about a spawn in which case no, what you spawn runs on its own
the spawn itself runs there tho
it just adds the script to the scheduler and moves on
The script inside of the scheduler will get run line by line though right?
yes
i.e I don't need to worry about variables not being present yet in the next line of code
I don't think you understand what the scheduler is
it will pause every 3ms (?maybe more? i dont remember) for the next script in sch to run tho
or what schd vs unschd is
sch is a list of scripts waiting to run by engine, they let you pause because they work in time frames
basically
un sch is:
"do it now please, no buts"
Oh right
im sure Leo can give a more indepth explanation, im not versed enough to explain at detail
you already mentioned the important parts... 😅
this part is what I want to stress more tho
a script taking longer than 3ms will be suspended in the current frame and waits for its next turn in future frames
which is why I said use schd env
if that code containing the findIf check was gonna take a long time it would cause jitters when you run it unschd
but when it's schd the engine won't let it take that long and the FPS won't be hurt
tho your script will take longer to run
if the scheduler already has several other slow scripts it might even take several seconds before it can cycle back to your script
I'm also gonna drop this here in case you want to refresh your info:
https://community.bistudio.com/wiki/Scheduler
How would I stop a RscVideo from playing when the player closes/exits the gui?
yes, always consider your profiled times for performance to be the best, sch environment will always delay them and add substantially according to how busy it is
So worst that'll happen is player'll take a short while to go from covert to overt?
It also won't take longer than 3ms with a reasonable amount of AI but is definitely worse performance than I'd like in unscheduled
On the other hand my CBA settings seem to have just disappeared now 
yeah
probably because of when you did the perf checks on spawn (or PFEH)...
I'm adding them via preinit/postinit in config
https://community.bohemia.net/wiki/BIS_fnc_playVideo#Example_4
see how that function does it
oh you mean YOUR CBA settings
try running them manually during the mission
Yeah, the ones in addon options etc lol
neither preinit nor postinit is working which is slightly confusing as I've not changed anything there 😅
Tbf I've probably made a syntax error somewhere
if that still doesn't work maybe your profileNamespace or CBA settings in general are corrupt
Should probably figure out what's wrong with it because that was stopping my other mod from working in editor which would be pretty useful lol
Ah, rogue " 😐
is there a way to show cinema borders without the official function. i want players still be able to move around
_unit limitSpeed (-1 * (_unit getSpeed "SLOW"))
above code now makes units walk backwards. it didn't used to, right? and helicopters fly backwards?!
So you're setting the limit speed to a negative number and they're going backwards? That's hilarious. I would've thought it'd go to 0
Yeah for sure it used to be reset limit for values <= 0
That's what the page says
it's not just dev branch either =D https://youtu.be/j2aBsf6XmIE?t=106
Hello everyone, I would be glad if someone helped me with some scripts
the goal is for the script to spawn opfor ai group on 3 different markers (random marker) whenever blufor causes civilian casualties.
I have this on loop
while {true} do {
TAG_StartingRespawnDelay = 5;
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer"];
if ((side group _killed == civilian) && (side group _killer == west)) then {
[] call fn_spawnaigroup;
hint "The police caused civilian casualties! Expect more civilians to join the insurgents!";
trg1 = true;
};
}];
};
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
thanks
and you don't need to add an Event Handler in loop. Just once is enough.
dead
in case you have previews disabled
while {true} do {
TAG_StartingRespawnDelay = 5;
{
params ["_killed", "_killer"];
if ((side group _killed == civilian) && (side group _killer == west)) then {
[] call fn_spawnaigroup;
hint "The police caused civilian casualties! Expect more civilians to join the insurgents!";
trg1 = true;
};
}];
};
Thanks man
Let me try this then
question is it better to just add this in init or create a loop.sqf instead?
you don't need to add an Event Handler in loop. Just once is enough.
Event Handler is basically "run this code every time X happens". You add the same handler multiple times - it gets executed as many times. You add it inwhile {true}loop - you crash the game :3
Oh! thanks!
no wonder fps went to hell
okay I placed it on initServer instead
for some reason the hint wont show after killing civilians, so I don't think it would also call my function
this doesn't add Event Handler at all
TAG_StartingRespawnDelay = 5;
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer"];
if ((side group _killed == civilian) && (side group _killer == west)) then {
[] call fn_spawnaigroup;
hint "The police caused civilian casualties! Expect more civilians to join the insurgents!";
trg1 = true;
};
}];
};
this is what I put in my initServer
is it just bug or did I overlook something
is it called exactly "initServer.sqf"? No ".txt" in the end?
yes
are you running it in editor or, say, on dedicated server?
define "on mp", please
just lan server?

you really do have extra }; in the end here. It can break stuff
LMAO thanks, I keep missing a lot of stuff
let me try again
sad, the hint wouldn't show even tho when I try it on debug console it seems fine
Break is a thing
What does "now" mean. Now compared to what? Is it a new thing on dev or profiling?
well, you came here talking about caching so I expect you to know 😄
but, basically: use dynamic simulation for most of the things
use simple objects for what is possible to use
disable simulation of other objects if you feel that it saves performance, and not for "doing everything perfectly"
download the vsc extension for shortcutting to your arma3.rpt (the log file).
and check the file regulary for errors thrown, you can't always see it in the game.
can find the file in C:/Users/yourName/appData/local/Arma3 i think
thanks!
also it turns out my script works just fine
it's just that for some reason my script doesn't see the civilians spawned by alive as civilians
it had to be editor placed
does anyone have any idea how to make the script work alive civilians?
Init EH for civs
Or
Triggered when an entity is created.
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
If (side _entity = "civ") then
{};
}];
without knowing the missioneventhandler:
you are adding the EH at mission start, so it (probably) gets assigned to all existing units at that point.
if anything is spawned later, it wont receive this EH.
So you need to add the killed EH to any units that are not editor spawned.
"So you need to add the killed EH to any units that are not editor spawned."
Sorry for being incredibly ignorant, but how do I do this exactly?
Where should I put this exactly? Sorry for being noob at this.
currently reading this get an idea
Hi there, so I'm trying to build a statistics tracking function for my mission, everytime I've tested it so far is with spawning the AI through Zeus and ...
wait actually let me try again
kind of in a blank of what to actually put in the then let me try to think again lmao
thanks so much for giving me an idea tho
is it possible to add the killed EH by calling it like a function everytime new civs are spawned? (not sure if I'm even making sense)
hi all wanting to use addaction to move a marker and a tent (basically a moving RV point in a mission)
This is what I have written.
this addAction ["Set Rally", {"respawn_west_1" setmarkerpos getpos sl1;
tent1 setpos(getpos sl1);
}];```
Would this work okay in an MP enviroment? it works on a locally hosted one but i know that its different to an actual server
One what i used is
class Extended_Init_EventHandlers {
class CAManBase {
init = "if (side (_this #0) == civilian) then {[_this #0] call VRK_fnc_identity_create}";
};
};
And in function you can add current killed eh to unit / do what you want it
or would this suit better?
this addAction ["Set Rally", {"respawn_west_1" setmarkerpos getpos sl1;
tent1 setpos(getpos sl1);}] remoteExec ['Spawn', 2];```
this addAction ["Set Rally", {
private _pos = sl1 modelToWorld [0,0,0];
"respawn_west_1" setmarkerpos _pos;
tent1 setpos _pos;
}];
? i do not understand your question
Sorry wanted to know if i could make the tent spawn x distance away from the unit
sure
just add in model to world [0,5,0] - its 10m front of unit
For example, if the object scale is 2, _obj modelToWorld [0,1,0] will be offset 2 meters from the model center ([0,0,0]).
I mean , you need select from pos and add some distance for tent from sl1
So
tent1 setPos [_pos#0, _pos#1 + 2.5, _pos #2];
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
besides, you have "2,5" and not "2.5" 🙂
also use vectorAdd
tent1 setPosATL (_pos vectorAdd [0, 2.5, 0]);
almost ninja'd you 😋
Bad keyboard, thanks for correcting
Le French keyboard hon hon hon
So @idle jungle did you get what you need to change?
Use vectorAdd instead of setPos
Like in Lou's example
this addAction ["Open Arsenal", { ["Open",true] spawn BIS_fnc_arsenal; }, [], 0, false, false, "", "(getPlayerUID _this) in arsenalPlayers"];
How can i make it so that if the player UID is not found, place instead a different addAction?
if (getPlayerUID player in arsenalPlayers) then
{
// then
}
else
{
// else
};
You can add action only for certain players, no need to use condition to check
either that, or add two actions, one with "getPlayerUID _this in arsenalPlayers" and one with "!(getPlayerUID _this in arsenalPlayers)" (but that's less cool)
yeah thats great thank you
thanks
and thanks ❤️
like this?
TAG_StartingRespawnDelay = 5;
class Extended_Init_EventHandlers {
class CAManBase {
init = "if (side (_this #0) == civilian) then {[_this #0] call spawnai_fnc_addEH}";
};
};
And in your fnc you have something like
params [_unit];
_unit addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (side _killer == west) then {
[] spawn fn_spawnaigroup;
"The police..." remoteExec ["hint"];
trg1 = true;
};
};]
When it add current eh to unit (the checking side of the unit is not needed because the unit is civilian)
this
}];
Oh thanks!
I found this error on the log files when I couldn't get it to work.
21:04:57 Error position: <{
if (side group _killer == west) t>
Fixed, forgot those params
Any easy option to remove the action of "Inventory" from a box?
You mean you want to remove the way to access into a box?
Thanks I think get this problem from the initServer script
21:24:38 Error in expression <class Extended_Init_EventHandlers {
class>
21:24:38 Error position: <Extended_Init_EventHandlers {
class>
from this script
Sry, this goes to
config.cpp or description.ext
I'm embarrassed to say that I was under a misconception since I didn't understood the meaning of caching, I was assuming that caching in this context was being used as a synonym for a system that was hiding/unhiding stuff, hence why I inquired about it that way.
After reading a bit more in the meaning and where it is used in computation, I can understand why the word is thrown so freely in association with said systems, as objects lists are much more simple/faster to use than constant retrieval of them.
Regarding performance, I get it's really case-uses in where scenario benefit from this.
Being honest and after testing, it would be worse for performance to execute constant distant checks to players in order to unhide STATIC stuff, so I will just stick with dynamic sim and render distance being basically the same since Im enforcing >1250m for objects view distance.
Oh thanks, sorry it was my fault
so basically all I need is that on the description.ext
the function for EH killed as well as the trigger that I use to spawn ai.
Is that right?
ah yeah indeed, just hiding (the physical representation) an object the player would not see anyway is absolutely pointless performance-wise
simulation is what costs network sync and therefore some performance
glad you figured it out, it will help you plenty!
compared to ~March 2022 when I was last working with it
yeah I mean, it's really cool that units and helicopters CAN reverse... I can think of some situations where that's useful like backing away from players. AI boat reverse would actually be really useful xD
Hello, is there anyway to remove tickets when a vehicle is destroyed? I know how to remove them when they respawn, but not when they are destroyed. Thanks
add a Killed event handler and use BIS_fnc_respawnTickets?
you would have to get the vehicle's "side" in some way
I just made a trigger for each vehicle and it worked, Thanks anway
Hello, I am using this script to make a mission like the Makarov estate raid in CoD MW2, and I am trying to make a intel downloading task, but it gives an error in the mission. The error is |#|!_target getVariable ['inUse', false] - Type Object, expected Bool. And this is the code I am using -
this addAction ["Download Files", { [] execVM "download.sqf"}, nil, 2, true, true, "", "!_target getVariable ['inUse',true]"];```
"!_target getVariable ['inUse',true]" gets parsed as "(!_target) getVariable ['inUse',true]", not "!(_target getVariable ['inUse',true])"
How can I fix that? Do I just add brackets to the place you show?
yes
Thanks a lot.
Back with another question. I am now getting this error after interacting with the laptop. Both %1 and %2 are numbers, _i is the downloaded percentage.
Code -
{
// Check the distance with the player
if (player distance laptop > _maxDistance) exitWith { hint format ["Download Canceled : You are %1 meters away from the laptop",_maxDistance]; laptop setVariable ["inUse",false,true];};
// This is how much time to way at each percent, lower this to make the download faster
sleep _timePerPercent;
// Show the current download progress
hintSilent format ["Download in progress : %1%2, _i, "%""];
};```
" placement doesn't really make much sense. Did you mean hintSilent format ["Download in progress : %1%2", _i, "%"];?
Ohh. Sorry, I am a very bad programmer, and this is a very old code I am trying to fix.
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
for "_i" from 1 to 100 do
{
if (player distance laptop > _maxDistance) exitWith { hint format ["Download Canceled : You are %1 meters away from the laptop",_maxDistance]; laptop setVariable ["inUse",false,true];};
sleep _timePerPercent;
hintSilent format ["Download in progress : %1%2, _i, "%""]; // error here :)
};
Didn't know this was possible. Thanks.
because its related by topic:
[] spawn {
_t = 2;
_arr1 = [
"starting russianhack.exe...",
"hack.getInstance.init();",
"bruteforcing pincode"
];
{_x remoteExec ["hint",0];sleep _t;} forEach _arr1;
for "_i" from 0 to 100 do {
(str round (random 100000)) remoteExec ["hint",0];;
sleep 0.1;
};
_arr2 = [
"found code: 12345",
"executing breach...",
"hacking mainframe...",
"disabling algorythms...",
"deleting database..."
];
{_x remoteExec ["hint",0];;sleep _t;} forEach _arr2;
};
some hacky code i made for alex couple months ago
Double ; make me sad
i got one free bc i was the 1millionst customer
params ["_unit", "_container"];
_priWeap = primaryWeapon _unit;
_unitMagArr = magazines _unit;
_compMagArr = compatibleMagazines _priWeap;
_priWeapmags = (magazineCargo _container) arrayIntersect (_compMagArr);
_priWeapmag = if ((count _priWeapmags) > 0) then { selectrandom _priWeapmags } else { "" };
if (((count _priWeapmag) >= 4) and ((count _unitMagArr) < 7) and (_unit canAdd [_priWeapmag, 4])) then {
_unit addMagazines [_priWeapmag, 4];
[_container, _priWeapmag, 4] call CBA_fnc_removeMagazineCargo;
} else {
};
Who can say what's wrong with this?
rpt report:
_priWeap = primaryWeapon _unit;
_unitMagArr = magazines _unit;>
20:31:38 Error position: <
_unitMagArr = magazines _unit;>
20:31:38 Error Invalid number in the expression
is there a way to get the gamma/brightness value?
@spark turret yeah, i see
hmmm, ok, will try
Yeah, there's a ghost character at the point marked.
Don't paste stuff from Word or whatever :P
but where else would i write my code?!?
@granite sky yeah, it was pasted 🙂 Thank you, mates.
_o = {
params ["_unit"];
_priWeap = primaryWeapon _unit;
_unitMagArr = magazines _unit;
_compMagArr = compatibleMagazines _priWeap;
systemChat str _priWeap;
systemChat str _unitMagArr;
systemChat str _compMagArr;
};
[player] call _o;
wors for me
That was just example for systemchats those _vars, and temon does get those. So I would say he's call params (or spawn params) is not correct. But I don't know, maybe temon show how he call he's script where he trying get some data out
I need help with some music I been trying to upload to the workshop for me and my friends in a private mission
Im using a really old template for it so it might be the culprit (I have been able to successfully upload it to the workshop and I could see the class name in the game but not the song itself)
Anyone got any idea why?
if you mean other scripts, call doesn't block them anyway
the music must be part of the pbo (or mission folder) not outside it
so I packed the folder using the addon builder does that not pack the ogg file into the PBO?
im really new to arma 3 modding
and how do I do that?
do I just use the addon builder again but with the pbo in the folder this time?
you put the song and config.cpp into a folder
then in addon builder give your addon a pbo prefix, say HEF
then change the sound path in config.cpp to HEF\RazormindL.ogg
ok thx let me try that
init files have to be completed before game loads
so if you put a while loop there it will block the game
That's not a behaviour of call, that's a behaviour of a while loop. Code after the loop won't be executed until the loop is finished. call just means "do the saved code here as if it was written out here in the same script". So if you put a while loop inside what you call, yes, it will pause the current script until it's complete, but call on its own doesn't do that.
Because spawn creates a separate "script thread". spawn is not "do the saved code here as if it was written out here in the same script". It's "do the saved code in its own scheduled thread, like a different script".
Again, not actually caused by call. Caused by the while loop, and spawn gets around it while call doesn't.
It's really helpful to look up spawn and call and the Scheduler on the wiki, because understanding how those things work, and what the differences are, is super useful.
hi guys!
i'm brand new to editing, i started by copying a script i found online to stream live feed from a drone camera to a screen as a texture (script is here http://killzonekid.com/arma-scripting-tutorials-uav-r2t-and-pip/)
i got it to work for one drone (uav), but when i tried to copy the script and set it to a different drone and different screen (uav2, tv3) it doesn't work
help?
my script is here
tv3 setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uav2rtt,1)"];
uav2 lockCameraTo [tgt2, [0]];
cam2 = "camera" camCreate [0,0,0];
cam2 cameraEffect ["External", "Back", "uav2rtt"];
cam2 attachTo [uav2, [0,0,0], "PiP_pilot_pos"];
cam2 camSetFov 0.1;
addMissionEventHandler ["Draw3D", {
_dir =
(uav2 selectionPosition "PiP0_pos")
vectorFromTo
(uav2 selectionPosition "PiP0_dir");
cam2 setVectorDirAndUp [
_dir,
_dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
];
}];
please ping if anyone knows what's wrong
i checked the config and Pip_pilot_pos is the name given to the memory point on that drone
yeah it's been tearing me apart for a while lol
thanks for the answer tho!
Hey guys, im currently looking at Unitcapture for a video that I am working on. I have a slight issue regarding infantry movements. Is there a script where AI follow your exact steps? https://youtu.be/xeVAV3FD0s4?t=66 Copied at current time in the video. How do I make something like this? It doesnt feel like Unitcapture is the way to go
ARMA3 Machinima Cinematic Movie by Flawless War Gamer
(The battle for Germany ▶ World War 3 Episode 6)
Subscribe Link:
(https://www.youtube.com/channel/UCO3rUMBjMZ0Iuo5MfRWIROw?sub_confirmation=1)
There is one thing that you shall never forget !!!
Machinimas is the last a-male castle. You have to protect it at all costs !!!
Help me to be rewa...
Obviously remove the video if its not allowed in here, its just there as an example
Just to add to above, I want to add/create a script where my AIs move similar to the ones in the video
Im pretty sure I've seen a script for jets where you can have a wingman following your exact movements, but he cant fire. Just wondering if there is something for infantry as well
custom animations
the best you can achieve with scripting is having the AI move on "rails" and play an animation, and change their direction
but if you want it to look good like in that video you need custom animations
you might be able to find similar animations to the ones in the video on the workshop if you don't know how to make animations
Do anybody know how laser beams are scripted? and classname to create a laserbeam?
Hey man, thank you for your answer! When you say custom animations, do you mean animations such as Polpox/a2 cutscene animations etc?
Because I cant really get them to work either. When I give an AI a move animation, they seem to be running on the spot instead of actually moving somewhere if you see what I mean
yeah. or ones made in blender
no. it's a software for making 3d stuff and animations
Oh xD
also the game has some built in animations similar to the ones in that video iirc
like viper unit anims
So, could I make something like that?
Just by using animations?
Either way, thanks man! Another quick question. When I use Unitcapture on infantry, the guy moves, but his legs dont move. Any ideas why?
you can. but it just depends on your skills and how good you want it to look
like I said there are some exisiting anims that might suffice for what you want
but if that's not enough you have to make your own. which is easier said than done
unitCapture doesn't capture animations
Thanks, I will give that a try now
it just captures position, velocity, direction
Hes not doing any animations
Literally I just want him to move from point A - B
He is moving next to a road where I have an APC moving, but you know how AIs are if they move by themselves
the "legs moving" part of a character is an animation
They become suicidal
Oh
I see
I thought it just captured what you are doing
when recording
even when a character is standing in place he's playing an anim
the non-animated character has a T pose
Ah, ofc
Makes sense now thinking about it
So, there is no way of getting his legs to move when using unitcapture?
you can play the animation manually yourself while unitPlay is running
I solved it for vehicles because they kinda had the same issue where the wheels werent moving, so I had to disabled its breaks in init
Yeah, thats what I did
But the legs arent moving
He just slides on the ground
xD
...again legs moving is an ANIMATION
if his legs don't move you're not playing the animation
unitCapture/unitPlay is not animation
Ok. It just confused me because I was following a tutorial on YT, and I followed the steps that he did (in the vid), but his guy was moving properly whilst mine was sliding
But, I guess its just an issue on my end
either he wasn't using unitCapture or he was playing the anim manually
like I said unitCapture doesn't capture animations
just movement
Yeah, he might have cut that part out then i would assume
Thanks either way Leopard!
Thanks man!
start moving your player, then pause the game and run
https://community.bistudio.com/wiki/animationState
to see what animation your character is playing
then use it on the AI
just for testing you can run this:
myGuy playMoveNow "AmovPercMrunSrasWrflDf"
Ill try that now
replace myGuy with the var name of an AI
and put that into the init console?
yeah, nvm
it works
Interesting
So, he took around 5 - 10 steps, can I give him an order to run x amount of meters?
no
Ah damn
you should do that manually
Yeah I see what u mean
you can use the anim viewer to find the animation you want then play it on the AI
like I said, if you play it while unitPlay is running, it will look like as if the character is actually moving itself
tho if you play multiple anims (e.g. walk, run, sprint, move left, right, etc. all are different anims) that alone won't do
Yeah I see what you mean
Im just gonna find one that makes it look like he is moving forward
Just for practice and see how it goes
you might be able to find existing scripts for that tho
I don't know what you looked for but it was literally the first thing on google:
https://forums.bohemia.net/forums/topic/175154-functions-unitcaptureunitplay-for-infantry-units-in-arma-3/
I simply googled arma 3 unit capture script infantry
Ah, nice. I just started with unit capture today. Before I was looking for a script to do it all for me xD
please help i am losing my mind
if (player == shark) then attachObject "friggen_lazer_beam"; attachObjecTo "head";
sorry too tempted
Not sure if real or a joke
Think I've an issue with logical operators here as all the conditions are true (checked in systemchats) and yet never exits with false -- anyone able to provide any pointers?
_playerHelmet = headgear player;
_playerVest = vest player;
_playerUniform = uniform player;
if ((KJW_Imposters_Setting_MilitaryUniformsEnabled) &&
((_playerUniform != "") && (_playerUniform in (parseSimpleArray KJW_Imposters_Setting_MilitaryUniforms))) &&
((_playerVest != "") && (_playerUniform in (parseSimpleArray KJW_Imposters_Setting_MilitaryVests))) &&
((_playerHelmet != "") && (_playerHelmet in (parseSimpleArray KJW_Imposters_Setting_MilitaryHelmets)))
) exitWith {false};```
Not related to your issue but, why not use lazy eval?
Will do once I get it working but the brackets for && lazy eval get confusing for me
Are you calling this from somewhere else to get a return value?
Will be but at the moment I'm using that in debug console
Only bit not included there is systemchats with all the conditions to ensure they're all true which they are 
And it exits with true?
Oh yeah, just true is after that but yes returns true
But you're only running the codeblock you posted in debug? Nothing else?
Yup
_playerHelmet = headgear player;
_playerVest = vest player;
_playerUniform = uniform player;
systemChat str (_playerUniform != "");
systemChat str (_playerVest != "");
systemChat str (_playerHelmet != "");
systemChat str (_playerUniform in parseSimpleArray KJW_Imposters_Setting_MilitaryUniforms);
systemChat str (_playerVest in parseSimpleArray KJW_Imposters_Setting_MilitaryVests);
systemChat str (_playerHelmet in parseSimpleArray KJW_Imposters_Setting_MilitaryHelmets);
if ((KJW_Imposters_Setting_MilitaryUniformsEnabled) &&
((_playerUniform != "") && (_playerUniform in (parseSimpleArray KJW_Imposters_Setting_MilitaryUniforms))) &&
((_playerVest != "") && (_playerUniform in (parseSimpleArray KJW_Imposters_Setting_MilitaryVests))) &&
((_playerHelmet != "") && (_playerHelmet in (parseSimpleArray KJW_Imposters_Setting_MilitaryHelmets)))
) exitWith {false};
true``` this is *everything* in debug console
Remove true, what does it come back with then?
Nothing returned
_playerHelmet = headgear player;
_playerVest = vest player;
_playerUniform = uniform player;
systemChat str (_playerUniform != "");
systemChat str (_playerVest != "");
systemChat str (_playerHelmet != "");
systemChat str (_playerUniform in parseSimpleArray KJW_Imposters_Setting_MilitaryUniforms);
systemChat str (_playerVest in parseSimpleArray KJW_Imposters_Setting_MilitaryVests);
systemChat str (_playerHelmet in parseSimpleArray KJW_Imposters_Setting_MilitaryHelmets);
private _myValue = true;
if ((KJW_Imposters_Setting_MilitaryUniformsEnabled) &&
((_playerUniform != "") && (_playerUniform in (parseSimpleArray KJW_Imposters_Setting_MilitaryUniforms))) &&
((_playerVest != "") && (_playerUniform in (parseSimpleArray KJW_Imposters_Setting_MilitaryVests))) &&
((_playerHelmet != "") && (_playerHelmet in (parseSimpleArray KJW_Imposters_Setting_MilitaryHelmets)))
) then {
_myValue = false;
};
_myValue
whats this give you?
Uniform in vests?
Try what artemoz said first.
roger doger
copy pasta mistake
Although even with
Uniform in vests?
You might have a bigger problem if that returned true.
Yeah that's why I was going to try yours first lol
Yeah it works with fixing the vest lol, looks like I need to read my stuff properly 
Great, now lazy eval it boyo.
I've got to add toggles for primary weapon, secondary primary weapon, launcher etc and checks for them now too 😄
I did post it in ACE discord yesterday but didn't get any solutions
Figured it was something trivial so posted in here for more people reading it and clearly paid off 😅
Just out of curiosity, what is this condition actually for?
Making an undercover system but allowing players to disguise as configured military/police, requires helmet, uniform and vest to be correct and then enable/disable checks for other things like guns and backpacks etc
Oh, how I'm doing it in here isn't going to work then 
You need a rubber duck
i have schizophrenia so im sorted
Several rubber ducks, nice.
I'm not sure if toggling inside of the if statement is even possible
what's the point of checking if it's an empty string?
Top of my head:
- Turn it into function.
- Switch statement for each type with return value.
- Figure out from there.
i shouldnt check any empty strings im confused
(_playerUniform != "") <
That would probably work better -- though surely I would need a switch statement for each possible combination
yeah thats if the player is actually wearing a uniform
nudity isnt standard issue in any militaries im aware of
You're never gonna hear the end of lazy eval.
vs parsing constantly (im not sure if you reuse this script more than once)
i will do lazy eval once ive got it working because the bracket bits confuse me
but i think mike is right in turning it into a function
However I don't know if I would need every possible combination of addon checks or if I'm just being stupid
You could make this simpler by having it be more lenient.
Instead of checking every slot for items, Just stick to core Uniforms/Vests/Helmets.
Lowers your overhead and it's still a fun thing for missions.
Yeah though someone running around with US uniform/vest/helmet with russian backpack gun etc may be something mission makers want to not allow
True, but trust me on this one. Mission maker simply telling people not to do shit is a lot easier than delving into unnecessary complexity.
I suppose there is no switch statement that'll evaluate all of the cases so probably for the best tbh
Since this is part of a mod, nothing stopping you from adding a pre-made Arsenal which you can place in mission, only has items from your undercover choices.
I still need to figure out how to make the player go overt again after firing in military disguise without making it pointless
How are you making them undercover?
setCaptive with a check for ACE unconscious or captive (as to not set them not captive whe uncon or captive)
uh, fired EH?
Actually should be easy enough to just give player a variable that changes after certain amount of time not firing tbf then add that to the check
Can't really give you much help with this one, last time i messed with it the overt toggle was just holding a weapon of some kind.
Wasn't great.
I think I'll just make firing increase a points variable or something that otherwise decreases slowly
alright, update
ive figured out that the issue is only one .sqf file can run at once using execVM
is there a way to fix this?
Create your sqf as a function and call it?
how?
Trying to automate some functionality with modded units in 3DEN, but I only want it to happen when that unit is freshly pasted or created.
Currently I'm using onMissionNew and onMissionPreviewEnd Cfg3DEN event handlers to create an EntityCreated mission event handler in the editor, but that applies for any object, including when 3DEN editor loads in the already existing objects.
Am I missing the proper 3DEN event handler for this?
class Cfg3DEN {
class EventHandlers {
class NUT_Util_3den {
onMissionPreviewEnd="'onMissionPreviewEnd' call NUT_Util_fnc_3denTest";
onMissionLoad="'onMissionLoad' call NUT_Util_fnc_3denTest";
onMissionNew="'onMissionNew' call NUT_Util_fnc_3denTest";
};
};
};
switch _this do {
case "onMissionNew";
case "onMissionLoad";
case "onMissionPreviewEnd": {
if (isNil "NUT_Util_3den_entityCreatedEVH") then {
NUT_Util_3den_entityCreatedEVH = addMissionEventHandler [
"EntityCreated",
{} // My functionality ()
];
};
};
};
Do you use CBA?
We do
Won't that have the same problem of triggering when the object is created/loaded, rather than just when the user has placed it
Give it a try
Third example indicates it should work.
Ah, re-read what you initially wanted.
How so? The third example shows that it can retroactively apply to objects.
That isn't what I'm trying to achieve.
It would require special handling to only apply when a user places an entity in the 3DEN environment, which I doubt CBA would have implemented without noting
For further context: I'm trying to automatically set certain object specific attributes from one of the mods we use. I have that working, I just have the issue of the trigger for that action not being as discerning as I'd like it to be to stop it overwriting any user changes.
If I have to live with that stuff being done every time the 3DEN environment loads the objects for that mission, so be it, but it feels like there should be a proper event to use for this that I must be missing
Hi,
If i create HashMap in initServer.sqf
Is that global?
i mean can i modify it (add and remove) via local client?
If i have "Killed" EH (local) which count teamkills , and i want every time when player kill teammate to add him to "list" and when he's append 4 times there i want punish him , but i want reset teamkill "list" by removing killer from list, so he can again kill 4 times and get punish again.
But currenlty from publicVar which is just empty array, i cannot (i do not correct way) delete killer from (4 times _killer) list.
Maybe a unclear question, so let me know if I need to clarify my own question better.
Hashmap is not a very familiar concept to me, so I need help with this (understood that this is the right way to make a "list" / array)
You can pass hashmaps around with publicVariable but as with arrays, you really shouldn't write them from more than one location.
So if clients need to update an array or hashmap they should tell the server to do it using remoteExec.
Consider if two machines attempted to update the same variable at the same time.
So how do i append _killer from EH to killerList array via remoteExec
hmm, true, this is what i didn't think about. thx
Ideally you make an update function that you can remoteExec.
Or some1 have some workaround to get list of killers
True, easiest way
And then clients would do something like [_killer] remoteExecCall ["MyTag_fnc_addToKillerList", 2]
But how do i check ? can i check current list from client? can i "ask" from server what there is.
Can server return data to client, or do i need just update that to global from serer
use an EntityKilled EH server side, then you won't need any REs, and also won't need to add Killed EHs everywhere
Oh yeah, that works for that one.
o.O
mission event handlers are often really good for that stuff.
True
Awesome, I'll check it out.
Define this EventHandler via serverInit.sqf?
Thanks
And correct way to delete _killer from list? I didn't understand this part of arrays remove
You can also use (-) operator to subtract arrays. The subtraction returns array copy, just like addition, and this not as fast as deleteAt and deleteRange which modify target arrays.
private _myArray = [1, 2, 3, 4, 5];
_myArray = _myArray - [1]; // _myArray is [2, 3, 4, 5]
MRN_playerTeamKills = MRN_playerTeamKills - [_killer];
Correct or not?
in EH where _killer is killer
looks like you want a hashmap here and not an array
If it's not going to be a long list then I'd leave it as an array personally.
hashmaps can't use objects directly as keys so they're a bit fiddly for that.
You have to use netId or playerId or something.
Although in this case maybe you want playerUID anyway? Unclear.
Well it can be long because if each player kills their teammate 3 times, all players will be there 3 times.
I was just thinking about how I could build a "list" of every player team kill.
Can I do it separately? or somehow each player has their own list or something.
Yeh, if same person kills teammate 4 times, he will be punished. But currenlty doing pretty long list of players (unnecessarily?).
Ace killtracker could be of use for this task
Do you want that number preserved over reconnections?
Simce they have the "ace_killed" cba event
You would have to track kills by adding the killed unit to an array and Store the variable on the killing unit, then check each time if killed was alrdy killed 3 rimes over
Or any blufor wa killed 4 times to suit your request
Well, if the player disconnects and reconnects, it would be good if the information teamkills is preserved
Gotta go will catch up later
Yup! and when you don't have an ace in use, that's a issue.
Maybe I can check how they built it, but I'm not using ace right now. thanks anyway.
// check if _killer teamkilled, blabla
private _key = netId _killer;
private _count = (TAG_teamkillsHashmap getOrDefault [_key, 0]) + 1;
if (_count == 4) then {
_killer setDamage 1;
_count = 0;
};
TAG_teamkillsHashmap set [_key, _count];
something like this is all you need
awesome thanks!
If you use playerUID instead of netId then you get the preservation over disconnects.
Otherwise identical.
is that just = [] , or do i need define something more
TAG_teamKillsHashmap = createHashMap;
I read and didn't understand, read again and didn't understand. But now that you show how to set it up, I can understand it at least a little XD
createHashMap just creates and returns an empty hashmap.
hashmaps are similar to what you do with get/setVariable, except that you get more functionality with hashmaps https://community.bistudio.com/wiki/Category:Command_Group:_HashMap
I'm trying to think of a way to make it easier for my players to round up civilians and load them into a truck. I thought maybe addaction in the Civilian Presence module would work, but I'm not so sure. Does anyone have any ideas?
first i think you need to make the civilian not controlled by the Civ Pres module. Then you can use command to move the civilian in to vehicle, or use waypoints
is there a way to get the gamma/brightness value?
Does getResolution return it?
I really don't know
I'm a bit surprised there isn't a command that just returns an array of all graphics settings
and all setting names are in czech. not further description, other than the array is between 100 and 200 entries long
can we get a command for it?🫣
I am not the one to ask 😄
why do you need that though?
I’ve seen a few mods similar to this. Honestly you should be able to get around it pretty easily by running a few counter scripts on your end, possibly even just adding a few more gigs of Ram to your build. Do you have a link to this mod? I’d love to deep dive into this
Trying to play a sound defined in CfgSFX (addon), I checked the wiki and it said that they can be played with either setSoundEffect or createSoundSource
https://community.bistudio.com/wiki/CfgSFX
I took a look at setSoundEffect, and one syntax is trigger setSoundEffect [sound, voice, soundEnv, soundDet]
I plugged player setSoundEffect ["ambient_Alarm2", "", "", ""]; into my script but didn't play anything
Hey hey, people. I have a little tiny pickle I can't wrap my head around.
in this bit of code, I Spawn AI and place them into a vehicle asset.
ScriptO is used to give them a specific loadout.
_CrewTeam = createGroup East;
_vehicle = createVehicle ["I_APC_Wheeled_03_cannon_F",_VicSpawnPoint,[],0,"NONE"];
"O_R_Patrol_Soldier_Engineer_F" createUnit [_VicSpawnPoint, _CrewTeam, "_CrewTeam selectLeader this; this moveInCommander _vehicle; [this,8,0] spawn _ScriptO", 0.8, "corporal"];
"O_R_Patrol_Soldier_Engineer_F" createUnit [_VicSpawnPoint, _CrewTeam, "this moveInDriver _vehicle; [this,8,0] spawn _ScriptO", 0.8, "corporal"];
"O_R_Patrol_Soldier_Engineer_F" createUnit [_VicSpawnPoint, _CrewTeam, "this moveInGunner _vehicle; [this,8,0] spawn _ScriptO", 0.8, "corporal"];
_CrewTeam
after this script is called _crewteam is passed onto the next script I called "BattleHandler" where it _CrewTeam is referenced as _Asset. where the group I just created and placed into an APC is then given a list of move orders to move to.
This is where I have my problem as the APC and team inside do nothing and wait at the spawn point.
_AssetL = leader _Asset;
_AssetA = vehicle _AssetL;
_Asset move getpos (selectrandom _MovePoints);
{
_TargetArea = _x;
_target = [_TargetArea,AllPlayers] call Sov_Fnc_CurrentClosest;
_Targetpos = Getpos _target;
_Asset setBehaviour "AWARE";
_Asset setCombatMode "RED";
_Asset setFormation "WEDGE";
_Asset setSpeedMode "FULL";
_wp = _Asset addWaypoint [_Targetpos,50,0];
_wp setWaypointType "SAD";
} Foreach _MovePoints;
I use no AI mods though it started working when I used Vcom AI. I have tried giving them 'DoMove' and 'CommandMove' and normal 'move' and yet nothing happens. When I go into Zeus the AI has their Waypoints that I can see, when I give AI this command without the armoured asset they actually move to these points. I have even had success getting helicopters to follow this with no fault.
Another thing I have noticed is I have to manually turn on the armoured asset's engine and physically rotate it to get going. but shouldn't they do this themselves?
are you a trigger? 😄
Is it specifically for a trigger?
The wiki just says "trigger: Object"
It didn't seem to specify that it would only work for a trigger
trigger or waypoint yes
setSoundEffect is the same as the "sound" dropdown in the trigger or waypoint's Editor attributes
i.e. it selects the sound that plays when the trigger or waypoint activates
*poof*
If you just want a particular sound without the randomisation stuff from CfgSFX, use playSound, playSound3D, say3D etc instead.
you can define a mod sound in CfgSounds and do as NikkoJT suggestst above yes ^
Yeah, I was probably just going to end up doing that if sounds in CfgSFX were being weird
The main thing I was wanting from the sound fx was that it looped
Without having to do like: play sound, sleep x, repeat
you can create a sound source
private _soundSource = createSoundSource ["TheCfgSFXModClass", getPosATL player, [], 0];
_soundSource attachTo [player, [0,1,0]];
@tulip ridge ^
It doesn't seem to play any sound
Is anyone able to provide a pointer as to where the game handles respirator breathing sfx underwater? Can't seem to find it, wondering if its engine driven
I have to start heading into work now, so I'll mess with it again later, thank ya
engine driven most likely, you could use a sound played event
fixed description btw
pretty sure engine side
same as normal breathing
Ah, wanted to see if it was possible to run it upon respirators being equipped
and you can lower the sound volume (to 0) in v2.12
can you set the index that you are currently using while iterating through an array?
{
//Do a bunch of stuff and then:
_exampleArray set [_forEachIndex, _newElement];
} forEach _exampleArray;
Its basically an apply, but it saves me time since im already doing other operations in each iteration. Just wanted to confirm since I remember arrays shifting while modifying indexes
I think so
array shifting happens if you remove items
Yes you can, with an array
ah, yeah you are right. It was when removing elements being iterated that the shifting made you skip an index
yup
[0, 1, 2, 3]
if (_index == 2), remove 2
[0, 1, 3]
next iteration… ERROR
that specification for array made me wonder, in which case you cant?
hashmap
is there any known issue with "hideobject(global)"? i am having issues hiding an object locally when in a per-frame setposworld loop
using setposworld each frame, is returning hidden, but still visible ... not visible on other clients
Is there any way to get the sound played in SoundPlayed EH or will I have to search through config for the scuba sound
as in the sound itself, not index or something
Is there an easy way to find the sound effects in this list?
to use in this for example
playsound3d ["a3\sounds_f\sfx\radio\ambient_radio8.wss", holo1, true, getposasl holo1, 5, 0.8, 0]
Open the Config Viewer from the Tools menu, navigate to CfgSFX, and look for the classname on the bottom line of the tooltip. (If you have Leopard20's Advanced Developer Tools loaded, you can search in the Config Viewer, making it extra-easy)
Appreciate it! Will download that mod and check it out too
I was also curious what option people would recommend for creating a siren in a burning ship.
Basically its a multiplayer star wars mission where players fight to escape out of a ship. The siren would loop and be playing for everyone until they leave the ship. I've looked at multiple different ways to go about it but I run into different issues on each or i'm just generally unsure of things. Mostly worried about multiplayer issues.
(i'm also fairly new to scripting and arma mission making)
Some things i've tried out
-Loop with this && round (time %5) ==5 in trigger
playsound3d ["3as\3as_props\SoundProps\Sounds\Siren1.ogg", h1, true, getposasl h1, 5, 1, 50];
playsound3d ["3as\3as_props\SoundProps\Sounds\Siren1.ogg", h2, true, getposasl h2, 5, 1, 50] ``
----------------------------------------------------------------------------
-CreateSoundSource with description ext
-Currently placed on player, but might change to place one one object and change the radius it can be heard.
private _alarm = createSoundSource ["MyAlarmSound1", position player, [], 0];
class MyAlarm
{
sound0[] = {"@3as\3as_props\SoundProps\Sounds\Siren1.ogg", db-10, 1.0, 1000, 0.9, 0, 1, 30}; // path to addon sound
sounds[] = {sound0};
empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
};```
whats the command for creating (not spawning) a Custom Composition ? the Editor's window's "Ok" button's Event Handler is empty, and seems that the OnLoad script doesn't lead to the answer .
there is no command specifically for that
you have to get what objects it creates and create them one by one and place them according to what it provides for the relative pos and dirs
creating (not spawning)
what's the difference?
inb4 "creating" as in "saving to the disk"
making a new one, not adding to the scene .
yes, and there must be a function which does that, called by the Editor's button
fuck, selection doesn't seem to be settable too . ty
do3denaction 'createcustomcomposition' and what's after that is likely to be in-engine
y, i somehow missed that when searched the list . ty
Anybody have a clue how to change openmap [true, true] (where the map is forced), to non-forced without executing openmap [true, false]?
The thing just jumps around now if you do that, even though it seems like the easy way
openMap [true, false]
- opens map normally
openMap [false, false]
- closes opened map normally
openMap [true, true]
- force opens map and keeps open (the user cannot close it on their own)
New
openMap [false, true]
- prevents map from opening, closes open map and forces it to stay close (the user cannot open it on their own)
Found the solution, just use openMap true followed by forceMap true, and then if you want to toggle the behaviour back just use forceMap false.
That I knew, but wasn't my problem. Read my message again! 😉
Forced. Sry. My bad
Np! Thanks for the response man!
Hi, how to enlarge size of list box elements?
Is there a way of finding the time between point a and b in a script? I want to use a function that causes acceleration to V2, so I'm basically using a script that has this exponential function. It's pretty barebones.
a = 0.5;
b = 2;
c = 0;
d = 0;
x = time;
xd = x+d;
bxd = b*xd;
abxd = a*bxd;
y = abxd + c;
# the same as doing y = a(b^(x+d))+c
v2 setVelocityModelSpace [0, y, 0];
sleep 0.2;``` The problem lies in the time command, as it starts on mission start, rather than script start, it may start the acceleration of V2 at some absurd value like 5000. Alternatively, I could find a way to record the time and feed that into x instead.
Cheers! 🙂
(I've also noticed I need to add a Sqr to the second line of maths 😛 )
saving a time at the start of the run and then using x = time - SavedStartTime;. Or accumulating diag_tickTime. Or using https://community.bistudio.com/wiki/BIS_fnc_deltaTime 🤷♂️
Wow there's also actually an exponent function. I didn't notice that.
there is sizeEx for font size and something like rowHeight or sth (check the wiki)
and ofc if you mean make them wider you can just increase w
Hey dudes, is it possible to use sleep inside a trigger? I am playing around with making a checkpoint where you drive into a trigger, the sqf file runs and the following script will run:
s1 playMove [ANIMATION]
sleep 20;
s1 switchMove [ANIMATION]
Doesnt something like this work?
The reason for the sleep 20 is that I have another AI walking around my car which takes around 20 secs
yes, you can, but from a design point, is it really what you want?
Timed animations movement CAN and WILL break on busy missions as times will get longer and longer than when you expect it to be playing
This is just for me to play around on, I am not making a mission or anything. I am playing around to see if I can create a scene like this for a video that i am working on
to answer your question,
to use sleep or use any kind of pause, you just need to execute your script/code in scheduled environment
[] spawn {//Something};
is enough
yes, inside the curly brackets
https://community.bistudio.com/wiki/Scheduler fyi in case you want to read the literature
Thanks, will do!
np, good luck
so there was BIS_fnc_addStackedEventHandler where you could pass some arguments, now it is deprecated and should use addMissionEventHandler but there are no arguments available, is there some "current" alternative with arguments, or do I need to pass arguments via some namespace/setVariable. Note, using EachFrame.
🤔

I need a simple script for when I pick up a intel document I want to replace the default “ pick up “ or what ever it is to my own words how do I do this ??
Cheers what would the script be as I’m new to it I don’t even understand the basic ones ?
https://community.bistudio.com/wiki/BIS_fnc_initIntelObject
There is couple examples how to do
Put the script in init of a object.
Here are a couple of examples:
this addAction ["Pick me up pls", { hint format ["Hello %1!", name player] }];
```Example how to change the color of the interaction text:
```sqf
this addAction ["<t color = '#8b0000'> Red Text wow.</t>", { hint format ["Hello %1!", name player] }];
```to make it so it works in multiplayer:
```sqf
[this,["Pick up INTEL",{systemChat "Hello";},[],1,false,true,"",""]] remoteExec ["addAction",[0,-2] select isDedicated];
the MP compat bit is irrelevant since it's being done in the init of the object that we are assuming is placed using 3DEN. using the standard method you provided first is enough as the removal of the action is not handled anyways, it will still show in every player, even with the mp bit it will still be visible for all players unless the vehicle is destroyed or the action is removed manually
howdy so im making a mission where in players need to push their way through thick jungle and or build a road from point a to point b whilst defending a convoy that has vital stuff etc etc
problem is however best way ive found so far of clearing trees like this is carpet bombing the hell out of jungle which leaves behind these jagged stumps which act as almost mini tank barriers.
So question i have is. is there any script out there that has the same function as the hide object script but can be set to a radius around a vehicle so it will allow smooth transition through.
there is a vanilla module that is used to hide terrain objects
im aware of it, problem is though i wanted to "Knock down the trees" get that real immersion going ya know?
im playing on the map Fox Hutan and the jungle is dummy thicc, some of the trees can be knocked down no problem. the big bastards though wont even move if massive ammounts of GBU's are dropped on them.
im using the defoliating mod also
Ah, by your wording it felt like you wanted to just remove them.
If such is the case, then there is probably no way to do so, what remains of a tree is not controlled by the player but by config.
There is a lot of trees that DO fall down when their damage is "1" (fully damaged), I dont know about your specific tree type. Your best bet would be hiding the trees and redecorating with fallen down trees in that is the case.
ah apologies if i wasnt clear, i was worried it would come to that.
might have to place a million objects tho
such is life of a mission designer x)
you might be able to remove tree stumps tho using code, but i don't recall those reporting back using nearObjects
You could just apply the dmg to the trees and bushes example script:
private _terrain = nearestTerrainObjects [player,["Tree","Bush"],300];
{
_x setDamage 1;
} foreach _terrain;
its for an Avatar OP im doing, We are playing the Humans and are bulldozing a way to a new mining site along the way we get ambushed by blue people
OHHHH ill give it a go
paste this in the init line of the vehicle in question is it?
No this is just a example how you could make it so the trees and bushes fall over baicly.
Ohhhhhhhhhh
hmm ill figure it out
either triggers or something
are there even trees that produce stumps?
I was pretty sure that all tree types and bushes just fell or were squashed.
I am preatty sure some modded maps uses thoes stumps as a another tree type in the map
these might even be a terrain prop
so far of clearing trees like this is carpet bombing the hell out of jungle which leaves behind these jagged stumps which act as almost mini tank barriers.
yeah, I assume so too
If i could post a screen I'd show it, its less of a stump more of a jagged crater of bark.
Whatever it is its playing havoc with the big mining vehicle the belaz. It Canroll over em but progress is painfully slow and it can flip the vehicle too.
Besides doing what legion suggested, you might want to identify tree stump objects using a command such as nearObjects or nearEntities and then doing deleteVehicle
as tree stumps cannot be destroyed
Not sure you can deleteVehicle on map objects? Might have to hide those.
stumped once again
ill see myself out
ah, this is correct indeed
here is a simple example how you can make a addaction on a vehicle and destroy forest and hide the pice of terrain that you dont need:
this addAction
[
"Destroy Forest",
{
params ["_target", "_caller", "_actionId", "_arguments"];
private _terrain = nearestTerrainObjects [_target,["Tree","Bush"],50];
{_x setDamage 1;} foreach _terrain;
private _objectsToHide = nearestTerrainObjects [_target,["ROCK","ROCKS"],50];
{_x hideObjectGlobal true;} foreach _objectsToHide
},nil,1.5,true,true,"","true",5,false,"",""];
Anybody see what's wrong with this script? It must be my exhaustion
if (count units inArea) thisTrigger == 3 then {true} else {false};
my thanks friendo this will do nicely
You need yo specify the”area”
your parenthesis is in the wrong side of the command inArea, it should be on the right of thisTrigger.
(inArea thisTrigger) <- area to check
{_x Inarea thistrigger} count allunits
PS: here are the possible type names so you can adjust depending on what type of terrain it is.
https://community.bistudio.com/wiki/nearestTerrainObjects
Yea you need this to detect trees, i made an “axe” mod, and it was painfull lol
Setdammage will make them fall, but for now is random, in next patch will be posible to make them fall away of the player
@kindred zephyr @open hollow it keeps saying it's missing )
btw @icy seal the if is not correctly placed neither
if (count (units (inArea thisTrigger)) == 3) then {true} else {false};
lol, yeah just what i said
Yeah this one's throwing up an error as well, that's why it's doing my head in
It's weird
you could technically use
setVelocityModelSpace
to add a direction to the falling tree, although results might vary, i never have used it on terrain objects
what is it saying?
It's giving the "Missing )" error
I’ve tryed but nothing seem to work
What code exactly?
are trees falling down controlled by physics?
Everything done using physics should work with setVelocityModelSpace afaik.
It might be an animation if not? 😮 perhaps someone else could enlighten us
@open hollow this one, and the rest of them
Yea its like a animation, but even in the ground you won’t be able to “move” them
This will work.
If want to use “units” you need to read the docs in how, because just the command won’t do anything, needs a side of group
Btw this script has no sense to be in a trigger, since that is handled by “thisList” and detection
Fuck, I got it now-- thanks dude
o7
It was:
if (({_x Inarea briefingtrigger} count allunits) == 3) then {true} else {false};
Lol how do you guys do the coloured code blocks?
if you are specifing sides then using
count _thisList == 3
should be enough too, as Tarta said, using the variables that the trigger provide is even better.
It might be required to remove the underscore honestly cant remember right now
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
@icy seal
thanks!
Is anyone aware of a way to stop the player equipping a weapon when they leave a vehicle? Thus far I have
player addEventHandler ["GetOut", {
params ["_vehicle", "_role", "_unit", "_turret"];
player action ["SwitchWeapon", player, player, 299];
}];``` ~~but this doesn't seem to have any influence (action command should holster the weapon immediately after player gets out~~ that is because `GetOut` is for vehicles not players 
GetOutMan
switchMove?
if (primaryWeapon player == "" && KJW_Imposters_Setting_GunAwayOnExit) then {player action ["SwitchWeapon", player, player, 299]; player switchMove "";}; doesn't seem to reset animation state
But I don't know if I'm misinterpreting what reset means there
Yeah, no just checked it with prone and it's still playing the weapon animations themselves
Thanks for the help today man! I have successfully made a decent looking roadblock script
great to hear that, just take in consideration the thing about waiting times not being the most ideal way to do this kind of stuff on the long run in actual missions
Yeah I see what you mean. The series im working on is a cinematic version of the arma vanilla campaign
So, I recreated the first checkpoint scene, and im glad it worked out! 😄
Is there a way to add an action to civilians globally so that any player can make them set their state to surrender?
you should specify if you mean existing units or units created throughout the mission
Units created
I'm trying to save CPU for the players by using the civilian presence module
I know that if I place a unit down I can just put an addAction in the init
Is there a code on unit created box in the module
I've tried just adding a blank action as a test, but it doesn't seem to be working
send the code you used
_this addAction ["Test"];
why are there brackets around addaction
That was my previous test, because it's telling me that I'm missing a left bracket
ok, you don't want to take those errors as written :P
I don't think the second argument is optional
- make sure that the field is executed globally, otherwise remoteExec is required for multiplayer
single player testing shouldn't matter with locality
It still needs a remoteExec even if the module itself is adding the action?
Not in singleplayer, in multiplayer maybe. It depends whether the code is executed globally like object init or only serverside
if you have cba use class event handlers, otherwise https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityCreated
either of those you would put in something like initPlayerLocal.sqf, filter by side in the EH and add the action
Class event handler is likely the best
If using a vanilla handler you would need to filter out entities for "Man" and then check that it's side is civilian
try waiting a frame or more, you might be calling that too early, or attach a anim changed EH for that time period and try handling it there
I haven't really dug into eventhandlers yet.
I recommend one of the many youtube videos on them, it helped me a lot
they're really simple, basically they execute some piece of code when a certain event happens (handle). for example https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired you add it to a unit, and whenever they fire, it executes a piece of code you passed when adding it. same thing is with what i sent, EntityCreated would fire everytime some object is created
So I'd have to put this into a file with the mission, I presume
If this is with the guys created using the Civilian Presence Module, would the class just be
["_civilian"]
?
"CAManBase" is what you would want to look
unless you have one specific civilian type
Do vehicles have sides stored in their configs? Could i check if a vehicle a player is in belongs to opfor? Or more specifically to a faction?
Or could I pull a list of classnames from a faction?
fx.,
params ["_entity"];
if (!(_entity isKindOf "CAManBase") || { side _entity isNotEqualTo civilian }) exitWith {};
_entity addAction ...
there should be iirc
Oh, so CAManBase is just like, the base human model of the game?
checking through factions is the last thing you want to do
Ahhh, ok
all unit classes inherit it
That's very helpful
so like i said, if your civilian units are of one particular type only, then use that instead (this allows you to omit the side check)
unless you have those civilian units not be civilian side
any way setSimulWeatherLayers 0; could be made to work natively in a worldcfg? . . if only we had more knowledge about these rare little simulweather commands 😅
Does this go in the initServer.sqf?
would be nice to give people the option to disable the volumetric clouds and not have it be persistent
this is what you would put in the eh, and you would place the eh in initPlayerLocal.sqf (or some other environment where it runs on all pcs minus the server)
How come it needs be added to the players locally rather than the server?
because addAction is effect local
you said you wanted it added to every player
if you add it on server, only the server will see it (if it's player hosted, if dedicated it's nonsense, there is no interface)
keep in mind that for the initial units (editor preplaced or if a player JIPs), you will need to handle them seperately, you can probably loop through all civilian units in the init script, add the actions there, then handle the "on the fly" ones with the EH
params ["_entity"];
if (!(_entity isKindOf "CAManBase") || { side _entity isNotEqualTo civilian }) exitWith {};
_entity addAction ["Order Halt", {this setCaptive true;}];
}];```
This doesn't seem to be working. The game is telling me that I have an undefined variable in addEventHandler
EntityCreated is a mission event handler, which means you need to use https://community.bistudio.com/wiki/addMissionEventHandler
Ah, ok
TAG_fnc_addCaptiveAction = {
if (_this getVariable ["TAG_addCaptiveAction_isAdded", false]) exitWith {};
_this setVariable ["TAG_addCaptiveAction_isAdded", true];
_this addAction ["Order Halt", {
params ["_target"];
[_target, true] remoteExec ["setCaptive", _target];
}];
};
{
_x call TAG_fnc_addCaptiveAction;
} forEach units civilian;
addMissionEventHandler ["EntityCreated", {
params ["_entity"];
if (!(_entity isKindOf "CAManBase") || { side _entity isNotEqualTo civilian }) exitWith {};
_entity call TAG_fnc_addCaptiveAction;
}];
this should solve the JIP issue alltogether
Good lord
your addAction code was also wrong , {this setCaptive true;}];, this is undefined in that scope, https://community.bistudio.com/wiki/addAction see script
also that requires a remoteExec just realised, setCaptive takes local argument, edited the code
See, this is why I think I need to just pay someone to give me a class on this stuff
I don't understand the how or why of most of this
I know it's all banging rocks together until things work but just copying and pasting code into a file doesn't help me understand it and I'm VERY bad at staying focused when I'm just reading and reading lines of text
In the case of the addAction, I forgot how it was set up and that's my fault but the rest? Fuck me running
which part is confusing?
Like, I know some of the various phrases in that script but I don't know how it all fits together
I haven't done enough research into this stuff, really.
But like I said, research is difficult for me
that top part i made is to avoid typing the addAction twice, better maintainability etc.
if (_this getVariable ["TAG_addCaptiveAction_isAdded", false]) exitWith {};
_this setVariable ["TAG_addCaptiveAction_isAdded", true];
this part is just a guard to avoid adding the action multiple times, the rest just adds the action, _this is whatever you pass when you call this code, see https://community.bistudio.com/wiki/call syntax 2
{
_x call TAG_fnc_addCaptiveAction;
} forEach units civilian;
this just loops over all civilian units, and calls TAG_fnc_addCaptiveAction on every single unit https://community.bistudio.com/wiki/forEach
_entity call TAG_fnc_addCaptiveAction; same thing here, everytime an entity is created, that code is called (if the condition (!(_entity isKindOf "CAManBase") || { side _entity isNotEqualTo civilian }) is false, which basically says, if _entity is not a unit or is not civilian side, exit this scope)
Is that larger block of script meant to replace the previous?
which previous?
The smaller one that I had.
the code i sent is plug and play, nothing else is needed
Why does it need a remoteExec rather than just running the script?
https://community.bistudio.com/wiki/setCaptive "arg local, effect global"
which basically means that the unit must be local to the machine that is executing this command
that page also covers remoteExec
Ah
Well, the script adds the action, but it doesn't seem to be executing it
I'm testing in a MP environment currently
it should work
aim at the unit and execute systemChat str captive cursorObject in the debug console and see the chat
(after you activate the action)
making them captive won't make them play any animations or stop
Is entity created similar with this solution to add stuff to only civ
class CfgFunctions {
class VRK {
class civ {
class civ_east {
};
class civ_rating {
};
};
};
};
class Extended_Init_EventHandlers {
class CAManBase {
init = "if (side (_this #0) == civilian) then {[_this #0] call VRK_fnc_identity_create}";
};
};
yea, that's what i was saying as one of the solutions, except scripted not config https://cbateam.github.io/CBA_A3/docs/files/xeh/fnc_addClassEventHandler-sqf.html
It was having an influence -- putting player prone -- but continuing the animations regardless. I'll try waiting a frame anyway once I get home
you need a surrender animation for that, i don't remember the exact name now, there are plenty to choose from, paired with something like https://community.bistudio.com/wiki/switchMove
"AmovPercMstpSsurWnonDnon"
Allegedly. Haven't gotten to that part yet
Would I need to add another block of script for it, or is it possible to add it somewhere in there?
Or maybe just replace the setCaptive portion
if it's looped anim, then [_target, "AmovPercMstpSsurWnonDnon"] remoteExec ["switchMove", _target] is enough, otherwise it will be abit more tricky
I'm fairly certain that it locks you in place, but I'll check now
HEY IT WORKS
It doesn't seem to be showing up on some of the civilians, however
...and it appears that I can change the animation state of dead ones lmao
That last bit, I'm not too concerned about tbh
The ones it's not working on must have some kind of different model somehow
It's kind of annoying that I had to manually enter all the default values of the addAction to set the radius, but we got there.
Thank you for your help
@copper raven One last thing, will this also add to civilians that I place on the map in Eden?
yes
Excellent. Thank you
Hello friends! I am trying to place a specific object inside of buildings of a specific type in a radius of 200 of where I click. I tried a method that Vindicta utilized with Cylindrical coordinates, but that seems to be a bust. Any idea as to how I can collect the relative coordinates of an object to a building and then later on place the object at those relative coordinates of that building?
For better reference, I hope to store something like this:
private _objectstoputinbuilding = [
["Land_Sun_chair_F", [2.81779,192.774,3.71886]]
];
and then have a result like this:
For every building of this specific type within a 200 meter radius of where I click.
I got the rest of the script down, its just this placement.
Code was:
player onMapSingleClick {
private _buildingstolookfor = [
"Land_u_House_Big_02_V1_F",
"Land_i_House_Big_02_V3_F",
"Land_i_House_Big_02_V1_F",
"Land_i_House_Big_02_V2_F"
];
private _objectstoputinbuilding = [
["Land_Sun_chair_F", [2.81779,192.774,3.71886]]
];
_marker = createMarker[format ["%1", _pos], _pos];
format ["%1", _pos] setMarkerShape "ELLIPSE";
format ["%1", _pos] setMarkerSize [150, 150];
_buildings = nearestObjects [_pos, ["Building"], 150];
{
_building = _x;
if (_buildingstolookfor find typeOf _building != -1) then {
_buildingmarker = createMarker[format ["%1", getPos _building], getPos _building];
_buildingmarker setMarkerShape "ICON";
_buildingmarker setMarkerType "mil_dot";
_buildingmarker setMarkerSize [1, 1];
_buildingpos = getPosATL _building;
_r = _objectstoputinbuilding select 1 select 0;
_theta = _objectstoputinbuilding select 1 select 1;
_z = _objectstoputinbuilding select 1 select 2;
_xcord = _r * cos(_theta) + (_buildingpos select 0);
_ycord = _r * sin(_theta) + (_buildingpos select 1);
_zcord = _z + (_buildingpos select 2);
_newpos = [_xcord, _ycord, _zcord];
hint format ["%1", _newpos];
_chair = createVehicle ["Land_Sun_chair_F", [_xcord, _ycord, _zcord], [], 0, "NONE"];
};
} forEach _buildings;
};
150 meters, my bad 😅
relativeCoord = buildingCoord - furnitureCoord
but you need to take account the building's rotation as well
I got it down! (Not)
_buildingpos = getPosATL _building;
_targetpos = getPosATL _target;
_dirRel = (_buildingpos getDir _targetpos) - (direction _building);
_zRel = _targetpos#2 - _buildingpos#2;
_distRel = _buildingpos distance2D _targetpos;
_targetnewpos = [_buildingpos, _distRel, _dirRel] call BIS_fnc_relPos;
_targetnewpos = [_targetnewpos#0, _targetnewpos#1, _zRel + _buildingpos#2];
you could just use https://community.bistudio.com/wiki/modelToWorld
https://community.bistudio.com/wiki/vectorModelToWorld for direction
setDir would be fine here even i think, depending on your use case
Hey there, just wondering, if anyone experimented with this before I start destroying my game and addons.
I have an addon, that is using oldschool method of having one init function, that then uses
call compile preprocessFileLineNumbers '\path_to_the_sqf_file';
which contains some functions like
prefix_function_name_1 = {
original function;
};
prefix_function_name_2 = {
original function;
};
And I need to edit functionality of some of those functions.
Would having own addon that would use this one as dependency and then using the same init method with
call compile preprocessFileLineNumbers '\path_to_mine_sqf_file';
and editing the functions in there and naming them the same
prefix_function_name_1 = {
edited function body;
};
prefix_function_name_2 = {
edited function body;
};
"replace" the original functions?
I am trying to add a limitation to the addon, but don't want to recreate the entire functionality and I would only need to edit three of many functions.
Yes. Only functions used with compileFinal and cfgFunctions are overwrite-protected
Dont know what you aim for but making an extta mod seems overkill when you can achieve the same witha single sqf file
Also note that you have to overwrite the functions on all machines. They are just public variables afaik so dont get auto-published through the network.
Hello all! I’m seeking help/advice for a script on my arma 3 exile server. I’m looking to have a short list of equipment with higher storage capacity to add to a custom trader. Anyone have any tips on where I should start or maybe have some thing to share? Thanks in advance!
Thank you for your aid so far. I feel that I am getting close to the result I want. But I am not quite there yet!
As of current I use the following to get all the values of objects in the specific building.
private _selectedobjects = get3DENSelected "object";
private _building = "nothing";
private _config = [];
{
if(_x isKindOf "Building") then {
_building = _x;
break;
};
} forEach _selectedobjects;
{
if(_x == _building) then {continue;};
// Add object to config
_config pushBack [typeOf _x, _building worldToModel ASLToAGL getPosASL _x, _building vectorWorldToModel vectorDir _x];
} forEach _selectedobjects;
_config;
Which gives me:
["Flag_CSAT_F",[1.92417,-10.9795,1.6924],[0.999972,0.00754303,0]],
["Land_Graffiti_01_F",[-3.00684,-10.0654,-0.411343],[-0.00754302,0.999972,0]],
["Land_BagFence_Long_F",[1.47096,1.7168,-1.75784],[-0.00754302,0.999972,0]],
["Land_BagFence_Long_F",[-4.64139,2.06445,-1.31759],[-0.00754302,0.999972,0]],
["Land_BagFence_Short_F",[2.81495,0.917969,-1.75759],[0.999972,0.00754303,0]],
["Land_BagFence_Short_F",[-5.95452,0.84375,-1.31759],[0.999972,0.00754303,0]]
Then I run the following script:
player onMapSingleClick {
private _buildingstolookfor = [
"Land_u_House_Big_02_V1_F",
"Land_i_House_Big_02_V3_F",
"Land_i_House_Big_02_V1_F",
"Land_i_House_Big_02_V2_F"
];
private _objectstoputinbuilding = [
["Flag_CSAT_F",[1.92417,-10.9795,1.6924],[0.999972,0.00754303,0]],
["Land_Graffiti_01_F",[-3.00684,-10.0654,-0.411343],[-0.00754302,0.999972,0]],
["Land_BagFence_Long_F",[1.47096,1.7168,-1.75784],[-0.00754302,0.999972,0]],
["Land_BagFence_Long_F",[-4.64139,2.06445,-1.31759],[-0.00754302,0.999972,0]],
["Land_BagFence_Short_F",[2.81495,0.917969,-1.75759],[0.999972,0.00754303,0]],
["Land_BagFence_Short_F",[-5.95452,0.84375,-1.31759],[0.999972,0.00754303,0]]
];
_marker = createMarker[format ["%1", _pos], _pos];
format ["%1", _pos] setMarkerShape "ELLIPSE";
format ["%1", _pos] setMarkerSize [150, 150];
_buildings = nearestObjects [_pos, ["Building"], 150];
{
_building = _x;
if (_buildingstolookfor find typeOf _building != -1) then {
_buildingmarker = createMarker[format ["%1", getPos _building], getPos _building];
_buildingmarker setMarkerShape "ICON";
_buildingmarker setMarkerType "mil_dot";
_buildingmarker setMarkerSize [1, 1];
{
_objectarr = _x;
_objecttype = _objectarr#0;
_objectpos = _objectarr#1;
_objectdir = _objectarr#2;
_objectnewpos = _building modelToWorld _objectpos;
_objectnewdir = _building vectorModelToWorld _objectdir;
_object = createVehicle [_objecttype, [0, 0, 0], [], 0, "NONE"];
_object setPos _objectnewpos;
_object setVectorDir _objectnewdir;
} forEach _objectstoputinbuilding;
};
} forEach _buildings;
};
With the expected result of having this on every building:
Yet...
iirc you can turn compositions into sqf to deploy faster
No wait, I think I know whats going on.
Its selecting not the building as _building but one of the other objects since the type is the same (I think?)
To get your object on ground
https://community.bistudio.com/wiki/surfaceNormal
make sure that you capture the data when the building is facing north
dir 0
else it will be all wrong when you recreate it on different buildings
I get my object to correct place with Lou's example to get
I knew it.
🤔
It considers the banner a building apparently.
try "House" instead
It did the trick with House_F
Building is probably inherited by many things that aren't actually buildings 😅
btw you have wrong position formats in your code, modelToWorld returns positionagl, you should be using _object setPosASL AGLToASL _objectnewpos; over setPos
when you are getting your data, worldToModel also takes positionagl, so you want to do something like _house worldToModel ASLToAGL getPosASL _thing
probably caused by you only ever adding any data to element 2 (index 1) of listbox
by using the correct index in https://community.bistudio.com/wiki/lbSetData 🤷♂️
Return Value:
Number - Index (row) of newly added item
https://community.bistudio.com/wiki/lbAdd
Anyone have experience with crate loading and unloading scripts?
perhaps
Is it possible to pass parameters into an sqf or do I have to somehow make a function?
define "into an sqf"
So I've cobbled together this
function spawnai(point,side) {
_patrolObject = getPos point;
_patrolRadius = 100;
if (side isEqualTo 1) then {
_group = createGroup west;
_unitSpawnPool = [
"B_Soldier_SL_F",
"B_Soldier_A_F",
"B_soldier_AR_F",
"B_medic_F",
"B_soldier_M_F",
"B_Soldier_F",
"B_soldier_LAT_F",
"B_Soldier_TL_F"];
};
if (side isEqualTo 2) then {
_group = createGroup east;
_unitSpawnPool = [
"O_Soldier_SL_F",
"O_Soldier_F",
"O_Soldier_LAT_F",
"O_soldier_M_F",
"O_Soldier_TL_F",
"O_Soldier_AR_F",
"O_Soldier_A_F",
"O_medic_F"];
};
if (side isEqualTo 3) then {
_group = createGroup resistance;
_unitSpawnPool = [
"I_Soldier_SL_F",
"I_soldier_F",
"I_Soldier_LAT_F",
"I_Soldier_M_F",
"I_Soldier_TL_F",
"I_Soldier_AR_F",
"I_Soldier_A_F",
"I_medic_F"];
};
for "_i" from 0 to (count _unitSpawnPool - 1) do {
_unit = createUnit [_unitSpawnPool[_i], _patrolObject, [], 0, "NONE"];
_unit joinAs _group;
_unit setBehaviour "AWARE";
};
_group setCurrentTask ["Patrol", _patrolObject, _patrolRadius];
}
and saved it as a sqf, but having difficulties, I don't know if it's because the scripting is wrong, if I'm calling it incorrectly, or if there's just a fundamental flaw in my understanding
function spawnai(point,side) { is not a valid SQF syntax. At all.
consult documentation. https://community.bistudio.com/wiki/Function
that is fair enough, it's been a long while since I last had time to try and create stuff with arma and I feel as though I've lost a lot of what I'd learnt
@winter rose made a post earlier about where to start with one for an exile server I run
can someone explain the difference between these - setFuelCargo and setFuel. Is there an ability to set the usage rate or amount of fuel a veh can have?
sorry what?
I’m trying to figure out how to put together a script that allows players to load and unload crates in and out of vehicles @winter rose thought your reply earlier was to me when you said perhaps
indeed, but that message above made no sense to me
I thought the script was about sling loading
otherwise I don't have scripts at hand. I can help you creating one if you know your way around scripting
I’m fairly new to scripting so this would be my first one. I have a very basic understanding just by browsing through the arma 3 samples files
Check out the BoxLoader mod if you just want some functionality
setFuel is for the fuel tank that the engine of the vehicle is connected to (i.e. how far the vehicle can drive).
setFuelCargo is for the big fuel tank on the back of fuel trucks that can be used to refuel other vehicles (i.e. how often other vehicles can be refueled).
@digital hollow that looks like that might put me on the right track actually. Hard to tell since I’m not around the pc but will check in to it when I get home. Thank you!
One last question: if I wanted to make my own equipment (uniform/backpacks) and give them a custom carry capacity, how would I go about that? I think others have accomplished this by creating a custom server mod and adding pbos in there
You would need a config mod to do that #arma3_config
Got it. Thanks again!
Cool ty
a Stringtable is the way to go
now hints with giant texts are not great, either
inb4 custom field manual entries with cursory hints
line return?
~~*see https://community.bistudio.com/wiki/Structured_Text*~~ 🙂
ctrlSetText takes a string though, not structured text
https://community.bistudio.com/wiki/ctrlSetText
try either \n or <br/>
ooor… endl as the doc says 🙂
does the function
BIS_fnc_buildingPositions
``` returns AGL coordinates?
It seems to be giving me incorrect Z values sometimes.
I know https://community.bistudio.com/wiki/buildingPos returns AGL but there seems to be no info on the returned coordinates type
is there any reason to even use BIS_fnc_buildingPositions when _bld buildingPos -1 returns all positions already?
force of habit I guess, was the -1 added recently?
i dont remember it having it like a year ago
ah, its fairly old
1.56v
in what cases is it giving incorrect Z?
I'm not sure if somehow I am misusing waitUntil {scriptDone ...}, because when I use it in my script, it doesn't seem to actually wait until the given script is completed to continue.
I was working on a script that would use addAction to add actions to an object that would let players quickly grab kits for a pvp scenario.
This is an example of one of the kits
// pvp_blue_kits.sqf
_this addAction
[
"<t color='#156f9b'>Close Quarters</t>",
{
_a = player execVM "scripts\clear_kit.sqf"; // Clear the player's current loadout
waitUntil { scriptDone _a; };
_b = player execVM "scripts\pvp_basic_items.sqf"; // Basic PvP items: medical, vest, grenades, etc.
waitUntil { scriptDone _b; };
// Blue Team Armor
// Helmet / Uniform / Vest
// Primary Weapon and Smokes
// Guns and ammo
for "_i" from 1 to 5 do {player addItemToUniform "SmokeShellBlue";};
// Switch side to Blufor
[player] joinSilent createGroup WEST;
}
];
However, the script appears to run the scripts in reverse order, as the only items in the inventory are the ones added after both scripts.
It seems to add the basic items, clear the kit, and then run the rest of the script
compile your code, beforehand
and use call here
it does actually wait for it to finish
just maybe you're doing something you're expecting to work differently
hey, this should assign _destpos as coordinates like [x,y,z] if there is only one object in the radius with the classname that FOB_typename provides right?
private _destpos = (nearestObjects [((KPLIB_respawnPositionsList select _idxchoice) select 1), [], 50]) apply { if (_x isEqualTo FOB_typename) then {getPosATL _x}};
Shouldn't it execute the first script, which clears their inventory, waiting until it's complete, then executing the second script, which adds some basic items, waiting until it's done, and then the rest of the code?
// Reset Unit Traits
_this setUnitTrait ["Engineer", false];
_this setUnitTrait ["Medic", false];
// Clear inventory
removeAllWeapons _this;
removeAllItems _this;
removeAllAssignedItems _this;
removeUniform _this;
removeVest _this;
removeBackpack _this;
removeHeadgear _this;
removeGoggles _this;
// Reset Patch
[_this, ""] call BIS_fnc_setUnitInsignia;
yeah, so
you shouldn't even be able to tell when it completes, it happens fast
but anyway, like i said, you should compile your code once, either CfgFunctions or manually via https://community.bistudio.com/wiki/compileScript and simply use https://community.bistudio.com/wiki/call
see note from Leo on call
no, it transforms an array of objects to their position if the object is FOB_typename, otherwise nil
so you get something like [obj1, obj2, objOfFOB] apply ... > [nil, nil, [x, y, z]]
oh alright, didnt realize that. Is there a better way or should I just for loop the nearestObjects array to find the FOB_typename obj?
if FOB_typename is an object, why even look for it?
sorry, FOB_typename is a string. I am searching for the object based on that class name in order to get the position to allow a player to spawn in it
so if (_x isEqualTo FOB_typename) is also wrong, a value of type object is never going to be equal to value of type string
just use findIf
private _objects = nearestObjects [((KPLIB_respawnPositionsList select _idxchoice) select 1), [], 50];
private _fobObjIndex = _objects findIf { typeOf _x isEqualTo FOB_typename };
if (_fobObjIndex < 0) exitWith {}; // not found
private _fobObj = _objects select _fobObjIndex;
ah I should have been using isKindOf huh?
and thats a good idea
thank you ill try using that
you can also just put the classname into nearestObjects directly
oh really? I figured the second array was only for types or whatever you call it, Car, Tank etc
private _maybeFobObj = nearestObjects [((KPLIB_respawnPositionsList select _idxchoice) select 1), [FOB_typename], 50] param [0, objNull];
how do you use the param ?
ah ok I think I get it
actually since your radius is 50, you can just do private _maybeFobObj = nearestObject [((KPLIB_respawnPositionsList select _idxchoice) select 1), FOB_typename], will do the exact same thing as the other one
Hardcoded radius is 50 meters.
the keyword is "seems":
hence why I ask if it gives AGL pos coord, most of the positions verified are actually sunken around 3 meters from where it should be, so I suspect im just using an incorrect coordinate format. Which im gonna assume is the case, since the actual command version delivers AGL
don't use BIS_fnc_buildingPositions
it's simply a wrapper for https://community.bistudio.com/wiki/buildingPos
and yes, as the wiki states there its AGL pos
thanks for confirmation, Ill move from the function to the command versions
this worked perfect for me, thanks a ton.
I created a CfgFunctions in my description.ext file and set up the paths to the files, but the same thing occurs, where the items from the pvp_basic_items script aren't added / are cleared after adding
class CfgFunctions
{
class TRAIN
{
class PVP
{
class clearLoadout
{ file = "scripts\clear_kit.sqf"; };
class giveBasicItems
{ file = "scripts\pvp_basic_items.sqf"; };
class blueKits
{ file = "scripts\pvp_blue.sqf"; };
class redKits
{ file = "scripts\pvp_red.sqf"; };
};
};
};
and then swapping out the execVM <script> with player call TRAIN_fnc_Name; calls, but the same thing happens, where none of the items from pvp_basic_items are added
};
privat>
Error position: <_obejct] call BIS_fnc_error;
};
privat>
Error Undefined variable in expression: _obejct
File A3\functions_f_bootcamp\Training\fn_target.sqf..., line 38```
This script error comes up when I've been trying to initialize Targets.
```sqf
["initialize", [t1_1]] call BIS_fnc_target;
["initialize", [t1_2]] call BIS_fnc_target;
["initialize", [t1_3]] call BIS_fnc_target;
["initialize", [t1_4]] call BIS_fnc_target;
["initialize", [t1_5]] call BIS_fnc_target;
["initialize", [t1_6]] call BIS_fnc_target;
["initialize", [t1_7]] call BIS_fnc_target;
["initialize", [t1_8]] call BIS_fnc_target;
There appears to be a typo in that function's error-handling code.
Guessing that you're specifying objects that are not "TargetBootcamp_base_F"
That would be the case.
I was under the presumption that "initialize" works on any target (guessing now, this isnt the case)
Well, you can find out on line 38 of BIS_fnc_target in the function viewer
All Arma documentation should be considered suspect :P
Hopefully you can explain why
t8_1 setVariable ["noPop", true, true]; isn't working
Is that related?
I don't see any reference to "noPop" either in the function or the documentation.
how are you adding the items?
it's supposed to be set in missionNamespace
I have misunderstood, greatly.
What is missionNamespace (Because I read this as the variable name)
Just the basic addItemToX (vest, uniform, backpack)
missionNamespace setVariable ["noPop", true]; is (normally) equivalent to noPop = true;. missionNamespace is the default global namespace.
But I still have no clue what anything to do with Namespaces are...
Every object has a namespace. Just like every person has a name.
It's the space or container of variables... associated with that name
Mission namespace is stored in the mission scenario
individual objects and players also have namespaces.
Global namespace is shared by everyone and the server
not really true, you're talking about public variables here
Ah right, fixed
ive forgotten how to do transparency on PAA images
converted a PNG with transparency to PAA and lost the transparency
I usually just use ImageToPAA and have no trouble (given the image has correct dimensions)
How can I have a script check to see if a mod is active and use that as a conditional for an 'if' function? I was trying to use 'modParams [""["active"]]' and I haven't had any luck yet.
I would do check if a file from the Mod exists in the game
How can I do that? Sorry, this isn't my strong suit
fileExists
Thanks!
you can also look up CfgPatches
Well, somehow I didn't think up that
angery
sussy lou
that descreption of the chat anoys the crap out of me....
well ... it would throw a script error
if (isScripting humanInstance then { [] call BRAIN_fnc_Chat; };
== errors in arma anyway
really?
((which is basically the explicit equals === ))
well FU :P
enjoys to cause some chat stir by late night channel description
you are missing that /me arent you
it's emphasis, so Italic aka it looks different ;)
well ONT :P
http://puu.sh/kS97P/269438ff83.jpg
brag brag
note who ever designedTreeView is special
Hahaha
finaly i dont need to JSON decode an array to see whats in it where XD
and how do I find the namespace?
I can't... I need them to pop normally until that section of the script, where I don't want them to pop.
So I have 100-800m range targets.
Only the 800m targets shouldn't be popping back up, until they are needed. (ofc atm they are popping back up aka normal behaviour)
hence this being an extract of target 8, lane 1.
Youre think of it wrong.
There are multiple namespaces, most importantly the missionnamespace and the objects themselves. You just have to know where you set something so you can access it later.
For the noPop, you want to put it into the unit-namespace which is the unit itself
wasn't nopop supposed to be defined in missionNamespace (i.e global var)?
seems to say so
disable pop
do it yourself manually
is that not possible?
that page seems to suggest that you can animate the targets yourself using the terc animation
seems to work when set on a specific object
Anyone know how I can remove patches from virtual (or ACE) arsenal? There are many hundreds in my arsenal.
I use ACE arsenal and it's whitelist only.
if ((_target getVariable ["nopop", !isNil "nopop" && {nopop isEqualTo true}]) isEqualTo true) exitWith {true}; the code that checks for a first target that got under my cursor ("Hostage_PopUp3_Moving_90deg_F")
checks local, defaults to missionNamespace if no local 🤔
ok. then what's the problem?
Animate isn't noPop
I want this to be repeatable and for anyone to use. I really dont need to have someone accessing Zeus just to disable noPop. It's a pain.
who knows? Are the targets really named that? What are the classnames of used targets? What's the exact code that sets "noPop" and where is it called?
if you use it with a timer it is
This shows noPop and how it's supposed to work.
this here shows what target I shouldve been using, and now am.
as said here. Targets are named. t8_1 (Target800m_Lane1) so:
t8_1 t8_2 t8_3 t8_4 t8_5 t8_6 t8_7 t8_8
as the target variable names.
Animating targets, doesnt ensure they stay down when hit.
hence the need for no pop on this specific part of the range script.
What are the classnames of used targets? What are the classnames of used targets?
this?
this exact one https://i.gyazo.com/63415d0080ddbab01d66b182de82d2ff.png
yeah, that one is slightly cursed, it uses other function to pop up. And doesn't check for "noPop". And doesn't seem to be able to have both falling down and staying down forever at the same time
targets from this list: https://pastebin.com/BfrbjBim (entries formatted as ["className", "displayName"]) are likely to respect "noPop" 🤷♂️
ugh its one of the only ones that have the scoreboard, which is the other issue
yeah, "being cursed" and "having a scoreboard" are one and the same
JSON array?
continuing on the topic of being cursed: sqf // Defines #define TRUE 0 #define FALSE 1
wait wait wait ...
taken directly from "\a3\functions_f_bootcamp\training\fn_target.sqf" that's used as everything-handler and scoreboard on supported targets
never checked the treeView
it seems to wait for this amount of time: _targetPopupDelay = _object getVariable ["RscAttributeTargetPopupDelay", so doing something like t8_1 setVariable ["RscAttributeTargetPopupDelay", 9999] can (in theory) make them stand down for long enough 🤔
seems to work. And resetting with _target animate ["terc", 0] seems to work as well (and fn_target seems to respect the externally changed animation state) 🤷♂️
well arma array can be decoded as JSON array eg displayed :P
@queen cargo well Displayed as JSON array as most parsers work on it
LOL, VERY cursed
Whenever there is a vehicle created using the "GroundWeaponHolder_Scripted" classname, can they actually refilled after taking out the item from the container itself?
Ty!
In a totally unrelated note, commands that "fail silently" allow the execution of the rest of the scripts in which they are part of?
Is there any list of commands that fail silently?
last I checked all commands allow that. the only way the rest a of a code wouldn't execute is if the "flow" changes
i.e when you use loops, if, etc.
also happens if you just break the whole code...
Hey, very very quick question that I can't work out, is there a way of seeing if a value is between two numbers? I know >= and <= exist, but I don't believe you can use them at the same time. Thanks 🙂
you can, by combining them using &&
you can, use an AND operator or double ampersands (&&)
and other way is using abs(num - center) < halfDist|
center is (min + max) / 2 and halfDist is (max - min) / 2
Ah, I see where I've gone wrong
I tried if (v1 >= 0.35 && <= 0.65) then
But that's clearly wrong because after I've done &&, I don't list the variablename again
yes, you are missing the variable to compare
on this note:
if (abs(v1 - 0.5) <= 0.15) then
That actually looks a lot neater, I might steal that 👀
it could be less readable if you don't know where those numbers come from tho 😉
the arithmetic logic in that operation MIGHT be confusing on the long run, if you use that method you might want to add a comment to be reminded of why you are doing it like that
I can say where the numbers are coming from, I pulled them from my arse 
Random values for testing right now, going to tweak it after I've got a base concept.
yes, this seems to be the case. I though that they straight up broke the scope of the script somehow 
does this formula has a name btw?
distance? 
in this case, 1D distance ofc
the 2D version would be a circle
3D version sphere
is there any reason to write extra logic when 2 comparisons seem good enough, though?
yes. to be "that" guy 😅
it might be faster in SQF. idk
One more, I've got this
isLookingAt = worldToScreen ASLToAGL getPosASL Drone;
``` and I run this through an if statement, when the drone is not on the screen, it returns an Error Zero Divisor because it 'attempts to access an element of an array which does not exist.' I'm already using the else statement with if statements inside of that, but is there a way I can do something along the lines of```sqf
if (isLookingAt = null) then...``` I've tried that, and it just seems to shit itself 😄
_x >= 0.35 && _x <= 0.65 and abs (0.5 - _x) <= 0.15seem pretty equivalent speed-wise on my machine with _x >= 0.35 && {_x <= 0.65} being like 10% slower
why do you use so many global vars...?
anyway, = is for assignment, == is for equality
also there is no such thing as null
isLookingAt would not be null anyway. it would be an empty array if the drone is offscreen
but there's such thing as isNull, though 🤣
and there is a dedicated command to compare null data types too
isNull something
yeah but arrays can't be null
I meant to use == haha, my bad. Also, yes, I definitely need to start using private variables.
not just objs but other stuff that can be null, e,g, groups, controls, displays, etc.
script handles...
Is there any point in stopping this error then? It doesn't affect the script in any way as far as I can tell, but it's slightly annoying that if I have the gun equipped it just keeps returning this error whilst I'm not looking at the drone.
I told you why
yes, data types, my b
That makes sense, thanks 🙂
The treeview is annoying to work with
I did the same thing for invenotry listing.... HO LE CRAP it was anoying
retaking this thing from earlier today, it seems that I have an issue with this type of containers.
Whenever I create X amount of this containers and populate them with item from an array of items filled with classnames that can be mags, items, weapons etc. I pushback them into a control variable to be able to repop them every Y seconds.
During this first creation the creation and population of each item happens accordingly and they are perfectly fine.
But when I iterate through them using my control variable to re populate their inventories, first cleaning their inventory and then re-adding stuff exactly like the first time, only certain classes of items are added, everything that is a magazine for example is not added back.
I tried troubleshooting this issue and started pulling my hairs out until I just decided to entirely delete the containers in my control array, cleaning the array and going back through the process of creating and populating them, however, the issue still persist when its not the first time I run my code, containers still happen to be empty if they are magazines.
The only real time they get populated correctly is during the first run.
Here the paste bin, since the thing is too long, function is slightly altered to contain just the crucial code, everything else is just moving internal variables for the rest of scripts in other places:
https://pastebin.com/b0NmNSmn
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
is there any reason of why would a container of this type fail to populate at all? Do they perhaps have a weight limit?
Is this just Arma armaing me or is there an actual reason of why would weaponHolders would fail to populate?
Note: line 35 _x is in reality _objectCreated, i just forgot to change it for the bin
https://community.bistudio.com/wiki/screenshot can I adjust the screenshot ""; code to save a file as MYMISSIONNAME_YYYY_MM_DD_hh_mm_ss.png? Is it possible to inject a phrase into that? Adding anything in "" will change whole file name.
Welp, solved, rewrote the entire script and it now suddenly works every single time....
Hey guys, does anyone know if its possible for AIs to shoot during animations? For example, if I give an AI the "Acts_crouchcoveringfire_blabla" - Forgot the full name of it, is it possible to make a script so the AI shoots when he does.. the covering fire bit?

