#arma3_scripting

1 messages · Page 553 of 1

grave stratus
#

i see.

#

i used to script for ragnarok back then, it was different, i could even use goto case "whatcase": wherever i want in the script. 😅

#

maybe different framework i guess

winter rose
#

vomits

grave stratus
#

hey it was the trending game back then 😂

#

in my country tho

winter rose
#

I don't blame the game though

grave stratus
#

does [] spawn { waitUntil {} }; run once or everytime the condition is met?

#
[] spawn {
    waitUntil { 
        sleep 1; 
        (east countSide allUnits == 0);
    };
    ["Task_001_01", "Succeeded"] call BIS_fnc_taskSetState;

would it run again if i spawn enemy and kill it after the spawn ran the first time?

winter rose
#

No.

#

At the end of the spawn, the code is terminated

grave stratus
#

ah good to know.

#

so it is better to check the task if i want to do multiple of these codes right?

#
[] spawn {
    waitUntil { 
        sleep 1; 
        ((["Task_001_01"] call BIS_fnc_taskState) == "ASSIGNED" && (east countSide allUnits == 0));
    };
    ["Task_001_01", "Succeeded"] call BIS_fnc_taskSetState;
#

something like this

winter rose
waxen tendon
#

how can i check if all units in array is in vehicle type boat

still forum
#

findIf {vehicle _x GetTypeSomehow == "boat")

#

maybe simulation type from vehicle config

waxen tendon
#
findIf {typeOf vehicle _x == "Boat"} forEach array```?
still forum
#

no

#

isKindOf maybe, probably not though

#

I guess simulation entry in vehicle config is most reliable

waxen tendon
#

i dont know what that is (sorry)

#

is it under Config CfgVehicles?

still forum
#

yes

waxen tendon
#

ok

#

anyhow this should work ```sqf
findIf {typeOf vehicle _x == "O_Boat_Transport_01_F"} forEach array

still forum
#

"CfgVehicles" >> vec >> "simulation"

#

no........

#

read the wiki

waxen tendon
#
array findIf {typeOf vehicle _x == "O_Boat_Transport_01_F"}```
#

thanks!

obsidian violet
#

hey guys.
Having some issues with the Hold Action function.

I´m trying to use the CBA function addClassEventHandler to attach a holdaction on every object that is a "Land_PaperBox_open_full_F"

But for some reason I cannot get it to work. Do you have any clues?

["Land_PaperBox_open_full_F", "initPost", {
    params ["_object"];
    

[
    _object,                                            
    "Tag Supplies",                                        
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
    "_this distance _target < 3" ,                        
    "_caller distance _target < 3",                        
    {},                                                    
    {},                                                    
    {  hint "Supply box tagged";
    deletevehicle _object; },                
    {},                                                    
    [],                                                    
    5,                                                    
    10,                                                    
    true,                                                
    false                                                
] call BIS_fnc_holdActionAdd;


}, false, [], true] call CBA_fnc_addClassEventHandler; 


still forum
#

have you tried adding diag_log or some kind of logging in the class eventhandler to make sure it runs?

#

The eventhandler is called InitPost not initPost

obsidian violet
#

when i´m running it in the debug it returns true.

tried to change the initPost to InitPost but still no difference.

#

If I give a object the variable name "box" and then just paste the following code in the hold action works... seems to be something with the CBA function?


[ 
 box,            
 "Tag Supplies",           
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",  
 "_this distance _target < 3" ,       
 "_caller distance _target < 3",       
 {},              
 {},              
 {  hint "Supply box tagged"; 
 deletevehicle box; },     
 {},              
 [],              
 5,              
 10,              
 true,             
 false             
] call BIS_fnc_holdActionAdd; 
still forum
#

no errors in RPT?

#

And you added logging and it worked?

#

tried logging the contents of _this inside the classEH?

thorn mural
#

If i define an array arr1= [1,2,3] and arr2 = arr1, if i now modify arr2 with deleteAt it modifies arr1

#

Is that how it is supposed to work?

still forum
#

yes

thorn mural
#

So = creates no copy but rather a link?

still forum
#

yes

#

not just with arrays, with everything

obsidian violet
#

@still forum

this is what I have from the RPT.
Im not sure how the diag_log works gonna read about it now 🙂

still forum
#

That stuff says literally nothing relevant

obsidian violet
#

I know 😦

still forum
#

use whatever logging method you like and understand

#

why do you post it then?

obsidian violet
#

you asked if I had any errors in the RPT. Maybe you could see something I couldn´t either way.I try to do some more testing

still forum
#

Ah that. yeah.

old radish
#

hey im struggling with something that really should be super simple, i need to create a bounty system for enemy kills. The method i currently use works perfectly in the editor, but as soon as i run it on the dedicated server it will not work.
initServer.sqf
#include "scripts\fnc_BountyPayout.sqf"

fnc_BountyPayout.sqf (Relevant portion)

fnc_BountyPayout = addMissionEventHandler ["EntityKilled", 
{
    _killed = _this select 0;
    _killer = _this select 1;
    
    _killedSide = (side group _killed);
    _killedFaction = faction _killed;
    
    
    if (_killedSide == resistance) then
    {
        if (isplayer _killer) then
        {
            [_killer, 500] call grad_moneymenu_fnc_addFunds;
            "You received 500$" remoteExec ["hint",_killer];
        };
    };
still forum
#

_this select
use params.
fnc_BountyPayout = fnc_ prefix makes it look like it contains a function, while it doesn't.
Have you added logging to see what's going wrong?

old radish
#

no i havent tried logging, i did try several other methods of basically doing the same thing. I took this example from a reply on the VASS (Virtual arsenal store) forum page, original is here;

fnc_BountyPayout = addMissionEventHandler ["EntityKilled", 
{
    _killed = _this select 0;
    _killer = _this select 1;
    
    _killedSide = (side group _killed);
    _killedFaction = faction _killed;
    
    
    if (_killedSide == resistance) then
    {
        if (isplayer _killer) then
        {
            _money = _killer getVariable [TER_moneyVariable,0];// get the variable, if not defined use default (0)
            _money = _money + 500;//add kill reward
            _killer setVariable [TER_moneyVariable, _money];
        };
    };
    
    if (_killedSide == east) then
    {
        if (isplayer _killer) then
        {
            _money = _killer getVariable [TER_moneyVariable,0];// get the variable, if not defined use default (0)
            _money = _money + 500;//add kill reward
            _killer setVariable [TER_moneyVariable, _money];
        };
    };
    
    if (_killedSide == civilian) then
    {
        if (isplayer _killer) then
        {
            0 = [_killer] execVM "scripts\fnc_CivilianKilledPenalty.sqf";
            
        };
    };
     
    // Player death
    if (_killedSide == west) then
    {
        if (isplayer _killed) then
        {
            
        };
    };
}];
still forum
#

why tap around in the dark for hours/days. instead of simply adding logging and seeing what goes wrong where

old radish
#

I think i might have found why this is happening

still forum
#

logging would have told you that if you logged the arguments

old radish
#

i will, in the future 😛

round scroll
#

In the carpet bombing module I wrote for Sabre's secret weapons and Unsung one must specify the weapon that is used for the carpet bombing, e.g. Uns_Mk83Launcher_dl for the A-6 in Unsung. Ideally I would like to make this more user friendly and offer users a selection of light/heavy/napalm/CBU or whatever bombs instead of having them dig in the config viewer for a long time to get the weapon name. Any ideas how to add this? Maybe a key->value map in the _logic of the module? Any suggestions how to auto generate such lists?

old radish
#

Your honor, i may have shot the man. But really, he killed himself. <- ACE attorney
killed: reb_564, _killer: reb_564, _instigator: <NULL-object>

still forum
#

Any suggestions how to auto generate such lists?
Maybe just add a "isCarpetBombLauncher" entry to supported weapons configs?

round scroll
#

and then iterate over the weapons config and add them to some list, nice idea, thanks

still forum
#

Or just make a new root level config class that contains the name of supported weapons
Like
class SupportedCarpeteers {
Uns_Mk83Launcher_dl = 1;
blablub = 1;
...
}

old radish
#

for posteritys sake, i used ace_medical_lastDamageSource to get _killer's real identity.
_killer = _killed getVariable ["ace_medical_lastDamageSource", objNull];
It now works

still forum
#

I'd say: no

lucid junco
#

"InBaseMoves_table1" can someone tell if its somehow possible to smoothly change from this animation to default stand animation? (without weapon - without that cross animation when unit move his weapon on his back).

dusky pier
#

is possible to get magazine ammo from magazines in container?

finite dirge
dusky pier
#

@finite dirge thank you a lot!

finite dirge
#

No problem! Good luck with your script.

plain raven
#

anyone use the calculate path command? Seems to be outputting an interesting Z co-ord: [14012.3,17348,17348] Tried various conversions to no avail.

#

deleteAt 2 seems to delete both Y and Z co-ords to which again, strikes me as odd

astral dawn
#

What is more weird, Y and Z are the same

tough abyss
#

Not weird, don’t use stable

astral dawn
#

Fixed: The PathCalculated Event Handler would fill each path node with [X, Z, Z] instead of [X, Z, Y]
Does he mean 'instead of [X, Y, Z]` ?

winter rose
#

depends actually 😅
I think internally it's XZY (such as Y being the altitude axis) whereas in SQF it's XYZ where Z is the altitude

tough abyss
#

Yes z is y internally

west grove
#

is there a way to detect when a mortar shell hits the ground (and where) ?

#

or artillery shell, etc

#

or just any bomb

#

i just want to know where the ammo explodes

winter rose
#

usually where it lands, but not always!

west grove
#

sure, but it would be great if the game could tell me in detail

#

i'm thinking of a fired event handler in combination with find nearest, but this seems awful complicated

winter rose
#

fired can give you the fired ammo though

west grove
#

but what do i do with that. detect when it explodes?

#

wasnt there some ammo explosion trigger something something

#

maybe i just have to check if it i alive

#

let's test

tame socket
#

an alive check should work, you could also check the position of the bullet to see when its z axis is less than 0.5 or so above terrain level

tough abyss
#

Add on each frame and monitor pos until it is null, last not null position will be close enough

astral dawn
#

Which command do I use to add an item defined in cfgVehicles to the cargo space of a vehicle?

#

For instance, "Item_FirstAidKit"

winter rose
#

addItemCargo ?

astral dawn
#

Unfortunately, no, or am I looking at the wrong class name

#

Yeah indeed, it should be "FirstAidKit", not "Item_FirstAidKit"

still forum
#

to add an item defined in cfgVehicles to the cargo space of a vehicle?
Items are not defined in CfgVehicles

#

Items are CfgWeapons

#

CfgVehicles entries are just prefilled dummy WeaponHolders

astral dawn
#

Ahh ok, makes sense

plain raven
#

@tough abyss That post, if im reading it right, its revision 145765, im running 145977, or is this the diff between stable and dev branch?

still forum
#

yes there is diff between stable and dev

#

but bigger build number "usually" means you have that

plain raven
#

right ok, for now at the advice of someone else im just using set to change the 3rd element to 0. Seems to work fine, cheers guys

tough abyss
#

@plain raven sometimes things from dev don’t get merged to stable. The bug is fixed in the next stable

#

Use dev for now

grave stratus
#

Can some one tell me where i went wrong please? i am about to explode.
init

if (isServer) then {
    sleep 1;
    ["002"] execVM call HKB_fnc_multiSpawnCall;
    };

fn_multiSpawnCall.sqf

params ["_mscIDs"];

switch (_mscIDs) do {

    case "001": {
        
        [East,[2039.222, 7379.76, 0],"O_T_Soldier_F",5,[1948.333, 7369.368, 0],[1833.130, 7339.478, 0],[1703.357, 7324.028, 0]] call HKB_fnc_task001SG;
        [East,[1909.678, 7372.375, 0],"O_T_Soldier_F",2,[1909.678, 7372.375, 0],[1834.790, 7424.806, 0],[1762.071, 7472.087, 0]] call HKB_fnc_task001SG;
};

    case "002"; {
        
        [East,[2958.123, 7118.643, 0],"O_T_Soldier_F",5,[2958.123, 7118.643, 0],[3058.665, 7157.612, 0],[2938.392, 7234.15, 0]] call HKB_fnc_task001SG;
        [East,[3728.521, 7609.846, 0],"O_T_Soldier_F",5,[3728.521, 7609.846, 0],[3643.559, 7592.115, 0],[3566.231, 7569.459, 0]] call HKB_fnc_task001SG;
        _newGroup = CreateGroup civilian;
        PERISIK2 = _newGroup createUnit ["C_man_polo_4_F", [3616.062, 7562.843, 3.415], [], 1, "CAN_COLLIDE"];
        sleep 0.05;
        PERISIK2 setPosASL [3616.062, 7562.843, 3.415];
        PERISIK2 setUnitPos "UP";
        PERISIK2 disableAI "MOVE";
        PERISIK2 setDir 72;
    
    };
};

i got an error saying _mscIDs undefnied variable in expression. It went well for case "001". when it is time for case "002", the error shows up

#

when using execVM before converting multiSpawnCall.sqf to a function, it does not work but does not even shows any error

winter rose
#

execVM call?

still forum
#

execVM call syntax error

winter rose
#

@grave stratus use the -showScriptErrors flag in the launcher please

grave stratus
#

🤦 🤦 🤦 🤦

#

how did i missed that

#

@winter rose flag?

winter rose
#

flag.

Tick a "show script errors" box

grave stratus
#

in parameters tab?

#

ah okay found it

#

thanks

grave stratus
#

@winter rose what does it do? i dont see any different apart from the usual script error box

winter rose
#

So maybe you had it already somehow. It shows script errors

still forum
#

Eden has force enabled

tough abyss
#

execVM call "description.ext"

winter rose
#

Ah, didn't know about that in Eden

#

(got it always on, hahaha)

grave stratus
#

oh

#

btw, i fixed the command to ["002"] call HKB_fnc_multiSpawnCall;, still doesnt spawn enemy unit like it supposed to. case 001 is fine.

bold bane
winter rose
#

not gonna work, private vars are used across different scopes

grave stratus
#

so i cant use params then?

winter rose
#

@bold bane this faulty code really cannot work, don't use it.

grave stratus
#

i thought private vars only for innermost scope?

winter rose
#

@bold bane

private _bombTimer = 3 * 60; // 3 minutes
bombObject setVariable ["defused", false, true];

bombObject addAction ["Defuse me", {
    params ["_bomb"];
    _bomb setVariable ["defused", true, true];
    hint "bomb defused";
}];

[] spawn {
    while {sleep 1 ; not (bombObject getVariable "defused") } do
    {
        _bombTimer = _bombTimer - 1;

        if (_bombTimer <= 0) exitWith {
            for "_i" from 1 to 4 do { // change number for more booms
                "R_60mm_HE" createVehicle position bombObject;
            };
        };
    };
};```
#

@grave stratus addAction code is a separated scope

grave stratus
#

but im not using addAction

winter rose
#

not gonna work, private vars are used across different scopes
was aimed at Ustio

grave stratus
#

ah

#

that addaction is also for ustio right

winter rose
#

…I @'d him

finite dirge
#

No, you didn't.

#

Well you did, but both of them.

winter rose
#

FACEPALM (╯°□°)╯︵ ┻━┻

grave stratus
#

hah

bold bane
#

Wow @winter rose thanks a bunch

winter rose
#

@grave stratus @grave stratus @grave stratus
show your code again?
( @finite dirge )

finite dirge
#
execVM compileFinal call spawn ITGH_fnc_winGame;
winter rose
#

I like execVM compileFinal call spawn "description.ext" more

finite dirge
#

True.

#

Gotta put my function in there. That's truely how ARMA wants it. Works 100% of the time everytime.

winter rose
#

it works all the time 60% of the time*

grave stratus
#
[ WEST, "Task002_01", ["Perisik Leftenan Akram di Bandar Komarovo.", "Cari Perisik.", "Cari Perisik"], [3637.699,7591.825,0], TRUE ] call BIS_fnc_taskCreate;
        
if (isServer) then {
    sleep 1;
    ["002"] call HKB_fnc_multiSpawnCall;
    };

fn_multispawnCall.sqf

params ["_mscIDs"];

switch (_mscIDs) do {

    case "001": {
        
        [East,[2039.222, 7379.76, 0],"O_T_Soldier_F",5,[1948.333, 7369.368, 0],[1833.130, 7339.478, 0],[1703.357, 7324.028, 0]] call HKB_fnc_task001SG;
        [East,[1909.678, 7372.375, 0],"O_T_Soldier_F",2,[1909.678, 7372.375, 0],[1834.790, 7424.806, 0],[1762.071, 7472.087, 0]] call HKB_fnc_task001SG;
    };
    
    case "002"; {
        
        sleep 1;
        [East,[2958.123, 7118.643, 0],"O_T_Soldier_F",5,[2958.123, 7118.643, 0],[3058.665, 7157.612, 0],[2938.392, 7234.15, 0]] call HKB_fnc_task002SG;
        [East,[3728.521, 7609.846, 0],"O_T_Soldier_F",5,[3728.521, 7609.846, 0],[3643.559, 7592.115, 0],[3566.231, 7569.459, 0]] call HKB_fnc_task001SG;
    
    };
};

fn_task002SG.sqf
https://pastebin.com/w7h6Bk24

#

it does create the task but it doesnt spawn

#

before that happens, spawn in case "001" was working fine

winter rose
#

while {_looper < _manCount} do {

might be an issue, idk? where does the code run, where does the code stop

grave stratus
#

the code stop after spawning

#

init.sqf

["001"] call HKB_fnc_tasker;

fn_tasker.sqf

params ["_taskIDs"];

switch (_taskIDs) do {
    
    //Task001
    case "001": {
        [] execVM "Semboyan\Task\001.sqf";
    };
    
    //Task002
    case "002": {
        [] execVM "Semboyan\Task\002.sqf";
    };
    
};

001.sqf - https://pastebin.com/h3gkVvgw

#

at the end of 001.sqf, it call for ["002"] call HKB_fnc_tasker;
that is where it start

winter rose
#

identify the blocking point and tell us

grave stratus
#

it is after ["002"] call HKB_fnc_tasker;
where it supposed to create task, which is working,

#

then call for the spawn

#

which is not happening, but no error shown

#

002.sqf

[ WEST, "Task002_01", ["Perisik Leftenan Akram di Bandar Komarovo.", "Cari Perisik.", "Cari Perisik"], [3637.699,7591.825,0], TRUE ] call BIS_fnc_taskCreate;
        
if (isServer) then {
    sleep 1;
    ["002"] call HKB_fnc_multiSpawnCall;
    };
winter rose
#

001.sqf, "002", "_mscIDs", HKB_fnc_task001SG…
that's a great way to organise your code… NOT

#

it's hard to tell what does what where

#

(btw)

grave stratus
#

thats the best i can do for now

#

i just learnt how to use function library

winter rose
#

so:
["001"] call HKB_fnc_tasker;

[] execVM "Semboyan\Task\001.sqf";

(…)

yeah no I don't debug that sorry.

#

place diag_log or systemChat to see where it stops or gets stuck in an eternal loop, and tell us here the precise point that blocks exec

grave stratus
#

okay

winter rose
grave stratus
#

so it stop between 002.sqf ->

[ WEST, "Task002_01", ["Perisik Leftenan Akram di Bandar Komarovo.", "Cari Perisik.", "Cari Perisik"], [3637.699,7591.825,0], TRUE ] call BIS_fnc_taskCreate;
        
if (isServer) then {
    sleep 1;
    systemChat "msccallreturn";
    ["002"] call HKB_fnc_multiSpawnCall;
    systemChat "msccallreturn2";
    };

and fn_multiSpawnCall.sqf

params ["_mscIDs"];

switch (_mscIDs) do {

    case "001": {
        
        [East,[2039.222, 7379.76, 0],"O_T_Soldier_F",5,[1948.333, 7369.368, 0],[1833.130, 7339.478, 0],[1703.357, 7324.028, 0]] call HKB_fnc_task001SG;
    };
    
    case "002"; {
        
        systemChat "mscreturn";
        [East,[2958.123, 7118.643, 0],"O_T_Soldier_F",5,[2958.123, 7118.643, 0],[3058.665, 7157.612, 0],[2938.392, 7234.15, 0]] call HKB_fnc_task001SG;
        [East,[3728.521, 7609.846, 0],"O_T_Soldier_F",5,[3728.521, 7609.846, 0],[3643.559, 7592.115, 0],[3566.231, 7569.459, 0]] call HKB_fnc_task001SG;
    };
};

where systemChat "mscreturn"; doesnt goes off

#

systemChat "msccallreturn1" & "msccallreturn2" in 002.sqf is working fine.

ruby breach
#

Because you have case "002";

#

not case "002":

winter rose
#

*ding ding ding* we have a winner!

grave stratus
#

FINALLY!

#

sometimes can't see it in notepad++

ruby breach
#

Not sure how long that's been there unnoticed, I just kinda scrolled to the bottom. lol

grave stratus
#

well long enough for me

#

feeling burnout from learning and writing script for days

winter rose
#

stop for a while before diving back in

grave stratus
#

yeah i guess i'll take a break tomorrow

winter rose
#

also, staying on one problem for too long is not efficient; if you block for ½h, just switch to something else then come back to it

#

benefits: fresher head, reduced stress, new eyes on the issue

grave stratus
#

well actually i planned to take a break after this code is done, didnt know its going to take me a whole day just to solve this.

#

anyway thanks @winter rose and @ruby breach

#

awesome

thorn mural
#

Is it possible that you can take an empty magazine out of your weapon and store it in your inventory ? Because when i take an empty magazine out of my weapon and put it in my inv it instantly gets removed, but if i put it on to the ground first and then pick it up it remains in my inv. Just wanted to ask if thats a bug or intention

tough abyss
#

Intentional, you can mod it so empty mags don’t disappear

thorn mural
#

i think you get me wrong, they don't disappear, even though they should

#

but only if you put the empty mag on to the ground

#

if you put it in your inv it disapperas as it is supposed to

tough abyss
#

You asked is it possible to make empty mags not disappear when you put them in inventory, the answer is yes, you can make a mod

silent latch
#

@ruby breach is a very epic gamer and helps the people a ton

thorn mural
#

My question refers to magazines not being removed when they should to, sorry if i expressed myself a little unclear there

#

i just want to know if it's feature that you can drop empty magazines on the ground, without them being deleted

#

because if you put them directly in your clothing they do get deleted

exotic tinsel
#

Does anyone have a good script for detecting when another player does not kill but only "INCAPACITATED" another player? i cant find a reliable one on the webs.

grave stratus
#

if i set a variable to a civ, if it die, would it delete the variable as well?

exotic flax
#

by default yes

#

as in; a dead unit still contains the variable, but the moment it respawns or gets picked up by the garbage collector you lose the unit and therefor the variable connected to it

#

so if it's mission specific, I would connect set a variable to the missionNamespace instead.
eg.

missionNamespace setVariable ["some_variable_UNITNAME","some_value"];
grave stratus
#

@exotic flax ah i want to lose the variable, i am just wondering if i have to delete it manually after the unit get picked up by the garbage collector

frozen knoll
#

if you run deleteVehicle on a unit then the unit variable will return <NULL-Object>

#

to test you could check if variable is nil by running

#

if (isnil {missionNameSpace getvariable "YOURVARIABLE"}) then {systemChat "nil man";} else {systemChat "not nil";};

#

i havnt looked in garbage collector hence that test would be best as after using deleteVehicle YOURVARIABLE; the variable wont be nil and you can make it nil by using YOURVARIABLE = nil;

still forum
#

to test you could check if variable is nil by running
nil != null

cold pebble
#

Hi all, I'm trying to create some ambient wildlife but when the animals spawn they don't move, the server executes this, and number and origin are both defined. The animals spawn fine, but then they don't move, does anyone know why?

params [
    ["_number",1,[0]],
    ["_origin",[],[[]]]
];

private _animals = ["Sheep_random_F","Goat_random_F","Hen_random_F","Cock_random_F","Rabbit_F"];

for "_i" from 0 to _number do {
    private _type = selectRandom _animals;
    private _position = _origin getPos [250 * sqrt random 1, random 360];
    private _animal = createAgent [_type,_position,[],0,"NONE"];
    _animal setDir (random 360);
};
still forum
#

well you don't ever tell them to move

#

Arma has a animal FSM I think. Or maybe SQF

#

that needs to run on the animal

cold pebble
cold pebble
#

Confusingly, if I execute that code in debug using server exec, the animals spawn and start moving 🤔

#

Well, I delay the spawning by 30 seconds and now they move 🤔

winter rose
#

Ah, yes, some delay may be required for agents, I met that once

waxen tendon
#

is it possible to denote a string without 'apostrophes' or "quotes"?

winter rose
#

in code you mean?

waxen tendon
#

yes

winter rose
#

…why

still forum
#

Yes

waxen tendon
#

i am trying to send out srtings from a diary record link

still forum
#

{string} 😄

waxen tendon
#

the expression is already in quotes and apostropes

#

tried that {string}

#

didnt seem to work

still forum
#

Yeah was semi joke-ish.
Parser handles "'{ as strings

winter rose
#

Maybe a preprocessor define

still forum
#

can you send example script of how it would look?

waxen tendon
#

1 sec

winter rose
#

You can double the quotes @waxen tendon

waxen tendon
#

""string""?

winter rose
#
private _myString = "this is a ""quoted"" string";```
waxen tendon
#
player createDiaryRecord ["Important Subject", ["Open this tab", "<execute expression = '[{string}] call fnc_doStuff'>Click here!</expression>"]]```
@still forum
winter rose
#

""

waxen tendon
#

ill try

#

error type any, expected string

#

nvm works, thank you @winter rose @still forum

winter rose
#

@brittle burrow do you know how to spawn normal units?

brittle burrow
#

yes

#

only with the hexagon things

winter rose
#

re-reading your request, what do you want to do?

make a mod spawn units, or spawn mod units?

brittle burrow
#

spawn mod units

winter rose
#

then spawn them the same way as normal units, but with their class name

brittle burrow
#

how to ad their name to the spawner

winter rose
#

Copy/Paste to the class list

brittle burrow
#

hmm wait

#

i start the editor

#

do i just type their names on the init

winter rose
#

do you have the mod installed

#

if so, then they are in the right-side unit list somewhere (you can filter by mod)

brittle burrow
#

i can see it

#

but not in the attribute of the spawner

#

now how do i make it spawn that unit

winter rose
#

"the spawner"

#

what the hell is even that!

brittle burrow
#

that hexagon thing

#

spawn ai

winter rose
#

Well maybe if you twiddle that other stuff it will work

brittle burrow
#

ill try

#

thanks

winter rose
#

. . . 👍

grave stratus
#

i am trying to make a civi ai do a animationg to treat wounds. so i put this in the init of the unit this playMove "Acts_TreatingWounded02"; is playMove the wrong command? nothing is happening

winter rose
#

try switchMove

#

playMove cannot play animations that do not have a "transition path" from the current unit animation.

"Acts_" means Cutscene, and most of the time these anims don't have a transition from "normal state" to them

grave stratus
#

tried that too, same result

winter rose
#

ah

#

and not in the unit's init

grave stratus
#

oh its must be script?

#

_unit switchMove "Acts_TreatingWounded02";

winter rose
#
0 = this spawn { sleep 0.1 ; _this switchMove "xxx" };```
#

is this stuff MP?

grave stratus
#

yes

winter rose
#

stuff in init is run on every connecting client; so ideally don't

if you only know that, use some isServer

grave stratus
#

yes i know that, as you have told me before

#

im just trying out the code

winter rose
#
if (isServer) then {
    this spawn {
        sleep 0.1;
        _this switchMove "Acts_TreatingWounded02";
    };
};```
grave stratus
#

im not going to put it in a script but just to test the animation, i put it in the unit box

winter rose
#

ok then

#

works?

#

@grave stratus

grave stratus
#

nope

#

im gonna try from the script instead

#

see if it works

potent depot
#

Anyone happen to know if there is a way to check if a unit has a forced speed? Trying to check if a unit is garrisoned by Achilles.

winter rose
#

a getForcedSpeed doesn't exist afaik

potent depot
#

yep or at least its not in the biki

#

and i would rather not have to make a custom version of the garrison module if i can avoid it.

winter rose
#

so it has to exist!

#

I can create the page if you want 😄

potent depot
#

is there actually a command that isnt documented?

winter rose
#

well, none as far as I know ¯_(ツ)_/¯

potent depot
#

lol, yeah my problem atm is that when transferred to HC the forcespeed seems to reset

#

which makes our zeuses unhappy

winter rose
#

even limitSpeed doesn't have a getter

you can still set/getVariable, eventually

potent depot
#

yeah, thats likely going to be the workaround, make a new garrison module and add a variable to the group that gets checked when it transfers

#

was just wondering if there was any other way.

#

though i have no idea why forcespeed gets reset when transferred unless its only enforced on the zeus's end since they are the ones processing

winter rose
#

yep, dunno

potent depot
#

rip simplicity

winter rose
#

Why the usage of forceSpeed btw? @potent depot

grave stratus
#

@winter rose i've tried both in the init box and script, both playMove and switchMove, does not do anything.

#
_newGroup = CreateGroup civilian;
_newciv = _newGroup createUnit [C_Man_Fisherman_01_F, [3641.039, 7534.907, 0.631], [], 1, "CAN_COLLIDE"];
_newciv setPosATL _spawnPos;
_newciv setDir _dir;
//_newciv setUnitPos _states;
_newciv switchMove "Acts_TreatingWounded02";    
potent depot
#

Achilles garrison uses force speed when it garrisons the units to keep them from moving

#

It’s a mod that expands the Zeus toolbox

digital hollow
#

You could force the transfer first, then garrison?

exotic tinsel
#

Is there a way to get the servers actual real Date? not in game date

umbral cliff
#

Hi everyone

#

Is there any way to read the whole config file from the ingame by the script? Or at least a certain sub-class. And write it somewhere, to the clipboard, rpt file or else

finite dirge
umbral cliff
#

I'm looking for some special subclasses in the Livonian config, but it can't be opened directly because of ebo format

#

3Den's config viewer shows these parameters separately, this is not so convenient

#

{configfile >> "CfgWorlds" >> "Enoch"} returns just a config.bin name

exotic tinsel
#

@finite dirge thanks

tough abyss
dusky pier
#

i'm trying with script - take weapon from car with accessories

#

but i when i'm trying to take weaponsItems (objectParentPlayer) - i'm getting only ```
[["CarHorn","","","",[],[],""]]

#

when i see to car inventory - weapon have accessories

#

ah, i find the reason xD

exotic tinsel
#

@dusky pier objectParentPlayer returns the object the player is attached to so in this case a car. it doesnt get accessories to a weapon.

dusky pier
#

weaponsItemsCargo return accessories

exotic tinsel
dusky pier
#

i have tryed and is working for now

#

@exotic tinsel ty, i understand that. My unit seat in vehicle, script is take weapon from vehicle gear

vernal venture
#

So, if you wanted a bunch of random dead bodies, what would you guys use? I find that setDamage 1 puts all the bodies in the exact same pose, no matter how I use it

frozen knoll
#

@grave stratus _newciv playMove "AinvPknlMstpSlayWrflDnon_medic";

tough abyss
#

hey all if i want to get player currentWeapons (in vehicle) and how much ammo it has remaining how can i get that data?

#

i want to make an alternative hud

frozen knoll
#

weaponsTurret & magazinesTurret

#

even weaponState will do it

grave stratus
#

@frozen knoll oh it doesnt playMove properly because of the move is for cutscene?

frozen knoll
#

the above animation works

exotic tinsel
#

Is it possible to hide all player and ai postions on map via script? I dont want to modify the profile.

grave stratus
#

@frozen knoll thanks it works. now i wonder how to loop the animation until a certain condition is met

waxen tendon
#

is it possible to forEach for get commands and write all answers to an array?
eg.sqf {_x call fnc_isCaptured} forEach arrayZones

#

fnc_isCaptured would return true or false

cosmic lichen
waxen tendon
#

thanks

velvet merlin
exotic flax
#

it's more about radioChannelCreate, which can be useful if you want to have more different channels (eg. "AirChat", "BaseChat", "SupportChat", etc.)

#

similar to ACRE/TFAR where people use different channels/frequencies for specific purposes

tough abyss
#

customChat allows to custom add units you want to see the same chat where as other chats have specific groups hardcoded

velvet merlin
#

i see. one has to transmit the chat message manually, unless its predefined text, right?

#

in more general terms looking for ways to separate player chat from system messages (MP)

#

the only way i know to do this is to intercept the chat input, transmit that manually over net and display it again - however the different channels, desc.ext options etc make this fairly complex

tough abyss
#

Custom chat is just like systemchat, but will only be shown to added units. And you need remote executing it globally. Might as well use remote exec with specific targets and systemchat to save headache of setting up custom chat

exotic flax
#

but if you use radioChannelCreate all units who have access to it can also use it to chat over this channel

velvet merlin
#

with systemChat one would need to make the sender name part of the chat message, right?

exotic flax
#

yes, because it's not send by a unit

velvet merlin
#

with custom chat channels one could determine how sees it, but isnt it more simple just to pV to the needed clients or handle the receiving logic locally?

exotic flax
#

Custom channels works just like GroupChat, all units connected to this channel can send/receive over it.

velvet merlin
#

well you need to adjust channel participants, so you can handle it by other means locally/on each receiver, no?

exotic flax
#

In theory yes, but you are limited by the amount of custom channels you can add.

#

so depending on what you try to achieve you most likely need SystemChat or a custom Hint system

velvet merlin
#

well as said to decouple the chat display from system messages

#

the only other alternative i can see would need the ability to intercept incoming chat message/manipulate the chat display control

#

(which would need some engine change/sqf cmd)

fluid wolf
#

Is there a way to denote a square area, and everyone inside it?

#

Like, create a square area and then do like nearestobjects it somehow to get only things inside it

waxen tendon
#

how do i return answer from a function

still forum
#

the last value left on the stack is the return value

waxen tendon
#

so fnc_test = { if (true) then {"lets go"} }

#

would return "lets go"?

exotic flax
#

yes

#

although I also noticed the following:

fnc_test = {
    if (true) then {
        "good"
    };
    "bad"
};

Will always return "bad"

#

so if you need a default, use a return variable:

fnc_test = {
    _return = "bad";
    if (true) then {
            _return = "good";
    };
    _return
};
waxen tendon
#

neat

#

thanks

random crescent
#

Obviously that will return "bad"

#

It's the last statement

#

You can either use exitWith or else

#

exitWith exits the current scope. A scope is equivalent to a code block enclosed in curly braces.

leaden venture
#

Does anyone know how to disable an aircraft's targeting pod?

winter rose
#

the only commands I find are
hasPilotCamera, getPilotCameraPosition, getPilotCameraDirection, getPilotCameraRotation, getPilotCameraTarget, setPilotCameraDirection, setPilotCameraRotation, setPilotCameraTarget

IDK if one can disable it (maybe breaking it with setHitPointDamage!)

#

@leaden venture try to find a hitpoint with getAllHitPointsDamage and damage the pod fully

leaden venture
#

Yeah I'd really like to remove that thing

copper raven
#

so if you need a default, use a return variable:
exitWith

strange elk
#

@still forum

#

is there a debug console script to restore my rocket launcher ammo?

#

i tried in the mission editor but I click "Triggers" and no box opens with trigger lists.

velvet merlin
frozen knoll
#

im using

disableChannels[] = {{0, false, true},{2, true, true }};

works perfectly

velvet merlin
#

what tool do you use to build the mission/pbo?

frozen knoll
#

use

#

#define true 1
#define false 0

#

at top and its fine

velvet merlin
#

yep with defines its fine

frozen knoll
#

and as u asked "what tool do you use to build the mission/pbo?" definitely depends on that as some you dont need to define some you do

strange elk
#

@velvet merlin

#

any idea why It isnt working?

#

i hit
Local execute on a single player mission and it isn't restoring my ammo.

winter rose
#

have you checked the wiki for the commands you use @strange elk ?

strange elk
#

yes

#

ive tried

#

EVERYTHING

winter rose
#

… except the proper, working code 😄

strange elk
#

i was told to put the gun in ""

#

tried that also

#

never changed the ammo count

#

i literally copied the line from the wiki

winter rose
#

(also, "you're done for")

Yeah well, launchers are a bit different

Their "magazine" is 1-bullet, and gets discarded as soon as it is fired so you can't set its ammo (no more mag)

You can add a magazine to the player though (maybe to the weapon itself, I am not too sure about that)

strange elk
#

pulled an all nighter trying to figure this out

#

YAYYYY finally it worked:)

winter rose
#

👍
which code did you use in the end?

strange elk
#

add magazine

winter rose
#

noice. to the weapon itself? I can't remember if one can directly insert a magazine into a weapon by script (or if you still have to remove/readd weapon)

tough abyss
#

any idea why It isnt working?
Syntax error

dusty basalt
#

hey i'm new to scripting, i'm trying to create a trigger that forces players into first person while they're in the zone, would anyone be able to help or point me in the direction of some good learning material? seems very hard to find

tough abyss
#

Add player switchCamera "INTERNAL" into on activation but it will do it once and player would be able to switch back

still forum
#

@strange elk

#

yes

velvet merlin
#

can one disable chat displayed on clients fully with enableChannel or setCurrentChannel? i am seeing different statements on this in discord here, BIKI and BIF

like with

addMissionEventHandler [
    'EachFrame',
    {
        if ((getPlayerChannel player) in [0,1]) then {
            setCurrentChannel 5;
        };
        if (currentChannel in [0,1]) then {
            if (!isNull (findDisplay 55)) then {
                setCurrentChannel 5;
            };
        };
    }
];```
or
```sqf
while{true} do {
    waitUntil{getPlayerChannel player < 3 && getPlayerChannel player > -1};
    setCurrentChannel 5;
};```
winter rose
#

oh, didn't know this issue on disconnection/reco

#

put some enableChannel in the init.sqf then? that's how I would do it

velvet merlin
#

some people say it cant block global and sideChat/groupChat

plain current
#

Any way/script to see which pbo an asset is loaded from?

young current
#

I dont think so

#

but pbo names dont mean anything to the engine

tough abyss
#

You can hide chat with showChat @velvet merlin

velvet merlin
#

reading different things about it again when searching BIKI, BIF and discord 😬

does it hide only player chat messages? what about admin (logged/voted)?
system messages (MP or BE) are still shown right?
what about AI radio messages?

tough abyss
#

Probably everything

spice axle
#

What would be the best workaround for disabling the map marker on the side chat? I haven’t read all messages but if enableChannel has bugs what I should do?

ivory lake
#

is there a simple way to convert a string to structured text and change special characters like & to the appropriate &amp;

#

apart from doing a replace loop

tough abyss
#

Convert special chars no, convert string yes, just use text

ivory lake
#

yeah more need the special char aspect 😦 just looking to sanitize briefingname output

tough abyss
#

I don’t think text takes any notice of special chars

ivory lake
#

I tried it and it just made the string cut off at the first &

dull drum
#

Hi guys! Any ideas on how to make AI unit to run and shoot simultaneously? I now can make them run (through Zeus waypoint placement) and then shoot or vice versa (depends on when I apply while loop - before or after waypoint movement).

ivory lake
#

but that might have been parsetext

tough abyss
#

And other text commands?

ivory lake
#

(like it was going through parsetext after it)

tough abyss
#

Yeah parsetext would do that

strange elk
#

player allowDamage false;

#

why does this not work? ^

#

i did it in singleplayer btw.

still forum
#

where you execute?

strange elk
#

in game

#

does it need to be done via init in the editor?

still forum
#

"in game" yeah.. all scripts run ingame

#

where, how?

#

debug console?

#

tried adding logging to make sure its really running?

#

like drop a chat message or so (not sure if they show up in SP)

strange elk
#

@still forum i ran it in the debug console

#

but a YT video showed it placed in init box via editor

still forum
#

console should work just fine

strange elk
#

lemee see if it worked

strange elk
#

@still forum Hey one other question

#

what key did I press as my character is locked looking one direction and I cant turn him in any other direction.

tough abyss
#

Double Alt?

strange elk
#

hmm?

#

i believe so

#

@tough abyss it was the issue?

#

how can I disable that keybind?

tough abyss
#

Like any key bind in options controls

strange elk
#

is it "Freelook"

#

?

steel ferry
#

More than likely

#

Free look allows you to move your head but not your gun

strange elk
#

found it.

tough abyss
#

Try it and don’t ask million questions

strange elk
#

@still forum ok so i just died.

#

the immortal thing didnt work.

tame lion
#

does anyone know of a command that can find the parent display of a control? Similar to displayParent but for controls and not displays?

astral dawn
#

At least I think so!

thorn saffron
#

question: can you play character animations on dead bodies?

austere granite
#

no

tough abyss
#

Sure you can

young current
#

so which one of these answers is true

tame lion
#

thanks @astral dawn that is exactly what I needed

tame lion
#

so now i have another question, I have a control group in a UI that I want to be forced to scroll back to the top of its height. How would I go about doing that?

astral dawn
#

I have no idea but better move that question to #arma3_gui

#

@tame lion

jolly wolf
#

hello~I typed the script file in and init.sqf

#

I want to use Pierre MGI. But what should I enter variables for an object?

fleet sand
#

@jolly wolf create the script called MGI_HALO.sqf create it inside your mission name.nameofthemap and then just put this in init file of the objects _halo_jump =[500,100,this] execVM "MGI_HALO.sqf";

austere hawk
#

got an error with my vehicle init Eventhandler script (defined in config) I want to hide/unide some stuff based on config settings. This worked since many months. Now i added some new option to it and i get error

Error in expression <_this animate ["hide_conf_EA_front", 0];, 
_this animate ["hide_conf_EA_front_ha>
  Error position: <, 
_this animate ["hide_conf_EA_front_ha>
  Error Invalid number in expression```
#

ah nvm, i put comma after the semicolon 😄

#

weird how you can look for the error for minutes going back and forth... think you hit a wall. The moment you post it somewhere you see the error...

winter rose
#

Coined as rubber duck debugging

tough abyss
#

Hi, anyone can tell how i can do to disable damage in water?

young current
#

for what?

winter rose
#

you can't kill water in Arma 😄

tough abyss
#

No just want to prevent or disable drowning.

young current
#

scuba gear is for that

tough abyss
#

😂

young current
#

Im not sure if you can even do what you want

winter rose
#

"set oxygen remaining", you can

#

but a loop has to be done

tough abyss
#

Thanks i'm checking this right now.

tough abyss
#
player addEventHandler ["SoundPlayed", 
{ 
    params ["_unit", "_soundID"]; 
    if (_soundID == 8) then { _unit setOxygenRemaining 1 };
}];

@tough abyss will increase oxygen every time player is about to choke

dull drum
#

rokuninYesterday at 5:30 PM
Hi guys! Any ideas on how to make AI unit to run and shoot simultaneously? I now can make them run (through Zeus waypoint placement) and then shoot or vice versa (depends on when I apply while loop - before or after waypoint movement).

Anyone? 🙂

tough abyss
#
0 = this spawn {for "_i" from 1 to 100 do {[_this, currentmuzzle _this] call BIS_fnc_fire; sleep 0.1}}; this playmove "amovpercmtacsraswrfldf"; this playmove "amovpercmtacsraswrfldf";this playmove "amovpercmtacsraswrfldf"; this playmove "amovpercmtacsraswrfldf"; this playmove "amovpercmtacsraswrfldf";

try this

lapis viper
dull drum
#

@tough abyss that actually did work wonderfully, thank you sir!

young current
#

@lapis viper no it does not cope with objects very well.

lapis viper
#

@young current very well. Thank you for information!

young current
#

I mean as far as I know, it's purpose is to find a objectless space.

grave stratus
#
_animate = true;

_newGroup = CreateGroup civilian;
_newciv = _newGroup createUnit ["C_Man_1", [9423.552, 9228.516, 0.502], [], 1, "NONE"];
_newciv setPosATL [9423.552, 9228.516, 0.502];
_newciv setDir 126;
_newciv    setUnitPos "UP";
_newciv disableAI "MOVE";

if (_animate) then {
    while {true} do {
            _newciv switchMove "AinvPknlMstpSlayWrflDnon_medic";
            waitUntil {animationState _newciv != "AinvPknlMstpSlayWrflDnon_medic"};
        };
};

any one know how to properly loop an animation? i googled a few solution (this and using EH) but both of them seems not looping it properly.

astral dawn
#

isn't there some playMove command which adds the animation into the queue?

exotic flax
#

playMove adds them to a queue (so will only execute when the previous animation is done)
playMoveNow will execute directly and replaces the queue

grave stratus
#

both playMove and switchMove does not execute the loop properly, only execute it once

outer fjord
#

Is there any event handler, or recommendation way of knowing if it's raining or not?

finite dirge
#

nextWeatherChange and then checking rain when it changes could work.

#

Not sure on an EVH.

tough abyss
#

There is no event handler

finite dirge
#

Thanks for the confirmation!

tough abyss
#

addRainEventHandler ["BloodyRaining", {}];

finite dirge
#
player addEventHandler ["isWet", {
    params ["_unit", "_wetness"];
}];

^ The true EVH we need ABlobHaha

modest rapids
#

I'm trying to get use the civilian presence module to spawn civilians from unsung, but for some reason identities aren't working _this setUnitLoadout (selectRandom [ (getUnitLoadout "uns_civilian1"), (getUnitLoadout "uns_civilian2"), (getUnitLoadout "uns_civilian3"), (getUnitLoadout "uns_civilian4"), (getUnitLoadout "uns_civilian1_b1"), (getUnitLoadout "uns_civilian1_b2"), (getUnitLoadout "uns_civilian2_b1"), (getUnitLoadout "uns_civilian2_b2"), (getUnitLoadout "uns_civilian3_b1"), (getUnitLoadout "uns_civilian3_b1"), (getUnitLoadout "uns_civilian3_b2"), (getUnitLoadout "uns_civilian4_b1"), (getUnitLoadout "uns_civilian4_b2")]); [_this, selectRandom ["AsianHead_A3_01","AsianHead_A3_02","AsianHead_A3_03","AsianHead_A3_04","AsianHead_A3_05","AsianHead_A3_06"]] remoteExec ["setIdentity", 0, _this];
their loadouts spawn fine

tough abyss
#

why do you need to get all loadouts and then select one if you can select unit and THEN get loadout for it

#

As for Identity, a head name is not identity, identity is a class for example

class SomeGuy
{
    face = "WhiteHead_10";
    glasses = "G_Tactical_Clear";
    name = "Adams";
    nameSound = "Adams";
    pitch = 1.0;
    speaker = "Male01ENG";
};
#

you want setFace

modest rapids
#

ah that'd probably be why

#

i was just copying the wiki pretty much

#

didnt realise it wasn't head names

winter rose
#

probably

astral tendon
#

How to make a entry to my missions file to escape the "no entry" errors?

finite dirge
#

Where are those coming from? Some mod?

astral tendon
#

yes, is just anoying

finite dirge
#

You'd need to fix the configs in that mod.

astral tendon
#

no other way to fix on my side?

#

even if is just a null value?

finite dirge
#

You may be able to create your own mod and override the config, but otherwise, no.

rustic brook
#

Hey, I'm having an issue in a script where it isn't grabbing the list box that I want it to. The script is acting as if the list box doesn't exist.

_listBoxIDC = 1500; // IDC of our list box

_index = lbCurSel _listBoxIDC;

systemChat format ["index = %1", _index];

_vehClass = lbData [ _listBoxIDC, _index ]; // retrieve the data (previously set) from the listbox's currently selected index

if (_index == -1) exitWith {hint "No vehicle selected to buy"}; // Make sure the player selected a box

// Attempt to buy the vehicle //////////////////
closeDialog 0; // This was lowercase before 'action = "closedialog 0; nul = [vehSDKBike] spawn A3A_fnc_addFIAveh";'
systemChat format ["Veh Class: %1 | index = %2", _vehClass, _index];
[_vehClass] spawn A3A_fnc_addFIAveh;
#

whereas I have another file that populated the list and I can read the data from the list just fine.

#

The script above only returns -1 for index

#

Do I need to reference this script in a header file?

astral dawn
#

-1 means nothing is selected

#

try alternative syntax of lbCurSel maybe

#

also make sure that control really exists (finddisplay ... displayCtrl 1500)

rustic brook
#

I tried the alternate control earlier - will try to see if it exists

astral dawn
#

yes just diag_log the control

#

it will return something meaningfull or controlNull if it couldn't find it

rustic brook
#

will this work? I'm fairly new to the arma language.

_control = findDisplay displayCtrl 1500;
systemChat format ["control: %1", _contorl];
astral dawn
#

Check parameters... no it's wrong, findDisplay gets a display IDD

#

where are you creating your control? it should belong to some display

rustic brook
#

yes it has an idd of 9999

astral dawn
#

Then
_ctrl = (findDisplay 9999) displayCtrl 1500;

rustic brook
#

I see

#

the printed result was 'any'

rustic brook
#

this is in my header

class BUY_Menu{
    idd = 9999;
    movingEnabled = false;

    class controls{
        ////////////////////////////////////////////////////////
        // GUI EDITOR OUTPUT START (by theav, v1.063, #Lemiqy)
        // Shift + CTRL + S for export ***********************
        ////////////////////////////////////////////////////////

        // was IGUIBack
        class BUY_Background: BOX
        {
            idc = 2200;
            x = 0.29375 * safezoneW + safezoneX;
            y = 0.225 * safezoneH + safezoneY;
            w = 0.4125 * safezoneW;
            h = 0.55 * safezoneH;
        };
        class BUY_List: RscListbox
        {
            idc = 1500;
            x = 0.304062 * safezoneW + safezoneX;
            y = 0.335 * safezoneH + safezoneY;
            w = 0.391875 * safezoneW;
            h = 0.33 * safezoneH;
        };
        class BUY_BuyBtn: RscButton
        {
            idc = 1600;
            text = "Buy"; //--- ToDo: Localize;
            x = 0.304062 * safezoneW + safezoneX;
            y = 0.687 * safezoneH + safezoneY;
            w = 0.391875 * safezoneW;
            h = 0.066 * safezoneH;
            action = "closeDialog 0; nul=[] execVM ""jacobGUI\buy_selected.sqf""";
        };
        class BUY_ExitBtn: RscButton
        {
            idc = 1601;
            text = "Close"; //--- ToDo: Localize;
            x = 0.597969 * safezoneW + safezoneX;
            y = 0.247 * safezoneH + safezoneY;
            w = 0.0928125 * safezoneW;
            h = 0.066 * safezoneH;
            action = "closeDialog 0;"
        };
        ////////////////////////////////////////////////////////
        // GUI EDITOR OUTPUT END
        ////////////////////////////////////////////////////////
    }
}
tough abyss
#

the printed result was 'any'
Because you misspelled _control

slate ferry
#

Hey there, iam looking for help. I try to limit this script to a maximum range of 3 meters between player and victim but i dont get the syntax. It uses ACE medical. How do i use "distance cursortarget" in this array? Can anybody help me please?

[cursorTarget, 1, "head", "stab"] call ace_medical_fnc_addDamageToUnit

winter rose
queen cargo
#

@slate ferry
simple stuff from the basics of scripting

if (cursorTarget distance player <= 3) then {
    ...
};```
slate ferry
#

Thank you X39. Iam a beginner and try to learn.

queen cargo
jaunty ravine
#

Anyone know how I through BIS_fnc_spawnVehicle can set a spawn height?

finite dirge
#

Would that not be in the position array?

#

If you are getting the height from a marker, use set and set a height.

jaunty ravine
#

How exactly do I set a height for a marker?

finite dirge
#
private _spawnPos = (markerPos "myMarker") set [2, _zValue];
jaunty ravine
#

Thank you!

velvet merlin
#

is there perf gain to disable simulation of wreck objects? (mission object - not destroyed vehicles)

astral dawn
#

you mean a vehicle which was destroyed due to damage?

#

or just a plain model of a wreck, like the ones you can find in eden?

finite dirge
#

Don't some of those have animations and sounds?

jolly bone
#

Perhaps this is a very basic question but is there any simple way to refer to a specific player on the server in a script (to be executed in console) without knowing the id for that player's specific slot? An example of the manner of thing I am trying to accomplish:
[PLAYER 1] setpos(getpos [PLAYER 2]);

finite dirge
#

How are you running it? You could get them from a selection or cusorObject maybe.

#

It really depends on the situation.

tough abyss
#

and then use set
set returns NOTHING

jaunty ravine
#

yeah the "set" thing didn't work out

finite dirge
#

Oh yeah lol

#

Save the var first and set it haha. Need some coffee this morning.

#
private _spawnPos = markerPos "myMarker";
_spawnPos set [2, _zValue];
#

Thanks Schnellführer!

jaunty ravine
#

Gonna give that a try now

#

I can't get it to work but that's most likely due to my own incompetence in sqf, here's the code I'm using:

private _Spawn_Heli_1 = markerPos "Spawn_Heli_1";
_Spawn_Heli_1 set [2, 5];
Spawn_Heli = [ getMarkerPos "Spawn_Heli_1", 0, "RHS_UH60M", WEST] call BIS_fnc_spawnVehicle;
Spawn_Heli_Veh = (Spawn_Heli select 0);
Spawn_Heli_Veh addItemCargoGlobal ["ace_rope36", 2];
Spawn_Heli_Veh call ace_fastroping_fnc_equipFRIES;```
finite dirge
#

You didn't change it in the spawn and are still getting the position from the marker.

jaunty ravine
#

Yeah, sorry, I have no idea how to do that unfortunately.

finite dirge
#
Spawn_Heli = [ getMarkerPos "Spawn_Heli_1", 0, "RHS_UH60M", WEST] call BIS_fnc_spawnVehicle;

You are getting the marker position here instead of using the _Spawn_Heli_1 you set with the correct Z.

This would be actually using that new position:

Spawn_Heli = [_Spawn_Heli_1, 0, "RHS_UH60M", WEST] call BIS_fnc_spawnVehicle;
jaunty ravine
#

Still spawning way above where I want it to.

finite dirge
#

getPos standing at the height you want it in the editor, and use that Z value.

finite dirge
#

Continued via PM we found that it was actually setting the variable given to 50m and thus spawning at the same height, so that function isn't useful for this specific situation.

spice axle
#

is there a good way to roll a vehicle to the side?

winter rose
#

setVectorUp @spice axle

#

or sharp turning while driving downhill 😄

spice axle
#

Any good animation rolling? setVectorUp is instant

young current
#

no

#

nothing controlled at least

#

there is a set velocity /force or something like that command

#

but theres no animations you can play to do stuff like that

#

you will have to play with the physics if you want stuff to be moving live

tough abyss
#

there is a set velocity /force or something like that command
👆

young current
#

cant be arsed to look through the command list

#

😛

tough abyss
#

but theres no animations you can play to do stuff like that
could always use setVelocityTransformation

hollow thistle
#

addForce, but the results may vary. Sometimes the vehicle rolls over. sometimes it decides to do a outer space trip lenny

young current
#

most vehicles have pretty low center of mass and they tend up rolling back on their wheels

#

so depends on what you want to achieve if you need to freeze the vehicle to some certain direction at some point of your roll

spice axle
#

The torque will be fit the best but dammit rhs is really doing some stupid stuff

hollow thistle
#

Some of their mraps are very much self stabilizing 😬

spice axle
#

the new m-atv is just i don't know. I reached the max number cap trying to roll them to the side

#
US_Veh_CAR_2 addTorque (US_Veh_CAR_2 vectorModelToWorld [0,99999999999999999999999999999999999999,0]);

Is not enough torque

astral tendon
young current
#

@astral tendon

astral tendon
young current
#

¯_(ツ)_/¯

astral tendon
#

👌

young current
#

works on my end, no idea why not on yours

still forum
#

Read wiki properly

astral tendon
#

(Since Arma 3 v1.95.146032) and my version is 1.94

still forum
#

exactly. Jackpot

young current
#

oh true im running diag exe

astral tendon
#

would be better just do like the other ones that had DEV tags or "Not implemented yet"

#

I wasted a unesessary amout of time trying to figure it.

winter rose
#

(Since Arma 3 v1.95.146032)
@astral tendon

tough abyss
#

Existing command can’t have DEV tag

astral tendon
#

Yeah, I will check it every time I see that "Since" next to the comand.

winter rose
#

(oops, Discord didn't sync well)
well, we could add A3dev besides the A3 icon for now, but the patch is days away I think sooo

tough abyss
#

Then you have to monitor and remove it with release

#

Fire and forget is much better

#

Can’t fix everyone if people don’t read

winter rose
#

yep, that's the issue - the forget part

tough abyss
#

Funny though how string in string is so obvious yet wasn’t implemented

astral tendon
#

maybe a date when the comand will be avaialbe?

#

or (Available in Arma 3 v1.95.146032)

tough abyss
#

You can’t have date if it is not known

hollow thistle
#

It's fine as is. People need to learn to RTFM.

astral dawn
#

Typically 'since' refers to some moment in the past, that's why it might be misleading

tough abyss
#

What would you suggest to write instead?

astral dawn
#

NYI, Will be available after 1.99 ?

#

Probably wiki doesn't allow to automate that, I have no idea

tough abyss
#

After 1.99 means from 2.00?

astral dawn
#

Well how do you phrase version >= 1.99 properly? 😄

tough abyss
#

Since

astral dawn
#

🙄

young current
#

since meaning after version xx is released

#

could be "will be included in version XX"

tough abyss
#

But usually version is already available on dev

young current
#

if goal is to make less informed ppl aware of that, then it can be mentioned

#

or dev version users already know its there

#

what stage is the wiki intended to follow

#

dev or stable

#

there will always be users that dont even know there is a dev branch

tough abyss
#

Well it is only confusing between stable releases, for someone who doesn’t use dev so ¯_(ツ)_/¯

young current
#

id wager most people dont use dev

tough abyss
#

And this is bad

#

Though if you are on biki you are probably developing so technically by not using dev you limit yourself

young current
#

but if you develop stuff for stable build then youre not

#

most servers run stable build

#

not dev

#

so if you build on dev, most of the time your stuff cant be used

#

if you use things that are not on stable that is

#

if you develop for your own fun/own group who all run same version == no problem

#

if you develop public mod that you intend to update more often than Arma updates == problem

tough abyss
#

Yes but on dev you normally get improvements and fixes that are going to hit next stable so if you want to make sure you don’t get any surprises you want to at least have parallel build

young current
#

sure that is good practice especially on more complicated projects

#

but if youre in that advanced level of making stuff you probably know your stuff already and can read wiki like a pro

tough abyss
#

What is the worst case scenario if you haven’t paid attention to since version? You try it and it doesn’t work, you go to discord and embarrass yourself, and I think this is what the actual issue here

#

Which is good, because next time you gonna pay more attention which is a good thing

astral dawn
#

Worst thing is that everyone's time is wasted

tough abyss
#

Yeah like 5 min

#

Don’t do Arma if you care for your time

astral tendon
#

I love this community.

young current
#

well if the problem stems from simple phrasing on wiki why could that not be made so that there is no problem at all?

astral dawn
#

That's what I was trying to say but gave up, thank you...

#

But really it's also the question if we assume that user is free to play on any version he likes or do we assume his version 🤷

#

Generally it's better not to assume things

astral tendon
#

Anyway, does anyone knows how to swich the light of Land_TransferSwitch_01_F to the green one below? I don't want to swich the color of the current light, but change it to the one that is below

#

I get the lever to work but did not figure about the light.

tough abyss
#

well if the problem stems from simple phrasing on wiki why could that not be made so that there is no problem at all?
Because the problem is with people not paying attention at all

young current
#

well that applies to anything and is a problem far beyond Arma modding

astral dawn
#

Maybe they do but not enough to catch this

young current
#

if changing few words might help some people why not do it?

#

why not educate people?

tough abyss
#

Oh really? CreateUnit has red box saying pay attention this syntax doesn’t return an object, doesn’t seem to stop anyone

young current
#

we were talking about the version numbers?

tough abyss
#

Same thing

young current
#

im not saying you have to do it either. Im sure the red box helps some people

#

it wasnt always there either

tough abyss
#

There is no empirical data to judge the usefulness of that red box but it sure increases embarrassment factor if you missed it

young current
#

now you do see your attitude towards this matter is not at all helpful or progressive

tough abyss
#

Then again the version thing is a thing only between stable releases for someone who is not using dev and only when some existing command gets some love, so really quite marginal, yet somehow it goes on for several pages already

#

Let’s not go personal, ok?

astral dawn
#

Let's look at it this way... does it move wiki into a better state? I think it does. Now can it be easily done so that it compares a function version VS the current stable version?

tough abyss
#

You have to retro edit all such notes, are you up for it? Dooo eeet then

astral dawn
#

_> Hey man, I have NO idea how wiki works, nor I'm registered there, that's why I'm asking

young current
#

I have no idea either

astral dawn
#

However it answers my question, thx

young current
#

but instead of mocking us for asking if it would improve wiki you could have said its very difficult and time consuming to do for little gain

tough abyss
#

That’s what I tried to say when I mentioned marginal nature

young current
#

yes indeed. could have started with that,

lavish hamlet
#

Im having a hard time getting this to work on a dedicated server

if (!isServer) exitwith {};


_lightspawn = selectRandom  ["lightarm1","lightarm2","lightarm3","lightarm5","lightarm6"];

_lightArm = [getMarkerPos _lightspawn,0,"rhsgref_BRDM2_vmf",East] call BIS_fnc_spawnVehicle;

[_lightArm select 2, getmarkerpos "patrol", 1000] call BIS_fnc_taskPatrol;

im pretty sure that the problem is im spawning it localy and not on the server.. setup is, a laptop with addaction to run .sqf

winter rose
#

well, yeah

#

unless the player that is activating the script is the server, you can't get it to work like that

lavish hamlet
#

I also tried this to no avail



_armorSpawns = selectRandom ["armor1","armor2","armor3","armor5","armor6"];


_veh = createVehicle ["rhs_t72ba_tv", getMarkerPos _armorSpawns, [], 0, "NONE"];

[_veh select 2, getmarkerpos "patrol", 1000] call BIS_fnc_taskPatrol;
winter rose
#

if you createVehicle, you create… a vehicle

#

so _veh is not an array, but an object

astral tendon
rustic brook
#

@astral dawn
"Then
_ctrl = (findDisplay 9999) displayCtrl 1500;" from yesterday.

I did what you requested and it now prints 'No Control".

astral dawn
#

Hey

#

Well I have no idea, need to see more

#

More code, and how you create the dialog maybe

#

And how the dialog is defined

rustic brook
#

this is called on action and works -

// Don't want to cache this dialog
disableSerialization;

createDialog "buyMenu";

waitUntil {!isNull (findDisplay 9999)};

// Create List Box ref
_listBoxIDC = 1500;

{
    // %1:price %2:name
    _displayString = format ["%2: %1 €",[_x] call A3A_fnc_vehiclePrice, getText (configFile >> "CfgVehicles" >> _x >> "displayName")];

    _index = lbAdd [ _listBoxIDC, _displayString ]; //Display string needs to be grabbed from the vehConfig which is based off of _x
    lbSetData [ _listBoxIDC, _index, _x ]; // _x is our class name we want to reference

} foreach vehBuyList; // Global list containing all vehicles we can buy in the format of class name strings
#

buy_selected.sqf

_listBoxIDC = 1500; // IDC of our list box


_control = (findDisplay 9999) displayCtrl 1500;
systemChat format ["control: %1", _control];

_index = lbCurSel _listBoxIDC;

systemChat format ["index = %1", _index];

_vehClass = lbData [ _listBoxIDC, _index ]; // retrieve the data (previously set) from the listbox's currently selected index

if (_index == -1) exitWith {hint "No vehicle selected to buy"}; // Make sure the player selected a box

// Attempt to buy the vehicle //////////////////
closeDialog 0; // This was lowercase before 'action = "closedialog 0; nul = [vehSDKBike] spawn A3A_fnc_addFIAveh";'
systemChat format ["Veh Class: %1 | index = %2", _vehClass, _index];
[_vehClass] spawn A3A_fnc_addFIAveh;
astral dawn
#

called on action
you know that you can't suspend inside unscheduled environment?

You say that it works, so you mean that it's adding stuff into the listbox after all?

rustic brook
#

yes it adds to the list

#

and no I'm unfamiliar

astral dawn
#

Cool, so what was the problem again?

#

Read into scheduled and unscheduled environment on wiki

rustic brook
#

control

class buyMenu {
    idd = 9999;

    class controls{

        class buyFrame: RscFrame
        {
            idc = 1800;
            x = 0.29375 * safezoneW + safezoneX;
            y = 0.225 * safezoneH + safezoneY;
            w = 0.4125 * safezoneW;
            h = 0.55 * safezoneH;
        };
        class buyCombo: RscCombo
        {
            idc = 2100;
            x = 0.309219 * safezoneW + safezoneX;
            y = 0.258 * safezoneH + safezoneY;
            w = 0.252656 * safezoneW;
            h = 0.033 * safezoneH;
        };
        class buyCloseBtn: RscButton
        {
            idc = 1600;
            text = "Close"; //--- ToDo: Localize;
            x = 0.618594 * safezoneW + safezoneX;
            y = 0.247 * safezoneH + safezoneY;
            w = 0.0721875 * safezoneW;
            h = 0.044 * safezoneH;
            action = "closeDialog 0";
        };
        class buyListBox: RscListbox
        {
            idc = 1500;
            x = 0.309219 * safezoneW + safezoneX;
            y = 0.302 * safezoneH + safezoneY;
            w = 0.252656 * safezoneW;
            h = 0.44 * safezoneH;
        };
        class buyBtn: RscButton
        {
            idc = 1601;
            text = "Buy"; //--- ToDo: Localize;
            x = 0.5825 * safezoneW + safezoneX;
            y = 0.61 * safezoneH + safezoneY;
            w = 0.108281 * safezoneW;
            h = 0.132 * safezoneH;
            action = "closeDialog 0; nul=[] execVM 'jacobGUI\buy_selected.sqf'";
        };
    };
};
#

The issue is that the buy_selected can't see the control

#

and always returns -1

#

for index

astral dawn
#

Yeah I see. Does it (finddisplay 9999) return an existing display at least?

rustic brook
#

"No Display"

#

from

_control = (findDisplay 9999); //displayCtrl 1500;
systemChat format ["control: %1", _control];
astral dawn
#

So... If this display/dialog if still open at the moment when you click the button, then the display should be found!

#

It could find the 9999 display before after all!

#

Ha, you see, right what I said...

#

action = "closeDialog 0; nul=[] execVM 'jacobGUI\buy_selected.sqf'";

#

You need to close the dialog after you run the script

#

🤣

#

also probably there is no need for execVM there... unless you are super sure what you are doing

rustic brook
#

Im not

astral dawn
#

Are you modifying antistasi things actually?

rustic brook
#

yes

#

Im loading it back up rn to test the dialog close order

astral dawn
#

execVM and spawn are (almost) like creating a new thread, when you create a new thread you should have a damn good reason to do so, typically

#

anyway yeah try this instead
action = "nul=[] execVM 'jacobGUI\buy_selected.sqf'";
then run the closedialog command from your buy_selected when you won't need the dialog any more

rustic brook
#

ah I see - if it is scheduled behind other scripts it will just close and we wont have access to it

astral dawn
#

Even if you did a call from the button action after closing the dialog, result would be the same

#

because first it would close the dialog, then you would try to find the control from the script

rustic brook
#

yeah, I was under the impression that the dialog was global and always available - this is starting to make more sense now.

#

Awesome yep that resolved it. I really appreciate the help!

astral dawn
rustic brook
#

Aye

rustic brook
#

when you select a new item in a combo box does it fire the 'action' line of the comboBox?

astral dawn
#

?

mystic plaza
#

will setPosASL safely place a player on top of the aircraft carrier, or do I need to use something else?

frozen knoll
#

setPosASL is perfect

#

try it and u will see

mystic plaza
#

I went with setPosATL since that's what was being reported in the editor when I placed something on the carrier

#

setPosASL with the editor value (around 114) put me way up in the air, and setPosASL with 0 put me (as expected) in the ocean

#

thanks for the help

runic quest
#

Excuse me, how can I make it possible for players who only add UIDs to their servers to play? Thank you!

frozen knoll
#

yeh setPosASL does require you to getPosASL first but works great

grave stratus
#

@mystic plaza i've learnt that you need to put an airstrip platform on the carrier, in order to place a unit properly, or it will drop into the ocean. But make sure not to clash with take off barrier and the ropes.

mystic plaza
#

I've got some scripts that are keeping players in a zone, and teleporting them back in if they leave it. I currently have every player selected like so:

_allPLs = allPlayers - _allHCs;```I want to exempt some players who are playing as CAS from this script. I've tried giving the CAS players a variable name ``pcas1`` and ``pcas2``, then deleting them from ``_allPLs`` with ``_allPLs deleteAt (_allPLs find pcas1);``, which works... but it throws an error about ``pcas1/2`` being null if the player isn't present.

I tried fixing this with ```if (!isNull pcas1) then {
    _allPLs deleteAt (_allPLs find pcas1);
};``` but this is also giving me an error on ``isNull`` if ``pcas1`` isn't present. Is there an easier way to do something like this?
still forum
#

but it throws an error about pcas1/2 being null if the player isn't present.
no it doesn't

#

it throws an error about them being NIL, not null. Different things

#

important difference

#

!isNull pcas1
vs
!isNil "pcas1"

tough abyss
#

_allPLs = allPlayers - _allHCs - [pcas1,pcas2,....]

mystic plaza
#

When I use _allHCs = entities "HeadlessClient_F"; _allPLs = allPlayers - _allHCs; if (!isNull pcas1) then { _allPLss deleteAt (_allPLs find pcas1); };, I get the error 18:47:55 Error Undefined variable in expression: pcas1 for each unoccupied CAS slot.
With _allPLs = allPlayers - _allHCs - [pcas1,pcas2]; I get the same thing.

The if statement with !isNil "pcas1" with the quotes added seems to work, however, so I'll just go with that. The help is very much appreciated.

hot kernel
#

Did we get an update or something? I'm getting weird results from a script that has worked consistently for months. It's an "ANYPLAYER" trigger and for some reason as of this morning it fails to detect the player once the player boards a vehicle. After the vehicle has moved, the trigger fires as usual.

hot kernel
#

inexplicable: changing nothing else but the height of the trigger fixed it. Even though the vehicle is only about 1 meter higher than ground level, with the trigger height at 3 meters the trigger deactivates. At 6 meters it works as usual. Pretty weird and inconsistent trigger behavior.

winter rose
#

that or you set a trigger height

hot kernel
#

@winter rose , this is a common trigger I use a lot. It's properties never change. This morning it behaved differently than last night-- even though the game was still running (which I guess means it wasn't update related). That seems pretty inexplicable.

#

3 meters has worked for months, now it's 4 for some reason

winter rose
#

no update though ¯_(ツ)_/¯

hot kernel
#

I'm not sure if it's little things like this that keep me going or make me want to quit but it's all good, trigger works again... for now.

winter rose
#

*armagic*

hot kernel
#

I mean, I'm drawing the trigger in my imagination and the vehicle is well within it. Boarding the vehicle definitely makes the player exit the trigger area. Starting the engine and moving a inch makes the trigger fire again. That's weird. I know that's weird because I've play-tested this scenario a hundred times. Another vehicle in the same zone but at the exact altitude of the trigger works as expected. So two vehicles next to each other have different behavior with the only difference being one is about a tire's height higher. Both vehicles are vanilla, empty, unnamed.

winter rose
#

3m height trigger may use older bounding box, I don't know

hot kernel
#

@winter rose , I'm probably just venting. Thanks for your help as always, Lou

winter rose
#

well, didn't really help here but triggers can be bitchy
if your trigger is 3m high but terrain is bumpier than usual, you are out of it very easily

hot kernel
#

I probably moved the stupid truck while I was tired or something and it had just always been right on the edge-- it has a grace area now-- oh @winter rose , regardless whether it accomplished anything or not , I appreciate your time

jolly bone
#

Suppose that I have an array with the IDs of the players' units in a mission, which I then shuffle. I now want to execute a script on each given place in the array. (unit 1 gets a specific script, unit 2 gets a specific script, and so forth.) What would be the best (and hopefuly simplest) way to accomplish this? The only thing I can think of so far is running a series of convoluted if-cases, but intuitively this solution feels a like a recipie for errors and disorganization.
The ambition here is having a "random" role selection which, while unpredictable from the perspective of the individual player, make sures to hand out the most important roles first.

still forum
#

make an array of script functions.

#

Then just forEach through the players, and select from your function array by forEachIndex

jolly bone
#

Thank you. Haven't written any code for a few years so I'm a bit rusty haha.

still forum
#

what kind of IDs do you have, and what kind of scripts do you want to execute. Do these scripts need to run local to the player?

#

something like this probably

_unitsArray = [1,2,3];
_scriptsArray = [{hint "script1"},{hint "script2"},{hint "script3"}]

{
 _x call (_scriptsArray select _forEachIndex)
} forEach _unitsArray;
jolly bone
#

Nice, thanks this seems to be just what I wanted.
ID-array is _playerlist = allplayers; and optimally I would just run an .sqf corresponding to each index. I don't suppose there is an easy way to change the global variable refering to a unit once mission has started?

daring trout
#

Good day ladies and gents! Got a little trouble here using sqf cfgRoles and sqf CfgRespawnInventory I get the concept and all, you got a role that players pick (given in cfgRoles) and to them you got loadouts assigned. Sure. But how do you assig a role from sqf description.ext to a playeable unit you put down in Eden? Using the Role Description field in the units attributes only seems to change the actual description in the MP lobby. Thaks in advance, folks!

jolly bone
#

Just confirming that your method works so far when testing in a singleplayer environment. Thanks Dedmen! 👌

velvet merlin
#

what is unscheduled in diag_captureSlowFrame? what is the short name/what section is it in?

still forum
#

all eventhandlers

frozen knoll
#

@daring trout [player, "YOURROLE"] call BIS_fnc_addRespawnInventory;

daring trout
#

@frozen knoll oh, so the BIS_fnc_addRespawnInventory is the link connecting the role with the unit? Thank you VERY much!

frozen knoll
#

yeh its been a year or so since i played with that but should be what your looking for

daring trout
#

@frozen knoll you the man, thanks!

hot kernel
#

I want two waituntil's running at the same time. If I embed them in if/then statements, that'll work, right?

if (alive player) then {endBlue=[]spawn {waitUntil {sleep 10; player getvariable "scoreBLUE" > 99};"Success!" call BIS_fnc_endMission;};};
if (alive player) then {endRED=[]spawn {waitUntil {sleep 10; player getvariable "scoreRED" > 99};"Failure!" call BIS_fnc_endMission;};};
winter rose
#

waitUntil one or the other is 99+, then if it's blue victory, else failure

hot kernel
#

ah

#

yes

winter rose
#

Else you can have a win then a loss! ☝

hot kernel
#
waitUntil {sleep 10; player getvariable "scoreBLUE" > 99 or player getvariable "scoreRED" >99};
if (player getvariable "scoreBlue" >99) then {call bis_fnc_endMission};

so more like that?

astral dawn
#

yes

hot kernel
#

cool, thanks guys!

#

also, I'm passing a variable through a function like

fnc_example=
{
_mark=mark
mark=something else
call function with variable
mark=_mark
};

Is that the right way or is there something better?

still forum
#

wat

#

what do you mean by "passing through"?

hot kernel
#

I want mark to exit the function with the same value

still forum
#

the function is editing mark ?

#

Sure you can do that, but I'd say you should re-plan your logic such that such a thing is not necessary

hot kernel
#

like this,

MMF_tankOFF=
{
_currentMARK=currentMARK;
        currentMARK=baseAREA2;
        baseAREA1 call MMF_fnc_bluTANK;
        baseMARK3 call MMF_fnc_redTANK;
currentMARK=_currentMARK;
};
#

It's not really for me, it's so when other people try to use the MMF framework they don't have to keep track of default values, just set it and forget it

astral dawn
#

What's really the purpose of this? Are you worried about many scripts running in parallel or what?

still forum
#

i assume the functions modify the variable

#

it wouldn't help at all against scripts running in parallel

#

As you can see above he wants to modify the variable, and then revert it again

#

you really should just pass a argument to the function instead of temporarily modifying globals

astral dawn
#

Global variable is bad unless there is really no other way
Think three times before using globals

winter rose
#

four even

hot kernel
#

This isn't a typical use type scenario and none of the actual functions use the above method. However, I've written several shortcut functions for users to spawn (like a batch), and this is strictly so they don't have to manage defaults

still forum
#

Yeah looks like that could still be done with local variables being passed implicitly, or just arguments being passed ¯_(ツ)_/¯

#

would ofc have to rewrite big parts of that stuff

#

looks to me like you are just missusing global variables as parameters. To avoid having to pass them manually

hot kernel
#

yes, I'm totally doing that but I didn't know that is misusing them.

hot kernel
#

oh,
https://community.bistudio.com/wiki/params
okay. I think I get it. Cool. So release date gets pushed back a week and I re-write this thing, again.
I should probably start asking these questions before I write the thousand line .sqf

thanks @still forum , I think...

#

just tell me this, if I successfully rewrite the file using correct parameters, will that put the project a step closer to being MP compatible?

still forum
#

I assume so

#

passing parameters to remoteExec is easy

#

setting global variables, then remoteExec'ing and then resetting them is way harder

hot kernel
#

great! Because ultimately that's what users will want, is MP

astral dawn
#

is way harder
and can even lead to asynchronous shit because we don't know how publicVariable is ordered relative to remoteExec and other things?

still forum
#

I would assume publicVariable/remoteExec would be properly ordered.. But I never tried and wouldn't even want to try it

#

re-write this thing, again.
That's how you learn. ^^

hot kernel
#

I know, I know... and I am thankful I was just being snarky

errant jasper
#

Ordering constraint is why I never use remoteExec and only remoteExecCall. Even if the messages themselves are ordered, the scheduled script executions might run interleaved.

outer fjord
#

How would I get a vehicles location actual and re-purpose that data to spawn something on said location?

still forum
#

"location actual"?

#

you mean... getPos?

random loom
#

So I'm trying to create a script that replaces CUP structures with Contact equivalents, and I've ran into a bit of a roadblock. Namely trying to get relative positions of structures

#

the method I use to get relative positions is this: copyToClipboard str (getPos _obj1 vectorDiff getPos _obj2);

#

and to get placement position I use this: ((getPosATL _building) vectorDiff _offset)

#

Though it doesn't seem to place things in the correct position and I need help with finding a good solution to this, or at least some pointers.

still forum
#

contact and cup buildings are different

#

so yes, they are placed in wrong position

random loom
#

Yeah I know, I'm trying to get the offset between them as mentioned

still forum
#

you could try comparing the bounding boxes

#

and model centers from that

#

and turning that into an offset

outer fjord
#

From what I understand and why CUP team hasn't just done it already is that reason

#

Particularly with bounding boxes and model centers.

random loom
#

Yeah

still forum
#

cup has tools to automate that stuff, but its still alot of work

swift merlin
#

how would i force an ai VTOL to use forward flight on a certain waypoint. I want them to take off/hover to my first waypoint and then zoom off at my second. Right now they only hover off to my second waypoint even though its 3km away. I tried setting the ai setting to run but it didnt work

swift merlin
#

nevermind, for anyone that wants to do this, just look into the unit capture function in arma 3

exotic flax
#

what? set unit to captured will force it to fly instead of hover?

winter rose
#

no. unitCapture, a BIS fnc made to "capture" position and direction of a vehicle (mostly air vehicles)

exotic flax
#

well... that only works with static movements, not on the fly waypoints (like in Zeus)

#

guess playing a single waypoint close to the take-off area also "fixes" this issue

tiny wadi
#

Hello, I want to implement a system identical to ArmA 2s construction interface. I'm setting up the camera stuff now but I was curious if it is possible to just use the eden editor camera controller or zeus's as they both already have most of the functionally I need from the camera. I couldn't find much information on modifying them so figured I'd ask here

#

Also assuming they are scripts, where would they be?

bitter lark
#

Hey, I need some help with a situation I've found myself in trying to make a simple mission. To begin, I'm very novice and all of my knowledge comes from the biki that I can barely decipher 90% of the time, so sorry if my stuff seems kind of ghetto.

My add action is on a unit with the variable name "cop". The addaction changes convcop1 to true, which activates the trigger to play the subtitles and progress the mission. The issue only comes in multiplayer. When one of my players activates the action, the dialog plays for them exclusively, the Create Task module connected to the trigger doesn't activate, and the action remains for everyone else despite the action being removed for the user.
cop's int is:

this addaction ["Talk to Constable", {convcop1 = 1; cop removeaction 0;}, [], 1, true, true, "","_this distance _target<2"] call bis_fnc_mp;

My Trigger (trig1)'s condition is:

Convcop1 == 1;
and the int is:
execvm "conv1.sqf";

plain raven
#

When one of my players activates the action, the dialog plays for them exclusively im no expert but I think its a locality issue? I.e. its executing on the client that selected the addAction. This client (the players computer) isn't where the task is stored cuz thats on the server.

I'm not great at this but here goes, in arma (and i imagine other games) the code executes on certain machines, namely client and server. The two are linked via the internet/a network or whatever. Not everything in arma broadcasts across the network across all client, this in turn means that if you create something on the server (such as you placed create Task module) the client (the players machine) might not know about it. This means in scripts, you have to remotely execute on the intended machine OR use something global.

#

Look at the top of addaction page: https://community.bistudio.com/wiki/addAction
and you'll see AG and EL (arguements global and effects local). In your case, this means the effect (i.e. the removal of your action and executing of your convo.sqf) happens on the machine that executed only, so the player in your case.

#

@bitter lark I'm happy to PM you with what I can to help if you want?

spice axle
#

@bitter lark you already got a answer on reddit

forest forge
#

Hi, I need help with the carrier and having ai launch off it as well as raise and lower the deflectors, and yes I've googled it and yes none of the scripts that I found accomplish what I need. sorry for the hostile tone, All help is welcome

bitter lark
#

@spice axle I posted this here before I got my response. Cheers.

spice axle
#

Ah ok

sudden yacht
#

Hello all. Using waypoints for a group with each waypoint set to safe and limited speed. It appears only the squad leader is taking a casual walking stance and not the rest of the squad. Ideas?

forest forge
#

@sudden yacht I can take a look in my editor if I’m getting the same thing and are you using any mods?

#

I’m not getting that problem

forest forge
#

Coop/ PvE

#

So something similar to what happens in the showcase

hot kernel
#

@still forum , okay I researched params last night and I'm sitting down to re-write some functions and I'd like to see if I understand this,

right now I'm saying something like (misused globals),

spawnNUM=2
spawnState=1
baseMark3 call MMF_fnc_soldierEAST

and if I understand correctly it should be something like,

[basemark3, 2, 1] call MMF_fnc_soldierSIDE (provided those params are available)

Is that anywhere near correct?

still forum
#

yes

hot kernel
#

thank goodness

still forum
#

and then something like
params ["_baseMark", "_spawnNum", "_spawnState"];

hot kernel
#

if MMF_fnc_soldierWEST makes a west group using bis_fnc_spawn, how do I consolidate EAST and WEST in the same function and use the params of bis_fnc_spawn group in addition to the params I set?

still forum
#

you can pass east or west as argument

#

not sure what you mean with "addition"

hot kernel
#

so like an if statement inside the function?
if (_caller==basemark3) then {side east};-- pseudo

#
  • addition (the params I added + the params built into the function)
still forum
#

you could do that too

#

I was thinking adding the side as a parameter to the function

#

[basemark3, west, 2, 1] call MMF_fnc_soldierSIDE

hot kernel
#

a specific example is "spawnNUM", I put that global where the param goes for number of units so it should be unnecessary

still forum
#
  • addition (the params I added + the params built into the function)
    I don't understand that. how are your params related to the params of some other function you might call?
hot kernel
#

okay, then clearly I don't understand that part either. What I'm trying to say is that bis functions have params, and I can make up new params for my functions. So if I have a bis_fnc in my function how to I send params to where they need to go

still forum
#

old:

MMF_fnc_soldierEAST = {
east call spawnGroup;
}

new

MMF_fnc_soldierSIDE = {
params ["_baseMark", "_spawnNum", "_spawnState", "_spawnSide"];
_spawnSide call spawnGroup;
}
#

So if I have a bis_fnc in my function how to I send params to where they need to go
same as with everything else.
You pass params via the array on left side of call Just out in there what you need to put in there

hot kernel
#

OH! yes that makes things more clear

#

Okay I'm going to rewrite a function or two. I'll make a forum post so I can share my learning with everybody. Thanks for your help @still forum , I'll check back in with some progress later

still forum
#

can't wait to comment on the mistakes you'll make in that forum thread :3

hot kernel
#

😄

tame lion
#

Whats the best way to get the name of the seat that a unit occupies in a vehicle? Ex: return "Driver" when checking the driver of a vehicle?

still forum
#

a chain of if statements?
elseif?
switch statement?

tame lion
#

nevermind, I got it figured out now

#
{
    _result = "";
    _unit_vehicle = vehicle _unit;
    {
        _x params ["_seat_unit", "_seat_name"];
        if (_seat_unit == _unit) exitWith {_result = _seat_name};
    } forEach fullCrew _unit_vehicle;
    _result```
#

incase you were curious

still forum
#

that will return "cargo" for each of the cargo seats tho

#

names aren't unique in your code

#

also.. you should probably use findIf, and private keyword for that

tame lion
#

I'm fine with it returning Cargo tbh

#

because im not trying to find the driver, I'm trying to find what seat a specific unit is occupying at the time code is run

#

unless I can get the exact seat name from the seat Index that fullCrew would return

still forum
#
private _crew = fullCrew vehicle _unit
private _result = (_crew param [_crew findIf {_x select 1 == _unit}, []]) param [1, ""]

that's my variant.
Well you can just append the cargo index to the name

tame lion
#

I'm building a dialog similar to Ctab that in part will return what vehicle the selected unit is in, and what role/seat they are taking if in a vehicle. Which is why Cargo is an acceptable result tbh but thank you for the input though. I'll remember that incase I decide I want to give more info than just Cargo

#

Another question now: What is a quick way to determine if a mag is compatible with a weapon?

tame lion
#

awesome, thanks again Dedmen

exotic flax
#

Is there someone in here who has knowledge/experience with the antenna & component system of ACRE2?
What I'm trying to do is use a script to change an antenna on a radio, however I don't see it actually changing...

// script to change antenna (simple component)
_radioId = ["ACRE_PRC117F"] call acre_api_fnc_getRadioByType;
_hash = [] call acre_main_fnc_fastHashCreate;
_antenna = "Some_Custom_Antenna"; // exists in CfgAcreComponents
_return = [_radioId, 0, _antenna, _hash, true] call acre_sys_components_fnc_attachSimpleComponent;
systemChat format ["Antenna Attached: %1", _return];

^^ this always return "Antenna Attached: true"

However if I call acre_sys_components_fnc_getAllConnectedComponents on the same _radioID, it keeps showing the original antenna.

hot kernel
#

So instead of going with the soldier function to start I thought I'd use my go-to example script, which is based on GOM teaching me to count a few months ago,

I would define these,

rings1=[objNull, ring1_1, ring1_2, ring1_3];
rings2=[objNull, ring2_1, ring2_2, ring2_3];
rings3=[objNull, ring3_1, ring3_2, ring3_3];

In an area trigger,

[1,[rings1],ringOBJ] call FTA_fnc_ringCourse;

and,

FTA_fnc_ringCourse = {
params ["_courseID","_rings","_ringGoal"];

currentRing=currentRing+1;
_ringGoal setpos (getpos [_rings] select currentRing]);

if (currentRing==4) then {currentRing=0};
};

I'm not sure about the syntax but I think the logic is correct

tough abyss
#

Hi guys, quick question: What's the best way to check if a animation is over? I saw there is an event but idk how to properly use it in my script

hot kernel
#

did we make _courseID irrelevant?

#

or maybe that could be one step easier by just having the ringObj call the function?

ringOBJ [rings1] call FTA_fnc_ringCourse;

FTA_fnc_ringCourse = {
params ["_rings"];

currentRing=currentRing+1;
ringOBJ setpos (getpos [_rings] select currentRing]);

if (currentRing==4) then {currentRing=0};
};
#

and calling it _this,

_this setpos (getpos [_rings] select currentRing]);
still forum
#

dont have time right now to feedback. might remember later tho o7

#

(getpos [_rings] select currentRing]) syntax error, and precedence error, and logic error all in one

#

the ] is closing an array that was never opened.
getPos takes precedence over select, and getpos on array with one element no work.
logic error your select can only ever work with 0, because the array only has one entry

hot kernel
#

@still forum , thanks I'm on it

covert inlet
#

@zealous meteor Huh, i didn't think the adding multiple at a time worked in vehicle init

#

did it add 2 ak's?

zealous meteor
#

the whole script didnt run

#

only the clears

covert inlet
#

yea multiples dont work in the init

zealous meteor
#

can you give me a really quick crashcourse on sqf scripting?

#

like where do I put the file and how do I run it

covert inlet
#

create a new text file in your missions root folder
name it customVehicleInventory.sqf

zealous meteor
#

done

covert inlet
#

then past this into it

clearItemCargoGlobal _mrap1;
clearMagazineCargoGlobal _mrap1;
_mrap1 addWeaponCargoGlobal["rhs_weap_aks74u", 2];
_mrap1 addWeaponCargoGlobal["ace_bloodbag500", 10];```
zealous meteor
#

done

covert inlet
#

again check the ace wiki for for correct classname, and you will have to add all the clears for relevant items eg backpacks all on the arma wiki

zealous meteor
#

yeah yeah I get that

covert inlet
#

then just give the vehicle the variable name _mrap1

zealous meteor
#

Already did

covert inlet
#

thats it

zealous meteor
#

hmm, will it run no problem?

#

no need to do anything else?

covert inlet
#

if it didnt do something stupid, its 2am for me

zealous meteor
#

trying it out

covert inlet
#

you might have to reload the editor/mission file for it to recognize the new .sqf file in the mission folder

zealous meteor
#

will do

#

didnt work

#

without it

#

reloaded it, didnt work...

#

man this is frustrating 😅

covert inlet
#

did the clears work?

zealous meteor
#

nope

#

I restarted the editor and everything

#

the file is saved, in the mission's root directory

#

wait

#

wait I messed up, 1 sec

covert inlet
#

sure you put the .sqf file in your mission folder, the one in documents>arma>"profile">missions?

zealous meteor
#

no I didnt

#

its called _mrap1

#

yeah its there

#

does it have to be in profile?

#

I have no such folder

#

im putting it in arma/missions/missionblabla

covert inlet
#

no thats were the packed .pbo mission file goes

zealous meteor
#

whoopsie

#

lemme try then

#

the mission doesnt show up in the editor

#

this way

#

cant load it

covert inlet
#

if you save a mission in eden it saves to your profile under missions or mp missions

#

you will have a folder called "my mission name" and inside that is a file called mission.sqm

#

you want to put your sqf file in the same folder as the mission.sqm

zealous meteor
#

it doesnt save to my profile, it saves to arma 3/missions

#

not arma 3/UserSaved/missions

#

and yes, I put it in the Documents\Arma 3\missions\Test.chernarus_summer

#

which is my mission

#

which contains the mission.sqm file

#

and I which I can load

covert inlet
#

that is your profile folder, just the default profile

zealous meteor
#

ic

covert inlet
#

so just chuck the .sqf file in the same folder as the mission.sqm

zealous meteor
#

its there

#

script.sqf

#

and mission.sqm

covert inlet
#

then reload the editor/mission and test it by placing a unit and RMB play as unit

zealous meteor
#

yeah I did

covert inlet
#

if that doesn't work or a least throw some kind of error then i dunno, and i dont have arma on this pc to test it.
Will have to wait for someone smarter than me, to point out the dumb thing i did 😂

zealous meteor
#

yeah, no error but doesnt work either

#

hey man, probably me that did something stupid

#

either way I think this is very poorly designed...

#

thanks anyway for your patience