#arma3_scripting

1 messages · Page 180 of 1

broken pivot
#

Saved to files. Hopefully I remember Ive got this note. Thats really good explained brother. Thank you

#

BUT if Im checking with !isNull Im checking for: Is there something with not the value "0" or "null" or "nothing".
So in other words: Is there something existing with the var hinterhalt_sascha_tgr. Right?

#

If my knowledge is correct so far I can be sure that the trigger
got created and something about the activation or area code is wrong

hushed turtle
#

I don't have game running to test it, but isNull likely expects defined variables

broken pivot
#

Dont I define it in here with the " = " letter?

hinterhalt_sascha_tgr = createTrigger ["EmptyDetector", [18471.7,14284.1,0], true];
#

Or is "defining" something diffrent again?

hushed turtle
#

So those first three lines work without error?

broken pivot
#

No error at all

#

Thats why Im swetting haha.

#

Its just no output

hushed turtle
#

Ok, so it must be defined otherwise setTriggerArea and setTriggerActivation would complain

broken pivot
#

There are more ways to define then just do _localVar = definedNow?

#

Look what Ive found. Maybe this is helpful even if I think I got it right

hushed turtle
#

So you're not getting hint "Someones there!" ?

broken pivot
#

Nope. Im getting crazy. That seems so simple and takes so long haha

hushed turtle
#

I think I know why

broken pivot
#

Im excited and about to turn a cigarete 😄

hushed turtle
#

Command triggerActivated as I understand it, returns true if trigger have been activated before. But at the time of running that code, trigger have not been activated yet

broken pivot
#

Interesting idea. It could be true. Im gonna check for triggerActivated manually in debug now.

hushed turtle
#

Yes walk into the area and try that in debug console

broken pivot
#

Genie!

#

Ok lets go on 😄

#

You was right professor! Its because the script isnt running consistantly

#

I thought the system is always running the if cause and checks if something changed.

Ive now implemented a sleep 3; to implement delay and avoid the engine to otherwrite the hint.
It worked. It worked also 30 mins ago haha. I just wasnt able to read it.

#

Yes men! Im really happy. Yesterday Ive failed the 500th time to understand how to
create and edit the existing modules with only script.

But today I achieved the createTrigger thing and I understood how to create returns
with nil and null and also the if-causes are now available in my skill set so I can teach
my people 😄

To-Do: Learn modules by script. Learn how to script great createTask things 😄

I want to use the moment to say "thank you" to everybody who brought me here ❤️ Your great people
@winter rose, @hushed turtle, @pallid palm, @hallow mortar, @open hollow (sorry if I missed someone)

halcyon creek
#

So question for you, I have a script running but it seems to duplicate for every player rather than just running once, each is activated by a trigger "Player Present"

fnc_fiacontactend = {   
 [] spawn { 
  fiaphone say3D "ringtone"; 
  sleep 6; 
  fiaphone say3D "ringtone"; 
  sleep 6; 
  fiaphone say3D "ringtone"; 
  [0, "black", 5, 1] spawn BIS_fnc_fadeEffect;    
  sleep 5; 
  "EveryoneWon" call BIS_fnc_endMissionServer; 
 }; 
  
};   
   
[fnc_fiacontactend] remoteExec ["call", 0];
``` This is an example of one of the triggers, there are many others but they all follow the same basic structure of creating a function then using ```sqf
[fnc_myfunction] remoteExec ["call",0]; 
```  is there a way to stop these for being duplicated?
hushed turtle
#

First player activates then it plays ringtone for everyone?

halcyon creek
#

That part works, however it plays im quck succession twice, as in the code itself plays twice overlapping

hushed turtle
#

Are those tiggers repeatable?

halcyon creek
#

Negative

tulip ridge
#

That code creates a function, and then executes it on all machines. If you don't have the trigger set to "Server Only" each player will have their own trigger that they can activate

halcyon creek
tulip ridge
#

The function would be defined each the time trigger is run, that part doesn't matter as much here because the mission is ending after it runs but its something to know. The main thing is sending code over the network, which isn't good for network reasons.

Sending just the name of the function is also a lot less traffic than the entire code block

halcyon creek
#

I see, good to know

broken pivot
#

Hey people, Ive did a quick breake and went back with new energy
Im coming back with the same old questions Im hanging on since years.

How to create existing modules by script and fill in their blanks
What I want to do:
I wanna be able to use every existing module (like hidingTerrainObject, like createTask, like createSmokeShell etc.)
and edit it. For example, using a smoke shell module in a script and change the color
Or for another example create a "createTask" module and use it fully.

Please help me, Im really trying this hard other the years @tulip ridge, I think you could help me with this. Now its not 5.30 am...

exotic gyro
#

This is uh, an incredibly broad question

broken pivot
#

How do I start?

exotic gyro
#

By figuring out just one thing you want to do

open hollow
#

it finally worked 😄

broken pivot
#

Nothing more. And nothing less. And in case I want to use other modules I want to achieve the skill with all modules

bold rivet
#
_vorona = createVehicle ["M_Vorona_HEAT", _drone, [], 0, "CAN_COLLIDE"];
_vorona setPosASL getPosASL _drone;
_vorona setDamage 1;

someone knows how to make the vorona rocket immidently explode after spawning in?
because currently the setDamage 1; doesnt make it explode on spot.

bold rivet
#

thanks

eternal spruce
#

Good day everyone, is there any other way to remove grass from a map and keeping the maximum terrain detail other than setTerrainGrid 50;

#

setTerrainGrid 50; this works flawlessly in terms of removing the grass but the objects in my view distance gets removed or distorted

granite sky
#

You can mess with the grass models instead, I think. I used a CUP low grass mod that probably did that.

eternal spruce
#

@granite sky I'll give that a try but doesnt this only works for cup mods

warm hedge
#

setTerrainGrid is a command to set the overall terrain quality, not just grass. If you just want grasses be gone, use a Mod

edgy dune
fleet lotus
#

Am trying to make a mini mission where you look for a boat and call it in through an addAction. Am trying to get it where once your in a trigger it checks if you are looking at the boat by a combo of worldToScreen and checkVisibility but I keep getting an Error Suspending not allowed in this context. Am wondering if am doing this right or if I should go about it other way.

warm hedge
#

You cannot use sleep or waitUntil etc in addAction

fleet lotus
#

its not in the addAction its before that. am calling the waitUnitl to change a bool variable to call a If statement to add the addAction or not

warm hedge
#

So do you mean you ran this code in a trigger? Still invalid

#

Search by Scheduler or Scheduled Environment in wiki

fleet lotus
#

should I move this code to its own sqf file and have the trigger call the file then?

warm hedge
#

spawn will do

fleet lotus
#

thank you the error is gone

little token
#

Hello guys. Can someone tell me if there is any way to check which surfaceType is on the road the player is on? I've tried different ways. But I did not find the necessary functionality for this

granite sky
#

getRoadInfo?

little token
#

Unfortunately, getRoadInfo does not return a surfaceType

#

And surfaceType position player returns surfaceType of terrain beneath player, not road

granite sky
#

hmm, what's in the material parameter of getRoadInfo then?

little token
#

path to .rvmat file

granite sky
#

I'm not a modeller but I'm kinda surprised that none of these things are related :P

winged thistle
#

If I need to post code to get help, what service should I use to do so?

warm hedge
#

You can fetch rvmat as config and call it a day

indigo snow
#

codeshare, pastebin, hastebin, gist, github?

winged thistle
#

Let me rephrase: Is there a preferred service?

indigo snow
#

no

winged thistle
#

Ok, great. Thanks.

warm hedge
winged thistle
#

I'm trying to set a spawned AA vehicle's direction equal to the direction of the marker it is spawned on, but I can't seem to get it to do so. Code here: https://codeshare.io/46KxT

little raptor
eternal spruce
#

Ok, I'm confused on something. Why does this works perfectly fine to lower the landing gear of my first aircraft but does not work on the second aircraft

Pilot_1 action ["flapsDown", FA18_1];
FA18_1 action ["Land", FA18_1];```
`second:`
```Pilot_2 action ["LandGear", FA18_2];
Pilot_2 action ["flapsDown", FA18_2];
FA18_2 action ["Land", FA18_2];```
warm hedge
#

You may have some undefined variable

eternal spruce
#

Ok i tried this just now [FA18_2,["LandGear"]] remoteExec ['action',0,FA18_2]; and it works but only through the debug console and not in a script

warm hedge
#

Debug Console executes a script. So you are running a script

#

You need to specify more info

south swan
#

LandGear
Description Lowers the landing gear of an aircraft. In the case of AI-controlled aircraft, it has to be used in an each-frame loop to override the AI behavior (otherwise they'll raise the landing gear when they take off).
🤔 https://community.bistudio.com/wiki/Arma_3:_Actions#LandGear
fun stuff

eternal spruce
#

yes sorry i failed to mention it before you replid as i ws typing it

warm hedge
#

You failed to do what

eternal spruce
#

I didnt say it was in a script

warm hedge
#

All you do is script

eternal spruce
warm hedge
#

So you are saying FA18_2 is an AI plane?

eternal spruce
#

yes same as FA18_1

warm hedge
#

Both are?

eternal spruce
#

yes

#

but only one works

warm hedge
#

Then make sure both Pilot_2 and FA18_2 exist

#

And tell how do you run the code

eternal spruce
#

alright gonna check again

#

`0 spawn {

sleep 1;

[FA18_1, HLF_moveData_FA18_1_RTB] spawn BIS_fnc_UnitPlay;
[FA18_2, HLF_moveData_FA18_2_RTB] spawn BIS_fnc_UnitPlay;

sleep 1170; // time it take for the first airplane to make final approach to land

hint "Lower Landing Gear";
Pilot_1 action ["LandGear", FA18_1];
Pilot_1 action ["flapsDown", FA18_1];
FA18_1 action ["Land", FA18_1];

sleep 150; // second airplane approaching runway to land

hint "Lower Landing Gear";
Pilot_2 action ["LandGear", FA18_2];
Pilot_2 action ["flapsDown", FA18_2];
FA18_2 action ["Land", FA18_2];

};`

#

AndI tried remoteExec as well [FA18_SH_2,["LandGear"]] remoteExec ['action',0,FA18_SH_2]; but only in the console

warm hedge
#

remoteExec is not the concern

#

You sure you waited 150 seconds to see

eternal spruce
#

I did and i lowered the time to 60 seconds to see if anything changes but it was the same result

warm hedge
#

Also FA18_SH_2 is not FA18_2

eternal spruce
#

Would a trigger be any different?

#

tracking that as well and i changed it earlier

atomic niche
#

And can you confirm they actually exist? show your code to spawn them (or call the variable name in debug and see if they actually return something)

eternal spruce
#

@atomic niche Sorry just saw this but I don’t understand your question

winged thistle
#

I get 0 script errors, so I know it's probably just my code.

eternal spruce
#

I also I placed a trigger at the beginning of the runway with this:
condition: FA18_2 inArea thisTrigger;
On Activation: [FA18_2,["LandGear"]] remoteExec ['action',0,FA18_2];

#

this seems to work on the trigger but i dont know why not in the script

indigo snow
#

one thing i immediately want to tell you about is _forEachIndex

winged thistle
#

Is that the one that returns a pos in the array?

indigo snow
#

the current index number, yes

warm hedge
#

We are asking to check FA18_2 is the actually the name of the object

eternal spruce
#

yes thats the name

#

and also the trigger is a hit or miss

warm hedge
#

You sure? Not FA18_SH_2?

eternal spruce
#

Yea that was the original variable name i had before i asked for help but i started the scenario from scratch and changed the Vname

warm hedge
#

And do you mean that is FA18_SH_2, not FA18_2?

winged thistle
#

Ok.

eternal spruce
indigo snow
#

also try logging all the variables with diag_log _myVar and see if you have any wierd results

warm hedge
#

There is no FA18_SH_2

eternal spruce
#

oh think i see the error that was made now

#

i have different names in the script than whats in the editor

indigo snow
#

The actual error is probably in this

atomic niche
#

You also only have 1 pilot no?

winged thistle
#

I am sure I will. It's got to be a var value that's off.

indigo snow
#

_AA setDir ( markerDir "_x"

south swan
#

(only 1 pilot that matches the search query)

atomic niche
#

ah i see

#

but that pilot probably still has the wrong name then, hence we asked to check if they existed

indigo snow
#

it will look for a marker called "_x"

eternal spruce
#

I swear I checked each like and I didn’t find anything but in the editor there was a mismatch because I started over and used different names

#

This game is gonna drive me crazy

winged thistle
#

should just be _x?

atomic niche
#

for next time, just running

Pilot_2

in the debug console should return the unit, if it doesn't then it isn't properly defined/created

warm hedge
#

This is not about the game, about how the programing anywhere works

winged thistle
#

no quotes?

south swan
#

the best way to not get crazy because of mess - don't create a mess in the first place blobdoggoshruggoogly

eternal spruce
#

Thank you all for your help I just pulled an all nighter to fix working on this but I have to go to work y’all have a good one

indigo snow
#

yes, since the thing in the array will already be a string

#

e.g. have quotes

winged thistle
#

I'm sure that was a result of my desperation. I don't think it had quotes originally.

indigo snow
#

if you need to turn a variable into a string look into format

winged thistle
#

That one, I'm familiar with.

#

It's just been a long time lol

#

So where would you recommend using _forEachIndex?

indigo snow
#

FOR_obj1Tgts select ( count FOR_obj1Tgts - 1 )

#

you shouldnt actually need it

#

and I'm really confused by what you were tring there

winged thistle
#

Trying to get the vehicle of the current array element and set its direction

#

I put examples of what the arrays look like

finite bone
#

Whats the best way to remoteExec switchLight with (63 allObjects 0)? I can't for the love of god get it working. Nvm, go it working i guess.

winged thistle
#

That's what I got when I put them in the editor console

indigo snow
#

yea but FOR_obj1Tgts select ( count FOR_obj1Tgts - 1 ) should always be equal to _forEachIndex in this case

winged thistle
#

Well, that's handy 😄

indigo snow
#

also the first time youll be selecting the -1 index

#

on a 0 length array

#

im pretty sure arma doesnt like that either

winged thistle
#

I could see that...

indigo snow
#

other than that, diag_log _x and diag_log _AA

#

because trivially,_AA setDir (markerDir _x) should work if _AA is an object and _x a marker

winged thistle
#

_x is the marker name in a string

#

Should it be a string?

indigo snow
#

yes since markers arent objects

winged thistle
#

oic

#

Well then, wtf?

#

why didn't it work when I had that line in there?

indigo snow
#

Try the trivial solution again

winged thistle
#

ok

indigo snow
#

without all the stuff you added to it

#

also look up the append command

winged thistle
#

oh nice

#

Basically replaces what I had. I like it

#

Hmm, they still aren't rotating.

indigo snow
#

diag_log (markerDir _X)

winged thistle
#

diag_log is supposed to report to the RPT, right?

indigo snow
#

yes

winged thistle
#

I'm gonna be so pissed if I find out I am working in the wrong file...

indigo snow
#

😄 wouldnt be the first time i saw that happening

winged thistle
#

lol

#

Just to be sure, what's the local editor path?

#

SP editor

little token
#

I think surfaceType of the road is only somewhere in Terrain Builder, idk

warm hedge
#

What you really done

little token
#

In any case, rvmat won't help me here in any way, because it doesn't contain information about surfaceType

indigo snow
#

of the .rpt file?

south swan
#

"information about surfaceType" to do what? From what i see on the wiki surfaceType doesn't seem to have any meaning outside of terrain context or something blobdoggoshruggoogly

indigo snow
#

%APPDATA%/local/arma 3/somethingwithdateandtime.rpt

little token
indigo snow
#

alternatively try systemChat str _myVar for more direct results

buoyant hound
#

how to remove stones and trees?

game logic with:

call{{ _x hideObjectGlobal true } foreach (nearestTerrainObjects [this,[],200])}

not work on this part.
note : deformer mod applyed on this part maybe it overwrite !?

#

game logic with:

call{{ _x hideObjectGlobal true } foreach (nearestTerrainObjects [this,[],200])} 

this work on another part of map!

winged thistle
#

I have the rpt up. Sorry, I meant the folder for the in game editor mission files.

#

~:\Documents\Arma 3 - Other Profiles\username\missions

#

That one?

indigo snow
#

yes

proven charm
#

make sure the script line is called, add: ```sqf
hint format ["Running! %1", this];

winged thistle
#

Hmm

#

It's the one I'm using but my scripts don't seem to have any effect.

indigo snow
#

ah if you already exported your mission to .pbo once i remember it having some issues

winged thistle
#

I know it's being called...

#

Nope, not yet

#

Just a single folder in there

indigo snow
#

Then _obj1Mkrs might be empty

#

wait no your _x had a value

winged thistle
#

Yeah

indigo snow
#

and its logging to rpt?

winged thistle
#

I checked my vars in the editor

#

Some stuff does, but not my diag_log

indigo snow
#

"checked my vars in the editor"

#

what do you mean exactly

winged thistle
#

In my script, you can see what _obj1Mkrs equals

#

So I put that same value in the watch field in the editor console to make sure it returned a value

#

Then I pasted those values as comments in codeshare

indigo snow
#

but _vars are local

winged thistle
#

I know

indigo snow
#

you cant watch them

winged thistle
#

but that's why I watched what they are equal to.

#

Same dif

indigo snow
#

anyway

winged thistle
#

[_obj1Name,FOR_mapMarkers] call FOR_fnc_findMarkers returns ["obj1AA","obj1AA_1","obj1AA_2","obj1AA_3"]

indigo snow
#

if you placed a diag_log

#

and its not logging

#

then your script isnt running

#

or you run with -noLogs as a parameter

winged thistle
#

I know it's running because the AA is getting spawned

#

I don't have noLogs as far as I know

#

Only params I set were no land and showscripterrors

indigo snow
#

but the script that is running is not the one with the diag_logs

#

or it would log

winged thistle
#

But that's the same script that creates the vehicles

indigo snow
#

diag_log doesnt fail

winged thistle
#

lol It's failing

indigo snow
#

its definitively not this version thats running

#

diag_log "aaa";

winged thistle
#

Lemme try reloading in editor again

little raptor
#

Hint doesn't appear during init afaik

indigo snow
#

but really, diag_log will only fail if it encounters nil

#

and that would throw an error

winged thistle
#

No errors and no diag_log

indigo snow
#

then its not running

proven charm
#

hmm diag_log then

winged thistle
#

I promise I'm not just trying to be difficult ;P

indigo snow
#

i know

#

but if it doesnt result in a log

#

its not running

winged thistle
#

But that doesn't make sense to me. The same script places the vehicles, and they are spawned.

indigo snow
#

at least, not the version with the diag_log in it

winged thistle
#

I reloaded it in the editor with the saved version

indigo snow
#

Yet youre editing the wrong file apparently

#

or not saving 😛

winged thistle
#

Notepad++ goes from red disk icon to blue disk icon on save.

#

So that's for sure.

#

The file thing, maybe, but I posted you the directory and you said it was correct.

#

So I don't know

#

Lemme try something...

#

If this fixes it, I will rage.

indigo snow
#

I'm sorry but I really cant say what is going on if you make a change to the script but the changes dont show up 😛

winged thistle
#

I've got a gut feeling that this is a Windows problem.

south swan
winged thistle
#

So check it out

blissful current
#

I heard somewhere that there is a process where you can "record" a vehicles movement then play it back. This might be a solution for me because a boat crewed by enemy AI in my mission keeps beaching itself on the river it's supposed to travel down.

What is the process called? Is there any documentation on it? Can the enemy AI still shoot back or is it a static object that can't be destroyed?

winged thistle
#

My computer decided that I should use ~:\Documents\Arma 3\missions instead.

#

Neat, huh?

blissful current
#

Ahh dang. It says you can record weapons too which makes me think it's entirely scripted. I need the AI to function minus the path they travel.

winged thistle
#

I've been up since 7am

#

It's now 2pm

#

I just found I've been working in the wrong file.

#

#getrekt #retired

indigo snow
#

So youre on your default profile atm

winged thistle
#

My windows is all messed up for some reason

indigo snow
#

other profiles is only fpor when youre on the non default profile

winged thistle
#

I changed my profile name

#

Now it hates everything

indigo snow
#

arma 3 prfile that is

#

this is not windows

#

this is arma

winged thistle
#

Ok good

#

I also changed my Arma profile name

#

Which apparently meant creating a new profile

indigo snow
#

If youre using the system default it will be in Arma 3 \ missions

paper sedge
indigo snow
#

any other profile (name) and itll end up under other profiles

paper sedge
#

"firing: Boolean - (Optional, default false) if set to true, will record the input unit's weapon fire data as well"

#

so as long as you dont toggle that i imagine the AI will still handle shooting

blissful current
#

Good point. Guess there's one way to find out. Thanks!

winged thistle
#

Guess I'm using the default then

#

Cool, so now, rotating AA

#

Thanks for the help btw

indigo snow
#

congratz on finding another reason someone is editing the wrong file 😄

winged thistle
#

lol ty ty

#

I was getting so frustrated that none of my changes had any effect

half moth
#

I'm trying to call the ModuleHideTerrainObjects_F via script in sqm file. When the mission starts I see the module in zeus but it is not hiding any terrain objects. Any ideas why or how to do this properly?

winged thistle
#

At this point, Arma has folders in like 6 different locations on my PC

#

I can only count to 3, so this is a challenge.

proven charm
#

how are you setting the module parameters?

indigo snow
#

%APPDATA% , my Documents and the steam folder

#

i count 3 😄

winged thistle
#

But the subfolders, man...

south swan
#

and a bit more details on "script in sqm file" if possible :3

winged thistle
#

There's like 2 in each location

half moth
#

I'm using cursor ai to help me try and figure it out. But I'm guessing the module parameter is what is not correct.

private _allBaseMarkers = ["base_1", "base_2", "base_3", "base_4", "base_5", "base_6"];

// Create a copy to select from
private _availableBases = +_allBaseMarkers;
private _selectedBases = [];

// Create logic center for modules
private _logicCenter = createCenter sideLogic;
private _logicGroup = createGroup _logicCenter;

// Select 3 random bases
for "_i" from 1 to 3 do {
    private _selectedBase = selectRandom _availableBases;
    _selectedBases pushBack _selectedBase;
    _availableBases deleteAt (_availableBases find _selectedBase);
    
    // Wait 5 seconds before placing module
    sleep 5;
    
    // Create Hide Terrain Objects module at the base position
    private _pos = getMarkerPos _selectedBase;
    private _hideModule = _logicGroup createUnit ["ModuleHideTerrainObjects_F", _pos, [], 0, "CAN_COLLIDE"];
    
    // Initialize the module
    _hideModule synchronizeObjectsAdd [_hideModule];
    _hideModule setVariable ["Hide", 1, true];
    _hideModule setVariable ["Size", 100, true];
    _hideModule setVariable ["Filter", -1, true];
};

// Make the selected bases available globally
missionNamespace setVariable ["activeBaseMarkers", _selectedBases, true];```
indigo snow
#

3DEN will actually support subfolders for the mission folders too

#

thats gonna be nice

winged thistle
#

Bootiful 😄

#

Oh yeah 😄 IT WORKS!!! @indigo snow Thank you so much, man!

indigo snow
#

congratz man

proven charm
#

AI 👀

indigo snow
#

at least you learned some new stuff out of it too 😃

#

like counting to six haha

proven charm
#

try adding # to the setVariables not sure but I think you need that

#
_hideModule setVariable ["#Size", 100, true];
half moth
#

Thanks I'll try that.

haha ya AI, my only coding experience is a QBasic class back in high school so I need the assistance lol

proven charm
#

also you dont need to create centers in arma 3, just have : ```sqf
private _logicGroup = createGroup civilian;

winged thistle
#

hahah

proven charm
#

and lastly the code is synchronizing to itself ;D

winged thistle
#

Don't worry. I'm sure I'll be back with 1,000 more questions.

tulip ridge
#

Modules should be sideLogic, not civilian

winged thistle
#

You guys want a hard one?

cobalt path
#

Not sure wher to ask this. But I have a bunch of invisible objects I wanna place in eden, Is there a way for me to add a texture to them in Eden? So I could see exactly how and where I am placing everything?

proven charm
granite sky
#

Not necessarily to the module.

#

I recall the BIS tasks system creating logic objects on various sides and breaking our spawning code.

proven charm
#

ive been using civilian 😬

winged thistle
#

It's not a troubleshooting question this time ;P

#

I need to create a function that creates smooth AI flight paths for paradrops. Helis will fly in, drop paratroopers at the drop zone, and return to base. What's the best way to go about creating the paths if I have the heli spawn marker and the drop zone marker?

blissful current
#

How much time do yall spend in the eden editor vs VScode when you make a mission? I've been finding myself wanted to write as much code as possible out of the editor because it makes it easier to track down later.

Is it possible to do near 100% outside the editor?

open hollow
#

you can even use execvm to test stuff in the middle of the mission, with out even restart

#

advanced developer tools its quite usefull too, usually i start the scripts there before moving to vc

granite sky
#

The keyboard navigation conventions in ADT's console are kinda painful so I usually write code elsewhere and then paste it in to test.

open hollow
#

where is the error /s

open hollow
winged thistle
#

Waypoints or scripted paths?

fallow pawn
#

Is there a reliable way to make a unit not die when inside a vehicle that explodes?
I have a "HandleDamage" event handler that manages player's damage intake and makes it uncounscious as needed, never dying, so others can come and heal. All my tests were succesful while on foot, but while passenger in a vehicle that explodes I cannot, for the life of me, make the player not die! It seems as the game has this behavior hardcoded.
I'd like some insight, maybe examples, anything...
Thank you for your time!

granite sky
#

Hmm, a plain {0} handleDamage works for me.

#

Get kicked out of the vehicle though, so I guess you'd need to override something else to prevent that.

#

Guessing that you're making assumptions in your HandelDamage.

indigo snow
#

MP or SP?

winged thistle
#

Multiplayer

indigo snow
#

Trick question

#

you dont

#

you put a player in it

winged thistle
#

lol

#

but

#

It's for a reason

indigo snow
#

no buts

#

you dont

#

its impossible

winged thistle
#

So right now, we're attempting to do it with waypoints.

#

You don't think it will work?

indigo snow
#

if you want it to be reliable?

#

no

#

pilot AI is generally pants on head retarded

winged thistle
#

That's discouraging...

#

lol

#

So no spec ops paradrops from AI?

indigo snow
#

well in a way

#

start the players in their parachutes 😄

winged thistle
#

We're starting them as pilots

#

Players are separate

#

Paratroopers are for an objective

indigo snow
#

then waypoints is the best way to try and get it to work

winged thistle
#

OK

#

Well, here's hoping they don't continue crashing into each other.

blissful current
#

Anyone seen this error code?

#

It pops up on mission start. I'm not sure what I did to get it to pop up. It may have been there for a while and I just noticed it.

winged thistle
#

0 enemies on map; AI panics under pressure. GG>

indigo snow
#

yes

#

hence my use of the word reliably

#

😄

winged thistle
#

I don't understand it at all

#

Maybe the AI is so advanced, we're actually watching them learn to fly a helicopter right as soon as they are spawned inside the pilot's seat...

#

Watching my huge fleet of choppers swarm toward an objective base is like watching a bunch of sperm swarm toward an egg.

nimble hill
#

If you are just flying players in at the start of the mission, you can use sleep then eject them after a set timer(which you time by testing the flight path of the ai)

winged thistle
#

Only one survives. Sometimes 2.

pallid palm
#

maybe this @blissful current

placid root
#

hey 😃 i have a quick question. does anybody know why e.g. ctrlSetText [1400, str (date select 3)]; ctrlSetText [1401, str (date select 4)]; does not add anything to a editbox. but strangly it does when i exec it in the debug window o.O same goes with listboxes. the script gets launches "onload" of the dialog

winged thistle
#

@nimble hill but if the flight paths are unreliable, that might not work

#

too many variables

blissful current
lethal fern
#

hey guys new here i need some help with arma 3 scripting, I'm trying to make a large scale air bombardment with the flying legends b-17 and its ai only. is there a way?

winged thistle
#

There's my sketch

#

Waypoints can do this?

indigo snow
#

depends on the scale

winged thistle
#

Scale is huge.

indigo snow
#

the general movement of going in and waving off to a side, yes

#

nail an exact flight path, no

winged thistle
#

Unfortunate.

unkempt marsh
#

has anyone found a way to detect when a player friendly fires? im trying the entityKilled eventhandler however the side of the dead unit will be civvie no matter what, there must be a way to find whether it was friendly or not

unkempt marsh
warm hedge
#

A (not perfect) workaround would be something something like getNumber (configOf _victim >> "side")

unkempt marsh
warm hedge
#

Config is not SQF command and will not be altered ingame/dynamically, it will return 1 if you kill B_Soldier_F

#

And always 1

unkempt marsh
#

so with the entityKilled eventhandler you could use configOf _killed >> "side" to return the side the unit had while it was alive?

warm hedge
#

Technically (it is tldr why it is not the comprehensive way, but 99% of situation there is no much issue)

unkempt marsh
#

i'll look into it further on the wiki then

warm hedge
#

Convert 0, 1, 2, 3 to side is BIS_fnc_numberToSide or some similar name

south swan
#

side group _killedUnit?

still forum
indigo wolf
#

Whenever I try BIS_fnc_attachToRelative - it resets the orientation of the scaled simple object. Any idea how I can fix it?

winter rose
#

as you can see in https://community.bistudio.com/wiki/setObjectScale,

Changing the direction of the object (e.g. using setDir, setVectorDir, etc.) will reset the object back to its original size (probably because the engine normalises the directions, thus the scale in the transformation matrix becomes 1), so those commands should be run before resizing the object.

indigo wolf
#

I've set the default orientation via the editor and then used BIS_fnc_attachToRelative and finally scale it to 2x. It does not take the orientation. Do you mean I should scale it and then attachit?

winter rose
#

I mean that object scaling is definitely not helping and not well supported, so you may have to do things manually

indigo wolf
#

Oof ok then thanks 👍

indigo wolf
#

Heres another question: How would you execute while against a variable being true? I tried while { _variable == true } and it says, type bool expected code

winter rose
#

whie is not a valid keyword

indigo wolf
#

sorry a typo in here - this is the codeim using while {_objectStared == true} do { /* code here */ }

#

basically i want the code inside the do {} to run until the variable _objectStarted is set to false by another function

winter rose
#
while { _objectStared } do
{
  // I hope you change _objectStared in here
};
```is very valid
#

the variable _objectStarted is set to false by another function
HAH here's your issue
how do you want to change a local variable with another function

indigo wolf
#

omg ur right lmao

#

thanks 😄

winter rose
vagrant elm
#
    ["Gefreiter", "U_SPE_GER_Soldier_M40_Boots_Rolled"],
    ["Unteroffizier", "U_SPE_GER_Soldier_M40_uffz"]
];

{
    private _rang = _x select 0;
    private _uniform = _x select 1;

    this addAction [
        format ["<t color='#00FF00'>%1</t>", _rang],
        {
            params ["_target", "_caller", "_actionId", "_arguments"];
            private _uniform = _arguments select 0;
            _target forceAddUniform _uniform;
            systemChat format ["Uniform %1 wurde angezogen.", _uniform];
        },
        _uniform
    ];
} forEach _uniformen;

systemChat "Uniform-Aktionen wurden hinzugefugt.";``` 

I have a error for whatever reason
it just says something about the *"error generic error in expression"*

What i wanna achive:
- Go over to an NPC, scroolwheel over his body, select the rank (i.e. "Gefreiter") and his Uniform changes to that. Bc i wanna show off the different rang insignias to my players without going into an arsenal.


i use ace, the SPE cdlc etc
Hopefully somebody can help me.
hushed turtle
#

Is _arguments rally array? It looks like it should be string

#

meaning private _uniform = _arguments;

south swan
#

_argument params ["_uniform"]; if in doubt 😛

blissful current
#

I'm going to try to tackle this error again tonight when I get home from work. I checked the rpt and didn't see anything that stood out, though I admit I don't really know what I'm looking for. I'm just going to remove .sqf files from my project until the error goes away, and hopefully, that will narrow it down some. Has anyone else seen an error like this? Usually, the errors I see will at least give you a line number...

hushed turtle
#

Never thought about params command like that. Never realised it can take any array. Nice to know thanks blobcloseenjoy notlikemeow

south swan
#
[1,2,[3,4]] call {
  params ["_one", "_two", "_this"];
  params ["_three", "_four"];
  [_one, _two, _three, _four]
} // => [1,2,3,4]``` also works, but please don't do it 🤣
pallid palm
#

@lethal fern what!, you mean flying legends has a b-17 ?

fair turtle
#

how I make bombcar?

buoyant hound
#

hey , anybody can help me to add action for RuggedTerminal_02_communications_F ?

#

No problem on addaction
Just need animation order

#

And list

pallid palm
#

@fair turtle tell us about what you need we have no idea what you want when you say bombcar

#

yes you can make a car into a bomb,, but when and how do you want to use it

#
bomb="Bo_GBU12_LGB" createVehicle getPosATL car1;
//or
bomb="M_Mo_82mm_AT" createVehicle [(getPos car1 select 0),(getPos car1 select 1),0];
proven charm
#

getPos not good, should use getPosATL 🙂

stable dune
pallid palm
#

still need more info m8 @fair turtle

#

you can put a trigger around the car is that what you mean

#

or do you want to script the hole thing

fair turtle
#

I wanted to know if it's possible to place bombs like dynamite on the car.

pallid palm
#

oh

#

yeah you can place any bomb on a car in the game

#

if you have it in your inventory

winter rose
#

well, you cannot attach a satchel charge without scripting in Arma 3

pallid palm
#

and btw hello Lou

#

how did u know he wanted to use attachTo

#

i must of missed that some how

winter rose
#

place bombs like dynamite on the car
I assume they mean placing the bomb anywhere on the car

eternal spruce
#

How can I get this bad boi to target a friendly unit and continuously keep tracking it until I want it to stop.
I did try dotarget & dowatch but it did nothing

#

Side note I did get this one to look at a static object (a sphere) with dowatch but wanted to see if i can do it with the unit rather than attaching a sphere or another small object to said unit

dry cradle
#

Dynamic Patrols Script Problems

I'm trying to make a patrol script that will every 60 seconds, it finds every WEST squad leader and spawns a patrol 200 meters directly in front of them. The script will add all of the LAMBS functions to the patrols, Then patrols are dynamically deleted when they get more than 500 meters away from any player.

My problem that I have had so far is that the patrols do not delete properly. It get the point where there are 30 to 40 patrols on the map if left untamed.
Does anyone know of any way to keep track of what units have been spawned in by the script?

dry cradle
# fair turtle how I make bombcar?

Add this to the init of the car

_bomb="Bo_GBU12_LGB_MI10" createVehicle (getPos (_this select 0)); 
_bomb="Bo_GBU12_LGB_MI10" createVehicle (getPos (_this select 0)); 
 
deletevehicle (_this select 0); 
}];```

It'll make the explosion bigger when if blows
tender fossil
dry cradle
# tender fossil Post the code, you can use code highlighting btw

This is kinda what I have so far

// By Too Many Cooks

if (!isServer) exitWith {};

// CONFIGURATION PARAMETERS
private _patrolDistance = 200;  // Distance in front of squad leaders to spawn patrols
private _despawnDistance = 500; // Distance at which patrols despawn
private _patrolInterval = 60;   // Time between patrol spawns
private _patrolRadius = 100;    // LAMBS patrol area
private _patrolSize = 6;        // Number of units per patrol

// List of enemy unit types
private _enemyTypes = [
    "UK3CB_ION_O_Woodland_SL", 
    "UK3CB_ION_O_Woodland_TL", 
    "UK3CB_ION_O_Woodland_MD", 
    "UK3CB_ION_O_Woodland_RIF_1", 
    "UK3CB_ION_O_Woodland_LAT", 
    "UK3CB_ION_O_Woodland_ENG", 
    "UK3CB_ION_O_Woodland_DEM"
];

// Main Loop
while {true} do {
    // Get all WEST squad leaders
    private _leaders = allPlayers select {side _x == west && (rank _x == "SERGEANT" || rank _x == "LIEUTENANT")};

    {
        private _leader = _x;
        private _spawnPos = getPos _leader getPos [200, getDir _leader];

        private _group = createGroup east;
        {
            private _unit = _group createUnit [_x, _spawnPos, [], 0, "FORM"];
            _unit setSkill ["general", 0.5];
        } forEach (_enemyTypes select [_patrolSize]);

        private _leaderUnit = leader _group;
        _leaderUnit setVariable ["lambs_danger_dangerRadio", true];
        _leaderUnit setVariable ["patrolZone", "DynamicPatrol"]; 
        [_leaderUnit, _leader] call lambs_danger_fnc_tactics;
        [_leaderUnit, _leader] call lambs_danger_fnc_tacticsReinforce;

        // Assign LAMBS Patrol Task
        [_group, getPos _leaderUnit, _patrolRadius, 4, [], true, true, false] call lambs_wp_fnc_taskPatrol;

        // Store patrol for despawn check
        missionNamespace setVariable [format ["ActivePatrol_%1", _group], _group];

    } forEach _leaders;

    // Despawn patrols if out of range
    private _allPatrols = missionNamespace getVariable "ActivePatrols";
    {
        private _group = _x;
        private _playersNearby = allPlayers select {side _x == west && (group _x) distance (group _group) < _despawnDistance};
        if (count _playersNearby == 0) then {
            { deleteVehicle _x; } forEach units _group;
            deleteGroup _group;
            missionNamespace setVariable [format ["ActivePatrol_%1", _group], nil];
        };
    } forEach _allPatrols;

    sleep _patrolInterval;
};
south swan
#

with "ActivePatrols" variable being set where?

hallow mortar
south swan
#

} forEach (_enemyTypes select [_patrolSize]); that's not looking very good, tbh tanking

#

not to sound like a quick gun... but was any ai/llm/whatever involved in writing that? sus

dry cradle
#

I'm still learning some of these more complex things, but yes unfortunately that's one of the few resources I have to learn from, no Armaholic any more to help me lol

dry cradle
#

Yeah I've read that

south swan
#

well, the problem with AI/LLM is: you don't want to ask it to write any code you can't debug (and fully rewrite with some effort) 🤣 And the problem with "Introduction to Arma Scripting" article is it's not really finished 🤣

finite bone
#

Just do what facebook did - Train a local LLM usiki BIKI and open source github projects -> EZ kmao

south swan
#

well, github projects are guaranteed to be better code source than forum questions in form of "here's my code, why isn't it working?!" 🤣

dry cradle
#

Yeah I'm still working on the "knowing how to debug" part lol, what it gave me at first was hot garbage, and I've cleaned it up a bunch already.

The question I am asking is what do I need to read up on to know how to make sure the script will keep track of what it has spawned in already

south swan
#

well, let the spam begin:
point 1: sqf private _group = createGroup east; { private _unit = _group createUnit [_x, _spawnPos, [], 0, "FORM"]; _unit setSkill ["general", 0.5]; } forEach (_enemyTypes select [_patrolSize]);
should be replaced with, say, for "_i" from 0 to _patrolSize do {//code here}; for it to actually spawn requested amount of enemies

dry cradle
#

Yeah this is what I mean lol, at this point I'd be going back and figuring out why "_i" is different than calling on the parameters in the first few lines

south swan
#

point 2: storing the stuff in a single ActivePatrols array is a sane and good idea. Except for it to work you need to:

  • in the beginning declare/define it with ActivePatrols = []; before starting the loop
  • right after the code from "point 1" add the newly created group with ActivePatrols pushBackUnique _group;
  • remove deleted groups from it (you can, say, replace forEach _allPatrols; near the end with forEachReversed _allPatrols; and do _allPatrols deleteAt _forEachIndex; inside the loop. Should work blobdoggoshruggoogly )
#

point 3: all the lines that mention format ["ActivePatrol_%1" (getVariable/setVariable equally) don't really have any valid use, so i'd say they can be safely removed

dry cradle
#

Kind of like this?
(this was from the last time I tried to wrap my head around this, but it was zone based with triggers)

south swan
#

kinda but not really. for "_i" from 0 to 6 do {//code}; is "execute code 6 times".
{//code} forEach _enemyTypes; is "execute code once for each value inside "_enemyTypes" array".
Both are useful, but for different things blobdoggoshruggoogly

#

so when your usecase is "I want to spawn 6 doods" - for-loop is your friend

south swan
#

but when your usecase is "here i have an array of AI groups, i need to check every one of them" - you reach for forEach

south swan
dry cradle
#

Oh okay so it would kind of be lookin like this?

for "_i" from 0 to 6 do {
spawn stuff;
do stuff;
more stuff;
};```
south swan
#

ja, kinda like sqf private _group = createGroup east; for "_i" from 0 to 5 do { private _unit = _group createUnit [selectRandom _enemyTypes, _spawnPos, [], 0, "FORM"]; _unit setSkill ["general", 0.5]; }; ActivePatrols pushBackUnique _group; or something.
(also, notice the selectRandom _enemyTypes to select (duh) the random unit to spawn in the createUnit invocation).
Bang, you have a group of 6 (hopefully, thanks, NikkoJT) doods spawned and accounted for.

tender fossil
dry cradle
south swan
#

well, that's another set of points 🙃

dry cradle
#

oh boy

south swan
#

aw, too much words, but too much lazy
a) execFSM isn't really used for SQF. execVM "dynamicPatrol.sqf"; or call TMC_dynamicPatrol; (or spawn), or something would be needed. Wiki, while not being all-encompassing does provide almost full documentation on all language commands and good enough "See Also" recommendations. (Or maybe my mind is too deformed to think any other way).
b) running an SQF that runs loops inside a trigger sounds... excessive and overcomplicated, tbh

#

trigger is, essentially, a Place, and a Loopthat's given a Condition to run periodically, On Activation code to run when Condition goes from false to true, and On Deactivation code to run when Condition goes from true to false. Not really much more.

#

wouldn't add anything extra to your usecase blobdoggoshruggoogly

dry cradle
#

Wait I've been doing that wrong this whole time? In my defense I learned that off of a BI forum, not AI lol

south swan
#

i'm rambling. I'd move to a thread, if you're not opposed to that

#

This code and Triggers and AI and General Scripting Advices

eternal spruce
#

@hallow mortar I did this mk29_1 lockCameraTo [FA18_SH_2, [0,0]]; but ntn happed as well or did i miss smt

hallow mortar
finite bone
#

Is it possible to for a video being played via BIS_fnc_playVideo be displayed to a player connecting via JIP without needing to reset?

fallow pawn
unkempt marsh
fallow pawn
#

Just try it, you'll see

tulip ridge
warm hedge
#

An unit forms a group, a group can have one unit. What we suggested already is what we have as workaround anyways

granite sky
#

Note that side group _unit doesn't work universally for dead units because they eventually get switched to grpNull, but it works at the point when they die.

little ether
#

I'm sure I'm doing some really simple shit wrong here but I cannot get either of these actions to show for the player with the variable Knight_1 on the dedicated server. Had it working fine using normal addaction, but I'm missing something on getting it working on the dedi and when a player respawns (the code is in the respawn eventhandler for the unit at least)

{wagontarget setPosASL AGLToASL screenToWorld [0.5, 0.5]; wagonend setPosASL AGLToASL screenToWorld [0.5, 0.5]; wagonreservespawn setPosASL AGLToASL screenToWorld [0.5, 0.5]}] remoteExec ["addAction",0,true];

[knight_1, "Light of Sigmar", {_pos = player ModelToWorld [0,0,20], _light = createVehicle ["F_40mm_red", _pos, [],0,"NONE"];}] remoteExec ["addAction",0,true];```

What the hell do I need to look at/change to get these actions to show for the designated player every time they respawn?
granite sky
#

what sort of respawn event handler?

#

The easiest way to give actions to players is to do it on the client side. initPlayerLocal for example.

#

Your remoteExec is pretty busted though. Left side should always have two parameters (left, right) at most. An addAction remoteExec would look like this:

[_target, ["title", {code}]] remoteExec ["addAction", _target];
little ether
#

...............

#

Missing bracket before "title"

#

Kill me

cobalt path
#

Question, u know how sometimes if u hit smth with your main rotor of a heli, rotor breaks and dissapears?
Any way to do it with a script?
I tried setting 100% damage on it in zeus enhanced and that didnt work. I think

wicked sparrow
#

Problem: Script in trigger won't work in dedicated MP (probl. locality problem)
Hey, I was wondering how triggers work with locality and dedicated servers. I have a custom chat that is created via a game logic init at the begin of the mission and saves the IDs in a mission var so other scripts can grab the ID. Now I have a trigger in my Amory that when trigger should add the user that triggers it to the custom chat (and set the current channel to that). When the user leaves it should remove them from the chat. Now to the funny part as always with locality pepe_yay. When I use player in the trigger and host it localy everything works, but if on the server it does not add the user to the chat (the setchannel command still works tho). So I thought lets use the thisList var from triggers but funny thing, this var is not available on the deactivation section so I could add units but not remove them. Another thing I tried (on the screenshot) was using remoteexec to sync it to all machines but still not working in dedicated MP. IDK what to do now cause nothing seems to work. Before someone asks, the chat is created correctly, I can add myself via the console.

flint topaz
#

I’d make sure your trigger condition is correct and is triggering/detriggering as you expect first by hinting or systemChat responding it

wicked sparrow
#

already did all of that, everything works as it should (otherwise it wouldn't work on local MP). Thing is I can't use ´thisList` cause arma dosen't have a equivalent in the deac section.

flint topaz
#

Just for a sanity check show me your trigger

wicked sparrow
#

I mean I have a other trigger that opens the Ace arsenal that uses player as well or a other trigger that auto opens a door, these work. But now those more advanced ones don't.

flint topaz
#

As local multiplier is still different to dedicated in that regard

#

I just want to be able to rule it out

wicked sparrow
#

Well what do you want to see / know

flint topaz
#

the condition line and if it’s just this then the part above

wicked sparrow
#

I have arma closed currently, but yes, the condition is only this.

#

and it is set to trigger if any player is inside

flint topaz
#

I recommend to use

player in thisList

#

Unless you want it so when one person enters it triggers for everyone

wicked sparrow
#

here is the script from the sqm:

items=2;
                                                class Item0
                                                {
                                                    dataType="Trigger";
                                                    position[]={1042.311,6,1173.098};
                                                    angle=6.2668309;
                                                    class Attributes
                                                    {
                                                        onActivation="private _customChatID_Armory = missionNamespace getVariable ""customChatID_Armory"";" \n "" \n "[_customChatID_Armory, [player]] remoteExec [""radioChannelAdd"", 0, true];" \n "" \n "[{ " \n " params [""_customChatID_Armory""]; " \n " setCurrentChannel (_customChatID_Armory + 5);" \n "}, [_customChatID_Armory], 1] call CBA_fnc_waitAndExecute;" \n "";
                                                        onDeactivation="private _customChatID_Armory = missionNamespace getVariable ""customChatID_Armory"";" \n "" \n "_customChatID_Armory radioChannelRemove [player];  " \n "setCurrentChannel 5;";
                                                        sizeA=5.4660001;
                                                        sizeB=12.693;
                                                        sizeC=5;
                                                        repeatable=1;
                                                        activationBy="ANYPLAYER";
                                                        isRectangle=1;
                                                        triggerInterval=1;
                                                    };
                                                    id=65776;
                                                    type="EmptyDetector";
                                                    class CustomAttributes
                                                    {
                                                        class Attribute0
                                                        {
                                                            property="KJW_Radiate_Core_countRate";
                                                            expression="_this setVariable ['KJW_Radiate_Core_countRate',_value, true];";
                                                            class Value
                                                            {
                                                                class data
                                                                {
                                                                    singleType="SCALAR";
                                                                    value=0;
                                                                };
                                                            };
                                                        };
                                                        nAttributes=1;
                                                    };
                                                };
wicked sparrow
meager granite
#

From what I see your trigger will trigger for every player in the network as soon as any player steps into the trigger

#

And it will cause all players to be added to the channel

#

Any player stepping out then will caused all players to be removed

wicked sparrow
#

funny thing is, no one is getting added to that channel

meager granite
#

Oh @flint topaz already said that, as usual I didn't read the whole thing

#

Also radioChannelAdd is global by itself but as usual with Arma its wonky and its often better to execute global stuff on server if possible

wicked sparrow
#

From what I tested with triggers is they run locally and execute stuff locally until there is a var or script that shares stuff between clients.
I have a trigger that if you enter the zone opens the arsenal that uses player to open it. If it would execute on every machine that would open the arsenal for everyone but it dosn't atm. (maybe I am wrong tho and I didn't 100% tested that with multiple people on the server)

wicked sparrow
#

like this is the main problem that I am facing

flint topaz
#

player would be fine as your reference

wicked sparrow
#

I refered from using thisList due to the deac not having it

flint topaz
#

As player is a local variable you can use

wicked sparrow
#

does not work

flint topaz
#

Are you sure it’s the player part that isn’t working?

#

Did you hint all of the variables you are using?

wicked sparrow
#

jep, It works in SP but not on DMP

flint topaz
#

player still works in DMP if used in the right context

wicked sparrow
#

From what I concluted is that somehow due to the server now hosting the mission player or the init does not get passed correctly and so player is not a local var anymore.

flint topaz
#

I believe your issue will be getting of the channelId might be objNull

#

But hinting or displaying this will confirm or deny it

meager granite
#

player is a scripting command returning currently controlled unit, it should just return null on server and it will be fine

wicked sparrow
meager granite
#

Sure _customChatID_Armory is properly available on clients?

flint topaz
#

^

wicked sparrow
#

WKBob is a var name of a AI unit

meager granite
#

Yeah that's your problem

#

Radio channels are global and server creatable only

wicked sparrow
#

But the server creates it

meager granite
#

radioChannelCreate can only be used on server, then you'll need to broadcast resulted channel ID to players

wicked sparrow
#

But I do

#

I save the channel ID to a var to grab it in other scripts

meager granite
#
if(isServer) then {
    private _channelID = radioChannelCreate [[0.66, 0.7, 0.5, 1], "A. Fortenbachers Büro", "%UNIT_NAME", [WKBob3]];
    private _channelID1 = radioChannelCreate [[0.66, 0.7, 0.5, 1], "Waffenkammer", "%UNIT_NAME", [WKBob1, WKBob2, WKBob3]];
    missionNamespace setVariable ["customChatID_Office", _channelID, true];
    missionNamespace setVariable ["customChatID_Armory", _channelID1, true];
};
wicked sparrow
#

If the channel was not created correctly how would I be able to join it via a command then

meager granite
#

Added true at the end of setVariable

#

If you have that code in init field it fails radioChannelCreate on clients and saves the ID as 0

wicked sparrow
#

That is not needed cause it is executed in a init and inits are JIP and global

meager granite
#

And then you ask server to add you to custom channel 0 which is invalid

wicked sparrow
#

give me a sec I send a vid

meager granite
#

You're having your clients do radioChannelCreate which they cannot and it returns 0

wicked sparrow
#

Hmm now I see where you are going with this, cause they fail to create they save a wrong value to the missionvar

meager granite
#

Yes, use my change it will only create on server and then broadcast the resulting ID

wicked sparrow
#

local MP works, now uploading to server. Lets have a look. pepe_weird

meager granite
#

Make sure to have that player in thisList condition

#

otherwise any player entering the trigger will have every client execute "On activation"

wicked sparrow
#

Well gotta say, I didn't expect this to work

#

still one problem consist, how do I remove them in the deac section? Cause yea I can use player in thisList in the activation section to only get the player but in deac it would remove all players from that channel.

meager granite
#

Hmm, good point

#

Actually no, you don't need thisList in deactivation, only in condition

#

Trigger wont even activate to worry about deactivation

#

So it will be fine

#

Make sure its in Condition field

wicked sparrow
#

u mean player in thisList

meager granite
#

Yes

wicked sparrow
#

kk

#

Well that works so far, thanks a lot @flint topaz & @meager granite. You guys where a great help. pepeheart cutecat

still forum
edgy dune
# winter rose *😊*

yeah I saw that part, and then I saw it was used in SOG for I think the boats so I was thinking surely they must have a reason (cause they are better at scripting then I so)

edgy dune
ivory lake
#

probably just an old script

edgy dune
#

understandable o7 will use the mission event handler

hushed turtle
#

Is it possible to put weapon into cargo with completely custom set of attachments? There are classes with predefined attachments, but I would like to have my own in mission. In editor or using scripting of course.

hushed turtle
#

Thank you

hushed turtle
#

That's potentially a lot of network traffic. What if I remote exec function calling local version of command on every machine instead, will JIP clients get the change as well based on current cargo on server?

still forum
#

Don't do that. Inventory desync is bad.

lime rapids
#

can you attach variables to a map object?

proven charm
#

whats a map object?

lime rapids
#

terrain object*

proven charm
#

ah thought you meant that

finite bone
little raptor
#

An alternative solution is using a hashmap, using terrain object id as key

lime rapids
little raptor
#

Hashmaps are fast. It won't be much different than setVariable

#

Or are you talking about broadcasting vars over network?

lime rapids
little raptor
#

In that case you can just broadcast the change

lime rapids
#

i suppose hashmaps could allow me to keep it serverside until i need to check if said object is in that hashmap

lime rapids
finite bone
#

Yea but it does not play the video where it was left off from my testing.

lime rapids
finite bone
#

Like, a player joins in the middle of an active remoteExec'd BIS_fnc_playVideo can only hear the audio but not the video. Seems kinda strange.

lime rapids
finite bone
#

nope

lime rapids
#

whats your use case?

finite bone
#

Its displayed on a billboard (more specifically the briefing room screen)

little raptor
# lime rapids i suppose hashmaps could allow me to keep it serverside until i need to check if...

here's an example:

// fn_setVariable.sqf
params ["_objID", "_name", "_value"];
if (isNil "TAG_objectsHashmap") then { TAG_objectsHashmap = createHashmap };
TAG_objectsHashmap getOrDefault [_objID, createHashmap, true] set [toLowerANSI _name, _value]; 
// fn_getVariable.sqf
params ["_objID", "_name", "_default"];
if (isNil "TAG_objectsHashmap") exitWith { _default; };
private _varsHashmap = TAG_objectsHashmap get _objID;
if (isNil "_varsHashmap ") exitWith { _default; };
_varsHashmap getOrDefault [toLowerANSI _name, _default];

and to setvar, you just remoteExec that function:

[getObjectID _someTerrainObj, "myVar", 1] remoteExec ["MY_fnc_setVariable", 0];//instead of _someTerrainObj setVariable ["myVar", 1, true]
lime rapids
little raptor
#

if you make sure ObjectHashmap is initialized at init (e.g. putting it in a fnc with preInit=1), you can get rid of the first isNil check to make things faster

little raptor
little ether
#

Sorry to always be asking questions lads, I really hope I can reach the point where I can help one day...

Until then;

  • I want a unit to be able to place his Banner (which is a melee weapon) and pick it back up through a scrollwheel action
  • I can get this to happen perfectly ONCE through various means
  • I CANNOT work out how to make it so that once the flag is picked back up, the cycle can start all over again
  • I've tried OBJ INIT modules from NF_EXTRA, I've tried passing an action ID and running it
  • I've tried adding on deletion event handlers etc etc

Anyone got any ideas?

_unit = _this#0; 
_unitarray = _this; 
_unit removeWeapon "Roger_Sigma_Banner_Weapon_1"; 
_pos = player ModelToWorld [0,0,20]; 
_banner = createVehicle ["BannerS", _pos, [], 0, "NONE"]; 
_banner setPosASL AGLToASL screenToWorld [0.5, 0.5]; 
_this#0 removeAction (_this select 2); 
_banner addAction ["Pick up Banner", {player addWeapon "Roger_Sigma_Banner_Weapon_1";  deleteVehicle _this#0;}]; 
}];``` This is an example of the code and its basic "put down, pick up"

```_this#0 addEventHandler ["Deleted", {player addAction ["Stand your ground!", {
_unit = _this#0;
_unit removeWeapon "Roger_Sigma_Banner_Weapon_1";
_pos = player ModelToWorld [0,0,20];
_banner = createVehicle ["BannerS", _pos, [], 0, "NONE"];
_banner setPosASL AGLToASL screenToWorld [0.5, 0.5];
_this#0 removeAction (_this select 2);
_banner addAction ["Pick up Banner", {player addWeapon "Roger_Sigma_Banner_Weapon_1"; deleteVehicle _this#0;}]}]}];``` This is an example of me trying to use NF_Extras OBJ Init setter to add eventhandlers to all instances of the banner ever made, and is the only solution I have tried that I have to hand.

Any ideas lads? I'm really trying to flesh out WH Fantasy for my unit so it stops being so shit, and basic mechanics like this are things I'm surprised aren't in some of these mods yet (I'll probably try and find/build a drinking script too soon 😂 )
little raptor
# little ether Sorry to always be asking questions lads, I really hope I can reach the point wh...

you should make functions so that you can recursively call stuff
for example, the script that adds the banner is one function. let's call it "TAG_fnc_addDropAction"
the part where you do addWeapon, you can just call that function to add the action back:

_banner addAction ["Pick up Banner", {
  params ["_banner", "_player"];
  _player addWeapon "Roger_Sigma_Banner_Weapon_1";
  _player call TAG_fnc_addDropAction;
  deleteVehicle _banner;
 ...
}...
little ether
#

Yeah I was honestly reaching the point where I think I just need to get over my fear of learning sqfs and in turn packaging functions into a mod 😂

A quick follow up, one I'm going to need a lot I feel - what's the best way to determine the one player I want to add the actions to?

Say I turn this into sqfs and have the flag out and want to pick it up. Flag has an action on it that calls "pickup.sqf" and in that sqf it needs to give an action to the player. Will addaction player pick up only the interacting player?

finite bone
little raptor
#

not supported by videos

#

only audio

finite bone
#

Tbh, its the first time I'm hearing a video can be played from offet 😅

little raptor
#

which is why I said make a feature request

finite bone
#

Ah makes sense. Ty

little raptor
# little ether Yeah I was honestly reaching the point where I think I just need to get over my ...

yes. the action code runs locally. player means local player.
To make the action visible to everyone, you must execute addAction for each client (an easy way to do that is object init or initPlayerLocal.sqf), but the action code runs locally for each of them separately (as they interact with the action)

however, in action code you should use the _caller (just like the way I did _player), not player. because in Arma you can remote control other units but they're not the "player". so if you use player in actions and a remote controlled unit interacts with something, you'll end up applying the script to player not the unit who performed the action

little ether
#

Yeah this stuff is all local to the player who picks up and puts down the banner, one blokes responsibility so _caller sounds like it to be on the safe side

frigid oracle
#

Track your localities and remote exec destinations. I once made a mistake causing a recursive loop from server to client and each client to server and repeat on accident.

small iron
#

Hi, I was looking to lock the "Zeus" player in the air similar to how the Zeus 16+2 or 48+2 game master modes are set up. Whenever I create a Zeus module and a player joins it, their camera view is directly on the floor and they have to hit their toggle zeus key

little ether
karmic flax
#

Im trying to have a unit do a scriped landing and taxi in a plane, but he will not put his landing gear down, any ideas?

_pilot = _this select 0; 
_plane = _this select 1; 
wp1 =;
onEachFrame {
    _plane action ["LandGear", _plane];
    _pilot action ["LandGear", _plane];
};
sleep 1;
[_plane, wp1] spawn BIS_fnc_Unitplay;

This is my script, called by a trigger,
rec = [pilot1, plane1] spawn wp1;

Note, I removed the waypoint data to let discord paste it, the unitcapture works its just the AI refuses to use the landing gear

winged thistle
#

Can I add waypoints to grpNull?

warm hedge
#

wp1 =;
invalid

tulip ridge
#

They said they removed the recording data

karmic flax
#

the waypoint was too long for discord so I just removed it, only the landing gear part needs work

tulip ridge
#

I forget if onEachFrame is a new scope or not, check if _plane is defined in it

little ether
tulip ridge
#

Yeah it's a new scope then

little ether
#

Not sure if you can params [_pilot, _plane]; in it, but give that a go, otherwise change it to global variables as per this example;

tulip ridge
little ether
#

Then global variables it is

tulip ridge
#

Yeah you probably just need to make it a global variable, make sure you prefix it

little ether
#

Love that I can help other issues but can't work out my own, oh well back to error screens 😂

tulip ridge
#

I would guess you meant rope

little ether
#

Nah it's Add Drop Action

fossil smelt
#

Anyone got a quick script for having a tank turret face a direction?

tulip ridge
little ether
#

Sorry I'm learning how to actually make sqfs etc so I'm in the middle of remaking it entirely, let me test and then post what I have if it doesn't work

#

What I need;

  • Player goes to crate and gets assigned gear set, this gear set includes banner. While getting gear set, crate also gives an addaction to plant that banner and removing it from his hands
  • I have had the pickup and putdown work once EACH (1 full cycle of put down/pick up) but was attempting to do it purely through object inits so could not get it to loop or be recursive
  • Another user suggested I need to learn how to do sqfs properly to do this, so I'm underway but can find no information on what might be going wrong here
this,  
"Page",   
     
[["aequip_NOL_horn_F","","","",["NOL_Horn_Magazine",9999],[],""],[],["Roger_Sigma_Banner_Weapon_1","","","",[],[],""],["EoO_Fant_Uni_14",[]],["EoO_Fant_Vest_16",[]],["1715_haversack_black",[["NOL_Horn_Magazine",10,9999]]],"EoO_Fant_Milita_Hat_4","",[],["","","","","",""]], 
     
[],   
"true",  
{player call FAN_fnc_addBannerDropAction;}   
] spawn Wbk_AddKit;``` This is the gear set, anything in that last {} gets executed. Addactions with player here work, but calls don't seem to be or I'm not understanding something.

**FAN_fnc_addBannerDropAction**
```player addAction ["Stand your ground!", {  
params ["_fan_fnc_adddropaction"];
_pos = player ModelToWorld [0,0,20];  
_banner = createVehicle ["BannerS", _pos, [], 0, "NONE"];  
_banner setPosASL AGLToASL screenToWorld [0.5, 0.5];  
player removeAction (_this select 2);  
_banner addAction ["Pick up Banner", {_banner call FAN_fnc_addBannerPickupAction}];  
}];``` This code drops the banner and in previous iterations would add the pickup action to the banner itself, but would never recur.

**FAN_fnc_addBannerPickupAction**
```params [_banner];
_banner addAction ["Pick up Banner", {
params ["_banner", "_player"];
_player addWeapon "Roger_Sigma_Banner_Weapon_1"; 
_player call FAN_fnc_addBannerDropAction; 
deleteVehicle _banner;
}];``` and this is the code that should delete the placed banner, add the weapon back to the player, and give them the option to plant it again.

Can't for the life of me work this shit out
granite sky
#

I didn't read much of this, but this won't work because _banner doesn't exist when the action code is executed.
_banner addAction ["Pick up Banner", {_banner call FAN_fnc_addBannerPickupAction}];

#

There's some inception shit going on here too though. Like why does the addAction do an addAction with the same name...

tropic nimbus
#

having an issue with a eventhandler that hopefully somebody can figure out whats happening

_medListBox ctrlAddEventHandler ["LBSelChanged", {
    params ["_control", "_selectedIndex"];

    if (_selectedIndex >= 0) then {
        private _medItem = _control lbData _selectedIndex;
        systemChat format ["Selected _medItem: %1", _medItem];

        private _doseListBox = findDisplay 38580 displayCtrl 71307;
        if (isNull _doseListBox) exitWith { systemChat "ERROR: _doseListBox is NULL in event!"; };

        systemChat "Scheduled dose list population...";

        private _capturedMedItem = _medItem;

        [{

            params ["_doseListBox", "_capturedMedItem"];

            if (isNil "_capturedMedItem" || {_capturedMedItem == ""}) exitWith { 
                systemChat "ERROR: Delayed _medItem is EMPTY!"; 
            };
            if (isNull _doseListBox) exitWith { 
                systemChat "ERROR: Delayed _doseListBox is NULL!"; 
            };

            systemChat "Executing dose list population...";
            lbClear _doseListBox;

            private _medParts = _capturedMedItem splitString "_";
            private _medBaseName = _medParts select (count _medParts - 1);
            systemChat format ["Computed _medBaseName: %1", _medBaseName];
            private _doseLevels = [1, 2, 3]; ```
#
                {
                private _stringtableKey = format ["STR_KAT_Pharma_%1_Dose%2", _medBaseName, _x];
                private _localizedText = localize _stringtableKey;
                systemChat format ["Checking Key: %1, Result: %2", _stringtableKey, _localizedText];

                if (_localizedText != _stringtableKey && {_localizedText != ""}) then {
                    private _index = _doseListBox lbAdd _localizedText;
                    _doseListBox lbSetValue [_index, _x];
                    systemChat format ["Added Dose: %1", _localizedText];
                };
            } forEach _doseLevels;

        }, [_doseListBox, _capturedMedItem], 0.05] call CBA_fnc_waitAndExecute;
    };
}];```
#

(split into 2 bc no nitro

#

when it first gets created it works fine, it populates the listbox with what it should, however after a progressbar and a reopening of the ace medical menu it breaks, and needs a manual close and reopen of the GUI

granite sky
#

Maybe expand on "it breaks"

tropic nimbus
#

it no longer populates the list box as it should

#

welp, apparently all i needed was a WAE

dusk gust
tropic nimbus
#

where there's a will, there is a WAE

cobalt path
#

I wanna remove the main rotor from a helicopter (like they do when rotor breaks).
I looked into selections.
Apparently I can do:

myheli hideselection "main rotor"; (for that specific helo)

BUT hideselection only works on simple objects. So how does it work ingame than when helicopters crash? How do I do it manually with a script than?

hallow mortar
#

Use the breakrotor parameter for setHit or setHitPointDamage

little raptor
torn geode
#

Idk if its the right chat but I could use some help with creating a simple script/mod that replaces main menu arma 3 logo into a button that connects user into a server automatically.

I've read some tutorials on forums and watched a few of creating/retexturing some models but I still don't know shit. It's like I was reading/watching a very profound chain of gibberish that was meant to discourage me from starting rather than actually helping me out.

Im studying IT but creating mods instead of being the consumer is something very alien and a hard territory for me. Like what does a minimal required structure of the mod looks in order for it to even work? Where do I find resources like what classes does the arma menu have or what its code even look like? You know its stuff like that, that I actually need and not some yet another tutorial video telling me to download arma 3 tools. and a while later suddenly bro opens up a whole ready generated or handmade (i dont even know) config.cpp out of his ass without explaining anything with a ready skeleton/outline (if i can call it that) of his mod config file.

If anyone could point me to a good/easy learning material that explains it or maybe explain a bit I would be very grateful since now Im just stuck in a hopeless situation, deciding if it's even worth all the hassle and just give up.

#

.

I tried changing the (now deprecated) "spotlight" into a button, made config.cpp, formatted a logo into .paa, threw it all into .pbo file, placed it in arma 3 directory and created a startup parameter to launch the mod... All i got was a fog/bright background image/scene in the menu and that was it :/

warm hedge
#

If you mean you made a Mod that somehow isn't working well, post your entire config in #arma3_config

little ether
little raptor
#

And how does your config look like?

little ether
#

Isn't for a mod, just for a mission

little raptor
#

Well description.ext is still a config

little ether
#

Well....I MIGHT turn it into a mod if I can ever work it out, I'm just trying to flesh out the fantasy side of things a little

#

Yeah okay then atm non-existent, although I realise that's where this cfgfunctions section is meant to go now that I've seen that page

tender inlet
#

hello everybody!
could some one can explain to me what this message mean ?

15:39:18 Observer B Bad Irony:1 (pSiKO) REMOTE (bis_o2_10715) in cargo of B Bad Irony:1 (pSiKO) REMOTE (bis_o2_10715); message was repeated in last 60 sec: 1239

13:27:35 Observer B Bravo 2-1:1 ([TF22]C.le.RamWar) REMOTE (bis_o2_15045) in cargo of B Bravo 2-1:1 ([TF22]C.le.RamWar) REMOTE (bis_o2_15045); message was repeated in last 60 sec: 6267

this message appear from time to time, but only on HC
setup: Main server linux, headless windows

"Bad Irony" is the group name

little ether
little raptor
#

Well yeah you need a description.ext to define a function in cfgFunctions

little ether
#

Yeah just had not the foggiest, have never moved beyond some addaction and object inits

blissful current
#

Any here versed in waypoints? I have the following code for a helicopter to land that works in SP but not when executed from the client in MP. Maybe I need to remoteexec some of this code? When I check waypoints with ADT it returns the correct number of waypoints which makes me think it's not a locality issue though. But I can also use ADT to run this code on the server and it works, which makes me think it is a locality issue. But I have to run the code twice for it to work.

EDIT: I decided to play this in a .sqf and remoteExec it. It works this way, just wish I understood why.

#
_group = ExtractHeliGroup;
_markerName = "moveToLZ"; 
_waypointPosition = getMarkerPos _markerName;
_waypoint = _group addWaypoint [_waypointPosition, 0];
_waypoint setWaypointType "MOVE";
_group setCurrentWaypoint [_group, 2];
[ExtractHeliGroup, [8584.56,8187.52,0], ExtractHeli] spawn BIS_fnc_wpLand;
edgy dune
little raptor
edgy dune
#

I probably could have worded that better

granite sky
#

Streamed. Loaded dynamically. Loaded on demand. Arma doesn't keep the whole map in memory.

little raptor
tardy osprey
#

Quick question, would: "3:04:55 Mission operation_phantoms_fall.rhspkl: Missing 'description.ext::Header'" prevent a mission from booting?

hallow mortar
#

It shouldn't. As far as I know, it's not required (I've never put it in a single one of my description.exts). The information contained in the description.ext header class is also provided in the mission.sqm by the Editor, anyway.

eternal spruce
#

I'm not sure If I'm articulating this properly, However say I have 3 triggers (Trigger1-3) for 3 helipads. I want to create a repair/refueling area but say I have 3 helicopter (helo1-3).
In each trigger i want the following outcome:

the helicopter is repositioned to the helipads precise location.
disable simulation for the driver of the vehicle or disable control for certain amount of time.

But what puzzling me is, what if i want the trigger to be activated by any on the helicopter, meaning helo1 can activate trigger 3, helo2 can activate trigger 1 - basically any helicopter can land on any helipad and do the following. Again I'm really sorry if I cant articulate what I'm trying to say any better.

warm hedge
#

Do you mean heli1 only should trigger trigger1, not others, same for 2 and 2, 3 and 3?

eternal spruce
#

I was thinking about that but what if helo1 lands on the helipad with triggger2 that means nothing would happen, i guess I'd like to add some randomness to each helipad

granite sky
#

I feel like there should be some event that triggers when a heli lands, but apparently not.

#

I guess you could create three tiny triggers with a limited z axis.

#

The actions aren't difficult. You can use disableAI to turn off the pilot. setPosATL to the pad's position should work for the reposition.

#

If you delay the actions with a spawn for a few seconds then that should allow the heli to finish landing first.

eternal spruce
#

I could try that, but instead of having a variable name for the helicopters can i just use the class name

#

So instead of giving every helo a name i can have multiple class variants

granite sky
#

Doesn't need either really. You can just check for a heli that's actually on/near the pad.

eternal spruce
#

How do i go about doing that?

granite sky
#

Could probably use thisList in the trigger activation.

#

Down side of triggers is that if another matching object enters the trigger area and remains there, then it won't detect a heli landing.

eternal spruce
#

I see, so what if I set the condition with all the vehicles I want to activate the trigger

granite sky
#

I think the only option you get is "VEHICLE"

#

oh, I guess there is the trigger condition. I'm not sure how that interacts with the non-scripted parts.

eternal spruce
#

Ok thank you, I’ll see what I can conjure up much appreciated

unkempt marsh
#

https://community.bistudio.com/wiki/targetKnowledge
I've noticed that the position returned from this command is in "Position" format whilst all the other commands i know require PositionAGL or PositionASL
Does anybody know how to convert them? when i try to use Position it just throws out errors about receiving type: Any, expected: number

warm hedge
little raptor
#

What you say about "using position throws error" makes no sense. As POLPOX said it's still a position (3D vector) and only its Z might be different, so you're doing something wrong yourself

carmine sand
#

is there a way to make collision work for attached objects? I mean for Soldiers the collision works, but not for Vehicles anymore. Example

A attachTo B
A has lost collision
B has also lost collision

possible to let A or B have collision again while being attached?

little raptor
#

You can move it manually every frame

#

Also if you attach A to B, B should still have collision

carmine sand
little raptor
#

Are you on perf or dev branch?

carmine sand
#

because im trying to make a static MG not being moveable by vehicles crashing into it and ive attached the MG to a invisible MG defined as a house.. it works its attached and AI is able to use and fire the MG but i can drive trough

carmine sand
little raptor
#

Can you test stable?

carmine sand
#

ill try 👍 will give feedback

little raptor
little raptor
#

Oh right no 😅

#

Tank has collision too blobdoggoshruggoogly

carmine sand
#

hmm

little raptor
# carmine sand hmm

here's a script to try:

_w = "Land_InvisibleBarrier_F" createVehicle [0,0,0];
_mg = "B_HMG_01_high_F" createVehicle [0,0,0];

_w setVectorDirAndUp [[0,1,0], [1,0,0]];
_w setPosASL (player modelToWorldWorld [0,5,0]);

_mg attachTo [_w, [-2,0,0.7]];
_mg setVectorDirAndUp [[0,1,0],[-1,0,0]]
little raptor
#

or have you actually created an invisible model?

carmine sand
#

i got fixed it, ive forgot to add GeometryPhys, only did Geometry LOD kekw2

#

red one is the invisible one later

little raptor
#

but if you don't have a physx lod, the game should use geometry instead thonk

carmine sand
#

attached one's geometry is disabled

#

while the house is working

carmine sand
#

for infantry yes

#

im doing invisible doubles for staticMG classes (defense turrets) so they cant be moved by tanks, cars amd other bigger vehicles

#

because even if you set the Mass up in the model you still can move it while drive into it

#

thanks a lot Leopard20 👍

pallid palm
#

@little raptor hay m8 you missed End of Block up there last line 🙂

little raptor
#

it's not needed

pallid palm
#

ok

#

i was thinking that but well you know

vagrant elm
#
    private _rang = _x select 0;
    private _uniform = _x select 1;
    private _headgear = _x select 2;
    private _farbe = _x select 3;

    this addAction [
        format ["<t color='%1'>%2</t>", _farbe, _rang],
        {
            params ["_target", "_caller", "_actionId", "_arguments"];
            _target forceAddUniform (_arguments select 0);
            _target addHeadgear (_arguments select 1);
        },
        [_uniform, _headgear]
    ];
} forEach [
    ["Rekrut", "U_23pzd_inf_gren_m43_02_oc_gb", "H_23pzd_mann_ehfm_01_feldgrau", "#FFFFFF"],
    ["Pzobgren", "U_23pzd_inf_obgren_m43_01_oc_gb", "H_23pzd_mann_ehfm_02_feldgrau", "#FFFFFF"],
    ["Gefreiter", "U_23pzd_inf_gefr_m43_03_oc_gb", "H_23pzd_pin_mann_ehfm_03_feldgrau", "#FFFFFF"],
    ["Obergefreiter", "U_23pzd_inf_obgefr_m43_04_oc_gb", "H_23pzd_pin_mann_m38_01_feldgrau", "#FFFFFF"],
    ["Obergefr6", "U_23pzd_inf_obgefr6_m36_02_oc_gb", "H_23pzd_pin_mann_ehfm_04_feldgrau", "#FFFFFF"],
    ["Stabsgefr", "U_23pzd_inf_stgefr_m36_07_oc_gb", "H_23pzd_pin_mann_ehfm_05_feldgrau", "#FFFFFF"],
    ["UA", "U_23pzd_zeiser_m43_01_oc_gb", "H_23pzd_pin_mann_m38_01_feldgrau", "#FFFFFF"],
    ["Unteroffizier", "U_23pzd_inf_uffz_m36_03_cc_jb", "H_23_pzd_pin_inf_uffz_schirm_02", "#00FF00"],
    ["Unterfeldwebel", "U_23pzd_inf_ufw_m36_04_cc_jb", "H_23_pzd_pin_inf_uffz_schirm_02", "#00FF00"],
    ["Feldwebel", "U_23pzd_inf_fw_m36_08_cc_jb", "H_23_pzd_pin_inf_uffz_schirm_01", "#00FF00"],
    ["Oberfeldwebel", "U_23pzd_inf_ofw_m36_07_cc_jb", "H_23_pzd_pin_inf_uffz_schirm_02", "#00FF00"],
    ["Hauptfeldwebel", "U_23pzd_inf_hptfw_m36_06_cc_jb", "H_23_pzd_pin_inf_uffz_schirm_0", "#00FF00"],
    ["Leutnant", "U_23pzd_inf_lt_m40_01_rb", "H_23pzd_pin_inf_schirm_01", "#FF0000"],
    ["Oberleutnant", "U_23pzd_berg_m40_01_rb", "H_23pzd_pin_pzgren_schirm_01", "#FF0000"],
    ["Hauptmann", "U_23pzd_keppler_m40_01_rb", "H_23pzd_pin_pzgren_schirm_01", 
];

systemChat "Uniform- und Mützenaktionen wurden hinzugefügt.";```
#

So it works ... on paper, in singleplayer etc
However issue now i am having is that on the main server the uniform swaps kinda dont work. They either just delete everything on that AI or randomly sometimes for a second select at least a uniform from one of the ranks.... no consistancy.

Should i try to put it into a sqf.? bc rn i have it in in the init field ingame on that AI

south swan
#

missing part of the last array ("Hauptmann" one) as posted blobdoggoshruggoogly

vagrant elm
#

Sry i had to cut out a bit

this is the full script:

#
    private _rang = _x select 0;
    private _uniform = _x select 1;
    private _headgear = _x select 2;
    private _farbe = _x select 3;

    this addAction [
        format ["<t color='%1'>%2</t>", _farbe, _rang],
        {
            params ["_target", "_caller", "_actionId", "_arguments"];
            _target forceAddUniform (_arguments select 0);
            _target addHeadgear (_arguments select 1);
        },
        [_uniform, _headgear]
    ];
} forEach [
    ["Rekrut", "U_23pzd_inf_gren_m43_02_oc_gb", "H_23pzd_mann_ehfm_01_feldgrau", "#FFFFFF"],
    ["Pzobgren", "U_23pzd_inf_obgren_m43_01_oc_gb", "H_23pzd_mann_ehfm_02_feldgrau", "#FFFFFF"],
    ["Gefreiter", "U_23pzd_inf_gefr_m43_03_oc_gb", "H_23pzd_pin_mann_ehfm_03_feldgrau", "#FFFFFF"],
    ["Obergefreiter", "U_23pzd_inf_obgefr_m43_04_oc_gb", "H_23pzd_pin_mann_m38_01_feldgrau", "#FFFFFF"],
    ["Obergefr6", "U_23pzd_inf_obgefr6_m36_02_oc_gb", "H_23pzd_pin_mann_ehfm_04_feldgrau", "#FFFFFF"],
    ["Stabsgefr", "U_23pzd_inf_stgefr_m36_07_oc_gb", "H_23pzd_pin_mann_ehfm_05_feldgrau", "#FFFFFF"],
    ["UA", "U_23pzd_zeiser_m43_01_oc_gb", "H_23pzd_pin_mann_m38_01_feldgrau", "#FFFFFF"],
    ["Unteroffizier", "U_23pzd_inf_uffz_m36_03_cc_jb", "H_23_pzd_pin_inf_uffz_schirm_02", "#00FF00"],
    ["Unterfeldwebel", "U_23pzd_inf_ufw_m36_04_cc_jb", "H_23_pzd_pin_inf_uffz_schirm_02", "#00FF00"],
    ["Feldwebel", "U_23pzd_inf_fw_m36_08_cc_jb", "H_23_pzd_pin_inf_uffz_schirm_01", "#00FF00"],
    ["Oberfeldwebel", "U_23pzd_inf_ofw_m36_07_cc_jb", "H_23_pzd_pin_inf_uffz_schirm_02", "#00FF00"],
    ["Hauptfeldwebel", "U_23pzd_inf_hptfw_m36_06_cc_jb", "H_23_pzd_pin_inf_uffz_schirm_0", "#00FF00"],
    ["Leutnant", "U_23pzd_inf_lt_m40_01_rb", "H_23pzd_pin_inf_schirm_01", "#FF0000"],
    ["Oberleutnant", "U_23pzd_berg_m40_01_rb", "H_23pzd_pin_pzgren_schirm_01", "#FF0000"],
    ["Hauptmann", "U_23pzd_keppler_m40_01_rb", "H_23pzd_pin_pzgren_schirm_01", "#FF0000"],```
#
    ["Panzermann", "U_23pzd_hoffmann_jb_aufkl", "H_23pzd_pin_mann_ehfm_03_panzer", "#FF69B4"],
    ["Panzergren", "U_23pzd_pzgren_pzobgren_m43_01_va_cc_jb", "H_23pzd_pin_mann_ehfm_04_feldgrau", "#90EE90"],
    ["Aufklärer", "U_23pzd_aufkl_gefr_m43_04_va_oc_gb", "H_23pzd_pin_mann_ehfm_05_feldgrau", "#FFA500"],
    ["Sanitäter", "U_23pzd_richter_m43_01_oc_gb", "SPE_m42_stahlhelm_Sani", "#00008B"],
    ["Artillerist", "U_23pzd_stug_pzgren_wrap_07_pka_va_gb", "H_23pzd_mann_ehfm_01_panzer", "#8B0000"]
];

systemChat "Uniform- und Mützenaktionen wurden hinzugefügt.";```
#

and if so: can you explain to me where or what i did wrong? I am fairly new to this whole thing and have no idea what i am doing tbh xD

south swan
#

nothing looks obviously wrong

vagrant elm
#

Well but something must be wrong... Bc it just doesnt work correctly xD

south swan
#

works alright in MP, though blobdoggoshruggoogly (the only changes i've made were vanilla uniform/headgear classes)

vagrant elm
#

what you mean? Like for example "U_23pzd_aufkl_gefr_m43_04_va_oc_gb" ??

south swan
#

with Hauptmann being ["Hauptmann", "U_C_Poloshirt_salmon", "H_HelmetB_plain_blk", "#FF0000"] blobdoggoshruggoogly

vagrant elm
#

well i use inhouse mods and the SPE-stuff

south swan
#

left window hosts from 3DEN, right is client

vagrant elm
#

those uniforms and headgear is from our arsenal

south swan
#

code as posted looks correct. Code as posted works correctly on my machine. I can't see anything that can go wrong from what's available here blobdoggoshruggoogly

vagrant elm
#

yeah ... for me as well
It works when i post it in editor, test in MP
But when i put it into our actual server and launch the mission its fucked

#

or maybe it is bc of lag? bc we have quite a few things placed down to accomendate our 100+ players in spawn

rich phoenix
#

Hi all. There are some questions about scripts in Arma 3.

I just started to learn the development of this game and I met in Workshop a Dynamic Recon/Combat Operations in a deep past. But the there is the problem, that you can't use the Zeus while playing it and there is a fair question: Can we decompile the maps and edit it.

I think that it is possible because of there are lots of addons, which refer to other mods.

#

And can we decompile pbo-files?

little raptor
#

Can we decompile the maps and edit it
no. you can add or remove (hide) map objects via scripts tho

little raptor
rich phoenix
#

"//" is used to comment something or it has another meaning in syntaxis

tulip ridge
#

It's a comment

rich phoenix
little raptor
granite sky
rich phoenix
little raptor
#

yes

#

vscode, notepad++, etc. all have something for SQF

vagrant elm
still forum
hushed turtle
#

Does init.sqf execute for JIP players too?

flint topaz
hushed turtle
#

I'm testing coop mission and I'm calling createDiaryRecord in init.sqf to create briefing, but client didn't have any briefing.

My setup is running 2 game instances on same PC, one is listen server and second one client.

Maybe init.sqf didn't run cause of this setup?

south swan
#

inb4 it's run after if !(isServer) exitWith {}; line

hushed turtle
#

Tried again, but this time I selected new mission from editor in mp lobby and loaded it from editor rather then selecting mission previously exported and client is getting briefing now. It's kinda weird, but whatever blobcloseenjoy

proven charm
#

i think the player may not be always set on time

#

so you could do waituntil { sleep 0.1; !isnull player };

#

had this problem once

rich phoenix
#

Hey, Guys, does somebody know, where are located pbo-files of addons

hushed turtle
#

Client didn't have any briefing even when joined in progress when I was testing it on exported mission

#

Workshop?

rich phoenix
#

I want check the scripts of one zombie mod

#

But I can't find the folder with it

hushed turtle
hushed turtle
#

Yes

rich phoenix
blissful current
#

How would I make a filter that would single out variables that aren't already active? The way I have written this unfortunately it is possible to set a variable that is already active. I thought about if else but I have 3 variables, so I think that wouldn't work.

if (_randomRoll < _chance) then {      
private _tasks = ["cacheTask", "gunboatTask", "samsiteTask"];
private _selectedTask = selectRandom _tasks;
missionNamespace setVariable [_selectedTask, true, true];
hushed turtle
#

Wanna check if you already set variable from _tasks using setVarible?

blissful current
#

I'm not sure how to go about it. I've seen isNotEqualTo before. Maybe there's a way to use that to filter out the ones already true?

hushed turtle
#

Why not to use getVariable to check if variable returns nil?

blissful current
#

I'm not against that, I just don't know I would go about it? Like, do I put that in the condition of an if statement?

#
if (_randomRoll < _chance) then {      
private _tasks = ["cacheTask", "gunboatTask", "samsiteTask"];
private _selectedTask = selectRandom _tasks;
if (_tasks == nil) then {
private _selectedTask = selectRandom _tasks;
};
missionNamespace setVariable [_selectedTask, true, true];
#

Maybe this?

stable dune
hushed turtle
#
if (isNil { missionNamespace getVariable _selectedTask }) then {
  missionNamespace setVariable [_selectedTask, true, true];
};
blissful current
#

Hmmm, I just though of something. isNil might not work. Because I have a trigger condition for each of these that checks for the variable missionNamespace getVariable [cacheTask, false]; for example. So as the trigger condition is evaluated then the variable will go from Nil to false, correct?

#

So how about this?

if (!{ missionNamespace getVariable _selectedTask }) then {
  missionNamespace setVariable [_selectedTask, true, true];
};
hushed turtle
#
if (!(missionNamespace getVariable [_selectedTask, false])) then {
  missionNamespace setVariable [_selectedTask, true, true];
};
#

you can do the same

blissful current
#

So this says "If the variable is already true then select another one at random." But then the code stops there, right? So it could happen that it selected that same true variable twice. I want it to reiterate until it chooses once that hasn't been made true already.

stable dune
#

if you want this part?

private _tasks = ["cacheTask", "gunboatTask", "samsiteTask"] select {missionNamespace getVariable _x};
if (_tasks isNotEqualTo []) then {
  private _selectedTask = selectRandom _tasks;
};

or just remove from your array (make it global) when used.

blissful current
#

This may work. Im reading the biki to understand it's function.

hushed turtle
#

True, you could make _tasks global array and remove task from it after task gets selected

blissful current
#

I don't understand what the brackets are empty though.

#

I'm not sure which path to take. As you can gather I am a novice at this. The isNotEqualTo route seems to make the most sense to me so far.

hushed turtle
#

So, you want to have tasks, which you want them to be selected in random order?

#

Each task only once?

blissful current
#

Yeah, okay so I give you the big picture. I have 10 objects with hold action "search for intel". There is a 10 percent chance after the action is complete that it will run the code I posted. But it can only select one of the random variables because that triggers a task for the players. If it was to select the same variable twice it wouldn't make sense narritively for the game to say "you found intel!" but not proc a task because it has already been activated. Sorry if that is confusing.

#

So that is why I'm looking to remove a variable from the pool. So the random pool of variables will go from 3 to 2 to 1.

hushed turtle
#

You could make _tasks global:

tasks = ["cacheTask", "gunboatTask", "samsiteTask"];

And then, when you want to select task you gonna remove it from array as well:

if (_randomRoll < _chance) then {      
  private _selectedTask = selectRandom tasks;
  missionNamespace setVariable [_selectedTask, true, true];
  tasks = tasks - [_selectedTask];
};
blissful current
#

Ahhh, so by pulling the tasks code out of the holdAction code block. It ensures that it wont get run again, thus re-adding it to the array.

#

So functionally both ways produce the same result, right?

private _tasks = ["cacheTask", "gunboatTask", "samsiteTask"] select {!(missionNamespace getVariable [_x, false])};
if (_tasks isNotEqualTo []) then {
    private _selectedTask = selectRandom _tasks;
    missionNamespace setVariable [_selectedTask, true, true];
};
hushed turtle
#

no, functionaly it won't be same

#

firstly you are recreating _tasks again and that select is gonna select first or second element and never third

still forum
#

select CODE is not select BOOL

blissful current
#

I think I just got this error when I tried the above one.

hushed turtle
#

was looking at {} and thought it might bad

still forum
blissful current
still forum
granite sky
#

You have an object in one of your task variables.

still forum
#

It looked like your code would only be "true" in the variable

granite sky
#

Last time this happened you had a trigger with that variable name or something :P

#

need more tagging

blissful current
hushed turtle
#

the idea was to make task global, define it for example at intServer.sqf and then remove elements from it when you will be selecting tasks

#

but no re-creating of that array

#

It gets created once and that's how it is gonna remember what was removed

#

if you gonna create it again with original elements, then you goona lost what you've removed from it

blissful current
#

initServer.sqf:

tasks = ["cacheTask", "gunboatTask", "samsiteTask"];

initPlayerLocal.sqf:

// Define objects
private _objects = [obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10];

// Counter for attempts and successful hints
missionNamespace setVariable ["holdActionAttemptCount", 0];

{
    private _object = _x;
    [
    _object,
    "<t color='#FFFF00'>Search for Intel</t>",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", //idle icon 
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", //progress icon
    "_this distance _target < 3", //condition
    "true", //condition progress
    {}, //code on start
    {}, // code every tick
    {
        params ["_target", "_caller", "_actionId", "_arguments"];

        // Increase attempt count
        private _attemptCount = missionNamespace getVariable ["holdActionAttemptCount", 0];
        _attemptCount = _attemptCount + 1;
        missionNamespace setVariable ["holdActionAttemptCount", _attemptCount];
        
        // Calculate chance (10% per attempt, guaranteed at the 10th)
        private _chance = _attemptCount * 10;
        private _randomRoll = random 100;

        // Creates task for player by using setVariable
        if (_randomRoll < _chance) then {    
            private _selectedTask = selectRandom tasks;
            missionNamespace setVariable [_selectedTask, true, true];
            tasks = tasks - [_selectedTask];
            };
    }, // code on finish
    {}, // code on interuption
    [], //arguements
    1, //duration
    8, //order from top
    true, //remove on finish
    false, //show if unconcious
    false //show in middle of screen
    ] call BIS_fnc_holdActionAdd;

} forEach _objects;
#

So I probobly should place the BIS_fnc_holdActionRemove after tasks maybe in an if statement. Could I use _objects here? I'm not sure what to place in the ID index though. Like this:

if (_randomRoll < _chance) then {
  //stuff    
  private _selectedTask = selectRandom tasks;
  missionNamespace setVariable [_selectedTask, true, true];
  tasks = tasks - [_selectedTask];
  if (tasks isEqualTo []) then {
  [_objects, ID] call BIS_fnc_holdActionRemove         
  };
#

Guess I need to find a way to pass _objects to within the code block. And probably need to remoteExec this as well for MP.

dusk gust
blissful current
#

I dont get an error message this way. But it doesn't remove the actions. I think I need to put an action ID but I dont understand what to put there.

dusk gust
blissful current
#

What is _actionID?

dusk gust
#

Thats the actionID that is added with holdActionAdd I would assume

blissful current
#

So do I need to figure out what it's value is or just write _actionID somewhere in my code?

dusk gust
#

You already have the parameters defined in the codeCompleted section in your code. Basically just switch your
[_objects, ID] call BIS_fnc_holdActionRemove
To
[_target, _actionId] call BIS_fnc_holdActionRemove

blissful current
#

Hmm that's what I tried at first. Lemme try again.

#

Yeah the error is for undefined variable _object

#

This work's though. However I need to test what happens if one of these object's doesn't exist. Might throw and error.

if (tasks isEqualTo []) then {
  private _objects = [obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10];
  { [_x, _actionId] call BIS_fnc_holdActionRemove; } forEach _objects; };
#

It did not throw an error. Okay... I'll take it.

#

Now to test in MP.

#

Hmm, it seems when the client executes the hold action the variable isn't sent to the server.

missionNamespace setVariable [_selectedTask, true, true];

This should send it over the network correct?

granite sky
#

Yes.

blissful current
#

That's what I thought too. But when I check with ADT the variable isn't defined yet.

#

Oh this might be it.

private _selectedTask = selectRandom tasks;

tasks is defined in initServer and my holdAction code is in initPlayerLocal

tulip ridge
#

Yeah, its defined on one machine and used on the other

blissful current
#

Hmmm so what is stopping it from getting the variable from the server then?

tulip ridge
#

Because if you only define tasks in initServer, then it isn't defiend on the client

blissful current
#

Ah Okay that's what I was getting at but didn't articulate well probably. So should I place that in initPlayerLocal instead?

I think it might not work that way because if a JIP player comes then the variable will be rewritten because it's an array of a possible 1-3 variables.

granite sky
#

Bouncing these vars back and forth from the server is not a good idea anyway and it sounds like you should redesign.

#

Like have your holdAction call a function on the server instead.

blissful current
#

Dang. That might be above my skill level at the moment. I'm not sure what that means.

hallow mortar
#

It means use remoteExec from the holdAction code (executed on client) to the server

blissful current
#

Oh that doesn't sound too bad, but probably another days work for me. I just got a few more minutes before I go to bed so I decided to go back to my original method that was said to be less performant.

blissful current
#

Well I think it's working so far. Thank you everyone for the help and ideas! Goodnight!

pallid palm
#

funny i never use any Tasks, i just put what must be done in the briefing, (this would force you to read the briefing) So i guess if you can't read then you would not know what to do

#

Hello Awsome people: what would be a good reason, to use Layers, ?

cosmic lichen
#

Organisationen and the possibility to enable/disable or show/hide entire groups of entities.

pallid palm
#

ok thx m8 i understand

#

so if i'm Exstreamly Organised and i spawn every thing in as the mission progress, then i don't need Layers would that be fair to say

proven charm
#

arent layers just for organization purpose (and for toggling on/off). if you create everything via script i dont see point in layers

open fractal
#

I put a composition on the workshop a while ago that ran a script on every object within a certain layer so that it was drag and drop for the end user

#

But I suppose that's not creating everything via script on the end user side

pallid palm
#

is there some kind of performance gain if we use Layers or No

#

seems to me there would be a performance drop if we use Layers

cosmic lichen
#

There is no performance drop with layers.

hallow mortar
cyan dust
#

Good day. Is there a Get function for setVehicleAmmoDef ? 🤔 Or is there an option to get at least approx. value? I'm trying magazinesDetail but parsing strings doesn't seem ideal.

proven charm
little ether
#

Are there many resources on creating ACE compatability patches for weapons? I wanted to get a weapon working with ACE and though it would be a case of re-assigning magazines and ammo, but am not having much luck. Don't want to mooch of my betters but I can't seem to find many resources on the topic. Any leads?

cyan dust
next kraken
#

when using "setAperture" command, making a pretty bright moonshine night, is there any workaround to make the AI see better so they engage you

hallow mortar
#

setSkill

blissful current
blissful current
little raptor
#

Actually you have to lower it
Default is 1. So you set it to a number between 0 and 1

hallow mortar
#

The wiki says lower camouflageCoef makes it harder to spot the unit 🤔

blissful current
#

How many hours does it take you all to make a mission that is say 1 hour in playtime length?

I assume the more you make missions and the more you understand SQF coding the faster it becomes.

hallow mortar
#

It depends hugely on what kind of mission you're making and how big it is. Not all missions require complex scripted systems; adding more players usually requires more work to account for the increased scale.

proven charm
#

it goes to the point where you no longer have anything to code because you code so fast 😛

#

but may take time to reach that though

hallow mortar
#

Some missions I make use only standard systems from my group's framework. I have very little coding to do. All my time is spent on laying out the mission space itself in the Editor.
For other missions I introduce entirely new scripted gameplay mechanics. In those cases, it can take a few days of iteration and testing to get the result I want - not only to get the code working, but also to get it working in a way that's fun and balanced to play with.

late drum
#

Hello! I'm getting this error on my function:

Error in expression <.11];
private _cameraObject = camCreate _cameraPosition; 
_cameraObject cameraEf>
  Error position: <_cameraPosition; 
_cameraObject cameraEf>
  Error Missing ;

But I don't know what's wrong, I don't see anything wrong:

    case "setupCamera":
    {

        private _cameraPosition = [186.15, 16295.2, 1.11];
        private _cameraObject = camCreate _cameraPosition; 
        _cameraObject cameraEffect["INTERNAL", "FRONT"];
        _cameraObject camSetTarget [186.15, 16297.3, 1.11];
        _cameraObject camCommit 0;
        Villas_Camera = _cameraObject; 
    };
hallow mortar
blissful current
hallow mortar
#

It means we have a framework of scripted systems that serve as the basic starting point for every mission. Loadout assignment scripts, force tracking markers, medical system etc. Common mission features don't have to be rebuilt every time; they're in the framework.

versed trail
#

I'm using the camera tutorial on the Biki at https://community.bistudio.com/wiki/Camera_Tutorial
to test camera objects, which works great. I have a camera set up in the editor (a Camera_F object from the Timeline category) but when I switch to it in game with the command in the tutorial (_camera cameraEffect ["internal", "back"]; it switches for about a second and then switches back to my player camera. Are there additional commands needed to make it stick on that camera?

sly cape
#

How would I make something happen when a certain control is pressed, like the laser rangefind key.

hallow mortar
#

You have some options depending on the behaviour you want.
addUserActionEventHandler - safe against changing keybinds, but cannot block the action it detects
displayAddEventHandler with KeyDown - can block inputs but requires special handling to be safe for changing keybinds; detects inputs rather than actions so can be more complicated
addAction with a shortcut set - can block some actions but not all; requires an addAction to be available

sly cape
#

Thank you

little raptor
steady pelican
#

Is this the correct chat for mod development questions? I'm trying to get a better understanding of how the CfgVehicles class is defined, but I'm unsure if this is the right channel.

Apologies - just recognized that Arma3_config is the proper channel.

glossy pine
#

I mean for waitAndExecArray and waitUntilAndExecArray, could skip the part of marking for delete etc

#

and for perFrameHandlerArray would be better I think, would reduce the logic to remove a perframehandler

zealous solstice
#

needing to make an array out of the values probably would be slower in general i expect

#

so i expect removal and addition could be faster or but normal loop time is probably slower

#

so the part that is done Often is worse probably so it would not really make sense

frozen seal
#

hi all! I feel like I'm missing something obvious here:

// This line works in SP
_vehicle addMagazineTurret [_magType, _path, _ammoCount];
        
// This line does not work in SP
[_vehicle, _magType, _path, _ammoCount] remoteExec ["addMagazineTurret", _vehicle];

Since I'm currently testing in singleplayer shouldn't remoteExec go straight back to my machine and be equivalent to the first line? why wouldn't it work?

hallow mortar
#

Because the remoteExec isn't formatted correctly. It wouldn't work in MP either.

#

The right-side argument for addMagazineTurret is an array. When it's turned into a remoteExec, it needs to stay as an array, within the [left, right] array of arguments. You're flattening it.

frozen seal
#

ohh I see, that worked, thank you!

[_vehicle, [_magType, _path, _ammoCount]] remoteExec ["addMagazineTurret", _vehicle];
upbeat hill
#

is it possible to give a trigger or a object health and make it take damage ?

granite sky
#

If there's already a handler to remove then it's already going to run that code in the next frame.

south swan
#

Ah, next frame, ye. "Only add removal handler once, add the target to list for removal" meowsweats

meager granite
#

So no its not possible unless they already have that. You'll need to script simulate damage taking

still forum
# glossy pine Using hashmaps on the perFramehandler of CBA instead of arrays wouldnt be faster...

What do you imagine the hashmap keys to be?
The ID of the handler? That doesn't work because hashmaps are unordered. And mods might depend on PFH's executing in the order they were added.
And you cannot do that when the hashmap might be randomly shuffled at any time.
You could take all elements out and sort them to keep order, at every execution, but that is much worse.

If you wanted to "simplify" the deletion logic here https://github.com/CBATeam/CBA_A3/blob/2182e35655c2919f09a6db074912087bd33495a8/addons/common/fnc_removePerFrameHandler.sqf#L39
You could do that, https://community.bistudio.com/wiki/deleteAt in 2.18 added a new syntax to supply array of indices.

So ```sqf
{
GVAR(perFrameHandlerArray) set [_x, objNull];
} forEach GVAR(perFrameHandlersToRemove);

        GVAR(perFrameHandlerArray) = GVAR(perFrameHandlerArray) - [objNull];

Can besqf
GVAR(perFrameHandlerArray) deleteAt GVAR(perFrameHandlersToRemove);



You can do the same kinda thing with waitAndExecArray too.
https://github.com/CBATeam/CBA_A3/blob/2182e35655c2919f09a6db074912087bd33495a8/addons/common/init_perFrameHandler.sqf#L54

It always iterates the first N elements, until it finds one who's time has not come yet.
Remember the index of the last element that is executed (can just use `breakWith _forEachIndex` instead of the exitWith), and then use deleteRange to remove the first N elements.

You could also use findIf to find the index of the last element to be executed.
both select and deleteRange can handle 0/-1 properly.

then just
```sqf
{(_x select 2) call (_x select 1);} forEach (GVAR(waitAndExecArray) select [0, N]);
GVAR(waitAndExecArray) deleteRange [0, N];

The findIf will be so simple that SimpleVM optimization will trigger, but I'm not sure if it will actually be faster, because the number of iterations will be very low.

frozen seal
#

hi all!
I need to generate random vehicleVarNames for vehicles spawned via script or by zeus. I am a bit concerned about setVehicleVarName locality.
I plead to the gurus of sqf to please look at this method and tell me if this looks safe in the context of MP/JIP 🙃

fnc_assignRandomVarName = {
    params ["_vehicle", ["_prefix", ""]];
    
    _varName = "";
    while { true } do {
        _suffix = call fnc_getRandomSuffix;
        _varName = _prefix + _suffix;
        
        // Make sure the name is unique
        _existingVar = missionNamespace getVariable [_varName, objNull];
        if (isNull _existingVar) exitWith {};
    };
    
    [_vehicle, _varName] remoteExec ["setVehicleVarName", 0];
    missionNamespace setVariable [_varName, _vehicle, true];
};
#

Should I set the JIP parameter of remoteExec to true?

winter rose
#

(why do you want to set the vehicle var name?)

frozen seal
#

I'm building a persistent save system and I need to have unique identifiers on vehicles so I could serialize their data and deserialize it back later.

#

it works fine with vehicles added in 3den because I can set the variable name manually, but with the ones spawned by zeus it's more of an issue.

little raptor
#

It also returns negative numbers to give you more numbers.
But if you don't want that set its initial value to 0

#

You should also serialize that number btw

frozen seal
# little raptor You don't need to generate var names for that But anyway to answer your question...

I was thinking about an incremental counter but I think it would break in this edge case:

  1. 10 vehicles are spawned, each with unique number
  2. Vehicle X is spawned next, gets the index 10
  3. First 10 vehicles are removed
  4. Server is shut down, vehicle X is serialized with 10 in its name
  5. Server is restarted, the TAG_lastID is reset to 0
  6. After 10 more vehicles are spawned there will be tag collision with vehicle X from the previous server run
winter rose
#

You should also serialize that number btw

frozen seal
#

I mean yeah, that's one of the solutions I guess.
Either way unique tag is a smaller issue here and it can be solved in different ways

little raptor
#

It's a pseudo random number generator. It just repeats a pattern (how soon it breaks depends on how good it is tho, iirc A3's isn't good)

frozen seal
#

fair, I will use the counter

#

the issue with varname persist though

little raptor
#

I don't see why you're sending them to the clients if it's just for serialization?

frozen seal
#

I want my loading system to work like this (pseudocode)

condition A = vehicle with ID N exists at mission start
if (A) {
  apply loaded settings to the existing vehicle
} 
else if vehicle with ID N exists only in the database {
  spawn new vehicle and apply loaded settings to it
}
frozen seal
glossy pine
frozen seal
#

I think I would still like to sync the varname to at least be able to check it during the mission through console commands while playing as a connected client.

#

But it is true that only the server truly NEEDS to have the varname. Everyone else might experience slight inconvenience at worst, it shouldn't be gamebreaking

little raptor
#

and what do you serialize to? (mission)ProfileNamespace? or a database?

frozen seal
little raptor
#

no I mean every object?

#

or just some?

frozen seal
#

Not really, my current plan is:

  1. Predefined objects from a list manually set up in 3Den or in a script
  2. Additionally, based on mission makers preferences either one of these:
    a. Every vehicle or prop that zeus spawns
    b. Vehicles that zeus manually chooses to save during the game
little raptor
# frozen seal hi all! I need to generate random vehicleVarNames for vehicles spawned via scrip...

also regarding this part:

[_vehicle, _varName] remoteExec ["setVehicleVarName", 0];
missionNamespace setVariable [_varName, _vehicle, true];

it's better to send one message imo:

// fn_setVar.sqf
params ["_vehicle", "_varName"];
_vehicle setVehicleVarName _varName;
missionNamespace setVariable [_varName, _vehicle];

so instead you now do this:

[_vehicle, _varName] remoteExec ["TAG_fnc_setVar", 0];
frozen seal
#

hmm fair, thanks!

spice siren
#

Hello, I am working on a script in which the wind direction and speed updates as a player passes down through altitude blocks. It is an attempt to easily enter real world wind values to be used during HAHO jumps within the game. I have a half working script, but am running into issues with it pulling the data I want it to from an easily editable array. The script is large. Would anyone be willing to give me a hand?

little raptor
#

Post the script

spice siren
#
// Wind Updater Script: Updates wind when "lead jumper" crosses 1000-ft altitude blocks

// Define wind profile (altitude in feet ASL, direction in degrees "from", speed in knots)
wind_profile = [
    [30000, 270, 10],
    [29000, 270, 10],
    [28000, 270, 10],
    [27000, 270, 10],
    [26000, 270, 10],
    [25000, 270, 10],
    [24000, 270, 10],
    [23000, 270, 10],
    [22000, 270, 10],
    [21000, 270, 10],
    [20000, 270, 10],
    [19000, 270, 10],
    [18000, 270, 10],
    [17000, 270, 10],
    [16000, 270, 10],
    [15000, 270, 10],
    [14000, 270, 10],
    [13000, 256, 49],
    [12000, 256, 44],
    [11000, 257, 41],
    [10000, 258, 37],
    [9000, 259, 34],
    [8000, 259, 31],
    [7000, 260, 27],
    [6000, 266, 22],
    [5000, 277, 16],
    [4000, 297, 16],
    [3000, 309, 16],
    [2000, 309, 16],
    [1000, 310, 17],
    [0, 308, 10]
];

// Function to process wind profile into usable format
fnc_processWindProfile = {
    params ["_profile"];
    if (isNil "_profile" || {typeName _profile != "ARRAY"} || {count _profile == 0}) exitWith {
        hint format ["Error: wind_profile invalid - Type: %1, Count: %2", typeName _profile, if (isNil "_profile") then {"N/A"} else {count _profile}];
        [];
    };
    private _processed = [];
    {
        private _alt_ft = _x select 0;          // Altitude in feet ASL
        private _dir_from = _x select 1;        // Direction wind is coming from
        private _speed_knots = _x select 2;     // Speed in knots
        private _alt_m = _alt_ft * 0.3048;     // Convert to meters for Arma
        private _dir_to = (_dir_from + 180) % 360;  // Convert "from" to "to"
        private _speed_ms = _speed_knots * 0.514444;  // Convert knots to m/s
        _processed pushBack [_alt_m, _dir_to, _speed_ms];
    } forEach _profile;
    _processed sort true;  // Sort by altitude (ascending)
    hint format ["Processed profile: %1 entries", count _processed];
    _processed
};```
#
fnc_getWindAtAltitudeBlock = {
    params ["_altitude_ft", "_processedProfile"];
    if (isNil "_processedProfile" || {count _processedProfile < 1}) exitWith {
        hint "Error: Processed wind profile is empty";
        [0, 0]
    };
    private _altitude_m = _altitude_ft * 0.3048;  // Convert block altitude to meters
    hint format ["Checking block: %1 ft (%2 m)", _altitude_ft, _altitude_m];
    {
        private _alt_m = _x select 0;       // Altitude in meters
        private _dir_to = _x select 1;      // Direction wind is going to
        private _speed_ms = _x select 2;    // Speed in m/s
        if (_alt_m == _altitude_m) exitWith {
            hint format ["Matched block: %1 m - Speed %2 m/s, Dir %3°", _alt_m, _speed_ms, _dir_to];
            [_speed_ms, _dir_to]  // Return speed and direction directly
        };
    } forEach _processedProfile;
    hint "No exact match, using nearest lower block";
    // Fallback: Find the closest lower block if no exact match
    private _windSpeed = 0;
    private _windDir = 0;
    {
        private _alt_m = _x select 0;       // Altitude in meters
        private _dir_to = _x select 1;      // Direction wind is going to
        private _speed_ms = _x select 2;    // Speed in m/s
        if (_altitude_m >= _alt_m) then {
            _windSpeed = _speed_ms;
            _windDir = _dir_to;
        } else {
            exitWith {};
        };
    } forEach _processedProfile;
    [_windSpeed, _windDir]
};```
#
[] spawn {
    waitUntil {!isNil "leadJumper" && {!isNull leadJumper}};
    hint format ["Wind updater running for 'lead jumper'. wind_profile count: %1", count wind_profile];
    private _processed = wind_profile call fnc_processWindProfile;
    private _lastBlock = -1;  // Track the last 1000-ft block to detect changes
    while {true} do {
        if (alive leadJumper) then {
            private _altitude_m = getPosASL leadJumper select 2;
            private _altitude_ft = _altitude_m / 0.3048;  // Convert meters to feet
            private _currentBlock = floor (_altitude_ft / 1000) * 1000;  // Nearest lower 1000-ft block
            if (_currentBlock != _lastBlock) then {  // Only update if block changes
                private _wind = [_currentBlock, _processed] call fnc_getWindAtAltitudeBlock;
                private _speed = _wind select 0;
                private _direction = _wind select 1;
                private _dirRad = _direction * pi / 180;
                private _windX = _speed * sin(_dirRad);
                private _windY = _speed * cos(_dirRad);
                setWind [_windX, _windY, true];
                hint format ["Wind updated for block %1 ft: Speed %2 m/s, Dir %3°", _currentBlock, _speed, _direction];
                _lastBlock = _currentBlock;
            };
        } else {
            setWind [0, 0, true];
            hint "Lead jumper dead, wind reset. Waiting for respawn.";
            waitUntil {alive leadJumper};
            hint "Lead jumper respawned, wind updates resumed.";
            _lastBlock = -1;  // Reset block to force update on respawn
        };
        sleep 1;  // Check every 1 second
    };
};```
open hollow
#

i mean, from the server, know if a player is in a building

granite sky
#

Should do. sound controllers still exist on the server.

#

hence stuff like selectBestPlaces still works.

open hollow
#

nice

fleet sand
open hollow
frozen seal
hallow mortar
#

All functions can be inspected in the in-game Functions Viewer, available from the Editor Tools menu or from the debug console menu. (Leopard20's Advanced Developer Tools recommended for an improved UI)

frozen seal
#

I've been using eden enhanced functions viewer and could not find it here, I will try the Advanced tools now

frozen seal
#

ohhh I see, I was searching for BIS_fnc and was not getting anything

#

but I'm getting now, thanks!

proven charm
#

yup

frozen seal
#

btw the tools look awesome 🤩

little raptor
eternal spruce
#

Can i make the AI ignore or pretend an object is infront of it

winter rose
#

yes

granite sky
#

no

#

For what purpose? :P

spice siren
eternal spruce
#

Ok, ignore that, I used AI disableCollisionWith and i got the desired result, the question is how do I write a script to disable 10 objects instead of individually write them in one by one in the objects Init

blissful current
#

I read about an effort to increase the performance via CPU multi-threading in Arma 3. Where can I track this feature's progress as it develops?

granite sky
granite sky
eternal spruce
#

They’re all just a Cargo platform to simulate an elevated helipad

granite sky
#

Could use nearestObjects if you don't want to give them all a variable name.

eternal spruce
#

I tried this:

_platform = [plat_1, plat_2, plat_3, ….etc]
{_x [AI disableCollisionWith] } forEach [_platform]