#arma3_scripting

1 messages Β· Page 659 of 1

still forum
#

I can see the missing ;
can you?

sharp peak
#

I πŸ‘€ too

sturdy patrol
#

in the if above

still forum
#

Next time when you ask for help with an error.
provide the error, and your script and enough context so people can see whats going on without having to pull everything out of you in seperate questions wasting 5 minutes of time πŸ™‚

sturdy patrol
#

yes excuse me @still forum , I'm really into a lot of things and I'm supposed to be on vacation

sharp peak
#

Since there are some eventHandlers not listed here - https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
Is there a better eventHandler to use for this? c++ addMissionEventHandler ['EachFrame',{if (cameraView isEqualTo 'GROUP') then {player switchCamera 'INTERNAL';};}];
Script for removing the group/commander/tactical view

still forum
#

"Since there are some eventHandlers not listed here " huh? which aren't listed?

glass zinc
#
if (worldName isEqualTo "Tanoa") then 
{ 
 CTI_TANOA_REMOVED_OBJECTS = 
 [
  "t_ficus_medium_f.p3",
  "t_palaquium_f.p3d", 
  "t_ficus_big_f.p3d", 
  "b_cycas_f.p3d", 
  "d_fallentrunk_branches_lc_f.p3d",
  "d_fallenbranch_lc_f.p3d",
  "d_treestump_natural_large_f.p3d",
  "d_fallentrunk_roots_lc_f.p3d",
  "b_colored_yellow_f.p3d",
  "b_colored_red_f.p3d",
  "b_gardenia_dec_02_f.p3d",
  "tyre_01_f.p3d",
  "tyre_01_line_x5_f.p3d",
  "tyre_01_horizontal_f.p3d",
  "garbageheap_04_f.p3d",
  "garbageheap_01_f.p3d",
  "garbageheap_02_f.p3d",
  "garbageheap_03_f.p3d",
  "clothesline_01_full_f.p3d",
  "clothesline_01_f.p3d",
  "fishinggear_01_f.p3d",
  "cinderblocks_01_f.p3d",
  "fishinggear_02_f.p3d",
  "woodenplanks_01_messy_f.p3d",
  "crabcages_f.p3d",
  "woodencrate_01_stack_x3_f.p3d",
  "woodencrate_01_f.p3d",
  "woodencrate_01_stack_x5_f.p3d",
  "containerline_01_f.p3d",
  "containerline_02_f.p3d",
  "containerline_03_f.p3d",
  "woodenplanks_01_f.p3d"
 ];
 
 { 
  if(toLower(str _x) in CTI_TANOA_REMOVED_OBJECTS) then 
  {
   _x hideObjectGlobal true; 
   _x enableSimulationGlobal False;
  };
 } foreach (nearestTerrainObjects [[worldSize/2, worldSize/2], ["HIDE","tree","house"], worldSize, false]);
};

any idea why it does not remove the objects?

#

woops

#

did nto mean to post the whole thing

still forum
#

toLower(str _x) did you check that in debug console? that it returns exactly what you expect it to return?

glass zinc
#

hmm, im using the dev console, what command should i use to do that?

sharp peak
still forum
glass zinc
#

kk

glass zinc
#

"560992: t_ficus_medium_f.p3d"

#

it returns on one of them

still forum
#

well there you go

glass zinc
#

when i do it like this it works...

#

1 sec

still forum
#

it doesn't work

#

"560992: t_ficus_medium_f.p3d" is not IN your CTI_TANOA_REMOVED_OBJECTS

glass zinc
#

ok i just grabed one i thought it did

#

what i mean is

#

when i do it like this it works

#
if (worldName isEqualTo "Tanoa") then { {      
 if (
 (toLower(str _x) find "t_ficus_medium_f.p3") >= 0 ||
 {(toLower(str _x) find "t_palaquium_f.p3d") >= 0} ||
 {(toLower(str _x) find "t_ficus_big_f.p3d") >= 0} ||
 {(toLower(str _x) find "b_cycas_f.p3d") >= 0} ||
 {(toLower(str _x) find "d_fallentrunk_branches_lc_f.p3d") >= 0} ||
 {(toLower(str _x) find "d_fallenbranch_lc_f.p3d") >= 0} ||
 {(toLower(str _x) find "d_treestump_natural_large_f.p3d") >= 0} ||
 {(toLower(str _x) find "d_fallentrunk_roots_lc_f.p3d") >= 0} ||

 ) then {_x hideObjectGlobal false; _x enableSimulationGlobal true; }
 } foreach (nearestTerrainObjects [[worldSize/2, worldSize/2], ["HIDE","tree","house"], worldSize, false]);
};
#

ob with more stuff

#

i deleted some so im not flooding the discord as much

still forum
glass zinc
#

yes but non of the othernames get remved

still forum
#

Yes.

glass zinc
#

is that because the first 1 is broken?

still forum
#

You still don't understand what I'm trying to say

#

no

winter rose
#

It contains "t_ficus_medium_f.p3" but you are checking if it contains "560992: t_ficus_medium_f.p3d"

still forum
#

"560992: t_ficus_medium_f.p3d" != "t_ficus_medium_f.p3d"

#

the number at the start

winter rose
#

It contains "t_ficus_medium_f.p3d" but you are checking if it contains "560992: t_ficus_medium_f.p3d"

glass zinc
#

ahhh

still forum
#

it can never match exactly, because it doesn't have the numbers

#

every object has a unique number too so can't really check with that

winter rose
#

ask @midnight spoke Mason about the numbers

still forum
#

just use getModelInfo to get the real model name

glass zinc
#

hmm i have had issues using get model info before..

#

thats why i used this originally

#

how come the 2nd one works?

#

can i make the first work like the 2nd?

still forum
#

The second one shouldn't work

#

they should all have the numbers

#

or do you mean the other script?

#

Better try getModelInfo, I don't know why that wouldn't work, and it would be more efficient

glass zinc
#

it does work

#

the 2nd one works

#

it just takes forever

#

like 6 seconds of freezing

#

but im in dev

#

and have used the 2nd one for a long time

still forum
#

"or do you mean the other script?" yes, didn't understand what you meant by "2nd"

glass zinc
#

like im in eden in the dev console i mean

#

kk

still forum
#

I know it works but its very bad performance wise

glass zinc
#

so why does 2nd work and first wont?

#

and can i make the 1st work?

#

the 1st one should improve performance right?

still forum
#

Maybe I'm not talking loud enough.

#

USE GETMODELINFO TO GET THE MODEL NAME.

#

is that better? can you hear me now?

glass zinc
#

i can hear you of course

still forum
#

Sorry I'm REALLY not a fan of having to repeat myself half a dozen times

glass zinc
#

sorry i just remember having a real struggle with getModelInfo in the past

winter rose
#

we're here to back you up πŸ˜‰

still forum
#

Works fine here. And I can't think of anything that would break it

glass zinc
#

kk thanks ill go mess with it

#

i had issues with CUP maps and other custom maps

#

thats why i used that stuff originally

#

cuse i could get returns

#

where sometimes i could not get the full classname

#

returned to me

#

but ill give ner a another go

still forum
#

Some objects on terrains don't have a classname. But noone here said you should use classnames

glass zinc
#

this may be what confused me before then...

sturdy patrol
#
_action = _this param [0];
_handle = 0;
if (_action == "start") then
{
    _handle = [] execVM "computer.sqf";
};

if (_action == "exit") then
{
    terminate _handle;
};

dedmen a more question i have this script to boot the other script, but i have a problem to terminate the script any help with this?

glass zinc
#

ok so ["t_ficus_medium_f.p3d","a3\vegetation_f_exp\tree\t_ficus_medium_f.p3d",false] is returned with get model info

sturdy patrol
#

is like the _handle is not assigned with the exec of the script it contain the 0

still forum
#

"t_ficus_medium_f.p3d" use that. With your CTI_TANOA_REMOVED_OBJECTS

glass zinc
#

kk

still forum
#

When you call it with exit, _handle = 0 you will have set it to 0

sturdy patrol
#

ok, i need to declare it as global to work ?

glass zinc
#

im so confused.. brain hurts
so i ran

if (worldName isEqualTo "Tanoa") then 
{ 
 CTI_TANOA_REMOVED_OBJECTS = 
 [
  "t_ficus_medium_f.p3d"
 ];
 
 { 
  if(toLower(str _x) in CTI_TANOA_REMOVED_OBJECTS) then 
  {
   _x hideObjectGlobal true; 
   _x enableSimulationGlobal False;
  };
 } foreach (nearestTerrainObjects [[worldSize/2, worldSize/2], ["HIDE","tree","house"], worldSize, false]);
};

the tree is not removed... sorry if im super fucking dense

still forum
#

toLower(str _x)

#

How often shall I repeat to use getModelInfo

glass zinc
#

oh in that part you want get modle info

glass zinc
#

i thought we where jsut using that to get the model via cursor object

still forum
#

I already told and showed you above that str _x returns that number at the start

glass zinc
#

yes thus why i was not getting in, i did not understand what we where changing

#

I thought i needed to grab the name of the object

#

in a different way

still forum
#

I don't understand why you thought that

glass zinc
#

via chainging it by grabbing it via cursor object

still forum
#

how would "t_ficus_medium_f.p3d" generated one way be different from "t_ficus_medium_f.p3d" generated another way, its the same thing

#

Its literally just a string of characters. No matter how you generate it, as long as it matches

glass zinc
#

thus my confusion

sturdy patrol
sharp peak
#

Tried it 3 times now, every time I draw a line or put down a dot on the map in one of the channels that the script is meant to delete markers in - the game instantly crashes

still forum
#

try

#
addMissionEventHandler ["MarkerCreated", { 
  params ["_marker", "_channel"];
  if (_marker select [0, 13] == "_USER_DEFINED" && _channel in [0,1,2,3]) then { _x spawn {deleteMarker _this}; };
}];
sharp peak
#

Propably it's due to the tons of other scripts n stuff in the mission, but those would be a bigger pain to change

sharp peak
still forum
#

Can you either make a feedback tracker ticket for the crash, or just send me the mdmp via DM

sharp peak
#

I'll do the feedback tracker if I don't figure it out, but my guess would be that it's caused by bunch of other scripts n their errors

#

Through - I have it in the init.sqf, maybe that's not the correct place?

#

Crashes happened on "play in multiplayer" through the editor, so not an actual server

#

I'll also try the new one on a completely empty mission if it still crashes, just in-case

still forum
#

Please also do if you figure it out

#

I need to fix that

#

It doesn't matter where you execute

#

I just need the report please

sharp peak
#

Figured I'd ask, I know some things directly in the 'init' break things

distant oyster
#

can confirm, deleting marker in markercreated EH in hosted MP will crash the game

sharp peak
distant oyster
#

havent tested dedicated

sharp peak
#

Will try the previous one on a no-mods empty mission, see if it still crashes me

still forum
#

oops sorry.

#

not _x, use _marker

still forum
sharp peak
#

Will do ticket, maybe both

#

Restarting again to try with _marker))
Just incase

sharp peak
#

Making error report/ticket and RPT with nothing loaded on the previous one

still forum
#

I don't care about mods, they wouldn't make a difference

sharp peak
#

Aye, but it's quicker to open the game when I unload everything, especially since the result of crashing is opening the game over n over again))

glass zinc
#

ok so this is what i came up with... i could not figure out how to incorporate getmodelinfo into my script myself, i tried various things. I copied a bit of what some guys did in a thread and tried to pull out what did not matter.

if (worldName isEqualTo "Tanoa") then 
{ 
    CTI_TANOA_REMOVED_OBJECTS = 
    [
        ["t_ficus_medium_f.p3d"],
        ["t_palaquium_f.p3d"], 
        ["t_ficus_big_f.p3d"]
    ];
    
    { 
    private _a = ((getModelInfo _x) select 0);
    private _c = CTI_TANOA_REMOVED_OBJECTS select {_a == _x select 0};
    
    if !( _c isEqualTo []) then {
          hint "its true";
        hideObjectGlobal  _x;
        _x enableSimulationGlobal false;
    
    };

        
} forEach nearestTerrainObjects 
    [
        [worldSize/2, worldSize/2], 
        ["Tree"], 
        worldSize, 
        false
    ];
};

I shortend it to make it readable... it works, but i had to add those extra [] in there on each line item. I believe that is because im using that select 0 command. my question is is this what you meant? how can i make it better. and does this method ruin the performance im trying to gain?

worthy willow
#

Why the 2D array?

glass zinc
#

in nearest? i belive the first false is about whether the array arranges near to far.

#

and the one after that does 2d or 3d

worthy willow
#

No in CTI_TANOA_REMOVED_OBJECTS

glass zinc
#

you mean the brackets in the bracket?

worthy willow
#

Why not just ["P3d", "P3d"]

glass zinc
#

i think that is because if the selcetion method i copied? i could not make it work without that

#

when i did it that way

#

i think the private _a = ((getModelInfo _x) select 0);
private _c = CTI_TANOA_REMOVED_OBJECTS select {_a == _x select 0};

#

was not working

#

before i put them each in brackets

#

how do i make it work without that?

worthy willow
#
if (worldName isEqualTo "Tanoa") then 
{ 
    CTI_TANOA_REMOVED_OBJECTS = 
    [
        "t_ficus_medium_f.p3d",
        "t_palaquium_f.p3d", 
        "t_ficus_big_f.p3d"
    ];
    
    { 
        private _a = toLower ((getModelInfo _x) select 0);
        
        if (_a in CTI_TANOA_REMOVED_OBJECTS ) then {
            hint "its true";
            hideObjectGlobal  _x;
            _x enableSimulationGlobal false;
        
        };
        
    } forEach nearestTerrainObjects 
    [
        [worldSize/2, worldSize/2], 
        ["Tree"], 
        worldSize, 
        false
    ];
};
#

Like that

glass zinc
#

ill go try

#

it works!

#

thanks!

#

well i might as well compare them now to see if i wasted everyones time :S

worthy willow
#

BTW has anyone ran into an Issue where doing setVectorDirAndUp and setPosATL right after the creation of an object on the server doesn't work?

cosmic lichen
#

@worthy willow

private _a = worldSize / 2;
private _center = [_a, _a, 0];
private _size = sqrt 2 * _a;```
#

TO get the exact worldsize

worthy willow
#

Not my code πŸ™‚

#

@cosmic lichen I also swear it is ((sqrt 2) / 2) * worldSize

cosmic lichen
#

replace _a with worldSize / 2

#

sqrt 2 * worldSize / 2;

now do some math πŸ˜‰

worthy willow
#

Forgot you did worldSize /2 πŸ™‚

glass zinc
#

@cosmic lichen will this make it faster?

worthy willow
#

The area check won't be as big

#

So yeah

cosmic lichen
#

I dunno how nearestTerrainObjects behaves outside of the terrain boundries

glass zinc
#

ok so new script is 15731 ms
old one is 37216 ms

#

so a big improvement!

cosmic lichen
#

πŸ˜„

glass zinc
#

dont know about your thing yet r3vo

#

gotta try that still

glass zinc
#

okay so i was able to improve it very minorly with toLowerANSI to 15400. no effect from changing the worldsize settings

#

ill keep it in there anyway maybe it will help with really really big maps

#

like Australia and mske

#

@cosmic lichen @worthy willow @still forum thanks for the help!

worthy willow
#

@glass zinc Removing the hint will give a lot more performance btw.

glass zinc
#

yeah i removed that

#

thanks

glass zinc
#

so it seems like its mostly having the array in the array that makes the performance that much worse

winter rose
#

maybe you can have a faster search by using apply and the indexes

#

meh, no, everything seems already gudenuff

cosmic lichen
#

Very easy way to make it faster

#

Just get all trees on tanoa, stratis, altis, whatever

#

and store them in a variable

#

Then just go through them when the mission is running and hide them.

#

downsight is, that it's static and needs to be adjusted for every map

glass zinc
#

@cosmic lichen that sounds very cool... you mean like remove them slowly over time

#

it does jam up the mission at start for sure, causes a freeze while its doing its thing

cosmic lichen
#

What I mean is. You go into the editor on Tanoa. Execute the script which collects all trees which fulfill the condition. Then you copy that array to clipboard and paste it into the script file. When you now start your mission . You only have to loop through that array and hide the trees.

#

I am kinda busy now but I am sure someone else will help

glass zinc
#

ah ic what you mean

#

that would be pretty cool

hollow lantern
#
if (_tempad) then 
{
}

Can someone explain to me why this produces an error that _tempad is not set? I mean yes it is not set, but tbh it should just check if it exist and run some code. If it doesn't then skip it. tried also the !(isNil _tempad) approach .
Or is there a better way of doing this? _tempad is an object btw

spark turret
#

isNil "_tempad"

#

@hollow lantern

#

uh also you cant boolean-test an object.

#

what do you wanna test for?

hollow lantern
#

I just want to check if it exists

#

and run some code only then

spark turret
#

_tempad is a local variable. so if it wasnt set, it will always be nil. it also does not autoupdate, if you set it at a later point.

#

isNil is the way to check if its existing.

pseudo shadow
#

I think I know the answer, but I want to ask anyway.
_lightsource = "#lightpoint" createVehicleLocal _pos;
can the lightsource by made with regular createVehicle on MP? or do I have to send the command to each machine?

spark turret
#

createVehicleLocal πŸ˜„

#

yeah its local. also, lights are kinda dumb in arma. arma has a max amount of lightsources, so if you create more, they might not show, or extinguish old ones. noticable in illuminated cities.

pseudo shadow
#

yeah i'm only creating one

#

but I update it about a dozen times in one script

spark turret
#

just remoteExec the code

pseudo shadow
#

i'll just make some eventhandlers

#

the code spawns models + units, it's just a lack of fore thought on my end

#

so half has to be run on server, half on client's machines

#

well the lights need to be on client's machines

spark turret
#

thats fine, remoteExec does the job well for a central script running on local machines

cerulean cloak
#

How would I get the doors to open on a helicopter? I've got a RHS UH-60M and I've got the list of all animations using animationnames and I've found the one for the back doors. But when I run

blkh_1 animate ["left_back_door", 1, true];
``` nothing happens. I've checked it's the right animation by using the interaction to open the door and checking it's animation phase.
little raptor
graceful pewter
#

Hi all, looking for some help with a script that would cause damage to players if they are not wearing gas masks in a certain area; anyone done that before? thanks!

spark turret
#

i have partly

cerulean cloak
#

I'm not familiar with the config viewer. Roughly where in there should I be looking?

spark turret
little raptor
#

not sure if it should be goggle or headgear

cerulean cloak
#

@little raptor I've got the config viewer open, where would I find the animation source roughly?

little raptor
#

the easies way to get there is to spawn a new vehicle in eden , right click on it and select find in config

cerulean cloak
#

Yeah, I've got that open, I'm not sure where in that animation source would be

little raptor
#

on the left

#

animationSources

cerulean cloak
little raptor
#

expand RHS_UH60m_d

cerulean cloak
#

Plus button on the far left, yeah?

little raptor
#

no double click it

cerulean cloak
#

Ok, I've got animation sources expanded now.

little raptor
#

just use this

#

see which one works

#
{
  blkh_1 animateSource [configName _x, 1];
} forEach ("true" configClasses (configOf blkh_1 >> "animationSources"));
#

@cerulean cloak

#

if any of them work, put a sleep in there to see which one it was

cerulean cloak
#

I ran that and nothing happened to the back doors.

little raptor
cerulean cloak
#

Also nothing.

graceful pewter
cerulean cloak
#

The front doors are disappearing though so it's definitely running.

little raptor
cerulean cloak
#

I will now.

#

Back doors are still shut, front doors reappeared though.

little raptor
#

did you try both?

cerulean cloak
#

Both the thing for anim sources and anim names were tried with 1 & 0.

little raptor
#

Are you sure it can be opened?

cerulean cloak
#

Yes, because when you get in it opens the door for you and when inside it you can use an action to open the door.

little raptor
#

oh wait there's none for opening doors meowsweats

cerulean cloak
#

I'll look in the config viewer for actions or something.

#

Ok, so I've opened the config viewer and for the open door action it animates both dorLB and doorhandler_l

#

I'll try animating both from the debug console and hope that works

winter rose
#

don't animate, animateSource?

cerulean cloak
#
blkh_1 animatedoor ["DoorLB", 1, true];
blkh_1 animate ["DoorHandler_L", 1, true];

That ended up doing the job.

clever radish
#

How do I make GUI display Image1 whenever player clicks on Document1 and Image2 whenever plays clicks on Document2? I already got the list working out

dusky wolf
#

I'm trying to make a trigger activation add an eventhanlder to the player that added it

I'm getting a generic expression error. _thisList didn't seem to do anything. Any clues?

#

Putting this addEventHandler [... in the player init works just fine. I just need it added later in the mission

hushed tendon
hushed tendon
#

I think it has something to do with updating the value of the variables from the addAction

regal night
#

I noticed that the other offroad textures are not available for the offroad hmg. I wanted to know what the textures might be called or if it's possible to change the texture using something like this, this setObjectTexture [0,"0"]; or something like that?

finite jackal
winter karma
#

IS there a way to make a group action? Like eject form a vehicel.
I have a squad of 8 AI,with 8 squads in total so a whole mech platoon. all 43 AI have individual names, two letters and digits so it goes SQ1_1 and so forth. I created "groups SQ_1 = group this;" put that in the init field of each soilder. I want them a leave a airplane on the runway fast. So I have created said waypoints and triggers. I know I can do it individual for each soldier with this "SO1_1 action ["EJECT",tp1];SO1_1 leaveVehicle tp1; (tp1 is the airplane) and prevent them from re entering said airplane. But its tideus for 40 or even more soilders to do it. I would need a group action, like with SQ_1action ["EJECT",tp1] but here is the trick. No SQF scripts.I know ther eis plenty para drop scripts i could use and take inspiration from. But they are external scripts. My goal is to do it all in the editor with triggers and init fields. NO external scripts. has any one a idea or a hint?

regal night
# finite jackal Yes you can use that to change their texture, it will be a string path to the te...

I'm not sure where the civilian textures are located, but I think that there may already be a offroad hmg with civilian textures. My friend remembers using one and so do I. We both specifically remember getting the offroad from the FIA - Cars tab in zeus. Though now looking at the same tab, it appears to be broken. There is three of each of the same vehicle listed and all of them are the same, without civilian textures.

odd bison
#

Hello. I would like to ask you for help. Is there a way how to change type of the playableUnit controled by AI when game is in progress. Thank You
Example:
In editor is placed playableUnit CSAT soldier "O_Soldier_F"
After mission starts, I want to change the playableUnit (AI) to be AAF soldier "I_Soldier_F" with correct uniform, face and voice (language). And remain AAF soldier after respawn as well.
Why:
I would like to make FACTION (side) selection in the lobby for MP scenario.
https://steamcommunity.com/workshop/filedetails/?id=1239940319

odd bison
#

.
I know how to do it hard way.
Change side by : createGroup and then joinSilent
change loadout by: _unit setUnitLoadout "I_soldier_F";
change identity by: setIdentity
But after respawn ,the unit is again CSAT soldier.
There should be a better solution. for example change parameters of the unit defined in the mission.sqm???

west grove
#

pretty sure there is no other solution

#

you will have to apply all that stuff on respawn again

odd bison
#

Thank you

cosmic lichen
#

You use the onRespawn EH and change the side again.

odd bison
#

Thanks @cosmic lichen that's how I do it. I thought there is some more elegant and simple solution I don't know about. πŸ™‚

graceful pewter
#

Is there a way to make an interior pitch black (ie. a tunnel) whilst it is day outside?

distant oyster
winter rose
distant oyster
dusky wolf
#

Thanks. I actually just came back to this earlier and used a _x forEach thisList

distant oyster
#

yeah that is also possible and will take into consideration other units that activated the trigger

distant oyster
# hushed tendon Anyone have any clue why my code isn’t working? pastebin.com/wukCvkUm

your last condition will never execute because the variables will only be updated when the player activates the addaction. so basically your script says this:

if(isServer) then {
    westReady = 0;
    eastReady = 1;
    
    //weather
    sunnyMidday = 0;
    afternoon = 0;
    rainy = 0;
    dusk = 0;
    dawn = 0;
    night = 0;
    
    if(playerSide == west) then { 
        player addAction ["<t color='#ff0000'>Ready Up</t>", { 
            //--- Executed later
        }]; 
    };

    if(playerSide == east) then { 
        player addAction ["<t color='#ff0000'>Ready Up</t>", {
            //--- Executed later
        }]; 
    };
    
    if((westReady > 0) && (eastReady > 0)) then {  // will always be false 
        
        titleText ["<t color='#ff0000' size='3'>Vote for Setting</t><br/>____________________________", "PLAIN", -1, true, true];
        titleFadeOut 3;
    
        player addAction ["Sunny Midday", {sunnyMidday = sunnyMidday + 1;}];
        player addAction ["Afternoon", {afternoon = afternoon + 1;}];
        player addAction ["Rainstorm", {rainy = rainy + 1;}];
        player addAction ["Dusk", {dusk = dusk + 1;}];
        player addAction ["Dawn", {dawn = dawn + 1;}];
        player addAction ["Nightime", {night = night + 1;}];
    
    };  
};
open hollow
#

u will need to use publicvariable "var" to change tha value on server

#

the addaction exec is local, so that values will change on the players, publicvariable updates the value

distant oyster
tribal lark
#

{(_this select 0) this say3D ["YourSoundHere", 100, 1, false, 0];sleep 230;}; is not working on an object. no script error, everything in the mission root and description.ext is correct

graceful pewter
winter rose
#

you could use setApertureNew with entrance detection

willow hound
tribal lark
#

Yeah I figured it out, but thanks

graceful pewter
wispy cave
#

Is it possible to change the value of ace_medical_AIDamageThreshold 'on the fly'? As in, I have a mission with multiple enemy factions and based on which enemy faction is selected at mission start I want to change the value of that variable

exotic flax
#

No you can't; although the threshold is based on (final) damage, so after armor values are calculated. So if you want faction A be stronger than faction B, simply give them better gear with higher armor values.
Or you could try to hook into the damage event handler (is different for ACE), and modify the given damage when an unit is of a specific faction.

wispy cave
#

The current problem is that we have factions without armor and factions with level 3 armor and although we want there to be a noticeable difference, the difference is a bit too much to our liking at the moment. But i'll have a look at hooking into the damage event handler

slim oyster
#

I would be interested in altering the ACE damage handler to have minimum final damage applied

timid niche
#

Is the following function type local or global? It's not mentioned on the wiki.

BIS_fnc_addVirtualXCargo
slim oyster
#

param for global effect

timid niche
#

ahh I see

#

im dumb

slim oyster
#

1 global var is okay if you just want to alter general threshold of course but handling the armor specifically with some modifiers or applying min damage/ max damage resistance would be nice

#

terrible armor configs + armor damage handling = some enemies incredibly easy to kill some impossible

dreamy kestrel
#

I have an interesting scenario... Q: given, [_pos, _radius] ... is there a way to determine whether that spot is "over land"? i.e. I want to reject when it is entirely over a body of water, let's say.

winter rose
#

you can check surfaceIsWater every 10cm or so

dreamy kestrel
dreamy kestrel
#

of course I could lay down a grid as such and ask if any of those positions are over water... but it's a bit much for the question being asked I think...

strange seal
#

it's been awhile since I've worked with scripting so I'm a bit rusty, but I'm trying to improve a script I was working on, I'm trying to figure out how to name markers that get created on map clicks but don't want to have a limit (like having 3 or so pooled for use) my original thought was to have a variable count up each time they click and append that to the name with toString or something, anyone have anything helpful?

little raptor
hushed tendon
clever radish
woeful sundial
#

hi i have a question: i'm trying to fetch allMapMarkers from the server with a mission containing only user defined markers and i noticed that the list of markers retuned by allMapMarkers is local on the client that created the marker does someone knows a command to retrieve the whole marker list from the server?

little raptor
woeful sundial
#

can you give me a brief example

little raptor
strange seal
#

@little raptor that makes sense, thanks!

woeful sundial
#

ohh i know what you mean i was using something similar to test things [[],{ [allMapMarkers,{hint str(_this)}] remoteExec ["call",remoteExecutedOwner] }] remoteExec ["call",2]; thanks for the suggestion, time to rewrite everything πŸ₯²

still forum
#

you just set westReady to 0, so it cannot possibly be bigger than 0

hushed tendon
still forum
#

no

#

you do that some time later

#

but not between setting westReady to zero, and checking if westReady is bigger than zero

hushed tendon
#

I'm confused. Can you give me an example?

still forum
#

already posted that above?

hushed tendon
#

on how to update the value (+1) of westReady so that section of code isn't false

still forum
#

with your code not possible

#

what you do:
Set to 0
Check if bigger than zero
Player will use action to set to bigger than zero

#

in this order

#

you need to check after its bigger than zero

#

maybe it makes sense to do that check in your action

#

Also that complete code is nonsense anyway

#

because you check "isServer", unless you are local hosting, which most people will not be, player will not be valid, and you also can't add actions on a server, the server has no UI

hushed tendon
#

I'm trying to make a voting system that will check if a certain amount of players are marked as "ready" and then allow them to vote for the type of weather. You think you could point me in the right direction?

still forum
#

remoteExec, while/waitUntil loop, spawn

hushed tendon
runic surge
#

Apologies for interrupting, but is it no longer possible to use non-mission script files with file patching enabled? I have it enabled in my parameters but any scripts I try to execute (that worked before) simply return the script not found error.

Normally I have script files in this directory: C:\Users\Rylan\Documents\Arma 3 - Other Profiles\Rylan\scripts and can execute them from the debug menu in game in any mission. But I can't seem to do that at the moment

queen cargo
#

@still forum could we get a command to "assign" a final method? Like... Not having to Str the method first

clever radish
#

How do I display a custom image in GUI display box? I got the button to show and all, but I don't know how to show the image.

distant oyster
clever radish
queen cargo
#

Meh

distant oyster
clever radish
queen cargo
#

Because.. fnc = compilefinal "Code" horrible, parsing wise, is πŸ˜‚

#

And fnc = asFinal {...} much cleaner

little raptor
#

oh so you mean make the code final (instead of compiling string and finalizing it)

#

yeah that makes sense

orchid stone
#

hey guys, trying to get removeaction to work over remoteexec. found this on a forum but doesn't seem to be working.

[_unit,_index] remoteExec [ "removeaction", 0, true ]

not sure what im troubleshooting since i couldnt find better documentation on this combo. just want to make sure the structure looks correct before i dive deeper.

#

nevermind, i see in the doc now that it recommends creating a function that does this client side thats executed from the server (not using commands)

#

will make that issue irrelevant

strange seal
#

is there a simple way to only open the map for someone who uses a radio call? I've googled it and most I can find is using communication menu thing but I'm not quite to the level of doing that I think

#

to clarify I'm trying to make it so the map doesn't open for other players in an MP setting

strange seal
#

@little raptor the simple trigger thing, select radio alpha/bravo/charlie etc.

little raptor
#

Ok

#

so what's the problem?

#

the map opens for everyone when you do that?

strange seal
#

yeah

#

it's not too big an issue but it would be nice if I could keep it just to the person calling it, like I said I think communication menu makes it doable but right now I'm just scripting in triggers on the map rather than actual scripts in the mission file and such so I'm not too familiar with making classes and all that

little raptor
#

if you use eden triggers they will be global

strange seal
#

yeah, I figured it wouldn't hurt to ask, I'll just put it in my todo list, thanks for the help!

hollow lantern
#

whats an efficient way to let a choppper land smoothly?
I'm currently using a move waypoint to let the chopper fly to the position. About 500m before the destination I delete the waypoint and then use a _aircraft LAND "GET OUT"; to make him land and eject troops.
Issue here is that the chopper then goes from height 28 to height 70 before actually touching down instead of just descending right away to the helipad.

#

especially under enemy presence that certainly makes the chopper a easy target because he suddently is now above all houses and anyone can spot him. No big deal for the chopper pilot as he has been given the proper care of sqf { _x disableAI "AUTOCOMBAT"; _x disableAI "AUTOTARGET"; _x disableAI "TARGET"; _x disableAI "CHECKVISIBLE"; } forEach [driver _aircraft];

#

but still the landing is weird. I already tried to play around with flyInHeight but this depending on the height makes the chopper dead slow

spark turret
hollow lantern
hollow lantern
spark turret
#

Sometimes ai is dumb and just cant be helped

hollow lantern
#

wouldn't be Arma if it where no issue

hushed tendon
#

@still forum In the code from earlier I still can't get the

if((westReady > 0) && (eastReady > 0)) then { };

to work even when westReady and eastReady = 1.

spark turret
#

Explain your problem

still forum
#

"even when westReady and eastReady = 1." how did you check that?

little raptor
#

you must increase the values on the server

#

it seems like that was what you were doing (if isServer then {...})

#

no publicVariable is necessary

#

just remoteExec

#
[{
westReady = westReady + 1; 
call some_fnc_checkready;
}] remoteExec ["call", 2];

fnc_checkready:

if (westReady > 0 && eastReady > 0) then {
...
};
#

or even better

#
[1] remoteExec ["some_fnc_checkready", 2]; //1 for west, anything else for east

fnc_checkready:

params ["_sideID"];
if (_sideID == 1) then {
  westReady = westReady + 1;
} else {
  eastReady = eastReady + 1;
};
if (westReady > 0 && eastReady > 0) then {
...
};
#

p.s: are you sure that those values are initialized?

hushed tendon
#

I’m not that great at this so I’m not sure

#

And thanks for those examples

hushed tendon
still forum
#

the if statement only runs once

#

you know that?

#

thats what I was trying to tell you

little raptor
#

@hushed tendon

the if statement only runs once
which is why I used that function. I had a hunch you were doing that

hushed tendon
#

😯 I’m dumb

#

I understand now

spark turret
#

all code only runs once, when you start the script. you have to specifically tell it to run multiple times, using loops or recursion

little raptor
#

loops are bad

#

use "event handlers"

#

as in my code

#

you only call the code when the values actually change

spark turret
#

eventhandlers are like flares the game shoots up whenever it does something special, so you code knows immediatly its happening. way faster and more performance friendly than contanstly checking

hushed tendon
#

Okay

hollow lantern
#

@spark turret I did the following now:

             waitUntil {(_aircraft distance _destination) < 800};
                _aircraft limitSpeed 50;```
works so far and the chopper slowed down pretty nicely. Still at about 50 clicks from the helipad (_destination) the chopper suddently skyrocketed in the air. Video of that: https://dl-cdn.knight-industries.org/2021-03-06_03-06-32.mp4
#

maybe I need to slow him down even more?!

vague nebula
#

I don't see what the issue was. I mean this looked good to me are you talking about the portion where it rose in altitude a little higher to make sure it it landed properly?

#

Like when it basically pulled a vertical in the air? Cause your code here looks fine you could try limiting speed lower and play around with that. Though I don't have much experience with SQM I believe this is, correct me if I am wrong though.

hollow lantern
#

exactly, it veticaled in the air

#

unnecassery in my opinion

#

because with the current altitude the chopper had he would have to turn his stick just forward to get over the helipad and then just descend

vague nebula
#

Yea it almost looked like it didn't wanna come in too hot, so purposely rose in the air for some odd reason LOL. I agree with that.

#

Or he could have slowed down even further.

hollow lantern
#

I mean he did from 50 to 12 km/h but in a weird way

vague nebula
#

right. I am sorry I can't offer you as great as advice as other scripters here as I haven't scripted in arma before. Though I believe you could maybe try to see if you can have him stay his current altitude till he reaches above the airpad.

hollow lantern
#

I mean I could also say flyInHeight and set that to a lower value. we'll see

vague nebula
#

Ye I would play around with that, and maybe tweak your speed. Cause what you have there with that function or wait until IF statement seems to logically work fine.

hollow lantern
#

yeah it works, just hate doing so much static stuff instead of having a dynamic AI work they way I would like :D

vague nebula
#

Yup I feel you.

#

I mean I create games occasionally on the side and when the ai fails to do things annoys me.

tough abyss
#

any way to check if a player has a certain peice of clothing equipped say like the blootooth headset for the face slot

exotic tinsel
#

is there an event for detecting when player changes weapon? im not seeing one in the EH list. Do we have to hijack animation changed or something?

hollow lantern
#

@spark turret @vague nebula okay so I played around with both flyInHeight and limitSpeed aka:

                waitUntil {(_aircraft distance _destination) < 800};
                _aircraft limitSpeed 50;

                _aircraft flyInHeight 50;
                waitUntil {(_aircraft distance _destination) < 500};

                _aircraft limitSpeed 10;
                _aircraft flyInHeight 30;
                ```
outcome is, that at the end the chopper still ignores the limits I have set and well , makes a vertical climb to 200ft (about 70 meters) until he descends again and lands.
#

Arma is weird sometimes :(

vague nebula
#

I think its a safety thing to prevent from like crashing LOL

#

I know it may look awkward but I would just leave it and call it the ai pathfinding trying to be safe

hollow lantern
#

technically no, according to the wiki of flyInHeight --> Avoid too low altitudes, as helicopters and planes won't evade trees and obstacles on the ground. The default flying altitude is 100 meters.

vague nebula
#

ah

tough abyss
#

@hollow lantern are you giving the helo sufficient time to slow down using these commands because i have succesful used these to commmands on waypoints to have a helo perform a stealth insertion

#

just slap them commands in a waypoint

hollow lantern
#

@tough abyss well can you give an example how spaced out your waypoints are? As from my code above I limit his speed to 50 when the chopper is 800m away from the target. If he is 500m away he gets limited to 10

tough abyss
#

honestly it should work when i did this using these commands in a waypoints it worked the problem is you are asking the ai to go from top speed to 50 the instant it hits 800 meters gradually slow it down over a longer distance distance

#

what airframe are yyou using ghost hawk

hollow lantern
#

MH-6 Littlebird which tops at 120km/h

tough abyss
#

so make it slow to 100 at 1.5km, 100 at 1km, 80 at 800m, 60 at 650m, 50 at 500m 30 at 250m, 20 at 100m, 10 at 50m and ensure the flight path is actualy clear at the altatude you want to fly at or the ai will path find over obsticals or chrash

#

it dosnt matter how much you throtal down even a player cant go from 120 to 50 instantly without balloning into the sky

hollow lantern
#

will try that later, thanks

tough abyss
#

are you trying to make this dynamic as in it will do this any where or is the aircraft on a strict flight path

hollow lantern
#

dynamic is the goal

#

and aside from the flight path everything so far works

#

just the vertical sky-rocketing was my last issue

#

lol

tough abyss
#

yeah you got to gradualy slow em down the way you have it atm is at 800m eters i want you to go from 120 to 50

you try doing that in a chopper without gaining height

#

how do a add a minimum distance for the addaction command ive forgoton and the video i used to figure it out i cant find anymore

little raptor
dusky pier
#

Hello, is possibe to somehow enable sound with say3D from hc to players?
(i attached sound to object, but when players near - they don't hear sound, it seems like local)

slim oyster
timid niche
#

Is there a way to limit the vehicle garage to certain vehicles?

glass zinc
#

Ok so im trying to use allTurrets instead of a custom script to get veh positions before the veh spawns in on the map. is this possible? I would also like to use fullcrew as well. anyone have any tricks to do this? I also have questions about allTurrets speed 0.0017 ms
vs BIS_fnc_allTurrets 0.0421 ms
why is BIS_fnc_allTurrets so much slower?

rancid mulch
#

bis_fnc_allturrets uses a vehicle class, so if you want checking before the spawn, you need to use it. allTurrets command only works on objects. So you need to spawn it.

glass zinc
#

kk

#

im using a custom script right now that checks veh class its running at 0.0146 ms it is using compileFinal preprocessFileLineNumbers is that why it is faster then the BIS function? would the bis fuction be faster if it did the same thing to it?

rancid mulch
#

look into the code and look out for differences.

glass zinc
#

how do I see the bis function code?

rancid mulch
#

function viewer in the editor

glass zinc
#

kk thx

wet shadow
#

Hello people, any tips on how to add a sub-array into an existing array?

_array1 = [0,1,2];
_array2 = [a,b,c];
???
_desired_array = [0,1,2,[a,b,c]];
rancid mulch
#
_array1 pushback _array2; //_array1: [0,1,2,[a,b,c]]
_array1 set [4, _array2];  // _array1 : [0,1,2,[a,b,c]]
_array1 append [_array2];  // _array1 : [0,1,2,[a,b,c]]
_desired_array = _array1 + [_array2]; // _desired_array: [0,1,2,[a,b,c]]

to learn more about the differences check out the wiki: https://community.bistudio.com/wiki/Array

vague nebula
#

See Its interesting cause to me in c++ adding an array to an array would probably make it a multi dimensional array LOL. Though I wouldn't be sure what the out come of pushing another array into an already existing array would be.

strange seal
#

So I'm trying to make it so a red smoke/chemlight gets spawned when a unit becomes incapacitated, I figured that would be easy with event handlers but I can't find one for vanilla and attempts with ACE EH's don't seem to work any ideas?

cosmic lichen
#

Then spawn the item

strange seal
#

thanks for the response! I was thinking about doing that, looks like I might have to, framerate probably won't like it too much πŸ˜› but it's only going on playable units so it can't be too bad

cosmic lichen
#

EHs are no problem

hushed tendon
# little raptor ```sqf [1] remoteExec ["some_fnc_checkready", 2]; //1 for west, anything else fo...

I ran this with the remoteExec in the player addAction with a hint in the fnc but the hint never showed up. The code is (the fnc_checkReady)

[missionNamespace, "fnc_checkReady", { hint "The event handler runs";
  params ["_sideID"];
if (_sideID == 1) then {
  westReady = westReady + 1;
} else {
  eastReady = eastReady + 1;
};
if (westReady > 0 && eastReady > 0) then {
hint "It Works!";
};
}] call BIS_fnc_addScriptedEventHandler;```
little raptor
agile pumice
#

I'm hoping someone can help me solve this problem. I want to have a switch do block for performance reasons, but I want to have a condition to check for a patch class to use more cases inside the block. example:

switch (true) do {
  default {true};

  /*if (isClass "A3_Data_F_Exp") then {
    #include "..\include\canPlayerKickDoor_Apex.sqf"
  };
  if (isClass "A3_Data_F_Contact") then {
    #include "..\include\canPlayerKickDoor_Contact.sqf"
  };*/

  case (_building isKindOf "Land_i_Barracks_V1_F"): {
#

the sqf's just contain more cases

#

can I accomplish this while still using a switch do block?

little raptor
#

@agile pumice use hashmaps

#

do you execute some code or does it simply return true false?

#

like this default {true};

agile pumice
#

it just returns true false

little raptor
#

so for some cases true for some false?

agile pumice
#

there isn't a case that returns true. false is the default return above the switch do block

little raptor
#

then just use hashmaps or arrays

agile pumice
#

I've never used hashmaps before so this will be a joy to figure out

little raptor
#

since you use isKindOf hashmaps are not suitable

#

just use array

#

and findIf

#
["Land_i_Barracks_V1_F", "Land_blabla_F"] findIf {_building isKindOf _x} == -1
#

that's it

#

@agile pumice if you meant to use EXACT matches (not derived objects) then use hashmaps (with get) or arrays (with find)

agile pumice
#

nah, I wanted to check against a parent class to save time making a case block for every child building variant

little raptor
#

then use the code above

agile pumice
#

So I'd be eliminating the switch block right?

#

and then pushback the array if a patch class is valid? that's brillant

little raptor
#

yes. that's your "switch block" now

hushed tendon
little raptor
# hushed tendon So instead of the "event handler" would I spawn a section of code with the remot...

Make a function:
https://community.bistudio.com/wiki/Arma_3:_Functions_Library#Adding_a_Function
this creates Some_fnc_checkReady:

class CfgFunctions
{
    class Some
    {
        class someCategory
        {
            file = "path\to\folder\fn_checkReady.sqf";
            class checkReady {};
        };
    };
};

Alternatively:
to call that BIS fnc simply use this:

[missionNamespace, "fnc_checkReady", [1]] remoteExec ["BIS_fnc_callScriptedEventHandler", 2];
#

actually that won't work

#

missionNamespace is local

#
[{[missionNamespace, "fnc_checkReady", [1]] call BIS_fnc_callScriptedEventHandler}] remoteExec ["call", 2];
#

this will work

#

but you're better off with the function method

hushed tendon
#

Got it

#

And the CfgFunction can be in the same sqf as all the other code so far?

little raptor
#

if you're making a mod it goes in config.cpp

#

if it's a mission it goes in description.ext

hushed tendon
#

Alright

strange seal
#

@cosmic lichen so I did as you suggested, dammage handler with an if statement, I have 2 test subjects with the exact same event handlers in their init, but it never works on the second one, whichever I shoot first spawns the smoke and chemlight, but the second one doesn't, any further advice?

broken forge
#

I'm working on a download intel script with an animation loop but I'm finding it difficult to get the animation loop to work along side the hintSilent.

little raptor
#

@broken forge ```sqf

#

see the pinned messages

broken forge
#
_maxDistance = 5;
_timePerPercent = 1;

if(laptop getVariable ["inUse", false]) exitWith {hint "Someone is Already Downloading the Files."};

laptop setVariable ["inUse", true, true];

hint format ["The Download Will Start in 3 Seconds. Stay at Least %1 Meters Away From the Laptop", _maxDistance];
sleep 3;

for "_i" from 1 to 100 do {
    if (player distance laptop > _maxDistance) exitWith { hint format ["Download Canceled : You are %1 Meters Away From the Laptop", _maxDistance]; laptop setVariable ["inUse", false, true];};

    player switchMove "acts_accessing_computer_in";

    sleep _timePerPercent;
    hintSilent format ["Download In Progress... %1%2", _i, "%"];

    while {_i < 100} do {
        player playMove "acts_accessing_computer_loop";
    };

    player playMove "acts_accessing_computer_out_short";
};

if (player distance laptop < _maxDistance) then {
    hint "You Have Successfully Downloaded MLP_s05_1080p_x264";

    myGlobalTriggerVar = 1;
    player addRating 200;
    player setDamage 0;
    "Box_East_WpsSpecial_F" createVehicle position player;
};
strange seal
#

@little raptor this addEventHandler ["Dammaged", {params ["_unit"]; status = lifeState _unit;
if(status == "INCAPACITATED")
then {
"ModuleSmokeRed_F" createUnit [getPosATL _unit, modulegroup,"this setVariable ['BIS_fnc_initModules_disableAutoActivation', false,true];"];
"ModuleChemlightRed_F" createUnit [getPosATL _unit, modulegroup,"this setVariable ['BIS_fnc_initModules_disableAutoActivation', false,true];"]
};

}];

#

making the status variable for lifestate was me troubleshooting, not sure it's necessary

little raptor
# broken forge ```sqf _maxDistance = 5; _timePerPercent = 1; if(laptop getVariable ["inUse", f...

Remove the while.

_maxDistance = 5;
_timePerPercent = 1;

if(laptop getVariable ["inUse", false]) exitWith {hint "Someone is Already Downloading the Files."};

laptop setVariable ["inUse", true, true];

hint format ["The Download Will Start in 3 Seconds. Stay at Least %1 Meters Away From the Laptop", _maxDistance];
sleep 3;
player switchMove "acts_accessing_computer_in";
player playMoveNow "acts_accessing_computer_loop";
for "_i" from 1 to 100 do {
    if (player distance laptop > _maxDistance) exitWith {
      hint format ["Download Canceled : You are %1 Meters Away From the Laptop", _maxDistance]; 
      laptop setVariable ["inUse", false, true];
    };

    sleep _timePerPercent;
    hintSilent format ["Download In Progress... %1%2", _i, "%"];
};
player playMoveNow "acts_accessing_computer_out_short";
if (player distance laptop < _maxDistance) then {
    hint "You Have Successfully Downloaded MLP_s05_1080p_x264";

    myGlobalTriggerVar = 1;
    player addRating 200;
    player setDamage 0;
    "Box_East_WpsSpecial_F" createVehicle position player;
};
#

(also changed the code flow)

broken forge
#

@little raptor Thank you so much, I've been working on this for a few hours now, lol

little raptor
strange seal
broken forge
#

@little raptor Will this script work as intended in mp?

little raptor
#

depends

#

how do you call it?

vague nebula
#

So what is SQF or SQM a subset of exactly? Is like SQL scripting?

#

Or is it arma's own scripting language?

little raptor
#

its own language

vague nebula
#

Oh interesting. So its a language they came up with that's awesome. Ye I was just interested cause I am a coder in general so I wanted to know what SQF was. I assume its object oriented language as well?

little raptor
#

no

#

procedural

#

but not statically typed

vague nebula
#

Ah. I see interesting.

fresh wyvern
broken forge
#

@little raptor By an addAction in the init field of the laptop, I'm also trying to get the weapon to be put on back so I'm not holding it when in the animation

fresh wyvern
#

And then set an other objective relative to it?

little raptor
#

@broken forge When you put something in init, it gets executed for everyone every time someone connects to the server, so people get duplicate addActions

little raptor
fresh wyvern
#

I intend to offset an object in regards to an other object without taking into account which way the first object is facing.

broken forge
#

@little raptor initPlayerLocal.sqf: sqf laptop addAction ["Download Intel", {[] execVM "scripts\downloadIntel.sqf"}, nil, 2, true, true, "", "!(_target getVariable['inUse', false])"];

little raptor
little raptor
tough abyss
#

Hey everyone, I've made a mission that uses a radiation script, that mainly adds radioactive geiger counter sounds. However whenever I move the files into the .pbo it makes it so that after choosing a role on the dedicated server it loads infinitely. I've already found a error in the code with some help, but didn't seem to fix it. DM me for more information. All the help is appreciated!

little raptor
tough abyss
#

Ok I will thank you.

broken forge
#

@little raptor The laptop is a one and done, the next thing I like to add to the script is a way to hide the weapon when a player is in the animation loop. As of right now when the player is in the animation loop they're holding on to their gun, which throws off the realism

little raptor
broken forge
#

Oh, ok, that sounds easy, lol

strange seal
#

@little raptor this addEventHandler ["Dammaged", {params ["_unit"];
if(lifeState _unit == "INCAPACITATED")
then {
_smoke = "ModuleSmokeRed_F" createUnit [getPosATL _unit, modulegroup,"this setVariable ['BIS_fnc_initModules_disableAutoActivation', false,true];"];
_light = "ModuleChemlightRed_F" createUnit [getPosATL _unit, modulegroup,"this setVariable ['BIS_fnc_initModules_disableAutoActivation', false,true];"]
};

}];

little raptor
#

@strange seal plz use ```sqf

#

see the pins

strange seal
#

@little raptor sorry, I'm not sure how but I'll figure it out

broken forge
#

@little raptor I just realized that not every player is going to have the same weapon, how do I work around this?

little raptor
#

then add it

strange seal
#

tried to make it more specifically local but it's doing the same thing, my next step is to put a hint or systemChat in to make sure it's executing but I have to run out real quick, thank you for all the help!

vague nebula
#

Oh ye that's true you could have a function that gets player weapons and possibly assign it to an array if thats a thing in SQF. though that maybe an issue since the array would get large.

little raptor
vague nebula
tough abyss
#

description.ext

#

yikes didn't meant to send that

little raptor
vague nebula
broken forge
#

@little raptor ```sqf
_maxDistance = 5;
_timePerPercent = 1;

if(laptop getVariable ["inUse", false]) exitWith {hint "Someone is Already Downloading the Files."};

laptop setVariable ["inUse", true, true];

primaryWeapon player;
primaryWeaponItems player;
player weaponAccessories primaryWeapon player;

secondaryWeapon player;
secondaryWeaponItems player;
player weaponAccessories secondaryWeapon player;

handgunWeapon player;
handGunItems player;
player weaponAccessories handGunWeapon player;

hint format ["The Download Will Start in 3 Seconds. Stay at Least %1 Meters Away From the Laptop", _maxDistance];
sleep 3;

player switchMove "acts_accessing_computer_in";
player playMoveNow "acts_accessing_computer_loop";

for "_i" from 1 to 100 do {
if (player distance laptop > _maxDistance) exitWith {
hint format ["Download Canceled: You are %1 Meters Away From the Laptop", _maxDistance];
laptop setVariable ["inUse", false, true];
};

sleep _timePerPercent;
hintSilent format ["Download In Progress... %1%2", _i, "%"];

};

player playMoveNow "acts_accessing_computer_out_short";

if (player distance laptop < _maxDistance) then {
hint "You Have Successfully Downloaded MLP_s05_1080p_x264";
};

tough abyss
#

Hey everyone, I've made a mission that uses a radiation script, that mainly adds radioactive geiger counter sounds. However whenever I move the files into the .pbo it makes it so that after choosing a role on the dedicated server it loads infinitely. I've already found a error in the code with some help, but didn't seem to fix it. DM me for more information. All the help is appreciated!
decription.ext
https://sqfbin.com/jubiforukulipowodogu
init.sqf
https://sqfbin.com/qozititevumefejerehe
initPlayerLocal.sqf
https://sqfbin.com/jawayecusokidewipiza
** Also has Sound and Img folders** Would you like to see other script folders just lemme know!

little raptor
little raptor
#

store them in a variable

hushed tendon
#

So I got it to work by throwing stuff together and this is the product.
https://pastebin.com/J3Lg1sBW
However I get an error in

call BIS_fnc_addScriptedEventHandler]; remoteExec [2];

right before the remoteExec.

little raptor
#

@broken forge the easiest way would be to store the whole player loadout.
and remove the weapons from it:

_loutOut = getUnitLoadout player;
_backupLoad = +_loudout;
for "_i" from 0 to 2 do {
  _loudout set [_i, []];
};
player setUnitLoadout _loadout;

//for loop here...

player setUnitLoadout _backupLoad;
hushed tendon
#

makes sense

#

Do I not need the remoteExec there?

little raptor
#

@hushed tendon the remoteExec was for the voting system

#

not for the server script

#

remove that

hushed tendon
#

ok

little raptor
#

@hushed tendon i mean this:
call BIS_fnc_addScriptedEventHandler]; remoteExec [2];

remove the remoteExec and [] around the BIS_fnc_addScriptedEventHandler

hushed tendon
#

Yep, it works now with no errors. Thanks!

little raptor
#

@tough abyss it's a really bad script. lots of performance issues

tough abyss
#

@little raptor Really? I want it soo baddly to work.

little raptor
#

you can make it work

#

it's just not written properly

tough abyss
#

@little raptor I just want that wonderful radiation sound.

little raptor
#

will cause a lot of performance problems on the server

tough abyss
#

Even if it's written properly?

little raptor
#

I haven't seen your entire script so idk

you're using a lot of bad practices
for instance:

execVM "AL_radiation\al_ini_fnc.sqf";

waitUntil {!isNil "glowindark"};

tough abyss
#

So basically. As long as I get the sound of radiation. Not even like the damage, the glowing or any of the effects. Is there a way.

tough abyss
#

It works fine on singleplayer, hosted locally, but not dedicated.

#

@little raptor I know, I dont know code, but I cant figure out the basics.

little raptor
broken forge
#

@little raptor Should my init.sqf include this: ```sqf
laptop setVariable ["inUse", false, true];

tough abyss
#

@little raptor Well, I know it's not good code, as long as it works i'm fine with that. I just can't seem to get it to work. Do you wanna get into a call?

little raptor
#

no

tough abyss
#

ok XD

little raptor
#

@tough abyss this is a simplified (but better) script. It gives you the sound you want:
initPlayerLocal.sqf

_radioActiveObjs = [obj1, obj2, ...];
_geigerPlayTime = 5; //set the sound playTime here
while {alive player} do {
  if (_radioActiveObjs findIf {player distance _x < 10} != -1) then {//player is closer than 10m to one
    (player getVariable ["geigerSound", [objNull, 0]]) params ["_soundObj", "_endTime"];
    if (!alive _soundObj || time > _endTime) then {
      deleteVehicle _soundObj;
      _soundObj = "#particlesource" createVehicleLocal [0,0,0];
      _soundObj attachTo [player, [0,0,0], "head"];
      _soundObj say3D ["geiger", 10];
      player setVariable ["geigerSound", [_soundObj , time + _geigerPlayTime]];
    };
  } else {//optional; delete Sound source to stop the sound
    deleteVehicle ((player getVariable ["geigerSound", [objNull, 0]]) select 0)
  };
  sleep 1;
}

of course you could just use the player as sound source and not create/delete anything, which is even faster

tough abyss
#

you made that my guy. Wow

little raptor
tough abyss
#

so basically, from what i've seen it has a playtime? Shouldn't it play as long as your near an object?

#

Rest looks pretty sick

little raptor
#

playtime is the duration of the sound

#

in seconds

tough abyss
#

oh so it'll just repeat?

little raptor
#

yes

tough abyss
#

awesome my guy. Do you the faulty sound script was perhaps the reason why the loading was infinte?

tough abyss
#

Yessssssssssssssss

little raptor
#

probably due to the use of sleep during loading screen

tough abyss
#

I'm going to try it!

#

Thanks man I super duper appreciate it.

little raptor
tough abyss
#

Ok, I won't lol πŸ˜†

fresh wyvern
#

Where do I go wrong. The vehicle always lands on the ground. It never comes in flying:

_veh = "B_Plane_Fighter_01_F" createVehicle(position player vectorAdd [-2000 ,0,5000]);
_veh flyInHeight 500;

player moveInDriver _veh; 
vehicle player engineOn true;

_veh setDir 90; 
_veh = nil;
fresh wyvern
#

I added a position 5000 meter above ground, I've tried the flyinheight function

little raptor
fresh wyvern
#

ok thanks

little raptor
#

to observe the flight height

tough abyss
#

@little raptor Yessir

little raptor
#

@fresh wyvern use the alternative syntax for createVehicle, set placementspecial to "FLY"

fresh wyvern
#
_veh = createVehicle ["B_Plane_Fighter_01_F", position player vectorAdd [-2000 ,0,5000], [], 0, "FLY"];

player moveInDriver _veh; 
vehicle player engineOn true;

_veh setDir 90; 
_veh = nil;
broken forge
#

@little raptor Thanks for all the help, I've also converted it to a function for a mission I'm working on, and everything is working great. I'm starting to work on another script which uses some of the default game functions by bis

#

Do I even need the if (isServer) then {} for the script to work on a dedicated server? ```sqf
if (isServer) then {
trg = createTrigger ["EmptyDetector", getMarkerPos "marker_0"];
trg setTriggerArea [300, 300, 0, false];
trg setTriggerActivation ["WEST", "PRESENT", false];
trg setTriggerStatements ["this && !isnil 'alert'", "wp1 = grp4 addWaypoint [getMarkerPos 'marker_0', 0];", ""];

grp0 = [getMarkerPos "marker_0", EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault")] call bis_fnc_spawngroup;
[grp0, position leader grp0, 300] call bis_fnc_taskpatrol;

grp1 = [getMarkerPos "marker_1", EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call bis_fnc_spawngroup;
[grp1, position leader grp1, 300] call bis_fnc_taskpatrol;

grp2 = [getMarkerPos "marker_2", EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad_Weapons")] call bis_fnc_spawngroup;
[grp2, position leader grp2, 300] call bis_fnc_taskpatrol;

grp3 = [getMarkerPos "marker_3", EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call bis_fnc_spawngroup;
[grp3, position leader grp3] call bis_fnc_taskdefend;

grp4 = [getMarkerPos "marker_4", EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Mechanized" >> "OIA_MechInf_Support")] call bis_fnc_spawngroup;
[grp4, position leader grp4] call bis_fnc_taskdefend;

alert = false;

{
    _x addEventHandler ["firedMan", {
        deleteWaypoint [grp4, 1];
        [grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;
        _x removeEventHandler ["firedMan", _thisEventHander];
        alert = true;
    }];
} forEach (units grp0 + units grp1 + units grp2 + units grp3 select {side _x isEqualTo EAST});

};

still forum
#

A switch is just a fancy looking chain of if statements

little raptor
broken forge
#

@little raptor it's called from the initServer.sqf: ```sqf
[] call JAS92_fnc_spawnGroupsEast;

little raptor
#

I mean JAS92_fnc_spawnGroupsEast

broken forge
#

just once

little raptor
#

then why do you make it a function?

fair drum
#

FSMs should be better than switch blocks I think

little raptor
#

depends

hushed tendon
#

Is there a way to give an addAction to every player and only one side at a time?

little raptor
#

wdym one side at a time?

hushed tendon
#

Give the addaction to blufor only

broken forge
#

@little raptor I would like to do something in which creates some strong points around a map for missions, and I liked the organization. I would also like to implement an aspect in which if you wait long enough the ai will forget about you, as well as implementing a dead body detection.

fair drum
#

Look at the condition section of add action

#

Since they are local you can do a compare of the players side.

strange seal
#

@little raptor added debug messages to the smoke/chemlight spawning then statement and the messages pop up, so it's gotta be something with the spawning of the modules... I saw commands that could force AI to fire weapon or something but would that work if they're unconscious?

hushed tendon
little raptor
little raptor
hushed tendon
little raptor
hushed tendon
#

something like this?

if(playerSide == west) then { 
    ...
};```
hushed tendon
#

and that alone will give it to each player of that side?

little raptor
#

depends where you're running that

hushed tendon
#

anywhere I should run it specifically?

little raptor
#

for addAction initPlayerLocal.sqf

strange seal
#

@little raptor got it workin! I was dumb and had a global group for all the modules instead of making one that deletes when empty each time the then statement gets triggered

broken forge
#

@little raptor I'm trying to implement a killed EventHandler that causes the AI to forget about the player(s) after some time has pasted and then return to normal to the spawn script: https://sqfbin.com/zesusaheledudorilegu

spark turret
#

line 54 will probably only check for the last group if its side EAST.
} forEach (units grp0 + units grp1 + units grp2 + units grp3 select {side _x isEqualTo EAST});

#

line 7 to 20 would like to become a foreach loop πŸ˜›

#

also all your checks for the side of the units in a group is unnecessary bc the groups are all side EAST

#

your variable names are very confusing, enemy this enemy that

#

uh i have never used apply, but it lookes like a fold-list command. i dont think its meant to be (ab) used as a foreachloop.
instead, try:

_killerBuddies = units (group _killer);
{
  _xEnemy = _x;
  {
    _xEnemy forgetTarget _x;
  }foreach _killerBuddies;
} foreach _enemies;

also: maybe its enough to run the forget command for the enemy groups leaders, bc groups have "cloud" knowledge, aka all members share the same knowledge. dont quote me on that tho.

code above is untested

#

@broken forge

broken forge
#

@spark turret I'll give that a try, so what exactly would I replace?

spark turret
#

The apply part

hushed tendon
#

Can you not sleep in an event handler? And if not how could you wait?

spark turret
#

[] spawn {sleep 1; hint "uwu"};

#

You can spawn code which allows sleep from the eventhandler

hushed tendon
#

Alright. uwu

broken forge
#

So then my script will look like this: ```sqf
{
_x addEventHandler ["firedMan", {
deleteWaypoint [grp4, 1];
[grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;
_x removeEventHandler ["firedMan", _thisEventHander];
alert = true;
}];

    _x addEventHandler ["Killed", {
        params["_unit", "_killer"];

        private _enemies = (units grp0 + units grp1 + units grp2 + units grp3 select {side _x isEqualTo _unit});

        _killerBuddies = units (group _killer);
        {
            _xEnemy = _x;
            {
                _xEnemy forgetTarget _x;
            } foreach _killerBuddies;
        } foreach _enemies;
    }];
} forEach (units grp0 + units grp1 + units grp2 + units grp3 select {side _x isEqualTo EAST});
spark turret
#

Yeah that should work

#

Btw, if you want the unit to be alerted after they fired, maybe you like the suppressed EH. It fires when a bullet hits close to the unit. Could use that in addition, sometimes the AI cant fire back, like at snipers f.e.e

hushed tendon
spark turret
#

You dont use the spawned code to sleep inside the EH, but you basically spawn a new branch whicj can be suspended. So you sleep first and in the spawned code do more of the stuff you wanna da

#

Like, all code that was in the EH beforw; goes into the spawned code brackets

hushed tendon
#

" Second, I throw the code from the event handler in the spawn and nothing happens from the code."

#

I did that

broken forge
#

@spark turret So the reinforcements didn't come in once the ai started firing at me, I'm not sure why

little raptor
spark turret
#

probably a parameter issue. you have to pass over the values from EH to spawn with then [parameters] array

#

and then parse them into vars.

broken forge
hushed tendon
spark turret
#

oh boy i angered dedmen

little raptor
spark turret
broken forge
#

I'm not sure how to do that

spark turret
#

put

systemchat "hi im a EH and i fired";

in your EH code

spark turret
#
//eh code
{
  _this spawn {
    params ["_killer","_victim"];
  sleep 5;
  diag_log ["i spawned with",_this];
  };
};

is not the best way?

broken forge
#

The Fired EH is working, and the Killed EH is displaying a ```sqf
systemchat "Hello I'm an EH and I Forgot About You";

spark turret
#

Well thats good :)

broken forge
#

But I'm not sure how the killed EH will work, as in the amount of time it takes for the AI to forget about me. It show's that system chat right away once I take out an AI quietly and none of the other enemies fire at me.

spark turret
#

Eventhandlers are instant. The code in them is run at the frame the eventhandler happened

#

So they probably instantly forgot about you

broken forge
#

So let's say I get into a heated battle, I run away for 10 or 15 min, will it show up as them forgetting about me?

#

I also want to get the script to change the AI behavior from Alert to Normal once they forget about me

spark turret
broken forge
#

Ok, so how would I go about creating an EH or a script that'll cause the AI to forget about me after some time where they're not firing at me or can't find me

spark turret
#

The killed eventhandler only runs once, after you kill a unit who has the EH.

#

Ah okay i get what you want

#

Well they will forget about you after some time by default. If they cant see you, their knowledge about you drops, and reaches zero after around 2 min (iirc according to biki)

spark turret
broken forge
#

Ok, so for example after 5 sec of not finding me, the group can set their behavior to Safe and speed to limited

spark turret
#

Yeah pretty much

broken forge
#

I'm having troubles getting that part of it to work. I'm trying to get the AI that become alerted to reset after 30 seconds, where they're behavior is Safe and their speed is Limited. Here's what I have so far: https://sqfbin.com/xirematasosarijipefu

hushed tendon
spark turret
#

:D

hushed tendon
spark turret
broken forge
#

I thought it was set to groups, lol, well I guess my question would be, by default the ai forget after some time, once they forget do they go back to the patrol that was generated for them?

spark turret
#

They will resume their waypoints yeah.

broken forge
#

How would I implement an alarm that goes off once the reinforcements are called and continues until the AI forget about the player(s) and resume their patrols?

spark turret
#

Waituntil {
//code that will run on each check
Playsound3d [myalarmsound];
Sleep 30;
//condition to stop
Ai knowsabout player == 0
}

#

Kinda like that

#

While loops are also interesting for that

#

They are essentially the same thing

broken forge
#

@spark turret So like this: ```sqf
{
_x addEventHandler ["firedMan", {
deleteWaypoint [grp4, 1];
[grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;
_x removeEventHandler ["firedMan", _thisEventHander];
waitUntil {
playSound3D ["Alarm", getMarkerPos "marker_0"];
sleep 150;
EAST knowsAbout player == 0;
};

        alert = true;
        systemchat "Hello I'm an EH and I Fired at You";
    }];
} forEach (units grp0 + units grp1 + units grp2 + units grp3);
#

I'm trying to get the alarm to sound until the reinforcements have been eliminated.

crimson walrus
#

The last line of your waitUntil doesn't need the semicolon

#

Also, it seems like the event handler will happen once for every unit's first shot, I suspect you'll get a lot of sirens playing simultaneously.

#

Lastly, I don't think you can use waitUntil in an event handler, to my knowledge event handler code runs in an unscheduled environment.

hollow lantern
# tough abyss yeah you got to gradualy slow em down the way you have it atm is at 800m eters i...

thanks for your suggestions. I currently have added the following: ```sqf
waitUntil {(_aircraft distance _destination) < 1500};
_aircraft limitSpeed 100;

            waitUntil {(_aircraft distance _destination) < 1100};
            _aircraft limitSpeed 90;

            waitUntil {(_aircraft distance _destination) < 900};
            _aircraft limitSpeed 80;

            waitUntil {(_aircraft distance _destination) < 750};
            _aircraft limitSpeed 70;

            waitUntil {(_aircraft distance _destination) < 600};
            _aircraft limitSpeed 50;

             waitUntil {(_aircraft distance _destination) < 500};
            _aircraft limitSpeed 40;``` I might need to add  more because at the end (I guess around 300-200 meters) the heli still verticals into the sky to get to a velocity of -2 before landing. So I might need to add more slow downs. Probably I also should re-write that code part to not have that much waitUntil and limitSpeed around.
tough abyss
#

@hollow lantern np glad i could help

broken forge
#

@crimson walrus You're correct with the multiple alarms, I'm at a lost to what can be done here.

crimson walrus
#
StartAlarm = {
  if (isNil "AlarmHasGoneOff") then {
    AlarmHasGoneOff = true;
    waitUntil {
        playSound3D ["Alarm", getMarkerPos "marker_0"];
        sleep 150;
        (EAST knowsAbout player) == 0
    };
  };
};

{
    _x addEventHandler ["firedMan", {
        deleteWaypoint [grp4, 1];
        [grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;
        _x removeEventHandler ["firedMan", _thisEventHander];
        [] spawn StartAlarm;
    }];
} forEach (units grp0 + units grp1 + units grp2 + units grp3);
#

That's what I'd do

#

Also fixes the part where you can't use 'sleep' in an unscheduled environment

broken forge
#

@crimson walrus Thanks, I'll give that a try, I do have one question though. Does Group 4's waypoint reset everytime the EH is fired?

broken forge
crimson walrus
#

Remove line 22: AlarmHasGoneOff = false;

#

this makes (isNil "AlarmHasGoneOff") false

broken forge
#

Still no luck, will this line cause any problems: ```sqf
trg setTriggerStatements ["this && !isnil 'AlarmHasGoneOff'", "wp1 = grp4 addWaypoint [getMarkerPos 'marker_0', 0];", ""];

crimson walrus
#

No reason to have: !isnil 'AlarmHasGoneOff'

#

I think the trigger wouldn't execute then

broken forge
crimson walrus
#

Maybe try removing the semicolon at end of last statement in the waitUntil?

#

Could also be the playSound3D command, try running that independently and see if noise is made

broken forge
#

@crimson walrus I was able to get it to work with this: ```sqf
soundAlarm = {
if (isNil "AlarmHasGoneOff") then {
AlarmHasGoneOff = true;

    deleteWaypoint [grp4, 1];
    wp1 = grp4 addWaypoint [getMarkerPos "marker_0", 0];
    [grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;

    waitUntil {
        _alarm = createSoundSource ["Sound_Alarm", getMarkerPos "marker_0", [], 0];
        sleep 150;
        (EAST knowsAbout player) == 0;
    };
};

};

{
_x addEventHandler ["firedMan", {
_x removeEventHandler ["firedMan", _thisEventHander];
[] spawn soundAlarm;
}];
} forEach (units grp0 + units grp1 + units grp2 + units grp3);

crimson walrus
#

Glad to hear it

void delta
#

position player nearObjects ["O_Survivor_F", 100];

Returns nothing if the Survivor is in a vehicle. Is there a solution to get a return if the Survivor is crew?

little raptor
agile pumice
#

what's the proper way to use this syntax for random?

waitUntil {(getpos _unit) distance (_lastLocation > (random [20,25,30]))};
#

3:26:25 Error position: <> (random [20,25,30]))}; if (vehicle _un> 3:26:25 Error >: Type Array, expected Number,Not a Number 3:26:25 File mpmissions\__CUR_MP.Sangin_Distirict_Helmand_Provi

warm hedge
#
waitUntil {((getpos _unit) distance _lastLocation) > (random [20,25,30])};```Watch your brackets
agile pumice
#

yepjust noticed

#

should have been
waitUntil {((getpos _unit) distance _lastLocation) > (random [20,25,30])};

warm hedge
#

πŸ‘

hasty violet
#

throwing this into the absolute blue:

#

Arma 3 map drawing keybind (+shift?) to allow the lines to stick to roads.

#

that's all.

warm hedge
#

Is this a suggestion?

azure aspen
#

Hi there just a little question.
I was using dayz medics uav script however everytime you use the arsenal it would mess the script up and it'd no longer be on the screen. So I was like the obvious solution is to add a sleep function then execute the script as a quick fix. However everytime it would execute the script it would mess up my zeus interface by teleporting me back to my player but still technically in the zeus interface. It was extremely strange.

How would I avoid this in the future?

digital vine
#

Bit of a specific question here:

If I wanted to define an area, with a script, whilst in Zeus mode, which would (preferably) turn the ACE weapon safety permanently on (whilst in area), or remove weapons on entering (normally via TP), how would one do that?

little raptor
# digital vine Bit of a specific question here: If I wanted to define an area, with a script, ...

Weapon safety is a weapon firing mode. I think it's simply called "safe"? But you can check that in config.
For turning the weapon safety on, set the player's weapon mode on safe, then add a keyDown event on that client so that when he presses a key to turn it on you could turn it off again.
I'm not in the mood to write you a sample script (if you don't know how). Maybe someone else can help you with that.

spark turret
#

InArea for checking if inside a trigger or marker, then removeMagazines or similar to take away ammo

fresh wyvern
#

Anyone who know how to combine the createVehicle into the "Fly Black Wasp" script?

if (playerSide isEqualTo blufor) then {
    remoteExec [player addAction [
        "Fly Black Wasp", {}, nil, 0
        ]
    ];
};
_veh = createVehicle ["B_Plane_Fighter_01_F", position player vectorAdd [-2000 ,0,0], [], 0, "FLY"];
_veh setVelocity [-5000, 0, 0];
_veh setFuel 0.15;

player moveInDriver _veh; 
vehicle player engineOn true;

_veh setDir 90; 
_veh = nil;
warm hedge
#

Put the script into the {}

fresh wyvern
#

I've tried that ..

willow hound
#

What is that experimental undocumented remoteExec syntax though? meowcamera

fresh wyvern
#

It's adding an action to the players scroll wheel options.

#

It does work.

copper raven
#

it works, but the remoteExec doesn't do anything there

digital vine
copper raven
#

in fact it should throw an error, because the first element in the array should be a string, not a number

willow hound
#

How should any of that code work?

fresh wyvern
#

Selecting an action in the scroll wheel menu spawns you in a flying jet.

willow hound
#
player addAction ["Fly Black Wasp", {
  //Put the create vehicle code here
}];
```That is the answer to your initial question, but that code with `remoteExec` should throw an error because `remoteExec` works differently.
copper raven
#

it will throw error expected string got number, action will get added regardless...

fresh wyvern
#

seems like taking away the remoteExec made it work.

willow hound
#

You don't need _veh = nil; by the way, the _veh variable is destroyed once the script finishes.

fresh wyvern
#

ok thanx

pulsar solar
#

help, i am confused. i do this: if (triggerActiveted t) then; true :but then it comes up with an error: condition of presence: Invalid number in expression

spark turret
#

dont crosspost

tough abyss
#

Any way to forcefully turn a player smoothly to face a target, setDir snaps to where i want to look

spark turret
#

doWatch doTarget

tough abyss
#

ok how do you switch from one animation to the next

#

b1 playMove "Acts_Accessing_Computer_Out_Short"; sleep 1; b1 playmove "Acts_C_in1_briefing"; he wont play the second animation

#

also he is doing a weird unconsious animation for some reason

tough abyss
#

ok different question is there a way to stop the untit from teleporting after it finishes this animation "Acts_B_M02_briefing" when the animation ends he teleports back to his starting position

hollow lantern
sage dawn
#

is it possible to make AI flown vehicles somehow ignore objects that are attached to them? now it seems like attaching anything to a AI helicopter will just make them see it as an obstacle and fly in weird ways

mild pumice
#

Hey guys, do you know if it's possible to display a special char ingame ?
When i do diag_log format ["%1", toString [8383]]; I have "β‚Ώ" in my logs
But if I do hint format ["%1", toString [8383]]; I just have an empty space

spark turret
sage dawn
#

tried that, didn't seem to help

spark turret
#

Disable simulation or simple Object? One of both makes AI ignore it, i think the first one

sage dawn
#

I already have enable simulation unchecked and simple object checked on the attached objects, but I can try to actually make them all as simple objects instead

sage dawn
#

now it seems to maybe slightly go towards its waypoint but it still mostly just keeps going up

broken forge
#

@spark turret I've made an edit to the download intel script so it can display a progress bar, but now it's not removing and adding my loadout correctly. Here's my script: https://sqfbin.com/tefezivojeyinisuhesa

spark turret
#

Line 6 is faulty. Why + _loadout?

tough abyss
#

so im still new to scripting does this look like it would work


waitUntil {_cnt =< 3;
};
 {_x switchMove "animation";} forEach units group;```

would this work? have i messed up my coding anywhere
worthy willow
#

You need to update _cnt in the waituntil

#

Otherwise it will never change

tough abyss
#

hmm can i get a hint for 100 jerremy

worthy willow
#

Also what group? Group is a keyword

#

So you need to specify which group.

spark turret
tough abyss
#

yeah im just generalising it with group

worthy willow
#

Thought so

tough abyss
#

will change it to whats needed when implemented

broken forge
#

@spark turret I'm just trying to remove all current player weapons, and then return them to the player once the download is complete. This way the player isn't holding a weapon while interacting with the laptop

tough abyss
#

just have them play the acessing computer animation

spark turret
#

Ah it should work then. Try sleeping after first removinf the weapons so youbare sure it worked

broken forge
#

The weapons are being removed now, but now it's not returning them to me

spark turret
#

Im not sure, maybe your backup loadout is not a copy but a reference to the loadout, so it gets modified itself

#

I keep forgetting how to make copies of arrays in sqf

tough abyss
#

seriously if i had arma open right now id make you a script where they type on the keyboard

#

literaly 3 lines of code

#

well 5 if you wanty it to look nice

broken forge
#

@spark turret Well the original script you helped me with yesterday worked, but now I've made some edits to show a progress bar instead of a hint, and took out the ```sqf
for "_i" from 1 to 100 {}

#

@tough abyss Well I've got the whole animation and progress bar working, but it's the remove all weapons and then return all weapons back to the player that's interacting with the laptop that's not working.

tough abyss
#

realy what animation are you using

broken forge
#
player switchMove "acts_accessing_computer_in";
player playMoveNow "acts_accessing_computer_loop";
player playMoveNow "acts_accessing_computer_out_short";
tough abyss
#

ah im surprised that animation dosnt make him put the weapon on his back

#

the salute animation does

#

even though the preveiwer does not show him puting the weapon on his back

broken forge
#

Yep, that's the problem, the first animation puts the weapon on the back I believe, but then the loop animation puts the weapon back into the players hand while they're interacting with the laptop

tough abyss
#

huh

worthy willow
#

Okay, I am having an issue and wandering if am doing something wrong or it's bug. I am creating an object, rotating it and then changing the pos. When this code is executed on the server it creates the object, but then doesn't rotate or change pos. But when I run the code on a client it works as expected.

_obj = unit_1;
private _c4 = "DemoCharge_Remote_Ammo_Scripted" createVehicle [0,0,0]; 
_c4 setVectorDirAndUp [(_obj vectorModelToWorld [-2.85742,8.50781,-2.14834]), (_obj vectorModelToWorld [0.81766,-0.0635719,0.57218])];
_c4 setPosATL (_obj modelToWorld [0,2,2]);

An example of the code I am running. The object is valid on both server and the client. The server and client both return the same values from modelToWorld. So it seems and issue with the server.

spark turret
#

Position commands have global effects so it should work

#

Maybe the code is not executed on the server

worthy willow
#

I tested with Diag_log

#

and they were in the server RPT

#

so it is running on the server

finite sail
#

I've had trouble with moving mines in the past, maybe explosives are similar

worthy willow
#

I have had it with other items aswell

finite sail
#

no matter what i did with them on the server, the clients never saw the move

worthy willow
#

Is this recent?

finite sail
#

no, tbh

worthy willow
#

Hmm

finite sail
#

try _c4 setpos getpos _c4

#

might propogate the pos across the network

worthy willow
#

Will test

finite sail
#

also.. is the object over land or water?

worthy willow
#

Land

#

I can see the object

#

If exec on client

tough abyss
#

hmm ok would

};
waitUntil {_cnt =< 3;
};
 {_x switchMove "animation";} forEach units group;}```

ok would this work
worthy willow
#

But not on the server.

#

setPos didn't work :/

finite sail
#

😦

worthy willow
#

I can just run it as the client

#

But it just seems dumb to.

tough abyss
#

@worthy willow sorry to take away from your problem but the code i just posted does it look ok

copper narwhal
#

how would one open .BIN files? Ive tried pbomanager and eliteness but the filestill cant be opened

spark turret
#

Just do a waituntil where it first updates your variable and then sleeps 1 second ans then checks the condition.

#
WaitUntil {
//code that is looped
//update condition
_stop = (alive player);
//check condition
(_stop)
}
//code that runs after the loop finished
tough abyss
#

thanks for the help brain to tireds to work now will work on it tommorow

orchid stone
#

any suggestions on making name plates that disappear after a certain distance above NPC's more efficient?

    addMissionEventHandler ["Draw3D", { 
        { 
            drawIcon3D ["", [0.73,0.24,0.11,1], visiblePosition _x vectorAdd [0,0,4], 0.6, 0.6, 45, "text here", 1, 0.05, "EtelkaMonospacePro"]; 
        } foreach _npcs select {_x distance player < 20})
    }];
cold pebble
#

Anyone off the top of their head knows if deleteVehicle objNull fails silently?

cold pebble
#

Cheers πŸ‘

fresh wyvern
#

Anyone who know to make a spawned in plane fly in a desired manner?

hushed tendon
#

You could try using unit capture if you want to be highly specific on the planes movement

still forum
hushed tendon
#

Someone mind taking a look at my code to make sure certain parts run properly?

#

Trying to make a weather voting system that every player takes part in

#

initServer.sqf

execVM "weatherVoting.sqf";
still forum
#

global vraiables should always have a TAG_

hushed tendon
#

so like TAG_eastReady?

still forum
#

if(isServer) then {
so that code is serverside only.
titleText is useless then. It will only display the text on the server, but the server has no UI

#

yes

#

But the TAG_ is your own 3/4 letter thing, something unique to you

hushed tendon
#

alright

#

And for setting the weather do I need to do that server side or client side?

still forum
#

[{[missionNamespace, "fnc_checkReady", [1]] call BIS_fnc_callScriptedEventHandler}] remoteExec ["call", 2];
That is overcomplicating it. Instead of calling call with a function. You might aswell just directly call the function
[[missionNamespace, "fnc_checkReady", [1]]] remoteExec ["BIS_fnc_callScriptedEventHandler", 2];
like that I think

#

Depends on the script command to set weather, i don't know. See what the wiki says

worthy willow
still forum
#

If I knew I would've already replied to you..

worthy willow
#

Oh

#

Damn

still forum
#

Also I don't understand your usage of scripted eventhandlers. Doesn't make sense to me

hushed tendon
#

Me?

still forum
#

yeah

#

why not just make functions. I mean your eventhandlers are already called fnc_ as if they were functions

hushed tendon
#

I don't have much knowledge so I went with what seemed to work.

#

Alright

#

I also tried using functions but I couldn't figure out how to call them. I would get an error no matter what I tried. You have a possible example?

still forum
#

fnc_requestWeather = { [] spawn {...} };

#

call fnc_requestWeather

#

remoteExec ["fnc_requestWeather", 2]

hushed tendon
#

Hmm. I used to get an error when I tried call fnc_requestWeather; but then again your function has a spawn so that's probably it

#

If I call a function for the title text on line 25 in weatherVoting.sqf with the function being located in initPlayerLocal.sqf will that run for every client or still only for the server?

still forum
#

no its not the spawn

still forum
#

if you call a function on the server, it will only run on the server

hushed tendon
#

Hmm. So how could I make the title text show up for every client but still be called in that section of code?

still forum
#

remoteExec

hushed tendon
#

so just keep it as is but run remoteExec on it. Got it

orchid stone
still forum
#

one after the other

orchid stone
#

gotcha, ty

worthy willow
#

@orchid stone The way I optimize my Draw3D events is to calculate the objects outside of the Draw3D. So I use BIS_fnc_loop to calculate the objects every 0.5 seconds so that the demanding stuff is only ran twice a second. The downside to this method is that if you want perfect accuracy with the displaying of info on screen you have to use onEachFrame. But with this method you can run demanding code but also have it display on screen.

orchid stone
#

@worthy willow thanks man, i was throwing around that idea as well. could just spawn a
while{true}do{GLOBALVAR = player nearentities["Man",20] select {_x in ANOTHERGLOBALVAR}; sleep 1}

#

will gave that a shot πŸ™‚

worthy willow
#

Yeah

orchid stone
#

lol that works great! thanks again @worthy willow

regal night
#

I've recently been having some problems with ai not firing or even moving. Is there any way of disabling all ai squad commands? I'm trying to get ai to stop setting themselves to stance down and their combatmode to green. I just want to be able to set their combat mode and have them not change it, same with stance. I just want their stance to stay as auto.

little raptor
#

or do you mean like auto with no prone?

regal night
#

I want to them to be set to AUTO.

little raptor
#

stop setting themselves to stance down
blobdoggoshruggoogly

regal night
#

AUTO allows for each unit to think for themselves and set their stance depending on the circumstance.

#

If the stance is set to prone, even if they are out in the open they will stay in prone no matter what, that's what I don't want.

#

I don't know any simpler way to put this.

radiant yacht
#

does anyone know if unitcapture has a max length?

little raptor
radiant yacht
#

well i used the command, but it just stopped the recording without me stopping it

little raptor
#

like I said, it depends on the duration

radiant yacht
#

thats what i have in my trigger
rec = [heli1,180] spawn BIS_fnc_UnitCapture;

little raptor
#

@radiant yacht

_duration = _this select 1;
_timeStart = time;
_timeFinal = _timeStart + _duration;
...
while { ((time <= _timeFinal) && (alive _unit) && !(BIS_EndCapture)) } do //< Repeat until till the end or unit died or interruption from BIS_EndCapture
...
radiant yacht
#

oh

little raptor
#

that's how the function works

radiant yacht
#

so is the 180 in the command the duration?

little raptor
#

what 180?

little raptor
#

yes

#
[unit, duration, FPS, firing, startTime] spawn BIS_fnc_unitCapture
```https://community.bistudio.com/wiki/BIS_fnc_unitCapture
radiant yacht
#

oooh, so to stop it from being laggy i need to make it [heli1,180,60]

#

and to make it longer [heli1,1800,60]

#

right?

little raptor
radiant yacht
#

oh no i don't mean the mission is laggy

little raptor
#

I know

#

the recording is laggy

#

and that's what I meant

radiant yacht
#

i mean that the movement when i play it back is jittery

little raptor
#

again, that's what I meant

spark turret
#

For higher recording fps you need high mission fps while recording

#

Thats why you do it in a clean environment

radiant yacht
#

twas altis with nothing around, about 120fps while doing the recording

little raptor
#

they may be executed by other mods

radiant yacht
#

danke sir

little raptor
#

@radiant yacht but yes setting the FPS higher can help
The script records at 20FPS by default

_inputFPS = 20;
broken forge
#

@little raptor I was able to figure out the saving and loading of the Unit Loadout. I had to add the _backupLoadout variable to the params[]; array and then call sqf player setUnitLoadout _backupLoadout within the if statement. After that I had to add _backupLoadout to the BIS_fnc_addStackedEventHandler array at the end of the script. Here's a link to the updated script: https://sqfbin.com/iwecamutamezopunipoc

#

Now is there anyway to clean up or simplify the code even more, if so I'm all ears.

clever radish
fresh wyvern
#

Is there a way to search all the init boxes i a mission you have made in one go?

crimson walrus
#

Try opening mission.sqm using a text editor, should be in there

fresh wyvern
#

Thanx

little raptor
cosmic lichen
#

@broken forge ```sqf
if (_progress > 1) then {

Will it actually ever become > 1?
little raptor
#

but still, notlikemeow

#

(also I'm 99% sure it's just copy-pasted)

cosmic lichen
#

yes, because of non-clipped linear conversion
I haven't actually looked at the code that closely

little raptor
#

_progress = linearConversion[_start, _end, time, 0, 1];

#

if time > _end it becomes greater than 1

little raptor
regal night
#

I found a small script for setting units pos to auto, and I edited it a little. Just want to know, does this seem right?
TOV_noProne= {
params ["_unit"];
while {alive _unit} do {
if (behaviour _unit =="COMBAT") then {
_unit setUnitpos "AUTO";
sleep 2;
};
};
};

forEach allUnits;

spark turret
#

Uh that function is never called is it

distant oyster
spark turret
cosmic lichen
#

That foreach will not work anyway because

}; forEach```
brazen lagoon
#

is there a good reference for the Extended_Init_EventHandlers anywhere?

#

I'm trying to run something on all vehicles

#

(i.e. any sort of car or tracked vehicle)

exotic flax
brazen lagoon
#

yeah I tried that but I couldn't find any good references

exotic flax
#

and yes, Google πŸ˜‰

little raptor
brazen lagoon
#

oh this is exactly what I was looking for thanks

#

ah, I was searching arma 3 instead of cba

#

makes sense

exotic flax
#

it just extends the default Event Handlers, so technically not needed, but does make your life a lot easier

brazen lagoon
#

yeah

#

I swear there was a way to find the inheritance chain of an object but I don't remember now

little raptor
#

in scripting there is

brazen lagoon
#

yeah

#

well there's inheritsFrom

#

but that takes a config as a param

#

can you pass it in an object?

little raptor
#

use configOf obj

brazen lagoon
#

that was gonna be my guess yeah

little raptor
#

get the configParents
call inheritsFrom recursively (or in a loop)
you get every config it inherits from

brazen lagoon
#

oh that's annoying, there's no simple way to just get a list of superclases?

little raptor
exotic flax
#

BIS_fnc_returnParents is an easy method (probably does the same as example 2 of inheritsFrom)

brazen lagoon
#

oh! that's what I was looking for

#

ty

#

so if I wanted to run something on all land vehicles could i do something like: sqf class Extended_Init_EventHandlers { class LandVehicle { init = "_this call (compile preprocessFileLineNumbers 'retexture.sqf')"; }; };

exotic flax
#
class Extended_Init_EventHandlers {
    class LandVehicle {
        class My_Custom_EH {
            init = "_this call (compile preprocessFileLineNumbers 'retexture.sqf')";
        };
    };
};
#

this way multiple mods can attach EH's to the same object(s)

brazen lagoon
#

oh ok, that makes sense

#

ty ty