#arma3_scripting

1 messages Β· Page 44 of 1

winter rose
#

peeps die when all ejected at once (by collision I suppose)

ivory lake
#

the reason they die when they touch the ground is cuz of the parachutes

#

the parachutes are set to drop significantly faster than vanilla and its at lethal speeds, the paradrop script disables damage prior to landing to avoid it

#

those parachutes shouldnt be available for general use but for whatever reason, are

proven charm
#

im giving them vanilla parachutes

plush belfry
#

hey how do I use this in an sqf file,

what I am trying to achieve is basically I paste an

execVM "testScript.sqf"

and then whatever objects the script is pasted on, it runs the script in the file on that object

proven charm
#

in file use _this

cosmic lichen
#

Expression called upon at start. In multiplayer, it is called on every machine and for each player who joins in the progress. The variable 'this' refers to the affected object.
About init fields in the Editor.

plush belfry
#

I get an error saying
error undefined variable in expression: _this

cosmic lichen
#

Where do you use it?

plush belfry
cosmic lichen
#

Post the file

#

or rather the code in the file.

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
plush belfry
# cosmic lichen !code
[
    _this,                                            
    "Search Locker",                                        
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",    
    "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",    
    "_this distance _target < 3",                        
    "_caller distance _target < 3",                        
    {},                                                    
    {},                                                
    { 
        hint "Searched"

     },                
    {},                                                    
    [],                                                    
    12,                                                
    0,                                                    
    true,                                                
    false                                                
] remoteExec ["BIS_fnc_holdActionAdd", 0, _this];    
plush belfry
#

anyone know why its not working?

little raptor
plush belfry
little raptor
#

I mean show me the exact code

plush belfry
#

alright

plush belfry
# little raptor I mean show me the exact code

Execution

execVM "loot\lockerLoot.sqf";

lockerLoot.sqf



[
    _this,
    "Search",
    "", "",
    "true", "true",
    { hint "Started!" },
    { systemChat str (_this select 3) },
    { hint "searched" },
    { hint "canceled" },
    [], 10, nil, true, false
] call BIS_fnc_holdActionAdd;
little raptor
#

it should be this execVM ... not just execVM ...

little raptor
plush belfry
wooden spear
#

Looking for a script that when you look at a sign or a object in a vehicle, either a service menu comes up on scroll (option list) or service option. Anyone know?

jade acorn
wooden spear
#

So service is already in, just adding the usage of that is what I need?

#

I dont understand parameters, assistance?

#

(I speak for a server I make, so its a public usage is my concern if possible)

little raptor
jade acorn
#

your _hostageUnit is a string, not an actual unit

hallow mortar
#

First, most of the time you should use getPosATL/setPosATL or getPosASL/setPosASL - getPos/setPos are older commands that are slower and have some flaws.
Second...you're defining _hostageUnit as a string, not a unit.
Third, you're using getPos on a string. If hSpawn_x is meant to be an actual object or unit, you need to use that, not a string; if that's a marker then using a string is correct, but you need getMarkerPos.

#

"" denotes the String data type, which is literal text. Command documentation will tell you which commands expect what data types.

#

Yes

wooden spear
#

(servicing of vehicles and etc)

hallow mortar
#

Eh...probably? Maths is hard

granite sky
#

nah, it's correct.

tame raptor
#

howdy,so I created custom missile config for planes but AI does not want to launch them aganist air targets. How can I fix this issue?

hallow mortar
tame raptor
#

ah,thank you for correcting me

quiet geyser
#

Currently looking to issue some extra gear from an exosuit mod to a couple of players in a PvE scenario for my unit, but the weight of these items is a bit high for how my unit has their stamina stuff set up with ACE. What's the most effective way of being able to issue this gear to a select few player units and have them still able to perform without fatigue being as much of an issue without changing anything for the rest of the players?

hallow mortar
#

setUnitTrait changing the loadCoef trait, probably

quiet geyser
#

My main concern is how to set those values in a way that applies across respawns, but only to those units.

#

My assumption is that those values in the unit init wouldn't persist when they respawn?

pulsar bluff
#

you should be able to test that on your dev server

#

oneachframe {hintsilent str (player getunittrait 'loadcoef')}; and then kys

quiet geyser
#

Yep, all working. Thanks for the tip.

broken forge
#

I'm getting an error about type Number expected Bool and I'm confused as to how to fix this, even though it seems to be working in game. ```c
21:32:44 Error in expression <grade];
if ((_x select 0) == _paygrade) then {
_paymentToDo pushBack [_player, (>
21:32:44 Error position: <then {
_paymentToDo pushBack [_player, (>
21:32:44 Error Type Number, expected Bool

Here's a snippet of the script that's causing that error. Any help would be appreciated
```sqf
_totalPayment = 0;
    _paymentToDo = [];
    _paygrades = (missionConfigFile >> "SOG_AdminSystemClientModule" >> "dummyVariables" >> "payday" >> "paygrades") call BIS_fnc_getCfgData;
    {
      _player = _x;
      _paygrade = _player getVariable ["PayGrade", "E1"];
      {
        // diag_log format ["%1", (_x select 0)];
        // diag_log format ["%1", _paygrade];
        if ((_x select 0) == _paygrade) then {
          _paymentToDo pushBack [_player, (_x select 1)];
          _totalPayment = _totalPayment + (_x select 1);
        }
      } count _paygrades;
    } count (playableUnits);
    if (_totalPayment > companyFunds) exitWith { hintSilent "Poor Guys" };
    {
      (_x select 0) setVariable ["Cash_Bank", ((_x select 0) getVariable["Cash_Bank", 0]) + (_x select 1), true];
    } count _paymentToDo;
    ["deduct", _totalPayment] call SOG_ClientModules_fnc_adminRefresh;
    ["deduct", _totalPayment] remoteExecCall ["SOG_Server_fnc_handleFunds", 2];
  };
#

This is what the full output looks like: ```c
21:56:37 "[[""E1"",1000,""Enlisted""],[""E2"",1250,""Enlisted""],[""E3"",1500,""Enlisted""],[""E4"",1750,""Enlisted""],[""WO1"",2000,""Warrant""],[""WO2"",2250,""Warrant""],[""WO3"",2500,""Warrant""],[""WO4"",2750,""Warrant""],[""2LT"",3000,""Officer""],[""1LT"",3250,""Officer""],[""CPT"",3500,""Officer""],[""MAJ"",3750,""Officer""]]"

copper raven
#

you're currently returning a number, thus the error

#

stop using this "count perf" cheat thing, just forEach πŸ˜„

#

count when you actually need to count something, not iterate over an array

broken forge
#

can I have a forEach within a count?

copper raven
#

all 3 counts you have just replace with forEach and the problem will go away

#

or if you want to keep it with count, simply leave a true on the stack

#

also all those selects, use params

#

fx.,

    {
      _x params ["_obj", "_thing"];
      _obj setVariable ["Cash_Bank", (_obj getVariable["Cash_Bank", 0]) + _thing, true];
    } forEach _paymentToDo;
#

(rename the variables ofc, i got no idea what these things are)

broken forge
#

ok thanks for the help

copper raven
#

you can probably also use a hashmap here

keen stream
#

@cedar kindle And if they aren't?

winter field
#

you can still use a CBA PFH and only process part of the problem on each frame.

quiet geyser
#

Is there any way to set something up in a mission such that player profile facewear is ignored and the loadout facewear is used other than just manually using removeGoggles>addGoggles per unit in their init? It’s a massive pain in the ass.

hallow mortar
#

There's a description.ext parameter for it IIRC

queen cargo
#

great idea
use PFH
and after that why dont we take this shit even further on the script scheduler?
we do not have to stop here

nocturne bluff
#

lol

#

I only shit on people and in toilets.

#

:)

queen cargo
#

meh ... there where some word missing

jade acorn
#

can I somehow measure the detection rate/chance of unit depending on stance that unit is in? I'd like to see if unit doing a Ctrl+W/Ctrl+S "semi"-stances is harder or easier to detect than when in normal stand/crouch/prone stance. Placing two units in front of eachother while one of them does different poses seem to be too random

little raptor
proven charm
#

tidy: ```sqf
_spawns = [hSpawn_1,hSpawn_2,hSpawn_3,hSpawn_4,hSpawn_5,hSpawn_6,hSpawn_7,hSpawn_8,hSpawn_9];
selectRandom _spawns;

#

btw there is ,, in the code

#

if you want to exclude spawn objects from selectRandom you can do this:```sqf
selectRandom (_spawns - [_notThis]);

#

then the _notThis will not be selected

south swan
#

or something like ```sqf
private _spawns = [hSpawn_1, hSpawn_2, hSpawn_3, hSpawn_4, hSpawn_5, hSpawn_6, hSpawn_7, hSpawn_8, hSpawn_9];
private _weights = [0.1, 0.1, 0.6, 0.6, 0.6, 1.1, 1.1, 1.1, 1.1];

private _hostagePos = _spawns selectRandomWeighted _weights;
_spawns = _spawns - [_hostageSpawn];
private _pos2 = _spawns deleteAt (random count _spawns);
private _pos3 = _spawns deleteAt (random count _spawns);``` πŸ€”

winter rose
#

value comma space value comma space value etc.

#

also private your variables πŸ˜‰

south swan
#

"select random index inside the array boundary, save the value at that index into a separate value and delete it from the array"

#

the positions to use for "hMarker_2"/"hMarker_3"

#

just like you did in your own code? sqf _hostageUnit setPosATL (getPosATL _hostagePos); "hMarker_1" setMarkerPos (getPosATL _hostagePos); "hMarker_2" setMarkerPos (getPosATL _pos2); "hMarker_3" setMarkerPos (getPosATL _pos3);

meager granite
#

Is there a way to hide mouse cursor from display?

copper raven
meager granite
#

Need a display to track mouse movement with MouseMoving event and stop the player from moving the camera

#

Unless there is another way to do that πŸ€”

meager granite
warm hedge
#

inputAction can detect mouse movements I think

copper raven
#

i don't think you can disable the cursor

#

there was a FT thread about it

#

but was never implemented iirc

meager granite
meager granite
meager granite
#

Arma moment: MouseMoving and inputAction report no mouse movement if you do disableUserInput, yet mouse moves properly.

meager granite
#

Well, having invisible map control that does ctrlMapCursor could be a solution, if there was an invisible map cursor in vanilla config.

modern meteor
#

Simple question, why is the following not working? It is supposed to attach/detach the suppressor for the entire player group.

if (("muzzle_snds_M" in primaryWeaponItems player)) then {    
    _x removePrimaryWeaponItem "muzzle_snds_M";
    hint "Silencer off";
}
else {
    _x addPrimaryWeaponItem "muzzle_snds_M";
    hint "Silencer on";
}forEach units group player;

meager granite
#
{
    if (("muzzle_snds_M" in primaryWeaponItems _x)) then {    
        _x removePrimaryWeaponItem "muzzle_snds_M";
    }
} forEach units group player;
#

Unless you want to add/remove based of only player having/not having it

modern meteor
#

yea, it should be based on ether the player has it or not and then attach/detach for the whole group including the player.

meager granite
#
private _its_on = "muzzle_snds_M" in primaryWeaponItems player;

{
    if(_its_on) then {
        _x removePrimaryWeaponItem "muzzle_snds_M";
    } else {
        _x addPrimaryWeaponItem "muzzle_snds_M";
    };
} forEach units group player;
#
private _its_on = "muzzle_snds_M" in primaryWeaponItems player;

if(_its_on) then {
    hint "Silencer off";
} else {
    hint "Silencer on";
};

{
    if(_its_on) then {
        _x removePrimaryWeaponItem "muzzle_snds_M";
    } else {
        _x addPrimaryWeaponItem "muzzle_snds_M";
    };
} forEach units group player;
```with hint
modern meteor
#

This works perfect. So it's better to work with a variable.

#

Thank you for your help!

granite sky
#

well, you can replicate the whole loop instead. Either works.

worldly narwhal
#

Hello, I hope this is the right place to ask this.
I got this repeated trigger to work as intended, but after everything plays out in about two minutes, the trigger can be tripped again.
I wonder, is there a simple way to put sleep 600; somewhere to delay it's reset? I tried it right under terminate _handle; but it works just like before.
The trigger is as follows:
[] spawn { _handle = [player, player, east, ["AM_Ghoul_O_Radhop", "AM_Ghoul_O_Default", "AM_Ghoul_O_Hopper", "AM_Ghoul_O_Default"], 15, 1] spawn BIS_fnc_spawnEnemy; sleep 50; terminate _handle; };

meager granite
#

Do you mean you want trigger to not start again for 600 seconds after you triggered it?

worldly narwhal
#

Yes

granite sky
#

I guess you could disable simulation on the trigger.

south swan
#

or save last activation time in variable on trigger itself and check it inside the condition

winter rose
#

disabling saves lives CPU cycles

meager granite
granite sky
#

Theoretically yeah

worldly narwhal
#

Thanks guys, I'll try it out.

winter rose
worldly narwhal
still forum
#

You're writing good code, keep on! meowheart

worldly narwhal
#

Hmm, I have encountered a strange issue where when I use BIS_fnc_spawnEnemy; and set them as east (they are placed as west in the editor by default otherwise) their squad is marked red as east but individuals are still blue and shoot each other after being spawned by the trigger.

#

This all happens within the single squad.

proven charm
worldly narwhal
#

I think I misunderstood, then. I thought the "side" overrides "class" affiliation

#

The units are from west roster.

proven charm
#

side determines which side they belong

worldly narwhal
#

[player, player, EAST, ["Armored_Coat_01_body", "Armored_Coat_02_body", "Armored_Coat_02_body"], 20, 1] spawn BIS_fnc_spawnEnemy;

proven charm
#

you could make east soldier (model) to be in west side with that (I think)

worldly narwhal
#

the "Armored_Coat_01_body" is WEST by default, but I thought they would become EAST

little raptor
#

you can change their side after 1 frame

#

but I don't recommend it

#

instead just set their loadout

worldly narwhal
worldly narwhal
little raptor
#

yes it does last I checked

#

do you mean it doesn't?

worldly narwhal
#

No, no.. I did not do that yet. I'll look into it now, thanks for the pointers!

little raptor
# little raptor instead just set their loadout

I personally spawn ordinary riflemen first then just change their loadout (e.g if I want a bluefor viper I create a B_soldier_f then just do _unit setUnitLoadout "O_Viper_F" (or whatever it was...)

worldly narwhal
#

I think I will rewrite the triggers to use this method instead. It sounds much cleaner. Thank you!

hallow mortar
#

It bothers me that BIS_fnc_spawnEnemy has a side parameter if it doesn't work

little raptor
#

it only works if the side is the same as the spawned unit's side... meowsweats
that's a createUnit limitation, not related to the function itself

worldly narwhal
#

Yeah..

hallow mortar
copper raven
#

, % should be a string

#

, "%"

#

you can also use &#37;

#

since you're using structured text

hallow mortar
copper raven
#

yes

#

ascii keycode

lunar goblet
#

Can anyone help me make a script to make it seem like a helicopter was hit by lightning when it enters a trigger area, but actually just damage it's tail rotor? this is what I have so far.

copper raven
#

also locality, so in the end, something like

if !local lightningHeli exitWith {};
lightningHeli setHitPointDamage ["replaceme", 1];
true frigate
#

Hey! Is there a way of using Sleep in an unscheduled environment? I'm looking online and can't find anything sadly.

#

If I remember correctly, it's to do with Spawn, but I can't remember the exact code.

south swan
#

No sleeps in unscheduled. You can create a new scheduled thread with spawn or execVM from unscheduled, though

true frigate
#

I'll look a little further into it. Thanks πŸ™‚

south swan
#
[] spawn {
sleep 10;
call MUH_fnc_something;
};``` is the basic idea
little raptor
tiny loom
#

does anyone know what this means help

fair drum
tiny loom
#

im using cba right so where would i go to check that

tiny loom
fair drum
#

CBA shouldn't throw an error unless you may have included things wrong/file path wrong elsewhere I think.

#

but

#

if it is CBA, turn off "warnings are errors" in pboProject to ignore it

tiny loom
#

like that?

copper nova
#

Heyo, does anyone know if the player variable BIS_revive_incapacitated is set as global in the default arma revive system?

fair drum
# tiny loom

yeah so the cba isnt triggering it anymore. now you have file pathing issues atm

tiny loom
#

yea im just gonna resart

#

restart

fair drum
# copper nova Heyo, does anyone know if the player variable BIS_revive_incapacitated is set as...

yes its global

// from a3/functions_f_mp_mark/revive/defines.inc

#define STATE_RESPAWNED                                0
#define STATE_REVIVED                                1
#define STATE_INCAPACITATED                            2
#define STATE_DEAD                                    3

#define GET_STATE_STR(state)                        format["%1(%2)",["RESPAWNED","REVIVED","INCAPACITATED","DEAD"] select state,state]

#define SET_STATE(unit,state)                        ["",state,unit] call bis_fnc_reviveOnState;unit setVariable [VAR_TRANSFER_STATE, state, true]
#define SET_STATE_XTRA(unit,state,source)            ["",[state,source],unit] call bis_fnc_reviveOnState;unit setVariable [VAR_TRANSFER_STATE, [state,source], true]
#define SET_STATE_XTRA2(unit,state,source,reason)    ["",[state,source,reason],unit] call bis_fnc_reviveOnState;unit setVariable [VAR_TRANSFER_STATE, [state,source,reason], true]

#define GET_STATE(unit)                                (unit getVariable [VAR_STATE, STATE_RESPAWNED])
#define IS_DISABLED(unit)                            (GET_STATE(unit) == STATE_INCAPACITATED)
#define IS_ACTIVE(unit)                                (GET_STATE(unit) < STATE_INCAPACITATED)
fair drum
tiny loom
#

do you know who to wipe my p drive

#

how

#

sorry

copper nova
#

Well I have another question πŸ€“ Maybe someone has an idea, I have unfortunately found nothing helpful. Is there any way to check if a hold action becomes visible on screen?

#

So that you know:
I have put a jump action on spacebar and want to prevent that you jump by mistake when you want to press the hold action πŸ˜…

fair drum
tiny loom
#

yea sorry i had a dumb moment but i got it figured out now

fair drum
copper nova
tiny loom
#

is it good that my pboproject is taking a bit now instead of instantly giving me errors

fair drum
copper nova
#

Would probably be better haha. But spacebar is just THE jump key 🀣

#

Is it possible to change the key for a hold action? I guess not?

pulsar bluff
#

findEmptyPosition works fine on terrain, but what about on something like a ship deck

meager granite
pulsar bluff
#

like testing bounding box at a position the object isnt at? @meager granite

meager granite
#

Yeah, depending on your needs

sterile flower
#

i am currently working on a set of scripts that "teleports" an object to the player in order for them to use it and then teleports it away when they are done. I am doing this with an addAction and setPos for each movement. The issue is it only works once for each, so it will teleport to the player and teleport away but then it wont work again. Any ideas? I dont want to use an SQF since it is supposed to all be a composition instead i am using something like testTest = true

broken forge
#

Could someone help me with combining two arrays defined from a config.hpp if a player's UID matches a specified UID. ```hpp
storeCategories[] = {
"storeBackpacks",
"storeGoggles",
"storeHeadgear",
"storeItems",
"storeMagazines",
"storeUniforms",
"storeVests",
"storeWeapons"
};
storeRestrictedCategories[] = {
"storeAircraft",
"storeArmored",
"storeChopper",
"storeMarine",
"storeStatic",
"storeUAV",
"storeUGV",
"storeWheeled"
};

```sqf
{
    if ((getPlayerUID player) in companyGenerals) then {
        {
            _index = lbAdd [2023005, _x];
        } forEach storeRestrictedCategories pushBack _x;
    };
    _index = lbAdd [2023005, _x];
} forEach storeCategories;
lbSetCurSel [2023005, 7];
#

Essentially I need the storeRestrictedCategories to only be added to the storeCategories array when the if statement is met.

peak pond
#

Hi, do scheduled scripts have much effect on game performance? I understand from the wiki the scheduler allocates 3ms per frame, which in theory should give about 14ms for everything else to run at 60 fps. Are there cases where the scheduler may significantly overrun the 3ms limit, eg if some heavy atomic script command cannot be paused midway through? Is there a way to pause the entire scheduler, or terminate all scripts, to see the total performance effect of all the scripts that were running?

fair drum
fair drum
hallow mortar
peak pond
#

Makes sense. I guess I'm wondering how far past 3ms some scripting commands may push the scheduler. Like what if it begins an operation at 2.9ms which takes a whole 1 ms.

meager granite
fair drum
meager granite
#

nearestObjects [player, [], 100000] will freeze the game for like a minute and scheduler won't help you

#

Basically, running heavy commands inside scheduler isn't going to help. I think scheduler can interrupt and wait until next frame only at ; or something like that.

peak pond
#

Ok, that was my worry.

#

So is there some way to pause the scheduler, or terminate all scheduled scripts? Ie in order to determine if I had expensive things scheduled.

meager granite
hallow mortar
meager granite
peak pond
#

Sorry that's not what I meant. Is there a way to globally pause/disable/empty the scheduler?

#

Like pause all scripts even ones I didn't write, to compare game performance with scripts running vs a baseline with no scripts.

hallow mortar
peak pond
#

Gotcha, makes sense. For my own scripts, I suppose I could keep track of all the script handles and at least terminate everything that way, for purpose of performance comparisons.

#

Thanks for the help.

meager granite
#

To make sure you're keeping track of all threads

peak pond
#

Thanks, that is a good one.

#

I've also started tinkering with diag_captureSlowFrame in the development build, but unfortunately I'm not familiar with most of the symbols the call tree includes.

meager granite
#

If you think your scripts freeze the game and you're sure its not something in unscheduled, look for heavy commands

#

allMissionObjects for example is a no-no to use during gameplay, always freezes the game for a bit

#

nearestObjects with huge radius is another one

meager granite
#

Not sure if there are tools to ease the comparison, you can just do it manually

peak pond
#

Good idea, I'll give that a try.

#

Thanks for the tips.

#

Gotta say, it's often challenging to answer the question "is the game lagging because too many units, or because bad script?"

hallow mortar
#

It can be both

broken forge
peak pond
#

Ah crap I just found 2 instances of the above mentioned expensive allMissionObjects in my script. allMissionObjects "WeaponHolderSimulated" and allMissionObjects "GroundWeaponHolder"... for a garbage collector. I haven't actually noticed any lag spike from this, but is there a better way to get all such objects?

meager granite
meager granite
#

WeaponHolderSimulated is returned with vehicles and entities "WeaponHolderSimulated" commands.
GroundWeaponHolder can be returned with much less costly 8 allobjects 0 command.

#

vehicles and allobjects include other objects of course, you'll need to skip them

peak pond
#

Ok, so you're saying allObjects should be faster than allMissionObjects and useful for getting "GroundWeaponHolder". I'd definitely like to avoid having the client tell the server when GWH is created, as mentioned in your ticket, and keep it simple.

meager granite
#

Run diag_codePerformance on both to see for yourself

peak pond
#

Ok, will do πŸ‘

upbeat valve
#

Is there a vehicle respawn script out there that preserves the wreck? I don't get why the default vehicle respawn module moves all the wrecks to [10, 10, 10]

peak pond
#

The results are in:

[
    count allMissionObjects "",
    diag_codePerformance [{allDeadMen}],
    diag_codePerformance [{vehicles select {_x call BIS_fnc_objectType select 0 == "Vehicle"}}],
    diag_codePerformance [{allMissionObjects "GroundWeaponHolder"}],
    diag_codePerformance [{allMissionObjects "WeaponHolderSimulated"}],
    diag_codePerformance [{8 allObjects 0}],
    diag_codePerformance [{8 allObjects 0 select {_x isKindOf "GroundWeaponHolder"}}],
    diag_codePerformance [{entities "WeaponHolderSimulated"}],
    diag_codePerformance [{vehicles select {_x isKindOf "WeaponHolderSimulated"}}]
];
[
    922,
    [0.0169532,58986],
    [2.75482,363],
    [40.12,25],
    [40.56,25],
    [0.0592663,16873],
    [0.335683,2979],
    [0.0124983,80011],
    [0.076063,13147]
];
#

Will replace allMissionObjects with allObjects for GWH and entities for WHS.

#

The second one (2.75 ms) could probably be improved too...

velvet merlin
#

_soundSetSource = "SoundSetSource_01_base_F" createVehicle _position;

#

can anyone reason why creating that takes a 10ms?

#

like entity generation is expensive in general, but this seems strange to be so heavy

meager granite
#

Might it be because of empty space lookup?

#
diag_codePerformance [{_position = getPos player; _soundSetSource = createVehicle ["SoundSetSource_01_base_F", _position, [], 0, "CAN_COLLIDE"]}]
```=> `[0.256476,3899]`
```sqf
diag_codePerformance [{_position = getPos player; _soundSetSource = "SoundSetSource_01_base_F" createVehicle _position;}]
```=> `[2.38095,420]`
#

Yeah, space lookup for that old syntax makes the command 10 times slower

#
diag_codePerformance [{_position = getPos player; _soundSetSource = createVehicle ["Logic", _position, [], 0, "CAN_COLLIDE"]}]
```=>`[0.0811216,16013]`
```sqf
diag_codePerformance [{_position = getPos player; _soundSetSource = "Logic" createVehicle _position;}]
```=>`[0.102371,10247]`
Entity type also matters, no lookup for "Logic", probably depends on the model? Newer syntax with `"CAN_COLLIDE"` is still faster though.
velvet merlin
#

great thinking - much appreciated πŸ™‡β€β™‚οΈ will report how much difference it does make in our use case

broken forge
#

@meager granite Thanks for the help, that worked like charm

velvet merlin
#

[0.820345,1219]
[22.4,45]

meager granite
velvet merlin
#

still the difference is massive

meager granite
#

Old syntax: [1.4341,698]
New syntax: [0.193536,5167]

#

Tested again just to be sure

edgy dune
meager granite
#

hashValue of same unit in MP will be different for example Nevermind, its MP-compatible

#
A hash value remains the same between game restarts but for Object and Group type, their hash being based on their netId.
```Actually, maybe not πŸ€”
edgy dune
meager granite
#

If you have a unit already, why do the lookup when you can store something in unit's variable namespace in the first place?

edgy dune
#

I have a loop where every so often it will loop over this list of certain units (which I could just use a simple array for). However when that unit dies or killed I should remove from said list, and I was thinking maybe having the units saved in a hashmap wouldnt be terrible idea

meager granite
#

If your unit gets deleted instead of dying (or dies and deletes later) and then you do a walk through array of your units, you won't be able to use it as a key in your hash map because hashValue objNull will always return same hash.

edgy dune
#

huh oh yeah

#

maybe I was overthinking thonk

south swan
#

are objects even a valid type for hashmap keys?

meager granite
#

They aren't, @edgy dune tries to used hashValue _object as key instead

edgy dune
#

The page says no, but when i tried it gave a hash value back shrug

#

oh I was thinking the page also meant using hashValue would also not work

meager granite
#

If your unit deletes, you no longer can find its key

#

A hash value remains the same between game restarts but for Object and Group type, their hash being based on their netId.
Went into SP editor, hashValue still different for different entities, but apparently there are no netIds in SP

south swan
meager granite
#

Unless there are and command just returns nothing in SP to appear as there isn't

south swan
#

isNull on what?

meager granite
#

no netid off non-existing unit

#

Nothing off null objects with BIS_fnc_netId either

south swan
#

keys _myHashMap select {isNull (_x call BIS_fnc_objectFromNetId)} meowsweats

meager granite
#

_x would be hashValue in your example though

still forum
south swan
#

it would be netId if objects are added with _myHashMap set [_targetObject call BIS_fnc_netId, "MuhValue"];

edgy dune
south swan
#

well, the problem i'm trying to circumvent by using BIS_fnc_netId is that you can't go from hashValue back to object to see if it still exists meowsweats

meager granite
#

same as no entity to feed into hashValue

south swan
#

hence the "periodical sanitizing by checking if object still exists" part

#

possible with netId. Impossible with hashValue πŸ€·β€β™‚οΈ

meager granite
#

Yeah, the only way would be iterating through list/hashmap yourself to check for deleted objects

#

createVehicle ["Logic", getPos player, [], 0, "CAN_COLLIDE"]; => objNull
wat

#

Why can't you createVehicle the Logic entity?

south swan
#

apparently they're units 🀣

meager granite
#

You can createVehicle other units though

modern meteor
#

Is there a way to move a unit to a marker on the map by using setpos? Or how would i do it?

south swan
#

!quote 5

lyric schoonerBOT
south swan
#

_unit setPosASL AGLToASL markerPos ["markerName",true]; πŸ€·β€β™‚οΈ

modern meteor
#

Works! Thank you!

modern meteor
#

What is the best way to let time pass during a mission? Eg. move time forward by six hours.

warm hedge
#

skipTime

modern meteor
#

Thank you

winter rose
#

or setDate if you don't want the weather synchronised (leading to a slight stutter)

modern meteor
#

got it, thanks

merry viper
#

Alright, question time: I've pulled a steam workshop mission into the eden editor using the PBO unpacker thingy, loaded it up, and immediately get hit with a script error. One that doesn't exist when I just play the mission on its own. I know absolutely nothing about scripting or editing other than what I'm seeing here, so I'm a bit lost as to where to start trying to figure this out. Please advise

#

This is what I get when I load in. Either it's not a lot of information or I have no idea how to read it. Or both

#

I'm off to steam to ask the original author

#

Ah, apparently he has "improved scripts" from his github. I will return

merry viper
#

Ah, there we go

#

Figured it out! It was one of my mods

latent flare
#

these are the 2 errors i get when im in editor trying to get zeus to work when i go into play in multiply that pops up and Zeus does not work. in editor i also can not edit addon options i have had the same problem for 2 days and my zeus module is set up correct

#

anyone know how to fix it hopefully

proven charm
#

or ACE? :/

stray flame
#

hey, how would I remote execute this?

Taki say3D ["haircut", 1000, 1];

#

the best I got was
[Taki, "haircut"] remoteExec ["say3D", 1000];

but that aint good enough it seems
Due to the missing 1 at the end

latent flare
proven charm
latent flare
hallow mortar
stray flame
#

ah okay

#

that helps

#

works like, working things

#

thanks

#

is the wait/sleep command just exclusive to SQFs or is it somehow possible to have it in a trigger?
Since mouth movements would compliment voicelines well

latent flare
# proven charm and loaded up?

i put in 3din enhaced but not sure really how to use it but i took out zeus enhanced cause i though it was causing problems but it still continues

tough abyss
#

Hello people. Quick question here before I commit and spend hours on making a scene for a video that I am working on. I am using some other Arma 3 Machinima videos for reference, but just cant figure out whether this part here is just UnitCapture or if he has created a script for it

gaunt tendon
#

switching weapons no longer present on scroll menus or is it just me?

tough abyss
#

I would guess he is using UnitCapture, but just want to check here before I commit into my scene

#

The reason im asking is that, you can see each AI move in a different way, and by the looks of it, Im not even sure if that is vanilla movement (player movement).

gaunt tendon
#

is there any way to get rid of the reload entries on the scroll menu?

copper nova
#

Did you come to a solution? πŸ˜…

open fractal
winter rose
#

(I believe you inverted scheduled and unscheduled ^^)

open fractal
#

(yes I did)

winter rose
#

(thou shalt be spared… this time)

hallow mortar
#

I didn't get spared when I tried to explain it and I was right, how come he gets away with it :U

winter rose
#

he's the favourite child :p

open hollow
manic sigil
#

Putting together a function that, in the course of use, may spawn several helicopters on the ground in relatively short time frames.

This isnt a problem per se, since theres five helicopter bays that Im using for this, and the array-of-markers thing works... but the bays are large enough that createVehicle will try and pack two into once space before choosing another bay, which is uncomfortably tight.

Is there anything I can do to reliably get it to pick one marker at a time?

#

The odds of multiple helicopters being created at the same time, or even within a short time, is pretty small, but I want to minimize AI air collisions if possible.

kindred zephyr
#

it really boils down to what you want to use as conditional.

you could even sequenciate it instead and just have a predefined order of spawns.

If this doesnt satisfy you, use positions instead of objects and check for space availability.

Doing a distance check to an already existing helicopter should allow you to do this. if you are using object variable names you can even use the distance command

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

There is a lot of approaches on this issue

open fractal
#

posting your code wouldn't hurt either

torpid mica
#

ist there an easy way to count the number of seats a vehilce has?

kindred zephyr
torpid mica
#

thank you very much

granite sky
#

The config method is quite complicated but there's BIS_fnc_crewCount which is mostly usable.

manic sigil
torpid mica
manic sigil
granite sky
#

fullCrew's fine as long as you can wait until the vehicle is spawned.

kindred zephyr
#

^^ very important detail indeed. Fullcrew only works for existing vehicles.

manic sigil
#

Ugh. Can already see the excess now. Check if pad 1 is clear, if not, check if pad 2 is clear, if not... if pad 5 isnt clear, wait for a pad to clear

kindred zephyr
#

its all part of the creation of a script after all, first get it to work the way you want it and then you can bring your concerns for optimization or design in order to discuss

velvet knoll
#

anyone know why this script isnt working? it gives me the interact option but wont add the item

#

(this) addAction ["Fill Canteen", {
_item = "Land_Canteen_F";
_count = 1;
for "_i" from 1 to _count do {
player addItemToBackpack "_item";};
},[],6,true,true,"","true",10];

open fractal
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
velvet knoll
# open fractal !code

!code

(this) addAction ["Fill Canteen", {
_item = "Land_Canteen_F";
_count = 1;
for "_i" from 1 to _count do {
player addItemToBackpack "_item";};
},[],6,true,true,"","true",10];

open fractal
#

you can edit your message

#

```sqf
<paste your code here>
```

velvet knoll
#

ah

#

i see

open fractal
#

@velvet knoll you have quotes around _item which makes the game think _item is the classname

#

just write _item without the quotes since it's a variable pointing to a classname

#

syntax highlighting catches this kind of thing. The ` key is above TAB and left of 1 on a US keyboard. You type ` three times to make a code block and write sqf at the top to get the highlighting.

this addAction ["Fill Canteen", {
        //removed redundant loop
    _item = "Land_Canteen_F";
    player addItemToBackpack _item; //no quotes
},[],6,true,true,"","true",10];
#
player addItemToBackpack "_item"; //with quotes (incorrect)
velvet knoll
#

Yeah i was just looking at that myself, wasnt quite sure what i was doing wrong there

velvet knoll
open fractal
velvet knoll
#

and therein lies my other problem

velvet knoll
#

thank you!

open fractal
#

yw

velvet knoll
#

@open fractal success! thank you for the assist

worldly narwhal
# little raptor I personally spawn ordinary riflemen first then just change their loadout (e.g i...

Hello, sorry for bothering but...
Do you think this would be an alright way to do it in each individual trigger (for decently wide variety of custom loadouts and units) or is this liable to cause problems on a greater scale?
Each trigger is a different type of loadout per squad (patrol, assault squad, platoon etc...) and different squads per faction. I am looking at about 12 different trigger variations total.

_bosPaladinSpawn = createGroup EAST;
paladin01 = _bosPaladinSpawn createUnit ["O_Soldier_F", getmarkerpos "bosPatrolSpawn", [], 1, "FORM"];
removeAllWeapons paladin01;
removeAllItems paladin01;
removeAllAssignedItems paladin01;
paladin01 addMagazines ["24Rnd_MicroFusionCell_Mag", 8];
paladin01 addWeapon "AM_LaserRifle";

//etc. for remaining gear and additional units in the squad...```
torpid mica
#

i have a problem with some of my code...
if i use allGroups I get an array with every group on the map...
but the following code always has <null> as the first entry in that array... why is that?

        {
            if (side _x == WEST) then
            {    
                
                _grouptype = _x call getGroupType;
                bluGroup set [_forEachIndex, [_x,_grouptype]];
                //bluGroup deleteAt (find "<null>");
            };
            if (side _x == EAST) then
            {

                _grouptype = _x call getGroupType;
                opfGroup set [_forEachIndex, [_x,_grouptype]];
            };

        } forEach allGroups;
#

is there a way to just delete that useless entry?

copper raven
little raptor
worldly narwhal
#

Oh, that should make things simpler, thanks.

I meant if I have 3 to 10 different soldiers with different loadouts, will it choke if it's all placed into activation field of the trigger in the editor?

#

Say, when three or more such triggers are tripped at the same time

little raptor
# tough abyss I would guess he is using UnitCapture, but just want to check here before I comm...

no. unitCapture cannot capture infantry animations
some of the animations were vanilla. some were not (or maybe I didn't recognize them), which were created in other tools (e.g. Blender)
you can make the AI play the animation using playMoveNow (you also need disableAI "MOVE"/"ANIM" to make sure AI won't rotate or interfere)
if you need to make units also turn as they move, you can do so using setVectorDir command every frame (normally created as part of a path loop)

copper raven
little raptor
tough abyss
#

I will have a look

torpid mica
worldly narwhal
#

Yes, I thought of doing it directly in the trigger instead of sqf. I wondered if it hits performance significantly.

granite sky
#

addWeapon can be surprisingly slow, IME. Maybe not something you should do in unscheduled code.

#

Can always spawn it (and ideally pull it out to a function)

little raptor
worldly narwhal
#

Right

little raptor
#

or do you mean several at once?

#

if so yeah, doing that in schd would be better

worldly narwhal
#

Well a single trigger will spawn a group of five (more or less) soldiers plus set all their equipment individually. That was the plan and concern.

little raptor
worldly narwhal
#

Alright, thanks!

granite sky
#

I think the way Arma works you can even get visible hitching when creating units in scheduled code, because it waits for the asset load.

#

At least it feels like that.

worldly narwhal
#

Yeah, I did notice this using a little larger custom unit compositions, even on SSD

#

And players notice this also in real-time MP

granite sky
#

In Antistasi we usually sleep between each unit spawn, but I'm not sure if anyone ever tested whether this helps.

worldly narwhal
#

It just might, I noticed how they pop in in quick succession but it never really hitched. The triggers using createGroup seem to consistently give hitches when the unit count is around 10 or more

copper raven
worldly narwhal
#

This is also very good to know, thank you all!

copper raven
#

environment should have no influence on the command's execution

#

if a command is really expensive to a point where you hang the game, running it unschd or schd will make no difference

granite sky
#

You mean a single command?

copper raven
#

yes

granite sky
#

Difference with scheduled is that if you have 10 slow commands then it'll split them across 10 (not necessarily consecutive) frames.

copper raven
#

yes ofc

granite sky
#

while if you do that in unscheduled it'll just freeze until the script is done.

copper raven
#

yep

worldly narwhal
#

Fantastic info

worldly narwhal
# granite sky Difference with scheduled is that if you have 10 slow commands then it'll split ...

One additional question after seeing things play out in 4 person multiplayer the other day.
bis_fnc_spawnEnemy was used, I tested the triggers in singleplayer and they worked more or less in accordance to the seconds set in sleep, but in multiplayer it took twice or thrice longer to make the triggers work.
For example, ghouls spawn is set to have 30 sec delay after entering the trigger zone and then spawns all the units. However in multiplayer it took up to 3 or even 5 minutes.

granite sky
#

Should only happen with very heavy script load.

worldly narwhal
#

Could high latency also cause it?

granite sky
#

Was this localhost?

worldly narwhal
#

dedicated server on windows machine, using... uh... hamachi, and having a friend from US join who gets 250~ ping

granite sky
#

Maybe if the server was really struggling on bandwidth.

worldly narwhal
#

Right, I suppose it was. It's not stellar to begin with and multiple people use it at times.

granite sky
#

seems extreme though. Would be surprised if that was playable.

copper raven
#

low server fps + lots of scheduled code = πŸ’₯

worldly narwhal
#

Yeah, the server did not struggle on the hardware side, it also has the liberty of being a separate machine from the one I play on.

worldly narwhal
granite sky
#

The trouble with the scheduled script load idea is that the scheduler is supposed to prioritize threads that have slept for longest.

#

So sleep 1 spammed threads shouldn't delay a sleep 30, for example.

#

That one was word of mouth from the devs though, so maybe they were thinking of a different game :P

worldly narwhal
#

It prioritizes the ones that have slept the longest but does not wait for them to get off sleep, right?

#

I mean, before moving to non-sleeping one

granite sky
#

You mean if the long one takes more than 3ms to execute?

#

I dunno, maybe I'll reverse engineer the thing some day. Should be able to figure what it's doing with crafted test cases.

#

but generally you keep the script load low and then everything works :P

worldly narwhal
#

I think I meant a more stupid question, if one is set to 'sleep 6000;' then the separate ones are not waiting in scheduler, right?

#

For the 6000 to pass

copper raven
granite sky
#

hmm no, that's very different.

copper raven
#

when you sleep, all you're doing is setting a flag on the current script that this script can only run after (not exactly) x seconds have passed. this flag is then checked everytime the scheduler comes to this script

worldly narwhal
#

I am sorry for writing it so oddly.
If there is sleep 6000 in one trigger to delay the enableSimulation, other triggers do not care for the 6000 and work regardless, yes?

#

Completely separate triggers

#

Not linked in any way

granite sky
#

yeah, the sleep in that thread won't affect other threads/events/triggers.

worldly narwhal
#

Haha, alright. Thanks

queen cargo
#

Anybody ever got around adding mines created using createMine to zeus?
addCuratrEditableObjects seems to refuse to add the mine

little raptor
#

you need the ammo afaik

frank cedar
#

Guys, is there any reason to use sqs over sqf? Are there some circumstances where unscheduled scripts better than scheduled? I dont understand now, after all discussion.

queen cargo
#

cannot get it added with any way known to me sadly

little raptor
#

actually no it gives the ammo meowsweats

little raptor
queen cargo
#

mhh?

little raptor
#

I mean what you edit in Zeus is the module object

#

not the mine itself

queen cargo
#

i know

little raptor
#

so you can only add their modules blobdoggoshruggoogly

queen cargo
#

used allCurators to get the logic modules

#

and getAssignedCuratorLogic

#

both not yielding the mine created in zeus

little raptor
#

wat? thonk

#

what does allCurators have to do with mines?

little raptor
#

so you can create a logic object and add that as editable object
and just attach the mine to it

queen cargo
#

nah
think you misunderstand me here

_mine = createMine ["IEDUrbanSmall_F", [0,0,0], [], 0];
{ _x addCuratorEditableObjects [[_mine], true]; } forEach allCurators;
``` this ain't working for me
little raptor
copper raven
queen cargo
#

urgh ... so no way to create mines which can be defused and be added to zeus ...

copper raven
little raptor
queen cargo
little raptor
queen cargo
#

just a missunderstanding

#

will probably leave them uneditable then ..

wanton tundra
#

I have a question whether this approach, as I imagine it, can work in principle.
Let me try to explain with a concrete example:
In the vanilla map Tanoa is an airport (Aeroport Tanoa; it would be the one where a plane would land given the command "landAt 0") . As far as i could research this airport is hardcoded in the terrain itself. This includes all the taxi points, landing points and so on.
Could I place a dynamic airport placing it at this very same airport (Aeroport Tanoa) and let my planes land at this dynamic airport (in script form something like plane1 landAt "Dynamic_Airport_XY") or would these two airport interfere with eachother? I am aware that to have this working as intended, you should stick to script form and not using "LAND" waypoints in the eden editor as the AI would search for nearest airport which I could believe the AI would prioritise the vanilla hardcoded airport.
What I would like to achieve with this would be as one idea of many I have:
Create multiple dynamic airports that will have taxioff waypoints leading into the hangars.
If i tell the first plane to landAt "Dynamic_Airport_1" the plane would taxioff in the first hangar. The next plane i would landAt "Dynamic_Airport_2" to go in the next hangar and so on.
I hope I could explain it in a way it is understandable for you guys.

queen cargo
#

Guys, is there any reason to use sqs over sqf?
No

lone glade
#

no never

#

just forget about SQS

queen cargo
#

only reason to do "SQS" by today is if you want to use the buttonSetAction command as that is still taking SQS and not accepting SQF

lone glade
#

On the PFH subject, it's supposed to be ran in unscheduled

queen cargo
#

Are there some circumstances where unscheduled scripts better than scheduled?
yes and no ...
problem with unscheduled scripts is that the engine will block untill the command is done
whilst the scheduled script will only run a few ms per frame but do not pull your framerate down

#

both has its positives and negatives

#

it all depends on what you want to archive to select what you need

#

and to know what you need requires experience

#

^^

keen stream
#

Same goes for client and server-sided scripts..

#

teh_pain

lone glade
#

the biggest issue with scheduled atm is that the conditions of your script can change

queen cargo
#

thats actually just "you have to understand how networking in arma works" @keen stream

lone glade
#

On lighter news Added: Scripting commands isEqualType, isEqualTypeArray, isEqualTypeAll, isEqualTypeParams yesterday's dev branch

keen stream
#

@queen cargo : Yeah, this takes some time and a lot of errors. :-(

queen cargo
#

actually it does not ^^
its the locality that does that harm

#

and as soon as you understood that concept again

#

everything else is just simple planar network shit

lone glade
#

ownership is quite hard to wrap your head around too

#

once you get it it's pretty simple

pliant stream
#

in arma 2 both script environments run on the main game thread, is it different in arma 3? i would imagine not, which means the scheduled environment can definitely have an impact on fps

peak pond
#

Does the scripting engine provide any kind of mutex lock to prevent multiple spawned scripts hitting the same critical section simultaneously?

meager granite
#

Btw, having code inside scheduled environment inside isNil {} will make sure scheduler doesn't interrupt the script until that block is complete

#

So have your critical sections inside isNil {...code...}; to avoid race conditions

peak pond
#

Ok thanks, good to know, isNil {...} should do the trick if it can't be interrupted.

pulsar bluff
#

whats en example of such condition @peak pond

peak pond
#

I'm just wondering about the general computer science problem of avoiding race conditions when multiple threads access a shared resource. In this case I need to produce unique IDs for some objects that get registered by a logistics thing I'm making, and want to ensure ID collisions don't occur in the rare case multiple scripts create new IDs simultaneously.

pulsar bluff
#

fair enough. for stuff like that with potentially multiple clients interacting i just pass things to a server queue, instead of allowing direct function calls

peak pond
#

Makes sense using a serial queue, and let server be source of truth.

manic kettle
meager granite
#

Means you're trying to do sleep inside unscheduled

#

I was talking about using isNil inside scheduled code to make sure its not interrupted inside that isNil block

#

You can have it inside unscheduled but it makes no difference there in that sense, serves its usual function of checking if code block return is nil or not

manic kettle
#

any idea how i can make my code wait until an animation is finished then?

meager granite
#
  1. Check each frame
  2. Through event handler if there is any
tender fossil
untold turret
#

Hello, I try to run it in console but I have error that it lacks ";" in function, but it doesn't imo. Any idea what it can be?

void myFunctionShouldSurrender(object unit) {
    // Check if the unit is an AI unit
    if (unit isKindOf "BOT") {
        // Get the unit's group
        private _group = unit getVariable "group";

        // Check if the group is valid
        if (isNil "_group") exitWith {};

        // Get the number of units in the group
        private _numUnits = count (_group units);

        // Get the number of casualties in the group
        private _numCasualties = count (_group units - alive _group);

        // Check if the number of casualties is greater than 50% of the number of units
        if (_numCasualties / _numUnits > 0.5) {
            // Play the surrender animation
            unit playMove "Acts_Signal_Surrender";
        };
    };
};

// Register the function to run for all units on each frame
[] spawn {
    while {true} do {
        {myFunctionShouldSurrender(_x)} forEach allUnits;
        sleep 1;
    };
};
peak pond
#

I don't think void foo() {}; is SQF syntax.

untold turret
#

thanks will look this way

tender fossil
#

And there's no void either

untold turret
#

so I could just "then {};"

tender fossil
#

Wait what am I reading... Should just turn my brain on

pulsar bluff
#

whats a good way in script to handle both default and custom key bindings? in KeyDown event i am looking at something like this, however also considering pulling out "actionKeys" to a variable so it isnt called on each keypress

#
if (_key in ([199,(actionKeys 'User9')] select ((actionKeys 'User9') isNotEqualTo []))) then {};
warm hedge
#

Yeah I have no idea what am I reading

proven charm
warm hedge
pulsar bluff
#

i should use those more for sure ... unfortunately we cant block default actions with those

warm hedge
#

Hmm

tender fossil
pulsar bluff
#

however maybe it is a perfect tool for custom keys

#

my issue is that player may not necessarily (in fact data shows only a few % of players running my mission use custom bindings) have custom ones set up

#

so core bindings still need a default setting

untold turret
tender fossil
#

It has different paradigm

untold turret
#

ah, okay, so will have dive more into it, thanks anyway

tender fossil
copper raven
little raptor
velvet merlin
#

Warning Message: Variable 'rscdisplayloading_display' does not support serialization and should not be stored in the mission namespace.
Warning Message: Variable 'rscdisplayloading_progress' does not support serialization and should not be stored in the mission namespace.

#

from what i understand you need to set disableSerialization; (or store things to uiNamespace)

#

i am still getting these tho. does disableSerialization have to be set in each scope directly?

little raptor
#

Don't store displays in global vars

#

Use uiNamespace instead

#

But even if you don't those warnings are not harmful. Just ignore them

pliant stream
#

Technically uiNamespace variables are global too.

little raptor
#

Obviously

velvet merlin
#

well its coming from BI functions. i think as these are launched differently then the standard onLoad

#

BI is doing this

onLoad = "[""onLoad"",_this,""RscMiniMap"",'IGUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')";

#

while we have (also from onload) but within a function:

#

if (getMissionConfigValue ["...",0] == 0) then
{
// if not, use default script
#include "\a3\ui_f\scripts\Loading\RscDisplayLoading.sqf"
}
else
{

pulsar bluff
hallow mortar
copper raven
# tender fossil Is this intended behaviour or more like accidental? Just curious why `isNil` pre...

isNil differs from commands like call in a way that the command itself waits for the code to finish (which is why we call it "unscheduled" in a way), unlike call which simply pushes a block of instructions on the stack and forgets. the 3ms limit does not apply, isNil <code> will execute whatever it needs to regardless of that, it's no different than running some heavy parameterized nearestObjects for example.

drowsy geyser
#

is there a simple way to get a door using cursorObject command?
if i use this animationNames cursorObject it will list all doors but if i do this:
animationNames cursorObject isEqualTo "door_1_rot"
it returns false

little raptor
#

That's an array

#

You're comparing it to a string

#

They're never equal

#

Anyway, do you mean you want the door under cursor?

drowsy geyser
#

yes

little raptor
#

Use lineIntersectsSurfaces

#

It gives the selection name of the door

#

Getting the animation is a bit tricky without access to the model.cfg

#

But if the model is configged properly you can find it in its door actions iirc

drowsy geyser
#

okay thank you i`ll test it

copper raven
#

usually you can just look for animation having a substring of the selection

wanton tundra
#

anyone has experience with dynamic airports? someone i could have a little chat with? I have some principle questions.

little raptor
#

but I don't have any experience with dynamic airports, and I doubt anyone has ever tried it, so I guess you should try and see blobdoggoshruggoogly

proven charm
#

what you mean by dynamic airports?

warm hedge
#

Dynamic Airports is a years-old feature, like the one used in USS Freedom Aircraft Carrier

wanton tundra
#

for example you have a very flat space in a terrain which normally is not defined as airport. If you wish so you could add it

wanton tundra
#

i mean that yes

little raptor
wanton tundra
#

ah thanks leopard

proven charm
#

i see

wanton tundra
#

i wrote this question yesterday at around 24:00. I was researching till the morning. In this period i think i realised i am not fit yet to do this kind of things in scripting. I think i might need to get a better understanding first about classes and about config.cpp as i have never touched them. I need to make smaller steps first i guess. It looks like the "simple" thing i want to do is not that simple.

proven charm
#

i did aircraft taxi script once, but it wasn't pretty

#

setDriveOnPath doesnt seem to work with aircraft?

wanton tundra
#

him interesting idea

#

setddriveonpath i have not touched yet with planes.

proven charm
#

yeah this is no simple task, you should work on those scripting skills first

#

if you just started scripting...

wanton tundra
#

yeah. I agree. I got a little bit euphoric.

little raptor
wanton tundra
#

i would say i have some amount of scripting experience. For sure not as much as many of you hear. I just got a little bit euphoric because my current mission i am testing around with was making fast progress. And i thought just add better airport taxi and everything looks smooth.

#

@little raptor yeah i expected this. it looks like fixed wing aircrafts work very different from other objects

little raptor
#

And i thought just add better airport taxi and everything looks smooth.
if it's a predefined path you can just use unit capture

wanton tundra
#

ah yeah i was also thinkin about unit capture, but there are also some downsides to this. It has it's limitations and for me it seems like to be not consistent with fixed wing objects. For cars it works very well

little raptor
#

well yeah the wheels and wing animations won't work but still it should look ok from far away

wanton tundra
#

and then with commands like: Testplane_1 landat ((allAirports select 1) select 0); or Testplane_1 landat ((allAirports select 1) select 1); i would choose which dynamic airport the plane would land on and having them have different taxiOff paths

little raptor
#

well you can try it. it's very easy to make the airport itself. just place two of them side by side in 3den to see if your idea works

wanton tundra
#

this is the first problem πŸ™‚

#

i do not find the airport as an object in the eden editor

little raptor
#

you don't need an object

#

use an empty model

wanton tundra
#

but i need to touch classes and config.cpp for that already right?

little raptor
#

yeah

wanton tundra
#

ok

little raptor
#

actually you can just use the USS Freedom's to test it

wanton tundra
#

ok so my knowledge is not good enough for this yet. I will go ahead and study these topics first. Thank you guys for your feedback. When i make progress i will let you know. In my research i found many users asking the same/similiar question. So it looks like there would be a need of a step by step tutorial which i would provide (if my brain would finally be able to comprehend all these topics)

wanton tundra
little raptor
#

that's not what I mean

#

create the airports
not the aircraft carrier

wanton tundra
#

ah ok...

echo yew
#

Anyone know why knowAbout return 0; on 90% of buildings in custom terrain?

little raptor
#

but it's iffy

echo yew
#

or where could it come from

little raptor
little raptor
#

why do you need the knowsAbout of a building?

echo yew
#

if knowabout is 0 cursortarget return objnull

wanton tundra
#

@little raptor your idea would be to place the carriers so that it would set up the airports in the corresponding files? and then adapt the files? sorry if i am completely wrong with my interpretation

echo yew
#

on other vanilla terrain knowabout is always 4 on building, i don't understand this.

little raptor
#

create airports

#

a carrier is just an object composed of several parts. one of those parts is the airport object

hallow mortar
#

I'm pretty sure it's like Land_DynamicAirport_F or something like that

little raptor
#

here's how I create the airport: createVehicle ["DynamicAirport_01_F", player]

#

I created a few of those then rotated them and placed them end to end

#

the aircraft did follow the path a bit but eventually it got confused blobdoggoshruggoogly

wanton tundra
#

ok thank you. i will start up the editor and use your information and fiddle around with it

little raptor
little raptor
#

but knowsAbout for that same object returns 4 in other terrains?

echo yew
#

yes

little raptor
#

no clue blobdoggoshruggoogly
but anyway I still don't see why you'd need that since knowsAbout is meant for AI targeting

#

and AI don't target buildingsthonk

echo yew
#

its for cursorTarget knowsAbout 0 == objnull

little raptor
#

umm, what?

echo yew
#

cursorTarget return me a NULL object on these buildings.

meager granite
#

Maybe something to do with side centers?

little raptor
meager granite
#

Try script-creating all sides and see if it helps?

#

I know Arma 3 always creates all centers unlike OA, but who knows maybe custom terrain somehow doesn't?

#

Also, is your unit an Agent? Maybe agents always return knowsAbout as 0? Don't have much experience here, just guessing.

little raptor
#

I would like to know why this is happening
I really doubt it's documented anywhere. if you don't find anything just use a workaround for what you want to do

meager granite
#

{createCenter _x} forEach [blufor, opfor, independent, civilian]

little raptor
#

createSide? meowsweats

meager granite
#

*fixed

echo yew
#

@meager granite thanks ive tried but nothing change. with some building its working fine like this church

#

another work around, is to use reveal command on all building but is that okay with perf?

misty trail
#

Does anyone have a Helicopter Patrol script they can share ?

meager granite
#

Are these script-spawned buildings by any chance?

echo yew
#

looks like this issue is related with terrainbuilder

wanton tundra
# wanton tundra I have a question whether this approach, as I imagine it, can work in principle....

Update to what i could achieve so far with your input:
i have created a Testplane flying south east of the aeroport tanoa.
i have placed a gamelogic more or less centered on the runway aeroport tanoa. I put in the init:
dynamicAirport1 = "DynamicAirport_01_F" createVehicle position this;
Testplane landat ((allAirports select 1) select 2);

result: i could achieve that with using Testplane landAt 0; --> the plane approaches from the south east for landing.
if i use Testplane landAt ((allAirports select1) select2) the plane will approach from northwest for landing. Small success but anyways πŸ™‚
hint: i have to use select2 because for test purposes i have placed two uss freedoms. They are already taking the 0 and 1.

In the case of landing on the dynamic airport. It seems the plane is following the Landingposition (ilsPosition) as well as the direction (ilsDirection) as well as the TaxiOff (ilsTaxioff).
However it looks like at one point (my guess is when the plane reached it's last TaxiOff coordinate from the dynamic airport) the plane will prioritize the airport 0 (hardcoded terrain airport). This is leading to that the plane will transition from it's dynamic airport Taxioff to the hardcoded tanoa airport taxioff. Plane will continue the tanoa airports taxioff transition to TaxiIn and afterwards lift up again.

So basically it looks like the priorisation which airport to take is the problem. My next approach is that i would try to make a class inheritence of "DynamicAirport_01_F" and fiddle around with ilsTaxiOff and see if when I extend the path if it would stay on the dynamicsAirport path.

Another approach would be if it is possible to delete all the hardcoded airports. But i think this would be seen as altering someoneelse's content. In this case bohemia interactive's content. Because i think i would need to edit the terrain for that. Or is there a syntax to delete the airports via script that i could put in an .ini?

modern meteor
#

What is the best approach to start an editor mission at a random time of the day?

granite sky
#

skipTime random 24 would do.

modern meteor
#

perfect, thanks

manic sigil
#

Best method for detecting if a helicopter has crash-landed and cannot fly any more, but hasnt been destroyed?

Ive got a Killed EH set up, but I want to make sure I cover the edgecases.

meager granite
hasty pond
#

@frank cedar Not that I know of

manic sigil
#

Ooh, noted, will give that a try!

modern meteor
#

I am spawning in darter with the following code above the player:

myUAV = [getPos player, 0, "B_UAV_01_F", WEST] call BIS_fnc_spawnVehicle;
createVehicleCrew (myUAV select 0);  

Is there a way to assign the player automatically to the gunner seat?

granite sky
#

IIRC canMove covers dead engine and no fuel cases but not dead/injured driver.

#

@modern meteor connectTerminalToUAV + remoteControl maybe

modern meteor
#
myUAV = [getPos player, 0, "B_UAV_01_F", WEST] call BIS_fnc_spawnVehicle;
createVehicleCrew (myUAV select 0);
player connectTerminalToUAV myUAV;

Error: Type array, expected object

How can I assign the UAV I just spawned to an object?

hallow mortar
proven charm
#

Or params πŸ™‚ _myUAV params ["_veh", "_crew", "_group"];

still forum
proven charm
#

oh yes makes sense

#

should have realized that πŸ™‚

modern meteor
hallow mortar
#

The remoteControl method is probably better for that since it lets you specify directly, e.g. gunner myUAV

#

Note that "moving the player into the gunner seat" and "controlling the UAV gunner" are not the same thing. I'm assuming you mean controlling the gunner, but if you mean literally moving the player into the UAV, do say so

modern meteor
#

yea, i mean that the player has the view from the gunner position of the UAV

worldly narwhal
#

Hello again, with all your help I arrived at this thing just flexible enough for mostly everything I was looking to do...
https://pastebin.com/TTygugdp

However, I wanted to despawn them once players get too far.
I tried adding this before disabling the trigger simulation, but it doesn't work and I feel like I am missing the point...

_outcastPatrolSpawn spawn {
while {true} do {
sleep 30; 
if ((player distance (leader _this)) > 1000) exitWith { 
{deleteVehicle _x} forEach units _outcastPatrolSpawn; }; }; };```
modern meteor
cosmic lichen
worldly narwhal
#

Alright, let me check!

modern meteor
#
myUAV = [getPos player, 0, "B_UAV_01_F", WEST] call BIS_fnc_spawnVehicle;
createVehicleCrew (myUAV select 0);
myUAV = myUAV select 0;
player connectTerminalToUAV myUAV;
player action ["Switchtouavgunner", getconnecteduav player];
myUAV addAction ["Destroy Drone!", { 

player connectTerminalToUav objNull;
deleteVehicle getConnectedUAV player;
deleteVehicle myUAV;
player switchCamera "Internal";

}];

When I switch into the drone, I see "Destroy Drone!" in the middle of the screen. How can I avoid the text in the middle of the screen?

worldly narwhal
#

myUAV addAction ["Destroy Drone!", {
seems to be the cause for the message, I think (could be wrong) that you can either do myUAV addAction ["", { or myUAV addAction [{ instead

little raptor
#

or do you mean you just want the action to appear when you scroll?

#

if so just set the showWindow flag to false

proven charm
#

findDisplay 46 ok? could be null at the time

#

not sure

little raptor
#

if you run that script at init yes

#

then yeah it doesn't exist

proven charm
#

u need waituntil { !isnull (findDisplay 46) };

little raptor
#

you're attempting to create a control on something that doesn't exist

#

so the control is never created in the first place

#

and it will never be created

proven charm
#

that's why the waituntil

little raptor
modern meteor
#
myUAV = [getPos player, 0, "B_UAV_01_F", WEST] call BIS_fnc_spawnVehicle;
createVehicleCrew (myUAV select 0);
myUAV = myUAV select 0;
myUAV setUnitTrait ["audibleCoef", 0];
myUAV setUnitTrait ["camouflageCoef", 0];
player connectTerminalToUAV myUAV;
player action ["Switchtouavgunner", getconnecteduav player];
myUAV addAction ["Destroy Drone!", { 

player connectTerminalToUav objNull;
deleteVehicle getConnectedUAV player;
deleteVehicle myUAV;
player switchCamera "External";

},nil,1.5,false];

This is what i have now. On spawn, is it possible to give the done the order to loiter with a radius of 100m?

little raptor
#

yes. use addwaypoint

#

then use setWaypointLoiterRadius (or whatever it was called) to make it loiter

#

also don't forget to set the waypoint type

modern meteor
#

i tried this but it does not work:

myUAV = [getPos player, 0, "B_UAV_01_F", WEST] call BIS_fnc_spawnVehicle;
createVehicleCrew (myUAV select 0);
myUAV = myUAV select 0;
myUAV setUnitTrait ["audibleCoef", 0];
myUAV setUnitTrait ["camouflageCoef", 0];
player connectTerminalToUAV myUAV;
player action ["Switchtouavgunner", getconnecteduav player];
myUAV addAction ["Destroy Drone!", { 

player connectTerminalToUav objNull;
deleteVehicle getConnectedUAV player;
deleteVehicle myUAV;
player switchCamera "External";

},nil,1.5,false];
//myUAV = _grp addwaypoint [position player, 0]
_wp = myUAV addwaypoint [position player, 0];
[_wp, 0] setWaypointLoiterRadius 50;
little raptor
#
  1. _wp is already the waypoint
  2. you should add the waypoint to the group not the object
  3. you didn't set the waypoint type
#
myUAV = createVehicle ["B_UAV_01_F", getPosWorld player, [], 0, "FLY"];
_grp = createVehicleCrew myUAV;
myUAV setUnitTrait ["audibleCoef", 0];
myUAV setUnitTrait ["camouflageCoef", 0];
player connectTerminalToUAV myUAV;
player action ["Switchtouavgunner", getconnecteduav player];
myUAV addAction ["Destroy Drone!", { 

  player connectTerminalToUav objNull;
  deleteVehicle getConnectedUAV player;
  deleteVehicle myUAV;
  player switchCamera "External";

},nil,1.5,false];
_wp = _grp addwaypoint [getPosWorld player, -1];
_wp setWaypointType "LOITER";
_wp setWaypointLoiterRadius 50;

#

those setUnitTraits don't make any difference afaik

#

also loiter radius of 50 is not gonna work

modern meteor
little raptor
#

it's too close for loiter

modern meteor
#

ok

#

whats the minimum?

little raptor
deep dew
#

how to delete object this ??

#

help me please.

modern meteor
#

Just want to make it invisible for OPFOR

winter rose
little raptor
#
{_x setCaptive true} forEach crew myUAV;
modern meteor
#

It's just a darter

#

Has no crew

little raptor
#

it does

#

all vehicles have crew

modern meteor
#

Oh okay

little raptor
#

UAVs have invisible crew

modern meteor
#

And the crew is what is being detected by OPFOR?

little raptor
#

what do you think createVehicleCrew is for then?!

little raptor
modern meteor
#

got it, i will try this. thank you!

deep dew
#

that's right ??

winter rose
#

no

#

forEach takes an array (of objects here)
so find the corresponding objects first

little raptor
#

you can use nearObjects

#

or allObjects after v2.12 update

plush belfry
#

Hey I am trying to get a custom image for one of the elements of the Orbat that I am making.
Trying to overwrite the type icon with a custom .paa image. its dimensions were 512x512 before converting from png to paa.
Yet it still fails to show up in game. There's just a transparent "texture" there.
This is the code that defines the texture.

texture = "SASG.paa";
worldly narwhal
# cosmic lichen Code looks fine. You should print the distance to the rpt to see what's going on

So according to rpt:
18:03:16 Error in expression <th { {deleteVehicle _x} forEach units _outcastPatrolSpawn; }; }; }; thisT> 18:03:16 Error position: <_outcastPatrolSpawn; }; }; }; thisT> 18:03:16 Error Undefined variable in expression: _outcastpatrolspawn

I am not sure what is wrong, I tried replacing _outcastPatrolSpawn with the trigger name, first "outcastPatrolSpawn" then simply outcastPatrolSpawn but neither worked.
the "" case was not recognized as valid input, the next one was ignored without error.
Do I have to define every single unit from _outcastPatrolSpawn in [] bracket in that place or am I completely off here?

(edit: I was off a bit indeed... thank you for pointing me in the right direction!)

deep dew
worldly narwhal
worldly narwhal
#

as defined previously in the script

winter rose
plush belfry
worldly narwhal
#

The whiteboard is a good example. If you fill it's size out completely with an image, it will be across the whole whiteboard and missing a little bit of it's edges. (instead of being the images taped to it you otherwise see)

deep dew
#

i try to delete this in my code.

#

{ deleteVehicle _x } vn_o_air_mig19_ejection_seat;

open fractal
#

syntax is completely wrong

plush belfry
# worldly narwhal I noticed that some .paa files have a lot of transparency within their canvas, b...

Yes that helped a bit. Appreciate it. I got the same PAA file to work on two different objects. Now the issue is trying to get it to work on the Orbat Viewer itself to replace a built in Icon with a custom paa image, right now it does not show anything, meaning it is either not detecting the image or what you said, transparency issues. The Official orbat wiki does not state what should be the dimensions of that said custom texture.

texture = "\ca\missions_f\data\orbat\customTexture_ca.paa";    // Custom texture, will replace icon set by 'type' param.

This is all it gives you in terms of how the texture line works in CfgOrbat.
I have tried 64x64 and 512x512

open fractal
# deep dew { deleteVehicle _x } vn_o_air_mig19_ejection_seat;

you would need to get a reference to the object, what you have is a classname which is just the type of object and not the object itself. You also wrote a code block for a loop without creating an actual loop.

deleteVehicle _object;
``` would delete whatever object the `_object` variable points to.
for example, if you have a vehicle with `car` defined as its variable name in the editor you do
```sqf
deleteVehicle car;

I assume what you're looking at is a dynamically created object in the mission and not one manually placed in the editor, so to help you reference the object we need to know under what circumstances it was created and at what point in its lifetime you want it to be deleted.

#

You must have copied code intended for a forEach loop (or any other loop that uses _x as a magic variable) which is not applicable to deleting a single object

worldly narwhal
modern meteor
granite sky
#

delete the waypoint.

#

Or setCurrentWaypoint to the next one.

modern meteor
#

Is the currentwaypoint always 0?

granite sky
#

Depends how you create the crew. Sometimes you get a default move to 0,0,0 as waypoint 0.

#

And then your loiter would be waypoint index 1.

modern meteor
#

I am using the code above

tepid vigil
#

Can someone tell me why I would prefer deleteVehicleCrew over moveOut _unit; deleteVehicle _unit? deleteVehicleCrew (at least according to biki) has all sorts of locality shenanigans going on that make it hard to use and cause unpredictable behaviour

modern meteor
#

_grp = createVehicleCrew myUAV;

#

To create the crew

granite sky
#

shrugs

#

always check it.

little raptor
#

when there's a command that does specifically what you want why would you want to bother to reinvent the wheel anyway? blobdoggoshruggoogly

tepid vigil
#

I was using deleteVehicleCrew, until I discovered that units weren't deleted properly, even though I was using the recommended remoteExec method. For example, the command will fail if the unit disembarks during the inevitable delay with remoteExec, or the vehicle might change locality, etc

little raptor
#

well the wiki itself says:

While the argument is global, you should take extra steps and execute this where vehicle is local as moving units out of the vehicle happens where vehicle is local and you want this to always precede deletion.

#

so idk if doing that will change anything

#

maybe it'll help with the soldier disembarking thing

#

for locality changes you can make a function that makes sure the object is local

#

if not remoteExecs again

tepid vigil
#
    if (isNull objectParent _recruit) then {
        deleteVehicle _recruit;
    } else {
        [(objectParent _recruit), _recruit] remoteExec ["deleteVehicleCrew", _recruit, false];
    };

This was the approach I was using, but I got reports that dead crew usually failed to delete

#

The deleteVehicleCrew is hard to use correctly. It must be executed with remoteExec on the computer where the vehicle is local, but this causes a delay before the code is really executed. During this delay, the unit might have disembarked or the vehicle might have been deleted, causing deleteVehicleCrew to fail. A real world example was in fn_cleanup.sqf where the vehicle was actually deleted right after calling remoteExec. Because of this, around 70% of time the crew was not properly deleted.
Should I just write a function that checks all these conditions and ensures that the unit gets deleted?

little raptor
#

idk. maybe

copper nova
#

Have you found out if this is possible? I am trying to find that out too πŸ˜…

meager granite
#
    {moveOut _x; deleteVehicle _x} forEach crew _vehicle;
    deleteVehicle _vehicle;
```to delete the vehicle and crew inside
#

Not sure about moveOut to be honest, but its there.

grizzled cliff
#

in arma 2 both script environments run on the main game thread, is it different in arma 3? i would imagine not, which means the scheduled environment can definitely have an impact on fps

A2 and A3 are the same.

#

fuck this app sucks, no commenting lololol

#

at max SQF will execute for ~3ms each frame

lone glade
#

if only it supported markdown quotes.... CMON DEVS

still forum
#

@grizzled cliff you could just talk to someone like this ^^

grizzled cliff
#

it can be longer than 3ms if you have a command that is very intensive (like nearObjects)

lone glade
grizzled cliff
#

the main problem with the scheduler though is not that things excute over time (duh thats the entire point)

#

it is that it is very greedy

#

new scripts will push older scripts to the bottom of the excution queue

#

as such things like sleep become unreliable

#

and long loops can become very slow

#

basically it is unreliable in terms of timings

lone glade
#

If you have a script checking for a unit, that unit can change if the script doesn't finish in the 3ms

#

if that happens you break your script

grizzled cliff
#

thats why commands need to be atomic as possible in sqf, because it executes statements, not commands in the 3ms timing

#

so if you do everything in one statement its safer

loud shard
#

Does anyone have a healing script? Players go to an AI and get healed or go to a location

grizzled cliff
#

or just write your code in a way that doesn't ever use it

#

which is how ACE and ACRE do it

#

there are very minimal spawns in ACRE, I think just 2, and thats for situations where no other solution really works.

#

They also execute once at the start of the mission and then end ASAP.

#

ACE still has a number of spawns but our core guidelines restrict its usage.

lone glade
#

there's 2 AFAIK

grizzled cliff
#

There is more than 2, but there might be only 2 that are running all the time

#

i havent done a script running check in a while on the codebase

meager granite
#

player setDamage 0

lone glade
#

correction 31

#

or at least that's the number of time spawns are mentionned in the code

jade abyss
#

hm, don't the "[] spawn {}" they finish/delete themselfs, when they are finished?

grizzled cliff
#

Dscha, yes, but imagine you start a spawn with a waitUntil in it

#

at the start of the game

#

every time you call a terminating spawn it will execute with higher priority than the first spawn

jade abyss
#

hmm

grizzled cliff
#

you can actually force an older spawned function to never execute

#

by every frame adding a bunch of new spawns

#

thats what i mean when i say the scheduler is greedy

lone glade
#

I always wondered why BI wrote their missions in FSMs, now I know

grizzled cliff
#

FSM has a similar issue

lone glade
#

It's because it has half of the scheduler

#

and it's easier to maintain for them

grizzled cliff
#

The timings in FSM can be off because it is affected by the scheduler

#

the scheduler divides up its load into thirds

#

SQS/SQF/FSM

#

FSM code blocks execute non-scheduled

#

but the conditions are checked in the scheduler

#

so its subject to script lag

lethal nova
#

Hi all, need some help with my Mission Complete Trigger. I 'm trying to edit the Text of "MISSION COMPLETE" - chatgbt told me to enter
"Custom mission complete text";
into the On Activision parameter but im still seeing "MISSION COMPLETE"

hallow mortar
#

Because that's not how it works

#

Do not use AI generation for SQF. It doesn't understand it and the results won't work.

lethal nova
#

ahhhh ok

#

You wouldn't happen to know the correct script?

hallow mortar
lethal nova
azure birch
#

guys how can i get AI (in this case "driver1") that is not in my team to drive to "trigger8",
wait for me and my remaining alive team to get in "transport1" and when conditions are met to start
driving to next waypoint in this case "wp1". I don't know to script and i neeed this script in almost every scenario that i make.

wary needle
#

i need some help with with a remote exec comand, i am trying to create a comand that removes certain types of weapons from a players inventory when the arsenal is closed. I can get it to work in eden. But i get a remote exec kick when i use it on pub zeus. Is there a way to bypass, or an alternate method?

proven charm
meager granite
#

Anyone looked into drawIcon caching? I managed to speed it up by caching entire drawIcon array depending on map's scale (ctrlMapScale) but having smooth map zooms (like when you speed up and GPS zooms out or when you press "center on player" on the main map) produces a lot of unique scale values and floods the cache with like 500 different arrays. Multiply that by amount of entities that need to be drawn you and end up with 10000 of arrays stored in multiple hashmaps. Sure hashmap lookup is pretty fast but storing 10000 arrays doesn't sound right.

hallow mortar
wary needle
azure birch
#

In eden editor i know how to make ai drive to a waypoint and wait for me to get in car,
but i have trubble making ai wait for my team beacuse some of them are dead.
If all of my team is alive it works perfectly. is there a way to get arround that somehow

proven charm
#

@meager granite I don't know what you are trying achieve here but since drawIcon is slow I would check if those drawn icons are withing screen boundaries before rendering them

hallow mortar
wary needle
#

a limited arsenal will still alow players to load un restricted loadouts

proven charm
meager granite
#

Not sure if calling cached drawIcon is slower than checking the boundaries

#

even non-cached

#

Anyway, I'll test it out

#
    private _draw_array = _x get "cache" get _scale;
    if(isNil"_draw_array") then {
        private _size = (_x get "size") * ((0.05 / _scale) max (_x get "coefMin") min (_x get "coefMax"));
        _draw_array = +(_x get "array");
        _draw_array set [3, _size];
        _draw_array set [4, _size];
        _x get "cache" set [_scale, _draw_array];
    };
    _map drawIcon _draw_array;

This is how I'm caching the "drawIcon" btw. _scale is map scale, _x is a hashmap where "array" is a template drawIcon array, "cache" is a hashmap with keys of _scale and value of ready drawIcon arrays.

proven charm
#

create an array of rendered drawIcons everytime map is moved/scaled ?

azure birch
meager granite
proven charm
#

oh yes the GPS, didnt think of that :/

meager granite
#

Yeah it constantly does these micro zooms in and out depending on your velocity

#

That's why these caches of 500 arrays per icon form

proven charm
#

update the draw icon array every x millisecond?

meager granite
#

Hmm, maybe toFixed can help with that, to ignore tiny changes in scale

meager granite
proven charm
#

I think the drawIcon should itself have a boundaries check but Idk if it does

meager granite
#

@still forum Does the drawIcon do boundaries check? Is it worth it scripting that check before using the drawIcon or the engine handles it better?

still forum
#

Atleast when it gets to drawing it does a check. Probably not in the command tho

granite sky
#

How many drawIcon calls are you making per frame here?

copper raven
meager granite
misty trail
#

how do i attach a marker to a helicopter so it will show on the map ?

meager granite
#

Calculating size and doing set x2 each time is 20% slower than caching code above

#

But caching generates 500+ cached arrays as soon as any smooth zoom is involved is what I don't like about it

meager granite
#

Full code, non-cached:

    params ["_map"];
    private _scale = ctrlMapScale _map;
    {
        if(_scale < _x get "scale") then {
            private _size = (_x get "size") * ((0.05 / _scale) max (_x get "coefMin") min (_x get "coefMax"));
            private _array = _x get "array";
            _array set [3, _size];
            _array set [4, _size];
            _map drawIcon _array;
        };
    } forEach game_drawIcons;
``` => [0.0529829,18874]
And cached:
```sqf
    params ["_map"];
    private _scale = ctrlMapScale _map;
    {
        if(_scale < _x get "scale") then {
            private _draw_array = _x get "cache" get _scale;
            if(isNil"_draw_array") then {
                private _size = (_x get "size") * ((0.05 / _scale) max (_x get "coefMin") min (_x get "coefMax"));
                _draw_array = +(_x get "array");
                _draw_array set [3, _size];
                _draw_array set [4, _size];
                _x get "cache" set [_scale, _draw_array];
            };
            _map drawIcon _draw_array;
        };
    } forEach game_drawIcons;
``` => [0.0416858,23989]
#

20% performance gain, but lots of cache spam

copper raven
little raptor
#

e.g. _x#DRAW_SCALE, etc.

loud shard
little raptor
#

Array instead of hashmap

meager granite
#

Ah, you mean use arrays instead of hashmaps

#

Not sure if it will be that much faster πŸ€”

tough abyss
#

anyone know the name of the command that disables ai leg movement but not aiming like stops them pathing completely

little raptor
granite sky
#

Do these icons all have different size/coefMin/coefMax?

meager granite
#

They currently don't but might

#
    private _cfg = configFile >> "RscMapControl" >> "Rock";

    game_drawIcons pushBack createHashMapFromArray [
         ["size", getNumber(_cfg >> "size")]
        ,["scale", 0.08681]
        ,["coefMin", getNumber(_cfg >> "coefMin")]
        ,["coefMax", getNumber(_cfg >> "coefMax")]
        ,["array", [getText(_cfg >> "icon"), [0.1,0.1,0.1,0.8], getPosWorld _x, 0, 0, 0]]
        ,["cache", createHashMap]
    ];
```Hashmap contents
#

Kind of universal, but maybe can be simplified and use the same cache for each

pulsar bluff
meager granite
tepid vigil
#

What happens if, for example, objNull is given as a remoteExec target? Is it local nowhere and no execution happens?

pulsar bluff
#

hmm

#

hashmap has some overhead to the lookup, i dont know if id be using hashmap get in a draw event

#

i mean i actually do, but just not that many

#

i dont actually know when hashmap overtakes array for lookup, performance wise

#

like an array with 3 elements is faster than hashmap lookup, statistically (if the elements were all equally likely to be queried

#

but an array with 3000 elements is slower

meager granite
#

πŸ€”

pulsar bluff
#

i think just the draw event context is not the best for iterating over large/complex data sets. in Draw/3D i try to have as many constants as i can with limiting variables/calculations only to pos/dir/text

granite sky
#

pretty sure the hashmap's always faster if you need a lookup and your hash doesn't require additional SQF.

copper raven
#

wut? array should always be faster

#

if you can rely on indices, then do it

#

what Leo said

pulsar bluff
#

its a "get" vs "findIf" comparison

#

[["a",1],["b",2],["c",3]]

#

findIf wins when few elements to iterate over, like finding value for "a"

copper raven
#

only for that case

copper raven
#

why am i even questioning myself πŸ˜„ that's two extra sqf commands anyway (already slower)

#

also i didn't mean array in that way

granite sky
#

In this case it's just iterating over the whole thing so you don't need the hashmap.

#

like you can do _x params ["_cache", "_size", "_coefMin", "_coefMax"] instead.

#

SQF way of doing structs :P

sharp skiff
#

quick question for adding a cfgFunctions? do i add them like this:

#

class CfgFunctions {
// add your own functions below
// Cratefiller
#include "KPCF\KPCF_functions.hpp"
};
// Ace Menu view distance
#include "taw_vd\CfgFunctions.hpp"
};

#

or like this

#

class CfgFunctions {
// add your own functions below
// Cratefiller
#include "KPCF\KPCF_functions.hpp";
// Ace Menu view distance
#include "taw_vd\CfgFunctions.hpp"
};

granite sky
#

first one has a bogus close bracket, second one has a bogus semicolon.

#

Otherwise, depends what's in the included files.

hallow mortar
#

The { and }; denote the start and end of the cfgFunctions class. You have to put the stuff inside of them.

sharp skiff
#

ah ok and the semicolon is bogus so it hat to look like that?:

#

class CfgFunctions {
// add your own functions below
// Cratefiller
#include "KPCF\KPCF_functions.hpp"
// Ace Menu view distance
#include "taw_vd\CfgFunctions.hpp"
};

granite sky
#

That one is at least superficially correct.

sharp skiff
#

so it should work?

granite sky
#

No, depends what's in the included files.

sharp skiff
#

"should"

#

well view distnace script

warm hedge
#

John said about how it's written, not what it does

hallow mortar
#

That looks suspiciously like the functions files from existing mods, so it's likely to work provided it hasn't been messed with

sharp skiff
#

it sort of is @hallow mortar its from vdauphins Hearts and Minds added with KP-Cratefiller and now TAWΒ΄s view distance script

granite sky
#

Also depends where you put it :P

sharp skiff
#

since i have more or less NO knowledge with that u can take a look an tell me if it is right:

#

disregard line 40/41 just saw that now!

granite sky
#

ok. Otherwise it looks plausible.

sharp skiff
#

well it worked without the taw_vd before so it should do it now too i check that

sharp skiff
#

well looks like i have some more editing to do "[...] taw_vd\GUI.h 162: .RscText: Member already defined."

#

and arma makes no sense for me again.... " Line 162: linespacing = 1;" 🀣 arma is a fucking hatelove

hallow mortar
#

That means there's duplication somewhere. Impossible to diagnose without seeing all files involved. I don't have time to comb through them - someone else might I guess, if you're nice and lucky.

sharp skiff
#

well i guess its either kpcf as the have a custom hud too for the cratefiller

#

"#include "KPCF\ui\KPCF_dialog.hpp" but if i dont include the GUI.h in the taw_vd it wont work hope it will run with the duplicate on the server localy i have to close 2 error dialoges then it loads fine

granite sky
#

Sometimes with UI conflicts you can undefine to workaround them.

#

but you'd need to pin down exactly what it's tripping on.

#

Line numbers tend to be off when you include files.

sharp skiff
#

i try to find it should be another GUI.h right? if not im fucked cause i got around a 100 files with extra stuff for the mission

#

well .RscText is there

granite sky
sharp skiff
#

well thats WAY to complicated for my brain

#

i just hope it works with both in place on the server

#

well localy what has a custom gui still has it ...

velvet knoll
#

Anyone happen to know if theres a way to get class names for the lights on a map?

proven charm
#

i dont think they all have a class name, just model name πŸ€”

velvet knoll
#
_myLamps = position powerPlant nearObjects ["Lamps_Base_F", "PowerLines_base_F", "Land_PowerPoleWooden_L_F", "Land_PowerPoleWooden_F", "Land_LampHarbour_F", "Land_LampShabby_F", "Land_PowerPoleWooden_L_F", "Land_PowerPoleWooden_small_F", "Land_LampDecor_F", "Land_LampHalogen_F", "Land_LampSolar_F", "Land_LampStreet_small_F", "Land_LampStreet_F", "Land_LampAirport_F"", 100000]; 
{ 
  _x switchLight "OFF"; 
} forEach _myLamps;
#

anyone have any idea why this is getting kicked back when i try to drop it into the init of an object?

#

says im missing "]"

#

but for the life of me i cant figure out where

hallow mortar
#

Double " after Land_LampAirport_F is breaking it, it thinks the string hasn't ended

velvet knoll
#

ahhhhhhhh im an idiot

#

thank you @hallow mortar

#

yep! accepted no problem

hallow mortar
#

I'm not sure that's going to work though, nearObjects only accepts one classname, not several

#

Those all inherit from Lamps_base_F so just use that

velvet knoll
#

ah okay cool, will try that. I noticed its not having the desired addect

#

will adjust and try again

velvet knoll
granite sky
#

Wrong channel, but looks like a very old version of the teamspeak plugin.

tough abyss
#

Whats the right one?

#

I cant find it at bloody all

granite sky
hallow mortar
#

setting the variable value to the string "nil" is a bit weird but not fundamentally wrong in the context of this script alone. In what way is it not working?

#

At the moment you're setting a variable on the trigger. The variable's name is hostageRescuedByPlayer, it contains the string "nil", and it exists in that state on all clients. That's the only effect of the setVariable line....I'm not really sure what you were wanting it to do, it's a little pointless in its current state.

#

You mean you want the trigger to be referred to by a varname? That's not what setVariable does

#

Well, it could, but not like that

#

When you do _playerByHostage = createTrigger [ ... you are saving the trigger as the local variable _playerByHostage. This is, essentially, a varname, just a local one to this specific script. If you want the variable to be accessible outside of this particular script, just make it a global variable. (If this code is only executed on one machine, you'll have to publicVariable it as well to make it available on other machines)

#

Editor "varnames" are just global variables, when you choose the variable name you are just choosing the name of the global variable that will refer to the object

#

Yes

#

What?

#

There's no particular reason in the code itself why that would be the case.
Where is this code being executed?