#arma3_scripting
1 messages ยท Page 99 of 1
Those are local variables so you'll need to tunnel a few levels down from there.
ye ... ty ...
not like thats what i already know
the question is how to get the most recently added backpack
you are not rly helpfull
anyway
_this addBackpackCargoGlobal [_backpackType, 1];
_backPack = (everyBackpack _this) select (count _backPacks);```
either that works or he can do it himself ...
ye ...
anyway
have to play fallout
so that thats not working is no option
say it to arma
when you start it next time @fallen locust
Any solutions how to fix flag not changing texture even tho right command?
what?
IIRC that's a known init timing issue.
Not sure on the best solution but you could probably just spawn & delay.
So just hit play then go back to editor?
Does the command work if you run it from the debug console with cursorObject or whatever?
Never tried but I will do it
that thats not working is no option
I'm not sure that those flags are changeable.
also:
- where is the texture located
- does the flag pole have a "texture" field where you could set the value
yeah I took too much notice of "even tho right command"
There's a whole lot wrong with this :P
pretty sure that texture needs a lot more path.
An example flag texture path that we use:
"rhsafrf\addons\rhs_main\data\flag_rus_co.paa"
and to make it work with some trickery it requires more code then just a few lines
pah!
no time
fallout waits
and it whispers to me "dude! come back! there are still raiders to kill"
_teams = _logic getVariable "cti_teams"; this indicates that the variable in question is stored somewhere else and the server needs to go get it, right?
...which also means:
_logic = (_side) call CTI_CO_FNC_GetSideLogic;
_teams = _logic getVariable "cti_teams";
if(!(isNull _team)) then {
if !(_team in _teams) then {
[_team, _side] call CTI_SE_FNC_InitializeGroup;
//--- The leader may had a disabled slot
if (CTI_Log_Level >= CTI_Log_Information) then {["INFORMATION", "FILE: Server\Functions\Server_OnPlayerConnected.sqf", format["Player [%1] [%2] does not belong to any CTI Groups on [%3]. Performed late-initialization and updated the Global Teams", _name, _uid, _side]] call CTI_CO_FNC_Log};
//--- Update the global teams
_logic setVariable ["cti_teams", _teams - [objNull] + [_team], true];
};
};```
the above code is what the server cries about in the log when it fails the init; from my understanding, it hinges on the first "call" to get the tools needed to figure out wtf a "_teams" is.
according to https://community.bistudio.com/wiki/Scheduler a call is a scheduled script, so if the server is under heavy load, it can panic and not go through completely. not usually a problem, except in the case of server init when players are actively trying to join and start the mission; thus causing "_teams" to be misconstrued as an unassigned variable
does my assessment seem like i'm on the right track to y'all?
because i feel pretty confident in it but i'm also very, very new to this
spawn is scheduled, call is not
if "cti_teams" doesnt have a value at the time you are trying to get the variable then _teams will be nil
you need a default value with the alt syntax (though i am under the impression you need the variable to be defined in the first place)
...gotcha, thank you
ofc if script spawns within it then all code in the spawn is scheduled
but thats generally construed as bad practice from what i have seen and spawn fnc should be used instead
i feel it's worth mentioning that this code will be 10 years old in a month
it is probably worth rewriting at that point
the mission is approaching 28Mb in size and i've never scripted anything before so i am very afraid.
im very appreciative of the help, though
when you say spawn fnc are you referring to https://community.bistudio.com/wiki/BIS_fnc_spawnOrdered ?
....gotcha
Hey everyone. I would like to share with you sqf-analyzer, a VS code extension to develop missions or addons in sqf. You can find it on VS code extensions tab or at https://marketplace.visualstudio.com/items?itemName=SQF-analyzer.sqf-analyzer
It supports
- type identification and annotation
- go to definition (both local variables, cross-file global variables and functions defined in config/description)
- function arguments identification and annotation
- all kinds of error identification (function calls with incorrect types, both builtin and defined in config.cpp/description.ext, wrong number of arguments, etc.)
- complete preprocessor support (e.g. it can parse the config.cpp of ACE, CBA and antistasi)
- semantic tokens (e.g. keywords vs functions vs variables vs comments)
- windows, mac and linux
It still does not support:
- external addons (e.g. if your mission depends on addon A, it cannot identify errors in using functions from addon A)
- CBA-based functions during initialization (i.e. it can't tell that such function is defined in the namespace and thus analyze code accordingly)
- much more ^^
I am looking for feedback to make it more robust to the different mission and addon variations, as well as bugs, improvements, etc (here or github issues)
Hope it reduces the mental workload in creating the amazing content that this community creates
(image of it being used with Antistasi, bonus if you can identify why the analyzer is complaining)
please also post it in #production_releases with a small description (e.g 3 lines) text
X39 I decided to give you a little competition. Whipped this up last night: https://github.com/NouberNou/carma2
a lot of stuff not comitted yet, and it's not functional (in game) yet.
how do you make a titleText appears to everyone in a script ?
does it work if I do?
["", "BLACK FADED", 999] remoteExec ["cutText"];
you need the second set of straight braces, [ ], around the first argument, see the third part of Example 1 on remoteExec, so
[["", "BLACK FADED", 999]] remoteExec ["cutText"];```
would work
Hi, i have a question ? Is it possible to toggle the detail mode on a control map ? Because when you are in the map, you have a button to toggle the detail mode or the satellite mode but in an RscMap in a gui, you only have the satellite map not the detail one.
This is not entirely the correct place for this question, but still the best I would say.
We have an event against a community that uses A3Sync, so us, workshop users, need to add their mods that aren't on workshop manually to Arma 3 launcher.
I've written a simple program that downloads the mods, generates the Arma 3 launcher preset HTML, but I need to import the local mods to the launcher, otherwise they won't be recognised.
Is there a way to point to the folder of the mod in the HTML, or can I run the launcher with some cmd params to import the mods? Or do I have to trust that my players aren't full stupid? 
(I would love to tell them all to just use A3Sync and what to do, but
I would assist at least 40 people with broken workshop folders, even if I tell them DON'T)
you can run the whole game with command line params, instead of using the launcher
Yeah, but different people have different parameters, like memallocs etc
or if the launcher is strictly needed - you can generate the entire -mod=... string and say people to paste it into Command Line parameter of the launcher ๐
well just tell them to add the local folder to Watch folders 
Yeah, all of those are options. But people... Are people 
Currently trying to attach an object to the player at their holster position, cannot make it work as for some reason returned offset is incredibly small
Currently using the following to do so, don't understand why it doesn't work:
https://sqfbin.com/momafivuvaliquvohike
(yes i am trying to make a dummy item in the holster)
because you have to attach it to leg bone I guess
the holster must follow some leg bone, I guess right leg?
so the proxy offset has to be relative to that leg too
tried putting _pistol in the bone btw and no dice there either
because it doesn't exist
it's a proxy tho? 
oh as in
doesnt exist in world
which is why im doing this convoluted workaround
doesn't exist in model
I mean player model
ah
it's in vest model
well your whole code seems wrong tho 
suppose I need to... somehow find the distance between the holster and leg bone?
oh private _pistol = selectionNames player select {"holster" in _x};
nvm didn't see that
was adapted from attaching to gl script i wrote ages ago
then it exists
but it shouldn't exist in the vest model
no the holster thing. I thought you were using the proxy from what I said a couple of days ago
im still confused
me too ๐
is it clear what im trying to do
it is, but idk why you're using a selection from player model in vest model
does it even exist?
im not, im using selection from vest model
because you cannot get selectionposition of holster from player
but does it work in the vest model?
you're using it in the vest model
well what is the selection name anyway?
Now using this: https://sqfbin.com/hefeluyasifakuyibehi
Gives
"proxy:\a3\characters_f\proxies\pistol_holstered.001"
then I don't understand the point of the dummy shenanigans
im not using dummy any more
i was using it as a "workaround" when i didnt need to for holstered proxy
well still you can't just attach it like that to the leg
like I said you should get the rel pos and orientation
{
detach _x;
deleteVehicle _x;
} forEach attachedObjects player;
private _pistol = selectionNames player select {"holster" in _x};
_pistol = _pistol#0;
private _proxyOffset = player selectionPosition [_pistol, 1];
private _proxyVectorDirAndUp = player selectionVectorDirAndUp [_pistol, 1];
_proxyOffset = _proxyOffset vectorDiff (player selectionPosition "rightupleg");
private _sphere = createSimpleObject ["Sign_Arrow_Blue_F", [0, 0, 0]];
_sphere attachTo [player, _proxyOffset, "rightupleg", true];
_sphere setVectorDirAndUp _proxyVectorDirAndUp;
_sphere setObjectScale 0.5;```
results in
vectordirandup looks incorrect tho
did you translate them to world?
its attached tho 
well you must fix the orientation too
everything must be relative
i do that with selectionvectordirandup tho
my absolute favourite (i hate matrices)
_bvx = _bvy vectorCrossProduct _bvz;
_svx = _svy vectorCrossProduct _svz;
_mat = [_bvx, _bvy, _bvz];
_relMat = matrixTranspose(_mat matrixMultiply matrixTranspose[_svx, _svy, _svz]);
_relPos = flatten (_mat matrixMultiply (_proxyOffset apply {[_x]}));
_relVUP = [_relMat#1, _relMat#2];
something like that I guess
bvn are bone's
svn are pistol selection vectors
vy being vdir and vz being vup?
yes
thank you i love you no homo
Returns that, think that looks about right?
Given if I was to orientate a gwh to that it'd have the pistol about right
Thanks leopard ๐
I guess 
try attaching a dummy pistol there
oop
did you also use the relPos I gave?
what if you do _relPos = flatten (matrixtranspose _mat matrixMultiply (_proxyOffset apply {[_x]}));

what is the code rn?
this one was wrong btw
{
detach _x;
deleteVehicle _x;
} forEach attachedObjects player;
private _pistol = selectionNames player select {"holster" in _x};
_pistol = _pistol#0;
private _proxyOffset = player selectionPosition [_pistol, 1];
private _proxyVectorDirAndUp = player selectionVectorDirAndUp [_pistol, 1];
private _boneVectorDirAndUp = player selectionVectorDirAndUp ["rightupleg","HitPoints"];
_proxyVectorDirAndUp params ["_svy", "_svz"];
_boneVectorDirAndUp params ["_bvy", "_bvz"];
_bvx = _bvy vectorCrossProduct _bvz;
_svx = _svy vectorCrossProduct _svz;
_mat = [_bvx, _bvy, _bvz];
_relMat = matrixTranspose(_mat matrixMultiply matrixTranspose[_svx, _svy, _svz]);
_relPos = flatten (matrixtranspose _mat matrixMultiply (_proxyOffset apply {[_x]}));
_relVUP = [_relMat#1, _relMat#2];
private _sphere = createSimpleObject ["\A3\weapons_F\Pistols\P07\p07_F.p3d",[0,0,0]];
_sphere attachTo [player, _relPos, "rightupleg", true];
_sphere setVectorDirAndUp _relVUP;
_sphere setObjectScale 1;```
your proxy offset is missing the vector diff...
private _proxyVectorDirAndUp = player selectionVectorDirAndUp [_pistol, 1];
_proxyOffset = _proxyOffset vectorDiff (player selectionPosition "rightupleg");
from what you had earlier
whoops, deleted in editing but not when i executed this
that part was should still be there
yeah im just tidying up and accidentally deleted it
And then you get the vest with different proxy placement (and weighted by multiple bones)
this is mostly just so i can have pistols in my two secondaries appear in the holster
yeah you shouldn't really use attachTo
i intend on having cba setting for boneinfo
is there anything i should be using instead?
each frame local loop ๐
wouldnt even be the worst thing ive done with eachframes
as you know
though i suppose for all players within 10 meters or so wouldn't be too bad -- anything further is beyond the point of being able to see it probs
๐ง include your own holster model, attach model to leg/whatever, show pistol in it
the word model scares me
suppose i can just modeltoworld the selectionposition and vectormodeltoworld the vectordirandup? 
though im blindcreateSimpleObject is GE so may not be the greatest 
it has local arg
yeah well it's worth a try at least
that way you know you have the right selection
heres the fun part some vests have multiple pistol selections
but thats just forEach instead of _pistol = _pistol#0;
Rip your sanity
i lost my sanity long long ago
about here.
still have a weird offset tho
{
detach _x;
deleteVehicle _x;
} forEach attachedObjects player;
MYFUNNYOBJECT = createSimpleObject ["\A3\weapons_F\Pistols\P07\p07_F.p3d",[0,0,0],true];
onEachFrame {
private _pistol = selectionNames player select {"holster" in _x};
_pistol = _pistol#0;
private _boneInfo = ["rightupleg","HitPoints"];
_boneInfo params ["_bone","_lod"];
private _proxyOffset = player selectionPosition [_pistol, 1];
private _proxyVectorDirAndUp = player selectionVectorDirAndUp [_pistol, 1];
private _world_proxyOffset = player modelToWorldWorld _proxyOffset;
private _world_proxyVectorDirAndUp = _proxyVectorDirAndUp apply {player vectorModelToWorld _x};
MYFUNNYOBJECT setPosASL _world_proxyOffset;
MYFUNNYOBJECT setVectorDirAndUp _world_proxyVectorDirAndUp;
systemChat str [_world_proxyOffset, _world_proxyVectorDirAndUp];
};```
as a sidenote i need to create a groundweaponholder regardless for this for attachments etc
then you have the wrong lod or proxy 
or maybe there's another transformation that's missing
possible that its just the model offset or something due to the muzzle stuff also being there?
just to check, theres no way to get the bones a proxy is connected to via script is there
no
thought so, suppose it'll probably be functionality requiring a lot of headache
uh
think pistol proxy position on the player is constant
changing vest doesnt change where its appearing
then maybe you should use the vest
ya trying that now
like I originally proposed 
did you? 
here
I just saw your post about warlords aircraft spawning.
I made a wiki page on github with a bunch of examples of how aircraft are spawned in various warlords missions which are hosted on github. The wiki also includes info on how to setup airfields in warlords.
Here is the link:
https://github.com/korbelz/WarlordsReduxMe.altis/wiki/Aircraft-spawning-examples
ah, couldnt remember that far back
omg rendering pistols in holster, my past is haunting me
anyone know of any breathing soundfile names?
I hope you're not setObjectScaling humans there
did it ever work? 
i am ๐
I hate you now 
uff yes.
I did something for CUP team a long time ago to.. I don't remember what
various instances of me setting my scale to 0.1 and running around altis
this is for two secondaries, i hope
just cannot get my head around this at all lmao
Ah I think I did rendering of magazine inside pistol in holster
that sounds incredibly difficult for sqf
isnt it part of the engine now? 
its that recent of a change? i missed that lol
Google for "Arma AIO Config" its very useful for things like that.
Just open it and search for breathing
thanks daddy
i can get the offset for the vest, just cant figure out how to apply that to the player now
get it relative to right leg
but how when im creating a dummy model with no player bones in it 
well also translate it to model first
find where the vest attaches 
I guess you don't need to
i.e. vest coords is the same as model
oh hang on a moment i dont think the gun is moving when you change stance
idk if thats a me error or if its a limitation
which code?
proxyoffset = _vest selectionPosition [_pistol,1];
proxyvdirup = _vest selectionVectorDirAndUp [_pistol, 1];
deleteVehicle _vest;
that's wrong
oh nvm that's in vest
ya
well like I said you MUST GET IT IN LEG COORDS
i dont know how to do that given the vest has no leg
T pose model 
But it does if the holster depends on it
does it really ๐ค
I'm pretty sure the vest just uses the T pose
selectionnames on the vest returns this
no easy way to figure out which the pistol holster is using though
Which lod are those selections from? Memory?
just all selections
selectionNames _vest
_vest selectionNames "Memory" returns []
so does anything with that syntax
changing string to 1 just returns this
given it doesnt change position or orientation (does by like .05) when changing stance think ill have to call it a dead end though
is there a way to get the object of container added by addBackpackCargoGlobal?
(i need to add multiple bags to a box with different items inside them)
_tPose = createSimpleObject [getText(configFile >> "CfgVehicles" >> "b_soldier_f" >> "model"), [0,0,0], true];
private _pistol = selectionNames _tPose select {"holster" in _x};
pistol = _pistol#0;
private _proxyOffset = _tPose selectionPosition [pistol, 1];
private _proxyVectorDirAndUp = _tPose selectionVectorDirAndUp [pistol, 1];
private _boneVectorDirAndUp = _tPose selectionVectorDirAndUp ["rightupleg", "memory"];
_proxyOffset = _proxyOffset vectorDiff (_tPose selectionPosition ["rightupleg", "memory"]);
_proxyVectorDirAndUp params ["_svy", "_svz"];
_boneVectorDirAndUp params ["_bvy", "_bvz"];
_bvx = _bvy vectorCrossProduct _bvz;
_svx = _svy vectorCrossProduct _svz;
_mat = [_bvx, _bvy, _bvz];
relMat = (_mat matrixMultiply matrixTranspose[_svx, _svy, _svz]);
relPos = _mat matrixMultiply (_proxyOffset apply {[_x]});
deleteVehicle _tPose;
MYFUNNYOBJECT = createSimpleObject ["\A3\weapons_F\Pistols\P07\p07_F.p3d",[0,0,0],true];
onEachFrame {
private _bonePos = player selectionPosition ["rightupleg", "memory"];
private _boneVectorDirAndUp = player selectionVectorDirAndUp ["rightupleg", "memory"];
_boneVectorDirAndUp params ["_bvy", "_bvz"];
_bvx = _bvy vectorCrossProduct _bvz;
_mat = matrixTranspose [_bvx, _bvy, _bvz];
_matt = matrixTranspose (_mat matrixMultiply relMat);
_pos = _bonePos vectorAdd flatten(_mat matrixMultiply relPos);
MYFUNNYOBJECT setPosWorld (player modelToWorldVisualWorld _pos);
MYFUNNYOBJECT setVectorDirAndUp ([_matt#1, _matt#2] apply {player vectorModelToWorldVisual _x});
}
something like that
could have errors tho because I copied and pasted from different places...
will try now, tyvm
also you shouldn't use hitpoints LOD for the rightupleg sel
I changed it to memory but dunno if it exists
check in the game
running without issues but isnt positioned properly on kipchak vest
checking on regular rifleman vest now
_backpacks = everyBackpack _container;
_container addBackpackCargoGlobal ...;
_backpack = everyBackpack _container - _backpacks param [0, objNull];
I guess
that looks painful
hitpoints also doesn't work i think
Oh God, I mean I wanted to try that, but isn't that going to slow the operation a lot?
it does but I don't think you have a choice 
(tho I'm not familiar with all inventory commands)
but I don't think it's that slow
I looked around, i never seen a command that returns an object for some reason
unless the everyBackpack command is slow
what to do about other containers tho too? (vests and uniforms)
everyContainer to get
I didn't even add the vest code in there ๐คฃ
rightupleg does exist in memory lod btw
what about this?
https://sqfbin.com/vaneyuhutusesuveyiqo
right tpose coords are reversed
can you create a vest model and player model?
just want to make sure
as in just _vest and _tpose?
are they at the same pos?
then the vest coords aren't the same as model coords as I guessed 
I think this is probably more hassle than it is worth lmao
Given 90% of the time you don't even look at your holster
I guess not 
at least not now... I better go to sleep... ๐
energy better spent trying to fix the latency on my capital ships given thats the only project i have worked on since february until last week 
well one last try:
https://sqfbin.com/zibewufiredoweyuropo
i shall try in a minute arma is loading
just got an mpu5 model so thats yet another project on my list
actually that one is also wrong let me fix it
I shouldn't have reversed all coords...
relMat = relMat apply {[-(_x#0), -(_x#1), _x#2]};
relPos = relPos apply {[-(_x#0), -(_x#1), _x#2]};
well no I think this is the correct one
actually no not that either 
he has developed an instance of p09 penis again
get some sleep i doubt this is something that can be fixed at liked 1am your time lol
true ๐
oh that was an accurate guess? i am a god
hey, i'm having some trouble understanding how to get spawn scripts to run in order
the wiki says to use https://community.bistudio.com/wiki/BIS_fnc_spawnOrdered; would i call that command immediately after spawn?
e.g. onPlayerConnected {[_uid, _name, _id] spawn CTI_SE_FNC_OnPlayerConnected}; ->
onPlayerConnected {[_uid, _name, _id] call BIS_fnc_spawnOrdered; spawn CTI_SE_FNC_OnPlayerConnected};
No, you use that instead of spawn. The wiki page describes the syntax.
thank you i am very stupid
What is the best way to add an event handler to player object? I create an addon, thus I can no longer use initPlayerServer.sqf. I need them to be added when player spawns, respawns, takes control of, etc. OnUserSelectedPlayer event doesn't work properly in SP I think. And I don't want to use some infinite while-true-sleep cycle for it.
Use a postInit function that adds EHs to catch the other events
onPlayerConnected {[_uid, _name, _id] call BIS_fnc_spawnOrdered CTI_SE_FNC_OnPlayerConnected};
where am i missing a semicolon here?
That's not the right syntax for BIS_fnc_spawnOrdered
the original script is onPlayerConnected {[_uid, _name, _id] spawn CTI_SE_FNC_OnPlayerConnected};; i'm trying to replace spawn with BIS_fnc_spawnOrdered. instead of just replacing spawn would it be onPlayerConnected {[_uid, _name, _id] for "CTI_SE_FNC_OnPlayerConnected" call BIS_fnc_spawnOrdered};?
No, it would be the syntax described on the wiki page
If you still have trouble in a minute I'll write more but reading it will be a start
sorry. code in general is not a strong suit for me; i don't need you to write anything, i'll figure it out. thank you!
onPlayerConnected {
[[_uid, _name, _id],"CTI_SE_fnc_onPlayerConnected"] call BIS_fnc_spawnOrdered;
};```
however:
- you should use an event handler instead of the non-stackable `onPlayerConnected` (<https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#PlayerConnected>)
- I'm not sure that `BIS_fnc_spawnOrdered` is exactly what you want, I think "trying to get spawned scripts to run in order" is a red herring and it's either a symptom of a different issue or simply not necessary
i appreciate the help
So I am using a ZEN Module to paradrop an object. The module is placed on an object, then asking for the zeus to click on a spot in the world to paradrop the object over, then opening a menu with a height and smoke options.
I can create the ZEN Module and ZEN Dialog. The part I dont know how to do is the clicking a spot in the world. What functions or eventhandlers exist for this?
I want the same thing as the second click functionaly that the attachTo module has:
i'm trying to fix an issue in the ancient warfare BeCTI mission, wherein player init sometimes "fails" mysteriously and can be fixed on a local LAN ~60% by aborting and re-trying to start the mission; but the hacky abort and restart fix doesn't work on a distant dedicated server
my best guess to this is the scheduler is failing to load certain variables required for player init while the server is under heavy load; thus, trying to get onPlayerConnected to run in spawnorder is the best fix i can think of
this code is approaching 10 years of age, though, and i'm rapidly approaching the conclusion that it might just not be worth it
If it's spawning a function that needs some variables to be initialized then you could just use a while or waitUntil in that spawned function.
problem is, i'm not even certain if that's the case, because the only error code i get only appears ~60% of the time when the init fails, and can occasionally appear even when the init succeeds, which makes me think it might not even be the issue
ergo, very appreciative for all help, learning a ton, love y'all, but all my herrings might be red today, lol
Probably a combination of getMousePosition and screenToWorld
I dont think this works triggerAmmo, set it inside fired EH and nothing happens to the rocket
Is it possible to have the singleplayer death screen in multiplayer + team switch enabled?
Ok so this is a bit jank but It works for me when I have init issues. If it works in your case I have no idea since I don't know the rest of the dependent code. But if you just need variables set...
[] spawn {
Sleep 15;
//code here }
Or a wait until instead of sleep
thank you!!
@grizzled cliff Wow, carma has risen from the dead. Interested to see where these two porjects will be going :)
I've got a little whishlist and I'm hoping there's a few Santa Clauses in here that can help me. I'm looking for:
- A system that handles a civilian population slowly (ideally controlled by events like civ deaths) turning aggressive on players/a certain faction
- A way to quickly and efficiently 'barricade' vanilla A3 buildings. If you've got X-cam /mcc/sqf exports/presets of e.g. barricaded/fortified buildings that would be a great start.
- A script/function that makes an (unarmed?) AI search dead bodies and crates in the vicinity until he finds a weapon + ammo. (Like a less-broken and more awesome version of "resupply")
Is it possible to use BIS_fnc_attachToRelative like this:
[object1, the vehicle within 3m of object1, true] call BIS_fnc_attachToRelative.
This is for the composition I am working on and there could be more than one of the compositions, thats why im asking
nearestObject or something
ah nice thank you
Could this would show the video for everyone?
[["decompteCB2_1.ogv"] call BIS_fnc_playVideo] call remoteExec;
... I mean, maybe it's just not a way I've seen before, but wouldn't it be
["decompteCB2_1.ogv"] remoteExec ["BIS_fnc_playVideo",0]
why the 0 at the end?
ooh yeah ty
"dynamicBlur" ppEffectEnable true;
// ^ would become this? v //
["dynamicBlur", true] remoteExec ["ppEffectEnable",0];
Looks about right, yeah
Hello is there a way to make AI holster their weapon with actions? I want them to keep their weapons off sight and in case my players mess up they then will pull them out. I had done it in the past but can't remember it. I saw the command hideweapon on wiki
Do you mean weapons on back, or completely gone until pulled out?
Weapon on back
They are like civilians with carry. The weapon exists in their holsters
Found something like this
player action ["WeaponOnBack", player]
Maybe replace player with "this"
"SwitchWeapon" worked for me, but I'm not sure the exact mechanic.
What did switch weapon do? Did it make them holster the gun till something went wrong (eg someone firing?)
Hrn, yeah, on review it worked for my unit, but not an ai. Curious.
I see
is there a way to make AI lower landing gear for a plane. I used unit capture and unitplay but the AI doesn't lower the gear. It moves the flaps but not the gear
There is an action binded to that
_pilot action ["LandGear", _plane];
Note the following:
Lowers the landing gear of an aircraft. In the case of AI-controlled aircraft, it has to be used in an each-frame loop to to override the AI behavior (otherwise they'll raise the landing gear when they take off).
So how do I loop it properly
EachFrame eventhandler
I put a trigger near the avenue of landing. With
There is an action binded to that
Pilot1D action ["LandGear", Pilot1];
I put it conditiom true with activation present for blufor
you are still missing the loop
so something like this
im not sure if using onEachFrame command itself it a good practice, its often recommended to use the eventhandler version for the mission
but if they do the same, it should be ok
Is there some way you can add ammunition to a magazine in your inventory, i.e. not in your weapon?
yes, you can modify the unit loadout
however, its a bit more complicated that it sounds to do it like that, you might as well want to find a workaround to that
Would that work if I wanted to add only a certain amount of ammunition? For the sake of making the discussion easier, the project I am working on is refilling ammunition across magazine classnames that use the same ammo.
There are no commands to add bullets to a magazine or even to remove a specific magazine. What you generally do is remove all magazines of a type and add back what you want.
Understood, thank you.
Example magazine removal script here:
#arma3_scripting message
Need help with relative coordinates of object B to object A. I placed 2 objects in the editor, object A and object B. Is there a way to view/calculate the relative position in Eden Editor of object B to object A? Both are far apart.
I'm not sure what sort of solution you're looking for. They have 3d coordinates which you can find easily enough.
The GetRelPos seems to return position based on distance and degree selected. I do have 2 objects already set on the map, and need to check Object B relative position to object A, not the fixed map coordinates of both objects. Let's say, how many X and Y is object B from object A.
check second syntax....
The second syntax states: obj1 getRelPos obj2 , what names do I substitute the obj1 and obj2, the class names of the object?
do eventhandlers work in MP
// no params
}];```
the variable names of the object that is the base/center and the target
assume that the position returned is AGL btw
Will try
they are local to the machine that adds them
so for multiplayer scenarios not a good idea
never said that, it just means that if you want it happening in all machines, all machines have to add it. If this is for the landing gear, if the AI is created/managed on the server then the only place that needs the eventHandler
Sounds like just (getPosATL _objB) vectorDiff (getPosATL _objA)
getRelPos is for if you care about the facing of the objects.
Thanks will test it
second syntax delivers a "relativePosition" as XYZ, it doesnt consider orientation
i thought we were in 2.14
otherwise i wouldnt had mentioned it
welp, its dev
dammit
If it's for attached objects then I'd be amazed if it didn't consider orientation anyway.
I'm bit confused, do I run these commands in Extended Debug Console? I tried both and nothing returns .
its for a version that has not been released, at lest the getRelPos second syntax
the method John gave should work
well, you'd have to define _objA and _objB
And where you run it from depends what you're trying to do with the output.
I named both objects Variable Name: objA and objB,. Than run local Exec command: _relpos = objB getRelPos objA; nothing happens, no return of anykind
are you returning the _relPos var itself?
or just defining and assigning its value?
Not sure how to answer to this question. I was hoping to return actual relative coordinates
Just put this straight into the console then:
(getPosATL objB) vectorDiff (getPosATL objA)
If you do _relpos = (getPosATL objB) vectorDiff (getPosATL objA) then that will set the local var but not return it.
Will try it
You can do this instead:
_relpos = (getPosATL objB) vectorDiff (getPosATL objA);
_relpos;
^
Thank you for all the hints, obviously I'm doing something wrong as I still don't get any return to the command in Debug Console.
did this work for you? i tried triggerAmmo and doesnt work
@unborn rivet I don't think the objects exist until you start the mission.
Should I start the mission, than exit and check or there is a way to run Debug Console while mission is running?
Just press escape.
Willtry
Good call, indeed I got the return now. Thankyou very much!
Is there a way to know if a EH is deleted by itself when a vehicle gets deleted script side? Or do I have to check that in my delete vehicle function?
If an EH attached to an object isn't deleted with the object then that's a memory leak and it's BI's fault. There's no way for us to know.
but in general it should be deleted with the object, right?
It should be.
thats what i wanted to know. thank you!
Is there any commands that list the nearest players from nearest to futhest
Or commands that fetch the closest player?
No, you'd need a composite.
Whats that?
you would need to write code
Nearest player example:
private _players = allPlayers - entities "HeadlessClient_F";
private _nearest = objNull;
private _minDist = 1e10;
{
private _dist = _targPos distance _x;
if (_dist < _minDist) then {
_nearest = _x;
_minDist = _dist;
};
} forEach _players;
This would work as well, where _targ is the position or object you want to compare to
private _players = allPlayers - entities "HeadlessClient_F";
_players = _players apply {[_x distance _targ, _x]};
_players sort true;
private _closest = _players#0#1;```
maybe use distanceSqr instead of distance, but timing may not matter (especially since it's already sorting)
SQF is so slow that distance and distanceSqr are basically identical perf :P
It does show up depending on player count but at that point you're trying to optimize small impacts (I think it's like twice as long if I remember performance stuff I've done in the past)
but yeah twice approximitely zero is still zero
Not the point. It's more that every command is so slow that the extra sqrt at low level is undetectable.
right, I agree, what I was saying was using distance vs distancesqr (if I remember correctly from testing before) doubles line runtime, but it's still in the microseconds
Your memory is wrong. It's more like 1/100 difference.
probably was wrong, it's been years
As an example, units group player apply {_x distance player}; for an 8-unit group takes about 0.009 ms on my hardware. distanceSqr is the same. units group player apply {_x}; is 0.0063 ms.
Now your version of the closest-player code should be faster than mine except sort is a disappointingly slow command :P
Yeah, as I noted before, doesn't really matter much
They're both pretty grim. There should be nearestInArray commands to go with inAreaArray.
For some practical applications you're better off doing multiple inAreaArray checks with different radii rather than going straight for the nearest-position checks, which is silly.
maybe even a sort option for inAreaArray
Any easy way to get the simulation type of a vehicle? CarX, TankX, that kind of thing
I'm thinking taking it from the config, but maybe there's a command for it that I don't know about
getText(configOf _obj >> "Simulation")
Yeaah I figured that'd probably be the answer, thanks

helped me a lot, thanks again
Is there a possibility that side player doesn't return the right faction that the players is in, if that player is killed during while the script is being ran?
Code:
// BMP-2 [HF1]
case "BMP2_INS": {
_current_heavy_level = ((side player) Call WFBE_CO_FNC_GetSideUpgrades) select WFBE_UP_HEAVY;
if (_current_heavy_level < 2) then {
_this removeWeapon "AT5LauncherSingle";
};
};
The BMP spawned on top of me, which runs this script to remove it's weapon. Never had this problem during like 10 years...
Dead units become civilians. Use side group player instead - the group's side doesn't change.
i was looking for a command that invokes the construction interface but then realized it's just a module
Thanks!
this has implications like, i can use that to create a colony sim or RTS in arma lol
i wonder how it does the RTS style camera controller and building
@grizzled cliff well ... always nice to have competition but ... thought carma was not capable of removing the large overhead?
((so ... then i will release 0.6.2 this WE :P))
@rich bramble first thing is ... large request, second is more or less easy to solve but requires you to set up a ton of barricade prefabs, third thing ... well ... kinda simple
Are objectIDs local or global ? I mean forexample on a multiplayer session, on my computer i have object 1780614: tracer_red.p3d, does it means that an other object on another computer of the session can have id 1780614 ?
depends
That sounds like a bullet? Most of those are local objects.
Global objects have global IDs.
It is a bullet an yes it is local, but i just wanted to know if these objectIDs were unique on all computers connected to the server
what, like whether any other machine could use 1780614 as an ID for that local object or another one?
exactly
carma2 is using a totally different under laying system for objects
kk
will be interesting to see how you solved that without type safety
neverwind, i found the answer. An objectID is local but netId is global. A same objectid can correspond to different objects depending on the machine you're looking on, which means 1780614 can be a bullet on my computer but a grenade on an other computer
netId is playerID:ObjectID ye
Ello, sorry for interjecting may if my code is okay because this doesnt work :/
{
[vehicle _x, convoyMinSpeed] remoteExec ["forceSpeed", vehicle _x]
} forEach units convoyGroup;```
Doesn't work how?
limitSpeed
ah okay
forceSpeed is supposed to work for this
I realised
still it doesnt...
welp
maybe it has to do withโฆ l o c a l i t y
Are you sure convoyGroup and convoyMinSpeed actually contain what they're supposed to?
yes
curatorName = player;
convoyGroup = Convoy_1;
convoySpeed = 50; convoySeparation = 50;
convoyMinSpeed = 3;
pushThrough = true;
vComAiEnabled = false;
lambsDangerEnabled = false;```
note that 3 = 3m/s = 10.8 km/h
try in eden only
if vehicle _guy doesn't work, try driver vehicle _guy (even though you should get a list of them instead of calling that on every group member)

private _vehicles = units convoyGroup select { not isNull objectParent _x } apply { vehicle _x };
_vehicles = _vehicles arrayIntersect _vehicles;
private _drivers = _vehicles apply { driver _x } - [objNull];
{ [_x, convoyMinSpeed] remoteExec ["forceSpeed", _x] } forEach _drivers;
```I guess
allUnits select {vehicle _x isEqualTo vehicle player};```
no
i am a master at scripting (please do not do this)
u wot
i once set every variable in all namespaces to equal 0 and it didnt break nearly as much as i thought it would
STEP AWAY FROM THE KEYBOARD SIR, I WON'T SAY IT TWICE *calling code BIS on my position, immediately!*
BIS
inb4 dedmen corrects you
up until an Arma 2 version, you could do true = falseโฆ
ye ๐
it was patched, but I almost couldn't leave the main menu given all the errors ๐
KJW is SCP 0x00000005 confirmed
i'd have to be to write mods that run setobjectscale on every unit on every frame
in MP
it doesnt work if you are not local to the server in mp sadly
and on every client ๐
the guy breaks scripts more than I do, and that says something
quite thankful it doesnt work in mp now
i wrote it on the toilet
using someone sending me screenshots of what i wrote in a discord message for syntax highlighting
I won't comment on your toilet-breaking abilities
it is truly astounding how the mod even works
but all it does is make the local host hoster change size or singleplayer change size
there are limits to it you cant go below like .1 scale
else shit breaks
range 0.0001..65504
i dont think i ever found an upper bound for scale aside from you just unrendering
on units it encounters issues being usable
not 65535 son, I am disappoint
the larger you are the quicker you can run up hills too
which makes sense but it is very comical just stepping up a 20m drop
omg, thank you so much ๐ซถ๐ฝ
At the start of the mission i use on the serversqf 0 setFog 0.1;but after some time (1, 2 hours) the fog is at 0.457, and i use no command to change the fog (nor is server or clients).
The only weather command i use is setOvercast a couple of times.
Why the fogo changes?
because reasons and randomisation
0 setFog 0.1; OK
but also 3600 setFog 0.1; to enforce no changes for an hour
https://community.bistudio.com/wiki/forceWeatherChange
To prevent the engine from overwriting custom weather settings, enable the Manual Control settings in Eden Editor's intel section.
@south swan rain, waves, lighthings and wind have a Manual Override buttom, but Fog don't: https://imgur.com/sUPD2C0
Can i use that?sqf 0 setFog 0.1; (3600*6) setFog 0.1;
Sorry for interjecting, may I ask how I can get array for units of a convoy without the leader?
so I can use this
{
_x join leader convoyGroup
} forEach units convoyGroup;```
join takes an array
plus, they're already in the group
uhh
units convoyGroup is all units in the group
so making those units join convoyGroup does nothing
re-read your code ๐
"all the units of that group, join the leader of that group" yeah ๐
reminds me of why i got so confused with 0 divisor errors before realising i was trying to find the distance to myself
i had forgotten to add player handling.
i know what i am doing ๐ well sometimes the units wont move even after the command and manually (in zeus) joining them to the leader works and they move just fine!
private _harold = leader convoyGroup;
_harold doMove getPosASL _harold;```
im pretty sure theres a dedicated command for moving back into formation but seeing as youre doing a convoy thing change getposasl if you want
(group leader orders all units in group to formation after reaching domove position)
havent tested that but imagine itd work
Can someone explain to me how to add interaction to an object through which the player will receive a full loadout?
mfw searching "addAction" returns results for addiction 
imo, friendliest method for mission makers:
//In obj init
this addAction [
"myfunnyactionname",
{
private _loadout = getUnitLoadout bob; //bob is the variable name of the unit which has the loadout you want your player to have.
player setUnitLoadout _loadout;
},
nil, //no touchy
1.5, //no touchy
true, //Do you want players to see the action in the middle of their screen?
true, //Do you want the action to go from the middle of their screen after use?
"", //no touchy
"true", //no touchy
10 //Radius from object action will appear
];```
ensure you have unit of variable name bob and set the loadout up on him, makes for easier editing
he can be anywhere, doesnt need to be seen by players
Better way would be to directly get the loadout from the config
what if they want a custom loadout
thats the entire point of that part
set the loadout up on bob, keep bob hidden (or use him as the action object)
change bobs loadout accordingly, no faffing with arrays and stuff that are difficult for mission makers to understand if they dont script
Fair enough
if you had set up the units loadout in config ofc you could just config lookup but thats most user friendly IME
can even hide & disable simulation on bob if you have a lot of them :P
main issue is accidentally including in things like units west
I'm gonna guess yes
well then can just kill the unit too
They drop their primary & secondary weapons though.
Not sure if you can re-add them :P
ah, true
does anyone know how to fix this error i have no clue what chat to ask this in
missing 'description.ext::Header
[_x] instead of _x, or just (units convoyGroup) join convoyGroup;
do you still have to call an extra join in A3 to make sure the units side is set correctly?
uhhh i dont think so
it's needed in A2 or else their side will be such as written in config rather than the group's side
tho I dont have a lot of experience with join command
i thought the reason you were doing that was because their side was wrong
no, side is set fine with one join call
one yes, one. after you did, you know, _group createUnit ..., where group already knows what side it's on
so that one call to join is really an extra
Yeah, still the same. I guess they were worried that it'd break some old missions if they changed it.
Although I can't imagine the use case for having units of two different sides in the same group.
i remember trying to create arbitrary number of sides, by having all units turn into renegades and then re-join their group, so that they wouldn't shoot each other
they still shot a few of their mates sometimes, i never figured out why
In the conventional case they all shoot each other, because they use the group side for targeting, apparently.
Create redfor units in blufor group and they go full all vs all.
They're probably still taking orders from the leader and sharing target knowledge, because Arma.
oh, they shot each other if they re-joined their old group. but if i created a new group (of the same side), and joined all of them into it, they wouldn't shoot most of the time lol
they still seemed jumpy like there was actual tension
I'm slightly worried that this wasn't 100% :P
Maybe there's still some logic looking at the original unit side.
it's good for modeling bandits behavior, they'd suddenly shoot their mates at random as if having some inner group conflict
anyone know how to add a idle animation for agents? i cant get the panic one to work
_zombie addEventHandler ["AnimChanged", {
params ["_agent", "_anim"];
_agent playActionNow "Panic";
}];
hmm, perhaps their rating goes up after they shot a few other renegades, and that's why they dont all kill each other
this was the only way i got it to work
why do you use an event handler for that?
i wrote it so long ago, i have no idea
do you at least play the anim?
?
you must play some anim on the agent for the event to trigger at all
_zombie addEventHandler ["AnimChanged", {
params ["_agent"];
_agent playActionNow "Panic";
}];
_zombie playActionNow "Panic";
no im not saying what i have now doesnt work
or
_zombie addEventHandler ["AnimStateChanged", {
params ["_agent"];
_agent playActionNow "Panic";
}];
_zombie playActionNow "Panic";
i just want to make it work whilst idle
wut?
cant get the panic one to work
are you sure it's an actual action? never even seen it
sorry i was unclear
the panic anim works when running or walking
when the ai is still he puts his hands down and just stands there
i want him to be paniced while idle
cant put videos shit
what if you try AnimStateChanged like this?
maybe the action is not linked to the idle stand actions group
use its state instead
first make the unit play the panic action, then get its state: animationState myZombie
then use it like so:
_zombie addEventHandler ["AnimChanged", {
params ["_agent"];
_agent playMoveNow "WhatEverThatCommandGaveYou";
}];
i mean i can just fetch the animation from amimation viewer
ctrl+C?
cant highlight it though
just select it from the list, then press ctrl+c
ApanPercMstpSnonWnonDnon_G02
ApanPknlMstpSnonWnonDnon_G03
ApanPpneMstpSnonWnonDnon_G02
well now use it with playMoveNow
by "idle" you mean stopped and not moving?
i could not find an eh that did it
yeah
and i would still like the other anim to work
acualy i have a solution
my zombies have a "trigger" when they get shot at
_zombie addEventHandler ["AnimStateChanged", {
params ["_agent", "_anim"];
if !("mstps" in _anim) exitWith {};
_agent playMoveNow "ApanPercMstpSnonWnonDnon_G02";
}];
you can try that
well try making him play some anim
_zombie playMoveNow "ApanPercMstpSnonWnonDnon_G02";
or try with AnimChanged too
yep did that
Hey guys, I am trying to set up a script which essentially takes the derived value of a variable and then issues a hint depending on the variables value (Numerical).
Here is what I have so far, but the numerical value doesn't appear to actually affect what text is shown on the screen.
Strength = 0.66;
Strength_Increase =
{
if (Strength < 0.99) then
{
Strength = Strength + 0.33;
if (Strength == 0.66)
then
(
hintSilent parseText format["<t size='1.25' font='Zeppelin33' color='#29b00e'>NORMAL STRENGTH</t>"]
)
else
{
hintSilent parseText format["<t size='1.25' font='Zeppelin33' color='#bf0000'>HARD STRENGTH</t>"]
};
};
};
Any help would be appreciated
for some reason this does not work
what did you use that worked with this?
_zombie addEventHandler ["AnimChanged", {
params ["_agent"];
_agent playMoveNow "WhatEverThatCommandGaveYou";
}];
you can't compare floats like that
did you literally use that?
didn't you change "WhatEverThatCommandGaveYou"?
Ok, so what would be required to get this working?
you could use a diff: abs(strength - 0.66) < 0.01 for example
_zombie playActionNow "Panic";
_zombie addEventHandler ["AnimChanged", {
params ["_agent"];
_agent playMoveNow "ApanPercMstpSnonWnonDnon_G02";
}];
i used this and it worked i mean
Or I could just use round numbers right? Like 1,2,3
If strength is always a multiple of 0.33 than yes, 0-3 is preferable.
also you start with a value of 0.66 and increment, so you never have 0.66 anyway 
Half your code is missing anyway
yes
It's just a function that's not called.
The function is called via a CBA Keybind, that part works so all good
no clue 
get an entire zombie script finished and built. cant add idle anims lol
maybe something else is changing the animation like every frame
forcing it to be something
so that the zombie doesnt look normal and stays in the zombie stance
?
btw zombies were an easter egg in A1, they were reskinned civilians you could only spawn from script
i mean maybe some other script is already doing playAction/playMove on the zombie
i removed it to test, nope
_zombie addEventHandler ["AnimChanged", {
params ["_agent", "_anim"];
_agent playActionNow "Panic";
if !("mstps" in _anim) exitWith {};
_agent playMoveNow "ApanPercMstpSnonWnonDnon_G02";
}];
if i use this the zombie just gets frozen
without the panic it also just frezzes
Still having issues, Evertime I press the relevant key, the text is still being shown as HARD STRENGTH, I have checked the variable each key press and it does appear that the actual variable itself is changing between 1-3 on the key presses, just the text is alwasy HARD
Strength = 2;
Strength_Increase =
{
if (Strength < 3) then
{
Strength = Strength + 1;
if (Strength == 1) then (hintSilent parseText format["<t size='1.25' font='Zeppelin33' color='#3b378c'>GENTLE STRENGTH</t>"]);
if (Strength == 2) then (hintSilent parseText format["<t size='1.25' font='Zeppelin33' color='#29b00e'>NORMAL STRENGTH</t>"]);
if (Strength == 3) then (hintSilent parseText format["<t size='1.25' font='Zeppelin33' color='#bf0000'>HARD STRENGTH</t>"]);
};
};
Strength_Decrease =
{
if (Strength > 1) then
{
Strength = Strength - 1;
if (Strength == 1) then (hintSilent parseText format["<t size='1.25' font='Zeppelin33' color='#3b378c'>GENTLE STRENGTH</t>"]);
if (Strength == 2) then (hintSilent parseText format["<t size='1.25' font='Zeppelin33' color='#29b00e'>NORMAL STRENGTH</t>"]);
if (Strength == 3) then (hintSilent parseText format["<t size='1.25' font='Zeppelin33' color='#bf0000'>HARD STRENGTH</t>"]);
};
};
["TEST","strength_increase", "Increase Strength", {_this spawn Strength_Increase}, "", [0xF8, [false, false, true]]] call CBA_fnc_addKeybind;
["TEST","strength_decrease", "Decrease Strength", {_this spawn Strength_Decrease}, "", [0xF9, [false, false, true]]] call CBA_fnc_addKeybind;
Really lost at this point, any pointers would be greatly appreciated!
Your then statements all have the wrong brackets.
how do i make a unit honk the car they're driving? (the car is civ)
something like this myb:
driver _vehicle forceWeaponFire [currentWeapon _vehicle ,currentWeapon _vehicle ]
_ZOMBIE addEventHandler ["AnimChanged", {
params ["_UNIT"];
_UNIT playMoveNow "ApanPknlMstpSnonWnonDnon_G03";
}];
i got this working, how would i make it only work when idle?
Any idea how I could get the addCamShake function to work on a player that the person is looking at?
I want 1 player to be able to do an action (A), whilst looking at another player (B), and then have player (B) have a cameraShake effect
Been playing around with RemoteExec for that purpose but doesn't seem to work too good
rather have a local script, especially if the effect's condition is permanent
Question, is there an event handler for when a unit completes a waypoint, or move to position?
the waypoint's completion field ๐
Make a function (https://community.bistudio.com/wiki/Arma_3:_Functions_Library) that applies the camera effect locally. The action can then remoteExec that function to the targeted player. You could use cursorObject to target the player; don't forget to make sure the cursorObject actually is a player.
is anyone here familiar with hemtt ? having some issues trying to compile GUI code
i actually did something different instead. Thank you. ๐
hello does anyone know of a working script for a server to warn, and eventually kick a player for being afk?
did it with this:
_vehicle action ["useWeapon",_vehicle,_driver,0];
it's very important that what goes before action is _vehicle, and not _driver
Brett is fairly responsive in the HEMTT channel on the ACE discord, might be a good place to ask
Unless you mean the vehicle
Q: what is a circular reference to a HASHMAP?
20:00:50 Warning Message: Circular reference found in HashMap, this will cause a memory leak!
20:00:50 Circular reference found in HashMap, this will cause a memory leak!
20:00:50 Circular reference found in HashMap, this will cause a memory leak!
...
intuitively I think it is a value in one of the KV pairs being the HASHMAP instance itself, but I do not think I have any of those going on.
Like:
_hm1 = createHashMap;
_hm2 = createHashMap;
_hm1 set ["hm2", _hm2];
_hm2 set ["hm1", _hm1];
really? that? hmm...
here's my dilemma...
or why that caused bunch of these things to stack up before A3 finally crashed... 
I have inventory being arranged in terms of hashmaps. maybe not the greatest choice, but it offers easy key ident throughout.
inventory includes weapon platforms and their accessories, which each accessory has a value reference to the platform itself. this possibly being the circular reference.
sure sounds like it
I use that to identify the platform from the accessory for inventory management purposes, filtering compatible items, etc.
alternatives to that is a naked array, even KVP, but that just gets ugly real quick. but if it avoids this A3 pitfall 
so I have a lot of this pattern going on navigating inventory, _x getOrDefault ['_parent', _x], '_parent' having been the platform in the case of an accessory hashmap.
Sounds like you need a redesign then.
maybe so, slightly, anyway, even with an intermediate RYO 'hashmap' ...
otherwise so close to a functional inventory manager...
Hey, I'm getting an error "invalid number in expression"
{_x addVest "rhs_6b2"} forEach units group;
{_x addHeadgear "ssh40_helmet"} forEach units group;
not sure what's causing it
usually means you have an incomplete primitive expression, along these lines. i.e. units group what? or even that group itself is undefined i.e. nil
got it fixed, just needed to use units (group this) instead
Hmm
How would I... take a playableUnit and then ask "are you in a land vehicle of any type"
or, well
I wouldn't mind "are you in a car, APC, or tank" but let's start small
Ideally I could get a switching statement that says like case car: and case apc: but that seems foolish
vehicle _unit isKindOf "LandVehicle" should mostly work
There's a slightly more proper method where you look at the simulation.
wdym simulation?
It's a config value.
have a look at fullCrew
https://community.bistudio.com/wiki/fullCrew
can return an array in list form, in the shape:
[_unit, _role, _cargoIndex, _turretPath, _personTurret, _assignedUnit, _positionName]
for the most part it is dependable, but there are sometimes vehicles in which _role is not as dependable.
but AFAIK you know that the _unit is 'in' or not.
Also, what's the best way to get the prefix off of a group's name? i.e. group player gives B ALPHA 1-2 and I really just want ALPHA 1-2.
more like get group ID
is what I want
oh wait
GroupID is just that
lmao
nvm
thanks, you led me to the correct result anyway because I clicked on the link
G'day peeps, need a bit of help wrapping my brain around event handlers
ive been trying to run a code on all entities on a dedicated server
the logic im looking for is as follows:
-any entity, player or not "shot in the head"
-remoteExec "function"
anyone able to offer some advice?
and where in the mission.pbo does this need to sit
Hello i need a script to set damage to a predefined area to destroy the trees. Is this possible?
There is a terrain removal(I forget the proper name) module in the editor that you can place on your map to remove items like trees.
Yes but this requires player to be nearby and it also stops working about 3 hours after the mission has started. I was thinking maybe i can do a set damage to an area and just knock them down.
You can put this in invisible helipad init in Eden and it will destroy trees and delete rocks:
private _terrain = nearestTerrainObjects [this,["Tree","Bush"],50];
{_x setDamage 1;} foreach _terrain;
private _objectsToHide = nearestTerrainObjects [this,["ROCK","ROCKS"],50];
{_x hideObjectGlobal true;} foreach _objectsToHide;
I will try this! THANK YOU
is there any existing script to automatically flush cache?
No
Hit me up im remastering scripts etc also can check ur scripts for any problems within the script
Has anybody created a unix timestamp generator for arma mission time/date? Thought there were commands for it but they do not exist
Use case is having a constant time across all mission saves etc (that will be compatible with time skips)
Tried using ChatGPT to help me write a script and it seems like exactly what I need except there's an error with curatorType that I can't figure out
Does anyone know?
if (isServer) then {
{
_message = format ["Your name is %1",name player];
private _curator = _x;
if (curatorType _curator == "Zeus") then {
_curator remoteExecCall ["systemChat", 0, _message];
};
} forEach allCurators;
};
!quote 6
_ https://cdn.discordapp.com/attachments/105462984087728128/1096430025504473209/image.png _
Lou Montana; Friday, 14 April 2023
I forgot this one ๐
i had to search for it
speaking of gpt though, anyone tried github copilot with sqf? any good?
Fairly tricky. You'll need to use HandleDamage, which must be installed locally to the entity. Depending on your mission, you may need to handle units changing locality too.
There's also some tricky stuff in working out what's a head hit.
Non-head hits will often do small amounts of damage to the head, and ACE's extra hitpoint counts as head selection for some reason, so you need to use the hitpoint param rather than the selection.
have you found a solution?
@split scarab
That script is so bad that I can't even tell what it's trying to do. Shoulda left the comments in :P
Not quite no, I'm trying to make a Trigger message ONLY Zeus players with the name of the player who entered the Trigger zone
Messaging all zeus players:
private _zeusPlayers = [];
{
_zeusPlayers pushBackUnique getAssignedCuratorUnit _x;
} forEach allCurators;
"Test message to zeus players" remoteExec ["hint", _zeusPlayers];
Must be executed on the server.
Will that work if I slap it in the Trigger Activation field?
probably not. I don't deal with triggers.
I'm not even sure that triggers can do what you want. Depends what you want to happen if a second player enters the trigger zone.
Hmm, I'm making a Zeus mission where players have to travel somewhere specific and I've setup stuff along the route but I wanted to put down triggers outside of the route to alert me when they're veering off course so I can possibly spawn stuff to discourage them from continuing off the route
So I was hoping to make the Trigger message the Zeus players so we know to deal with the stragglers
A repeatable trigger won't fire again until it's been reset by everyone moving out of the zone. So if you wanted a message for each player that strays then it won't work well.
SELECT item_name, item_quantity FROM box_inventory WHERE box_id = boxID;
friends, I wrote this code to save the data of the items in the boxes on my server, but it does not work.
I give an example of what I want, for example, if there are 10 windings in 1 box, there are 8 left when 2 windings are missing. When I restart, I want it to continue from 8 chargers.
So basically I want to keep the database inside the box
should i use attachTo or waypointAttachVehicle to attach a "destroy" waypoint?
oh it looks like attachTo doesnt accept waypoint type
this is SQL, and SELECT is to read data, not save it
There's no such thing as waypoint type. They're just arrays of [group, scalar]
You can't show unix timestamp in A3, except in strings, which is pretty much useless (unless you write a scalar implementation yourself)
You don't need "unix timestamp" for this
realised arma's number processing issues would mean its useless anyways
looking for some ideas for sorting such data in sqf
problems
a) models dont have consistent RES LOD naming
b) sort strings bunches strings together starting with the same time (ie 1, 1x, 1xx) [can be solving by adding leading 0s]
c) preferable order the data to be just index 0,1,2,3, etc regardless of th RES LOD naming - thus reshuffle the data accordingly
any intelligent way to achieve this or just basic array data reordering
peculiar issue here; filepatching is making function viewer (using adt) return the updated file, but running str fnc is giving me the pbo function -- have i missed out on something here? pboprefix is pathed correctly (obviously, given function viewer is returning it)
sorting what and by what? I don't know what I'm looking at
LOD names
special LODs have resolution too
https://community.bistudio.com/wiki/LOD_resolutions
however model makers dont name their RES LODs consistently
so one does 0,1,2,3, another 1,2,3,4, yet another 1,10,25,100 or 0,0.5,1,2,5,10
well exactly. anything that's not a special LOD, is a res LOD
well not sure what resolutions were actually valid by the game, but you can just assume that
if you look at the colums, its very hard to read as the values are not colum by column
you would want
value1, valu2, value3, value4, - , - , ..
ADT rereads the function file. str reads what the function actually represents
you need to recompile the function
if it's not being updated your function is final
Ah, it's cfgfunction'd -- I assume that's the purpose of CBA's PREP stuff?
wut?
using it in cfgfunctions means it is final right
so are PREP functions
so you mean you want it to say RES1, RES2, etc instead of 0, 0.5, 1, ...?
I really don't know what's the goal here
another example
"1"
"2"
"3"
"0"
"4"
"3.5"
"12"
"6"
"5"
"10"
"7"
"8"
"1.5"
"2.5"
input
oh 
sort leads to:
"0"
"1"
"1.5"
"10"
"12"
"2"
"2.5"
"3"
"3.5"
"4"
"5"
"6"
"7"
"8"
so 10 and 12 not at the end
- you get a lot of additional columns
yeah atm doing parseNumber to detect if the LOD is a RES LOD, and then sort
however next is to simplify to RES1, RES2, RES3, .. RESn
so drop the custom numbering and reduce to minimal amount
and finally fetch the data correctly from the array of the info per model
as said can be done in basic logic step by step - was wondering if there is a more intelligent way to do it
like "squash array" to reduce to only relevant entries
depending on how data is represented, this is the only part you could optimize
the rest has to be done as you said and there's no other way around it (so you still have to sort the res lods and assign indices to them)
one thing that is not clear for me yet:
is all data being extracted from the game?
or are you just trying to sort them in SQF?
Why not do the sorting in Excel?
you have too much faith there @cosmic lichen ๐
Huh?
what to do to save it)
?
UPDATE
If the entry in the DB already exists
Otherwise it's INSERT
is there any way of getting player uid in sp? 
i switched from units to agents to back to units and re-wrote same code 10+ times
Running into a weird bug where a sound that should be played locally can be heard by other clients
private _voiceLine = selectRandom getArray (_config >> "voiceLines");
private _nearbyUnits = (getPosATL player) nearEntities ["CAManBase", 30];
[_voiceLine, getPosASL player] remoteExecCall ["CWR_fnc_playLocalSound", (_nearbyUnits)];
// fn_playLocalSound
params ["_file", "_position"];
if (CWR_Voice_EnableVoiceLines) then
{
playSound3D
[
_file,
objNull,
false,
_position,
1, // volume
1, // pitch
0, // distance
0, // offset
true // play locally
];
};
(Sound effects on the other client were muted for the recording)
I have other code that references this same function, but does not have this issue
That seems pretty clear that you're calling the top routine twice?
and therefore it's working as written.
Although you're probably double-stacking the calls as well because both units are local?
The first set of code is called in a fired event (or ace_fiedPlayer if loaded), but I don't see why it'd be called for each nearby player?
Although technically that's not true, one second
interesting detail about RPT log file
@tulip ridge Are there two players there? I figured one of them was AI.
I have two instances of arma open on a local lan server
That's why there's a (2) in the other client's name
After throwing in some debug statements, the code does seem to be called once for each unit, but the sound effect only plays once per player
So I guess something is wrong with my check for ACE?
class Extended_PostInit_EventHandlers
{
class CWR_ThrowGrenadeEH
{
init = QUOTE(if isClass (configFile >> 'CfgPatches' >> 'ace_common') then { call CWR_fnc_throwGrenadeEHACE; } else { call CWR_fnc_throwGrenadeEH; };);
};
};
Do you have any documentation on CWR_ThrowGrenadeEH?
oh, I guess that's just a function that you haven't pasted.
It's just this, adding a fired event handler
player addEventHandler ["Fired",
{
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
[_unit, _magazine] call CWR_fnc_throwGrenadeMain;
}];
Ace version just uses a CBA event handler for ace_firedPlayer
As far as I can tell, both
Wasn't the check at least, just threw in a message for when each handler initially starts
So you've confirmed that when you throw a grenade, the handler triggers on both clients?
Was about to check if it runs on each client twice, but it definitely runs on the client that throws the grenade twice
Shouldn't be, I was only getting one message saying the handler was created
Other option is that it's firing the same handler twice for the same grenade throw.
That doesn't seem to be the case? I was only getting a single "Grenade thrown" message when I added one
This is the whole repo for it, although obviously that won't have the changes I've made right now
How can I get the head (eyes) orientation in azimuth degrees like getDir?
eyeDirection or selectionVectorDirAndUp and convert into direction 0-360
_eyeDir = eyeDirection player;
_dir180 = _eyeDir#1 atan2 _eyeDir#0;
(_dir180 + 360) % 360;
I think I might have figured out why some of the weirdness happening?
For actually sending the message in group chat I use:
[player, _message] remoteExecCall ["groupChat", (units group player)];
to send it, so maybe that's why?
There wasn't any noticeable difference when using group player for the targets
Are players only ever local on their own machines?
Yes, players are always local on therir machines
Yeah, but is a player ever local on another player's machine?
I'd assume no, but want to make sure
I'm assuming yes, because upon filtering out non-player units from _nearbyUnits and then putting remoteExecCall in a forEach _nearbyUnits, seems to be working
I do not think so. If a player is not local object, one cannot move the player unit properly
Player objects are briefly server-local on creation, IIRC
After that they're client-local.
I don't think that should be an issue? If anything I think it would just play a sound on the server's side, where the player spawns
Where's the setting for giving all players access to debug console?
Found it before but can't now
It's in the Editor mission attributes, I wanna say under Multiplayer but not 100% sure
Yeah I found it, thought I deleted my message after I did but my internet's been weird today
[for the historical record, it's in the States section of the General attributes menu]
The message seems to be working now, but the voice lines are not, I can still hear the sound effect playing for each player
private _nearbyUnits = (getPosATL player) nearEntities ["CAManBase", 30];
_nearbyUnits = _nearbyUnits select
{
isPlayer _x;
};
{
[
_voiceLine,
getPosASL player
] remoteExecCall ["CWR_fnc_playLocalSound", _x];
} forEach _nearbyUnits;
Got it figured out now, I actually ended up fixing it by going to fix another part.
I do the voice lines with "tags", and since I made the message get processed for each player, it caused each player to check those tags and then play the voiceline
What's the script command to create a tactical ping?
I think there's nothing
Is it just like a draw3D or something?
If you want to recreate, that may do
A feature for another day then
Was going to put a tactical ping where the player was looking for the "Contact" callouts for the chat wheel mod I've been working on
The only other thing is that the voice line doesn't play in singleplayer for some reason
It's because I took off my testing voice lines since I was going to publish the update the mod
Actually it should be x atan2 y not y atan2 x
yeah I wrote it correctly initially from memory and then misfixed it hours later after glancing at the wiki :P
Anyone have experience with tvTrees? I was messing around tonight and made this https://i.gyazo.com/ba065265d34607075ff00622a21cc9dc.gif, but it seems like tvTrees are limited. I couldn't find a way to change the text being displayed so every update to the text I would have to remove the 13 children and readd them with the updated name. In that example it seemed to work very smoothly but who knows how it might look in a multiplayer environment with a heavier load. I suppose another way would to be to remove the value I want to change, add it back and then use one of the sorting commands.
VBS gets all the nice things like advanced tvTree commands :( https://resources.bisimulations.com/w/index.php?title=Dialogs_Tree
Well it depends how you look at it ๐
x atan2 y is CW from north
y atan2 x is CCW from east
For getDir like behavior you want the first
Yo, how do I set a direction to look at on a plane?
I'd like it to look at the direction of _planedirpos when it spawns and I don't really know how to
_planespawnpos = markerPos "W1";
_planedirpos = markerPos "W2";
_plane = createVehicle ["B_T_VTOL_01_infantry_F", _planespawnpos, [], 0, "FLY"];
_pilot1 = group player createUnit ["B_Pilot_F", [0, 0, 0], [], 0, "NONE"];
_pilot1 moveInDriver _plane;
_plane moveTo _planedirpos;
See the getDir command
Is there not a chat command for direct communication?
Direct chat does have a channel ID of 5, but I can't seem to find a command to use it?
customRadio
but channel 5 is for directSay
it's not actually a "radio channel"
Yeah but I was hoping there was an equivalent for sideChat, groupChat, etc. for direct chat
Unfortunate
maybe customChat 
systemChat 
It was mostly just for the text styling (more white than system)
well try customChat too 
I already tried customChat, it just didn't send a message at all
looking for way to detect ( on player ), if item was taken from player's backpack by another player ( or zeus )
You can check is item removed from backpack with removeItem command: https://community.bistudio.com/wiki/removeItem
But if you are vorried about stuff desapearing becouse of players then i would use lock backpack by diwako Github:
https://github.com/diwako/lockBackpack
Does anyone know if you can adjust current heat signature on the fly via SQF or via some other trick? I want to have an object which doesn't have engine to be heated up so it can be targeted by infantry anti-tank teams?
EDIT: found it https://community.bistudio.com/wiki/setVehicleTIPars
trying to find some sort of event I can listen, so I can detect moment, when it was taken. Preffer not to use loops
You could also force close the inventory if the another player is trying to access the backpack of another player:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#InventoryOpened
[10:24 PM]
Randomelement = selectRandom ["stuff"];
[10:25 PM]
Randomelement setpos pos1;
// then I get an error that there is no object.. help..
Stuff = nearestObjects [player, ["class1ect"], 200];
Randomelement = selectRandom [Stuff ];
Randomelement setpos pos1;
``` If you are not using this variables in other stuff make them private.
There's not really an event for something specific like that
You could use a CBA event to check when a player's loadout changes, and compare that to the last loadout you checked from them
That's because you're picking a random element from ["stuff"], not the objects you got with nearestObjects
I will investigate, thanks, by any chance you would know the event name
Change selectRandom ["stuff"] to just selectRandom Stuff
['loadout', TAG_fnc_yourFnc, true] call CBA_fnc_addPlayerEventHandler;
'loadout' for listening to loadout changes, TAG_fnc_yourFnc is the function to call when it changes, true (or false) is whether or not to call the function when the player first spawns
but.. Isnt it defined as stuff when i placed it.. I am easily confused.. Bear with me.
stuff = ect... that defines it right? Im not crazy.. right?
Stuff = nearestObjects [player, ["class1ect"], 200];
Randomelement = selectRandom ["stuff"];
- Stuff is with a capital letter and in selectRandom is with small s
(Variables are casesensetive). - in SelectRandom you are passing string as a element, and not passing array that you got saved in Stuff.
Variables are casesensetive
no
stuff is an array of objects
selectRandom command takes an array and randomly selects an element from it
so what you should do is: selectRandom stuff
in layman terms, stuff is something like [obj1, obj2, obj3, ....] so you don't need to wrap it into an array again
so if you did selectRandom [stuff], you'd get your array back again ([stuff] is an array of array of objects now)
(random can now only select one element, and it's the stuff array)
Wait are you saying that:
GlobalVariable = 42;
//is the same as
Globalvariable = 12;
//and it will print 12
```?
oh. The more you know.
thanks leopard! i dont know why i was thinking about like the way i was ๐
not only variables, but everything except preprocessor operators. E.g. [] Call {1} works
Some string comparisons (e.g. isEqualTo, in) are case sensitive
hey need a white list for warlords we're they can not load modern guns into the server anyone got ideas
how do i show the mission results summary, like statistic, kills, failed objectives etc?
You mean without ending the mission?
with or without, whatever
oh, it shows itself lol
i thought i had to do from script
how do i change what it says though
CfgDebriefing entries.
looks like the relevant one for me is briefing.html
Updated: https://github.com/NouberNou/carma2
This is amazing and works flawlessly thanks again
If you want the trees to fall away from the centre point, replace _x setDamage 1; with _x setDamage [1, true, this];
hey can somone help me make the a script ?
Don't ask to ask just ask
I need to make a Para chute script
the goal is to be able to eject ai out of the plane with static Para chute I just started scripting dnt really have any idea and im trying to learn
@warm hedge
@native hemlock: yeah, there's not currently a tvSetText command
Its hurrible
Hi all. How can I create a new team i.e. Bravo, spawn an AI-controlled soldier and assign it to that team please?
_group = createGroup civilian;
_group createUnit ["C_man_1_1_F", [0,0,0], [], 0, "NONE"];
Civilian can be changed out for the side you want them on - opfor, blufor, independant etc
"C_man_1_1_F" is the class name of the character type you want, this is a class without any weapons.
[0,0,0] is the position coords that you want to spawn it.
This will create a group and add that unit to it.
Thank you but this didn't seem to do anything. Do you know if it'd work in Dynamic Recon Ops multiplayer?
I've honestly never played it, but if it uses specific teams that it makes, then it probably wouldn't work.

