#arma3_scripting

1 messages ยท Page 734 of 1

fervent kettle
#

sadly does not work either

tough abyss
#

Curious

#

So in SP and local MP it works fine but not when hosted on dedi?

fervent kettle
#

Exactly

tough abyss
#

Do you have any other code in your dedi's init to act as a sanity check?

fervent kettle
#

I have 2 view distance lines and an addAction. Before the event handler is an sleep of 3 seconds (heard that the init sometimes loads to quick)

tough abyss
#

How about this

#

Rather than doing your 3 second sleep, do this

waitUntil {!(isNull findDisplay 46)};
fervent kettle
#

Nope

#

this is how my init looks like

setObjectViewDistance [2500, 800]; //Objekte, Schatten
setViewDistance 8000; //allgemeine Sichtweite des Servers

private _currentLeaderRespawn = leader player;
leaderRespawn = _currentLeaderRespawn addAction ["<t color='#662112'>Respawn Erstellen</t>", "_resupply\scripts\createRespawn.sqf", [], 6, false, false, "", "true", 0.2];

waitUntil {!(isNull findDisplay 46)};
doTeleport = (findDisplay 46) displayAddEventHandler ["KeyDown", {if ((_this select 1) == 54) then {_nul = [] execVM '_resupply\scripts\teleport.sqf'}}];
tough abyss
#

Alrighty how about this

#

since all of that code is intended for actual clients, slap a ```sqf
if (isDedicated) exitWith {};

at the top
fervent kettle
#

what should go in there? All the init?

tough abyss
#

Just put that line at the top of your init

#

curious to see if it changes anything

copper raven
#

just use initPlayerLocal.sqf if you intend to run it on clients only

copper raven
#

uhm, what exactly doesn't work here? ๐Ÿค”

tough abyss
#

The KeyDown EH

#

works in SP and local MP but not dedi

fervent kettle
#

so I just have to use smth like onButtonPress?

copper raven
#

do systemChat loadFile "_resupply\scripts\teleport.sqf" or something and see if it prints anything (on dedi as any client)

fervent kettle
#

in the keyDown handler?

copper raven
#

doesn't matter where

#

debug console

fervent kettle
tough abyss
#

just put it in initPlayerLocal if you don't want to deal with getting debug console open

fervent kettle
#

@tough abyss @copper raven Doesn't drop any output.. only on dedi tho

tough abyss
#

And the file's still present clientside?

fervent kettle
#

wdym?

tough abyss
#

Do you as a client still have _resupply\scripts\teleport.sqf

#

when you're testing on dedi

fervent kettle
#

Idk if I have, but as I said, on the client side it did not drop any output

tough abyss
#

So you get output in SP and local MP but not on dedi

#

and you're not changing any files between those tests

#

correct?

fervent kettle
#

Yes

tough abyss
#

Hm

#

What's your server.cfg look like

fervent kettle
#

I don't think I can access that rn

#

I'm not the host

tough abyss
#

But you have access to the server's init?

#

Just to clarify

fervent kettle
#

I can access the files via FileZilla

tough abyss
#

Ok

#

so you've been able to edit the init via that but don't currently have access to the config

#

alright

fervent kettle
#

I didn't edit any serverside files

tough abyss
#

aaaaaand bingo that's your problem

fervent kettle
#

my ears be growing big, tell me

tough abyss
#

I don't know how to put this

#

your local init isn't going to run if the dedi's hosting the mission

#

you need to edit the serverside

#

if the server's in control

#

hence why your stuff's only working in SP and local MP

fervent kettle
#

initServer.sqf?

tough abyss
#

any of them

#

init, initPlayerLocal, initServer, etc.

#

those are all done by the mission host

fervent kettle
#

but my thingy is in init.sqf

tough abyss
#

correct

#

which is defined by the mission host

#

which in dedi's case is the dedi server

fervent kettle
#

Okay

winter rose
#

and mission change == server restart, iirc

fervent kettle
#

so if I put the script locally (initPlayerLoca.sqf) it should work

tough abyss
#

No

#

If you're playing on a dedicated server

#

the dedi provides all of the init files

#

you can't force it to exec your local copy unless you do some strange voodoo with remoteExec which I'd not recommend

#

the solution to your problem is to get access to your dedi's init files and change those

#

then it should work fine

fervent kettle
#

thanks for the help, I'll wait til I get the init and tell you if it worked

tough abyss
#

๐Ÿ‘ hope it goes well

vague geode
#

Basically I wonder whether it is possible to tell AI via a scripting command to e.g. heal someone.

fervent kettle
#

How can I use a variable defined file A, in file B. file A is only executed by one person, but all users should use that variable in file B

tough abyss
#

@vague geode I'm not super experienced with that in specific but I don't think there's much for that

#

@fervent kettle There's lots of ways. The cleanest would probably be to broadcast the value of the variable in file A to all of the people using file B

#

Which you could do via publicVariable

fervent kettle
#

worked, thanks again ๐Ÿ˜„

tough abyss
#

No problem

frank mango
#

Intel creation script, works but only on the player who picks it up.
Anyone able to see whats up?

call{data = [this,"RscAttributeDiaryRecord",["Map of Tria Swampland","This Map of Trias' Swampland shows the Cartels' <marker name='Int1'>Barracks</marker>",""]] call bis_fnc_setServerVariable; }

wet geode
#

Why is this not working? It is a sqf in the mission folder and when I call it it just quickly flashes' back for a frame or two and later uses the blur effect.

[] spawn
    {
        cutText ["", "BLACK FADED", 999];
            0.1 fadeSound 0;
            sleep 3;

                "dynamicBlur" ppEffectEnable true;
                "dynamicBlur" ppEffectAdjust [6];
                "dynamicBlur" ppEffectCommit 0;
                "dynamicBlur" ppEffectAdjust [0.0];
                "dynamicBlur" ppEffectCommit 3;

        cutText ["", "BLACK IN", 7];
            14 fadeSound 1;
            playMusic "AmbientTrack01a_F_EXP";
        sleep 1;
            

            [str ("Delta") ,  str (date select 2) + "." + str (date select 1) + "." + str (date select 0)] spawn BIS_fnc_infoText;
        sleep 11;
            [str ("Time"), str (date select 3) + "." + str (date select 4)] spawn BIS_fnc_infoText;
        sleep 10;
            0=[[["MISSIONAREA, ","align = 'center' size = '0.7' font='PuristaBold'"],["","<br/>"],["MISSIONISLAND","align = 'center' size = '0.7'","#aaaaaa"]]] spawn BIS_fnc_typeText2;
    };
wet geode
#

It is suppose to be a black screen with text appear and then fade to the game with a short amount of blur

frank mango
#

on mission start?

wet geode
#

No during the mission on a trigger

#

that calls the sqf

tough abyss
wet geode
frank mango
#

I'm outta depth here. I only use this when starting a mission in the init.sqf

Tried increasing the fade times? 3 - 5?
and the sleep time?

wet geode
#

999 didn't make a difference

frank mango
#

no clue anymore

wet geode
#

anyone else?

hallow mortar
#

fadeColor: String - (Optional, default "BLACK") case-sensitive can be "BLACK" or "WHITE"

wet geode
#

Did not fix it

dapper cairn
#

So im trying to destroy the Bridge in Harcourt on Tanoa but it cant be destroyed via explosives and essentially has to be deleted/removed from the mission when they go off and the only way I can see of doing this is the Edit Terrain Objects under the Environment but I dont know if I can change the presence of it from false to true.

This is the script I'm using for the explosives and was wondering if I could add a way to remove the bridge onto the end of it or something

this addAction ["Destroy Charges",{{ _x setDamage 1; } forEach [charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9,charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,charge21,charge22,charge23,charge24,charge25,charge26,charge27,charge28,charge29,charge30,charge31,charge32]}];

winter rose
dapper cairn
#

yeah im going to change that in a moment

hallow mortar
#

You can combine hideObjectGlobal (remoteExec'd to the server) and nearestTerrainObjects

dapper cairn
#

right now its still in testing phase

hallow mortar
#

Approximately:

{
  [_x,true] remoteExec ["hideObjectGlobal",2];
} forEach nearestTerrainObjects [_position_or_object,["TRACK"],300];

Note: "TRACK" could alternatively be "MAIN ROAD" or "ROAD" or any other type listed here https://community.bistudio.com/wiki/nearestTerrainObjects - try them until you get the right one

#

(and choose the position and radius carefully so you don't accident any of the nearby roads)

dapper cairn
#

okay thank you

hallow mortar
#

If you can figure out the model name (e.g. by using nearestTerrainObjects in the debug console) you might be able to create a "destroyed" bridge using simple objects of the bridge sections. Bit high-effort though

little raptor
dapper cairn
#

this addAction ["Destroy Charges",{{ _x setDamage 1; } forEach [charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9,charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,charge21,charge22,charge23,charge24,charge25,charge26,charge27,charge28,charge29,charge30,charge31,charge32]}];

Is there any reason why this works on testing in the editor but not in the mission on the server

little raptor
#

you mean the action is not shown?

dapper cairn
#

it shows but does not actually do anything

#

it doesnt set off the charges

little raptor
#

what are those charges?

dapper cairn
#

satchels named 1-32

little raptor
#

I know. I mean how did you create them and where?

dapper cairn
#

placed and named in the editor on/around the bridge I want to use them on

little raptor
#

well setDamage takes global args, so the reason it doesn't work with those seems to suggest it needs local args for ammo thonk
you can try this:

for "_i" from 1 to 32 do {
  _charge = missionNamespace getVariable ["charge" + str _i, objNull];
  if (!alive _charge) then {continue};
  [_charge, 1] remoteExec ["setDamage", _charge]; 
}
#

I got rid of your forEach (you had some nerve to write all that meowsweats )

vivid estuary
#

What would cause a script to not execute at all with no shown errors or .trp reports?

#

I feel like I'm missing something stupid simple or I'm executing it wrong

little raptor
#

or wrapping it in {} and not executing the scope

vivid estuary
#

this is what im using.

its a crew check script for whitelisting slots to use vehicles on a Dedi Server

https://www.sqfbin.com/adaximadosokawulular

ive tried using execVM in both init and Serverinit, ive also tried just putting it in both inits ive also treid using EH to fire it and it just doesnt fire.

#

im still new to all this scripting as i used to only do design so im probably missing something stupid simple

little raptor
hallow mortar
#

Well it won't do anything on the server since {player == player} will never be true on a DS

little raptor
#

the colors aren't just for show

vivid estuary
hallow mortar
#

It doesn't really need to run on the server so there's no need to fix it, just put it in initPlayerLocal or wrap it in if !(isServer) then { ... }; and it won't matter

#

you can also use a getInMan event handler instead of that horrifying while {true} do { waitUntil ... }

vivid estuary
#

Thanks for that

brazen lagoon
#

Any suggestions for debugging network spam? I tried running my mission yesterday and we ran into an issue where #monitor showed something like 3000 guaranteed messages being sent every second. This seems extremely high, how would you suggest going about figuring out what can get trimmed down?

brazen lagoon
#

I think it's something related to this function I run to have cash rewards. Any ideas on what might be a performance problem here?

bitter jewel
#

how do i use params to assert that first argument is an array

#

params [ ["_array", [], [[]] ] ]; ?

little raptor
#

yes

bitter jewel
#

thanks

bitter jewel
#

does waitUntil not inherit its scope?

#

my private variables defined in the parent scope seem to be undefined in the waitUntil block

little raptor
bitter jewel
#

ah i was using waitUntil in a context i mistook as spawned

fiery gull
#

is it possible to make a weapon show up on the UI after adding it to a vehicle with addWeapon(Turret)?

little raptor
#

what UI?

fiery gull
#

sorry lemme get a screenshot

#

add this to a vehicle that doesn't normally have weapons

fiery gull
#

I know it is possible by changing unitInfoType to "RscUnitInfoTank" in the vehiclecfg but I was wondering if there is any way that doesn't require an addon

wind cairn
#

hint str _boxSpawned;```

anyone know why createVehicle isnt returning the object?
little raptor
wind cairn
#

the object spawns, but when i hint the name nothing shows

little raptor
#

I mean between the two statements

wind cairn
#

yeha

little raptor
#
hint str _boxSpawned;
hint "bla"
little raptor
#

no

wind cairn
#

yeah it isnt hinting anything

warm hedge
#

What isn't? Your current code?

wind cairn
#

well no hint is showing up

warm hedge
#

How did you do? What you've put into the code?

wind cairn
#

hint "test"

warm hedge
#

And how?

wind cairn
#

?

warm hedge
#

init or whatever

wind cairn
#

initServer.sqf

#

but its a functionn call

#

initserver.sqf > function

#

is it hinting on the server?

little raptor
#

hints are not shown at init

#

because there's no display

#

also if you're not the server you won't see the hint either

#

hints are shown locally

wind cairn
#

system chat is though

warm hedge
#

But hint isn't

wind cairn
#

system caht doesnt either

#

systemChat str _boxSpawned; does not show anything either

warm hedge
#

What Leopard said. Did you put a bit of delay?

#

Or, tried on like Debug Console?

wind cairn
#

i've addd a delay, ill also try in console

#

delay doesn't work and its on a dedi so i cant access the consol

warm hedge
#

smh that's why

#

It just doesn't run on your game

wind cairn
#

ok, It still isn't returning the object because trying to add an action to the spawned object doesn't work

little raptor
wind cairn
#

yeah my bad i realise now how stupid that was

little raptor
#

or use diag_log

warm hedge
#

Or don't try to make and debug mission on dedi

grave thistle
#

I guess nothing along these lines is possible in SQF (?)

arr = [[1,2],[1,2]];
{_x = _x#0 + _x#1} forEach arr;
arr  // --> [[1,2],[1,2]], not [3,3];

...and if I wanted to do something like it, I'd have to instead create a new array, for example, and use pushBack to add the result to that one instead

// Tested this and it seems to work as intended
arr = [[1,2],[1,2]];
arr2 = [];
{arr2 pushBack (_x#0 + _x#1)} forEach arr;
arr2  // --> [3,3];
tough abyss
#

@grave thistle you could, just use arr set [_forEachIndex, _x#0 + _x#1];

grave thistle
#

Thanks! I'll look into this

tough abyss
#

In a forEach of course

#

@grave thistle though really the simplest would be

arr = arr apply {_x#0 + _x#1};
#

If you're OK with losing the forEach

grave thistle
#

This would work too. I'm just trying to figure out the simplest & tidiest ways to do this kind of array manipulation, and apply and set seem to be the keys to most of it.

proven charm
#

when you pass array via remoteExecCall to client or server is the array passed as reference even in multiplayer/dedi game? I think this is probably a stupid question but had to ask anyway ๐Ÿ™‚

#

when testing this in editor the array passed to remoteExecCall is passed by reference

little raptor
#

ofc not

proven charm
#

I mean passed to the function/code remoteExecCall calls

#

ok

little raptor
#

how did you test it exactly?

proven charm
#

so its just different behaviour while testing in editor

#

like this: ```
_posTest = [123,777,0];

testFn =
{
params ["_tp"];

_tp set [2,888];

systemchat format ["--> %1 ", _tp];
};

[_posTest] remoteExecCall ["testFn", 2];

systemchat format ["> %1 ", _posTest];

little raptor
#

in this case no network transfer occurs. it just executes locally

proven charm
#

yea hence the array is passed by reference

little raptor
#

well it's no different than doing call testFn

#

so yeah

proven charm
#

ok

#

its good to know otherwise would get weird results while testing

#

modifying the original array...

little raptor
#

you will once you test it on other clients

proven charm
#

which is not what I want

little raptor
#

so why do you put remoteExec then?

proven charm
#

for MP

little raptor
#

wat?

#

which is not what I want
if it's not what you want you don't want remoteExec either

proven charm
#

I need remoteExec to call client function (and pass the array) but I dont want it to modify the original array

#

the original array server has

#

I can use the + copy to make sure the behavior is same in editor/dedi

#
[+_posTest] remoteExecCall ["testFn", 0];
#

so that the original array wont be modified

cyan dust
#

Good day. What can break 'LOITER' waypoint behaviour? ๐Ÿค” And how can I fix it?
It works good if there are no enemies nearby, but if there are, it never works and helicopters are just hanging in the air in one place instead of loitering.

little raptor
#

set them on careless

cyan dust
#

Could try that on pilot only, but since they are also a group leader at the same time, won't it break combat behaviour?

little raptor
cyan dust
little raptor
#

shouldn't matter much in your case

cyan dust
#

Ok. Thank you

bitter jewel
#

which heli are you using

#

i am no expert on arma ai but i am pretty sure you are witnessing them breaking out of loiter to engage the enemies and they do one strafe and the ai thinks it is finished since it has no more waypoints

#

i have managed to convince myself that you cannot make them loiter and shoot enemies at the same time since the ai is just programmed to forget their loiter waypoint when they start to engage enemies

#

except for some reason

#

the cups independent heli CH-146 Griffon (armed) will happily do a loiter while also mowing down enemy infantry

#

dont know why but if i change that to some other heli they will either just loiter and not engage at all, or they will break loiter and do strafes

#

i do have this in the heli init

#
this spawn { 
  while { alive _this } do { 
    { 
      if (_this distance2d _x < 300) then { 
        _this reveal [_x, 4]; 
      }; 
    } forEach (units independent); 
    sleep 3;    
  }; 
}; 
#

in this case the heli happens to actually be under opfor control

#

and it is loitering independent units

#

and going brrrt

#

the minigun has 2000 rounds loaded and it burns them very quickly

final sun
#

Good evening, I seem to have an array error (by the looks of it). I've made a function which accesses the values of a 2D array (objects and a number), I have a simple if statement cover the rest of the code inside the function, if the object exists then do this. what happens is, I make friendly units kill the array units (4 enemy units in total). when the functions fires a 5th time it throws "Error Zero divisor". My question is, why? it can't follow through with the rest of the function , why throw an error? . What I am not seeing?
https://sqfbin.com/umonuvefulajibigatux
Function: lines 16-48.
called: 70,93

pliant stream
#

That try-catch can't catch out of range errors

final sun
pliant stream
#

Yeah, use if

final sun
# pliant stream Yeah, use `if`

If I use an If statement, it still throws the error as technically it tries to access an element that does not exist

 if(!isNil {Threats select _arrayIndex})then
  //do stuff
pliant stream
#

yeah so check if _arrayIndex is out of bounds

last coral
#

hey guys, i hope i ended up in the right place for my problem. So in Arma3 i am using MGI Modules Spawn attack waves and there you can put in a condition to trigger the module. I use either triggerActivated trg1; or EAST countSide allGroups < 3. Each on their own works as intended. i can't get it to work having both of them. Any syntax tipps are greatly appreciated.

bitter jewel
#

(triggerActivated trg1) or (east countSide allGroups < 3)

last coral
#

thx for the quick answer. It works, however i kinda want them both to be mandatory to trigger the attack spawn. Now it's either the trigger or the countSide. Would be nice if both of them would be necessary

upper siren
#

try changing or to and

last coral
#

will do

#

thank you

open star
#

Seen the trailer for the Enfusion Engine for Bohemia?

#

Thoughts on how that's gonna work out for scripting in Arma 4, ya'll think it'll be better?

winter rose
bitter jewel
#

it has if-else xd

pliant stream
#

Overriding the index operator can be achieved through the Set and Get methods
who designed this crap

#

doesn't look great, but better than sqf i guess. not that that's a very high bar

visual brook
#

hey fellas. is there a way to stop a playsound3d after it starts?

copper raven
visual brook
#

Yeah im trying that now

#

Yeah say3d sadly doesnt work

#

or im just being bad at it

copper raven
#

did you configure cfgSounds properly?

#

note that it doesn't take path unlike playsound3d

visual brook
#

Do you have an example of what it should like?

#

i found one all good

#

@copper raven sorry to bother you. Is there a way to then stop a say3d when it starts?

copper raven
#

check the wiki

visual brook
#

sadly not

hollow thistle
torpid mica
#
_trgBomber setVariable ["_AssassineLeader", _AssassineLeader , true];
_trgBomber setTriggerStatements ["!alive AssassineLeader","

I have a problem with this Piece of code.... When I want to use a lokal Variable in the Trigger Condition it wont work (even if variable is set to this spesific trigger. It works as intended with global Variable but i need it to work with a lokal one. Can somebody tell me whats wrong?

torpid mica
open fractal
#
_trgBomber setTriggerStatements [format ["!alive %1", _AssassineLeader],
#

I'm no expert but that's the avenue I would take

copper raven
open fractal
#

the trigger just recognizes the variable doesnt it

#

so format isnt necessary

visual brook
#

but thank you for your input

copper raven
visual brook
#

(radio)

#

as in

#

a music radio

torpid mica
peak pond
#

Which Position format does createUnit interpret its Position argument as? ASL/AGL/AGLS/ATL/ASLW? I'm guessing AGLS but not sure.

peak pond
#

It's not documented there

#

It just says it receives a Position argument but doesn't specify what format.

winter rose
#

it might be AGL

#

it's usually that with old commands, but to be confirmed

peak pond
#

Ok, thanks, I'll try to confirm. Working on a garrison script...

winter rose
flat eagle
#

can you use setpos on ModuleSpawnAIPoint_F?

winter rose
#

!quote 5

lyric schoonerBOT
flat eagle
#

so what should i use, please enlighten me

winter rose
#

you have plenty of variants, setPosATL, setPosASL, setPosWorld ๐Ÿ™‚

flat eagle
#

fair enough, ill give them a try

winter rose
#

it might not work (but it also may ๐Ÿ˜ฌ let's see)

limber panther
#

hello, i got stuck with a simple script, can somebody help me out please? i'm trying to add action to a static object (e.g. noticeboard) that is going to spawn a vehicle at a given location on the map (can be determined by coordinates, or invisible helipad or generally anything, the location is not going to move around)

this addAction [hatchback, {createVehicle [C_Hatchback_01_F, [9160,8288]]}]
``` thank you
distant oyster
limber panther
#

by the way since we're in it, is there a way to give the spawned vehicle a script into its init?

distant oyster
#

you can use the first syntax and then use that variable to do whatever you want with it

#

createVehicle returns the created vehicle

limber panther
#

here's an example, i would like to spawn a vehicle using this: sqf this addAction ["hatchback", {createVehicle ["C_Hatchback_01_F", [9160,8288]]}] and that vehicle should have this: ```sqf
this addaction["Last 112 call",{ [caller_position] spawn gps_fnc_main; }];
this addaction["Last 911 call",{ [caller_position2] spawn gps_fnc_main; }];

distant oyster
limber panther
#

why is there the "private" word? what does it do?

distant oyster
#

it will only make that variable visible to the current scope. it's not really necessary in this case but it's good practice

limber panther
#

allright so basically no other scripts on the server will use it

#

anyways, thank you very much @distant oyster you helped me and taught me something new ๐Ÿ™‚

winter rose
distant oyster
# limber panther allright so basically no other scripts on the server will use it

so the variable doesn't get overwritten by another script or overwrites a variable with the same variable name, eg:

_var = 123;
[] call {_var = 456};
if (_var == 123) then {/* Do very important stuff*/};

now imagine {_var = 456} is a function that you don't know the code of but the author forgot the private statement. your code will not work and you don't know why.

limber panther
#

oh by the way merry christmas @distant oyster ๐Ÿ™‚

#

and you too @winter rose ๐Ÿ˜‰

winter rose
#

wait what

#

why thank you, and the best celebrations to you ๐Ÿ‘

distant oyster
#

bit early but w/e

last coral
#

is it possible to spawn pre-placed units when a trigger is activated?

#

and not directly from the get go

limber panther
last coral
#

that sounds like a great approach

#

how would i go about it?

limber panther
#

if you right click the unit go to atributes and find "show model" or something like that, i've got the game in different language

peak pond
#

The "Show / Hide" module works in MP as well for this type of thing, no script needed. While hidden, units are not simulated and performance is saved.

limber panther
#

uncheck it to make the unit disappear and then use the trigger and the script to make it visible again

#

@last coral in trigger on activation: ```sqf
soldier hideObjectGlobal false

little raptor
little raptor
#

keep that in mind

last coral
#

so they are cpu heavy as if they would be there?

limber panther
little raptor
#

if you also disable their simulation hopefully that'll solve the problem

limber panther
limber panther
#

by the way hello @little raptor ๐Ÿ™‚ merry christmas also to you

little raptor
little raptor
limber panther
#

thank you

little raptor
#

it's a bit early tho ๐Ÿ˜›

limber panther
little raptor
#

I was just kidding meowsweats

limber panther
#

ah ok ๐Ÿ˜… you got me

#

when i get back to the previous script for a while ```sqf
this addAction ["hatchback", {
private _vehicle = createVehicle ["C_Hatchback_01_F", [9160,8288]]}];
_vehicle addaction["Last 112 call",{ [caller_position] spawn gps_fnc_main; }];
_vehicle addaction["Last 911 call",{ [caller_position2] spawn gps_fnc_main; }];

little raptor
winter rose
#

indentationnn

limber panther
winter rose
#
this addAction ["Create hatchback", {
  private _vehicle = createVehicle ["C_Hatchback_01_F", [9160,8288]];
  _vehicle addAction ["Last 112 call", {
    [caller_position] spawn gps_fnc_main;
  }];
  _vehicle addAction ["Last 911 call", {
    [caller_position2] spawn gps_fnc_main;
  }];
}];
limber panther
distant oyster
limber panther
# distant oyster that's on me. I edited the code seconds after I posted it

it's fine, no problem, i just created necessary script (359lines) and placed it into our server ... and it doesn't work so right now i'm wondering, whether the script is incorrect, or if i perhaps inserted wrong coordinates so the car actually got spawned, but really far away where i can't see it so i'm thinking how to figure it out right now ๐Ÿ˜…

#

yeah i got it, wrong coordinates ... got to rewrite the entire script ๐Ÿคฆโ€โ™‚๏ธ whatever

winter rose
#

argh, findIf doesn't work with hashmaps

formal sentinel
winter rose
formal sentinel
#

sorry. There are too many files... is it impossible with a link?

#
_script = [] execVM "script.sqf";
sleep 5;
terminate _script;```
I tried like this, but to no avail.
winter rose
#

given how it is designed, it seems like an old code
read the documentation or contact the author, that's your best chance

formal sentinel
#

I just wanted to know how to exit the script. Is there no way to terminate unless it is modified?

winter rose
#

nobody knows without reading the whole thing

little raptor
#

you're just terminating your own script

#

it appears this is the variable that controls the snow: al_snowstorm_om

#

so simply try:

sleep 5;
al_snowstorm_om = false;
formal sentinel
little raptor
#

lol wtf?!

al_snowstorm_om=true; publicvariable "al_snowstorm_om"; sleep _duration_storm; al_snowstorm_om=false; publicvariable "al_snowstorm_om"
#

why?! meowsweats

winter rose
#

server-side script?
newbie?
both?

little raptor
#

if it can be disabled, it most likely has a global boolean var that controls the snow

#

but in any case, that's a terribly written script

#

better just forget about it

formal sentinel
little raptor
formal sentinel
#

sleep 5;
this?

little raptor
#

yes

formal sentinel
#

I just ran this.
al_snowstorm_om = false;

#

I ran it globally.

hushed tendon
#

Can you set mod settings using a file? Whether it was through description.ext or some on start eh

bitter jewel
#

if the mod supports cba then yes

hushed tendon
little raptor
hushed tendon
#

oh

little raptor
#

I think if you hover your mouse over them you can see the variable name as well

bitter jewel
#

cba lets you import and export all your cba settings

#

so at least you can copy and paste in and out different versions of ypur settings

hushed tendon
#

I'm dumb. Never realized those were variables for some reason

bitter jewel
#

there is also a cba_settings.sqf but i remember that you need to place some extra pbo from the cba mod dir somewhere

#

that would exactly then be a file you can move around and edit outside arma

peak pond
# winter rose if you get a good info (test with water, water + waves, terrain, building surfac...

After some light testing inside and on top of a building, inside and on top of a dirt pile object, and inside and above a shallow pond, it seems that createUnit accepts an AGL position. For the pond, the observed Z placement was relative to water surface not terrain, hence AGL not ATL. For building and dirt pile, observed Z placement was relative to terrain not object, hence AGL not AGLS.

winter rose
little raptor
#

AGL is the default position format

pliant stream
#

so dumb. world should have been default

tough abyss
#

I don't know why every non- specialized command doesn't just take and return world pos

#

Would make things much more straightforward and avoid all the stupid conversion bugs

indigo storm
#

how to install Arma

pliant stream
#

click install in steam

tough abyss
#

Also why the hell is there no nice universally applicable bug-free command for smoothly rotating vectors, literally had to make an sqf quaternion library for this shit

pliant stream
#

apparently quaternions are too complicated ๐Ÿ™„

tough abyss
#

Even though I'd expect the engine uses them internally

#

Or I hope it does

pliant stream
#

well it might use them for some things

#

animation blending, that sort of thing

tough abyss
#

Right but imo it should be pretty much standard for object manipulation

#

As it is in most engines

versed widget
#

does typeof command works with currentweapon or vehicle only ?

winter rose
tidal ferry
#

Hey, what';s the command to grab the offset between two posAGLs?

#

I need to offset positionAGL -> positionAGL, rather than object -> positionAGL, so getRelPos and other commands won't work for me

tidal ferry
#

Will try it

#

Oh God, vectors meowsweats

little raptor
winter rose
#

so let's change that ๐Ÿ˜„

#

that is how it was already

#

although, wait

#

it says "positionATL" but for boats, not for e.g humans

#

so what happens if you create a car over water
etc

limber panther
#

Hello!
On the steam workshop, there is this mod for traffic lights
https://steamcommunity.com/sharedfiles/filedetails/?id=2444073983
that has one little problem. The red light does not emit light. So it pretty much all works but red light is nearly invisible and can not be seen at night at all. My attempts to contact the mod creator were unsuccessful so i came here. In theory i can attach a source of red light right over the red light on the pole. By using hide object global i can try to make it appear and disappear, but my question is - is there a way to relate any script to the phase of the traffic lights?

little raptor
#

My guess is that it uses animateSource

#

If you don't want to "embed" your code just run an external loop

limber panther
# little raptor My guess is that it uses animateSource

judging by observation, i think, that the traffic light is just an object that does nothing, the effect of individual colours being lit is done using independent coloured circles and light sources that are attached to it and appear in in front of the desired light

little raptor
#

Ok. Then it's a lot t simpler

limber panther
#

well it's just my guess based on what i see in game

little raptor
#

There's no need to guess. Just look at the script meowsweats

limber panther
#

unfortunately there are no settings whatsoever, basically i place the object in the editor and it does the job, nothing to set up so there's also nothing to catch up with

limber panther
#

...i feel like there's a bunch of useless things in the mod folder that are not used in any way

winter rose
#

@edgy larkno crossposting thank you

limber panther
#

the .rar is not supposed to be there at all right?

little raptor
#

No meowsweats

limber panther
#

not my fault by the way, i didn't do this ๐Ÿ˜…

#

anyways thank you @little raptor i think i can handle it from this point, thanks for the help

peak pond
# winter rose so what happens if you create a car over water etc

Good question. I didnโ€™t have time for a proper test. Tested on GOS Gunkizli. No ocean on that map, but it has marshes at sea level, similar to Limni on Altis. So, not sure if thatโ€™s a lot of pond objects or if it counts as (shallow) ocean ๐Ÿค” , but creatUnitโ€™ing infantry at 0 height placed them at the water surface, not the terrain underneath. ยฏ_(ใƒ„)_/ยฏ

tribal sphinx
#

Hello everyone, I'm looking for a simple (I'm not a programmer) and quick way to transform an object, vehicle, tent, house, etc. into a medical facility capable of automatically treating who enters or who is transported inside as injured. Using the ACE system.
Thank you all for your cooperation and happy holidays.

fleet stirrup
# tribal sphinx Hello everyone, I'm looking for a simple (I'm not a programmer) and quick way to...

Hey, I haven't heard of anything that exists like that, but if you have or know someone with a small amount of experience programming it should be possible. ACE has a couple of functions to do with medical, ace_medical_treatment_fnc_fullHeal and ACE_medical_ai_fnc_healingLogic that may be of use to you, to heal people using ace medical. They are not documented as public so use at your own risk though!

tough abyss
#

@tribal sphinx so you just want to make it so that whatever object you choose heals nearby players or you actually want to have it turn into an actual medical facility building?

tribal sphinx
tough abyss
#

@tribal sphinx so how do you want it implemented?

#

Just heal nearby players automatically? An action?

tribal sphinx
tough abyss
#

Well then it's going to need to work differently depending on whether it's a vehicle or not

#

That okay?

tribal sphinx
graceful kelp
#

Is there a way after using setweaponzeroing to script the system back to auto ranging

torpid mica
#

just a quick question:```sqf
_waitTime = time + 10;
waitUntil {time > _waitTime};

Is it possible to get this to work in an trigger within the on activation code? need a Delay but donยดt want to use spawn because i would have to pass many variables
vapid drift
#

In 3denEnhanced, you can set the ambient animations of a unit... I'm not able to get all of them to work with BIS_fnc_ambientAnim. Am I missing something?

torpid mica
winter rose
torpid mica
fervent kettle
#

@tough abyss how should the ini on the server be called an located?

hushed tendon
#

So I've got this hint displaying a unit's traits but is there a way to make the values in the hint be a different color? Like instead of it being the gray as the rest of the message if it is true it's color is green and red for false.

_isMedic = _unit getUnitTrait "medic";
_isEngineer = _unit getUnitTrait "engineer";
_isExplosive = _unit getUnitTrait "explosiveSpecialist";
_isHacker = _unit getUnitTrait "UAVHacker";

private _text = parseText format ["
<t color='#FFA32B' size='3' font='PuristaBold'>Unit Traits</t><br/>
<t color='#807E78' size='1.5' font='PuristaBold'>Medic : %1</t><br/>
<t color='#807E78' size='1.5' font='PuristaBold'>Engineer : %2</t><br/>
<t color='#807E78' size='1.5' font='PuristaBold'>Explosive : %3</t><br/>
<t color='#807E78' size='1.5' font='PuristaBold'>Hacker : %4</t>
",_isMedic,_isEngineer,_isExplosive,_isHacker];
        
[_text] remoteExec ["hintSilent", _unit];
vale lintel
#

Would it be possible for units to be spawned upon certain units entering a trigger? And if so could you make them delayed?

distant oyster
distant oyster
tough abyss
#

You pretty much have to shoot it in the face with a arty 5 times to kill it lol

#

@tough abyss you can change the armor values in its config

#

Thanks for the reply, @tough abyss

Do you have an example or walkthrough on this?

#

When I try to look at things the pbo, it all looks like gibberish

#

It's probably binarized then

#

You'll need to unbinarize the config.bin and change the armor values

#

Now this is a mod, does that need to be defined somehow in the mission.pbo, so it pushes out to players connecting?

#

You would just need to distribute your edited version of the mod to your clients

#

Like create my own mod and key

#

Alternatively if you don't want to basically repack someone else's mod

#

You could make your own mod that creates a vehicle that inherits from that tank and just overwrite the armor values

#

Then distribute that mod to your clients and use the new tank

#

ok, so as a first step, whats the best way to fix the .bin file

#

I know I had to do it once in the editor with my mission file

#

just untick the binary when saving, but not sure how to do that with a tank config

#

You won't need to if you go with option 2

#

Which I recommend

#

I think thats a good idea, making my own mod

#

But I still can't edit anything if its all gibberish

#

It's fine because you're not editing directly

#

Just inheriting from the existing tank class and overriding values

#

So you can experiment with new armor values and see what you like

#

Just look at the cfgVehicles documentation

#

So pretty new to this kind of stuff, is there anything you could suggest that I read or look at for more information?

#

The cfgVehicles documentation will get you started

#

As this is more of a config area

#

ok, thank you

hushed tendon
#

Anyone know why this might not work? For the object I have this in its init

_this execVM "filepath";

and this is the file I'm trying to run on a dedicated server
https://pastebin.com/9MbE8c5F

#

For the most part the file is just a lot of functions that run off each other and at the end it calls the function to start the code

flat eagle
#

just use execVM "filepath";

acoustic abyss
#

It would save a lot of coffee if I didn't have to manually work my way through the campaign missions to find the one where the game explains how CAS works ๐Ÿ˜†

snow pumice
little raptor
little raptor
#

publicVariable is extinct now

acoustic abyss
#

Aye, it explains that they are defined in config files. So, do I really have to comb through every "configFile, campaignConfigFile and missionConfigFile" of the A3 pbos ?

#

There's no other way to search for them?

little raptor
#

Wat?

#

You define it yourself

acoustic abyss
#

Oh, just to clarify: I want to re-use an existing advanced hint of the game.

little raptor
#

You just open the config viewer

acoustic abyss
#

Namely, the one that explains how to call Close Air Support.

little raptor
#

Find it in config viewer then

snow pumice
# little raptor Just use `setVariable`

problem is that the var i wanted to change is not set with setvar, its an not private var like weaponLevel
i used a script and remotexec but soon will get rid of vars like this

acoustic abyss
#

I am not extremely experienced with the ConfigViewer. I've used it to find attributes of certain things (eg: does the classname* have hiddenselections?). As I understand it (?), there's no search function. So, I would indeed have to search every config of the campaigns and missions to find my cfgHint, or not?

little raptor
#

Just find the name that is closest to what you want

little raptor
acoustic abyss
#

Oh, great, there are mods for that? Because, I wouldn't know how the game references a specific cfgHint directly.

#

Do you have a name of a mod for me, please?

little raptor
#

Advanced Developer Tools

acoustic abyss
#

Thank you!

little raptor
#

@acoustic abyss there's one here. not sure if this is what you want:

configFile >> "CfgHints" >> "Tactics" >> "Supports"
acoustic abyss
#

Thank you so much for this. Let me check it out.

#

That's almost the one. Could be wrong, but thought there was another hint about how to laser designate targets. But I now understand the structure. Appreciate the handholding ๐Ÿ‘ถ

little raptor
#

@acoustic abyss here's an example:

configFile >> "CfgHints" >> "Weapons" >> "Designator"
#
description = "Laser designator is used for aiming guided missiles, bombs and artillery.%1<t></t>1. Select %3Laser Designator%4 by pressing %16.%1<t></t>2. Use its optics by pressing %17.%1<t></t>3. Zoom using %12<t></t>, %13.%1<t></t>4. Switch view modes with %14.%1<t></t>5. And finally, press %15 to mark the target."
acoustic abyss
#

Ok. So I have two BI advanced hints config references and a short one of my own, that explain a new player how to CAS with a laser designator:
i) config reference >> "Supports"
ii) a short line hint "Press "B" to equip your laser designator"
iii) config reference >> "Designator:
I'm stuck on finding an appropriate condition for the second hint. It should activate/trigger once players have completed calling CAS via the radio menu. I couldn't find an appropriate action to reference.. do I need to check what the player has done via User Interface Event Handlers ?

past wagon
#

Alright, so I have a plane, and I want it to fly in a (almost) perfectly straight line from point A to point B at a constant velocity. I have already tried waypoints, and the plane always zig zags back and forth a bit and does not travel nearly as perfectly as I need it to. I have tried setting the plane's direction and velocity, and that really doesn't seem to make the plane fly naturally any way I set it. Does anyone know any methods I should try?

little raptor
past wagon
#

yeah a few days I started to try setVectorTransformation but it seems really complicated and not the best way to do what I need

#

I want to write the script myself and fully understand all of it, and I'd rather work with something I'm familiar with now unless setVectorTransformation is easy enough to figure out, but it doesn't seem so.

little raptor
#

if you want a "perfectly straight line" with proper networks sync that's the best way

past wagon
#

what do you mean "sync"?

little raptor
#

I mean object moving properly and not jittering

past wagon
#

ohh

#

yeah no I see what youre saying

#

okay

#

I had trouble figuring out the params last time tho

little raptor
#

and I already showed you a premade script

past wagon
#

I will look at that again

#

The problem is I dont know the starting velocity of the object

#

I put it in a random position and want it to travel in a straight line from there

little raptor
#

that's up to you

#

you can set whatever speed you want

little raptor
past wagon
#

I want it to travel at a constant speed the entire time but I dont direction of the vector

past wagon
#

okay, how do I get it then?

little raptor
#

_velo = _dir vectorMultiply _speed;

past wagon
#

oh

little raptor
#

if you just use that script you don't need anything at all

past wagon
#

oh that makes sense

#

I just didnt know how the vector system worked

#

yeah that makes sense thanks I'll use that

past wagon
little raptor
#

read the script

past wagon
#

well

#

oh vectorFromTo ok

#

and since it is a uniform flight path, I should just initialize all these variables outside of the EH, right?

past wagon
#

okay I think I have everything

#

except the interval, that's what I'm confused about

little raptor
#

interval is just percent of progress

past wagon
#

This is what you put, but I'm not exactly sure how it works.

_interval = _speed * diag_deltaTime / _dist;
#

yeah

past wagon
little raptor
#

you get it using math meowsweats

past wagon
#

yeah

little raptor
#

you say "I want the plane to be here at this point in time"

past wagon
#

but why is it speed * duration of last frame / distance?

little raptor
#

_speed * _duration = how much it should move (displacement)

past wagon
#

๐Ÿค”

#

ok yeah

#

v = d/t

little raptor
#

p1 is not constant

past wagon
#

oh

little raptor
#

it's the current position of the plane

past wagon
#

cuz its inside the EH

#

okay

#

so youre kind of cheating to make it easier

little raptor
#

that's not the point

little raptor
past wagon
#

not really lol

little raptor
#

the way I've written it allows you to change destination

past wagon
#

yeah

little raptor
#

not easier

#

you think it's easier

past wagon
#

oh really

#

well otherwise you'd have to subtract the previous frames

#

or something like that

little raptor
#

this is the easier way (p1 and p2 constant):

_interval = (time - startTime) / duration;
past wagon
#

yeah

#

so i guess I might as well do that

#

but if this is multiplayer, wouldnt time be weird? gotta check that

little raptor
#

but that's another reason why I don't use time

#

time is a float

#

as it grows bigger, accuracy drops

past wagon
#

yeah

little raptor
#

you can instead create your own timer

past wagon
#

so if I initialize the object's position inside the EH then I won't need to use time tho, right?

little raptor
#

but again it accumulates errors as you increment it

past wagon
#

yeah I don't wanna have to worry about that

little raptor
#

you set it outside the EH

past wagon
#

oh

#

so just GET the object's position inside the EH

#

right?

little raptor
#

that's up to you

#

ยฏ_(ใƒ„)_/ยฏ

past wagon
#

This is what I mean```sqf
addMissionEventHandler["EachFrame", {
{
_obj = _x;
_p1 = getPosWorld _obj;

#

so it gets re-initialized on each frame

little raptor
past wagon
#

yeah

#

yeah thats what im gonna use

#

that works best

past wagon
#

ok

#

thanks

#

and what will happen once the plane has passed it's ending position?

little raptor
#

it's no longer affected by the loop

past wagon
#

so the event handler will stop being fired?

little raptor
#

no. only the object is removed from the loop

past wagon
#

ohh

little raptor
#

at least in my code

past wagon
#

yeah

#

what if I don't include that in mine?

little raptor
#

if you only have 1 plane and only want to do it once just use a global variable and ditch the forEach

#

and remove the EH once done

#

use this as the termination condition (that one's incorrect because it doesn't take into account the FPS and speed):

_dir = _p1 vectorFromTo _p2;
_velo = _dir vectorMultiply _speed;
if ((_p2 vectorDiff (_p1 vectorAdd (_velo vectorMultiply diag_deltaTime * accTime))) vectorCos _dir <= 0) then {
      movingObjs = movingObjs - [_x];
      continue;
};
past wagon
little raptor
#

sorta

#

it checks if the plane would turn

past wagon
#

oh

#

okay cool

little raptor
#

although come to think of it it's better to use a constant dir vector

past wagon
#

what if you just took the plane dir and the plane pos and checked if the coords of the ending position were behind the plane or not

little raptor
#
_p2 = _obj getVariable ["destination", _p1];
if (_p2 isNotEqualTo (_obj getVariable ["lastDestination", _p1]) then {
  _obj setVariable ["lastDestination", _p2];
  _obj setVariable ["targetDir", _p1 vectorFromTo _p2];
};

if (_dir vectorCos (_obj getVariable ["targetDir", _dir]) <= 0) then { //terminate

}
little raptor
#

but the point is that the p1 is moving

past wagon
#

ok

little raptor
#

there's no "front" or "behind" here

past wagon
#

well, p2 is set and p1 is where the plane is which is either past or not past p2

little raptor
#

how do you define "past"?

past wagon
#

the plane is facing away or towards

little raptor
#

it's always facing towards

past wagon
#

what if it goes past the point and begins moving away from it?

little raptor
past wagon
#

ok lmao

little raptor
#

it does what you're asking

past wagon
#

yeah

tough abyss
#

you said you want it to go from point a to point b

#

not from point a past point b

#

and even if you do want that why not just put a point past point b and use that as point b

past wagon
#

okay so if it wont ever go past point B, what will happen when it gets there?

tough abyss
#

I haven't read through leopard's script so I'm not sure

#

though I'd assume the code keeping the plane straight probably stops

past wagon
#

just with setVelocityTransformation in general

tough abyss
#

so pretty much what I just said then

past wagon
#

ok

little raptor
#

if interval is between 0 and 1 it interpolates

past wagon
#

yeah

little raptor
#

outside that range it extrapolates

past wagon
#

ohhhh

#

interpolate is the opposite of extrapolate

#

now it all makes sense to me

#

but im getting Type any, expected array here:

    plane setVelocityTransformation [
        getPosWorld plane,
little raptor
#

is plane defined?

past wagon
#

its the object variable name

little raptor
#

what about the rest?

past wagon
#
//START FLIGHT
addMissionEventHandler ["EachFrame", {
    _thisArgs params ["_planeStartPos", "_planeDir", "_planeEndPos"];
    _vectorDir = _planeStartPos vectorFromTo _planeEndPos;
    _velocity = _vectorDir vectorMultiply 150;
    _distance = getPosWorld plane vectorDistance _planeEndPos;
    plane setVelocityTransformation [
        getPosWorld plane,
        _planeEndPos,
        _velocity,
        _velocity,
        _vectorDir,
        _vectorDir,
        [0,0,0],
        [0,0,0],
        150 * diag_deltaTime / _distance
    ];
}, _this];
little raptor
past wagon
#

oh

#

can I pass them?

little raptor
#

yes

#

use the EH args

#

and inside the EH code use _thisArgs to get them

past wagon
#

oh got it

#

yep

little raptor
past wagon
#

yeah

#

so the plane will fly off into the distance?

little raptor
#

no

#

it just keeps going in crazy motion once it reaches the destination

past wagon
#

I could just set a timer to destroy the object then

little raptor
#

just use vectorCos

#

your destination and start are fixed in your code

#

it's a lot easier

past wagon
#

yea

little raptor
#
_pos = getPosWorld plane;
if (_vectorDir vectorCos (_pos vectorFromTo _planeEndPos) <= 0) exitWith {
  removeMissionEventHandler ["EachFrame", _thisEventhandler];
}
past wagon
#

what about this tho

if (plane inPolygon [_planeStartPos, _planeEndPos]) exitWith {
  removeMissionEventHandler ["EachFrame", _thisEH];
};
#

yours is probably better, just curious

little raptor
#

first of all [_planeStartPos, _planeEndPos] is not a polygon

#

a polygon needs at least three points

past wagon
#

oh yeah

#

im stupid

#

haha

little raptor
#

second of all, that would still be subject to the same error as checking the distance

past wagon
#

because it would be technically in the polygon?

little raptor
#

no

#

it's a matter of FPS an velocity

past wagon
#

ok

little raptor
#

if you really want to know why I can explain

past wagon
#

its okay

#

it would just confuse me anyway

little raptor
# past wagon it would just confuse me anyway

no it's actually very simple
let's say your plane was going at 500 m/s and you're running the game at 100FPS, and let's say you set the termination condition to _dist < 1
diag_deltaTime is 1/100 = 0.01s

now let's say the plane is within 3 m of the end pos

if you move the plane again, it will move by 500 * 0.01 = 5 m
so it'll move past the end pos

in the next frame it's now 2m away from the end pos, so it moves in the opposite direction and again ends up at 3m from the end pos

this movement will never end. it just keeps going forward and backward

#

if you simply check the distance or polygon or area or something it'll be wrong, because its accuracy will depend on FPS and velocity

#

the correct way is checking direction

past wagon
#

ok

#

yeah that does make sense i guess

#

okay its basically working perfectly now which is awesome

#

the only thing is that I did the vectorUp wrong and I'm not sure how I should do it

#

I did [0,0,0]

#

If I want the plane to fly completely level, what do I do?

little raptor
#

up should point up meowsweats

past wagon
#

oh

#

yeah makes sense lol

#

okay I changed that and it's still going up

#

I think it might be something to do with the vectors

little raptor
#

the direction in which it moves?

#

if so the problems are your start and end position

past wagon
#

its going forward as well. but its also gaining altitude very quickly

little raptor
#

then your start and end positions are wrong

#

what do you use for them?

past wagon
#

here's whole script:

//GET RANDOM PATHZONE POSITION AND DIRECTION
_pathZonePos = [["centerZone"], ["water"]] call BIS_fnc_randomPos;
_pathZoneDir = random 360;

//SET PATHZONE POSITION AND DIRECTION
"pathZone" setMarkerPos _pathZonePos;
"pathZone" setMarkerDir _pathZoneDir;

//SPLIT PATHZONE POSITION ARRAY AND INITIALIZE PLANE DIRECTION
_pathZonePos params ["_posX", "_posY"];
_positive = selectRandom [true, false];

//CALCULATE PLANE STARTING POSITION
_sideA = 15000 * cos _pathZoneDir;
_sideB = 15000 * sin _pathZoneDir;
_planeStartPos = if (_positive) then {
    [_posX + _sideB, _posY + _sideA, 1500]
} else {
    [_posX - _sideB, _posY - _sideA, 1500]
};

//GET PLANE STARTING DIRECTION
_planeDir = if (_positive) then {
    _pathZoneDir + 180
} else {
    _pathZoneDir
};

//CALCULATE PLANE END POSITION
_sideA = 15000 * cos _pathZoneDir;
_sideB = 15000 * sin _pathZoneDir;
_planeEndPos = if (_positive) then {
    [_posX - _sideB, _posY - _sideA, 1500]
} else {
    [_posX + _sideB, _posY + _sideA, 1500]
};

//RETURN PLANE STARTING POSITION, DIRECTION, AND WAYPOINT POSITIONS
[_planeStartPos, _planeDir, _planeEndPos]
#

but basically the _endPos should have an altitude of 1500

#

nvm

little raptor
past wagon
#

I do

little raptor
#

where?

#

I don't see anything

past wagon
#
//DEFINE VARIABLES
params ["_planeStartPos", "_planeDir", "_planeEndPos"];

//PUT PLANE INTO POSITION
plane setPos _planeStartPos;
plane setDir _planeDir;

//START FLIGHT
addMissionEventHandler ["EachFrame", {
    _thisArgs params ["_planeStartPos", "_planeDir", "_planeEndPos"];
    if (_vectorDir vectorCos (getPosWorld plane vectorFromTo _planeEndPos) <= 0) exitWith {
        removeMissionEventHandler ["EachFrame", _thisEventHandler];
    };
    _vectorDir = _planeStartPos vectorFromTo _planeEndPos;
    _velocity = _vectorDir vectorMultiply 150;
    _distance = getPosWorld plane vectorDistance _planeEndPos;
    plane setVelocityTransformation [
        getPosWorld plane,
        _planeEndPos,
        _velocity,
        _velocity,
        _vectorDir,
        _vectorDir,
        [0,0,1],
        [0,0,1],
        150 * diag_deltaTime / _distance
    ];
}, _this];
little raptor
#

you're joking right?

past wagon
#

uhh

little raptor
#

!quote 5

lyric schoonerBOT
past wagon
#

ok

#

should I just use ASL?

little raptor
#

world

past wagon
#

ok

#

okay well that wasnt the problem because it's still going up

#

I think its gotta be the vectors

little raptor
#

what are you talking about?

#

it must be the AI

past wagon
#

theres no AI

#

pilot is gone

little raptor
#

_vectorDir vectorCos (getPosWorld plane vectorFromTo _planeEndPos) <= 0

#

_vectorDir is not defined

past wagon
#

well that code doesnt work but I was gonna worry about that later

#

oh

#

need to re-arrange it

#

but yeah thats not the problem either i dont think

#

it seems to be flying up at the same rate it is flying forward

little raptor
past wagon
#

my positions have gotta be corrrect tho

little raptor
#

also where are you running that code?

past wagon
#

init.sqf:

//INITIALIZE PATH ZONE
_flightArray = call TRI_fnc_pathZone;

//START FLIGHT
_flightArray call TRI_fnc_startFlight;
little raptor
past wagon
#

yeah...

#

I have been

little raptor
#

you must go back to Eden

past wagon
#

oh

#

well

#

I'm pretty sure I did a couple times

#

but I've mostly just been restarting

#

yeah, still not working

little raptor
past wagon
#

in the EH?

little raptor
#
systemChat format ["%1 | %2 | %3", _planeStartPos#2, getPosWorld plane#2, _planeEndPos#2];
little raptor
past wagon
#

ok

#

if you cant read it very well, the first and last are both 1500

little raptor
#

is that at the start?

past wagon
#

no

#

it starts at 1500

#

and flies up

little raptor
# past wagon ```sqf //DEFINE VARIABLES params ["_planeStartPos", "_planeDir", "_planeEndPos"]...

try this instead:

//DEFINE VARIABLES
params ["_planeStartPos", "_planeDir", "_planeEndPos"];

//PUT PLANE INTO POSITION
plane setPosASL _planeStartPos;

//START FLIGHT
addMissionEventHandler ["EachFrame", {
    _thisArgs params ["_planeStartPos", "_planeDir", "_planeEndPos"];
    _vectorDir = _planeStartPos vectorFromTo _planeEndPos;
    if (_vectorDir vectorCos (getPosASL plane vectorFromTo _planeEndPos) <= 0) exitWith {
        removeMissionEventHandler ["EachFrame", _thisEventHandler];
    };
    
    _velocity = _vectorDir vectorMultiply 150;
    _distance = getPosASL plane vectorDistance _planeEndPos;
    plane setVelocityTransformation [
        getPosASL plane,
        _planeEndPos,
        _velocity,
        _velocity,
        _vectorDir,
        _vectorDir,
        [0,0,1],
        [0,0,1],
        150 * diag_deltaTime / _distance
    ];
}, _this];
past wagon
#

ok

#

yep now its working

#

what did you change lol

little raptor
#

changed the world to ASL

past wagon
#

ok

#

haha

#

thanks

little raptor
#

although it's stupid that the game uses ASL and not world meowsweats

#

ASL pos changes depending on object orientation

#

@tidal ferry btw that must've been why you had that problem meowsweats

past wagon
#

yeah

#

makes sense

#

thanks for helping me tonight

#

finally got this damn plane to fly straight smh

little raptor
#

np

little raptor
#

the problem wasn't a vector

#

it was using world position instead of ASL

pallid ravine
#

I've got a question. I'm working on various scripts for public zeus custom compositions, and I'm having a hard time understanding locality of init. Other sources on google suggest that any scripts in the init of an object are run on every client, including JIP clients. This means that if you use a remoteExec on, say, an addAction, then every new client that joins will run that init and create another copy of that added action on the attached object. However, I've used a remoteExec to make add an action and did not experience any action duplication when new player join. Am I misunderstanding something? Is the init of objects placed by zeus somehow different?

little raptor
bitter jewel
#

sometimes when i set variables and inspect them later, the value of the variable shows up as any or string instead of any actual value like 1 or "foo"

#

i cant pinpoint when this happens

#

does someone know the reason?

little raptor
#

hard to guess without looking at the code

#

you probably assign it to something where you shouldn't

#

or maybe you don't use tags and another script modifies your variable

little raptor
pallid ravine
#

On the client of the zeus?

little raptor
#

yep

#

you can test it tho

#

but it'd make no sense to run it anywhere else

#

the object that Zeus creates is local to that Zeus client, so it makes sense that it also runs the init script locally

pallid ravine
#

Alright, I suspect that's the case as it would explain why the code I have is working (and why the tutorials I was basing my code on used this code). Thanks for the quick answer!

bitter jewel
#

i was doing ```sqf
call { if (...) then { _foo = 1 } else { _foo = 2 }; _value = 1 + _foo; _value }

#

i had to declare _foo somewhere before the if

tough abyss
#

are you asking why you had to?

bitter jewel
#

no i am just reporting why

#

just if someone else was wondering why

#

i dont know if that was very useful since it will quickly be drowned under new messages

#

but i did it anyway

#

how do i collect each config in CfgVehicles where VehicleClass == given?

lilac maple
#

Hi. I don't know since which update, but from some time now, when I have cba_a3 + zen loaded, open unit init and put this code inside:

this setVariable ["yethe_variable1", true, true];```
Nothing happens. It used to be working just fine couple of months ago. Right now, only solution I have is to assing a variable name to the unit via Zeus module and then launching this code via console:
```sqf
unitVarName setVariable ["yethe_variable1", true, true];```
Which is not ideal. I don't know why the old way is not working currently. How should I change the code so I can execute it properly inside the unit init field?
bitter jewel
#

-- open unit init and put this code inside:

#

do you mean as zeus or in eden editor?

lilac maple
bitter jewel
#

i believe in zen you have to use _this instead of this when referring to the unit in the init field

lilac maple
#

When I do this in editor, it is working just fine. But when I spawn something in Zeus and I would want to use the same thing, it does not work for some reason.

#

Okay, will try it

bitter jewel
#

thanks

#

i looked at the page before

#

but didnt look good enoughtanking

lilac maple
fervent kettle
upper siren
#

ok, I can see how that is confusing if you don't know what they mean

#

so in really simplified way:
if you're hosting locally or in SP the only place where scripts get executed is on the server (which is you because its localhost/SP):

#

Once you move to dedicated that doesn't hold true anymore, the server and you are to separate instances, so e.g. something you put in initServer.sqf will run on the dedicated server and not on you.
BUT if you localhost initServer.sqf will run on you, the player, because you're ALSO the server.

#

in short, try calling your script from initplayerlocal.sqf and see if that works

#

meaning, instead of doing whatever you're doing in init.sqf just rename the file to initplayerlocal.sqf (the file should be in your mission)

#

If anyone reading this sees something wrong with this do tell ๐Ÿ˜…

winter rose
#

initServer.sqf* ๐Ÿ˜‰

upper siren
#

so THATS why my scripts never work!

harsh lake
#

can someone help, im trying to start a mission off with a breifing but i cant do that, i have a breif but the player has to open breifing in the map. is there a way to start the situation with a breifing

#

if you could join general voice to help that would be nice

fervent kettle
upper siren
fervent kettle
#

Will definetely look into that next time I write some stuff

pallid ravine
#

Is there a way to get the weapon that a given magazine uses?

I'm putting together a script that will allow players to set pylon weapons in public zeus. So far it has worked, but the issue I've run into is that when all pylons of a weapon type has been removed (by being replaced with setPylonLoadout), that weapon is still on the weapon list, just with no ammo. Supposedly this can be fixed by running removeWeaponGlobal, but that function requires a weapon name. The only function I know to check what is on a pylon is getAllPylonsInfo, which only gives you the magazines on each pylon, hence my original question.
Edit: Found the solution, I can read what weapon uses a given magazine from that magazine's config file using the >> operator.

snow pumice
#

Hey I noticed that I cant spawn the Land_Carrier_01_base_F or Land_Destroyer_01_base_F with createVehicleLocal or createSimpleObject only with createVehicle

Is there any explanation for that?

plain linden
#

Ok Iโ€™m stumped. Iโ€™m trying to stop the characters from having asthma attacks from walking 2 feet.

{
player enableFatigue false;

};```

`player enableFatigue false;`
#

Neither works. Any solution?

snow pumice
plain linden
cosmic lichen
#

Please not without sleep

pallid ravine
#

Does anyone know why
missionNamespace setVariable ["BIS_fnc_garage_data", _temp];
is not actually changing the contents of BIS_fnc_garage_data? Both BIS_fnc_garage_data and _temp are arrays of the same dimension/structure, _temp is defined earlier in my code and I confirmed it is taking the correct value.

tough abyss
#

Is BIS_fnc_garage_data an existing BIS function or custom?

pallid ravine
#

Existing

tough abyss
#

That'd be why

#

It's not defined in missionNameSpace then

#

Hence why your code isn't overwriting it

pliant stream
#

why is it an array if it's called BIS_fnc_something

pallid ravine
#

Am I misunderstanding something?

distant oyster
pliant stream
#

oh okay, so the naming convention is just dumb

distant oyster
#

no it makes sense. if the variable is only used in that function

tough abyss
#

Yeah that's a dumb name

pliant stream
#

why have fnc if not for the hungarian notation

distant oyster
#

it's to make absolutely sure that there is no other variable with that name, given that arma has several hundred functions

tough abyss
#

You don't name a variable with function naming convention just because a function uses it

#

It's bad and unnecessary

#

Why not BIS_var_garage_data

pliant stream
#

imagine if bohemia had invented static typing

tough abyss
#

That's confusing then why you're not able to overwrite it

#

๐Ÿค”

pliant stream
#

well sqf kinda has readonly variables, only i thought the user couldn't create any except for code via compileFinal

tough abyss
#

That was my understanding

pliant stream
#

iirc there are some cases where the engine creates readonly variables with values of other types

tough abyss
#

@pallid ravine since it's a global var it might be worth trying direct assignment with =

#

setVariable might be encountering issues for some reason

pallid ravine
#

I figured it out. It seems like calling BIS_fnc_garage overwrites BIS_fnc_garage_data for some reason. I'll investigate some more and see if there's a way around that.

tough abyss
#

If all else fails you could make a wrapper function that calls both of them to restore its initial state

#

Though I imagine there's a better way

vapid drift
#

as always, I assume I'm missing something... but _speaker say3D _sound; is returning "Sound RadioAmbient4 not found" _speaker is an object, _sound is "RadioAmbient4" which is the class name so I'm not sure what the issue is.

#

using playSound "RadioAmbient4"; from the debug console results in "NOID <no shape>"

tough abyss
#

Seems like it doesn't like _speaker then

#

As the return value of both commands is supposed to be the object used

#

As for why it can't find the sound

vapid drift
#

playSound has nothing to do with the object though when fired from the debug menu

tough abyss
#

You have it properly set up in CfgSound?

vapid drift
#

I mean, that's the entirety of the command playSound "RadioAmbient4";

#

it's a vanilla sound

tough abyss
#

Ah

vapid drift
#

No... that's the problem

winter rose
#

so it might not be defined in CfgSounds but in another subclass

#

if you know the file path you can define it yourself with @ prefix in your own description.ext

vapid drift
#

ugh disregard

#

I knew I was screwing up something stupid... it's Music

#

alright... forget I was here!

winter rose
#

*spanks*

tough abyss
#

Usually something simple like that

winter rose
#

nice havin' you here! ๐Ÿ‘‹ anytime ^^

vapid drift
#

lol

tough abyss
#

Debugging is 99% self dread anyways

winter rose
#

hmm, whyโ€ฆ whyโ€ฆ WHY?!!
oh! that's why.

hm, who is the idjit thatโ€ฆ nevermind that was me

how can it not work in such edge case? oh, fixedโ€ฆ wait, how could it work before??

tough abyss
#

Oh god that's the worst

#

I don't know how it works, and I don't like that because now I have no clue what will break it

vapid drift
#

Lol always

tough abyss
#

And as far as I know it shouldn't work

#

But it does

fair drum
#

there a function for averaging an array of numbers?

winter rose
#

be sure to check that the array is not empty, otherwise it will throw a division by zero error

plush nova
#

Is there a movetime equivalent for gestures?

winter rose
#

nope afaik

pliant stream
#

can't do shit with gestures

#

there's no way to make use of the gesture animation graph from sqf, even in A3 is there?

past wagon
#

If I do this:sqf for _i from 0 to 10 do { "Land_PlasticCase_01_large_black_F" createVehicle call BIS_fnc_randomPos; "WeaponHolderSimulated" createVehicle call BIS_fnc_randomPos; }; And then later....```sqf
{
deleteVehicle _x;
} forEach allMissionObjects "Land_PlasticCase_01_large_black_F";
{
deleteVehicle _x;
} forEach allMissionObjects "WeaponHolderSimulated";

I'm just a bit confused about whether or not they would be in `allMissionObjects` and if their classnames will work the `type`.
fair drum
past wagon
#

ok

tough abyss
#

Eh using it isn't so bad so long as you're not using it regularly and the script doesn't need to be fast

#

Ideally you'd be doing some sort of caching though

vapid drift
#

My gosh if it's not one thing it's another... I've seen a million different solutions for this but why the heck are my helicopters ignoring the land waypoints? They're set to carless and the waypoints are placed directly on invisible helipads. They move close to them then just hover

tough abyss
#

Something something collision avoidance

#

Don't recall how to fix it but it's common

past wagon
#

why am I getting Undefined variable in expression: _i here?

for _i from 1 to 3 do {
    pilot action ["VectoringDown", plane];
};
vapid drift
#

"_i"... put it in quotes

past wagon
#

oh

#

I'm stupid my bad

#

forgot about that

vapid drift
#

Lol pretty sure I just said that same thing earlier

past wagon
#

lol

#

I'm trying to write a script that will spawn weapons and supplies inside buildings on the floor and in crates. I'm checking buildings and not getting anything. Does anyone see what might be the problem with my code?

//INITIALIZE VARIABLES
_buildingArray = nearestObjects [[15000,15000,0], ["house"], 20000, true] inAreaArray "pathZone";
_containerArray = [
    "Land_PlasticCase_01_large_black_F", 1,
    "WeaponHolderSimulated", 7
];
_groundWeaponArray = [
    [["arifle_Katiba_F", "30Rnd_65x39_caseless_green"],1,["arifle_Katiba_ACO_F", "30Rnd_65x39_caseless_green"],1,["arifle_Katiba_ARCO_F", "30Rnd_65x39_caseless_green"],1],1
];
_groundItemArray = [
    "FirstAidKit",1
];
_crateWeaponArray = [
    [["arifle_Katiba_F", "30Rnd_65x39_caseless_green"],1,["arifle_Katiba_ACO_F", "30Rnd_65x39_caseless_green"],1,["arifle_Katiba_ARCO_F", "30Rnd_65x39_caseless_green"],1],1
];
_crateItemArray = [
    "FirstAidKit",1
];
_crateArray = [];
_groundArray = [];
#
//CREATE LOOT CONTAINERS
{
    if (_x buildingPos -1 isEqualTo []) then {
        continue;
    };
    if (random 10 > 5) then {
        continue;
    };
    _lootPos = selectRandom (_x buildingPos -1);
    _lootContainer = selectRandomWeighted _containerArray;
    _lootContainer createVehicle _lootPos;
    if (_lootContainer == "Land_PlasticCase_01_large_black_F") then {
        _crateArray pushBack _lootContainer;
    } else {
        _groundArray pushBack _lootContainer;
    };
    if random 10 > 5 then {
        _lootPos = selectRandom ((_x buildingPos -1) - [_lootPos]);
        _lootContainer = selectRandomWeighted _containerArray;
        _lootContainer createVehicle _lootPos;
        if (_lootContainer == "Land_PlasticCase_01_large_black_F") then {
            _crateArray pushBack _lootContainer;
        } else {
            _groundArray pushBack _lootContainer;
        };
    };
} forEach _buildingArray;

//SPAWN CRATE LOOT
{
    _gunAndMag = selectRandomWeighted (selectRandomWeighted (_crateWeaponArray));
    _gunAndMag params ["_gun", "_mag"];
    _x addWeaponCargoGlobal [_gun, 1];
    _x addMagazineCargoGlobal [_mag, 4 + (round random 3)];
    for "_i" from 1 to 2 do {
        _item = selectRandomWeighted _crateItemArray;
        _x addItemCargoGlobal [_item, 1];
} forEach _crateArray;

//SPAWN GROUND LOOT
{
    if random 10 > 5 then {
        _gunAndMag = selectRandomWeighted (selectRandomWeighted (_groundWeaponArray));
        _gunAndMag params ["_gun", "_mag"];
        _x addWeaponCargoGlobal [_gun, 1];
        _x addMagazineCargoGlobal [_mag, 2 + (round random 3)];
    } else {
        _item = selectRandomWeighted _groundItemArray;
        _x addItemCargoGlobal [_item, 1];
    };
} forEach _groundArray;
fair drum
limber panther
#

hello! I'm trying to understand to some scripts and i just need a little push. ```sqf
[lod1, true] remoteExec ["hideObjectGlobal", 2];

[i did read the pinned message in this channel]
little raptor
limber panther
little raptor
#

Yes

limber panther
brazen lagoon
#

Anyone have a suggestion on how to find a route between 2 points?

#

like, that follows roads I mean

winter rose
brazen lagoon
#

cool, didn't know what to search for

#

thanks!

#

this makes this idea I have much easier

open fractal
#

is there a way to make a dead unit ragdoll straight out of an animation? right now he's flipping around and lying flat for a split second before ragdolling

#

interesting

#

when i do

injuredSoldier setDamage 1

it flips him around and ruins it but when I do

[]spawn { 
 while {true} do { 
  if (!alive injuredSoldier) then {terminate _thisScript} else { 
  injuredSoldier setDamage ((damage injuredSoldier) +.05); sleep 1;} 
 }; 
}```
then he just ragdolls??
#

nevermind

#

it's seemingly random which italian cuisine arma serves up

little raptor
#

unbalanced {}, incorrect ifs, etc.

past wagon
winter rose
#

indent ๐Ÿ˜‰

past wagon
#

I did

#

I always indent

#

oh well now I notice the problem with that for loop lmao

open fractal
past wagon
#

ohhh

little raptor
#

if random 10 > 5

past wagon
#

I forgot the ()'s in the if.

little raptor
#

that's wrong

past wagon
#

yeah

#

I've been coding in python for school ๐Ÿ™„

little raptor