#arma3_scripting

1 messages ยท Page 626 of 1

little raptor
#

Just remove that draw3d

#

You'll see it still works

#
kamera = "camera" camCreate [0,0,0]; 
kamera cameraEffect ["Internal", "Back", "kamerartt"]; 
kamera attachTo [this, [0,0.4,0.5]]; 
 
"kamerartt" setPiPEffect [0]; 

This should still work

#

No need for the rest

#

In fact, as I said, that draw3d wasn't doing anything. Just wasting performance and probably throwing silent errors (your .rpt could be full of errors right now)

trail smelt
#

Ok i deleted and my code is seme as your but after use zeus/arsenal, screen still set to black..

little raptor
#

Something is deleting your camera. What does kamera give you when you run it in the debug console after the screen has become black?

trail smelt
#

i try it

little raptor
#

@trail smelt In that video, are you remote controlling the unit?

trail smelt
#

yes via module

little raptor
#

If you simply close Zeus, what happens?

trail smelt
#

my range master (character with connect zeus module is next to)

#

still black..

#

to reconnect

#

after reconnect is everything's good

#

i can send you my full mission if you want for better understanding where si probleme...

little raptor
#

No need

#

It could be a locality issue

#

Did you try the scenario in SP

trail smelt
#

No bcs is mp scenario..

#

If i start as SP all npc spawn (700+) and mission will not allow you to choose a slot

little raptor
#

Unfortunately I can't help anymore because I'm on mobile rn.
But one thing I'm sure of is that it is not a variable name conflict (that's why I told you to change those names)
I think it could be a locality issue.
Maybe someone else who's running the game can help you out with the rest.

trail smelt
#

Even so, thank you for the great effort ๐Ÿ˜‰

little raptor
#

np

proud carbon
#

(_JetTeam select 0) dofire _A2AFound;
will this select a unit from group ingame?

cosmic lichen
#

What is _JetTeam ? @proud carbon

proud carbon
#

Yeah it is a group

#

(units _JetTeam select 0)

finite sail
#

a group isn't an array, use units group to get the group members

proud carbon
#

this should work?

finite sail
#

((units _jetteam) select 0)

proud carbon
#

Ty

finite sail
#

np

cosmic lichen
#

Is there a way to detect if a player placed a respawn tent by using one of those respawn backpacks?

robust hollow
#

would it fire the weapon assembled event?

finite sail
#

assembling it will use an animation? could capture that with an EH

#

problem is, they often reuse the 'engineer repair' anim

robust hollow
#
player addEventHandler ["WeaponAssembled", {diag_log _this}];
// 19:10:42 [unit,1fdbb97d600# 17: tenta_f.p3d]
#

appears to work

quartz pebble
#

what's the max distance one can see a deployed tank smoke?

cosmic lichen
#
player addEventHandler ["WeaponAssembled", {diag_log _this}];
// 19:10:42 [unit,1fdbb97d600# 17: tenta_f.p3d]

@robust hollow Awesome, only problem is that I need to have a predefined list with respawn backpacks, but I can live with that

#

Thanks ๐Ÿ™‚

vague geode
#

Is any way to get/calculate the approximate visible distance on certain coordinates from the fogParams?

winter rose
#

not really
try maybe checkVisibility @vague geode

vague geode
#

@winter rose BaerMitUmlaut (which strangely enough was spelled without any Umlaut) posted on the BI Community wiki page of that command that "[...] Distance, fog, overcast, rain and nighttime have no effect on the result."

winter rose
#

theeen nope

#

AIs with knowsAbout perhaps

crude vigil
#

@trail smelt Hello, your issue is due remote control means a camera spawned on the unit, and since your screen is displaying a camera, you cannot see any RTT feedbacks on monitors etc.

#

This is an engine limitation afaik. There is no issue with your code

#

Usual players will see the feedback normal but as Zeus or remote controlled unit, you cannot see it. (Only way to see it during Zeus is through pressing enter and entering 1st person camera of any ai or player.)

#

So in your video, it is basically working but it is just you not seeing it as remote controlling unit due nature of camera-spectating players not able to watch RTT feedbacks.

little raptor
#

It didn't work after exiting Zeus either

#

I mean exiting normally

crude vigil
#

Dont see any part in video where he exited normally.

little raptor
#

I asked her

#

Read the full discussion

crude vigil
#

To be honest, I dont know how that feedback works before he shows in zeus, I thought I was seeing 3den interface there for a moment.

#

But I believe there is an issue about that because in past (3 4 years ago) I made a lot of tests

little raptor
#

You can still see it in Zeus

#

At the start of the video

crude vigil
#

and it wasnt working properly at all

little raptor
#

Which you said you can't

crude vigil
#

I believe the start of video is just showign a picture

#

it doesnt actually take any live feedback

little raptor
#

It's a static camera with a static scene

#

So you get a static picture

trail smelt
#

but after opening the arsenal it will do to everyone who opened it so it's not just a problem zeuse

crude vigil
#

that is what Im saying. if there had been movement, I would doubt it would have any feedback

#

arsenal is changing ur camera

#

maybe u might need to write an event handler and use the cameraEffect command again

trail smelt
#

Well, if the mission is based on an arsenal, this can't really work if I understand correctly ..

crude vigil
#

If you find a way, notify me too. I was disappointed too when I found it out.

#

but my knowledge is very old, maybe some update fixed those issues.

#

maybe some veteran could give more accurate info about this.

trail smelt
#

Its Arma... i doubt it.. ๐Ÿ˜„

crude vigil
#

It is a very edge scenario that even a lot of modders/mission makers will miss it so I think so.

#

If I were you, I would try to see if there is any actual visual feedback while camera has to show a movement

#

if it works, you can just use some event handlers to handle any problem of going and staying black, I believe.

#

However, I remember screen sometimes even going black due zeus camera movement etc.

#

so it is not only camera change scenarios. But yeah, do your own tests imo. Dont trust mine :)

little raptor
#

@vague geode This is something you have to calculate experimentally. There is no known equation afaik.
E.g. set the fog, overcast, etc. to zero (also maximize visibility in video options).
Then only change one parameter at a time (you can use an onEachFrame to keep other values constant during your test) and measure the visibility.
Do this for all parameter.
You can then assume that the overall visibility is a linear function based on all of these parameters (maybe with some weights)

low zodiac
#

Is there a way to let the music not fade out, when using BIS_fnc_fadeEffect? As I want the music to continue and not getting faded, when Using said effect.

warm hedge
#

Looks like no. It does fadeMusic 0 hardcoded. You can overwrite it just like do fadeMusic 1 a frame later

low zodiac
#

Ok, Thanks! [Sadly it resets the music and begins from the beginning again, which I don't want]

#

^ Any way to let the music beginn from the point where it stops?

little raptor
#

playMusic [musicName, start]

warm hedge
#

Wiki is always your friend

little raptor
#

I literally just copy pasted it! ๐Ÿ˜‚

little raptor
#

Does anyone know if it's possible to make pictures look less jagged? Kind of like anti-aliasing?
Pixel precision doesn't seem to work on pictures according to my tests (only text is affected)

dense surge
finite sail
#

@dense surge , if you disable the simulation of the ambulance, that will workj

#

or

#

you can spawn a normal van, and reskin it to look like an ambulance

dense surge
#

Thanks but I need us to get in the vehicle

and I would like to use the interior of this vehicle

#

it's for role playing

little raptor
#

afaik ambulances can heal indefinitely. you can't remove their "healing" ability

dense surge
#

Ah ok ๐Ÿ˜ฆ

finite sail
#

correct

#

hmm, you can't hide/spawn the interior equipment of the ambulance in virtual garage

#

which means you if you want that equipment (stretcher etc), you must have the ambulance

#

you can force the ambulance skin onto a normal van though

dense surge
#

yes but I make my own skin which I apply afterwards, no problem for this

#

๐Ÿ™‚

finite sail
#

supplyradius

#

in the vehicle config

#

you might br able to reduce that to 0

#

so no one can get close enough to it for the heal to work

#

but that you need a mod afaik

little raptor
#

I think it is possible to also modify it by the mission config in v2.01 (dev)

still forum
#

huh? how?

little raptor
#

Import can't do it?

still forum
#

huh

#

no

#

import imports things. And thats it

little raptor
#

I thought it was identical to class ...
Except it could see and modify the configFile too

still forum
#

even if it were

#

description.ext cannot modify game configs

#

yes it can

#

import can see configFile. But it only imports, it can only read from there

slim oyster
#

Export cfgvehicles { class ... } ? meowtrash

#

Mission config being locked out from things is mostly a security thing right?

little raptor
still forum
#

yes you can change properties after you imported something

#

but I dont see how that would let you modify vehicles?

#

CfgVehicles and CfgWeapons and stuff have no effect in description.ext

#

only in mod configs

little raptor
#

but not the configFile:

import cfgVehicles;
class cfgVehicles {
  class newVehicle {
  }
}
#

yeah. I realize that now. This was never gonna work

slim oyster
#

Import class from path?

#

Instead of import cfgvehs

#

But yeah, only unlocked cfgs like ui and such

little raptor
#

I think we now understand that import simply imports the class and defines it there (so you could use them in mission config). That's it.

slim oyster
#

A2 had cfgvehs unlocked for some things right?

#

Damage for rocks from mso, etc?

winter rose
#

"unlocked"?
you could read it, that's it

all the rest is modified by mods

still forum
#

its not "locked"

#

its a different config

slim oyster
#

Effect of missionconfig on "effective" calc of cfgvehicle class entries?

#

So a2 had ability to read damage entry value from missionconfig while a3 does not and only reads from configfile?

ripe sapphire
#

hello guys, is there a way to addd delay to foreach command?

#
{moveOut _x;} forEach units a1
#

i want units from group a1 to be disembarked every say 3 seconds

winter rose
#

{ sleep 3; moveOut _x } yes

astral dawn
#

spawn it and use a sleep inside

ripe sapphire
#

will try thx ๐Ÿ™‚

vernal jay
#

Hello everyone, with my boys we re doing some IS operations and what i need is to be able to stop a civilian that is riding a car from driving it. the nature of the mision would be to seek and intercept suspects vehicles on the go, thats why i cant use normal zone triggers or something like that, i need to be able to make a civilian driving a car to stop, is it possible to do it without having to set a variable for every civilian? im in need of help here

ripe sapphire
#
0= []spawn {{sleep 1;moveOut _x;} forEach units a1}
#

worked great thank you

little raptor
#

@vernal jay Civilian = A unit whose group side is civilian (I say group because captives and unconscious units are also on the civilian side but they're not civilians)

side group _unit == CIVILIAN
#

So no, you don't need to set any variable

finite sail
little raptor
#

what I said is faster. No need to look it up in config

finite sail
#

ah yes, group side

#

๐Ÿ™‚

#

ooo yeah, way faster ๐Ÿ™‚

#

side group is 0.0006 ms

vernal jay
#

ok cool so thats the way i can identify the civs in the script, now i need to put a variable that everytime they get close to one of my mates it runs teh disableAI "ALL" variable

finite sail
#

config is 0.0011

little raptor
#

way faster
That's only 2 times faster! (and only 0.0005 ms!)
I meant as opposed to using the function

vernal jay
#

so it would be [civilian,_unit] disableAI "ALL"

#

man im such a noob, im embarasing myself :8

finite sail
#

i missed a zero ๐Ÿ™‚

little raptor
#

oh. Now it makes more sense!

finite sail
#

i do that fnc side thing quite a bit, i should replace that with group side

#

every tiny bit oof cpu power saved ๐Ÿ™‚

little raptor
#

i missed a zero ๐Ÿ™‚
You mean you added an extra zero?!

finite sail
#

dont know, ill do it again, wait 1

#

Result:
0.0005 ms

Cycles:
10000/10000

Code:
side group player

#

Result:
0.013 ms

Cycles:
10000/10000

Code:
[player, true] call BIS_fnc_objectSide

little raptor
#

@vernal jay You don't need a variable. You need a loop:

waitUntil {
  sleep 1;
  {
    if (side group _x == civilian) then {
      _civ = _x;
      if (vehicle _x != _x && {allPlayers findIf {_x distance _civ < 20} != -1}) then {// at least one player is closer to the civilian than 20 meters
        if (_civ checkAIFeature "MOVE") then {
          _civ enableAIFeature ["MOVE", false]; //disable moving
        }
      } else {
        if !(_civ checkAIFeature "MOVE") then {
          _civ enableAIFeature ["MOVE", true]; //enable moving
        }
      }
    }
  } forEach allUnits;
  false
};
vernal jay
#

man

finite sail
#

findIf ... such a gem

vernal jay
#

thank you, i ll just stick this into a script and run it via radio trigger. it should keep running right? man i ve been learning a lot of scripting in arma 3, but i am astonished how long i still have to go when i see you guys just write the piece of code i need in a blink of an eye. cheers to you all

little raptor
#

it should keep running right?
Yes. Just make sure you spawn the code (it's scheduled)

vernal jay
#

i couldve spent 4 hours writing that, i swear

little raptor
#

@vernal jay If you only need driving civilians, you'll have to change the code. That code applies to all civilians

vernal jay
#

its the same, there wont be many civilians running around, the idea is to implement the Eagle PAtrol tactic that teh brits use in North Ireland to bust IRA members, it requires to intercept the car using a helo by dropping a quick deploy squad in a roadblock ahead of the enemy, thing is that civs will just bust trough you or derrail from the road, looking like suspects, with this now i have full powah

finite sail
#

who is flying the helo?

little raptor
#

ok. I just changed the code to only apply to driving civilians. You can remove that part

vernal jay
#

my squad

finite sail
#

as long as it isnt AI ๐Ÿ™‚

vernal jay
#

no chill, i would never trust an AI pilot with landing fast, NEVER

#

thank you very much guys. ill check if it works and tonight we will see how the civs behave, cheers

sudden yacht
#

any idea what im doing wrong hear? this addEventHandler ["Explosion", {
_this select 0 setdamage (damage _this select 0 + 0.07);
}];
@sudden yacht

distant oyster
#
this addEventHandler ["Explosion", { 
  _this select 0 setdamage (damage _this select 0 + 0.07); 
}];```

@sudden yacht damage _this is getting evaluated before _this select 0. Instead:

this addEventHandler ["Explosion", {
  params ["_vehicle"];
  _vehicle setdamage (damage _vehicle + 0.07);
}];```
sudden yacht
#

ty

brave jewel
#

Does anyone have a script to let say a helicopter patrol in a trigger area?

winter rose
#

it can be done, but you could also use waypoints?

amber inlet
#

Hi. How do i make a boat start riding as soon as the mission starts? Like its already riding as I load in. I only need 1 point to go to

#

With ppl inside

#

Also intro is another whole animal compared to scenario lol , i think i night just start with scenario only missions first

#

I dont know much at all about scripting

distant oyster
#

is there a way to switch the weapons of an ai unit instantly?

#

specifically in 3den?

ripe sapphire
#

hello guys, if i have a global variable a_var1, then i go in-game, open debug console and LOCAL EXEC :

a_var1 = true; publicvariable "a_var1"

would a_var1 be updated to true for all clients?

#

or do i have to run server exec/global exec

robust hollow
#

that would work with local exec

#

publicvariable sends it to everyone, so you only need to execute it locally. global exec executes the code on everyone

ripe sapphire
#

nice thx

vernal venture
#

Is there an easy easy way to make this work without having to give every object a name for deleteVehicle?

[ 
 this, 
 "Clean Up", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "_this distance _target < 5", 
 "_caller distance _target < 5", 
 {}, 
 {}, 
 {deleteVehicle this}, 
 {}, 
 [], 
 10, 
 0, 
 true, 
 false 
] remoteExec ["BIS_fnc_holdActionAdd", 0, this];
robust hollow
#

~~provide this as the action argument (where the empty array is right now), then use deleteVehicle(_this#3) ~~
the object the action is added to is provided as argument 0

#
deleteVehicle(_this#0)
vernal venture
#

Works. Thanks, @robust hollow. Google was failing me.

#

Now I just gotta restrict it to Engineers, which should be up where distance is specified.

distant oyster
#

is there a way to switch the weapons of an ai unit instantly?
@distant oyster well that was easy:

_o = get3DENSelected "object" select 0;
_w = "arifle_AK12_arid_F";
_o addWeapon _w;
_o selectWeapon _w;
_o switchMove "aidlpercmstpsraswrfldnon_ai";
vernal venture
#

How come _this == B_engineer_F works in addAction, but not in holdActionAdd?

robust hollow
#

are you sure it works, or does it just not show an error?

#

holdActions are just fancy addActions, so working in one and not the other seems unlikely

vernal venture
#

I've used it in an addAction, as "_this == B_engineer_F && _this distance _target < 3" and that worked, but using it here is throwing up an error.

robust hollow
#

is B_engineer_F a variable you have set?

vernal venture
#

It's the unit type.

robust hollow
#

you want typeOf _this == 'B_engineer_f'

vernal venture
#

Wonder why it worked before.

exotic flax
#

and make sure _this is actually the object, and not an array

robust hollow
#
conditionShow: String - Condition for the action to be shown.
Special arguments passed to the code: _target (action-attached object), _this (caller/executing unit) 
#

like i say, i doubt it worked before. it just didnt error

exotic flax
#

Arma isn't very consistent with their variable naming ;)
But should work as Connor pointed out with typeOf

vernal venture
#

Hmm. typeOf _this == B_engineer_F && _this distance _target < 5 doesn't work either. Consistency is too hard, I guess.

robust hollow
#

typeOf _this == 'B_engineer_f'
'B_engineer_f'
'

#

you need quotes

#

B_engineer_f needs to be a string

#

otherwise the game will look for a variable named B_engineer_f

vernal venture
#

Ah, I got you.
Have you noticed they're inconsistent with those names too? Some are B_Soldier_xx and some are B_soldier_x

robust hollow
#

yea, but == is case insensitive so it doesnt matter

vernal venture
#

Oh, nice.

#

Hey, it works. Now only players in Engineer slots can clean up my mess. Thanks guys.

[ 
 this, 
 "Clean Up", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "typeOf _this == 'B_engineer_F' && _this distance _target < 5", 
 "_caller distance _target < 5", 
 {}, 
 {}, 
 {deleteVehicle(_this#0)}, 
 {}, 
 [], 
 10, 
 0, 
 true, 
 false 
] remoteExec ["BIS_fnc_holdActionAdd", 0, this];
little raptor
#

You're limiting it to a specific unit type. Not every engineer is a "B_engineer_F"

#

Use unit traits.

vernal venture
#

Well, in the case of my particular mission(s), the only engineers with engineer traits will be that type anyway. Unless it's as easy to limit to trait, I think this will work.

crude vigil
#

Arent holdActionAdd conditions are checked continuously, it would be better to have that engineer condition to add the action?

#

instead of inside of it..

vernal venture
#

According to the wiki, the first one is only checked on start, the second one is checked every tick

robust hollow
#

the first is checked every frame to show the action, the second is checked every frame while holding

exotic flax
#

Unless it's as easy to limit to trait, I think this will work.

// will return TRUE when _this is an engineer
// works with all engineer units and ACE engineers
_this getUnitTrait "engineer";
little raptor
#

yeah what he said

#

And there's no need for false

#
_this getUnitTrait "Engineer"
exotic flax
#

true... was watching the wrong wiki page

vernal venture
#

?

_this getUnitTrait "Engineer" && _this distance _target < 5```
little raptor
#

yes

exotic flax
#

yup

robust hollow
#

you will need to double quote if thats going in a string

little raptor
#

or just '

exotic flax
#

or use single quotes ๐Ÿ˜‰

vernal venture
#

Yeah, don't want to end the string short.

robust hollow
ripe sapphire
#

hey guys, does enableGunLights work on players too?

#

im trying to disable players using ther flashlights without removing them, if that is possible

robust hollow
#

you use this to toggle it, i dont know about force disabling it though

player action ["GunLightOn", player];
player action ["GunLightOff", player];
#

from a brief test it appears enableGunLights doesnt work on players

ripe sapphire
#

hmmm ok, perhaps i can do a loop with the toggle

#

do you think it would cause a performance impact if i make it loop every second?

robust hollow
#

negligibly

#

but dont do the action every second, do a check like this

if (player isFlashlightOn currentWeapon player) then {player action ["GunLightOff", player]};```
ripe sapphire
#

ah you're right

tough abyss
#

Hello all, I am very new to scripting, can you give me some refrences i can view?

ripe sapphire
#

how should i set it up so that it runs on every client if i use that code in lightoff.sqf?
im not sure how to run execvm with remoteexec

#

hey @tough abyss , you can ceck the pinned posts in this channel for many references

tough abyss
#

oh ok thx :))

ripe sapphire
#
"lightoff.sqf" remoteExec ["execVM",0,1];

is this correct?

robust hollow
#

why not just execute it from the initPlayerLocal.sqf or similar? no need to remoteexec

smoky verge
#

I've probably asked a similar question at least twice but I keep forgetting
trying to make this work on a dedicated server
https://community.bistudio.com/wiki/BIS_fnc_dirIndicator
what should I use so it works for every player?
because if I type just "player" it only works on the host.

winter rose
#

depends on where you place your code

#

it should work well in init.sqf, where player impacts everyone

#

@smoky verge โ†‘

willow hound
#

LM spreading bad practice?!

#

initPlayerLocal.sqf

smoky verge
#

its supposed to play mid mission

willow hound
#

remoteExec

smoky verge
#

yeah was thinking of that
could I just remoteExec an sqf file and have it work for all players?

willow hound
#

Better, you can remoteExec the function straight away

winter rose
#

LM spreading bad practice?!
always!
call me old school (you can ^^) but I don't like having too many init files, I mostly stop at init.sqf/initServer.sqf - the rest is checked in init.sqf with hasInterface and waitUntil { not isNull player }; ๐Ÿ™ƒ

cosmic lichen
#

Does anyone has a good reliable script to sort items (weapons, items, mags) into proper categories? BIS_fnc_itemType doesn't work with ACE for example.

willow hound
#

Because you are trying to use player, the easiest way is

[[player, MyTarget, MyColor, MySize], BIS_fnc_dirIndicator] remoteExec ["call", 0];
cosmic lichen
#

don't use call in remoteExec ๐Ÿ™‚

willow hound
#

Uh-oh

cosmic lichen
#

Only if you are sure that cfgRemoteExec will not be touched

willow hound
#

I have a feeling that player will be resolved on the executing machine like this too...

winter rose
#

@willow hound bad practice you said? ๐Ÿ‘€ ๐Ÿ˜›

cosmic lichen
#

yes it will

willow hound
#

Probably best to go with your first idea and put the code in a file that you then run with remoteExec.

smoky verge
#

notlikemeow many hard words
so if during a mission I run an radar.sqf containing

[player, MyTarget, MyColor, MySize], BIS_fnc_dirIndicator]

it should apply to all players

winter rose
#

yep
I would recomment using a function

#

with argumentssqf params ["_target", "_color", "_size"]; and the function would use player by itself

willow hound
#

As long as you run radar.sqf on all clients it will work.

smoky verge
#

assuming its coming from a trigger does nul = [] execVM "radar.sqf" run it on all clients?

winter rose
#

if the trigger is not server-side only and is triggered everywhere, yes

smoky verge
#

notlikemeow
the server side only should be a checkbox
how do I know its triggered everywhere?

winter rose
#

well, what are the conditions?

smoky verge
#

!alive object

#

should be everywhere right?

winter rose
#

yep

willow hound
#

If the trigger condition is something like player in thisList then it only triggers on clients that are in the trigger.
If the condition is something like BLUFOR present then it should trigger on all clients once any BLUFOR unit enters.

smoky verge
#

while stuff like area triggers are moer local I guess

#

ok understood

#

I can't test it sadly but thanks for the help, cleared out some dark spots

winter rose
#

hence why ideally everything is checked server-side, then the server sends commands to clients

smoky verge
#

what kind of trigger would be useful in server side only?

winter rose
#

ideally none, but that's my POV ๐Ÿ˜„

#

checking conditions - only the server is the real game referee - if a player sees a unit dead while the server doesn't, the server is always right so checks should be done on its side

#

or sometimes, units in a trigger
e.g far away units won't be sync'ed as much for other clients, but the server always knows their position
so whether they went in a trigger or not (in the 0.5s window) can be false client-side, and true server-side

smoky verge
#

interesting
lately I'm getting that exact situation
I see a player ragdolled on the floor while the rest of the players see him normally

ripe sapphire
#

why not just execute it from the initPlayerLocal.sqf or similar? no need to remoteexec
@robust hollow cant because it needs to happen mid-game

proper sail
#

Does MPKilled evh get deleted after it fired when the vehicle gets blown up, or is it necessary to remove it again

winter rose
#

it is still there, but inactive (unless the vehicle respawns I think)

proper sail
#

Alright, and what about if i delete the vehicle. Is it gone then?

winter rose
#

yep

proper sail
#

cool

winter rose
#

all EHs get deleted along the object

#

all object's EHs, obviously ๐Ÿ˜

proper sail
#

One last thing, does a normal evh like GetIn- GetOut behave differently? Or does that also become inactive on vehicle explosion and deleted when vehicle gets deleted

winter rose
#

same I would believe

#

but! sometimes, the vehicle can explode and the person still be alive (and get out)

proper sail
#

yes true

winter rose
#

an EH is "inactive" since no one can trigger it anymore (e.g killed, well can't kill it twice)

proper sail
#

Alright makes sense, thanks for the answer

winter rose
#

and btw, event handlers are not some kind of "while loop" checking if something is hit or killed; it is some code that gets stored somewhere, not impacting anything perf-wise, until said event is raised by the engine then executes all the stored code

proper sail
#

I still wonder why mods like arma 2 dayz removes all evhs when killed evh fires. And this still continues in modern a3 in exile mod etc

#

thats why im asking if there is some kind of irregularity

winter rose
#

to free some RAM, that's the only point

proper sail
#

Yeah I was thinking something along those lines as well. Like for DayZ that would make sense as it keeps the wrecks on the map for an amount of time. But when i look at the exile code it literally clears all evhs, does some stuff and then deletes the vehicle itself.

#

So that seemed kinda weird

fresh cape
#

It's probably because Exile players are scripted AI and on death then respawn get a new net id and group, so good practice to remove the eh's and re-add them on spawn

proper sail
#

But is that the same about vehicles; my point was about the vehicles

quartz pebble
#

What is reliable distance in MP arma displays particle effects?

winter rose
#

viewdistance?

quartz pebble
#

Nope. I set VD to 12km, I see say a tank at 5-6km, but if the tank deploys smoke, I won't see the smoke at that distance. And apparently allMissionObjects "SmokeShellVehicle" won't return a thing.

winter rose
#

object view distance mayhaps?

quartz pebble
#

OVD was also 12km, otherwise I wouldn't see the tank

winter rose
#

yep, realised that.
particle quality to the max in video settings?

quartz pebble
#

That's a thing to play with )

#

I was trying to check if a tank has hidden behind smokes, but I was surprised when faced the behavior

winter rose
#

checkVisibility for the AI part, but for the player's POVโ€ฆ no dice

quartz pebble
#

POV won't help here.. I'm working with "fire and forget" missiles

winter rose
#

then checkVisibility will tell you if there is some smoke (though I would maybe rather check that smoke grenades are around)

quartz pebble
#

I assume checkVisibility will return true at the high distances due to missing particles

#

but need to check

winter rose
#

I think the particles still exist, they are just not shown
hence why it should work

quartz pebble
#

I also thought so, but the code tank nearObjects ["SmokeShellVehicle", 50] was returning an array of shells on the machine the tank was local to, and was returning [] on the mahching with player far away

willow hound
#

Vehicle countermeasures might use createVehicleLocal; I think our community server sometimes auto-kicked players for executing that command too often when all they did was use countermeasures. Not entirely sure though.

quartz pebble
#

Nope. All the stuff I was checking works fine at distances less than ~4km

willow hound
#

I'm not entirely sure if I remember correctly, but I'm somewhat sure, so my suggestion is that you do some testing aimed at identifying the role of createVehicleLocal.

ruby glade
#

Hey guys, i'm currently trying to save backpacks and their content when they are inside a list of vehicle.
let's say that i have an array like this :
_savedVehicles = [v_1, v_2, v_3];

I'm using a foreach on _savedVehicles, and this command line (where _vehicle = _x) :
_vehicleBackpacks = everyBackpack _vehicle;

But everytime this command run i get the Error Invalid number in expression on _vehicle.

Do you guys have any idea ?

winter rose
#

everyContainer, no?

ruby glade
#

same result with everyContainer

winter rose
#

(well, idk. never really worked with these tbh)

#

try this?sqf systemChat str _vehicle

ruby glade
#

returns all _savedVehicles values

#

v_1
v_2
...

winter rose
#

and everyBackpack v_1 returnsโ€ฆ?

ruby glade
#

[] as i don't have any backpacks in v_1

winter rose
#

then your forEach should work
what you do before in it might be the issue

#

post your code on sqfbin so one can check

finite sail
#

guys... in a mission, i have players searching an object using initinspect which when completed, spawns an item that they must pick up and take somewhere, item is laptop, files, wallet or similar

#

problem is that when i spawn the object, i can have a reference to it provided by createvehicle, but when players pick it up, the reference is lost

#

it becomes objnull

winter rose
#

yes ?

finite sail
#

i then cant track the object

willow hound
#

Of course, it's in their inventory then, it's no longer an object.

finite sail
#

yes

winter rose
#

set a variable on the taker - or, just check "hasItem laptopClass"

finite sail
#

yes, i keep track of all the players and who has the class in their inventory

#

is there anything to do with weaponholder that I'm missing here?

#

if players put the object in a vehicle, it gets even harder to track it

willow hound
#

Don't forget players disconnecting notlikemeow

finite sail
#

that too.. ๐Ÿ™‚

winter rose
#

yep
so just check if at the end, someone has the laptop - else, mission failed

#

unless there are 50 laptops and a precise one must be tracked ๐Ÿ˜…

finite sail
#

well, they are to take the laptop to base and yes, there's only 1 in the mission ๐Ÿ™‚

winter rose
#

go for the simplest then ๐Ÿ˜‰

finite sail
#

the mission watches which player has the laptop and if he gets to base, mission win

#

if he dies, fail

#

all good so far ๐Ÿ™‚

#

if he puts the laptop in car inventory as long as he takes it back out of the car when at base, mission win

winter rose
#

and others cannot grab it from his body?

finite sail
#

befor respawn, yes they can

winter rose
#

oh ok

finite sail
#

but if the car is destroyed,.... im struggling a bit

#

if th reference to the object remained intact throughout, this would be easy

#

or, as ansin says, the laptop carrier disco's

willow hound
#

If you store a laptop in a car, and somebody explodes that car with an ATGM, then, I'm fairly certain, the laptop is destroyed with the car.

#

d/c can be handled by script or EH

finite sail
#

yes, but how to track which car the laptop is in, if the reference is nulled

#

look through inv of all vehicles in a loop?

winter rose
#

on EH "put", tell the server
the server then checks proximity objects with inventory storage

#

unfortunately, inventory doesn't keep reference, I know
but that's how it is, so here is a workaround

finite sail
#

because the object is unique, i know that works in my favour

#

but I got it into my head that weaponholders was the way forward, i just didnt know how

willow hound
#

Weaponholders are just a thing when the item is on the ground, not in some inventory.
Or so I think it is.

winter rose
#
laptop attachTo [player, [0,0.5,1.25]]
```๐Ÿ˜
finite sail
#

oh... not rhought about that

winter rose
#

wait, that was a joke

finite sail
#

it looks nasty, but needs must lol

#

hehe

willow hound
#

Since the player can't interact with something attached to him, you might as well store the carrier in a variable and delete the laptop object itself.

finite sail
#

i can store the carrier when its a player, already doing that with allplayers and findif

#

i spose i just need to do the same with vecs

willow hound
#

If the laptop is not actually in the player's inventory, he can only put it into a vehicle using a custom action (e.g. addAction), so it just goes back to updating the carrier variable.

finite sail
#

yeah, im not a fan of custom actions for something that's gonna happen once in a mission, but i see your point

#

this mission has been a mass of workarounds, lol... cant add holdaction to terrainobjects... (hiding it and creating a new)

#

to name just one

#

item cargo doesnt return classnames, but some weird short name (which isnt displayname)

#

to name another

#

i think im gonna code up something so i can track the carrier regardless of if its a player, vehicle etc

#

If the laptop is not actually in the player's inventory, he can only put it into a vehicle using a custom action (e.g. addAction), so it just goes back to updating the carrier variable.
@willow hound could be done with the inventory EH, i spose

#

thanks for help, guys, was suffering a bit from burnout on this, been doing it for ages#

#

seeing a clear path ahead is helpful

winter rose
#

don't hesitate to take breaks and do something else too, helps ^^

finite sail
#

absolutely. this morning, got my sorry arse kicked by the japanese in civ6

#

not sure it helped much

#

but I know what you mean, fresh eyes

lone galleon
#

Hi everyone, I got this script, to play music on some helicopters, the thing itยดs I canยดt manage to set a distance to interact like 1 meter away from heli or less thatยดs the code, someone can help?

heli2 say3D ["music2", 50, 1];
} ];```
winter rose
#

radius parameter

lone galleon
#

That could work?

heli2 say3D ["music2", 50, 1];
} 
50,
];```
winter rose
#

no ๐Ÿคจ

lone galleon
#

I see

#

And this? I always mess up setting radius

heli2 say3D ["music1", 50, 1];
} ];```
winter rose
#

it's not a guess game, I mean, there is a documentation about it

cosmic lichen
#

@lone galleon Check the biki. There is a radius parameter. Don't use the condition for that.

finite sail
#

hmmmm, itemcargo _vehicle doesnt return laptops / files etc

#

it returns FAKS etc

#

but not the items I need

hollow thistle
#

they might be magazines

finite sail
#

FAK doesnt show up in magazinecargo... do you mean the laptop might be a magazine?

#

oooo, the mission chose the mobilephone instead of the laptop just now

#

and that IS in magazinecargo player

#

and it shows upin magazinecargo of the vehicle when I put it in there

#

ok good

cosmic lichen
#

can anyone tell me a reliable way of detecting an item type and group all items into various categories, similar to BIS_fnc_itemType?

#

BIS_fnc_itemType is unfortunately not compatible with ACE so I am looking for a better way.

winter rose
#

rather, ACE is not compatible with the function, no? ^^

#

iirc the function plays with two config values

cosmic lichen
#

rather, ACE is not compatible with the function, no? ^^
@winter rose Doesn't matter which way around it is, the result stays the same.

#

iirc the function plays with two config values
These value seem to be useless since ACE changes them.

hollow thistle
#

What's the issue?

cosmic lichen
#

One sec

#

"ACE_bloodIV_250" call BIS_fnc_itemType // ["Item","AccessoryBipod"]

#

Guess I have to look at the ACE code for their arsenal

hollow thistle
#

It's because of CBA_MiscItem being an Bipod

#
class ACE_ItemCore: CBA_MiscItem {};
cosmic lichen
hollow thistle
#

Becouse there's nothing like "misc item" in the game?

#

You can either do it as magazine or something else.

#

What's the expected return value for misc items?

cosmic lichen
#

I'd expect BIS_fnc_itemType to return ["Item", "Unknown"]

hollow thistle
#
my_fnc_itemType = {
    params ["_class"];

    if (_class isKindOf ["CBA_MiscItem", configFile >> "CfgWeapons"]) exitWith {
        ["Item", "Unknown"] // return
    };

    _this call BIS_fnc_itemType // return 
};
cosmic lichen
#

๐Ÿ˜ฎ

#

Thanks alot ๐Ÿ™‚

hollow thistle
#

code not tested so might not work

cosmic lichen
#

That's not a problem

hollow thistle
#

idk how BIS fnc works but the ACE one is very robust.

cosmic lichen
#

@hollow thistle Works like a charm now with a bit of modification. Thanks again ๐Ÿ™‚

hollow thistle
#

yw salute

rain lichen
#

Is there a way to make a unit invincible?

winter rose
#

yes, allowDamage

compact maple
#

Hi, with what cmd can I save the state of a vehicle ? (ie broken wheel, glass, engine), and apply it later ?

rain lichen
#

^^^^^

#

I need a command for the whole invincibility thing

#

As well, please

compact maple
#

Lou answered, it's allowDamage

#

seems getAllHitPointsDamage will do the job

rain lichen
#

Hmkay

#

So do I just say; allowDamage false

winter rose
#

@rain lichen see the wiki for the syntax

rain lichen
#

Ah ah ah okay

gilded rover
#

just a quick question , so I'm doing pointers now in java with linkedlists and was wondering if pointers are used in arma? Also i hate linkedlists xD

still forum
#

Uh.. yes
And linked lists too

gilded rover
#

very, very interesting

little raptor
#

Uh.. yes
And linked lists too
@still forum
We do?! How come I've seen them?!

violet gull
#

What does this error mean? Never seen it before:

"warning: macro AFAR: trailing ; should be in each caller. Never the macro body."

cosmic lichen
#

Where and when do you get it? @violet gull

winter rose
#

sounds likeโ€ฆ a mod maybe?

violet gull
#

Someone sent me the error, apparently they were trying to compress my script with Mikero Tools or something

robust hollow
#

i believe that happens when you do something like

#define myMac "abcxyz";
a=myMac
b=myMac
c=myMac

instead of

#define myMac "abcxyz"
a=myMac;
b=myMac;
c=myMac;
#

so the error is saying ; should not be in the macro itself

violet gull
#

Weird, don't think I use any

#

I don't use define anyway

winter rose
violet gull
astral dawn
#

just a quick question , so I'm doing pointers now in java with linkedlists and was wondering if pointers are used in arma? Also i hate linkedlists xD
well object handle is a pointer to an object, but it's safe to access it in SQF, it can become null safely

#

also if you pass an array somewhere, it's passed by reference

#

everything else is passed by value (string, number, bool, what else?)

gilded rover
#

yeahh okay i did not think of that ๐Ÿ˜‚ but linked lists though?

astral dawn
#

well I guess you can fake it with an array

#

but in sqf you can't do cyclic arrays (array which has a pointer to itself as one of its elements)

#

so your double linked list would go one way and that's it

#

there isn't really an easy and comfortable way to implement a linked list in sqf

#

so I think generally people just don't use them

#

maybe you could make an array of arrays, these subarrays being the 'elements', then you could use indexes of elements instead of pointers

exotic flax
#

I usually make a simple subarray with key and value (if really needed) sqf _array = [ ["key", "value"], ["key", "value"], ["key", "value"] ]; which is actually easy to search in, since key is always _x#0 and value _x#1

astral dawn
#

it's not a linked list though

#

but it's good for applications ๐Ÿคท

exotic flax
#

SQF is not a AAA programming language, so don't expect any fancy constructions ๐Ÿคทโ€โ™‚๏ธ
And I've been scripting for quite some time and never had the need for linked lists ๐Ÿค”

astral dawn
#

And I've been scripting for quite some time and never had the need for linked lists ๐Ÿค”
yes me too lol

#

I think closest to the need of a linked list is some sort of graph, and I did make graph recently

#

but it was a graph in a 2D plain, and each element had links to neighbours (or some or none of the links to neighbours), and I implemented links as IDs of neighbours this one is linked to

#

because same problem, can't put a pointer to the same array into this array

exotic flax
#

of course you could store the pointer in a global variable which can be accessed elsewhere (especially in combination with hashmaps), but again I can't really think of a use which would benefit from it without the worry of the performance impact it will have.

astral dawn
#

no, it was smth like this:

_elements = [
["value", next ID],
["value", next ID],
...
];

then accessing the next linked element was like

_element = _elements # _index; // whatever index is
_nextid = _element#1;
_nextElement = _elements#_nextid;

Except the array was 2D. I guess it's the easiest way to do it.

crude needle
#

Anyone know how to control the loiter waypoint direction in script (clockwise or counter-clockwise)?

crude needle
#

waypointLoiterType returns "CIRCLE" regardless of the direction its set with in 3den. Don't think it has any bearing on direction and all I could see was "CIRCLE_L" (large?) as the other choice.

warm hedge
#

Left

#

...I believe?

robust hollow
#

I'd say so. the 3DENExport function has this

private _loiterDirection = (_wpID get3denattribute "loiterdirection") # 0;
if !(_loiterDirection) then {format ["_this setWaypointLoiterType ""%1"";",if (_loiterDirection) then {"CIRCLE"} else {"CIRCLE_L"}] call _fnc_addLine;};
#

kind of a redundant if statement but basically it executes _this setWaypointLoiterType "CIRCLE_L" if the direction is defined as left.

cold glacier
#

SQF is not a AAA programming language, so don't expect any fancy constructions ๐Ÿคทโ€โ™‚๏ธ
And I've been scripting for quite some time and never had the need for linked lists ๐Ÿค”
Pretty sure this captures the essence of this argument. Common computer science data structures are pointless most of the time in Arma, because SQF is sloooow. By the time you've written an implementation, the overhead of using that implementation has minimised any gains, in 99% of cases.

IMO, quick arma scripting is all about making efficient use of built-in scripting commands, which pretty much means Arma has its own unique set of algorithms and data structures that leverage those commands as best possible.

brave jewel
#

I just realised how awesome sqf BIS_fnc_EXP_camp_guidedProjectile is

copper needle
#

I need to turn [[8, 2], [3,2], [1,3]] into [[1,3], [8, 2], [3,2]]. In other words, I need to sort nested arrays by their second element and sort nested arrays with the same second element by their first element from greatest to least

#

Any ideas?

robust hollow
#
private _a = [[8, 2], [3,2], [1,3]];
{reverse _x} foreach _a;
_a sort false;
{reverse _x} foreach _a;
_a // [[1,3],[8,2],[3,2]]
copper needle
#

@robust hollow you are lovely. Thank you so much!

proper sail
#

Is using MPHit faster than sending local HandleDamage data to the server? As one fires on all clients while the other one doesnt

#

Ignoring the params

languid oyster
#

Hey guys, I have an object. Currently, I got it's vectors with this commands:

_dirVector = vectorDir _object;     // result: [1.14129,-0.972686,-0.184172]
_objUpVector = vectorUp _object;    // result: [0.0264739,-0.182259,0.982894]

Now, I need to alter those values to turn turn the object 90ยฐ around the x-axis, and 180ยฐ around the z-axis. So I can then reset objects direction with:

_object setVectorDirAndUp [_dirVector, _objUpVector];

Question: How do I recalculate the vectors, to turn the object in desired way? Or is there a smarter/easier way to achieve this?

violet gull
#

What does fadeSpeech do in Arma 3? I've been testing it out and don't hear any differences in AI talking, radio effects, or anything like that. Is it in the game just for backwards compatibility for Arma 2 scripts? Also didn't notice a difference in VOIP volume.

#

@languid oyster Look into BIS_fnc_transformVectorDirAndUp, that function is probably what you're looking for

languid oyster
#

@violet gull thanks for advice, testing now

still forum
#

@still forum
We do?! How come I've seen them?!
@little raptor I don't know how you saw them

#

everything else is passed by value (string, number, bool, what else?)
@astral dawn
Wrong, everything is by reference

winter rose
#

it's assignation that creates a new instance?

still forum
#

no

#

its assign that assigns the variable to a different reference

winter rose
#
_var1 = "abc"; // instance A
_var2 = "abc"; // instance B
// --- other file --- //
_var1 = "abc"; // instance A
_var2 = _var1; // instance A as well?
_var3 = _var1 + _var2; // instA + instA?
still forum
#
_var1 = "abc"; // instance A
_var2 = "abc"; // instance B

_var1 = "abc"; // instance C
_var2 = _var1; // instance C
_var3 = _var1 + _var2; // instC + instAB
#

values get created at compiletime (if they are constants, like your strings there)
or inside script commands that return a new value (most do)

winter rose
#

I meant those as two separate scripts ^^

still forum
#

Ah then.....
yeah.. I guess

would still name it instance C, as its different from the instance A from the other script

winter rose
#

OK, interesting - thanks for the insight!

languid oyster
#

Scenario: AI is ejected at, say 1000 m height from a heli above water.
Problem: How do I find the nearest shore for the AI to safely land on?

winter rose
languid oyster
#

surfaceIsWater only tells me, if there is water at one certain position. But I need to know the position, where there is no longer water. Guess I will have to make some 'find land' script.

exotic flax
#

you can use BIS_fnc_findSafePos

#

although I'm not sure if it's possible to have AI steer their parachute towards a certain position ๐Ÿค”

languid oyster
#

Ah yes, this is something interesting :). Well, if the AI does not steer, I will try to push it via addForce or something

#

I know it is a maths problem. And I know I am not intelligent enough to solve it alone. This is why I seek help here.

winter rose
#

BIS_fnc_findSafePos should do the trick; if not, we can fix you something with surfaceIsWater and a lookup grid

languid oyster
#

I will play around with the things you guys suggested. Many thanks for helping.

ripe sapphire
#

hello guys, would it be possible to bypass using remoteexec entirely by sticking with globalvariables, publicvariable, and premade triggers?

#

and does that have performance consquences compared to remoteExec

winter rose
#

heavy performance and security consequences yes

#

just why

ripe sapphire
#

xd

#

my brain explode learning how to remoteexec

winter rose
#

I can help you get it if you want

#

what is or are your concerns?

ripe sapphire
#

how much do i have to pay? xd

winter rose
#

three fiddy

#

and a subscription to my latest mission ๐Ÿ˜„

ripe sapphire
#

hell, im subcsribed to your First mission even :p

#

so i was learning how to remoteexec and leopard told me i should use functions, question does functions need to have params etc? can i just use my actual script.sqf, define it as a function in functions_cfg, and run it as a function?

#

or do i have to modify the script

finite sail
#

what's wrong with remoteexec?

ripe sapphire
#

nothing, i just dont understand it yet lol

winter rose
#

[usual, params] remoteExec ["functionName", target(s)] ๐Ÿ™‚

#

to define a script (sqf file) as a function, you can use CfgFunctions indeed

#

from there, it will be compiled and non-editable at the beginning of the mission

finite sail
#

so you're prepared to go down the performance/cpu/bandwith intensive route of public variables and triggers rather than learn remoteexec?

#

i think you're going about this wrong

#

remotely executing a premade function is BY FAR, the best way of doing what you need

winter rose
#

yes, hence why we will be coaching him into it ๐Ÿ˜‰

finite sail
#

I should add that I've messed with the public variables and triggers method just for fun

#

it turned out, it wasn't fun at all

ripe sapphire
#

yes, hence why we will be coaching him into it ๐Ÿ˜‰
teach me my lord camoman

finite sail
#

yes, remoteExec is a bit of a black art, it's often a matter of throwing shit at it until it works, but it's worth it

#

if you can't do remoteexec, you have no hope of doing the really hard stuff like dialogs ๐Ÿ™‚

ripe sapphire
#

yes i am willing to learn, thankfully i have lot of free time ๐Ÿ˜‚

#

so, i want to make an addaction, that will run this script for every client once its triggered

  params ["_target", "_caller", "_actionId", "_arguments"]; 
  _target animateSource ["switchposition",-1];      
  _target animateSource ["light",1];     
  _target setDamage 0; sleep 1; playSound "Alarm";  sleep 2; playSound "AlarmCar"; sleep 2;  playSound "AlarmCar"; 

airlight1 switchLight "on"; sleep 30; hint "dooropen"; dome1 setVariable ['bis_disabled_Door_1',0,true];
finite sail
#

you have free time at the moment.... lol

ripe sapphire
#

do i write that into an .sqf, define it in cfgFunction as exo_fnc_doorswitch, then ```sqf
this addAction
[ "<t color='#FF0000'>Turn ON Backup Generators</t>", remoteExec ["exo_fnc_doorswitch", 0, true],
[],
1.5,
true,
true,
"",
"",
3,
false,
"",
""
];

#

forgive the poorly written code lol

winter rose
#

no "true" after 0 because you only want it to happen once

#

you don't want JIP players to execute it at the moment they join

ripe sapphire
#

ahh ok thx

#

so that means to convert a script to a function you dont really need to modify anything right? just have to define it in cfgFunctions?

winter rose
#

also, since you setVariable with the public variable setting, it will make this synchronisation ร— nb of players ๐Ÿ˜ฌ

#

so that means to convert a script to a function you dont really need to modify anything right? just have to define it in cfgFunctions?
yep

#

it's better to have proper headers, params etc but a function is basically just an sqf file

ripe sapphire
#

ahh nice so thats easy, just have to do an extra step defining scripts in functions

#

also, since you setVariable with the public variable setting, it will make this synchronisation ร— nb of players ๐Ÿ˜ฌ
@winter rose i dont really understand MP scripting yet lol, how should i make it better?

winter rose
#

the thing is you should do everything that has a global effect on the server (e.g setDamage)
for all the rest, you can either run a function or run commands with remoteExec

ripe sapphire
#

got it so, 1-2 commands can just run with remoteexec, but big scripts use functions yes?

#

and the setvariable i guess should just run on the server but use set public parameters to true?

#

or remoteexec but set public to false?

winter rose
#

no, no

#

the third argument of remoteExec is to say "will it trigger to JIP players", nothing to do with global variable

basically:
you can trigger something client-side (e.g switchPosition animation)
the server catches that, then does all the rest

setDamage
sleep
remoteExec playSound
sleep
remoteExec playSound
remoteExec switchLight
sleep
remoteExec hint
setVariable with global flag

#

if the server disconnects, you have a bigger issue ๐Ÿ˜ฌ ๐Ÿ˜€

ripe sapphire
#

ooh so in the trigger onAct i execVM a script to execute serverside and inside that script:
setDamage
sleep
remoteExec playSound
sleep
remoteExec playSound
remoteExec switchLight
sleep
remoteExec hint
setVariable with global flag

finite sail
#

got it so, 1-2 commands can just run with remoteexec, but big scripts use functions yes?
@ripe sapphire That's how I do it, yes

winter rose
#

you could do that yes ๐Ÿ™‚

#

if the trigger is server-side ๐Ÿ‘€

#

just note, some things can be done with a slight delay

so doing a

[unit, false] remoteExec ["allowDamage", unit];
// spawn a bomb at unit's feet
```_may_ not work in that exact order ๐Ÿ˜ (but it is usually a matter of small durations)
ripe sapphire
#

ok i tried making that script, so i put this in init field of object:

this addAction     
[       "<t color='#FF0000'>Turn ON Backup Generators</t>",  execVM "doorswitch.sqf",     
    [],     
    1.5,     
    true,     
    true,     
    "",     
    "",     
    3,     
    false,     
    "",     
    ""     
];
#

and then doorswitch.sqf:

params ["_target", "_caller", "_actionId", "_arguments"]; 
_target animateSource ["switchposition",-1];      
_target animateSource ["light",1];     
_target setDamage 0
sleep 1;
{playSound "Alarm"} remoteExec ["bis_fnc_call", 0]; 
sleep 2
{playSound "AlarmCar"} remoteExec ["bis_fnc_call", 0]; 
sleep 2
{playSound "AlarmCar"} remoteExec ["bis_fnc_call", 0]; 
{airlight1 switchLight "on"} remoteExec ["bis_fnc_call", 0]; 
sleep 30;
{hint "dooropen"} remoteExec ["bis_fnc_call", 0]; 
 dome1 setVariable ['bis_disabled_Door_1',0,true];
winter rose
#

yeah, but no!

#

because the addAction code executes on the client that used the action

#

also, don't remoteExec BIS_fnc_call please x(

#

e.g```sqf
["AlarmCar"] remoteExec ["playSound"];
[airlight1, "on"] remoteExec ["switchLight"];

ripe sapphire
#

because the addAction code executes on the client that used the action
oof thats true, that means i have to remoteExec the server ones too with different params ?

[_target, 0] remoteExec ["setDamage",2]
#

like this?

#

e.gsqf ["AlarmCar"] remoteExec ["playSound"]; [airlight1, "on"] remoteExec ["switchLight"];
ok, i need to get used to that format, its hard because the syntax is different than usual xD

winter rose
#

you should make that the action code triggers the function server-side

#

non-safely, you could do```sqf
[[], "theFile.sqf"] remoteExec ["execVM", 2];

#

moar safely,sqf [] remoteExec ["EXC_fnc_theFunction", 2]; and in the function```sqf
if !isServer exitWith { ["Server only."] call BIS_fnc_error };
// then your code

ripe sapphire
#

i see so again since this is a lot of commands to execute then we use a function but for example if i want the action to just set damage then i can simply put this yes?

[_target, 0] remoteExec ["setDamage",2]
#

and also i was told using execVM with remoteexec is slower than using functions?

winter rose
#

no, just _target setDamage 0
the effect is global

#

the client can execute a global command, but do consider that he can also disconnect in the meantime
so on action's activation OK
after a sleep, risky

little raptor
#

@little raptor I don't know how you saw them
@still forum
Sorry I meant to write "how come I've never seen them?!"
I was typing on my phone! ๐Ÿ˜
Anyway, didn't you say we have them in Arma?

still forum
#

Arma engine has them yes

#

SQF does not

finite sail
#

guys, when I'm testing my MP stuff, I run the (is it a "listen server) game on my pc in MP and my test clients join over the lan and it's all good
when I have to make some changes to scripts, when I restart the mission, the clients don't download the changed mission file unless I completely shut the game down on my server pc

#

is there any way I can force the clients to get the new missionfile?

still forum
#

delete it from cache on the clients

#

appdatalocal/arma3/mpmissionscache

winter rose
#

"%localappdata%\Arma 3\MPMissionsCache"

finite sail
#

yes. is there a way of forcing a redownload from within the game?

winter rose
#

run it through Eden I think?

#

you can start the mission with an MP server from the editor

finite sail
#

ok, so when quitting existing run of mission, go back as far as edeneditor? that will do it?

#

because, as the server/client where im making the mission, I only have to go back as far as lobby for the pc to get new mission, if that makes any sense

#

you can start the mission with an MP server from the editor
@winter rose yes, thats what I'm doing

winter rose
#

IDK, I believe going back to Eden then re pressing (MP) preview will refresh that

#

at least I didn't encounter such issues

finite sail
#

ok, got it.. server/client has to go back to the edeneditor and restart from there

#

then clients download mission file if it has changed

#

yes all sorted, thanks guys

languid oyster
#

Stumbled over another problem. Medic and unconscious victim are both ejected from a damaged heli. Works:```sqf
unassignvehicle _medic;
_medic allowDamage false;
moveout _medic;
unassignvehicle _victim;
_victim allowDamage false;
moveout _victim;
waitUntil {vehicle _victim == _victim && vehicle _medic == _medic};


Now, that both are in air following should be no problem:```sqf
_victim attachTo [_medic, [0, 0, -0.5]]; 

But guess what. It doesn't work. Victim will not be attached to medic.

It does not work as long as I insert

sleep 3; // wait until victim and medic are airborne 

in between. Why is this so? I tested values up to 2 seconds, which do not work. Only 3 seconds or more will be enough.
I would rather not have that waiting period. 3 seconds of free fall could lead to critical situations, if heli is at lower altitudes.

ripe sapphire
#

had to turn my brain finding out why the params wasnt passed on to the function :'), finally figured it out

 {params ["_target", "_caller", "_actionId", "_arguments"]; [_target, _caller, _actionId, _arguments] remoteExec ["exo_fnc_backupgen", 2]}

finally made my first remoteExec work! thanks lou, tankbuster, leopard

finite sail
#

wow, thats a pig of a remoteexec.. i can see why you didnt like it lol

#

congrats on making it work

ripe sapphire
#

just note, some things can be done with a slight delay

so doing a

[unit, false] remoteExec ["allowDamage", unit];
// spawn a bomb at unit's feet
```_may_ not work in that exact order ๐Ÿ˜ (but it is usually a matter of small durations)

this is something that im concerned about, if the server is having low fps/ cant keep up with the processing, will the script mess up badly? because i tried running a listen server on my PC, then running a 2nd arma instance to join and test it, when the script executed everything was waay off

#

like very different in timing compared to when running it as SP mission

#

will running things through functions minimize those?

robust hollow
#
{params ["_target", "_caller", "_actionId", "_arguments"]; [_target, _caller, _actionId, _arguments] remoteExec ["exo_fnc_backupgen", 2]}

in that snippet specifically you could simplify it because the argument order doesnt change

{_this remoteExec ["exo_fnc_backupgen", 2]}
ripe sapphire
#

aaa you're right! thanks a lot! gonna save me lots of time xD

robust hollow
#

if the server is having low fps/ cant keep up with the processing, will the script mess up badly?
the remote execution will be delayed is all

winter rose
#

and if you have a server issue, the client-side script will lag as well ๐Ÿ˜ฌ

always consider the server is fine (to a certain extent of course)
at least, it is not a reason to put scripts on the client (maybe a headless client if absolutely needed)

ripe sapphire
#

i see, is it possible that script messed up badly because im running 2 arma clients at the same time? cause running it in SP worked fine without delays

winter rose
#

well, it always depends on performances
if you have 1 server + 2 clients on the same machineโ€ฆ it might be an issue yeah

ripe sapphire
#

i see, i guess i'll have to actually test it out with somebody online to get the real results... Thanks for the help today, good night gentlemen ๐Ÿ™‚

low zodiac
#

Is there a way to disable, that the mission fails if all players die in a MP Mission? (Used google and did found something, but only via custom scripting and/or custom revive systems. Also the option, mission fails if all die, is unticked in the settings.) Is there a way to do it without eg. a custom revive system

robust hollow
#

enable respawning

low zodiac
#

It is

winter rose
#

what are your set respawn options?

low zodiac
#

Respawn: respawn at custom position
I ticked only Set Respawn-Position, enabeld manual respawn and put the respawn timer to 6 seconds

robust hollow
#

did you place a custom respawn position (marker)?

low zodiac
#

Yes, and they show up when activ, the module(atleast on the map)

winter rose
#

mods?

low zodiac
#

No mods loaded

fluid wolf
#

This is related to ACE, but I'm having a hard time making a check to see if Adenosine has been injected into someone. Does anyone know a way to check for that, that I might be missing?

oblique arrow
#

that sounds like a good question for the ace slack server @fluid wolf

trail smelt
#

Hi, I made a script to move the furniture (using "enableSimulation"
"hideObjectGlobal") but it works great on localhost on a dedicated server, these commands are ignored .. except when they are embedded in a trigger
does anyone know where the problem might be?

fluid wolf
#

Oh I didn't know they had one

#

Thank you for the redirect

astral dawn
#

@astral dawn
Wrong, everything is by reference
from point of view of sqf user it's passed by value, that's what we were talking about @still forum

#

internally it can be passed through another dimension or whatever ๐Ÿคท it's just an implementation detail

still forum
#

From the point of view of the sqf user its magic that just works

#

just because you never use it as a reference, doesn't mean it isnt a reference

exotic flax
#

From the point of view of the sqf user its magic that just works
^^ perfect description on how SQF works magic

finite sail
#

black magic

#

because its mostly evil

#

or grey magic, because thats the colour of my hair since I started SQF

#

2 jokes for the price of 1, ladies and gentlemen

#

im here all week

winter rose
#

"try the veal!" ๐Ÿ˜„

fluid wolf
#

I'm kind of losing my mind but when you set an addaction, is there a way to make it disappear when it completes? I have it set to only function if you're on opfor (which the purpose of it is to set you on blufor) but on blufor you can still select it, it just does nothing. Not sure which bool I messed up

#

especially because the proximity trigger one works, but this one doesn't...

finite sail
#

the hideOnUse boolean, set it to true

#

the action will go away after it's been used

fluid wolf
#

HideonUse doesn't stop you from reselecting it

#

it just hides the action menu afterwards as far as I can tell

finite sail
#

your script is constantly readding the action?

fluid wolf
#

I don't think so... it should be pretty clear cut. If redfor switch to bluefor

#

but as blufor you can still use it, it just has no effect

#

it remains forever in your action menu

#

no effect as in I know it isn't firing because the hint does not appear again either

winter rose
#

you can remove the action with removeAction ๐Ÿคทโ€โ™‚๏ธ

fluid wolf
#

...yea let me try that

astral dawn
#

just because you never use it as a reference, doesn't mean it isnt a reference
it's not like I decide myself to not use references in SQF, I just can't affect it at all, let's not confuse SQF people by saying that everything is passed by reference, we must say that 'internally it is passed by reference but for you it looks like it's passed by value' instead

fluid wolf
#

Oh I figured it out. I had my brackets too high and the condition was getting jammed into the wrong place, so it wasn't taking effect. Kind of suprised the script even ran like that honestly...

queen cargo
#

everything in SQF is passed by reference. Period

#

however

#

barely any operators operate on reference values

hollow thistle
#

only some of the array operators.

queen cargo
#

correct

#

to name most of them:
set, pushBack, pushBackUnique, deleteAt, resize

#

technically tho, all object operators are also reference modifying

finite sail
#

@winter rose , what are they saying? i thought I understood this and now they've broken me

#

make them stop

#

im sad

astral dawn
#

Just SQF nerds nerding SQF

winter rose
finite sail
#

you are nerding on a level way above me

#

ive read that a meeeeelyon times, Lou

#

arrays elements are by reference, so if you copy the array and change the original the copy changes too, right?

#

so what does "by value" mean?

#

BTW, if you think it's better I don't trouble myself with this, that's also an acceptable answer

astral dawn
#

when stuff is passed by value, it means you can modify the passed value and it won't affect the original one

finite sail
#

oh ok

astral dawn
#

like it happens with SQF numbers or strings

finite sail
#

yes

astral dawn
#

'pass (argument) by value' and 'pass (argument) by reference' is a common situation in many programming languages

#

and sometimes they pass stuff by reference by default, sometimes they pass stuff by value by default

finite sail
#

but as you say earlier, i dont really need to know that

#

right?

#

i dont need to know what happens under the bonnet, as long as the car goes

astral dawn
#

I meant that you don't need to know how SQF is implemented internally. And internally they pass things by references. But to the user it appears as if it's passed by value.

But you must always know if stuff is passed by value or reference on your (user's) side of course.

#

So to sum it up, in SQF, on user's side: basic types are passed by value, only array is passed by reference.

#

i dont really need to know that
yeah you don't need to know SQF implementation details to write programs in SQF ๐Ÿ™‚

#

On the contrary, X39 knows all that because he made an SQF emulator himself

still forum
#

like it happens with SQF numbers or strings
no it doesn't. you cant modify numbers and strings in SQF

astral dawn
#

I do a [_a, _b, _c] call myFunc, inside it I do params ["_a", "_b", "_c"], of course I can modify _a, _b, _c

still forum
#

no you dont

#

you can run commands on it that return copies and then reference these copies in your variable

#

you cannot modify

astral dawn
#

which in the end makes it behave like pass-by-value

still forum
#

you call _b = "otherstuff" to be modifying _b, but its not.
Same as _b = _otherArray is also not modifying the array that was in _b before you assigned something different to it#

astral dawn
#

which in the end makes it behave like pass-by-value

still forum
#

Just the fact that there is no command to modify the value, doesnt mean the variable suddenly turns into pass by value

#

If there was a command, without anything else changing you'd probably pass by reference even though literally nothing in your code changed

astral dawn
#

you are talking about implementation details again, I am talking about how it behaves for user

still forum
#

no I'm talking about the same

#

you are saying, if there was a command that could modify strings, all string variables would all of the sudden change from being pass by value, to being pass by reference.
Just because some script command somewhere starts existing

#

that wouldn't make any sense

astral dawn
#

where did I say that?

still forum
#

you said strings are pass by value, because there are no commands to modify it (like array has)

#

The difference that makes array pass by reference, and string pass by value is just that array has commands to modify it, and string doesn't.
Commands existing or not doesn't change how variables are passed around

astral dawn
#

It's also the equality operator

#

_a = [1,2,3];
_b = "stuff";
_c = _a; // we have a reference to that array
_d = _b; // we can modify _d and it won't affect _b

#

so equality operator also works different?

still forum
#

you talk about equality operator, and now show assignment operator.
What do you mean about equality operator

#

no. It also always works the same

astral dawn
#

ok assignment then

still forum
#

_d = _b; // we can modify _d and it won't affect _b
you cannot modify _d, there are no commands to do so

sharp grotto
#

Stupid question: How would i filter and count only attachments from weaponsItemsCargo backpackContainer player and get the results in an array like that [["optic_Arco",1],["rhs_acc_2dpZenit_ris",1],["muzzle_snds_B",1]]

astral dawn
#

you cannot modify _d, there are no commands to do so
ok I understand what you mean then

still forum
#

I guess you need to make config lookup and check the type. Or BIS_fnc_itemType might work @sharp grotto

#

you can reassign the variable. But you cannot MODIFY.
Except arrays, because they have commands to modify them.

But if strings had commands to modify them it would be the exact same for them, because everything is passed by reference

#

And just the fact of some command being added that you might not even use, doesn't magically change whether variables are passed by reference or value, like you say

astral dawn
#

I would need to make deep string copies if I decide to use that command

queen cargo
#

you can also use SQC, changing the front end

#

shameless self advertising of something that is not even having a forum thread because i am lazy

astral dawn
#

hi X39 ๐Ÿ‘‹

queen cargo
#

hay

finite sail
#

On the contrary, X39 knows all that because he made an SQF emulator himself
@astral dawn Oh yeah, I use it every day, that and the VS code thing you did

hollow plaza
#

Haven't found any direct information about this regard, but is it possible to code a custom script in mission files that would be accessed via one of the empty custom keybindings that are available in vanilla Arma?

#

And of course, how could I go about it

#

Actually, making a scroll menu option might be easier and overall better in this case.

finite sail
#

guys.. a question about scope and

#

breakout, which ivce never used

#

example 1

#

scopeName main is the while loop at line 2?

#

so breakto main will quit that loop?

still forum
#

breakTo will break out of scope for so long, until it arrives at the scope you named

#

scopeName main is the while loop at line 2?
no, its the scope right before/outside/above that while loop

finite sail
#

so the scopename names the loop it is within, rather than the loop directly after it?

still forum
#

not loop, the scope

#

A scope is basically everything surrounded by {}

finite sail
#

yes and in example 1 on that page, it goes from line 2 to line 11

#

which in this case, is a loop

exotic flax
#

the loop could be anything, like another script

still forum
#

scope != loop

finite sail
#

ok, let me have another go ๐Ÿ™‚

still forum
#

imagine it like a row of rooms.
scopeName sets the name of the room you are currently in.
And breakOut makes you walk backwards, until you are standing in a room, with the name that you gave to breakOut

finite sail
#

in that example, whats the name of the scope that is from the while true at line 2 to the closing curly at 11?

still forum
#

"loop1"

finite sail
#

good, i get it

#

thank you

still forum
#

loop1 goes from
while {true} do { #starts here#

to

sleep 1;

#ends here#
};

#

we have a wiki page about scopes

finite sail
#

im on it now ๐Ÿ™‚

compact maple
#

hi, I would like to get the ID (prim key) of the query I just inserted with extdb3, I think it's not possible with extdb functions. So I tought about SELECT LAST_INSERT_ID(); but Idk if it's reliable

exotic flax
#

I would say that SQL is more reliable than extdb3 or SQF in this case ๐Ÿ˜‰

compact maple
#

Alright, but do you know how the SQL engine handle many queries, like
I insert a vehicle
(in the meantime others queries are called by the server)
If I call the command to get the last inserted id, will it give me the right one and not the id of another query? (sorry for my english)

exotic flax
#

The ID that was generated is maintained in the server on a per-connection basis. This means that the value returned by the function to a given client is the first AUTO_INCREMENT value generated for most recent statement affecting an AUTO_INCREMENT column by that client.
So the value returned by LAST_INSERT_ID() is per user and is unaffected by other queries that might be running on the server from other users.

Although I have no idea how this is handled by extdb3 ๐Ÿค”

compact maple
#

Per user, you mean instance of query ? of sql users ?

#

I think I am just going to try it, and see what happened, at first I used extdb witth the nยฐ2 protocol so I query async, and it returns me an ID, but the returned id is not the primary key id of the inserted row, I think it's a global ID for the whole database

exotic flax
#

well, technically the server is the only "client" connecting to the database, so it should already be impossible to run 2 queries at the exact same time (when programmed correctly)

compact maple
#

true!

low zodiac
#

Is there a way to disable, that the mission fails if all players die in a MP Mission? (Used google and did found something, but only via custom scripting and/or custom revive systems. Also the option, mission fails if all die, is unticked in the settings.) Is there a way to do it without eg. a custom revive system
I still haven't found a solution beside having a custom revive system etc. Any ideas?

astral dawn
#

you need to set respawn mode in description.ext

low zodiac
#

respawn = "Base" ?

astral dawn
#

I don't remember

#

there's a wiki article about respawn types

low zodiac
#

currently on it

#

That actually worked. Thanks!

gilded rover
#

one can export ingame stats to a SQL DB? (thinking of doing some sort of website/app/program for my clan that tracks kills and accuracy and such

robust hollow
#

yes

#

you will probably want to use an extension like extdb to send the data to the db

tough abyss
#

Evening gents.

I'm sure it's been done many times, but didn't know how to search for it.

Context: I have a function that I would like to execute locally for certain players that gives them an action. Function works fine (MP dedicated), but I now have it execute for every player via initPlayerLocal.sqf. What construction do you guys use to identify what unit classname a player is?

robust hollow
#

typeOf

#

eg typeOf player

tough abyss
#

Ha! Thanks.

torn juniper
#

@still forum do you take bribes for commands or fixes? monkaThink

hollow thistle
#

No BI pings without solid reason #rules

torn juniper
#

I thought that was a motivating reason.. https://community.bistudio.com/wiki/setUnitLoadout will not set with some mods enabled, and has refill of ammo if multiple ammo has the same used quantity. Plus the use of a way to add a weapon with attachments into the player cargo if possible...

elder siren
#

Hi, wondering if someone could help me out. Trying to add a .paa image to my diary. Comes in transparent. I'm using a3tools to covert from png to paa. Anyone know what im doing wrong?

robust hollow
#

share the code you're using to add it to the diary

elder siren
#

<img image='ctog.paa' />

robust hollow
#

the image is in the mission root?

elder siren
#

player createDiaryRecord ["Diary",["Situation",
"<img image='ctog.paa' />SITUATION - NATO continues to be engaged in the Mediterranean combatting localized....

robust hollow
#

mmmmmmk

#

did you use imagetopaa or texview2 to convert to paa?

elder siren
#

texview2

robust hollow
#

use imagetopaa

elder siren
#

said failed to convert

#

going from png to paa

robust hollow
#

what is the resolution of the png?

elder siren
#

359x359

robust hollow
#

All input textures must have resolution 2^x / 2^y (e.g. 16 / 16, 32 / 32, 64 / 64, 256 /256)

elder siren
#

should i shrink it down to 256x256 then?

robust hollow
#

yea

#

texview2 doesnt error on bad images, but it doesnt convert them correctly either

elder siren
#

ok thanks, i'll try it and see. 1 second

#

still comes up transparent

robust hollow
#

hmm. could you dm me the png and ill see if i can make it work

warm hedge
#

_ca prefix?

robust hollow
#

needed to restart the game

elder siren
#

Connor was very helpful! Thank you.

still forum
#

@still forum do you take bribes for commands or fixes? :monkaThink:
@torn juniper I don't know if I'm allowed to, but yes I would :D
will not set with some mods enabled
that would be a bug then, if you have a repro put on FT and link me.
Plus the use of a way to add a weapon with attachments into the player cargo if possible..
just use addWeaponWithAttachmentsCargo?

ripe sapphire
#

hey guys, im trying to hint 3 different strings for 3 cycles, is this code good enough?

for "_i" from 0 to 2 do
{["1","2","3"] apply {hint _x; sleep 1}}
}
#

for performance

winter rose
#

why so complicated

{
  hint _x;
  sleep 1;
} forEach _strings;
ripe sapphire
#

hmmm ok i think thats better, just thought that the array would be very long xD

winter rose
#

but your code executes it thrice

ripe sapphire
#

yes because it needs to run 3 times

#

like this (downloading. , downloading.. , downloading...) and repeat 3 times

winter rose
#

then wrapping with for as well is required (or some other looping structure of your choice)

ripe sapphire
#

this?

for "_i" from 0 to 2 do
{ 
  {hint _x; 
  sleep 1; 
  } forEach ["Systems booting.", "Systems booting..", "Systems booting...."]}
}
winter rose
#

yep (and what an awful forEach indentation really)

#
private _strings = [
  "Systems booting.",
  "Systems booting..",
  "Systems booting..."
];

for "_i" from 1 to 3 do
{
  {
    hint _x;
    sleep 1;
  } forEach _strings;
};
```isn't it better
ripe sapphire
#

๐Ÿ˜‚ i am sorry and thank you for the help!

ripe sapphire
#

guys, -showScriptErrors is force enabled in editor yes? that means if i dont tick the -showScriptErrors startup parameters then i'd still see them in editor but not in-game?

winter rose
#

I think so, unsure

#

I always have it enabled ๐Ÿ˜„

ripe sapphire
#

yea i know its good to have it on but some mods keep showing these error messages and theyre not going off, so annoying xD

winter rose
#

remove them mods, they don't deserve you!

ripe sapphire
#

exactly, we deserve arma4 with all the bugs fixed and lots of amazing features so we dont need them mods ๐Ÿ˜Ž

tough abyss
#

Do leave a comment with the mod too so they at least know there is a problem even if they don't fix it.

smoky verge
#

if I made a trigger that activates when players enter it
and I put player setDamage 1; in the activation field
it should only kill the players inside the trigger right?
thats what I understood from the latest discussion I had here

hollow thistle
#

depends how you make the activation

#

if you set it wrongly it might kill the player when other player gets into the area

smoky verge
#

yeah thats what I'm worrying about
used the default scroll down menu and selected players

hollow thistle
#

then local trigger will activate if any player will get into the area

smoky verge
#

so its correct right?

hollow thistle
#

player A and B
every player has local Trigger activated when any player in area

#

Player B enters trigger area

#

Trigger A and B activated on respective machines

smoky verge
#

oh so it would kill everyone

ripe sapphire
#

So by using any player as activation, then you dont need to remoteexec yes ?

hollow thistle
#

yes and no would kill most of the player as triggers check their activation every 0.5

#

and it might kill the player B before trigger on player A machine notices it should be activated.

#

but yeah let's say it kills everyone for simplification

smoky verge
#

I guess I need to work with in thislist
not sure how though

hollow thistle
#

yes

#

this && {player in thisList} should be enough

smoky verge
#

in the condition?

hollow thistle
#

yes

#

are triggers with activation NONE checking the condition?

#

then it could also be done as:
player inArea thisTrigger

smoky verge
#

I guess so

hollow thistle
#

I guess this is just always false when activation is set to none.

#

So by using any player as activation, then you dont need to remoteexec yes ?
this question has no sense to me in context we're talking about. Sorry.

smoky verge
#

so to clarify
I use none in scroll down menu
in the condition field I use
this && {player in thisList}
in the activation field I use
{player in thisList} setDamage 1;
?

ripe sapphire
#

I mean, say i want to give a hint to everyone once any player enters the trigger

hollow thistle
#

Yeah, every local trigger will activate and execute code, should work for you.

ripe sapphire
#

In the onact i can just do hint โ€œabcโ€ and it will trigger to everyone?

hollow thistle
#

Sanchez your thing makes no sense at all.

smoky verge
#

meowtrash knew it

hollow thistle
#

if using activation of any player:
condition: this && {player in thisList} // check if any player in area (dropdown activation) AND local player is in the list of the objects that activated the trigger

#

and player setDamage 1 in statement

#
{player in thisList} setDamage 1;

what is that, you're trying to execute set damage on CODE.

smoky verge
#

yeah I had doubts on that

finite sail
#

thats {bool} setdamage 1

hollow thistle
#

does not matter code will be not executed.

finite sail
#

yep

smoky verge
#

check if any player in area (dropdown activation) AND local player is in the list of the objects that activated the trigger
what do you mean exactly with that?

hollow thistle
#

I explained what the code does.

#

this contains state of the trigger activation you've selected from dropdown

smoky verge
#

well but since the dropdown does the same thing wouldn't it be better if I used "none" with it?
like thishttps://imgur.com/a/77PWuw9

hollow thistle
#

no

#

what will be in thisList if trigger is activated by nothing?

#

NOTHING ([])

#

this contains state of the trigger activation you've selected from dropdown

#

let's guess what will be in this variable if trigger is activated by nothing

smoky verge
#

oh the present activation type is used only if I use something

#

got it

hollow thistle
#

should work I guess.

#

When you're doing None as activation I suggested to use player inArea thisTrigger as an alternative.

smoky verge
#

oh I understand

#

its a shame there is no way to test it properly unless I had a dedicated server

hollow thistle
#

Why not?

#

Open local hosted

#

start second arma client

#

I'm doing it all the time

smoky verge
#

but the local hosted doesn't always behave the same as a dedicated does it?

hollow thistle
#

It's mostly the same... it all comes to understanding the locality.

smoky verge
#

yeah I'm bad with local/global stuff
how do you create a 2nd client?

hollow thistle
#

you click Play again in the launcher

smoky verge
#

huh never though of that

hollow thistle
#

Yeah I guess a lot of people not, people complain that it's hard to test MP and I'm sitting here with 2-3 clients open like...

smoky verge
#

isn't it taxing on your pc?
I feel like it would be the killing blow for mine

hollow thistle
#

I'm fine with just 16gb of ram

smoky verge
#

I see, I'll make some tests then
thanks a lot @hollow thistle

ripe sapphire
#

You can also run a dedicated server from ur pc

hollow thistle
#

that too, and it's really easy. Just tick the "server" in launcher

smoky verge
#

with tasdt or stuff like that?
seems a bit extreme for testing

#

I beg your pardon what?

ripe sapphire
#

check here, bottom of page

#

"testing locally" section

hollow thistle
smoky verge
#

you guys opened a world of possibilites

hollow thistle
#

my standard dev dedicated config:

loopback = true;
hostname = "Development";
localClient[] = {"127.0.0.1"};
admins[] = {"<yoursteamid>"};
persistent = 0;
BattlEye = 0;
allowedFilePatching = 2;
verifySignatures = 0;
smoky verge
#

wonder if that could fix my port forwarding problems
but thats more of an issue with my country

ripe sapphire
#

dont think server config could fix port forward

winter rose
#

isn't there a kickDuplicate = 0 to set too?

hollow thistle
#

IIRC not when you're using loopback

winter rose
#

thanks ๐Ÿ‘Œ it has been a huge while since I ever configured a server ^^

mortal wagon
#

Hello i was wondering if there was script that would make wapon with a couple of mags Spawn in a certain type of box. This would Be used in a battle royal pvp mission

warm hedge
#

addWeaponCargo and such?

winter rose
tough abyss
#

how does locality for spawn work?

#

I'm assuming spawn itself should be used inside a function/script that has been remoteexec'd

mortal wagon
#

thank you lou

astral dawn
#

how does locality for spawn work?
I'm assuming spawn itself should be used inside a function/script that has been remoteexec'd
that's the preferred way, yes

#

however you can remoteexec a spawn and send the code to execute over network

#

but please don't do that

tough abyss
#

ty, noob locality question, but is it better to remoteexec a function/script with code or remoteexec individiual functions & such? in terms of network usage

slim oyster
#

Cba events work on publicvariable eventhandlers i believe

astral dawn
#

ty, noob locality question, but is it better to remoteexec a function/script with code or remoteexec individiual functions & such? in terms of network usage
@tough abyss
Depends on the situation of course. But if you separate your remote-executed code into your own SQF function, then you get the flexibility of being able to vary it in case you need to change something.

slim oyster
#

Function = {} so defining that and calling that is better than something like remoteexec'ing bis_fnc_call i believe

astral dawn
#

I'd guess that remoteExec network usage shouldn't concern you unless you do them very very often or unless you need to send very very much data

slim oyster
#

Remoteexec passes the fnc/command as a string that is then used as a reference, which could be nil right?

#

Its not actually passing the function as code over the network right?

astral dawn
#

however you can remoteexec a spawn and send the code to execute over network
but please don't do that
I meant that you shouldn't do it because it would mean that you will have to open "spawn" fore remote exec access. It would mean that cheaters will get to easily remotely-execute any code on remote machines. It's a big security risk in any situation if you allow arbitrary code execution over network. If you contain your code in your own functions, then the possibilities are much more limited.

#

Its not actually passing the function as code over the network right?
why would it not? ๐Ÿค”

#

[0, {player setpos [1,2,3];}] remoteExec ["spawn", ...] or whatever the syntax is. Whole left part is sent over network I believe I am totally sure.

slim oyster
#

I mean for a function not a command

#

Its passing string reference, and params

tough abyss
#

@astral dawn ty for the explanation

astral dawn
#

Its passing string reference, and params
yeah I think it's just passing string, not whole code

worn forge
#

using remoteExec on BIS_fnc_call is ... strange, when you could just use remoteExecCall

astral dawn
#

yes it's also important to know difference between remoteExec and remoteExecCall @tough abyss

tough abyss
#

seen it before, what's the difference? @astral dawn

astral dawn
#

remoteExec will spawn the function you tell it to remote-execute

#

remoteExecCall will call it

jade abyss
#

Yeps

astral dawn
#

I'd say in 95% of cases you want to remoteExecCall things

jade abyss
#

sleep/waitUntil/etc in it? -> RE
else: REC

tough abyss
#

@astral dawn thank you, very helpful

#

@astral dawn One more question, apologies if I'm being annoying, but is there a way to remoteexec just a block of code?

astral dawn
#

yes, check examples of remoteexec

tough abyss
#

problem is, I have to use sleep in this block of code

#

so I can't use call

#

if that's what you're referring to

#

or should I just use a function and immediately after it remotexec it?

astral dawn
#

you should make your function, and remoteExec it then

#

it will execute your function, remotely, in scheduled environment

tough abyss
#

thought that there was some better solution than that, thank you o7

astral dawn
#

no, that's the intended way

ripe sapphire
#

problem is, I have to use sleep in this block of code
@tough abyss you can put the code in a .sqf file and then remoteExec an ExecVM

["zeScript.sqf"] remoteExec ["execVM", 0];

but not recommended because theyre unsafe and also slower than functions

hollow thistle
#

please don't. Just use functions with RE/REC

jade abyss
#

I guess there is almost any possible way as an example in there.

trail smelt
#

Hello, i need help with my script this i need my script do https://streamable.com/5oa86x this solution works only in eden ...
solution based on addAction and enableSimulation, hideObjectGlobal

code:

//plot1 init:
plot1 addAction ["Zabarikรกdovat pล™ededek", {
titleCut ["", "BLACK FADED", 1.5]; 
1 fadeSound 1;
plot1 say3D ["music4", 1000, 1];
sleep 1;
plot1 enableSimulation false; 
plot1 hideObjectGlobal true;
plot2 enableSimulation true; 
plot2 hideObjectGlobal false;
sbag1 enableSimulation false; 
sbag1 hideObjectGlobal true;
sbag2_1 enableSimulation true; 
sbag2_1 hideObjectGlobal false;
sbag1_1 enableSimulation true;
sbag1_1 hideObjectGlobal false;
regal1 enableSimulation false;
regal1 hideObjectGlobal true;
regal2 enableSimulation true;
regal2 hideObjectGlobal false;
oldb1 enableSimulation false;
oldb1 hideObjectGlobal true;
oldb2 enableSimulation true;
oldb2 hideObjectGlobal false;
}]
#

but in MP (on dedicated server) do this https://streamable.com/tdq34f .. one guy from community tell addAction transfer to remoteExec
after transfer code is looks like this:

//table1 init:
[this,["Zabarikรกdovat dveล™eX","scripts\backbarik.sqf",[],1,false,true,"","_this distance _target < 5"]] remoteExec ["addAction",-2, true];
//backbarik.sqf:
titleCut ["", "BLACK FADED", 0.30];
1 fadeSound 1;
table1 say3D ["music5", 1000, 1];
table1 enableSimulation false;
table1 hideObjectGlobal true;

bag1_1 enableSimulation false;
bag1_1 hideObjectGlobal true;


bag1_2 enableSimulation false;
bag1_2 hideObjectGlobal true;

bag1_3 enableSimulation false;
bag1_3 hideObjectGlobal true;

bag1_4 enableSimulation false;
bag1_4 hideObjectGlobal true;

bag1_5 enableSimulation false;
bag1_5 hideObjectGlobal true;

table2 enableSimulation true;
table2 hideObjectGlobal false;


bag2_1 enableSimulation true;
bag2_1 hideObjectGlobal false;

bag2_2 enableSimulation true;
bag2_2 hideObjectGlobal false;

bag2_3 enableSimulation true;
bag2_3 hideObjectGlobal false;

bag2_4 enableSimulation true;
bag2_4 hideObjectGlobal false;

bag2_5 enableSimulation true;
bag2_5 hideObjectGlobal false;

The result is the same only in the menu the option appears in duplicate
video with result: https://streamable.com/kxss7z

Some one help me with this ?

robust hollow
#

hideObjectGlobal must execute on the server. your action should look something like this

plot1 addAction ["Zabarikรกdovat pล™ededek", {
    titleCut ["", "BLACK FADED", 1.5]; 
    1 fadeSound 1;
    plot1 say3D ["music4", 1000, 1];
    ["scripts\backbarik.sqf"] remoteExec ["execVM",2];
}]

where backbarik.sqf is just the enablesimulation and hideobjectglobal lines

winter rose
#

@trail smelt โ†‘

trail smelt
#

Yea i testing now.

trail smelt
#

๐Ÿ˜„ yea thank you nice works now..

weary osprey
#

is there a code monkey around?
trying to figure out an error and its driving me up a wall

robust hollow
#

๐Ÿต

weary osprey
#
[ 
 Generator,            
 "Turn On Generator",           
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",  
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",  
 "_this distance _target < 3",       
 "_caller distance _target < 3",            
 { Hint "You flip the switch, nothing. Immediately you begin to look around for a way to turn the generator on" }, 
 { Hint "Fumbling around, your find a loose fuse. You begin to place it in, hoping it will work"}, 
 {playSound3D ["generator.ogg", Generator, false, getPosASL player, 1, 1, 0]}, 
 15,              
 0,              
 true,             
 false             
] remoteExec ["BIS_fnc_holdActionAdd", 0, Generator];
#

its returning type bool expected number

robust hollow
#

you are missing a couple of arguments after the third code block

[ 
 Generator,            
 "Turn On Generator",           
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",  
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",  
 "_this distance _target < 3",       
 "_caller distance _target < 3",            
 { Hint "You flip the switch, nothing. Immediately you begin to look around for a way to turn the generator on" }, 
 { Hint "Fumbling around, your find a loose fuse. You begin to place it in, hoping it will work"}, 
 {playSound3D ["generator.ogg", Generator, false, getPosASL player, 1, 1, 0]}, 
 {},
 [],
 15,              
 0,              
 true,             
 false             
] remoteExec ["BIS_fnc_holdActionAdd", 0, Generator];
weary osprey
#

the only 2 changes I see made are the empty [] and {}

robust hollow
#

yea

weary osprey
#

also, how did you get that to change colors in the box?

robust hollow
#

```sqf

```

weary osprey
#

good to know

#

thank you

#

hmm the sound file didnt trigger

#

worked fine, no errors, just didn't trigger

#

any reason the sound file wouldn't trigger? Just tried messing around the bit, the file is the right name and in the right place