#arma3_scripting
1 messages Β· Page 706 of 1
yeah but commands like removeAllItems
because when I tested it doesn't remove all a players stuff
It removes all Items
removeAllItems is global
not weapons, or magazines
Yeah I know that @cosmic lichen
I only want to remove medical, radios and that sort of thing
I am confused, if it is global and I call it within my script, how come it doesn't perform that task?
Hi, when I place a composition like a roadblock in Zeus, there often is a gap between it and the floor. Trying to move it down a bit (ground level)by using alt the whole structure crashes. Does anyone know a script to fix this issue?
Is the unit local to where you execute it?
No
local argument, global effect
That's why
the player is connected to the server
Ok sry, only the removeBackpack has global one
then remoteExec the command to execute it local to the player
that's the part I am confused on why it didn't work
you did not remote exec anything so far
Can you write what exactly do you have right now?
it was pretty funny when the guy i was testing with got kicked out of the plane, I told Nah, you should get a chute. didn't
sure, let me clean up a few things

I expected a shorter one, ngl as I gotta be going in like 3 mins haha
same π
yeah, basically you have to remoteExec all the inventory related commands local to the crew (player)
@cosmic lichen@crude vigil I do appreciate the help either way π
Or perhaps even remoteExec that whole function local to the player
Also, what is it with formatting (indentations, empty lines etc) these days π
oh, so like run the script but separate for if (isPlayer) then { Take his stuff} and (isServer) then {Stuff}
yeah?
Apart from the question, I also see a very problematic sleep there in last lines π
That requires definitely more than 3 mins
removeBackpackGlobal _x;
removeAllItems _x;
removeAllAssignedItems _x;
You wrote that three times. Might be worth putting it into a function
it's going to give hell to my players
{
[_OdinPlayer] remoteExecCall [_x,_OdinPlayer,true];
[_OdinPlayer] remoteExecCall [_x,2,true];
} foreach ["removeBackpack","removeAllItems","removeAllAssignedItems"];
removeBackpackGlobal _x;
removeAllItems _x;
removeAllAssignedItems _x;
What's that?
so I make this function, I should run it as a local to the players where I remoteExec it?
yeahs that is my attempt at brute forcing the command to work

@proud carbonyeah please use sqfbin.com for such length
I now know of its existence, Thank you
you guys can see the script yeah?
nope, not at all
params ["_yourVehicle"];
private _crew = crew _yourvehicle;
private _dir = direction _yourvehicle;
private _fnc_setUpGear
{
params ["_target"];
[_target] remoteExec ["removeBackpack", _target];
[_target] remoteExec ["removeAllItems", _target];
[_target] remoteExec ["removeAllAssignedItems", _target];
[_target, "B_Parachute"] remoteExec ["addBackpack", _target];
};
// Play some sounds for immersion
["Sov_missile_hit"] remoteExec ["playSound",0,true];
sleep 4;
[_yourvehicle] remoteExec ["Sov_fnc_planeFire", -2, true];
["Sov_Plane_fall", _yourvehicle] remoteExec ["playSound3d",0,true];
// Wait before passengers exit
sleep 7;
// Loop through the whole crew and make passengers exit the vehicle
{
private _role = assignedVehicleRole _x;
if("Cargo" in _role) then
{
_x call _fnc_removeGear;
// Exit vehicle
_x disableCollisionWith _yourvehicle;
_x allowdamage false;
unassignvehicle _x;
moveout _x;
_x setDir (_dir + -90);
[_x] spawn Sov_fnc_KillChute;
_x spawn
{
sleep 1;
_this allowdamage true;
};
};
} foreach _crew;
Perhaps something like this
I didn't change everything
I need to look at remoteExec again as well
Nah, should be okay
ignore that.
I was trolling a friend with that one
amma warn u 4 trollin' π
I might be missing something here but why are you doing (_crew + playableUnits + switchableUnits);
You just wanna edit the ppl inside the vehicle right?
yeah, I found that if I hadn't gone for something like that, The AI in the plane, wouldn't jump out
can anyone explain why that might have been the case?
I#ve updated the script above
There shouldn't be a difference between AI and players
moveOut should work for both.
Another thing I'd change is that you have two loops
strange, i have no clue why didn't before
didn't even give me an error
just refused to do it
anyway
I'm going to get a friend on the server for a test run of the thing soon,
How can I make the effects here pop more?
https://sqfbin.com/ezecatopeniwefaliqak
Let me know if it works.
hmm i'm a bit stupid right now ... i have a forEach which runs over an array with various sizes. can i somehow count the amount of objects in my forEach array in total? example: { hint format ["i have %1 objects.", _allMyObjects]; } forEach [obj1, obj2, obj3];
guess i could just count the array before running the forEach... but just curious if there are other ways
_counter = 0;
_counter = _counter + 1; // In the loop
i need the total amount already in the first foreach round
otherwise i'd just use _forEachIndex
count _array?
nevermind, my question is too complicated :p
it takes longer to word out what i mean than just doing that π
You already answered your question in your first post. Β―_(γ)_/Β―
that's why the question is if there are other ways
as example with _forEachIndex we can get the current index. maybe there is some magic about how to get the full amount of cycles that will run
I doubt forEach knows the size of the array until it's done
but there is no magic variable for the size in forEach if you mean that
Just count it once before the loop
yeh, doing that now. just wondered if i can save a line
Just remove an empty line somewhere in the script π
When I pull "nearestobjects" to my player, it gives a list of objects, but returns a bunch of numbers after the obj. Is it possible to return just the class name only?
apply typeOf _x ?
why does the AI ignore domove command?
It has something to do with leader dying, they wont move after that
If squad is not aware that the squad leader is dead and due that, not updating the squad leader to next member, the command may not be working as these commands make the squad leader order whatever doXXX/commandXXX command you used. Dont know though, just a guess.
commandMove is when leader gives the order but domove is silent
read the description of doXXX commands, it may be silent but it is still ordered.
read it
what's quickest way to remove weapons magazines?
would love to have check if mag belongs to weapon
that's two unrelated questions right?
magazines with scope 1
the ones that are not visible in Eden loadout editor
ok never heard that one
I'm making AI to pickup weapon but then he switches to flashlight
I've been looking for a tutorial to make and package my script mod but I can't find any. can anyone help?
What do you mean?
Didn't find any basic ones but these Β―_(γ)_/Β―
https://byjokese.com/blog/Basic-Structure-of-a-Mod-in-Arma-3.html
https://www.reddit.com/r/armadev/comments/hzcnb3/tutorial_creating_a_simple_mod_following_the_cba/
Im trying to return a list of structures/structure using nearestObjects. I cant seem to figure out how to implement typeOf into the statement. I keep getting errors anyone got an idea?
yes
use typeOf appropriately (differently from how you use it now)
(a.k.a we can't tell you what's wrong with your code without the code π)
Good point
hint format ["%1",_g1];```
Look at typeOf and select
very insufficient :\
@little raptor huge help thanks
Did you figure it out?
Here's something I posted for someone else. Maybe it can help you:
#arma3_config message
I'll write an official tutorial on the wiki later (if I can find some time)
def needs more documentation on the ins and outs of addon making. I had to figure it all out by reverse engineering everyone elses stuff
I'm messing around with an old mod called Chemical Warfare https://steamcommunity.com/sharedfiles/filedetails/?id=1095745477 I found another mod that adds new hazmat suits https://steamcommunity.com/sharedfiles/filedetails/?id=2270576186 and edit the mod files so that the new hazmat suits can protect from the chemical agents in the other mod. I have limited knowledge with coding and could use some help if someone is willing to help with my fools errand
(I am currently just looking through the mod files with PBO Manager)
You're talking about needing to make the hazmat suits work in the chem mod?
delete pbo manager and get Mikero's ExtractPbo (along with his other tools). saves you a lot of time in the long run.
ill look into that
I'm not sure where to find it, but it should just be a matter of adding the suits to the list of protective suits in the chem mod.
I've been looking and can't seem to find anything other then something about how it finds if a suit is protected it seems like he put the code for that in the model itself or sth
You'd need to find that list in the chem mod.
and yea i'm looking in chem mod
private _maskList = [[""], ["None"], 0];```
maybe?
There's usually an array/list of items that work with a modded attribute.
Like how in SOG prairie fire, the radio support, had a list of qualified radio backpacks.
One sec I found something that might be akin to that earlier
private _maskLevel = getNumber (configFile >> "cfgGlasses" >> goggles _unit >> "CBRN_protectionLevel");
private _suitLevel = getNumber (configFile >> "cfgWeapons" >> uniform _unit >> "CBRN_protectionLevel");```
You mean this?
You could check the config to see if they contain a list of the suits/masks.
Ill look i've found like 3 .cfg's so far lol
Well PBO manager won't let me search so this is gonna suck
If it is indeed in the configs somewhere, you're better off asking in #arma3_config.
Ill go poke around in there a bit then ty for the help thus far
Ye. I haven't touched the configs, like at all yet, so I can't give too much help with things related to them.
heh fair enough
I havent really touched modding Arma untill well today so i'm learning as I go lol
So far I still can't even find any CBRN_ProtectionLevel file just model.cfg and that ain't got anything in it
Almost all of my help, comes for going to college for programming/game design.
And I've only just started messing around in ARMA and sqf, so my knowledge pertaining directly to ARMA's systems are limited.
Fair enough i'ma go try that program the other guy recommended and see if I can use it to search in the pbo or sth
no not search in pbo, you extract/unpack the pbo and open configs/scripts in proper text editor like notepad++.
if you define a function in an sqf like the following:
fn_patrol = { // do something };
is that a global function that can be accessed by other scripts?
nevermind, i figured it out, yes
noob question, what's the method for placing and syncing an addon module to an object, in code ? I seem to be calling to a function inside the module which is placing the instance ok but it doesn't have the same behaviour as if it was placed via zeus
I don't think so. If you want something that can be accessed by other scripts, you must make a function as file and declare it
if you run the code that defines it before you use it, it will work
really? I can make a script that declares all the functions at pre-init / earlier than the other scripts and all the scripts can access it?
Functions are just variables
What you just described is known as a function library.
Like how you have "using" statements in some languages, that tell your script to use certain built-in functions.
Like "using system" in c#.
I thought you needed to use that, guess not
Not if you run the script in the mission file before anything else.
By doing that you've basically made a using statement for the whole mission.
If you were making something from scratch without a game engine to fill in the gaps, you would need the using statements.
a function doesn't actually exist, or well it's just an alias to code type you could say
if alive player then {
hint "'function' that runs if player is alive";
};
private _fnc_playerAlive = { // fnc is just a naming convention thing, but its no different than a code, like above
hint "'function' that runs if player is alive";
};
if alive player then _fnc_playerAlive; // ofc don't do it like this, inline the code instead
CfgFunctions begs to differ
As for your specific example, it definitely exists. In programming they're referred to as Lambda expressions, or some languages call them "anonymous functions".
I actually prefer the way sqf does lambda-esque things to other languages
Is it possible to import a custom CSV file to Arma and cut it in chunks with a delimiter (or rather a combination of two delimiters, aka ; & \n)?
you can load any text-based file inside the game
(usually utf8 encoding)
to cut it in chunks, you can use splitString
So there's nothing like some kind of filtering? (Or was it so that you could edit the allowed file types in server cfg)?
Ah, nice, so I can work with linebreaks too (duh, ofc, stupid me π )
yes, but i meant in SQF
and cfgFunctions is literally the same thing
it just assigns a bunch of code values to certain variables
@undone flower https://community.bistudio.com/wiki/Arma_3:_Creating_an_Addon
Still needs a lot of work but should get you started
my god why this hasn't been around since forever? thank you. I'll definitely take a look at it
Why on earth am i getting missing semicolon when using _ctl = displayCtrl (_this select 0); ?
_ctl = displayCtrl (_this select 0);
private _group = ct>
5:11:42 Error position: <(_this select 0);
private _group = ct>
5:11:42 Error Missing ;```
...it wants me to put semicolon right after the `displayCtrl` which is obviously nonsense, so what is wrong here?
Even if i remove everything else and the whole script is just the following line:
_ctl = displayCtrl (_this select 0);
...i am getting the same error.
.it wants me to put semicolon right after the displayCtrl
it's because displayCtrl is a binary command
you're using it as a unary command
wiki says it can be used both ways.

so wiki is wrong then?
why won't they mention it there when they go through the effort of adding it.
top left corner
holy damn. it's working. how exactly? I don't know but it is working.
what is working?!
my addon. I followed the step-by-step and structure, it's showing up in game and initializing properly
oh. cool! π
now I gotta figure out how to make that "add-on config" page. I made my mod to be configurable and all
Question about the structure. when declaring a function in config.cpp, it needs to have its path declared manually like this:
class infAmmoInf {
file = "\(Add-on prefix)\scripts\infAmmoInf.sqf";
postInit = 1;
};
I suppose the add-on prefix plays a role in path, right? or I could just do \scripts\blah?
add-on prefix plays a role in path
yes. all paths in the addon start from the addon prefix
it needs to have its path declared manually like this
not necessarily
I think @winter rose removed that part about automatic file paths?
really? on the biki CfgFunctions it says so: "if in config, <ROOT> means the game's root directory. The addon path needs to be set manually."
well it is still partly manual.
this is how it should be (copy pasting from my mod):
class cfgFunctions {
class DBUG
{
class console
{
file = "DBUG\functions\console";
class initConsole {};
class initCommandHelp {};
class initSearch {};
class initCommands {};
class initOpenFile {};
class consoleLoaded {};
class replaceDebugConsole {};
class updateEditor {};
class updateFileView {};
class highlight {};
class showInfo {};
class showHint {};
class search {};
class setSearchMode {};
class closeConsole {};
class saveFile {};
class saveAS {};
class openFile {};
class newFile {};
class cleanUp {};
class dock {};
class charEnter {};
class initRemoteExecTargets {};
class exportToNPP {};
class initExportToNPP {};
};
};
};
under category, you put a file = "" property which is the path to the folder containing the files
the file names are:
fn_className.sqf
e.g. in my mod:
DBUG is the addon prefix
functions\console is the folder containing the scripts
the scripts are:
fn_initConsole.sqf, fn_initCommandHelp.sqf, etc.
I see. category name also plays a role in the paths normally, correct?
no
it's completely irrelevant
the only thing that matters is the TAG, and the function names (which determine the function names in TAG_fnc_funcName, and if you use automatic paths feature, the file names)
ohh okay. I thought categories implied actual folders
How do I set up an add-on configuration page? I made some variables that are meant to be configured from there
yep! those add-on options
wew. I'll get to it tomorrow. thanks for pointing it
is there any other way to disable AI shooting than disableAI "all" ?
I don't think I removed anything but let's check
sure, remove their magazines
I mean by mistake 
oh right I forgot that one, it's not what I want...
or kill them
"TARGET"
I think I tried that already but will check again
nope that didn't work. AI wont stop shooting
Maybe "AUTOTARGET" too?
that also doesn't stop AI from firing
hmmm disableAI "ANIM" works
but then setUnitPos "MIDDLE"; wont work, I need that too
you can try among the various values
note the "too"
hmm
Contrary to what current version of wiki states(it was correct in past, is now misleading), TARGET and AUTOTARGET disables the assignment of a new target, does not stop unit from engaging the current target they are assigned
https://community.bistudio.com/wiki/setUnitCombatMode This may help you, I believe.
I need the AI to switch from standing to crouch, fast
That is a solution to use instead of disableAI "ANIM", since you dont want unit to shoot. Then you can use setUnitPos as you wish.
aah
testing...
didnt work π¦
it stops firing only for a moment
_unit setUnitCombatMode "Blue". that is
_unit setBehaviour "careless"
that seems to work!
setBehaviour "CARELESS" makes the AI too dumb to follow any orders hence I didnt suggest it (it will also make it walk only iirc, no running at all). You can use group version of it setCombatMode "BLUE" if you dont mind group to be affected as well (setUnitCombatMode is not working apparently)
well setBehaviour doesnt work after all because when I run animation on the AI it starts taking shots again
I play switchMove and the AI starts firing again =/
yeah well instead of us guessing the setup, can you tell us what you try and want to do with them? π¬
I'm making a weapon jam script
then none of these commands will help you since they affect entire group, so jamming for one unit means , entire group suddenly deciding not to attack
good point
I thought setUnitCombatMode was for one unit only
It is, but it doesnt work as you said, because for some reason combatMode overrides unitCombatMode or it just gets completely ignored.
ok
is it possible to play the animation to make unit go from stand to crouch? that's basically all I need atm.
brb
_theUnit playAction "Crouch"
you can do that but I believe you ask that with the usage of disableAI "ANIM" which would be a no afaik.
setUnitPos "Middle", otherwise don't mess with things you don't understand π
Either way, it wont work as long as ANIM is disabled.
It's possible
You can still play animation even if ANIM is disabled
@proven charm Maybe what you can do is, upon weapon is supposed to be jammed, create a unit that wont matter(invisible etc), reveal it to ai, doTarget it, disableAI "TARGET" and "AUTOTARGET", when jam is removed, revert them all back.
perfect, that works!
the script should be complete now, thx everyone!
except im still missing cool weapon unjam animation π
Play the reload action 
funny you say because I am running something like that, the "WeaponMagazineReloadKneel"
Grab the weapon reload action from its config
β¦then simply remove the magazine from the weapon to jam it?
Honestly, since start Im asking to myself, why not just play an animation, that will stop shooting etc , wont it?
I was thinking more like setting it to empty temporarily for manual reload requirement
or just a looping gesture that doesn't allow shooting
then the unit statistics wont work
theβ¦ unit statisticsβ¦
I have gui that shows how much ammo the AI has
If it is your ui, make it adapt
fake it 
no need with the current weapon jam code
If you do it as I say, you ll need to store the bullet count in mag, send it to ui as well
but what me and Talya suggested here works too
You don't even have to make a new rtm
Just use a vanilla anim
And create the config for the anim
of course only a solution if you're working on a mod and not just a script
not working on a mod
Darn so many constraints you have, dont you
. Anyways setting the magazine bullet to 0, storing it till it is jammed(meanwhile unit will reload as well so you dont even need to play any anim), showing stored bullet count in UI works from what I can think of.
They will reload tho
yeah many ways to do this, what I prefer is to let "arma have" all the data
Makes sense in every scenario, dont see the problem?
Last mag?
Too much adrenaline, I got no time to unjam this, switching to pistol 
What if he switches to the launcher?! π€£
War is a bad thing but we gotta all do what it takes, even if it takes tearing the enemy into limbs. 
Give another mag with same ammo count , do I have to tell it as well, I would take all the fun for myself. 
What if inventory is full?! π
Actually back when I played some DRO I would always give my guys tons of ammo 
Almost entirely full
Say that again but slowly, you give "what"
Mags...
? :O
How many last mags do you give them? 
I think my point has been made, thank you. 
What if inventory is full?! stuck_out_tongue
I was just messing around here! π
I know but making sure for any potential audience. 
(In case someone would search for history in future for implementing similar feature)
Good day. Is there a neat way to force airplane to attack any unit or vehicle? I'm trying it with 'doTarget' and 'fireAtTarget', but most of the time plane misses like A LOT, not hitting anything, or worse - just spins around the target without actually aiming at it.
You need to handle it's pathing(ie. manage how it flies), a simple doTarget etc wont do it, which is quite an annoying work depending on how you want to do it.
Try revealing it first
_plane reveal [_enemy,4]
Already doing it for autopilot between attacks - does not relate to airplane position and exact target aiming.
Any hint on how can I do that please? (=
There's also:
_plane disableAI "AIMINGERROR"
Not easy to do. You'll have to manually fly the aircraft using setPosWorld/getPosWorld. Might not be worth your time 
I think the plane needs long approach to the target in order to be able to fire. if it just flies around the target it cant shoot
You can probably make it work by giving the plane "waypoints" (doMove, etc)
But it'll probably be just as unreliable as what you do rn
I've tried giving it 'DESTROY' waypoint, but it's either not working at all, or I'm doing something wrong - it keeps saying that WP is not attached to an object and does nothing.
_killWP =_group addWaypoint [_target, -1];
_killWP setWaypointType "DESTROY";
it keeps saying that WP is not attached
what is saying that? π
Log file
I have two mem points, m and m_dir. I attach my object to m and want to face it then in m_dir. Is this a job for setVectorDir?
Thanks, it's not giving errors now, but sadly plane is not attacking also =_=
one problem at a time π
_group reveal _target; // reveal needs a local _group btw
As I said, you need to manipulate path of the vehicle, it is very hard work, no any hints will be enough. 
Cant he record the path himself then play it?
I've tried this with no luck so far =_= Guess 'doTarget'-'fireAtTarget' iz da way for me
https://www.sqfbin.com/xoxilagijacifuhaloya
If m_dir is in the direction of the bone (m) you can just use the "follow bone" parameter of attachTo
Otherwise yes, you need to set the dir manually
(Also note that directions for attached objects are relative to the objects they're attached to)
@round scroll
If you dont trust me, trust to @little raptor's sweating emotes. 
is _pilot local?
Β©
Sure I do (= Just lost a little
Yeah, it's an AI and code is running server-side, so yes, it is local
EAsiest way is as @meager epoch said, you can record the flight path with BIS_fnc_unitCapture, but even its usage is hard unless you gonna do something like Support CAS module does
Easiest way shouldn't sound so hard 
Because you need to make AI to manually align to a particular position unless you want a teleport the moment you start to play the record since your "Target" position will not be guaranteed I believe? Is it a stationary unit/object?
No, the target is player-controlled object
If it is moving target, then you definitely dont wanna mess with it. I am sure π
Especially if it is player controlled 
You can just record a very long flight (from the part it starts to be visible till lost in horizon), to see an example, see CAS module. Exists both in 3den and zeus.
It is the easiest, rest requires AI to move to particular positions.
Thank you for the explanation.
https://community.bistudio.com/wiki/BIS_fnc_unitCapture
https://community.bistudio.com/wiki/BIS_fnc_unitPlay
The attack will need to be recorded by you as well in this scenario. The function does the job. Enjoy the flight. 
is it possible to use flyInHeight to force a certain hover height for a helicopter whilst ignoring if an object is in the way?
currently it will add the set flyInHeight on top of the objects height
even if I could just have the heli hover downwards around 5ft and hold for a set time before flying off that would be ideal
a rather large invisible object prevents the heli going down as it must think there is land in the way so adds more height
Is it possible to eject a dead body from a vehicle?
A plane, to be more precise.
Or to teleport it outside the plane
Actually nevermind. Even if it is possible, it's gonna look terrible. I'll keep him in.
do it for comical purposes
how could i execVM multiple .sqf's with one line of code?
like can i execute an array of them or smth?
Why is that important?
execVM "script1.sqf"; execVM "script2.sqf" π
If you wanna optimize don't use execVM
executing them like above will always be faster than using a loop
its not a big issue, just wondering
https://community.bistudio.com/wiki/Code_Optimisation This might be a good read for you. Perhaps you find other things you can tweak
will do, danke
Bitte
see also currentWaypoint
so i'm messing around with the Remains Collector module and there exists a command for removeFromRemainsCollector, but executing it from the init field on a unit either before or after death does not seem to have an effect. not sure what I'm doing wrong.
removeFromRemainsCollector this;
https://community.bistudio.com/wiki/removeFromRemainsCollector
any ideas?
managed to get it working!
yep
don't use init field
Sorry, not the init field - the execute field from Zeus
so modded im guessing?
it should be _this and not this, if we're talking about init boxes that zen/achilles add
tried that. i also noticed it was asking for an array, so I tried
removeFromRemainsCollector [this];
and
removeFromRemainsCollector [_this];
TBD if it works.
edit: it doesn't
Wasn't aware it was a mod that added it, but I suppose it might be
either way, just trying to figure out how to exempt a body or wreck from remains collection
anyone knows exactly what do I put in config.cpp for requiring CBA?
See CfgPatches
cba_common
got it
Anyone happen to deal with Vector Dir and Vector Up to Pitch Yaw Roll conversion, do you have a function for it? Trying to generate numbers for mission.sqm's angles property for objects.
My attempts making it myself failed so far
So mission.sqm has x y z angles and you want to convert them to vect dir and up?
The opposite, I have vectors and need xyz angles that mission.sqm uses
Can you show a sample of what mission.sqm has?
position[]={14425.979,12.056995,7564.9883};
angles[]={0,1.5707964,0};
Did you try the rotateVector3D function? They seem like Euler angles (possibly in radians)
Nope, gonna check it out
Tried to make my own from getPitchBank
Figured what I had wrong, angles needed radians, not degrees.
Having degrees even crashed the game, thus I thought I was completely wrong
@little raptor Couldn't figure how that function can help by itself. Didn't look into its source though
Still, my script produces wrong angles. Horizontal objects appear fine but ones on slopes are all wrong.
// _vector_dir and _vector_up are input here
private _flat_dir = +_vector_dir; _flat_dir set [2, 0]; _flat_dir = vectorNormalized _flat_dir;
private _yaw = acos([0,1,0] vectorCos _flat_dir);
if([0,1,0] vectorCrossProduct _flat_dir select 2 > 0) then {_yaw = 360 - _yaw;};
private _vdir = [_vector_dir, _yaw] call BIS_fnc_rotateVector2D;
private _vdirY = _vdir select 1;
if(_vdirY == 0) then {_vdirY = 0.01;};
private _pitch = atan((_vdir select 2) / _vdirY);
private _vup = [_vector_up, _yaw] call BIS_fnc_rotateVector2D;
private _vupZ = _vup select 2;
if(_vupZ == 0) then {_vupZ = 0.01;};
private _roll = atan ((_vup select 0) / _vupZ);
if((_vup select 2) < 0) then {_roll = _roll - ([1,-1] select (_roll < 0)) * 180;};
[rad _pitch, rad _yaw, rad _roll]
The script if anyone cares, pretty much taken from BIS_fnc_getPitchBank
iirc the function has to be used separately for each angle. Currently on mobile so I'll check later
You have to rotate the vector 3 times. Depending on whether it's Euler or Lagrange, it's either XYZ or ZYX rotation, so try both.
Rotate both the dir [0,1,0] and up [0,0,1] like that
Then use the setVectorDirAndUp command (not setvectordir and setvectorup)
I think you're thinking it the other way around, I need to figure the angles and already have vectors dir and up
I'm not sure why you're doing all that math. it's a lot easier than that.
gonna get something to eat. brb
ok so I'm back
Not sure about the math but are you sure you're not hitting a gimbal lock?
ok so, if you write out the Euler transformation matrix you can get a system of equations that can be solved easily
I'm assuming it's Euler, so the transformation matrix is ZYX
assuming rotation of X is a, Y is b and Z is c
let me do this in matlab to be accurate 
ok so in matlab:
clc
clear
syms a b c
Z = [cos(c), -sin(c),0;sin(c), cos(c),0; 0,0,1];
Y = [cos(b), 0, sin(b); 0,1,0; -sin(b),0,cos(b)];
X = [1,0,0; 0, cos(a), -sin(a); 0, sin(a), cos(a)];
Z*Y*X
gives:
[ cos(b)*cos(c), cos(c)*sin(a)*sin(b) - cos(a)*sin(c), sin(a)*sin(c) + cos(a)*cos(c)*sin(b)]
[ cos(b)*sin(c), cos(a)*cos(c) + sin(a)*sin(b)*sin(c), cos(a)*sin(b)*sin(c) - cos(c)*sin(a)]
[ -sin(b), cos(b)*sin(a), cos(a)*cos(b)]
this means that the b can be determined from the Z component of the transformed x-axis
i.e:
b = asin(- (x#2));
from the Z component of the transformed y and z axes we can find a
and then finally we can get c from, say, the X component of the transformed X and Y axes
transformed X, Y, Z axes are:
Z: vectorUp
Y: vectorDir
X: Y cross Z
(you can also get them using vectorModelToWorld)
altho the above matrix is only correct if it's a ZYX transformation 
Way more complicated than one might like.
it's simple 
you just have to do an asin for b and two atan2 conversions for a and c
Eulers are fun, right?
NO
How about them quaternions, am I right?
My brain starts to hurt just thinking about programming with them in any way.
So no gimbal lock?
not sure what you mean! π
but you have 3 unknowns and 3 equations, so it was a determined equation system
I know what a gimbal is 
Quaternions don't have that issue
ah yeah I see what you mean
Was just wondering whether a gimbal lock caused Sa-Matra's issue or not
Nah, its not it
Gonna continue trying to combat my vector math retardation tomorrow
recommendation for a warning beep sound like on a shooting range?
you mean the sound file?
dunno 
did you look at the time trial missions?
You can get one from e.g. https://www.freesound.org as well
no π was just hoping someone might know so i can be lazy
yeah thanks, im trying to be as minimalist as possible here π
Firing drills got sounds for that. Just browse the config viewer
Eden Enhanced has a "sound player" right?
music only
@spark turret
a3\Missions_F_Gamma\Challenges\firing_drills\sp_fd06.altis\
Should expand it for all sounds thoughπ€
that's a mission file
Ah right snooping time it is :P
You can also place a trigger and listen to the sounds with it
Right heard about that recentl?
Ah theres a whole buncj of shooting range sounds, starting with "Firing Drills -"
yep thats what i found π
hello, how to create an object that will be in the inventory or on the ground and at the same time launch the script within a radius of 10 meters?
any suggestions, pls
object that will be in the inventory
huh? objects cannot be in the inventory
item*
I mean, object on the ground or item in the inventory
object on the ground
what object?
item in the inventory
whose inventory?
Does anyone know of a way I can make a trigger activate after a single player walks into a zone and that one player sees one hint and everyone else see another. Hitting a brick wall and I feel like its something as simple as making two triggers with conditions
trigger1 - this && (player in thisList)
trigger2 - triggerActivated trigger1 && !(player in thisList)
a single player walks into a zone and that one player sees one hint and everyone else see another
use local triggers
show the hint you want the player to see normally (no remoteExec)
remoteExec the hint that you want to show to others
Is there anything special I need to put in the remoteExec trigger to make sure the player with the local hint doesnt see the remoteexec?
Or would those conditions above work?
set the remoteExec target to -clientOwner
I recommend not using triggers to begin with anyway
Thank you. Triggers hurt my head but i unfortunately prefer them to zeusing (kill me pls)
Hey,
i am working on an Housing System and i really would need to identify an House, old way is to use the pos and nearestobject.
But i thought that maybe the netID of the object would be a possible unique identifier?
I checked for this and restarted the server 4 times and one hous still had the same object and netid, so would this be an unique, permanent identifier?
netId is unique
and also Permanent over restarts and changes of objects in the mission.sqm?
Though for terrain buildings. Multiple clients may have a instance of the same building at same position with same netid
Unique yes, consistent no
In most cases the netids for terrain objects will stay the same
But it's not guaranteed
hm okay
is there anything else what could identify an building for every player
something else than the position
str _object has an id in it. Though you'll have to parse the string for it and it will change when map is updated\recompiled on game\mod update.
Probably not a chance for Altis to be updated anymore
tru but i guess position workes good aswell so meh will go with the pos
thanks @still forum @meager granite
Anyone know more about how
deleteMarker when running on a server?
Especially in remoteExec cases, does it need to be locally executed or is it implied that it's global?
How does players see which one is visible for them or someone else?
it's global
Thank you
is there any elegant way to get the units of a side, excluding the player?
cus i'm just units side - [player]
this is the most elegant and fastest way already
excellent. making my life easier
although instead of [player] maybe it should be [player, vehicle player]? 
not sure what units returns for units inside vehicles
i'll check
I placed a civilian inside a truck as driver and it returned the unit as normal. no vehicle reference
is there a way to handle teammate damage so whenever he's shot, he will be hurt but he won't die? I thought about a script that would check every hit and if fatal, then change the setDamage to something non-fatal, however it would not work if there's a lag or the check doesn't start early enough.
use event handlers
HandleDamage EH to be exact
I have a question regarding Sector Control multiplayer victory condition (I tried searching it up on the web but I can't find anything useful)
So Blufor, Redfor and Independent are fighting for control of a single sector, but I don't know how to set up a condition where as soon as a side captures it the game ends
Does anyone know the script to that?
in terms of performance which one is better using a compiled code in the init.sqf and call it inside a spawn thread or using spawn directly inside the code ?
no difference
well there is a compiling time ahead but other than that, exec time is the same
["Sov_Plane_fall",_yourvehicle,true,[0,0,0],4] remoteExec ["playSound3d"];
this should work with what I am trying to do yes?
I doubt you want the true at the end, as that'd mean for every JIP player, it would then play form them, also Sov_Plane_fall needs to be a filename
aaand what if the server is a player? π
oh well then.
what about now?
I removed the -2 and the true at the end
so a file name?
do I have to path to the file?
Well -2 is fine, if a player won't be the server
Yes
See the examples
Various ways depending on where it is
Well if its in a mission file; playSound3D [getMissionPath "mySound.ogg", player]; // to play a mission directory sound
how would the work for this?
"Sov_Ai\sounds\Sov_Plane_fall.ogg"
Well ifs its in a PBO, try it
Also, you do realise this is globally executed, so remoteExec would make it happen multiple times to all people
Plays positional sound with given filename on every computer on network.
Yep
this is for the start of the mission where the plane gets shot down
and this is the server the makes the call for exec
Yes, but this would mean a player would hear the same sound played multiplied by the number of players on
yes
say3D is local execute
So you'd remoteExec that
But playSound3D is global execute
I need to come here more, this was a thing my mates told me to try
read the wiki, you said?
usually, a command's locality is displayed there yes π
in that case, here https://community.bistudio.com/wiki/playSound3D π
I'm in your base, stealin' your screenshots
so this will work now.
_Sov_Plane_fall_Pathed = (getMissionPath "Sov_Ai\sounds\Sov_Plane_fall.ogg");
playSound3D [_Sov_Plane_fall_Pathed,_yourvehicle];
where is the sound file placed?
You've lost a lot of parameters, and is the sound in your mission
Is this in the mission file? π€
yes
then yes good
Yes
ok
Testing it now, I have to wait a solid 5 minutes of fly time to test
Just reached the 1500 height mark
Negative, the sound did not work.
It did not play
prolly worth checking getMissionPath "Sov_Ai\sounds\Sov_Plane_fall.ogg" gives you the correct path
no you don't
you can create a temp mission in VR or even use the debug console
Just alt tabbed back,@winter rose your telling me I've been doing it the long way?
yes.
Found out why it wasn't playing, the sound file I forgot to convert to an ogg file.
Now how do I increase the volume of the sound file without deep frying it?
have you heard of the wiki? π
yes but in this case, SoundPos is before volume
how do I not put anything into the sound pos argument and put a value into the Volume?
β¦use Audacity π
btw, the sound will not be attached to the vehicle
so it wont follow the vic at all? even without soundPosition arg?
iirc
Should I switch to say3d?
That is actually preferred
If you are going to use say3D, note that you give this a classname as defined in CfgSounds
how would I remote exec say3d? something like [MySound, _Plane, 20, 1, false] remoteExecCall ["say3d"];
@cold pebble
class Sov_Plane_fall
{
name = "Sov_Plane_fall";
sound[] = {"Sov_Ai\sounds\Sov_Plane_fall.ogg",db+75,1};
titles[] = {};
};
nailed?
is db+75 valid?
worked for "Sov_missile_hit"
Thanks bros
so [_yourvehicle,[Sov_Plane_fall, 20, 1, false]] remoteExecCall ["say3d"];
And you don't need false there as its the default value
same with pitch

Where have those "" come from
Just surrounding the sound name
Not around the 1
[_yourvehicle,["Sov_Plane_fall", 20]] remoteExecCall ["say3d"];
btw, 20m max distance is ok to you?
it is a voice over of some dude screaming his lungs out while a beeping noise is in the back
Sounds a bit low tbh
ok, back to my next problem, how do I increase the volume without using audacity to deep fry the susy baka
I guess it won't hurt.
https://community.bistudio.com/wiki/say3D
For some unknown reason if at the moment of command execution the player is in first person view and is inside a vehicle, the sound created is greatly attenuated.
I have greatly ear raped myself, but the audio has been amplified greatly, so may God have great mercy on anyone in third person.
ok so now my new problem is
https://sqfbin.com/ilukiwetonabawobicuw
for some unknown reason the player are not getting kicked out of the plane.
how can i edit stuff like cfgSurface?
by config editing (see #arma3_config and https://community.bistudio.com/wiki/Arma_3:_CfgSurfaces_Config_Reference)
can't really find a section where it shows/tells how can i edit stuff like "AiAvoidStance" and things like that
I don't even know if that's done in there 
ask in #arma3_config, they will know
Anyone know the best way to give a player slot zeus? Like a command?
The game master module works fine but... we're finding in certain scenarios that the zeus has to respawn for it to kick in. I suspect a JIP issue
(Select respawn position turned off)
I know liberation has a feature in the scroll menu "reassign zeus"
Would it be using assignCurator command?
Maybe in the initServer.sqf
well if the Game Master module exists but your Zeus can't join the curator view then you can simply assign it through debug console using assignCurator
give your zeus' slots variable names lik zeus_1, zeus_2 and so on, for modules mzeus_1 etc. for the sake of easier implementation and then you can simply assign them however you want
If I have the module variable name as boss
Would it be for example
unitvariablenameblabla assignCurator boss;
Thanks buddy I'll give it a shot :)
yes
Is there any way to remove the Take and Open scroll menu options from weapons, vests etc? I'm using some as props.
Disable Simulation or make them simple objects
Disable Simulation is a no-go, you can't pick them up but it still shows the option to
And I can't make most of these simple objects, can I. There is no option in the editor
Seems that the solution is to set the health to 0.
are there any character limits for classnames in cfgs? like for the sounds in CfgMusic
Is there a more natural way of forcefully turning the direction the player's looking at other than setDir?
yes, but you won't reach them
fair enough
no
welp
int? π
if by "natural" you mean "smooth", there is tho
using setDir every frame
So what, do i like slap 200 setdirs lol
:d
see for example:
https://community.bistudio.com/wiki/onEachFrame
(note: use stacked version)
even if you do that, it will look ugly without using animation
I tried using an animation but it doesnt work in first person
Like, it plays out but his head is stuck in one position if in fp
you tried to use the usual animation that is used for rotating?
animations only affect the body
not turn dir
or head
oh ait
Well as I said "without"
max distance the audio reaches, in meters
ty
I wonder if the wiki can answer that. yes, in meters
the wiki does not state that
it does now
well, cant blame you though, all distance related commands are in meters, afaik.
yep
how do i test in the hit EH if a popup targets base was hit or the relevant part?
use HitPart as an EH instead
The object-based Event Handler is always executed on the computer where it was added.
- https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
so the one that executedaddEventhandler
ah hitpart has a description for that
If above _a = []; there was _b = 2;
Would _a now be [1, 2]?
Iβm trying to figure out how Params work when a private variable is declared outside of the params while using the exact same variable name.
private _a = [];
[_a] call {
params ["_b"];
// identical to
private _b = _this select 0;
};
read https://community.bistudio.com/wiki/Variables#Scopes to understand variable scopes π
here, it means _b only exists in this call code
private _b = [1];
private _a = [];
[_a] call {
params ["_b"];
// identical to
//private _b = _this select 0;
};
_a // is a now 1? Or did declaring another private _b wipe out the value?
π
private _var = 0;
call {
private _var = 5;
call {
private _var = 10; // disappears after this line
};
_var // == 5 here
};
_var // == 0 here
Thank you, so this implies private declares in a scope of βif(_condition) β is contained and not displayed beyond that scope but within their own scope _myVariable is 2 right?
yes, it says "I don't care about the above, I name my own local variable this and it will die once the scope is done"
same name but really pointing at two different values
Thank you, so much. Iβm on phone this makes more sense now β€οΈ
private _var = 0;
call {
_var = 5; // var is going to be 5
private _var = 10; // -this- _var will be = 10, the other remains 5
};
_var // == 5
So declaring _var = 5 is still useful for modifying out of scope. But beyond private _var = 10; within the scope, _var is now 10.
yes
and does not point to the previous one anymore
Thank you again, this whole thing is from me trying to add more to an existing script and having it fail horribly. 
no worries, it's always better to know a bit more after all π
Hey guys, is there a way to make pop-up targets require a couple more hits before theyll go down?
Maybe disable damage and use Hit EH to count hits
Is there a cleaner way to get a weighted random integer than this?
round random [0,2,10]; // maybe?
Thanks! That did it.
No. What I wrote there has nothing to do with params. It's related to variable references
_a is still []
I'm running into an issue with onPlayerRespawn.sqf
What I have:
params ["_oldUnit"];
hideBody _oldUnit;
What I expect:
When the player respawns, their body is hidden from view, then removed.
What's happening:
The body is hidden from view moments after the player dies, then removed when they respawn.
Not sure what's going wrong here. If anyone has any ideas, I would appreciate it.
Any idea why my sound isn't playing?
class CfgSounds {
sounds[] = {p_manScreaming};
class p_manScreaming {
name = "Loud Scream";
sound[] = {"sounds\scream.ogg", db+10, 1.0};
titles[] = {0, ""};
};
};
It does pop up in the sounds listed under Effects in a trigger, but doesn't play.
Path to sound file is incorrect
Maybe set the volume to 1
Β―\_(γ)_/Β―
(and not db+1, just 1)
ait, will try
The body is hidden from view moments after the player dies, then removed when they respawn.
what happens if you don't add anything?
What do you mean? If onPlayerRespawn.sqf is left blank?
yes
the body persists indefinitely
I think as soon as you press the respawn button you have already respawned? 
did you test that?
put a systemChat, see when the script triggers
I'll try the test - it seems to be triggering on death though
triggering on death
same difference
how does it differ from onPlayerKilled.sqf, then?
https://community.bistudio.com/wiki/Event_Scripts#onPlayerKilled.sqf
is there anything like a priority queue already implemented in arma2?
what priority queue?
adding new element at position based on its priority vs. priority of elements already in the queue.
I don't think A2 even has a sort command/function! π
@little raptor still nothing D:
then maybe your sound file is not supported
It works as cfgMusic
Idk lol
and you're not supposed to put anything there
just remove p_manScreaming from it
back in the daysβ¦ π΄
Is there a script or way i can use a drone on a laptop instead of the tablet in game?
you would do an addaction to a laptop which then points to a script that makes use of remoteControl and switchCamera keeping in mind MP locality
ok cheers been looking ages to find out how
nothing again
can I specify a script to execute once every frame?
yes, see EachFrame mission EH
arma 2 doesn't have those! π€£
There's an "onEachFrame" in A2
however, it says only one of these can run at a time
oh wait it does 
And I want to use this in a mod
he didn't specify, I default to A3
degenerates, all of you
which sounds like a bad idea, if only one can be active at a time
yep, so not recommended indeed
but it doesn't appear there's another way
you simply take the risk of being overriden by something else, that's it Β―_(γ)_/Β―
that or use Arma 3 π
IsNil exists in A2 right?
yes
ouch
A2 has HandleDamage right?!
maybe you could create a unit, slam it into the ground, catch it with HandleDamage, put him back up, then slam him into the ground again! π€£
it will trigger every frame!
another idea is using animStateChanged EH
(if A2 even supports playMoveNow and switchMove)
looks like it does
hmm... maybe I should forget the whole thing. I was trying to make the gunshot sounds less shitty. But I don't know if it's worth the effort.
All I really wanted to add was different sounds for long distant shots
and a speed of sound delay
I figured a simple queue with 32 or so slots
and a sound triggers on the frame it should based on speed of sound delay to listener
of course, then I'd have to turn off all the sounds on the guns themselves
I have no idea why you're still sticking with A2 π€·
It's very limited in many ways (especially scripting)
uh, well 2 reasons
shit computer
and, from everything I've read, A3 still has all the same problems that A2 had
they really need to redesign everything from the ground up
Especially the AI
I recently installed A2 again and it runs nearly the same as A3 for me (A3 is only slightly slower)
I can run A3, but only micro maps
the others never finish loading
Plus I'd have to install tons of mods anyway, since I'm only interested in cold war to present day military stuff
Thank you, sorry for necroing your example months ago but I was a little confused to why my code stopped working and params was the only culprit i didn't get. Lou Montana helped me out up there too and now i understand more about scripting. Fixed my script too π
I missed 5~6 semi colons and one if statement was without a "then". That's why it was broken
||don't write code til 5 am it's not worth it||
hey was wondering if its possible to disable throwing? like vanilla throwing via script. dont want players fat fingering grenade throw or doing it on purpose within a zone
ive disabled weapons by forcing them to switch it onto their back, but grenades is the last problem
i tried:
player addEventHandler ["FiredMan",
{
params ["_unit", "_firer", "_distance","_weapon", "_mode", "_ammo", "_gunner"];
if ( ([_mode] call BIS_fnc_itemType select 1) isEqualTo "Grenade" ) exitWith
{
HintSilent "You attempted to throw a grenade";
deleteVehicle _ammo;
_unit addMagazine _mode;
};
}];
^ something i found from an old forum post
doesnt work unfortunately and im still learning eventhandlers
the alternative i see is fetching the players current throwable and deleting it the moment it leaves the players hands and then replacing it in their inventory
that's what that script was supposed to do
but anyway it's wrong
the params are nonsense:
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
"_unit", "_firer"
wtf?
_distance
(β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
oh I see, they copy pasted FiredNear params π€£
can i get a hand with it then?
the forum thread was super old (2011 to be exact) and i cant find any help on it elsewhere
everything you need is in the script. just fix the params and the variables
im an incredibly slow person, can you point out what needs fixing more specifically and why? im still massive newb to sqf
player addEventHandler ["FiredMan",
{
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
if ( ([_magazine] call BIS_fnc_itemType select 1) isEqualTo "Grenade" ) exitWith
{
HintSilent "You attempted to throw a grenade";
deleteVehicle _projectile;
_unit addMagazine _magazine;
};
}];
was it really that hard? 
i see now. yeah im retarded.......
let me give this a quick test
works perfectly. @little raptor ty for the help β€οΈ
any possible way to modify this slightly tho?
using
_throwables = [];
"_throwables append getArray( _x >> 'magazines' )" configClasses( configFile >> "CfgWeapons" >> "Throw" );
could i use it to disable ALL throwables?
why? does it still allow throwing sth?
it only blocks grenades, not all throwables
so i can clog the area with smokes and chemlights
but not harmful grenades
id prefer if you couldnt
then change it to:
player addEventHandler ["FiredMan",
{
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
if ( ([_muzzle] call BIS_fnc_itemType select 1) == "Throw" ) exitWith
{
HintSilent "You attempted to throw a grenade";
deleteVehicle _projectile;
_unit addMagazine _magazine;
};
}];
the above version just breaks it entirely :/
change _muzzle to _weapon
no effect
what did you write?
player addEventHandler ["FiredMan",
{
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
if ( ([_weapon] call BIS_fnc_itemType select 1) == "Throw" ) exitWith
{
HintSilent "You attempted to throw a grenade";
deleteVehicle _projectile;
_unit addMagazine _magazine;
};
}];
then use this:
throwable_mags = [];
"throwable_mags append getArray( _x >> 'magazines' )" configClasses( configFile >> "CfgWeapons" >> "Throw" );
throwable_mags = createHashmapFromArray (throwable_mags apply {[_x, nil]});
player addEventHandler ["FiredMan",
{
params ["_unit", "", "", "", "", "_magazine", "_projectile"];
if ( _magazine in throwable_mags ) exitWith
{
HintSilent "You attempted to throw a grenade";
deleteVehicle _projectile;
_unit addMagazine _magazine;
};
}];
hmmm. still has no effect, grenades can still be thrown
maybe it just cant be done for all grenades?
what about the new one?
it can
all throwables are fired from the Throw weapon
is there a simple way to figure out if a vehicle is a UAV?
my guess is it's somewhere in config, but I thought maybe there was a function
yes
isUAV
in config
thats a bool I assume
there is no bool in config
getNumber (configOf _veh >> "isUAV") == 1
right
sick, thanks
and then just createVehicleCrew to make it a controllable UAV right?
yes
cool
When I pull the item class from the _premiumGear array and send that to the DB via _premiumItem select 0, how do I format the result so thet it gets sent to the DB as ["BSF_Bergen_Black_F"] instead of just BSF_Bergen_Black_F? Or what should I be doing here instead? The values should be in an array format it appears.
_premiumCount = round random [0,2,10];
_premiumGear = [
["BSF_Bergen_Black_F",5000],
["BSF_Bergen_Winter_F",5000],
["BSF_Bergen_Winter2_F",5000],
["BSF_Bergen_BlackDigi_F",5000]
];
while {_premiumCount > 0} do
{
_listingID = call ExileServer_MarXet_inventory_createListingID;
_premiumItem = selectRandom _premiumGear;
format["createNewListing:%1:%2:%3:%4:%5",_listingID,1,_premiumItem select 0,_premiumItem select 1,_serverUID] call ExileServer_system_database_query_fireAndForget;
[format["BSF MarXet Server just listed a %1 for %2",_premiumItem select 0, _premiumItem select 1],"createNewListingRequest"] call ExileServer_MarXet_util_log;
_premiumCount = _premiumCount - 1;
};
I've tried to just brute force is by formatting the variable with the [""] but that leads to syntax errors.
maybe str(_premiumItem select 0) would work?
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
That get me "BSF_Bergen_Black_F" but no brackets. A step in the right direction.
I got it. Just placing the variable in [] marks it as an array I guess.
[_premiumItem select 0]
Hi i have a question
Can anyone tell me exactly what "compile" is doing in this line: _this call (call compile getText (_cfg >> "jsrs_soundeffect"));
creates a code from string
not sure why there are two calls tho 
it could just be _this call compile getText (_cfg >> "jsrs_soundeffect"); if it was written properly
I have a question about ExecVM and RemoteExec. i want to make my mission multiplayer compatible, so i understand that remote exec is the way to go. but having many remoteexedc can be some bad thing to do. i create sqf scripts mainly for titleTexts, hints and say3D, mainly triggered by a
_nul = [] execVM "myscript.sqf";
my question is, does the execVM MP compatible? i mean, do i need to add remoteexecs inside of it? or just by having it, all the hints and sounds will play on all the clients over the network?
maybe is a dumb question, but i'm refactoring my mission and dont want to make a mistake. planning to add a bunch of remoteexecs inside the execVM fired script.
maybe is redundant
depends on the commands used
https://community.bistudio.com/wiki/Multiplayer_Scripting
look at the biki and see the locality of the commands that you want to use
e.g hint has local effect
so it is only visible on the PC that executes the command, so it must be remoteExeced
remoteExec ["titleText", 0, true];
that's wrong. see the pinned messages for remoteExec examples
yes thanks, i mean i have something like this: ["<t>my title text</t>, "PLAIN DOWN", -1, true, true"] remoteExec ["titleText", 0, true];
having many remoteexedc can be some bad thing to d
yes. you should not useexecVMeither. both are bad
beacause i want that the command will be executed globally, i.e. on the server and every connected client, including the machine where remoteExec originated
i'm so confused, the trigger activation field will trigger on every machine, so will propagate on the network. so i made some scripts that will be fired on trigger activation. each one of the scripts have titleTexts, hints, say3d stuff, and a few other variables.
which is the proper way to be totally sure my players will get this content when the play
contained on each of the sqfs
and be JIP compatible also, dont want that a JIP player wont get the effects of the scripts
what I mean is, there are many ways to execute a sqf script. execVM is one of the worst
as you said it yourself, running many remoteExecs are bad.
the way to solve it is making functions
and remoteExecing the function
is it possible to leave out the parent class? class M16A2 : M16_base { in the event that I'm not inheriting any of the properties I plan to modify from the parent class?
getText (_cfg >> "something").... what happens in the event that "something" doesn't exist as part of _cfg?
can someone help me, i kept getting
sleep 5;
call{this playAction "Salute";};
};
Error undefined variable in expression: this```
the script was
```[] spawn {
sleep 5;
call{this playAction "Salute";};
};```
"" will be returned
because it's not
this is not a global variable
it's not seen by the code inside the spawn
aaah, i see
this is how you solve it:
[this] spawn {
params ["_unit"];
sleep 5;
_unit playAction "Salute";
};
(call was redundant so I removed it)
also if you're on the stable branch and not using CBA, you might want to wrap the spawn in call
aight, thank you so much mate
What is actually returned by configFile. Is it just a reference?
a string?
In other words if I store the result of configFile "something" >> "something_else" into a variable, how much memory does it actually use?
I have to presume it is a reference to the config, and not the entire config itself
it's a data of type CONFIG
how much memory does it actually use?
very little
I have to presume it is a reference to the config, and not the entire config itself
obviously
you've got to be kiiding
so I need some kind of dummy object, spamming all the time for each new sound, plus a cfgsounds entry, just to do the same thing locally instead of globally
Can I reference a cfgSound entry directly inside of a cfgWeapon entry? Example: class M16A2 : M16_base { thingy = sound; } Where "sound" is defined in cfgSounds
afaik no. but you should ask in #arma3_config
can 1 object "say" more than 1 sound at a time with say3D?
also, can I use say3D like this? some_object say3D (configFile>>"cfgSounds">>"sound_name")
no
how would i get a sound from its name as a string?
?
a name is already a string 
uh okay so.... object say3D "sound_name" should work?
where "sound_name" is the anme of a sound defined in cfgSounds
yes
and the other question. do you know if 1 object can "say" more than 1 sound at a time?
looks like no
tested it myself
alright, i guess I'll need multiple objects to act as the source
for "_i" from 0 to _count step 1 do { if I change the value of _count inside of this loop, will it effect when this loop will terminate?
inside of a forEach loop, if I remove the current element _x from an array, will it cause the loop to skip the next element?
yes
Can I reduce _forEachIndex by 1 to compensate?
if you use deleteAt
what are the contents of the array?
other arrays... but
I'm basically doing: array set [_forEachIndex, -1]; array = array - [-1];
inside of forEach array
do it outside
this doesn't change the array that's being iterated on, so it won't skip, but you should do it outside the forEach for performance reasons
hmm... if it doesn't change the array being iterated, why would it affect performance?
it still is creating new arrays
in every iteration
while you could only do it once and get the same end result
I'm removing several elements in the array during the forEach loop
but not all of the elements
it's conditional
is BIS_fnc_textTiles local only? If so am I able to remote exec it?
yesΒ²
everything UI is local
Gotcha
can cfgsounds contain sounds defined like: asound[] = {sounda,0.25,soundb,0.25,soundc,0.5}; ?
what is this (nonsense)?
if you want to play a sound at random, use selectRandomWeighted + playSound
otherwise, see https://community.bistudio.com/wiki/CfgSFX for repeated random sounds
Is there a way to get script handle for remoteExec'd scripts?
Or how does one go about terminating remoteExec'd scripts
no
from the script itself or by making the script spawning and registering the handle somewhere
buuut it sounds like bad designβ¦
I know it's bad design, but I've been working on this too long to care
I have this readycheck script that's firing twice for some reason
Which results in double mission
The script should know its own handle: https://community.bistudio.com/wiki/Magic_Variables#thisScript
Hey everyone, i donβt know how to programm a plane with A.I for he destory units in the editor of arma
Can you help me pls ?
sounds like a #arma3_scenario thing, not scripting
I used this, seems to be working. Thanks!
Ok thx
How do you select an element within a nested array?
_myArray = ["ABC",["1","2","3"],"Dog","Cat"];
How do you select "2"?
_myArray select 1 select 1
Cool, simple enough.
_myArray select 1 // gets ["1", "2", "3"]
select 1 // gets "2"
```yep, ez pz π
Thanks a bunch.
with pleasure! 
is it possible to have an action (through addaction) availalbe while in the radius, without having to look at the action supplier?
By supplier, you mean target I believe?
yeah
add the action to player, involve your "supplier" in condition, check whether in range or not?
yeah i guess thats the reasonable thing to do
I'm trying to make sure the space in front of the player is open and what I've come up with was spawning a box and keeping it's position in front of the player and seeing if detects another object with EpeContact but it seems to only work with objects that are moving. Also seeing as I'm here is there a better way of accomplishing this?
I need like a 1x1x1 space about 1.5m in front of the player
Im doing some update catching up and was wondering...
does from in association with import work twice for deeper classes or does it just search until it finds the keyword.
For example
class cfgClass {
class level1 {
class level2 {};
};
};
//I would simply
level2 from level1 from cfgClass
//Or just
level2 from cfgClass
β¦ #arma3_config ?
if I can't help, it's most likely not #arma3_scripting :p (that and/or I don't know, ofc)
haha you always know π
I need someone to tell me how cludgy this is/if there is a better way. Right now it works for what I need. I need to check 4 different vehicles if any of them has been dismounted completely. The vehicle varnames are in an array name vehArr.
testArr = [];
{testArr pushback (count (crew _x) > 0)} forEach vehArr;
if ( {_x == false} count testArr < 4) then {
something happens;
};
What would be a good way to implement things like aircraft engine starting procedure, etc.?
Of course, ideally, i would like to do it the way its done in TKOH, but that isn't an option - regardless of whether the required mechanics are present in Arma 3 in usable form, i need a system that works with aircraft models i cannot edit to add interaction points etc., so i need to take a more "virtual approach".
So, i made a simple dialog GUI with custom widgets for various kinds of switches and indicators you can find in aircraft cockpits, and now i need some kind of FSM that will respond to these switches and move between states depending on what has been done.
(when i say "FSM", i mean it as a general term, not that it has to be using the native "FSM" feature of Arma 3)
What would be a good way to implement something like that?
I made a script from which this dialog is opened and after that the script runs a loop in which it has conditions for some "state" variable (representing a "state" the script "is in"), and based on that "state" it runs set of more specific condition checks where it reads/set state of various switches in the dialog, and eventually change the value of the "state" variable to change/advance the state the script is in, until it reaches some point where something should happen (like actually starting the engine), or the user closes the dialog.
Is there a better way?
Or any mods/examples where i could look for inspiration?
anybody got a suggestion for scenic but not dangerous AA fire?
ALIAS is your saviour there
i tried using HMG cars with 100% skills but 0% aiming precision but its not really what i want
