#arma3_scripting
1 messages Β· Page 70 of 1
yes, but as I said, I do not want to use this method for putting details on top of other props, because I'm getting a relative positions and directions in relation to the parent prop.
first one synced to a game logic is parent, others synced are attached to parent. all game logics synced to a module? π€·
I'm not sure what issue you're referring to with spawning compositions in the first place either
save a table with stuff on top and spawn it on an slight incline, the stuff from the top will get spawned on the ground and clip through the table
spawning using BIS_fnc_objectsMapper
spawning in 3den you just disable vertical mode, don't know why you'd spawn a composition during runtime
Those compositions will be spawned dynamically during a mission
ah wait, this comparison is about not parsing all elements
I didn't want to list apply or select or anything else to prevent people straying from for and forEach
I think
that or I didn't think of making the comparison
Saved compositions can be placed by Zeus
I want more control
oh yeah -- either way there's no base game supported way for spawning compositions iirc
Might be worth including inAreaArray in that example
objectsmapper function looks old
just have the table in the comp and make its init spawn/attach the stuff on top.
Btw, exitWith forEach construct has a problem of running it with empty arrays, might be a noob trap
{if(alive _x) exitWith {true}; false;} forEach []; => nil
not relevant to the demonstrated case (partial iterations) I think, but the example should be changed
No, I need to get the objects right away, there will be a dozens of different compositions going, so I need something that is very simple to setup.
True. Though if only there was inAreaArrayCheck to return true/false on a first inArea match π€ Could be much faster than _array findIf {...inArea...} >= 0
How do you get the objects anyway for the attachto? Synching of the objects does not work, how do you tell the game with objects will be attached to?
You'd need to prepare it in editor first. get the types and relpos for each, add to list, put list in init code.
_table = (get3DENSelected "object" select {_x isKindOf "tableClassName") select 0;
_objects = get3DENSelected "object" - [_table];
_objects apply {[typeOf _x, _table worldToModel ASLToAGL getPosASL _x, also vectorDir, Up]}
Great, idea. That is exactly what I was doing. The issue is getting the damn list of objects without doing dumb stuff like having dummy game logic syncing going on where you have make sure that the parent object is first in array just to let the script know that stuff is meant to be attached to that.
is there a way to lock out player movement controls as I am currently trying to fly an aircraft carrier by rolling around on the floor
you can block certain actions by using addAction and using the action alias (inputAction name), however, I dont know up to what extense you can block all the actions.
you might want to block the display 49 I believe for that?
You could play an idle animation to stop player from moving around.
Figured out getting into a plane with no sim works for testing, I'll bear that in mind though, didn't know that -- thanks π
made a movement system from scratch and now am trying to learn how to use it π
problem seems to be that im unable to roll left or right but I think that's due to the inputcontrols I'm using
I thiiiiink? certain types of scripted camera take away control of the player unit
I'll probably have to use CBA keybinds or something similar though as you cannot stack turning and increasing throttle 
Annoying part is if u block user input and player is moving mouse, it will keep rolling their head
player's mouse probably won't be needed(?)
It has thrust in all 3 dimensions though and pitch, roll and yaw so it could be 
or i be really mean and bind it to wasd, throttle up and down and then pitch/roll/yaw is hujkyi
Meh i needed it for my own dramatic suicide animation, but i ended up scrapping it cause camera just rolled somewhere
I'm so confused because yaw works fine but pitch/roll doesn't π€
Bet I'm calling something wrong
What phone number did you use?
Oh I reckon I'm changing orientation not target orientation]
but I cannot check currently because arma crashed because I walked too far away with my hearing aids connected to my laptop π
if (inputAction "HeliBack" == 1) exitWith { //Pitch up.
private _currentOrientation = _ship getVariable ["KJW_CapitalShips_TargetOrientation", [0,0,0]];
_currentOrientation set [2,(_currentOrientation#2+5*diag_deltaTime)];
_ship setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
systemChat "HeliBack";
};
if (inputAction "HeliForward" == 1) exitWith { //Pitch down.
private _currentOrientation = _ship getVariable ["KJW_CapitalShips_TargetOrientation", [0,0,0]];
_currentOrientation set [2,(_currentOrientation#2-5*diag_deltaTime)];
_ship setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
systemChat "HeliForward";
};
if (inputAction "HeliRudderLeft" == 1) exitWith { //Yaw left.
private _currentOrientation = _ship getVariable ["KJW_CapitalShips_TargetOrientation", [0,0,0]];
_currentOrientation set [0,(_currentOrientation#0-5*diag_deltaTime)];
_ship setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
systemChat "HeliRudderLeft";
};
if (inputAction "HeliRudderRight" == 1) exitWith { //Yaw right
private _currentOrientation = _ship getVariable ["KJW_CapitalShips_TargetOrientation", [0,0,0]];
_currentOrientation set [0,(_currentOrientation#0+5*diag_deltaTime)];
_ship setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
systemChat "HeliRudderRight";
};
I'm not going totally insane, right? Yaw and pitch are the same with different indexes?
I would use switch instead of ifs but i guess, array indexes look okay
I know, it's just me shitting about trying to get this to work in something showcaseable
I've manually run KJW_CapitalShips_Ships#0 setVariable ["KJW_CapitalShips_TargetOrientation", [-100,-100,-100]]; and it works just fine as well 
And it is updating the array
if _currentOrientation is then used to set world vector dir, "left" goes "more west"
is there an animation that's just a t-pose?
It's orientation using
_x setVectorDirAndUp [
[sin _yaw * cos _pitch, cos _yaw * cos _pitch, sin _pitch],
[[sin _pitch, -sin _pitch, cos _pitch * cos _pitch], -_yaw] call BIS_fnc_rotateVector2D
];```
so doesnt take vectors
just one array of yaw, roll and pitch
And array is showing correct values on user input? So if you yaw it right 3rd value changes?
Yep, yaw works just fine
Only pitch and roll 
that being said roll doesn't actually seem to have any effect here
oh bruggin
my ctrl+h stuff didnt work properly
Guess I must not know what I'm looking for when setting manually
You could jank it with obj setDir yawDeg;
[Obj, pitchDeg, rollDeg] call BIS_fnc_setPitchBank;
now I've fixed that hopefully it should be fine
well aside from heliforward and heliback not working but I think that's bc I'm on the ground w/ sim disabled
Also wont setVectorDirAndUp reset velocity?
heres the fun part
there is no velocity
setposasl oneachframe π
object has no physics
and before you ask why i dont use setvelocitytransformation
dont
I wont ask
the movement function used to be 500 lines then i woke up this morning and rewrote it in about 50 across 2 functions
FUCK setvelocitytransformation i hate it
Amazing it's pitching now
Rolling not pitching, pitching still doesn't work for some reason
Oh yeah bc I don't have the control duh
this is perhaps a daft question but is there a way to change an objects orientation in modelspace 
Yuh, mode 0
i.e
always make it turn to the left no matter what its pitch/bank is
Oh yeah nvm. Youd have to set mode 1 and whitelist allowed. I dont think there is blacklist mode
not directly, but there's vectorModelToWorldVisual
How would I use that to do this though? Get vectordirandup from a random point based on how much orientation or something? 
Dont think u can set mode for each function.
well, ideally unit direction vector, right? so yaw would be
_dirAndUp = [[sin _yaw, cos _yaw, 0], [0,0,1]] apply {_ship vectorModelToWorldVisual _x};
I think I understand? ish? Not really? 
vector maths has (probably obviously) always been my weakness
[[0,1,0], [0,0,1]] // no change
[[sin _yaw, cos _yaw, 0], [0,0,1]] // yaw
[[0,1,0], [sin _roll, 0, cos _roll]] // roll
[[0,cos _pitch, sin _pitch], [0, -sin _pitch, cos _pitch]] // pitch
pitch left as exercise for the reader
jk it's taking me a while xD
probably some neg signs messed up there still...
I understand a bit more -- but I'm not sure how that'd get put into one setvdirup command though π
i mean literally _ship setVectorDirAndUp _dirAndUp
what would _dirandup be though with more than just one? 
more than just one input? easy-slow way would be to do them one after the other xD
as in
if pitch is increased but you're rolling left, you need the nose of the ship to go up and left -- but I just have _orientation params ["_yaw", "_roll", "_pitch"]; π
how does createMine work? Can I provide it any object class and it will turn it into a proximity based mine?
Use the mine class from the mine you place down in the editor. Right click on it and copy class.
oh so it must be an existing mine? I cant turn a table into a mine or trash pile?
oh, am I correct in the assumption that for the ones with changes you'd just multiply them all together? π€
!quote 6
_ https://cdn.discordapp.com/attachments/105462984087728128/1096430025504473209/image.png _
Lou Montana; Friday, 14 April 2023
correct. you custom script something like that instead
gotcha, thanks ill figure that out then. Do you know if the SOG DLC's remote mines from the magazine tabs would count? Probably not right
if they did it right, they should also exist as mines in the mine tab
not confident xD but in your code you exitWith so there's no control mixing anyways π
ill give it a shot
I do need to change it to then but the controls just add/subtract from the orientation variable regardless 
no way xD this is fantastic
no
oh shit I thought it did, how do I make it loop?
found it
I need to add sleep right?
well yes as you see I just found it I just need someone to confirm because I am unsure
what
ask ask ask
, there is no shame in not knowing
but i wanted him to find out what happens if you dont add sleep to a while true loop
the last thing he needs is a PC lockup (ok, unlikely to happen in scheduled but still :D)
best way to learn π
Got it!
private _roll = diag_deltaTime *5* (inputAction "AirBankLeft" - inputAction "AirBankRight");
private _pitch = diag_deltaTime *5* (inputAction "HeliForward" - inputAction "HeliBack");
private _yaw = diag_deltaTime *5* (inputAction "HeliRudderRight" - inputAction "HeliRudderLeft");
private _dir = [0,1,0];
_dir = [_dir, _yaw, 2] call BIS_fnc_rotateVector3D;
_dir = [_dir, _pitch, 0] call BIS_fnc_rotateVector3D;
private _up = [0,0,1];
_up = [_up, _roll, 1] call BIS_fnc_rotateVector3D;
_up = [_up, _pitch, 0] call BIS_fnc_rotateVector3D;
_ship setVectorDirAndUp ([_dir, _up] apply {_ship vectorModelToWorldVisual _x});
This works for me, SHIP is heli with sim disabled
onEachFrame {
private _currentOrientation = SHIP getVariable ["KJW_CapitalShips_TargetOrientation", [0,0,0]];
if (inputAction "HeliCyclicBack" > 0) then { //Pitch up.
_currentOrientation set [2,(_currentOrientation#2+5*diag_deltaTime)];
SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
systemChat "HeliCyclicBack";
};
if (inputAction "HeliCyclicForward" > 0) then { //Pitch down.
_currentOrientation set [2,(_currentOrientation#2-5*diag_deltaTime)];
SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
systemChat "HeliCyclicForward";
};
if (inputAction "HeliCyclicLeft" > 0) then { //Roll left.
_currentOrientation set [1,(_currentOrientation#1-5*diag_deltaTime)];
SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
systemChat "HeliCyclicLeft";
};
if (inputAction "HeliCyclicRight" > 0) then { //Roll right
_currentOrientation set [1,(_currentOrientation#1+5*diag_deltaTime)];
SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
systemChat "HeliCyclicRight";
};
if (inputAction "HeliRudderLeft" > 0) then { //Yaw left.
_currentOrientation set [0,(_currentOrientation#0-5*diag_deltaTime)];
SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
systemChat "HeliRudderLeft";
};
if (inputAction "HeliRudderRight" > 0) then { //Yaw right
_currentOrientation set [0,(_currentOrientation#0+5*diag_deltaTime)];
SHIP setVariable ["KJW_CapitalShips_TargetOrientation", _currentOrientation];
systemChat "HeliRudderRight";
};
SHIP setDir _currentOrientation # 0;
[SHIP, _currentOrientation # 2, _currentOrientation # 1] call BIS_fnc_setPitchBank;
};```
Im using on my tree cut mod looping sound, so people can use own time how long they cut tree
_actionSound = "#particlesource" createVehicle getPosATL _unit;
[_actionSound] spawn {
params ["_actionSound"];
while {alive _actionSound} do {
[_actionSound, ["VRK_sawSound",500,1]] remoteExec ["say3D"];
sleep 5.25; // length of your sound
};
};
And stop by deleteVehicle _actionSound
I'll give both a try and see which runs better as is oneachframe executed foreach array of ships π
idk, the input thing on mine is copy pasta of yours, i just added 2 commands at the bottom
Ya I'll give that a try before amp's as it seems to be simplest π
committing the cardinal sin of building a mod to test though
also u may wanna increase this +5*diag_deltaTimeΛ it turns slow as sin
capital ship is 800m long π
though I did increase to 10 not long after I posted. turning is actually driven by a different function though based on config values π
have 4 perframehandlers for acceleration, velocity, turning and orienting at the moment 
two just set the variable and the other two just use it
with setDir you'd have to check if bank>90 yaw is reversed, right?
good point lemme check
errrr
I think so? Not 100% sure what the question means as my brain is frazzled rn
Well, if you bank it 90 degrees down it will flip for 180 yaw* wise BUT.. BUT who turns mothership into a nose dive
upright, right rudder goes N > E.
upsidedown, right rudder goes N > W.
Oh right -- probably; but as Marko said it's unlikely to be a problem lol
and if someone does it do hint "Get rotated"
_x setDir _orientation#0;
[_x, _orientation#2, _orientation#1] call BIS_fnc_setPitchBank;``` doesn't seem to work as if you turn 90 degrees and try and pitch up it... doesn't π
[{
{
private _orientation = _x getVariable ["KJW_CapitalShips_Orientation",[0,0,0]];
_orientation params ["_yaw", "_roll", "_pitch"];
private _type = _x getVariable ["KJW_CapitalShips_Type", ""];
_x setDir _orientation#0;
[_x, _orientation#2, _orientation#1] call BIS_fnc_setPitchBank;
} forEach KJW_CapitalShips_Ships;
}, 0, []] call CBA_fnc_addPerFrameHandler;``` full code
90 deg in what?
Roll 90 degrees, pitch up :p
i see what you mean xD
it doesnt follow the model π it goes up according to world
Think Amp's is probably the better approach even if I do not understand what's going on π
I don't fully get the matrix math either, just glad the function is there n_n
That works amazingly, thanks amp π
Time to just turn it back down from 50 deg/s π
I think that's my movement system finished aside from lightspeed stuff
I hope u dont intend that for mp
Thats alot of setVectorDirAndUp to sync
indeed
but setvelocitytransformation is effectively the same thing so not a big deal
I've done much worse on servers
And this is why 20 fps is acceptable in game xD
its only on a single object for the ship π
we're ignoring everything attached
i dont doubt there'll be network problems but π€· i'll figure it out
worst comes to worst i broadcast the values and make each client run it locally
wait no that wouldnt even work either bc setposasl is local args
oh well!
Now I just need to stop it from flipping over itself tons π
MosqueSpeakers say3d ["ArabTalking1", sleep 037]
did I write the line wrong?
I tried without the 0 as well
like only 37
LOL
ugggggghhhhhhhhhhhhhhhhhh
The second parameter for say3D is the maximum audible distance. This must be a number, if it's present at all. You can't put a command in it unless the command outputs a number.
does sleep 037 look like maxDistance to you??
XD
I get it but I also don't understand how to type it with the sleep then 
I do try to stay helpful but the whole "I have already forgotten everything we just went over" thing is becoming....less amusing
Well I do............................
The command in itself does not contain a mechanism for looping. (You can see on its wiki page, none of its parameters have anything to do with looping.) This means you have to construct the loop outside of the say3D command, using a loop command such as while. The sleep, which is designed to make the game wait until the first sound has finished before doing the next one, will be located inside the loop but outside the say3D command.
[] spawn {
myradioooo say3D ["despacito", 200];
sleep 37;
myradioooo say3D ["aaaaaaaa", 500];
};
This will make object play despacito, which can be heard 200m away, then wait for 37 seconds and then play aaaaaaaaa, which can be heard 500m away
the scream of pain after hearing despacito i see
is there an event or something for when a unit starts to target something
wth is while
I just tried something from a steam guide but I deleted some stuff off it since I thought it will work
will this loop it because I have no idea what the rest of the commands mean
||Asked in editor, but think it'd probably be fixed with scripting so deleted there||
Flak cannons are targetting infantry. I'd prefer if they- ya know- didn't annihilate infantry x3
Okay so lets imagine in cfgSounds you have sound classed as despacito and you know its 37 seconds long
[this] spawn //spawn following code in scheduled environment, so we can use sleep command, parameter is the object, you want the sound to originate from
{
//Grab object from arguments of spawn
params["_radio"];
//continue looping while object is alive, if radio is destroyed loop stops
while {alive _radio} do
{
//Make object play sound, that can be heard 200 meters away from object
_radio say3D ["despacito", 200];
//Wait while sound is playing, in our case 37 seconds
sleep 37;
//Go back to the start of the loop, check if object is still not destroyed
};
};```
use google π
https://forums.bohemia.net/forums/topic/195987-make-ai-aa-tanks-not-attack-infantry/
Is there a way to make enemy AI AA tanks not attack infantry units on the ground and strictly only attack aerial vehicles?
https://community.bistudio.com/wiki/while
Marko has a good in-depth example, but just a reminder that "wth is x" is usually answered in the first paragraph of x's wiki page.
Also "I tried the thing from the guide but deleted some stuff basically at random" is not really a good approach. Start with the example and prove it works (and understand why it works). Don't start by taking out potentially vital chunks.
Ah ok, so not an 'elegant' solution
Put it in a pit / hbarrier, or on a roof so it doesn't have angle to hit infantry.
the distance in the command is it the number after select?
oh wait wait
I got it
so it's supposed to be
actually no I didn't get it, honestly I just copy pasted the line
nul = [this] spawn {while {true} do {(_this select 0) say3D "sound01"; sleep 150;};};
and it worked, but to se the distance does it needs to be
nul = [this] spawn {while {true} do {(_this select 0) say3D "sound01"; 200; sleep 150;};}; ?
no
improper vehicle weapon/ammo config
No. You already know how to set the distance for say3D. We did it before.
Marko's example is literally word-for-word how you do it. The only thing you need to do is insert your sound name instead of despacito, and change 200 to whatever distance you want (if it's not 200).
we have already been over "how to set the distance".
I sense chatGPT 
I think he's just working badly from a bad example.
One-liner bracket spam is not a good way to learn.
I know that we went over it and I know that I remember, but this line is written differently and that's why I am unsure if it's supposed to be "sound01"; 200; sleep 150; or "sound01", 200; sleep 150;
We've been here for hours explaining every step of this though, before we even got to this example :|
well you wrong because I took it from a steam guide and I am new so I have no clue
hint: []
thank you for clarifying it and yet I still don't get it ok so what you want me to do bash my head again? sorry for not understanding
Their use of say3D is different because they are not using any of the optional parameters. They are using Syntax 1. We are using Syntax 2, because we want to use some of the optional parameters.
We've already established how to use the say3D optional parameters, and that part is not going to be any different to what we did before, because we're now working on the loop, which is outside of say3D and doesn't change how say3D works.
all those brackets are confusing me ok that's why I have no clue how the fk to write it, in my eyes (not your professional eyes which say the easy solution) it will end with a bracket inside a bracket inside a bracket and it won't makes sense
re-read what was correct, re-read the wiki - that's the good data
compare with your current code, the bad data
if you don't see it, ask for the difference
an array is a list of things:
["string", 42, { code = "value" }]
```a command can take zero, one or two arguments:```sqf
nularCommand; // a command without arguments
unaryCommand rightHandArgument; // a command with one argument
leftHandArgument binaryCommand rightHandArgument; // a command with two arguments
````say3D` is a **binary** command (`theObject say3D something`)
`something` can be either a **string** (`"string"`) or an **array** (`[elements, in, array]`)
For https://community.bistudio.com/wiki/enableSimulationGlobal
Since 2.06 the command can also be executed client-side, with a local argument.
How would that look like ? 
Normally it can only be executed only on the server.
This means it could instead be executed on the client where the argument (i.e. the object) is local.
Most things in a mission are local to the server so this isn't a massive difference, but sometimes it may be useful.
In implementation it would look exactly the same, except you don't need to remoteExec it to the server if you know for a fact the object is local to the current client.
Thanks, didn't understand exactly what "with a local argument" meant.
(no, I won't upload that to the biki)
Client: i can tell server to modify simulation of everything via remoteExec
if there are no BE filters
Shouldn't animate work on a object that is simulated globally 
It doesn't animate when no player is nearby 
what about animateSource instead
same outcome, doesn't animate.
only when i get near it 
is it on dynamic simulation?
params ["_obj",
["_range",2000,[1]]];
while {alive _obj} do {
sleep 2;
_units = [];
if(_obj isKindOf "Man")then{
_units = [_obj];
}else{
_units = crew _obj;
};
{
_aa = _x;
_aa disableAI "AUTOTARGET";
{
_x params ["_pos","_type","_side","_cost","_objt","_acc"];
_last = 0;
if ((_aa countEnemy [_objt]) isEqualTo 1) then {
if (_type isKindOf "Air") then {
if (_cost > _last) then {
_aa doTarget _obj;
};
};
};
} forEach (_aa nearTargets _range);
}forEach _units;
};
This ain't working it seems. Keeps shooting at the same spot as the thing moves.
It is but i've ran this on the server and no difference
_obj = objectFromNetId "2:75";
_obj enableDynamicSimulation false
_obj enableSimulationGlobal true;
didn't you mean _objt?
also I have no idea what that script is actually supposed to be doing
and you can use lazy eval instead of that chain of if thens
if (_expression1 && {_expression2 && {_expression3}}) then {
}
how's that supposed to help? 
at the very least you should have a forgetTarget or something? 
you can report that problem to mod authors
Looks like once the object was subject to enableDynamicSimulation you are not able to disable it and do enableSimulationGlobal 
Found it! Thanks for the input 
[_ToggleObject, true] remoteExec ["enableSimulationGlobal", 2];
[_ToggleObject, false] remoteExec ["enableDynamicSimulation", 0];
I am not a great arma coder and trying to learn as i go, apologizing in advance for not using correct terms, i would if i knew them. I found out about weights in random selection not too long ago and i'm having to edit code using them in Antistasi. I was wondering how exactly the weight values work
So for example there are vehicle categories like lightAPC, Tank etc. In one of the Antistasi scripts that handles vehicle spawns during enemy attacks, there are is an array of "weights" per 'war level' (maximum is 10) for each of these categories. So for example
lightAPC = [ 5, 10, 15, 20, 25, 30, 35, 40, 45, 50];
was what i encountered, where each value represents the "weight" or likeliness of a vehicle from this type appearing during calculation per war level. I changed it in hopes that no light APCs would get selected by the script to the following
lightAPC = [ 0, 0, 0, 0, 5, 10, 15, 20, 25, 30];
and while they are much more rare, they still show up
so apearantly this weighting is some kind of way to influence random selections, and i am curious what terms i can google to learn more about this kind of way of setting up scripts, whatever its called. I know its not unique to antistasi or arma script. If anyone can suggest me search terms that would be very welcome
and more importantly, i am trying to figure out how to give values here so i can actually achieve the result i was after. Could i for example use negative weight values to make the chance even smaller, or is there some other weight value i can set here to very simply guarantee that it will never be randomly selected?
i believe this might be called "weighted random" or "weighted random sampling"
WoT
See selectRandomWeighted for the sqf command
now regarding Antistasi itself I do not know their framework, the best to do would be to visit their Discord
oh thats cool i didnt know arma also has this present
@winter rose so what exactly do the values do
are they relative or something?
So what would happen if i changed
lightAPC = [ 0, 0, 0, 0, 5, 10, 15, 20, 25, 30];
to
lightAPC = [ 0, 0, 0, 0, 50, 100, 150, 200, 250, 300];
in terms of possible results?
would doing something like that make sense then?
there is no difference in chance here because the values are relative
and the reason why vehicles are still being selected with weight set to 0 is because something is adding to the weights elswhere in the code, making them no longer 0
!quote 6
_ https://cdn.discordapp.com/attachments/105462984087728128/1096430025504473209/image.png _
Lou Montana; Friday, 14 April 2023
it accurately answered my question faster than discord did though
and without the attitude too π
Searching 89 files for "createHashMap"
261 matches across 30 files
```Hashmaps are the greatest thing to happen to Arma 3
Searching 806 files for "createHashMap"
1170 matches across 86 files
```Through entire project, more than half of these are objective configs in SQF though
Searching 806 files for "getOrDefaultCall"
34 matches across 12 files
```Turned out to be very useful too
I need to get around to learning the uses of hashmaps.
I can't live without them any more, I even use them as function arguments, function returns, where lots of data is sent or received from the function
_target addAction (createHashMapFromArray [
["title", format["<img image='i\ico_repair.paa' shadow='0'/> %1", localize "STR_KOH_Acts_ServiceAction"]]
,["action", {isNil{call client_func_actions_doFullService}}]
,["priority", ACTIONS_TOP_PRIORITY]
,["condition", "!client_isBusy"]
,["condition_key", "service_repair"]
] call client_func_actions_hashMapToAddAction)
```Sleek `addAction` wrapper to avoid defining unwanted parameters, only define what I really need into hashmap and have the function sort out `addAction` arguments mess.
Yeah, I'm bragging 
isNil{call client_func_actions_doFullService} are you checking for return value here only, or can client_func_actions_doFullService be nil at some point? if not, this can just be isNil client_func_actions_doFullService
Its a way to have function run without interrupts since addAction actions are scheduled
π€
Interesting...
isNil { call { blabla } } and isNil { blabla } is same thing
Considering most of my mission scripts don't need to be scheduled this could be very useful to look into understanding
Huh, indeed, additional scope layer can be removed, didn't think of that. Thanks for the tip.
No way to send arguments into functions like this though, unless you manually redefine _this beforehand.
I guess I'll leave it wrapped in isNil because other actions include arguments and
,["action", {isNil{call client_func_actions_doFullService}}]
...
,["action", {isNil{true call client_func_actions_doKickstart}}]
```looks better not far from each other than
```sqf
,["action", {isNil client_func_actions_doFullService}]
...
,["action", {isNil{true call client_func_actions_doKickstart}}]
```which triggers some kind of OCD reaction or something when I look at both
GIB ANYTHING isNil CODE
,["action", {_this = true; isNil client_func_actions_doKickstart}]
```
callUnschd π
does disabling path (on specific units) will stop from Ai moving around on mulitplayer server? or do I need to use the command in the init?
disableAI "PATH" prevents AI units from moving. It works in multiplayer provided it's executed where the AI is local. A unit's Editor init field is executed on all machines, so you can put it there and be sure it will take effect. (Note: use of init fields should be done with caution on a case-by-case basis as it causes problems with some commands or use cases.)
@velvet merlin I just noticed that there is also https://community.bistudio.com/wiki/inPolygon π
To be sure command, disableAi or any other that require to be ran where object is local, or commands with global effect (so they dont run 1+number of player times), you can use if (local this) then { this disableAI "PATH" };
But sometimes global execution is desired, with eg clientside commands, like say3D
ups π€― nice thank you!
so we only need to create a polygon from the polyline. should be fairly in our case
this time
the day you start to trust chatGPT in its current state is the day you come here posting nonsense asking "why does this doesn't work?" π
Guys - would it be possible somehow to script a proper Azimuth and Elevation for an AI artillery gunner? So not just give a target to fire at, but set its azi and ele to X and Y, so a human would have to do calculations but AI would just fire the gun
I believe this is what is done behind the curtains, a fake target is given to an artillery piece and it fires in the air like that
Ace does that already.
I think he meant to change the gameplay loop, so the player has to do the calculations but then tell an AI to use them. Similar to ACE, but without directly acting on your figures.
Force setting turret elevation and traverse is complicated, the only command for it we have is lockCameraTo, and that works by targeting a pos or object, not in degrees. Someone probably could figure out a way to use that to fake it, but it'd be some pretty brutal maths
I tried with elevating turret by animation... didnt quite work
You can turn off the artillery computer on a vehicle so that a human gunner is forced to use azimuth and elevation (...and then script a way for them to know the true values of those because the displayed values are relative or some crap like that), but the AI doesn't care about that
How do I spawn an active grenade with a trigger? As if the grenade was connected via trip wire (not the actual plan, but close enough that I can get the gist).
createVehicle should do
Cool, thanks. I'll probably poke my head back in in a couple hours to make sure I got the syntax right
"GrenadeHand" is the class iirc, but I don't know if one can trigger it with triggerAmmo
I would go into detail of what I'm actually trying to accomplish, but I have too many of my players in here that it'll spoil the surprise. (Needless to say it's designed to have an air of occultism).
explosions involved? I'm in
Actually, because this may make things more exciting, how would I make it so an AI dropped a specific grenade on death? Like the old CoD Martyrdom perk.
a "Killed" Event Handler + createVehicle "grenadeHand" π
Cool.
I used something similar, spawning a grenade on a stairwell right as any player tries to climb it to deal with an MG nest. Just π§βπ³π
my question was more about programming theory than writing sqf code anyway. I dont think anyone is stupid enough to rely on current year AI to do their scripting for them
β¦you would be surprised!
thats what quote 6 is for after all
Easy way would be to use Fired EH to setVelocity the projectile, and forget the visual barrel alignment.
But isn't that gonna happen all the time? Or is there something in vehicle config that can stop it?
sorry for late response-
if you don't mind making a mod you can even fix it yourself using a config patch
aiAmmoUsageFlags and airLock control which type of vehicles they can target
ofc you might have some AI mod that does its own thing, so check without any AI mods first
ah yes. I discovered the AI will continue to autotarget. Seem that is a mod.
no not necessarily
AI targeting is a bit weird I'll admit
autotarget is not really what you think it is
Wait, so autotarget could be making it so the unit will still get the target and shoot at it after forgetting target and setting target to objNull?
well autotarget allows the AI to target something when it cannot target its assigned target. but iirc if the AI itself is the leader it gives targets to itself so it doesn't need an assigned target
it's been a while since I messed with that tho
oh uh- that could be an issue
wait-
It looks like it might be auto response sorta thing?
Is AAA targeting infantry actually a bug? IMO it would be much weirder if the AI was just sitting there in an armoured vehicle loaded with autocannons, not shooting infantry it could see
Well, even vanilla AAA will target infantry or ground vics, if no higher priority air is avalible.
true
You could set their spotting skill to 0 and then manually reveal air targets
As in spotTime and spotDistance
I wonder to what extent the AI relies on the vehicle's visual sensor component rather than simulated eyes. Maybe disabling that component (and the NV component) and just leaving them the radar would work.
Assuming it's a radar AAA anyway.
Well I am testing rn with just man units b/c debug weee
setTurretLimits above head height xD
opfor unit is autocombat false and they don't target the nato man if the nato man has simulation set to false when I forget target. I think the game is setting the opfor's target automatically in response to the unit becoming a target.
The way i did it for my mission, i had hidden radar on the map, and ai had spotting skills down to 0.
It still engaged air. But if player was stupid enough to approach it from direct front or climb infront of the turret it still razed them.
But appraching from back to plant charges was ok.
And data link enabled, set to receive and send.
Hey guys, trying to create an addAction that will then put the player into an animation and call up a timer
does anyone have any tips on where to start looking?
yes: the wiki! ^^
https://community.bistudio.com/wiki/addAction
remember addaction effects are local to the client. If you aren't MP scripting then not much to worry about.
https://community.bistudio.com/wiki/addAction
https://community.bistudio.com/wiki/playMoveNow
Dunno about the timer, but youve got several options for how to display text on screen, some more responsive to timing than others.
Quick question how would i check if player has enough space for x amount of items and not just for 1 ?
canAdd's alt syntax
@sullen sigil
π₯ βοΈ
Oh i skiped that ty.
π€«
(i realised halfway through typing i probably shouldnt answer while im this sleep deprived)
on the plus side that capital ships mod you told me was a bad idea is nearing completion π
wait, where did I say that and what is this ships mod π
the one with the pip windows
i woke up at 7am yesterday and deleted the movement function and redid it from scratch in 60 lines versus the previous 600 π
(oh nice, I love such rewrite stories ^^)
it now uses 0 setvelocitytransformation as well thank GOD
now just has target velocity and orientation variables you modify and the mod does the rest
π
^, just need spaceship instead of a hemtt and config value tweaksπ
Question Is there a better way to check if player can fit these items in invenotry then this ?
if((_unit canAdd ["ACE_morphine",2]) && (_unit canAdd ["ACE_quikclot",10]) && (_unit canAdd ["ACE_tourniquet",4]) && (_unit canAdd ["ACE_salineIV_500",1]) && (_unit canAdd ["ACE_salineIV_250",1])) then {true} else {false};
That checks if there's space for each one of those sets, but not all of them once the previous sets take up space.
hi, the text to texture procedural doesn't seem to work
i do sqf ((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,'Caveat',0.2,#0000ff,#ff0000,'aaaaaaaaaaaaa')"]; while i have an object selected in 3den
or am using it wrong?
How would i check for all those items can they fit ?
doesn't work where?
also do you use the dev branch?
on the texture. the blue background appears, but not red text
no, i don't
ah that was merged in 2.12 nvm you don't need dev
colors must be wrapped in ''
now what
what do you have now?
white plain
- check how many of these are in there (present)
- add all of them wanted
- compare if result is present + added
β¦code
calculate the total mass the items take
then check against max load of player - loadAbs
How do you getMass of a item is it getMass ?
what?
configFile >> "CfgWeapons" >> _item >> "ItemInfo" >> "mass"
what is your current code?
oh. here
((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,'Caveat',0.3,'#0000ff','#ff0000','aa')"];```
doesn't it need alpha?
this is what the wiki says:
"#0000ff7f"
so it does need alpha
this is also what wiki says
backgroundColor - in format #RRGGBB or #RRGGBBAA
textColor - in format #RRGGBB or #RRGGBBAA
i'll try with alpha, one sec
yeah just saw that one
nothing changed
code?
((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,'Caveat',0.3,'#0000ff00','#ff00007f','aa')"];```
alpha is 0, so fully transparent
how do i set it to one?
FF
((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,'Caveat',0.3,'#0000ffFF','#ff0000FF','aa')"];``` still nothing
looks like it doesn't support ''
double "" it is then
Would this be correct ?
private _canFit = maxLoad _unit - loadAbs _unit;
if(_canFit > 23.5) then {true}else {false};
use this instead:
((get3DENSelected "object")#0) setObjectTextureGlobal [0, '#(rgb,512,512,3)text(1,1,"Caveat",0.3,"#0000ff00","#ff00007f","aa")'];
no
((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,""Caveat"",0.3,""#0000ffFF"",""#ff0000FF"",""aa"")"];
``` this works too
I mean yes π
I just copied your code
my example
I copied this
I am mp scripting unfortunately
I understand, but the result differs with double decker "" or with single "
lesson learned; use this command with always double decker "". thanks for the help!
OH. right. i changed code to FF between tests
ok, i tried to run this code:
((get3DENSelected "object")#0) setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,""Caveat"",0.3,""#0000ff00"",""#ff000000"",""aa"")"];``` and got a completely transparent image, which was the desired result, since alpha is set to 00.
however, if i run this code:
```sqf
((get3DENSelected "object")#0) setObjectTextureGlobal [0, '#(rgb,512,512,3)text(1,1,"Caveat",0.3,"#0000ff00","#ff00007f","aa")'];``` the background is transparent but the letter's aren't
thanks for help! the only different is the double ""
00 vs 7f
you almost never need to do this
if(_canFit > 23.5) then {true}else {false};
_canFit > 23.5 // just return this
You may run into edge cases where total load has space but the split across containers cause things to not fit. You could check each container if that can be an issue.
ok yeah i'm dumb
I am doing it like this so it returns true or false for a coddition:
["FirstAidKit", ["CONTAINER","CLOTHES"], "Open IFAK", nil, nil, [{
params ["_unit"];
private _canFit = maxLoad _unit - loadAbs _unit;
if(_canFit > 23.5) then {true}else {false};
},{params ["_unit"]; _unit isEqualTo vehicle _unit;}],
{
params ["_unit", "_container", "_item", "_slot", "_params"];
for "_i" from 1 to 2 do {_unit addItem "ACE_morphine";};
for "_i" from 1 to 10 do {_unit addItem "ACE_quikclot";};
for "_i" from 1 to 4 do {_unit addItem "ACE_tourniquet";};
_unit addItem "ACE_salineIV_500";
_unit addItem "ACE_salineIV_250";
true
}, true, [0,1,2]] call CBA_fnc_addItemContextMenuOption;
yes, just have the comparison with no semicolon as the last line of the code block. that will return the value.
another option could be just making a weaponholder for the spill over.
Now i am bit puzzeld how to check propely:
This is my Inventory: https://imgur.com/358jpaQ
and this is stats for player: https://imgur.com/XeSMl4w
and if i check _canFit witch is 874 > 23.5 witch is always true i can open IFAK even if my inventory dont have space.
loadAbs
try
_maxLoadUniform = getContainerMaxLoad uniform player;
_maxLoadVest = getContainerMaxLoad vest player;
_maxLoadBackpack = getContainerMaxLoad backpack player;
e.g. (1 - loadVest player) * getContainerMaxLoad vest player
gives you the amount of free mass in the vest
so if you want to check if you can add an item to the vest you check if _freeMass >= _addedMass
where addedMass is just:
_addedMass = 0;
{
_x params ["_item", "_cnt"];
_addedMass = _addedMass + _cnt * getNumber (configFile >> "CfgWeapons" >> _item >> "ItemInfo" >> "mass");
} forEach [["ACE_morphine", 10], ...]
Yea i was just testing this a bit.
private
private _maxLoadUniform = getContainerMaxLoad uniform player;
private _currentLoadUniform = loadUniform player;
private _freeSpaceInUniform = _maxLoadUniform - (_currentLoadUniform * _maxLoadUniform);
systemChat format ["Max Load: %1 Current Load: %2 FreeSpace: %3",_maxLoadUniform,_currentLoadUniform,_freeSpaceInUniform];
I think i manage to make it work ty very much and Ampersand
here is code in future if somebody is interested:
["FirstAidKit", ["CONTAINER","CLOTHES"], "Open IFAK", nil, nil, [{
params ["_unit"];
private _freeMassVest = (1 - loadVest _unit) * getContainerMaxLoad vest _unit;
private _freeMassUniform = (1 - loadUniform _unit) * getContainerMaxLoad uniform _unit;
private _freeMassBackpack = (1 - loadBackpack _unit) * getContainerMaxLoad backpack _unit;
private _addedMass = 0;
{
_x params ["_item", "_cnt"];
_addedMass = _addedMass + _cnt * getNumber (configFile >> "CfgWeapons" >> _item >> "ItemInfo" >> "mass");
} forEach [["ACE_morphine", 2], ["ACE_quikclot", 10],["ACE_tourniquet", 4],["ACE_salineIV_500",1],["ACE_salineIV_250",1]];
if((_freeMassVest >= _addedMass) || (_freeMassUniform >= _addedMass) || (_freeMassBackpack >= _addedMass)) then {true} else {false};
},{params ["_unit"]; _unit isEqualTo vehicle _unit;}],
{
params ["_unit", "_container", "_item", "_slot", "_params"];
for "_i" from 1 to 2 do {_unit addItem "ACE_morphine";};
for "_i" from 1 to 10 do {_unit addItem "ACE_quikclot";};
for "_i" from 1 to 4 do {_unit addItem "ACE_tourniquet";};
_unit addItem "ACE_salineIV_500";
_unit addItem "ACE_salineIV_250";
true
}, true, [0,1,2]] call CBA_fnc_addItemContextMenuOption;
this is a bit messy tho 
and it's not exactly correct
e.g. if an item needs a mass of 100 and your total backpack, vest, uniform load is 101 it doesn't necessarily mean you can fit the item
you need to have 100 units free in at least one container
Couldn't get the grenades to spawn so I resorted to just making them catch fire on death instead
ah wait you're checking per container nvm
also a couple of notes:
if((_freeMassVest >= _addedMass) || (_freeMassUniform >= _addedMass) || (_freeMassBackpack >= _addedMass)) then {true} else {false};
you can just write that as:
(_freeMassVest >= _addedMass) || (_freeMassUniform >= _addedMass) || (_freeMassBackpack >= _addedMass)
for "_i" from 1 to 2 do {_unit addItem "ACE_morphine";};
for "_i" from 1 to 10 do {_unit addItem "ACE_quikclot";};
for "_i" from 1 to 4 do {_unit addItem "ACE_tourniquet";};
use the other syntax
it's faster
ah wait it doesn't have any other syntax π
something did tho? 
So i can just have this as return?
(_freeMassVest >= _addedMass) || (_freeMassUniform >= _addedMass) || (_freeMassBackpack >= _addedMass)
yes
Cool didnt know that i can return it like that.
that returns a bool anyway
your if was taking a bool and returned the same bool 
okay im having some issues.
I am trying to make it so that any player within trigger area gets punished
but I cant seem to figure out how thisList is suppose to work
thisList is "current units in the area matching the trigger's conditions"
well if I say, wanted damage 1 to be applied to units in a trigger, how may I do this?
I tried
thisList setdamage 1but that gives no luck
how do you do it for any array?
that's because setdamage takes an object and thisList is an array
use forEach
ah
it would be something like:
{
_x setDamage 1;
} foreach thisList;
ahhhh
this will return false if the contents can't fit into any single container, but could fit if split across containers, fyi. not really a big deal, and making players do the inventory tetris is probably better anyway.
it's easily solvable, but kinda slow
_canFit = true;
{
_x params ["_item", "_cnt"];
_mass = getNumber (configFile >> "CfgWeapons" >> _item >> "ItemInfo" >> "mass");
for "_i" from 1 to _cnt do {
if (_freeMassVest > _mass) then {
_freeMassVest = _freeMassVest - _mass;
continue;
};
// do for other containers too
...
// then finally
_canFit = false;
break;
};
if (!_canFit) then {break};
} forEach [["ACE_morphine", 2], ["ACE_quikclot", 10],["ACE_tourniquet", 4],["ACE_salineIV_500",1],["ACE_salineIV_250",1]];
_canFit
What's the main difference between post and pre init using cba config event handlers? As in for use cases.
Most mods I open for example seem to favor post init. So what the particular reason?
Post init is called once all objects are created in mission.
Pre init happens before that
In a nutshell, if you need to do something with objects use post.
Ah ok
I used my audio files today in a mission in the unit we have in arma 3 (some mosque sounds etc.) when I tested it, it sounded pretty quiet, I used audacity and level up the sound, it sounded perfect, but when we ran it on our server it became pretty damn loud, anyone knows why?
Diffrent sound effect settings?
You changed volume in description.ext?
Always test em with sound effect turned up to normal levels.
don't you have the volume set to 5 + have multiple sound sources at the same time to increase the volume too?
yeah but on my end it didn't real raise the volume maybe it's reacting differently when it's on a server?
It's capped at 5 is it?
Yes but thats very loud.
Also as Lou said perhaps your script played it multiple times all at once. If sound is played twice from same source it amplifies
depending on where you wrote your code, it might multiply by the amount of players
e.g init fields
well I just used the playSound3D in the init
sorry not playsound
Say3d
ah that's interesting, so I should write it in the description? whatever the command is
say3D is local effect, so that shouldn't be that
well, playSound too
Uhm weird, I will try again tomorrow, I will add the original files without amplifying the volume, but my main question is how come in the editor when I start "play in mutliplayer" it sounds normal but in the server it's louder? if say3D isn't the issue really
I always use play in mutliplayer, but when I listened to it it was pretty quiet, but when we added the mission file to our actual server
it was louder
makes sense?
ah ok, Eden MP preview vs dedicated server
I have to say "no idea" for now
what's your code?
remoteExec?
Awe π¦
I will try again tomorrow with the normal level sounds
Uhm no its
I actually donβt remember atm lol
Iβm in bed but itβs something with say3d, file name, distance (only some of them) and sleep
Wait sorry by code you mean like a code file?
My brain isnβt working at 4 am lol
and even with just one person starting the mission on the server, is it louder?
anyway, let's see that when fully awake
Yeah that would be a better idea haha
But uhm no itβs was just louder in general, I went straight into zeus to check and it was louder, maybe setting the volume on the description file does not affect in the editor but only in a server or something
does anyone know if there is a public retractable turret script? i saw one in a rimmy video and wanted to use it for an op that my unit it doing
what's that?
where the turret slowly pops up out of the ground
turret, like an M2?
anyturret
like an M2
not like "a tank turret" for example
well you can script it with setPosATL
regarding an existing script, I believe Google will be of more help
ok thanks
Can setpos the tank too if you want tank turret to pop up 
There is a civilian population module but it doesn't show all the civilian factions I have, is there anyway to change the loadouts from the ones I CAN use? (uniforms and whatever)
some OFP mods did that ^^
they disabled the driving seat of course, but the whole body model was below the ground π
There is documentation
https://community.bistudio.com/wiki/Arma_3:_Civilian_Presence
Maybe only the mod itself can, I do not guarantee CfgVehicles working in description.ext here (but perhaps)
I'm experiencing a weird issue with pboprojec
get a missing inheritance class error for line 34, but when I comment out this line (line 31), the error goes away: class EventHandlers {init = ""};
class EventHandlers {}; seems to work, but why shouldnt an empty init?
Hi, I am using the following to detect enemies within player's range of 350m:
arraytarget = player targets [true, 350]; // enemy targets in 350m
How can I sort the received array by distance to player (from smallest to largest?)
BIS_fnc_sortBy may help
Tyvm. This should work
I am debating on how to make static gunners. All in seperate groups or 1 massive group?
maybe one group because of the group limit and I think they are more dangerous in single group as they share targets...
setCaptive?
nope
must be something weird with joining groups and stuff?
oh wait-
wait then why is it working at all? xD
weird-
the group always determines the unit's side
yes, but why is there a group with an opfor and a civilian in it
Does anybody know how i can reliably retrieve the positions of the wheels of a vehicle? or axis would be even better
maybe the unit is wounded "UNCONSCIOUS"
hey guys, how would I be able to get myself some ambient explosions in a certain area
i tried say3d but it hasn't worked
no
he's perfectly fine. both are
What effect are you trying to achieve?
Isn't it's title just "BattlefieldExplosions", not "battlefield_explosions1"?
Oh :x You're talking a custom sound effect, or one from the game already?
as GC8 said one of them is captive
yeah these
No, that isn't possible.
the group marker is also civilian
there's no other way to have a civilian in a non-civilian group
I see it red so it's OPFOR
Yes. Basically, I was changing group so quickly, I think I out paced the game.
You can also use config path to use current sound
playSound3D ["A3\Sounds_F\sfx\alarm_independent", player]; //Β no sound
playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player]; //Β alarm
you can't out pace the game
eachFrame EH that switches the unit's group?
thanks, i'll try it out
also how would i be able to loop it?
Prisoner's method also works, though looping for either method is gonna take some scripting.
I'm having problems with object rotations, vectors and terrain normal. I have a an object that I have rotated at custom angles: how can I add a surface normal to the rotation so the object keeps it's rotations, and align along the terrain normal?
Well, see- I am confused how they're being made to be opfor. If I'm correct they should actually be civilian, b/c I forgot something.
first set the direction, then set the vectorUp
unit spawner makes them be apart of an initial civilian group, then adds them to a provided group. But I accidently am providing it with grpNull, so-
well maybe they're renegades?
How the HECK are any of them opfor and not just civilians xD
ooo one sec
this is really weird, some of the first code I ever wrote for arma but
ALARM_LoopSound2 = {
params["_CurAlarm","_pos"];
while { _CurAlarm select 0 } do {
_source = _pos say3D [(_CurAlarm select 2),(_CurAlarm select 4)];
waitUntil {(isNull _source || not (_CurAlarm select 0))};
if((_CurAlarm select 0)==false && not isNull _source)then{
deleteVehicle _source;
};
};
};
The issue is what to set the vectorUp to. I am calculating a new up vector as I'm rotating a whole composition. It works perfectly on flat ground. However on angled ground the objects still behave and align as on flat ground, as Im still using my new up vector. Simple terrain normal + new up vector does not give a good result.
for multiple alarms, but basically, say3D, then wait until the say3D is nil.
i kinda wanna redo the code but then this works so eh x3
a composition can span multiple terrain grids tho
if you attempt to align the parts with each normal they'll get misplaced
I realize, ignore the composition part. I have a vectorup, how do I add the terrain normal to it so the object "inherits" the terrain rotation and then adds it's own rotation to that.
make a rotation matrix
_vectorSide = _vectorDir vectorCrossProduct _surfaceNormal;
_matrix = matrixTranspose [_vectorSide, _vectorDir, _surfaceNormal];
multiply that by each vector and they'll get rotated the way you want
also _vectorDir and _surfaceNormal must be perpendicular
_vectorDir is the object's vectorDIr?
if they're not make them perpendicular
no it's the new direction vector
and must be perpendicular to surface normal
if you're not sure if they are, you can make them perp as follows:
_vectorSide = _vectorDir vectorCrossProduct _surfaceNormal;
_vectorDir = _surfaceNormal vectorCrossProduct _vectorSide;
I have a _newVectorDir and and _newVectorUp calculated. Those are used to orient the object in the new position and they work fine. It's the terrain aligning what throws me off.
just keep the vectorDir
e.g. if you want to rotate the composition by 40 degrees:
I got the composition rotation figured out.
_vectorDir = [sin 40, cos 40, 0];
LoopSound goes through a list of alarms, loopSound2 is called from there and does the while seperately to check if the alarm is still active and if the alarm needs to be repeated.
anyway back to my original thing :P
Its the rotation of individual objects in relation to the terrain normal, in a way so they keep their vectorUp, but instead to the flat ground they align to the normal.
that's what I'm trying to explain to you 
me dum dum, vectors hard
Sorry about that. I just have problems wrapping my head around the vector stuff.
combination of selectionPosition and modelToWorld
well to summarize:
- calculate the new direction of the whole composition (where the whole composition will face)
- calc the surface normal
- use this:
_vectorSide = _vectorDir vectorCrossProduct _surfaceNormal;
_vectorDir = _surfaceNormal vectorCrossProduct _vectorSide;
_matrix = matrixTranspose [_vectorSide, _vectorDir, _surfaceNormal];
- calculate the new pos, dir and up for each composition part as follows:
_pos = flatten (_matrix matrixMultiply _partRelPos) vectorAdd _compositionPos;
_dir = flatten (_matrix matrixMultiply _partRelDir);
_up = flatten (_matrix matrixMultiply _partRelUp);
_compositionPos is where you want the "core" (reference) object of the composition to be
_partRelPos is the position of each composition part relative to the reference object
yes
did you mean then or than? 
its actually the modelspace coordinates im interested in, thx i'll check it out
@little raptor
So I have this:
_orgDirVector - the original vectorDir of the object
_orgUpVector - the original vectorUp of the object
_orgRelPos - original position in relation to the composition anchor
_spawnPos - position that the new composition is spawned on
_compDir - the new direction that the new composition will be roated to
_newVectorDir - a new vectorDir calculated by rotating the whole composition around it's anchor point
_newVectorUp - new up vector also calculated for the rotated composition
The _newVectorUp _newVectorDir are calculated properly and work fine, on the flat ground.
Now I'm trying to figure out with of my variables are supposed to be in your code.
_vectorSide = _newVectorDir vectorCrossProduct _surfaceNormal;
_vectorDir = _surfaceNormal vectorCrossProduct _vectorSide;
_matrix = matrixTranspose [_vectorSide, _newVectorDir, _surfaceNormal];
?
_newVectorUp - new up vector also calculated for the rotated composition
The _newVectorUp _newVectorDir are calculated properly and work fine, on the flat ground.
well something that works fine on the flat ground should work everywhere
but if they don't something else is wrong
_newVectorUp - new up vector also calculated for the rotated composition
this part is a bit confusing for me tho
it's because I'm just rotating them around with this:
private _newVectorDir = [_orgRelativeDir, _compDir,2] call BIS_fnc_rotateVector3D;
private _newVectorUp = [_orgRelativeUp, _compDir,2] call BIS_fnc_rotateVector3D;
I'm not taking the terrain normal into consideration
didn't you want to align it with the surface normal? if so the new vector up should be surface normal
_obj modelToWorld (_obj selectionPosition "some memory point")
Yes, but also there are some objects that were posed in specific ways, like folded chair propped against table. If I just surface normal it, it will just lay flat on the ground
Is there any way to force vehicle to stay in one place without attachto? I want to make crashed heli but with attachto rotors are spinning no matter if engine is on or if it have fuel
well that's the thing. what I wrote for you rotates everything the same way
something like that
Ah
are you simply trying to rotate the composition along the Z axis? (and then align with normal ofc)
or do you want other axes too?
Z axis only, but I want the objects to align to the ground, while preserving their poses.
then use this for _newVectorDir
_vectorDir = [sin _compDir, cos _compDir, 0];
_vectorSide = _vectorDir vectorCrossProduct _surfaceNormal;
_vectorDir = _surfaceNormal vectorCrossProduct _vectorSide;
_matrix = matrixTranspose [_vectorSide, _vectorDir, _surfaceNormal];
{
....
_partFinalPos = flatten (_matrix matrixMultiply (_orgRelPos apply {[_x]})) vectorAdd _spawnPos ;
_partFinalDir = flatten (_matrix matrixMultiply (_orgDirVector apply {[_x]}));
_partFinalUp = flatten (_matrix matrixMultiply (_orgUpVector apply {[_x]}));
_part setPosWorld _partFinalPos;
_part setVectorDirAndUp [_partFinalDir, _partFinalUp];
} forEach _parts;
@thorn saffron btw I forgot one thing. the vectors must be in [[x], [y], [z]] format for matrix multiplication
fixed the code (needed an apply {[_x]})
if you make the compositions yourself store the vectors in this format so you don't have to do apply when you spawn them
you sure?
what does attachTo have to do with object animation?
ah ha! auto man static weapons is now working in my liberation thingy :P
Is there a script to only add weapons from a specific mod to the virtual arsenal?
Want to add the RHSUSAF weapons and gear to an arsenal without having to go through and choose each one separately
thats the best part - i have no idea if anything. But i tested it and in VR and its like i said. Rotors wont spin if they were not spinning before attachto and wont stop if they were before
do you use the attachTo command yourself?
nope, from trigger
no other function?
I meant do you use the command?
doesn't matter where
only setVectorDirAndUp
Ch-67 Huron
no functions then i think
literally just tried it and its rotors aren't spinning
ah so it spins if it was on before?
looks like you're right
now is it a bug or a feature
I guess neither
attached objects don't get simulated anymore
so the engine state never changes
but I guess it's worth making a ticket nontheless
yes
use setVelocityTransformation every frame
tho why do you want to make it stay in place?
a crashed heli doesn't move 
probably can make it only run for a second or two if its to prevent crashed vehicles bouncing from impact
well because its in the ground a bit
exactly
well ill just work it around and teleport it a bit above ground with engines off
this will have to do
you can also just create a simple object in its place, or disable its simulation
another way is moving the ground using setTerrainHeight 
thats where it gets tricky - players and crew are inside
well you can attach the players to the simple object 
and set their animations
it'll look as if they're actually sitting in it 
(tho they can't move their heads)
actually for the head problem you can use setVelocityTransformation
okay so ive been thinking for a good ol while now and tried something different cause the battlefield sounds werent the greatest
{
bomb = "O_GBU12_LGB" createVehicle (getMarkerPos (selectRandom ["mortar", "mortar_1", "mortar_2", "mortar_target_1", "mortar_target_2"]));
sleep 20;
};```
tried this, works without the "while true do" but doesnt with it
whenever loading in i get an error saying "error suspending does not work in this context"
because you need to spawn it
tried with your code again, still doesnt work
how would i do that
[] spawn {}
0 spawn {
while {true} do
{
"O_GBU12_LGB" createVehicle (getMarkerPos (selectRandom ["mortar", "mortar_1", "mortar_2", "mortar_target_1", "mortar_target_2"]));
sleep 20;
};
};
for whatever reason still doesnt work
might be something wrong on my end
no error this time though
Hi fellas, quick question
I've been trying to use setAnimSpeedCoef to change move speed on a unit, and it kept getting reset. Tracked it down to being ACE Advanced Fatigue doing it (whenever its disabled, I can use the function just fine)
Is there a way to selectively disable ace fatigue on units, or is there another way to solve this?
because there's no such thing: O_GBU12_LGB
no
you can force disable it tho
(for the current local player)
if (!GVAR(enabled)) exitWith {};
so you can just do ace_advanced_fatigue_enabled = false
it won't affect the user's CBA settings
As a mission CBA setting or?
Since I want fatigue enabled for everyone else, except one unit (i.e. me, the zeus)
then just run that where your zeus player is local
one more thing, how would i be able to make the sleep time random (for example from 1 to 15)
yes it'll only be applied to the current mission, if that's what you meant
it's just a code that changes a variable
Ah no, I thought you meant put that in the cba_settings.sqf file of the mission, since I was aware of that already lol
initPlayerLocal? or somewhere else?
sleep random 15
thank you very much
I meant sleep random [1, 8, 15] 
ah
or alternatively sleep (1 + random 14)
yes
well that'll execute for everybody
(I'm aware, I meant executing that in an if checking something like if (player == zeus) )
in that case it can work. or just put this in the Zeus player's init:
if (local this) then {ace_advanced_fatigue_enabled = false};
Would that work though? Aren't units placed in the editor global when loaded in MP? Or am I just wrong?
that's why it has local this
i.e. only execute the code where this unit is local
which obviously is on the PC that claims the Zeus spot
Tried it, init executes (hint that I put there to test shows up), but it doesn't disable the fatigue system
what if you add some delay?
Before or after setting the setting?
if (local this) then {0 spawn {sleep 1; ace_advanced_fatigue_enabled = false}};
Thanks, let me test it out
ah wait it checks the setting before mission is initialized 
That ought to do it, since it still works if I just disable it through the CBA settings
Fugg, seems like there's nothing then
actually this is in postInit 
I tried it, and it didn't work, so its probably just the case that it gets overwritten
or I'm just wrong
Β―_(γ)_/Β―
what if you try this:
if (local this) then {["CBA_settingsInitialized", {ace_advanced_fatigue_enabled = false}] call CBA_fnc_addEventHandler};
wait
ok fixed
Wilco, 1 sec
You're the GOAT, that did it, thank you so much:D
np
Although I really hope this doesn't break something in my mission lmao
Nah, not the case:)
Thanks again
Is there a script to only add weapons from a specific mod to the virtual arsenal?
see the note here:
https://community.bistudio.com/wiki/BIS_fnc_addVirtualItemCargo
:S probably not going to work for my needs as it seems everyone is using different names for their wheels ...
then do a check through wheels class?
Good morning ! Quick question: if I add a Cfg RemoteExec.hpp in a pbo of one of my mods, are remoteExec accepted in the multiplayer server?
Finally some worth opponent to good morning in a morning in this Discord! :D
Basically yes, your Mods' configuration can be overwritten by description.ext. On the other words, your Mod can set the default state
planes and choppers don't seem to care about the wheels class
which are the types of vehicles i need this for. for ground vehicles i suppose it works
imo there is no way to do it then
what i was afraid of, oh well at least i tried haha
i can still do some sort of guestimation based on bounding box and just use a random point for the wheel axis
Mine ammo being created by Put doesn't have any init EHs, right?
projectileCreated?
oh! 2.10. Will try <3
Is there a way to replace or remove (hide) the Support Module Icons once sync'd to a player?
So I'm familiar with creating editor modules in a mod..
But Is it possible to add editor modules from inside the mission folder? For testing without having to restart the game on every change/repack mod pbo? Or just a way to make the process of making changes less pain?
for scripts either put the file in the mission folder or use filepatching to live load changes.
for configs, use diag exe to live merge changes
Would you be able to filepatch a whole pbo? Like for testing a mod? If so, could you explain that a little more?
That's exactly what I needed, thanks!
I never knew about diag exe
I would be interested in hearing more as well, if what j3ff says is possible
if !(local _vehicle) exitWith {nil};
is this fine to do with handleDamage, or would you still to return a damage value?
Found an old dedman thread pointing to this. It's a little unclear in a few spots but yes it's possible
https://community.bistudio.com/wiki/CMA:DevelopmentSetup#Process
is there a way to do an animDone EH for objects (doors for example) ? 
If done in top scope, exitWith value will be ignored because top most scope in event handlers has to return something, you can't break it.
player addEventHandler ["HandleDamage", {
if(true) exitWith {0};
1;
}];
```This will never apply any of the damages, not `0` not `1` and will just use engine default calculated damage
I will take a look, thankyou!
is it possible to run a script on server startup?
i want to run this script: ```0 enableChannel false;
1 enableChannel [true, false];
2 enableChannel false;
3 enableChannel false;
4 enableChannel false;
5 enableChannel false;``` when my server starts
so i dont have to do it every mission
Not sure if I follow.
I think to remember the engine will always apply something with HD yes.
If you have stacked HD for example not sure how that nil returns affects anything.
Your exitWith sample should apply no damage due to 0. While Suma/Ondra said, exitWith behaviour is "undefined"/not guaranteed, I'am not aware of any case it doesnt work to have a function return to the value from the the end of the exitWith statement scope.
server side mod
cfgFunctions
postInit function (or with some extra spawn+sleep. you need to check when enableChannel exactly needs to be set)
You can't exitWith top scope that engine calls as an event handler
how would i use that?
player addEventHandler ["HandleDamage", {
if(true) exitWith {0};
1;
}];
Means that this scope was broken out of and its result is nil, there is no higher scope to use 0 in as return
player addEventHandler ["HandleDamage", {
call {
if(true) exitWith {0};
1;
};
}];
```This on the other hand will make player invincible and always set damage to 0
Because EH function ended with return of call which is 0
well i guess we use to call a function within and circumvent that then
will check if we have anything directly in the top scope
Or wrap your whole code in if(local _this # 0) then {
player addEventHandler ["HandleDamage", {
if(local _this # 0) then {
// Anything you want here, including exitWiths
};
}];
As there is no else, event handler will return nil and use engine behaviour
returning anything on non-local entities in HandleDamage doesn't do anything anyway (it can fire on non-local due to bugs)
if i ran the script for every mission would it work?
using the debug console or the init.sqf
Hello, you can use initServer.sqf
You can look that if you want other information about file init https://community.bistudio.com/wiki/Event_Scripts
What is the command to make a Helicopter landing on a landing pad and unload the passengers incl. the player (pilots stay in)?
_wp setWaypointType "TR UNLOAD"; if you want to use waypoints. dont know about landing pad in this case. just put the landing pad on wp pos
then there is https://community.bistudio.com/wiki/land
Hmm, it seems it does not work if the group leader is the player?
i think wps are for AIs only, not sure
Ok, tks
I have inherited a rather sizable pile of SQF code in a mission framework, and I've been wondering if there is a way to 'profile a whole mission', in the same way cProfile/pprof etc work for general purpose languages. My wishlist would be to have it run alongside a 1h-2h mission with tolerable impact, and then at the end I can see which mission-side scripts ate the most CPU time (or strangled server FPS the most). Ideally also telling me if the framework code is the issue, or just the humongous modpack. I have heard of ArmaScriptProfiler, but I dunno if it can do what I am looking for
This is just about HD/the EHs that do return something right?
Not sure how good the logging options with ArmaScriptProfiler are - in general probably the best there is.
May depend on amount of scheduled vs unscheduled code is in that mission framework.
Next that is the native, but largely very basic https://community.bistudio.com/wiki/Performance_Profiling and https://community.bistudio.com/wiki/diag_captureFrameToFile
Probably for both you need to parse/convert the output to a format to be able to visualize it with some third party software
that said, usually more important than scripts/functions, are the amount of units, groups and other entities. especially about of vehicles
how much of that is simulated permanently vs temporary (dynamic simulation, unit caching, dynamic spawning, etc)
and with mods its about how draining the assets (models/textures) and the terrain are
best search for server side mods, and learn from their setup. in the BI forum there used to be a few samples at least
thanks, kju, I will take a look into those, then
What is the command to make an AI unit throw a smoke grenade please?
Hello, is it possible to attach a createSoundSource to a building?
Grenades don't have their own command - they're magazines used with the special Throw weapon, which is built into the unit. You need to make them fire their Throw weapon, using the muzzle for the appropriate smoke grenade type (e.g. "SmokeShellGreenMuzzle"). So you need a fire-type command that can choose weapon and muzzle.
is it possible to rename the variable name of a unit which was set in the editor, mid-scenario?
No
Why would you rename it?
you could alway do
myNewVarname = myOldVarName; but that doesn't make much sense.
There is also https://community.bistudio.com/wiki/setVehicleVarName
ah okay thanks i will try this
Still a bit confused. Does this allow the AI to throw a certain type of grenade? I try to throw "ACE_HandFlareRed".
Good afternoon everybody
question about the civilian presence module
I checked the wiki and I noticed you can add loadouts from other mods (CUP civilians for example) but I did not see anything about custom loadouts (the one you make on ACE arsenal for example) is it possible at all?
yes, and there are few ways I reckon
easiest would be to create a bunch of custom loadouts in mission config and then use the example for CUP units but replace CUP classes with classes you have made
other would be creating your own units through a mod and then adding them to your module through everything that's in "Expanding module" section (except new terrains)
Yeah I think I will do that, it's for the long term anyways so why not, thanks!
I am using:
(units group player select 1) addMagazine ["B_IR_Grenade", 1];
(units group player select 1) fire ["SmokeShellMuzzle", "SmokeShellMuzzle", "B_IR_Grenade"];
It's not working. What am I doing wrong?
From Wiki
In Arma 3, as of version 1.76, examples 2 and 3 in the section above for smoke grenades are no longer working. As a workaround (throwing green smoke grenades for example), you can use:
[_soldier, "SmokeShellGreenMuzzle"] call BIS_fnc_fire;
AH, that's the issue
Got it
But how can I find out the muzzle of a certain grenade. Eg. "ACE_HandFlareRed".
Thank you. Maybe I am too stupid but I still can't make it work. Don't know which muzzle I have to use for ACE_HandFlareRed.
https://github.com/acemod/ACE3/blob/master/addons/grenades/CfgWeapons.hpp
Ace_HandFlare_RedMuzzle
does hideobject work on them at all?
no
create an invisible helipad
use the land command to make the heli land once it's above the landing pad
check in a loop if heli has landing using this condition: getPos _heli#2 < 1
disembark non-drivers: crew _heli - [driver _heli] apply {doGetOut _x}
Arma Script Profiler is useful for checking the performance of unscheduled scripts
I'm gonna guess your framework is all scheduled stuff
May thanks. May I ask how you found this? I did not see it on the Ace page.
Many thanks. I will give it a shot. What also works is:
{unassignVehicle (_x); doGetOut _x} forEach units group player;
The ACE Github page allows you to browse the full file structure of the mod. I just went up one level, into the grenades folder, and clicked on CfgWeapons.
- it's also visible in the left sidebar
that disembarks everyone in player's group
including the driver
I did setCaptive true;
Tyvm!
you can also find it in game using a config search (look for weapons that can fire that mag/magwell)
all throwable muzzles are in: getArray (configFile >> "CfgWeapons" >> "Throw" >> "muzzles")
I think after that you can just use the compatibleMagazines command 
yeah it works:
compatibleMagazines ["Throw", "HandGrenade_Stone"]
Brilliant, thanks a lot!
hey I am creating a faction now with alive, some time when I move between units to look that everything is ok, It changed to the original loadout of the unit I am modifying, why is that?
wait, I think I am actually modifying a unit and did not create a NEW unit ffs smh
Would anyone know why particlesource createvehiclelocal is creating on top of player? standby for sqfbins
why not manually use setPosXXX?
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
ASL may have it below terrain/objects, why would you have a ship explosion from crashing into terrain under terrain? 
so?
adjust your position
you're using modelToWorld (should be modelToWorldWorld for ASL), which is relative to model
it doesn't care about terrain
yes, it returns agl. waituntilandexecutes wait until its <= 0 agl so it crashes 
setPos is just a broken command
i mean, i can try asltoagl but π€·
oh the function is already called hang on
so the function is called when criteria is met so it doesnt matter
so long as im consistently using asl right
gotcha
same problem
changed to modeltoworldworld and to setposasl, no dice
no dice as in?
is _obj1 the player?
no, capital ship object. pos is different to player
verified with systemchatting it -- as well as _pos from the destroyship part
setParticleParams is using player 
...buh
serves me right for not breaking lines
should just be able to change all that to _obj1 without issues then
or just objNull actually as the ship's moving π€
meh, i'll figure it out -- thanks lol
Question is there a way to set Vision Mod ?
Unit.
_unit action ["nvGoggles", player];
Is there any way i can set thermal vision mode ?
do they have thermal vision nv
yea
take a look at that page
i cant find anything but could be blind
second param could be vision mode string or something but i doubt it
I am looking for the most efficient way to test if a unit is inside a building. Is it best to use calls to lineInterSectsSurfaces but insideBuilding? Is one of these faster or more/less reliable?
read the page
insidebuilding is engine driven but poorly configured modded buildings may not work
insideBuilding is likely to be faster, but does have some cases where it might not detect a unit that seems to be inside a building. Its detection is based on whether the unit is on a surface configured as interior, so some open-bottomed buildings won't be detected.
Using raycasting is likely to be more reliable, but since it requires a lot of moderately expensive checks, it will be slower.
Thanks - for this application which is for porting mission layouts as SQF raycasting should be fine.
KJW_CapitalShips_Ships = if (isNil "KJW_CapitalShips_Ships") then {[]};
KJW_CapitalShips_Ships pushBack _shipHelperObject;
publicVariable "KJW_CapitalShips_Ships";``` seems to be causing the `KJW_CapitalShips_Ships` array to be getting undefined when run after the array has been emptied of one object? 
oh, the if statement seems to need an else {kjw_arr};. seems like a bug..?
why?
as its making the variable nil if the if condition isnt met
it makes variable nil when you ask it to make variable nil
if (isNil "KJW_CapitalShips_Ships") then {[]} else nil
yeah, im not doing that -- without the else it's nilling it 
if kjw_capitalships_ships doesnt exist return [], else dont do anything
thats what erm
either lou or leopard said too
if (isNil "KJW_CapitalShips_Ships") then {KJ_CapitalShips_Ships = []};
i had been doing that (else variable) previously but one of those two told me it wasnt needed 
i feel like thats what would make intuitive sense too rather than this which is probably what happens in the engine or w/e if there's no else specified
you're explicitly assigning return of if to variable π€·ββοΈ
Posted on May 19, 2022 - 01:11 (UTC)
When using if to assign values to a variable, if you not have an else block it is treated as nil and returned, setting the variable value to nil. A3 2.08.149102
https://community.bistudio.com/wiki/if
pretty sure neither of us did. I didn't for sure
must've been lou then but can't find it in search 
i want to tell him hes wrong
lou you are wrong
oh fuck no youre not i didnt read it properly the first time either 
thats embarrassing whoops
sorry for the ping too
No.
good. π
ive changed it to what you suggested now
oh no, it works!
ive nested 5 cba waituntilandexecutes because i refuse to use the scheduler for this so working probably isnt the word i'd use
does anyone knows if the comment "Must be executed on all clients to work properly in MP" found here https://community.bistudio.com/wiki/setAnimSpeedCoef still stand true? It says global argument, local effect. So the server changing some Ai's animation speed coef should be updated on the clients as well, right? Or do I need to remoteExec it?
local effect
do I need to remoteExec it?
yes
Quick question how would i make a simple Jagged Array or MutliDimentional Array or how ever is called.
basicly array of arrays something like this:
[
["....","...","..."]
["....","...","..."]
]
for what?
I just wonna learn how to make a Jagged Array in arma 3.
[
[1,2,3],
[1,2],
[1]
]
Ok lets say i have x amount of players is there a way to get me a gear of each player in seperate array ?
allPlayers apply {getUnitLoadout _x};
non-apply version:
_loadouts = [];
{
_loadouts pushBack getUnitLoadout _x;
} forEach allPlayers;
and if you want to store more information per element:
allPlayers apply {[_x, getUnitLoadout _x, "someOtherStuff"]}; // each array element is [player, playerLoadOut, someString]
Oh shit i didnt know you can do that with apply i was thinking i need neasted loop or something to get this but no this is much simpler thanks.
I closed it by accident π’
It's worth the effort. Ask again if the process gives you trouble.
Thankyou!
Im trying to make a vehicle explode whenever a player enters. I assigned the vehicle the variable car_bomb, currently im doing this to blow it up:
initServer.sqf
{
while { alive car_bomb } do {
if !(_x != vehicle _x) then {
sleep 2;
} else {
vehicle car_bomb setDamage 1;
};
}
} forEach allPlayers;
But im assuming this works if the player enters in ANY vehicle, right?
any possible way to check only for car_bomb?
Specifically; if !(_x != vehicle _x) then {
yes
use GetIn event handler instead
car_bomb addEventHandler ["GetIn", {
_this#0 setDamage 1;
}];
no need for any loop
Thanks!! i was looking for the event but i couldnt find in the wiki
so i ended up doing a loop
π
btw, what does the #0 do? Im asumming it is checking the item 0 of an array?
it selects item 0 yes
so it would be #0 -> vehicle #1 -> player?
no. #2 is the unit that got in
this addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
}];
ok
I'm trying to find a way for illegal items to be deleted from your loadout if the arsenal you are loading them on doesn't allow them.
For example, let's say I don't have any NVG allowed on said arsenal. If someone kills an enemy with an NVG and picks it up, then saves a loadout with said NVG, he'll still have it. I want that NVG to be gone upon loading the loadout, as it is not ''listed'' on said arsenal. Any tips?
Top of my head nuclear option, add an inventoryOpened EH to each player character that checks for and deletes the items on a black list.
Uhhhhh I don't really know what that is. Don't really know much scripting myself
and if I'm getting that correctly, I'd have to make a blacklist with every single item in the game that I don't wanna allow... how would I go about doing that?
If you're just talking NVGs, thatd be easier, but if you want to erase specific items, you're gonna have to make the list of items you don't want players to have (Alternatively, items they're allowed to have) and operate with that.
got it
Is there any way to see if a user is running the game on the profiling branch of arma?
Hello, yes with mod. you run your script when the game launches and you wait if you find display of profiling
Could you explain?
I tried using productVersion but that doesnt differentiate between stable and profiling
what for?
Some GUI elements break when on profiling, so I want to give a warning to player if they are on profiling that some elements may not show correctly
ah 
am i completely bruggin (again) or is there an engine command for finding the position based on direction from position and distance? 
vectorAdd+vectorMultiply should do it for vector directions
yeah just seem to recall a specific command for it