#arma3_scripting

1 messages · Page 615 of 1

past wagon
#

also i dont want to learn how to code right now

winter rose
#

@fair drum yes

exotic flax
#

I want to write code, but I don't want to write code
We can only help you if you are willing to learn something, because we won't write stuff for you...

past wagon
#

Well

winter rose
past wagon
#

i have some code that Lou Montana wrote for me, and it works great. I just want to modify it a little bit. I am working on a project that i want to get done in the next couple days, and i dont have time to learn a coding language

robust brook
#

I literally gave you exactly what you needed to understand

past wagon
#

i am getting a lot of mixed messages because there are like 5 people giving me code

#

im having to talk to 5 people at the same time

#

it would be much easier with just one person helping me

winter rose
#

doing it for you*
let's be honest, you don't want to learn, you would like the end result provided here

past wagon
#

ok thats kinda true

#

but i am learning some stuff along the way

#

and i dont have time to learn the entire language right now, so im just learning the stuff that you guys show me

potent dirge
#

I suggest making ample use of the BIKI it's fairly well documented

past wagon
#

dude

#

i have looked there many times

winter rose
#

okaaay, stop, we're running in circles here.

past wagon
#

but what i am able to take from the wiki is very very limited, because i dont know most of what it is telling me

winter rose
#

now: whoever is available to write this script for him, dm him, thank you.

past wagon
#

yes that would be great

#

i dont have paypal but if anyone can write me a script i will pay in asylum money lol

#

if anyone plays asylum...

robust brook
#

😉

fair drum
#

sec, forgot you want it in a trigger which is unscheduled

#

@past wagon place in your trigger

if (hasInterface) then {
  [] spawn {
    private _endTime = diag_tickTime + 300;
    while { sleep 1; diag_tickTime < _endTime } do {
      if ((vehicle player == player) and !(player inArea "Zone1")) then {
        player setDamage 1;
      };
    };
  };
};
queen cargo
#
if (hasInterface) then {
  [] spawn {
    sleep 300;
    if ((vehicle player == player) and !(player inArea "Zone1")) then {
      player setDamage 1;
    };
  };
};```
no need for the while loop here
robust brook
#
//Loop 300 times
[] spawn {

  for "_i" from 1 to 300 do {

    if ((vehicle player isEqualTo player) && !(player inArea "Zone1") && (hasInterface)) then {
      player setDamage 1;
    };
  };

};

//Loop Forever
[] spawn {

  for "_i" from 0 to 1 step 0 do {

    if ((vehicle player isEqualTo player) && !(player inArea "Zone2") && (hasInterface)) then {
      player setDamage 1;
    };
  };

};
silent latch
#

Is remoteExec breaking for anyone else

#

none of the params im passing will actually get passed

winter rose
#

@silent latch code?

silent latch
#

[_unit, _name , _value, player] remoteExec ["life_fnc_acceptBet", _unit];

winter rose
#

oh
ah
not touching that! g'night ^^

silent latch
#

listen man i get it everyone here hates life servers im just asking why this remoteExec wont work

solemn steppe
#

Hello there, in tracers module, for custom bullets, I just need to enter a weapon and ammo ? Does't seems to work. https://imgur.com/a/IWuoPZh

robust brook
#
//Put this below your params in life_fnc_acceptBet

hint format ["Script: %1 \n _unit = %2 | _sender = %3 \n  _value = %4 | _senderUnit = %5", _fnc_scriptName, _unit, _sender, _value, _senderUnit];

//Run this in debug console as local
private _targetPlayerForBet = cursorObject;
[player, name player, 1000, _targetPlayerForBet] remoteExec ["life_fnc_acceptBet", _targetPlayerForBet]; //Change the variables you want to send through as you wish

//Tips - make sure its defined in cfgRemoteExec.cfg and also check names and function names are correct and in the right folder etc.

@silent latch

silent latch
#

yeah dude i have

#

its all nil dude

exotic flax
#

@solemn steppe do you get any errors?
Because the module checks if the weapon and magazine(!) are compatible

robust brook
#

did you try the example I provided in the debug console?

silent latch
#

yes

#

everything that gets passed is nil

robust brook
#

check both servers .rpt files, yours, and the player you are testing it on.

silent latch
#

yeah i have and i get undefined var erros

solemn steppe
#

@exotic flax They should be, as they came from NATO Cheetah, autocannon and his ammo. weird.

winter rose
#

@open star no because it was a nice intent; however #rules state not to entertain a foreign language discussion (with the exception of moderators to explain them, the rules)

#

@solemn steppe tried quotes perhaps?

robust brook
#

then where ever you are doing the remoteExec, you are pushing out variables that aren't being defined in that script. @silent latch

silent latch
#

they are

solemn steppe
#

@winter rose Yeah even with quotes, module broken maybe

silent latch
#

ive put a system chat before the remoteExec and all the vars are fine

#

but they all get passed as nil

winter rose
#

tried ```sqf
[[player, name player, 1000, _targetPlayerForBet]] remoteExec ["life_fnc_acceptBet", _targetPlayerForBet];

robust brook
#
//Before we push out our variables, lets check that they work -  put above the line of ur remoteExec
hint format ["Script: %1 \n _unit = %2 | _sender = %3 \n  _value = %4 | _senderUnit = %5", _fnc_scriptName, _unit, _name, _value, player];
[_unit, _name , _value, player] remoteExec ["life_fnc_acceptBet", _unit];

@silent latch

silent latch
#

yeah i had it pretty much just like taht

winter rose
#

@solemn steppe if the module's function is BIS_fnc_moduleTracers, these last three parameters are actually not used at all 😂

solemn steppe
#

whaaaaat...

silent latch
#

value and everything comes through to the hint it just will not pass through the remoteExec

winter rose
#

@silent latch have you tried what I suggested?
Also, isn't it blocked by some kind of security or whatnot?

silent latch
#

yeah ive cfg whitelisted the functions

winter rose
#

and restarted?

silent latch
#

yep

winter rose
#

¯_(ツ)_/¯

silent latch
#

and its not like my function is broken because i put it in a test server and it worked just fine no errors or any issues

winter rose
#

magic it is then

silent latch
#

yeah im really stumped

past wagon
#

wait guys

#

i need a substitute for this

    while { true } do
    {

that instead of looping infinitely, loops 300 times

#

thats all i need now

willow hound
#

for "_i" from 1 to 300 do {

past wagon
#

oh

#

awesome

robust brook
#

🤦‍♂️

past wagon
#

well

#

@robust brook im just gonna see if this works

exotic flax
#

simple question: I want to add an image in some Structured Text (which I do with <img image="path\to\file.jpg"/>), but how can I make it larger than 24 pixels? Do I just have to use the size attribute?

past wagon
#
//first part
if (hasInterface) then
{
  [] spawn {
    for "_i" from 1 to 300 do
    {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone1")) then
      {
        player setDamage 1;
      };
    };
  };
};

//second part
while { true } do {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone2")) then
      {
        player setDamage 1;
      };
    };

for some reason this skips to the second part without going through the first loop 300 times. anyone know why?

exotic flax
#

because the spawn part MAY run later than the rest of the script

past wagon
#

how do i fix it?

exotic flax
#

put the second part also inside the spawn block

past wagon
#

oh

#

so i move one of the }; from the bottom of the first part, to the bottom of the second part?

#

or is it the other way around?

exotic flax
#
if (hasInterface) then
{
  [] spawn {
    //first part
    for "_i" from 1 to 300 do
    {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone1")) then
      {
        player setDamage 1;
      };
    };

    //second part
    while { true } do {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone2")) then
      {
        player setDamage 1;
      };
    };
  };
};
past wagon
#

ok let me try that

#

thanks that makes sense

exotic flax
#

Try to document your code as much as possible, so you know what is happening (even when you wrote it yourself, or copied it from someone else). This will make it a lot easier to understand what is going on.
And the wiki can explain every single command/function in case you don't know.

past wagon
#

yea

#

also

#

IT ACTUALLY WORKS

#

IM DONE ASKING FOR HELP NOW

#

THANK YOU TO EVERYONE WHO TRIED TO HELP ME

fair drum
#

@past wagon yeah don't stop there. Keep learning

upper rose
#

is there a relatively easy way to return the action ID of a given addAction applied to an object? im searching - doesnt look simple...

tough abyss
#

you'd have to go through every actionIDs and find the one you want by checking actionParams i think

#

given you know the params of the action you're looking for it shouldn't be too risky, since once addAction is called all but the action's title will be unchangable

hollow thistle
#

Why not just save the id when you're adding the action?

tough abyss
#

im assuming his script doesn't have knowledge of the id, if that's not the case def save the id when the action is created instead

fair drum
#

question, do ghillies naturally increase camo vs AI via unitTrait?

past wagon
#

i will keep learning

upper rose
#

actually, i thought i did that...

#

will share in a sec

#

I have this on a laptop object: 3 = this addAction ["Assault Course 1: Remove Targets", "Scripts\AC1DT.sqf", nil,0,true,true,"","",2,false];

This is part of a script that executes as part of the action above: ControlLaptop removeAction 3;

The intent is to have the script execute and remove the addActions from all associated laptop objects.

Now this works for a different addAction and removeAction combination numbered "0", but not for others labeled with different numbers at times, and I have reason to believe that it's because the Action IDs are being applied in the order of which the actions were initially input onto the objects...

#

so I believe my goal is to determine which actions are assigned to what action ID numbers

orchid stone
#

Anyone have a creative way to detect if a position is near water other than sampling relative locations around it with surfaceIsWater?

#

kinda thinking a function like this....

    _location = nearestObject _location;
    private _iswater = false;
    [0,45,90,135,180,225,270,315,360] apply {
        if(!_iswater) then {
            _iswater  = surfaceIsWater(_location getRelPos [500, _x]);
        }
    };
    _iswater ```
fair drum
#

will using BIS_fnc_EXP_camp_setSkill override a server's value for skill and accuracy set in the difficulty?

#

or alternatively
does setSkill also work independently of the difficulty settings skill bar?

fair drum
#

...
What should I do if I have a command where I have two sets of arrays that I want to go through...

_subskills = ["aimingAccuracy","aimingShake","aimingSpeed","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];
_allUnits = allUnits;

_x setSkill [_x,0.3]; //Example of where I want the arrays to go

how would I go about going through both arrays for this one command? is it possible?

robust brook
#

what are you using _allUnits for @fair drum

#
//Run global in debug console
{
  private _subSkillsArray = ["aimingAccuracy", "aimingShake", "aimingSpeed", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general"];
  private _subSkillsArrayofNumbers = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1];
  private _allPlayersArray = allPlayers; //Not sure if you are even using this

  private _randomSkill = (selectRandom _subSkillsArray);
  private _randomSkillNumber = (selectRandom _subSkillsArrayofNumbers);

  //Set a random skill on each player
  _x setSkill [_randomSkill, _randomSkillNumber];

  //Hint the skill we placed
  hint format ["Skill (%1) was set to a value of (%2)", _randomSkill, _randomSkillNumber];

} forEach allPlayers;
``` @fair drum
fair drum
#

Well yes I understand how to do that. Was just asking how to parse through all two of my arrays in single command. It's not quite stacking forEach I've found.

Everyunit setskill [everySkillInArray,value]

#

Instead of having to write every skill out in a different line then doing a allunit forEach

#

cause I could write it like this...

{
  _x setSkill ["aimingAccuracy",0.3];
  _x setSkill ["aimingShake",0.3];
  _x setSkill ["aimingSpeed",0.3];
  _x setSkill ["spotDistance",0.3];
  _x setSkill ["spotTime",0.3];
  _x setSkill ["courage",0.3];
  _x setSkill ["reloadSpeed",0.3];
  _x setSkill ["commanding",0.3];
  _x setSkill ["general",0.3];
} forEach allUnits;

but wondering if I can condense it further

robust brook
#

You want all those skills to be set right? @fair drum

fair drum
#

yeah, this is more of a theory question rather than what I want. just wanting to know if you can parse through two different arrays in a single command

#

just using this as an example

#

@robust brook

robust brook
#
[] spawn {

  private _subSkillsArray = ["aimingAccuracy", "aimingShake", "aimingSpeed", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general"];
  private _setSkillNumber = 0.3; //Change as you wish

  {
    //Loop for each player
    {
      hint format ["Skill (%1) has been set to a value of (%2)", _x, _setSkillNumber];
      player setSkill [_x, _setSkillNumber];

      uiSleep 0.5; //Change this as you wish, just so all the hints dont get spammed instantly
    } forEach _subSkillsArray;

  } forEach allPlayers;

};
``` @fair drum Try in debug and global
#
//Anyone have a creative way to detect if a position is near water other than sampling relative locations around it with surfaceIsWater? - Zacho40Yesterday at 10:42 PM
_setRandomPosFnc = {
  params ["_location"];

  _randomPos = [[[_location, 300]], ["water"]] call BIS_fnc_randomPos; //Returns a random position, function has water blacklisted!

  player setPos _randomPos;
  hint format ["You have been teleported to a random position at (%1)", _randomPos];
};

[(getPos player)] call _setRandomPosFnc;
``` @orchid stone
orchid stone
#

ooo, hmmm... and if position == [0,0], i can mark it false

#

i'll do some performance testing to see which method is faster

#

thanks for giving me some ideas

robust brook
#

@orchid stone you can increase the radius in the params of BIS_fnc_randomPos, I just limited it to 300 meters

#

whitelist (Optional): Array - whitelisted areas. If not given, whole map is used. Areas could be:

orchid stone
#

yep gotcha. i didn't think about using that function. will mess with it tomorrow. thanks man 🤙

robust brook
#

performance wise it should be good, only calls being used 🙂 GL!

fair drum
#

why are you using player? they are AI units. can't really change the skill of a player lol but it would be cool if you could haha.

robust brook
#

just for an example, you can change it to however you want

fair drum
#

but you can't because you can't create a second array parse for allUnits.

[] spawn {

  private _subSkillsArray = ["aimingAccuracy", "aimingShake", "aimingSpeed", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general"];
  private _setSkillNumber = 0.3; 

  {
    
    {
      hint format ["Skill (%1) has been set to a value of (%2)", _x, _setSkillNumber];
      _x setSkill [_x, _setSkillNumber]; //Failure Point, this is what I was getting at, two arrays need to be parsed in a single command

      uiSleep 0.5; 
    } forEach _subSkillsArray;

  } forEach allUnits;

};
thick chasm
#

I put a script for spawn units at the position MARK1, but I want put more marks for spawn ramdom units in diferent marks... The game give me an error when I write
...[getMarkerPos "MARK1,MARK2", WEST, ["B_G_Sold...
Any solution?

The complete script is it: AlphaCharlie = [getMarkerPos "MARK1", WEST, ["B_G_Soldier_A_F", "B_G_Soldier_F", "B_G_Soldier_AR_F", "B_G_Soldier_LAT_F"]] call BIS_fnc_spawnGroup;

winter rose
#
getMarkerPos selectRandom ["mark1", "mark2"]```
thick chasm
#

ohh, thanks u @winter rose, I will try now

#

It works, nice!!!

winter rose
#

I know 😎

thick chasm
#

🤣

thick chasm
#

tanks spawn with crew
argg

worthy spade
#

Can I pass variables as references to a call? I've discovered that assignment to arguments won't be available outside the call, but using something like set does change the actual reference.

private _arr = [0, 0, 0];
[_arr] call {
    params ["_arr"];
    _arr = [1, 2, 3];
};
// _arr: [0, 0, 0]

private _arr = [0, 0, 0];
[_arr] call {
    params ["_arr"];
    _arr set [0, 1];
    _arr set [1, 2];
    _arr set [2, 3];
};
// _arr: [1, 2, 3]
winter rose
#

if you want to duplicate an array, use +_array

worthy spade
#

What I want to do is to edit some of the arguments from inside the call.

private _var1 = 0;
private _var2 = 0;
[_var1, _var2] call {
    params ["_var1", "_var2"];
    _var1 = 1;
    _var2 = 2;
};

if (_var1 == 1 && _var2 == 2) then {
    // nice
}
winter rose
#

then just use _var1 = 1, no params

#

call is like "copy paste this code and run it"

private _code = { _val = 2; hint str _val };

private _val = 1;
call _code; // hints "2"
worthy spade
#

Ah, so params is what's making them private within the scope? I was mostly using it to get rid of the "possibly undefined variable" warnings from my IDE, haha. Still seems like weird behaviour to me that my set example works, even with params.

winter rose
#

arrays are passed as references, so you are editing the actual array
numbers and other values are passed as values

worthy spade
#

Alright, so I have to specify when I want an array to be passed by value, by duplicating?

winter rose
#
private _a = 5;
private _b = _a; // value copy
_b = 10; // a = 5, b = 10

private _a = [5];
private _b = _a; // value reference
_b set [0, 10]; // a = [10], b = [10] (same object)

private _c = +_a; // copies the array
_c set [0, 255]; // a = [10], b = [10], c = [255]
#

yep

worthy spade
#

Okay, thanks.

winter rose
#

once you get the array exception in your mind, it's OK ^^

#

it took me some time, back in OFP :p

haughty stump
#

Hey! I'm trying to setup "simplex Support Services" So that only certain people ingame can use the module and only if they have the required items. I'm completely ignorant to arma coding and the documentation for the mod didn't really make any sense to me, Is anyone available to call and explain how I would set this up?

winter rose
haughty stump
#

Hey! i've read through that and figured out one half of what i wanted to do. I specifically want to allow only people with certain names IE "John D." to be able to use the module and only if they have a specific radio. The second part i have figured out but i'm unsure of even where to begin with the first

winter rose
haughty stump
#

correct!

winter rose
#
private _canUse = name player in ["SovietWiggler", "JohnBob"];
player setVariable ["canUseSSS", _canUse, true];
haughty stump
#

let me test!

winter rose
#

do or do not, no try there is

haughty stump
#

does not appear to be working, I'm assuming i would replace my name with my Ingame name correct?

winter rose
#

well yes ^^

#

a better check would be with player UID

haughty stump
#

negative, i'm sure im missing something basic let me remove the radio req and see if there is a change

#

no change

winter rose
#

where do you put this code?

haughty stump
#

Beside "Access Condition"

winter rose
#

…what? where?

haughty stump
#

I can make an Imgur gallery if that's allowed may be easier to understand

#

mind if i DM it to you

winter rose
#

an imgur might be better if someone else wants to help

haughty stump
winter rose
#

oh that's in game then
my code if for the editor

try maybe```sqf
name player in ["SovietWiggler", "JohnBob"];

haughty stump
#

oh man that worked!

winter rose
#

First try!

haughty stump
#

I'll tell ya, you guys are like wizards

#

i appreciate that so much!

winter rose
#

w/ pleasure!

winter rose
#

Oooooonly Loooooou… can make the darkness bright 🎵

split coral
pale ridge
#

i need help with a script for a mod, i already have some thoughts but i am pretty sure it doesnt work is missing something..., is anyone willing to help?

warm hedge
#

Can't help you without details

pale ridge
#

so i am trying to intruduce pain inducing bullets with the ACE mod. My first idea was doing it with an eventhandler, when ever a unit is hit by _ammo X
like this:

#
this addEventHandler ["HitPart", {
    params ["_ammo","_target"];
    if (_ammo isEqualto ""AmmoSplinterRM","AmmoSplinterRS"") then (
        if (isClass(configfile >> "CfgPatches" >> "ace_main")) then (
        private _painLevel = GET_PAIN_PERCEIVED(_target);
            _painLevel = _painLevel + 0.2 _target;
            else (
            _currentdamage = getDammage _target;
            _newdamage = _currentdamage + 0.1;
                 )
        )
}];```
#

i also got another suggestion for someone else, but i am quite unsure how it works, and if it is even complete

#
["ace_medical_woundReceived", {
    params ["_unit", "_woundedHitPoint", "_receivedDamage", "_shooter", "_ammo"];
    
    if (_ammo isEqualTo "<your_ammo_class>") then {
        private _painToInflict = (getNumber (configFile >> "CfgAmmo" >> _ammo >> "<your_pain_config_attribute>"));
        
        if (_painToInflict > 0) exitWith {
            ["ace_medical_injured", [_unit, _painToInflict]] call CBA_fnc_localEvent;
        };
    };
}] call CBA_fnc_addEventHandler;```
spark sun
pale ridge
#

yeh thats me

queen cargo
#

if the snippet here:

["ace_medical_woundReceived", {
    params ["_unit", "_woundedHitPoint", "_receivedDamage", "_shooter", "_ammo"];
    
    if (_ammo isEqualTo "<your_ammo_class>") then {
        private _painToInflict = (getNumber (configFile >> "CfgAmmo" >> _ammo >> "<your_pain_config_attribute>"));
        
        if (_painToInflict > 0) exitWith { // Inb4: useless here as you exit the scopes anyway @<267396223357550603> otherwise the whole message is not directed towards you :wink:
            ["ace_medical_injured", [_unit, _painToInflict]] call CBA_fnc_localEvent;
        };
    };
}] call CBA_fnc_addEventHandler;```just could rather be written like this:
```ts
CBA_fnc_addEventHandler("ace_medical_woundedReceived", function(unit, woundedHitPoint, receivedDamage, shooter, ammo) {
  if (ammo === "<your_ammo_class") {
    let painToInflict = getNumber(configFile / "CfgAmmo" / ammo / "<your_pain_config_attribute>");
    if (painToInflict > 0) {
      CBA_fnc_localEvent("ace_medical_injured", [unit, painToInflict]);
    }
  }
});
```would be nice, right?
haughty stump
#

so last question, i'm in the editor now and i want to place down the MK41 VLS missle launchers for use with the independent side. The object is normally NATO, so what would i need to put in to change the side of the MK41 from nato to independent?

#

surely it's not as simple as
"Setside Independent" in the Init box?

queen cargo
#

what about

private test = player.getVariable("test");```
winter rose
#

advertisiiing! :D

jade abyss
#

dict or nothing.

queen cargo
#

just trying to create hype about a guaranteed flop 👯👯👯

winter rose
#

You are not developing the next Duke Nukem, you will be alright 😄

exotic flax
#

Half Life 3 Confirmed!!!!

queen cargo
#

shhhhhs 🤫 i know
but would be cool if SQC (SQF-Cstyled) could actually gain some traction ... 😄

winter rose
#

Bam, integrated in A3 in patch 2.02 👀

queen cargo
#

funny enough, it does not requires any magic
sooo ... imo should even be doable 🤪

#

dreams of a bright future full of beer filled rivers

winter rose
#

we can jump in the water, stay drunk all the tiiime 🎵

still forum
#

dict or nothing.
😉 Thanks for reminding me

queen cargo
#

hint-hint: the moment some actual dictionary functionality arrives in the lang, we should be able to implement javascript ontop of SQF

#
{
  "jsonobj": "Smells like JSON"
}```
this is the only thing not possible right now with SQF
#

having something like createHashMap could solve that

winter rose
#

ah, JSON parser I wouldn't mind…

#

though didn't you make an in-game XML parser?

queen cargo
#

nope
javascript objects

haughty stump
#

does anyone have any input on how i can change the default side of an artillery piece (MK41) from blufor to independent? 👀

queen cargo
#

and yes, did a XML parser for SQF

winter rose
#

@haughty stump change the crew units

haughty stump
#

in the editor it's not showing units

#

i'm an idiot. i can just drag and drop the unit i need in there

winter rose
#

when zoomed enough yes, otherwise use the left-hand menu 🙂

haughty stump
#

time to test!

#

and i thought this was going to be a simple mod install 3 hours later

still forum
#

having something like createHashMap could solve that
👀 stop spying

queen cargo
#

it ain't spying if you just expect that to happen 🤔

still forum
#

literally just talked with KK about specifically createHashMap

queen cargo
#

gib gib gib gib

still forum
#

Yeah I'll start planning later today

queen cargo
#

once landed (official), SQC will receive JSON object-init syntax and SQF-VM the hasmap support

pale ridge
#

does this work:
_ammo isEqualTo ""AmmoSplinterRM","AmmoSplinterRS""
or does it have to be:
_ammo isEqualTo ["AmmoSplinterRM","AmmoSplinterRS"]
or
_ammo isEqualTo ""AmmoSplinterRM" || "AmmoSplinterRS""
or
_ammo isEqualTo ""AmmoSplinterRM" || _ammo isEqualTo ""AmmoSplinterRS"
i am sorry i don't understand arma languange yet, can't find it right now

warm hedge
#

Not sure what is the goal? If _ammo is either AmmoSplinterRM or AmmoSplinterRS returns true?

pale ridge
#

aye

warm hedge
#
(_ammo == "AmmoSplinterRM" or _ammo == "AmmoSplinterRS")```
pale ridge
#

really?, that complicated, damn

warm hedge
#

Is it complicated? 🤔

pale ridge
#

i mean long, but i thought u could just use brackets

#

for arrays

warm hedge
#

Nope, you can't

#
(_ammo in ["AmmoSplinterRM","AmmoSplinterRS"])```Beware case sensitive way
winter rose
#

^ yup

#

that or toLowerANSI everything

winter rose
#

no for many reasons
= assigns, == checks equality
isNull respawn
isNull doesn't check if the variable is defined

#
PIE_respawn = [];
if (PIE_respawn isEqualTo []) then
{
  PIE_respawn = [missionNamespace, blufor, "Rally Point"] call BIS_fnc_addRespawnPosition;
};
#

SQF-VM?

#

(way ahead of you @queen cargo 😋)

unique sundial
#

I keep trying to apply C# to this language
didnt know assignment operator could be used to check quality in C#

winter rose
#

the thing == null is hard to get around yes

#

it's isNull now 👀

robust brook
#
//Check https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition for different parameters
if (isNull yourGlobalVariable) then {
  yourGlobalVariable = [missionNamespace, "yourMarkerName", "respawnNameHere"] call BIS_fnc_addRespawnPosition;
};
``` @open star
jade abyss
#

😉 Thanks for reminding me
@still forum i can remind you every week, if you want 😂

crude needle
#

I think what you are looking for is isNil.

if (isNil "myGlobalVariable") then {
// create respawn
} else {
// move respawn
};

Alternatively, if you are looking for a global variable that may or may not exist: missionNamespace getVariable ["myGlobalVariable",[]] where the [] is just the default value of the variable if it does not exist. Could be anything though.
https://community.bistudio.com/wiki/getVariable
https://community.bistudio.com/wiki/isNil
@open star

robust brook
#
[] spawn {

  private _subSkillsArray = ["aimingAccuracy", "aimingShake", "aimingSpeed", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general"];
  private _setSkillNumber = 0.3; //Change as you wish (0-1)

  {
    private _unitObject = _x;
    {
      _unitObject setSkill [_x, _setSkillNumber];
      hint format ["Unit: (%1) \n Skill (%2) has been set to a value of (%3) \n Current element (%4) of _subSkillsArray", _unitObject, _x, _setSkillNumber, _forEachIndex];
      uiSleep 0.5; //Wait 0.5 seconds per each setSkill/hint
    } forEach _subSkillsArray;
  } forEach allUnits;

};

``` @fair drum Forgot to give you this, should work as you requested.
winter rose
#

did you define rallyRespawn somewhere?

#

and btw, do you want it to be enableable, disableable (if these are words) or only created once and that's it?

robust brook
#

you shouldn't need the if then?

winter rose
#

then make it a one-time action? I don't get the issue?

#

ah, perhaps 😁

#

making things simple is complicated, that's a fact
step back, cool down, rethink it, then write code 🙂

#

so:

  • you know there will be only one action of creating a respawn
  • you know how to create a respawn
  • how will you make the player create the respawn? make this creation way removed as soon as the player selected a spot, and no more need to worry about it
#

how so?

robust brook
#

position: (Array - format Position) OR (Object - specific object. When some crew positions are available and unlocked, players will be respawned on them, otherwise they will appear around the object.) OR (String - marker name)

#

with global variables, I suggest using more complex names instead of "RALLY", also you can try ```sqf
yourGlobalVariable = [missionNamespace, (getPos RALLY), "Rally Point"] call BIS_fnc_addRespawnPosition;

#

Try that instead

#

in the init of the object put ```sqf
RALLY = this;

#

double click on the object

winter rose
#

did you test in MP?

#

(and set the respawn type adequately?)

opal ibex
#

Does anyone know a way to get a public string array from .cfg? It looks like misson params only accept integer (https://community.bistudio.com/wiki/Arma_3_Mission_Parameters). Is there a method to achieve this?
For example, server hoster would be able to enter an item name like {"ItemGPS","ItemRadio"} to the config and then .sqf could use those values.

winter rose
#

@opal ibex in Description.ext?

getText (missionConfigFile >> "myClass" >> "myEntry");
opal ibex
#

Entries are integer no?

robust brook
#

@opal ibex What exactly are you trying to do?

opal ibex
#

I don't know how else i can describe it better than the example i gave

winter rose
#
// Description.ext
class MyClass
{
  items = { "ItemGPS", "ItemRadio" };
};
// sqf
private _items = getArray (missionConfigFile >> "MyClass" >> "items");
opal ibex
#

I see, so we can do custom classes, they would override it inside .cfg mission right?

class Missions {
  class Mission1 {
    class MyClass {items= { "ItemGPS", "ItemRadio" }}
  }
}
open star
#

So I see the issue I've run into now then.

#

I guess at least, I was assigning this:

rallyRespawn = [missionNamespace,RALLY,"Rally Point"] call BIS_fnc_addRespawnPosition;```
to an Object that had Simulation, Show Model, and Damage disabled and it wouldn't appear. So I oddly tested a theory and placed another object and tried this isntead:
```sqf
rallyRespawn = [missionNamespace,rallyRespawnObject,"Rally Point"] call BIS_fnc_addRespawnPosition;```
and it works just fine.
robust brook
#

You just changed the global variable name right?

open star
#

No, I turned on Simulation, Show Model, and Enabled Damage.

#

And after a few more tests, turns out if Simulation is disabled on the object you're attaching it too it breaks?

robust brook
#

@open star are you wanting to hide the object and/or disable damage also?

open star
#

Nah as long as it's hidden and doesn't "exist" in the world it's fine.

#

I can't believe that was the source of most of my frustration.

robust brook
#

@open star Put this in the init box, if you are wanting to hide it by sqf means```sqf
this hideObjectGlobal true;

open star
#

I'm still struggling on this, christ.

tough abyss
#

Could some one help me with my acre2 ?

winter rose
#

@robust brook no global command in the init box like this 👀 ```sqf
if isServer then { this hideObjectGlobal true };

open star
#

Okay so I made this work the way I want too by placing the Respawn Position Module down giving it the variable name "RALLY" and then when I set the position it moved the respawn position to the players position, since I'm moving RALLY variable which is the respawn module.

#

This whole issue is because I didn't want to have Rally Point respawn position on map start, I wanted it created later.

robust brook
#

@winter rose I've had a couple objects place with that line of code in their inits, in a mp enviroment the objects remain hidden globaly. Does it really matter to check?

winter rose
#

@robust brook it will simply run the command one time on server + x times the players' number/joining so not ideal (not a performance killer, but still unwelcome)

#

setObjectTextureGlobal, e.g, has a weird behaviour with init fields

wet shadow
#

Does anyone know if variables stored in the missionNamespace are retained if the player goes to the lobby and switches his slot? Does it make a difference if the mission simulation is suspended when there are no players on the server while the player is in the lobby?

still forum
#

Unrelated to the question that was asked

#

afaik missionNamespace is cleared on server connect/disconnect. So from lobby back to ingame should not be cleared, but not 100% sure about that

marsh ermine
#

is it possible to take kill zone kids script and make it so that all c4 placed through ace adds his objects to it?
If so would one of you awesome people be able to edit the script below to make that happen?
I don't want the scroll wheel options, just transform the c4 we use into the his script below.
We are trying to create a way to clear trees that works with JIP.

    "BOOM" addPublicVariableEventHandler {
        _c4 = _this select 1 select 0;
        _c4pos = _this select 1 select 1;
        for "_dir" from 0 to 359 step 45 do {
            0 = [_dir, _c4pos] spawn {
                _dir = _this select 0;
                _f = "Land_CargoBox_V1_F" createVehicleLocal [0,0,0];
                _f setMass 999999;
                _f allowDamage false;
                _f setDir _dir;
                _f setPosASL (_this select 1);
                _f setVelocity [cos _dir * 5, sin _dir * 5, 5];
                sleep 0.5;
                deleteVehicle _f;
            };  
        };
        _c4 setDamage 1;
    };
} else {
    KK_fnc_makeC4 = {
        player addAction ["Put C4", {
            _c4pos = screenToWorld [0.5,0.5];
            player playActionNow "PutDown";
            sleep 0.5;
            _c4 = createVehicle [
                "DemoCharge_Remote_Ammo_Scripted",
                _c4pos,
                [],
                0,
                "CAN_COLLIDE"
            ];
            player removeAction (_this select 2);
            player addAction ["GO BOOM!", {
                BOOM = _this select 3;
                publicVariableServer "BOOM";
                player removeAction (_this select 2);
                call KK_fnc_makeC4;
            }, [_c4, getPosASL _c4]];
        }];
    };
    call KK_fnc_makeC4;
};```
potent dirge
#

Can I declare variables while constructing arrays? E.g.

myArray = [
  _varAlfa = 117,
  _varBravo = 034,
  _varCharlie = 087
];
queen cargo
#

no

#

arma will not return a value if you do that, not even nil

potent dirge
#

Alright, thanks then

little raptor
#

You can do it like this:

_a=[1,2,3];
_a params ["_v1","_v2","_v3"]
#

It's not the same though (it has a hidden "private" there too)

ionic anchor
#

im trying to make it so that if a player has an item in their virtual inventory and gets inside an air vehicle it will move them out, but it keeps giving me a missing ) no matter how many ways i do it

_blueprints = ["bppack","mk200diss","ifritdiss","qilindiss","4wddiss","car95diss","spar16sdiss","lim85diss"];
_inv = ((findDisplay 100800) displayCtrl 100802);

if ((_blueprints in _inv player && count _inv > 0) && (vehicle player isKindOf "Air")) then {
    moveOut player;
};
ionic orchid
#

@still forum just double-checking that missionNamespace clearing, since I've run into issues with that - the vars aren't cleared if you disconnected and went back to the server browser - they stay there until you back out to the main menu or join a new server

#

I only know that because I have a loading screen Display that uses a RscMapControl & "Draw" event - the display doesn't close and the event still runs while in the server browser, so you can check the state of the variables that way

robust brook
#
private _varAlfa = 117;
private _varBravo = 34;
private _varCharlie = 87;
private _myArray = [_varAlfa, _varBravo, _varCharlie];
//OR
private _myArray = [117, 34, 87];
private _varAlfa = _myArray select 0;
private _varBravo = _myArray select 1;
private _varCharlie = _myArray select 2;

@potent dirge

knotty flame
#

where would i ask questions about things such as best units for defending a base?

potent dirge
#

@robust brook Thanks, but I had already implemented something similar to your second option

robust brook
#

@ionic anchor what does your _inv exactly return?

ionic anchor
#

its a listbox of items, mayeb i should use lbdata instead

robust brook
#

@ionic anchor are you using a specific framework or mod? for the inventory system

ionic anchor
#

altis life

robust brook
#

V5?

ionic anchor
#

no 4.4 i think

#

the array is to check for any of those virtual items are present in players vinventory

robust brook
#

figure out what you had set the virtual items names as, ex: life_inv_bbpack or whatever

ionic anchor
#

they are what are in the array I.E. "variable = "ifritdiss";

robust brook
#
{
  _x params ["_vItem"];
  private _amountOfEachVirtualItem = missionNamespace getVariable (format["life_inv_%1", _vItem]);


  if ((_amountOfEachVirtualItem > 0) && (vehicle player isKindOf "Air")) then {
    hint format ["You had a virtual item (%1) \n with an amount of (%2) \n so you were removed from the vehicle!", _vItem, _amountOfEachItem];
    moveOut player;
  };

} forEach ["bppack", "mk200diss", "ifritdiss", "qilindiss", "4wddiss", "car95diss", "spar16sdiss", "lim85diss"];
``` @ionic anchor
ionic anchor
#

legend, thank you very much @robust brook

wet shadow
#

where would i ask questions about things such as best units for defending a base?
@knotty flame #arma3_scenario

fair drum
#

how can I remove the targeting pod's ability to lase? remove an aircrafts self lasing ability for players?

winter rose
#

remove turret's laser?

#

removeWeapon the laser, it should work

fair drum
#
plane1 removeWeaponTurret ["Laserdesignator_pilotCamera",[-1]];

for others to reference

tough abyss
queen cargo
#

by doing some UX magix and "a few" lines of code

#

it is essentially a "toast" message system

#

as that already exists

tough abyss
#

Ok thx. I’m sorry but what is UX magix?

queen cargo
#

GUI coding 😄

tough abyss
#

Alright thank you

queen cargo
#

but unless you are rather experienced with SQF and at least already displayed some custom dialog, i would not recommend you to try with it

strange seal
#

Is there a way to reference a groups waypoint array? I know you can reference individual waypoints using [_grp, index] but I’m trying to count how many waypoints there are

winter rose
strange seal
#

@winter rose oh my god I feel stupid now, been looking all over that thing and for some reason just skated over that, thank you very much!

#

one other question, I’m trying to use createMarker I create it, set the shape (icon) and set the type (using the classname I see in the editor) but it never shows up on the map I’ve also tried setting color as well along with everything, what am I missing?

winter rose
#

setMarkerType from cfgMarkers (see the wiki)
setMarkerSize perhaps

strange seal
#

Thanks again

ripe sapphire
#

Guys whats the best way to make infantry (players and AI) dismount from a chopper thats moving on a unitcapture recording?

#

Its also for an MP mission

fair drum
#

how fast?

#

cause I know that if you do your waypoints just as you would without the unit capture, they still fire when you get close to them
@ripe sapphire

#
//Example #1
player action ["Eject",vehicle player];

//Example #2
{ _x action ["Eject",vehicle1] } forEach crew vehicle1;

//Example #3
_group = [];
_group = _group + [player] + units group player;
{ _x action ["Eject",vehicle player] } forEach _group;

@ripe sapphire

ripe sapphire
#

Normal fast

#

Im trying to do like a big air assault landing with recorded helicopter paths

#

I will try the waypoint and scripts thanks

#

@fair drum should i have that script start after a trigger of heli altitude = 0?

fair drum
#

well you want them to jump out while flying in the air right? and they parachute down?

#

@ripe sapphire

ripe sapphire
#

No, its like the vietnam helicopter landings you know

#

Lots of hueys

fair drum
#

do you want them flying away with their pilots after dropping off? @ripe sapphire

ripe sapphire
#

Yeah, should i record the fly away too?

#

Or end capture at the LZ

fair drum
#

well, you don't have to. depends, are the players gonna notice that the helis are flying away? or do you think they are going to go right off to the objective and not care. if they don't care, then you can keep them on the ground then delete them after x amount of time as the players leave

#

also, I need to know if its 1 pilot, 2 pilots, 2 pilots and 2 gunners etc etc. how many non cargo crew are there going to be?

#

@ripe sapphire

//Condition 
(heli1 in thisList) and ((getposATL heli1 select 2) <= 2)

//On Activation 
private _ejectCrew = crew heli1; 
_ejectCrew deleteRange [0,1];
{ _x action ["Eject",heli1] } forEach _ejectCrew;

this is if you have 2 pilots. it will kick all other members out

#

fires when the heli is in the trigger as well as if its height above terrain is lessThanOrEqualTo 2 meters

#

you want to have the units in the helicopter have a waypoint where you want them to go, if not, they will get back into the chopper since the SL didn't tell them to get out

#

separate squads from the pilots

fair drum
#

how do I set off a placed in editor APERS mine dispenser? setDamage 1 doesn't work with that one.

robust brook
#
//Place this in the "APERSMineDispenser_F" object init box
mineProneForExplosion = this;

//Run these on debug or a .sqf file
_spawnedExplosion = "ModuleMine_APERSBoundingMine_F" createVehicle (getPos mineProneForExplosion);
_spawnedExplosion setDamage 1;

//OR

[] spawn {
  for "_i" from 1 to 5 do { //loops detonations from APES mine (5 shots)
    _spawnedExplosion = "ModuleMine_APERSBoundingMine_F" createVehicle (getPos mineProneForExplosion);
    _spawnedExplosion setDamage 1;
    uiSleep 0.5;
  };
};
``` @fair drum
fair drum
#

so I need to use the "_F" version. does this apply to all mines and deployables?

robust brook
#

I'm creating a scripted explosion, still doesn't effect the actual object as it's just static.

fair drum
#

oh well the apers dispenser doesn't create an explosion. I just want to activate it to spit its mines.

robust brook
fair drum
#

i think we aren't on the same wavelength. nvm this is what I'll do. I'll create said mine, assign it to a npc, then do action touchoff to do it, its crude but it might work

#
_mine1 = createMine ["APERSMineDispenser_F",getposATL position1,[],0];
unit1 addOwnedMine _mine1;
unit1 action ["TouchOff",unit1];
robust brook
#
private _apesMine = createMine ["APERSMineDispenser_F", (getPos unitTesting), [], 0];

unitTesting addOwnedMine _apesMine;
unitTesting action ["TouchOff", unitTesting];
``` @fair drum just tested this and works like a charm
winter rose
#

setDamage should work on a script-created mine dispenser

waxen tide
#

is there an equivalent of initplayerlocal.sqf inside a mod?

winter rose
#

a preinit CfgFunctions I would say @waxen tide

waxen tide
#

is there a tutorial or an example around?

#

i prodded the wiki but i only ever did mission scripts, never really touched mods

deep ice
#

Is it possible to allow the driver of a vehicle to hold a weapon out to use?

young current
#

no

#

would require significant remaking of the vehicle

waxen tide
#

thx !

storm radish
#

im looking to make a script for a heli crash, iv got the crash on lockdown (heli shakes players blackout etc) but i want to original heli to despawn and as the players recover a pre made crash site appears im at a loss

willow hound
#

I suggest a combination of moveOut, deleteVehicle and setPos. Alternatively, selectPlayer might also be of interest.

steel fox
#

I'm currently encoutering a strange issue where setVectorDir seems to not have a global effect when used on a CfgAmmo object. Is this documented behavoir?
Running a dedicated server. Command fails to progate effect to clients.
When running the command from a client connected to the server, the command appears to be working fine locally, but no changes are seen on other clients or the server.

robust brook
#

use setPos to sync the directions globaly, should do the trick. @steel fox

#

after you setVectorDir

steel fox
#

Aight, checking now.

#

Sadly, it doesn't sync the direction.

#

normal CfgVehicles work fine, even with out a setPos. CfgAmmo objects just seem broken.

robust brook
#

I just noticed your using ammo as an object lol

#

my bad

#

What exactly are you trying to do? @steel fox

steel fox
#

Creating a tripwire. Several one meter segments get chained to create a dynamically sized tripwire.

#

I can provide my code, but the issue can be replicated without it.

robust brook
#

provide if you want to, or dm me @steel fox

steel fox
#
//Create a tripwirePart: an 1m segment of tripwire and an empty helper:
private _fnc_createPart = {
    params["_position", "_vector", "_tripwirePartsIndex"];

    //Create the helper:
    private _helper = createVehicle ["rid_tripWire_helper", (ASLToATL _position), [], 0, "CAN_COLLIDE"];
    _helper setVariable [QGVAR(tripWireNodes), [_object0, _object1], true];


    //Give the helper the Index to the position where the tripwire it is part of is stored in _object0's rid_tripwire_parts ARRAY, to allow rid_core_fnc_tripWireActivation to clean up the tripwire:
    _helper setVariable [QGVAR(tripwire_parts_index), _tripwirePartsIndex, true];

    //Spawn the tripwire segment:
    private _segment = createVehicle ["rid_tripWire_segment_ammo", (ASLToATL _position), [], 0, "CAN_COLLIDE"];
    //_segment setPosASL _position;
    _segment setVectorDir _vector;
    [_segment, _helper];
};

This is the part that is relevant to the tripwire creation.

#

well, a single segment

#
class CfgAmmo {
    
    class APERSTripMine_Wire_Ammo;
    class rid_tripWire_base_Ammo: APERSTripMine_Wire_Ammo 
    {
        author = "Walthzer/Shark";
        isCW=1;
        SoundSetExplosion[] = {};
        defaultMagazine="APERSTripMine_Wire_Mag";
        hiddenSelections[]={"camo", "start", "end"};
        hit=0;
        indirectHit=0;
        indirectHitRange=0;
        soundHit[]={"",1,1};
        explosionEffects="rid_tripWireEffect";
        CraterEffects="";
        soundTrigger[]={"",1,1};
        class CamShakeExplode {
            power=0;
            duration=0;
            frequency=0;
            distance=0;
        };
    };
    class rid_tripWire_segment_Ammo: rid_tripWire_base_Ammo
    {
        model=QPATHTOF(rid_tripwire);
        mineTrigger="rid_tripWire_base_trigger";
        mineModelDisabled="";
    };
};

and the tripwire segment object

opal ibex
#

@robust brook after learning more, i get what you meant yesterday by me misusing the server.cfg file but i still haven't found a solution to my problem.
Let me try to explain it again, i need a way for a server owner to easily change a variable that is used in a mission.pbo and afaik server.cfg is the only place to do this. I don't want unpacking .pbo changing Description.ext and packing again. If it is an integer, no problem easy to do, you use the params. But with what i'm trying to do i need a string array to be changed and params only use integers. Is there a way to achieve what i'm trying to do?

ripe sapphire
#

Thanks @fair drum for the scripts, will try them soon

fair drum
#

anyone have any recommended resources/learning programs for C#?

#

as a non CS person

surreal peak
#

wrong place to ask for C#

#

arma uses SQF

fair drum
#

arma 4 and dayz use C#

#

learning ahead of time

still forum
#

DayZ uses Enscript, not C#

surreal peak
#

@still forum Do you know of any published examples of Enscript code? Did some googling and could only find something from 1980

still forum
#

All of DayZ script is written in Enscript

#

just unpack system.pbo from DayZ

fair drum
#

well isn't it similar to C#? which means that I should learn that in preparation?

still forum
#

Its as similar to C# as it is to C or C++ or Java

surreal peak
#

so like how SQF is a mismatch of languages sort of thing?

still forum
#

Like every language ever basically 😄

winter rose
surreal peak
#

tyvm

fair drum
#

im assuming there will be commands just like in sqf that we can use that simplify stuff?

winter rose
#

🐮 perhaps

unique sundial
#

You can try DayZ scripting if you are so eager to start ahead of time on unannounced game

surreal peak
#

thats true, Hypoxic you got about 4-5 years to learn probably 😄

winter rose
#

Enscript is using SQF anyway

#

juuust kidding, I swear I heard 3 cardiac arrests from here 😄

still jewel
#

Anyone know how to set task so player can wear helmets/other gear?

steel fox
#

What are you trying to do?

still jewel
#

You know the set task?

steel fox
#

yes

still jewel
#

Like player picks up the gun and the task is completed.

#

I’m trying like that but I’m not sure if it works at all.

winter rose
#

how do you do it?

still jewel
#

That’s why I am asking, not sure myself too.

winter rose
#

…so you did not do anything so far ^^

still jewel
#

Not much, aside from making dialogues in sideChat.

winter rose
#

do you simply want "any gun = task completed"?

still jewel
#

Like that one but with helmets/vest

winter rose
#

you could do something like this (very raw thing)

waitUntil { primaryWeapon player != "" };
// or
waitUntil { vest player != "" };
// etc
still jewel
#

Umm..

winter rose
still jewel
#

Thank you

quaint ivy
#

Hey could someone provide me some insight. Im deleting a bunch of vehicles, and to avoid ghost objects im deleting their crews beforehand. My loop for deleting the crew works fine but the game keeps throwing me an undefined variable error in expression crew #_vehicle and here's my code

for "_i" from 0 to (count _objects) do
{
    _vehicle = _objects select _i;
    {_vehicle deleteVehicleCrew _x } forEach (crew _vehicle);
};```
still forum
#

for "_i" from 0 to (count _objects) do
{
_vehicle = _objects select _i;
wat

#

forEach?

quaint ivy
#

yes

high marsh
#

_i would be a number?

still forum
#

just use forEach I mean

quaint ivy
#

its a for each in a for each

still forum
#

for "_i" from 0 to (count _objects) do
that's not a forEach

quaint ivy
#

I know, but its a way of avoiding it

#

is there a second magic variable such as _x ?

still forum
#

why would you want to avoid forEach and replace it by a much worse performing for loop

#

{
private _vehicle = _x;
{_vehicle deleteVehicleCrew _x } forEach (crew _vehicle);
} forEach _objects;

#

where does _objects come from?

#

if _objects contains nil's, that'll cause the error you posted

#
{
  if (!isNil "_x") then {
    private _vehicle = _x;
    {_vehicle deleteVehicleCrew _x } forEach (crew _vehicle);
  };
} forEach _objects;
quaint ivy
#

it seems I havent completely mastered the scopes of forEach

#

thanks @still forum

still forum
#

forEach just repeats a piece of code, what you do with that is left entirely to you

quaint ivy
#

I was getting confused because I couldn't figure out how the magic variable gets handled when having multiple forEach

still forum
#

its not magic

#

just stop thinking things are "magic" and take them as they are, just some variable 😄

quaint ivy
#

'magic variable' is just a nickname for _x is it not?

still forum
#

people often think a "magic" variable has some magic properties that make it special so that you can't handle it just like a normal variable

quaint ivy
#

Lol i was simply calling it that because of this piece from the biwiki Description: Executes the given command(s) on every item of an array. The array items are represented by the magic variable _x. The array indices are represented by _forEachIndex. In Arma 2 and later, the variable _x is always local to the forEach block so it is safe to nest them.

#

and I obviously never noticed the last part where it says "the variable is always local to the block"

#

which is why I spaghettied and tried to avoid multiple forEach blocks

outer fjord
#

What is the lightest EH or system that I could use to do timed events. Like if I wanted a patrol to spawn and deploy every 12:00 in-game time. What would be the best tool to accomplish this?

still forum
#

how exact does it need to be?

#

does it need to respect code changing ingame time ala setDate?

outer fjord
#

Doesn't have to be perfect, just not be super heavy on the system that I could have multiple events happening depending on time of day.

#

Does changing time by other means throw it off a lot?

ionic orchid
#

@quaint ivy your for-loop goes 1 number too high, if you're interested
it would have to be
for "_i" from 0 to ((count _objects) - 1) do
but stick with forEach, it's better for what you're doing

quaint ivy
#

@ionic orchid yeah i realized that too, but the issue was that some values within _objects was nil

ionic orchid
#

try this:
forEach (_objects - [nil]);

#

that should trim all the nils out beforehand, so you don't have to check inside the loop

quaint ivy
#

thanks, although im just skipping the case if the current object is nil which works perfectly for what i need

ionic orchid
#

👍 whatever works for you!

quaint ivy
#

By the way, anyone know what the best way for spawning object compositions is trough scripts?

jovial nebula
stable wedge
#

I've read the additem wiki
What do I have to put in the damn init field of an object for it to simply spawn with an array of items that I want it to
In the editor
this addItem
this addItemCargo
this addItemCargoGlobal

they don't work. I know additem wants a str so fine, but the others?

unique sundial
#

wiki should have examples, no?

stable wedge
#

I've tried

#

this additemcargo [["ACE_fieldDressing","ACE_morphine","ACE_epinephrine","ACE_EarPlugs","ToolKit","ACE_elasticBandage","ACE_bloodIV_500","ACE_microDAGR","kka3_ace_extension_Land_BagFence_Long_F","kka3_ace_extension_Land_BagFence_Round_F"],[50,20,20,5,2,50,15,3,10,10]];

#

Doesn't want to put it into the container

#

It has plenty of space

stable wedge
#

I've named the object _crateammo, added a trigger which triggers when any player is present in a 100m zone, added the script

_crateammo additemcargo [["ACE_fieldDressing","ACE_morphine","ACE_epinephrine","ACE_EarPlugs","ToolKit","ACE_elasticBandage","ACE_bloodIV_500","ACE_microDAGR","kka3_ace_extension_Land_BagFence_Long_F","kka3_ace_extension_Land_BagFence_Round_F"],[50,20,20,5,2,50,15,3,10,10]];

#

No errors, no items in my crate

fair drum
#

try addItemCargoGlobal @stable wedge

#

also, try only adding 1 value for count, not 10

stable wedge
#

Nothing

#

with any of those changes

#

itemcargoglobal, and the value I had, setting everything to 1, or using itemcargo and having the amounts be 1

fair drum
#

this command only works for 1 item and 1 number value

stable wedge
#

zzzzzzzzzzzzzzzzzzzzzzzz

fair drum
#

standby

#

ill fix it for you

stable wedge
#

Thank you

fair drum
#

You want it so you can place it in the object init box? @stable wedge

stable wedge
#

That would be ideal yea

fair drum
#

@stable wedge

[this] spawn {

  if isServer then {

    params ["_crate"];

    private _item = [
      "ACE_fieldDressing",
      "ACE_morphine",
      "ACE_epinephrine",
      "ACE_Earplugs",
      "ToolKit",
      "ACE_elasticBandage",
      "ACE_bloodIV_500",
      "ACE_microDAGR",
      "kka3_ace_extension_Land_BagFence_Long_F",
      "kka3_ace_extension_on_Land_BagFence_Round_F"
    ];

    _crate addItemCargoGlobal [_item select 0,50];
    _crate addItemCargoGlobal [_item select 1,20];
    _crate addItemCargoGlobal [_item select 2,20];
    _crate addItemCargoGlobal [_item select 3,5];
    _crate addItemCargoGlobal [_item select 4,2];
    _crate addItemCargoGlobal [_item select 5,50];
    _crate addItemCargoGlobal [_item select 6,15];
    _crate addItemCargoGlobal [_item select 7,3];
    _crate addItemCargoGlobal [_item select 8,10];
    _crate addItemCargoGlobal [_item select 9,10];

  };
};
stable wedge
#

Wow

#

Thanks, let me try this

#

Thank you!

fair drum
#

I wrote it so you can take out the spawn loop (starting with if isServer) and make it a separate file if you wished, then you can call it with [boxGoesHere] execVM "filepath.sqf"

stable wedge
#

Could you explain why this method works instead of how I had it?

fair drum
#

1.) If you just used addItemCargo, that is a local command. You would have needed to execute that on every machine in multiplayer. addItemCargoGlobal is global so you only need to run it on the server and all players will see the changes.

2.) addItemCargo and addItemCargoGlobal follows the syntax of box addItemCargoGlobal [item, count] where box is a SINGLE object (object), item is a SINGLE item (string), and count is a SINGLE value (number)... the way you had it, you were feeding a whole bunch of values to item and count which just does nothing

stable wedge
#

Ah

fair drum
#

Say you wanted all of them to be the same number of things... you could do

_arrayOfItems = ["item1","item2","item3"];
{box addItemCargoGlobal [_x,10]} forEach _arrayOfItems;
#

now you only have 1 line for the command that will run with every iteration of _arrayOfItems

stable wedge
#

Okay that's fairly straightforward

fair drum
#

and I completely forgot what my question was going to be when I opened this...

robust brook
#
private _crate = yourCrateObject //Change this in here for whatever (private or global) variable you had for the crate
private _itemsArray = [
  ["ACE_fieldDressing", 50],
  ["ACE_morphine", 20],
  ["ACE_epinephrine", 20],
  ["ACE_Earplugs", 20],
  ["ToolKit", 20],
  ["ACE_elasticBandage", 20],
  ["ACE_bloodIV_500", 20],
  ["ACE_microDAGR", 20],
  ["kka3_ace_extension_Land_BagFence_Long_F", 20],
  ["kka3_ace_extension_on_Land_BagFence_Round_F", 20]
];

{
  _x params ["_stringItem", "_itemCount"];
  _crate addItemCargoGlobal [_stringItem, _itemCount];
} forEach _itemsArray;
``` @stable wedge
stable wedge
#

and I completely forgot what my question was going to be when I opened this...
@fair drum Sorry friend

#

Thank you, let me test that

fair drum
#

hoooold up, never considered this... _x params ["_stringItem", "_itemCount"];

#

the more you learn...

robust brook
#

I love me some params 😄

stable wedge
#

That doesn't work for me CSS

#

Testing this in Editor, using init

robust brook
#

I was using debug...

fair drum
#

did you name your box and then place the box in the top line?

stable wedge
#

yes

#

Let me double check and use debug

robust brook
#

make sure to remove comments if you are trying with debug

fair drum
#

take out comment

stable wedge
#

yes

#

So my crate I will call _crateobj

#

as the variable name for its init

#

private _crate = _crateobj;

robust brook
#

Needs a global variable name not a private, if its placed in the editor

stable wedge
#

for the script

fair drum
#

use _crate = crateobj

stable wedge
#

I see

fair drum
#

do you understand the difference between global, local, and private variables?

stable wedge
#

like 5/10

#

global and private yes

#

local not so much

#

ok I named my crate _crateobj in the objects variable name

#

then run the scenario

#

in debug I run

`
_crate = _crateobj;
private _itemsArray = [
["ACE_fieldDressing", 50],
["ACE_morphine", 20],
["ACE_epinephrine", 20],
["ACE_Earplugs", 20],
["ToolKit", 20],
["ACE_elasticBandage", 20],
["ACE_bloodIV_500", 20],
["ACE_microDAGR", 20],
["kka3_ace_extension_Land_BagFence_Long_F", 20],
["kka3_ace_extension_on_Land_BagFence_Round_F", 20]
];

{
_x params ["_stringItem", "_itemCount"];
_crate addItemCargoGlobal [_stringItem, _itemCount];
} forEach _itemsArray;
`

#

Nothing in crate

fair drum
#

first line still wrong

#

private _crate = crateobj;

#

or _crate = crateobj;
but using private is more proper

stable wedge
#

my variable name for my object is _crateobj

fair drum
#

change it to crateobj

#

in both the script and the variable name

#

when naming things in the editor for variable name, use global. so without the "_"

robust brook
#
testingCrateObject = this; //Put this in the init box, or place "testingCrateObject" in the  variable name box

//This in debug
private _itemsArray = [
  ["ACE_fieldDressing", 50],
  ["ACE_morphine", 20],
  ["ACE_epinephrine", 20],
  ["ACE_Earplugs", 20],
  ["ToolKit", 20],
  ["ACE_elasticBandage", 20],
  ["ACE_bloodIV_500", 20],
  ["ACE_microDAGR", 20],
  ["kka3_ace_extension_Land_BagFence_Long_F", 20],
  ["kka3_ace_extension_on_Land_BagFence_Round_F", 20]
];

{
  _x params ["_stringItem", "_itemCount"];
  testingCrateObject addItemCargoGlobal [_stringItem, _itemCount];
} forEach _itemsArray;
``` @stable wedge
stable wedge
#

Ahhh

#

Thanks Hypoxic that worked

fair drum
#

now do you understand why

stable wedge
#

_ makes things not global

fair drum
#

yes, because local things can only be seen in the script that it was defined

stable wedge
#

Yea

#

which makes sense for an earlier script since its self contained

#

gotcha

fair drum
#

global seen by all scripts, local seen by its script, private seen by its scope

stable wedge
#

question now, with the method CSS has, is there a way to run that in an object's init without me having to use the debug?

fair drum
#

yes, look at the last thing he posted

stable wedge
#

Ideally, I can create item lists and then just chuck them into an objects init

#

That still requires debug exec

#

im saying without it

#

Like your method

#

I could attach that to a trigger maybe?

robust brook
#

You can put it an .sqf? lol

stable wedge
#

True

robust brook
#
private _privateVariable1 = ""; //This is a private variable
_privateVariable2 = ""; //This is also another way of defining a private variable

testingGlobalVariable = ""; //This is a global variable (accessible to either server or client which ever its defined on)

testingPublicVariable = ""; //To broadcast a publicVariable it must be global variable first - https://community.bistudio.com/wiki/publicVariable
publicVariable "testingPublicVariable"; //Variables broadcast with publicVariable during a mission will be available to JIP clients with the value they held at the time.

``` @stable wedge
stable wedge
#

then just have the object run the sqf?

fair drum
#
private _testingCrateObject = this;

if isServer then {

private _itemsArray = [
  ["ACE_fieldDressing", 50],
  ["ACE_morphine", 20],
  ["ACE_epinephrine", 20],
  ["ACE_Earplugs", 20],
  ["ToolKit", 20],
  ["ACE_elasticBandage", 20],
  ["ACE_bloodIV_500", 20],
  ["ACE_microDAGR", 20],
  ["kka3_ace_extension_Land_BagFence_Long_F", 20],
  ["kka3_ace_extension_on_Land_BagFence_Round_F", 20]
];

{
  _x params ["_stringItem", "_itemCount"];
  _testingCrateObject addItemCargoGlobal [_stringItem, _itemCount];
} forEach _itemsArray;

};
#

^ you can place in the init

#

without naming the object

stable wedge
#

okay so the isServer runs on a dedi or server host

fair drum
#

it runs on the server, and if you are single player, you are the server

stable wedge
#

right

robust brook
#

"IsServer", It will return true for both dedicated and player-hosted server.

fair drum
#

if you don't put that, say you have 20 players, this code will run 20 times and you'll have a crate with billions of stuff

stable wedge
#

whew

#

Thank you both so much

#

This will help a lot

#

And I have a couple of things to learn !

fair drum
#

especially the multiplayer one. it changes the coding game so you might as well learn it at the start

stable wedge
#

Yea

fair drum
#

nvm I see my error

pliant stream
#

is public variable ordering guaranteed?

robust brook
#

@pliant stream wdym "ordering"?

pliant stream
#

observed in the exact order in which they are sent

robust brook
#

I have no idea what you are trying to say @pliant stream

#

give me an example?

pliant stream
#

send two pv. does the other machine see them in that order? this isn't complicated

robust brook
#

can I see the public variables?

pliant stream
#

the variable or the value doesn't matter

robust brook
#

I don't understand what you mean by order of the variables lol

pliant stream
#

client A sets an event handler on PV X
client B sends value 0 in X
client B sends value 1 in X
does the EH on A always fire in order 0, 1?

winter rose
#

it should, I think, but … don't use PVEH?

pliant stream
#

it's the only message channel available to me in A2

winter rose
#

oh, A2.
Wait, isn't there a Function module with [params] call RE; for remote execution of some things?

pliant stream
#

i think there is something like that but i won't be using it. i already have my own high level RPC abstraction

#

even if i was doing A3 i would probably have to build the same on top of whatever new message channel is available

#

the A3 RE doesn't have any return values right?

fair drum
#

is there a way to check if it is daylight or not without using time of day?

robust brook
still forum
#

_privateVariable2 = ""; //This is also another way of defining a private variable
no thats a local variable, not a private one

#

@stable wedge

I've named the object _crateammo,
you can't give objects names with a local variable, object names can only be global variables.

#

is public variable ordering guaranteed?
afaik yes

#

to be pedantic what he's doing can't easily be modeled using foreach
it could, as was already shown above, which is why I deleted my message as I posted it before I saw that

tough abyss
#

is there such a thing as an unlimited fuel script for cars?

winter rose
#

yes, setFuel

warm hedge
#

There's no fuel consumption command multiplier command, though. I want it badly

winter rose
#

just damage your fuel tank and see the result 😛

unique sundial
#

There's no fuel consumption command multiplier command, though. I want it badly
@warm hedge what do you mean

winter rose
#
vehicle setFuelConsumptionRatio 3 // three time fuel consumption
vehicle setFuelConsumptionRatio 0 // UNLIMITED POWEEER
```I suppose?
unique sundial
#

ratio?

warm hedge
#

Yes, that's something I want

fair drum
#

trying to use Bis_fnc_liveFeed... for the target parameter, how can I get the location to where a gunner is looking?

winter rose
#

ratio

#

eyePos + eyeDirection I suppose

fair drum
#

does that work if its an AI using the gunner like on a UAV?

#

or does it have to be a hasInterface

winter rose
#

eyePos of a UAV is most likely not to work 😄

#

but maybe something to do with turret pointing, dunno

#

why not use the UAV camera?

fair drum
#

i want something squad leaders can view without having a UAV terminal while one player controls the UAV.

#

kind of like info from the air to the units on the ground type thing

#

my plan was to addAction for the squad leaders to have this feed created on the side of their screen

winter rose
warm hedge
#

Yes. I always feel vehicles (especially fixed/rotary wings) have big fuel tank than it should compared to the map size

cosmic lichen
#
vehicle setFuelConsumptionRatio 3 // three time fuel consumption
vehicle setFuelConsumptionRatio 0 // UNLIMITED POWEEER
```I suppose?

@winter rose That would be nice.

warm hedge
#

Kinda becoming offtopic though, I want to make it so CAS planes have to land and refuel more frequently and it feels more authentic-y than current almost infinitely flight

cosmic lichen
#

It has many use cases. Make a feedback tracker ticket

willow hound
#

You could store the fire on the unit using _unit setVariable ["SmallDino_fire", _fire]; inside fnCreateFire.
You would then be able to later retrieve the fire (to delete it) using _unit getVariable ["SmallDino_fire", objNull];.

pliant stream
#

it will break with JIP. it's (probably, not actually sure about A3) very complicated to do correctly

winter rose
#

make a function to be called and that will delete said objects after a condition is reached

#

with this way, all would stop after the same condition (if the condition is a global variable)
what do you want to do?

#

oh, I get it. you could make asqf unit setVariable ["SMOLDIN_onFire", true, true];
and locally, when the fire is put outsqf unit setVariable ["SMOLDIN_onFire", false, true];
the fire condition would besqf unit getVariable ["SMOLDIN_onFire", false];

pliant stream
#

it still won't work with JIP

#

maybe you don't care though

winter rose
#

well, you could make it JIP friendly
a script that check all units and create a fire if their onFire variable is on or off
and set damage only if unit is local

pliant stream
#

looping over all units is so pedestrian

winter rose
#

I am not sure with "#classname" classes

#

(anyway, particle commands are local)

#

(written by a guy who knows stuff)

thick chasm
#

With this script, how can I spawn a vehicle with a "varible name"?

AlphaCharlie = [getMarkerPos selectRandom ["MARK100", "MARK101", "MARK102", "MARK103", "MARK104", "MARK105", "MARK106", "MARK107", "MARK108", "MARK109", "MARK110", "MARK111", "MARK112"],
WEST, ["O_MBT_04_cannon_F"]] call BIS_fnc_spawnGroup;

winter rose
#

@thick chasm what do you mean ?

thick chasm
#

[position, side, toSpawn, relPositions, ranks, skillRange, ammoRange, randomControls, azimuth, precisePos, maxVehicles] call BIS_fnc_spawnGroup

pliant stream
#

that wiki page doesn't go into the MP synchronisation aspects

thick chasm
#

I want spawn a "O_MBT_04_cannon_F" with the variable name "tank1", for example

winter rose
#

that wiki page doesn't go into the MP synchronisation aspects
that page says it is local @pliant stream

#

the rest is up to the scripter, I suppose

pliant stream
#

right

thick chasm
#

In this propieties it is not especificate:
[position, side, toSpawn, relPositions, ranks, skillRange, ammoRange, randomControls, azimuth, precisePos, maxVehicles] call BIS_fnc_spawnGroup

pliant stream
#

makes sense that they wouldn't want to go into it. synchronisation is complicated and the game does nothing to help you

winter rose
thick chasm
#

lol

#

ok

spark turret
#

or do leader

winter rose
#

makes sense that they wouldn't want to go into it. synchronisation is complicated and the game does nothing to help you
"they" don't think it is the page's topic (and see page edition logs please ^^)

spark turret
#

arma isnt really complicated MP wise. you just remote exec the local stuff

open star
#

Or execute on initialization.

winter rose
#

arma isnt really complicated MP wise
now* ^^

spark turret
#

as in, it will be worse in the future?

open star
#

No it was

winter rose
#

no, but it was worse in the past 🙃

pliant stream
#

it's still worse for me in A2

spark turret
#

ah

#

just play arma 3 with cup

open star
#

Absolutely not.

spark turret
#

🤷‍♂️

winter rose
#

before remoteExec we had BIS_fnc_MP, before that it was A2 and RE (RemoteExecution)

open star
#

I only like CUP for its Core, buildings and what not. MAYBE some of the maps.

pliant stream
#

i wouldn't trust that BI RE thing even if it provided an adequate RPC API

winter rose
#

well, you can always do you r own stuff but then you have to write your own doc ^^

pliant stream
#

that's exactly what i've done

winter rose
proud carbon
#

is there a command that stops aircraft from showing up on radar systems?

winter rose
#

setCaptive perhaps

pliant stream
#

seems pointless if you can't return

winter rose
#

remoteExec cannot return either, we deal well with it 🤷‍♂️

still forum
#

remoteExec can return very easily.
at target just remoteExec the result back to remoteExecutedOwner

pliant stream
#

right, but then you're just using it as a low level building block for a higher level api

#

correctly implementing the rpc return is non-trivial. just calling remoteExec on the sender breaks as soon as you have two calls in flight at the same time

winter rose
#

There is a bis fnc that does that iirc

pliant stream
#

my rpc functions just return futures

queen cargo
#

Got remote promise System for sqf already as little framework 🤔🤔

pliant stream
#

mmh

#

i made my futures generic, not tied to any remote execution api

#

i use them for some local async operations as well

winter rose
#

that's noice

pliant stream
still forum
#

You can use remoteExec locally too 😄

winter rose
#

can't you create a localRemoteExec then 🤔 😄

still forum
#

wat

scenic mantle
#

hello

#

pc1 setVariable ["NotUse", false, true];
"The download will start in 3 seconds. Pick the drive after download finished" remoteExec ["hint",west];

sleep 3;
for "_i" from 1 to 100 do
{
sleep 2;
hintSilent format ["Download in progress : %1",_i];
};
"Download completed! Pick the thumbdrive from PC." remoteExec ["hint",west];
pc1 setVariable ["NotPicked", true, true];
pc1 addaction ["Pick Drive", { [] execVM "PickDrive.sqf"}, nil, 2, true, true, "", "_target getVariable ['NotPicked',true]"];

#

how i want everyone to see hint for countdown?

#

i tried something like this [["Download in progress : %1",_i],"hintSilent Format",true,false,false] call BIS_fnc_MP; but not working

winter rose
#

@scenic mantle ```sqf please 🙃

scenic mantle
#

sorry

winter rose
#

remoteExec is what you are looking for, not BIS_fnc_MP

#

you have an example with hint in your own code 🙃

scenic mantle
#

["Download in progress : %1",_i] remoteExec ["hintSilent format",west]; so like this?

winter rose
#
  • format, and you are good yes
#

[format ["%1", _i]]

still forum
#

"hintSilent format" is not a command name

#

its a string that contains two command names, that's invalid for remoteExec, you wanna use a single command, so remove the format from there

scenic mantle
#

[format["Download in progress : %1",_i]] remoteExec ["hintSilent",west]; like this?

winter rose
#
[format ["Download in progress : %1",_i]] remoteExec ["hintSilent", west];

// split
private _text = format ["Download in progress : %1",_i];
[_text] remoteExec ["hintSilent", west];
```@scenic mantle
scenic mantle
#

ouh. ok2. tq @winter rose !

vague geode
#

Is it possible to transmit audio from one in-game chat to another?

I want to increase the realism of in-game player radio communication a bit by autometically transmitting everything the players say in any channel into the local channel as well or at least make it hearable locally. Basically like the communication with NPCs: Yes, they do talk to you in the group chat (or for support requests what every channel you set as the support channel) but what they are saying over the radio can also be heard by everyone that is close enough to the speaking NPCs.

Is such a thing possible in any way?

thick chasm
#

what is _veh, _text or _offroad? what is -

still forum
#

@vague geode no, there is basically no control at all over voice chats from scripting

vague geode
#

Ok, thanks anyways.

young current
thick chasm
#

thx

timid niche
#

Is there an evh that checks when a player puts an object in a container/inv?

winter rose
#

Put

timid niche
#

ty

winter rose
stuck rivet
#

is there a script for unlimited rocket launcher ammo and no reload?

young current
#

not ready made but sure that could be done if one invests the time and effort

warm hedge
#

Fired EH and addWeaponItem I suppose? I think I've done it before

winter rose
#

setVehicleAmmoDef 😛

scenic mantle
#

is there a script for unlimited rocket launcher ammo and no reload?
@stuck rivet use eventhandler for fire?

stuck rivet
#

yeah ive been trying scripts i find with google, but none of them work with the disposable RHS rockets

#

like this one:
player addeventhandler ["fired", { params ["_unit", "_wep"]; _testIsRocket = getText (configFile >> "CfgWeapons" >> _wep >> "cursor"); if (_testIsRocket isEqualTo "missile") then { _rocketArry = getArray (configFile >> "CfgWeapons" >> _wep >> "magazines"); _rocket = (_rocketArry select 0); _unit addMagazine _rocket; reload _unit;//remove if unwanted }; }];

robust brook
#

@stuck rivetWhat/who fires the RHS rockets?

stuck rivet
#

i do

#

script is entered into debug console

thorn cape
#

Hi, everyone!

I need help, I use this code for choosing all available players:

private _players = allUnits select {isPlayer _x && side group _x == east}; private _unit = selectRandom _players;

How exclude from selectRandom player with variable name: Player1 and Player2?

robust brook
#
player addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];

  private _testIsRocket = getText (configFile >> "CfgWeapons" >> _weapon >> "cursor");
  hint format ["%1", _testIsRocket];
}];
``` @stuck rivet
#

tell me what the hint returns after you fire the rocket

digital hollow
#

@thorn cape allPlayers - [Player1, Player2]

thorn cape
#

@thorn cape allPlayers - [Player1, Player2]
@digital hollow and code will not select Player1, Player2, yes?

robust brook
#

Its removing player1 and player2 from _players

digital hollow
#

By removing them from the array before selectRandom, it becomes impossible to select them.

stuck rivet
#

it returns rocket

thorn cape
#

Its removing player1 and player2 from _players
@robust brook @digital hollow thank you!

robust brook
#

@stuck rivet What exactly do you want to happen once you launch the rocket?

stuck rivet
#

have another rocket ready to fire without having to swap out launcher

fair drum
#

if I do [player,["grenadier",2,-1]] call BIS_fnc_addRespawnInventory;, does this limit of 2 stack for every iteration of the code in initplayerlocal.sqf? cause last game, I had a limit of 1 sniper, yet every squad could have 1 sniper.

#

Reference:

Array - format [class, number, limit]
class: String - CfgRespawnInventory class
number: Number - Number of players who can use this inventory (-1 = no limit, default)
limit: Number - Limit for role assigned to given loadout (-1 = no limit, default)
Only role or only loadout can be limited at one moment, if there is limit for both, then only role uses limit.
If the limit definition for role is called multiple times with different numbers, then the highest number is used.
robust brook
#
player addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];

  private _rocketWeaponString = getText (configFile >> "CfgWeapons" >> _weapon >> "cursor");

  if (_rocketWeaponString isEqualTo "rocket") then {
    private _rocketAmmoTypesArray = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
    private _rocketAmmoString = (_rocketAmmoTypesArray select 0);

    hint format ["_rocketWeaponString: %1 \n _rocketAmmoTypesArray: %2 \n _rocketAmmoString: %3", _rocketWeaponString, _rocketAmmoTypesArray, _rocketAmmoString];
  };

}];
#

Try that and let me know if it works, if not let me know what the hint returns

stuck rivet
#

it returns the ammo type

#

tbh i don't think unlimited disposable rockets are possible because i think RHS turns the launcher into a (used) launcher and i don't think you can stop that with scripts, but thanks anyway i really appreciate the help freely given

winter rose
#

freely? 👀

young current
#

It might have been useful to know the RHS one shot launchers were in question

#

🙈

#

and yes they have special behaviour

#

best to use some other laucher

thorn cape
#

Is it possible force this code on server/local multiplayer game?
_mission = floor random 2 ; switch (_mission) do { case 0: { Player1 synchronizeObjectsAdd [task_module]; }; case 1: { Player2 synchronizeObjectsAdd [task_module]; }; };

real tartan
#

is there a way to get string from init field of object by SQF ? getter of setVehicleInit

fair drum
#

what is the cameraVieworcameraOn for UAV Terminal? How do I detect if a player entered a UAV terminal?

winter rose
#

cameraOn is the UAV

fair drum
#

i mean just in the terminal menus

winter rose
#

oh
you are still the player, it's "only" an overlay

fair drum
#

is there a way to detect if this overlay was opened?

winter rose
#

maybe by checking displays, because there seems to be no command for that

fair drum
#

i guess all I'm trying to do is remove UAVs that are placed in editor from the terminal of my players. I've tried so many ways so far and nothing has been fruitful

winter rose
#

what do you want to do, again?

fair drum
#

players are independent. i have a nato radar and nato sam that I have changed their group to independent side upon init. I want so that if my players spawn in as the UAV operator, they cannot see those UAVs in the terminal menu to select. so far I've tried using disableUAVConnectability and action "UAVTerminalReleaseConnection" to no success.

winter rose
#

about disableUAVConnectability,

This command has effect on a UAV terminal, not on whether a unit is able to connect to a UAV or not.

#
unit disableUAVConnectability [[uav1, uav2], true];
#

(local effect, so remoteExec it if needed)

fair drum
#

can't seem to get it working with remoteExec currently. I figured out a crude workaround though...

private _uavs = [uav1,uav2];
private _bob = (creategroup independent) createUnit ["ffp_m05w_rifleman_uav_op",getPosATL uav1,[],0,"NONE"];
_uavs joinSilent group _bob;
#

cause they are removed from the menu if they are in a group apparently

winter rose
#

hue hue hue weird workaround, but ok !

strange seal
#

is there a way to trigger something when the map closes? I have onMapSingleClick being used to set waypoints for units but I want to set it back to "" when the map closes, I haven't had any luck searching the wiki

hallow mortar
strange seal
#

I'll give it a shot, I'm new to scripting so it looks pretty daunting, thanks 🙂

ionic orchid
#

@strange seal I've used something like this in the past

[] spawn {
  waitUntil {!visibleMap};
  //code...
};
tough abyss
#

how would i go about implementing an article of clothing into my game as a mod? i wanted to import a model of a space suit for a mission im doing but idk what to do

fair drum
#

@tough abyss

quasi rover
#

Have you ever experienced or heard that pilot player is invincible after fighter jet ejection?
So the player is not dead by any enemy attack unless respawn by itself.
our players reported it and no idea how to solve it.

fair drum
#

you running ace?

quasi rover
#

no vanilla mode.

fair drum
#

so occasionally, a players plane will explode, go all the way to the ground, and they get out?

quasi rover
#

yes, right

#

eject the seat and land without time to parachute, but he stil survive and invincible.

#

vanilla mode but just some server side Mode like Sling, Rappelling.

fair drum
#

try taking off those mods and see if you can replicate it? or, make sure they also have the mod, not just the server

#

private _groups = [];
{
    if ((side _x == opfor) and (count units _x > 2)) then {
        _groups = _groups + [_x];
    };
} forEach allGroups; //Returns array of groups _groups = [group1,group2,group3,etc]

{
    private _group = _x;
    //if a {_x setDamage 1} forEach units _group is placed here, it goes through all groups
    waitUntil { ({alive _x} count units _group) < 2 }; //pass
    {
        _x setCaptive true; //pass
        _x action ["Surrender",_x]; //pass
        [_x] joinSilent grpNull; //pass
    } forEach units _group; //pass
} forEach _groups; //error: only applies to group index [0] in _groups

I'm hitting an issue where its only applying to 1 group (happens to be index[0] of the _groups array). Anyone see the problem?

fair drum
#

Is it possible force this code on server/local multiplayer game?
_mission = floor random 2 ; switch (_mission) do { case 0: { Player1 synchronizeObjectsAdd [task_module]; }; case 1: { Player2 synchronizeObjectsAdd [task_module]; }; };
@thorn cape

this isn't working for you? synchronizeObjectsAdd is a global command so you shouldn't have to remoteExec it. are you sure you are calling it right? and are your units named player1,player2,etc?

pliant stream
#

https://community.bistudio.com/wiki/removeMagazine

Note: You may create invalid combinations with this function. When doing so, application behaviour is undefined.
i hope they're just abusing the concept of undefined behaviour here right? i.e. it's not actually going to format the hard drive?

winter rose
#

it is going to ban you from this Discord

#

I suppose it is command application behaviour result that is undefined.

pliant stream
#

well reading this comment it just sounds like someone made the game crash with this command

winter rose
#

hopefully not, but perhaps, actually
also note that this remark may have been for a previous title and may or may not apply to A3

smoky rune
#

Could setParticleParams be used to overwrite only certain particle effect parameters (i need to increase particle lifetime only), not everything?

winter rose
#

nope, but you can store the settings array somewhere then only update one part with set

smoky rune
#

yeah, didn't even think about that, it is an array so i can increase parameter by index, thx

spark kiln
#

Alright so I am trying to make an elevator to go to the roof of a building using two flagpolls and this script line
this addAction ["Teleport", {player setPos (getPos blue1)}]

blue1 being the other poll. while I do teleport i do so at 0 height at the base of the building instead of up high, anyway to fix this?

strange seal
#

@ionic orchid just did a test and it looks like that worked perfectly! thank you very much!

queen cargo
#

can we get some binary operators in SQF?
like:

// bit-or
float larg, rarg;
return (float)((int)larg) | ((int)rarg);```
wonky ... but usable enough for people to find usecases
winter rose
#

there are BIS fnc bitflags, but… :-\

pliant stream
#

you only have 24 bits of mantissa in a 32 bit float... it's not great

queen cargo
#

could in theory be solved by adding a multi-type scalar 🤪
std::variant<int, float>

pliant stream
#

is that intercept library still a thing? there's your bit ops

ornate pasture
#

Hi guys, is there a way to spawn a group in CUP units in a script like this ?
_group1 = [getMarkerPos "spawn1", EAST, (configFile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call BIS_fnc_spawnGroup;

warm hedge
#

Just use CUP config, yes

ornate pasture
#

Like configFile >> "CUP config" ?

I don't know the right syntax

winter rose
#

you can check the config path in the Config Viewer

ornate pasture
#

forgot about that. Thank you ❤️

wheat geyser
#

Erm, am I mentally challanged or does this not work:
Setting up the displayEH "MouseMoving", rotating the current VectorDir/VectorUp of a camera by the angles given by the event (horz & vert) and yielding it back to the camera by "setVectorDirAndUp" should result in smooth camera movement. But why doesn't it, though?

winter rose
#

(one does not exclude the other)

wheat geyser
#

(my math is "correct" [well, obviously isn't], I've compared it to "BIS_fnc_transformVectorDirAndUp" in which Killzone_Kid makes very nicely use of the A3-matrixmult cmd and a mathematical trick)

#

What do you mean?

#

You just apply the Rotation Matrix given by the Horz (= yaw) Angle and the Matrix given by the Vertical (pitch) to both the current directional/Up vectors of the camera, don't you?

winter rose
#

am I mentally challenged or does this not work
both are possible at the same time 😬

but I don't know about mousemoving
the camera moves as expected, but does so in stutters?

wheat geyser
#

Yes, that's true

#

Nonono, "as expected" would be very far fetched here.

#

It actually begins to roll, I've no idea how to describe that

#

It certainly does not do what it's supposed to do

#

Instead I am using the second argument of the EH in place of the "GetDir"-Thing for that UAV (no "Roll"-ing applied)

wheat geyser
#

"BIS_fnc_setObjectRotation" works even less. That, however, is kinda trivial, the functions doesn't rotate the vectorUp by the yaw, as it should (?)

#

I can't be the first person wanting a free view camera, can I

tough abyss
#

Trying to play animations with switchmove and playmove, for some reason on the one that I need the gun keeps going back into the unit's hand even if i switch it off before

winter rose
#

@wheat geyser you can check how the Arsenal does it in the BIS fnc?

gilded rover
#

quick question , how would one check is unit x got into helicopter y?

winter rose
#

x in y

#

(quick question, quick response)

#

@gilded rover ↑

gilded rover
#

slightly longer question , translate that to code quick😅

winter rose
#
private _unit = x;
private _heli = y;
if (_unit in _heli) then
{
  hint "I iz in da choppah";
} else {
  hint "get to da choppah!!1!";
};
#

slightly longer answer ^^

gilded rover
#

^^

gilded rover
#

quick question number 2
!(hos getVariable "Enh_isHostage");
I have this in the condition of a trigger , but the trigger never fires regardless if the hostage is a hostage or not
any idea how to fix this?

wheat geyser
#

Currently checking out "BIS_fnc_camera". They do it very weirdly. It's not really """correct"""

#

Instead of manipulating the actual pitch of the camera, they allow only free camera movement while depressing the Right Mouse Button. As this event continuously returns the On-Screen Mouse Y Position, this is actually used instead of the actual Pitch Angle (meaning one of the Euler Angles)

#

They themselves were not using their own functions "bis_fnc_getPitchBank" and "bis_fnc_setpitchbank" (they use only the latter w/ the above trick)

winter rose
#

@gilded rover make sure it is the proper variable name 🙃

haughty stump
#

I'm currently trying to change the default Gau-8 ammo for the USAF A-10, Addmagazine doesn't seem to be working anyone got any ideas?

/this addmagazine ["UAS_Base_30x173_XM1170_1150Rnd",[1]]/
gilded rover
#

I'm currently trying to change the default Gau-8 ammo for the USAF A-10, Addmagazine doesn't seem to be working anyone got any ideas?

this addmagazine ["UAS_Base_30x173_XM1170_1150Rnd",[1]]

@haughty stump```
during the mission or a mod?

haughty stump
#

in the editor, it's going to be a respawning A-10 for liberation so i'd like it to respawn everytime with the selected ammo

winter rose
#

@haughty stump check the wiki page for addMagazine please

haughty stump
#

... I had an extra bracket

gilded rover
#

@gilded rover make sure it is the proper variable name 🙃
@winter rose got it working , i feel like noob

vague geode
#

How do Laser designators work? I am asking because whenever I spawn a laser target it disappears again after a second. Are there any way that I can prevent it from despawning until I want it to?

unique sundial
wheat geyser
#

@unique sundial Hey, you wrote the script "BIS_fnc_transformVectorDirAndUp". Do you know any reason that this Transformation doesn't work in conjunction with the arguments in the Display EH "MouseMoving"?

unique sundial
#

no idea there is example on biki or are you saying it doesn’t work anymore?

wheat geyser
#

No, the Transformation is code itself is fine, I'm asking about a free camera movement via "MouseMoving"

#

Even the official seem to the safe the pitch angle, using it for the later transformation. This, however, is IMO bad design, because if s/o was to constantly spin in one direction, the number could overflow, can't it?

fair drum
wheat geyser
#

camera setVectorDirAndUp ([[vectorDirVisual camera, vectorUpVisual camera], _alpha, _theta, 0] call BIS_fnc_transformVectorDirAndUp); should do the trick, doesn't it? (If "MouseMoving" returns [display, _alpha, _theta])

winter rose
#

@fair drum because it will wait for group 1 to surrender, then apply it to group 2, etc

#

spawn

fair drum
#

okay, so spawn the whole internal block? I'll try it

vague geode
#

@Killzone_Kid Thanks alot.

fair drum
#

thx lou

unique sundial
#

camera
no idea doesnt say anything this is just variable could be anything

#

If "MouseMoving" returns [display, _alpha, _theta]
Huh? MouseMoving doesnt return angles

wheat geyser
#

Hm? What does it return?

queen cargo
#

i kinda feel like i should start actual arma modding again

queen cargo
#

Don't just upvote @young current 😱 you need to tell me "no, sqf-vm and other tooling is your future." or "forget about that medic mod you are too lazy to write UI Code for"

young current
#

😝

jade abyss
#

"forget about that medic mod you are too lazy to write UI Code for"
and all the other projects you started and never finished 😄

queen cargo
#

That ain't true

#

Arma.Studio is not dead, sqf-vm still alive, xmedsys was done, the few other mods too

#

Just that most of those are not really known 😅😅

EG, XInsurgency

#

But really... Ui is just horrible to do, especially for what I plan to do... Maybe only some xmedsys relaunch... That at least was extremly simple 😅😂

unique sundial
#

UI got a lot of love recently

queen cargo
#

mhh? what kind of love?

#

i mean ... technically, i already have some UI cobbled together:
https://imgur.com/Gy1q5pU
but implementing the whole interaction stuff with it is ... meh

winter rose
#

how does one "rotate" a vector?
e.g [-1,-1,0] rot90 = [-1,1,0]?

#

it is for some kind of relative position.

wheat geyser
#

What do you mean.

exotic flax
wheat geyser
#

This is a special case for Planes (in 2D)

#

Switching the items and negating one of them

#

Cannot be applied for the general case, though

#

For general directions and angles you'd need to apply the known Rotation Matrix

winter rose
#

I will (hopefully) only need 2D rotation

wheat geyser
#

Only 90°?

winter rose
#

nope

#

so BIS_fnc_rotateVector2D it is! Thanks @exotic flax

tough abyss
winter rose
#

@tough abyss re-add the action to the put laptop, that's about it

tough abyss
#

thank you, how would I go around doing that?

winter rose
#

use the "Put" Event Handler to grab the newly placed laptop 🙂

#

"Take" EH to get the picked up one

tough abyss
winter rose
#

no, ideally don't put anything in the object's init - bad for MP, rarely good for anything

#

use the EH on your unit that should put the laptop, and if the _item corresponds to the laptop's class, add the action to the _container

tough abyss
#

How would I make it available for say every single unit in an MP game?

#

bear with me im new to scripting

winter rose
#

add it to player in init.sqf, surrounded by ```sqf
if (hasInterface) then
{
waitUntil { not isNull player };
player addEventHandler ["stuff", { /stuff/ }];
};

tough abyss
#

that means no one will be able to interact with it besides the person who put it down?

winter rose
#

this way, yes

tough abyss
#

Im fine with that

#

thank you 🙂

winter rose
#

unless you use addAction with remoteExec

tough abyss
#

execVM and remoteExec, are they the same or?

winter rose
#

nope, not at all.
execVM will simply "run a file script", where
remoteExec will broadcast a scripting command

#

e.g```sqf
[1, 2] execVM "myFunction.sqf";
// vs
["Hello there!"] remoteExec ["hint"];

#

(btw, have you heard of our lord and saviour the Wiki? 🙂)

tough abyss
#

I have yes, but I get headaches looking at documentation

#

PTSD from making discord bots 😛

winter rose
#

ah well, I can kinda get it 😄

#

but we try to make the wiki a nice and easy place! :<

tough abyss
#

Alright well thank you I'll take a look at this

#

figure it out myself

winter rose
#

np, the channel remains open for questions and assistance

tough abyss
#

I'll come back if i need help, I'll try not to bother too much though 😄

winter rose
#

I mean, the channel is here for that and we are not alone, plenty of peeps here :3

tough abyss
#

@winter rose sadly looks like the put event handler and take one are for taking/putting stuff into containers

winter rose
#

doesn't it trigger when you drop something 🤔

tough abyss
#

It does

exotic flax
#

Triggers when a unit puts an item in a container.
Although technically, when you drop something on the ground it will also be in a "container"

tough abyss
#

I just tested it

#

something wrong with my script then 😛

winter rose
#

hah 😛

tough abyss
#

ok wew I'm stupid

#

didn't realise _item meant class name

#

not variable name

winter rose
#

ah yep - String

tough abyss
#

How would I get a classname of an object?

#

Just Ctrl+C in the editor or?

#

@winter rose

winter rose
#

right-click → copy class to clipboard or something like this

#

in a sub-menu

astral tendon
#

Is createVehicleLocal limited? or can be limited? Im starting make a script that you have a 3D preview of a selected vehicle, is there a problem?

tough abyss
#

nevermind I think it just shows up under the actual item

winter rose
#

@astral tendon should be no limitation so far - you can also use createSimpleObject with a "local" parameter

astral tendon
#

Does pylon configuration works with vehicles created with createSimpleObject ?

winter rose
#

I don't believe so!

tough abyss
#

is this a valid way to compare?

if (_item=="Item_Laptop_Unfolded") then {
winter rose
#

yes

astral tendon
#

is this a valid way to compare?

if (_item=="Item_Laptop_Unfolded") then {

@tough abyss
if ( (typeOf _item)=="Item_Laptop_Unfolded") then {

winter rose
#

no

#

_item is a string already

#

@tough abyss, == is case insensitive too

astral tendon
#

oh, it is.

tough abyss
#

still doesn't work though

#

hmm

exotic flax
#

I prefer isKindOf

#

since it works with strings and objects

winter rose
#

(but looks up config)

exotic flax
#

true, it's slower

tough abyss
#
if (_item=="arifle_MX_SW_F") then {
   hint "test";
};
#

tried this

#

doesn't work with it either

winter rose
#

show the full EH test plz?

tough abyss
#
if (hasInterface) then
{
  waitUntil { not isNull player };
  player addEventHandler ["Put", { 
      if (_item=="arifle_MX_SW_F") then {
        hint "test";
      };
}];
};
#

i tried it outside the if statement

#

it works like that

#

maybe remove the _?

winter rose
#

you didn't use params

tough abyss
#

do I have to keep the params part in?

winter rose
#

of course, it is what defines the variables, from _this

tough abyss
#

oof, monkey mistake

#
if (hasInterface) then
{
  waitUntil { not isNull player };
  player addEventHandler ["Put", {
      params ["_unit", "_container", "_item"];
      if (item=="arifle_MX_SW_F") then {
        hint "test";
      };
}];
};
winter rose
#

ah well, the sooner you make the mistakes the less there are you can make! 😄

tough abyss
#

this better?

winter rose
#

```sqf
/* your code */
``` and it's perfect 😉

tough abyss
#

ah yeah use sqf with the formatting

winter rose
#

and indent that second-to-last line, come on! D:

tough abyss
#

vsc doesn't like indenting sqf for some reason

#

i didn't tell it its sqf

#

probably why 😛

#
if (hasInterface) then
{
  waitUntil { not isNull player };
  player addEventHandler ["Put", {
      params ["_unit", "_container", "_item"];
      hint "test1";
      if (_item=="arifle_MX_SW_F") then {
        hint "test2";
      };
  }];
};  

test1 gets triggered but not test2 for some reason hmm

#

@winter rose any ideas?

winter rose
#

did you drop an MX SW ?

tough abyss
#

yup, do attachments make a difference?

winter rose
#

should not
instead of "test1", try hinting _item - you will get the class you dropped

tough abyss
#

ah, with or without the quotes?

winter rose
#

without

#

otherwise you would only see "_item1" 😄

tough abyss
#

arifle_MX_SW_pointer_F

#

what's the difference?

astral tendon
#

I think is a premade weapon with attachments

winter rose
#

arifle_MX_SW_pointer_F
vs
arifle_MX_SW_F

yep

tough abyss
#

yeah alright, i'll try it with the laptop now 😛

winter rose
#

anyway, the laptop doesn't have attachments yeah!

tough abyss
#
if (_item=="Laptop_Unfolded") then {
        hint _item;
        [hackLaptop1,  
        "Upload Virus",  
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa",  
        "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",  
        "_this distance _target < 5",  
        "_caller distance _target < 5",  
        {_caller playmove "Acts_Accessing_Computer_in";sleep 2},  
        {_caller playmove "Acts_Accessing_Computer_Loop";parseText format["<br/><img size='2' image='\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa'/><br/><br/><t size='1.5'>\\\VIRUS UPLOAD///</t><br/><br/><t size='1.5' color='#FFFF00'>UPLOAD IN PROGRESS...</t><br/><t color='#FFFF00'></t><br/><br/><t size='1.25' color='#CCCCCC'>%1&#37; Complete</t><br/><br/>",round ((_this select 4) * 4.16),name (_this select 1)] remoteExec ["hintSilent"];playSound3D ["A3\Sounds_F\sfx\click.wav", hackLaptop1]},  
        {_caller switchmove "Acts_Accessing_Computer_Out_Short";parseText format["<br/><img size='2' image='\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa'/><br/><br/><t size='1.5'>\\\VIRUS UPLOAD///</t><br/><br/><t size='1.5' color='#00FF00'>UPLOAD SUCCESSFUL</t><br/><t color='#00FF00'></t><br/><br/><br/><br/>",name (_this select 1)] remoteExec ["hintSilent"]; sleep 2; "" remoteExec ["hintSilent"];

        _nearStreetLights=nearestObjects[hackLaptop1,["Lamps_base_F","PowerLines_base_F","PowerLines_Small_base_F"],500];
        {
        _x setHit["light_1_hitpoint",0.97];_x setHit["light_2_hitpoint",0.97];_x setHit["light_3_hitpoint",0.97];_x setHit["light_4_hitpoint",0.97];
        }forEach _nearStreetLights;

        },   
#
  {_caller switchmove "Acts_Accessing_Computer_Out_short";parseText format["<br/><img size='2' image='\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa'/><br/><br/><t size='1.5'>\\\VIRUS UPLOAD///</t><br/><br/><t size='1.5' color='#FF0000'>UPLOAD ABORTED</t><br/><t color='#FF0000'></t><br/><br/><br/><br/>",name (_this select 1)] remoteExec ["hintSilent"]},   
        [],   
        15,   
        10] call bis_fnc_holdActionAdd;
      };
#

anyways, i get through the if statement this time

#

the holdaction doesn't trigger though for some reason

#

the variable name is hackLaptop1

#

assigned in the editor

#

not sure if it stays after being picked up and dropped

#

it works if I do it by debug console, but not by the script for some reason

winter rose
#

it's not to hackLaptop1 you want to add the action, it's _container

#

hackLaptop1 doesn't exist the moment you pick it up

tough abyss
#

ahhh okay

#

let me try that

#

Ay, it works!

#

now one more thing, is it possible to make the event handler a one time thing? Once it detects the laptop being dropped once, it just stops checking for puts?

#

just to save some performance

winter rose
#

yes, add```sqf
_unit removeEventHandler ["Put", _thisEventHandler];

tough abyss
#

love you, no homo intended 😄

winter rose
#

(he can then only place it once)

tough abyss
#

Thank you so much for the help mate

#

hope I wasn't too annoying

winter rose
#

be sure that not at all!

tough abyss
#

@winter rose last thing i promise, is there a way to get a certain object that's part of the map from the editor?

#

i have 3den enhanced if that helps somehow

#

get it as in get its classname

winter rose
#

oh, then yes
go in the editor, play, aim at it, in the debug console:sqf typeOf cursorObject;