#arma3_scripting
1 messages Β· Page 16 of 1
I thought you said it's dedicated
ok. are you running the game?
I mean are you connected as a client with a debug console? (admin)
oh yes
ok. if you type 1 into the console and exec it do you get something back?
I get back 1
what does fileExists "scripts\ghst_halo.sqf" say?
but no hint?
no
what does loadFile "scripts\ghst_halo.sqf" give?
returns the entire script
yep, returns this exactly but I removed some comments
_host = _this select 0;
_caller = _this select 1; // 6
_id = _this select 2;
_params = _this select 3;
_typehalo = _params select 0;//true for all group, false for player only.
_althalo = _params select 1;//altitude of halo jump
_altchute = _params select 2;//altitude for autochute deployment
hint str _host;
if (not alive _host) exitwith {
hint ""Halo Not Available"";
_host removeaction _id;
};
systemChat ""Click on the map where you want to insert"";
openMap true;
mapclick = false;
onMapSingleClick ""clickpos = _pos; mapclick = true; onMapSingleClick """""""";true;"";
waituntil {mapclick or !(visiblemap)};
if (!visibleMap) exitwith {
systemChat ""Im too scared to jump"";
};
_pos = clickpos;
if (_typehalo) then {
_grp1 = group _caller;
{_x setpos [_pos select 0, _pos select 1, _althalo];} foreach units _grp1;
{_x spawn bis_fnc_halo} foreach units _grp1;
} else {
_caller setpos [_pos select 0, _pos select 1, _althalo];
_caller spawn bis_fnc_halo;
};
sleep 1;
[_caller] spawn bis_fnc_halo;
openMap false;
_bis_fnc_halo_action = _caller addaction [""<t color='#ff0000'>Open Chute</t>"",""A3\functions_f\misc\fn_HALO.sqf"",[],1,true,true,""Eject""];
sleep 5;
systemChat ""Have a nice trip"";// and dont forget to open your chute!"";
//auto open before impact
waituntil {(position _caller select 2) <= _altchute};
_caller removeaction _bis_fnc_halo_action;
if ((vehicle _caller) iskindof ""ParachuteBase"") exitwith {};
systemChat ""Deploying Chute"";
[_caller] spawn bis_fnc_halo;
hint ""Halo Not Available"";
this line is wrong...
oh nvm
I havent changed the last line yet
that's copy paste error
there's nothing wrong 
yep, I just ran it and it works 
(tho the halo part is broken)
it works for me locally
just not on the server
thats why I assumed some kind of locality error
How would I check? that would explain why these scripts arent running either now that I think about it
execVM "scripts\fn_advancedTowingInit.sqf";
// Enable Advanced Sling
execVM "scripts\fn_advancedSlingLoadingInit.sqf";
execVM "core\vehicle_init.sqf";
CfgRemoteExec
in the console?
no. in config viewer
try this:
this addAction ["<t color='#00ffff'>Solo Halo</t> ", {_this spawn compile preprocessFileLineNumbers "scripts\ghst_halo.sqf"}, [false,600,70], 5, true, true, "","alive _target"];
not there. missionConfigFile
but try this first
i'll give this a shot
but ill need a little more explanation here, I dont understand
there are 3 config roots: configFile, missionConfigFile, campaignConfigFile
you're in configFile right now
ah
Ok that works, map halo and all
then you've blocked execVM 
huh, is that a server config setting??
cant find that in the config viewer
what would I be looking for
this is my ext file
I dont see anything out of the ordinary
what are these?
#include "core\fnc\common\dlg.hpp"
#include "core\fnc\fob\dlg.hpp"
#include "core\fnc\log\dlg.hpp"
#include "core\fnc\debug\defines.hpp"
not sure, im running Hearts and Minds, ill check them real quick
the dlg.hpp files seem to define button ui's
and dialogue ig
the defines seems to affect gui, has this comment at the top
// Generated by: "Default" call BIS_fnc_exportGUIBaseClasses;
Well if there is nothing i can do about the execVM block, can I run my other scripts like so? or how could I go about that? maybe call instead of spawn
spawn compile preprocessFileLineNumbers "scripts\fn_advancedTowingInit.sqf";
// Enable Advanced Sling
spawn compile preprocessFileLineNumbers "scripts\fn_advancedSlingLoadingInit.sqf";
spawn compile preprocessFileLineNumbers "core\vehicle_init.sqf";
can I run my other scripts like so
you can but you have to track all of them down. including some subtle ones like the addAction
maybe call instead of spawn
depends on the context of execution
track all of them down?
for this use call tho because action codes are already scheduled
yes. maybe those scripts use execVM themselves
the first two basically add deploy ropes actions to all vehicles and a few more. The last one has event handlers to change certain vehicles magazines to SLAP rounds on server start and vehicle respawn
and all three are being called in the init_server.sqf
use execVM over spawn compile preprocessXX
what is init_server.sqf?
removed - use pastebin
a script called by the init.sqf like so
if (isServer) then {
[] call compileScript ["core\init_server.sqf"];
};
it calls a bunch of other scripts and functions in the same way, now that i'm looking at it perhaps I should call my scripts like that as well
β¦and why not save yourself the hassle of this and use instead initServer.sqf that is run by the game itself?
oh, that's part of something else (core).
yeah, im slightly modifying a mission file called Hearts and Minds
just adding a few things, unsuccessfully though
I just find it strange because normally in other missions I dont have a problem executing these scripts so i assume somehow the mission file is blocking execvm
(also spawn is binary)
the problem is that he has disabled execVM but has no idea where or how π
otherwise we wouldn't be here 
either be filters or Cfg commands something
filters?
BattlEye filters
I already checked CfgRemoteExec with him and looks like he doesn't have one 
maybe the paths are wrong then?
config paths?
i don't know, it can't be BE filters because you would get kicked for it wouldn't you?
and if it's not cfgRemoteExec either, then it has to be wrong script paths, or perhaps in config allowedPreprocessorExtensions or whatever(if you've changed them at all)
wrong script paths
nope
modified this once before a long time ago, added b64. Didnt remove anything
the allowedPreprocessorExtensions
We also dont use battleeye at the moment
it gives us a hard time
does execVM not work at all?
Nope
I have multiple scripts that simply wont work with this mission but have in other missions
and spawn compile does?
no that didnt work either actually
well
not with the other scripts
the addaction did
as Lou told you spawn is binary
it was your fault 
in Eden/singleplayer?
On the dedicated server
I have used them in liberation and other custom made scenarios
something tells me that
- your code is broken
- you don't code with the
-showScriptErrorsflag
I have gotten script errors in my rpt, typos and such
yep
fix that
I mean I got them before, fixed them already
anyway
I changed my other scripts to be executed like so instead of the preprocess bit, this works it seems
[] call compileScript ["scripts\fn_advancedTowingInit.sqf"];
// Enable Advanced Sling
[] call compileScript ["scripts\fn_advancedSlingLoadingInit.sqf"];
[] call compileScript ["core\vehicle_init.sqf"];
call is unary and binary
Im not sure what that means, could you explain?
unary commands take one argument (on the right side), binary takes two, left and right
call { hint "OK" };
"OK" call { hint (_this select 0) };
Ohh alright
Hey, I'm having troubles with creating a custom vehicle for an op. Basically, its a static weapon on the back of a civilian boat. This is in the init of the static weapon, R1_2 is the boat. When I play the scenario, the weapon gets destroyed and the boat flips over, or gets launched around 500m, as if it still is colliding with the gun. Have I set something up wrong?
[this, R1_2] call Bis_fnc_attachToRelative;
this remoteExecCall ["disableCollisionWith", 0, R1_2];
For remoteExec, all arguments for the command being remoteExec'd go in the left argument of remoteExec. You're passing R1_2 as the JIP parameter of remoteExec, which is...not what that's for. There's a pin in this channel that explains it better, along with the wiki page for remoteExec, but essentially what you want is this:
[this,R1_2] remoteExec ["disableCollisionWith",0,true];```
(`remoteExecCall` is unnecessary for commands, you would only want to use it for functions)
That being said, `disableCollisionWith` shouldn't be necessary, because `BIS_fnc_attachToRelative` should have already taken care of that. So there's something else funny going on.
How do this mod work ? I already try and didn't understand anything ...
The bits I've used so far are just better versions of the vanilla debug console & config viewer. They're pretty self-explanatory if you used the originals.
Ah, thank you π
if needed, the doc
https://community.bistudio.com/wiki/remoteExec
I had taken a look but it was a little confusing, I use remoteExec to call scripts a bit, but I'm still relatively new to it haha. Only figured out the other day something wasn't working in MP because I had the target set to 2, not 0
It's worth getting to know it, it's a very powerful command for enabling a lot of other commands to work properly.
But, still....you shouldn't need it at all in this case, BIS_fnc_attachToRelative normally works fine on scenario start. So my guess is that either something is delaying that attachTo until after scenario start, or R1_2 doesn't actually refer to the boat.
I think I just figured it out with this
So my guess is that either something is delaying that attachTo until after scenario start
Its on a show/hide module
Would that be causing the issue?
I don't know enough about show/hide modules to say for certain, but it's certainly worth trying it without the module to see if anything changes.
Well, looks like its working fine now. I don't see why it would be causing that though? I know it disables sim and drawing of the object, but I thought scripts in the init would still work. I'll just place them in the trigger that shows the unit π
Huh, its gone right back to it ._.
Looks like its actually the unit that's causing the issues then
It's cool that lockTurret does what I want (you know, locking turrets and such). But it'd be cool if it also prevented them from being accessed from within the vehicle. Unless i'm just missing something.
It should prevent access from inside the vehicle.
If this is for multiplayer, make sure it's being executed where the vehicle is local.
Also check that you've got the right turret path (you can easily find the right path by getting in the appropriate seat and running (vehicle player) unitTurret player in the debug console)
Hey. I am trying to have the freefall height of some units set to 3000 when they are spawned. I am running the function on the units init eventhandler and it is working in singleplayer, but not in multiplayer. any ideas?
class EventHandlers: DefaultEventhandlers
{
init = "(_this # 0) setUnitFreefallHeight 3000;";
};
Is the mod loaded on the machine where the units are local when they're spawned?
the mod is loaded on the server and the clients
In that case, the code appears to be correct and the locality appears to be correct. I'm out of ideas.
hmm. ill double check that the mod was updated correctly on the server. thanks for the help
server is updated with the mod. im at a loss
seems to have a maximum delay of 0.06 according to my tests
between the projectile hitpart and the buildingchanged
Oh no... there is something weird with the hashmap
so I destroyed '6' buildings, here is the resulting hashmap:
[
["425794", Tro_player_AT],
["426325", Tro_player_AT],
["427637", Tro_player_AT],
["", Tro_player_AT],
["413702", Tro_player_AT],
["413690", Tro_player_AT]
]
the fourth element... why is the objectID "" ??
@drifting portal Did it miss an element?
That would only happen in the case it misses an element.
Add a simple check with an if condition to make sure the returned value isn't equal to ""
If it is don't execute the further instructions.
params ["_buildingID", "_killer"];
if (_buildingID in alreadyDestroyed) exitWith {"don't count it twice"}
if !(_buildingID isEqualTo "") then {
alreadyDestroyed set [_buildingID, _killer];
[_kiiler, -100] call my_fnc_addRating;
}
I've actually had this happen to me too.
Generally a good idea to defensively test for the possibility something is empty.
how about === π€£
yeah probably, I added two verification lines just to make sure, client and server side
very odd stuff going on right now
I'm only calculating the losses in buildings using hitpart attached to a projectile that the player fired, BUT
addUserActionEventHandler ["TacticalPing", "Activate", {
_Crosshair = lineIntersectsSurfaces [AGLToASL (positionCameraToWorld [0,0,0]), AGLToASL (positionCameraToWorld [0,0,5000]), player];
_PosASL = _Crosshair#0#0;
_missile = "ammo_Missile_Cruise_01" createVehicle [0,0,10];
_missile setposasl _PosASL;
}];
this simple script I made for testing is causing the building loss count to increase??
very weird
looks like the missile is exploding?
triggering HitPart
yeah but we are talking about projectile hitpart
so it shouldn't do that?
I would check the _projectile in HitPart to see what it is
not easily it thinks it is == + =
That means it happens in the next frame
Probably because you're passing objNull
Check it in buildingChanged
Your timer is wrong then
well
the timer is the difference between time inside the buildingChanged and the time that was stored in hitpart
so it shouldn't have an effect because the cruise missile here is not being fired by the player?
I'm only spawning cruise missiles, I'm not firing in between spawning them
- N O -
can you show all scripts?
Alright,
initServer.sqf and initPlayerLocal.sqf : https://sqfbin.com/okaqitupotubiseperij
fn_BuildingDestroyedClientInit.sqf: https://sqfbin.com/mutehaninifabiqutegu
fn_BuildingDestroyedProjectileEH.sqf: https://sqfbin.com/uhefizazatoxoduwuxam
fn_BuildingDestroyedValidator.sqf: https://sqfbin.com/ecorosenitojuhiranos
fn_BuildingDestroyedValidator is unused?
oh nvm that's the server's thing
Tro_DestroyedBuildings_Counter_Enabled seems to be always false?
I set it to true prior to testing
its so that I can control when the system should work
your timer is wrong, as I said
you simply check the time
not which object was hit
can you write the script so I can understand the idea?
Tro_DestroyedBuildings_Player_ProjectileHitPartEH = _projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_component", "_radius" ,"_surfaceType"];
if (alive _hitEntity) then{
Tro_DestroyedBuildings_ProjectileHitTime = time;
Tro_DestroyedBuildings_HitEntity = _hitEntity;
};
}];
that's sound but why do I need to check if its alive?
addMissionEventHandler ["BuildingChanged", {
params ["_from", "_to", "_isRuin"];
if (_isRuin && {_from == Tro_DestroyedBuildings_HitEntity && {time - Tro_DestroyedBuildings_ProjectileHitTime < 0.5}}) then {
}
}]
to set the timer correctly
tho you should use an array imo
what would happen if I don't check if its alive
you can go back to _hitEntity isKindOf "Building" if you want 
alive means it's alive, and not null
isn't isNull more suited for this orr?
you put both in 1 check. why write 2?
oh alright
but anyway, as I was saying, you should probably keep an array of hit entities
and timers for all
e.g if you fire 2 rounds at 2 buildings from a distance and kill both, one of them will not be triggered
hmmm, I understand the idea but I'm not very sure about its execution (how to form the array, check it and remove it later on)
_projectile addEventHandler ["HitPart", {
params ["", "_hitEntity", "_projectileOwner"];
if (_hitEntity isKindOf "Building") then {
Tro_DestroyedBuildings_ProjectileHits = Tro_DestroyedBuildings_ProjectileHits select {time - _x#0 < 0.5};
Tro_DestroyedBuildings_ProjectileHits pushBack [time, _hitEntity];
};
}];
addMissionEventHandler ["BuildingChanged", {
params ["_from", "_to", "_isRuin"];
if (_isRuin && {Tro_DestroyedBuildings_ProjectileHits findIf {_from == _x#1 && {time - _x#0 < 0.5}} >= 0}) then {
}
}]
fourth line is confusing me, what if projectileHits is nil
you have to init it yourself
an empty array I presume
you can also try this tho 
_projectile addEventHandler ["HitPart", {
params ["", "_hitEntity", "_projectileOwner"];
if (_hitEntity isKindOf "Building" && alive _hitEntity) then {
_hitEntity addEventHandler ["Killed", {... if (player == _killer) then {...}}];
};
}];
should be simpler and work fine
sounds oof
yep
but also needs a timer...
or actually not
a player killed it anyway. that's a negative point 
i guess i'm missing stuff. What's the initial problem? Finding who destroyed the building when the actual destruction happens at least one frame after the actual hit?
finding if a player destroyed a building yeah
finding if a player destroyed a building
i'd say: 1 onhit EH that stores [instigator,timestamp] in the object namespace and 1 onkill EH that checks if there is a pair stored and timestamp is close enough to now?
i think onhit triggers multiple times with frag munitions
well, it has inaccuracy I think, 5 buildings destroyed yet it only counted 3
Tro_DestroyedBuildings_Player_ProjectileHitPartEH = _projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_component", "_radius" ,"_surfaceType"];
if (_hitEntity isKindOf "Building" && alive _hitEntity) then {
_hitEntity addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (player == _instigator) then {
[getObjectID _unit, player] remoteExecCall ["Tro_fnc_BuildingDestroyedValidator", 2];
};
}];
};
}];
I'll check the turret paths, but I would imagine that running it in the init of the vehicle pretty much makes it run globally. Even putting it there, it does lock the respective door gunners and such from the outside but since the door gunners can be swapped to from a passenger seat of the helicopter, it doesn't seem to fully lock them. Unless I'm misunderstanding where the helicopter is local to in a client hosted server.
so how do I init, because I think other methods are being inaccurate
yeah just wanted to make sure
Tro_DestroyedBuildings_Player_BuildingChangedEH = addMissionEventHandler ["BuildingChanged", {
params ["_from", "_to", "_isRuin"];
if (_isRuin && {Tro_DestroyedBuildings_ProjectileHits findIf {_from == _x#1 && {time - _x#0 < 0.5}} >= 0}) then {
_ObjectId = getObjectID _from;
if (_ObjectId == "") then {
_ObjectId = getObjectID _from;
};
[_ObjectId, player] remoteExecCall ["Tro_fnc_BuildingDestroyedValidator", 2];
};
}];
Tro_DestroyedBuildings_Player_ProjectileHitPartEH = _projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_component", "_radius" ,"_surfaceType"];
if (_hitEntity isKindOf "Building" && alive _hitEntity) then {
Tro_DestroyedBuildings_ProjectileHits = Tro_DestroyedBuildings_ProjectileHits select {time - _x#0 < 0.5};
Tro_DestroyedBuildings_ProjectileHits pushBack [time, _hitEntity];
};
}];
now its not working at all
hmm
_ObjectId = getObjectID _from;
if (_ObjectId == "") then {
_ObjectId = getObjectID _from;
};
that check is redundant
objectID is never ""
(plus you're recalculating it for _from again...)
did you init the array?
check in debug console
yep i think its not init too
Is anyone else getting a "File not found" error for the wiki?
https://community.bistudio.com/wiki/Main_Page
everybody, it seems
ouch
What is confusing is that all methods seem to indicate 3 buildings are destroyed, I think takistan building have a mind of their own
(I can see 5 buildings destroyed)
it's because of your kindOf "building" check
which is why I removed it
if (_isRuin && {Tro_DestroyedBuildings_ProjectileHits findIf {_from == _x#1 && {time - _x#0 < 0.5}} >= 0}) then {
[getObjectID _from, player] remoteExecCall ["Tro_fnc_BuildingDestroyedValidator", 2];
};
I don't think this is correct
is it?
it is
well unless the time is too short 
well should I add
Tro_DestroyedBuildings_ProjectileHits = [];
to the end of if statment
no
the array won't overflow?
you can remove the element tho if you want
no
because of this
How do you want me to check that
127
Tro_DestroyedBuildings_Player_ProjectileHitPartEH = _projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_component", "_radius" ,"_surfaceType"];
if (alive _hitEntity) then {
Tro_DestroyedBuildings_DebugCounter = Tro_DestroyedBuildings_DebugCounter + 1;
Tro_DestroyedBuildings_ProjectileHits = Tro_DestroyedBuildings_ProjectileHits select {time - _x#0 < 0.5};
Tro_DestroyedBuildings_ProjectileHits pushBack [time, _hitEntity];
};
}];
Tro_DestroyedBuildings_DebugCounter returns 127
how many times does buildingChanged trigger?
12
Tro_DestroyedBuildings_Player_BuildingChangedEH = addMissionEventHandler ["BuildingChanged", {
params ["_from", "_to", "_isRuin"];
Tro_DestroyedBuildings_DebugCounter = Tro_DestroyedBuildings_DebugCounter + 1;
if (_isRuin && {Tro_DestroyedBuildings_ProjectileHits findIf {_from == _x#1 && {time - _x#0 < 0.5}} >= 0}) then {
[getObjectID _from, player] remoteExecCall ["Tro_fnc_BuildingDestroyedValidator", 2];
};
}];
Takistan? As in CUP? I remember seeing some pretty shaky building models/classes there 
no just count _isRuin
so
if (_Isruin) then {
Tro_DestroyedBuildings_DebugCounter = Tro_DestroyedBuildings_DebugCounter + 1;
};
yes sir
yes
or Tro_DestroyedBuildings_DebugCounter = Tro_DestroyedBuildings_DebugCounter + parseNumber _isRuin; π
and you destroyed 7?
validator says 3
like, the first two buildings i've demolished caused the "BuildingChanged" to fire with "_isRuin" set to false
on CUP Taki right now
yeah imo it's probably better to check alive @drifting portal
well
I'm testing all of the previous numbers I gave with
Tro_DestroyedBuildings_Player_ProjectileHitPartEH = _projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_pos", "_velocity", "_normal", "_component", "_radius" ,"_surfaceType"];
if (alive _hitEntity) then {
Tro_DestroyedBuildings_ProjectileHits = Tro_DestroyedBuildings_ProjectileHits select {time - _x#0 < 0.5};
Tro_DestroyedBuildings_ProjectileHits pushBack [time, _hitEntity];
};
}];
quite the shocker honestly
and both say that alive is true 
thank you digger very cool
do you mean alive in building changed? in case I misunderstood
because I haven't done that
if (!alive _from && {Tro_DestroyedBuildings_ProjectileHits findIf {_from == _x#1 && {time -
what is confusing is that the first supposed worse system give 5 buildings destoyed, while the more supposedly better systems give 3, but with my own eyes I see 5 buildings, I'm not sure if its duplicating in the former case
what about isRuin?
okay, i stand corrected. 1 of those 2 actually had another level of destruction that fires "BuildingChanged" with "_isRuin" set to true.~~ But another one doesn't ~~
(alive _from && {Tro_DestroyedBuildings_ProjectileHits findIf {_from == _x#1 && {time - _x#0 < 0.5}} >= 0})
never goes true
wait i frogot the !
oof
and, for the extra clarity, the last test was done with cursorObject setDamage 1 
does it actually change to a ruin tho?
btw did you guys know that when you destroy a building it just sinks into the ground and the ruin is created on top? 
so the original building is still there
the one that says _isRuin == true does. It just had a very damaged intermediate state that wasn't yet a ruin 
okay i stay even more corrected. Repeated setDamage 1-ing of the second one managed to produce a proper ruin too 
When I was playing an op, a floating building did just that infront of us, lol
alright it says 6 buildings destroyed which seems right visually to me at least,
but the game statistics disagrees with me https://imgur.com/Vmo06TG
alright now its saying 7 despite me seeing only 6 destroyed so
is there a way
to get an object using objectid
so i can teleport my camera to every building and check?
nearestObject
well
I guess the reason I can't see the 7th object
is because it sank
without leaving ruins
ye some of the do that
like, the "BuildingChanged" explicitly states that "_to" is "objNull"
yeah but it gets assigned the object id again I think
well I guess the system that we came up with last is the best
this system gave me a headache a year ago in 2.02, we were never able to do it here in the scripting channel, thanks for the projectile eventhandlers lol
Many thanks to everyone who helped
Is there a command that returns the number of occupants of a vehicle?
Use fullcrew
Then count on the array it returns
Nice
just hack by adding a dummy element and seeing if count changes or not in both π€£
inb4 two checks in the racing threads happen at the same time
well obv dont use sched code for it
With regards to this, I did check my turret paths (0 is Co-Pilot, 1 & 2 are the left and right door gunners). As I understand it, a vehicle is local to the driver. I have an AI pilot in the helicopter so that leads me to think that I just run it on the server and it should be golden.
Does locality of a vehicle change when a player gets into the cargo of a vehicle and if so, how do I keep the doors locked when someone gets in?
This is what I have running in a script dedicated to operating the AI pilots and their helicopter.
(vehicle leader _heliGroup) lockTurret [0, true];
(vehicle leader _heliGroup) lockTurret [1, true];
(vehicle leader _heliGroup) lockTurret [2, true];
(vehicle leader _heliGroup) lockDriver true;```
a vehicle is local to the driver
if it has one. otherwise it's local to any player present in it afaik
Does locality of a vehicle change when a player gets into the cargo of a vehicle and if so, how do I keep the doors locked when someone gets in?
afaik yes. but the command has global effect so you don't need to do anything
So then why would people still be able to swap to gunner positions despite locking them with a command that has a global effect?
does lockturret even prevent switching seats?
test in single player
pretty sure it doesn't
To test that, Start in it and try to switch out I pressume?
why would people still be able to swap to gunner positions
however way you got that
Might be confusing to people coming from other languages, but sure, why not
I think that would give it the same meaning as it has in javascript right?
Oh wait, true, it does check if its the same reference for arrays in JS
So if SQF allows such name then why not
Just thought about another name for the command isEqualRef
to be in line with isEqualTo
Though 2 === 2 => true in JS, while it would be false in SQF
isEqualRef or isSameRef, KK now added isSameAs
I guess isEqualRef fits best into our current set
isSameAs sounds too much like isEqualsTo to me
referenceEquals π
I agree with this
Well, I don't have that answer, but I did get it working.
Turns out the question using thing lockTurret [0, true] or thing lockTurret [[0], true] has only one right answer.
With the second one, I can't swap into the turret from cargo.
yeah turret paths are always array
Do you guys think this (disabling collision of all vehicles with the dead body) could mitigate the "Touching dead bodies launches vehicles into space in MP bug"? ---> ```sqf
addMissionEventHandler ["EntityKilled", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
{[_x, _unit] remoteExecCall ["disableCollisionWith", 0, _x];} forEach vehicles;
}]; ``` Or would it be better to do it the other way around and disable the body's collision with the vehicles?
read the wiki. you can't do that (at least not for all dead bodies)
π "This command doesn't disable collision between PhysX objects"
I don't get why that wouldn't work then but if you say it won't it is enough for me... I have noticed that using the setUnconcious true command makes units fall though objects as if they lost their collision with everything... perhaps uncouncious units do not cause the bug I am trying to mitigate so instead of allowing units to die I just make them unconcious and after the player is away I turn the bodies into agents with a dead animation rather than units... that might work for the intended purposes?
I don't get why that wouldn't work
But each vehicle would be getting only one reference to the dead body where the vehicle is local: sqf {[_x, _unit] remoteExecCall ["disableCollisionWith", _x];} forEach vehicles;
ohhhh
yes, but it would only work for 1 dead unit
the cero... I need to change that to _X right
Since the command is run from a mission EH... on each death it would be disabling the collision of each vehicle with the dead unit that triggered the EH... but each dead unit would be different. The reference you mentioned from the wiki refers to not having the reference to the SAME object more than once
It actually means that it can't reference more than one object at a time. The wording's just a little off.
Indeed the wording is wrong... So you can only disable the collision of an object to only ONE other object at the same time and not with multiple ones?
Weird
You can sort of disable it with multiple objects if those other objects contain the reference. But then those other objects can't themselves reference multiple objects, so you can't, like, create a mesh out of it
We need a command that does what the hideObjectGlobal does but without hiding the object's model and texture... hideCollisionGlobal
Can we have an terrain edited EH in the future? 
Those both sound like good candidates for FT tickets (there might already be one requesting global collision disable, check first)
read the blue box
already made a ticket for that but I think it was denied (or at least ignored)
That would be so useful, to prevent physics bugs and even decreasing the negative performance impact of having many rocks with collision on a composition for example... hopefully it gets considered in the future π
is it possible to get some more info about setTerrainHeight and the jip queue?
the second example details only an array of arrays of the same size.
Can it be done by adding one more entry every time you use setTerrainHeight. meaning each time you call that command on server the same array + extra content is being applied
I think not. but only Dedmen would know
i was hoping he would see this, cannot ping tho
anyone know of a good script that will make units garrison buildings?
you mean automatically creates them in buildings?
or tells them to move into buildings?
automatically and makes em hold there positions
that's easy. I can write one for you
oh thanks π
/*
how to use:
[obj, classNames] execVM "garrison.sqf";
example:
[
this,
["B_soldier_F", "B_soldier_GL_F"]
] execVM "garrison.sqf";
*/
if (!isServer) exitWith {};
params [["_building", objNull, [objNull]], ["_classNames", [], [[]]]];
private _first = _classNames param [0, "B_soldier_F"];
private _side = [east, west, resistance, civilian] select getNumber (configFile >> "CfgVehicles" >> _first >> "side");
private _group = createGroup _side;
_classNames pushBackUnique _first;
{
private _unit = _group createUnit [selectRandom _classNames, _x, [], 0, "NONE"];
_unit setPosASL AGLToASL _x;
doStop _unit;
_unit setDir random 360;
} forEach (_building buildingPos -1)
I didn't test it so if it doesn't work let me know
put it in a file called garrison.sqf and put it in the mission folder
then put this in the init of the building you want to garrison:
[
this,
["B_soldier_F", "B_soldier_GL_F"]
] execVM "garrison.sqf";
you can add whatever classnames you want
the above example adds NATO rifleman and grenadiers randomly
no, the array positions need to be the same, if they are they get merged, it has a hash of the positions
meaning if I set the terrain with one position
then next time set it with 2 positions but the first (or second) is the same, even with the same height it will work and jip queue will only have the latest one?
shit, oh well. then there is no way of optimizing the jip queue for artillery splashes...
You could edit a bigger area, hoping that future hits land inside the area and you being able to keep it in one batch
not sure if editing heights to unchanged values is optimized in code, probably not
that would be a lot of positions tho
You can remove entries from the JIP queue, but I have a feeling that the overhead of deciding which entries to remove / replace / modify is going to make this impractical.
Q: re: "HandleDamage" event handler. difference between _source and _instigator? IIRC, sometimes you may want/need to do vehicle _instigator, i.e. when the trigger man is in a vehicle? But is that source or instigator? I'm not sure which... thanks...
_source is what made it (e.g a drone), _instigator is who ordered it (the drone-controlling player in that case)
no you/he can't
there is a chance to an eventhandler in the future? 
No reference to the jip queue else i would have looked into that as well somehow
I saw your message above and chose not to reply, why ask again
because a solid no is better than ghosting π
yea.. there is a ton of messages on this channel, there is no way to know that you saw it π
Ok. how about when it is just a unit pulling the trigger on a rifle? Or in a vehicle gunner position?
it's true; messages, responses, easy to get drowned out against the background noise.
source is what made the projectile and instigator is who pulled the trigger like Lou said
if it's a unit with a rifle both will be the unit
^
Okay, so in a vehicle gunner position, then source is the vehicle? makes sense...
Just wondering which is better when I want the unit itself. Sounds like instigator is what I want.
Thanks...
if in doubt, try π
#server_admins and no, it's server.cfg. If your server.cfg doesn't have that line just add it
Checking my thoughts; if a trigger is set to repeatable, it can run a new instance of its onAct for every condition event, correct?
if it deactivates in-between, it will fire onAct
(no idea what "new instance of onAct" means π¬ π)
I suppose thats a better way of putting it, would it run its onAct each time the condition occurs... hrm.
I have a server-created, global-flagged trigger detecting allPlayers for anyone that has a variable set on them (the Mike Force incapacitated variable), then passes the same search to a function. While it works, I havent tested yet for 'what if multiple players get shot at the same time'.
β¦no idea what it all means sorry
XP fair. I think I just need to add a variable flip so the trigger deactivates after calling the function, ready for the next player to get wounded.
β¦or not use triggers?
Oh? What do you have in mind?
scripting
first: what is your goal
(not "what do you want to write in script", what is your end goal, what is the feature for which you aim)
Fair enough, god knows Im usually the one asking that question :p right, so...
In SOGPFs Mike Force scenario, they have a variable on each player that flips when you are knocked out, doing their whole custom bleedout thing.
The trigger I have right now takes every player with that trigger set true (knocked out), and passes them to the function, which checks if they are in a vehicle, if any of their AI teammates are in the vehicle with them and not knocked out themselves, and finally selects the next one that qualifies, has them yell 'Im taking the wheel!', then knocks that AI out while restoring the player - a sloppy 'they take over' without mucking around with making them playable and forcing the player to swap around seats, but quite handy if you can think of your squadmates as ablative armor.
It functions fine, though the groupChat isnt being called on the players side so it needs a little touch up, but when my group tested it kept a few helicopters airborne after getting the cockpit ventilated.
The trouble is, the trigger activates when a player is shot, but I have about fiveish seconds of sleep before they get restored (for gameplay purposes), where the trigger would still - I suppose - be activated and unable to fire again if anyone else gets wounded.
that's⦠not exactly what I asked? :p
so:
you want to catch when a unit is knocked out, and send that info to a function somewhere and do other stuff :D
your issue is:
you can only catch one of them and don't know if the trigger is triggering on another (close in time) knockout
my question is:
does SOGPF not provide a scripted event handler for their "knockout" event?
Might do, but Im trying to develop this whole project as an addon that can work alone, not a fork of the scenario.
Though if I could find it, I could stack on it, yeah.
you are using their variable, sooo
when I say "scripted event handler", I mean this BIS_fnc_addScriptedEventHandler
Yeah, had to use that on their custom melee EH so my tools could move structures. Im digging through the files, but not sure where they put the incapacitated script. Or how it functions, exactly, just that if true, bleedout, if false, full health and get up.
they have a wiki, maybe they documented it
I suppose I could fit it into a onHit EH; its already spawned code, adding a one second delay to check if the variable has been set wouldnt hurt. At least, not hurt to script, cant say anything about performance.
... because they sure wont get hit more than once in a one second span of time π
PS: that would be one thread per unit per hit and it would be very bad, really
Yeahhh, thought it through a little further :p
GetIn EH - spawn {waitUntil (sleep 1 player variable) ...}?
GetInMan, w/e
With some choice exit clauses for getting out of a vehicle, so the spawned script doesnt get stacked.
check their functions, i highly doubt they don't have an event for it of some sort
Likely; I got a tip from their discord, but Ill have to wait a few days before I can get back on my computer with some free time to explore it further.
Is there a method to mix vehicle turret?
such as, if i want to put a slammer up turret on a madrid, is it possible other than using the attachto?
hey, thanks for the reply, but i dont want just the weapon, i want the turret with the hitpoint and etc
Not possible....
Got a question regarding the getPos wiki, specifically this bit:
the commonly misused code:
_obj1 setPos getPos _obj2is absolutely wrong
The only correct usage of this command is to determine the altitude of an object from the surface below it
May I ask why it's "absolutely wrong"?
And why it "only" has one "correct" use?
I know getPos isn't the best command to use for everything but the language in the wiki seems a bit strong.
https://community.bistudio.com/wiki/getPos
*edit: clarification and link
It's slower, and the position format it returns is not consistently the same as the format used by any setPos command, including setPos (see the setPos page). This can lead to objects being misplaced.
the position format it returns is not consistently the same as the format used by any setPos
I have never seen this been the case? I knowgetPosis slower than other commands but to say that something is absolutely wrong and only as 1 use seems like a stretch personally.
What else do you think you should use it for?
As in what other case could getPos be used?
Where getPosATL isn't superior, yes.
If you're talking in terms of superiority vs another command then there isn't a great use in which it is superior (exception being the one mentioned)
I'm not comparing it to other commands though, simply wondering why the language in the wiki is as strong as it is.
Because too many people default to setPos and either hurt themselves unnecessarily on perf or store up bugs.
Not many people bother reading the wiki either lol
If you know exactly the command's limitations and how to avoid them, or are simply very lucky, you can use it and it will work (but slower).
However, many people who read the wiki are beginners who don't have the background understanding needed, and relying on luck is bad practice. So, the heavy warning, so people don't try it, find it "works", and form a bad habit they will regret later (but not before teaching it to other people)
As described on the setPos page, the format it uses varies between the getPos format and a different one based on a frankly horrifying condition. Meanwhile, the getPos format does correspond to the formats used by the other setPos commands.....sometimes. The conditions in which it doesn't match can't be relied on to always be true or false in a live mission, and it's better to use one of the more predictable - and faster - matching getters.
Maybe I'm weird (well I know I am) but to me having the getPos wiki say - "The code _obj1 setPos getPos _obj2 is often misused to place objects at another objects position which can lead to placement issues in some edge cases (eg. over water). Using the other position commands [links to the "positions" command group] such as getPosASL is the correct way to handle these cases" - or similar such explanation would be a better approach than the current entry (although it would be longer) as it explains a typical case (placement over water) and why getPos would not work while also offering a solution and other commands.
Maybe my first message was unclear (re-reading it, it was unclear) but I'm not arguing for/against getPos but rather in clarity and expansion of the wiki to further explain the "why" behind it's statements. "is absolutely wrong" and "it is not the optimal way to approach this, here's an example and other commands" read differently.
The thing is that "it's not optimal" leads to "oh well I'll just leave it in for now, what harm can it do", while "DO NOT USE THIS" leads to people not using it. Well, mostly. It's better to put a hard stop to it before it bleeds in (and brings its worse performance with it).
But saying "DO NOT USE THIS" also causes people to not understand the "why" behind not using it, they just don't use it
It's similar to tossing code at people vs walking them through writing the code themselves and the reasons behind each bit.
Teaching the principles behind what code does is good and useful because you want them to use those principles later on their own. In this case, however, it doesn't really matter why, because we want them to not use it later on their own. Even when you understand why, you still shouldn't use it.
Incidentally, the information on why does exist and can be figured out once you understand the principles behind the commands you should use. It's just not described there, presumably to avoid confusing the issue.
I get where your coming from, maybe I'm overthinking it or coming at it from a different view than normal
Granted I also have a 100 line function with 40 lines of comments so maybe I'm just weird and like over-explaining things lol
saying "DO NOT USE THIS" also causes people to not understand the "why" behind not using it
the wiki says why...?
it doesn't match up with other position commands
and it's slower to boot
Do not use this command to get an object's position in 3D format:
the Z value from this command is relative to the surface underneath, and there is no compatible setter command to use it with;
the commonly misused code: _obj1 setPos getPos _obj2 is absolutely wrong
Not a very long-form explanation like in my example - like I said, maybe I'm just weird
getPos has been a recurring problem for a very long time and the wiki page has been through several iterations trying to get people to not use it. It's possible it could still be improved in some ways, but an unambiguous "do not use this" is necessary. Weaker warnings, or warnings long enough to encourage skipping, lead to people thinking they can safely ignore it and continuing the problem, which leads to worse-performing scripts, potential breakages, etc. I'd even argue that a warning that "forces" people to go look up getPosASL and getPosATL and understand the difference is more educational than letting them continue using the "easy" getPos.
i personally think it's fine, literally that one example (5) is it's only use case (which is mentioned in the note), in any other case, it's incorrect to use it
-wLeopard20 launch option, which throws a warning everytime a getPos is called π€£
does origin getPos [distance, heading] syntax also suffer
I want to make a mission where my players are not targeted by the ai if they are over a certain altitude. is there a way to achieve this in arma
I'll do it with trigger
and objectparent
is there a variable for altitude for trigger conditions
Will they be in a vehicle? Im imagining paradropping in, but want to be clear.
think something like reverse ravine mission like an ace combat canyon mission but inverse
they must stay over a certain altitude
they will be in a civilian cessna
so I'm not afraid of them abusing it to strike targets
I have the objectparent check
the altitude one is missing
Create a trigger, condition
( getposatl cessnaNameHere) select 2 < altitudeAboveTerrainLevelYouWantThemToMaintainHere
And onAct, a setFriend switch. Or setCaptive, but im not sure if that propagates from vehicle to passengers.
setcaptive
so cessnanamehere is the variable name
getposatl is to take the altitude
select 2?
Getposatl will return x,y,z. Select 2 narrows it to z.
wrong order
hi lou
hi game
Eh, im sure I got something not exactly right, but its hard to check on mobile :p
Bluh, i see where i goofed.
the parenthesis?
no, it is getPosATL theObject, not the other way around
oh ok just saw it
this returns true under a certain altitude
the "altitudeAboveTerrainLevelYouWantThemToMaintainHere" is in meters right?
Yeah, adjust < >s to taste, and its in meters.
thanks
Is there any way to hide a vehicles model but still have it function the same way. I've attached a frigate (optre) to a helicopter, and I want to be able to fly it without the helicopter being visible
Memory serves, I had some luck with https://community.bistudio.com/wiki/setObjectTextureGlobal and setting each part to "". Ymmv depending on vehicle used.
Hey, does anyone know why this only lets Speaker1 play the sound? Cheers π
Alarm = true;
while {Alarm == true} do {Speaker1 say3D ["Alarm", 8000, 1, false, 0]; sleep 25.2;};
while {Alarm == true} do {Speaker2 say3D ["Alarm", 8000, 1, false, 0]; sleep 25.2;};
while {Alarm == true} do {Speaker3 say3D ["Alarm", 8000, 1, false, 0]; sleep 25.2;};
Because the first while's only doing its job. Rest is suspended because the first is doing still
In other words you're stuck in the first while
To solve you need to include every say3Ds into one while
Ahhh right, that makes sense. I completely overlooked that haha. Thanks! π
Not exactly. That one just zeroes (or close) the Z value.
Alarm = true;
while {Alarm} do {
Speaker1 say3D ["Alarm", 8000, 1, false, 0];
Speaker2 say3D ["Alarm", 8000, 1, false, 0];
Speaker3 say3D ["Alarm", 8000, 1, false, 0];
sleep 25.2;
};
Thats what I've got now haha, originally though I'd written sleep after every line, which just caused the same problem lmao
Thanks anyway though π
how do I get the currently entered text in an RscEdit? I can't find any commands for it on the wiki...
I would guess the general ctrlText.
when in doubt, open the command groups π π
see https://community.bistudio.com/wiki/Category:Command_Group:_GUI_Control
I did, I was just looking for the wrong thing
I thought RscEdit would have its own command group π€·ββοΈ
RscEdit is just a flavour class for CT_EDIT.
Im trying to use Bis unit capture/play. Unit capture works fine and the movement is recorded, I paste the data into the wp1.sqf file but when I got to play I get this error;
'wp1 |/|-;
[heli1, wp1] spawn BIS_Fnc_Unitplay;'
Error GTAS (or 5) pre stack size violation.
what does it mean and how do i solve it? (p.s captured movement was about 50 seconds.
Unless loading a file is too slow for your use case I'd recommend keeping the data in a separate file and loading that instead of cluttering your script
I don't know what causes your error but I can walk you through another method in a minute here
Theres only one script in the file, which is the "[heli1, wp1] spawn BIS_fnc_Unitplay;" script
i'd appreciate taht
I paste the data into the wp1.sqf
and you just run
[heli1, wp1] spawn BIS_Fnc_Unitplay;
```the `wp1` variable is undefined
_wp1 = parseSimpleArray loadFile "wp1.txt";
[heli1, _wp1] spawn BIS_Fnc_Unitplay;
from here make a file called wp1.txt in your mission root. You can then paste your raw data in this file and hit save without worrying about formatting for the sqf file. The script will load the contents and store it as an array. If you need to optimize later you can always take the data and put it back into the sqf like before. This is slower but easier in my opinion
no, that one is fine
though personally i'd probably store the data to a global variable at init anyway
Still getting the same error
can you post the code block?
did you record the data again?
yes i rerecorded then pasted into wp1.text file and copy pasted the script u gave me
this is the one in the sqf file
wp1 = parseSimpleArray loadFile "wp1.txt";
[heli1, wp1] spawn BIS_Fnc_Unitplay;
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
wp1 = parseSimpleArray loadFile "wp1.txt";
[heli1, wp1] spawn BIS_Fnc_Unitplay;
what does the rpt say?
rpt?
%localappdata%\Arma 3 paste this in windows explorer and open the .rpt file
Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.
To get to your RPT files press Windows+R and enter %localappdata%/Arma 3
Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files
To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.
theres a shit ton of files none that say .rpt
Arma3_x64_2022-08-26_18-14-46.rpt no files named like this?
do you have logging disabled?
(you may not have file extensions displayed)
file extensions are displayed
No, im looking for the most recently modifed file its only showing me stuff from 4 hours ago
did you happen to follow an optimization guide at some point that had you disable logging
nope
ill restart arma and double check
17:20:29 Error in expression <wp1 =;
[heli1, wp1] spawn BIS_fnc_Unitplay;>
17:20:29 Error position: <=;
[heli1, wp1] spawn BIS_fnc_Unitplay;>
17:20:29 Error GIAS pre stack size violation
17:21:08 EPE manager release (25|81|0)
17:21:08 Number of actors in scene after release: 25
17:21:08 EPE manager release (0|25|0)
I believe this is the error related to the script
seems to happen when there is a mistake in unscheduled environment
can you retry with this please?
0 spawn {
private _wp1 = parseSimpleArray loadFile "wp1.txt";
[heli1, _wp1] spawn BIS_Fnc_Unitplay;
};
Exact same error
c/p it here please?
so please c/p the error here (really)
and after that, try```sqf
0 spawn {
private _wp1 = parseSimpleArray loadFile "wp1.txt";
};
7:28:10 Warning Message: '/' is not a value
17:28:17 [CBA] (optics) INFO: Scripted camera restarted.
17:28:21 Error in expression <wp1 =;
[heli1, wp1] spawn BIS_fnc_Unitplay;>
17:28:21 Error position: <=;
[heli1, wp1] spawn BIS_fnc_Unitplay;>
17:28:21 Error GIAS pre stack size violation
17:28:52 EPE manager release (20|140|0)
17:28:52 Number of actors in scene after release: 20
17:28:52 EPE manager release (0|20|0)
17:28:56 Link to 8e04a889 (Obj-149,112:137) not released
17:28:56 Link to 9d243ed7 (Obj-135,233:1751) not released
17:28:56 Link to 9d2436ea (Obj-134,233:1770) not released
17:28:56 Link to 9aa1f187 (Obj-62,213:391) not released
17:28:56 Link to 99c5c134 (Obj-184,206:308) not released
17:28:56 Link to 9905c345 (Obj-184,200:837) not released
17:28:56 Link to 94c5030c (Obj-160,166:780) not released
17:28:56 Link to 94a503d8 (Obj-160,165:984) not released
17:28:56 Link to 948240ee (Obj-72,164:238) not released
17:28:56 Link to 946224f5 (Obj-68,163:1269) not released
17:28:56 Link to 91a52a2e (Obj-165,141:558) not released
17:28:56 Link to 91851a31 (Obj-163,140:561) not released
17:28:58 No more slot to add connection at 023022 (2368.9,2201.0)
yep, you are not running the _wp1 code
lemme try again
eventually, do it on an empty mission to start from scratch
question about BIS_fnc_initVehicle, is there anything like it that takes global arguments?
I really don't wanna rewrite my whole EH just because that one function needs to be local
different error this time
17:37:55 Unknown attribute itemsCmd
17:37:55 Unknown attribute itemsCmd
17:37:59 Error in expression <0 spawn {
private _wp1 = parseSimpleArray loadFile "wp1.txt";
[he>
17:37:59 Error position: <parseSimpleArray loadFile "wp1.txt";
[he>
17:37:59 Error Generic error in expression
what
oh
is remoteExec a thing you heard before? π
but that means I have to learn
did you name your data file "wp1.txt"?
yes
please send it to me in DMs
Just realised I don't have to figure out on which client the vic is, nevermind π
theres a wp1.txt and sqf
remove that from the txt file......................................................
or suffer my wrath! have a nice day π¬ π
so the entire script was broken cause of a single `
the script was good, the data not
if a file is not in the expected format, yes, it breaks the whole chain
well, ima go crash a frigate into the ocean, thank you very much for your assistance
A single misplaced , or ; can break your whole server/mission π
initServer,sqf
It's even better when you copy code from somewhere (Bi forums for example) and there is a invisible symbol that breaks everything 
"Β " much? π
this is why I set an invalid character spotter in the SQF highlighter yeah :D
that or weird quote signs too
hint βerrorβ;
I am sad it has come to this but I realise I have to say it: don't code in Word, thank you
:3
notepad is baw
bae
I'm afraid I have to ban you after this
no hard feelings though
!burgerpan @austere pendant 0 speaking heresy
*nomnoming the cookie dough though*
but for real, I recommend Visual Studio Code with the SQF plugin π
I got a question, now that I know how to do this script with one unit, I want to have two units with two seperate movements. How do I get two vehicles to begin movin on the activation of 1 trigger
[heli1, parseSimpleArray loadFile "wp1.txt"] spawn BIS_fnc_UnitPlay;
[heli2, parseSimpleArray loadFile "wp2.txt"] spawn BIS_fnc_UnitPlay;
_num = selectRandom [1,2,3,4,5];
player addEventHandler ["Killed", {
systemChat str _num;
}];
```Would `_num` still be defined inside the EH?
no
how can I pass it, then?
global variable, setVariable on player to name a few.
Sorry for the easily findable question, but would this work for every player on a dedicated server when called with remoteExec? Or do I have to add something like foreach allplayers; My testing one is currently in use, otherwise I'd be able to test it myself π
"colorCorrections" ppEffectEnable true;
"colorCorrections" ppEffectAdjust [0.8, 1, 0.1, [0.0, 0.0, 0.0, 0.0], [3.0, 0.1, 0.1, 0.55], [0.2, 0.5, 0.2, 0.0]];
"colorCorrections" ppEffectCommit 0;```
I was looking at the wiki post processing effects, but I couldn't find if it said it was local or global
post process effects are local
you should never have to loop it
just remoteExec your function and you're good
Alright, awesome. Thanks π
keep in mind that changing video settings can reset post processing. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#PostReset I've written this into one of my scripts before but I'm not sure if it does anything
i.e. ```sqf
player addEventHandler ["PostReset", {"colorCorrections" ppEffectEnable true}];
i would actually like some closure on this
[spawn] {
bill sideChat "Ah good to meet you, im the commander of the UN troops stationed here on Altis";
sleep 2;
me sidechat "Thank you sir";
sleep 3;
bill sidechat "UN troops along with Greek troops are moving into a town to fully secure it.";
sleep 4;
bill sidechat "We need you to observe the operation and make a report on the civillains living conditions";
sleep 4;
bill sidechat "We arnt expecting trouble so this should be a easy one for you";
sleep 3;
me sidechat "Ha nothing is easy in this line of work";
sleep 4;
bill sidechat "that is true. Good luck" ;};
i swear this code hates me.. it never friggin works
ITYM [] spawn {
arhhhh im dumb thanks
heyo, so I have this addaction:
_crate addaction ["Arsenal", {[player, player, true] call ace_arsenal_fnc_openBox}];
and I also have an array of items I want added to it. Can anyone tell me how I would do this?
I know normally I could do
[_box, ["MyItem1", "MyItem2", "MyItemN"]] call ace_arsenal_fnc_initBox
but I want it as an addaction rather than an ace interaction
check their documentation
bit of a theory question. I have a repeatable trigger that starts a loop when players enter, and stops the loop when they leave. Would it be better to suspend the loop until the trigger conditions are met (waitUntil inside the loop) or to just kill the looped script and run it again when the trigger is activated again
I guess that question doesnt really have a definitive answer
what makes triggers evil? the performance cost?
waitUntil inside the loop
can't wait anything inside a loop.
wdym by this?
it would be waiting on a variable to change from outside the loop
if you spawn code then
yeah, it would be spawned
basically, either keep one thread alive and checking with a global variable,
or creating/deleting the thread on need/disposal
why create a loop inside a loop if both are waiting more or less for the same thing.
And triggers are not generally bad. It depends on the complexity of the condition.
any player present?
That's it?
you can create 500 of those and won't notice it
or out
they are
they have little horns and all
oh
and truckers usually have big horns
_trg setTriggerActivation ["ANY", "PRESENT", true];
_trg setTriggerStatements ["this", "systemChat 'on'", "systemChat 'off'"];
honk honk
"horn if you're honky"
I read that wrong the first try, what do I win
can I pass the trigger object into the onActivation code?
in the same way that _thisList exists?
a horny trucker
I did, and I seen the mention of virtual items like so but when I try to access it I get no vitrual items
[_box, ["item1", "item2", "itemN"]] call ace_arsenal_fnc_addVirtualItems
thislist, not _thislist
ah yes, I'm used to this from init fields and _this from.... some sqf stuff that I cant even remember
unless _this is just a local version of this
it's⦠complicated
wait a second, _this is pointless? Cant you just use params instead?
this is for init fields, _this is something else
check https://community.bistudio.com/wiki/Magic_Variables
usually yes, params is used to name the variables directly
https://community.bistudio.com/wiki/params
instead of variable = _this select #
yyyup, this is obsolete for a while now π
it also privates your variables properly (and forces you to use local _var)
sometimes I regret learning from reverse engineering, because I have come out with a lot of depreciated methods and skills
slowly bringing my knowledge up to date, but I learned a lot of old things
no worries, also not a lot dare to learn that way so kudos π
see https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
and https://community.bistudio.com/wiki/Code_Optimisation too,
they may help you
one thing the wiki doesnt mention, are the onActivation and onDeactivation fields of a trigger scheduled or unscheduled?
unscheduled, and it is mentioned
oh, I might just be blind
oh. I was looking at the trigger page 
If you have an ace question you might want to go to the ace discord
is there an ace discord? I know of an ace slack from a while back
yes, see #channel_invites_list
thank you
What explains this logic?:
I am sitting in a vehicle.
In debug watch window:
input : player
output: B Alpha 1-1:1 (JAMESON)
input : vehicle player
output: B Alpha 1-1:1 (JAMESON)
input : (vehicle player == player)
output: false
sorcery, of course
What explains this logic?
the "toString" returns the effective commander of a vehicle.
what you're seeing is the output string for player and vehicle player so there may be a uh yeah what he said
(if it has no vehicle var name)
thanks... This was actually an unexpected side mission to my real goal: How do I get the specific type of vehicle that I am sitting in. I thought "vehicle player" would do that, but the result is weird. Specifically I want to get a true/false answer to the question: Am I in the pilot seat of an AH-9 Pawnee?
typeOf vehicle player
https://community.bistudio.com/wiki/driver also see example 2 here
thanks for the direction π€©
Got my thing working! Thanks again. Here's the top of it:
_in_veh = typeof vehicle player in _veh_list;
_is_pilot = driver vehicle player isEqualTo player;
if (_in_veh && _is_pilot) then {```
there is also a βcurrentPilotβ command
it concerns pilot/copilot, not the driver seat itself then.
ah
I assume there is no way to localize custom radio channel labels with radioChannelCreate or radioChannelSetLabel commands?
tried prefixing with $?
Yes, doesn't work, strings starting with STR_ don't work either
radioChannelSetLabel is global even for clients
I guess I'm out of luck
what about https://community.bistudio.com/wiki/radioChannelSetCallSign and leaving label empty or something?
Global too
yeah but it supports localized text, which i assume would be localized locally
Oh, true, lemme check
Well, its something, the channel name in bottom left still can't be localised though.
you can hack the UI maybe
Yeah, could work too
idd is 63 for the channel, not sure about idc
Made a ticket: https://feedback.bistudio.com/T167359
fn_onChannelChanged = {
addMissionEventHandler ["EachFrame", {
if (_thisArgs # 0 != diag_frameNo) exitWith {};
removeMissionEventHandler ["EachFrame", _thisEventHandler];
if (currentChannel <= 5) exitWith {}; // skip default channels
private _translation = "blabla";
findDisplay 63 displayCtrl 101 ctrlSetText _translation;
}, [diag_frameNo + 2]]
};
addUserActionEventHandler ["PrevChannel", "Activate", {
call fn_onChannelChanged;
}];
addUserActionEventHandler ["NextChannel", "Activate", {
call fn_onChannelChanged;
}];
works fine, just have to do it a frame or two later, currentChannel is too early in the EH
Thanks!
I havea question: is there a command to place an object on top of another ? I you use attachTo to carry an object and use detach to drop it you most likely have to use setPosAGL to place it on the ground because the physic doesn't ork properly. For example, if i drop an object over a table, i want to be able to detect the table place this object on the table and not on the ground
setVehiclePosition
But how can i detect where the top of the table is to place the object directly on the table ? I would need to detect if there is the roadway of this table to place my object on it
give position above table it should place it on top.
if doesnβt work for some reason then you can always use lineIntersectsSurfaces to find top surface
[bomber, ["vn_bomb_500_blu1b_fb_ammo"], 6] call vn_ms_fnc_casAirstrike;
Anyone know if that code will work?
This what you're calling?
oh dang thats a SOG code, is there a none sog way?
Vanilla function, works beautifully - though you dont get a flyover unless you really script in your own. Ive done it before, its not difficult, but it is a lot of trial and error to line things up.
Feels good when a helicopter unleashes a CnC: Generals style Rocket Barrage, tho.
Fab 500 m62.. I'll be in the config viewer for awhile
Well yeah, thats also a SOGPF projectile :p the vanilla fnc should still work I think, but dont quote me on that.
Hey there, bit of a weird one.
I have an arsenal on which I'm using ace arsenal. I want to add an action that takes whatever is in the inventory of the arsenal and adds it to the ace arsenal.
Essentially populating the ["item1", "item2", "item3"] bit of this code with the inventory of the arsenal.
[_box, ["item1", "item2", "itemN"]] call ace_arsenal_fnc_addVirtualItems
Any help would be appreciated, thanks
This is what I'm currently trying but it doesn't seem to be working
[this, ["Add inventory Ace Arsenal",{[acearsenal, {ItemCargo acearsenal}] call ace_arsenal_fnc_addVirtualItems},nil,9,true,false,"","(side player == Civilian)"]] remoteExec ["addAction", -2];
[jet, "rhs_mag_fab500_m54_bd3_umk2a"] call BIS_fnc_fire;
i assume that that mag name is wrong?
Syntax: [entity, muzzle, turret] call BIS_fnc_fire the function doesn't take a mag name at all
Ep what's it take?
muzzle. "rhs_weap_fab500" for the RHS FAB-500's, it seems


this addAction ["Add inventory Ace Arsenal",{[acearsenal, ItemCargo acearsenal] call ace_arsenal_fnc_addVirtualItems},nil,9,true,false,"","(side player == Civilian)"];```
You don't need curly brackets on `{ItemCargo acearsenal}`, just `ItemCargo acearsenal` gets executed/calculated as is and its return value gets passed to `ace_arsenal_fnc_addVirtualItems`
And you don't need remoteExec at all. At least if you're using this code in the Init field in the editor, because the contents of Init are executed on every client anyways. And if you use remoteExec in the way you've written - every new client connecting would run it and add another copy of action to everybody on the server. And If you don't use the Init field - then i doubt `this` in the beginning would work.
I managed to work it out using sqf scripts that I call in the action instead but thanks for taking the time. Your explanation has taught me a fair bit π
is there a way to get a flat array of all items a unit is carrying, a bit like getUnitLoadout but not sorted into categories?
You can use getPos, as long as the object below has a roadway LOD
i don't think i've seen the command that works that way. But depending on use case just flatten getUnitLoadout may be enough (i.e. if you want to check if player has X). Or doing some filtering on that, say (flatten getUnitLoadout player) select {_x isEqualType "" &&{!(_x isEqualTo "")}}
I love how I even used the word flat in describing my problem but my stupid monkey brain didnt think flatten might have been a function... Thanks kindly aha
ye, 2,524 pages in category "Arma 3: Scripting Commands". On one hand you're not likely to remember them all. On the other hand the chance of any english word being a command is pretty high :3
It's also that while I have programming experience, I have very little game engine (if the editor can be considered such a thing) scripting experience, it's often that I know what I want to do and the kind of functions I'd need to be using, just not what they're called or how they all work exactly
anyone know why my image can be loaded in GUI but not as marker? when I try to make it a marker the color changes
i have color[] = {1,1,1,1}; in the marker config
can not be loaded as marker
the color changes
so which one is it?
if it can't be loaded then how does the color change?
i meant can be made as marker but not working 100% correctly
could have been more clear about that one π
nvm had line that changed the color π¬
addcamshake doesn't work with cameras created with camCreate ?
just shake it with setpos
Quick one, I'm using s1 action ["Surrender", s1];, is there a way of cancelling this after a certain amount of time? I've tried removeAllActions but I think that only works for scroll wheel actions. If someone knows how to make them exit the surrendered state, it would help a load! Thanks π
You could try:
action "None"
action ""
action "Surrender" again
action "CancelAction"
Thanks for the suggestions but it doesn't look like its working sadly :/
Looking at "CancelAction", I'm not too sure why it wouldn't work, it says that the unit will finish anim without performing the action. Is surrender an infinite animation or something? π
try
s1 playActionNow "STOP";
s1 setCaptive false;
if it doesn't work try:
s1 switchAction "STOP";
s1 setCaptive false;
Well the AI now tracks the player (imagine if path was disabled, same thing), but he's still in the surrendered animation 
try the second one then
Looks like it didn't do much else either, I'm half tempted to delete these units and create new ones on their exact previous positions π
then just do:
s1 switchMove "";
s1 playActionNow "STOP";
s1 setCaptive false;
You legend, works beautifully, thanks Leopard! π
if the animation jump is annoying, you should be able to find a "reversed surrender" animation in animation viewer or config viewer
use that with switchMove instead of ""
I think I prefer the jump, its supposed to take the player off guard, they won't be looking at the unit at the time anyway π
yes :(
maybe it will work if you use switchCamera but definitely not with cameraEffect
I'm attaching a unit to Logic created with createVehicleLocal and move Logic smoothly each frame, but attached unit doesn't update as smooth as Logic does. Question is, how can I trigger the engine to update attached unit's position each frame?
Is there a vehicle with higher frequency of updates than Logic?
I tried Sign_Sphere100cm_F and it updates even less frequently
Looking for an entity that updates attached objects each frame
Wonder which config parameters affect that apart from simulation
i will just change its bank and stuff
yeah it will but that kills off the rest of the cinematics such as dramatic fov change, lol
placed_chemlight_green is the best one so far, seems to be super smooth 
Probably a side-effect of a major network performance bug :P
it's not a bug. objects have different simulation and sync frequencies
Trying to figure which config values determine rate of updates
projectiles should be the smoothest maybe 
not sure if you can attach anything to them
iirc there's something like typicalSpeed or something that has speed in it
don't remember right now
simulation should also affect it
Noticed that building objects update more often
I need something invisible, simple and that updates attached objects each frame π€
no such thing in CfgVehicles
don't attach 
Welp, that's the only way there is for what I'm trying to do
Won't go into details, it just is
maxSpeed
Is it really about simulation frequency? π€
that's what I use in my "engine" for simulation frequency 
would anyone know why this is getting init.sqf not found? I have confirmed that the folder exists in the root directory as well as the init.sqf file
if (!hasInterface) then // load external config if is server, no interface
{
RELO_var_externalConfigFolder = "\reloadedsettings";
if (loadFile (RELO_var_externalConfigFolder + "\init.sqf") != "") then
{
[] execVM (RELO_var_externalConfigFolder + "\init.sqf");
diag_log "[INIT] -> External Configuration Initiated";
};
};
Anybody have any more info about glanceAt ? Like does it stack, how frequent do they look, would they move to take a look?
cant believe that was the issue, thanks.
does it stack
no
how frequent do they look
they look for a few seconds then look straight ahead
would they move to take a look
no
this forceWeaponFire ["rhs_weap_fab250", "this"];
any idea why this wont work?
thats the weapons name and "this" is the fire mode
So if I want to use it I have to make a script that loops the command. What is the difference then with lookAt ?
I don't remember
is that code just very wrong?
instead of this pass the weapon name again
also it will only work fire
and since you've put that in unit's init you probably won't see that happening
its going into a Move waypoint for the bomber
also use fileExists instead of loadFile
for vehicles it's better to use fire instead
roger, thank you its an old file lol
or fireAtTarget
wiki says:
unit fire [muzzle, mode, magazine]
also what I said about this is wrong
unit forceWeaponFire [muzzle, firemode]
firemode is usually "single"
you need to check in config
ughh nothing seems to be working
where do you put that again?
wohoo, I love the new setTerrainHeight command - finally I can get artillery and IED craters π
i want to do my own role selection, there is a way to see how vanilla works to modify it?
im asuming you can create a new display on it, and close the vanilla one 
there is a way to see how vanilla works to modify it?
afaik it's done by the engine, so no
you should probably just have the server slot everyone into generic civilian (or whatever faction) slots and do role assignment in the mission
you can provide your own secondary role selection screen tho
well yeah like I said where were you putting the old code?
move waypoint
then change it to vehicle this fire "rhs_weap_fab250"
no
why no?
cause i got it to work
what I wrote will work too
6 move WP's and they all worked
unless i only need a single move wp with your code?
i guess i can make a way that autoselect a role and send it, then inside the game make a new role selection with the unit already spawned.
But im thinking that the interface uses this command:
https://community.bistudio.com/wiki/selectPlayer
whats the diff?
it seems to be a really old command, so i guess just spawning and then create a new interface will be better
you can copy paste it for multiple bombers without any change

thanks a lot !
I would like to know: Is there an animation to have the character stand at ease (for example using "AmovPercMstpSnonWnonDnon_Ease" ) and stay at ease ?
Thanks leo
setVelocityTransformation
It must be attached
attachTo uses setVelocityTransformation under the hood tho
unless you do that for the collision
I got my own set work with this, way point activation
(driver B1) forceWeaponFire ["LIB_FAB250_Bomb_Mount", "FullAuto"] ;
(driver B2) forceWeaponFire ["LIB_FAB250_Bomb_Mount", "FullAuto"] ;
(driver B3) forceWeaponFire ["LIB_FAB250_Bomb_Mount", "FullAuto"] ;
(driver B4) forceWeaponFire ["LIB_FAB250_Bomb_Mount", "FullAuto"] ;
Planes named B1 B2 B3 B4
And sry, missed yours and Leo conversation so I think you get that work before I answered
Thanks for the time you took anyway π
any suggestions for making it so players on the civilian side are unable to pick up weapons?
Do you want them to be able to pick up anything else?
hmm.. I can't think what else they would need to
but yeah I guess non-weapon items should be fine
Easiest solution I can think of atm is hooking inventoryClosed.
isn't there an event handler for taking something?
I guess that doesn't work for picking weapons up directly...
Take EH probably works for that.
aaand there is a Take, yep π
yeah. but this says item. is this triggered when you pick up a gun?
I'm pretty sure guns are going to trigger that.
"item" is pretty fuzzy.
As usual with Arma you'll have to try it and see.
sure hope so
I'll give it a try. now then how would you suggest checking if something is a gun?
my initial guess was check if there's a cfgweapons entry
because if it's not a weapon it'll be in cfgitems or cfgmagazines right
That depends. Some things are """weapons""" but not weapons. Things such as uniforms, vests, and hats. And first aid kits.
there's no cfgItems
not sure but they could be in CfgMagazines
no. ammo is ammo
I'll tell you in a minute when the game loads
FAKs are indeed CfgWeapons
interesting
thats fine ill just use itemType
@winter rose do you know if the Take EH is persistent?
persistentβ¦
i.e. will it stay attached to the player on death
that I do not know, my guess is "no" but I might be wrong
test plz
Checking isKindOf against "RifleCore", "PistolCore", "LauncherCore", and "GrenadeCore" would probably allow you to be less specific than BIS_fnc_itemType requires
kk i thought maybe you knew off the top of your head
@hallow mortar would also want to do MineCore I think
nope sorry :( I wish, because some EHs do some things, some EHs do differently
good luck soldier!
this is what im going with, will test and see if it works: ```sqf
_newUnit addEventHandler ["Take", {
params ["_unit", "_container", "_item"];
if !(alive _unit) exitWith {};
if (
_item isKindOf "RifleCore" ||
_item isKindOf "PistolCore" ||
_item isKindOf "LauncherCore" ||
_item isKindOf "GrenadeCore" ||
_item isKindOf "MineCore"
) then {
_unit removeItem _item;
_container addItemCargoGlobal [_item, 1];
};
}];
the "not alive" check is redundant, a dead unit cannot take anything
oh good point so I guess if its persistent it doesn't matter
yeah this doesn't seem to work for me
Have a look at the description of isKindOf https://community.bistudio.com/wiki/isKindOf
trying to get the "Open door" action localization
i can get the Open hatch stuff, but not open door
open hatch is like localize "$STR_A3_HATCH_OPEN"
cant find the open door tho
closest i get is localize "$STR_A3___1_1___OPEN_DOOR"
but that outputs something like "%1.1 - Open door"
$STR_DN_OUT_O_DOOR
There is the ultra helpful Stringtable visualiser on the Workshop where you can search string keys and content
You tried searching through diag_localized?
There is also web version I usually use that
but isn't that, like⦠an IP breach?
allUnits and vehicles seems fairly expensive - does it make sense to cache via pFEH with a less then per frame frequency a desired subset of vehicles or allUnits/entities "CAManBase" ?
like these sets only change via createUnit/createVehicle/deleteVehicle/etc and players joining/leaving but statistically with a quite lower frequency and probability [leaving out animals, and other special types]
so if your code doesnt need 100% accuracy on entities until the next pFEH check interval this should be a decent optimization strategy, no?
allUnits and vehicles
They are not the same, allunits iterates through all groups and all units in a group and potentially is expensive, vehicles iterates through vehicles array and is whatever it takes to go from start to finish of the array (i.e fast)
hey, i have a modded WW2 landing craft. and i need to find a way to Open the ramp of it via a trigger. anyone know how id go about doing that?
There is a way to disable mouse movement on map? disableUserInput don't do that.
disableUserInput just disable clicks.
Maybe setMousePosition
Animated components on vehicles can often be controlled using animate, animateSource, or animateDoor. The exact command, and animation name, will depend on the specific object you're using. You should be able to find the animation names in its config.
It works ok, but if the player move the mouse the pointer enters in a move/not-move fight. Thanks.
I will keep this way.
yea
then add own file to mission
Sa-Matra replied here π
but itβs more fun to make your own
thanks m8 this is what im looking for
yea i am doing some localization stuff, poked thru diag_localized
accidentally posted to systemchat, big mistake π
How I got it, picked some random house, then did getTextRaw on open door action
systemchat str (diag_localized "global")
oh i didnt know getTextRaw could do that. glanced over and looked like it was config related
where are faction preview images located? ive copied and created a new one using the alive orbat tool and want to delete the old unit preview images
Still looking for an info why placed_chemlight_green updates objects attached to it much more often than Logic, what config values (apart from obvious simulation) determine it.
I guess vehicleClass
placed_chemlight_green uses mines

Used for Mission Editor basic category selection π€
yeah nvm their simulation was different too
and the chemlight has animated = 0
apart from those I don't see anything else that could affect it
another thing is mapSize
tho I doubt that affects the simulation speed
but all mines have simulation = "house" and animated = 0
so if you attach it to a normal house and that one is slow then animated is affecting simulation
Tried Land_Pillow_F, updates attached objects very often (every frame?) too
that one is PhysX
ThingX vs Thing is my guess yeah
Is there any reason that deleteVehicle won't work to delete objects like a barricade I've placed with createVehicle?
Feel like it's something simple, but nothing in the notes
Wrote a script to compare every config property of tested objects, only simulation is the notable difference. So I guess it all comes down to it.
There isn't any reason that's innate to deleteVehicle or createVehicle. I would speculate that your reference to the vehicle isn't being retained or sent properly (doesn't one of the createVehicle syntaxes not return a reference to the created vehicle?)
nope, no reason but a wrong variable
don't ninja mi!
If it helps, I was wrong - neither of the createVehicle syntaxes have that problem, I must be thinking of something else
*it was createUnit
Yeah, I think it might be something funky with the reference not being passed, just wanted to check before I went down the rabbit hole
seeing your create & delete code may help π
How would I get a helicopter to eject its passenger when it passes a move waypont. With it not landing or slowing down
kick them out using moveOut π¬
Oh
cant get it working
How did you try use moveOut to units?
{ moveOut _x } forEach crew _ship;
None of them did not get out?
ive no idea what im doing 
nope none
i put it in a Move waypoint init.
tried a trigger
gave the squad a move waypoint tryed in that
tried that too