#arma3_scripting

1 messages ยท Page 647 of 1

bold mica
#
addMissionEventHandler [
    if ((backpack _unit) isEqualTo "tfw_ilbe_a_gr", "tfw_ilbe_dd_gr" && 
    {_itemRemoved isEqualTo "ACRE_PRC117F"}) then 
    { _unit addBackpackCargoGlobal ["ACRE_PRC117F", 1]; }
];```
tiny wadi
#

you could do an OR, or you could make an array of acceptable backpacks

#

so you could do

#
private _acceptableBackpacks = ["backpack1","backpack2"];
if ((backpack _unit) in _acceptableBackpacks)```
#

@bold mica

#

Also it seems that addMissionEventHandler is missing the eventhandler type

bold mica
#

aaaaaaaaaaaaaaa

#

im new to scripting

tiny wadi
#

No worries

bold mica
#

where can i set that array

#

(easier for future stuff)

#
addMissionEventHandler ["",{
    if (toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] && _itemRemoved isEqualTo "ACRE_PRC117F") then {
        _unit addBackpackCargoGlobal ["ACRE_PRC117F",1];
    };
}];``` my friend just gave me this
tiny wadi
#

You could make a global variable

#

Global variables dont begin with an underscore (_). And are accessible from anywhere within the mission. If you want to learn more search for Scopes on the wiki

bold mica
#

this?

tiny wadi
#

but quickly you could just write above the addMissionEventHandler:

MyAllowedBackpacks = [];
addMissionEventhandler blahblahblah```
#

Yes thats the right link

bold mica
#

wouyldnt a global variable send it to everyone to process?

robust hollow
#

no, thats a public variable

bold mica
#

your pfp is a mood

robust hollow
#

global means accessible in different scopes

bold mica
#

uh huh,,,

#

wait @tiny wadi wouldnt it be a normal event handler for inventory close

robust hollow
#

surely take would be better than invenntoryclosed

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

    if (
        _container isEqualTo backpackContainer _unit && 
        toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] && 
        _item == "ACRE_PRC117F"
    ) then {
        _unit addBackpackCargoGlobal ["ACRE_PRC117F",1];
    };
}];

then you just need to delete the item you removed, perhaps with a Put event.

cerulean cloak
#
for "_i" from 1 to 78 do  
    {  
                
                private _pos_1 = missionNamespace getVariable [format ["arr_%1", (_i-1)], objNull];
                private _pos_2 = missionNamespace getVariable [format ["arr_%1", _i], objNull];
                map drawline [getpos _pos_1, getpos _pos_2, [128, 1, 1]];
                deletevehicle _pos_1;
    };

I'm trying to get a line drawn between a serious of arrow objects with variable names arr_0 through arr_78. The script above isn't throwing any errors but isn't working either.

robust hollow
#

is that in a Draw event?

robust hollow
#

because you are taking it from your backpack

cerulean cloak
#

Ok, thanks. I saw the example just didn't know it had to be wrapped in that.

bold mica
#

but also im hoping that if they drop it from their backpack or move it anywhere that isnt their backpack, itll just put another radio in it

#

so it constantly checks with close inventory

#

like "if player has no brick but has backpack, add brick, but if brick is removed, add brick"

#

thats basically what im trying to do

#
    private _item = "ACRE_PRC117F";

    if (_unitItems findIf {_item == _x} == -1) then {
        _unit addBackpackCargoGlobal [_item,1];```
cerulean cloak
#

https://cdn.discordapp.com/attachments/788909053035413525/801306703958114324/unknown.png

for "_i" from 1 to 78 do  
    {  
                
                private _pos_1 = missionNamespace getVariable [format ["arr_%1", (_i-1)], objNull];
                private _pos_2 = missionNamespace getVariable [format ["arr_%1", _i], objNull];
                (findDisplay 12 displayCtrl 51) ctrlAddEventHandler 
                    [
                        "Draw",
                        "(_this select 0) drawline [getpos _pos_1, getpos _pos_2, [128, 1, 1]];"
                    ];
                deletevehicle _pos_1;
    };```
So now I'm getting that error after I but in the eventhandler bit.
robust hollow
#
map ctrlAddEventHandler ["Draw",{
    params ["_map"];

    for "_i" from 1 to 78 do  
        {  
                    
                    private _pos_1 = missionNamespace getVariable [format ["arr_%1", (_i-1)], objNull];
                    private _pos_2 = missionNamespace getVariable [format ["arr_%1", _i], objNull];
                    _map drawline [getpos _pos_1, getpos _pos_2, [128, 1, 1]];
                    //deletevehicle _pos_1;
        };
}];
#

lines are only shown for the frame they are drawn in, so you cant delete the position objects

cerulean cloak
#

Ah

#

Is there not a way to draw them and have them stick around?

bold mica
#
player addEventHandler ["Put",{
    if (toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] && _item == "ACRE_PRC117F") then {
        _unit addBackpackCargoGlobal ["ACRE_PRC117F",1];
    };
}];

Alternatively my friend gives me this but it'll just add another brick and not remove it

robust hollow
robust hollow
cerulean cloak
#

It's still not working, would the 12 and 51 values matter at all?

bold mica
#

Alright I'll test this tomorrow hopefully, if not friday

robust hollow
cerulean cloak
#

I don't really know what you mean by that but I guess it should be fine as it is. Any idea why I can see the lines still?

robust hollow
#

possibly because you provide an rgb color, but it expects rgba

cerulean cloak
#

Nope didn't fix it. Still no lines.

robust hollow
#

do the position objects exist?

cerulean cloak
#

I can't see why they wouldn't

#

I'll try something else just in case

bold mica
#

I have gotten 4 ways to do the same function and idk if any of them work

tiny wadi
#

Yeah, the put eventhandler is going to be the best. Also, I wasn't thinking and had you use the mission eventhandler, that was incorrect. Needs to be added to the unit

bold mica
#

How would the put event handler work

tiny wadi
#

It is triggered everytime an item is moved into a container

bold mica
#

Into or out of

robust hollow
#

take is out of, put is into

tiny wadi
#

Yeah

cerulean cloak
#

Objects 100% exist and yet no line?

robust hollow
#

show your code snippet as it is now

cerulean cloak
#
for "_i" from 1 to 78 do   
 {   
     
    private _pos_1 = missionNamespace getVariable [format ["arr_%1", (_i-1)], objNull]; 
    private _pos_2 = missionNamespace getVariable [format ["arr_%1", _i], objNull]; 
    map drawline [getpos _pos_1, getpos _pos_2, [128, 1, 1, 1]]; 
 };
robust hollow
#

.... is it in an event?

cerulean cloak
#

No, I thought the event thing went with the drawline thing?

bold mica
#

Wait so wouldn't take be better for if someone moved it out of the bag? Or....

cerulean cloak
#

Does it all need to go in the event thing?

robust hollow
robust hollow
cerulean cloak
#

I didn't notice the event had been moved only the commented out line. Sorry.

agile pumice
#

Why does playAction work for my player but not a civilian unit? Is it only certain gestures it works with?
tested with GestureNo

cerulean cloak
#
map ctrlAddEventHandler ["Draw",{
    params ["_map"];

    for "_i" from 1 to 78 do  
        {  
                    
                    private _pos_1 = missionNamespace getVariable [format ["arr_%1", (_i-1)], objNull];
                    private _pos_2 = missionNamespace getVariable [format ["arr_%1", _i], objNull];
                    _map drawline [getpos _pos_1, getpos _pos_2, [128, 1, 1, 1]];
        };
}];

I've removed the commented out line and also changed the colour from RGB to RGBA

bold mica
#

So this

player addEventHandler ["Put",{
    if (toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] && _item == "ACRE_PRC117F") then {
        _unit addBackpackCargoGlobal ["ACRE_PRC117F",1];
    };
}];```
robust hollow
#

you arent defining any variables so that will error

cerulean cloak
#

And sadly, no lines.

robust hollow
cerulean cloak
#

Ok, thank you.

bold mica
#

init

robust hollow
#

probably. give it a go and see if it works

#

@cerulean cloak this works for me

test_polygon = [];
for "_i" from 1 to 11 do 
{
    test_polygon pushBack position (missionnamespace getvariable [format["a_%1",_i],objnull]);
};

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", 
{
    params ["_control"];
    _control drawPolygon [test_polygon, [0,0,1,1]];
}];

mostly copied from https://community.bistudio.com/wiki/drawPolygon

cerulean cloak
#

What am I expecting to see on the map?

robust hollow
#

well you'll need to modify it to work for you...

test_polygon = [];
for "_i" from 0 to 78 do 
{
    test_polygon pushBack position (missionnamespace getvariable [format["arr_%1",_i],objnull]);
};

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", 
{
    params ["_control"];
    _control drawPolygon [test_polygon, [0,0,1,1]];
}];
cerulean cloak
#

Works quite well expect for a line linking the first and last points

robust hollow
#

ughh, yea ๐Ÿ˜ฆ go back to the draw line code you had. idk why it isnt working as that also works for me.

cerulean cloak
#

Would CBA or ACE have any impact on this?

robust hollow
#

its possible i guess. i wouldnt know what part though.

cerulean cloak
#

Since it seems the polygon function draws a line from each marker to the next looping at the end what if we added all the points again but in reverse order?

robust hollow
#

it connects the first and last position, no matter what order you add them in

cerulean cloak
#
test_polygon = [];
for "_i" from 0 to 78 do 
{
    test_polygon pushBack position (missionnamespace getvariable [format["arr_%1",_i],objnull]);
};

for "_i" from 0 to 78 do 
{
    test_polygon pushBack position (missionnamespace getvariable [format["arr_%1",(78-_i)],objnull]);
};

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", 
{
    params ["_control"];
    _control drawPolygon [test_polygon, [0,0,1,1]];
}];

It worked

robust hollow
#

oh, i see.

#

you could have from 78 to 0 step -1 do for the second loop, and get rid of the (78-_i)

cerulean cloak
#

Yeah, I should do that.

robust hollow
#

or this and avoid the second loop entirely

private _copyArray = +test_polygon;
reverse _copyArray;
test_polygon append _copyArray;
cerulean cloak
#

Yup, that works great. Thank you very much for working that through with me.

outer fjord
#

Is there a way to check if a unit has canDeactivateMines = true; in there config as a condition for a addaction?

cerulean cloak
outer fjord
#

Ah perfect thank you!

brazen lagoon
#

hey @high marsh just wanted to ping you to say I gave your idea a try in my mission and it seems to work! thanks a bunch

brazen lagoon
#

one thing I'm having trouble with is the AI seems to detect people way too well at night and I'm not sure how to change this

high marsh
#

do you have any examples? And if you're running a dedicated server what difficulty are you running. If you're running the host off your client which difficulty are you running.

frigid apex
#

I've tried 2 approaches to animation looping a moving target traveling along a wire. I want the target to travel from one end of the wire to the other, then return back. And doing this continuously until told to stop with a useraction.

1st approach was using a while loop with 1 sqf. But I couldnt make that work.

2nd approach is using 2 different sqf. TargetStart.sqf and TargetStop.sqf called by using 2 user actions. One for start, one for stop. But couldnt make this work either, and I've found very little info on animation looping on the internet except doing so with unit static animations, which isnt the same.

umbral nimbus
#

I need a little help in thinking something out...
I want a simple way for players to enable/disable an set ('layer') of mapmarkers.

I know how to hide/show them. Thats easy through setMarkerAlpha.
But anyone has a good simple idea for player to do this.
All I can think of is changing a radio trigger. Any other thoughts?

umbral nimbus
#

thats actually not bad. Can that be accessed through the map? Im not sure

#

ooh ACE interaction!

oblique arrow
#

Hm yeah that could be good

tidal swallow
#

I create a script where players can spawn a camp to sleep, chill etc... But i want to add when a camp is spawned it also creates respawn point and when camp is packed up it deletes respawn point. I was thinking with BIS_fnc_addRespawnPosition to create respawn point and Position to get position of the camp and to place a respawn point there

#

I was thinking of getting position for respawn point from current player position with getPos player

next eagle
tidal swallow
#

But will that keep the respawn persistent on location or will it be always on player?

next eagle
#

I actually don't know

#

Might be something you have to try out and see

warm coral
#

i have an issue with creating a module for achilles

#
[] spawn { 
 
      if(isClass (configFile >> "CfgPatches" >> "ace_main"))then{ 
        ["[SRBMOD]", "Unit suicide", { 
 
          params [["_position", [0,0,0], [[]], 3], ["_object", objNull, [objNull]]]; 
 
          _curator = getAssignedCuratorLogic player; 
 
          if( !(_object isKindOf "Man"))exitWith{ 
              [_curator,"No valid unit"] call BIS_fnc_showCuratorFeedbackMessage; 
          }; 
 
          [_object, true] call murshun_suicide_fnc; 
 
        }] call Ares_fnc_RegisterCustomModule; 
    }; 
 
  };```
#

this is the script

next eagle
#

I'm wondering if maybe someone can give me some insight: I had created a couple small scripts to remote control units with during a mission. I wanted to have like a medic and engi I can switch to when needed, and what I came up with kinda works, but there are issues. I input an addAction command into my player init in 3den, which gives me the action, but only until I die, which is no good. I want it to persist with the player even after death and respawn. It also shows the action on the screen all the time until I open scroll wheel menu and close it again; this isn't a huge issue but the disappearing on respawn makes it kinda useless overall. Any ideas?

This is the addAction: this addAction ["Control Medic", {[med1] call zen_remote_control_fnc_start;}];

And this is to switch back to the player: this addAction ["Back to Player", {objNull remoteControl player; player switchCamera "INTERNAL"; sleep 0.1; findDisplay 312; closeDisplay 2;}];

past mist
#

I'm creating a task from scripting, using BIS_fnc_taskCreate, description takes an array with description, title and marker. what is this marker? the position where the task is shown on map? and in that case what is the optiona destination parameter next to the description array?

#

@next eagle you might add an handler for when you respawn to re-execute the add-action command

next eagle
past mist
#

otherwise

#

add that code on onPlayerRespawn.sqf

#

that script get's executed when someone respawns

#

maybe check for the guy respawning being effectively you and you would be set

next eagle
#

Ok, I'll see what works. cheers

past mist
#

good luck

little raptor
past mist
#

okay, I'll experiment with it

#

one last thing, best way to check from scripts if a bool variable has been changed without hogging the VM using an endless while loop?

little raptor
#

@past mist
best way is to do what you want wherever you change the bool
in other words:
Setting var in one script:

VarIsTrue = true;
```and checking when it becomes true in another spawned/execVMed code using a loop:
```sqf
waitUntil {
  VarIsTrue
};
//do something
```Is bad.

But this is good:
```sqf
VarIsTrue = true;
//do something

to cover both cases of true and false, you can make a function

My_fnc_setBool = //use a better tag, not just "My"
{
  params ["_isTrue"];
  someVar = _isTrue;
  if (_isTrue) then {
    //do this when enabled
  } else {
     //do this when disabeld
  };
};


//
[true] call My_fnc_setBool; //change the var to true
scarlet flume
#

any one free to give a hand?

past mist
scarlet flume
#

how do i set up sectors to have team base spawn pos? that can change based of what side controlls it

little raptor
#

exactly

#

don't use loop for that

#

do what I said

past mist
#

then, I should not use an external SQf at all

little raptor
#

what do you mean external SQF?

past mist
#

i have a tasking.sqf file where I wrote all the code for the tasks

#

that file gets execVMed at the start of the mission

#

and adds the first task

little raptor
#

I think you didn't understand what I said

#

let me explain for your case

#

let's say task1 completes, and you want to add task2:

#

this is the completion code for task1:

//complete task 1
["task1", "SUCCEEDED"] call BIS_fnc_setTaskState;
//add task 2:
["task2", .....] call BIS_fnc_taskCreate;
#

as you can see, all of it is taking place in one script

#

and it can be an "external" sqf

#

if you want

past mist
#

got it

#

in my case I should add it when the holdaction callback for being completed get's called

little raptor
#

yep exactly

#

no loops

past mist
#

k, thanks

little raptor
#

np

little raptor
#

it seems to me it is

#

ok wait

scarlet flume
#

i was referred to here

little raptor
#

yeah I noticed

#

let me see what your issue was

scarlet flume
#

so im setting up a team deathmatch, with sector control, how can i set up spawn points to become active/inactive off who controls the said sectors

little raptor
#

how did you set up the spawn points?

scarlet flume
#

sector module with linked blufor independent AREA logic entities

little raptor
scarlet flume
#

sector
sectormoduleF
and player respawns

little raptor
#

ok but you can't just respawn on the sector

#

are you using markers for the respawn?

scarlet flume
#

modulerespawnpositionF

median abyss
#

Is there any compilation of the functions that you can apply to a unit? (setPos, getPos, getDir, getUnitLoadout, etc..)

scarlet flume
#

is there a way to script is so it enables blufor spawn if blufor owns it, but if opfor caps the sector it disables the blufor spawn and enables a opfor spawn

median abyss
little raptor
#

the spawn positions?

scarlet flume
#

no

#

well yes but one is ,respawn_west and one is respawn_east

little raptor
#

well then it's really simple

#

all you need is enableSimulationGlobal

scarlet flume
#

and what where do i put that

little raptor
#

if you disable a respawn module's simulation you can't spawn there anymore

scarlet flume
#

so put that into the spawn module?

little raptor
#

no

#

you have to use it when it changes side

#

but I'm not sure if there's an scripted EH for that

#

let me check

#

ok good news

#

there is

scarlet flume
#

?

little raptor
#

@scarlet flume
put this in the sector's init field:

if (!isServer) exitWith {};
[this, "ownerChanged", {
    params ["_sector", "_owner", "_ownerOld"];
    respawn_west enableSimulationGlobal (_owner isEqualTo west);
    respawn_east enableSimulationGlobal (_owner isEqualTo east);
}] call BIS_fnc_addScriptedEventHandler;
scarlet flume
#

so how do i set up the REspawns that are to be attached to the sector

little raptor
#

change the names

#

in the script

scarlet flume
#

so thats respawn-east/west

little raptor
#

yes

scarlet flume
#

so i only need to add/change a number on the end of both the respawn_east/west and in the init?

#

to add this to more sectors

little raptor
#

the names correspond to whichever respawns you want to be affected by the sector

scarlet flume
#

ok thank you my good sir and i shall go have a play with this

little raptor
#

the above code toggles the respawn for respawn_west and respawn_east

#

np

scarlet flume
#

real quick

#

so i dont need to change ANY think in the respawn module, like set sides?

little raptor
#

but that's all you have to do

scarlet flume
#

ok well i jsut had a test run and it enabled from the start? give me a few to play about with it

little raptor
scarlet flume
#

how and where?

little raptor
#

or disable the simluation for the respawn points that belong to a sector not captured yet

scarlet flume
#

very sorry how would i do that?

little raptor
#

I already told you how

#

so you just put this in the init of respawn modules:

if (!isServer) exitWith {};
this enableSimulationGlobal false;
scarlet flume
#

thenks

scarlet flume
#

very sorry leopard every time i run a test it still dont work

little raptor
#

it works for me

scarlet flume
#

so i have this in the sector init
if (!isServer) exitWith {};
[this, "ownerChanged", {
params ["_sector", "_owner", "_ownerOld"];
respawn_west1 enableSimulationGlobal (_owner isEqualTo west);
respawn_guerrila1 enableSimulationGlobal (_owner isEqualTo independent);
}] call BIS_fnc_addScriptedEventHandler;

#

and i have your after mentioned code in the respawn modules

little raptor
#

so what doesn't work?

scarlet flume
#

its not enabling the spawns when a side caps the sector

little raptor
#

these names are correct right?
respawn_west1 respawn_guerrila1

scarlet flume
#

yea, for bluefour and inderpendent

#

?

#

i did say that it was for west/east, but i was thinking that is was easier just to sayt east to west and change it to blufour AFF after all was said and done, but im apparently not that good

little raptor
#

do you get any errors?

little raptor
#

it should've worked

scarlet flume
#

i was getting one for "error undifined expression guerrila1"

#

or somethink

little raptor
#

well give me the full error

#

look in rpt

scarlet flume
#

never mind i have found what was problem

#

thank you for your help and time

#

10/10 rating

little raptor
scarlet flume
#

all good

#

thanks

#

its late (3:10am) and im off to bed

fiery orbit
#

Is there a way to set capture rules for a sector based of which sides are friendly with each other?

onyx sonnet
#

how would i assign RopeAttach to every helicopter in the game, for example is there an event for when an entity is created

spark turret
#

does anyone know if the cba class eventhandler is fired on the server if a zeus-player owned unit is placed?

spark turret
exotic flax
#

the easiest is to set an init EH with configs

class DefaultEventHandlers;
class CfgVehicles {
   class Air;
   class Helicopter: Air {
      class EventHandlers: DefaultEventHandlers {
         init = "_this#0 enableRopeAttach true"
      };
   };
};

or use CBA XEH, which is a lot better (both scripted and configured)

onyx sonnet
#

it says that doesn't count for spawned vehicles in editor tho?

#

actually i think that was another thing nvm

spark turret
#

CBA XEH has an option to run for already initialized objects too (editor placed i assume)

onyx sonnet
#

yeah nvm cheers

spark turret
#

i just dont know if it has the EH has to be local to the machine taht spawns the unit

tidal swallow
#

I'm using this function in unit unit field but it only works in SP, not MP. Any idea why? this addAction ["<t color=""#F8FF24"">" +format["Set Up Camp"], {_this execVM "addons\Camp_Script\spawn.sqf";}];

#

here is the script where this takes you

#

the original command was player addAction ["<t color=""#F8FF24"">" +format["Set Up Camp"],"addons\Camp_Script\spawn.sqf"]; but this does not work in MP at all for some reason.

#

The problem is that there is no action created, therefor you cannot spawn camp

willow hound
#

@tidal swallow Just place the original line (player addAction [...];) in onPlayerRespawn.sqf or initPlayerLocal.sqf.

median abyss
#

Does getUnitLoadout not return the current inventory of a unit?

winter rose
median abyss
#

Yes, but specifically "Returns a Unit Loadout Array with all assigned items, " is a bit unclear

#

Or do I have to execute it on the machine that the unit is local on?

winter rose
#

containers and their stored items

median abyss
#

Yes, but currently Im trying to save a players inventory on disconnect. But the output includes items that I've removed from the inventory of the character

winter rose
#

that's another issue then
how do you remove such items?

median abyss
#

Manually, using the ingame inventory

#

Drop them on the ground -> disconnect. getUnitLoadout in disconnect handler includes dropped item.

winter rose
#

there may be a sync delay yeah

median abyss
#

Any idea if it's possible to force a sync somehow?

#

Would be "simple" if the player was still connected

#

But since I'm running it in the disconnect handler I'm a bit restricted

winter rose
#

disconnections are always hard to track, it can be a network error, a slow connection etc

you can e.g give the player an action to disconnect, which would send his current gear to the server

median abyss
#

Might go that route, thanks ๐Ÿ™‚

wind hedge
#

Guys and Gurus, quick question...

#

And that: The player can see the remaining time in seconds to complete said task and that the task is automatically failed when the timer has expired...

exotic flax
#
  • taskCreate (remember taskID)
  • set and show countdown timer
  • if complete:
    • taskSetState: "SUCCEEDED"
    • remove timer
  • if timer at 0:
    • taskSetState: "FAILED"
median abyss
#

[] spawn { while (_taskNotFailed) { timer = timer -1; if (timer <= 0) then { _taskFailed }; sleep 1}; }

exotic flax
#

BIS_fnc_countdown will end the mission when the timer runs out... not a good idea for single tasks...

median abyss
#

No, it's pseudo sqf

wind hedge
exotic flax
#

but than you need to have a second loop (one in countdown and one of your own) to check the current time...

wind hedge
#

waitUntil {sleep 0.1; _timeLeft = [0] call BIS_fnc_countdown; _timeleft < 2};

exotic flax
#

so easier to just make your own, and have a single loop ๐Ÿคทโ€โ™‚๏ธ

wind hedge
#

Yeah, it would be optimal if the time left shows on the Task Description on the Map and not as a hint or something

#

Too bad a Time Left param isn't featured on BIS_fnc_taskCreate by default

exotic flax
#

Although simply storing the TaskID, (end) time and callback in missionNamespace, and checking every second if the current time is past the one stored, if done; run callback

#

prolly takes 20-30 lines of code ๐Ÿค”

tight jungle
#

i know how to program, but just started with Arma 3's code today, so sorry if this seems obvious. I have a group set up with soldiers in it, but when using variableName disableAI "MOVE"; it says error generic error in expression or something like that. what am i doing wrong?

exotic flax
#

Where do you use that line of code?
In the init of a unit, in the init of a group, or in a separate script (like init.sqf)?

tight jungle
#

I put it in the completion of a waypoint i believe

#

and i've successfully printed hints from it so i know it triggers

worthy rivet
#

disableAI "ANIM";?

tight jungle
#

let me see

#

nope that says the same error

cerulean cloak
#

How would I disable the NV sights on a backpack drone after it's assembled?

digital hollow
#

WeaponAssembled eventHandler on the unit will let you access the newly created drone.

cerulean cloak
#
this addEventHandler ["WeaponAssembled", {
    params ["_unit", "_staticWeapon"];
    weapon disableNVGEquipment true;
}];

Just like that?

digital hollow
#

You need to make sure this is the unit, so if this is in its init then it's ok.
Then you need to make sure _staticWeapon and weapon are the same thing, since you need them to be the same thing.

cerulean cloak
#

So would I need to change _staticweapon to the classname of what's being assembled?

digital hollow
#

params ["_unit", "_staticWeapon"]; is telling you that inside the braces, _unit is the unit and _staticWeapon is the new weapon. So use those private variables.

tight jungle
#

i have a group whos variable name is o1squad. Running o1squad disableAI "MOVE"; returns generic error in expression. what should i do?

cerulean cloak
polar saffron
#

Hello, I have a small question, how can I make an npc pass to be alloyed to an enemy when touching a trigger?

cerulean cloak
#

o1squad references a group not a unit you need.

{
    _x disableAI "MOVE";
} foreach units o1squad;
tight jungle
cerulean cloak
#

Yeah, should be.

#

Just make sure you've coppied the version above. Made a slight change

tight jungle
#

got it, let me check

tight jungle
#

also should i declare variables as _name or name?

warm hedge
#

_name = <something>;, name is occupied

ebon citrus
#

Anything you might need to know about variables in sqf is there

warm hedge
tight jungle
#

appreciate it

ionic tinsel
#

I'm trying to test the player's ATL position for a Trigger condition. What's wrong with this formatting? getPosATL player > 0

warm hedge
#

getPosATL returns an array, so you can't compare it directly (imagine [0,0,0] > 0) the ATL position of it is stored in select 2 or #2

ionic tinsel
#

So how would I need to type it, then, to find the player's Z coordinates ATL?

warm hedge
#
getPos player#2```
fiery orbit
#

would this be a proper way to check a private variable for a nil value?

private _check = isNil{_returnPos isEqualTo nil}
if(_check) ...
winter rose
#

@fiery orbit```sqf
isNil "_returnPos"

fiery orbit
#

thank you

quasi rover
#

Is there a way to check or avoid AI unit spawned under rock?

willow hound
#

@winter rose We need a wiki page for that query

median abyss
#

Im trying to find resources related to packing my scripts into a mod (instead of having them all shipped with the mission), is there any good guides related to this?

winter rose
willow hound
#

AI in rocks

fiery orbit
quasi rover
#

@fiery orbit because of the lineIntersectsSurfaces in BIS_fnc_findSafePos ?

fiery orbit
#

actually based off what I found in the documentation, I would do a maximum gradient to eliminate large rocks (most are utilized for cliffs and mountains) and then use a nearest object to deal with small rocks

#

so set an objDist and maxGrad

#

and experiment until you find something you like

quasi rover
#

I just thought BIS_fnc_findSafePos is not enough to avoid under rock, but I'll give it a try. thanks.

spark turret
#

tried setting an AIs name by remotely executing setName. no effect on server. any advice?

exotic flax
#

Sets the name of a location or a person. In Arma 3 this can be used to set name of a person but only in single player.

spark turret
#

yeah but there is a way to do it in MP

#

ive done it before, i just cant remeber how

#

maybe its ace_common_fnc_setName; ? can t find the docu for that function

exotic flax
spark turret
#

ah i think thats it!
how did you find it?

exotic flax
#

ace_common_fnc_setName
ace = mod
common = addon
fnc = function ๐Ÿ˜‰
setName = name of file

spark turret
#

alright cool

exotic flax
#

standard CBA/ACE mod structure

past mist
#

Can someone explain me how the tasking system works on dedicated server? My mission has tasks working in both single player and self-hosted multiplayer, however when run in a dedicated server no tasks are assigned. I'm assigning all tasks by calling BIS_fnc_taskCreate. Is it because I'm using execVM? should I call a remote exec? Or what else?

spark turret
#

taskCreate is a global function. no need for remoteexec

#

show the rest of your code?

past mist
#

so, on init.sqf along with the respawn points being set, I get the first call to my "tasking.sqf" script, that takes a number as parameter to know what task complete/add.
[0] execVM "tasking.sqf";

on tasking.sqf (i'm going to skip all the task variable setup for simplicity sake) this code get's executed:

private _taskN = param[0, 0];

switch (_taskN) do{
    case 0: {
         _task1 call BIS_fnc_taskCreate;
    };
    case 1: {
        ["task1", "SUCCEEDED"] call BIS_fnc_taskSetState;
         _task2 call BIS_fnc_taskCreate;
        prisonerMrk call BIS_fnc_showMarker;
    };
    case 2: {
        ["task2", "SUCCEEDED"] call BIS_fnc_taskSetState;
        _task3 call BIS_fnc_taskCreate;
        _task4 call BIS_fnc_taskCreate;
        "EnemyBase" call BIS_fnc_showMarker;
    };
    case 3: {
        ["task3", "SUCCEEDED"] call BIS_fnc_taskSetState;
    };
    case 4: {
        ["task4", "SUCCEEDED"] call BIS_fnc_taskSetState;
    };
    case 100: {
        ["task2", "FAILED"] call BIS_fnc_taskSetState;
        ["task4", "FAILED"] call BIS_fnc_taskSetState;
        _task100 call BIS_fnc_taskCreate;
    };
    case 200: {
        _task200 call BIS_fnc_taskCreate;
    };
    case 201: {
        ["task200", "SUCCEEDED"] call BIS_fnc_taskSetState;
    };
    case 202: {
        ["task200", "FAILED"] call BIS_fnc_taskSetState;
    };
    case 300: {
        ["task300", "SUCCEEDED"] call BIS_fnc_taskSetState;
        ["SUCCESS"] execVM "ending.sqf";
    };
};
little raptor
spark turret
#

and _task1 is an array of format: [owner, taskID, description, destination, state, priority, showNotification, type, visibleIn3D] ?

past mist
#

this does work in single player, also I tried it in the editor by hosting it as multiplayer and it was still working.
Yesterday on the dedicated server with my group all the tasking was not present.

#

of course

#

task1:

private _task1Title = "Parla con l'informatore";
private _task1Description = "Thamos Roumpesi ha delle informazioni riguardo alla milizia che sta agendo sul territorio di Malden. รˆ disposto a collaborare con noi, potete trovarlo nel villaggio di Lolisse. Il villaggio รจ neutrale, tenete le armi basse e non causate panico tra la popolazione. I civili non ci vedono molto amichevoli, cercate di non complicare la convivenza.";
private _task1 = [west, "task1", [_task1Description, _task1Title, "Informatore"], Informer, true, 1000, true, "talk"];
#

I avoided pasting all the lines just to not bring a giant wall of text

little raptor
#

```sqf

#

see the pinned messages

past mist
#

oh, does discord support sqf syntax?

little raptor
#

yes

past mist
#

nice to know

spark turret
#

have you tried debugging if task1 is successfully created?

past mist
#

on the dedicated server?

#

I have no clue on how to do it.

spark turret
#

yeah. also the init.sqf gets run on every machine, so you will create the task again for every joined player

past mist
#

should I move it on initServer.sqf?

spark turret
#

at least thats what the framework recommends

past mist
#

however, even if it would create the task for every player, I still don't understand why no task appeared yesterday

#

how I can check for a task existence from the debug console?

past mist
#

I actually followed that page

past mist
#

uh, noice

#

time to spin up server and client and test

#

okay, task does not exist

#

Then, I can confirm that for some reasons, even calling the script file myself from inside the server tasks aren't created

#

I can't even create a task by calling #exec from the chat (I'm logged in as admin)

exotic flax
#

got any CfgRemoteExec which blocks executing BIS_fnc_setTaskLocal in any way?

past mist
#

I don't think so

#

any way to check?

#

I think if they are present, they would be on description.ext, but there I only have my 2 possible endings in CfgDebriefing

exotic flax
#

could be in mission (Description.ext) or a mod (although I doubt any mod would do that)

past mist
#

with the same modlist we played a lot of times DRO missions, that generate tasks at runtime, so I doubt.

exotic flax
#

in that case it could be in description.ext, but that should be "obvious" (although can cause a lot of headaches)

past mist
#

my description.ext only containes the CfgDebriefing classes

#

literally only that

past mist
#

okay. I might have discovered the culprit of this is issue

winter rose
#

YOU

past mist
#

High command

#

literally, removing high command subordinates from the company commander made all the tasks started working again.

winter rose
#

!purgeban @runic obsidian 60d spam

lyric schoonerBOT
spark turret
#

pew pew
never forget the donnager!

past mist
#

So, anyway, is there a reason for tasks not working when groups are under high command? Wiki doesn't say anything about that. Is it intended behaviour or is it a bug?

median abyss
#

How can I check what a class name (e.g. "launch_NLAW_F") is referring to? In this case a weapon

#

Solved it with isNull (configFile >> "cfgWeapons">> _className) for now

pale ridge
#

quick question: what does the "0 max" and "min 1" mean here?:

_pain = 0 max (_pain + _addedPain) min 1;
winter rose
#

it clamps the value between 0 and 1 ๐Ÿ™‚

#

0 max 50 = 50
0 max -10 = 0

1 min 50 = 1
1 min -10 = -10

@pale ridge

pale ridge
#

seems kinda strange format for me, but thx now i know

#

๐Ÿ‘

winter rose
spark turret
#

the minimum of { } = "min"

median abyss
little raptor
#

just add more

#

this is actually the fastest way to check

#

example:

#
[
  configFile >> "CfgVehicles",
  configFile >> "CfgWeapons",
  configFile >> "CfgMagazines",
  configFile >> "CfgAmmo"
] findIf {isClass (_x >> _className)} != -1
#

this will cover objs, weapons, mags, items, uniforms, etc.

median abyss
#

isClass (configFile >> "CfgWeapons" >> "U_OG_Guerilla1_1") shouldn't return true though, right?

#

(U_OG_Guerilla1_1 being a uniform, rather than a weapon)

little raptor
#

it should

#

because uniforms are also defined in cfgWeapons

median abyss
#

Aha!

little raptor
#

(almost anything that you can "equip" in inventory is defined in cfgWeapons)

median abyss
#

Ah, kinda weird choice... But then I have to check the subclasses of cfgWeapons for my entry, right?

little raptor
#

what do you mean?

#

didn't you just want to get the config?

median abyss
#

I wanted to get the type of the object that I had a class name of

#

aka, is it a weapon, items, etc

little raptor
#

if it's defined in weapon you also have to check its type

#

for example, for uniforms: type = 131072;

median abyss
#

Aight, how do you get the type ?

#

configProperties?

#

I AM GOD

#

getNumber ((configFile >> "CfgWeapons" >> "U_OG_Guerilla1_1" >> "type"))

polar saffron
#

hello I have a question is there any way in which an npc is eliminated by touching a yrigg?

#

Trigger *

velvet kernel
little raptor
tepid osprey
#

Any chance I can get some guidance?

#

Im trying to make custom vests but for some reason they are constantly spawning in the ground instead of on the character... can someone take a look over my congif and tell me where i messed up?

winter rose
tepid osprey
#

thank you

gloomy aspen
#

this addAction ["Deploy To HALO Airframe", {player setPosASL (getPosASL SLTele)}];

Could somebody advise me where in that code to add a CutText or PLAIN DOWN etc.? Just a flag teleporter but would like to add a 10 second black fade

exotic flax
#

I would do something like this:

this addAction ["Deploy To HALO Airframe", {
    params ["_target", "_caller", "_actionId", "_arguments"];
    private _loadingLayer = "TeleportLoading" cutText ["Teleporting now!", "BLACK", -1, false, true];
    _caller enableSimulationGlobal false;
    [_caller] spawn {
       params ["_caller"];
       _caller setPosASL (getPosASL SLTele);
       sleep 5; // <-- time in seconds between TP and removing black screen
       _caller enableSimulationGlobal true;
       "TeleportLoading" cutFadeOut 1;
   };
}];

not tested

fiery orbit
#
[_hostage,true] call ACE_captive_fnc_setHandcuffed;

is this the proper prefix for ACE captive?

exotic flax
#

according to the in-line documentation; yes

gloomy aspen
#

@exotic flax thank you! Ill give that a go ๐Ÿ™‚

gloomy aspen
#

Is there a way to teleport a player in multiplayer into a position & an animation? (Subsquently they would be set free with another trigger)

So far ive got (I know this is probably awful to look at but at least I tried ๐Ÿ˜† )

this addAction ["Teleport", {player setPosASL (getPosASL object)}; {(player, "Acts_SittingJumpingSaluting_loop") remoteExec {"switchMove", 0)}];

#

In this instance, teleported to a position and also into a sitting animation

tidal swallow
#

{_this call MY_fnc_unitSpawn;} // _this == _spawnedObject where should this be placed. I'm using AI caching and I'm intending to use GF script for zombies

cosmic lichen
#

@tidal swallow Check the documentation of the framework you ripped that from ๐Ÿคทโ€โ™€๏ธ

finite sail
#

ooo, Leo.. advanced developer tools?

#

lets see what this is then

#

๐Ÿ™‚

#

I was planning on some mission dev today, but this looks like it can usefully kill some time

young sonnet
#

Hello everybody
i'm new to arma 3 and i'm looking for one who helps me with the animations so that they belong in the mp i have already watched several tutorials and it explains to me how I have to proceed exactly, any can helph ?. or what was a good tutorial for me where I have to see myself go by for the removal
=? sory this is all google translate my englisch is bad im from swiss and im only speaking german or somthing like german xD
greetings Lรผc #

real tartan
#

I am trying to use EH AnimChanged or AnimStateChanged. Looking to way to execute script only when unit is unconscious. Which of these should I use ? And it is better (performance wise) than doing while loop to check for condition ?

little raptor
# real tartan I am trying to use EH `AnimChanged` or `AnimStateChanged`. Looking to way to exe...

AnimStateChanged
animChanged triggers when the unit "wants" to perform an animation (for example, if you're prone and want to start running, animChanged returns the "running" animation)

And it is better (performance wise) than doing while loop to check for condition ?
if what you do in the EH is fast and you only do it for a few units, yes. You can measure your code performance and see the performance impact.

If the while loop only runs for a short time (with appropriate sleep), it may also be used. but if it's an infinite loop, it's better not to use it

real tartan
#

@little raptor
to add to the context (used only local for player)
pseudo code
player addEH ["xxx", { if _anim = "unconscious" then _unit spawn { sleep 5; code } }]
vs
while { alive player } do { if user unconscious then do code; sleep 5; }

willow hound
#

Both good performance-wise, but they don't do the same:
The while-loop version will execute your code at most every 5 seconds.
The Event Handler version can execute your code more frequently because it spawns the code again every time the EH fires and the condition is met.

real tartan
#

every time the EH fires
@willow hound how often will it fire when you are in unconcious (animation locked) state?

willow hound
#

That depends on the context. (In MP) someone could pick the player's body up and carry it around for example.

young sonnet
#

what for i script i need to make a animation on f2 in mp

winter rose
young sonnet
#

?

young sonnet
#

i want to have more animations in multiplayer and i have to do that via the editor i know that

#

and I have to make the animation on a button so that I can use it in multiplayer, I have to have a script that I insert somewhere but I don't know where or what the script is

young sonnet
#

how exactly can I write the animation on a button that is somewhere

young sonnet
#

thx a lot

past mist
#

is BIS_fnc_showMarker synced along clients in multiplayer? Or should it be remoteExec'd?

willow hound
#

Have a look at the source code, if it uses (a) global marker command(s), it's global.

winter rose
past mist
#

whats the optimal way to make markers show up at runtime then?

winter rose
past mist
#

I'll go with setMarkerAlpha then. Thanks!

copper cipher
#

anyone able to give me a hand with some waypoint issues? i want to have a designated driver that picks me up from the side of the road, takes me to a point and drops me off and drives off. then i kill the specific target and he comes back and picks me up and drives me away.

i had it working initially, he would take me to the drop-off point then leave. but as soon as i started adding triggers for the target everything broke and now he wont even drive when i get in when he picks me up the 1st time

bold mica
#

Uh that's just arma ai I think

#

Do you have hold waypoints?

copper cipher
#

i can show on a vc/livestream if you want copeharder

#

bc its driving me up the wall rn

lusty canyon
#

@copper cipher in ur case id just spawn a new vehicle for the exfil instead of using the same one

copper cipher
#

ill give it a go

past mist
#

can you use addAction on an ai unit and then use that action when you take control of him as zeus?

exotic flax
#

good question ๐Ÿค”

bold mica
#

If he's willing to have a mod there's an easier solution

past mist
#

guess it's testing time

copper cipher
bold mica
#

Simplex support services

copper cipher
#

already got that iye

bold mica
#

Use it

exotic flax
bold mica
#

But ai don't count as players I believe, especially zeus controlled

exotic flax
#

I guess the biggest question would be; who is returned as _caller? The AI, the player or the Zeus instance?

past mist
#

now that's interesting, lucky for me my attached script doesn't need to know who the caller is

#

As a zeus tonight I'll have to role out a couple of NPCs to give players optional side tasks and rewards. If they will attack me I prepared an action to turn all of the bodyguards as enemies. Tested with play as character and it works. Time to test this out in Zeus

bold mica
#

lol

#

Tell me your findings, this may be useful information

copper cipher
#

i wiped every waypoint and started from scratch and now it wont even do the pickup and drive copeharder

past mist
#
if(!isMultiplayer){
    [east, "zaboye", "Zaboye"] call BIS_fnc_addRespawnPosition;
    ["start"] execVM "tasking.sqf";
};

Log says line 1 is missing a semicolon. WTF?

copper cipher
#

arma ai/scripting is so much more painful then it needs to be whyme

exotic flax
past mist
#

oh, right...

#

I'm too used to C#

exotic flax
#

I know the problem ๐Ÿคฃ

#

I also tend to forget once in a while to put a ; behind everything

winter rose
#

while () too

past mist
exotic flax
#

I did: _caller is the remote controlled AI itself (since that is the one who called the action)

copper cipher
#

is there any way to make map markers appear only once a certain task has been done?

#

i want the "extract" marker to appear only when the target is dead

exotic flax
#

you can either create the marker with scripts on success (createMarker),

#

or set the marker opacity to 0 (invisible) and only show when the task is successful

copper cipher
#

how do i do the 2nd option

exotic flax
#

setMarkerAlpha

copper cipher
#

the markers var name is marker_4

#

where do i put the script?

#

targets name is target1

past mist
#

Let's say I have a couple of inline functions in a sqf file. From my understanding I can't call them until I preprocess and compile the file?

exotic flax
#

When using in-line functions you don't have to do any weird stuff

private _fnc_someFunction = {
   // code
};

[] call _fnc_someFunction;
past mist
#

what if I need to call a function from the Init field of an unit placed in the editor?

exotic flax
past mist
#

calling an inline function that is on another file is possible or I also need to use a function library for that too?

winter rose
#

global function = CfgFunctions

#

waaay easier.

past mist
#

k, thanks

exotic flax
#

and safer

past mist
#

So, if I have multiple functions in one file how should I configure classes inside CfgFunctions?

#

matching name of the class with name of the function and givin it a path to the file?

exotic flax
#

you can't; check that wiki page on how to do it

#

each function will need its own file

lost barn
#

Can anyone confirm this will only fire the "fob\time.sqf" just once and get past JIP players i am getting issues with (called from the init.sqf") :

if (isNil "move_players") then {
move_players = false;
publicVariable "move_players";
waitUntil {time > 1};
execvm "fob\time.sqf";
};

enableSaving [FALSE,FALSE];

if (isServer) then {
move_players = true;
publicVariable "move_players";
};

past mist
#

from the wiki tho:

File Path
The easiest and the most transparent way is to set path for each function.

class CfgFunctions
{
    class myTag
    {
        class myCategory
        {
            class myFunction {file = "myFile.sqf";};
        };
    };
};```
This will try to compile function `myTag_fnc_myFunction` from the following file: `%ROOT%\myFile.sqf`
exotic flax
#

yes, so each file will be its own function

exotic flax
#

must love Arma errors:

Error Type Number,Not a Number, expected Number

bold mica
#

It's not a number but it's a number I want

exotic flax
#

it's more: "You give me a Number, which is not a Number, I want a Number"

past mist
#

the error type number is the confusing part

#

it really should be a "error type mismatch"

#

and the last 2 should be flipped

west portal
#

does anyone know how to make script-created markers Zeus-editable ?

hollow lantern
#

is it possible to reload the description.ext on runtime? Or do I really need to reload the mission every time?

hollow lantern
#

hmmm does this apply to CfgFunctions I have defined there as well, or can I "recompile/reload" them on runtime?

winter rose
#

I think it does yes

still forum
#

you can recompile them on runtime

#

if you enable recompiling

#

and find the correct function that does it, probably BIS_fnc_recompile

winter rose
#

you can recompile functions โ†‘ but not refresh CfgFunctions (afaik)

calm badger
#

I'm very new to scripting, how would I write an expression for a trigger, so that when an entity i've named brit is dead, the trigger activates?

#

i've managed to get to using the alive command and now I have no idea what to do lmfao

calm badger
#

thanks! being an idiot, i tried alive brit = false and gave up after realizing i didn't know how to do shit

wild prairie
#

Is there a way to check if an object is a terrain object?

tender fossil
#

I'm done with this piece of s....cript ๐Ÿ˜„

private ["_winnerTeam","_loserTeam"];

_winnerTeam = _this select 0;
_loserTeam = "";

["INFORMATION", Format ["LogGameEnd.sqf: Team [%1] has won the match!", _winnerTeam]] Call WFBE_CO_FNC_LogContent;

if (_winnerTeam == west) then {
    _loserTeam = east;
} else {
    _loserTeam = west;
};

if (isNil (profileNamespace getVariable format ["%1_WIN_CHERNARUS",_winnerTeam])) then {
    profileNamespace setVariable [format ["%1_WIN_CHERNARUS",_winnerTeam], 1];

    if (isNil (profileNamespace getVariable format ["%1_WIN_CHERNARUS", _loserTeam])) then {
        profileNamespace setVariable [format ["%1_WIN_CHERNARUS",_loserTeam], 0];
    };

    saveProfileNamespace;
} else {
    profileNamespace setVariable [(profileNamespace getVariable format ["%1_WIN_CHERNARUS",_winnerTeam]), (profileNamespace getVariable format ["%1_WIN_CHERNARUS",_winnerTeam] + 1)];

    if (isNil (profileNamespace getVariable format ["%1_WIN_CHERNARUS", _loserTeam])) then {
        profileNamespace setVariable [format ["%1_WIN_CHERNARUS",_loserTeam], 0];
    };

    saveProfileNamespace;
};

_westWins = profileNamespace getVariable WEST_WIN_CHERNARUS;
_eastWins = profileNamespace getVariable EAST_WIN_CHERNARUS;

["INFORMATION", Format ["LogGameEnd.sqf: Team BLUFOR has %1 wins and team OPFOR has %2 wins on Chernarus since start of logging.", _westWins, _eastWins]] Call WFBE_CO_FNC_LogContent;

Can anyone spot any mistakes here?

winter rose
#

yes, you are not using private _var = value ๐Ÿ˜„

austere granite
#

its not very pretty ๐Ÿ˜„

winter rose
#

I, huhโ€ฆ what?

tender fossil
winter rose
#

@tender fossil would you happen to be coding while tired?? ๐Ÿ‘€ ๐Ÿ”จ

proper sail
#

if you must use private in arma 2 use local _var instead

tender fossil
#

@winter rose I confess nothing!

little raptor
#

what is this?

WEST_WIN_CHERNARUS

proper sail
#

a variable

tender fossil
#

The script's not working and I have no idea why lol

little raptor
#

I just told you why

#

are you sure it's not "WEST_WIN_CHERNARUS"?

tender fossil
#

Ahhhhhh

#

...

#

.......

#

Spank me!

#

And thanks ๐Ÿ˜„

proper sail
#

im not really sure its worth spamming isnil if the vars dont exists instead of doing it once anyway at the beginning

tender fossil
#

@proper sail The variables must persist between matches and server restarts

#

So can't just place a default value

#

Well, now I get this output: LogGameEnd.sqf: Team BLUFOR has <null> wins and team OPFOR has <null> wins on Chernarus since start of logging.

winter rose
#

go to sleep

tender fossil
#

Oh boy

#

isNil works only for missionNamespace variables

#

How do I check whether profileNamespace variable exists or not?

#

== null?

dusty badger
#

Is it possible to change the Role Description of a player while a mission is live?

winter rose
tender fossil
#

Ok, maybe I should really go to sleep... rofl

dusty badger
#

Trying to figure out ways to communicate live information to players at the role selection menu

#

Like what roles are available or not

still forum
#

or use isNil {namespace getvar}

#

samne thing really

exotic flax
#

I usually have no roles in the lobby (using CBA to set custom naming).
And only use respawn templates (or our custom ORBAT system) to have people select a role

tender fossil
#

@winter rose But how do you trigger the execution of the script before the mission has been loaded?

winter rose
#

init.sqf triggers for everyone on mission load, before the mission is started

#

(I think)

tender fossil
#

But isn't it too late for selecting a role then?

winter rose
#

try it for yourself, place systemChat "Hello!"; in an MP init.sqf - I think it should work (I am not sure for non-JIP players, but maybe)

bold mica
#

idk where to put this script ```sqf
player addEventHandler ["Take", {
params ["_unit", "_container", "_item"];

if (
    _container isEqualTo backpackContainer _unit && 
    toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] && 
    _item == "ACRE_PRC117F"
) then {
    _unit addBackpackCargoGlobal ["ACRE_PRC117F",1];
};

}];```

winter rose
bold mica
#

o h

#

i put it in serverinit

#

oops

#

i..

#

rip the script doesnt workk

#

i get no erroes

#

but it doesnt want to give me the radio

winter rose
#

does it at least trigger?

bold mica
#

nope, it doesnt activate nothing happens @winter rose i just get a return value of 1

winter rose
#

you did not wait until not isNull playerโ€ฆ?

bold mica
#

what

winter rose
#

in initPlayerLocal.sqf

waitUntil { sleep 0.25; not isNull player };
// do stuff with player
exotic flax
#

Btw... Why try to break my mod? ๐Ÿคฃ๐Ÿคฃ๐Ÿคฃ

bold mica
#

..did i need that

winter rose
#

if you are JIP, yes

bold mica
#

whats JIP

winter rose
#

โ€ฆjoin in progress

jade abyss
#

JoinInProgress

bold mica
#

im a clown ok

willow hound
winter rose
exotic flax
#

When using proper EH's you usually don't have to worry about it, bit it's good practice to also make sure the player object is loaded before doing something

winter rose
#

PS: management, pushing to production

willow hound
willow hound
winter rose
#

weeeeee ๐Ÿพ

proper sail
# winter rose you did not wait until not isNull playerโ€ฆ?

ah yes the actual trick is to use jipwaitfor from bis iqlinuk

scriptName "MP\data\scripts\JIPwaitFor.sqf";

if (!isServer) then
{
  //textLogFormat ["INIT_INITJIP JIPwaitFor 0 %1", time,player];
  waitUntil {!isNil {player}};
  //textLogFormat ["INIT_INITJIP JIPwaitFor 1 %1", time,player];
  waitUntil {!isNull player};
  ///textLogFormat ["INIT_INITJIP JIPwaitFor 2 %1", time,player];
  if (player != player) then
  {          
      waitUntil {!(player != player)};
  };
  //textLogFormat ["INIT_INITJIP JIPwaitFor.sqf (CLIENT)  %1", [time,player]];
};
#

simply genius

winter rose
#

UGH

bold mica
#

it didnt work

winter rose
bold mica
#

got a return of 1

winter rose
#

we don't care about the return, that's EH index

bold mica
#

WEH

#

no erroes

#

errors

#

it didnt work?

winter rose
#

tried picking something up?

#

check your vars, the values, etc

#
systemChat str _this```
willow hound
#

See, player is not the baddie ๐Ÿ˜›

winter rose
willow hound
#

initPlayerLocal.sqf would not make much sense if there was no local player meowtrash

winter rose
#

sense?

#

in Arma?

bold mica
#

didnt work either

#
player addEventHandler ["InventoryClosed", { 
    params ["_unit", "_container", "_item"]; 
 
    if ( 
        _container isEqualTo backpackContainer _unit &&  
        toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] &&  
        _item == "ACRE_PRC117F" 
    ) then { 
        _unit addBackpackCargoGlobal ["ACRE_PRC117F",1]; 
    }; 
}];```
winter rose
#

using mooods? ๐Ÿ™ƒ

bold mica
#

they are modded items

winter rose
#

ACE?

bold mica
#

yes

winter rose
#

๐Ÿ”จ

willow hound
#

"InventoryClosed" passes different params

bold mica
#

yee ik, i just wanted to test

#

i also tested "take"

#

theres a CBA version my frined gave me

["loadout",{ 
    params ["_unit"]; 
 
    if !(toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"]) exitWith {}; 
 
    private _unitItems = [primaryWeapon _unit,secondaryWeapon _unit,handgunWeapon _unit,uniform _unit,vest _unit,backpack _unit,headgear _unit,goggles _unit]; 
    _unitItems append assignedItems _unit; 
    _unitItems append itemsWithMagazines _unit; 
 
    private _item = "ACRE_PRC117F"; 
 
    if (_unitItems findIf {_item == _x} == -1) then { 
        _unit addBackpackCargoGlobal [_item,1]; 
    }; 
},true] call CBA_fnc_addPlayerEventHandler;```
willow hound
#

How can your testing work if there is no _item param?

bold mica
#

wait what

bold mica
#

o h

#

imma just revert back to "Take"

willow hound
#

What exactly is the goal of the Event Handler? Unlimited 117s?

bold mica
#

akljdghasg no, its "if you have a specific backpack you MUST have the 117, if you remove it, you get another one

#

so essentially yes

bold mica
#
player addEventHandler ["Take", { 
    params ["_unit", "_container", "_item"]; 
 
    if ( 
        _container isEqualTo backpackContainer _unit &&  
        toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] &&  
        _item == "ACRE_PRC117F" 
    ) then { 
        _unit addBackpackCargoGlobal ["ACRE_PRC117F",1]; 
    }; 
}];```
winter rose
willow hound
#

RV Template rules

winter rose
#

let's hope so!

bold mica
#

wait are you saying backpackcargoglobal is not supposed to work

willow hound
#

Well the documentation says it's for adding backpacks to vehicle inventories... krtecek

bold mica
#

i am going to murder the dude that helped me make this script brb

#

what should i replace backpackcargo global with

#

wait

#

would it be

winter rose
#

addItemToBackpack?

bold mica
#

is it really this

#

im going to cry

winter rose
bold mica
#

YEP IT WAS

#
player addEventHandler ["Take", { 
    params ["_unit", "_container", "_item"]; 
 
    if ( 
        _container isEqualTo backpackContainer _unit &&  
        toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] &&  
        _item == "ACRE_PRC117F" 
    ) then { 
        player addItemToBackpack _item; 
    }; 
}];```
#

so like this?

winter rose
#

no; read the last link I provided

#

yup

bold mica
#

yay

winter rose
#

(or "_item")

bold mica
#

i alt tab back into arma and my base just got scud launcher'd

willow hound
#

It surprises me that _item == "ACRE_PRC117F" works as ACRE should replace that base class with a unique class.

bold mica
#

hhhhhhh didnt work

#

is it because i have _container

winter rose
bold mica
#

i am a monkey

winter rose
#

go to bed too, if you are too tired to read code ๐Ÿ˜„ nothing good can come out of it

bold mica
#

its 5pm

winter rose
#

lies!

finite sail
#

wine oclock

bold mica
#

wah it still no work

winter rose
#

โ€ฆtake a nap? ๐Ÿ˜„

willow hound
#
player addEventHandler ["Take", { 
    params ["_unit", "_container", "_item"]; 
 
    if ( 
        _container isEqualTo backpackContainer _unit &&  
        toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] &&  
        _item == "ACRE_PRC117F" 
    ) then { 
        systemChat "Success!";
    }; 
}];
```Can you run this and tell us if you see the "Success!" message?
bold mica
#

nope

willow hound
winter rose
#
player addEventHandler ["Take", { 
    params ["_unit", "_container", "_item"]; 
 systemChat str _this; // RUN THIS
    if ( 
        _container isEqualTo backpackContainer _unit &&  
        toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] &&  
        _item == "ACRE_PRC117F" 
    ) then { 
        systemChat "Success!";
    }; 
}];
willow hound
#

_item should be something like "ACRE_PRC117F_ID_123"

#

But different for each unit and each radio you add / pick up

bold mica
#

i..

#

thats a pain..

#

so each ACRE radio has its own ID and everytime you pick up a new radio it assigns a new ID?

willow hound
#

Yes. It needs to be that way because inventory stuff is not actually objects, so the only way to distinguish stuff in the inventory is by its class name.

winter rose
#

you can check if a string starts with such class (and maybe use isKindOf)

willow hound
#

Replace _item == "ACRE_PRC117F" with [_item, "ACRE_PRC117F"] call acre_api_fnc_isKindOf.

willow hound
bold mica
#
player addEventHandler ["Take", {  
    params ["_unit", "_container", "_item"];  
  
    if (  
        _container isEqualTo backpackContainer _unit &&   
        toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] &&   
        [_item, "ACRE_PRC117F"] call acre_api_fnc_isKindOf  
    ) then {  
        systemChat "Success!"; 
    };  
}];```
willow hound
#

Almost

winter rose
#

.

willow hound
#

Try if you get "Success!" now

bold mica
#

nope i got something completely different

#

bis_o2

#

something with dummyweapon.p3d

willow hound
#

Post the code you ran please magic

bold mica
#
player addEventHandler ["Take", {   
    params ["_unit", "_container", "_item"];   
   
    if (   
        _container isEqualTo backpackContainer _unit &&    
        toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] &&    
        [_item, "ACRE_PRC117F"] call acre_api_fnc_isKindOf   
    ) then {   
        systemChat "Success!";  
    };   
}];```
exotic flax
#

Did you check all three of the checks in that if statement separately, to see if they work?

willow hound
#
player addEventHandler ["Take", {   
    params ["_unit", "_container", "_item"];   
   
    if (   
        _container isEqualTo backpackContainer _unit &&    
        toLower backpack _unit in ["tfw_ilbe_a_gr","tfw_ilbe_dd_gr"] &&    
        ([_item, "ACRE_PRC117F"] call acre_api_fnc_isKindOf)   
    ) then {   
        systemChat "Success!";  
    };   
}];
```Worth a try I guess, I'm running out of ideas ![meowsweats](https://cdn.discordapp.com/emojis/707626030613135390.webp?size=128 "meowsweats")
bold mica
#

aaaaa....

#

nope,

winter rose
#

SYSTEMCHAT STR _THIS

bold mica
#

sys chat responeded with []

winter rose
#

if you did put it under params, no

bold mica
#

i just threw it into the debug console

#

the "iskindof" is coming back as false?

winter rose
#
// debug
player addEventHandler ["Take", {
  params ["_unit", "_container", "_item"];
  private _initialThis = +_this;
  private _isUnitBackpack = _container isEqualTo backpackContainer _unit;
  private _isWantedBackpack = toLowerANSI backpack _unit in ["tfw_ilbe_a_gr", "tfw_ilbe_dd_gr"];
  private _isWantedItemType = [_item, "ACRE_PRC117F"] call acre_api_fnc_isKindOf;

  systemChat str [_initialThis, _isUnitBackpack, _isWantedItemType];
}];
bold mica
#

no response ins syschat

#

dummyweapon.p3d for everytime i reload

#

pickup the backpack i get false false

#

acre_117f_id3, false, true

willow hound
#
player addEventHandler ["Take", {
  params ["_unit", "_container", "_item"];
  systemChat str _this;
  systemChat str (_container isEqualTo backpackContainer _unit);
  systemChat str (backpack _unit);
  systemChat str ([_item, "ACRE_PRC117F"] call acre_api_fnc_isKindOf);
}];
```Restart the mission / preview and test with this, we're missing something here ![think_turtle](https://cdn.discordapp.com/emojis/700311400094105672.webp?size=128 "think_turtle")
bold mica
#

the backpack came back as false?

#

picked up 117
false
(backpack classname)
true

willow hound
#

Okay that sounds good

#
player addEventHandler ["Take", {
  params ["_unit", "_container", "_item"];
  systemChat str (_container isEqualTo backpackContainer _unit);
  systemChat str (toLowerANSI (backpack _unit) in ["tfw_ilbe_a_gr", "tfw_ilbe_dd_gr"]);
  systemChat str ([_item, "ACRE_PRC117F"] call acre_api_fnc_isKindOf);
}];
```Should be three times "true" when you use one of the target backpacks and drop the 117 on the ground
bold mica
#

when i drop it on the ground i get nothing

#

when i pick it up

#

i get something

#

false
(backpack classname)
true
false
true
true

willow hound
#

Hmmmm then "Take" doesn't fire when taking items from backpack / inventory.

bold mica
#

what if its Put

#

its put

#

i got false true true when i used "put"

willow hound
#

Progress

bold mica
#

could the backpack config be broken?

#

i kinda... edited ILBE's backpack a little bit, ltierally just changed weight and mass, imma post it to the workshop as unlisted tho

exotic flax
#

Do you have permission for that?

willow hound
#

No, with "Put", _container is the target container, and that's not your backpack

bold mica
#

ya

exotic flax
bold mica
#

did you just plug me your mod

#

also im running acre

exotic flax
#

Only need to change mass and rework the ACRE antenna's (is a pain to do, trying to do that for a year now)

bold mica
#

yeah im just making this jerry rig for now

exotic flax
#

because ACRE has separate radios which are not tied to backpacks, so you need to handle ALL event handlers in case you want to add it.
And then simply use:
if (_item == backpack player && _item isKindOf "tfw_ilbe_Base") then {

bold mica
#

?

#

confused nyx noises

#

i got the seperate radios thing

willow hound
#

Since the 117 doesn't fit into anything but backpacks, we can probably also do something like this:

player addEventHandler ["Put", {
  params ["_unit", "_container", "_item"];
  if (toLowerANSI (backpack player) in ["tfw_ilbe_a_gr", "tfw_ilbe_dd_gr"] && !([player, "ACRE_PRC117F"] call acre_api_fnc_hasKindOfRadio)) then {
    systemChat "Player has no 117!";
  };
}];
exotic flax
bold mica
#

false true true + message

#

its held to gether by duck tape and hope

#

waht if i just use the backpack base like grez suggested

willow hound
#

Using the "Put" EH you can only detect the player dropping it from the inventory himself though, if somebody else takes it from his backpack I don't know, and if he has access to an Arsenal he can get rid of it there without firing the EH.

bold mica
#

hm'

#

well reloading would trigger it

#

since it removes and adds a magazine

exotic flax
#

Take, ContainerClosed and arsenalClosed are the EH's you're looking for

bold mica
#

does the backpack count as container closed

#

brb lemme reload my map

willow hound
exotic flax
#

no, but if you take the backpack from a container it will trigger

bold mica
#

Huh

exotic flax
bold mica
#

the ground counts

#

and reloading also triggers it

#

i mean i could make a group rule for people who run this backpack... and ill just enforce it via zues..

willow hound
#

That might be simpler

bold mica
#

that means i can be a d*** and delete their medical supplies to fit it!

willow hound
#

Could also run a loop every minute or so to check it for you

bold mica
#

i mean...

exotic flax
#

So unless the classnames of the radios are borked, this will work

player addEventHandler ["Take", {
   params ["_unit", "_container", "_item"];
   if (toLowerANSI _item in ["tfw_ilbe_a_gr", "tfw_ilbe_dd_gr"] && !([_unit, "ACRE_PRC117F"] call acre_api_fnc_hasKindOfRadio)) then {
      _unit addItemToBackpack "ACRE_PRC117F";
   };
}];
player addEventHandler ["InventoryClosed", {
   params ["_unit", "_container"];
   if (toLowerANSI (backpack _unit) in ["tfw_ilbe_a_gr", "tfw_ilbe_dd_gr"] && !([_unit, "ACRE_PRC117F"] call acre_api_fnc_hasKindOfRadio)) then {
      _unit addItemToBackpack "ACRE_PRC117F";
   };
}];
[missionNamespace, "arsenalClosed", {
   if (toLowerANSI (backpack player) in ["tfw_ilbe_a_gr", "tfw_ilbe_dd_gr"] && !([player, "ACRE_PRC117F"] call acre_api_fnc_hasKindOfRadio)) then {
      player addItemToBackpack "ACRE_PRC117F";
   };
}] call BIS_fnc_addScriptedEventHandler;
bold mica
#

ok, lemme test ๐Ÿ™‚

exotic flax
#

Just keep in mind that if the backpack is full, it won't add the radio!!!

bold mica
#

yee

#

oh my god

#

it worked

#

reloading the gun will force people to have it

exotic flax
bold mica
#

its for the take

#

event handler

#

reloading a mag makes you "drop" and then "pick it up"

exotic flax
#

which is why you should check if the taken item is the backpack, and not anything...

bold mica
#

yep

#

it only repleaces the 117

exotic flax
#

and it will break when someone carries another LR radio ๐Ÿคฃ

bold mica
#

ill cry

#

ill test it

exotic flax
#

you just get 2 radios (if it fits), but I have no idea how ACRE handles that

bold mica
#

nope it doesnt dupe

#

acre would handle it as having a 2nd or 3rd radio

exotic flax
#

hence why I'm working on a solution to have different antennas (as the whole mod is designed for), and don't care about the radio being used

willow hound
#

If you already have a 117 !([_unit, "ACRE_PRC117F"] call acre_api_fnc_hasKindOfRadio) becomes false.

bold mica
#

wdym different antennas, as different ranges for the 117? or a different radio altogether

exotic flax
#

different antenna; ACRE supports different antennas for each radio

bold mica
#

oh

exotic flax
#

so possible to have different ranges based on the antenna being used

bold mica
#

yee like the placeable, so ur turning the backpack into a range extender basically?

exotic flax
#

no; just change the actual antenna config which is connected to the radio

#

backpack is just a visual

bold mica
#

h

exotic flax
#

welcome to the pain of modding ACRE...

bold mica
#

yeap its really hard to understand... also how do you change the antenna on the SEM 52SL

exotic flax
#

["ACRE_PRC152_ID_1",0,"ACRE_120CM_VHF_TNC",HASH_CREATE,false] call acre_sys_components_fnc_attachSimpleComponent

bold mica
#

uh

exotic flax
#

yup; better start reading the source code of ACRE to still not understand how it works... I'm exactly at that part

dusty badger
#

Hmm so im trying to think of methods to evaluate the spatial cohesiveness of players

#

Basically a coefficient that goes up the closer a player is to everyone else

exotic flax
#

if you have the math for it, it's easy to implement

dusty badger
#

my initial gut reaction is to just get the average distance from every player to every other player but that feels expensive to me

#

I dont know if it actually is

exotic flax
#

That wouldn't make much sense; having 4 people close and 1 far away will then have a worse result than all 5 at an equal mid-range. Although it's easy to do.
For a "perfect" number you would need to have a very complex formula based on amount, range, and how close other people are to others (eg. if you are close to a group it's better than close to multiple single players)

#

That will be complex, but still doable

#

and as long as it doesn't have to run on each frame (and can be off-loaded to only calculate own numbers per client), than the performance should be too big

#

Each player stores the amount of other players with 10m, 25m and 50m, which is calulculated in a number (eg. (_amount10m * 1) + (_amount25m * 0.7) + (_amount50m * 0.5))
In addition it will take the _amount10m value from all players within 10m distance, and add the total + (_other10mtotal * 0.2).
And this is the total number you can use further in your calculations/scripts.

atomic arrow
#

greetings ... this might be a stupid quiestion ... is there a easy way to assign multi variables the same value... like a1, a2, a3, a4, enableAI "MOVE";

#

with out having to copy pasta each enableAI section to each var

exotic flax
#

you can loop over all the variables

#

like this ```sqf
{
_x enableAI "MOVE";
} forEach [a1, a2, a3, a4, a5];

atomic arrow
#

thank you good sir .... i cant tell you how many hours ive been banging my head against the keyboard trying to work this crap out... now things are finally starting to fall into place ...

exotic flax
#

it's a well know problem ๐Ÿคฃ

atomic arrow
#

when creating squads, can i apply the disableAI move to the group or do i need to apply it to each individual unit

exotic flax
#

for each unit

atomic arrow
#

balls

exotic flax
#

but you can use some magic:

_groupVars = [g1, g2, g3];
{
   {
      _x enableAI "MOVE";
   } forEach units _x;
} forEach _groupVars;

This will loop over the groups, and then over each unit in that group

atomic arrow
#

so each unit needs its own var name? or is it just the group name

exotic flax
#

no, just the group

atomic arrow
#

ah so "g1" is the group var name ... right.. i will get this programming stuffs... eventually

exotic flax
#

SQF has a lot of commands and functions which can make your life easier; simply check the wiki for what is possible and how stuff works

atomic arrow
#

sqf?

queen cargo
#

The scripting language youre using for Modding arma is called sqf

atomic arrow
#

ah

spring vigil
#

anyone ever use "bis_fnc_arsenal_data" ?

agile pumice
#

How do I convert this model space position to world space?

cursorTarget selectionPosition [(_doorArr select 1) select 0, "Memory"];```
#

I've been looking at modeltoworld and worldtomodel but I can't make it make sense

#

modeltoworld requires an object for the first param

#

is this the correct usage?

_memPointPos = cursorTarget selectionPosition [(_doorArr select 1) select 0, "Memory"];
            _memPointPosWorld = cursorTarget modeltoWorld _memPointPos;```
tepid osprey
#

Im trying to make foldable peltors compatable with ACE does anyone have a sample or is there any chance I can get some help with making my configs/getting it to work

tepid osprey
#

I have the model and function SQF but what should I put in the config?

sudden yacht
#

So question is it possible to set the max fly in height of a unit in a config?

winter rose
thorn saffron
#

How can I pass stuff into functions called via setWaypointStatements?
This works ["true", "[this] spawn taro_ta_fnc_deleteVehAndCrew"]; and this refers to the vehicles driver. However this:
["true", "_stuff spawn taro_ta_fnc_deleteVehAndCrew"];
does not work and I have no idea how to pass more complicated params down the line.
And yes I do have to use the setWaypointStatements, because I'm creating new waypoints on the fly and running variety of scripts and functions on them.

#

and yes I do realize that setWaypointStatements expects a string, but I have no idea how to turn an array with params into a string and then put it into the setWaypointStatements

tidal swallow
#

Can someone explain me whats causing this error.
15:18:19 Error in expression <ce}count playableUnits isEqualTo 16)
) then {
_Unit_list = _Unit_list - [_x];
d>
Error position: <then {
_Unit_list = _Unit_list - [_x];
d>
Error Undefined behavior: waitUntil returned nil. True or false expected

exotic flax
#

waitUntil returned nil. True or false expected

finite sail
#

brackets

tidal swallow
#

Where ๐Ÿ˜…

finite sail
#

(count playableUnits) isEqualTo 16

exotic flax
#

perhaps post the whole code, instead of just the error message (which tells you what is wrong...)

tidal swallow
#

I can't at the moment because I'm not at my computer. I can tag you when I post it

#

what youuu @finite sail

exotic flax
#

... posts error for help, gets help but can't receive it...

#

it's like a deaf person calling a support phone...

finite sail
#

any reason you're using playableUnits instead of allPlayers?

exotic flax
#

because they are different?

finite sail
#

just wondering if hes using the best one for his use case,

exotic flax
#

based on previous comments on this Discord do I doubt that he knows how the script even works... let alone why it's using one command or another...
end of rant

finite sail
#

probably, yes

oblique arrow
#

Hey peeps, any chance you know if there is a way to move a vehicles turret, without the need of ai?

finite sail
#

afaik, you need AI

exotic flax
#

And even with AI in the turret it's a pain...

oblique arrow
#

Welp rip blobdoggoshruggoogly

#

Then I'll jut leave them in the standard position

finite sail
#

just give the AI a lookat

exotic flax
#

Best I've managed was making a turret turn around (move horizontal), but it was not possible to make it move vertical reliable

finite sail
#

yes, me too

tidal swallow
tidal swallow
warm coral
#

does anyone know how to get a random sound from a list each time a script fires?

warm hedge
#

selectRandom

warm coral
#

so it will be like

#

list = {"Classname1","Classname2"};

selectRandom list

#

right

warm hedge
#
selectRandom ["className1","className2"];```Will just do
warm coral
#

oh okay thanks

warm coral
#
[_object,"pali1"] remoteExec ["say"];```
#

and is this function even correct

#

because it doesnt work

tidal swallow
#

I think you could create an array of classes and in remoteExec use selectRandom, or create an array from selectRandom. I think both should work. But this is like really basic logic function. Try if it works

#

Use remoteExec to call a class from array

#

like... remoteExec [selectRandom[_say], 0]

#

array should be _say = [class1, class2,...]

tidal swallow
#

But if u want it to be executed on client side (for server use) I think its better to use exevVM in initPlayerLocal.sqf

tidal swallow
#

here is also another function you could use

#

that you add playSound (_sounds select ([0,(count _sounds)-1] call BIS_fnc_randomInt๏ปฟ))๏ปฟ into remoteExec

hollow thistle
#

If it's an object reference or something, setVariable it on group and fetch it from group when statement is executed.

thorn saffron
#

I see, I was using setVariable, but I thought there might be more elegant solution

low birch
#

Is there a way to get a bullet owner? For example - to get a person who set the damage?

short vine
#

Looking into changing time locally for a user.
I noticed the skipTime command syncs up with the server every ~5 seconds.
Is there a way to disable that sync?

obtuse quiver
#

so, im trying to create a cod style uav thingy and i cannot figure it out, tried pre-made scripts i tried making some none worked, the obj is, i want to create a script that generates a marker on a player for about 10 seconds every minute

#

and i need a hint that announce that opfor is being marker on map

willow hound
willow hound
obtuse quiver
#

im using those but i cannot figure it out still

#

'cause im stoopid

willow hound
#

Mind sharing what you have so far?

obtuse quiver
#

i was using this

_center = param [1,player];
_deleteTime = param [2,10];
_posTolerance = param [3,0];

_nearestUnits = nearestObjects [_center, ["man"], _radius];

systemChat "Scanning in progress...";

for "_i" from 0 to (count _nearestUnits) - 1 do
{
   _unit = _nearestUnits select _i;
   if (side _unit != playerSide) then
   {
       _marker = createMarker [format ["tempMarker_%1",_i], [_unit, _posTolerance, random(360)] call BIS_fnc_relPos];
       format ["tempMarker_%1",_i] setMarkerType "o_unknown";
       format ["tempMarker_%1",_i] setMarkerColor "ColorUNKNOWN";
       format ["tempMarker_%1",_i] setMarkerSize [0.5, 0.5]; 
       
   };
   sleep 1;
};

systemChat format ["%1 hostile Entities found.",count _nearestUnits];
systemChat format ["Position tolerance: %1 m",_posTolerance];
sleep _deleteTime;

for "_i" from 0 to (count _nearestUnits) - 1 do
{
   deleteMarker format ["tempMarker_%1",_i];
   sleep 1;
};```
#

inside reveal.sqf

#

activated via radio alpha

willow hound
#

I'm guessing your main problem is that the marker positions don't update?

obtuse quiver
#

It actually never show up

#

and i would like to make a better code

willow hound
#

Does the "Scanning in progress..." message show?

obtuse quiver
#

negative

quartz coyote
#

Hello,
Which do you think is the smartest/fastest ?

waitUntil { ((allDeadMen) findIf {isPlayer _x}) isEqualTo -1 };```
```SQF
waitUntil { {alive _x} count allPlayers isEqualTo count allPlayers };```
obtuse quiver
#

i think the second one is the fastest not sure tho

robust hollow
#

the first should be faster, though they are checking slightly different things.

#

itl stop at the first time the condition passes, whereas the second will continue counting even if it fails one.

#

iirc allDeadMen is quite slow though, so Iโ€™d check if a unit in all players is not alive with findIf.

willow hound
# obtuse quiver and i would like to make a better code
params [["_radius", 50], ["_center", player], ["_deleteTime", 10], ["_posTolerance", 0]];
private _ttl = time + _deleteTime;

while {time < _ttl} do {
  private _markersArray = [];
  {
    if (side _x != playerSide) then {
      private _marker = createMarker ...;
      //Do the other marker creation stuff here
      _marker pushBack _markersArray;
    };
  } forEach (_center nearEntities ["Man", _radius]);
  sleep 2;
  {
    deleteMarker _x;
  } forEach _markersArray;
};
```This is still not ideal as the markers get deleted and recreated every cycle, so there is still room for improvement (for example if you know that `_center nearEntities ["Man", _radius]` will always return the same units).
willow hound
# obtuse quiver negative

Then I would assume that your script is not starting properly... You have a trigger with Radio Alpha activation and execVM "reveal.sqf";?

obtuse quiver
#

i'll try it now and thanks

willow hound
#

By the way, you don't need to use format ["tempMarker_%1",_i] every time, you can use _marker.

obtuse quiver
#

didn't know that thanks alot m8

quartz coyote
willow hound
#

Big logic error in my code fixed meowsweats

#

Another one meowsweats meowsweats

obtuse quiver
#

Lol

#

Little question, should i change the activation mode?

willow hound
#

Do you get the option to use the trigger with uhhhhhh 0-8-1 (I believe)?

#

Or does Radio Alpha not show up?

robust hollow
obtuse quiver
#

nono, radio shows up but i get an error script once i activate it

willow hound
#

Well well well what does it complain about?

obtuse quiver
#

sending screenshot

tribal onyx
#

This seems like such a basic question, I even personally feel I'm missing something obvious, especially relating how Arma handles scopes/variables:

Is there a way to earmark a unit?
Example, some groups got placed in the editor, then during game I create group A, B and C using BIS_fnc_spawnGroup, and after some trigger, I give some waypoint to all units of a SIDE, except group A and B

As is, all I can think of is putting A,B in a custom array at creation and then subtract that array from allGroups. But that does require to keep track of that created custom array somehow, and I can see it getting real messy if I want to run that initial spawn script multiple times (so have multiple "group A"). ||Again, super hypothetical example, just trying to wrap my head around Arma 3 scripting||

obtuse quiver
willow hound
#
private _marker = createMarker ...;
//Do the other marker creation stuff here

Well, I didn't complete that because it's not relevant to the logic, you can easily fix / complete it yourself blobcloseenjoy

obtuse quiver
#

Oh, okey dokey thank you for your time

willow hound
#

Does it work?

willow hound
# tribal onyx This seems like such a basic question, I even personally feel I'm missing someth...

You are right, I think I would do that with an array too. It's pretty simple though:

SpecialGroupsArray = []; //Only run this once (in initPlayerLocal.sqf for example)!

//Every time you create a special group you do it like so:
SpecialGroupsArray pushBack ([...] call BIS_fnc_spawnGroup);
```That way all your special groups are always in `SpecialGroupArray` and you can access and exclude them easily.
lucid mason
#

ah ok wrong section, thanks will clear this and post there.

obtuse quiver
#

i don't know what im doing lol

willow hound
#

Oh, maybe I should have written it after all since you seem to have not used forEach before. This is how I had it planned:

private _marker = createMarker [format ["tempMarker_%1", _forEachIndex], [_x, _posTolerance, random(360)] call BIS_fnc_relPos];
_marker setMarkerType "o_unknown";
_marker setMarkerColor "ColorUNKNOWN";
_marker setMarkerSize [0.5, 0.5];
```Inside a forEach-loop, `_x` is the current element and `_forEachIndex` is the current loop iteration.
obtuse quiver
#

now i understand and it works : )

agile pumice
#

looking for best effiiciency

willow hound
#

Uhm

little raptor
#

wat is that?! meowsweats

willow hound
agile pumice
#

or maybe this?

_line1 = ["Commaner Zlatko", "Well this is a fine fucking mess we're in, welcome to the party, Americans. I'm down over half my men, and these barbarians show no sign of stopping."];
_line2 = ["Commaner Zlatko", "Help my men re-inforce the compound, we MUST hold this position."];
_line3 = ["Commaner Zlatko", "I also have critically wounded that need CASEVAC on the lower level. Our supplies are low and our own helicopters are at least an hour away."]; 
_comeback = ["Commaner Zlatko", "Come back, I have more to say!"]; 
{
    if ((player distance o1) > 3) exitwith {[[_comeback],"COMMAND",0.1,true] execVM "scripts\fn_simpleConv.sqf";};
    [[_x],"COMMAND",0.1,true] execVM "scripts\fn_simpleConv.sqf";
} forEach [_line1,_line2,_line3];
#

@little raptor its a proof of concept

willow hound
agile pumice
#

its not my code and I don't have permission to modify it

willow hound
#

You don't need to modify fn_simpleConv.sqf to make it a function.

agile pumice
#

You're right, my mistake

little raptor
#

you do realize that what you wrote is wrong in every way right?!

agile pumice
#

the first time?

little raptor
#

both times

agile pumice
#

what's wrong the second time?

little raptor
#

for one it won't even "compile"

#

[_x],"COMMAND",0.1,true]

agile pumice
#

oh true, missing [

little raptor
#

and it's logically flawed

willow hound
#

Problem is, unless TAG_fnc_simpleConv offers a way to detect when the conversation is done, you can't really use a forEach-loop for your _comeback-message. In fact, unless TAG_fnc_simpleConv has a queue of conversations, you can't really use the forEach-loop at all (unless you want all conversations to happen at the same time).

agile pumice
#

I'm gonna have to double check with that

#

okay so here's the loop inside simpleConv

//Loop through all given lines
for "_i" from 0 to (count _lines) - 1 do
{
    private _nameSpeaker = (_lines select _i) select 0;
    private _currentLine = (_lines select _i) select 1;
    private _speaker = (_lines select _i) param [2,objNull,[objNull]];
    private _break = count _currentLine * _breakMultiplier;

    if !(isNull _speaker) then {_speaker setRandomLip true};
    private _handle = [_nameSpeaker,_currentLine,_colourHTML,_break,_showBackground] spawn _fnc_showSubtitles;
    waitUntil {scriptDone _handle}; //<-- line 132

    if !(isNull _speaker) then {_speaker setRandomLip false};

    sleep FADE_DURATION + 0.5;
};
#

perhaps if I add a new variable and add it like such, I can use it for iteration outside the script:

waitUntil {scriptDone _handle}; //<-- line 132
    Revo_fnc_simpleConversation_lineDone = true;
spark turret
#

Yeah you could suspend the loop waiting till the line is said

#

Convos in arma suck behind and are awful.

agile pumice
#

something like this should work right?

{
    if ((player distance o1) > 3) exitwith {[[_comeback],"COMMAND",0.1,true] execVM "scripts\fn_simpleConv.sqf";};
    [[_x],"COMMAND",0.1,true] execVM "scripts\fn_simpleConv.sqf";
    waitUntil {Revo_fnc_simpleConversation_lineDone};
} forEach [_line1,_line2,_line3];
little raptor
vast moss
#

Im a relative noob to arma modding.

#

I want to change some of the properties of a vehicle and I dont know which classes I need to reference to get it to work.

#

I want to edit the sensors of the vehicle, so im calling the class like this:

class Components: Components
        {
            class SensorsManagerComponent
            {
                class IRSensorComponent: SensorTemplateIR
                {
                    class AirTarget
                    {
                        minRange=0; 
                        maxRange=2000;
                        objectDistanceLimitCoef=-1;    
                        viewDistanceLimitCoef=-1;    
                    };
#

at the start of the file I added this, but it doesnt seem to work

    class VES_AV14_AGM
    {
        class components;
    };
vast moss
#

Nvm figured it out, I just needed to call the correct base class.

vast moss
#

Can someone help me with setting up the inheriting correctly?

#

I have no idea how to navigate this maze.

willow hound
# agile pumice something like this should work right? ```sqf { if ((player distance o1) > 3...

Obtaining the script handle and waiting is much easier:

_handle = [["Sample text"], "Sample text", 0.1, true] spawn Revo_fnc_simpleConv;
waitUntil {scriptDone _handle};
```But, again, you can't really use a forEach-loop because it will break with `_comeback`:
```sqf
{
  if (_x == "2") exitWith {
    systemChat "!";
  };
  systemChat _x;
} forEach ["1", "2", "3"];
```This will output "1" and "!" and then terminate the loop because of `exitWith`; "2" and "3" are skipped.
In your code it's the same, if the player is too far away when the condition is checked, `_comeback` is executed, but nothing after that.
willow hound
vast moss
#

Thanks, ill go look in the other channel.

cosmic lichen
#

_handle = [["Sample text"], "Sample text", 0.1, true] spawn Revo_fnc_simpleConv;'
Holy cow, that's old ๐Ÿ˜„

cosmic lichen
#

is uiNamespace available on preStart?