#arma3_scripting

1 messages · Page 650 of 1

patent goblet
#

ok, thanks

cosmic lichen
#

Typing "dbug" in one of the edit fields should work.

finite sail
#

hehe i did that too

#

felt like such a noob

#

in fact, you can type dbug in a chat window but if you do, you wont get a cursor

#

ive been meaning to mention that to Leo, but forgot

#

brb exercising

idle jungle
#
//Survivor dies then turns into nato script below
if (hasInterface) then
{
    G_SAS_Respawn =
    {
        waituntil {alive player}; //Just make sure the player is alive first
        
        //Lets create the vessel they will be spawning into
        private _BGroup = creategroup west; //You will want to keep this part, the player can be forced into another group AFTER they are initalized
        private _SpawnPos = SAS_SpawnFlag getpos [10,(random 360)]; //This will place the unit 10 meters from the "SAS_SpawnFlag" in a random 360 degrees.
        private _Newunit = _BGroup createUnit ["O_G_Survivor_F", _SpawnPos, [], 0, "None"]; //Lets create the unit here.
        [_Newunit] joinSilent _BGroup; //Fix AI shooting at you after respawn
        //Let the unit initalize before we swap...Maybe 2 seconds is enough?
        sleep 2;
        selectPlayer _Newunit;   
    };
 
    G_RespawnEH = player addEventHandler ["Respawn", {_this spawn G_SAS_Respawn;}];
};```

can someone help me? 
whenever i die i do swap sides but the AI also swaps sides rather than spawning on the respawn_resistance marker 
he spawns on the place i swap sides to
#

ohhh okay it bugs out if you force respawn got it, if you are killed it works

winter rose
#

oh, so forceRespawn does not trigger the Respawn EH?

idle jungle
#

i think so, if im killed by AI it works however if force respawning it works but brings the unit i died with, with me

#

do I add this sqf G_RespawnEH = player addEventHandler ["forceRespawn", {_this spawn G_SAS_Respawn;}];

winter rose
#

I don't think it is part of the Arma 3 EH 😄

tender fossil
#

When does code called from onEachFrame run during mission init (using the latest version of Arma 2 a.k.a. v1.64)?

#

Let's assume that it's called in unscheduled environment

spark turret
#

any advice on how to encourage AI to fire RPGs at infantry?
They are all provided with thermobaric/HE shells

austere hawk
#

cheap hack: attach invisible target to their forehead with high threat value and cost

#

its probably a simple matter of cost value (in config) - ammo cost is too high and target cost is too low -> AI wont use it for the target

#

but its a tricky matter - because if you set it so low that they willingly shoot, then they probably will dump HE onto the first soldier they come across

#

AI have no concept of indirect fire / when HE rockets would actually be usefull (like firing into a building to kill a target in that room). So either you help them by attaching targets to wherever you want them to fire to entice them, or you directly force them to aim at something and fire

finite sail
#

has anyone experienced weird stuff with attachto and setowner? Objects that I am attaching to a client vehicle and then moving their locality to the owner of that vehicle... the attached objects despawn

#

same thing happens if the setowner is done before or after the attachto... the moment the attachto happens... poof, the attached object disappears

timid niche
#

is there a way to block the engine from turning on in a vehicle unless the vehicle has a certain var set

#

tried using the engine evh, but it jsut causes other players to see the engine as turned off

little raptor
timid niche
#

lol guess thats an idea

finite sail
#

its still weird behaviour regardless of what happens to the object

little raptor
#

Are you sure the attached object is not "local only"? (e.g. createVehicleLocal)

finite sail
#

probably not, it was a destroyed vehicle, a truck or a car usually

little raptor
#

maybe you can't transfer the ownership of dead entities (probably just owned by the server)

finite sail
#

mmmm, good theory

winter rose
timid niche
#

Does the evh have to be remoteexecuted on everyone?

winter rose
#

which one?

timid niche
#

the engine one

winter rose
#

just setHitpointDamage, it's not an EH

timid niche
#

Well it's supposed to happen if someone turns on the engine and a certain var is not set

winter rose
#

you won't be able to set the engine on if the engine is destroyed

timid niche
#

yeah but for the check to happen the engine must be turned on first

#

or could do it in the getinman evh

winter rose
#

stop stop stop.
what is the end goal

timid niche
#

enter the vehicle, if a certain var isn't set, you cannot turn on the engine

#

but I need to check for this var somehow

winter rose
#

or
when you set the var, repair the engine?

timid niche
#

yeah but you need to do a getVariable at some point throughout entering the vehicle or turning it on or something

#

otherwise how will you know to destroy/repair the engine

winter rose
#

1/ destroy the engine
2/ when you want it repaired, repair it

you don't need to check if someone is trying to start it to fix it

timid niche
#

I don't think you understand what I am trying to do lol

#

Basically a hotwire script

#

Ill figure it out myself

glacial dust
#

Hello, I need some help. I want to add functionality to a mission where any AI shares target information with all units on it's side. How would that be possible?

idle sierra
#

how would I get 2 ai units to drop two parts of an mg/mortar and build it? _dropweapon [X] each and then what?

winter rose
#

See also TakeBag below with an example for it

idle sierra
#

thanks

fair drum
#

a handddd baaaaaaaaaaaag??

#

can a campaign description file use all the normal description file classes and apply them to every mission?

winter rose
fair drum
#

and double declares cause crashing right? so i have to write it in a way that won't double declare if say I have mission specific stuff too in that class?

winter rose
#

I huh, maybe?

fair drum
#

maybe I didn't say that well. say i have...

// campaign cfgsounds.hpp
class CfgSounds
{
  //sound config here
};

//mission cfgsounds.hpp
class CfgSounds
{
  //mission specific sounds configs
};
#include "\campaign\cfgsounds.hpp"

this will error right because of two cfgsounds declares?

little raptor
little raptor
winter rose
fair drum
#

yeah and that campaignCfgSounds.hpp should NOT have a cfgSounds declare in it then. just the sound classes

little raptor
winter rose
fair drum
#

gotcha

idle sierra
#

what script do i need to tell a squad "stop advancing, run back the squad leader and into formation and hold your position"?

hushed tendon
#

So I'm trying to get an ai unit to spawn on one of 3 locations. I'm currently getting an error from the _unit line and can't figure out what's wrong. I also have this running in the activation of a trigger. Anyone able to help?

_pos = ["pos_1","pos_2","pos_3"];
_unit = "CUP_O_TK_INS_Soldier" createUnit [getPosATL (selectRandom _pos),_group];```
little raptor
#

use the first syntax instead, @hushed tendon

hushed tendon
#

So I need to add this?_unit = this;

winter rose
#

…better use the other syntax

hushed tendon
#

I'm not sure I understand

winter rose
#

see the link Leopard20 provided; the command has two syntaxes, use the other one

hushed tendon
#

so example 1

little raptor
hushed tendon
#

Ok I understand now

fair drum
little raptor
#

doFollow doesn't reset the formation like the vanilla "return to formation"

winter rose
#

yep, I think there is nothing alike command-wise

hushed tendon
#

I have this for him but even with the waypoint to the player the squad doesn't move

{deleteWaypoint((waypoints Group1)select 0);}forEach waypoints Group1;};
{doStop _x} forEach units Group1;
_wp = Group1 addWaypoint [getPos Bob, 0];
Group1 setFormation "WEDGE";
_wp setWaypointType "MOVE";```
little raptor
winter rose
#

ah, interesting

little raptor
#

a fully working variant is more complicated than that (e.g. if a unit is alone in group, or is the leader)

hushed tendon
little raptor
#

nothing

hushed tendon
#

so leave that line out?

little raptor
#

since you're using waypoints

hushed tendon
#

there we go. Thanks

little raptor
#
  1. use ```sqf (see the pinned messages)
  2. you didn't remove doStop
  3. that's not what he's asking (he wanted a "return to formation"; plus removing all the waypoints is a bad idea)
hushed tendon
#

Welp

idle sierra
#

I'll try these out guys thanks!

hushed tendon
#

I think I'm doing this syntax wrong.

_group = createGroup east;
_pos = ["pos_1","pos_2","pos_3"];
_unit = _group createUnit ["CUP_O_TK_INS_Soldier", getPosATL (selectRandom _pos), [], 0, "FORM"];
winter rose
#

use getMarkerPos, not getPosATL

hushed tendon
hushed tendon
#

Not unit height. I mean set the height at which the ai will spawn at. Like on the second floor of a building

hushed tendon
#

would it be possible to use the position of an object rather than a marker in the syntax?

winter rose
#

yes

little raptor
hushed tendon
#

is it just the getPosATL that's wrong in the syntax?

little raptor
hushed tendon
#

I don’t understand. What part is taking the position of a string?

#

Oh. Is it the ["pos_1","pos_2","pos_3"]? And if so how should I change it?

little raptor
hushed tendon
#

They are cans that I placed down named as such

#

Objects

little raptor
hushed tendon
#

Generic error in expression

little raptor
hushed tendon
#

Nvm I had en extra bit that was not needed

#

It works now

#

And would there be any way to change they way they face upon spawning in?

hushed tendon
#

Thx

#

It works now. Thank you @little raptor @winter rose for the help!

finite sail
#

$50 per hour

little raptor
#

if only 😔

finite sail
#

🙂

fair drum
#

@winter rose so when doing an include pointing to the campaign folder...

//mission01 description.ext which is located at "TiberiumOrigins\missions\mission_01.altis\"
class CfgSounds
{
    #include "\TiberiumOrigins\cfgclasses\sounds.hpp" //error can't find

};

class CfgMusic
{
    #include "\TiberiumOrigins\cfgclasses\music.hpp" //error can't find
};

when I load up the mission in the editor, it says that the file cannot be found. it also throws an error in VSC saying it can't find it either.

#

so I'm guessing that the farthest back a mission can look is its own root folder, not one behind.

finite sail
#

the first \

#

i think you might have to remove that

fair drum
#

nope still can't find

#

it seems its always going to pull like this...

Failed to find 'c:\Users\Anthony\Documents\Arma 3\missions\TiberiumOrigins\missions\mission_01.Altis\TiberiumOrigins\cfgclasses\sounds.hpp' -- VSC error

#

which I see what it is doing... its still referring itself as the root folder, then adding on what I'm telling it to point to

little raptor
fair drum
#

is there a way to include from outside of the mission file? like i'm just trying to figure out how to share resources for different missions so I don't have MBs of data being repeated in each mission folder

exotic flax
#

if you make a campaign, just put it in your campaign structure.
for standalone missions; it doesn't work unless you make a mod with assets

fair drum
exotic flax
#

but root it mission root... not "random folder on HD"

#

and you can't go outside of mission root (or game root)

twilit cove
#

I was looking at making a mission for this and wanted to ask, is there any trick from old scripters to convert PBO addons with its config to the .sqm & .ext file? Or is it just too much work usually to do this especially for larger mods?

little raptor
#

um wat?

exotic flax
fair drum
twilit cove
#

e.g. you can baiscally make all DayZ or zombies into one mission file and people 'did' do this before, but its just like huge work it seems to back convert

#

well it seems in .ext you can define the classes and stuff

exotic flax
#

with massive limitations

twilit cove
#

but the format of having all different pbos and 'big mess' like in CBA

#

doesnt really translate well to that

exotic flax
twilit cove
#

ok, well its 'better' but seems harder

#

cuz u can get vanilla players to join with all mods but

#

i guess no one here knows, ohwell

exotic flax
#

we just have no idea what you want 🤔

twilit cove
#

i know

#

thx

exotic flax
#

🤷‍♂️

fair drum
#

I think he just wants to take say 12 mods and put them in a single mission folder which he can distribute to friends.

#

and plug and play after he makes it

#

sounds like more work than making a workshop collection everyone downloads

little raptor
#
  • theft
exotic flax
#

sounds more like impossible to do...

#

because it simply won't work, since most config stuff can't be done from description.ext

fair drum
#

breaking point did it a while ago, and then the community found out they were using other mod's assets in theirs

#

@exotic flax have you made a campaign? if you have one with shared assets between missions, can I view it so I can get the idea of doing it correctly?

exotic flax
#

I don't have any; although the core campaigns should give an idea on how they do it (eg. Old Man is sharing stuff all over)

fair drum
#

maybe i'll look there then. i've been looking through east wind and there is some out dated stuff in there that just confused me more

#

i dont have a "\a3\Missions_F_Oldman\Systems\commonDescription.inc" hmmmmm

#

no pbos that look like it either in the addons folder

#

nvm, its under expansions not the addons folder

#

not sure what a .inc file is or how its different from .hpp

exotic flax
little raptor
fossil yew
queen cargo
#

uhm ...

#

the fun part about unscheduled code is ..

#

there only ever can be once active instance running

fossil yew
#

Yeah, but how to tell "what exactly "?

queen cargo
#

i am not sure if i understand the question correct

#

unscheduled code is ran until it is done, nothing else may run inbetween

#

including game simulation

fossil yew
#

Suppose you want to find a mod doing resource intensive operations and lowering FPS.

queen cargo
fossil yew
#

Thx.

distant oyster
#

is it possible to exclude dead units from the spectator? I currently move them to a temporary civilian group and only allow spectating of west units.

drifting sky
#

is this valid use of "switch"? switch (true) do { case (a == 0 && b != 0): { do_something; }; case (a == 1 && b != 1): { do_something; }; };

exotic flax
#

yes, perfectly fine

#

not very performance friendly when called a lot, but will do the job

drifting sky
#

does it stop after the first true case, or does it do every true case?

queen cargo
#

generally speaking, the thing you did is kinda wrong but as of now sadly the arma way of doing an else if so it is kinda fine again

the switch will evaluate the conditions top to bottom and only ever execute the first one which was true

#

if you want all true conditions to be executed, use multiple if EXPRESSION then CODE

drifting sky
#

does arma 2 evalualte 0 == -0?

exotic flax
#

it should, although I'm not sure if -0 is a valid Number

drifting sky
#

0 - 0 == -0

ashen warren
#

hey all, Making a stress meter script. got this one error.


if(_stress <= _maxstress) then
{

if(_chang>
21:01:07   Error position: <_stress <= _maxstress) then
{

if(_chang>
21:01:07   Error Undefined variable in expression: _stress```
Parameters.sqf
https://pastebin.com/8RDiuVRS
shotdetection.sqf
https://pastebin.com/HhqdCpw3
stress.sqf
https://pastebin.com/rx2VUHqF
exotic flax
#

problem is in 'shotdection.sqf', which returns _changer but isn't set

ashen warren
#

I thought it was a stress variable i was passing then _changer gets created from shotdetection

exotic flax
#

but the file doesn't have params and is doing nothing with it

ashen warren
#

something like this?

Shotdetection.sqf

//To elevate stress levels if you are being shot at.

params ["_changer", "_stress"];

player addEventHandler
["firedNear",
    {
        _unit = _this select 0;
        if ((_unit getVariable ["_stress", 0]) < 100) then
        {
            _unit setVariable ["_stress", (_unit getVariable ["_stress", 0]) + 1];
        };
    }
];
player addEventHandler
["hit",
    {
        _unit = _this select 0;
        _unit setVariable ["_stress", 100];
    }
];

_changer```
ashen warren
#

how do i go about this since _changer basically is a variable that changes all the time?

queen cargo
#

for starters: you should not add an endless amount of event handlers to the player
you are also not modifying _changer anywhere and _stress is never set on the player

#

add those event handlers once to the player and then modify eg. the stress value everytime

#

to get the current stress value, you then just do the player getVariable ["stress", 0]

#

eventhandlers themself are not sitting in the same "scope" as your code

#

they are added to a list of events and get executed as they happen (hence: event handler)

#

your "Shotdetection.sqf" thus is pretty much just:

params ["_changer", "_stress"];
player addEventHandler ["firedNear", myFiredNearMethod];
player addEventHandler ["hit", myHitCallbackMethod];
_changer```
#

and now it should be kinda obvious too, why the approach you chose is not working 😉

ashen warren
#

Well crap, I guess I got to rethink this again

#

Just in theory, if the return value is set to _changer, doesn’t that technically create the value changer without doing something like _changer = 0 to make a predefined variable? Then when it gets passed down to stress.sqf have _stress = [_lowerstress, _stress, _maxstress, _changer] call _stressCheck

#

I bet I’m just spit balling at this point

ripe sapphire
#

Guys i experienced several times the issue where using setPos, the effects show up immediately for the server, but delayed for the client

#

Anyone know if this is a bug

drifting sky
#

A2OA: is it possible to have a marker have only a text label, and no icon?

ripe sapphire
#

maybe

#

it can probably be fixed by having 2 objects of the same type at the respective positions and just hiding/unhiding them accordingly instead of using setPos, just curious if anyones got this problem, as sometimes this solution might not be possible. If someone can confirm this i will make a ticket to feedback tracker

drifting sky
#

I solved my problem by setting the marker size to zero.

#

however, now I wish there were a way to change the marker text size

little raptor
ripe sapphire
little raptor
#

it's not a matter of performance

#

it's a matter of reliability

ripe sapphire
#

ok got it

#

will test the other ones

little raptor
#

plus that has nothing to do with mp sync

ripe sapphire
#

yea there was a playSound remoteexec'ed right before the setPos in my test script and the sound played just fine for everyone

#

just the setpos was delayed quite a while

#

gonna test other commands and see if they work better

ripe sapphire
little raptor
ripe sapphire
#

in the current case yes it was disabled

little raptor
#

well then it's likely

#

I guess it's worth bringing it up again

ripe sapphire
#

hmm ok will try both using setPosATL and enabling sim

little raptor
#

why do you disable simulation tho?

#

you can use createSimpleObject for "props" for example

ripe sapphire
#

it is tied to an addAction so no go

little raptor
#

also enabling simulation probably won't immediately "resync" the object

ripe sapphire
#

can u setpos simple objects tho?

little raptor
#

yes

ripe sapphire
#

i can probably delete the original object, then create simple object on new pos?

#

how long do you think it will take to resync it?

little raptor
#

that's a bad idea
dunno

little raptor
ripe sapphire
little raptor
#

disabling an object also disables the action

ripe sapphire
#

you mean disable sim? no it works

little raptor
#

oh right it's "hiding an object" that disables it

ripe sapphire
#

using hideobjectglobal

#

or is that delayed too

little raptor
#

that's a really bad idea

#

If there are only a few objects you want to do this with then I suppose it's alright

ripe sapphire
#

only 1

#

but i guess cant use this method if u absolutely need to move the exact object (ex. player or objects with a variable name)

#

Units that have been previously subjected to enableSimulation false; or enableSimulationGlobal false; may stay unrecognised for a long time even after simulation was re-enabled, returning objNull as cursorTarget. Force revealing units with reveal command usually solves the problem.
maybe revealing to all clients would fix the sync issue?

little raptor
#

¯_(ツ)_/¯

ripe sapphire
dusty badger
#

what might be a good way to create a dialog after a player has joined a server?

#

my first instinct is to have a small script that creates the dialog, and then execVM that script in initPlayerLocal

jade abyss
#

tag the function to call the dialog as postInit?

#

Example:

class MyFncToOpenTheDialog {postInit = 1;};```
#

or just add it to the init.sqf of the mission, etc.. There are many approaches on how you can do this.

dusty badger
#

Never considered tagging the function as postinit

dusty badger
#

Well, I made a function that is literally just createDialog "introDialog"; and tagged it as postInit, and it works fine in SP

#

it brings up the intro dialog as soon as you load in

#

but testing it on a dedicated server it does not work, and does not bring up the dialog, but the function to do so seems to work fine

#

like if I call the function locally in the debug console the intro dialog appears

winter rose
#

you should wait that player is not null for JIP players I think

robust hollow
#

or until display 46 exists for mp in general? because you dont necessarily need a player object to use a ui

jade abyss
#

What was it again?

waitUntil{!isNull player};
YourCode
dusky pier
#

Hi, i wanted to remove texture from model selection with script

(vehicle player) setObjectTextureGlobal [3,""];

This thing worked before, but now - this thing is not works

Is possible to do it somehow (another way)?

winter rose
dusky pier
#

understood, ty @winter rose

still forum
still forum
torpid sedge
#

Anyone know code/script put modded cars in car shop for life server dm me I need help

winter rose
#

@torpid sedge don't crosspost, thank you (#rules)

torpid sedge
#

Soz I didn’t where to put it so put in channels where I thought I went @winter rose

rigid otter
#

I would like to reterive the name of cfgWeapons, and I managed to store them into an array. The thing is I would like to save the array values into a readable text tile so I could read it. I tried storing with profileNamespace but it seems it can't let me do so, any other ways I can do this?

winter rose
rigid otter
#

yeah

#

to be more percise, their class names

#

I managed to stored them into an array class

#

It seems that BI don't provide a way for us to export files other than profileNamespace

ripe sapphire
rigid otter
#

lemme try

#

oops

#

it only could copy a string

ripe sapphire
rigid otter
#

@ripe sapphire is toString works?

ripe sapphire
#

tostring only for numbers array it seems

#

for text use joinstring

rigid otter
#

got it

exotic flax
#

why not just print directly with diag_log in your log file

rigid otter
#

good idea

#

lemme try that

#

@exotic flax Just asking, will I retrive those content immediately after I save into the rpt file?

#

Or I have to wait until the game closes?

exotic flax
#

it will be there the moment you write it

rigid otter
#

Got it

ripe sapphire
exotic flax
rigid otter
#

Oh I see. At the beginning I simply write the vars into the config, until I find out it will cause too many unnecessary results
@ripe sapphire btw cya in space.

summer pond
#

Hi, is there a command for getting the weapon caliber?

summer path
#

Question: i want to build a persistent scenario for my unit , thats saves player loadout and location after disconnect. Does anybody have an idea how i can do that ? Is that possible with a script ?

spark turret
exotic flax
#

afaik do weapons not have the caliber in their config, but you have to get the magazine or even ammo used

spark turret
#

weapons do have a config entry with "used magazines"

#

would be good to know. always wanted to make a compat mod that worksdynamcially for all caliblers

winter rose
#

the CSAT Viper has 6.5 + .50 😉

exotic flax
#

technically you can add any magazine or ammo in a weapon (even when IRL not possible)

#

and looking in the configs I don't see any reference to the caliber (CfgWeapons, CfgMagazines or CfgAmmo), except for the caliber variable in CfgAmmo which is just a number to calculate penetration.

spark turret
#

yeah we have some broken compat mod in our clan. HK G3 takes anything between 9mm and 7.62 lol

#

oh no, correction incoming

still forum
spark turret
#

ah i understand

#

i can only read after my mod wrote. so not possible

still forum
#

The only caliber entry I know is CfgAmmo, maybe he means that tho?

rigid otter
#

Weird, I pasted the make_file.dll into arma3's root folder, but arma3 can't find the extenision

#

It just be like:
23:13:13 CallExtension 'make_file' could not be found

queen cargo
#

really should get my file io extension build for all OSs

rigid otter
#

@queen cargo Do you have any links?

queen cargo
#

https://github.com/X39/extFileIO you would need to build from sources as of now as i was too lazy to build in CI yet

#

plus the documentation is slighly outdated (new commands are there, old have changed in their args slightly)

rigid otter
#

@queen cargo Are there example usages?

queen cargo
#

not sure what you mean with example usages

you pretty much just call an SQF wrapper method (https://github.com/X39/extFileIO/blob/master/extFileIO_fnc_call.sqf) like: ["write", [_filePath, _appendToExisting, _contents]] extFileIO_fnc_call and ... youre golden
_filePath is the string to your file
_appendToExisting is a boolean, determining wether you want to append to an existing file or the existing file shall be cleared prior
_contents is either a string or an array of scalar values

#

but as said

#

no CI, so you would need to build the library yourself

rigid otter
#

@queen cargo I've compiled the dll, as I am running the code from debug console (Since i would only like to dump the config), so I was looking for a solution to write the csv output from a config export script to a file

hushed tendon
#

Is there a way to delete any unnamed (spawned) vehicles that are in a radius of a map marker or if they are present inside a trigger?

#

If anyone could point me in the right direction it would be a big help.

winter rose
#

winter rose
hushed tendon
ripe sapphire
#

guys does ppeffectcreate, adjust, enable, commit etc. persist through respawn?

still forum
#

it should be bound to graphics renderer, not to your player object

#

so I'd say yes

ripe sapphire
#

ok nice so for MP, to make sure all players including JIP ones get the desired PPeffect for the entire mission, i should put the ppeffects code inside initPlayerLocal.sqf right?

ripe sapphire
hushed tendon
winter rose
#

what did you try?

hushed tendon
idle sierra
#

Is there a way script something like:

IF 60% of WholeGroup IS DEAD;
THEN ORDER WholeGroup to MOVE to WAYPOINT;```
#

basically to automate retreat if AI casualties get too high

austere hawk
#

sure

idle sierra
#

whats the function to check for death?

winter rose
idle sierra
#

thanks

hushed tendon
#

Is there a way to delete a specific type of vehicle?

young current
#

yes

#

collect X type vehicles into an array and run deleteVehicle forEach of them

hushed tendon
young current
#

no

#

my example was quite simplified

#

you will need to use the scripting wikipage to figure out the proper syntax

hushed tendon
#

Even with the wiki page I still can’t figure it out...

hushed tendon
#

Nvm I figured it out

#

Thx

young current
#

🎉 fast_meow_party

#

Good work

glacial dust
#

Ok so I did some experimentation with AI targets knowledge and found that between singleplayer and multiplayer there is a grave difference...
In singleplayer AI shares target information with it's side after a couple seconds, but in multiplayer it never does.
Has anyone experienced this kind of issue?

#

I tested that with knowsAbout btw

young current
#

mods involved?

winter rose
glacial dust
#

I think ASR AI yeah, but shouldn't inhibit such information flow should it

winter rose
#

if the AI is calculated on the server, you would not know everything on your side

glacial dust
#

Ah okay

#

But the final effect is the same. I tested by setting up an unarmed enemy survivor and on a hill next to it a IFV.
Locally, it shares the info after like 20 seconds when I step infront of the unarmed men, leading to the IFV to engage.
On the server however, nothing such happens.

#

Same mods on both

young current
#

same difficulty? Same skill levels?

winter rose
#

in groups?

glacial dust
#

No not in groups

#

Separate units

winter rose
#

thaaat's the thing

#

vanilla AI does not share info between groups (except for vehicle sensors)
so the mod fails (maybe because the server does not run the mod or it just isn't MP-compatible)

glacial dust
#

No it isn't - after the unit knowsAbout a target for some seconds it shares it with it's side, so east knowsAbout <player> is set to > 0 too, then the IFV knowsAbout also raises.

winter rose
glacial dust
#

Okay I see

young current
#

pure vanilla test is always recommended when checking if there is a problem

glacial dust
#

I don't have control over the server unfortunately

young current
#

you might see different behavior in your SP test too without ASR

winter rose
glacial dust
#

No the server is running the same mods

#

It's the server's modpack after all

past wagon
#

I also found that page

little raptor
#

and if that doesn't work, use addRating

past wagon
#

wait

little raptor
past wagon
#

i am gonna re read the setFriend page

#

oh

glacial dust
#

@winter rose @young current Yeah server settings of ASR AI were the culprit thanks

past wagon
#

is the 0 value making them enemies?

#

@little raptor

little raptor
#

the page already explains what it does

past wagon
#

oh

#

i see

#

any value smaller than 0.6 makes them enemies

#

got it

#

and does that go in init.sqf or serverInit.sqf?

#

i dont really know the difference between the sqf files yet, is there a wiki page I can read about those?

past wagon
#

ok

past wagon
#

thanks

tidal ferry
#

Need some support- so I'm looking to make a whitelisted arsenal, for which I know I'd usually use the scripts listed on https://community.bistudio.com/wiki/Arma_3:_Arsenal#Modding, however I want the whitelisted arsenal to be able to be opened via a holdAction and I'm having trouble getting the object set up

#

Anyone able to advise?

#

I'm able to get it worked by setting "true" for the BIS_fnc_addVirtualItemCargo functions, but I don't know how to open a whitelisted arsenal from an existing virtual inventory via script

#

Think it may have something to do with JIP? But I'm fairly lost

#

Or a better way of putting it: Anyone know how to open the Virtual Arsenal (not just create an ammocrate object) with a specific whitelist of classnames?

#

BIKI only shows how to open it with either nothing or everything, unless I'm missing something

exotic flax
#

you can add custom items to an arsenal with the following:

// init arsenal, empty, with addAction
["AmmoboxInit", [_container, false, true]] spawn BIS_fnc_arsenal;
// add custom items to container, globally
[_container, ["arifle_MX_F", "arifle_MX_SW_F", "arifle_MXC_F"], true, false] call BIS_fnc_addVirtualWeaponCargo;
[_container, [], true, false] call BIS_fnc_addVirtualMagazineCargo;
[_container, [], true, false] call BIS_fnc_addVirtualBackpackCargo;
[_container, [], true, false] call BIS_fnc_addVirtualItemCargo;

However you can not use holdAction with a limited arsenal (afaik).

PS. above code has NOT been tested, so may need changes

tidal ferry
#

🙏 You're a legend, will test out soon

#

Will this work in a holdAction?

exotic flax
#

However you can not use holdAction with a limited arsenal (afaik).

tidal ferry
#

Ahhh, damn

exotic flax
#

BIS_fnc_arsenal will automatically add an addAction to it.

tidal ferry
#

Yeah, we were just hoping to have a holdaction for a specific thing with our armory

#

Vs. the normal addAction

exotic flax
#

You could try ["Open", false] call BIS_fnc_arsenal in a holdAction, and change the 3rd param of "AmmoboxInit" to false

#

never tried it though... I only use ACE Arsenal

tidal ferry
#

Yeah, sadly we've tried but it doesn't want to cooperate, it just has it so that only player items are available in the arsenal

#

We'll try it again with this though

#

Yeah, tried that, sadly didn't work

#

And where should I put the above script?

#

OHH I GOT IT

#

Just need to add it to missionnamespace instead of an actual physicalized object

#

Sweeeeet

#

Got it working, thanks anyhow!

agile pumice
#

I'm trying to call a function through the arsenalClosed scripted event handler. The event handler itself doesn't seem to call the function fn_createCam but when I local execute the function after the arsenal is closed manually, it works fine.

arsenalClosed_ScreenTime = [missionNamespace, "arsenalClosed", {
    call fn_createCam;
    hint str "closed";
}] call BIS_fnc_addScriptedEventHandler;
``````sqf
fn_createCam = {
    /* create camera and stream to render surface */
    screentime_cam = "camera" camCreate [0,0,0];
    screentime_cam cameraEffect ["External", "Back", "uavrtt"];

    /* attach cam to gunner cam position */
    screentime_cam attachTo [uav, [0,0,0], "PiP0_pos"]; 

    /* make it zoom in a little */
    screentime_cam camSetFov 0.1;

    /* switch cam to NVG */
    "uavrtt" setPiPEffect [2];

    /* adjust cam orientation */
    Draw3D_ScreenTime = addMissionEventHandler ["Draw3D", {
        _dir = (uav selectionPosition "laserstart") vectorFromTo (uav selectionPosition "commanderview");
        screentime_cam setVectorDirAndUp [_dir, _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]];
    }];
    
    tv setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
};```
ashen warren
#

Just trying to get a simple stress meter working but I can't seem to get it to register. hint value just says 0 still when firing. any advice on what I might be screwing up.

_stress = 0;

player addEventHandler
["firedNear",
    {
        _unit = _this select 0;
        if ((_unit getVariable ["_stress", 0]) < 100) then
        {
            _unit setVariable ["_stress", (_unit getVariable ["_stress", 0]) + 1];
        };
    }
];
player addEventHandler
["hit",
    {
        _unit = _this select 0;
        _unit setVariable ["_stress", 100];
    }
];


while {true} do {
hint ("Stress = " + (str _stress));

    sleep 0.2;
};
little raptor
agile pumice
#

I don't see a point in assigning _stress and using "_stress" as a variable?

player addEventHandler
["firedNear",
    {
        _unit = _this select 0;
        if ((_unit getVariable ["stress", 0]) < 100) then
        {
            _unit setVariable ["stress", (_unit getVariable ["stress", 0]) + 1];
        };
    }
];
player addEventHandler
["hit",
    {
        _unit = _this select 0;
        _unit setVariable ["stress", 100];
    }
];


while {true} do {
    hint ("Stress = " + (player getVariable ["stress", 0]));
    sleep 0.2;
};
little raptor
agile pumice
#

@little raptor removeMissionEventHandler ["Draw3D", Draw3D_ScreenTime];`` runs in another event before the camera is created again

#

and my scripted event handlers are removed on object death as well

ashen warren
agile pumice
#

oh yeah, sorry

#

I'm used to using hint format

#

hint format ["Stress = %1", player getVariable ["stress", 0]]

ashen warren
#

YES. thanks man. Running on 4 hrs of sleep

agile pumice
#

@little raptor do you think the issue has something to do about time scheduling? (called too soon?)

little raptor
#

where do you call it?

#

and are you sure fn_createCam is defined?

agile pumice
#

its executed in an sqf via execVM through the UAV's init, and it is called at the start of the mission successfully

#

and I'm local executing (successfully) like this:

fn_createCam = { 
    /* create camera and stream to render surface */ 
    screentime_cam = "camera" camCreate [0,0,0]; 
    screentime_cam cameraEffect ["External", "Back", "uavrtt"]; 
 
    /* attach cam to gunner cam position */ 
    screentime_cam attachTo [uav, [0,0,0], "PiP0_pos"];  
 
    /* make it zoom in a little */ 
    screentime_cam camSetFov 0.1; 
 
    /* switch cam to NVG */ 
    "uavrtt" setPiPEffect [2]; 
 
    /* adjust cam orientation */ 
    Draw3D_ScreenTime = addMissionEventHandler ["Draw3D", { 
        _dir = (uav selectionPosition "laserstart") vectorFromTo (uav selectionPosition "commanderview"); 
        screentime_cam setVectorDirAndUp [_dir, _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]]; 
    }]; 
     
    tv setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"]; 
}; 
 
screen_texture = (getObjectTextures tv) select 0; 
call fn_createCam;```
#

its verbatim copy/paste from the sqf

#

so I'm really not sure what the issue could be at this point

little raptor
ashen warren
#

trying to get this thing to subtract and not entirely sure what I need to do

lowerstress = -0.10;

player addEventHandler
["firedNear",
    {
        _unit = _this select 0;
        if ((_unit getVariable ["stress", 0]) < 60) then
        {
            _unit setVariable ["stress", (_unit getVariable ["stress", 0]) + 1];
        };
    }
];
player addEventHandler
["hit",
    {
        _unit = _this select 0;
        _unit setVariable ["stress", 60];
    }
];


while {true} do {

//If (stress <= maxstress) then
    If ("stress" > 0) then
    {
        "stress" + "lowerstress" = "stress"
    };

    hint format ["Stress = %1", player getVariable ["stress", 0]];
    sleep 0.2;
};```
agile pumice
#

@void rover I just tried hint str fn_createCam; in both locations and it worked each time. Testing in eden editor

#
If ("stress" > 0) then
    {
        "stress" + "lowerstress" = "stress"
    };
``` isn't this a proof of concept or?
ashen warren
#

at this point I guess proof of concept

agile pumice
#

There isn't really a point in defininglowerstress

#

In your while true block (should be while alive player)

if (player getVariable ["stress", 0] > 0) then {
player setVariable ["stress", player getVariable ["stress", 0] - 0.10]; //lower stress over time
};```
#

and then I would make a respawned event handler to reset the stress variable back to 0

drifting sky
#

does _vehicle unit work on a corpse in the killed event handler?

ashen warren
agile pumice
#

I'm not sure

#

but I put some more code together

#
//Max stress is 60
//stress is set to 60 (max) when shot
//stress is increased by 1 when another unit fires nearby
//stress should reset on player respawn

player addEventHandler
["firedNear",
    {
        _unit = _this select 0;
        _stress = _unit getVariable ["stress", 0];
        if (_stress < 60) then
        {
            _unit setVariable ["stress", _stress + 1];
        };
    }
];

player addEventHandler
["hit",
    {
        _unit = _this select 0;
        _unit setVariable ["stress", 60];
    }
];

while {alive player} do {
    _stress = _unit getVariable ["stress", 0];
    if (_stress > 0) then {
        player setVariable ["stress", _stress - 0.10]; //lower stress each second
    };

    hint format ["Stress = %1", _stress];
    sleep 1;
};
#

still error?

ashen warren
#

while {alive player} do {
_stress = _unit getVariable ["stress", 0];
if (_st>
22:05:39   Error position: <_unit getVariable ["stress", 0];
if (_st>```
agile pumice
#

is that the entire error?

#

oh sorry

#

that _unit needs to be player

#
//Max stress is 60
//stress is set to 60 (max) when shot
//stress is increased by 1 when another unit fires nearby
//stress should reset on player respawn

player addEventHandler
["firedNear",
    {
        _unit = _this select 0;
        _stress = _unit getVariable ["stress", 0];
        if (_stress < 60) then
        {
            _unit setVariable ["stress", _stress + 1];
        };
    }
];

player addEventHandler
["hit",
    {
        _unit = _this select 0;
        _unit setVariable ["stress", 60];
    }
];

while {alive player} do {
    _stress = player getVariable ["stress", 0];
    if (_stress > 0) then {
        player setVariable ["stress", _stress - 0.10]; //lower stress each second
    };

    hint format ["Stress = %1", _stress];
    sleep 1;
};
ashen warren
#

Crap i should of saw that

agile pumice
#

I wish my problematic code gave me errors

ashen warren
#

that works now

agile pumice
#

instead it just doesn't work

ashen warren
agile pumice
#

dope

#

change the values as you see fit

ashen warren
#

yea I need to set it so it doesn't give an overflow error when it goes down. Apparently I need to set it so it don't go below zero

agile pumice
#

that's what if (_stress > 0) then { should be preventing

#

actually you have to do some math there

#

that if statement has to expect the reduction

ashen warren
#

it was supposed to -0.10 a second

agile pumice
#

if ((_stress - 0.10) > 0) then otherwise it WILL go below 0 at some point

ashen warren
#

sorry wait -0.10 every 0.2 seconds

agile pumice
#

i figured that loop would be unnecessarily tasking but adjust it as you need

ashen warren
agile pumice
#

If anyone has a chance to look over my code and find the issue, send me a DM, I may forget to check back tomorrow

#

don't forget to write that respawned event handler

ashen warren
#

Rewriting a script that had worse optimization. old habits

#

more like a bandaided script

agile pumice
#

I'm gonna heard to bed, good luck with the rest of your script

ashen warren
#

Thanks, thanks for the help

tough abyss
#

Excuse me there good sir

#

How does one use the scripting tool to spawn the VR Entity suits

#

U_O_Soldier_VR < those

tough abyss
#

another quick question, I saw nvgs that had same capabilities as viper helmet although they had default model, are those seperate items or normal NVGs that got fucked around with a bit

warm hedge
#
  1. Language please
  2. Define capabilities you mean
tribal onyx
#

How do I reference a specific location/city? I know nearestLocation exists, but what if I just wanna point to like the village of "Koroni" on Altis halfway across the map, not close to anything?

tough abyss
warm hedge
tough abyss
#

oh

warm hedge
#

Then, what's the question though? You saw an ENVG-II NVG but... what?

tough abyss
#

if you get those the same way

warm hedge
#

It's available in-game without do anything

tough abyss
#

wait really?

#

also btw how do I actually use the script

warm hedge
tough abyss
#

Alright thanks

#

well r.i.p dev console doesnt actually do anything with it

#

apparently I gotta do some wack stuff and put it in a folder somewhere

#

it was a good run

warm hedge
crude prism
#

Good day, i'm trying to get a npc to speak to the specific player that entered the trigger, in a trigger chat. And need a little help

C1 sideChat "It's great to see you again "insert player entering the trigger". Now what can I do for you?" 
warm hedge
#

Don't use " inside a "

warm hedge
crude prism
#

Yeah, it was just to mark where is was thinking the player was going to be named, my mistake to show it of that way

tough abyss
#

Oo thx

warm hedge
crude prism
#

yeah

warm hedge
#

format, thisList#0 maybe?

crude prism
#

so if you and me are in a mission, it names whoever goes in the trigger first

warm hedge
#
C1 sideChat format ["It's great to see you again %1. Now what can I do for you?",name (thisList#0)]```
crude prism
#

Its gives a generic error

warm hedge
#

How?

crude prism
#

It says "error generic error in expression" when I enter the trigger

warm hedge
#

I tested on player so it's player but besides that it's working properly here

crude prism
#

Got it to work on player, but not when I want a npc to say it

#

Im probbaly doing something wrong there then

#

It was me messing up the variable, thx for the help

astral tendon
#

How to get the array of sound names for the CFG sounds?

astral tendon
#

Does not work, it does not return names.

little raptor
#

configClasses

winter rose
#

oh, then get children classes yes

#

and use configName

astral tendon
#
_sounds = [];
_array = "true" configClasses (configFile >> "CfgSounds");
{_sounds append [configName _x]} forEach _array;
_sounds

it worked

#

but is very slow

cosmic lichen
#

apply

little raptor
astral tendon
#

thanks

little raptor
#

config reading is slow

cosmic lichen
#

Should be fast enough

#

except you are doing onEachFrame {code} 😄

hollow thistle
#

If you're doing it multiple times cache it into global var.

still forum
ashen warren
#

hey guys, I understand that when you have a continuous loop going, it doesn't continue on down the page. Is there a way to get a return value for stress for me to pass along? ```sqf

while {alive player} do {
_stress = player getVariable ["stress", 0];

if ((_stress - 0.10) > 0) then{
player setVariable ["stress", _stress - 0.10]; //lower stress each second
};

//hint format ["Stress = %1", _stress];
sleep 0.2;

};

#

want to pass this on to a switch command in a different script.

winter rose
#

wait, to a different script? use a global var

ashen warren
#
while {alive player} do {
    _stress = player getVariable ["stress", 0];
 
if ((_stress - 0.10) > 0) then{
        player setVariable ["stress", _stress - 0.10]; //lower stress each second
    };

    //hint format ["Stress = %1", _stress];
    sleep 0.2;
_stress
};```
ashen warren
winter rose
#

no, TAG_myGlobalVar = _stress;

ashen warren
# winter rose no, TAG_myGlobalVar = _stress;

Am i understanding u correctly?

Parameters.sqf
  --
//preprocessFileLineNumbers
_stressCheck = compileFinal preprocessFileLineNumbers "test.sqf";

//Stress
ADT_Stress = _stress;



//Is it day? (other tracks at night)
isDay = 1;

 Call _stresscheck;

While {true} do{

    hint format ["Stress = %1", _stress];
sleep 0.2;
};

--
test.sqf
--
player addEventHandler
["firedNear",
    {
        _unit = _this select 0;
        _stress = _unit getVariable ["stress", 0];
        if (_stress < 60) then
        {
            _unit setVariable ["stress", _stress + 1];
        };
    }
];

player addEventHandler
["hit",
    {
        _unit = _this select 0;
        _unit setVariable ["stress", 60];
    }
];

while {alive player} do {
    _stress = player getVariable ["stress", 0];
 
if ((_stress - 0.10) > 0) then{
        player setVariable ["stress", _stress - 0.10]; //lower stress each second
    };


    sleep 0.2;
};
--```
#

but then that is just undefined _stress?

winter rose
#

that's one WOT

winter rose
# ashen warren but then that is just undefined _stress?

I don't know what I am looking at, but let's simplify the question:

// script1
private _stress1 = 0;
// ...
_stress1 = 0.5;
My_Global_Var = _stress1;
``````sqf
// script2

waitUntil { sleep 1; not isNil "My_Global_Var"; };
private _stress2 = My_Global_Var;
little raptor
#

//lower stress each second
...
sleep 0.2
thonk

ashen warren
ashen warren
#

?

winter rose
#

I would use unit setVariable ["CHEIF_stress", 1];

little raptor
#

always put tags in your "global" variables

ashen warren
#

but the only thing is, If i use spawn, it would just rerun it over and over again?

little raptor
#

um, wat?

#

spawn creates a new "thread"

#

so you can "detach" a code execution from the current one

#
Parameters.sqf
  --
//preprocessFileLineNumbers
_stressCheck = compileFinal preprocessFileLineNumbers "test.sqf";

//Stress
ADT_Stress = _stress;



//Is it day? (other tracks at night)
isDay = 1;

 Call _stresscheck;

While {true} do{

    hint format ["Stress = %1", _stress];
sleep 0.2;
};

--
test.sqf
--
player addEventHandler
["firedNear",
    {
        _unit = _this select 0;
        _stress = _unit getVariable ["stress", 0];
        if (_stress < 60) then
        {
            _unit setVariable ["stress", _stress + 1];
        };
    }
];

player addEventHandler
["hit",
    {
        _unit = _this select 0;
        _unit setVariable ["stress", 60];
    }
];
[] spawn {
while {alive player} do {
    _stress = player getVariable ["stress", 0];
 
if (_stress > 0) then{
        player setVariable ["stress", (_stress - 0.10) max 0]; //lower stress each second
    };

    //hint format ["Stress = %1", _stress];
    sleep 0.2;
};
};
//do other stuff here
ashen warren
#

If i wanted a return value ```sqf
test.sqf

player addEventHandler
["firedNear",
{
_unit = _this select 0;
_stress = _unit getVariable ["stress", 0];
if (_stress < 60) then
{
_unit setVariable ["stress", _stress + 1];
};
}
];

player addEventHandler
["hit",
{
_unit = _this select 0;
_unit setVariable ["stress", 60];
}
];
[] spawn {
while {alive player} do {
_stress = player getVariable ["stress", 0];

if (_stress > 0) then{
player setVariable ["stress", (_stress - 0.10) max 0]; //lower stress each second
};

//hint format ["Stress = %1", _stress];
sleep 0.2;

};
};
_stress

little raptor
#

this code simply adds event handlers

#

you can't get return values from it

#

(at least not what you have in mind)

#

I'm pretty sure you don't understand the concept of event handlers and threads
these codes are being executed "somewhere else"

ashen warren
#

need a return value or some sort of variable that gets passed to a switch that reacts to whether _stress is over a certain threshold

little raptor
#

well then you have to define that switch in the event handler code (that's the only place where your "stress" goes up)

ashen warren
#

trying not to make the same mistake of having 100 if then statements

little raptor
#

preferably in a new function

#

because event handlers have a bug

#

they always recompile their code (it's stored as a string)

ashen warren
#

well at this point I am just trying to get this to allow the stress value get to the actual controller that will actually define what is going on

little raptor
#

I already told you how to do it

little raptor
#

if you need the value in a loop (e.g for suppression effects), you can use the "cooldown" loop (what I defined in the spawn) instead

wind hedge
#

Can some kind soul point me to the script in Arma 3 PBO files that handles the nametags that appear over every unit when in DEV spectator mode?

little raptor
#

expectator?!

winter rose
little raptor
#

what's the difference between dev and stable spectators?

winter rose
#

@wind hedge ↑

wind hedge
#

Yes my dears, spectator mode "nametags"

#

I want to copy the script

little raptor
#

you can find that function in function viewer

#

then use its path to find the PBO

wind hedge
#

Ok got it 😉

ashen warren
# little raptor if you need the value in a loop (e.g for suppression effects), you can use the "...

I figured it out and made a switch.

trying to make sure the _mode gets detected but says it is missing a ). when I // all the If (_mode = "truce) then or combat statements, error goes away. when I do the hints in the switch loop it detects the right values for stress.

16:42:36 Error in expression < {
while {alive player} do 
{
if (_mode = "truce") then
{
Hint format ["no"];
};>
16:42:36   Error position: <= "truce") then
{
Hint format ["no"];
};>
16:42:36   Error Missing )
_mode = "  "

while {alive player} do 
{
_stress = player getVariable ["stress", 0];
//define combat mode
Switch true do
{
 case (_stress <= 50):
    {
        _mode = "truce";

    };
 case (_stress > 50):
    {
        _mode = "combat";
        
    };
};
};
sleep 1;
};


[] spawn 
{
while {alive player} do 
    {
        if (_mode = "truce") then
        {
            Hint format ["no"];
        };
        if (_mode = "combat") then
        {
            Hint format ["yes"];
        };
    Sleep 1.0;
    };
};
ashen warren
#

really

wind hedge
#

the command isEqualTo also works like == but is slightly faster.

little raptor
little raptor
#

and not much faster (if anything, it's the same)

ashen warren
#

it was a test to make sure variables were passing

wind hedge
#

😅

ashen warren
#

but why have 2 definitions of =, makes little sense

#

nvr mind it works

little raptor
ashen warren
#

ok

#

still is dumb

little raptor
#

do you mean to compare them? or store one into the other?

ashen warren
#

I guess my background on this particular subject is quite limited. I don't have a response

#

id say compare

jade tendon
#

can someone please explain this error
(I have s screenshot of the error, just can't put it up here)
_unit = _this select o;
error select: type object, expected array,string,config entry

pastebin of the complete code
https://pastebin.com/bgcmArhA

little raptor
#

you're passing an object to your code

#

for example:

#
player call {
_unit = _this select 0; //Error: _this is an object (player)
}
winter rose
#

(a reason among others to use params)

little raptor
#

params still cannot fix this

winter rose
#

it can

little raptor
#

it expects array

winter rose
#
player spawn {
  params ["_unit"]; // works
};
#

not call

#
player call {
  params ["_unit"]; // does it work?
  _this params ["_unit"]; // does it work?
};```
little raptor
#

that makes no sense

#

are you sure?

winter rose
#

quite sure

little raptor
#

if it works with spawn, it also works with call (what matters is what you pass to it)

winter rose
#

I am tired 😄 dunno

#

then yes it works 😄

distant oyster
#

can confirm, params takes array or single value

winter rose
#

which is sometimes a pain to debug, when you should pass an array and provide _array params instead of [_array] params

little raptor
#

yeah, I'd say it was a bad call

jade tendon
#

ok so
1: i wrote this with very basic understanding of scripting
2: the above script (pastebin link) has worked perfectly before on both ai and player
3: code snippet of what i am trying to do

// dead driver setup
removeBackpack _driver;
removeVest _driver;
[_driver] execVM "scripts\rvg_frith_eos_random.sqf";
[_driver] call RVG_fnc_AddLoot;
_driver moveindriver _veh; // move driver to driver seat of above spawned vehicle
_driver action ["Eject", vehicle _driver]; // eject driver from driving seat (... its a placement thing)
sleep 0.2;
_driver setdamage 1; // kill driver

4: last run of the code worked for the above code snippet but did not work for the player later in the script

player execVM "scripts\rvg_frith_eos_random.sqf";
player moveincargo [_veh, 2]; // seat pos 2 for player
little raptor
#

player execVM "scripts\rvg_frith_eos_random.sqf";

#

but anyway, you can use params instead of fixing that

#

as we discussed

agile pumice
#

I'm trying to use these two events to call functons for my camera script, but there's a long delay with the open event for some reason

arsenalOpened_ScreenTime = [missionNamespace, "arsenalOpened", {
    call fn_destroyCam;
}] call BIS_fnc_addScriptedEventHandler;

arsenalClosed_ScreenTime = [missionNamespace, "arsenalClosed", {
    call fn_createCam;
}] call BIS_fnc_addScriptedEventHandler;
#

so its possible for the closed event to fire before the opened event

little raptor
agile pumice
#

@little raptor I actually did get an undefined variable in expression error for fn_destroyCam during one of my last tests

#

you asked me to check that variable last night

#

I'm looking for a faster way to call fn_destroyCam on arsenal init, and have the camera be created properly when the aresenal closes. At this time it does not get recreated properly

#

unless I call fn_createCam manually

#

I haven't tested it in a perfectly clean mission

agile pumice
#

@little raptor just tried it with a blank mission, same issue

warm hedge
agile pumice
#

I mean the event doesn't trigger when the interface is open right away

#

I decided to call execVM "screentime.sqf"; in initplayerlocal.sqf instead of the uav's init box

#

fn_destroyCam is an undefined variable in ScriptedEventHandler_arsenalOpened = [missionNamespace, "arsenalOpened", {call fn_destroyCam}] call BIS_fnc_addScriptedEventHandler; This error appears to only happen once. At which point I'm no sure.

#
23:10:18   Error position: <fn_destroyCam}] call BIS_fnc_addScripted>
23:10:18   Error Undefined variable in expression: fn_destroycam
23:10:18 File C:\Users\eagle\Documents\Arma 3 - Other Profiles\J%2e%20Hachey\missions\uavscreentest.VR\screentime.sqf..., line 36```
#

I tried just putting the content of the function there instead but the general issue (camera not being recreated) still occurs

little raptor
dusky wolf
#

I have a heal trigger that is meant to heal everybody in the trigger area (with ace fullHeal) once every 5 seconds. Unfortunately it is healing everybody on the map. Do I just need to replace player with (thisList select 0) in the activation field?

_Condition_
this and ((getPos (thisList select 0)) select 2 < 1);

_Activiation_
_handle= [] spawn {  
 
    _sleep = 5; 
    _trigger = healZone; 
  
    waitUntil { 
        player setDamage 0; 
        player setFuel 1; 
        [player, player] call ace_medical_treatment_fnc_fullHeal; 
        sleep _sleep; 
        not ((getPos player) inArea _trigger); 
        };  
  
}; 
jade abyss
#

afaik not

#

At least, the action won't be executed

buoyant hare
#

I'm using the civilian presence module on which any civilian that spawns will have a hold-down-button-action which gives you a reply after you question him. Everything works fine when I test it on my client through the 3Den Editor. However, when I'm on dedicated server the functions disableAi, enableAI and lookAT won't trigger at all, and the say3Dis just local to the plt_interpreter.

[_this,
"Interrogate civilian",
"\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa",
"\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa",
"_this == plt_interpreter && _this distance _target < 4 && (alive _target) && !(_target getVariable ['ACE_isUnconscious', false]);",
"_caller distance _target < 4",
{
_target disableAI "PATH";
_target lookAt _caller;
_question = selectRandom [1,2,3];
switch (_question) do {
case 1: {hint parseText "<t size='1.5'>Question 1</t>"; }; 
case 2: {hint parseText "<t size='1.5'>Question 2</t>";};
case 3: {hint parseText "<t size='1.5'>Question 3</t>";};};
},
{
_target disableAI "PATH";
_target lookAt _caller;
},
{
_target enableAI "PATH";
_target say3D "sound";
_reply = selectRandom [1,2,3,];
switch (_reply) do {
case 1: {hint parseText format ["<t size='1.5'>%1: Reply 1!</t>", name _target];}; 
case 2: {hint parseText format ["<t size='1.5'>%1: Reply 2</t>", name _target];};
case 3: {hint parseText format ["<t size='1.5'>%1: Reply 5</t>", name _target];};};
},
{
_target enableAI "PATH";
},
[],
10,
0,
true,
false
] remoteExecCall ["BIS_fnc_holdActionAdd", plt_interpreter, true];

So I'm thinking that I need to remoteExecCall the aforementioned functions for them to work on a dedicated server. Any idea on how to properly remoteExecCall these functions? Thanks in advance for the help!

tough abyss
#

Good day. I am new to coding and Arma 3 modding. I have created a faction using the Alive Orbat Tool. Now I'm digging into autogen.hpp and the files to implement a code for random face wear randomisation in every unit of my faction. I have already defined which facewear ["xxxx,","xxxx"] they are able to randomly wear and so on. I only need guidance to what and where to write the randomisation code. I would be really thankful If someone could help me. Cheers!

languid oyster
#

I am about to write some rearm mod for heavy weapons like artillerys and alike. If manned with AI units, and those units are in a player squad, the player should be able to command them to rearm those vehicles.
I thought of adding a getIn event handler to all those vehicles.
Now, there are plenty of vehicles without weapons, like trucks etc.
Is there a smart way to add the event handler only to vehicles with a weapon? Or do I have to manualy add their names one by one?

winter rose
languid oyster
#

@winter rose Hm, will give it a try. Thank you.

buoyant hare
tough abyss
tough abyss
#

Is there also a function to apply this to all units or do I need to do it invidually?

#

Ah I don't know about what the alive orbit tool produces, can't help with that. Ultimately it needs calling on unit initialisation

#

would it be too much for you to do if I upload the file and take a look lol

verbal whale
#

guys any one know script to open arsenal/ace arsenal based on items in container , I mean that the arsenal available items will be limited based on container content and their counts , and also by removing items from the the arsenal it should be moved to the container

agile pumice
#

@little raptor I thought spawning was when you execute a code block or a function in a scheduled environment?

#

And calling was when you execute a code block or a function in unscheduled

#

Is a code block defined as a variable never a function if it isn't compiled? Is it the compiling that makes it a function?

winter rose
brave lotus
#

how to append two object arrays? I want to combine the results of multiple nearestObjects together into one array so I can forEach it. Do I just do it as
_results = nearestObjects[ stuff ]; _tempresults = nearestObjects[ more stuff but different params ]; _results append _tempresults; _tempresults = nearestObjects [ even more stuff but different params ]; _results append _tempresults; { processing stuff } forEach _results;

brave lotus
#

Thanks, the examples just show single bracketed values being added, wasn't sure if it worked with objects. Getting there slowly.. 🙂

winter rose
#

sure - don't hesitate to ask here if something is unclear to you

agile pumice
#

Oh yeah, you right

#

I think I'll just try defining destriyCam and createCam in cfgFunctions. But it's strange that only fn_destroyCam isn't recognized

little raptor
#

iirc it should've been

naive stag
#

Hey guys, not sure if this is the correct channel to ask for help with a script ?Forgive me if its not

naive stag
#

Thanks @little raptor
Im looking for a script that once a player joins the mission the screen stays black for 10secs till a sound file have done playing.
Would titlecut work for that ?

sonic thicket
#

Hey guys, this may not be entirely script related but i feel as if this still is the right channel to ask. I am looking for a list of objects that emit sound by default (Such as the wind turbine) Would anyone know where to find such a list?

little raptor
naive stag
agile pumice
#

@little raptor I haven't updated the code yet. Using the script in a clean mission resolved the ArdenalOpen event being delayed though

little raptor
agile pumice
#

That's no longer the case

#

I'm strictly using event handlers, no while loops.

#

Aldo I'd like to note, that as far as I am aware, just because an eventhandler inside an sqf is executed via execVM,doesn't mean that the code in the event handler is spawned.

little raptor
#

Never spawn code inside event handlers (unless you have a good reason to do so)

agile pumice
#

Is the code inside event handlers scheduled by default?

still forum
#

huh, why not?

still forum
little raptor
still forum
little raptor
#

not saying never

#

but you generally don't need it

agile pumice
#

Well that's true for spawning any code

still forum
#

I would say, if you don't know code, always spawn

#

that way you cannot cause bad lag spikes in your eventhandling

little raptor
#

but you cripple the scheduler instead

#

¯_(ツ)_/¯

still forum
#

meh

agile pumice
#

Anyways, I'm fairly certain that code in an event handler is unscheduled by default regardless if you include it in an execVM executed sqf, and thus not spawned like you said.

still forum
#

execVM is spawn

#

execVM'ed code is spawned and thus scheduled

#

engine eventhandler code is always unscheduled

agile pumice
#

So if I put an event handler in an sqf that's ran with exexVM, the content of the event handler is scheduled?

still forum
#

"just because an eventhandler inside an sqf is executed via execVM, that the code in the event handler is spawned."
no. The eventhandler code doesn't know how it was added

little raptor
still forum
#

it doesn't know if the eventhandler was added in scheduled or unscheduled code.

still forum
agile pumice
#

That's what I've been trying to say.

still forum
#

if you execVM code, the execVM'ed code is ran scheduled

#

if you use execVM inside a eventhandler, the execVM'ed code is still scheduled

agile pumice
#

"if you use execVM inside a eventhandler, the execVM'ed code is still scheduled" okay I see the confusion now

#

I was referring to earlier when I noted that I was calling code ("call fn_destroyCam") in my event handler, and was told that it was actually being spawned

little raptor
#

because you execVMed

#

so you were spawning the code

#
...AddEventHandler [..., { //<- this code is unscheduled
[] execVM "..." //<- but what this executes is scheduled
}]
agile pumice
#

I was only ever referring to the event handler.

#

I understand that the content of my sqf is scheduled because its executed with ezecVM. Let's please move on to the content of the eventhandlers

#

I don't want to waste anyone's time and patience talking in circles

#

There's the code again

#

The main scope is scheduled

#

When I get home I'm going to include those two "functions" in a cfgFunctions to make them actually compiled functions

still forum
#

your functions are also "compiled" 😄

#

A "compiled" function is a variable that contains type CODE.
Which is what CfgFunctions does for you, or what you already have there

#

MissionEventHandler_Draw3D/screentime_cam
Its good practice to prefix global variables with your own unique prefix.
Like Hac_Draw3DHandler

#

so you cannot possible conflict with other mods or other peoples code

agile pumice
#

Leopard was right in what he was referring to. I misspoke when I said '''I decided to call execVM" I thought he was referring to the evenhandler I was having trouble with

#

We were talking about two different things, apologies for confusion.

#

I also said the opposite of what I meant to I n a previous reply which I have since edited

#

"Aldo I'd like to note, that as far as I am aware, just because an eventhandler inside an sqf is executed via execVM,doesn't mean that the code in the event handler is spawned."

#

Sorry work is stressful and I'm not thinking clearly

#

I'm also adjusting to new contact lenses and having difficulty reading my small phone screen

slate cypress
#

Is this channel appropriate for help with config.cpp?

cosmic lichen
#

Does anyone know where I would find the scripts for High Command? The modules have function = "";

#

Or is it engine driven?

little raptor
#

no it's not engine driven afaik

#

let me check

exotic flax
#

/a3/modules_f/hc/data/scripts

#

🤷‍♂️

ripe sapphire
#

hey hey, i booted up 2 game instances and joined local server, and i used setPosWorld on the client server, result is the object is moved immediately on the server instance, but around 10-15 seconds late on client server

#

any ways around this?

#

i tried all of the setpos commands not much diff, results just like above

little raptor
ripe sapphire
#

no sim enabled

#

with sim disabled it takes around 50 seconds even

#

and i dont think its ping since its literally my own pc running 2 instances? lol

#

no lag either

little raptor
#

try this (it's bad but let's just test it):

[object, pos] remoteExec ["setPosWorld"]
ripe sapphire
#

server is always instant

#

should i make support ticket?

little raptor
little raptor
ripe sapphire
#

but it was with sim disabled on the object

little raptor
#

the sim disabled one is intentional

#

I asked

ripe sapphire
#

i see

little raptor
ripe sapphire
#

did you get answer for how long after simulation enabled does the network updates return to normal?

little raptor
#

no, I didn't ask that

#

but if you have simply one object, it doesn't hurt to have sim enabled

ripe sapphire
#

i guess yes, but what if its a floating in the air object

#

also i tried using remoteexec hideobject and it synced instantly for client and server, so using 2 objects and hiding and showing each of them accordingly can be a workaround too

little raptor
ripe sapphire
#

ye but its triggered after an action from a client (via addaction)

#

better to remoteexec hideobject to everyone or remoteexec hideobjectGlobal to server?

ripe sapphire
#

ok got it

agile pumice
#

Sorry, trying to correct on my phone

#

Instead of something*

little raptor
#

well why did you delete the whole message?

agile pumice
#

I didn't mean to, having difficulties here lol

#

Let me try again, do you think its possible the issue has to do with using Draw3D for the mission event handler that sets the vector for the camera in fn_createCam? And that's what is conflicting with the arsenal display?

little raptor
#

I don't know. I have to see the script

agile pumice
#

I was thinking of trying on each frame instead

#

I'm not at home so I can't change anything yet

#

To describe the problem, the render surface becomes black after opening the arsenal, and stays that way after closing it

little raptor
#

@agile pumice

screentime_cam = "camera" camCreate [0,0,0];
screentime_cam cameraEffect ["Terminate", "Back", "uavrtt"];
screentime_cam cameraEffect ["External", "Back", "uavrtt"];
#

that's how you "recreate" the effect

ripe sapphire
#

ok i was testing the setpos thingy again and uncovered a dark truth

#

so apparently the sync problem was tied to a certain kind of object

#

at first i was using object "shoot house panels" (vanilla) for the setPosWorld, result is delayed 5-10 secs, longer if disabled sim

#

just now i used a ammo box for the setposworld, result = instant sync between client and server, even with disabled sim!

#

i ran this code

box setPosWorld [5268.46,529.234,5.00144];
dor setPosWorld [5268.46,549.234,5.00144] 

with box being ammo box and dor being the shoot house panels, confirmed the result was instant move for disabled sim box, and delayed for shoot house panels

agile pumice
#

@little raptor I did try it, had no effect

#

But as I said, without terminate Included, if I manually execute the createcam code, it works

#

Just not when the arsenalclosed eventhandler calls the code

#

What does the terminate effect do that deleting the cam doesn't?

#

I couldnt find an explanation on the wiki for what the effects actually do

winter rose
#

terminate leaves the camera

agile pumice
#

Why would I want to do that right after creating it?

winter rose
#

maybe it resets a camera state, idk

dreamy kestrel
#

Q: what is the namespace for function params ["...", "...", "...", ...] in a function? i.e. I can test isNil "..." right, but is it localNamespace getVariable "...", for instance? seemingly not, though I wonder if/what it might be. or do I have to set one up?

still forum
#

its a local variable

#

you cannot access their "namespace"

#

their namespace is the current scope

winter rose
#

scopeNamespace soon\™

dreamy kestrel
#

ah I see. soon but not yet. meanwhile it's a bit ugly, but CBA_fnc_createNamespace and CMB_fnc_deleteNamespace...

winter rose
#

scopeNamespace was just me kidding about it, it is not going (?) to be a thing (afaik)

grizzled lagoon
#

hello,i have try to spawn fire and after get fire for delte but the problem is if i cursorObject... is return nil

#
            _feu = "#particlesource" createVehicle (getPos player); 
            _feu setParticleClass "BigDestructionFire";
            _name = "feu_" + (str (round (random 1000)));
            _feu setVariable [_name, [50, 70], false];
            _feu setVehicleVarName _name;
            _pos = getpos _feu;
            if (isnil "john_feu") then {john_feu = [];};
            john_feu pushBack [_name, _pos];```
#

i have try to detect with postion player but the problem is for delete

still forum
dreamy kestrel
#

see above ^^ that is my use case

exotic flax
#

The "namespace" of params is current scope, nothing more nothing less. It's simply extracting an array (by default _this) into private variables.
If you need to test if a variable exists after using params... you did something wrong

agile pumice
#

Well I fixed my problem

waitUntil {isnull (uinamespace getvariable "RSCDisplayArsenal")};
        sleep 0.2;
#

needed to sleep before recreating the camera for some reason

dreamy kestrel
#

@exotic flax I can promise you I did nothing wrong. and I have a case where I need to test elements in the params.

still forum
#

A lifer just DM'ed me for help with his script.
Here have a PSA for everyone on how to do key-value store and how not to do it.

This is inefficient
[["id",2023],["name","Jean Maurice"],["aliases",["Jean Maurice"]],["steam_id","_SP_PLAYER_"],["cash","5671475"],["bank","161716002"]]

you need to iterate over every array in script and check if the first value is what you want. And as I said, looping in engine is faster than looping in script.
basically doing

_cashIndex = _array findIf {_x select 0 == "cash"}; // loop in script
_cashValue = _array select _cashIndex select 1;

compare it with this

[["id","name","aliases","steam_id","cash","bank"], [2023,"Jean Maurice",["Jean Maurice"],"_SP_PLAYER_","5671475","161716002"]]

_cashIndex = (_array select 0) find "cash"; // loop in engine
_cashValue = (_array select 1) select _cashIndex;

Lets compare performance in debug console trying to get the cash value.

Your format:

_array = [["id",2023],["name","Jean Maurice"],["aliases",["Jean Maurice"]],["steam_id","_SP_PLAYER_"],["cash","5671475"],["bank","161716002"]];
_cashIndex = _array findIf {_x select 0 == "cash"};
_array select _cashIndex select 1;

Result: 0.0154 ms

My format:

_array = [["id","name","aliases","steam_id","cash","bank"], [2023,"Jean Maurice",["Jean Maurice"],"_SP_PLAYER_","5671475","161716002"]];
_cashIndex = (_array select 0) find "cash";
(_array select 1) select _cashIndex;

Result: 0.0068 ms

HashMap:

_hashMap = createHashMapFromArray [["id",2023],["name","Jean Maurice"],["aliases",["Jean Maurice"]],["steam_id","_SP_PLAYER_"],["cash","5671475"],["bank","161716002"]];
_hashMap get "cash";

Result: 0.0098 ms

#

But you are not usually creating the arrays, mostly reading them.
So if we compare the reading performance of the 3 variants with arrays that are already present

Your current array format:

_cashIndex = GVAR_array findIf {_x select 0 == "cash"}; 
GVAR_array select _cashIndex select 1;

Result: 0.0116 ms

My array format:

_cashIndex = (GVAR_array select 0) find "cash"; 
(GVAR_array select 1) select _cashIndex;

Result: 0.0038 ms

HashMap:

GVAR_hashMap get "cash";

Result: 0.0018 ms

exotic flax
still forum
#

creating a cba namespace isn't really that cheap

dreamy kestrel
#

hrm, well, yes, taking a step or two backwards from it, coming up with better default values is the better approach I think.

exotic flax
#

Null, ObjNull (or any of the *Null values), [], false, ""

#

good ways to ensure it's the correct type, but easy to check if usable

regal night
#

So, I don't know anything about scripting, but recently I found a script that fixed a problem that I had for a long time, it allows other squads to help squads of the same faction. The issue is that ALL units of the same faction react. I want to edit this to only have ONE squad that is the closest distance to react. Not sure how to do this. Sorry for the dumb question. Also here is the script in question:

#
{
    _x addEventHandler ["FiredMan", {
        params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
        
        //    https://forums.bohemia.net/forums/topic/192831-detection-script/?page=2&tab=comments#comment-3068816
        _all = [];
        _side = side _unit;

        _groups = allGroups select{
                    side _x isEqualTo _side 
                    && alive leader _x
                    };
        _groups apply {_all append units _x};        
        //    copyToClipboard str _all;
    
        {
            If(!isPlayer _x)then{
                If(isNull _x)exitWith{};
                
                if(isNil {_x getVariable "Var_GF_doMove"})then{_x setVariable ["Var_GF_doMove",false];};
                if(_x getVariable ["Var_GF_doMove",true])exitWith{};
                _x setVariable ["Var_GF_doMove",true];
                
                _x allowFleeing 0;
                _x stop false;
                _x doMove (position _unit);
            };
        }foreach _all;
        
    }];
}forEach units group _group;```
exotic flax
#

if I understand the script correct the following happens now:

  • you give a single group
  • all members on that group will get a "FiredMan" EH (aka when that person shoots a weapon)
  • when he does, it will find all groups of the same side
  • for each other group it will check each unit if it's not a player
  • each unit in the other group(s) will move to the person who fired a weapon
#

To only have 1 group react; get all the groups, and get the distance between the group leader and the person who fired the weapon

regal night
#

Yes, it originally printed a message each time a unit fired, but I removed that.

exotic flax
#

and only append the units of the closest group

regal night
#

Yeah, I'm not exactly sure how to do that though.

exotic flax
#
private _closest = gprNull;
private _closestDist = -1;
{
    if (_closest == grpNull) then {
       _closest = _x;
       _closestDist = leader _x distance _unit;
    } else {
       if (_closestDist < (leader _x distance _unit)) then {
          _closest = _x;
          _closestDist = leader _x distance _unit;
       };
   };
} forEach _groups;

_all append units _closest;
``` something like this
regal night
#

Alright, that makes some sense. How would I single that down to maybe two squads or one squad though?

exotic flax
#

the above will only give you a single group

little raptor
exotic flax
#

not? crap...

drifting sky
#

How do you add vehicle or deployable weapon ammo to a crate?

exotic flax
drifting sky
#

No, that has no effect

little raptor
#

oh wait you still want A2 variants?

drifting sky
#

A2OA

exotic flax
#

than addMagazineCargoGlobal should work if the magazines are available (and correct classnames used)

drifting sky
#

I tried this: _this addMagazineCargoGlobal ["100Rnd_127x99_M2", 100];

#

it had no effect and gave no errors

#

_this was an ammo crate

little raptor
#

but not 100

#

just 1

#

It adds 100 mags

#

not 100 ammo

drifting sky
#

I can't get it to add any mags

#

It seems like there's just no way to bring extra ammo for vehicles or emplaced weapons

regal night
#

Is there any way of forcing a waypoint placed by zeus to be a guard waypoint?

crude vigil
#

Of course there is

astral tendon
#

How to get the player original voice from CFG? I need to do that because ACE just nukes the speaker.

oblique arrow
winter rose
oblique arrow
#

awe why not?

winter rose
#

maybe better in Code_Optimisation 😉 ?

oblique arrow
#

rooBonk no more channels

#

or do you mean a wiki page?

winter rose
#

the wiki page of course!!1!

still forum
#

Most people should know that stuff already :U

winter rose
languid oyster
#

How do I find out the current number of rounds in a vehicle magazine, for the commander weapon. Commands like magazinesAmmoFull and magazinesAmmo only reveal the counts of the [0] turret. While driver or commander weapons are not covered.

#

Solved. The command magazinesAllTurrets did the trick.

real tartan
#

can I use resources (sounds) from DLC in mission when others don't own it?

still forum
#

yes

#

provided the DLC is downloaded (contact special and CDLC's aren't)

real tartan
#

dumb question: so when I use sound from Apex DLC, will users without apex playing my mission hear it ?

still forum
#

jo

digital hollow
crude prism
#

So I'm trying to give a hint to only the players getting into a specific area, read earlier that it could be done with initplayer, but was wondering if it could be done through Initfeild of a object. Getting a error on this, so if anyone have any pointers.

if (isServer) then  
{ 
 _trigger = createTrigger ["EmptyDetector", getPosWorld this, false];  
 _trigger setTriggerArea [12, 14, 0, true];
 _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];  
 _trigger setTriggerStatements ["this", "hint format 'T.Y.R. Detector: %1! I have detected traces of Ricin.Please hold your movement, equip protection gear if you have any before continuing on, report to Foxtrot for further instructions on what to do.",name player'", ""]; 
};
winter rose
#

which "error"? also, SQF highlight should tell you

#

@crude prism ↑

crude prism
#

It only says Init: when I try to click OK.
And I'm to new to scripting to real pick to much out of it.

winter rose
#

remove the single and double quotes right after name player and it should be fine

crude prism
#

Also tried (thisList#0) in stead of name player, but that did not do much

#

Got to apply it to a object now, but the hint don't trigger

little raptor
#

Your format is wrong too:

hint format 'T.Y.R. De...
little raptor
#

but that's not the issue

crude prism
#

So in my head according to https://community.bistudio.com/wiki/hint:

hint format ["T.Y.R. Detector: %1! I have detected traces of Ricin.Please hold your movement, equip protection gear if you have any before continuing on, report to Foxtrot for further instructions on what to do.", name player]

That would with https://community.bistudio.com/wiki/setTriggerStatements give:

_trigger setTriggerStatements ["this", "hint format ["T.Y.R. Detector: %1! I have detected traces of Ricin.Please hold your movement, equip protection gear if you have any before continuing on, report to Foxtrot for further instructions on what to do.", name player], ""];

But this is as far as i get, the last gives the Init: error

winter rose
#

hint format [ ' ← use e.g single quote

little raptor
#

it should be all green

winter rose
crude prism
#

I can tell that something is wrong since it's not switching, but since I only work with code when I trying to make some missions in Arma. I don't have much experience to go with. This is the third line of code a make for it.
But will look closer at the hint with single quote 🙂

#

Got it to work, after tinkering with the single quote. Thanks for telling me that you could not use quotes in quotes.

if (isServer) then   
{  
 _trigger = createTrigger ["EmptyDetector", getPosWorld this, false];   
 _trigger setTriggerArea [12, 14, 0, true]; 
 _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];   
 _trigger setTriggerStatements ["this", "hint format ['T.Y.R. Detector: %1! I have detected traces of Ricin.Please hold your movement, equip protection gear if you have any before continuing on, report to Foxtrot for further instructions on what to do.', name player]", ""];
};
winter rose
languid oyster
#

I only need the first and the 3. value of a bunch of nested arrays. I am currently solving this by:

    private _currentLoadout = magazinesAllTurrets _unit;
    {
        _x deleteAt 1;
        _x deleteAt 2;
        _x deleteAt 2;
    } forEach _currentLoadout;

there GOT to be a more elegant way?

winter rose
#

yes

#
_currentLoadout = [_currentLoadout select 0, _currentLoadout select 2];
languid oyster
#

🤦‍♂️ than you, Lou

cosmic lichen
#

or 'params' if you need them as variable

mild pumice
#

Hello,

I was wondering if there is a "clean" way to make some kind of OnChange listener on a RscEdit control.
So in my dialog, when i'm typing some text in this control, it would automatically update other controls within the same dialog ?

I could make a loop which check the current value each X ms but that doesn't seem very optimal.
Thanks

little raptor
ripe sapphire
#

hello good evening

#

can you guys explain about safezones? i am confused

winter rose
#

hi confused, I'm dad!

cosmic lichen
ripe sapphire
#

can i get an example?

cosmic lichen
#

There are examples on the page

stone patrol
#

I have a question for you all. I am adding a "killed" eventhandler to a plane in a mission that calls a script to check if the player flying it ejected before it was destroyed. Is there a good way of checking if there is a corpse inside a wreck?
I tried:
if ((count (crew _vehicle)) == 0)
it doesn't seem to see the wreck as a vehicle any longer?

winter rose
little raptor
#

to get all crew/corpses, you can try the fullCrew command (not sure if it works)

stone patrol
#

Thanks! That seems to have done the trick.

noble storm
#

I'd love if someone here could help with this, but I'm making a mission with a respawning UGV for my players to use. The issue is that when respawning it via script or via module, it only respawns the empty UGV. I can put AI in it again, but they're not "UAV AI" from my understanding, so is there a better way of doing this or is there a way to just change that AI to UAV AI?

#

Another solution would be if someone could just tell me what the Hack UAV interaction uses, since I can always just call that to handle everything.

willow hound
#
typeOf driver MyUGV;
noble storm
#

after respawning, I use CreateVehicleCrew to put the AI into the drone, so both drivers are "O_UAV_AI".
The respawned vehicle won't accept commands or let the player manually drive it though.

#

Which I guess does change my initial post from "Making them UAV AI" to "Making them listen like a normal UAV AI"

willow hound
noble storm
#

Didn't seem to help. I tried disabling then enabling to see if toggling it would work, but nope.
A few more details though, I can connect to it, and I can operate the turret on it perfectly fine. It's the driver that doesn't seem to move. Engine stays off even after manually turning it on, can't manually drive it. But, the turret will move and fire, as well as return to the front facing position when exited. It seems like it's just the driver who isn't obeying commands.

willow hound
#

https://community.bistudio.com/wiki/createVehicleCrew

This command does not addVehicle to the created crew in the same way this normally happens when crewed vehicle created in the editor.
That might have to do with it. Try something with addVehicle and possibly with assignAsDriver / assignAsGunner. Maybe BIS_fnc_spawnVehicle works better for UAVs.

winter rose
#

BIS_fnc_spawnVehicle yeah?

noble storm
#

I might just go back to BIS_fnc_spawnVehicle for this then. It was working great with it, but I was trying to fit it into my unit's respawn vehicle script.
I'll see if I can just make my own respawn script using the function instead.

#

Thanks for the help though.

sullen sigil
#

minor trigger thing, how do i detect if the bluefor units are in a vehicle and only make the trigger fire if that condition is satisfied (bluefor units within a vehicle)

willow hound
#

Set activation to BLUFOR present and add this Activation Condition:

this && ({vehicle _x == _x} count thisList) == 0
```Then the trigger should only fire when there is BLUFOR present and when all those BLUFOR units are also inside a vehicle.
sullen sigil
#

cheers

#

just to check, if there's any bluefor not in a vehicle, it won't fire?

willow hound
#

Unless I messed up, that should be the case.
count counts all elements _x in thisList (which contains all units fulfilling the BLUFOR present condition) where vehicle _x == _x is true.
vehicle _x == _x should only be true when _x is not in a vehicle (could also use isNull objectParent _x, might be faster).

sullen sigil
#

rog, do I need to change vehicle or something as it's not working lol

#

my close animation isn't either but that's bar gate shit which is an easy fix

willow hound
#

Does it activate at all?

sullen sigil
#

didnt think to check on foot, one moment

sullen sigil
#

are embeds allowed here

#

nope

willow hound
#

Ugh there's always something with these

sullen sigil
#

Yep

#

If it matters I'm using an RHSUSAF MRZR

willow hound
#
this && ({systemChat str _x; vehicle _x == _x} count thisList) == 0
```Let's see what we see then ![krtecek](https://cdn.discordapp.com/emojis/705444289315864617.webp?size=128 "krtecek")
#

Maybe the vehicle is part of thisList too

sullen sigil
#

giving out vehicle_0 output, no trigger fire though

#

i.e animation on the bar gate is not playing

willow hound
#

Well, vehicle _x == _x is true for the vehicle.

#
this && ({_x isKindOf "Man" && vehicle _x == _x} count thisList) == 0
sonic thicket
#

So, i have been trying to add multiplayer compatible custom markers on the map ( Custom as in custom icons ) and i am having trouble finding on what's the best method to do this. Could anyone tell me what they know works in multiplayer and think is the best approach ?

ripe sapphire
#

hello, this code puts a dynamic text at the center of my screen (1080p) however, will it correctly display it at the center of screen on different resolutions ?

["<t font='PuristaBold' align='center' size='3'>Exocet</t><br /><t size='2' align='center'>Presents<\t>",safeZoneX + safeZoneW * 0.18, safeZoneY + safeZoneH * 0.4,6,0.2,0,739] spawn BIS_fnc_dynamicText;
willow hound
exotic flax
willow hound
#

CfgMarkers is not listed on the description.ext page

sonic thicket
#

Was afraid this was the case, was trying to avoid having to make it an addon but thanks for the answer.

#

Thats part of config.cpp

exotic flax
willow hound
#

Does it work?

#

If somebody can confirm it works the page can be modified swiftly.

sonic thicket
#

There's a guy who made some documentation on doing that and he got it to work. Ill go and head over to config_makers ( No clue how that works, I've only been scripting till now ) but ill leave a tag if it works or not if you would like to

willow hound
#

Yes please

distant oyster