#arma3_scripting

1 messages · Page 40 of 1

little raptor
#

that's not how you measure the performance of a spawn or PFEH anyway

sullen sigil
#

oh

little raptor
#

you measure what they run

#

not their creation

kindred zephyr
#

not their creation

#

yup

sullen sigil
#

Oh right -- I assume you just run it as scheduled if it's a slower script?

little raptor
#

yeah

#

and if you don't need the result immediately

sullen sigil
#

It'll still run top down etc won't it?

little raptor
#

top down?

sullen sigil
#

line by line

little raptor
#

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

sullen sigil
#

The script inside of the scheduler will get run line by line though right?

kindred zephyr
#

yes

sullen sigil
#

i.e I don't need to worry about variables not being present yet in the next line of code

little raptor
#

I don't think you understand what the scheduler is

kindred zephyr
#

it will pause every 3ms (?maybe more? i dont remember) for the next script in sch to run tho

little raptor
#

or what schd vs unschd is

sullen sigil
#

I don't think I do either

#

I just know scheduled lets you wait

kindred zephyr
#

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"

sullen sigil
#

Oh right

kindred zephyr
#

im sure Leo can give a more indepth explanation, im not versed enough to explain at detail

little raptor
#

you already mentioned the important parts... 😅

little raptor
#

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

broken forge
#

How would I stop a RscVideo from playing when the player closes/exits the gui?

kindred zephyr
#

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

sullen sigil
#

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 meowsweats

little raptor
#

yeah

little raptor
sullen sigil
#

I'm adding them via preinit/postinit in config

little raptor
#

try running them manually during the mission

sullen sigil
#

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

little raptor
#

if that still doesn't work maybe your profileNamespace or CBA settings in general are corrupt

sullen sigil
#

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 " 😐

next kraken
#

is there a way to show cinema borders without the official function. i want players still be able to move around

digital hollow
#
_unit limitSpeed (-1 * (_unit getSpeed "SLOW"))

above code now makes units walk backwards. it didn't used to, right? and helicopters fly backwards?!

manic kettle
digital hollow
#

Yeah for sure it used to be reset limit for values <= 0

manic kettle
#

That's what the page says

digital hollow
tough abyss
#

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;
};
}];
};

south swan
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
tough abyss
#

thanks

south swan
#

and you don't need to add an Event Handler in loop. Just once is enough.

tough abyss
#

dead

south swan
#

in case you have previews disabled

tough abyss
#
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; 
 }; 
}];
};
tough abyss
#

Let me try this then

#

question is it better to just add this in init or create a loop.sqf instead?

south swan
#

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 in while {true} loop - you crash the game :3

tough abyss
#

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

south swan
tough abyss
#
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

south swan
#

is it called exactly "initServer.sqf"? No ".txt" in the end?

tough abyss
#

yes

south swan
#

are you running it in editor or, say, on dedicated server?

tough abyss
#

I'm playing it on mp

south swan
#

define "on mp", please

tough abyss
#

just lan server?

south swan
south swan
tough abyss
#

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

still forum
#

Break is a thing

still forum
winter rose
#

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"

spark turret
#

can find the file in C:/Users/yourName/appData/local/Arma3 i think

tough abyss
#

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?

stable dune
#

Or
Triggered when an entity is created.

addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
If (side _entity = "civ") then
{};
}];
spark turret
#

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.

tough abyss
#

"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?

tough abyss
#

currently reading this get an idea

tough abyss
tough abyss
#

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)

idle jungle
#

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
stable dune
idle jungle
#

or would this suit better?

this addAction ["Set Rally", {"respawn_west_1" setmarkerpos getpos sl1;
tent1 setpos(getpos sl1);}] remoteExec ['Spawn', 2];```
stable dune
idle jungle
#

ohhh okay gotchya!

#

is one of the 3 "0" distance by any chance

stable dune
idle jungle
#

Sorry wanted to know if i could make the tent spawn x distance away from the unit

stable dune
#

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];
winter rose
#

!quote 5

lyric schoonerBOT
winter rose
copper raven
#

also use vectorAdd

winter rose
#
tent1 setPosATL (_pos vectorAdd [0, 2.5, 0]);
winter rose
stable dune
winter rose
#

Le French keyboard hon hon hon

stable dune
#

So @idle jungle did you get what you need to change?
Use vectorAdd instead of setPos

#

Like in Lou's example

dry mesa
#

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?

winter rose
#
if (getPlayerUID player in arsenalPlayers) then
{
  // then
}
else
{
  // else
};
warm hedge
#

You can add action only for certain players, no need to use condition to check

winter rose
#

either that, or add two actions, one with "getPlayerUID _this in arsenalPlayers" and one with "!(getPlayerUID _this in arsenalPlayers)" (but that's less cool)

tough abyss
stable dune
#

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
}];

tough abyss
#

Oh thanks!

tough abyss
stable dune
#

Fixed, forgot those params

dry mesa
#

Any easy option to remove the action of "Inventory" from a box?

warm hedge
#

You mean you want to remove the way to access into a box?

tough abyss
# stable dune Fixed, forgot those params

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>

stable dune
kindred zephyr
# winter rose well, you came here talking about caching so I expect you to know 😄 but, basic...

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.

tough abyss
tough abyss
#

Is that right?

winter rose
digital hollow
#

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

neat monolith
#

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

winter rose
#

you would have to get the vehicle's "side" in some way

neat monolith
#

I just made a trigger for each vehicle and it worked, Thanks anway

wooden moss
#

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]"];```
south swan
#

"!_target getVariable ['inUse',true]" gets parsed as "(!_target) getVariable ['inUse',true]", not "!(_target getVariable ['inUse',true])"

wooden moss
#

How can I fix that? Do I just add brackets to the place you show?

south swan
#

yes

wooden moss
#

Thanks a lot.

wooden moss
#

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, "%""];
};```
south swan
#

" placement doesn't really make much sense. Did you mean hintSilent format ["Download in progress : %1%2", _i, "%"];?

wooden moss
#

Ohh. Sorry, I am a very bad programmer, and this is a very old code I am trying to fix.

winter rose
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
winter rose
#
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 :)
};
wooden moss
spark turret
# winter rose ```sqf for "_i" from 1 to 100 do { if (player distance laptop > _maxDistan...

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

hallow mortar
#

Double ; make me sad

spark turret
#

i got one free bc i was the 1millionst customer

serene sentinel
#
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

spark turret
#

what the hell

#

idk dude what going on

#

note the var evaluation below works fine

drowsy geyser
#

is there a way to get the gamma/brightness value?

serene sentinel
#

@spark turret yeah, i see

spark turret
#

do you have a ghost character in there

#

rewrite it all. it works after i rewrote it

serene sentinel
#

hmmm, ok, will try

granite sky
#

Yeah, there's a ghost character at the point marked.

#

Don't paste stuff from Word or whatever :P

spark turret
#

but where else would i write my code?!?

serene sentinel
#

@granite sky yeah, it was pasted 🙂 Thank you, mates.

stable dune
# spark turret
_o = {
    params ["_unit"];
    _priWeap = primaryWeapon _unit;
    _unitMagArr = magazines _unit;
    _compMagArr = compatibleMagazines _priWeap;
    systemChat str _priWeap;
    systemChat str _unitMagArr;
    systemChat str _compMagArr;
};
[player] call _o;
spark turret
#

wors for me

stable dune
#

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

green kiln
#

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?

little raptor
#

if you mean other scripts, call doesn't block them anyway

little raptor
green kiln
little raptor
#

that's not how you pack things

#

you've put a pbo inside the pbo...

green kiln
#

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?

little raptor
#

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

little raptor
#

init files have to be completed before game loads

#

so if you put a while loop there it will block the game

hallow mortar
#

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.

worldly jasper
#

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!

tough abyss
#

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...

▶ Play video
#

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

little raptor
#

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

steel mantle
#

Do anybody know how laser beams are scripted? and classname to create a laserbeam?

tough abyss
#

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

little raptor
#

yeah. or ones made in blender

tough abyss
#

Blender, is that on the workshop?

#

Never seen that

little raptor
tough abyss
#

Oh xD

little raptor
#

also the game has some built in animations similar to the ones in that video iirc

#

like viper unit anims

tough abyss
#

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?

little raptor
#

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

little raptor
tough abyss
little raptor
#

it just captures position, velocity, direction

tough abyss
#

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

little raptor
tough abyss
#

They become suicidal

#

Oh

#

I see

#

I thought it just captured what you are doing

#

when recording

little raptor
#

even when a character is standing in place he's playing an anim

#

the non-animated character has a T pose

tough abyss
#

Ah, ofc

#

Makes sense now thinking about it

#

So, there is no way of getting his legs to move when using unitcapture?

little raptor
#

you can play the animation manually yourself while unitPlay is running

tough abyss
#

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

tough abyss
#

But the legs arent moving

#

He just slides on the ground

#

xD

little raptor
#

...again legs moving is an ANIMATION

#

if his legs don't move you're not playing the animation

#

unitCapture/unitPlay is not animation

tough abyss
#

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

little raptor
#

like I said unitCapture doesn't capture animations

#

just movement

tough abyss
#

Yeah, he might have cut that part out then i would assume

#

Thanks either way Leopard!

little raptor
#

for playing anims

tough abyss
#

Thanks man!

little raptor
#

then use it on the AI

#

just for testing you can run this:

myGuy playMoveNow "AmovPercMrunSrasWrflDf"
tough abyss
#

Ill try that now

little raptor
#

replace myGuy with the var name of an AI

tough abyss
#

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?

little raptor
#

no

tough abyss
#

Ah damn

little raptor
#

you should do that manually

tough abyss
#

Yeah I see what u mean

little raptor
#

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

tough abyss
#

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

little raptor
#

you might be able to find existing scripts for that tho

tough abyss
#

Yeah, tried but cant find the right one

#

But ill have another look

little raptor
#

I simply googled arma 3 unit capture script infantry

tough abyss
#

Ah, nice. I just started with unit capture today. Before I was looking for a script to do it all for me xD

worldly jasper
timber shore
#

if (player == shark) then attachObject "friggen_lazer_beam"; attachObjecTo "head";

#

sorry too tempted

steel mantle
#

Not sure if real or a joke

sullen sigil
#

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};```
lavish stream
sullen sigil
lavish stream
sullen sigil
#

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 thonk

lavish stream
#

And it exits with true?

sullen sigil
#

Oh yeah, just true is after that but yes returns true

lavish stream
#

But you're only running the codeblock you posted in debug? Nothing else?

sullen sigil
#

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
lavish stream
#

Remove true, what does it come back with then?

sullen sigil
#

Nothing returned

lavish stream
#
_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?

south swan
#

Uniform in vests?

sullen sigil
#

...bruh

#

thats probably it

#

i will try both shortly

lavish stream
#

Try what artemoz said first.

sullen sigil
#

roger doger

copper raven
#

copy pasta mistake

lavish stream
#

Although even with

Uniform in vests?
You might have a bigger problem if that returned true.

sullen sigil
#

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 meowsweats

lavish stream
#

Great, now lazy eval it boyo.

sullen sigil
#

I've got to add toggles for primary weapon, secondary primary weapon, launcher etc and checks for them now too 😄

lavish stream
#

This looks familiar

#

..Wasn't this in the ACE discord a few days ago?

sullen sigil
#

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 😅

lavish stream
#

Just out of curiosity, what is this condition actually for?

sullen sigil
#

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

sullen sigil
lavish stream
#

You need a rubber duck

sullen sigil
#

i have schizophrenia so im sorted

lavish stream
#

Several rubber ducks, nice.

sullen sigil
#

I'm not sure if toggling inside of the if statement is even possible

copper raven
#

what's the point of checking if it's an empty string?

lavish stream
#

Top of my head:

  • Turn it into function.
  • Switch statement for each type with return value.
  • Figure out from there.
sullen sigil
lavish stream
#

(_playerUniform != "") <

sullen sigil
sullen sigil
#

nudity isnt standard issue in any militaries im aware of

copper raven
#

also that if statement is redundant

#

you can just return the condition

sullen sigil
#

that is true

#

i think i did this too late at night

copper raven
#

also lazy eval

#

and parse once

lavish stream
#

You're never gonna hear the end of lazy eval.

copper raven
#

vs parsing constantly (im not sure if you reuse this script more than once)

sullen sigil
#

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

lavish stream
#

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.

sullen sigil
#

Yeah though someone running around with US uniform/vest/helmet with russian backpack gun etc may be something mission makers want to not allow

lavish stream
#

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.

sullen sigil
#

I suppose there is no switch statement that'll evaluate all of the cases so probably for the best tbh

lavish stream
#

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.

sullen sigil
#

I still need to figure out how to make the player go overt again after firing in military disguise without making it pointlessmeowsweats

lavish stream
#

How are you making them undercover?

sullen sigil
#

setCaptive with a check for ACE unconscious or captive (as to not set them not captive whe uncon or captive)

lavish stream
#

uh, fired EH?

sullen sigil
#

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

lavish stream
#

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.

sullen sigil
#

I think I'll just make firing increase a points variable or something that otherwise decreases slowly

worldly jasper
#

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?

manic kettle
worldly jasper
zenith totem
#

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 ()
            ];
        };
    };
};
zenith totem
zenith totem
#

Won't that have the same problem of triggering when the object is created/loaded, rather than just when the user has placed it

lavish stream
#

Give it a try

#

Third example indicates it should work.

#

Ah, re-read what you initially wanted.

zenith totem
#

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

stable dune
#

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)

granite sky
#

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.

stable dune
#

So how do i append _killer from EH to killerList array via remoteExec

stable dune
granite sky
#

Ideally you make an update function that you can remoteExec.

stable dune
#

Or some1 have some workaround to get list of killers

stable dune
granite sky
#

And then clients would do something like [_killer] remoteExecCall ["MyTag_fnc_addToKillerList", 2]

stable dune
copper raven
#

use an EntityKilled EH server side, then you won't need any REs, and also won't need to add Killed EHs everywhere

granite sky
#

Oh yeah, that works for that one.

granite sky
#

mission event handlers are often really good for that stuff.

stable dune
#

True

stable dune
stable dune
#

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

copper raven
#

looks like you want a hashmap here and not an array

stable dune
#

sure

#

But i do not know how i define that and how i should build that correclty

granite sky
#

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.

stable dune
#

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.

stable dune
gritty parrot
#

Ace killtracker could be of use for this task

granite sky
#

Do you want that number preserved over reconnections?

gritty parrot
#

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

stable dune
gritty parrot
#

Gotta go will catch up later

stable dune
copper raven
granite sky
#

If you use playerUID instead of netId then you get the preservation over disconnects.

#

Otherwise identical.

stable dune
#

Thanks guys! this helps me alot.

#

How do i define TAG_teamkillHashmap at start?

stable dune
#

is that just = [] , or do i need define something more

granite sky
#

TAG_teamKillsHashmap = createHashMap;

stable dune
granite sky
#

createHashMap just creates and returns an empty hashmap.

copper raven
crystal lagoon
#

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?

proven charm
drowsy geyser
#

is there a way to get the gamma/brightness value?

little raptor
drowsy geyser
#

I really don't know

winter rose
hallow mortar
#

I'm a bit surprised there isn't a command that just returns an array of all graphics settings

spark turret
#

and all setting names are in czech. not further description, other than the array is between 100 and 200 entries long

drowsy geyser
winter rose
#

I am not the one to ask 😄
why do you need that though?

pale gulch
#

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

tulip ridge
#

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

proud carbon
#

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?

tulip ridge
#

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

winter rose
#

trigger or waypoint yes

hallow mortar
#

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

tulip ridge
#

Gotcha that makes sense

#

I'll simply turn the player into a trigger, perfect

winter rose
#

*poof*

hallow mortar
#

If you just want a particular sound without the randomisation stuff from CfgSFX, use playSound, playSound3D, say3D etc instead.

winter rose
#

you can define a mod sound in CfgSounds and do as NikkoJT suggestst above yes ^

tulip ridge
#

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

winter rose
#

you can create a sound source

#
private _soundSource = createSoundSource ["TheCfgSFXModClass", getPosATL player, [], 0];
_soundSource attachTo [player, [0,1,0]];
#

@tulip ridge ^

tulip ridge
#

It doesn't seem to play any sound

sullen sigil
#

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

tulip ridge
winter rose
winter rose
still forum
sullen sigil
#

Ah, wanted to see if it was possible to run it upon respirators being equipped

winter rose
#

and you can lower the sound volume (to 0) in v2.12

kindred zephyr
#

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

winter rose
#

I think so
array shifting happens if you remove items

still forum
#

Yes you can, with an array

kindred zephyr
winter rose
#

yup
[0, 1, 2, 3]
if (_index == 2), remove 2
[0, 1, 3]
next iteration… ERROR

kindred zephyr
winter rose
#

hashmap

pulsar bluff
#

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

sullen sigil
#

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

steep hornet
#

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]

hallow mortar
#

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)

steep hornet
#

Appreciate it! Will download that mod and check it out too

steep hornet
#

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};
    };```
west portal
#

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 .

little raptor
south swan
#

inb4 "creating" as in "saving to the disk"

west portal
hallow mortar
#

It's direct enginestuff and not fully accessible through SQF

west portal
#

fuck, selection doesn't seem to be settable too . ty

south swan
#

do3denaction 'createcustomcomposition' and what's after that is likely to be in-engine

west portal
icy seal
#

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

stable dune
icy seal
#

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.

icy seal
stable dune
#

Forced. Sry. My bad

icy seal
earnest shard
#

Hi, how to enlarge size of list box elements?

true frigate
#

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 😛 )
south swan
true frigate
#

Wow there's also actually an exponent function. I didn't notice that.

little raptor
tough abyss
#

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

kindred zephyr
tough abyss
kindred zephyr
#

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

tough abyss
#

oh, so I put in the script in there?

#

inside open and closed brackets

kindred zephyr
#

yes, inside the curly brackets

tough abyss
#

2nd day learning sqf xD Its quite fun to play with

#

Thanks, will give that a shot

kindred zephyr
kindred zephyr
real tartan
#

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.

south swan
real tartan
rich nexus
#

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 ??

rich nexus
fleet sand
#

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];
kindred zephyr
# fleet sand Put the script in init of a object. Here are a couple of examples: ```sqf this ...

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

solid ocean
#

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.

kindred zephyr
solid ocean
#

im using the defoliating mod also

kindred zephyr
#

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.

solid ocean
kindred zephyr
#

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

fleet sand
solid ocean
solid ocean
fleet sand
solid ocean
#

hmm ill figure it out

#

either triggers or something

kindred zephyr
fleet sand
kindred zephyr
#

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

solid ocean
kindred zephyr
#

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

granite sky
#

Not sure you can deleteVehicle on map objects? Might have to hide those.

solid ocean
kindred zephyr
fleet sand
# solid ocean *stumped* once again *ill see myself out*

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,"",""];
icy seal
#

Anybody see what's wrong with this script? It must be my exhaustion

if (count units inArea) thisTrigger == 3 then {true} else {false};

solid ocean
open hollow
kindred zephyr
open hollow
fleet sand
open hollow
#

Setdammage will make them fall, but for now is random, in next patch will be posible to make them fall away of the player

icy seal
#

@kindred zephyr @open hollow it keeps saying it's missing )

kindred zephyr
#

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

icy seal
#

It's weird

kindred zephyr
icy seal
#

It's giving the "Missing )" error

open hollow
open hollow
kindred zephyr
icy seal
open hollow
open hollow
# open hollow {_x Inarea thistrigger} count allunits

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

open hollow
icy seal
#

It was:

if (({_x Inarea briefingtrigger} count allunits) == 3) then {true} else {false};
#

Lol how do you guys do the coloured code blocks?

kindred zephyr
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
kindred zephyr
#

@icy seal

icy seal
sullen sigil
#

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 ![facepalm](https://cdn.discordapp.com/emojis/978008080941993995.webp?size=128 "facepalm")
winter rose
#

GetOutMan

sullen sigil
#

indeed it works "perfectly" now

#

still have animations but better than nothing lol

winter rose
sullen sigil
#

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

tough abyss
kindred zephyr
tough abyss
#

So, I recreated the first checkpoint scene, and im glad it worked out! 😄

crystal lagoon
#

Is there a way to add an action to civilians globally so that any player can make them set their state to surrender?

open fractal
crystal lagoon
#

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

open fractal
#

Is there a code on unit created box in the module

crystal lagoon
#

I've tried just adding a blank action as a test, but it doesn't seem to be working

open fractal
#

send the code you used

crystal lagoon
#

_this addAction ["Test"];

open fractal
#

why are there brackets around addaction

crystal lagoon
#

That was my previous test, because it's telling me that I'm missing a left bracket

granite sky
#

ok, you don't want to take those errors as written :P

open fractal
#

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

crystal lagoon
#

It still needs a remoteExec even if the module itself is adding the action?

open fractal
#

Not in singleplayer, in multiplayer maybe. It depends whether the code is executed globally like object init or only serverside

copper raven
#

either of those you would put in something like initPlayerLocal.sqf, filter by side in the EH and add the action

manic kettle
#

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

copper raven
crystal lagoon
#

I haven't really dug into eventhandlers yet.

manic kettle
#

I recommend one of the many youtube videos on them, it helped me a lot

copper raven
crystal lagoon
#

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"]

#

?

copper raven
#

"CAManBase" is what you would want to look

#

unless you have one specific civilian type

manic kettle
#

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?

copper raven
crystal lagoon
#

Oh, so CAManBase is just like, the base human model of the game?

copper raven
#

checking through factions is the last thing you want to do

crystal lagoon
#

Ahhh, ok

copper raven
#

all unit classes inherit it

crystal lagoon
#

That's very helpful

copper raven
#

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

solid glacier
#

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 😅

crystal lagoon
solid glacier
#

would be nice to give people the option to disable the volumetric clouds and not have it be persistent

copper raven
crystal lagoon
#

How come it needs be added to the players locally rather than the server?

copper raven
#

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

crystal lagoon
#
    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

copper raven
crystal lagoon
#

Ah, ok

copper raven
#
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

crystal lagoon
#

Good lord

copper raven
#

also that requires a remoteExec just realised, setCaptive takes local argument, edited the code

crystal lagoon
#

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

copper raven
#

which part is confusing?

crystal lagoon
#

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

copper raven
#

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)

crystal lagoon
#

Is that larger block of script meant to replace the previous?

copper raven
#

which previous?

crystal lagoon
#

The smaller one that I had.

copper raven
#

the code i sent is plug and play, nothing else is needed

crystal lagoon
#

Why does it need a remoteExec rather than just running the script?

copper raven
#

which basically means that the unit must be local to the machine that is executing this command

#

that page also covers remoteExec

crystal lagoon
#

Ah

#

Well, the script adds the action, but it doesn't seem to be executing it

#

I'm testing in a MP environment currently

copper raven
#

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)

crystal lagoon
#

You're right

#

But they're not stopping. Puzzling

copper raven
#

making them captive won't make them play any animations or stop

crystal lagoon
#

I guess I'm looking for "surrender" then

#

Or somesuch

stable dune
copper raven
sullen sigil
copper raven
crystal lagoon
#

"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

copper raven
crystal lagoon
#

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

crystal lagoon
#

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?

copper raven
#

yes

crystal lagoon
#

Excellent. Thank you

pine rapids
#

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 😅

proven charm
#

relativeCoord = buildingCoord - furnitureCoord

#

but you need to take account the building's rotation as well

pine rapids
#

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];
copper raven
#

setDir would be fine here even i think, depending on your use case

leaden ibex
#

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.

spark turret
#

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.

echo wolf
#

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!

pine rapids
# copper raven you could just use https://community.bistudio.com/wiki/modelToWorld

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...

kindred zephyr
#

iirc you can turn compositions into sqf to deploy faster

pine rapids
#

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?)

copper raven
#

dir 0

#

else it will be all wrong when you recreate it on different buildings

stable dune
#

I get my object to correct place with Lou's example to get

pine rapids
#

I knew it.

copper raven
#

🤔

pine rapids
#

It considers the banner a building apparently.

copper raven
#

try "House" instead

pine rapids
#

It did the trick with House_F

copper raven
#

Building is probably inherited by many things that aren't actually buildings 😅

pine rapids
#

Nearly there.

#

I'll see if I can fix that clipping

copper raven
#

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

pine rapids
#

Wonderful! Thanks!

#

Heh, might need to add some variation.

south swan
#

probably caused by you only ever adding any data to element 2 (index 1) of listbox

echo wolf
#

Anyone have experience with crate loading and unloading scripts?

winter rose
#

perhaps

lime frigate
#

Is it possible to pass parameters into an sqf or do I have to somehow make a function?

south swan
#

define "into an sqf"

lime frigate
# south swan 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

south swan
#

function spawnai(point,side) { is not a valid SQF syntax. At all.

lime frigate
#

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

echo wolf
#

@winter rose made a post earlier about where to start with one for an exile server I run

storm arch
#

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?

echo wolf
#

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

winter rose
#

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

echo wolf
#

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

digital hollow
#

Check out the BoxLoader mod if you just want some functionality

willow hound
echo wolf
#

@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

digital hollow
echo wolf
#

Got it. Thanks again!

winter rose
#

a Stringtable is the way to go
now hints with giant texts are not great, either

south swan
#

inb4 custom field manual entries with cursory hints

winter rose
#

line return?

#

try either \n or <br/>

#

ooor… endl as the doc says 🙂

kindred zephyr
#

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
south swan
#

is there any reason to even use BIS_fnc_buildingPositions when _bld buildingPos -1 returns all positions already?

kindred zephyr
#

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

pulsar bluff
tulip ridge
#

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

copper raven
#

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

boreal parcel
#

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}};
tulip ridge
copper raven
#

that's exactly what it does

#

what do you have in scripts\clear_kit.sqf?

tulip ridge
#
// 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;
copper raven
#

yeah, so

#

you shouldn't even be able to tell when it completes, it happens fast

#

see note from Leo on call

copper raven
#

so you get something like [obj1, obj2, objOfFOB] apply ... > [nil, nil, [x, y, z]]

boreal parcel
copper raven
#

if FOB_typename is an object, why even look for it?

boreal parcel
#

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

copper raven
#

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;
boreal parcel
#

ah I should have been using isKindOf huh?

#

and thats a good idea

#

thank you ill try using that

copper raven
#

you can also just put the classname into nearestObjects directly

boreal parcel
#

oh really? I figured the second array was only for types or whatever you call it, Car, Tank etc

copper raven
#
private _maybeFobObj = nearestObjects [((KPLIB_respawnPositionsList select _idxchoice) select 1), [FOB_typename], 50] param [0, objNull];
copper raven
boreal parcel
#

ah ok I think I get it

copper raven
#

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.

kindred zephyr
# pulsar bluff in what cases is it giving incorrect Z?

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

copper raven
#

don't use BIS_fnc_buildingPositions

#

and yes, as the wiki states there its AGL pos

kindred zephyr
#

thanks for confirmation, Ill move from the function to the command versions

boreal parcel
copper raven
#

use the latter

#

it's faster

tulip ridge
# copper raven but anyway, like i said, you should compile your code once, either `CfgFunctions...

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

frank mango
#
};
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;
granite sky
#

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"

frank mango
#

I was under the presumption that "initialize" works on any target (guessing now, this isnt the case)

granite sky
#

Well, you can find out on line 38 of BIS_fnc_target in the function viewer

#

All Arma documentation should be considered suspect :P

frank mango
granite sky
#

Is that related?

#

I don't see any reference to "noPop" either in the function or the documentation.

copper raven
copper raven
frank mango
#

I have misunderstood, greatly.
What is missionNamespace (Because I read this as the variable name)

tulip ridge
granite sky
#

missionNamespace setVariable ["noPop", true]; is (normally) equivalent to noPop = true;. missionNamespace is the default global namespace.

frank mango
manic kettle
copper raven
#

Global namespace is shared by everyone and the server
not really true, you're talking about public variables here

manic kettle
#

Ah right, fixed

pulsar bluff
#

ive forgotten how to do transparency on PAA images

#

converted a PNG with transparency to PAA and lost the transparency

hallow mortar
#

I usually just use ImageToPAA and have no trouble (given the image has correct dimensions)

unreal quest
#

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.

warm hedge
#

I would do check if a file from the Mod exists in the game

unreal quest
#

How can I do that? Sorry, this isn't my strong suit

warm hedge
#

fileExists

unreal quest
#

Thanks!

copper raven
#

you can also look up CfgPatches

warm hedge
#

Well, somehow I didn't think up that

sullen sigil
#

sussy lou

fallen locust
#

that descreption of the chat anoys the crap out of me....

queen cargo
#

well ... it would throw a script error

fallen locust
#

if(script)then

#

no need for == it just anoys me when i see that :P

queen cargo
#

if (isScripting humanInstance then { [] call BRAIN_fnc_Chat; };

nocturne bluff
#

== errors in arma anyway

fallen locust
#

really?

nocturne bluff
#

that is

#

Boolean == Boolean

queen cargo
#

also true @nocturne bluff
would have to be &&

#

or isEqualTo

fallen locust
#

works!

queen cargo
#

((which is basically the explicit equals === ))

fallen locust
#

well FU :P

lavish ocean
#

enjoys to cause some chat stir by late night channel description

fallen locust
#

you are missing that /me arent you

lavish ocean
#

it's emphasis, so Italic aka it looks different ;)

fallen locust
#

note who ever designedTreeView is special

timber shore
#

Hahaha

fallen locust
#

finaly i dont need to JSON decode an array to see whats in it where XD

frank mango
still forum
#

just setVariable on the object

#

_object setVariable ...

frank mango
#

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)

frank mango
spark turret
# frank mango and how do I find the namespace?

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

little raptor
#

wasn't nopop supposed to be defined in missionNamespace (i.e global var)?

#

seems to say so

little raptor
#

do it yourself manually

#

is that not possible?

#

that page seems to suggest that you can animate the targets yourself using the terc animation

south swan
#

seems to work when set on a specific object

eager prawn
#

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.

south swan
#

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 🤔

little raptor
#

ok. then what's the problem?

frank mango
#

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.

south swan
#

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?

little raptor
frank mango
frank mango
frank mango
#

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.

south swan
#

What are the classnames of used targets? What are the classnames of used targets?

south swan
#

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" 🤷‍♂️

frank mango
south swan
#

yeah, "being cursed" and "having a scoreboard" are one and the same

queen cargo
#

JSON array?

south swan
#

continuing on the topic of being cursed: sqf // Defines #define TRUE 0 #define FALSE 1

queen cargo
#

wait wait wait ...

south swan
#

taken directly from "\a3\functions_f_bootcamp\training\fn_target.sqf" that's used as everything-handler and scoreboard on supported targets

queen cargo
#

never checked the treeView

south swan
#

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 🤔

queen cargo
#

ohh i see ...

#

your array is also no JSON string btw. @fallen locust

south swan
#

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) 🤷‍♂️

fallen locust
#

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

kindred zephyr
#

Whenever there is a vehicle created using the "GroundWeaponHolder_Scripted" classname, can they actually refilled after taking out the item from the container itself?

winter rose
#

yes

#

they are not auto-deleted (because _Scripted)

kindred zephyr
little raptor
#

i.e when you use loops, if, etc.

#

also happens if you just break the whole code...

true frigate
#

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 🙂

little raptor
kindred zephyr
little raptor
#

and other way is using abs(num - center) < halfDist|
center is (min + max) / 2 and halfDist is (max - min) / 2

true frigate
#

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

kindred zephyr
#

yes, you are missing the variable to compare

true frigate
#

Welp, sometimes it just takes asking 😄

#

Thanks anyway guys 🙂

little raptor
true frigate
#

That actually looks a lot neater, I might steal that 👀

little raptor
kindred zephyr
#

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

true frigate
#

Random values for testing right now, going to tweak it after I've got a base concept.

kindred zephyr
kindred zephyr
little raptor
#

in this case, 1D distance ofc

#

the 2D version would be a circle
3D version sphere

south swan
#

is there any reason to write extra logic when 2 comparisons seem good enough, though?

little raptor
#

yes. to be "that" guy 😅
it might be faster in SQF. idk

true frigate
#

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 😄
south swan
#

_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

little raptor
#

isLookingAt would not be null anyway. it would be an empty array if the drone is offscreen

south swan
#

but there's such thing as isNull, though 🤣

kindred zephyr
#

and there is a dedicated command to compare null data types too

isNull something
little raptor
#

yeah but arrays can't be null

true frigate
#

I meant to use == haha, my bad. Also, yes, I definitely need to start using private variables.

little raptor
south swan
#

script handles...

true frigate
#

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.

little raptor
#

so what you can check is _arr isNotEqualTo []

#

or count _arr != 0

true frigate
nocturne bluff
#

The treeview is annoying to work with

fallen locust
#

I did the same thing for invenotry listing.... HO LE CRAP it was anoying

kindred zephyr
# winter rose they are not auto-deleted (because `_Scripted`)

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

#

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

jade acorn
#

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.

kindred zephyr
tough abyss
#

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?