#arma3_scripting
1 messages ยท Page 626 of 1
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)
Ok i deleted and my code is seme as your but after use zeus/arsenal, screen still set to black..
Something is deleting your camera. What does kamera give you when you run it in the debug console after the screen has become black?
i try it
@trail smelt In that video, are you remote controlling the unit?
yes via module
If you simply close Zeus, what happens?
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...
No bcs is mp scenario..
If i start as SP all npc spawn (700+) and mission will not allow you to choose a slot
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.
Even so, thank you for the great effort ๐
np
(_JetTeam select 0) dofire _A2AFound;
will this select a unit from group ingame?
What is _JetTeam ? @proud carbon
If it's a group then https://community.bistudio.com/wiki/units
a group isn't an array, use units group to get the group members
this should work?
((units _jetteam) select 0)
Ty
np
Is there a way to detect if a player placed a respawn tent by using one of those respawn backpacks?
would it fire the weapon assembled event?
assembling it will use an animation? could capture that with an EH
problem is, they often reuse the 'engineer repair' anim
player addEventHandler ["WeaponAssembled", {diag_log _this}];
// 19:10:42 [unit,1fdbb97d600# 17: tenta_f.p3d]
appears to work
what's the max distance one can see a deployed tank smoke?
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 ๐
Is any way to get/calculate the approximate visible distance on certain coordinates from the fogParams?
not really
try maybe checkVisibility @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."
@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.
Dont see any part in video where he exited normally.
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
and it wasnt working properly at all
Which you said you can't
I believe the start of video is just showign a picture
it doesnt actually take any live feedback
but after opening the arsenal it will do to everyone who opened it so it's not just a problem zeuse
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
Well, if the mission is based on an arsenal, this can't really work if I understand correctly ..
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.
Its Arma... i doubt it.. ๐
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 :)
@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)
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.
Looks like no. It does fadeMusic 0 hardcoded. You can overwrite it just like do fadeMusic 1 a frame later
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?
playMusic [musicName, start]
Wiki is always your friend
I literally just copy pasted it! ๐
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)
Hello,
I am currently using the functions:
https://community.bistudio.com/wiki/setFuelCargo
https://community.bistudio.com/wiki/setRepairCargo
To prevent the use of repairing and refilling, no problem for this
but I can not find a function to prevent healing with the ambulance van (C_Van_02_medevac_F)
Do you have an idea for help me with this?
Ty ๐
@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
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
afaik ambulances can heal indefinitely. you can't remove their "healing" ability
Ah ok ๐ฆ
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
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
I think it is possible to also modify it by the mission config in v2.01 (dev)
huh? how?
Import can't do it?
I thought it was identical to class ...
Except it could see and modify the configFile too
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
Export cfgvehicles { class ... } ? 

Mission config being locked out from things is mostly a security thing right?
@still forum This part confused me:
https://community.bistudio.com/wiki/import#Modifying_properties
That's why I thought it could
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
but not the configFile:
import cfgVehicles;
class cfgVehicles {
class newVehicle {
}
}
yeah. I realize that now. This was never gonna work
Import class from path?
Instead of import cfgvehs
But yeah, only unlocked cfgs like ui and such
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.
"unlocked"?
you could read it, that's it
all the rest is modified by mods
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?
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
{ sleep 3; moveOut _x } yes
spawn it and use a sleep inside
will try thx ๐
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
@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
what I said is faster. No need to look it up in config
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
config is 0.0011
way faster
That's only 2 times faster! (and only 0.0005 ms!)
I meant as opposed to using the function
so it would be [civilian,_unit] disableAI "ALL"
man im such a noob, im embarasing myself :8
i missed a zero ๐
oh. Now it makes more sense!
i do that fnc side thing quite a bit, i should replace that with group side
every tiny bit oof cpu power saved ๐
i missed a zero ๐
You mean you added an extra zero?!
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
@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
};
man
findIf ... such a gem
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
it should keep running right?
Yes. Just make sure you spawn the code (it's scheduled)
i couldve spent 4 hours writing that, i swear
@vernal jay If you only need driving civilians, you'll have to change the code. That code applies to all civilians
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
who is flying the helo?
ok. I just changed the code to only apply to driving civilians. You can remove that part
my squad
as long as it isnt AI ๐
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
any idea what im doing wrong hear? this addEventHandler ["Explosion", {
_this select 0 setdamage (damage _this select 0 + 0.07);
}];
@sudden yacht
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);
}];```
ty
Does anyone have a script to let say a helicopter patrol in a trigger area?
it can be done, but you could also use waypoints?
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
is there a way to switch the weapons of an ai unit instantly?
specifically in 3den?
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
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
nice thx
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];
~~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)
Works. Thanks, @robust hollow. Google was failing me.
Now I just gotta restrict it to Engineers, which should be up where distance is specified.
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";
How come _this == B_engineer_F works in addAction, but not in holdActionAdd?
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
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.
is B_engineer_F a variable you have set?
It's the unit type.
you want typeOf _this == 'B_engineer_f'
Wonder why it worked before.
and make sure _this is actually the object, and not an array
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
Arma isn't very consistent with their variable naming ;)
But should work as Connor pointed out with typeOf
Hmm. typeOf _this == B_engineer_F && _this distance _target < 5 doesn't work either. Consistency is too hard, I guess.
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
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
yea, but == is case insensitive so it doesnt matter
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];
You're limiting it to a specific unit type. Not every engineer is a "B_engineer_F"
Use unit traits.
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.
Arent holdActionAdd conditions are checked continuously, it would be better to have that engineer condition to add the action?
instead of inside of it..
According to the wiki, the first one is only checked on start, the second one is checked every tick
the first is checked every frame to show the action, the second is checked every frame while holding
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";
true... was watching the wrong wiki page
?
_this getUnitTrait "Engineer" && _this distance _target < 5```
yes
yup
you will need to double quote if thats going in a string
or just '
or use single quotes ๐
Yeah, don't want to end the string short.
hey guys, does enableGunLights work on players too?
im trying to disable players using ther flashlights without removing them, if that is possible
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
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?
negligibly
but dont do the action every second, do a check like this
if (player isFlashlightOn currentWeapon player) then {player action ["GunLightOff", player]};```
ah you're right
Hello all, I am very new to scripting, can you give me some refrences i can view?
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
oh ok thx :))
"lightoff.sqf" remoteExec ["execVM",0,1];
is this correct?
why not just execute it from the initPlayerLocal.sqf or similar? no need to remoteexec
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.
depends on where you place your code
it should work well in init.sqf, where player impacts everyone
@smoky verge โ
its supposed to play mid mission
remoteExec
yeah was thinking of that
could I just remoteExec an sqf file and have it work for all players?
Better, you can remoteExec the function straight away
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 withhasInterfaceandwaitUntil { not isNull player };๐
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.
Because you are trying to use player, the easiest way is
[[player, MyTarget, MyColor, MySize], BIS_fnc_dirIndicator] remoteExec ["call", 0];
don't use call in remoteExec ๐
Uh-oh
I have a feeling that player will be resolved on the executing machine like this too...
@willow hound bad practice you said? ๐ ๐
yes it will
Probably best to go with your first idea and put the code in a file that you then run with remoteExec.
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
yep
I would recomment using a function
with argumentssqf params ["_target", "_color", "_size"]; and the function would use player by itself
As long as you run radar.sqf on all clients it will work.
assuming its coming from a trigger does nul = [] execVM "radar.sqf" run it on all clients?
if the trigger is not server-side only and is triggered everywhere, yes

the server side only should be a checkbox
how do I know its triggered everywhere?
well, what are the conditions?
yep
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.
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
hence why ideally everything is checked server-side, then the server sends commands to clients
what kind of trigger would be useful in server side only?
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
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
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
Does MPKilled evh get deleted after it fired when the vehicle gets blown up, or is it necessary to remove it again
it is still there, but inactive (unless the vehicle respawns I think)
Alright, and what about if i delete the vehicle. Is it gone then?
yep
cool
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
same I would believe
but! sometimes, the vehicle can explode and the person still be alive (and get out)
yes true
an EH is "inactive" since no one can trigger it anymore (e.g killed, well can't kill it twice)
Alright makes sense, thanks for the answer
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
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
to free some RAM, that's the only point
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
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
But is that the same about vehicles; my point was about the vehicles
What is reliable distance in MP arma displays particle effects?
viewdistance?
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.
object view distance mayhaps?
OVD was also 12km, otherwise I wouldn't see the tank
yep, realised that.
particle quality to the max in video settings?
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
checkVisibility for the AI part, but for the player's POVโฆ no dice
POV won't help here.. I'm working with "fire and forget" missiles
then checkVisibility will tell you if there is some smoke (though I would maybe rather check that smoke grenades are around)
I assume checkVisibility will return true at the high distances due to missing particles
but need to check
I think the particles still exist, they are just not shown
hence why it should work
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
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.
Nope. All the stuff I was checking works fine at distances less than ~4km
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.
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 ?
everyContainer, no?
same result with everyContainer
(well, idk. never really worked with these tbh)
try this?sqf systemChat str _vehicle
and everyBackpack v_1 returnsโฆ?
[] as i don't have any backpacks in v_1
then your forEach should work
what you do before in it might be the issue
post your code on sqfbin so one can check
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
yes ?
i then cant track the object
Of course, it's in their inventory then, it's no longer an object.
yes
set a variable on the taker - or, just check "hasItem laptopClass"
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
Don't forget players disconnecting 
that too.. ๐
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 ๐
well, they are to take the laptop to base and yes, there's only 1 in the mission ๐
go for the simplest then ๐
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
and others cannot grab it from his body?
befor respawn, yes they can
oh ok
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
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
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?
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
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
Weaponholders are just a thing when the item is on the ground, not in some inventory.
Or so I think it is.
laptop attachTo [player, [0,0.5,1.25]]
```๐
oh... not rhought about that
wait, that was a joke
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.
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
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.
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
don't hesitate to take breaks and do something else too, helps ^^
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
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];
} ];```
That could work?
heli2 say3D ["music2", 50, 1];
}
50,
];```
no ๐คจ
I see
And this? I always mess up setting radius
heli2 say3D ["music1", 50, 1];
} ];```
it's not a guess game, I mean, there is a documentation about it
@lone galleon Check the biki. There is a radius parameter. Don't use the condition for that.
hmmmm, itemcargo _vehicle doesnt return laptops / files etc
it returns FAKS etc
but not the items I need
they might be magazines
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
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.
rather, ACE is not compatible with the function, no? ^^
iirc the function plays with two config values
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.
What's the issue?
One sec
"ACE_bloodIV_250" call BIS_fnc_itemType // ["Item","AccessoryBipod"]
Guess I have to look at the ACE code for their arsenal
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?
I'd expect BIS_fnc_itemType to return ["Item", "Unknown"]
my_fnc_itemType = {
params ["_class"];
if (_class isKindOf ["CBA_MiscItem", configFile >> "CfgWeapons"]) exitWith {
["Item", "Unknown"] // return
};
_this call BIS_fnc_itemType // return
};
code not tested so might not work
That's not a problem
idk how BIS fnc works but the ACE one is very robust.
@hollow thistle Works like a charm now with a bit of modification. Thanks again ๐
yw 
Is there a way to make a unit invincible?
yes, allowDamage
Hi, with what cmd can I save the state of a vehicle ? (ie broken wheel, glass, engine), and apply it later ?
@rain lichen see the wiki for the syntax
Ah ah ah okay
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
Uh.. yes
And linked lists too
very, very interesting
Uh.. yes
And linked lists too
@still forum
We do?! How come I've seen them?!
What does this error mean? Never seen it before:
"warning: macro AFAR: trailing ; should be in each caller. Never the macro body."
Where and when do you get it? @violet gull
sounds likeโฆ a mod maybe?
Someone sent me the error, apparently they were trying to compress my script with Mikero Tools or something
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
not a #arma3_scripting error then ๐

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?)
yeahh okay i did not think of that ๐ but linked lists though?
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
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
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 ๐ค
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
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.
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.
Anyone know how to control the loiter waypoint direction in script (clockwise or counter-clockwise)?
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.
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.
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.
I just realised how awesome sqf BIS_fnc_EXP_camp_guidedProjectile is
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?
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]]
@robust hollow you are lovely. Thank you so much!
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
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?
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
@violet gull thanks for advice, testing now
@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
it's assignation that creates a new instance?
_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?
_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)
I meant those as two separate scripts ^^
Ah then.....
yeah.. I guess
would still name it instance C, as its different from the instance A from the other script
OK, interesting - thanks for the insight!
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?
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.
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 ๐ค
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.
BIS_fnc_findSafePos should do the trick; if not, we can fix you something with surfaceIsWater and a lookup grid
I will play around with the things you guys suggested. Many thanks for helping.
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
how much do i have to pay? xd
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
what's wrong with remoteexec?
nothing, i just dont understand it yet lol
[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
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
yes, hence why we will be coaching him into it ๐
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
yes, hence why we will be coaching him into it ๐
teach me my lord
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 ๐
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];
you have free time at the moment.... lol
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
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
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?
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
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?
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
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?
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 ๐ฌ ๐
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
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
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)
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];
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"];
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.g
sqf ["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
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
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?
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 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?
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?
"%localappdata%\Arma 3\MPMissionsCache"
yes. is there a way of forcing a redownload from within the game?
run it through Eden I think?
you can start the mission with an MP server from the editor
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
IDK, I believe going back to Eden then re pressing (MP) preview will refresh that
at least I didn't encounter such issues
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
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.
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
wow, thats a pig of a remoteexec.. i can see why you didnt like it lol
congrats on making it work
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?
{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]}
aaa you're right! thanks a lot! gonna save me lots of time xD
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
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)
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
well, it always depends on performances
if you have 1 server + 2 clients on the same machineโฆ it might be an issue yeah
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 ๐
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
enable respawning
It is
what are your set respawn options?
Respawn: respawn at custom position
I ticked only Set Respawn-Position, enabeld manual respawn and put the respawn timer to 6 seconds
did you place a custom respawn position (marker)?
Yes, and they show up when activ, the module(atleast on the map)
mods?
No mods loaded
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?
that sounds like a good question for the ace slack server @fluid wolf
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?
@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
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
From the point of view of the sqf user its magic that just works
^^ perfect description on how SQF works
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
"try the veal!" ๐
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...
HideonUse doesn't stop you from reselecting it
it just hides the action menu afterwards as far as I can tell
your script is constantly readding the action?
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
you can remove the action with removeAction ๐คทโโ๏ธ
...yea let me try that
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
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...
everything in SQF is passed by reference. Period
however
barely any operators operate on reference values
only some of the array operators.
correct
to name most of them:
set, pushBack, pushBackUnique, deleteAt, resize
technically tho, all object operators are also reference modifying
@winter rose , what are they saying? i thought I understood this and now they've broken me
make them stop
im sad
Just SQF nerds nerding SQF
https://community.bistudio.com/wiki/Array (for further reference, when you feel better again ^^)
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
when stuff is passed by value, it means you can modify the passed value and it won't affect the original one
oh ok
like it happens with SQF numbers or strings
yes
'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
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
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
like it happens with SQF numbers or strings
no it doesn't. you cant modify numbers and strings in SQF
I do a [_a, _b, _c] call myFunc, inside it I do params ["_a", "_b", "_c"], of course I can modify _a, _b, _c
no you dont
you can run commands on it that return copies and then reference these copies in your variable
you cannot modify
which in the end makes it behave like pass-by-value
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#
which in the end makes it behave like pass-by-value
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
you are talking about implementation details again, I am talking about how it behaves for user
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
where did I say that?
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
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?
you talk about equality operator, and now show assignment operator.
What do you mean about equality operator
no. It also always works the same
ok assignment then
_d = _b; // we can modify _d and it won't affect _b
you cannot modify _d, there are no commands to do so
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]]
you cannot modify _d, there are no commands to do so
ok I understand what you mean then
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
I would need to make deep string copies if I decide to use that command
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
hi X39 ๐
hay
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
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.
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?
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
so the scopename names the loop it is within, rather than the loop directly after it?
yes and in example 1 on that page, it goes from line 2 to line 11
which in this case, is a loop
the loop could be anything, like another script
scope != loop
ok, let me have another go ๐
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
in that example, whats the name of the scope that is from the while true at line 2 to the closing curly at 11?
"loop1"
loop1 goes from
while {true} do { #starts here#
to
sleep 1;
#ends here#
};
we have a wiki page about scopes
im on it now ๐
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
I would say that SQL is more reliable than extdb3 or SQF in this case ๐
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)
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 ๐ค
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
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)
true!
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?
you need to set respawn mode in description.ext
respawn = "Base" ?
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
yes
you will probably want to use an extension like extdb to send the data to the db
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?
Ha! Thanks.
@still forum do you take bribes for commands or fixes? 

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...
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?
share the code you're using to add it to the diary
<img image='ctog.paa' />
the image is in the mission root?
player createDiaryRecord ["Diary",["Situation",
"<img image='ctog.paa' />SITUATION - NATO continues to be engaged in the Mediterranean combatting localized....
texview2
use imagetopaa
what is the resolution of the png?
359x359
All input textures must have resolution 2^x / 2^y (e.g. 16 / 16, 32 / 32, 64 / 64, 256 /256)
should i shrink it down to 256x256 then?
yea
texview2 doesnt error on bad images, but it doesnt convert them correctly either
hmm. could you dm me the png and ill see if i can make it work
_ca prefix?
needed to restart the game
Connor was very helpful! Thank you.
@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?
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
why so complicated
{
hint _x;
sleep 1;
} forEach _strings;
hmmm ok i think thats better, just thought that the array would be very long xD
but your code executes it thrice
yes because it needs to run 3 times
like this (downloading. , downloading.. , downloading...) and repeat 3 times
then wrapping with for as well is required (or some other looping structure of your choice)
this?
for "_i" from 0 to 2 do
{
{hint _x;
sleep 1;
} forEach ["Systems booting.", "Systems booting..", "Systems booting...."]}
}
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
๐ i am sorry and thank you for the help!
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?
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
remove them mods, they don't deserve you!
exactly, we deserve arma4 with all the bugs fixed and lots of amazing features so we dont need them mods ๐
Do leave a comment with the mod too so they at least know there is a problem even if they don't fix it.
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
depends how you make the activation
if you set it wrongly it might kill the player when other player gets into the area
yeah thats what I'm worrying about
used the default scroll down menu and selected players
then local trigger will activate if any player will get into the area
so its correct right?
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
oh so it would kill everyone
So by using any player as activation, then you dont need to remoteexec yes ?
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
I guess I need to work with in thislist
not sure how though
in the condition?
yes
are triggers with activation NONE checking the condition?
then it could also be done as:
player inArea thisTrigger
I guess so
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.
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;
?
I mean, say i want to give a hint to everyone once any player enters the trigger
Yeah, every local trigger will activate and execute code, should work for you.
In the onact i can just do hint โabcโ and it will trigger to everyone?
Sanchez your thing makes no sense at all.
knew it
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.
yeah I had doubts on that
thats {bool} setdamage 1
does not matter code will be not executed.
yep
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?
I explained what the code does.
this contains state of the trigger activation you've selected from dropdown
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
no
what will be in thisList if trigger is activated by nothing?
NOTHING ([])
thiscontains 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
should work I guess.
When you're doing None as activation I suggested to use player inArea thisTrigger as an alternative.
oh I understand
its a shame there is no way to test it properly unless I had a dedicated server
Why not?
Open local hosted
start second arma client
I'm doing it all the time
but the local hosted doesn't always behave the same as a dedicated does it?
It's mostly the same... it all comes to understanding the locality.
yeah I'm bad with local/global stuff
how do you create a 2nd client?
huh never though of that
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...

isn't it taxing on your pc?
I feel like it would be the killing blow for mine
I'm fine with just 16gb of ram
I see, I'll make some tests then
thanks a lot @hollow thistle
You can also run a dedicated server from ur pc
that too, and it's really easy. Just tick the "server" in launcher
with tasdt or stuff like that?
seems a bit extreme for testing
I beg your pardon what?
you guys opened a world of possibilites
my standard dev dedicated config:
loopback = true;
hostname = "Development";
localClient[] = {"127.0.0.1"};
admins[] = {"<yoursteamid>"};
persistent = 0;
BattlEye = 0;
allowedFilePatching = 2;
verifySignatures = 0;
wonder if that could fix my port forwarding problems
but thats more of an issue with my country
dont think server config could fix port forward
isn't there a kickDuplicate = 0 to set too?
IIRC not when you're using loopback
thanks ๐ it has been a huge while since I ever configured a server ^^
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
addWeaponCargo and such?
@mortal wagon see https://community.bistudio.com/wiki/Category:Command_Group:_Containers ๐
how does locality for spawn work?
I'm assuming spawn itself should be used inside a function/script that has been remoteexec'd
thank you lou
how does locality for
spawnwork?
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
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
Cba events work on publicvariable eventhandlers i believe
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.
Function = {} so defining that and calling that is better than something like remoteexec'ing bis_fnc_call i believe
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
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?
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.
Its passing string reference, and params
yeah I think it's just passing string, not whole code
using remoteExec on BIS_fnc_call is ... strange, when you could just use remoteExecCall
yes it's also important to know difference between remoteExec and remoteExecCall @tough abyss
seen it before, what's the difference? @astral dawn
remoteExec will spawn the function you tell it to remote-execute
remoteExecCall will call it
Yeps
I'd say in 95% of cases you want to remoteExecCall things
sleep/waitUntil/etc in it? -> RE
else: REC
@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?
yes, check examples of remoteexec
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?
you should make your function, and remoteExec it then
it will execute your function, remotely, in scheduled environment
thought that there was some better solution than that, thank you o7
no, that's the intended way
problem is, I have to use
sleepin 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
please don't. Just use functions with RE/REC
Just simply check out the examples and comments in there.
https://community.bistudio.com/wiki/remoteExec
https://community.bistudio.com/wiki/remoteExecCall
I guess there is almost any possible way as an example in there.
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 ?
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
@trail smelt โ
Yea i testing now.
๐ yea thank you nice works now..
is there a code monkey around?
trying to figure out an error and its driving me up a wall
๐ต
[
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
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];
the only 2 changes I see made are the empty [] and {}
yea
also, how did you get that to change colors in the box?
```sqf
```

