#arma3_scripting

1 messages Β· Page 634 of 1

idle jungle
#

oh so if i have vehicles in this area it will blow them up?

willow hound
#

thisList depends on what was set in the "Triggered by" parameter.

#

If you set it to "Activated by players" or something like that, there are only players in thisList.

idle jungle
#

ohhhh okay makes sense

exotic flax
#

if activation is set to "ANYPLAYER", it will only trigger on players

idle jungle
#

blufor being any blufor unit and players?

willow hound
#

BLUFOR includes all members of BLUFOR groups, players and AI alike. Not sure about vehicles with that one.

idle jungle
#

no thats great to know thank you

willow hound
#

You can modify Grezvany13's code with if (isPlayer _x) then {..., then you can have it kill players only regardless of activation.

spark turret
#

it will trigger for everyone it is set to trigger for. so it its activated by any opfor, itll kill any opfor etc

exotic flax
#

the trigger will activate for everyone, true, but when using thisList it will only go through the objects in the trigger area

serene quiver
#

Howdy there....
I have problems with waitUntil and isTouchingGround...
situation: I have a group, which has been given scuba gear to infil AO...with a SDV. inventory was saved with
{[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_saveInventory;}forEach Units player;
what I'm looking for is that the team get the inventory back with
{[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_loadInventory;}forEach Units player; but I want it to happen once they reach the shore.
I tried with:
waitUntil {isTouchingGround player}; if (isTouchingGround player) then { {[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_loadInventory;}forEach Units player; };
and with
player addEventHandler ["GetOutMan", { waitUntil {isTouchingGround player}; if (isPlayer player) then { {[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_loadInventory;}forEach Units player; }; player removeEventHandler ["GetOutMan", _thisEventHandler]; }];
No joy..and I'm getting lost here...any ideas?

little raptor
#

what do you mean no joy?

#

what happens?

serene quiver
#

Unless water is considered ground by isTouchingGroundπŸ˜‚

queen cargo
#

```sqf
code
```

serene quiver
little raptor
#

see the pinned messages

queen cargo
#

To Format your code proper
Single ` is pretty much for "snippets"
Triple for blocks

queen cargo
#

No hard feeling, just noting it as your code gets much more readable then πŸ˜‰πŸ˜‰

serene quiver
# little raptor what do you mean no joy?

Not working... the best result I had was with ``` waitUntil {isTouchingGround player};

if (isTouchingGround player) then {

[player, [missionNamespace, "inventory_var1"]] call BIS_fnc_LoadInventory;
}; ``` but as soon as I get out of the SDV inventory is given back..

little raptor
#

you can try it it a more advanced way:

#
waitUntil {isTouchingGround player && {
  terrainIntersectASL [getPosASL player, getPosASL player vectorDiff [0,0,0.1]]
}}; 
#

also this is what X39 meant

#

as you can see my code has "colors"

serene quiver
little raptor
#

also your second condition is redundant

serene quiver
#

I try with ``` my script

little raptor
#

you should put sqf

#

in front of the three `

serene quiver
#

no wonder..lol

little raptor
#

try editing your old code

serene quiver
little raptor
#

no put it IMMEDIATELY after the three `

#

no space, no nothing

#

not even a next line

robust hollow
#

```sqf
code
```

serene quiver
#
waitUntil {isTouchingGround player}; 
 
if (isTouchingGround player) then { 
 
  [player, [missionNamespace, "inventory_var1"]] call BIS_fnc_LoadInventory; 
};```
serene quiver
little raptor
#
waitUntil {isTouchingGround player && {
  terrainIntersectASL [getPosASL player, getPosASL player vectorDiff [0,0,0.1]]
}}; 
[player, [missionNamespace, "inventory_var1"]] call BIS_fnc_LoadInventory; 
#

that's it

#

no need for if ... then {}

serene quiver
#

I see...

#

told ya..noob in the house!

little raptor
#

and if you want to check it for a group of units:

waitUntil {
  units player findIf {
    !(isTouchingGround _x && {
      terrainIntersectASL [getPosASL _x, getPosASL _x vectorDiff [0,0,0.1]]
    })
  } == -1
}; 

checks it for the player's group

serene quiver
#

I do...thanks

little raptor
#

fixed

serene quiver
#

OK..so it should go like this:

waitUntil { 
  units player findIf { 
    !(isTouchingGround _x && { 
      terrainIntersectASL [getPosASL _x, getPosASL _x vectorDiff [0,0,0.1]] 
    }) 
  } == -1 
}; {[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_loadInventory;}forEach Units player;```
little raptor
#

yep

#

I'm not sure about BIS_fnc_loadInventory because I've never used it

serene quiver
#

let me test it..sitrep asap..

little raptor
#

altho I should mention that a problem with that code is that no one gets their inventory back unless they all make it to the shore!

#

so you can try running the code separately for each unit

serene quiver
little raptor
#

example:

{
  _x spawn {
      waitUntil {isTouchingGround _this && {
        terrainIntersectASL [getPosASL _this , getPosASL _this vectorDiff [0,0,0.1]]
      }
    };
    //give inventory back
  }
} forEach units player;
#

@serene quiver you don't need to use a function for something so trivial

#
//save inventory
{
  _x setVariable ["SavedInventory", getUnitLoadout _x];
} forEach _units;
//get inv
{
  _x setUnitLoadout (_x getVariable ["SavedInventory", []]);
} forEach _units;
serene quiver
#

so "forEach _units" is intended the units in player group,right?

little raptor
#

yeah

#

or units player

#

it's just an array of units

serene quiver
#

let see if I got this right......

//save inventory
{
  _x setVariable ["SavedInventory", getUnitLoadout _x];
} forEach unit player;
{
  _x spawn {
      waitUntil {isTouchingGround _this && {
        terrainIntersectASL [getPosASL _this , getPosASL _this vectorDiff [0,0,0.1]]
      }
    };
//get inv
{
  _x setUnitLoadout (_x getVariable ["SavedInventory", []]);
} forEach unit player;```
little raptor
#

No

serene quiver
#

πŸ’©

little raptor
#

You should've put the get inventory part inside the spawn

#

Also you should remember that it runs for 1 unit

#

So you should use:

  _this setUnitLoadout (_this getVariable ["SavedInventory", []]);
serene quiver
little raptor
#

That's because each spawn runs for one unit now

#

Not the save part

#

The get part

#

Look at the code I posted

#

It's the get part

tough abyss
#

scripting is hard lmfao

little raptor
#

And if you don't understand any part of it, feel free to ask

serene quiver
serene quiver
little raptor
#
{
  _x spawn {
      waitUntil {isTouchingGround _this && {
        terrainIntersectASL [getPosASL _this , getPosASL _this vectorDiff [0,0,0.1]]
      }
    };

  _this setUnitLoadout (_this getVariable ["SavedInventory", []]);

};
} forEach units player
#

I hope I got it right

#

Cuz I'm typing on my phone now

serene quiver
#

so that part goes where in the above script?

little raptor
#

Look at the above code

#

Obviously after waitUntil

#

spawn is asynchronous

serene quiver
#

I meant in MY script..hahah

little raptor
#

It is your script

#

Minus the save part

serene quiver
little raptor
#

You're still using the bis fnc

#

For save inventory

#

Ditch that

#

Use what I said

serene quiver
little raptor
#

not unit player

#

Units player

#

The rest seems good

#

Also too many forEach

#

Put all those codes in one forEach

serene quiver
serene quiver
little raptor
#

{
//Add item 1
//Add item 2
// Etc
} forEach units player

#

And not just items

serene quiver
little raptor
#

Your whole code is just one forEach essentially

#

There are some parts that may need adjusting

serene quiver
little raptor
#

It's more of a performance issue

#

You run the loop like 20 30 times

#

sqf loops are SLOW

#

Try to get the job done in as few loops as possible

exotic flax
#

or make small loops, and call external scripts only when needed

serene quiver
# little raptor It's more of a performance issue

ok..so for example..something like this?

{removeAllWeapons _x;
removeAllItems _x;
removeAllAssignedItems _x;
removeUniform _x;
removeVest _x;
removeBackpack _x;
removeHeadgear _x;
removeGoggles _x} forEach Units player; ```
little raptor
#

It's faster if you empty the player's inventory by hand

#

Then use getUnitLoadout in debug console

#

Then copy the result and use it with setUnitLoadout

exotic flax
#
// remove everything
player setUnitLoadout (configFile >> "EmptyLoadout");
little raptor
#

That's a thing?

exotic flax
#

yup

#

it will just give you a "naked" guy

#

I use it in my framework which needs to set a loadout from a database, so to be 100% sure that the player does not have anything he shouldn't (in case DB data is corrupt or something) I first run that line to remove everything, before using setUnitLoadout with his personal loadout

serene quiver
exotic flax
#

yup

serene quiver
#

πŸ₯³ lol..finally getting something right at the first try...thank you..
so I guess reversing to give units a new loadout, right?

exotic flax
#

but you can improve your script a lot by only using set/getUnitLoadout, especially if you have a fixed loadout you want to set

serene quiver
#

Actually, the group has the inventory saved, then will get a fix inventory set, and then they'll get theyr stuff back..

serene quiver
exotic flax
#

looking at the script in sqfbin there is so much going wrong...

#

The cinema border is something that has to run locally for each player, and than the script is running the same scripts for all players.
Meaning that it will execute amount players x amount players...

#

like; when is this called? in a trigger, in an init script?

serene quiver
#

It's SP mission..called by an addAction
Player walk to an object, get the action and is teleported in the SDV with scubagear..

exotic flax
#
_divingKit = []; // UnitLoadout Array

[0, 0] spawn BIS_fnc_cinemaBorder;
sleep 1;
titleText ["", "BLACK FADED"];

{
    // store loadout locally to unit
    _x setVariable ["SavedInventory", getUnitLoadout _x, true];
    // remove everything
    _x setUnitLoadout (configFile >> "EmptyLoadout");
    // add diving kit
    _x setUnitLoadout _divingKit;
    // if group leader
    if (leader group _x == leader _x) then {
        _x addWeapon "Laserdesignator_03";
        _x moveInCommander SDVinfil; 
    } else {
        _x moveInAny SDVinfil;
    };
    cutText ["", "BLACK IN", 3, true];
    [1, 1] spawn BIS_fnc_cinemaBorder;

    [_x] spawn {
        params ["_unit"];
        waitUntil {
            isTouchingGround _unit
            && {
            terrainIntersectASL [getPosASL _unit, getPosASL _unit vectorDiff [0,0,0.1]]
            }
        };
        _unit setUnitLoadout (_unit getVariable ["SavedInventory", []]);
    };
} forEach units player;

All you need is to create the diving kit in the Arsenal, export it, and put it in the first line πŸ˜‰

serene quiver
#

πŸ‘€ WOW...awesome man..I'm gonna test it right now....thank you.

exotic flax
#

not tested of course πŸ˜‰ but should do the trick

serene quiver
serene quiver
exotic flax
#

true... I'm used to the ACE arsenal

#

if you're in the editor, make a unit with the prefered loadout, load that mission (as that unit) and put in the debug console copyToClipboard getUnitLoadout player
You will now have the correct data which you can simply paste with CTRL+V in the script

serene quiver
#

"copyToClipboard getUnitLoadout player" trow an error in the debug console:generic erron in expression...

crude needle
#

getUnitLoadout does not return a string.
Should be:
copyToClipboard str (getUnitLoadout Player);

serene quiver
#

Should be this, right?
["CUP_smg_MP5SD6","","","optic_Holosight_smg_blk_F",["CUP_30Rnd_9x19_MP5",30],[],""],[],["CUP_hgun_Mk23","CUP_muzzle_snds_mk23","CUP_acc_mk23_lam_f","",["CUP_12Rnd_45ACP_mk23",12],[],""],["U_B_Wetsuit",[["FirstAidKit",1],["SmokeShellBlue",2,1],["CUP_30Rnd_9x19_MP5",4,30],["CUP_12Rnd_45ACP_mk23",1,12]]],["V_RebreatherB",[]],["B_Assault_Diver",[["CUP_30Rnd_9x19_MP5",5,30],["SatchelCharge_Remote_Mag",1,1],[["Rangefinder","","","",[],[],""],1]]],"","G_B_Diving",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch",""]

serene quiver
exotic flax
#

an no script errors, or anything in your log files?

serene quiver
#

no error report...

exotic flax
#

and define "nothing"
you select the addAction, you get the cinema border and then nothing happens... what are you expecting at that point?

btw... you could move these 2 lines to the end of the file (so below the forEach)

cutText ["", "BLACK IN", 3, true];
[1, 1] spawn BIS_fnc_cinemaBorder;
serene quiver
exotic flax
#

and the vehicle has the correct variable name? SDVinfil

serene quiver
#

yap

exotic flax
#

it's a bit hard to build complex scripts without testing them

#

and the script I provided should give you enough to keep changing stuff till it works

#

dumping some stuff in chat or the log files (diag_log str <some_data>;) could help

serene quiver
#
_divingKit = [ MyLoadOutHere];   
  
[0, 0] spawn BIS_fnc_cinemaBorder;  
sleep 1; 
titleText ["", "BLACK FADED"];  
  
{  _x setVariable ["SavedInventory", getUnitLoadout _x, true];  
   _x setUnitLoadout (configFile >> "EmptyLoadout");  
   _x setUnitLoadout _divingKit;  
   _x moveInAny SDVinfil;   

   [_x] spawn {  
        params ["_unit"];  
        waitUntil {  
            isTouchingGround _unit  
            && {  
            terrainIntersectASL [getPosASL _unit, getPosASL _unit vectorDiff [0,0,0.1]]  
            }  
        };  
        _unit setUnitLoadout (_unit getVariable ["SavedInventory", []]);  
    };  
} forEach units player;  
cutText ["", "BLACK IN", 3, true];  
[1, 1] spawn BIS_fnc_cinemaBorder;```
#

πŸ₯³

rain idol
#

Hello, I am pretty new to the game, what is scripting and what does it do?

exotic flax
rain idol
#

Thanks

cosmic lichen
#
10:03:32 Bad conversion: bool
10:03:32  βž₯ Context:     [] L1 ()

What could be causing this? I checked the script but I am not converting any variable of type bool in a (at least to me, forbidden manner)

#

Only thing I do is something like systemChat format ["%1",true]; which doesn't seem to cause the rpt message

vestal radish
#

Is there anyway to change how someone sits in a seat of a vehicle? I have a back seat in a jeep you can look out of the sides of the vehicle to shoot but I was wondering if there was a way to make it to where instead of sitting they stand up in the back is that possible to do?

little raptor
#

@cosmic lichen can you post your code?
also are you sure it is from your code?
I'd seen this error before but I don't recall what it was about

cosmic lichen
#
10:35:01 Bad conversion: bool
10:35:01  βž₯ Context:     [] L1 ()
    [] L1680 (3denEnhanced\functions\GUI\variableViewer\fn_variableViewer_onLoad.sqf [ENH_fnc_variableViewer_onLoad])
 <-     [] L1 ()
little raptor
vestal radish
#

Im not smart enough to make a new vehicle im just barely learning how to do scripting

#

how does the animation part work

little raptor
#

just use switchMove

#

but it will probably not work

vestal radish
#

so add switch move to the seat I want and it should out them in that animation?

little raptor
#

@cosmic lichen the only two places I suspect it might be happening:

"ENH_VariableViewer_AllLocationTypes pushBack configName _x" configClasses (configFile >> "CfgLocationTypes");

and

_display displayAddEventHandler ["keyDown",//Focus Search
{
  params ["_display", "_key", "_shift", "_ctrl"];
  if (_key isEqualTo 33 && _ctrl) then
  {
    ctrlSetFocus (_display displayCtrl 2000);
  }
}];
#

most probably configClasses

cosmic lichen
#

The second code I used in other scripts as well and they are fine.

#

ohhh

#

The first one it is

#

configClasses expects bool as condition

little raptor
#

change it to:

"-1 == ENH_VariableViewer_AllLocationTypes pushBack configName _x" configClasses (configFile >> "CfgLocationTypes");
#

exactly

#

you're providing a number

cosmic lichen
#

Yeah, I've never done this before and I can't seem to find a reason why I did it there. It was probably very late at night πŸ˜„

#

Thanks for the help πŸ™‚

little raptor
#

no problem!

little raptor
#

not "seats"

#

for example:

unit switchMove "AmovPercMstpSrasWrflDnon"
#

this will put them in standing up animation

vestal radish
#

Do I have to execute that everytime someone gets in then?

little raptor
#

yes, use an eventHandler

little raptor
#

but first test it on a unit in your vehicle to make sure it works

#

Like I said the chance is pretty slim

tough abyss
little raptor
#

Good to know!
Because playMove kicks the unit out (or maybe they just exist themselves). I wasn't sure about switchMove

tough abyss
little raptor
#

@vestal radish so good news for you! it works

#

What's the difference between camPrepare... and camSet... commands?

vestal radish
#

Sorry got busy experementing so what line of code did you use because im having issues figuing this out

little raptor
#

I didn't use anything I'm just saying that based on Wipeout's image

vestal radish
#

ooooooo misread

winter rose
#

See Camera's tutorial @little raptor (I believe I wrote an explanation there, but maybe not)

#

Prepare* version preloads assets near the camera's future POV

little raptor
#

@vestal radish
and it's really simple to do:
put this in your vehicle's init box:

this addEventHandler ["GetIn", {
  params ["_vehicle", "_role", "_unit", "_turret"];
  if (_role != "driver") then {
    _unit switchMove "AmovPercMstpSrasWrflDnon"
  }
}];
#

you may have to do more work here, but it should give you some hint as to how this works

vestal radish
#

thank you

carmine tartan
#

Hey, I’m trying to creat a trigger that counts the amount of players in side it (dosen’t matter if you this team or that team). Then I would like to put the number into a gui. Can’t get my mind how to do it though? Any idΓ©s?

little raptor
#

@carmine tartan You'd need a loop that counts list _trigger

#

if trigger is set to activate by players

#

otherwise you'd need to filter it as well:

{isPlayer _x} count list _trigger
carmine tartan
#

Okey, will play around with it for a bit cheers

proper sail
#

One more thing; would something simple like

"[123,321]"```
Suffice as bypassing the array networking stuff?
still forum
still forum
#

Sorry I read the backlog first

little raptor
#

line?!

still forum
#

Nice to see that the context stuff helped :3

#

"line?!"
Context says L1680

proper sail
#

Understood

little raptor
still forum
#

That's
[dunno what was here] L Line number (script file path)

#

so the empty one just.. doesn't have path nor whatever is at the start there that i forgot what it is

#

like compile "hint bla" doesn't have a file path, and thus cannot show it

#

in this case, that's the code that configClasses compiled, the condition has no path

cosmic lichen
still forum
#

The context told you the problem is in L1680

#

so I meant to look at that line and see what it does

#

which will be that configClasses that you posted

cosmic lichen
#

Well, this line isn't really useful in this case since I have a macro file included which counts to the lines unfortunately

#

But the problem was solved anyway πŸ™‚

still forum
#

You can fix that macro bug

#

do includes before block comments

cosmic lichen
#

oh really ? πŸ˜„

still forum
#

somehow block comment after include breaks it

#

We fixed it in ACE/CBA by just moving the #include everywhere

#

I can now fix the preprocessor I guess, but didn't get to it yet

cosmic lichen
#

Let me test that.

#

including before comment block didn't work for me

#
#include "\3denEnhanced\defineCommon.hpp"

/*
  Author: R3vo

  Date: 2019-08-30

  Description:
  Draws the mod icon next to the Eden entity.
  Parameter(s):
  -

  Returns:
  BOOLEAN: true / false
*/

Like this you ment right?

still forum
#

ye

cosmic lichen
#

Still says line 16XX

still forum
#

any left includes after the block comment?

cosmic lichen
#

nope

still forum
#

that fix works in ACE/CBA definitely

cosmic lichen
#

wait let me check something

#

nope, doesn't work for me πŸ€·β€β™€οΈ

still forum
#

Well it will give you the correct line number, when it works πŸ˜„

severe vapor
#

I am working on creating a weapons free zone for my players to gather in. I set up a trigger that can loop through the players in the trigger and remove their weapons. I also created another trigger that stores and returns their loadout when leaving.

The problem I am having though is that triggers don't activate each time a player enters the area. I thought the simple solution was to just loop while the trigger was active to remove all weapons from all players ever second or so. removeAllWeapons seems to play a small noise when it executes. I don't want that noise playing once a second during briefing. Does anyone have a suggestions on a good way to have something execute just once when entering an area?

for reference this is what I was using in the onActivation on the trigger.

_safezone = {
  params ["_thisTrigger", "_thisList"];
  while {triggerActivated _thisTrigger} do {
    {
       _x setVariable ["Oasis_activated", true];
       removeAllWeapons _x;
    } foreach _thisList;
    sleep 1;
  }
}


[thisTrigger, thisList] spawn _safezone;
little raptor
#

@severe vapor

_safezone = {
  params ["_thisTrigger", "_thisList"];
  _oldList = [];
  while {triggerActivated _thisTrigger} do {
    _newList = _thisList - _oldList;
    {
       _x setVariable ["Oasis_activated", true];
       removeAllWeapons _x;
    } foreach _newList;
    _oldList append _newList;
    sleep 1;
  }
}
severe vapor
#

Clever! thank you! πŸ™‚

#

That worked perfectly!

spark turret
#

that will only work once tho. so if a player leaves oasis, rearms and comes back, he wont be disarmed afai can tell

#

i assume that the removeAllWeapons _x plays the sound (why ever that might be, kinda senseless) so you could just check if the player has a weapon, only then remove it.
will allow constant check for weapons, with only noise at detected weapon

exotic flax
#

That should work every time someone enters the trigger area, since the script will be called again.
Problem might be that the weapons will also be removed from all players who were in the trigger and moved out, because the trigger is still active πŸ€”

spark turret
#

is thisList passed as a reference or value?

#

if its a reference, a leaving player isnt in thisList anymore, therefor safe.
if its passed as a value, then he ll always be in _thisList

serene quiver
#

Hello...question: is "lasertarget player" from a handheld designator "viewed" differently by the game than the ones from any vehicle? What I meant is a script "recognize" the had-held one, but not the other (from a vehicle)...

little raptor
#

I don't think so
They both create the same laser target object

#

both are of "LaserTargetW" type (the "W" part depends on side)

little raptor
#

if you try:

thisList pushBack player;

you'll get an error

#

it's a reserved variable

spark turret
#

good to know πŸ‘ one day ill learn how to do one or the other without guessing

serene quiver
spark turret
#

LaserTargetW is likely the class name and not a global variable you can call

little raptor
#

It's the classname of the laser target object

spark turret
#

have you tried using

hint str laserTarget player;

in singleplayer to see if it works at all?

#

ah you want to create one, alright

spark turret
little raptor
#

Your question is very vague. I have no idea what you want to do with it even if you knew where the laser comes from

past tiger
#

There is a way to make one player rate -2000 to a second player and 10000 to a third player?

little raptor
#

what do you mean?

past tiger
#

May be a local effect setRate command.

little raptor
#

that makes no sense

#

rating is global

#

plus why would you even want a "local" rating?

serene quiver
# little raptor Your question is very vague. I have no idea what you want to do with it even if ...

Basically, on a SP mission, a little script https://sqfbin.com/uqenofovigakotiwoyed connect an AI manned VLS, thus allowing the player to call an airstrike on a lasertarget object. It works very well with a handheld laser, but in a vehicle it's not reading the laser and throw an error:
`18:54:40 Error in expression <;

if (isNull _laser) then
{
_nearObj = nearestObjects ["Car","Tank","Man","Buil>
18:54:40 Error position: <nearestObjects ["Car","Tank","Man","Buil>
18:54:40 Error Type String, expected Bool`

little raptor
#

@serene quiver
your code is wrong

#

it has nothing to do with vehicle vs handheld laser target

#

the error is clearly telling you that

#

look at nearestObjects syntax again. you'll see it yourself

serene quiver
#

You meant this part,right?

_target = objNull;

if (isNull _laser) then
    {
    _nearObj = nearestObjects ["Car","Tank","Man","Building"];

    if(count _nearObj == 0) then
    {
        strikeAllowed = false;
        hint "Strike not allowed...USE LASER DESIGNATOR";
    }
    else
    {
        strikeAllowed = true;
        //Selecting random target
        _target = selectRandom _nearObj;
        
        playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
    };
}
little raptor
#

yes

serene quiver
#

I'm sorry, I'm so bad at this that I don't know what's wrong. What I know is that with a handheld laser it work, with a vehicle it does not.Seriuously...I'm clueless..hehehehe

little raptor
serene quiver
#

Still no clue....

little raptor
serene quiver
#

the only thing missing that I see,compared with the wiki example is the radius..and maybe the 2D/3D optional boolean..

little raptor
#

are you sure that's all that's missing?!

serene quiver
#

Obviously there's something else..but I cannot see it

little raptor
#

yours

_nearObj = nearestObjects ["Car","Tank","Man","Building"];

wiki

nearestObjects [player, ["Car", "Tank"], 200];
#
nearestObjects [position, types, radius] 
serene quiver
little raptor
#

nearest objects needs an array of params:

#

1st elemnt: pos

#

2nd element: array of types

#

3rd element: radius

serene quiver
#
_nearObj = nearestObjects [player["Car","Tank","Man","Building"];200];```
#

hahahahahahahahahahahahahaha

little raptor
#

this is an array, for reference:

#
[element1, element2, element3]
#

separated by ,

serene quiver
#

did that part of code like that?["Car","Tank","Man","Building"];

little raptor
#

that's an array

#

we're talking about nested arrays here

#

look at this again:

serene quiver
#

"nested"?....

little raptor
#
nearestObjects [player, ["Car", "Tank"], 200];
little raptor
serene quiver
#

damn it...forgot the comma!!

β—‹6β—‹6`sqf

little raptor
serene quiver
#
_nearObj = nearestObjects [player,["Car","Tank","Man","Building"];200];```
little raptor
#

you also put ;

serene quiver
#
_nearObj = nearestObjects [player,["Car","Tank","Man","Building"],200];```
little raptor
#

yeah

#

the position is up to you

#

it doesn't have to be player

serene quiver
little raptor
#

I don't know

#

whatever pos you want to search in

serene quiver
#

lasertarget player (or vehicle πŸ˜† )

little raptor
#

so put that

serene quiver
#
_nearObj = nearestObjects [lasertarget player,["Car","Tank","Man","Building"],200];```
little raptor
#

laserTarget can be objNull

serene quiver
#

???
so..tell me already...hahahaha

little raptor
#

objNull is non existing object

#

do you see a problem with that?

serene quiver
#

obviously

#

what would you use then?

little raptor
#

🀷
it's up to you. I don't know what you're trying to do

serene quiver
#

get the VSL to lock on the laser of the player and launch the missile.

little raptor
#

so why do you use nearestObjects at all?!

serene quiver
#

Don't know...Is an old script I "frankenstein-ed" ...

#

don't even remeber where it come from...

#

I tried to make it work with laser to hook the VLS ..

little raptor
#

what's VSL again?!

serene quiver
#

VERTICAL LAUNCH SYSTEM; it needs a connection with a laser sensor to fire.It cannot be fire by AI on its own. It needs this part to fire:

TARGET = laserTarget player;
west reportRemoteTarget [TARGET, 3600];  
TARGET confirmSensorTarget [west, true];  
0 = VLS fireAtTarget [TARGET, "weapon_vls_01"];```
little raptor
#

so?

#

why nearestObjects?

#

are you trying to make it see sth?

serene quiver
#

I'm trying to have him locking on my laser when I call the stryke with a radio trigger...

little raptor
#

So use laserTarget

#

You don't need nearestObjects

#

When laserTarget is null, the user is not using the laser designator

#

So you have nothing to fire at

serene quiver
#

Ok.....let's see if got this right....

little raptor
#

There was no need for a global variable "strikeAllowed"

#

Just exit there

#

If (isNull _laser) exitWith {hint "use laser designator"}

serene quiver
little raptor
#

😭

#

Just exit. No else

#

And no need for strikeAllowed

#

At all

serene quiver
little raptor
#

exitWith has no else

serene quiver
#

didn't know that..

little raptor
#

Put that code in else after exitWith

#

Not in it

#

After it

#

Plus there's one more strikeAllowed left

serene quiver
little raptor
#

You removed your playsound

#

And you must end your line with ;

#

And there's an unmatched } at the end

serene quiver
#

I tested the last version..it fire but if the laser is from a vehicle (try with a drone) it say "need laser designator"..

obtuse quiver
#

How do i place activated demolition blocks and satchel charges in the editor?

finite sail
#

you dont

#

but you can setdamage 1 to them to make them go off

obtuse quiver
#

i know a script to make vbieds and stuff like that, but in this mission i need a disarmable bomb that won't go off

finite sail
#

you want to place it and not have it go off?

#

make it inert?

obtuse quiver
#

oh wait i can just make a hold action

#

ok sorry i solved this

topaz field
#

Does anyone have an Idea of how to make ["Vladimir", "Dimitri answer the fucking phone"] spawn BIS_fnc_showSubtitle; sleep 2; Global?

drifting sky
#

ARMA2OA... is there a problem using "set" with global arrays inside of an sqf function?

#

Nevermind, problem was elsewhere

little raptor
peak thunder
winter rose
#

if marked as 2.01, it will be in 2.02 @peak thunder

peak thunder
#

Awesome! Thank you!

little raptor
peak thunder
#

Already did it. And i like it. And i want it

#

x)

little raptor
#

The only command that can play sound from its file path is playSound3D right?

#

no alternatives?

winter rose
#

I believe so, at least off the top of my head

real tartan
#

how can I convert ?

code = { hint "test"; false };

to

code = 'hint "test"; false';

needed for inGameUISetEventHandler ["Action", code];

rancid mulch
#

Did you try str code?

real tartan
#

yes

rancid mulch
#

doing it manually or calling a function is not an option?

real tartan
#
code = { hint "test"; false };
inGameUISetEventHandler ["Action", str code];
11:40:47 Error in expression <{ hint "test"; false }>
11:40:47   Error position: <{ hint "test"; false }>
11:40:47   Error Type code, expected Bool
#

expected behaviour:

code = ' hint "test"; false ';
inGameUISetEventHandler ["Action", code];
rancid mulch
#
inGameUISetEventHandler ["Action", format["_this call %1", code]];
spark turret
#

You should clean up that code, half of it is obsolete and the other half uses double variables :D

little raptor
#

yeah, lines 5 to 15 are not used, so delete all of them

#

and TARGET is the same as _laser, so replace it with _laser

spark turret
#

Vehicle player is either the car/heli etc he is in, or himself if he is on foot

serene quiver
#
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle player;

If (isNull _laser) exitWith {hint "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];

sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
hint "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
_laser = laserTarget vehicle player;
west reportRemoteTarget [_laser, 3600];  
_laser confirmSensorTarget [west, true];  
0 = VLS fireAtTarget [_laser, "weapon_vls_01"]; ```
little raptor
#

_laser = laserTarget vehicle player;
duplicate
but anyway it should work fine

serene quiver
spark turret
#

Give me a minute, ill refine your code

#
//Info: this code only works in singleplayer as it uses local variables as "player".
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle player;

If (isNull _laser) exitWith {systemChat "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];

sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
systemChat "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
west reportRemoteTarget [_laser, 3600];  
_laser confirmSensorTarget [west, true];  
if (isNil "VLS") exitWith {systemChat "no vertical launch system found."};
if (isNull VLS) exitWith {systemChat "no vertical launch system found."};

0 = VLS fireAtTarget [_laser, "weapon_vls_01"]; 
#

btw, iirc you can have a condition in your scrollwheel action, so that it only shows up when the condition is met. condition is checked continuously. you could put

(!isNull (laserTarget vehicle player))

in there. action will only show up when a laser is detected

serene quiver
spark turret
#

wait trigger? where is the laserfire code called from?

serene quiver
#

from a radio trigger

#

condition: radio alpha on act: []execVM "missile_support.sqf";

spark turret
#

so you placed a blue trigger object with the above code?

#

never worked with radio triggers tbh

#

ah i see its a variation of the normal trigger

serene quiver
#

Yap..blue trigger with the above code, and the "missile_support.sqf" is the block of code you nicely provided me

spark turret
#

how do you call it? is there a scroll wheel action the player clicks?

serene quiver
#

0>->0 to access the radio trigger list (you can have multiple radio triggers) and then the number of the action you want

little raptor
#

@spark turret

if (isNil "VLS") exitWith {systemChat "no vertical launch system found."};
if (isNull VLS) exitWith {systemChat "no vertical launch system found."};

if (isNil "VLS" || {isNull VLS}) exitWith {systemChat "no vertical launch system found."};
serene quiver
#

Would be nice to have the action under the 0 >9 custom tab of the action menu..or even better in the 0> 8>support tab..

serene quiver
spark turret
little raptor
#

no

#

it's lazy

spark turret
#

thats why i separated it. not sure if theres a better solution

little raptor
#

like I said, it's lazy eval

#

so no errors

spark turret
#

ah right bc its positive eval, true

little raptor
#

the condition in {} will not be evaluated if isNil is true

#

in other words, this is what the game sees: (altho in a faster way)

if (if (isNil "VLS") then {true} else {isNull VLS})
spark turret
#

yeah i know. i just didnt see that its a positive eval and it will exit on the first true condition.
i was stuck on the usual, negative eval where it will check each condition connected with ||

serene quiver
#

I tested this...but is not working..no action of any kind at all...even with the correction Leopard20 suggested..

//Info: this code only works in singleplayer as it uses local variables as "player".
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle player;

If (isNull _laser) exitWith {systemChat "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];

sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
systemChat "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
west reportRemoteTarget [_laser, 3600];  
_laser confirmSensorTarget [west, true];  
if (isNil "VLS" || {isNull VLS}) exitWith {systemChat "no vertical launch system found."};

0 = VLS fireAtTarget [_laser, "weapon_vls_01"]; ```
little raptor
#

you mean the code doesn't run at all?

serene quiver
#

yap

little raptor
#

the code is correct

#

the issue is something else

serene quiver
#

previous code was "working" ..in the sense that it fires the VLS, but only if player lase on foot...

#
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle player;

If (isNull laserTarget vehicle player) exitWith {hint "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];

sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
hint "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
_laser = laserTarget vehicle player;
west reportRemoteTarget [laserTarget vehicle player, 3600];  
laserTarget vehicle player confirmSensorTarget [west, true];  
0 = VLS fireAtTarget [laserTarget vehicle player, "weapon_vls_01"];```
little raptor
#

you say it's not running,
so not even the playSound3D plays

serene quiver
#

nope

little raptor
#

well then it's not executing

#

in other words, whatever that executes this code is broken

serene quiver
#

let me test it from the console..

little raptor
#

plus the change you just made is incorrect

#

use the _laser variable again

#

you're using sleep, so laser target can change

#

it must be constant

carmine tartan
serene quiver
#

you mean the sleep 5; in line 6? the one between the soundPlay?

little raptor
#

yes, your code is scheduled, so the laser target can change. use the old code. it was correct

#

if that's all of your code, it has no problem at all

#

also, no need for 0 = ...

#

never

copper raven
serene quiver
little raptor
#

how do you execute it?

carmine tartan
serene quiver
#

console>localexec

spark turret
#

check your rpt file then

little raptor
#

your code is scheduled

#

it doesn't run in debug console

spark turret
#

true, also its got comments

little raptor
#

comments are fine (in debug console)

#

only /* */ comments are bad

serene quiver
#

even with the radiotrigger doesn't run..

little raptor
#
[] spawn {
//Info: this code only works in singleplayer as it uses local variables as "player".
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle player;

If (isNull _laser) exitWith {systemChat "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];

sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
systemChat "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
west reportRemoteTarget [_laser, 3600];  
_laser confirmSensorTarget [west, true];  
if (isNil "VLS" || {isNull VLS}) exitWith {systemChat "no vertical launch system found."};

VLS fireAtTarget [_laser, "weapon_vls_01"]; 
}
#

try this in the debug console

spark turret
#

poop i was to slow

serene quiver
#

nope..sorry..dead..no vital signs

little raptor
#

even when I test it I get results

#

restart your mission

#

you're probably killing the scheduler

#

are you using a while without sleep?!

serene quiver
#

ok restarting the mission..hold on

spark turret
#

or its in MP and hes executing on another client πŸ˜‚

little raptor
#

he said local exec

spark turret
#

yeah i know, just a fun thought

#

killing some rando on a public server with artielly sounds

little raptor
#

we have a troll on this server...

serene quiver
little raptor
#

I suggest you check your mission

#

it means you were killing the scheduler

#

as I mentioned

spark turret
#

"your spamming your machine with code"

little raptor
#

yeah that

serene quiver
#

still no joy from the vehicle tho..it say "use laser designator"

little raptor
#

do you lase it from a drone?

serene quiver
#

yes from a drone

little raptor
#

well then that's obvious it won't work

serene quiver
#

why?

little raptor
#

you have the get the laser target from the drone

#

not the player

#

maybe try cameraOn

#

I'm not sure if the game has a native command for UAVs

serene quiver
#

hold on..isn't lasertarget vehicle player supposed to take care of that?

spark turret
#

the player commadns the drone?

serene quiver
#

yes

little raptor
#

player is not in the drone

spark turret
#

hm the thing is, drones are commanded by invisible AI which the player takes control offf iirc

little raptor
#

It's a drone (unmanned)

spark turret
#

It still has an ai driver which is invisible

#

Quite sure

little raptor
#

I was talking to zagor

#

I know it has AI

#

I mean the player is not in it

#

so vehicle player is not drone

spark turret
#

Ah. You could call the lasertarget of the drone instead

#

True

serene quiver
spark turret
#

To conclude:
The player only "remote controls" the drone, he is not in it. Therefore its not his vehicle, so lasertarget verhicle player doesnt work

serene quiver
#

Just to be clear..I want the player to be free to call it while on foot or in a vehicle.Is possible?

spark turret
#

Yeah but a bit more difficult

serene quiver
little raptor
#

maybe try cameraOn

#

I already gave you the answer

spark turret
#

Maybe
'''
If (isNull(laserTarget vehicle player)) then {
//use lasertarget of drone
}

little raptor
#

use cameraOn instead of player

spark turret
#

Good idea

fair pilot
#

Is there a way to get default dynamic loadout of vehicle from its config?

little raptor
#

@serene quiver

//Info: this code only works in singleplayer as it uses local variables as "player".
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", cameraOn];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle cameraOn;

If (isNull _laser) exitWith {systemChat "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", cameraOn];

sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", cameraOn];
systemChat "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
west reportRemoteTarget [_laser, 3600];  
_laser confirmSensorTarget [west, true];  
if (isNil "VLS" || {isNull VLS}) exitWith {systemChat "no vertical launch system found."};

VLS fireAtTarget [_laser, "weapon_vls_01"]; 
spark turret
#

if its a dynamic loadout, its probably modified by a mod-owned script like british armed forces

serene quiver
spark turret
#

its fine, i didnt know about cameraOn as well

little raptor
#

I know

#

we were talking about something else!

#

or its in MP and hes executing on another client πŸ˜‚

fair pilot
spark turret
#

ah pretty sure thats in the config. try finding the vehicle in the config viewer

fair pilot
#

In config it only has those weapons which cannot be changed

#

I already checked it in config viewer

spark turret
#

oh wait you are talking about stuff like camo nets?

#

and not vehicle inventroy

fair pilot
#

No i'm talking about rockets and stuff like that

#

For some vehicles it can be changed

spark turret
#

that looks helpful

little raptor
#

the pylons info are there afaik

fair pilot
#

Yep

little raptor
#
configFile >> "CfgVehicles" >> typeOf _veh >> "Components" >> "TransportPylonsComponent"
fair pilot
#

But how do i find default loadout?

little raptor
#

dunno

serene quiver
#

@little raptor and @spark turret ..... THERE WE GO!!!!πŸ₯³ πŸ₯³ πŸ₯³ Thank a lot guys...work like a charm..

little raptor
#

who's iron?!

serene quiver
#

LOL

spark turret
little raptor
#

he was pinging "iron" in case you missed that!

serene quiver
spark turret
#

Might just steal the code. Never fiddled with uavs and cruisemissiles but would like to

finite sail
#

cruise missiles are hilariously OP

past tiger
#

@little raptor it's related to make "r" lock work on players in the same side and allowing then to enter in the same vehicle.

#

If anyone needs: Loop each x seconds (default 1, _cycle = 1) with error correction!```sqf
_cycle = 1;
_init = time-_cycle;
_tError = 0;
waitUntil {
_t = time;
_delta = _t-_init;
if (_delta >= _cycle-_tError) then {
_init = _t;
_tError = _tError+(_delta-_cycle);

    //YOUR CODE HERE
};
false

};

little raptor
#

that's a horrible loop

#

if you need delay, just use sleep

#

waitUntil is scheduled, so you're not doing anything except wasting performance by doing that

spark turret
#

thats the most complicated module loop ive seen so far lol

#
private _i = 0;
while {true} do {
  sleep 1;
  _i = _i + 1;
  if (_i mod 10 == 0) then {
    //every ten seconds do:
  }
}
#

not sure if thats what you want as i dont quite understand whats going on

#

wait is that just a super complicated sleep?

past tiger
#

I do a error correction because sleep x will take more than x time to complete

little raptor
#

again not doing anything helpful. but this is even faster:

private _i = time + 10;
while {true} do {
  sleep 1;
  if (_i > time) then {
     _i = time + 10;
    //every ten seconds do:
  }
}

anyway, all of these are horrible ideas. just use plain sleep

little raptor
spark turret
#

that selfcorrecting sleep looks like it will clog up your scheduler

#

maybe not if used once, but if you have a couple scripts running with that, it will

little raptor
#

it does. it runs in every scheduler cycle (if it can)

past tiger
#

i was thinking in a loop in a server running with low fps, where there is a need of a loop but the error in time could be big.

little raptor
#

when the FPS is low, the error can be both positive (running late) or negative (running early, because of your self correction). So you're not really helping the situation. When the server FPS is low, all scripts run slower. And you're making it worse by running that in the scheduler in every cycle.
and like I said, it's scheduled, so it also depends on the number of scripts that are currently running (and how long they have before they can finish).

serene quiver
#

@little raptor @spark turret here it is in action...with a little twist I added for immersion...hehehehe...again..thank you, guys.
https://youtu.be/KGSg3QcO7qI

ember path
#

if i want to just change the radius of add action how do i do that

#

can i just do radius=5

serene quiver
#

could be "_target distance player < 3" ???

little raptor
#

this sample should help you figure it out

object addAction [
    "title",    // title
    {
        params ["_target", "_caller", "_actionId", "_arguments"]; // script
    },
    nil,        // arguments
    1.5,        // priority
    true,        // showWindow
    true,        // hideOnUse
    "",            // shortcut
    "true",     // condition
    50,            // radius
    false,        // unconscious
    "",            // selection
    ""            // memoryPoint
];
ember path
#

yeah but for example

#

if i just put 10 after the scripot

#

script*

#

how will it know.. that i want that to be the radius

#

ok let me just

#

boy addAction ["Rescue undercover agent", {[boy] joinSilent group player, boy setUnitPos "AUTO", boy sideChat "We have to get out of here before they blow this whole place up!"}];

#

so if i do

little raptor
#

You have to place all the parameters up to radius

ember path
#

damn

#

how do i tell it to keep default stuff

little raptor
#

read the defaults from the wiki

spark turret
little raptor
#

@ember path
also, what I showed you already uses the defaults

spark turret
#

also uiSleep shouldnt have time offset through low FPS i think

ember path
#

so do i just copy paste that then... ig

little raptor
#

yes

ember path
#

oh and how do you prevent from the action staying on the screen

little raptor
#

then replace the parts you need

ember path
#

i see

little raptor
ember path
#

when you scroll wheel, the action is still there after you use it once

#

ig remove all actions?

little raptor
#

do you want to hide it or delete it?

ember path
#

i want it to not be there, like a one time thing

#

like you rescue the agent and thats it

little raptor
#

delete it is then

#
params ["_target", "", "_actionId"]; // script
_target removeAction _actionId;
ember path
#

oki ill try that

#

whats the target in params

little raptor
#

put it in the action script

ember path
#

player i assume, ok

little raptor
#

whoever you added the action to

ember path
#

ok

little raptor
#

read the wiki if you want to know about the parameters

ember path
#

scripting this in editor is a mess

little raptor
#

Don't write scripts in editor.

ember path
#

yeah im starting to realize that xd

#

i thought if they were a couple of lines it would be fine

little raptor
#

either use Notepad++ with SQF syntax highlighting or VSCode with SQF plugin

#

Notepad++ is more beginner friendly

ember path
#

im somewhat familiar with visual studio code, i use community usually for unity

#

but that doesnt have sqf stuff

little raptor
#

download the sqf plugins

#

I don't recall their names, but a quick search will give you some results

finite sail
#

sqfLint

#

sqf_VM Language Server

#

sqf_VM

#

SQF wiki

#

theres a forked version of lint by a chap called senfo

#

thats the one to get

ember path
#

i got all of those, theyre great

finite sail
#

πŸ™‚

ember path
#

but i was like.. i dont need to do this in vs code

#

cuz at this point i have so many scripts

little raptor
#

huh?

ember path
#

is _target removeAction _actionId;
in script of add action

#

like in the script field

little raptor
#

use the exact code I posted

#

yes it goes in script obviously

little raptor
#

there's two of them

finite sail
#

senfo is the later version, iirc

little raptor
#

yeah but it doesn't have much rating so it looks "suspicious"

finite sail
#

im using it without known issues, a coupe of other guys too

little raptor
#

that's only 3 people! πŸ˜›

finite sail
#

(not tagging them ) 7erra and Haz and ezzcoo

#

you can check his repo if you want

#

i havent tbh

little raptor
#

I am rn

finite sail
#

other than the pr0n pop ups and huge debits from Mrs Tanks credit card and the emails about bitcoins, I've noticed nothing unusual

ember path
#

also the scripts thing i mentioned: if i turned things i use rn into scripts, id have a script for the ai to hide, a script for when they get rescued, a script for interacting with a radio box etc etc

#

idk how many scripts is too many scripts

finite sail
#

lol

little raptor
#

the bad thing about VSCode plugins is that they're from like centuries ago

finite sail
#

my mission folder is 17 MB, the majority is scripts

ember path
#

so...i shouldnt feel bad for making scripts xd

little raptor
#

no

finite sail
#

nope, all the advanced stuff is done in script

#

just checked... ive got 568KB of images in my mission folder, probably some of them are deprecated, the sqm is 48 KB, the rest is scripts

#

if i could be bothered to maintain a stringtable, it'd be even bigger

ember path
#

rn im having an issue where im shooting at other units, but then my hide script doesnt execute cuz that one unit isnt in combat mode red

#

even tho they are hiding

idle jungle
#

Warning Message: '/' is not a value
16:32:24 Warning Message: No entry 'bin\config.bin/CfgFactionClasses.'.
16:32:24 Warning Message: No entry '.displayName'.```

how do i find the line the error is on. this message is really not helpful
ember path
#

oh wait i could try using Behaviour

#

instead of combat mode

still forum
idle jungle
#

thank you

ember path
#

how do i use the rtp visual studio extension

#

or whatever its called forgot xd, the debugy one

finite sail
#

i dont use it

#

rpt?

ember path
#

i think so yeah, the log one

finite sail
#

i use a seperate app for wacthing the rpt

#

baretail

#

have it on a different screen

ember path
#

in this example
_b = behaviour _soldier; //returns "CARELESS"
what is the _b

#

because im trying to write a trigger that triggers when theyre aware

#

and im getting

finite sail
#

the behaviour command, in taht example, creates a variable called _b

ember path
#

error behaviour: type group, expected object

#

(behaviour boys == "AWARE")

#

like that looks right

finite sail
#

as the error says, behaviour command expects a group, not a unit

ember path
#

but ig it isnt

#

it is a group

#

oh

#

i have to

#

switch them around

#

fuck

#

mh..no wait

idle jungle
#

ahhh crap sorry for the tag

winter rose
ember path
#

thanks!

idle jungle
#

wheres the command line startup parameters gone from the launcher

#

oh is it now parameter file

still forum
#

I think you cannot enable it in Arma launcher yet

#

there is no field for custom parameters, and the -debug option is only added on dev branch

fading tiger
#

Just a quick question. Is there a built in function to get a basic strength of units or Vehicles (like solider = 1, APC = 5)? Or do I have to write it?

winter rose
#

you could get the cost from config I suppose (if it is still a thing)

finite sail
#

cost still exists in config

#

never used it though

fading tiger
#

Hm, ok, thank you. I hoped more for something, that returns a combat strength. Probably seperatet against Infrantry and vehicles

winter rose
#

there are functions that tell you if infantry or vehicle, also isMan config entry

#

but how else do you want the game to guess what you want?

fading tiger
#

I hoped, that there is a function, that get's a strength of any unit based on there equipment.

finite sail
#

cost is probably as close as you want

#

unless you're prepared to go really deep

winter rose
#

yeah but "what is strength" Β―_(ツ)_/Β―

#

cost is indeed the closest the game has

#

FYI cost is not "money cost" or "Zeus cost", it is indeed "weight" the AI gives to the target

fading tiger
#

oh, ok, that's nice, I thought that is Zeus cost. Thank you

finite sail
#

zeus does use it

#

but its more the threat AI feel from a unit

wild prairie
#
{[_x, "curatorUnitAssigned", {
    params ["_curator", "_player"];
    //code goes here
}] call BIS_fnc_addScriptedEventHandler;} forEach allCurators;
``` so this *should* be enough to attach it to all the modules in my mission file
little raptor
#

no

#

your "module" is already being passed to the code

wild prairie
#

I'm referring to _curator as in

[_curator, "curatorUnitAssigned", { //< This line
    params ["_curator", "_player"];
    //code goes here
}] call BIS_fnc_addScriptedEventHandler;
```, which is how wiki says to call it.
little raptor
#

and this is what I meant

wild prairie
little raptor
#

yes

#

unless you have defined _curator
but again this will only add the EH to that curator module

wild prairie
#

Kay, you just confused me even more. I want to add the EH to all curator modules in my mission. Do I use option 1 or 2?

little raptor
#

1

wild prairie
#

Gotcha.

#

Thank you.

ember path
#

how would i set off a trigger after the action has been removed
(in my case i have an add action script, that lets me hack the terminal, and then plays the terminals animation, afterwards i want a helicopter to land, i assume the best way to do this is to have a hold waypoint and then activate the trigger, i just dont know how)

#

i tried settings the triggers condition with like script done

#

but that doesnt work, cuz the add action script gets executed as soon as the player gets near the terminal

#

i need something that checks when remove action script happened

#

I think i might be doing this in a very silly way..

little raptor
ember path
#

yeah i gave up from using a trigger

#

helo now lands at the spot, now to just figure out how to make it take off once everyone is in

little raptor
#

something I wrote a while back for someone else:

_landPad = createVehicle ["Land_HelipadEmpty_F",  ASLtoAGL getPosASL task4d];

MY_HELI land "GET OUT";

waitUntil {
sleep 1;
units group player findIf {alive _x && !(_x in MY_HELI )} == -1
};
deleteVehicle _landPad;
MY_HELI land "NONE"; //take off

_WP = (group MY_HELI) addWaypoint [getPosASL helperObject1, -1]; 
#

It makes a helicopter land, wait for everyone from the player's group to get it, then move to a new waypoint

#

their case needed some objs, but you probably don't

ember path
#

i butchered together a thing out of some scripts i found online

#

this trys to mimic the escape extract, where you get extracted once you hack the terminal

#

(by the way how do you format the code so it looks pretty like that with colors in dsicord)

little raptor
#

see the pinned messages

ember path
#

i see

#
_target = radio;
_actionId = 2;
_extractpos = [extract1];
radio addAction
[
    "Hack",    // title
    {
        params ["_target", "_caller", "_actionId", "_arguments"]; // script
        [radio, 3] call BIS_fnc_DataTerminalAnimate;
        _target removeAction _actionId;
        helo move (getMarkerPos "extract1");

sleep 3;

while { ( (alive helo) && !(unitReady helo) ) } do
{
       sleep 1;
};

if (alive helo) then
{
       helo land "LAND";
};
waitUntil {sleep 1; allPlayers findIf {alive _x && !(_x in helo)} == -1};
helo move (getMarkerPos "extractfinal");

    },
    nil,        // arguments
    1.5,        // priority
    true,        // showWindow
    true,        // hideOnUse
    "",            // shortcut
    "true",     // condition
    10,            // radius
    false,        // unconscious
    "",            // selection
    ""            // memoryPoint
];
#

its messy af but it works xd

#

ill add stuff like them telling theyre coming for extract and that they landed, but i just wanted to push through and get the ending to work

#

now all its left to do is the start, briefing stuff, and some polish/balancing

drifting sky
#

arma2OA, is it possible to initialize an empty array with n length, to avoid it needing to expand later?

#

Actually, can I make custom structures with named variables?

little raptor
winter rose
#

you can't "freeze" an array size though - if you add, it will expand

little raptor
drifting sky
#

Thanks. What bout the custom data structures?

little raptor
#

not sure what you mean

drifting sky
#

I'm using arrays, but it would be ideal to have named variables

#

like, i could create an instance of my custom structure, and refer to its variables like new_thingamajig.some_variable_name = some_value

little raptor
#

no

winter rose
#

you cannot create custom objects no

little raptor
#

we don't have structs in sqf

winter rose
#

but you can use setVariable on an object

drifting sky
#

ok thanks

#

too bad though

little raptor
#

there is one thing you can do

drifting sky
#

I'm using #define to name array indexes

little raptor
#

yeah that's one way

drifting sky
#

but the problem with define is Very long names

#

since they have to be unique for all "structures"

winter rose
#

the problem is your OOP approach of SQF πŸ˜„

little raptor
#

anyway, I'm not sure what you want to do, but another awkward way is:

_names = ["var1", "var2"];
_values = [1,2];
_array = [_names, _values];
_values select (_names find "var2");

it's terrible. but I can't think of anything else besides these two

drifting sky
#

eh, that looks like it would have a pretty big impact on performance

#

having to look up the name of each variable every time it is accessed

little raptor
#

not much

#

find is fast

winter rose
#

make one script that runs the info with all its inner variables, and send an array that will be the DTO (Data Transfer Object)

round blade
#

How would I go about preventing the ai from firing a weapon unless prone in a relatively performant manner? This would be for a light mortar launcher

winter rose
#

take their guns away! \o/

drifting sky
#

for return values from scripts, do I have to do something like this:

#

array = [a,b]

#

array;

#

or

#

can i do something like this

#

[a,b]

winter rose
#

last two are ok

#
[1,2,3] // will return [1,2,3]
// or
_myArray // will return _myArray's content
#

semicolons presence doesn't matter, maybe in Arma 1 and I am not even sure of that

#

(it was thought that having a ; would make the script return nil, which is (f)actually false)

little raptor
#

Yeah. As long as your command/expression returns something, and you don't store it, it returns a value

drifting sky
#

k thanks

little raptor
#

I mean this doesn't
_a = 1;
But these do
_a
_a;
1
Nil
etc

winter rose
#

WRONG
etc returns unknown variable!

drifting sky
#

and for waituntil, is it similarly, that the last returned value or expression is the condition?

little raptor
#

Yeah

drifting sky
#

Okay, one more question. can you use exitwith in conjuction with other commands? example:

#

if(condition) then { do_thing; exitWith{} };

willow hound
#

Not like that.
Either use it as intended:

if (condition) exitWith {
  //Do the stuff here
};
```Or, if for some reason you don't want that, you could do it like your example shows (but using correct syntax!):
```sqf
if (condition) then {
  //Do the stuff here
  if (true) exitWith {};
};
```But I don't see any reason to use option two. It's bad code and it does the same as option one.
drifting sky
#

ah... I misunderstood it's purpose. Thanks for clearing that up.

willow hound
#

Actually option two only exits the if-scope it's in, so it doesn't do the same as option one after all.
In fact it does nothing. Definitely don't use that.

drifting sky
#

k

finite sail
#

if (condition) exitWith {do_thing};

#

^^^ @drifting sky

idle jungle
#

Hey guys

Is there a way to disable the chat channels for everyone except specific user ids?

I.e. 0 enablechannel false

tough abyss
#

@idle jungle If that's the one thing you want to do, and you know the user ids in advance, you could make Switch cases

exotic flax
idle jungle
#

Oh okay

tough abyss
#

Q: How do you make dead (ahem) bodies in missions in a performance friendly way? Is there another way besides setDamage 1; and having the characters ragdoll for several seconds?

idle jungle
#

What if you hide model for couple of seconds and then show model

#

2bh don't listen to me haha

tough abyss
#

@idle jungle Don't give me IRL ideas πŸ€”

spark turret
#

I guess you could kill some dudes at start and disable their simulation after they come to a halt?

tough abyss
#

Yeah, but my guess is that the CPU expensive part is at the start (and also the greatest moment of lag in my mission). Any way of skipping/shortening the ragdolling?

#

Guess I could execVM a script on each character setting simulation to false after 1 second. Will try that.

drifting sky
#

if i have an array, a. And I do b=a. Is there a way I can replace a with a new array through b?

winter rose
#
private _arrayA = [1,2,3];
private _arrayB = +_arrayA; // copy, not ref
drifting sky
#

I don't believe that answers the question. Maybe I should elaborate.

#

B is a reference to A

#

But, I want to replace A with a new array through B

winter rose
#

a new array through B
I don't get that part

drifting sky
#

something like this:

#

A = [1,2,3]

#

B = A

#

B = [4,5,6] //A = [4,5,6]

winter rose
#

no can do

#

but you can update that reference

#
_arrayB resize 0;
{ _arrayB pushBack _x } forEach _arrayX;
#

this way, both A and B keep reference to the same array, its content being changed

drifting sky
#

thanks for the suggestion

winter rose
#

somehow it is not what you are after… but you unfortunately cannot do what you meant above

copper raven
#
private _arrayA = [[1, 2, 3]];
private _arrayB = _arrayA;
_arrayB set [0, [4, 5, 6]]; // _arrayA = [[4, 5, 6]]

i guess that's the closest you can get, but it's useless

#

you have to select everytime then...

sleek sail
#

Anyone had luck setting up original respawn module to work with playable slot controlled by AI? In my case if I play for the playable slot I can select respawn place as intended. But when playable is controlled by AI, it keeps respawning at the initial mission position.

little raptor
little raptor
#

if you want deep copy (if your array contains nested arrays):

B = +A;
past tiger
#

Set the same value to a variable twice, or even many times, can cause any harm related to this var storage in memory? I mean, this can increase memory fragmentation, or anything else? I know it's a strange question, sorry for any inconvenience.

little raptor
#
_unit switchMove "DeadState"

I don't recall its name, but I think it was that
You can find it in anim viewer

#

also, if you create very simple soldiers (those without any loadout), you can save some performance

tough abyss
#

Thanks.

#

I thought most of the CPU was spent on the AI and calculating the ragdoll physics of the dead unit. But loadout also plays a role, you have a point.

#

So, in order to save server CPU, I could disable AI on the character, then use switchMove on the character, for example?

little raptor
#

CPU was spent on the AI
A unit that is just created doesn't have AI yet
it's the looking up the model and initialization parts that take time

little raptor
#

the best thing you can do is create the soldiers as vehicles (use createVehicle(local), not createUnit)

#

then switchMove and kill

#

then disable simulation

tough abyss
little raptor
#

yes

#

they're vehicles

tough abyss
#

What's the functional difference? No FSM?

little raptor
#

no AI

tough abyss
#

Takes damage, collisions, inventory, physics simulation... but no AI?

#

interesting

little raptor
#

units have no physx sim

tough abyss
#

well not PhysX but they obviously have some sort of collisions and physics. Didn't mean to mix up

little raptor
#

yeah they do

tough abyss
#

OK cool. Will look up the other commands you mentioned as well (eg Kill is also new to me). Thank you.

little raptor
#

lol

#

I meant setDamage 1

tough abyss
#

😡

little raptor
tough abyss
#

True, since there's no AI.

topaz field
#

Could one of you please take a look. I had a look at the remoteExec page and fiddled around with this line. It produces no syntax errors to my knowledge but does not execute the dialogue. ["Vladimir", "Dimitri answer the phone"] remoteExecCall ["spawn BIS_fnc_showSubtitle",[0, -2]select isDedicated];

exotic flax
#

"spawn BIS_fnc_showSubtitle" does not make sense πŸ€”

#

it's not a function/command, and it's already being called by remoteExecCall

topaz field
#

it comes from this line ["Dimitri", "Hello?"] spawn BIS_fnc_showSubtitle;

#

It works

#

Look it up

exotic flax
#

πŸ€¦β€β™‚οΈ

#

remoteExecCall only accepts a function/command name

#

try this

["Vladimir", "Dimitri answer the phone"] remoteExecCall ["BIS_fnc_showSubtitle", [0, -2] select isDedicated];
#

or probably better, since that will be scheduled (just like spawn):

["Vladimir", "Dimitri answer the phone"] remoteExec ["BIS_fnc_showSubtitle", [0, -2] select isDedicated];
ember path
#

im not seeing it in pinned, but is there a good guide or way to do tasks, and spawning ai when needed stuff like that. For example i dont need the helo that extracts people until the end of the mission, i looked up createUnit but that would mean id have to redo the whole unit, and i changed some of their loadouts

#

is there a way to spawn the group as is, as in, you make them in eden how you want them, define them, and then just like..make them spawn like that, not having to define evereything

winter rose
#

you can use setUnitLoadout and a description.ext class

#

createVehicle + createVehicleCrew or BIS_fnc_spawnVehicle too

ember path
#

could i maybe even just keep them spawned but disable ai so they just hover, or another question: if they have dynamic simulation applied, and a script asks them to move or do something but theyre out of that range.. do they do it or

exotic flax
#

or use BIS_fnc_spawnGroup if you have defined the groups/units already

cosmic lichen
ember path
#

oh whaaaat

#

theres layerss?

#

right no gifs

#

xd

ember path
#

thats....amazing thanks, just what i needed

#

thats amazinggg

winter rose
#

never have I used them TBH, besides Eden organising πŸ˜„

ember path
#

this is gonna help me a lot i assume, cuz i was planning on writing another script for dynamic patrols or what not, that search for players, but i assume i could just put them in another layer with waypoints, and activate the layer when needed

#

i still love that windowed arma for some reason uses the win7 border

languid oyster
#

Anyone knows, if arma has somewhere cartridge models for large rounds such as 30mm, 40mm etc?

#

I mean the model type, that can be found e.g. here
configfile >> "CfgAmmo" >> "ACE_556x45_Ball_Mk262" >> "cartridge"

#

For configfile >> "CfgAmmo" >> "B_30mm_AP_Tracer_Green" >> "cartridge" the entry is
cartridge = "FxCartridge_556";
Leading to a tiny .556 cartridge, in comparison to the real world 30 mm cartridge.

#

Or can the model be somehow scaled in the game?

#

Advice me plz, if I should ask in another forum

winter rose
#

try checking the grenade launcher ammo? e.g on hunters or ifrits

ember path
#

ok.. dummy question but i saw a script that goes:

    {
        _x enableSimulation true;
        _x hideObject false;
    } forEach (getMissionLayerEntities "MyCustomLayer" select 0);
#

does that mean that the object is still like... active.. being simulated even if the layer is hidden?

winter rose
#

this ^ code enables the vehicle, not disables it

#

1/ use enableSimulationGlobal/hideObjectGlobal, server-side
2/ use false/true to disable the layer, true/false to enable it

#

hiding the layer in Eden is not doing anything in-mission, it is in-editor only

ember path
#

ohhhhhhh

#

oh this works great, im using that script in objects init field to disable it on mission start, and then enable it when i need to

winter rose
#

pleeease no

#

use initServer.sqf

ember path
#

why nottt

winter rose
#

because init fields are ebol

ember path
#

ebol??

winter rose
#

evil

#

bad

#

horrible

#

terrible

ember path
#

snake voice hrng.. ebol

winter rose
#

poopy

ember path
#

okay...okay

winter rose
#

code in init fields is run client-side on every clients connection as well
so even if *Global commands only work server-side, it's still a good thing to steer away from these forsaken fields

ember path
#

oh so there could be a bad: where like the init gets executed for every player

little raptor
#

that's a good (?!)

ember path
#

oh but could you also use it for good things, for example, in init lets say you spawn another guy next to the first guy, so for each player the init field gets executed and changes the difficulty of the mission

winter rose
#

yes
my favourite example, if you want to start injured:

this setDamage 0.5;
```then you play, and heal yourself, cool. then another player connects: boom! you're injured again
ember path
#

xd

#

its fine, in lore you got a flashback where your friend got hurt and now youre hurt again

winter rose
#

in some cases, an init field is OK (e.g local commands)
most of the time though, it's bad

little raptor
#

I've personally never used the init fields in my entire Arma scripting experience. They should be removed!

winter rose
#

agreed, but hey.

#

it's cool for single player missions though

little raptor
#

yeah fair enough

winter rose
#

let's not forget that this 20yo engine was not meant for multiplayer, and that it was added at a late development stage!

spark turret
#

Yeah, dedmen pls fix :D

#

Tbh armas engine is the best 20-yo one i know about. It does its job, its moddable and its not even bad at its job

#

I mod a 10-yo game one-man-passion-creation from time to time and its far far far worse than arma

#

on the other hand: i dont have access to armas source code so idk how much spaghetti it is πŸ˜›

winter rose
#

I believe they hid things well 😁 tbh, it might be a mess in some areas, but it's still somewhat solid on the "front" side. the lack of resource usage is something showing, of course, but take an Apex screenshot and say "it's a 20yo engine running @ 60FPS" (in single player ^^), it's still something

spark turret
#

yeah very true.

spark turret
#

theres a discussion going on in my clan about grass. players see it, AI dont. can someone confirm that AI completly ignores grass?

#

i tested myself for foliage and they didnt ignore it. they were just very good at guessing where you are behind it

cosmic lichen
#

I think Greenforst did some tests on that

winter rose
#

already debunked in an AI forum thread I believe?

cosmic lichen
#

Yes

#

AI Myth..something

spark turret
#

ah yes thats what google gave me. ill look into it very thanks much help

#

LOL didnt know that

Note: AI can only see your "central nervous system" so to speak. They can't spot your limbs or sides of torso, only the head and spine. This is why you can hide behind traffic sign posts for example.
little raptor
#

they can see your eyePos too

#

up to ~200m

spark turret
#

well eyes are part of he CNS

little raptor
#

oh right it mentions that:

only the head and spine

sage dawn
#

has anyone noticed any issues with using createVehicleCrew? I've been having a lot of issues with the crew that gets created getting out of the vehicle, running around in a circle before getting back in once they are created

#

I'm not sure if it's an issue with the command or something on my end

little raptor
little raptor
#

beyond that it's only aimPos

sage dawn
#

there's nothing on the wiki about that

winter rose
#

This command does not addVehicle to the created crew in the same way this normally happens when crewed vehicle created in the editor. See BIS_fnc_spawnVehicle for a full vehicle and crew creation and group addition.
really?

sage dawn
#

I don't think it's that, I've tried manually doing addVehicle

little raptor
#

it's an animation issue

#

what animation are you using for get in?

spark turret
#

A general question regarding performance:
I have been building an ambient battle script that creates local soundsources for each player and plays shot sounds. the soundsources all point in the direction of a "center master" object so it always seems that the sound is coming from there. reason is to have the battle be hearable from kilometers away.

now the problem is, it works fine in my local MP with 2 clients from same machine, and obliterated the mission it was intended for on the dedicated server :D

i suspect the reason is that i spawn a TON of coroutines. every shot has a spawn {sleep _delay; remoteExec playSound} foreach sound and foreach player.
other than that theres only one main loop which is ~2 seconds timeout.

Any other ideas what might clog up the scheduler?

little raptor
#

@sage dawn
make sure your interpolateTo and connectTo for the anims are empty. the animation must not connect to anything elese

spark turret
#

or any input is welcome

sage dawn
#

what? animation?

little raptor
#

the unit animations when they're seated

sage dawn
#

I'm not doing anything with animations, createVehicleCrew has nothing to do with animation

little raptor
#

did you create that vehicle yourself?

sage dawn
#

no

little raptor
#

I mean in object builder

sage dawn
#

it happens on pretty much every vehicle I've used it on

#

at least from what I've seen

#

not all the time but often

spark turret
#

your problem is that ai leaves the car and runs around?

sage dawn
#

yeah they get out, run around a bit and then get back in

#

it's most annoying when it's a static weapon on a roof or something

spark turret
#

i have had a kinda similar issues with helicopters. i noticed that i have to leave 2 passengers seats free, otherwise they will try to escape

#

so it i only fill in 8/10 passengers, they dont leave

sage dawn
#

they spawn in the static weapon, get out, fall of the roof and get injured

spark turret
#

you can disable their ability to leave the weapon iirc

sage dawn
#

though the moving back in almost seems to happen automatically

#

like they get put back in almost like using a moveIn command

#

though I dunno, it might be some mod issue

little raptor
#

how do you do this whole process?

sage dawn
#

I just createVehicleCrew and then addVehicle ```sqf
_crew = createVehicleCrew _x;
uisleep 0.01;
_crew addVehicle _x;

little raptor
#

don't add sleep

sage dawn
#

I think I've tried it without a sleep

little raptor
#
_crew = createVehicleCrew _x;
_crew addVehicle _x;
units _crew orderGetIn true;
#

maybe that?

still forum
#

Can you set the rotation of a object you attachTo'ed ?

little raptor
#

yes

still forum
#

how? i tried setVectorDir on the object that i attached, but it resets