#arma3_scripting

1 messages ยท Page 51 of 1

hallow mortar
#

If only there was a list of possible data types, which had previously been linked, which might contain this information

stray flame
#

seems like a yes

#

and testing says yes too

drowsy geyser
#

finally we can get the video settings

nocturne smelt
#

question, how does one make infinitely spawning enemies?

winter rose
#

scripts (createGroup/createUnit)

nocturne smelt
foggy stratus
#

I've written a script where player commands squad AI to hide weapons in backpack, and another to command squad AI to pull their weapons from the backpack. They work great if unit's not in vehicle. But if in vehicle, the AI will not draw their weapons (but will after they exit). This is the pull weapons script. I guess action "TakeWeapon" will not execute while unit in vehicle. I like it as is because TakeWeapon guarantees all weapon attachments still on weapon when unit takes it.

#

jboy_pullWeapons = { params ["_unit"]; private _ammobox = backpackContainer _unit; private _weapons = (getWeaponCargo _ammobox #0) ; { _unit action ["TakeWeapon",_ammobox, _x]; } forEach _weapons; };

#

If unit in vehicle, how do I get him to actually pull the weapon so he's holding it while in a fire-from-vehicle position? If I addWeapon instead of action "TakeWeapon", then the weapon will not have attachments.

little raptor
foggy stratus
#

Yeah, thanks. I was hoping for a short cut. ๐Ÿ™‚

tough parrot
#

what does marker mean in task param ["description", "title", "marker"]?

winter rose
#

I don't see that anywhere, you mean the config?

tough parrot
winter rose
#

the "marker" is the task's 3D waypoint

#

(appears if you set a destination ofc)

tough parrot
#

what data type is it?

#

i mean if the position is in the 4th param, i can't understand what that one is supposed to be

#

then the icon seems to be in the CfgTaskTypes

winter rose
#

string ("")

tough parrot
# winter rose string (`""`)

It gives an example using both 2d and 3d icon in CfgTaskType, so I don't get what the marker is supposed to be.

#

3d text?

winter rose
#

yes, this is the marker's text

faint oasis
#

Is it possible to get the command "moveTo" working outside of an FSM ? Because, for me the command doesn't work, and i really want to be able to move a group under fire. Currently nothing work and i don't know what to try. I disabled "AUTOCOMBAT", "COVER", "SUPPRESSION", "TARGET" but still not working. I combined this with an "Oneachframe" that "forgetTarget" for the group but it's working only 1/5 times otherwise the leader is stuck. I just want to be able to move an AI group to a specific position without any stop caused by the enemies. It's not really complicated but in Arma 3 it's almost impossible.

oblique pewter
#

hey guys how would i make this script work, i cant figure out how to define _display, this is to hide an arsenal button

#
    PW_RestrictArsenal = true;
    publicVariable "PW_RestrictArsenal";
    [[], {
        
        while {PW_RestrictArsenal} do {

            waitUntil {uiSleep 0.1; !isNull (uinamespace getvariable ["BIS_fnc_arsenal_cam",objNull])};
              if(PW_RestrictArsenal) then {

                 disableSerialization;
                  _display = ?;//whats the name of the arsenal display
                   {(_display displayCtrl _x) ctrlShow false} forEach [44151, 44150, 44146, 44147, 44148, 44149, 44346];
              
                };
            
            
        };
    }] remoteExec ['spawn',0,"PW_RestrictedArsenal_JIP"];



    ```
oblique pewter
#

cant

#

not allowed on pub zeus

faint oasis
# little raptor use doStop first

I tried and it is working so thank you ๐Ÿ™‚ but sadly it seems to be the same problem. In general when i disable everything like "AUTOTARGET" etc before they enter in combat then it's working but otherwise if they are already in combat there is no way to order them to move somewhere like a retreat or an offensive. The AI stay in place and die.

faint oasis
#

I tried this code :

{
    _x disableAI "ALL";
    _x enableAI "ANIM";
    _x enableAI "MOVE";
    _x enableAI "PATH";
    _x enableAI "TEAMSWITCH";
}forEach (units (group attackunit));

And it is working perfectly but sadly only when the units are not in combat, otherwise the leader is stuck in his position and i think it come from the "FSM" scripts so is it possible to stop the combat ? or to stop an FSM script ?

hallow mortar
#

Don't forget to switch them out of Combat behaviour mode. Disabling the AUTOCOMBAT AI feature prevents them from switching into it, but if they're already in it, they won't immediately switch out. Forcing them into Safe or Aware can break them out of their combat state.

faint oasis
thorny gull
#

I am trying to figure out how to make custom spawn points that can be selected, but meanwhile having everyone spawn inside a turret at the start of the mission, so that the first time they spawn they are in the turret but each time the spawn after, they can spawn elsewhere and select a respawn

#

I donโ€™t know if this or mission making would be the better place to ask, Iโ€™d assume Iโ€™d need some scripting to do something like this?

meager granite
#

Guys, interested in your opinions. Should drawRectangle/drawEllipse/drawIcon commands be auto rotated alongside with the map?

#

Here is example, top 3 shapes are createMarker, bottom 3 shapes are draw* commands

#
    testcenter = getPosWorld player;

    if(!isNil"testrectangle") then {deleteMarkerLocal "testrectangle"};
    testrectangle = createMarkerLocal ["testrectangle", testcenter vectorAdd [50,50,0]];
    testrectangle setMarkerShapeLocal "RECTANGLE";
    testrectangle setMarkerSizeLocal [20, 50];
    testrectangle setMarkerBrushLocal "SolidFull";
    testrectangle setMarkerColorLocal "ColorRed";

    if(!isNil"testellipse") then {deleteMarkerLocal "testellipse"};
    testellipse = createMarkerLocal ["testellipse", testcenter vectorAdd [-50,50,0]];
    testellipse setMarkerShapeLocal "ELLIPSE";
    testellipse setMarkerSizeLocal [20, 50];
    testellipse setMarkerBrushLocal "SolidFull";
    testellipse setMarkerColorLocal "ColorRed";

    if(!isNil"testicon") then {deleteMarkerLocal "testicon"};
    testicon = createMarkerLocal ["testicon", testcenter vectorAdd [0,50,0]];
    testicon setMarkerShapeLocal "ICON";
    testicon setMarkerSizeLocal [2, 2];
    testicon setMarkerTypeLocal "mil_arrow2_noShadow";
    testicon setMarkerColorLocal "ColorRed";

    {
        if(!isNil{_x getVariable "testeh"}) then {
            _x ctrlRemoveEventHandler ["Draw", _x getVariable "testeh"];
        };
        _x setVariable ["testeh", _x ctrlAddEventHandler ["Draw", {
            params ["_map"];

            _map drawRectangle [
                 testcenter vectorAdd [-50,-50,0]
                ,20
                ,50
                ,0
                ,[0.9,0,0,1]
                ,"#(rgb,8,8,3)color(1,1,1,1)"
            ];

            _map drawEllipse [
                 testcenter vectorAdd [50,-50,0]
                ,20
                ,50
                ,0
                ,[0.9,0,0,1]
                ,"#(rgb,8,8,3)color(1,1,1,1)"
            ];

            _map drawIcon [
                 "\A3\ui_f\data\map\markers\military\arrow2_CA.paa"
                ,[0.9,0,0,1]
                ,testcenter vectorAdd [0,-50,0]
                ,32 * 2
                ,32 * 2
                ,0
            ];
        }]];
    } forEach (
        [findDisplay 12 displayCtrl 51]
        + (uiNamespace getVariable ["IGUI_displays", []] select {ctrlIDD _x == ctrlIDD(uiNamespace getVariable "RscCustomInfoMiniMap")} apply {_x displayCtrl 101})
    )
```Code to see this in action.
#

Run it in debug console and switch to rotating GPS: R.Ctrl + ]

#

My arguments:

  • drawEllipse and drawRectangle should be rotated alongside with the map because their coordinates and dimensions are described in relation with the map - world position and world meters, so rotation should also be relative to the world displayed, not the UI/screen.
  • drawIcon is a mixed bag, position is world again but size is UI size (x = 640 = SafeZoneW, y = 480 = SafeZonH), not world size in meters, but I'd also make drawIcon rotate automatically to be in line with other draw* commands.
merry junco
#

I've seen people do this, but I don't know where to start. how would i create a print out for something like RPM of a vehicle

#

for debug purposes

#

I'm a sound guy, but i'm trying to figure out whats going on with the RPM for a vic so i can adjust the sounds accordingly.

tender fossil
#

Just a warning here in case of someone else thinks of using LiteDB for their extension; don't do it KEKW It claims to be thread and process safe but crashes due to concurrency issues like mutex stuff constantly and is abandoned by its developer. Lesson learned, gotta do due diligence properly before choosing an external dependency for one's project...

drowsy geyser
#

is it possible to make a player stay prone if their legs are damaged using this command?
player setHitPointDamage ["hitLegs", 1];

sharp grotto
tender fossil
drowsy geyser
meager granite
#

This command is for pre-A3 1.60 times

#

Surprisingly its pretty hard to keep player from standing up ๐Ÿค”

#

Ok, here is basic script to make player keep going into prone if they leave it:

if(!isNil"test") then {terminate test};
test = 0 spawn {
    waitUntil {
        waitUntil {
            stance player != "prone"
            && getNumber(configFile >> "CfgMovesMaleSdr" >> "States" >> animationState player >> "looped") == 1
        };
        player playActionNow "PlayerProne";
        waitUntil {stance player == "prone"};

        false;
    };
};
#

Test script to get the idea what you need to check for, don't use it 1:1

#

@drowsy geyser ^

#

Basically you need to wait until player's stance is not prone AND current animation is looped (its not a transition between stances)

#

If you don't do looped check, animation stucks

#

Then you do "lay down" action and wait for laying down to happen

#

Not sure how player will react in vehicles, probably need a check for that

#

and also your broken legs check too

gloomy basalt
#

Hi, I have a question and an issue.
I have this bit of code:

params [
    "_targets",    // true = pop-up, false = live.
    "_range"    // true = standard, false = marksman.
];

if (_targets) then {
    ["Steel Targets (Pop-Up) program selected."] call SS_fnc_notify;
    _target = "TargetP_Inf_F";
    if (_range) then {
        _rangeSelected = standardArea;
        systemChat "standard";
    } else {
            _rangeSelected = marksmanArea;
            systemChat "marksman";
    };
};

if (_targets) then {
    ["Live Targets program selected."] call SS_fnc_notify;
    _target = "O_G_Soldier_F";
    if (_range) then {
        _rangeSelected = standardArea;
    } else {
            _rangeSelected = marksmanArea;
    };
};

for "_i" from 0 to 30 do {
    _location = [_rangeSelected] call CBA_fnc_randPosArea;
    _createTarget = createVehicle [_target,_location,[],0,"NONE"];
};

However, when I run a [true,true] call SS_fnc_shootingRange;
I get this error:

params [ ["_zRef", [], ["",objNull,locat>
10:33:34   Error position: <params [ ["_zRef", [], ["",objNull,locat>
10:33:34   Error 0 elements provided, 5 expected
10:33:34 File /x/cba/addons/common/fnc_getArea.sqf..., line 30
10:33:34 Error in expression < CBA_fnc_randPosArea; 
 _createTarget = createVehicle [_target,_location,[],0,"N>
10:33:34   Error position: <createVehicle [_target,_location,[],0,"N>
10:33:34   Error Type Any, expected String
#

I have a feeling that _rangeSelected and _target aren't being passed, but I still get the notification and systemchat message

meager granite
#

Try private'ing _rangeSelected at the beginning of the script

#
private ["_rangeSelected"];
gloomy basalt
#

Still gives the same issue

meager granite
#

Also your both checks _targets instead of !_targets for second one

meager granite
gloomy basalt
meager granite
#
if(true) then {
    _var = 123;
};
//_var is undefined here
private ["_var"];
if(true) then {
    _var = 123;
};
//_var is 123 here
#
private _var = 321;
if(true) then {
    _var = 123;
};
//_var is 123 here
gloomy basalt
#
params [
    "_targets",    // true = pop-up, false = live.
    "_range"    // true = standard, false = marksman.
];

private ["_rangeSelected"];

if (_targets) then {
    ["Steel Targets (Pop-Up) program selected."] call SS_fnc_notify;
    _target = "TargetP_Inf_F";
    if (_range) then {
        _rangeSelected = standardArea;
        systemChat "standard";
    } else {
            _rangeSelected = marksmanArea;
            systemChat "marksman";
    };
};

if (_targets) then {
    ["Live Targets program selected."] call SS_fnc_notify;
    _target = "O_G_Soldier_F";
    if (_range) then {
        _rangeSelected = standardArea;
    } else {
            _rangeSelected = marksmanArea;
    };
};

for "_i" from 0 to 30 do {
    _location = [_rangeSelected] call CBA_fnc_randPosArea;
    _createTarget = createVehicle [_target,_location,[],0,"NONE"];
};

Like this you mean?

meager granite
#

Other variables from inside for loop are undefined too

#

_target that is

gloomy basalt
#

Aaaah, my bad

#

Still get the issue though

meager granite
#

Post the error

gloomy basalt
#

params [ ["_zRef", [], ["",objNull,locat>
10:45:53   Error position: <params [ ["_zRef", [], ["",objNull,locat>
10:45:53   Error 0 elements provided, 5 expected
10:45:53 File /x/cba/addons/common/fnc_getArea.sqf..., line 30
10:45:53 Error in expression < CBA_fnc_randPosArea; 
 _createTarget = createVehicle [_target,_location,[],0,"N>
10:45:53   Error position: <createVehicle [_target,_location,[],0,"N>
10:45:53   Error Type Any, expected String
10:45:53 Error in expression <
meager granite
#

Well it says it, it wants String (probably classname) but its Any

#

Probably _target is undefined.

gloomy basalt
#

_target is being defined in the if scope

meager granite
#

Did you private it beforehand?

gloomy basalt
#
params [
    "_targets",    // true = pop-up, false = live.
    "_range"    // true = standard, false = marksman.
];

private ["_rangeSelected", "_target", "_location","_createTarget"];

if (_targets) then {
    ["Steel Targets (Pop-Up) program selected."] call SS_fnc_notify;
    _target = "TargetP_Inf_F";
    if (_range) then {
        _rangeSelected = standardArea;
        systemChat "standard";
    } else {
            _rangeSelected = marksmanArea;
            systemChat "marksman";
    };
};

if (_targets) then {
    ["Live Targets program selected."] call SS_fnc_notify;
    _target = "O_G_Soldier_F";
    if (_range) then {
        _rangeSelected = standardArea;
    } else {
            _rangeSelected = marksmanArea;
    };
};

for "_i" from 0 to 30 do {
    _location = [_rangeSelected] call CBA_fnc_randPosArea;
    _createTarget = createVehicle [_target,_location,[],0,"NONE"];
};```
Yes
meager granite
#

Looks fine

#

Add logging for each variable in error line to see what they are then

#
diag_log [1, "_target", _target];
...
diag_log [2, "_target", _target];
...
diag_log [3, "_target", _target];
```at various points in your script
#

same for _rangeSelected if that's still an issue

pliant stream
gloomy basalt
# meager granite ```sqf diag_log [1, "_target", _target]; ... diag_log [2, "_target", _target]; ....
params [ ["_zRef", [], ["",objNull,locat>
10:53:24   Error position: <params [ ["_zRef", [], ["",objNull,locat>
10:53:24   Error 0 elements provided, 5 expected
10:53:24 File /x/cba/addons/common/fnc_getArea.sqf..., line 30
10:53:24 Error in expression < CBA_fnc_randPosArea; 
 _createTarget = createVehicle [_target,_location,[],0,"N>
10:53:24   Error position: <createVehicle [_target,_location,[],0,"N>
10:53:24   Error Type Any, expected String
10:53:24 [1,"_target",any]
10:53:24 [2,"_rangeSelected",any]
10:53:24 [3,"_location",[]]

meager granite
#

Also log your variables you get in params

south swan
#

inb4 _targets is false and no ifs are ever executed

meager granite
#

yup

gloomy basalt
#
params [ 
 "_targets", // true = pop-up, false = live. 
 "_range" // true = standard, false = marksman. 
]; 
 
private ["_rangeSelected", "_target", "_location","_createTarget"]; 
 
if (_targets) then { 
 ["Steel Targets (Pop-Up) program selected."] call SS_fnc_notify; 
 _target = "TargetP_Inf_F"; 
 if (_range) then { 
  _rangeSelected = standardArea; 
  systemChat "standard"; 
 } else { 
   _rangeSelected = marksmanArea; 
   systemChat "marksman"; 
 }; 
}; 
 
if (_targets) then { 
 ["Live Targets program selected."] call SS_fnc_notify; 
 _target = "O_G_Soldier_F"; 
 if (_range) then { 
  _rangeSelected = standardArea; 
 } else { 
   _rangeSelected = marksmanArea; 
 }; 
}; 

diag_log [1, "_target", _target]; 
diag_log [2, "_rangeSelected", _rangeSelected]; 
diag_log [3, "_location", _location];
diag_log [4, "_targets", _targets];
diag_log [5, "_range", _range];

for "_i" from 0 to 30 do { 
 _location = [_rangeSelected] call CBA_fnc_randPosArea; 
 _createTarget = createVehicle [_target,_location,[],0,"NONE"]; 
};

This yields no results in RPT, other than the first error.

Putting the dialogs at the end gives this:

params [ ["_zRef", [], ["",objNull,locat>
10:56:37   Error position: <params [ ["_zRef", [], ["",objNull,locat>
10:56:37   Error 0 elements provided, 5 expected
10:56:37 File /x/cba/addons/common/fnc_getArea.sqf..., line 30
10:56:37 Error in expression < CBA_fnc_randPosArea; 
 _createTarget = createVehicle [_target,_location,[],0,"N>
10:56:37   Error position: <createVehicle [_target,_location,[],0,"N>
10:56:37   Error Type Any, expected String
10:56:37 [1,"_target",any]
10:56:37 [2,"_rangeSelected",any]
10:56:37 [3,"_location",[]]
10:56:37 [4,"_targets",any]
10:56:37 [5,"_range",any]
meager granite
#

yeah you don't send anything into the function

gloomy basalt
meager granite
#

Your _targets is nil (nothing is sent into the function) so your if(_targets) conditions are just ignored

south swan
#

also 10:56:37 [3,"_location",[]] before it ever should get any value. Wut.

meager granite
#

He has logging after the error, so the logging is at the very end

#

So its a return of CBA_fnc_randPosArea

gloomy basalt
#

Alright, so I used this action:

private _standardSteel = [
    "standardSteel",
    "Standard Range",
    "\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\armor_ca.paa",
    {[true,true] call SS_fnc_shootingRange},
    {true}
] call ace_interact_menu_fnc_createAction;
``` to call my function and it gives me the Live Targets program instead.

Targets do spawn now. My bad on the debug console. However it is the wrong targets
south swan
#

probably because both of your ifs are checking for true ๐Ÿคทโ€โ™‚๏ธ

meager granite
#

Because both of your condition checks are if(_targets)

#

Either change one to if(!_targets) or use else

gloomy basalt
#

Right, I see that now

#

Thanks for the help

#

The private variables was the root of the issue

tender fossil
meager granite
#

A2OA scripting portfolio? ๐Ÿค”

south swan
#

i'd say the "root of the issue" was writing an entire screen worth of if statements instead of three [_a, _b] select _boolean;, but i'm rude and you do you :3

meager granite
#

private _var = if(_boolean) then {_a} else {_b}-gang aviator

south swan
#

still disregarding my style tastes way better than nested ifs with duplicated code blobdoggoshruggoogly

#
params [
    ["_targets", true, [true]],    // true = pop-up, false = live.
    ["_range", true, [true]]    // true = standard, false = marksman.
];

private _message = ["Live Targets program selected.", "Steel Targets (Pop-Up) program selected."] select _targets;
private _target = ["O_G_Soldier_F", "TargetP_Inf_F"] select _targets;
private _rangeSelected = [marksmanArea, standardArea] select _range;

[_message] call SS_fnc_notify;
for "_i" from 0 to 30 do { 
 private _location = [_rangeSelected] call CBA_fnc_randPosArea; 
 private _createTarget = createVehicle [_target,_location,[],0,"NONE"]; 
};``` ![blobdoggoshruggoogly](https://cdn.discordapp.com/emojis/748124048025714758.webp?size=128 "blobdoggoshruggoogly")
meager granite
#

๐Ÿ‘†

gusty path
#

C# is nice, been doing if for a few months now but sometimes you have to bang your head againts the keys

#

Same for any language really :D

pulsar bluff
meager granite
#

Probably does

pulsar bluff
#

what does the new gesture events show about stance changes

#

i think many of the state changes are captured in it

little raptor
#

Stances are not gestures

#

They're anims, so they don't get captured

pulsar bluff
#

the gesturechanged event fires almost constantly when a character is moving

#

i havent looked too deeply into what it is returning but i suspect you could find some "standing up" related strings in it

#

its actually a little silly how often it fires

tranquil nymph
#

I'll be starting perl soon, should be interesting

winter rose
#

that or keep an invisible ceiling above the player's head ๐Ÿ˜„

tranquil nymph
#

I hear it's somewhat similar to python

#

I like that the sqf scripting channel is mostly about other languages right now :D

proven charm
#

am i missing something when I move man out of heli he sometimes goes back in? I use this function: ```sqf
manLeaveVehicle =
{
params ["_man"];

_man remoteExec ["unassignVehicle",_man];

[_man] allowGetin false;

moveOut _man;

};```

meager granite
#

You're unassigning a man from himself?

#

oh, I didn't know how this command works

south swan
#

no, unassignVehicle is unary operator with a local argument

meager granite
south swan
#

another possibility is a race condition between moveOut and remoteExec notlikemeow

#

as in: possible cause of problems

proven charm
#

I dont think I have ever assigned the heli to the group, but I can try leaveVehicle

nocturne bluff
#

I could kill for a C# job.

proven charm
#

Of course in editor there isnt this problem ๐Ÿ™„

oblique anchor
#

Hi, I'm just wondering theoreticly, is it possible to iterate through all the objects of some type and add like interactions to them?
For example I want to add to all the fences an option to be cut with scripting

kindred zephyr
oblique anchor
#

but it is very tough on performance isnt it?

kindred zephyr
#

If ace has a way to trigger eventhandlers for that, then that the best way to check if it has been cut or not, yeah.

However that is not what you originally asked

oblique anchor
#

as a parameter it needs the fence tho as I can see in the docs

#

so I suppose I should just go through all the fence objects in the map in a loop and write the event handler for them

#

?

kindred zephyr
#

you can get your array of objects and just loop through it adding the handler, yeah.

As for performance, I don't know if it will impact negatively, they in theory do not have cost at all aside from memory space, as they do not check every frame, they just signal that the event is done

oblique anchor
kindred zephyr
oblique anchor
kindred zephyr
#

it can be done whenever/wherever you want, figure out your script first and then decide when you want to execute it

distant egret
oblique anchor
#

so like a specific type

distant egret
#

Yes, but all the objects in the mission of that specific type? Or only one of them?

distant egret
#

Yea then using the CBA event ("ace_logistics_wirecutter_destroyFence") will do it for you.

oblique anchor
#

Something like that?

distant egret
#

Well if handle_touch is an variable to code then yes.

oblique anchor
#

isnt it supposed to be a function?

distant egret
#

no code

#

But you can do {_this call handle_touch} like ace does.

#

if it's an function

#

But function is just variable of code AFAIK, so no difference.

#

But might be better to continue this on the ACE discord, they have better understanding on their own functions.

queen geyser
#

Hi can someone help me with a little something in the edit mode

distant egret
#

Edit mode?

queen geyser
#

Eden editor

#

Iโ€™m creating a mission and itโ€™s almost done

distant egret
queen geyser
#

I just need to know if I can make a group of soldiers enter and clear a building

#

Okay thank you

little raptor
little raptor
#

It will trigger for all objects that are cut

slow isle
#

Why can this trigger not recognize that I am inside of it?

// Trigger is repeatable
// Trigger is set to present
// This code is called in ON ACTIVATION
// Player count is 1 (me)

{
    _player = _x;
    if (_player in (list thisTrigger)) then {
        player sideChat "Inside trigger";
    } else {
        player sideChat "Outside trigger"; // This gets written BUT I am inside of the trigger and never got out (I spawn inside)
    };
} forEach allPlayers;
slow isle
proven charm
#

i think you should use *thisList * instead of list thisTrigger

slow isle
#

I tried that but it somehow still didn't work. Give me one second I'll test something now again

little raptor
#

they're the same

slow isle
#

I had code that worked yesterday but I changed player to _player from allPlayers

little raptor
slow isle
proven charm
#

are you calling the code more than once?

slow isle
#

it is repeatable if I understand the question

#

Let me explain what this is

little raptor
slow isle
#

I have a trigger which if you leave, it should display a message to go back to the zone. When you go back to the zone it should disappear.

little raptor
slow isle
slow isle
little raptor
slow isle
#

https://youtu.be/41troBy9fcU?t=602

in his code the trigger is again inverted

Here is a quick updated version of Zone Restriction using the Bohemia created module then a custom script.

The older one I'd created was far more clunky and now it includes a sound and multiple text messages so that players can't miss when they have entered a restricted zone.

Here is a link to the zoneRestrictor.sqf script: https://forums.pra...

โ–ถ Play video
#

I'll go through my logic again

slow isle
little raptor
#

if it's for testing it's fine

slow isle
#

what should I use instead? Functions?

little raptor
#

yes

#

execVM repreprocesses and recompiles the code every time

slow isle
#

does if (_player in (list _zoneTrigger)) check if the player has returned to the trigger? Or does it not update list _zoneTrigger

#

I have a for loop checking if the player is back inside of the trigger.

#

I don't know if _zoneTrigger is old data or is constantly updating with whether the player is in or not

south swan
#

initial code werks as posted on my machine blobdoggoshruggoogly

slow isle
#

This is my question put better How can I check if the player has returned to the trigger in my loop?

#

in loop: if (_player **has returned to the trigger he exited 5seconds ago**)

little raptor
#

the pastebin one is not

little raptor
#

but your first check fails

south swan
#

i smell FSM in the air :3

little raptor
#

FSM is stupid

slow isle
#

I just tested this code:

_zoneTrigger = _this select 0;

{
    _player = _x;
    _countdown = 35;

    for "_i" from 1 to _countdown do {
        if (!alive _player) exitWith {};

        if (_player in (list _zoneTrigger)) exitWith {
            cutText ["<t color='#00000000' shadow='0' size='10'>MARGIN</t><br/><t font='PuristaSemiBold' color='#FFFFFF' size='2'>YOU HAVE RETURNED TO THE COMBAT AREA</t><br/>", "plain", 0, true, true];
        };

        playSoundUI ["a3\3den\data\sound\cfgsound\notificationdefault.wss", 0.3, 0.3];

        _displaySeconds = _countdown - _i + 1;
        if (_displaySeconds < 10) then {
            _displaySeconds = format["0%1", _displaySeconds]
        };

        cutText [format ["<t color='#00000000' shadow='0' size='10'>MARGIN</t><br /><t font='PuristaSemiBold' color='#ef2e33' size='3'>WARNING</t><br/><t font='PuristaSemiBold' color='#ef2e33' size='2'>RETURN TO THE COMBAT AREA</t><br/><t font='LCD14' color='#ef2e33' size='3'>00:%1</t>", _displaySeconds], "plain", 0, true, true];
        titleFadeOut 1;
        sleep 1;
    };

    if (_player in (list _zoneTrigger) || (!alive _player)) exitWith {};

    titleFadeOut 0;
    titleText ["<t color='#00000000' shadow='0' size='10'>MARGIN</t><br/><t font='PuristaSemiBold' color='#FFFFFF' size='2'>YOU DIDN'T RETURN TO THE COMBAT AREA</t><br/>", "BLACK OUT", 0, true, true];
    sleep 3;
    _player setDamage 1;
    systemChat format["%1 has been killed for leaving the area.", name _player];
    sleep 1;
    titleFadeOut 0;
} forEach allPlayers;

And getting out works fine but when I go back in, the counter doesn't stop AKA if (_player **has returned to the trigger he exited 5seconds ago**) fails

little raptor
#

and thus the whole code

#

so ofc nothing will happen anymore

#

what you've written there must loop too

#

also one thing you don't seem to know about triggers is that they update their list once

#

i.e. let's say player1 moves into a trigger

#

it triggers

#

now player2 moves into it

#

its list won't update

#

and neither will it retrigger

slow isle
#

So you're saying once it's triggered, until p1 gets out, it cannot be retriggered?

slow isle
#

I expected the list to update every time an entity goes in

little raptor
little raptor
slow isle
#

I got quite confused and I'll read on triggers again when I have time

little raptor
#

triggers are stupid so I don't use them

granite sky
#

If the trigger is set as repeatable, it will be deactivated once the condition is not met anymore. Afterwards, the trigger can be activated again, and this can continue until the scenario ends.

south swan
#

so, inArea to be sure? blobcloseenjoy

slow isle
little raptor
#

yeah the logic for this needs a non-trigger loop with inArea

slow isle
#

This now seems to work. Question is, do I remove the trigger completely and make a loop or do I leave it like this. It needs to function with many players going in and out.

_zoneTrigger = _this select 0;

{
    _player = _x;
    _countdown = 35;

    for "_i" from 1 to _countdown do {
        if (!alive _player) exitWith {};

        if (_player inArea _zoneTrigger) exitWith {
            cutText ["<t color='#00000000' shadow='0' size='10'>MARGIN</t><br/><t font='PuristaSemiBold' color='#FFFFFF' size='2'>YOU HAVE RETURNED TO THE COMBAT AREA</t><br/>", "plain", 0, true, true];
        };

        playSoundUI ["a3\3den\data\sound\cfgsound\notificationdefault.wss", 0.3, 0.3];

        _displaySeconds = _countdown - _i + 1;
        if (_displaySeconds < 10) then {
            _displaySeconds = format["0%1", _displaySeconds]
        };

        cutText [format ["<t color='#00000000' shadow='0' size='10'>MARGIN</t><br /><t font='PuristaSemiBold' color='#ef2e33' size='3'>WARNING</t><br/><t font='PuristaSemiBold' color='#ef2e33' size='2'>RETURN TO THE COMBAT AREA</t><br/><t font='LCD14' color='#ef2e33' size='3'>00:%1</t>", _displaySeconds], "plain", 0, true, true];
        titleFadeOut 1;
        sleep 1;
    };

    if (_player inArea _zoneTrigger || (!alive _player)) exitWith {};

    titleFadeOut 0;
    titleText ["<t color='#00000000' shadow='0' size='10'>MARGIN</t><br/><t font='PuristaSemiBold' color='#FFFFFF' size='2'>YOU DIDN'T RETURN TO THE COMBAT AREA</t><br/>", "BLACK OUT", 0, true, true];
    sleep 3;
    _player setDamage 1;
    systemChat format["%1 has been killed for leaving the area.", name _player];
    sleep 1;
    titleFadeOut 0;
} forEach allPlayers;
#

what I did is replaced _player in (list _zoneTrigger) with _player inArea _zoneTrigger

mint goblet
#

Any thoughts of making CallExtension non blocking?

kindred zephyr
south swan
#

trigger marks the area, you shouldn't remove it. Setting it to activation NONE and removing repeatable shouldn't break inArea, though

little raptor
slow isle
little raptor
#

why are you showing a text for any player who isn't in the trigger, to the current player?

slow isle
#

They are out of the zone and should return

little raptor
#

you're showing it to the current player

#

the code should run client side, and simply check if player is in area

slow isle
#

How should I go about it

little raptor
#

just do something like this in initPlayerLocal.sqf

#
execVM "myCode.sqf"
#

myCode.sqf:

while {true} do {
  if !(player inArea myTrigger) then ...
  sleep 1;
}

etc etc

slow isle
#

Will do it now

little raptor
#

another idea is creating local-only triggers

kindred zephyr
#

yeah, a killzone should be local

#

no need to have the server do this

little raptor
#

that might work more reliably under heavy scheduler load

#

basically the condition can simply be: player inArea thisTrigger

south swan
#

ending up with personalized trigger on each client ๐Ÿคฃ

kindred zephyr
#

now that i think of it, does the wiki has a section for recomendations in where to run code like this?
A section for loop localities and their effect on performance like this could be handy.

slow isle
#

I'm thinking of one trigger in eden and using it to locally check with inArea

#

It should be good enough, right?

#

The player count would be no more than 16 anyway

little raptor
#

hmm but then again, does it still work if player respawns? ๐Ÿค”

little raptor
#

so just put the code in trigger deactivation

mint goblet
#

just more work for scripters

slow isle
#

I still can't get it to work. Does the trigger need to be 3d or does 2d work fine?

little raptor
#

2d

#

or 3d

#

won't matter

slow isle
#

It is finally working! ๐ŸŽ‰

#

Thanks everybody!

granite sky
#

you never know with the AI, but it's probably busted either way.

#

I mean if it broke the AI you probably couldn't tell because it looks broken anyway.

#

I don't think it matters for players.

pliant stream
#

they'd have to execute the extension calls on another thread i don't see it happening

#

you can do that yourself though

sturdy ice
#
sectors = ["marker_1","marker_2","marker_3","marker_4","marker_5","marker_6","marker_7","marker_8","marker_9","marker_10","marker_11","marker_12","marker_13"];

{
_markerdistance2D = (getMarkerPos _x) distance2D (getMarkerPos "marker_3"); 
_ifx = getMarkerColor _x;

    if (_markerdistance2D < 2001 && _markerdistance2D > 1999 && _ifx != "ColorWEST") then {
    _x setMarkerBrush "Solid";
    _x setMarkerColor "ColorEAST";
    
    _trg = createTrigger ["EmptyDetector", getMarkerPos _x];
    _trg setTriggerArea [1000, 1000, 0, false];
    _trg setTriggerActivation ["EAST", "NOT PRESENT", true];
    _trg setTriggerStatements [    "this", 
                        "hint 'Der Sektor wurde befreit';_x setMarkerColor 'ColorWEST'", 
                        ""];
    };
} forEach sectors;

Hi, ive run into the problem that the script works but my marker wont turn blue when the trigger is activated. I suspect that the _x from the forEach wont translate to the created trigger but have no idea how to write the string from the arraay into the trigger.

winter rose
sturdy ice
winter rose
#

the trigger can't "turn blue"
the marker, eventually

sturdy ice
south swan
#

format in 3..2..1..

winter rose
#

ah, I see in the trigger statement what you mean
you could do something like

_trg setVariable ["BBR_marker", _x];
```and in the statement```sqf
this getVariable ["BBR_marker", ""] setMarkerColor 'ColorWEST';
winter rose
#

but yes, format could do too - saves a var as well

sturdy ice
#

i looked at format but didnt grasp how it worked for this intance

winter rose
#
_trg setTriggerStatements ["this", "hint 'Der Sektor wurde befreit'; '" + _x + "' setMarkerColor 'ColorWEST'", ""];
```_still no `format`, hah!_
south swan
#

Two string+string vs one format sounds like a profiling bait ๐Ÿคฃ

winter rose
#

I believe I did benchmarks and it still checks out ๐Ÿ˜

sturdy ice
#

do you create a string with a emtpy string?

winter rose
winter rose
sturdy ice
#

thank you ๐Ÿ‘

south swan
#

"a" + _x + "b" seems to be ~25% faster than format ["a%1b", _x] in my testing meowsweats 0.015ms for 30 runs vs 0.02

#

["a", _x, "b"] joinString "" seems to be roughly equivalent to format meowsweats 0.02 ms for 30 runs with ["a", _x, "b"] alone being 0.008 ms of that meowsweats

winter rose
#

ye I'm working on that section to add the "string vs non-string" ๐Ÿ™‚

#

so I accidentally win! ๐Ÿ†

south swan
#

boom indeed

#

just for disclosure: my testing was done with a tst array pre-filled with strings of "0", "1", ..., "29" and {<code>} forEach tst;, so string-only

winter rose
#

I ended up with this

["str1", "str2", "str3"] joinString "";        // 0.0015 ms - no length limit
format ["%1%2%3", "str1", "str2", "str3"];    // 0.0015 ms - limited to ~8Kb
"str1" + "str2" + "str3";                    // 0.0012 ms - no length limit
south swan
#

sounds like constructing a new array is more expensive than constructing an extra string ๐Ÿคฃ

winter rose
#

I believe that, as an array is an object (a "complex" one let's say)

mint goblet
#

that might be the case yes

south swan
#

something like 0.0015 ms for creating an empty array 30 times, 0.005 ms for ["a"], 0.0065 for ["a", "a"], 0.008 for ["a,", "a", "a"], 0.0090-0.0095 for 4 elements, 0.01-0.011 for 5 elements... (all times 30) meowsweats

mint goblet
#

How does the spawn work?

south swan
#

๐Ÿค” inb4 _arr = ["a", nil, "b"]; {_arr set [1, _x]; _arr joinString ""} forEach tst;

winter rose
#

my CPU is slow

south swan
#

nope, totally not it

#

and my values were "normalized" by subtracting the time of {_x} forEach tst; (0.02 ms for 30 cycles) to make my 11-year old CPU look faster blobcloseenjoy

mint goblet
#

The thing is taht it gets tricky when you ahve to do it yourself. What if i have a extension that takes 2 seconds to return some data? How do i return that to the game later on?

slow isle
#

I have zero idea why it is like so

#

The loop works.

slow isle
#

I only get to player sideChat str "Code reached 1"; when inside or outside the trigger

#

I just found the issue
_player's position is the same in the while loop

#

But now I don't know how to get the player position

slow isle
#

Okay apparently replacing _player with player fixes the issue! Question is: Will the script work with more than 1 player in the server?

little raptor
slow isle
slow isle
little raptor
slow isle
#

Should I use it everywhere or only where it is needed

little raptor
#

and you didn't even have params think_turtle

little raptor
#

so if he respawned it would be invalid

little raptor
#

yes but you must add the params

slow isle
#

oh did I not ๐Ÿ˜‚

little raptor
#

it doesn't magically define it for you

slow isle
#

Oooh I did add them, I just didn't paste them in pastebin

little raptor
# slow isle https://pastebin.com/SWvWw2SU

I'd say doing it this way is probably cleaner?

private _timer = 0;
while { true } do {
    if (!alive player) then {_timer = 0; sleep 1; continue};
    
    if !(player inArea zoneRestriction) then {
        _timer = _timer + 1;
        
        if (_timer > 35) exitWith {
            titleFadeOut 0;
            titleText ["<t color='#00000000' shadow='0' size='10'>MARGIN</t><br/><t font='PuristaSemiBold' color='#FFFFFF' size='2'>YOU DIDN'T RETURN TO THE COMBAT AREA</t><br/>", "BLACK OUT", 0, true, true];
            sleep 3;
            player setDamage 1;
            [format["%1 has been killed for leaving the area.", name player]] remoteExec ["systemChat", [0, -2] select isDedicated];
            sleep 1;
            titleFadeOut 0;
        };
        
        playSoundUI ["a3\3den\data\sound\cfgsound\notificationdefault.wss", 0.3, 0.3];
        cutText [format ["<t color='#00000000' shadow='0' size='10'>MARGIN</t><br /><t font='PuristaSemiBold' color='#ef2e33' size='3'>WARNING</t><br/><t font='PuristaSemiBold' color='#ef2e33' size='2'>RETURN TO THE COMBAT AREA</t><br/><t font='LCD14' color='#ef2e33' size='3'>00:%1</t>", 35 - _timer], "plain", 0, true, true];
        titleFadeOut 1;
    } else {
        if (_timer != 0) then {
            titleFadeOut 0;
            _timer = 0;
        };
    };
 
    sleep 1;
};
loud forge
#

Hey everyone, i hope that this is the right place to ask.

I am currently using the ITC Land Sytems mod for Arma 3, and so far it has been great for what i use it for, mostly the CRAM/CWIS functions.

However, it didn't seem to work against rockets, which bummed me a bit so i looked at the documentation right there :

https://github.com/itc-addons/ITC_Land_Systems/wiki/CIWS-System

Basically from my understanding all the targetable munitions are stored in an array called "ITC_LAND_CIWS_INTERCEPTABLE". So far i've been able to add values to that array by using this code in the debug console :

ITC_LAND_CIWS_INTERCEPTABLE set [ 10 , "R_230mm_HE" ]; 
ITC_LAND_CIWS_INTERCEPTABLE set [ 11 , "R_230mm_Cluster" ];```

How could i go about running that code at the start of the mission? I've tried to put it in the init field but it doesn't seem to read it properly. Any ideas? Thanks!
GitHub

Improvements to ArmA 3 Land Systems. Contribute to itc-addons/ITC_Land_Systems development by creating an account on GitHub.

little raptor
runic edge
#

hello guys, is there a difference beetween bob disableAI "ALL" and using the command 17 times for all the features ?
Is one method better if i want unactivated AIs ?
Thanks !

little raptor
loud forge
little raptor
#

oh that's what you meant by init?

#

so if you put it in init it won't work

loud forge
#

Oooh alright
Yeah, sorry i'm pretty much a newcomer to this stuff, i only started tinkering with it a few hours ago.

It did give me an error stating that it was expecting a "=" instead of an "s" after "ITC_LAND_CIWS_INTERCEPTABLE" so it wasn't seeing the array and was trying to create it

little raptor
#

you can try this instead:

[] spawn {
  waitUntil {!isNil "ITC_LAND_CIWS_INTERCEPTABLE"};
  ITC_LAND_CIWS_INTERCEPTABLE append ["R_230mm_HE", "R_230mm_Cluster"]
}
little raptor
#

you had a different error

#

\\Setting the munitions used by the MLRS as targetable by CWIS
this was the error

#

first of all comments should be started with // not \\

#

second of all they're not allowed in init fields anyway

loud forge
loud forge
loud forge
#

Thanks for your time

vocal mantle
#

I think you have to hack the game to arbitrarily execute sqf when the function/routine is done. You basically need to finish the rvextension function as fast as possible and give the game a return while calling a separate thread in the process. Douggem has used this method in his hacks.

slow isle
little raptor
#

I guess it should work fine now

vocal mantle
#

It would be nice if they had an event handler or something in arma 3 that gets executed when you call a certain function in your extension.

mint goblet
#

Yes, But then what? When that seperate thread has finished, how does it return the data to the game?

vocal mantle
#

you make it call a sqf command. It's a hack method as far as I recall. You need to know memory offsets of subroutines and what not. I watched a few of Douggem's videos but haven't done it myself yet. I need to get better fimiliarized with C++ first. It can be done in other languages like C# but I chose C++ because I am stuborn and chose the hard way....

mint goblet
#

I see. Any links to the videos?

#

I am coding in c#

pliant stream
#

In your extension you start a new thread and queue tasks for execution on that thread you then have to periodically poll the extension to see if the task has completed

#

I doubt BIS appreciate reverse engineering the game all that much

meager granite
#

Why isn't there something like compileFinal CODE? ๐Ÿค”

#
fnc_a_final_function = compileFinal {
    //a func
};
#

@still forum How painful would it be to increase number of custom channels? Rewriting the system to support arbitrary number of custom channels might not be worth it, but I wonder if just increasing the number from 10 to say 100 will be much of an issue to the rest of the engine?

#

Issue is that these 10 custom channels are like 3 in practice when you want specific channels available to all 3 player sides of BLUFOR, OPFOR and INDFOR separately. 10 / 3 = 3 channels per side and 1 extra.

vocal mantle
#

Yeah well, thats why it would be nice to have an interface for extensions that then translates into an event handler defined via sqf

#

Thats the cleanest way I can think of doing it without hacking/ reverse engineering.

golden ore
#

i was looking into doing ambient sounds that play locally in a trigger area, but i was unsure of how deleteVehicle would interfere with that in a multiplayer environment. it's my understanding that because it's a global command, one player leaving the trigger area would also delete everyone else's sound sources? correct me if i'm wrong.

vocal mantle
#

But on top of that, it is so much faster to read values and executed code through memory then it is for the game to do it via sqf.

#

I also don;t think they care as long as it is not used to compromise multiplayer anti-cheat.

stable dune
lone glade
#

If you try that in MP pretty sure BE would pick on it.

pliant stream
#

If you start writing all willy nilly but not reading

vocal mantle
#

@lone glade yeah, if you use BE that is. BE is optional
@pliant stream I think BE doesn't like reading much either.
It's really a shame how restrictive BE is on extensions. I understand why, but it would be nice for servers to have there own signatures for extensions rather than a BE wide signature. Basically the way addons are handled now. If I want to use an extension on my server, I should be allowed to while still using BE.

tender fossil
#

Arma 2: OA v1.64!

Is there a way to prevent a missionNamespace variable publicVariable'd from server from getting updated with setVariable command (with the public property/parameter in the setVariable call set to true, i.e. the variable getting broadcasted to other clients and server)? Or alternatively, is there a way to catch a variable update by setVariable broadcast other than polling it constantly manually? A big bonus if it was possible to catch the client that broadcasted the variable too.

tender fossil
meager granite
tender fossil
tender fossil
meager granite
#

Here is what I have been doing to counter this at least a little bit:

Server:

server_varSomething = 123;
pvar_varSomething = server_varSomething;
publicVariable "pvar_varSomething";
if(!isDedicated) then {publicVariableServer "pvar_varSomething"}; // Trigger pvar event handler if server is also a player

Client:

"pvar_varSomething" addPublicVariableEventHandler {
    client_varSomething = _this select 1;
};
#

Cheaters that don't know server's variable name won't be able to change server's server_varSomething

#

If variable is only broadcasted by the server you then can blacklist it in Battleye's publicvariable.txt filter.

#

So if cheater does something like

client_varSomething = "cheating";
publicVariable "client_varSomething";
```they get kicked
#

same with server_varSomething and pvar_varSomething

#

I also countered that by randomizing all variable names each mission release

tender fossil
meager granite
#

missionNamespace setVariable is not covered by BE's filter?

tender fossil
meager granite
tender fossil
#

Good reminder that I should still learn regular expressions syntax, it's just such a useful concept ๐Ÿ˜„

south swan
#

Weren't public variable event handlers a thing?

#

Although they don't seem to disclose the initiator notlikemeow

tender fossil
dreamy kestrel
#

Q: what does this mean? Fixed: Some HashMap commands had an inconsistent return type inconsistent how? in which command(s)?

#

also congrats 2.12 finally deployed

distant egret
#

2.14 when? blobdoggoshruggoogly

tepid vigil
#

What is the difference between getPosATL player getEnvSoundController "houses" and insideBuilding player? Is the new command more reliable, faster?

winter rose
#

more reliable as in "game-usees-that reliable"

#

(afaik)

tepid vigil
# winter rose more reliable as in "game-usees-that reliable"

Fair enough, probably infinitely faster than the method lambs uses:

params ["_unit"];

private _trace = lineIntersectsSurfaces [eyePos _unit, eyePos _unit vectorAdd [0, 0, 10], _unit, objNull, true, -1, "GEOM", "NONE", true];

if (_trace isEqualTo []) exitWith {false};

_trace findIf {_x select 3 isKindOf "Building"} != -1
still forum
#

uff I am slo sorri

#

Can't help to process the backlog

tender fossil
#

I'm building the extension myself though because I want to learn (and build a portfolio in the process), it's been already quite a journey indeed

still forum
still forum
calm charm
#

Hey. A question concerning UI to Texture.
Are displays global or local objects? So is a display on a texture visible to everyone or just to the local?

still forum
#

local

warm hedge
#

Every UI related elements are local

still forum
#

If you setObjectTextureGlobal, everyone will have the same UI on the texture.
But everyone has their own instance of it

calm charm
#

ok thanks

little raptor
dreamy kestrel
dreamy kestrel
meager granite
shut reef
#

I'm spawning scheduled code from a controls onLoad function, but it seems it never gets executed?
Is there sth I am missing?

_ctrl spawn {
    diag_log "DEBUGGING: Spawned!";
    sleep 5;
    diag_log format ["DEBUGGING: Background visible? %1, Background enabled? %2, Display ? %3", ctrlEnabled _this, ctrlShown _this, ctrlParent _this];
};

It never prints.

stray flame
#

Hey, I have an op where you start in a ship high above the ground. How do I turn off the freefall animation?
It keeps triggering whenever I walk down stairs

digital hollow
#

setUnitFreefallHeight

stray flame
#

Stellar

#

this will work well in the init.sqf right?

digital hollow
#

You may need to find out =)

austere hawk
#

Game Update 2.12
Added: setTurretLimits
Did anybody try yet what happens if your turret is pointed outside the newly set limits, when executed? Can't test it atm

hallow mortar
#

Dev branch reports were that the turret instantly snaps to the maximum traverse/elevation allowed by the new limits.

austere hawk
#

ah, bummer... would be extremely usefull if the turret would move with max rotation speed to that limit. Because forcefully rotating the turret is not possible (unless i missed something in last patches). If it was to rotate at a speed instead of snap, the command would be a nice dual use

#

i just browsed spotrep today...
i used to daily check devbranch updates https://forums.bohemia.net/forums/topic/140837-development-branch-changelog/?page=60

hallow mortar
austere hawk
still forum
austere hawk
#

ohhhhhhhhhhhhhh meowheart

#

hmm are you sure? i don't see any added commands that fit the bill. Any idea what the name was? Or patch number added?

#

i know you can do workarounds for aiming (using an AI gunner with aimAt), but it gets very involved, when a player is in the seat

terse tinsel
#

how do i get to the bottom of the command line in eden? when i press ender it stops typing ๐Ÿ˜ฆ ?

#

init window

still forum
#

new alt syntax there?

terse tinsel
#

thx

wary sandal
#

let's say I want to replace this building with another one (a non damaged one for instance), how can I get its exact position given that I already fetched it via nearestTerrainObjects?

#

using getPos , position and getPosATL gives it a very weird offset

#

using getPosASL spawns it way off in the air

#

what should I use instead?

winter rose
wary sandal
winter rose
#

how do you create it
what do you do in your code

little raptor
winter rose
wary sandal
little raptor
#

no

wary sandal
#

_x is the building

little raptor
wary sandal
#

alr

little raptor
#

and use setVectorDirAndUp instead of vectorDir

winter rose
#

but getPosWorld is from the model's centre or did I miss something

little raptor
#

if the buildings are different then yeah

wary sandal
#

the building will always be of the same dimensions in my case

winter rose
#

if certain then getPosWorld is the uber fastest, even though getPosASL is close behind

wary sandal
#

they just get a fresher paintjob

little raptor
#

so it still won't be ideal

wary sandal
#
        private _building = createVehicle [[typeOf _x, "_u_", "_i_"] call _PX_fnc_stringReplace, getPos _x];

        if (!isNull _building) then {
            _building setPosWorld (getPosWorld _x);
            _building setVectorDirAndUp [vectorDir _x, vectorUp _x];
            _x hideObject true;
        };
#

sorry for the indent

little raptor
#

I think the vector dir and up of the destroyed object has changed then

#

it does happen with some objects

#

(tho never seen it happen with buildings think_turtle )

wary sandal
#

so we can rule out this possibility

little raptor
#

move setDUP above setpos

wary sandal
#

i will never understand arma

#

tysm

#

works like a charm now

little raptor
#

did it work then?

wary sandal
#

yeah it did the trick

little raptor
wary sandal
#

yeah i 100% had it

little raptor
#

because they stay the same regardless of orientation

wary sandal
#

i just moved setDirUp above setpos

#

that's all

agile pumice
#

Anyone come up with some interesting UI to texture features yet?

little raptor
#

a laptop running windows or something... meowsweats

#

basically a fully interactable screen think_turtle

merry cove
#

does someone know how i could put an ambient sound when the engine of the plane is ON ?

velvet flicker
#

Bois I need help

#

We started throwing together an op which features heavily navigation with map and compass in zeus, but forgot the server had that shift+click waypoint enabled

#

is there a script we can use to disable this for everyone?

winter rose
#

although it might be avoidable by overriding clicks etc on the map (not guaranteed and IDK how)

hallow mortar
#
onMapSingleClick {_shift};```
winter rose
hallow mortar
#

Don't worry, that's the one time it's gonna happen this century

winter rose
#

I forgot that onMapSingleClick ๐Ÿ˜ญ the end is near

astral bone
winter rose
formal stirrup
#
    [
        "Select Your kit",
        [
             ["COMBO", "Kit", [
                 ["commanderkit.sqf", "squadleaderkit.sqf", "riotkit.sqf", "medickit.sqf", "heavykit.sqf", "trooperkit.sqf"],
                 [["Commander"],["Squad Leader"], ["Riot"], ["Medic"], ["Heavy"], ["Trooper"]], 0]
            ],
            ["SLIDER", "Random stuff?", [0, 2000, 500, 0]],
            ["TOOLBOX", "Random stuff", [0, 1, 8, ["N", "NE", "E", "SE", "S", "SW", "W", "NW"]]],
            ["SLIDER", ["Boom", "Skadoosh"], [0, 5000, 500, 0]],
            ["SLIDER", ["Placeholders", "Boo"], [0, 60, 10, 1]]
        ],
        {
            _this execVM _Kit;
        },
        {},
        _position
    ] call zen_dialog_fnc_create;

Any idea on how i would make the _this execVM _Kit; Actually apply to the player that uses the menu?

winter rose
#

player execVM _kit eventually?

formal stirrup
#

Tried that to no success, I've considered doing _Caller but also doesnt work

#

Is it possible the way im grabbing _Kit is wrong?

winter rose
#

it is possible

formal stirrup
#

Any tips on testing to see?

winter rose
#

I would recommend to see ZEN documentation, they are not vanilla functions

formal stirrup
#

Alright

meager granite
#

Contact (Platform): for most other use cases, including sandbox multiplayer (loaded by default for all players)
What does this mean?

warm hedge
#

Contact Platform is enoch, it is available for everyone just like any other DLCs, and not optional, unlike the Alien stuff

meager granite
#

Non-Alien Contact DLC assets?

#

I thought they were available already just like Apex assets?

#

Or is it about the maps?

warm hedge
#

Livonia, Promet, LDF, Eddie... everything the vanilla game has

#

And not sure how you (mis)understood

meager granite
#

Oh I got this line out of the context from the SPOTREP

#

Why its mentioned there at all though? ๐Ÿค”

bold chasm
meager granite
#

ctrlMapAnimAdd and ctrlMapAnimCommit

#

Then displayUpdate after it to update the texture

bold chasm
#

How do you get the ctrl that these need to be ran on from the UI to Texture?
If I'm using RscDisplayMainMap or something similar, unless I'm meant to use a different display

warm hedge
meager granite
#

Create your own display in the config, have it call your display initialisation function in its onLoad event

bold chasm
#

Code I'm using:

cursorObject setObjectTexture [0,'#(rgb,1024,1024,1)ui("RscDisplayMainMap","myMapTexture")'];
meager granite
#

You need to create your own display and have map control on it

#

You can also do with existing RscDisplayEmpty display but its a bit hacky

#

Actually nevermind, you can't do that with RscDisplayEmpty, you need to have the display set its own handle somewhere with onLoad EH

#

Strange why there is no reverse command for displayUniqueName, supply unique name, get display handle in return

distant egret
#

findDisplay alt Syntax.

meager granite
distant egret
#

They don't really put them on display meowtrash

thorny gull
#

Yo so I have been following this tutorial for some like, ambient marching and I am wondering how he got the custom sounds into the game, can anyone give me some pointers?

#

I have an Mp3 file I would like to set up, all the scripting has been done in the mission editor already aside from the file related stuff

novel basin
#

Hi

how can block the speed of a vehicle (so he can't move forward or backward) ?

i tried with the setCruiseControl but i can move backward :/
It's my part of code :

vehicle player setCruiseControl [-1, false]; //Can't move forward but he can move backward

anyone know the issue ?

winter rose
#

_vehicle setFuel 0 ๐Ÿ˜„

#

(or damage its engine, etc)

meager granite
# distant egret findDisplay alt Syntax.

Hmm, apparently findDisplay STRING fails if you call it right after creating UI texture, I game engine has to draw the texture one to initialise texture procedural creation

thorny gull
#

ah thanks, i got that solved but I have a new issue

#

I have a trigger I want to trigger and it currently looks for players, but when you drive through it it doesnt trigger the trigger

#

the condition is set as this && player in thislist

#

the trigger is also set to see if bluefor is present

meager granite
#

Map displaying on a square display that gets rendered onto texture is a complete mess. Icons are shrinked horizontally (probably because all internal sizes are calculated off 640x480 base display size instead of square texture display), ctrlMapAnimAdd seems to be aiming completely off because of it too.

meager granite
fleet sand
#

Question does anybody knows how to recreate the stuff from update to have map shown on the bilboard ?

meager granite
#

Just tried, drawing maps on textures is a huge mess

pulsar bluff
#

what if the texture is the right size?

#

640x480

meager granite
#

Texture size has to be power of 2

still forum
#

Idea
Script command to serialize/deserialize a value.
Easily convert array or hashmap or anything to say base64 encoded.
And then same thing back out
? Where would you use such a thing, databases sure, what else? Is it worth it? Might even add compression into it
So then you can use it both for plain serialization, and for compressing data (why ever you'd want that) by just passing a string into it for ex.

still forum
thorny gull
#

I keep getting an error for this code
nul = spawn {{_x playMove "AmovPercMstpSnonWnonDnon_exerciseKata"} forEach [kar,kar_1,Kar_3,Kar_5,Kar_7,Kar_10]; sleep 0.2; {_x playMove "AmovPercMstpSnonWnonDnon_exerciseKata"} forEach [Kar_2,Kar_4,Kar_6,Kar_8,Kar_9,Kar_11]; [Kar_7, "karate"] remoteExec ["Say3D"];};

#

says I am missing a ;

fleet sand
thorny gull
#

that worked thx

winter rose
thorny gull
#

from the tutorial, its supposed to make it so that they dont sync

winter rose
#

unrelated to what I say ๐Ÿ˜„ I mean the "nul =" part is not required ๐Ÿ™‚

#
0 spawn
{
  {_x playMove "AmovPercMstpSnonWnonDnon_exerciseKata"} forEach [kar,kar_1,Kar_3,Kar_5,Kar_7,Kar_10];
  sleep 0.2;
  {_x playMove "AmovPercMstpSnonWnonDnon_exerciseKata"} forEach [Kar_2,Kar_4,Kar_6,Kar_8,Kar_9,Kar_11];
  [Kar_7, "karate"] remoteExec ["Say3D"];
};
```that's it
pliant stream
winter rose
# pliant stream Why did people ever start doing this in the first place?

it was due to an unrequired requirement that all init fields etc in the editor would throw an error if the expression returned a value, e.g 0 spawn {} returns a Script Handle
so people started adding that because the assignation step returns nothing

this was fixed inโ€ฆ a late Arma 3 ๐Ÿ˜ฌ

pliant stream
meager granite
winter rose
#

since OFP, I swear

meager granite
#

Was part of the reason I ditched doing anything in the editor and went script-only almost instantly

pliant stream
#

Hmm... I've very rarely used the editor, but not never, and i don't remember seeing this... I might be mistaken though.

winter rose
#

start A2, in player's init field try to write 0 spawn {}; or even just 33 and see

pliant stream
#

I'm not at home so i can't right now, but i'll take your word for it. I definitely have done stuff like removeAllWeapons and add weapons and magazines in init though, and don't recall ever seeing any weird errors.

#

They all return nil though, so maybe that surpressed the error? In which case it seems returning nil would have been more appropriate than the odd assignment.

winter rose
#

yes, a Nothing will appease the field ๐Ÿ™‚
so either end all the fields with nil or 0 = (as a = b returns nil too)

then people saw and copiedโ€ฆ

pliant stream
#

a=b doesn't return anything, unfortunately.

novel basin
winter rose
#

what do you mean, "block the speed"
limit the vehicle's speed in both forward and backward gear?

still forum
winter rose
meager granite
wary sandal
meager granite
#

Wish we could define aspect ratio for the display for ui2texture or something

wary sandal
meager granite
#

2:1 laptop texture and the display I have to use so picture looks normal in game.

meager granite
#

@still forum How difficult would it be let us to specify display aspect ratio when rendering the texture?

velvet flicker
#

Oh what hey it's sa-matra in the flesh

#

Hey sa matra add resupply crates for purchase so helis can run logi too, that is all.

meager granite
velvet flicker
#

Ah, fair enough. Worth a shot. Keep up the awesome work - huge fan

still forum
#

Also. Reading your createHashMapFromCode idea again.
How about just
createHashMapFromCode {}
code returns elements and they get added to hashmap, until the code returns nil, that marks the end of the map?
That way you can have input array, or input whatever, or just generate like 0-100 keys or.. whatever.

#

Best part about that.
I can merge it into createHashMapFromArray {}
and make it alt syntax and don't have to make a new command ๐Ÿ‘€

still forum
meager granite
#

My texture definition from the test above: #(rgb,1024,512,1)ui('Texture_Laptop','Laptop')

#

I guess you can get aspect right from it?

#

from width and height

#

Or just cut display off by that ratio?

#

So in this case it will only render UI width=1 and UI height=0.5 onto texture

still forum
#

Mh I just force aspect to 1 indeed even if texture is not 1:1 ๐Ÿค”

#

Can you make FT ticket for that issue? with example UI class provided.
I'll look at it in probably a couple weeks

meager granite
#

Noted, will do

meager granite
still forum
#

Ah you'd want a forEachIndex

#

smth like

private _sides = [blufor, opfor, independent, civilian];
createHashMapFromCode {
  private _side = _sides param [_forEachIndex, objNull];
  if (_side isEqualTo objNull) exitWith {};
  [_side, {side group _x == _side } count allUnits]
};

kinda ugly ๐Ÿ˜„

south swan
#

createHashMapFromCode [{code here}, [arguments here]]; blobdoggoshruggoogly

#

embrace ugly

#

_array applyToHashMap {code}; blobdoggoshruggoogly

meager granite
fair hemlock
#

hey folks, is this the right place to ask scripting questions?

meager granite
south swan
#

*_sides createHashMapFromArray (_sides apply {whatever}); ?

meager granite
#

Honestly, all this is just a convenience matter, not a priority what so ever, personally I'm not using this in performance critical code anyway

winter rose
still forum
winter rose
#

I don't like to copy paste things.
_ then make a separate method_
okido ๐Ÿ™‚

wary sandal
#

what does this code do {side group _x == _side} count allUnits;

hallow spear
#

yessir

meager granite
#

Counts number of players in each side in this example

wary sandal
#

that's what i'm failing to understand

meager granite
#

Speaking about wild hashmap ideas. I had a "need" to generate hashmap out of hashmap of hashmaps. I have hashmap with such contents in my mission:

_players = createHashMapFromArray [
     ["123123123123", createHashMapFromArray [
         ["name", "Player"]
        ,["owner", 2]
        ,["something", "whatever"]
    ]]
    ,["321321321321", createHashMapFromArray [
         ["name", "Player 2"]
        ,["owner", 3]
        ,["something", "whatever"]
    ]]
];
```And I need to make a hashmap to quickly associate `owner` to `name`, I do:
```sqf
(_players apply {_y get "owner"}) createHashMapFromArray (_players apply {_y get "name"})
```and it made me wish for something like `HASHMAP createHashMapFromHashMap ARRAY`, usage:
```sqf
_players createHashMapFromHashMap ["owner", "name"]
```creates `[[2, "Player"], [3, "Player 2"]]` hashmap.
Or if I wanted `uid` (key) to `name` association, have `HASHMAP createHashMapFromHashMap STRING`, usage:
```sqf
_players createHashMapFromHashMap "name"
```creates `[["123123123123", "Player"], ["321321321321", "Player 2"]]` hashmap.
#

Do I NEED it? No.

wary sandal
meager granite
#

Do I enjoy imagining it? I sure do.

wary sandal
#

and apply iterates through all the elements of an array and... applies changes on each of them, right?

#

like [1, 2, 3, 4] apply { _x * 2 }

meager granite
fair hemlock
#

ok, so here's the deal. I need to run a custom script when a player SHOULD die, but prevent them from actually dying

tough abyss
#

Hello I need help on how to disable all street lights in a map?

#

I am making a horror mod

fair hemlock
#

the perfect scenario would be having it run in the "Killed" event handler, but then overriding it so they don't actually get killed

#

but the Killed EVH doesn't allow you to override that, so I can't do it

meager granite
tough abyss
#

Sorry if this sounds like spoon feeding

#

But where am I supposed to paste it?

meager granite
#

Not sure if disabling lights on EVERY lamppost on the map is a good idea because it will require getting all objects on the map (and stream them in)

manic kettle
#

More items = longer code run times, so it takes longer. If you try to do the entire map it might hang
More objects for players pc to keep track of deviating from map

meager granite
#

I'm not sure if switchLight is global or not, probably won't hurt having it there.

tough abyss
meager granite
tough abyss
meager granite
#

It probably won't include editor placed lights though ๐Ÿค”

tough abyss
#

Ah do not worry

#

What I basically wanna do is that replicate horror games

#

where all lights are disabled

#

and I have to use flash light

#

so thanks

meager granite
#

If you're serious about it, you'll need to learn scripting, nothing is easy in Arma

hallow spear
#

I am not a man these answers, but you could try checking out other medic systems and see what they do. You might also consider a "Hit" EH instead and check if they go below a certain threshold

meager granite
#

You probably don't even need to check for config having lights, just run switchLight on everything. If it works - it works

#
{
    _x switchLight "OFF";
} forEach (1 allObjects 0);
fair hemlock
#

I have been trying to do it in the "HandleDamage" EVH but that is being very difficult because it has selection-specific damage, and the way that corresponds to overall damage isn't clear. E.g. you could have the HandleDamage EVH fire for the "spine1" selection with a "damage" of 1, but that doesn't mean the player will die

meager granite
#

Added this code to switchLight page

hallow spear
#

I wish i could help more, I look forward to the response of others.

stable dune
#

Hello , is some where example/ guide for new procedural textures to get ui (map) on the whiteboard, I read what Sa-Mantra answered earlier question, but I don't understand correctly how I do "own display" and how do I update that on the whiteboard.
Only get black background there, nothing else.

wary sandal
#

is there a way to prevent fences from being destroyed/ran over by cars?

winter rose
#

allowDamage?

wary sandal
#

running allowDamage false and enableSimulation false on them doesn't work btw

winter rose
#

it should

#

just that because they are terrain objects, you might have to deal with streaming iirc - otherwise I don't see an issue

wary sandal
#

i'll share the code so y'all can test

{
    if (!isObjectHidden _x) then {
        _x allowDamage false;
        _x enableSimulation false;
    };
} forEach nearestTerrainObjects[
    [worldSize / 2, worldSize / 2],
    ["FENCE"],
    worldSize * sqrt 2 / 2,
    false,
    true
];
granite sky
#

I dunno, they do have a different simulation, right...

wary sandal
granite sky
#

Are you sure the objects in question count as "FENCE"?

wary sandal
granite sky
#

because that stuff is pretty shaky at best

wary sandal
#

i used hideObject to test it

#

and the ones that do qualify as FENCE are still destructible

granite sky
#

Fair enough.

winter rose
#

stop breaking the game

#

bans user

proven charm
#

u can always fix them though, via setdamage

wary sandal
#

but i thought that having 50000 event handlers is a bit too much load on the server's memory...

proven charm
#

u could just make a script that finds broken fences

#

unless its whole map you want to cover , that would be slow....

granite sky
#

Maybe it's unintentional and you could persuade someone to fix it for 2.14

proven charm
#

im not expert here but i believe its a config thing

wary sandal
#

it wouldn't really be of any priority because it's not even a bug

meager granite
granite sky
#

meh, not like bugs get any priority :P

wary sandal
#

maybe it can be fixed with a mod, but i have no modding skills

still forum
meager granite
# stable dune Hello , is some where example/ guide for new procedural textures to get ui (map...

Here is crappy code snippet I used to try things out:

    if(!isNil"test") then {deleteVehicle test};
    test = createVehicle ["UserTexture10m_F", getPos player, [], 0, "CAN_COLLIDE"];

    teststr = "display" + (random 1e6 toFixed 0);
    test setObjectTexture [0, format["#(rgb,1024,1024,1)ui('RscDisplayEmpty','%1')", teststr]];

    onEachFrame {
        private _new_display = findDisplay teststr;
        testdisplay = _new_display;
        if(isNull _new_display) exitWith {};

        for "_i" from 1 to 10 do {
            private _test = _new_display ctrlCreate ["RscText", -1];
            _test ctrlSetPosition [0,0,_i/10,_i/10];
            _test ctrlSetBackgroundColor [random 1,random 1,random 1,0.3];
            _test ctrlCommit 0;
            _test ctrlSetText str _i;
        };

        private _ctrl_map = _new_display ctrlCreate ["RscMapControl", -1];
        _ctrl_map ctrlSetPosition [0.1, 0.1, 0.8, 0.8];
        _ctrl_map ctrlCommit 0;
        testmap = _ctrl_map;

        _ctrl_map ctrlMapAnimAdd [0, 0.3, player];
        ctrlMapAnimCommit _ctrl_map;

        displayUpdate _new_display;

        onEachFrame {
            testmap ctrlMapAnimAdd [0, 0.03, getPosWorld player vectorAdd [500,-150]];
            ctrlMapAnimCommit testmap;
            displayUpdate testdisplay;

            test setPosWorld (vehicle player modelToWorldWorld [0,10,5]);
            test setDir getDir player;
        };
    };
#

onEachFrame hacky mess, you can't get display on the same frame as you create ui2texture display, have to do it on the next frame.

#

If you'll have your own display that saves itself to some variable on onLoad, you can do everything proper right away.

meager granite
#
testmap ctrlMapAnimAdd [0, 0.03, getPosWorld player vectorAdd [500,-150]];
```this offset only works on Atlis, doesn't on other maps
#

map will be aimed at the wrong spot

meager granite
#

Are script-placed fences become immune to being destroyed by collision with allowDamage false?

#

If yes then you can try making a complicated solution: Check for fences around player\units each frame. If map-placed fences are found, hide them and replace with script-spawned properly invincible fences so player can't tip them over. When far away, delete\reuse script-spawned fences and un-hide original map ones.

#

The only issue is that you'll also need to somehow make scripted fences same size as map-placed ones, maybe setObjectScale\getObjectScale is sufficient.

#

If this concept is even possible, it might be optimised to run fairly fast with no FPS impact ๐Ÿค”

slender badge
#

Is there a way to use drawIcon to work in the initial briefing screen before mission start? Currently only tried using cfgFunctions and postInit to execute the inital call to draw the icons, all with no success.

little raptor
still forum
#

i commented on your ticket

little raptor
#

Oh meowsweats
Sorry didn't notice

meager granite
#

I needed to wait for getClientStateNumber to be >= 9 first though

#

Script started from vehicle init field

wary sandal
#

wouldn't that guzzle the server performances

wary sandal
#

i gotta try that

slender badge
winter rose
wary sandal
#

and how do I create one

meager granite
meager granite
#

the message was about the moment when script start running, at vehicle init

wary sandal
#

str returns it but with a number

#

i want to get rid of that

#

nvm found it

#

getModelInfo

cosmic cipher
#

Hi, i have a RPT message with "Wrong weapon selection".
Maybe it has something to do with an incorrect weapon declaration in the config?
Or is the rpt message an indication of something else (false classname for unit loadout)?
Maybe someone can help me with the correct interpretation. Thanks

wary sandal
#

@meager granite sorry for the ping, the super simple object solution works but i have a small issue

#

before

#

as you can see the copy of the fences don't exactly have the same rotation

#

and this could look really bad on steep terrains

#

here's the code i use to spawn the fences, maybe you can find a solution

private _copy = createSimpleObject [getModelInfo _x select 1, [0, 0, 0]];
_copy setPosWorld (getPosWorld _x);
_copy setVectorDirAndUp [vectorDir _x, vectorUp _x];
gleaming rivet
#

Best recommendation; look at the ACE3 code. It's on github and it's open, so clone yourself a copy and examine away.

little raptor
wary sandal
#

but there's no difference this time

little raptor
#

are the object scales the same?

wary sandal
#

same mesh to be exact*

little raptor
#

not same object

#

use setObjectScale and getObjectScale

wary sandal
#

alr

#

in any particular order?

#

like before setpos or setvectordir?

#

we never know with arma

little raptor
#

after setdup

#

before setpos

wary sandal
#

but i think it has to do with rotation

#

and not scale

little raptor
wary sandal
# little raptor what's the code?
(getModelInfo _x) params ["_model", "_modelPath"];

if (!_isExcluded) then {
    _x hideObject true;
        
    private _copy = createSimpleObject [_modelPath, [0, 0, 0]];
    _copy setVectorDirAndUp [vectorDir _x, vectorUp _x];
    _copy setObjectScale (getObjectScale _x);
    _copy setPosWorld (getPosWorld _x);
};
little raptor
#

do you execute that on the intact object?

#

or after it's destroyed?

wary sandal
#

roughly when the scenario starts

little raptor
#

the model is reversed

#

you have to read the property from config iirc

#
(getModelInfo _x) params ["_model", "_modelPath"];

if (!_isExcluded) then {
    _x hideObject true;
        
    private _copy = createSimpleObject [_modelPath, [0, 0, 0]];
    _copy setVectorDirAndUp [vectorDir _x vectorMultiply -1, vectorUp _x];
    _copy setObjectScale (getObjectScale _x);
    _copy setPosWorld (getPosWorld _x);
};
#

that'll fix your problem for that object

wary sandal
little raptor
#

I don't remember

#

it's either config or geometry LOD

#

either way it's called reversed iirc

little raptor
#

if so it's defined in config

#

if not it's defined in geometry LOD

little raptor
#

test it then

wary sandal
#

i know that for fences it returns ""

wary sandal
#

unfortunately

#

for both fences and walls

little raptor
#

are you sure you ran that on the original ones?

#

before being replaced?

wary sandal
#

yeah?

#

i don't run this command twice

little raptor
#

then I guess it's reversed by default and reversed=1 undoes it blobdoggoshruggoogly

wary sandal
#

i hope it's reversed for all fences lol

little raptor
#

does it have a reversed property?

#

ok now I remember

#

all objects are reversed by default

#

unless they have a reversed = 0 in config

#

so that means:

_reversed = typeOf _x == "" || {getNumber(configOf _x >> "reversed") == 1};
_dir = [1, -1] select _reversed;
_copy setVectorDirAndUp [vectorDir _x vectorMultiply _dir, vectorUp _x];
wary sandal
#

while most objects are reversed there are still a lot of non-reversed objects

#

good to know

#

i think i was facing the same issue with my house appearance script, i just didn't notice the houses flipping

wary sandal
#

it still looks weird basically anywhere else on the map

#
private _reversed = typeOf _x == "" || {getNumber(configOf _x >> "reversed") == 1};
private _dir = [1, -1] select _reversed;
private _copy = createSimpleObject [_modelPath, [0, 0, 0]];
            
_copy setVectorDirAndUp [vectorDir _x vectorMultiply _dir, vectorUp _x];
_copy setObjectScale (getObjectScale _x);
_copy setPosWorld (getPosWorld _x);
little raptor
little raptor
cosmic cipher
# little raptor post the whole error

This is a small part where the message appears:

0:40:53 ["MBMC_fnc_createStaticGun/rhs_D30_at_msv"]
0:41:12 Wrong weapon selection
0:41:12 Wrong weapon selection
0:41:12 Wrong weapon selection
0:41:12 Wrong weapon selection
0:41:12 Wrong weapon selection
0:41:12 Wrong weapon selection
0:41:12 Wrong weapon selection
0:45:01 Client: Object 5:32 (type Type_462) not found.

Between 0:40:53 and 0:41:12 foot patrols are spawned.
I just wanted to know if you have any idea what command or action gives this message in the RTP file.
If it's not a vanilla diag_log message, then it's probably going to be difficult to determine which mod it came from.
It's not bad if nobody knows, just wanted to know all the messages about possible irregularities and then fix these irregularities.

little raptor
#

it appears to be a config error tho

cosmic cipher
shut torrent
#

_smoke = nearestObject [player, "SmokeShellYellow"];
    
    // get the position where the helicopter will drop off the units
    _dropoffpos = _smoke modelToWorld [0,0,-5];

    // create the helicopter and group of units
    _heli = createVehicle ["B_Heli_Transport_01_camo_F", _smoke, [], 0, "FLY"];
    _group = createGroup west;
    _unit1 = _group createUnit ["B_soldier_F", _dropoffpos, [], 0, "NONE"];
    _unit2 = _group createUnit ["B_soldier_F", _dropoffpos, [], 0, "NONE"];
    _unit3 = _group createUnit ["B_soldier_F", _dropoffpos, [], 0, "NONE"];
    
    // move the helicopter to the dropoff position
    _heli setPos _smoke;
    _heli action ["engineOn",_heli];
    _heli animateDoor ["Door_LF_R", 1];
    sleep 2;
    _heli move _dropoffpos;
    _heli animateDoor ["Door_LF_R", 0];
    sleep 5;
    
    // move the units to the dropoff position and set their combat mode
    {_x setCombatMode "YELLOW"; _x move _dropoffpos} forEach units _group;
    
    // hint to the player that the reinforcements have arrived
    hint "Reinforcements have arrived!";
}];```
#

Can someone explain the issue with this?

winter rose
#

no, you have to tell us what you want and what you obtain (and eventually the error you encountered)

granite sky
#

I'm not really sure what you're trying to do as it seems to be trying to jam an awful lot of objects into a small space, but _heli setPos _smoke is clearly wrong as setPos won't take an object as the second parameter.

shut torrent
#

Trying to achieve being able to use a smoke grenade to call in reinforcements via a helicopter

meager granite
#

So, my comment about ctrlMapAnimAdd being broken for UI2Texture displays is wrong. I forgot that you have to move the map with ctrlMapSetPosition instead of ctrlSetPosition. thronking

#

Still a ton of inconsistencies with aspect ratio though

meager granite
#

In case somebody wants to experiment with it

stable dune
still forum
#

Add all to ticket when its there meowheart

drowsy geyser
little raptor
#

tl;dr use get

drowsy geyser
#

thank you, i got it working ๐Ÿ™‚

modern meteor
#

I am looking for a way to count the units in my AI squad and split them equally into Green/Red team. Not sure how to do this. Any idea?

stable dune
# modern meteor I am looking for a way to count the units in my AI squad and split them equally ...

Many ways to do, if you want group of player units to red or green you can do

_playerUnits = units group player;
private _count = 0; 
{ 
    _count = _count+1;
    _soldier = _x; 
    if (_count % 2 == 0) then { 
        _soldier assignTeam "RED"; 
    } else { 
        _soldier assignTeam "GREEN"
    }; 
} forEach _playerUnits;

it shows in gui radar each one in a different color, but if you want the first (half) to be red, and the other half to be green, you can do this

_playerUnits = units group player;
_count = count _playerUnits;
for "_i" from 0 to _playerUnits-1 do {
    _unit = _playerUnits select _i;
    if (_i =< _count/2) then {
        _unit assignTeam "RED";
    }else{
        _unit assignTeam "GREEN";
    };
};
modern meteor
#

Thank you both!

still forum
#

if you want vehicles, just use

wary sandal
#

sorry i forgot to do it

#

(the whole array)

restive hinge
#

Is there a better way to get name of all config entries for World locations?

_locationsArray = getArray (configFile >> "CfgWorlds" >> worldName >> "Names" >> _x >> "name");

I can't make this work. Any suggestions?

storm field
#

Anyone know the code to enable ai and show ai when players enter a trigger?

#

Such as players enter the AO and Ai enable simulation and unhide

winter rose
winter rose
storm field
#

Thanks

coarse dragon
#

what do you call the command to get a tank to fire its main weapon?

winter rose
#

"the good one"

#

alternative answer: "the big red button" ๐Ÿ˜„

coarse dragon
#

๐Ÿฅน

winter rose
#

fire, doFire, fireAtTarget, forceWeaponFire, BIS_fnc_fire? your call ๐Ÿ˜„

coarse dragon
#

which one doesnt need the Ammo type lol

restive hinge
#
_locationsArray = configFile >> "CfgWorlds" >> worldName >> "Names" >> "DefaultKeyPoint1";
_locationName = getText (_locationsArray >> "name");
systemChat str _locationName;

I'm able to get a single entry, although I can't properly iterate through all the Names properly...

_locationsArray = [];
{
    _locationArray = configFile >> "CfgWorlds" >> worldName >> "Names" >> _x;
    _locationName = getText (_locationArray >> "name");
} forEach _x in _locationsArray;
systemChat str _locationsArray;

I'm sorry if I'm being stupid! notlikemeow

stable dune
#

I tested just for learning myself too

stable dune
winter rose
winter rose
stable dune
coarse dragon
winter rose
#

perhaps ๐Ÿฎ

patent lava
#

is there a way to set roleDescription?

winter rose
#

no

#

I believe there might be a CBA something that does it

coarse dragon
#

"CUP_O_T72_RU" call funcGetTurretsWeapons;

#

that doesnt do anything

south swan
#

what is funcGetTurretsWeapons?

coarse dragon
#

ive no idea im clueless

winter rose
#

hi clueless, I'm dad!

coarse dragon
#

meowhuh you didnt die in the war after all

#

im not even sure what to google for for this

patent lava
#

unfortunate, custom variable it is

hallow mortar
# coarse dragon im not even sure what to google for for this

Finding a vehicle's weapons is fairly easy (weapons, weaponsTurret etc) but procedurally figuring out which one is the "main gun" is rather complex. The concept of the main gun is doctrinal, rather than technical, in Arma terms, and there's no one thing you can pick on to identify it. The easiest way forward is if you know and specify the weapon classname, rather than trying to get the script to pick one automatically. Obviously this makes it harder to dynamically use the script for arbitrary vehicle types.

#

If you know for sure that your script is only going to be run on a particular vehicle type, you can just look in its config or use weapons to find its weapons, pick the one you want, and put that in your script.

coarse dragon
#

ah thanks

#

weapons[] = {}; hmm

south swan
#

inb4 _tonk weaponsTurret (_tonk unitTurret (gunner _tonk));

winter rose
#

leaves the chat

hallow mortar
# coarse dragon weapons[] = {}; hmm

The first-level weapons[] property in the config shows the weapons that are on the base frame, i.e. driver-controlled weapons. If it has a horn, it will appear here, and if it's an aircraft with fixed weapons, those will appear here. Since this is a tank, and the weapons are all mounted on various turrets, you need to open up the turret subclasses and look in their weapons[] properties to see which weapons are mounted there. Or use weapons.

south swan
#

and then go a road of assumptions. Is the first weapon primary? Or the one with "cannon" in its classname? Or in soundName? Or with cannon targeting cursor? Or with highest penetrating round if you're willing to dive 3 layers of config deep for all of the weapons? notlikemeow

hallow mortar
#

That's why I said the easiest way to do it is to pick one beforehand using your own judgement, instead of trying to do it procedurally.

stable dune
spiral temple
#

is there any solution for player markers not showing for new connected players?

agile cargo
#

setObjectTexture [0, '#(rgb,1024,1024,3)text(1,1,"TahomaB",0.54,"#ffffff","#ff6f00","58m"']; works

#

setObjectTexture [0, '#(rgb,1024,1024,3)text(1,1,"TahomaB",0.54,"#ffffff","#ff6f00","59m"']; doesn't

#

wtf

wary sandal
#

i made it so the fences turn into super simple objects when they are in a 20m radius

#

which made the rotation issue even more noticeable

winter rose
spiral temple
agile cargo
# agile cargo ``setObjectTexture [0, '#(rgb,1024,1024,3)text(1,1,"TahomaB",0.54,"#ffffff","#ff...
[ 
 { 
  {
    private _distance = player distance _x; 
    _x setObjectTexture [0,  format ['#(rgb,1024,1024,3)text(1,1,"TahomaB",0.54,"#ffffff","#ff6f00","%1"', _distance toFixed 0 ]]; 
  } forEach  (_this select 0 select 0) ;
 }, 
 1, 
 [synchronizedObjects distance_bills_logic] 
 ] call CBA_fnc_addPerFrameHandler;
``` Some textures are not rendering, it appears to be random. Like every time I restart, it won't work for certain distances
#

Possible bug with the procedural text texture or I'm doing something wrong?

#

the amount of objects in the distance_bills_logic doesn't seem to have any effect.

#

hm, I changed the width and height to 512 and the mipmapsAmount to 1, that fixed it

quiet gazelle
#

Could someone please guide me through creating a c++ project using intercept that compiles to a .dll that i can execute from sqf?
I've never really done anything with c++ before, but i think i'll be fine on my own once i know how to access intercept and how to build the .dll.

open hollow
#

there is some way to detect when mouse is over the grp icon in zeus interface?

edit: curatorMouseOverblobdoggoshruggoogly

slow isle
#

private _assisters = (_killed getVariable ["shooterIndex", []]) - [_instigator, objNull];
What does the - symbol do?

#

Im trying to understand this line of code but can't

quiet gazelle
#

it subtracts arrays

slow isle
#

Oooh i see, thanks

wary sandal
#

is it possible to change the texture of ATMs via setObjectTextureGlobal ?

#

the getObjectTextureGlobal command returns []

slow isle
#

How can I remove an object from an array when I have said object?
something like:
arr = [bis_01, bis_02...]
arr2 = arr removeObject bis_02;

quiet gazelle
#

arr - [bis_02]

slow isle
#

oh one sec, I have a flaw in my logic

quiet gazelle
#

oh you want just the first occurence

#

?

slow isle
#

you're right

slow isle
#

one moment

quiet gazelle
#

arr deleteAt (arr find bis_02);

brazen lagoon
#

does the KeyDown event handler not fire for mouse1?

#

doesn't seem to fire for any mouse buttons

pulsar bluff
#

"key"

brazen lagoon
#

ok cool, how do you catch mouse events then?

pulsar bluff
#

"mousebuttondown"

brazen lagoon
#

doesn't that also disable mouse usage in menus.

#

sorry actually the real problem I want to solve is I want to disable a player's ability to shoot

pulsar bluff
#
player addAction ['',{systemchat 'nope';},nil,-10,false,true,'defaultaction','true'];```
brazen lagoon
#

huh. interesting

crystal lagoon
#

So, I found a script that goes into the init file that's supposed to jam TFAR radio, and I was wondering how I would go about setting it up to work with multiple objects

#

_unitInJammerArea = nearestObjects [jammer, ["Man"], 200];
_allUnits = allPlayers - entities "HeadlessClient_F";

_notInJammerArea = _allUnits - _unitInJammerArea;

if !(count _notInJammerArea isEqualTo 0) then { 
    {
        _x setVariable ["tf_receivingDistanceMultiplicator", 1];
        _x setVariable ["tf_sendingDistanceMultiplicator", 1];
    }foreach _notInJammerArea;
};

if !(count _unitInJammerArea isEqualTo 0) then { 
    {
        _x setVariable ["tf_receivingDistanceMultiplicator", 0];
        _x setVariable ["tf_sendingDistanceMultiplicator", 0];
    }foreach _unitInJammerArea;
};
sleep 5;

};```
#

Would I have to copy and paste this with a different variable name for each jammer, or can I just add all of them into this code and have it work fine?

grizzled cliff
#

dear BI, please implement native associative hash maps. - signed, nou, who just finished writing a full on implementation in sqf using logics and a garbage collector.

tender fossil
crystal lagoon
#

How would I have to modify it?

#

Also, if I can just copy/paste it and not have that bung anything up, that's fine.

tender fossil
crystal lagoon
#

My unit has 20-30 players on weekend ops

manic kettle
#

I have a lightweight jamming script that works by classname init and adds an interaction to objects spawned midgame.
If you want it msg me tomorrow evening so I remember, just need to credit and not reshare without permission

Otherwise I would just copy paste like ezcoo said

tender fossil
# crystal lagoon How would I have to modify it?

It depends on your general skill level when it comes to SQF and programming in general ๐Ÿ˜› But yeah, if the overhead of rewriting the script is higher than copy-pasting the code the necessary number of times, possible edits to all the code instances and testing, there isn't much sense in rewriting it. However, if you're planning to reuse the script or make more than a few modifications to your current mission affecting the jammers, then I'd script it "the proper way"

crystal lagoon
#

I pretty much just make missions for my unit lol

tender fossil
crystal lagoon
#

Alright, thanks

#

I keep a set of scripts in a folder for later reference

slow isle
#

For some reason "Code reached!" gets written to sideChat but the name of the last shooter does not. Can someone help me figure out why that is?

[] spawn {
    while { true } do {
        {
            _x setVariable ["shooterIndex", []];
            _x addEventHandler ["HandleDamage",
            {
                params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];

                _x setVariable ["lastShooter", _instigator];
                player sideChat str (_x getVariable "lastShooter");
                player sideChat "Code reached!";


                (_unit getVariable "shooterIndex") pushBackUnique _instigator;
                _damage
            }];
            _x setVariable ["passedThatHandleDamage", true];
        } forEach (allUnits select {isNil {_x getVariable "passedThatHandleDamage"}});
        sleep 2;
    };
};

This code is supposed to keep an array of all units who've hit an object. (assists)
I want to set and get a "lastShooter" variable so in case of indirect death, the _instigator/player still gets credited the kill.

tender fossil
crystal lagoon
#

How does sleep affect it? Isn't that just the time between checks?

tender fossil
#

I don't think Arma even allows sleep in init scripts (with some exceptions but they're not important here), because it could used to block the game

tender fossil
crystal lagoon
slow isle
#

thank you

tender fossil
# crystal lagoon So what happens if I take the sleep out?

It just checks it constantly and freezes the game for a while, though IIRC there might be some upper limit to the number of checks (10000?) so that the code will eventually stop and let the game to continue executing. But yeah, as a simplified version of the story: if you want to do stuff in parallel (i.e. tell computer/Arma to "do other stuff while this code is asleep and not make the game freeze instead", you need to tell it to the computer/Arma explicitly. To achieve that in Arma/SQF, you need to use scheduled execution which means using spawn or execVM. The better option of those commands depends on the exact use case.

crystal lagoon
#

So place a trigger that uses execVM just for the purpose of checking?

tender fossil
crystal lagoon
#

This is all new territory for me

tender fossil
tender fossil
crystal lagoon
#

It's probably a better idea to optimize it.

#

We uh

#

Tend to have a lot going on

#

Big warzone stuff on the weekends

tender fossil
# crystal lagoon It's probably a better idea to optimize it.
[] spawn {
// your code here
};```If you want to optimize it, you should compile it as a function (which is kind of preparing stuff beforehand to make it more optimized to run the code during the game) before spawning it with the above code. Arma 3 has `compileScript` command nowadays, it's handy. Or you can use a thing called `cfgFunctions` but that's probably not worth it to learn it yet
manic kettle
#

My best answer to that problem is a CBA perFrame event handler set to run every x seconds < I use 5s>

crystal lagoon
#

Oh no.

#

Now you're really outside my wheelhouse

#

Oh also, this is operating on a server that I don't own

#

In case that matters

tender fossil
# crystal lagoon Now you're really outside my wheelhouse

In short,

// yourFunction.sqf (a separate .sqf file)
YourFunctionName = {

params ["_jammer"];

  while {alive _jammer} do {

    _unitInJammerArea = nearestObjects [_jammer, ["Man"], 200];
    _allUnits = allPlayers - entities "HeadlessClient_F";

    _notInJammerArea = _allUnits - _unitInJammerArea;

    if !(count _notInJammerArea isEqualTo 0) then { 
      {
        _x setVariable ["tf_receivingDistanceMultiplicator", 1];
        _x setVariable ["tf_sendingDistanceMultiplicator", 1];
      } foreach _notInJammerArea;
    };

    if !(count _unitInJammerArea isEqualTo 0) then { 
      {
        _x setVariable ["tf_receivingDistanceMultiplicator", 0];
        _x setVariable ["tf_sendingDistanceMultiplicator", 0];
      } foreach _unitInJammerArea;
    };
  
  sleep 5;
  };

};

Then add to your init script:

// relative path means file path from mission root folder to the actual SQF file in it
compileScript ["relative/path/to/yourFunction.sqf"];

[jammerName] spawn YourFunctionName;
[secondJammerName] spawn YourFunctionName;
// repeat for each jammer with the proper object variable name

This can be optimized further a lot (in terms of both performance and flexibility), but it's a start for now to not to make you (too) confused

crystal lagoon
#

Oh damn. That does make it easier

tender fossil
#

If you're using a code editor like Visual Studio Code, you can get the relative path by right-clicking the SQF file and selecting "Copy relative path" or something like that. Just remove the first folder (the mission name) from the path and you should be fine

crystal lagoon
#

What would the path be relative to the folder?

#

Oh lmao

#

I use notepad++

quiet gazelle
tender fossil
# quiet gazelle do you not need to call the compiled code type for the variable YourFunctionName...

Ah, it might be indeed. I've been scripting only Arma 2 for a good while so I'm not that familiar with the new fancy stuff in Arma 3 ๐Ÿ˜„ So @crystal lagoon yeah, you probably need to change the init script to this:

// relative path means file path from mission root folder to the actual SQF file in it
call compileScript ["relative/path/to/yourFunction.sqf"];

[jammerName] spawn YourFunctionName;
[secondJammerName] spawn YourFunctionName;
// repeat for each jammer with the proper object variable name