#arma3_scripting

1 messages Β· Page 696 of 1

graceful kelp
#

thank you that has it sorted

#

just one of those things were you stare at it so long you dont see it thank

snow pumice
graceful kelp
#

so

_Radarrange = getnumber (configFile >> "CfgVehicles" >> _unit >> "components" >> "SensorsManagerComponent" >> "Components" >> "ActiveRadarSensorComponent" >> "AirTarget">> "maxRange");

works in dubug but not in script saying it dosent like the variable

graceful kelp
snow pumice
#

Maybe the complete error message?
Keep in mind you are getting an number from the config

little raptor
#

so you must change it to: typeOf _unit

graceful kelp
little raptor
wicked roostBOT
#
Arma RPT

Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.

To get to your RPT files press Windows+R and enter %localappdata%/Arma 3

Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files

To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.

stark granite
#

hey guys, Im trying to add a simple add action to allow civilian interaction to raise civilian rep using ration handouts. I think my conditions or variable may be used wrong? anyone spot anything obvious?

// civilianobjectinit
            _conditions = "(_target getVariable 'CivilianHelped') = nil";
            _this addaction ["Give Ration", 
                {
                    params ["_target","_caller","_actionId","_arguments"];
                    if ([_caller, "ACE_Humanitarian_Ration"] call bis_fnc_hasItem) then {
                        _caller removeitem "ACE_Humanitarian_Ration";
                        _randomAnswers = ["Thank you!","PizzaStrem?","This is great!","Oh great, Thanks.","This will have to do"];
                        _target customChat [5,  selectRandom _randomAnswers];
                        _target setVariable ["CivilianHelped", 1, true];
                        [0.005] call F_cr_changeCR;
                    } else {hint "you don't have any rations"};
                },
                nil, 1.5, true, true, "", _conditions
            ]
#

Right now the action isn't added at all, I think its either the use of _target in the conditions, or failing to initially set a variable to check for, confusled

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
little raptor
#

_conditions = "(_target getVariable 'CivilianHelped') = nil";
wrong in every way

#

_this addaction
there's no _this in object init

stark granite
#

uh

#

I dont understand the code thing xD

little raptor
#

@stark granite it's the tilde ~ key (next to 1 on most keyboards)

stark granite
#

Sorry about that

#

Thank you sir!

#

I use _this for all my other object inits and its fine?

little raptor
stark granite
#

Its being called from the KP liberation Object init

#

Which should just add it directly to the init each civilian placed

little raptor
#

I thought you meant Eden object init

#

anyway

#

this

_conditions = "(_target getVariable 'CivilianHelped') = nil";

is wrong

stark granite
#

Okay, is that because of how im using the _target there?

#

or the nil

#

or just all of it xD

little raptor
#

change the one in the code to:

_target setVariable ["CivilianHelped", true, true];

and the one in the condition to:

!(_target getVariable ["CivilianHelped", false])
#

in other words:

"!(_target getVariable ['CivilianHelped', false])"
stark granite
#

Brilliant

#

So its setting Civilianhelped as a true false, rather than a number?

little raptor
stark granite
#

So in total, in the object init


 [
    ["civilians"], 
        {
            _conditions = "!(_target getVariable ['CivilianHelped', false])";
            _this addaction ["Give Ration", 
                {
                    params ["_target","_caller","_actionId","_arguments"];
                    if ([_caller, "ACE_Humanitarian_Ration"] call bis_fnc_hasItem) then {
                        _caller removeitem "ACE_Humanitarian_Ration";
                        _randomAnswers = ["Thank you!","PizzaStrem?","This is great!","Oh great, Thanks.","This will have to do"];
                        _target customChat [5,  selectRandom _randomAnswers];
                        _target setVariable ["CivilianHelped", true, true];
                        [0.005] call F_cr_changeCR;
                    } else {hint "you don't have any rations"};
                },
                nil, 1.5, true, true, "", _conditions
            ]
        }
],
#

Looks more viable?

little raptor
#

yeah it looks fine

#

I think

#

I didn't read the whole thing

#

but the part I said is correct

stark granite
#

Great, Ill give it a test and see what happens πŸ™‚

#

Thanks for your help leopard, very kind of you!

echo smelt
#

Do you guys have any idea how I can make a batch file run a .exe on multiple files?

little raptor
#

wdym?

echo smelt
#

Ah okay will do lol Ill head over there

little raptor
mighty vector
#

can I define an array from another array like:

array_used-in_mod = [ MYARRAYVARIABLEHERE ]
?

novel delta
#

probably a dumb question, Am i able to limit a teleporter to just someones steam ID?
or to a specific squad?

current teleporter i use is
this addAction ["Teleport", {player setPos (getPos Kavala2)}]
for example

novel delta
#

mind pointing me in the right direction?

little raptor
#

is this teleport function pre-defined?

#

as in, set once

#

and never changes during the mission?

novel delta
#

correct

#

just set in eden and then not touched

little raptor
#

you can put something like this in initPlayerLocal.sqf:

params ["_player"];
_allowedSteamIDs = ["12345", "56789", ...];
if (getPlayerUID _player in _allowedSteamIDs) then {
  _player addAction ["Teleport", {_this#1 setPos (getPos Kavala2)}] 
};
novel delta
#

alright thanks

meager epoch
#

How can I have a task be set to completed when something is taken out of a supply box (or any other box)?

#

And by something I mean literally anything, not a certain item.

gloomy aspen
#

Hey guys

any idea why this is working properly


params ["_unit"];

_whitelist = ["sf_mc"];

(headGear _unit in _whitelist)

but this isnt


params ["_unit"];

_whitelist = ["sf_mc_ComtacIII","sf_nf_mc_ComtacIII"];

(headGear _unit in _whitelist)
#

Script wise they match up perfectly, but _whitelist seems to be very intermittent :/

mighty vector
#

@little raptor a mod is using an array, I want to define array contents from outside the mod, doing something like mod_array = [ my_array ]. just not needing to pack every time I change it.

little raptor
copper raven
little raptor
#

(also this mod_array = [ my_array ] is wrong)

gloomy aspen
#

@copper raven What would be the right thing to use here?

copper raven
#

^ that

gloomy aspen
#

Ah ok, will look into that, thanks guys πŸ™‚

meager epoch
copper raven
#

_item is the item that unit took from the _container

#

you need to check if _container is the one you want, and then set task state, preferably remove this event handler aswell

rugged tangle
#

How could I check the length of a player's weapon?

crude vigil
# rugged tangle How could I check the length of a player's weapon?
  1. Find the right shoulder position from selections (whatever the name is)
  2. Create a temporary Fired EH , shoot the weapon with fireAtTarget command, give the precious bullet back (or you can do this on a copied unit with same loadout), get projectile position relative to model space upon firedEH triggered
  3. Take difference of these positions.
    Bonus) Dont hate me if there is a simpler way. πŸ˜…
rugged tangle
#

Funnily enough I was thinking of a similar solution πŸ˜„

meager epoch
#

Is there any way to check whether or not someone is still being held hostage? (i got a soldier with the "set hostage" checked and I want the task to be set to completed once I untie him)

coarse schooner
#

If you are using 3den enhanced there is. It is acquired with getVariable though I can’t recall the name.

#

Found it:
unit0 getVariable β€œEnh_isHostage”;

little raptor
#

you can do it in many ways without Eden Enhanced as well. e.g.:

!captive _unit

or just use your own variable

meager epoch
#

thanks, will try it out later

tough abyss
#

is there a way to prevent player looting on uniforms, vests, helmets but not backpacks in multiplayer?

Or restrict items to HAVE to be held in certain storage items? Like you cannot put item x in your bag but you can place it in your uniform?

tough abyss
#

I basically want to prevent a few things:

  1. prevent players from stripping modded uniforms and leaving naked base vanilla models all over the place
  2. Prevent players from looting armor from other factions breaking the immersion of the faction vs faction aspect of my mission
copper raven
#

you can compare uniforms and stuff on inventory close, see if player has an unwanted one, if it does, remove it and replace it with the old one(you can save it into some variable)

#

you can also do the same thing with take eh, if you want the effect to be instant, rather than needing the player to close the inventory first

turbid crag
#

Is there a way to place a marker down in side, group, etc. remotely?

I want to place down a marker down as a Virtual Zeus in e.g BLUFOR side chat, but when I remote control a BLUFOR unit it still places it in the logic side.
Setting the curator entity to BLUFOR allows me to place a marker in the wanted side when remote controlling a unit, but I was wondering if there was another way.

snow pumice
young current
unique plank
#

hey, i was trying to find a way to set the probability of presence for a group of people and objects so if one of them is there all of them are there

#

right now im using an invisible helipad that has the probability set on it and then in the init of every object/unit that i want to spawn i have put !(isnull helipad_1)

#

strangely this seems to work for spawning the units but not the objects

#

any ideas?

copper raven
#

if that doesn't work, then the second best option is what TaktischerSpeck said

unreal scroll
#

Question:

  • I had two large "unclear" functions, that return nothing - only doing some not time-critical things.
    One uses Take EH, the second with CBA PerFrameHandler (3 seconds).
    Can I improve performance with spawn?
    Like, to place a spawn command inside the EH
_unit addEventHandler ["Take", {
    params ["_me","_container","_item"];
    [_me, _container, _item] spawn {
    params ["_me","_container","_item"];

, and replace CBA PFH with spawn + while loop?

copper raven
#

that's probably the worst decision you can make πŸ˜„

#

unless you run something that would make a noticeable game freeze(not caused by a single command call)

unreal scroll
#

I read before, that using scheduled environment (spawn) won't hit the performance as unscheduled for non-critical scripts when doing large calculations.
What are the cons I could encounter?

copper raven
#

well if your scheduler is already full of shit, you will instantly feel a delay of the effect(whatever your take event handler does)

#

when doing large calculations
like i said you have to be doing something REALLY large for you to have a need to go scheduled for things like that

#

and even then if its something like a nearestObjects making the game freeze, in scheduled the exact same thing will happen

unreal scroll
#

Ok, thanks.

copper raven
#

generally speaking just stay in unscheduled whenever you can, a scheduled script will almost never make things better

proud carbon
#

Hey how do I find the vic the unit is in?

little raptor
#

vic?

proud carbon
#

yeah like a car or what ever

#

nvm found the command

little raptor
#

vehicle

cosmic lichen
#

vehicle, in, objectParent

versed widget
#

how to stop a script without terminating the while condition ?

#

im using a condtion to play a code when the player is in the vehicle but when he get out the code will continue to play

copper raven
little raptor
#

terminate the whole script, or use break in the while

winter rose
desert palm
#

quick help if my script activation is execVM "spawnbaddies.sqf"; what will be my termination

#

terminate "spawnbaddies.sqf"; ?

little raptor
#
some_script_handle = execVM "spawnbaddies.sqf";
terminate some_script_handle
verbal knoll
#

trying to import dialog into the gui editor and i get this errorhttps://gyazo.com/9ebd6399a1d9818ec037d83b93bc37b1

trim sentinel
#

How do i lock vehicles per role?

copper raven
#

use getin event handler, and check for role

trim sentinel
#

i have no idea how script anything, so idk what that means lol

fading oar
#

Hola, I have a getMarkerPos issue that hopefully someone can help me with. I type this in the debug console for an existing marker -

_mPos1 = getMarkerPos "themarker";
_mPos1```
...and it keeps returning coords 0,0,0 EXCEPT for one time, when it returned real coords. I rebooted, stripped out the CBA function library, and still can't get it to work. Am I doing something wrong?
#

(i can move the marker, set the color and alpha, etc, just can't get the pos)

dreamy kestrel
#

ty both, yes, pretty much my take away's as well, ty. @unique sundial

drifting portal
#

is there a way to control an object's rotation relative to its model space instead of the world space?

unreal scroll
#

@drifting portal The object's model space is linked with the object itself, so it rotates with it too, is it?

robust tiger
robust tiger
distant oyster
drifting portal
#

I meant rotation across all axis

#

X,Y,Z

drifting portal
#

setDir resets BIS_fnc_setPitchBank

#

so I should use it before it right?

robust tiger
#

yes

fading oar
#

@distant oyster How interesting, it returns "". But the marker is placed, not sure how it doesn't exist.

#

This is going to drive me batty

#

I was running PPL Markers a few days ago, can a mod permanently change something in Arma?

#

.. and @robust tiger allMapMarkers returns [] even though I can see all the markers on the map in the editor

little raptor
fading oar
#

Recently?

little raptor
#

in the dev branch

#

if you're on stable it's not fixed for you yet

fading oar
#

i'm on stable

#

ok, so I guess I should look up the bug and see when an update is coming? This seems kind of big I would think

little raptor
fading oar
#

Ok I'll look into that thx..

fading oar
#

Yeah, I just wrote a quick script, it returns correctly for allMapMarkers but returns 0,0,0 for marker pos... I'll look into that bug

tough abyss
#

so I found this command on the wiki:

isUniformAllowed

Description: Check whether given uniform can be dressed by target soldier.

So could i set that so the entire faction checks for this? For example I want my Blufor players to be unable to wear a list of uniforms

_canUse = _unit isUniformAllowed "U_B_CombatUniform_mcam";

Where would be the best place to put this on a dedicated server? and how do i define an entire faction?

crude vigil
tough abyss
#

Ok thanks.

So what about forceAddUniform?

Create a new uniform and hard link it into slot (without any restrictions).

#

hard link? as in it cannot be removed?

crude vigil
#

It can be removed, the command ignores whether or not a uniform is allowed or not and makes unit wear it

tough abyss
#

crap lol

#

Im trying to research a solution to prevent factions from taking uniforms off other factions

crude vigil
#

if you want to prevent some uniforms from being worn, you need to setup event handlers and check uniform s for that.

crude vigil
tough abyss
#

and exit with a message like "you cannot wear this" or something

#

Ok, well im going to have uniform progression i want leveling using MCC, I want to prevent noob players getting higher end uniforms

#

so event handler?

crude vigil
#

yes

tough abyss
#

i need to learn about those a bit more

crude vigil
#

Depending on your mission(arsenal etc), you need to handle everything of course

#

For starters, it is easy to just prevent said uniforms from being taken hence I linked "Take" event , if you want to struggle a bit more, you can always detect manipulations when inventory is opened and check if unit is attempting to change their uniform

tough abyss
#

ok, few questions.
1: Where do i put this event handler to execute all the time on my server? in descriptions.ext for th mission? or maybe in the server specific config files?

2: can i define player as the "object"

this addEventHandler ["Take", {
    params ["_unit", "_container", "_item"];
}];
#

and would i just make a massive list of uniforms as an array within the EH?

#

for the "_item"

peak pond
#

Is there any way to script an AT unit to hold fire with launcher but still allow him to fire his primary/secondary?

keen orchid
#

i'm getting an error in my code with "waitUntil {repair_truck inArea[_this, 20, 20, 0, false]};"

it goes "waitUntil {repair_truck |#|inArea[_this, 20, 20, 0, false]}; error 0 elements provided, 3 expected"

    waitUntil {repair_truck inArea[_this, 20, 20, 0, false]};
    hint "blah";
    deleteVehicle _this;
    fennek1 = createVehicle ["I_MRAP_03_F", [8590.843, 18453.182], [], 0, "CAN_COLLIDE"];
    fennek1 setDir 66.029;
    };```
cyan dust
final sun
#

Morning to you all, I have a simple syntax question, I'm trying to break out of a foreach loop using exitWith, It says that I'm missing a parenthesis ")" . I can't quite put my finger on it, does anyone see the mistake? I wrote it the same way in the wiki examples.

if (_smokeThrown= true) exitWith{ _smokeThrown= false};
warm hedge
final sun
willow hound
#

You can use break instead of exitWith now πŸ™‚

noble flint
#

Can someone explain me to the correct way to make a patch mod.

#

or how to setup an environment to edit files and test them?

noble flint
#

Does SQF use ===?

#

condition checks?

warm hedge
#

==

final sun
#

Hello guys, I got a theory question. I made a script that I want to be triggered once per let's just say 1 min. the event that triggers to run my script is a simple "Fired". Currently I have a generic Error since I'm creating an event handler in loop. Does anybody have any ideas on how to approach this?

triggeredL = false;
while {triggeredL= false} do 
{
    triggeredL= true;
    player addEventHandler [
    "Fired", 
    {
        _this spawn 
        {
            systemChat "fire!";
            
            _smokeScript = call compile preprocessFileLineNumbers "SmokeCalc.sqf";
            _timeBreak= time +60;
            waitUntil { time >= _timeBreak };
            systemChat "60 seconds passed!";
            triggeredL = false;

        }
    }
];
};
warm hedge
willow hound
#

What part of this code is the script that you want triggered once per minute?

final sun
final sun
willow hound
#

Is your intention to run SmokeCalc.sqf when these two conditions are met: The player fires and the last time SmokeCalc.sqf ran was at least a minute ago?

final sun
#

My intention is run my script everytime an enemy fires the first time, I don't want my script to run for every single bullet but with a cooldown. e.g enemy fired, cooldown is now on. the script can't be called again for 1 min

willow hound
#
Unit addEventHandler ["Fired", {
  params ["_unit"];

  private _targetTime = _unit getVariable ["SFW_targetTime", 0];

  if (time > _targetTime) then {
    execVM "SmokeCalc.sqf";
    _unit setVariable ["SFW_targetTime", time + 60];
  };
}];
```Something like this perhaps?
final sun
willow hound
#

If you want something to happen only under a certain condition, use an if-statement πŸ˜‰

copper raven
ripe sapphire
#

yo bros in MP if a client does createVehicle, is th created vehicle local to the client?

#

coz i wanna setvectordirandup it

copper raven
#

yes

ripe sapphire
#

thank you

noble flint
#

how do I setup an environment to edit files and test them?

#

for a mod

#

I don't want to corrupt anything in arma.

warm hedge
#

I don't know where to start answering

noble flint
#

Maybe some resources I can use?

warm hedge
#

Making a Mod is completely different thing than a scripting

#

A Mod can contain some scripts but Mod itself doesn't use any of scripting knowledge

noble flint
#

πŸ€”

#

I'm trying to script things into the game

#

or edit scripts

warm hedge
#

Scripts aren't Mods

noble flint
#

they are part of the mods.

#

or is that wrong

warm hedge
#

Depends on the situation

noble flint
#

I'm trying to edit code to change values inside the game.

#

Without causing errors

#

or corrupting files.

warm hedge
#

And what is the goal?

noble flint
#

The end goal?

warm hedge
#

Your goal

outer fjord
#

Is it possible to detect a specific dropped inventory item near a player?

noble flint
#

Zeus Subcategory is missing.

#

I'm trying to create it.

#

and put the units that belong to it inside.

warm hedge
noble flint
#

I see ..

copper raven
noble flint
#

but it's not a config?

warm hedge
#

What?

noble flint
#

Maybe it is.

warm hedge
#

??

noble flint
#

Maybe I am in the wrong section.

#

lmao

outer fjord
#

Sweet thanks

still forum
outer fjord
#

Would that apply to IFAKS or none weapons as well?

still forum
#

yes

#

all items on ground are inside a weapon holder

#

except backpacks in some weird special cases sometimes if I remember right

tough abyss
#

Hello. I make OFP missions. How do I make a trigger that detects if the player or a specific object is in the area of the trigger?

#

An example would be a stolen tank.

cosmic lichen
#

sync the trigger with the tank.

#

Alternatively, give the tank a variable name and set the trigger's condition to myTank in thisList

tough abyss
#

I don't know if FWatch allows me to sync triggers with units.

#

I know triggers can be synced with waypoints. I've done that many times

#

I'll try that I guess.

magic sundial
#

ello, im trying to replicate the chemlight lamps seen in the contact dlc, but im having problems disabling the mine
currently im attachting a mine to a pole to get the lil peg coming out the top, then the chemlights to that peg to make the effect
but my problem is that the mine is renabling its simulation upon being attached to the pole, so when you run close to the pole, it explodes
i literally cant find anything on this on the web at all on how to have a disabled mine
and im completely stumped

desert palm
#

Hi guys still cant seem to figure it out, found a dynamic ai spawning script on yt and ppl here been helping to make it work, it works but it spawn ai via time ques i am wanting to change this to by ai spawned ex. 50 ai in 10 ai waves and spawns in if only 4 are left alive, or the spawning will stop when the trigger is deactivated ex. when players are outside the trigger zone.

https://sqfbin.com/kuzayaqasidimijudojo

ripe sapphire
#

yo bros is there a way to change group names in MP lobby?

#

like change from Alpha 1-2 to something else

still forum
#

With CBA yes

ripe sapphire
#

so no way in vanilla

#

ok thx

robust tiger
tough abyss
#

Oh ok.

versed widget
#

if ((player in crew (_tank)) && (group player == "combatbehaviour")
then {
while {vehicle player != player} do {vehicle player engineOn true}
};

it says missing ) in the last line meowsweats is there a typo

crude vigil
#

you do not terminate the very beginning (
if ((player in crew (_tank)) && (group player == "combatbehaviour")) <---- this very last one is missing.

versed widget
#

oh my they kept me dizzy all day thanks :p

fair drum
versed widget
manic sigil
little raptor
#

Looks like it is (but it's super old)

little raptor
leaden haven
leaden haven
#

Maybe, I will check.

#

Oh, OK it is. Damn.

fair drum
#

there a way to force a keystroke?

little raptor
#

no meowsweats

fair drum
#

lol i guess that's for the best haha

unreal scroll
#

How could some data in profilenamespace be changed after game restart?
I have a save system, that stores save data in profile.
So, on saving it does something like this

profileNameSpace setVariable [Save name,_data];
saveProfileNamespace;

On saving I check the data, and it is ok.
But after load I have some field corrupted - like some of data filed were overwritten after saving.
Is it possible? Maybe I missed something, saving in Profile namespace?

grim coyote
#

This script above wont save any data in profileNamespace since the variable name is not valid.
Meaning instead of using

profileNameSpace setVariable [Save name,_data];

You need to use something like this:

profileNameSpace setVariable ["saveName",_data];
desert palm
#

what is the script if i want to change the group of a squad relation to independent?

warm hedge
#

setFriend

#

You can't use it to a group but a side to side (BLUFOR, OPFOR, Independent)

desert palm
#

is it possible to set the blufor group to independent via script?

warm hedge
#

Not directly

desert palm
#

copy thanks

#

myLocation setSide resistance is it this one?

warm hedge
#

See the bottom note, this command itself is not for it

manic sigil
#

Related, what is the point of setting a location's side? As in, how does that affect gameplay?

warm hedge
#

It does affect something back when 2006? IDK...

manic sigil
#

Like the Guard waypoints?

warm hedge
#

Maybe it did in like some CTI, Superpowers or such? Well but I don't think there's a point nowadays

manic sigil
#

Ah. Weird.

#

I mean, i suppose its useful for keeping track of a CTI script, but other than that...

unreal scroll
#

@grim coyote It is valid, it is just for example. As I said, it is a working system.

robust tiger
unreal scroll
#

Of course, objects not saved. And yes, it is an array of arrays of arrays etc πŸ™‚

robust tiger
unreal scroll
#

Is there any reason to do it, taking in account that everything in that data structure generates automatically on save?
You mean that there could be a mutable array? Seems like there are no one, the corrupted list is based on array copy already.
At least I don't see it, but as the problem exists, I'm doing something wrong obviously πŸ™‚

robust tiger
#

I just thought the issue might be in the fact, that arrays are reference types. So you would be passing a reference to the array and not the contents themselves.

#

Might be wrong Β―_(ツ)_/Β―

unreal scroll
#

Here is the working part of the save:

private _recruits = server getVariable ["recruits",[]] apply { // The server variable that stores recruits data - it can contain obejcts
    private _d = +_x; // make copy of the element, element is the array
    if (count _d == 6 && {(_d#2) isEqualType objNull}) then {
        _d pushBack 0;
        private _unit = _d#2;
        if !(isNull _unit) then {
            _d set [4,getUnitLoadout _unit];
            _d set [2,getPosATL _unit];
            _d set [6,[_unit getVariable ["OT_xp",0],_unit getVariable ["OT_from","Oreokastro"]]];
        };
        if !(isNull objectParent _unit) then {
            _unit remoteexeccall ["OT_fnc_assignedVehicleRole",_unit];
            waituntil {count (_unit getvariable ["OT_assignedVehicleRole",[]]) > 0};
            private _role = _unit getvariable ["OT_assignedVehicleRole",["cargo"]];
            _d pushback [typeof objectParent _unit,_role];
            _unit setvariable ["OT_assignedVehicleRole",nil,true];
        };
    };
    _d
};
_data pushback ["recruits",_recruits];

When created, _data is saved in profilenamespace
Recruit array element format formatted for save should be like:

server variable for active recruits keeps soldier objects instead of coordinates.
So, during a save process it should be replaced with coords - and in the most of cases it does. But there is a 8-10% chance that the saved array will be corrupted. I still can't catch when it happens exactly.

Hm... The coords are the array. Can it be the cause? Like _d variable, that comes to the save, keeps a mutable object from server variable, and once it changes, the data in profilenamespace changes too?

pliant stream
#

if the profile namespace is like other namespaces then sure

copper raven
unreal scroll
#

You mean that the referenced data could be changed before saving profilenamespace variables? Maybe, the save process is about 15-30 seconds.
Ok, thanks, at least I know where the cause πŸ™‚

pliant stream
#

if you save multiple times it could also be mutated before the next save

#

just make a copy of the mutable array

copper raven
#

just explicitly call saveprofilenamespace right after you set the variables, unless you're saving this frequently, then deep copy

pliant stream
#

that may not solve the problem

unreal scroll
#

"if you save multiple times it could also be mutated before the next save"
Of course it will. It is supposed that it will mutate.
The recruits list for saving created on each save from that mutable list.
The problem most likely the server variable with objects can be changed during the save.

pliant stream
#

are you doing this in scheduled

#

oh you are

#

this whole thing seems rotten then

#

there will be all sorts of race conditions i'm sure

unreal scroll
#

I doubt it can be called "race conditions" exactly.
The save process could take a long time, but it just reads data, and it does nothing with obejcts.

pliant stream
#

you made it sound like someone else might be mutating that array at the same time

unreal scroll
#

Yup, this is what I think.
Another question: what spec should I read from the vehicle config (not vanilla) to check if it can attack aircrafts? radarTarget? Or should I read some params from weapon/ammo?

pliant stream
#

that's exactly what a race condition is: unsynchronised concurrent mutation of the same data

unreal scroll
#

Absolutely, but it is the unwanted effect, that is not supposed to be there πŸ™‚ So I'm trying to fix it.
Beside it, there should be no such situations.

pliant stream
#

so find all the mutations to those arrays in your project and synchronise with them

#

or alternatively deep copy this server getVariable ["recruits",[]] before you start iterating over it

turbid jolt
#

Is there a command with the ability change the "style" value of a GUI textbox? I want to have a text box in a vehicle RSc that is only surrounded by a frame (style = 162;) under certain circumstances. Seems it would be more efficient to change the style of a single text box element between styles 2 and 162, rather than overlay a framed box element over the top of the text and show/hide that second element

cosmic lichen
#

Style is static

little raptor
copper raven
#

yes i know

robust tiger
robust tiger
unreal scroll
#

@robust tiger Null-objects instead of coordinates.

robust tiger
olive cairn
#

Hi, i need some help. I'm using EdenEnhanced to allow the respawn with fresh loadout after death. Unfortunately, it loads and restores the default class form the unit ignoring any customization i made in the eden arsenal. Does anybody knows how to achieve this?

unreal scroll
#

@robust tiger We already figured out the issue, thanks.

"I feel like some of
the units in recruits in the server namespace are set to objNull"
Depends on the script. Actually, no, it doesn't contain objNull, but it doesn't matter. Just need to be very careful with mutable objects, like lists.

ripe sapphire
#

yo bros any idea why this works

playSound ["chimera1_1",true]

but remoteexec doesnt

["chimera1_1", true] remoteExec ["playSound"];
winter rose
#

[[]]

#

@ripe sapphire

ripe sapphire
#

damn i just figured !

#

ok it works thanks lou!

tough umbra
#

Hi how do i attach a trigger to a unit so that it work even when the unit ride a vehicle cause as of now the trigger only work when the unit isn't in a vehicle ?

willow hound
#
vehicle MyUnit in thisList
dreamy kestrel
#

anyone know how to get the Arma Script Profile to work again?

dreamy kestrel
#

ah ok got it thank you

plush magnet
#

How does one edit a mod that was download from the workshop onto a server? I'm trying to add a file to a mod then repack and reupload the changed file but that isn't working.

#

I know absolutely nothing about BI coding. I've tried looking around but there isn't much that isn't outdated.

hallow oak
#

anyone knowledgeable with arma scripts able to help me with a simple one? I'd just like a script to display the current damage value of a house/structure when I shoot it (for testing purposes)

runic spoke
#

yes

#
cursorObject addEventhandler ["handleDamage", {
    params ["_object"];

    systemchat format["Current damage value: %1", damage _object];
}];```
little raptor
#

better use hit tho

#

handleDamage shows the damage before the object takes damage

runic spoke
#

or that

little raptor
#

not total damage

runic spoke
#

ah

little raptor
#

e.g. you might get 1 for leg

#

but your damage is not 1

runic spoke
#

I'm struggling to keep AI from swimming from the surface

little raptor
runic spoke
#

to the surface*

#

they're underwater, and I'm trying to keep them there, but they just want to swim up lol

runic spoke
#

and goggles, and wetsuit

little raptor
#

what about swimInDepth command?

runic spoke
#

So many commands didn't know that existed. will report results.

#

Negative they still gradually swim upward

#

i have an idea

unreal scroll
#

@runic spoke How about waypoints? What is the ASL height of it?

runic spoke
#

Ah, that's it, I'm using ATL

little raptor
runic spoke
#

let see if ATLtoASL for waypoint works

#

I don't use any getPos Leo

little raptor
#

getPos is AGLS

#

what do you use?

#

(as in what command do you give them to move)

runic spoke
#

waypoint

little raptor
#

in Eden?

runic spoke
#

negative

little raptor
#

addWaypoint?

runic spoke
#

correct

little raptor
#

what's the radius?

#

if negative, it should be ASL
if >= 0, it should be AGL

runic spoke
#

_wp setWPPos [ATLtoASL _pos, -1];

little raptor
#

ok

#

(you don't need setWPPos tho)

#

actually you should not use it at all

runic spoke
#

radius is 0

little raptor
#

don't use setWPPos

#

set the radius to -1 in addWaypoint

leaden haven
#

Just a question, what is the command to open the Warlords menu as a scripting function? I want to add it to the pause menu as a button. Thanks.

runic spoke
#

hmmm, still gradually swimming to surface πŸ€”

runic spoke
#

do you think it could be related to createGuardedPoint

little raptor
#

Β―_(ツ)_/Β―

runic spoke
#

good answer

hallow oak
little raptor
#

If you want to use it in your trigger

runic spoke
#

Sweet, they no longer swim to the surface.

#

Think the only other cause would be if their group leader is on the surface in a boat. πŸ€”

#

yup, rip lol

#

Thanks Leo, fixed it.

#

Credited

jolly dune
#

Hello guys I need a help with a script.
So I found this hacking script on internet which I intend to use in my multiplayer scenario.
It works like this: You come up to a object which gives you option to hack it.
Once you interact with it a silentHint should show up for everyone on the server (players) and it should show everyone progress as it finishes with message "Hacking terminal was succesful".
I added this to the init of the object: this addAction ["Hack Terminal","hacking.sqf"];
But the main problem is that when I use this script in MP scenario it only shows the progress for the player who activates it and it doesnt show any messages to other players at all. How can I make it so it shows those messages to everyone?
Please help me with this problem.
`_unit = _this select 0;
_caller = _this select 1;
_action = _this select 2;

_unit removeAction _action;

hintSilent "Hacking started...";
sleep 1;
hintSilent "Hacking 5% completed.";
sleep 2.5;
hintSilent "Hacking 10% completed..";
sleep 4.5;
hintSilent "Hacking 15% completed...";
sleep 4.5;
hintSilent "Hacking 20% completed.";
sleep 4.5;
hintSilent "Hacking 25% completed..";
sleep 4.5;
hintSilent "Hacking 30% completed...";
sleep 4.5;
hintSilent "Hacking 35% completed.";
sleep 10.5;
hintSilent "Hacking 40% completed..";
sleep 6.5;
hintSilent "Hacking 45% completed...";
sleep 4.5;
hintSilent "Hacking 50% completed.";
sleep 4.5;
hintSilent "Hacking 55% completed..";
sleep 7.5;
hintSilent "Hacking 60% completed...";
sleep 4.5;
hintSilent "Hacking 65% completed.";
sleep 4.5;
hintSilent "Hacking 70% completed..";
sleep 7.5;
hintSilent "Hacking 75% completed...";
sleep 8.5;
hintSilent "Hacking 80% completed.";
sleep 4.5;
hintSilent "Hacking 85% completed..";
sleep 6.5;
hintSilent "Hacking 90% completed...";
sleep 4.5;
hintSilent "Hacking 95% completed.";
sleep 6.5;
hintSilent "hacking 99% completed..";
sleep 8.5;
hintSilent "Hacking 100% completed...";
sleep 4.5;
hintSilent "Hacking finished";
playSound "scoreAdded";
sleep 1;
hintSilent "Hacking terminal was succesful.";`

copper raven
#

use remoteExec

little raptor
#

also

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
zealous heath
#

Hi, anyone know how to increase AI damage when using ace?

#

Speciffically on the Max_Aliens mod if that matters

idle jungle
#

Can I put a script thats called by initPlayerLocal.sqf and the script itself is a .sqf into a mod?

#

Like would it work sorta thing if the @mod has a initPlayerLocal.sqf and script.sqf inside

ripe sapphire
#

Yo bros is there a way to disable interaction with a fireplace?

#

Like usually u get the option to turn off fire

idle jungle
#

Disable simulation might work?

#

Well it stops people from turning it on

ripe sapphire
#

Disabling sim removes the fire

idle jungle
#

Oh.. my bad you want the fire on

ripe sapphire
#

Yes want to keep it burning

idle jungle
ripe sapphire
#

Ok, is there a way to remove the action tho

#

The default action to turn it off

idle jungle
#

If bla inflamed false then bla inflame true? I'm not a wizard in all honesty :(

This might work??
Β [this]ο»Ώο»ΏΒ ο»Ώcall BIS_fnc_replaceWithSimpleObject;

#

Sorry for format I'm on phone

warm hedge
#

Prolly you can place particles manually

idle jungle
#

The emitter tool in workshop is good for that and doesn't leave dependency

#

Afaik

ripe sapphire
#

Ahh yeah i think best way is to make fireplace as simple object then create particle manually

#

Thanks guys

idle jungle
#

Welcome!

ripe sapphire
#

Curious tho can you remove/hide default actions?

#

Like open door for example

warm hedge
#

There's no way to remove. If the condition allows you probably can hide it

ripe sapphire
#

Example on hiding?

idle jungle
#

Towards the bottom someone made a script for loot on the ground or something maybe could tweak it

idle jungle
#

Ok thanks Leo

unreal scroll
#

Any ways to "lock" the infantry within a vehicle? enablesimulationglobal false?

finite sail
#

they dont bail the moment they come under attack

unreal scroll
#

Oh, thanks

finite sail
#

also, they turn out until they come under attack which looks cool

turbid crag
#

allowCrewInImmobile might help you, depending on what you want to achieve and under what conditions

finite sail
#

yes, that too πŸ™‚

unreal scroll
#

"allowCrewInImmobile"
I meant - in undamaged vehicles, mostly apcs.
I have complex AI scripts, and sometimes infantry like to disembark when they shouldn't πŸ™‚

turbid crag
#

As I couldn't find a response to you question - does anyone know the answer to this?
Can a domain name be used instead of an IPv4 address in connectToServer (I believe those are the right terms, but I'm not sure)?

rugged tangle
#

Hi, I'm still trying to figure out a way to check the length of a player's weapon. So far I've tried measuring the distance between the bullet as it is fired and the player's shoulder but this is quite inconsistent. The bullets don't really originate from where they're supposed to.

Another method I tried was using createSimpleObject to spawn a .p3d model of the weapon, then getting selectionNames from that and checking the position of "muzzle". However it seems that all selections of the model are at [0,0,0]. I also tried this method with createVehicle and groundweaponholder but it is the same issue there.

Starting to run out of ideas really. Getting the "muzzle" from the selections seems promising but all the parts are in the center of the model for some reason.

west grove
#

why exactly do you need the weapon length?

rugged tangle
#

For a wall avoidance thing. You know, making CQB harder with a M200 Intervention πŸ˜„

manic sigil
#

What is the intent? Just to keep a player from using a heavy rifle in CQB, or something more abstract?

austere hawk
manic sigil
#

Granted, while weapon handling and size are supposed to matter, its easier to spray and pray with an LMG than to clear a corner with an SMG, so there is a bit of real-world/gameplay disconnect.

rugged tangle
#

Perhaps this is a little off-topic, I'm just interested if anyone has ideas for checking the length πŸ™‚

austere hawk
#

show some code what you actually tried. Theres a good chance you just did something wrong when dealing with model positions

willow hound
austere hawk
#

^use ClipGeometry otherwise it might count the muzzle flash into size calculation...

rugged tangle
austere hawk
#

is it possible to turn an object's reference into a number or string, and back again into an object?
I would like to use objects as keys for a hashmap, but thats not supported

unreal scroll
#

@austere hawk Why not to just turn your object representation into a string?
Like str(_veh).
When checking: if str(_veh) isEqualTo _key
But you can run into name conflicts, so I think object string representation is not enough

austere hawk
#

how do you turn it back into object is the question?

#

hm... guess i could just save the object in the data array...

unreal scroll
#

@austere hawk
"hm... guess i could just save the object in the data array..."
I think the best way is to set unique names to your obejcts

willow hound
runic spoke
#

netId, getObjectFromNetID lol

austere hawk
willow hound
#

I don't know the answer to that question, only the green people can see inside the engine πŸ™‚

unique sundial
#

it is in fact one of those cases when it is easier to have sqf solution than implement it in engine

austere hawk
#

i'm going to use it for MP, so using "less optimal" for SP is no problem in this case

willow hound
unique sundial
#

what do you mean?

willow hound
#

Consider this lookup process:

_objId = netId MyObj; //Complexity: O(?)
_val = MyHashMap get _objId; //Complexity: O(1)
//Total complexity: O(?) + O(1) = O(?)
```I would like to know whether `netId` is slow enough to significantly increase the overall complexity of that lookup process.
#

So for instance if netId had a time complexity of O(n) that would mean that the whole lookup process takes O(n), ruining the constant-time key lookup of the HashMap.

rugged tangle
#

Can anyone help with weaponDirection? Which of the vector commands should I be using to get an object oriented the same way as the player's weapon?

errant jasper
#

Can't imagine netId not being constant time. Last I checked all user implemented hash tables used find or the like for performance and that is then O(n) anyway.

#

What is the use case that one wants to use a object as a key, and still need the data when the object is gone? Because, otherwise, you might as well just store the value directly on the object using setVariable.

willow hound
errant jasper
#

Nice.. Still using the object itself and setVariable means you don't have to worry about clearing the key when the object is gone.

oblique arrow
still forum
willow hound
#

Oof, okay krtecek

#

I'll try to remember to mention that on the wiki

desert palm
#

how do i terminate a loop script?

#

how do I make it stop? the script you edited @willow hound

robust tiger
willow hound
austere hawk
#

Say i have a script, that uses some global variables (larger arrays/ hashmaps). When i call a function in that script, is it better/equal/worse to pass the variables i already got via getVariable to the function VS the function pulling the data again via getVariable?

still forum
#

basically same thing

#

of course though doing
[getVariable "stuff1", getVariable "stuff2"] call function
EVERYTIME you call the function is nonsense

#

but passing a local variable that you already have is cheaper than letting the function do getVariable again

austere hawk
#

ok thanks. Thats what i meant, i already have the global variables, because i need the data in the main script anyway, but i also need the data in the function.

still forum
#

you can of course save even more performance by not passing them but still using the notlikemeow

#

myFunc= {hint _myVar;}
_myVar = "test";
call myFunc;

but if your code is open source or you expect anyone thats not you to fiddle with it, then probably don't do that πŸ˜„

little raptor
fair drum
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
bright robin
#

what can go wrong,so either the scrip doesn't works

#

or hides all markerss

little raptor
#

syntax highlighting plz

bright robin
little raptor
#

look at Hypoxic's message

bright robin
#
////Local Player Check
if (isNull player) exitWith {};

//Variables
private _bluforMarkers = [
    "marker_1",
    "marker_2",
    "marker_3"
];

private _opforMarkers = [
    "marker_4",
    "marker_5",
    "marker_6"
];

private _guerMarkers = [
    "marker_7",
    "marker_8",
    "marker_9"
];

//Hide All Markers
_bluforMarkers + _opforMarkers + _guerMarkers apply {
    _x setMarkerAlphaLocal 0;
};

//Show Markers Depending on Side
switch (side group player) do {
    case "west" : {
        _bluforMarkers apply {
            _x setMarkerAlphaLocal 1;
        };
    };

    case "east" : {
        _opforMarkers apply {
            _x setMarkerAlphaLocal 1;
        };
    };

    case "independent" : {
        _guerMarkers apply {
            _x setMarkerAlphaLocal 1;
        };
    };

    default {};
};
#

would that be correct?

little raptor
#

yeah delete the old one

bright robin
#

understood

#

and

//
execVM "markers.sqf";
#

and then that one from my init.sqf

fair drum
#

oh its because case needs to be correct case

bright robin
#

oh hi hypoxy

fair drum
#

thats my bad

bright robin
#

fine,what do i do

fair drum
#

change those strings of "west", "east", "independent" to west, east, independent without the quotes

bright robin
#

a

#

np

fair drum
#
switch (side group player) do {
    case west : {
        _bluforMarkers apply {
            _x setMarkerAlphaLocal 1;
        };
    };

    case east : {
        _opforMarkers apply {
            _x setMarkerAlphaLocal 1;
        };
    };

    case independent : {
        _guerMarkers apply {
            _x setMarkerAlphaLocal 1;
        };
    };

    default {};
};
bright robin
#

i got it

#

i'll check if it works

#

thx hypox

fair drum
#

the way I had it it would compare "west" to "WEST" which is false

bright robin
#

YEAH

#

@fair drum it works as wonders

#

thx

past wagon
#

does an addAction script run locally for the player who used the action?

#

so would there be no need to do this:

_caller = _this select 1;
["Hello"] remoteExec ["hint", _caller];

could I just do this instead:

hint "Hello";

?

winter rose
#

yep

#

@past wagon

past wagon
past wagon
#

can I not put an object as a key in a hashmap?

little raptor
#

no

past wagon
#

why not?

little raptor
#

idk. ask Dedmen.

past wagon
#

is there a way I can get around it?

little raptor
#

no

past wagon
#

i need the keys for my hashmap to be objects

little raptor
#

use arrays then

ripe sapphire
#

yo bros is there a getter for ammo count in current magazine ?

#

i know theres currentmagazinedetail but it returns a whole string of multiple things

#

how would i isolate only the ammo count

ripe sapphire
#

poggers bro thanks

digital torrent
#

is there a script or a command that can hide the back rotor of a heli?

#

i tried settexture but it didnt hide the back rotor

fair drum
warm hedge
#

Setting some scripted damage perhaps

digital torrent
#

ok thx both of you!

past wagon
#

how do I turn an image into a .paa file?

fair drum
past wagon
#

nvm, i found it

fair drum
#

remember your library filters. i don't think tools is automatically selected

#

so you might not find it when you install it

past wagon
#

there is an application called imageToPAA do i want to use it?

#

or texview?

#

it just says "Failed to convert 1 file"

#

how large does an image need to be in order to convert it?

#

i keep opening the file in texview and saving it as a paa/pac file and it does nothing

#

its a png file

copper raven
past wagon
#

ok i got it

#

i needed to name it .paa as well as select paa as the file type

past wagon
#

how come when I convert a solid blue image to .paa it becomes red, and a solid red image becomes blue?

#

and when I open the image in texview it appears as the color it originally was, but when i apply it as a texture in game, it switches

#

i dont get it

past wagon
#

how can I make the drawIcon3D only appear for a player when they are within a certain range of the text?

little raptor
#

so just use it locally

digital torrent
#

is there a alternate to settexture to disable a texture? (making it transparent for the outside armor?

I am doing this rn


this setObjectTexture [0, "\pboname\texture.paa"]; 
this setObjectTexture [1, "\pboname\texture2.paa"];

But create error in dedicated obviously

past wagon
# little raptor drawIcon3D is already local

even if im doing this in initServer?

addMissionEventHandler ["Draw3D", {
    drawIcon3D ["", [1,1,1,1], [14477.2, 6189.25, 1.865], 0, 0, 0, "Text", 1, 0.05, "RobotoCondensed"];
    drawIcon3D ["", [1,1,1,1], [14476.9, 6179.86, 1.844999], 0, 0, 0, "Text", 1, 0.05, "RobotoCondensed"];
}];

could I change it to the following?

addMissionEventHandler ["Draw3D", {
        if ( player inArea myTrigger ) then {
            drawIcon3D ["", [1,1,1,1], [14477.2, 6189.25, 1.865], 0, 0, 0, "Text", 1, 0.05, "RobotoCondensed"];
            drawIcon3D ["", [1,1,1,1], [14476.9, 6179.86, 1.844999], 0, 0, 0, "Text", 1, 0.05, "RobotoCondensed"];
        };
}];
little raptor
past wagon
little raptor
#

and no need for inArea

warm hedge
little raptor
#

just use distance

digital torrent
#

bc rn when i put the code, it create a error which prevent to load the rest of the mission in dedicated

warm hedge
#

Just put "" in setObjectTexture

past wagon
little raptor
past wagon
#

yeah i see it now mb

#

thanks

#

lol

past wagon
#

how can I directly set an object's texture to a solid color without using images?

#

i tried this:

this setObjectTextureGlobal [0, "#ff0000"];
this setObjectTextureGlobal [1, "#000000"];

but it doesnt seem to be doing anything

fair drum
untold copper
past wagon
#

im confused about how this is what they use for a blue texture. it just doesnt make sense to me. what is the format here?

"#(rgb,8,8,3)color(0,0,1,1)"
past wagon
#

can someone help me get a less harsh red? i cannot figure out what color values to put. ive been trying for like an hour. when I use "#(rgb,8,8,3)color(1,0,0,1)", I get the following color, but if I add small values to the green and blue, it just becomes light pink. I really dont get it.
https://imgur.com/a/v36GINh

warm hedge
#

How did you do that? How small it is?

past wagon
warm hedge
#

And which vehicle? Might the material makes it brighter

past wagon
#
this setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"];

but this just makes it standard, bright red

warm hedge
#

Then try to adjust to make the color to the color you wish? If it is, probably it is what it is

past wagon
#

im just kind of trying to understand how this "RGB" format works

#

it is definitely not the standard rgb format

warm hedge
#

It is

#

You can test it in like Custom Texture

fair drum
#

the first part is creation of the texture itself, then the color which is rgba

warm hedge
#

#(Texture format)color(color format)

fair drum
#

what exactly does (rgb,8,8,3) mean? don't really know. I just know that it is the solid texture format

past wagon
# warm hedge It is

this uses a scale of 0 - 1 for each color, standard RGB is a scale of 0 - 255

#

whenever I put a number larger or equal to 1 for every color, it just gives me pure white

warm hedge
#

0-1 and 0-255 is not even a difference

past wagon
#

i know

#

i used the same proportions and it gave me light pink instead of red which it was supposed to be

warm hedge
fair drum
#

he's just elaborating on the resolution of the texture. nothing big for most applications

past wagon
#

ok

warm hedge
#

Resolution. But if it is just a color texture which had no info than a single color, 1,1,1 is enough

past wagon
#

yeah

#

but how can I make it give me the color I want?

#

it really doesnt make any sense to me how this RGB system works

fair drum
#

it works more like channels in photoshop

past wagon
#

i tried using the standard RBG code, that didnt work. then i tried converting it with proportions, and that didnt work either

#

ive never worked with PH

fair drum
#

do you use 7erra's editing extentions?

past wagon
#

idk what that is

fair drum
#

he's got a color picker you can use right from the menu

warm hedge
#

You can test in like very simple object like User Texture if you wonder how it works

past wagon
warm hedge
#

Workshop

warm hedge
#

But I'm 100% sure if it doesn't seem a right color, it's just a material thing

fair drum
# past wagon thanks

also when you did your conversion, did you do something like this?

private _decRGB = [255, 51, 51];

private _binRGB = [];
_decRGB apply {
    private _value = linearConversion [0, 255, _x, 0, 1, true];
    _binRGB pushBack _value;
};

_binRGB;

because for me, both [255, 51, 51] is the same color as the output in percent that the game uses which I checked on some websites that use decimal RGB as well.

#

and it also is the correct HTML color code as well

past wagon
#

if I did

object setObjectTextureGlobal [0, "#(argb,8,8,3)color(1,0,0,1)"];
object setObjectTextureGlobal [1, "#(argb,8,8,3)color(0,0,0,1)"];
``` and then did
```sqf
getObjectTextures object;
``` would it return `["#(argb,8,8,3)color(1,0,0,1)", "#(argb,8,8,3)color(0,0,0,1)"]`?
#

nevermind, it definitely doesn't

winter rose
#
private _binRGB = _decRGB apply { _x/255 };
```you use apply instead of forEach, and don't even use its return value!
past wagon
#

why do I get Error: local variable in global space when I put this in initServer.sqf?

spawnPos = getPos spawnFlag;
spawnPos params ["spawnPosX", "spawnPosY", "spawnPosZ"];
```I dont understand.
warm hedge
#

params can't take global variable, which means variable without _ prefix

past wagon
#

oh

#

ok

#

ohhh

#

the variables in the quotes on the right side of params?

warm hedge
#

Yes

past wagon
#

ok

#

yeah i forgot to add the _'s

#

mb

winter rose
#

added to the paddlin' list

past wagon
#

is there a way to get a random number between two numbers? random gives a random number between 0 and a number.

warm hedge
#

X + random Y

past wagon
#

oh

#

nice

#

so if I wanted it to be anywhere from -3 to 3, i could do -3 + random 6?

warm hedge
#

Jup

past wagon
#

does arma use PEMDAS?

warm hedge
#

6/2*(1+2) == 9 so yes

#

...If I'm getting the question correctly

past wagon
#

if I did:

_x setPos [_posX - _spawnRadius + random _spawnRadius * 2, _posX - _spawnRadius + random _spawnRadius * 2, _posZ];
```if `_spawnRadius` was 3, it would not be the same as:
```sqf
_x setPos [_posX - 3 + random 6, _posX - 3 + random 6, _posY];
#

because it would do random _spawnRadius before it multiplied _spawnRadius by 2, right?

#

hmm

warm hedge
#

If in doubt, use the bracket

past wagon
#

would the brackets actually change the way the code is run?

#

or does it just help visualize things?

warm hedge
#

Former, yes

past wagon
#

ok

#
_x setPos [_posX - _spawnRadius + random ( _spawnRadius * 2 ), _posY - _spawnRadius + random ( _spawnRadius * 2) , _posZ];
past wagon
warm hedge
#

would the brackets actually change the way the code is run?

#

As in former and latter

past wagon
#

ohh

#

im dumb

#

thanks

copper raven
still forum
still forum
past wagon
little raptor
still forum
#

ah :u

past wagon
#

also I could have just put the objects in strings and used missionNameSpace getVariable

#
_myHashmap = createHashmapFromArray [
  [1, "object1"], 
  [2, "object2"],
  [3, "object3"]
];
_objectString = _myHashmap get 1;
_object = missionNameSpace getVariable _objectString;
little raptor
#

wat?

#

If you've already named them just do:

missionNamespace getVariable ["object" + str _id, objNull]
warm hedge
#

What is the purpose of this?

still forum
#

if you want objects as keys.. why don't you just store stuff on the object itself?

#

Each object has a hashmap integrated into itself

little raptor
past wagon
dusky pier
#

Hello, is possible to somehow check - if grenade launcher exists on weapon?
And display GL grenades

warm hedge
#

In MX 3GL example,
configfile >> "CfgWeapons" >> "arifle_MX_GL_F" >> "muzzles" has ["this","GL_3GL_F"] data. But an alternative muzzle doesn't always mean it has a grenade launcher, so you need to check a bit more if GL_3GL_F (in this case) is a grenade launcher like from the magazine?

dusky pier
#

ye, i think is needed in that context like magazine

warm hedge
#

Probably the easiest way is to check if it has UGL_40x36 in its magazineWell[]

dusky pier
#

Thank you @warm hedge, i thought - is possible to use grenade launcher like an accessories πŸ˜„
Gonna try this way just to display grenade launcher magazines πŸ™‚

past gazelle
#

Odd question for scripting: If I have a relatively big mission but savegames are NOT an option (for a variety of reasons), how would one go about setting up a file to record flags (play this message ONLY the first time the player starts the mission) and a file to record the contents of a container? (Anything stored in this container will remain in the container during the next mission, even if you die and restart.)

warm hedge
#

profileNamespace is an idea

past gazelle
#

Thank you, just knowing where to start is half the battle...

thorn saffron
#

Is there any way to have a database that scripts can get data from? I have really chonky arrays and I would like to have them in some kind of file that the scripts can access, just so they don't have to be constantly regenerated and slung around.
Currently I have them in a function, but I declare the chonk arrays first and then have a switch that chooses the right one. Problem is AFAIK it keeps redefining those arrays every time that function is accessed.

errant jasper
#

Declare them outside the function as global variable instead.

thorn saffron
#

Its a lot of stuff in there, I kinda don't want it hotloaded in the game at all times

errant jasper
#

If the arrays change rarely move each one into its own file, and load is as either a sqf script that defines the variable or parse it using parseSimpleArray. Then "run" the proper file the first time it is needed

thorn saffron
#

I wonder if I used goTo would it skip the defining of the arrays? Like this

goto "Array2";

#Array1
_stuff = [];

#Array2
_stuff = [];

Would the creation of Array1 be skipped?

distant oyster
thorn saffron
#

oops my bad

hollow thistle
#

just store them in global namespace, it will really not matter.

#

If in doubt compare ram usage blobdoggoshruggoogly

thorn saffron
#

πŸ€” Yeah, I just remembered I will keep stuff in the local space anyway, so might as well keep all of the stuff

errant jasper
#

Yeah just init once with global names. Unless you they are like 1,000,000+ in size and you have many there is no need to worry

still forum
#

store them in a hashmap, only "generate" them when they are requested first time

thorn saffron
#

Ok, I think that the biggest one is something like 6.3k in size.

barren pewter
#

I have a trigger to detect when a blufor ai squad shows up and teiggers a opfor attack. But sometimes the player will trigger it because you have to walk through that relative area. How do I make a trigger that triggers by the presence of the ai sl.

robust tiger
barren pewter
#

@robust tiger oh that would explain what set trigger owner is lmao. Thanks

dusky pier
#

Hello, is possible to somehow convert item description from text format to string?
I mean replace <br /> in description text

willow hound
#

Replace with what?

dusky pier
# willow hound Replace with what?

i mean in vanilla arma invenroty in tooltips - i can't find <br /> is just start new string instead it

ctrlSetTooltip command can use string only
i can parse this text via script (replace <br /> with new string, but wanted to ask if somebody knows another way)

willow hound
#

Can you give me an example?

dusky pier
# willow hound Can you give me an example?

sure:
"Π’ΠΈΠΏ: ОЀ Π³Ρ€Π°Π½Π°Ρ‚Π°<br />ΠšΠ°Π»ΠΈΠ±Ρ€: 40 ΠΌΠΌ<br />Кол-Π²ΠΎ: 1<br />ΠŸΡ€ΠΈΠΌΠ΅Π½Π΅Π½ΠΈΠ΅: EGLM, 3GL"
^^ this i get from config

this, how looks this text in inventory menu:
Π’ΠΈΠΏ: ОЀ Π³Ρ€Π°Π½Π°Ρ‚Π°
ΠšΠ°Π»ΠΈΠ±Ρ€: 40 ΠΌΠΌ
Кол-во: 1
ΠŸΡ€ΠΈΠΌΠ΅Π½Π΅Π½ΠΈΠ΅: EGLM, 3GL

willow hound
dusky pier
#

ye, i find that page too, but can't use it until release 😦

#

so if there is no way how to parse it another way - gonna try to parse with script)

try'd this way:

_desc = [_desc,str (parsetext _desc)] select ("<br />" in _desc);

but is remove <br /> only, but not new lines instead

warm hedge
#

How do you wanted to use it?

dusky pier
#

something like short description

warm hedge
#

So a GUI menu?

dusky pier
#

yep

#

via ctrlSetTooltip

warm hedge
willow hound
#

Yea I've arrived at the same solution meowthis

dusky pier
little raptor
dusky pier
little raptor
#

Yeah

#

It returns a structured text, not string
But if you want it for GUI's, maybe that's better

#

You can still convert it back to string tho

#

But I think it'll look weird:

_str = str parseText _str
dusky pier
#

i tryed this way
but is return without new lines, just all in one line πŸ˜„

little raptor
#

Yeah notlikemeow
That's what I meant by "looking weird"

rustic kiln
#

Hi, im wondering if isPlayer can check if an object is a player.
I want to check if an object returned from cursorObject = a player

warm hedge
#

isPlayer does that actually

rustic kiln
#

Alright thought so, thanks!

gaunt acorn
#

Hi all, i wonder if there a better way to count units in a spΓ©cific aera than my actual script:

_unitsEast = unitsEast inAreaArray ["mkr1", "mkr2", "mkr3"];
_unitsEast = count units opfor; 
if (_unitsEast >= 1) then{ 
 hint "Unit here"; 
}else{ 
 hint "No Unit Here"; 
};

Is there a possibility like count units opfor inAreaArray ... in one line ? I try but still unsuccess 😦 In advence, Thanks for your responses

little raptor
#

count units opfor inAreaArray ...
That's just wrong. Learn about operator precedence on the wiki. What you wrote executes as (count units opfor) inAreaArray

#

@gaunt acorn Anyway, what you want is:

count (_units inAreaArray "mrk1") + count (_units inAreaArray "mrk2") + count (_units inAreaArray "mrk3")
#

if you have too many areas, you can use a forEach loop and a counter

gaunt acorn
#

OK i see, thx a lot for your help πŸ™‚ save me a lot of time, but iwill read more about operator precedence thx for your time and answere πŸ˜‰

little raptor
#

there's no unitsEast (unless you actually defined that)
And you're just counting all opfor units

gaunt acorn
#

Ho ok so _units its the right parameter ? _unitsEast = _units inArea ....

little raptor
#

_units is a local variable that should be an array of units

#

I'm assuming in your code:

_units = units east;
gaunt acorn
#

Han ok Now i see why i ave null as response

#

@little raptor Thanks you so much , need to rewrite every thing but i learn today πŸ™‚

dusky pier
#

Hello, did you try'ed to get picture of weapon (with attachments - like in inventory)?

radiant yacht
#

so i'm trying the stuff in this video but it isn't working, do any of yall scripting wizards see anything wrong with the stuff in the video? if not then i guess i'll have to check my own side https://www.youtube.com/watch?v=QJRsyaqntw0

dusky pier
dusky pier
#

Can you give me a hint? πŸ™‚

little raptor
#
getText (configFile >> "CfgWeapons" >> _weaponName >> "picture")
dusky pier
#

@little raptor i know this way, but there is no primaryWeaponItems - i mean on icon

#

like was in default inventory

#

hm, can't find it as picture

{diag_log [ctrlIDC _x,ctrlText _x]} forEach (allControls (findDisplay 602));

don't return picture - maybe is something else...

wicked fulcrum
#

If I got an array with units in it, and set that variable as publicVariable so all other clients can use it. Will I run into trouble as the clients where the units are non-local they would be "remote" compared to the array on the client with local units? Or does "unit objects" somehow automatically get correctly set if remote or local when shared on a list through publicVariable.

guess my actual question is more if references to units can be shared between local and non-local clients?

past wagon
#

are the parentheses needed in this condition?

while { ( units west inAreaArray _mapTrigger ) isEqualTo [] } do {
copper raven
#

no

past wagon
#

ok

#

thats what I thought, just checking

little raptor
#

still better keep it

past wagon
#

eh

#

i can read it fine without them

wicked fulcrum
radiant yacht
#

so, UH addaction [ "music on", { adds a scroll wheel option that is visible from very far away, is there any way i can make this only visible from inside the vehicle?

#

UH addaction [ "music on", { UH say3D ["music1", 1000, 1]; } ];
is the full init

robust tiger
past wagon
#

would this:

"HELLO" splitString "";
```return this:
```sqf
["H", "E", "L", "L", "O"]

?

past wagon
#

thanks

radiant yacht
manic sigil
#

Time for me to bash my head in again.

If I execute a .sqf file on all computers in a multiplayer setting, beginning with

if (!hasInterface) exitWith {};

before having a line like

if (primaryWeapon Player == "LMG_Mk200_F") then {
Player addPrimaryWeaponItem "bipod_03_F_blk";}

Then only the player(s) with Mk200s would get bipods, correct?

#

That is, when that chunk of code comes up.

winter rose
#

player*, too πŸ™ƒ
and yeah

manic sigil
#

Alright, I'm slowly getting the hang of it T_T

warm hedge
#

Hey don't tell a lie Low Montowana, it's case insensitive!

manic sigil
#

Because that code is, while executed globally, local to every computer once the server is weeded out with !hasInterface.

#

Or rather, is always local but won't be duplicated by the server n times.

winter rose
warm hedge
#

Anti-camelCase is not nice. -Barbara Bush

coarse schooner
#

bruh thats an emoji now XD Lou Lou i love it

little raptor
#

I think you can use it as a scarecrow to scare off bots, or make people behave! 🀣

modern sand
#

Does anyone know a working way to limit the vehicles displayed in the Virtual Garage? I've looked at the wiki and apparently you can use BIS_fnc_garage_data to set the available vehicles, however the example provided doesn't seem to work. Neither does the following code;

BIS_fnc_garage_data = [
    //CARS
    [
        //model
        "\a3\soft_f\offroad_01\offroad_01_unarmed_f",
        //config paths of classes that use above model
        [
            [(configFile >> 'cfgVehicles' >> 'C_Offroad_01_F')],
            [(configFile >> 'cfgVehicles' >> 'B_G_Offroad_01_F')]
        ],
        "\a3\soft_f\mrap_02\mrap_02_gmg_f",
        [
            [(configFile >> 'cfgVehicles' >> 'O_MRAP_02_gmg_F')]
        ]
    ],
    [],        //ARMOR
    [],        //HELIS
    [],        //PLANES
    [],        //NAVAL
    []        //STATICS
];

["Open"] call BIS_fnc_Garage;

It opens the Virtual Garage like normal with every vehicle.

little raptor
modern sand
#

That's just using the example provided on the wiki ^

little raptor
#

no

#

you're nesting the configs

modern sand
#

modified*

#

The version on the wiki doesn't work, and I found that version on a forum post

#

I'm not quite sure on how they need to be nested, it doesn't really explain it on the wiki

little raptor
#

the wiki one wasn't nested. idk. I recommend just reading the function. maybe something's changed

modern sand
#

Okay thank you, will do

modern sand
#

I've managed to get the default BIS_fnc_garage_data list that gets set when you open the Virtual Garage with every vehicle, which is SQF [ [ // CARS "\a3\soft_f\mrap_01\mrap_01_unarmed_f", [bin\config.bin/CfgVehicles/B_MRAP_01_F,bin\config.bin/CfgVehicles/B_T_MRAP_01_F], "\a3\soft_f\mrap_01\mrap_01_gmg_f", [bin\config.bin/CfgVehicles/B_MRAP_01_gmg_F,bin\config.bin/CfgVehicles/B_T_MRAP_01_gmg_F], "\a3\soft_f\mrap_01\mrap_01_hmg_f", [bin\config.bin/CfgVehicles/B_MRAP_01_hmg_F,bin\config.bin/CfgVehicles/B_T_MRAP_01_hmg_F], "\a3\soft_f\mrap_02\mrap_02_unarmed_f", [bin\config.bin/CfgVehicles/O_MRAP_02_F,bin\config.bin/CfgVehicles/O_T_MRAP_02_ghex_F], .... (The list continues but you get the point) ], [...], // ARMOUR [...], // HELIS [...], // PLANES [...], //NAVAL [...] //STATIC ]; So I've tried to copy a few vehicles from the list (using configFile >> "CfgVehicles" >> "CLASSNAME") and it still doesn't seem to work. So I'm stumped on how to get it working.

#

The only other way I could possibly think of, which isn't necessarily efficient. Is to manually edit the display's listbox and remove the vehicles I don't want.

willow hound
#

What does your version look like?

modern sand
#
missionNamespace setVariable ["bis_fnc_garage_data",
    [
        [ // CARS
            "\a3\soft_f\mrap_01\mrap_01_unarmed_f",
            [configFile >> "CfgVehicles" >> "B_MRAP_01_F", configFile >> "CfgVehicles" >> "B_T_MRAP_01_F"],
            "\a3\soft_f\mrap_01\mrap_01_gmg_f",
            [configFile >> "CfgVehicles" >> "B_MRAP_01_gmg_F", configFile >> "CfgVehicles" >> "B_T_MRAP_01_gmg_F"],
            "\a3\soft_f\mrap_01\mrap_01_hmg_f",
            [configFile >> "CfgVehicles" >> "B_MRAP_01_hmg_F", configFile >> "CfgVehicles" >> "B_T_MRAP_01_hmg_F"],
            "\a3\soft_f\mrap_02\mrap_02_unarmed_f",
            [configFile >> "CfgVehicles" >> "O_MRAP_02_F", configFile >> "CfgVehicles" >> "O_T_MRAP_02_ghex_F"],
            "\a3\soft_f\mrap_02\mrap_02_hmg_f",
            [configFile >> "CfgVehicles" >> "O_MRAP_02_hmg_F", configFile >> "CfgVehicles" >> "O_T_MRAP_02_hmg_ghex_F"],
            "\a3\soft_f\mrap_02\mrap_02_gmg_f",
            [configFile >> "CfgVehicles" >> "O_MRAP_02_gmg_F", configFile >> "CfgVehicles" >> "O_T_MRAP_02_gmg_ghex_F"]
        ],
        [], // ARMOUR
        [], // HELIS
        [], // PLANES
        [], //NAVAL
        [] //STATIC
    ]
];

["Open"] call BIS_fnc_Garage;
#

sorry that's incorrect

#

let me fix it

#

There we go

#

That's what I'm using

willow hound
#

And does BIS_fnc_garage_data keep that value after you run BIS_fnc_Garage?

modern sand
#

Yes

willow hound
#

Have you tried both ["Open", true] call BIS_fnc_garage; and ["Open", false] call BIS_fnc_garage;, just to be sure?

modern sand
#

Yes I have tried both

#

Even though leaving out the second parameter defaults to false

willow hound
#

Hmmm that smells like a broken function krtecek

modern sand
#

Well darn, I guess I'll have to manually modify the displays list box to remove vehicles I don't want

willow hound
#

Have you gone through the BIS_fnc_garage source code?

modern sand
#

Yes

#

But I don't quite understand how it works, because there is only 2 instances where bis_fnc_garage_data get set and it relates to the actual category buttons IDC numbers in the garage display

#

I can't seem to wrap my head around it

#

on how it gets the vehicles data to then use in the list box

manic sigil
#

I'm trying to simplify my unit creation.

I have a function for a createUnit line, and I pass it three arguments; _group, _pos, and _code.

spawnRifleman = {
if (!isServer) exitWith {};
_group = _this select 0;
_pos = _this select 1;
_code = _this select 2;

Where it falls apart is the code section. I can't seem to formulate it properly.

If I leave it a simple string ala

hint "spawned"

I get an undefined _code error. If I try to wrap it, such as

"this setdammage 1"

I get an unknown enum value on the argument. If I try to encase it, like so

{this enableSimulation false}

I get an error at the createUnit level, complaining about it wanting a string but getting code.

#

I've tried both methods I could think of to place it;

Rifleman = _group createUnit ["O_Soldier_VR_F",_pos, [], 0,_code];

Rifleman = _group createUnit ["O_Soldier_VR_F",_pos, [], 0, format["%1",_code]];
#

Neither seem to work.

little raptor
#

that syntax of createUnit doesn't take init

manic sigil
#

...

#

brb gonna drink some draino

little raptor
#

the argument you're messing with can be one of "NONE", "FORM" and "CANCOLLIDE"

manic sigil
#

I see what I did. I see, and I do not like it.

little raptor
#

cuz there's no return value

manic sigil
#

I mean, that's what drove me to it initially, because that syntax DOES have a return value...

#

orrrrr I could read the big red shiny note on the wiki that tells you how to get a reference in the actually useful syntax I thought I was using.

#

Don't drink and code.

little raptor
#
_unit = _group createUnit ...;
call _code
manic sigil
#

Would that work if the code needs to be tagged to a specific unit? Like an event handler?

copper raven
#

_unit will be the created unit inside the _code

#

if done like above

manic sigil
#

Ah, so the arguments I'd have to pass would be like [_group,_pos, _unit enableSimulation false] ?

copper raven
#

?

little raptor
#

the last one has to be a code

manic sigil
#

Are you saying that I'm just missing syntax, or that my approach is flawed?

copper raven
little raptor
#

I'm saying it has to a code

#

_unit enableSimulation false is not a code. it's empty (NOTHING)

#

{_unit enableSimulation false} is a code

manic sigil
#

Okay. Missing syntax.

#

Thank you, I'll see what I can get working with this.

winter rose
#

what do you mean by that?

#

to convert some numbers to a letter or so

#

do you instead need a random id generator?

snow pumice
#

i will take the playerid and i would like to convert it to something else

#

like getting some letters in it

winter rose
#

getPlayerUID? (that would return Steam's id)

snow pumice
#

ok sorry i will write in a sec what i mean (its a bit weird formulated from me)

winter rose
#

okido ^^

real tartan
#

I have simpleObject that I need to destroy with explosives. Some workarounds ? eventHandler, waitUntill ?

snow pumice
# winter rose okido ^^

what i wanted to do is to replace some of the numbers with some letters, i tought there maybe is an method or something else for stuff like this
i thought about an array of letters and just selecting one is there any better way?

snow pumice
winter rose
pulsar bluff
#

@real tartan for that i use a small simulated and damageable object placed nearby to the β€˜destroyable’ simple object

#

linked by script variables and a handleDamage event handler

crystal lance
#

Anyone know how to make an addAction that effects the ACE3 medical class of an unit, tryed this but the init dosen't like it: this addAction ["Become Medic", (setVariable ["ace_medical_medicclass", 1, true])]; any ideas?

#

Found the issue, player setVariable ["ace_medical_medicclass", 1, true] was what I was needing

little raptor
crystal lance
#

this is just going into an init, works fine

little raptor
#

that's not what I mean

crystal lance
#

{}

little raptor
#

yes

crystal lance
#

forgot i changed that as well

#

Still quite new to scripting anything on arma

winter rose
#

hi new, I'm dad! πŸ˜„

#

the channel is here for you πŸ˜‰ don't hesitate, shoot

lilac maple
#

Hello. I would be more interested in SQF Bytecode. I have some experience with SQF, C and C++, but I'm not sure where should I start with SQF Bytecode. Would someone be able to point me out to the good direction or provide some material/threads/whatever useful for the first utilisation? Essentialy I'd like to learn how and when to properly utilise SQF Bytecode and then use that knowledge to good use for the community.

still forum
#

ArmaScriptCompiler on github

#

There isn't much to it, you compile your sqf files to sqfc bytecode and thats basically it

lilac maple
#

Nice, thank you πŸ‘πŸ».

past gazelle
#

Hmm, I'm trying to write a script to prevent the player from picking up any equipment off dead nato soldiers(but aaf/csat are fine). I have code to delete the corpses inventory, but I'd rather leave the bodies as they are. lockInventory doesn't work with deceased objects. Is there a way I can just disable simulation on the corpse and it's weapon?

real tartan
#

is there a way to clear systemChat ?

still forum
#

Heh, not gonna fall for that one again πŸ˜„

past gazelle
#

The easy way? run systemChat ""; six times...

still forum
past gazelle
#

lol learned something new...

still forum
#

yeah I learned that one last week πŸ˜„

past gazelle
#

    _unit = (_this select 0) select 0;

    sleep 0.5;

    _weaponHolders = nearestObjects [_unit,["WeaponHolderSimulated"],5];
    waitUntil {
        (({(velocity _x) select 0 == 0} count _weaponHolders) == count _weaponHolders) &&
        (({(velocity _x) select 1 == 0} count _weaponHolders) == count _weaponHolders) &&
        (({(velocity _x) select 2 == 0} count _weaponHolders) == count _weaponHolders)
    };
    {_x setDamage 1} forEach _weaponHolders;``` I found this code but I can't really understand what it's supposed to do. It keeps giving me this error: ``` 3:37:25 Error in expression <ponHolders"];
_unit = (_this select 0) select 0;
_weaponHolders = nearestObj>
 3:37:25   Error position: <select 0;
_weaponHolders = nearestObj>
 3:37:25   Error select: Type Object, expected Array,String,Config entry
 3:37:25 Error in expression <ponHolders"];
_unit = (_this select 0) select 0;
_weaponHolders = nearestObj>
 3:37:25   Error position: <select 0;
_weaponHolders = nearestObj>
 3:37:25   Error Generic error in expression```
distant oyster
past gazelle
#

I think it would be the corpse...

#

oh wait...```addMissionEventHandler ["EntityKilled", {

params ["_killed", "_killer", "_instigator"];```
#

Do I need to change _this to _killed?

distant oyster
#

not sure what setDamage does to a weapon holder but you can do this:

addMissionEventHandler ["EntityKilled", {
    _this spawn {
      params ["_unit", "_killer", "_instigator"];
      sleep 0.5;

      _weaponHolders = nearestObjects [_unit,["WeaponHolderSimulated"],5];
      waitUntil {
        (({(velocity _x) select 0 == 0} count _weaponHolders) == count _weaponHolders) &&
        (({(velocity _x) select 1 == 0} count _weaponHolders) == count _weaponHolders) &&
        (({(velocity _x) select 2 == 0} count _weaponHolders) == count _weaponHolders)
      };
      {_x setDamage 1} forEach _weaponHolders;
  };
};
past gazelle
#

I've read it leaves the weapon on the ground but makes it impossible to pick up, also useful for creating weapons displays without using simpleObjects...

#

Cool! I almost got it!

#

I can still open the inventory but all of the items are unusable...the gun on ground is too.

unreal scroll
#

Is there an EH for entity creation event? If no, how can I catch it?

past gazelle
#

Now all I need to do is figure out how to disarm the mouseroll "rearm at ____" menu so the character can't take smoke grenades/ammo...
(This doesn't look even remotely easily possible without making a mod, just gonna delete magazines instead...)

distant oyster
past gazelle
#

DOUGH! I just realized if I disable corpses like this It's gonna mess up VCOM's ability to rearm NATO troops...glad I noticed that right away...

#

@distant oyster Thanks, I gotta rethink this...

distant oyster
#

i really wish there was an InventoryChanged EH :)

past gazelle
#

Hmm...maybe I could just do something stupidly simple and only disable simulation if the PLAYER is near the blufor entity?

distant oyster
peak pond
#

Yeah, seems like engine doesn’t provide that many EH’s. I’m actually curious how expensive CBA EH’s are. Since CBA is adopted as a foundation for many mods, I figured they must do things close to as efficiently as possible given what they have to work with.

past gazelle
#

In order to keep the player from 'touching' any nato corpses, I've got a script to disable simulation on them but if I wanted that script to only disable simulation WHILE the player was around and turn it back on after the player left, what would be a non-insane way of doing that in the event handler? two waitUntil's and a loop?

warm hedge
#

What do you mean by touching? You don't want to loot the corpses?

past wagon
past gazelle
past wagon
#

OH

#

well use an event handler for inventory opened

#

here

past gazelle
#

Sorry yeah, it's the opposite, but I want the player to be able to loot CSAT/IND as normal

warm hedge
#

It's impossible to stop them to take weapons directly from ground unfortunately, AFAIK. But you can use lockInventory

past wagon
#

yeah

past gazelle
#

I dunno, I think the mission is more fun when you can't use NATO stuff...

past wagon
#

lemme see

past gazelle
#

lockInventory doesn't do anything for corpses

little raptor
past gazelle
little raptor
#

well there are inventory event handlers which you could use

warm hedge
#

Oh, I was 100% sure it can stop to loot. Nevermind then, I thought I tested it and worked but I think it was on my dream

past wagon
#

initServer.sqf:sqf natoSoldiersArray = [natoSoldier1, natoSoldier2, natoSoldier3]; initPlayerLocal.sqf:```sqf
player addEventHandler ["InventoryOpened", {
params ["", "_container"];
if ( _container in natoSoldiersArray ) then {
true
};
}];

#

maybe this would work?

#

@past gazelle

past gazelle
#

I'll try it. πŸ™‚

#

What does the natoSoldiersArray do?

warm hedge
#

natoSoldiersArray doesn't do anything. The matter is what do you do with it... it contains NATO soldiers you have, and if the β€œcontainer” is one of those, the inventory action terminates

past gazelle
#

Oh! I'm spawning these units using ALiVE...

#

Is there a way to check for side west?

warm hedge
#

Then check via getNumber (configFile >> "CfgVehicles" >> typeOf _container >> "side") == 1

past gazelle
#

Ok, will do. Got another 5-6 hours to work on this tonight.

past gazelle
#

Cool!

#

Only 3 nato soldiers had to DIE for me to test this...That's like a record for getting something to work for me...

#

Hmm, actually it looks like it took care of the rearm command too!

#

Nope, didn't get the 'rearm' actionMenu command...

#
    params ["","","","_act"];
    if ( !(cursorTarget getVariable ['holder',false]) && !(cursorTarget getVariable ['corpse',false]) ) exitWith { false };
    if ( _act in ['Rearm','TakeWeapon','Gear','Inventory'] ) then {true} else {false};
"];```
Would this disable those 4 menu actions completely?
past gazelle
#

Heh maybe I'll just capture the entire rearm command and pop up a hint that says "Rearm...did you mean...Open inventory?"

little raptor
wicked fulcrum
#

I am doing something wrong when doing if with multiple or-values. The log give me: Error Generic error in expression for this bit:

if (_target == objNull || _frequency == 0) then {continue};

When using equality operators in IFs do I need to put it inside {} or otherwise do it different for multiple expressions? Tried to check Wiki and google, but couldn't find a clear answer. I tried to do:

if ({_target == objNull} || {_frequency == 0}) then {continue};

But still gave the same error.

still forum
#

check the RPT for the actual complete error

#

not only the on-screen error (that doesn't always show the full problem)

#

_target == objNull is that even valid?
I think you wanted isNull _target

wicked fulcrum
#

oh Doh. You are right. I can't compare to ObjNull. I learned that some time ago but I still keep falling into that pitfall from c++. That might be the issue.

The entire log in rpt is here. Although I am not understanding if it actual tells me more specific what the error is.

13:45:02 Error in expression <

if (_target == objNull || _frequency == 0) then {continue};

private _requir>
13:45:02   Error position: <== 0) then {continue};

private _requir>
13:45:02   Error Generic error in expression
13:45:02 File z\crowsEW\addons\spectrum\functions\fnc_spectrumTrackingLocal.sqf..., line 49
still forum
#

The entire log in rpt is here.
are you sure there's not a second error right above that one with more detail?

wicked fulcrum
#

The error repeats a couple of times with the same as I posted. Pastebin: https://pastebin.com/Y7NPNQik

The first messages are debug diag_log from another function, then it comes with this error and repeats it.

still forum
#

mh.
Why is arma so stupid about logging errors

little raptor
still forum
#

the error is at the frequency == maybe _frequency is not a number?

wicked fulcrum
little raptor
#

well using isEqualTo you can compare to objNull. that's what I mean

wicked fulcrum
wicked fulcrum
#

hmm. This might be a race-condition. I just realised. As this happens inside a loop that iterates over an array. While another function might have removed an element of this array. Would fit with the error only shows when something happens that removes an element from the array. Hmmm.
Gonna debug and test some more to see if I can narrow it down.

#

Do we have mutex's or similar in sqf?

still forum
#

well there is no typecheck on _frequency

wicked fulcrum
#

Thats true. I'll try to change it to ["_frequency", 0, [Number]]

#

although not sure if you can use Number as a type like that?

still forum
#

you can't

#

use 0

#

its a number

wicked fulcrum
#

oh, you just give it any type of the type you want. Ah thats handy. Thanks!

torpid quartz
#

I'm trying to add respawn loadouts for diffrent sides, I have BluFor and OpFor working fine, but I can't seem to find the right syntax for Independent
[resistance, ["Grfor2",3]] call BIS_fnc_addRespawnInventory;
any ideas on what to put where I put "resistance" ?

radiant yacht
#

UH addAction ["music on",{UH say3D ["music1",1000,1]},nil,1.5,true,true,"","_this in _target"]; so i recently got help from one of you guys to get this command that allows me to activate a class CfgSounds in my description.ext . so my question, is there any way i could add another addAction that stops this command?

wicked fulcrum
#

If its the text to side you need. Not sure excatly what respawn function requires

torpid quartz
#

I tried that before and it didnt work, but I think that's actually what I'm looking for and I've broken something else lol. I'll give it another try once I fix whatever went wrong lol

little raptor
radiant yacht
#

i see

#

what like UH addAction ["music off",{UH say3D ["music1",1000,1]},nil,1.5,false,false,"","_this in _target"]; ?

wicked fulcrum
little raptor
radiant yacht
#

oh πŸ˜…

little raptor
#

basically it has to be a "loop" action

action1 adds action2 and removes itself
action2 adds action1 and removes itself

#

so you need functions

radiant yacht
#

that's above my paygrade

#

i'll give it a try tho