#arma3_scripting

1 messages Β· Page 706 of 1

crude vigil
#

well u dont remoteExec global commands

proud carbon
#

yeah but commands like removeAllItems

#

because when I tested it doesn't remove all a players stuff

cosmic lichen
#

It removes all Items

crude vigil
#

removeAllItems is global

cosmic lichen
#

not weapons, or magazines

proud carbon
#

Yeah I know that @cosmic lichen

#

I only want to remove medical, radios and that sort of thing

proud carbon
olive trench
#

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?

cosmic lichen
proud carbon
#

No

winter rose
#

local argument, global effect

cosmic lichen
#

That's why

proud carbon
#

the player is connected to the server

crude vigil
cosmic lichen
#

then remoteExec the command to execute it local to the player

proud carbon
#

that's the part I am confused on why it didn't work

winter rose
#

you did not remote exec anything so far

crude vigil
proud carbon
#

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

cosmic lichen
crude vigil
#

I expected a shorter one, ngl as I gotta be going in like 3 mins haha

cosmic lichen
#

same πŸ˜„

#

yeah, basically you have to remoteExec all the inventory related commands local to the crew (player)

proud carbon
#

@cosmic lichen@crude vigil I do appreciate the help either way πŸ™‚

cosmic lichen
#

Or perhaps even remoteExec that whole function local to the player

#

Also, what is it with formatting (indentations, empty lines etc) these days πŸ˜„

proud carbon
#

oh, so like run the script but separate for if (isPlayer) then { Take his stuff} and (isServer) then {Stuff}

#

yeah?

crude vigil
#

Apart from the question, I also see a very problematic sleep there in last lines πŸ˜…

#

That requires definitely more than 3 mins

proud carbon
#

Oh yeah

#

that is so intentional too

cosmic lichen
#
removeBackpackGlobal _x;
            removeAllItems _x;
            removeAllAssignedItems _x;

You wrote that three times. Might be worth putting it into a function

proud carbon
#

it's going to give hell to my players

cosmic lichen
#
{
                [_OdinPlayer] remoteExecCall [_x,_OdinPlayer,true]; 
                [_OdinPlayer] remoteExecCall [_x,2,true]; 
            } foreach ["removeBackpack","removeAllItems","removeAllAssignedItems"];
            removeBackpackGlobal _x;
            removeAllItems _x;
            removeAllAssignedItems _x;

What's that?

proud carbon
proud carbon
cosmic lichen
proud carbon
#

Most of this is code from 2019

#

I was a lot worse then πŸ™‚

winter rose
#

@proud carbonyeah please use sqfbin.com for such length

proud carbon
#

you guys can see the script yeah?

winter rose
#

nope, not at all

cosmic lichen
#
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

winter rose
#
publicVariable "_yourvehicle";
```_ugh_
#

(not you R3vo)

cosmic lichen
#

I didn't change everything

#

I need to look at remoteExec again as well

#

Nah, should be okay

proud carbon
#

I was trolling a friend with that one

winter rose
#

amma warn u 4 trollin' πŸ‘€

cosmic lichen
#

I might be missing something here but why are you doing (_crew + playableUnits + switchableUnits);

#

You just wanna edit the ppl inside the vehicle right?

proud carbon
#

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?

cosmic lichen
#

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

proud carbon
#

strange, i have no clue why didn't before

#

didn't even give me an error

#

just refused to do it

#

anyway

cosmic lichen
#

By changing some of the values Β―_(ツ)_/Β―

west grove
#

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

cosmic lichen
#

_counter = 0;
_counter = _counter + 1; // In the loop

west grove
#

i need the total amount already in the first foreach round

#

otherwise i'd just use _forEachIndex

cosmic lichen
#

count _array?

west grove
#

nevermind, my question is too complicated :p

#

it takes longer to word out what i mean than just doing that πŸ˜„

cosmic lichen
#

You already answered your question in your first post. Β―_(ツ)_/Β―

west grove
#

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

cosmic lichen
#

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

west grove
#

yeh, doing that now. just wondered if i can save a line

cosmic lichen
#

Just remove an empty line somewhere in the script πŸ˜„

storm arch
#

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?

proven charm
#

why does the AI ignore domove command?

#

It has something to do with leader dying, they wont move after that

crude vigil
#

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.

proven charm
crude vigil
proven charm
#

what's quickest way to remove weapons magazines?

#

would love to have check if mag belongs to weapon

winter rose
#

that's two unrelated questions right?

proven charm
#

they are related

#

@winter rose thats great thx!

#

but what's hidden magazine?

winter rose
#

magazines with scope 1
the ones that are not visible in Eden loadout editor

proven charm
#

I'm making AI to pickup weapon but then he switches to flashlight

undone flower
#

I've been looking for a tutorial to make and package my script mod but I can't find any. can anyone help?

full otter
#

What do you mean?

storm arch
#

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?

winter rose
#

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 πŸ˜›)

winter rose
#

ah
I see

#

you are not using typeOf here πŸ˜„

storm arch
#

@little raptor huge help thanks

little raptor
little raptor
#

I'll write an official tutorial on the wiki later (if I can find some time)

fair drum
solid shore
#

(I am currently just looking through the mod files with PBO Manager)

hexed crown
#

You're talking about needing to make the hazmat suits work in the chem mod?

solid shore
#

pretty much

#

Want the better suits/masks to work in the older mod

bitter magnet
#

delete pbo manager and get Mikero's ExtractPbo (along with his other tools). saves you a lot of time in the long run.

solid shore
#

ill look into that

hexed crown
#

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.

solid shore
#

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

hexed crown
#

You'd need to find that list in the chem mod.

solid shore
#

and yea i'm looking in chem mod

#
private _maskList = [[""], ["None"], 0];```
#

maybe?

hexed crown
#

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.

solid shore
#

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?

hexed crown
#

You could check the config to see if they contain a list of the suits/masks.

solid shore
#

Ill look i've found like 3 .cfg's so far lol

hexed crown
#

You're specially looking for the CBRN_protectionLevel.

#

That's your keyword

solid shore
#

Well PBO manager won't let me search so this is gonna suck

hexed crown
#

If it is indeed in the configs somewhere, you're better off asking in #arma3_config.

solid shore
#

Ill go poke around in there a bit then ty for the help thus far

hexed crown
#

Ye. I haven't touched the configs, like at all yet, so I can't give too much help with things related to them.

solid shore
#

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

hexed crown
#

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.

solid shore
#

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

bitter magnet
#

no not search in pbo, you extract/unpack the pbo and open configs/scripts in proper text editor like notepad++.

chilly bronze
#

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

frigid idol
#

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

undone flower
copper raven
#

if you run the code that defines it before you use it, it will work

undone flower
still forum
#

Functions are just variables

hexed crown
#

Like how you have "using" statements in some languages, that tell your script to use certain built-in functions.

#

Like "using system" in c#.

undone flower
hexed crown
#

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.

copper raven
# undone flower really? I can make a script that declares all the functions at pre-init / earlie...

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
mental wren
#

As for your specific example, it definitely exists. In programming they're referred to as Lambda expressions, or some languages call them "anonymous functions".

digital rover
#

I actually prefer the way sqf does lambda-esque things to other languages

tender fossil
#

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)?

little raptor
#

(usually utf8 encoding)

#

to cut it in chunks, you can use splitString

tender fossil
#

Ah, nice, so I can work with linebreaks too (duh, ofc, stupid me πŸ˜„ )

copper raven
#

and cfgFunctions is literally the same thing

#

it just assigns a bunch of code values to certain variables

little raptor
undone flower
supple matrix
#

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.

little raptor
#

you're using it as a unary command

supple matrix
#

wiki says it can be used both ways.

little raptor
supple matrix
#

so wiki is wrong then?

little raptor
#

that's v2.06

#

so not yet

supple matrix
#

meowfacepalm why won't they mention it there when they go through the effort of adding it.

supple matrix
#

Oh, crap, guess i need to update my compact stylesheets

#

thanks

undone flower
little raptor
#

what is working?!

undone flower
little raptor
#

oh. cool! πŸ˜„

undone flower
#

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?

little raptor
#

it needs to have its path declared manually like this
not necessarily

#

I think @winter rose removed that part about automatic file paths?

undone flower
little raptor
#

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.

undone flower
#

I see. category name also plays a role in the paths normally, correct?

little raptor
#

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)

undone flower
#

ohh okay. I thought categories implied actual folders

undone flower
#

How do I set up an add-on configuration page? I made some variables that are meant to be configured from there

little raptor
#

configuration page?

#

you mean CBA settings?

undone flower
#

yep! those add-on options

undone flower
proven charm
#

is there any other way to disable AI shooting than disableAI "all" ?

winter rose
winter rose
little raptor
proven charm
winter rose
#

or kill them

proven charm
proven charm
little raptor
proven charm
#

hmmm disableAI "ANIM" works

#

but then setUnitPos "MIDDLE"; wont work, I need that too

winter rose
#

you can try among the various values

winter rose
proven charm
#

hmm

crude vigil
#

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

proven charm
crude vigil
proven charm
#

aah

#

testing...

#

didnt work 😦

#

it stops firing only for a moment

#

_unit setUnitCombatMode "Blue". that is

winter rose
#

_unit setBehaviour "careless"

proven charm
crude vigil
# proven charm 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)

proven charm
#

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 =/

winter rose
#

yeah well instead of us guessing the setup, can you tell us what you try and want to do with them? 😬

proven charm
#

I'm making a weapon jam script

crude vigil
#

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

proven charm
#

I thought setUnitCombatMode was for one unit only

crude vigil
#

It is, but it doesnt work as you said, because for some reason combatMode overrides unitCombatMode or it just gets completely ignored.

proven charm
#

ok

#

is it possible to play the animation to make unit go from stand to crouch? that's basically all I need atm.

#

brb

winter rose
#

_theUnit playAction "Crouch"

crude vigil
#

you can do that but I believe you ask that with the usage of disableAI "ANIM" which would be a no afaik.

winter rose
#

setUnitPos "Middle", otherwise don't mess with things you don't understand πŸ˜„

crude vigil
#

Either way, it wont work as long as ANIM is disabled.

little raptor
#

You can still play animation even if ANIM is disabled

crude vigil
#

@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.

proven charm
#

the script should be complete now, thx everyone!

#

except im still missing cool weapon unjam animation πŸ˜‰

little raptor
proven charm
little raptor
#

Grab the weapon reload action from its config

winter rose
crude vigil
#

Honestly, since start Im asking to myself, why not just play an animation, that will stop shooting etc , wont it?

crude vigil
little raptor
#

or just a looping gesture that doesn't allow shooting

proven charm
winter rose
#

the… unit statistics…

proven charm
winter rose
#

the plot thickens

#

but well, okay
at least it works

crude vigil
#

If it is your ui, make it adapt

little raptor
proven charm
#

no need with the current weapon jam code

crude vigil
#

If you do it as I say, you ll need to store the bullet count in mag, send it to ui as well

little raptor
#

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

proven charm
#

not working on a mod

crude vigil
# proven charm not working on a mod

Darn so many constraints you have, dont you notlikemeowcry . 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.

proven charm
#

yeah many ways to do this, what I prefer is to let "arma have" all the data

little raptor
#

If they have more mags

#

If not they'll switch weapons meowsweats

crude vigil
#

Makes sense in every scenario, dont see the problem?

little raptor
crude vigil
#

Too much adrenaline, I got no time to unjam this, switching to pistol meowtrash

little raptor
#

What if he switches to the launcher?! 🀣

crude vigil
#

War is a bad thing but we gotta all do what it takes, even if it takes tearing the enemy into limbs. salute

crude vigil
# little raptor Last mag?

Give another mag with same ammo count , do I have to tell it as well, I would take all the fun for myself. meowtrash

little raptor
#

What if inventory is full?! πŸ˜›

crude vigil
#

AI never has full inventory blobdoggoshruggoogly

#

Has full inventory but last mag notlikemeow

little raptor
#

Actually back when I played some DRO I would always give my guys tons of ammo notlikemeow

#

Almost entirely full

crude vigil
little raptor
#

Mags...meowsweats

crude vigil
crude vigil
#

I think my point has been made, thank you. meowtrash

little raptor
crude vigil
cyan dust
#

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.

crude vigil
robust tiger
cyan dust
cyan dust
robust tiger
little raptor
proven charm
#

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

little raptor
#

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

cyan dust
#
_killWP =_group addWaypoint [_target, -1];
_killWP setWaypointType "DESTROY";
winter rose
#

it keeps saying that WP is not attached
what is saying that? πŸ‘€

winter rose
round scroll
#

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?

cyan dust
winter rose
#

one problem at a time πŸ˜„

#
_group reveal _target; // reveal needs a local _group btw
crude vigil
meager epoch
#

Cant he record the path himself then play it?

crude vigil
#

Thats the easiest way yes

#

but it depends on usage case

cyan dust
little raptor
crude vigil
#

If you dont trust me, trust to @little raptor's sweating emotes. meowtrash

little raptor
#

Β©

cyan dust
cyan dust
crude vigil
# cyan dust Sure I do (= Just lost a little

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

cyan dust
crude vigil
#

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?

cyan dust
#

No, the target is player-controlled object

crude vigil
#

If it is moving target, then you definitely dont wanna mess with it. I am sure πŸ˜…

#

Especially if it is player controlled meowtrash

#

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.

cyan dust
#

Thank you for the explanation.

crude vigil
mortal forum
#

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

meager epoch
#

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.

frosty cairn
#

how could i execVM multiple .sqf's with one line of code?

#

like can i execute an array of them or smth?

cosmic lichen
#

Why is that important?

frosty cairn
#

code optimization, i suppose

#

well

#

sort of

cosmic lichen
#

execVM "script1.sqf"; execVM "script2.sqf" πŸ˜„

#

If you wanna optimize don't use execVM

copper raven
#

executing them like above will always be faster than using a loop

frosty cairn
#

its not a big issue, just wondering

cosmic lichen
cosmic lichen
#

Bitte

winter rose
#

see also currentWaypoint

mossy lark
#

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?

undone flower
mossy lark
#

Sorry, not the init field - the execute field from Zeus

copper raven
#

so modded im guessing?

#

it should be _this and not this, if we're talking about init boxes that zen/achilles add

mossy lark
#

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

undone flower
#

anyone knows exactly what do I put in config.cpp for requiring CBA?

hollow thistle
#

cba_common

undone flower
#

got it

meager granite
#

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

little raptor
meager granite
#

The opposite, I have vectors and need xyz angles that mission.sqm uses

little raptor
#

Can you show a sample of what mission.sqm has?

meager granite
#
position[]={14425.979,12.056995,7564.9883};
angles[]={0,1.5707964,0};
little raptor
meager granite
#

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

meager granite
#

@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

little raptor
meager granite
#

I think you're thinking it the other way around, I need to figure the angles and already have vectors dir and up

little raptor
#

Oh sorry 🀣

#

I'm not really focused rn 🀣

little raptor
little raptor
#

ok so I'm back

tender fossil
#

Not sure about the math but are you sure you're not hitting a gimbal lock?

little raptor
#

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 meowsweats

#

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 meowsweats

hexed crown
#

Way more complicated than one might like.

little raptor
#

it's simple meowsweats
you just have to do an asin for b and two atan2 conversions for a and c

hexed crown
#

Eulers are fun, right?

winter rose
#

NO

hexed crown
#

How about them quaternions, am I right?

#

My brain starts to hurt just thinking about programming with them in any way.

little raptor
little raptor
#

I know what a gimbal is meowsweats

tender fossil
#

Quaternions don't have that issue

little raptor
#

ah yeah I see what you mean

tender fossil
#

Was just wondering whether a gimbal lock caused Sa-Matra's issue or not

meager granite
#

Nah, its not it

#

Gonna continue trying to combat my vector math retardation tomorrow

spark turret
#

recommendation for a warning beep sound like on a shooting range?

little raptor
spark turret
#

yeah the class name

#

for using with playSound or similar

little raptor
#

dunno notlikemeow
did you look at the time trial missions?

tender fossil
spark turret
#

no πŸ˜„ was just hoping someone might know so i can be lazy

spark turret
cosmic lichen
#

Firing drills got sounds for that. Just browse the config viewer

little raptor
cosmic lichen
#

music only

little raptor
#

@spark turret

a3\Missions_F_Gamma\Challenges\firing_drills\sp_fd06.altis\

cosmic lichen
#

Should expand it for all sounds thoughπŸ€”

little raptor
#

that's a mission file

spark turret
#

Ah right snooping time it is :P

cosmic lichen
#

You can also place a trigger and listen to the sounds with it

spark turret
#

Right heard about that recentl?

#

Ah theres a whole buncj of shooting range sounds, starting with "Firing Drills -"

cosmic lichen
spark turret
#

yep thats what i found πŸ‘

foggy jetty
#

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

little raptor
still forum
#

item*

foggy jetty
#

I mean, object on the ground or item in the inventory

little raptor
#

item in the inventory
whose inventory?

onyx hound
#

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)

little raptor
#

show the hint you want the player to see normally (no remoteExec)

#

remoteExec the hint that you want to show to others

onyx hound
#

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?

little raptor
little raptor
onyx hound
#

Thank you. Triggers hurt my head but i unfortunately prefer them to zeusing (kill me pls)

snow pumice
#

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?

still forum
#

netId is unique

snow pumice
still forum
#

Though for terrain buildings. Multiple clients may have a instance of the same building at same position with same netid

still forum
#

In most cases the netids for terrain objects will stay the same

#

But it's not guaranteed

snow pumice
#

hm okay

#

is there anything else what could identify an building for every player

#

something else than the position

meager granite
#

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

snow pumice
#

thanks @still forum @meager granite

tropic spruce
#

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?

tropic spruce
undone flower
#

is there any elegant way to get the units of a side, excluding the player?

#

cus i'm just units side - [player]

little raptor
undone flower
#

excellent. making my life easier

little raptor
#

not sure what units returns for units inside vehicles

undone flower
#

i'll check

#

I placed a civilian inside a truck as driver and it returned the unit as normal. no vehicle reference

jade acorn
#

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.

little raptor
#

HandleDamage EH to be exact

tepid pebble
#

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?

versed widget
#

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 ?

still forum
#

no difference

winter rose
#

well there is a compiling time ahead but other than that, exec time is the same

meager epoch
#

How can I get the amount of health the player has?

#

nvm i figured it out

proud carbon
#
["Sov_Plane_fall",_yourvehicle,true,[0,0,0],4] remoteExec ["playSound3d"];
#

this should work with what I am trying to do yes?

cold pebble
winter rose
proud carbon
#

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?

cold pebble
#

Well -2 is fine, if a player won't be the server

#

Yes

#

See the examples

#

Various ways depending on where it is

proud carbon
#

but I have a custom file.

#

should path it like how I ref it in cfg sounds?

cold pebble
#

Well if its in a mission file; playSound3D [getMissionPath "mySound.ogg", player]; // to play a mission directory sound

proud carbon
#

how would the work for this?
"Sov_Ai\sounds\Sov_Plane_fall.ogg"

cold pebble
#

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.

proud carbon
#

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

cold pebble
#

Yes, but this would mean a player would hear the same sound played multiplied by the number of players on

proud carbon
#

that is if I have done it right :0

#

Oh

#

so it is global?

cold pebble
#

yes

#

say3D is local execute

#

So you'd remoteExec that

#

But playSound3D is global execute

proud carbon
#

I need to come here more, this was a thing my mates told me to try

winter rose
#

read the wiki, you said?

#

usually, a command's locality is displayed there yes πŸ˜‰

cold pebble
#

Heeeey

#

I wanted to post that

#

But wasn't allowed PepeHands

winter rose
#

I'm in your base, stealin' your screenshots

proud carbon
#

so this will work now.
_Sov_Plane_fall_Pathed = (getMissionPath "Sov_Ai\sounds\Sov_Plane_fall.ogg");
playSound3D [_Sov_Plane_fall_Pathed,_yourvehicle];

winter rose
#

where is the sound file placed?

cold pebble
#

You've lost a lot of parameters, and is the sound in your mission

proud carbon
#

in the sounds folder

#

@winter rose

#

inside the Sov_Ai folder

cold pebble
#

Is this in the mission file? πŸ€”

winter rose
#

so you have <missionRoot>\Sov_Ai\sounds

#

OK

proud carbon
winter rose
#

then yes good

proud carbon
#

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

cold pebble
#

prolly worth checking getMissionPath "Sov_Ai\sounds\Sov_Plane_fall.ogg" gives you the correct path

winter rose
proud carbon
#

Just alt tabbed back,@winter rose your telling me I've been doing it the long way?

winter rose
#

yes.

proud carbon
#

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?

winter rose
#

have you heard of the wiki? πŸ™‚

proud carbon
#

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?

winter rose
#

…use Audacity πŸ˜„
btw, the sound will not be attached to the vehicle

proud carbon
#

so it wont follow the vic at all? even without soundPosition arg?

winter rose
#

iirc

proud carbon
#

Should I switch to say3d?

winter rose
#

would be better I guess

#

note, if the object gets killed the sound stops

proud carbon
cold pebble
#

If you are going to use say3D, note that you give this a classname as defined in CfgSounds

proud carbon
#

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?

cold pebble
#

is db+75 valid?

proud carbon
#

worked for "Sov_missile_hit"

cold pebble
#

Ok

#

So your params need to look like thi

#

Wait

#

Which syntax you using?

#

2?

proud carbon
#

sqf

#

?

winter rose
#

[from, [all the params]]

cold pebble
#

If its syntax 2

#

What Lou said

proud carbon
#

Thanks bros

#

so [_yourvehicle,[Sov_Plane_fall, 20, 1, false]] remoteExecCall ["say3d"];

winter rose
#

"Sov_Plane_fall"

#

the "quotes" are important here

cold pebble
#

And you don't need false there as its the default value

winter rose
#

same with pitch

proud carbon
#

[_yourvehicle,["Sov_Plane_fall", 20, ""1, false]] remoteExecCall ["say3d"];

#

yes?

winter rose
cold pebble
#

Where have those "" come from

#

Just surrounding the sound name

#

Not around the 1

#

[_yourvehicle,["Sov_Plane_fall", 20]] remoteExecCall ["say3d"];

winter rose
#

btw, 20m max distance is ok to you?

proud carbon
#

it is a voice over of some dude screaming his lungs out while a beeping noise is in the back

cold pebble
#

Sounds a bit low tbh

winter rose
#

if it's on the plane, it's OK

#

just check that it can be heard from external camera

proud carbon
#

ok, back to my next problem, how do I increase the volume without using audacity to deep fry the susy baka

winter rose
#

why not Audacity

#

you already used the db+75
and Arma is not a sound software 😬

proud carbon
#

I guess it won't hurt.

winter rose
proud carbon
#

I have greatly ear raped myself, but the audio has been amplified greatly, so may God have great mercy on anyone in third person.

#

for some unknown reason the player are not getting kicked out of the plane.

cold pebble
#

Because _passengers isn't defined

#

You need a private _passengers = [];

marsh plinth
#

how can i edit stuff like cfgSurface?

marsh plinth
winter rose
idle jungle
#

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

jade acorn
#

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

idle jungle
#

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 :)

jade acorn
#

yes

rugged tangle
#

Is there any way to remove the Take and Open scroll menu options from weapons, vests etc? I'm using some as props.

cosmic lichen
#

Disable Simulation or make them simple objects

rugged tangle
#

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

rugged tangle
#

Seems that the solution is to set the health to 0.

jade acorn
#

are there any character limits for classnames in cfgs? like for the sounds in CfgMusic

meager epoch
#

Is there a more natural way of forcefully turning the direction the player's looking at other than setDir?

still forum
jade acorn
#

fair enough

meager epoch
#

welp

winter rose
little raptor
meager epoch
#

how

#

cause with setDir it looks awful

little raptor
#

using setDir every frame

meager epoch
#

So what, do i like slap 200 setdirs lol

little raptor
#

every frame

#

not in one go meowsweats

meager epoch
#

:d

little raptor
crude vigil
#

even if you do that, it will look ugly without using animation

meager epoch
#

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

crude vigil
#

you tried to use the usual animation that is used for rotating?

little raptor
#

not turn dir

#

or head

meager epoch
#

oh ait

crude vigil
#

Well as I said "without"

meager epoch
#

What's the distance in playSound3D?

#

Is it like

#

Meters and stuff

crude vigil
#

max distance the audio reaches, in meters

meager epoch
#

ty

winter rose
#

it does now

crude vigil
#

well, cant blame you though, all distance related commands are in meters, afaik.

winter rose
#

yep

spark turret
#

how do i test in the hit EH if a popup targets base was hit or the relevant part?

distant oyster
spark turret
#

where is hit local to on dedicated? shooter or hit object?

#

thx for that hint

distant oyster
spark turret
#

ah hitpart has a description for that

tropic spruce
#

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.

winter rose
#
private _a = [];
[_a] call {
  params ["_b"];
  // identical to
  private _b = _this select 0;
};
tropic spruce
#
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? 
winter rose
#

πŸ™‚

#
private _var = 0;
call {
  private _var = 5;
  call {
    private _var = 10; // disappears after this line
  };
  _var // == 5 here
};
_var // == 0 here
tropic spruce
# winter rose πŸ™‚

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?

winter rose
#

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

tropic spruce
#

Thank you, so much. I’m on phone this makes more sense now ❀️

winter rose
#
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
tropic spruce
winter rose
#

yes
and does not point to the previous one anymore

tropic spruce
#

Thank you again, this whole thing is from me trying to add more to an existing script and having it fail horribly. YMg_Dead

winter rose
#

no worries, it's always better to know a bit more after all πŸ˜‰

gloomy aspen
#

Hey guys, is there a way to make pop-up targets require a couple more hits before theyll go down?

rugged tangle
#

Maybe disable damage and use Hit EH to count hits

grand idol
#

Is there a cleaner way to get a weighted random integer than this?

winter rose
grand idol
#

Thanks! That did it.

little raptor
mossy lark
#

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.

meager epoch
#

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.

little raptor
meager epoch
#

but it's not

#

or is there another way to write it?

little raptor
#

Β―\_(ツ)_/Β―

#

(and not db+1, just 1)

meager epoch
#

ait, will try

little raptor
mossy lark
#

What do you mean? If onPlayerRespawn.sqf is left blank?

little raptor
#

yes

mossy lark
#

the body persists indefinitely

little raptor
#

I think as soon as you press the respawn button you have already respawned? think_turtle

#

did you test that?

#

put a systemChat, see when the script triggers

mossy lark
#

I'll try the test - it seems to be triggering on death though

little raptor
mossy lark
little raptor
#

Β―_(ツ)_/Β―

#

test

drifting sky
#

is there anything like a priority queue already implemented in arma2?

little raptor
#

what priority queue?

drifting sky
#

adding new element at position based on its priority vs. priority of elements already in the queue.

little raptor
meager epoch
#

@little raptor still nothing D:

little raptor
meager epoch
#

It works as cfgMusic

little raptor
#

sounds[] = {p_manScreaming};
wat?

#

why did you put that?

#

it's wrong anyway

meager epoch
#

Idk lol

little raptor
#

and you're not supposed to put anything there

meager epoch
#

Saw it somewhere

#

ait, gonna yeet it

little raptor
meager epoch
#

ye

#

tabbed out, my game crashed D:

#

big sad

winter rose
tough abyss
#

Is there a script or way i can use a drone on a laptop instead of the tablet in game?

fair drum
tough abyss
meager epoch
drifting sky
#

can I specify a script to execute once every frame?

winter rose
little raptor
drifting sky
#

There's an "onEachFrame" in A2

#

however, it says only one of these can run at a time

little raptor
#

oh wait it does meowsweats

drifting sky
#

And I want to use this in a mod

winter rose
drifting sky
#

which sounds like a bad idea, if only one can be active at a time

winter rose
drifting sky
#

but it doesn't appear there's another way

winter rose
#

you simply take the risk of being overriden by something else, that's it Β―_(ツ)_/Β―

#

that or use Arma 3 πŸ˜›

little raptor
#

IsNil exists in A2 right?

drifting sky
#

yes

winter rose
#

ouch

little raptor
#

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

drifting sky
#

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

little raptor
#

I have no idea why you're still sticking with A2 🀷
It's very limited in many ways (especially scripting)

drifting sky
#

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

little raptor
drifting sky
#

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

tropic spruce
# little raptor _a is still []

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||

tight cloak
#

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

little raptor
#

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 🀣

tight cloak
#

the forum thread was super old (2011 to be exact) and i cant find any help on it elsewhere

little raptor
tight cloak
little raptor
#

was it really that hard? meowsweats

tight cloak
#

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?

little raptor
tight cloak
#

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

little raptor
#

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;
    };
}];
tight cloak
#

the above version just breaks it entirely :/

little raptor
tight cloak
little raptor
#

what did you write?

tight cloak
#
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;
    };
}];
little raptor
# tight cloak any possible way to modify this slightly tho? using ```sqf _throwables = []; "_...

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;
    };
}];
tight cloak
#

hmmm. still has no effect, grenades can still be thrown

#

maybe it just cant be done for all grenades?

little raptor
#

what about the new one?

little raptor
#

all throwables are fired from the Throw weapon

tight cloak
#

it works!

#

ty ❀️

#

now i just need to add the ace throwable.... p a i n

brazen lagoon
#

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

little raptor
#

isUAV

#

in config

brazen lagoon
#

thats a bool I assume

little raptor
#

there is no bool in config

brazen lagoon
#

so its probably like getBool (path >> to >> vehicle >> "isUav")?

#

oh

little raptor
#
getNumber (configOf _veh >> "isUAV") == 1
brazen lagoon
#

right

#

sick, thanks

#

and then just createVehicleCrew to make it a controllable UAV right?

little raptor
#

yes

brazen lagoon
#

cool

grand idol
#

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.

undone flower
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
grand idol
#

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]
olive cairn
#

Hi i have a question

drifting sky
#

Can anyone tell me exactly what "compile" is doing in this line: _this call (call compile getText (_cfg >> "jsrs_soundeffect"));

little raptor
#

not sure why there are two calls tho thonk

#

it could just be _this call compile getText (_cfg >> "jsrs_soundeffect"); if it was written properly

olive cairn
#

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

little raptor
#

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

olive cairn
#

remoteExec ["titleText", 0, true];

little raptor
olive cairn
#

yes thanks, i mean i have something like this: ["<t>my title text</t>, "PLAIN DOWN", -1, true, true"] remoteExec ["titleText", 0, true];

brazen lagoon
#

wouldn't you want -2

#

or maybe an array of players

#

(instead of 0)

little raptor
olive cairn
#

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

brazen lagoon
#

well does titletext do anything on a server

#

assuming its a dedi I mean

olive cairn
#

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

little raptor
#

as you said it yourself, running many remoteExecs are bad.
the way to solve it is making functions
and remoteExecing the function

drifting sky
#

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?

drifting sky
#

getText (_cfg >> "something").... what happens in the event that "something" doesn't exist as part of _cfg?

tranquil thunder
#

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";};
};```
little raptor
#

this is not a global variable

#

it's not seen by the code inside the spawn

tranquil thunder
#

aaah, i see

little raptor
#

(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

tranquil thunder
#

aight, thank you so much mate

drifting sky
#

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

little raptor
drifting sky
#

Just being sure.

#

Is there a Local only version of playSound3D?

little raptor
#

no

#

only say3D

#

(which need cfgSounds entry)

drifting sky
#

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

drifting sky
#

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")

drifting sky
#

how would i get a sound from its name as a string?

little raptor
drifting sky
#

uh okay so.... object say3D "sound_name" should work?

#

where "sound_name" is the anme of a sound defined in cfgSounds

little raptor
#

yes

drifting sky
#

and the other question. do you know if 1 object can "say" more than 1 sound at a time?

little raptor
#

Β―_(ツ)_/Β―

#

try

drifting sky
#

do you have a link to that info?

#

or did you just test it?

little raptor
drifting sky
#

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?

little raptor
#

afaik no

#

but _i will

drifting sky
#

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?

drifting sky
#

Can I reduce _forEachIndex by 1 to compensate?

little raptor
#

if you use deleteAt

little raptor
drifting sky
#

other arrays... but

#

I'm basically doing: array set [_forEachIndex, -1]; array = array - [-1];

#

inside of forEach array

little raptor
#

do it outside

little raptor
drifting sky
#

hmm... if it doesn't change the array being iterated, why would it affect performance?

little raptor
#

in every iteration

#

while you could only do it once and get the same end result

drifting sky
#

I'm removing several elements in the array during the forEach loop

#

but not all of the elements

#

it's conditional

little raptor
#

so?

#

doesn't change what I said

#

_array - [-1] removes all -1s

drifting sky
#

ah... yes, of course

#

thanks

frigid oracle
#

is BIS_fnc_textTiles local only? If so am I able to remote exec it?

winter rose
#

everything UI is local

frigid oracle
#

Gotcha

drifting sky
#

can cfgsounds contain sounds defined like: asound[] = {sounda,0.25,soundb,0.25,soundc,0.5}; ?

winter rose
lavish coral
#

Is there a way to get script handle for remoteExec'd scripts?
Or how does one go about terminating remoteExec'd scripts

winter rose
lavish coral
#

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

willow hound
hollow wing
#

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 ?

tight cloak
lavish coral
grand idol
#

How do you select an element within a nested array?

_myArray = ["ABC",["1","2","3"],"Dog","Cat"];

How do you select "2"?

winter rose
#
_myArray select 1 select 1
grand idol
#

Cool, simple enough.

winter rose
#
_myArray select 1 // gets ["1", "2", "3"]
select 1 // gets "2"
```yep, ez pz πŸ˜‰
grand idol
#

Thanks a bunch.

winter rose
#

with pleasure! praise_the_sun

spark turret
#

is it possible to have an action (through addaction) availalbe while in the radius, without having to look at the action supplier?

crude vigil
spark turret
#

yeah

crude vigil
# spark turret yeah

add the action to player, involve your "supplier" in condition, check whether in range or not?

spark turret
#

yeah i guess thats the reasonable thing to do

hushed tendon
#

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?

spark turret
#

how about a raycast?

#

or is that nor broad enough?

hushed tendon
brave jungle
#

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
brave jungle
#

Yeah I suppose it would be wouldn't it

#

πŸ˜…

winter rose
#

if I can't help, it's most likely not #arma3_scripting :p (that and/or I don't know, ofc)

brave jungle
#

haha you always know πŸ˜„

weak obsidian
#

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;
};
supple matrix
#

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?

spark turret
#

anybody got a suggestion for scenic but not dangerous AA fire?

tight cloak
#

ALIAS is your saviour there

spark turret
#

i tried using HMG cars with 100% skills but 0% aiming precision but its not really what i want

tight cloak
#

like this?

#

link is ALIAS' ambient battle script