#arma3_scripting

1 messages ยท Page 68 of 1

little raptor
#

he meant a single command

tough abyss
#

so you see for the server there is no diffrence

little raptor
#

a command's performance doesn't depend on scheduled vs unscheduled

jade acorn
#

ah

little raptor
#

and the answer is yes, it can

tough abyss
#

There should be.

sharp grotto
#

depends on the load/hardware of the server/client

tough abyss
#

you as a mission designer need to knwo what you are doing

#

It's not documented anywhere

little raptor
#

no even if they had the exact same hardware the performance could be different

tough abyss
#

there is a lot undocumented, but you never finish something without debugging stuff and while debugging you should find such stuff

jade abyss
wind hedge
#

guys, any idea on how to structure a select version of this: sqf private _aiFeatures = ["AUTOTARGET", "ANIM", "COVER"]; private _enabledFeatures = []; { private _featureEnabled = _unit checkAIFeature _x; if (_featureEnabled) then {_enabledFeatures append [_x];}; } forEach _aiFeatures;

little raptor
#
_aiFeatures select {_unit checkAIFeature _x}
tough abyss
#

"And since the HC is a player"
I disagree and so does the English language

little raptor
#

pushBack is a thing

wind hedge
pliant stream
#

blame BIS for the faulty naming i guess, you can rise above and call your shit from it with proper names depending on whatever your client is to do

tough abyss
#

I do.

jade abyss
#

Oh boy... coming up with the fkn language again? Retard... OOhhh i am so sry, that i don't speak english... idiot

tough abyss
#

Now you insult me for bringing up messed up language in the game? Why do you care?

#

remember setDammage?

#

Yes. Difference is that this was fixed.

jade abyss
#

Commy... you are just... lets say "special"...

tough abyss
#

BI devs are mostly not nativ english

#

Dscha, why am I special?

#

after how many years? :D

pliant stream
#

spellcheck too mainstream

tough abyss
#

I'm not a native speaker either.

jade abyss
#

makes it even worse.

tough abyss
#

How so?

jade abyss
#

oh boy

tough abyss
#

I doubt player in czech means anything that would be considered a head less client.

stray flame
#

im struggling with one thing, so this thing I have replaces an arrow with a weapon holder then places an item in it. My question is if I wanted a trigger to go off when player picks up this item, what would I do?

#

Red arrow with this in the init

_wh = createVehicle ["GroundWeaponHolder", ASLtoAGL getPosASL this, [], 0, "CAN_COLLIDE"];  
_wh addBackpackCargoGlobal ["OPTRE_Armored_Matrix", 1];  
deleteVehicle this;
#

cuz the item itself is technically not placed in eden and the arrow thing is replaced when the mission start so I cant bind it to that

#

this is MP

quiet gazelle
#

do you just need a reference to your weaponholder?

stray flame
#

well when the item is picked up

#

I want a trigger to turn on

#

I dont know if the weaponholder dissapears when the item is picked up. If so is the case then the trigger could activate when the holder disappears

quiet gazelle
stray flame
#

well maybe

quiet gazelle
#

if that's the case just add myWeaponHolder = _wh to the init

stray flame
#

it really depends. Its a backpack. So when the player picks it up, they drop theirs. Idk if the weaponholder just swaps the old content with the new

sharp grotto
stray flame
#

could I instead

#

make a thing that triggers if any player is carrying a specific item?

quiet gazelle
#

yes, you could

sharp grotto
#

sure, just run a loop on the clients to check and send the response to server via remotexec if they have the item and do your stuff ^^

stray flame
#

step 2, how many one do this?

#

cuz I wouldnt want a bad loop if that makes sense

sharp grotto
#
 while {true} do {
//code
sleep 1; // So the loop doesn't run every frame
}; 
stray flame
#

okay step 2, where do i put this?

#

int.sqf?

sharp grotto
#

for the client ? initplayerlocal.sqf

stray flame
#

ah okay

#

thats simple

sharp grotto
#

Might wanna add it after this so the player is properly initialized

waitUntil{player == player};
wind hedge
#

I need my zombies attacking the door of a vehicle's driver, is this correct? sqf private _driverRelativePos = _targetVehicle selectionPosition "pos driver"; private _attackPosASL = _targetVehicle modelToWorldVisual _driverRelativePos; private _attackPosATL = ASLtoATL _attackPosASL;

stray flame
#

ofcorse I need some more stuff in the //code

stray flame
granite sky
#

I'd hope that you'd know which weapon slot that thing is in.

stray flame
#

backpack

#

yeah I had a few clues this wouldnt work

sharp grotto
#
waitUntil{player == player};
 while {true} do {
if((backpack player) isEqualTo "OPTRE_Armored_Matrix") then
{
    // Code
};
sleep 2; // So the loop doesn't run every frame
}; 
stray flame
#

thank you

wind hedge
# little raptor no

Any idea how to transform a selectionPosition to an ATL position I can use for a _unit setDestination [_attackPosATL, "LEADER DIRECT", true] command?

little raptor
#

setDestination takes AGL

#

modelToWorldVisual already returns AGL

#

but anyway to answer the question, you can use ASLtoATL with modelToWorldVisualWorld

wind hedge
little raptor
#

the key was it returns ASL

wind hedge
quiet gazelle
#

"ELD_cover_0P13636363636363635_0P2272727272727273" regexFind ["(?<=ELD_cover_[0-9P]+_)[0-9P]+",0] trows an error: Bad Pattern

#

what's wrong with my pattern?

#

online regex testers tell me it works

#

(they do warn me that lookbehind is not supported everywhere, but "ELD_cover_0P13636363636363635_0P2272727272727273" regexFind ["(?<=ELD_cover_)[0-9P]+(?=_)",0] works so i guess that's not the problem

little raptor
quiet gazelle
#

is this indefinite lookbehind because of the +?

little raptor
#

yes

#

it doesn't work

quiet gazelle
#

guess i'll work without that regex then

#

thanks

quiet gazelle
#

is there a command that does nothing but return NaN?

little raptor
#

you can get it using log -1 tho

#

or sqrt -1

#

or acos 2

#

basically providing a value that is not within the domain of a math function

quiet gazelle
#

thanks

quiet gazelle
#

yes

#

not through sqf tho

#

you need to make a config and pack it as a mod

keen stream
#

What is the JIP compatible way of removing some units backpack at spawn? Just put removeBackpack this in the init-field of said unit?

crystal talon
#

I have some survivors with custom loadouts on the editor, multiple slots on each side. ELI5 how do I make them respawn with the loadout they have in the editor?

wanton swallow
#

How to spawn LaserMarker from script?

fleet sand
#

Hi guys i just wonna know how can i make this code better. i have 2 timers 1 for delaying the cloacking and 2 timer for how much time unit is cloaked.

params ["_unit","_invis","_delay"];
private _nextCloak= _unit getVariable ["next_cloak", -1];
if (time < _nextCloak) exitWith {systemChat format ["wait for %1 seconds before Cloaking again.", (_nextCloak - time) toFixed 0];};
_unit setVariable ["next_cloak", time + _delay];

[_unit,_invis] spawn {
    params["_unit","_invis"];
    _unit hideObject true;
    while {_invis >= 0} do {
        _invis = _invis - 1;
        sleep 1;
    };
    _unit hideObject false;
};
wary needle
#

how do i display a mortar chart on a players screen

#

it needs to show when they enter the mortar

#

i have the text for the ranges ect but i dont have method to display it

sullen pulsar
#

I don't recommend that, the init-field via mission editor is executed everytime someone joins

north leaf
#

Good morning, what would be the best way to send data to a client from the server?

I'm sending the info in an array from inidbi2 to the client so they can build an interface.

_data remoteexec ["fnc to hold data", clientid] ? If I run that from the server will it run to players?

keen stream
#

Should I wrap if (isServer) then{} around it or something?

frank cedar
#

It is better wap with if (local this) then {}

sullen pulsar
#

If it's all units or something similar I recommend initPlayerLocal and check _this select 1

frank cedar
#

because unit may be local to player not server

sullen pulsar
#

if it's true then they're jip

#

or what Zealot said

keen stream
#

@sullen pulsar initPlayerLocal, good call. :)

sullen pulsar
#

I tend to stay away from the mission.sqm stuff and only use it for placing the objects xD

proven charm
proven charm
digital rover
#

On the wiki about setTerrainHeight it says Edited terrain heights are not saved inside savegames, they need to be restored manually on savegame load.. Is this even true any more? It seems to be being saved for me...

frigid oracle
#

I want to double check my knowledge here.
When you use spawn with a handle

_handle = [] spawn something_fnc

If your code loops

while {condition} do {
_handle = [] spawn smething_fnc_here
sleep 1
}

The spawn wont duplicate in the while loop and only will be recompiled and ran again if the handle is clear and free of the running script?

digital rover
#

No, a new handle is returned every time you spawn it

proven charm
#

that code will create many spawns . if you want only one at a time use waituntil { scriptdone _handle }

digital rover
#
// Both these will run at the same time
_handle1 = [] spawn fnc;
_handle2 = [] spawn fnc;
#

if you wanted to make sure you should do as GC8 says

// _handle2's spawn will only spawn after _handle1 exits
_handle1 = [] spawn fnc;
waitUntil {sleep 1; scriptDone _handle1};
_handle2 = [] spawn fnc;
stable dune
frigid oracle
digital rover
#

you can give whatever name to a handle you want, it doesn't make a difference

frigid oracle
#

I see

#

Hmmm

digital rover
#
_handle = [] spawn fnc;
_handle = [] spawn fnc;

Here you're just overwriting the handle so you can't access it in your script any more, but the script is still running.

#

but you can do

_handle = [] spawn fnc;
waitUntil {sleep 1; scriptDone _handle};
_handle = [] spawn fnc;

As it doesn't matter if you overwrite the handle of a script that is already finished

meager granite
#

Would love to know the answer to that as well

little raptor
#

Use call

digital rover
#

I'm answering the question he asked

#

not pissing my opinions everywhere

north leaf
hallow mortar
#

It runs on the machine where the EH was added - addMissionEventHandler is a local effect command, and many mission EH types are related to client-specific events.

#

Don't confuse mission EHs with MP EHs, which do trigger everywhere.

winter rose
#

and are not saved in MP savegame

velvet merlin
#

@meager granite

drawIcons can be be optimised quite well with new inAreaArray command
You need to update a location each frame to fit map's size then you run all your potential draw candidates against it with inAreaArray

sorry was busy this week. do you have a code sample on that please

meager granite
# velvet merlin <@107672558320496640> > drawIcons can be be optimised quite well with new inAre...

Code from KotH:

    private _location = _map getVariable "koth_map_location";
    private _map_dir = _map getVariable "map_dir";
    private _map_aim = _map ctrlMapWorldToScreen client_mapDraw_nullPosition;
    if(_map_aim isNotEqualTo (_location getVariable "aim")) then {
        _location setVariable ["aim", _map_aim];

        ctrlPosition _map params ["_map_x", "_map_y", "_map_w", "_map_h"];
        private _map_top_left = _map ctrlMapScreenToWorld [_map_x, _map_y];
        private _map_bottom_left = _map ctrlMapScreenToWorld [_map_x, _map_y - _map_h];
        private _map_top_right = _map ctrlMapScreenToWorld [_map_x + _map_w, _map_y];
        private _map_center = _map ctrlMapScreenToWorld [_map_x + _map_w / 2, _map_y + _map_h / 2];

        private _dir_vector = _map_bottom_left vectorFromTo _map_top_left;
        if(_dir_vector select 0 == 0) then {
            _map_dir = 0;
        } else {
            _map_dir = if([0,1] vectorCrossProduct _dir_vector select 2 > 0) then {
                acos([0,1] vectorCos _dir_vector) - 180
            } else {
                180 - acos([0,1] vectorCos _dir_vector)
            };
        };

        _map setVariable ["map_dir", _map_dir];

        private _a = ((_map_top_left vectorDistance _map_top_right) / 2) + _scale * 1000;
        private _b = ((_map_bottom_left vectorDistance _map_top_left) / 2) + _scale * 1000;

        _location setPosition _map_center;
        _location setSize [_a, _b];
        _location setDirection -_map_dir;
    };
#

Execute on "Draw"

#

Then you can do:
allUnits inAreaArray _location
and only iterate through it

#

client_mapDraw_nullPosition is [0,0,0]

#

_scale is ctrlScale _map

#
        if(isNull(_map getVariable ["koth_map_location", locationNull])) then {
            private _location = createLocation ["Name", getPosWorld objNull, 0, 0];
            _location setVariable ["aim", getPosWorld objNull];
            _location setVariable ["map", _map];
            _location setRectangular true;
            _map setVariable ["koth_map_location", _location];
            _map setVariable ["map_dir", 0];
        };
```On control initialization, alongside adding `Draw` EH
#

_map_dir can now be retrieved with 2.14's ctrlMapDir instead of doing the manual calculation

#

So location position calculation can be made even simplier

#

This code updates location to fit map's control, so it works dynamically for any sized RscMap

#

With some padding + _scale * 1000 so larger icons aren't cut off right away

#

_location setDirection -_map_dir; also covers rotating GPS

#

This will give you noticable performance boost if you need to draw lots of objects, instead of drawIcon'ing everything

velvet merlin
#

@meager granite thank you! so in simple terms you render only those actually in the visible space, or is there even more to it that i am missing?

meager granite
#

Yes, you cut off invisible objects with inAreaArray

#

invisible outside of the map view

#

You can test it to make sure it works by making padding negative and notice that objects no longer draw by the edge of the screen

#
_map drawRectangle [
    locationPosition _location,
    size _location select 0,
    size _location select 1,
    _map_dir + direction _location,
    [1,0,0,0.5],
    "#(argb,8,8,3)color(1,1,1,1)"
];
```Debug draw for the location to see that it follows map view exactly
scenic shard
#

I'm having some issues with using my compositions that have a script in the init field.

for example this:

[this, true, [0, 1.1, 0.8], 90, true] call ace_dragging_fnc_setCarryable;
 
this setVariable["ace_cargo_customName", "Guardsmen Ammo", true];

clearWeaponCargoGlobal this; 
clearMagazineCargoGlobal this; 
clearItemCargoGlobal this; 
clearBackpackCargoGlobal this; 
 
{ 
  this addWeaponCargoGlobal _x; 
} forEach [["ML700_Launcher_Weapon_CadianLauncher_Loaded", 2]]; 
 
{ 
  this addMagazineCargoGlobal _x; 
} forEach [["ML700_Lasgun_Rifle_B_50_Battery", 250], ["ML700_Stubber_Drum_Green", 70], ["ML700_frag_grenade_magazine", 60], ["ML700_krak_grenade_magazine", 30], ["TIOW_ig_smoke_grenade_mag", 60], ["IC_Frag_rocket_mag", 8], ["IC_Krak_rocket_mag", 16]];

it works well for boxes placed in editor running the same code (just a added check so it only runs on server)

when i use the above from the composition in zeus however nothing happens, the boxes have their original contents

hallow mortar
scenic shard
hallow mortar
#

If it doesn't exist the default value is 1, which prevents init scripts

scenic shard
#

nice, sounds like that is my issue then ๐Ÿคž

#

works now, thanks!

north leaf
#

Any thoughts on why my _populate would result in [false, false, false, false, false, false]?

#

this is where it's defined:

#

what's weird, is if I use format systemchat right before the "_populate apply" section, it provides the right info

#

so I don't believe it's an issue with sending the data or receiving it....something is changing the info before it's being added to the interface

stable dune
north leaf
#

I'm defining / reading on the server and then sending it to the client, don't think I can run oo_inidbi if the player doesn't have hte mod

#

so yeah, sorry, that second pic isn't where i'm defining it, it defines at mission init

meager granite
#

You're having it as false elsewhere

north leaf
#

It's a nested array, I wonder if thats messing with me

meager granite
#

Why apply instead of forEach btw?

north leaf
#

I was just looking around and it seemed like a simpler way to do it, I was using ForEach before...was hoping apply would provide a different result xD

#

before the 'ButtonSetAction' area, if I use format systemchat, it provides the correct information

#

I think i'm losing something in translation to unpack the array

meager granite
#

So far your code shouldn't modify your _items

#

Add diag_log ["_items", _items]; Right before and after _populate apply

north leaf
#

lemme try that

#

inside the apply code or after it?

meager granite
#

Before and after that whole statement

#
diag_log ...;
_populate apply {
...
};
diag_log ...;
north leaf
#

ohhhhhhh

#

now that's interesting!

#

10:48:19 ["_items",[[false,false,false,false,false,false],["ACM_B_NAG_Ifrit","Karatel","\acm_nagansk\ui\ACM_B_NAG_Ifrit.jpg",36,1,true],["ACM_B_NAG_Ifrit_HMG","Karatel (HMG)","\acm_nagansk\ui\ACM_B_NAG_Ifrit_HMG.jpg",31,1,true],["ACM_B_NAG_Ifrit_GMG","Karatel (GMG)","\acm_nagansk\ui\ACM_B_NAG_Ifrit_GMG.jpg",5,1,true],["ACM_B_NAG_RM70","RM-70","\acm_nagansk\ui\ACM_B_NAG_RM70.jpg",27,1,true],["ACM_B_NAG_Tatra","Tatra T810 (Covered)","\acm_nagansk\ui\ACM_B_NAG_Tatra.jpg",2,1,true],["ACM_B_NAG_UAZ_Unarmed","UAZ-469","\acm_nagansk\ui\ACM_B_NAG_UAZ_Unarmed.jpg",34,1,true],["ACM_B_NAG_UAZ_AGS30","UAZ-469 (AGS-30)","\acm_nagansk\ui\ACM_B_NAG_UAZ_AGS30.jpg",1,1,true],["ACM_B_NAG_UAZ_MG","UAZ-469 (DShKM)","\acm_nagansk\ui\ACM_B_NAG_UAZ_MG.jpg",15,1,true],["ACM_B_NAG_UAZ_SPG","UAZ-469 (SPG-9)","\acm_nagansk\ui\ACM_B_NAG_UAZ_SPG.jpg",21,1,true]]]

#

so the first nested array is buggered....hmm

#

it was the same both before and after btw

meager granite
#

When it doubt, diag_log the hell out of it

north leaf
#

yeah, i'm new to that command

meager granite
#

Yeah, your apply didn't modify anything

north leaf
#

been using format systemview hahaha

#

god this woulda been so useful before

meager granite
#

apply should return a resulting array, but you don't assign it to anything

#

not a problem really, just a bit weird to use it instead of forEach

north leaf
#

this si what I was using prior

meager granite
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
north leaf
#
{
    [format ["ITEM = %1", _x]] remoteExec ["systemChat", 0];
    for "_i" from 0 to (count _x) do {
        _data = _populate select _i;
        [format ["_data = %1", _data]] remoteExec ["systemChat", 0];
        // Current result is saved in variable _x
        _classname = _data select 0;
        [format ["_classname = %1", _classname]] remoteExec ["systemChat", 0];
        
        _name = _data select 1;
        _image = _data select 2;
        _added = _list lbAdd _name;
        _cost = __data select 3;
        _list lbSetData [_added, _classname];
        _list lbsetTextRight [_added, _cost];
        _list lbSetPicture [_added, _image];
    };

} forEach _populate;
meager granite
#

I don't think you need to iterate through _x here

#

(And it should be for _i from 0 to count _x - 1)

north leaf
#

can probs remove the 'foreach' right? keep with the for "_i"

meager granite
#

count _x would be 1 item more than array length

north leaf
#

ahh yeah true

meager granite
#

Your _populate apply { looks fine

north leaf
#

omg, that's right

#

the first entry of the db is the total sum of logistics 'points'

#

that's why the array is messed up

meager granite
#
    for "_i" from 0 to (count _x) do {
        _data = _populate select _i;
```Now I see why your code *sort of* worked, you iterated through each inner element of an item and then used its index to get the item again
#

But its totally wrong

north leaf
#

xD

meager granite
#

Just forEach or apply through your _items array and you're good

north leaf
#

I'll probably switch to forEach

#

that way i can start from the 2nd entry

meager granite
#

I think you're mixing something up

meager granite
north leaf
#

this is the data from inidbi that the info is coming from

meager granite
#

I guess its a return of first _x = 0 calls to your _db function?

north leaf
#

select 0 would provide all falses, as it's not finding the right criteria

meager granite
#

Perhaps it wants indexes to start from 1

little raptor
#

ctrlMapPositionToWorld? think_turtle

meager granite
#

So fix it in your inidb getter

north leaf
#

yeah

little raptor
meager granite
#

Fix until there is no array of falses in data that user gets

north leaf
#

what a whirlwind of coffee infused craziness haha

meager granite
#

Then just forEach through it similar to your original apply code

#

And btw you can replace

        _classname = _x select 0;
        _name = _x select 1;
        _image = _x select 2;
        _cost = _x select 3;
```with
```sqf
        _x params ["_classname", "_name", "_image", "_cost"];
#

You can params any array, not just _this

north leaf
#

oh yeah? that's awesome

#

a lot cleaner

#

That worked!!! @meager granite , thank you for the assistance!

meager granite
#

๐Ÿ‘

hasty gate
#

How do I check if unit is watching a position assigned by doWatch command using SQF?

little raptor
frigid oracle
#

when I use ppEffectCreate should I destroy the effect when its not needed temporarily? Is it ok to let it linger and use Adjust to show and hide it at any time anyway?

little raptor
#

yes

#

I mean it's ok to just hide it

frigid oracle
#

Gotcha, makes my life easier that way. ๐Ÿ‘

little raptor
#

but keep in mind that it still consumes resources a bit so if you don't need it anymore just destroy it

frigid oracle
#

Alright, ill keep that in mind

hasty gate
little raptor
#

then no

tepid vigil
#

Do I need to pass variables somehow to getOrDefaultCall? This doesn't seem to be working.

params ["_unit", "_muzzle", "_magazine"];

private _currentRoundCount = _unit ammo _muzzle;

private _magData = TRFR_magazineCache getOrDefaultCall [
    _magazine,
    {
        private _magConfig = configFile >> "CfgMagazines" >> _magazine;
        private _tracersEvery = getNumber (_magConfig >> "tracersEvery");
        private _lastRoundsTracer = getNumber (_magConfig >> "lastRoundsTracer");

        // Fix zero divisor
        if (_tracersEvery == 0) then {_tracersEvery = 9999};

        [_tracersEvery, _lastRoundsTracer]
    },
    true
];
little raptor
#

no

#

it should work blobdoggoshruggoogly

scenic shard
#

can i spawn just the visuals of the zeus lightning bolt?

I currently have this in the init of my unit to make a bolt strike it as i spawn it through zeus composition.
[this] remoteExec ["FLO_fnc_lightningSpawn", 0];

params["_unit"];

_unit spawn
{
    if(local _this) then { _this allowDamage false;};
    private _tempTarget = createSimpleObject ["Land_HelipadEmpty_F", getPosASL _this, true];
    [_tempTarget, nil, true] spawn BIS_fnc_moduleLightning;
    if(!local _this) exitWith {};
    sleep 1;
    _this allowDamage true;
};

if i don't remote exec it the visuals of the bolt don't appear for clients, not however each of them make their own strike, so the unit gets sent flying

forest hill
#

what sort of script would i need to add to a unit to force it to aim more left?

wind hedge
#

according to chatGPT this is a thing: sqf playerPos = getPos player; nearestCity = nearestLocation playerPos ["NameCity", "NameCityCapital"]; but nearestLocation can only take one location type at a time right?

granite sky
#

scrambled as usual.

#

There is a nearestLocations which you could theoretically use for that.

scenic shard
#

regarding my question above, anyone know the locality of BIS_fnc_moduleLightning? feels odd that it would have to be sent to all clients

little raptor
little raptor
#

well except for the light

#

the light is local meowsweats

#

the lightning object itself is global

scenic shard
#

great lol. sooo, grab the code from the module and make my own?

little raptor
#

yep

#

remoteExec the light part

scenic shard
#

ok, thanks

little raptor
#

it spawns the lightning wherever the lightning object itself is local

#

so for the best effect, you should do that part server side

#

(you won't need an object anyway)

wind hedge
#

If I remember correctly, postion is quite slow? Should I use getPosASL?

granite sky
#

Yes, it's same as getPos. <- Not for locations it isn't

#

use getPosATL if in doubt.

tough abyss
little raptor
#

dunno

tough abyss
#

ill test it sometime ig

little raptor
#

looks like yes

wind hedge
granite sky
#

oh wait, position is correct for locations.

#

could use locationPosition to make it clearer.

tough abyss
tepid vigil
#

While waiting for 2.14 with forEachReversed, what's the best way to go about deleting elements from an array as it's being iterated over?

private _currentTime = time;
for "_i" from (count TRFR_activeFires) to 0 step -1 do {
    (TRFR_activeFires # _i) params ["_fireObject", "_size", "_expireTime"];
    if (_currentTime > _expireTime) then {
        if (_size == 0 && {random 100 < CBA_SETTING(fireGrowChance)}) then {
            [getPosASL _fireObject, 1] call FUNC(createFire);
        };
        deleteVehicle _fireObject;
        TRFR_activeFires deleteAt _forEachIndex;
    };
};

This is what I am currently doing but I think it's skipping some elements thonk

#

Not sure though. The array does get empty but objects remain

granite sky
#

uh, not sure about _forEachIndex there

#

should be _i

tepid vigil
#

Nice catch. I wonder how the array was clearing up even with that issue

granite sky
#

Has a count issue too, start index should be (count whatever - 1)

tepid vigil
#

How come that _forEachIndex wasn't printing out an error? The array was clearing up as well

little raptor
#

unschd never shows any errors for undefined vars

#

as for why it was working, it was probably defaulting to 0

little raptor
#

you're just emptying your array

#

just do TRFR_activeFires resize 0 after the forEach loop

granite sky
#

It's not. expireTime can vary between entries, so it's a partial clearout.

little raptor
#

oh it has an if meowsweats

granite sky
#

Would still be inclined to do the deletion separately but it's not entirely unreasonable :P

little raptor
#

that's what I recommend too

#
_deleted = false;
{
...
  TRFR_activeFires set [_forEachindex, 0];
  _deleted = true;
} forEach TRFR_activeFires;
if (_deleted) then {
  TRFR_activeFires = TRFR_activeFires - [0];
}
cold pebble
#

Is there a neat way to check if the player is zoomed in through a scope, turret scope, or the + key?

jade acorn
#

you can use cameraView == "Gunner" to find if player is looking through an optic at all, but zoom check can be done only with the fov checker iirc

cold pebble
#

Hmm, any event which I could link that to, or would I have to do it on keypress?

little raptor
#

you can use addUserActionEventHandler

stark fjord
#

I have a question about VLS and targeting and fire, so i have VLS spawned and on force hold fire (so it doesnt randomly shoot at any valid target).
So when player attaches/throws IR grenade at the vehicle that they want destroyed following script runs:

params["_obj", "_class", "_temp"];
if (_temp) exitWith {};
if (_class != "B_IR_Grenade") exitWith {};
[_obj] spawn
{
    params["_tgt"];
    sleep 60;
    _vic = (_tgt) nearEntities [["LandVehicle"], 10];

    if (count _vic == 0) exitWith {hint "No target"}; 
    _vic = (_vic # 0);
    west reportRemoteTarget [_vic, 5000];
    _vic confirmSensorTarget [west, true];
    vls fireAtTarget [_vic, "weapon_vls_01"];
    deleteVehicle _tgt;
};

This works fine, as long as VLS is local to player, but when its not, its really hit or miss situation (quite literally).
As sometimes VLS will properly lock on to target and fire, missile hits vic and everyone is happy, or
VLS will fire straight off into the stratosphere and missile is never to be seen again...
When testing and it doesnt work, i notice no target is revealed on VLSs "radar",
Should i be remote executing reportRemoteTarget, confirmSensorTarget and fireAtTarget on VLS?

forest hill
#

when using the Fired event handler, what are the variables i can apply to the projectile parameter? i can't seem to find a list of them

#

or rather, what would be the code i'd need to use to adjust the starting position of the bullet that's fired

hallow mortar
#

By the time the EH fires, the bullet has already been created; you can't change where it gets created without modifying the weapon. However, setPosATL/ASL work on the bullet and you can do whatever you want with that.

forest hill
hallow mortar
#

setPos should not be used in 99.9% of all cases. It's an old, slow command with a dangerously inconsistent output. You can technically use it to change the position of a bullet, but you shouldn't.

forest hill
#

alright, i'm just trying to figure out how to make setPosATL not relative to the terrain since this would be for a moving plane

hallow mortar
#

Well, that's what ASL is for

#

You may find the entertainingly named modelToWorldVisualWorld useful

forest hill
#

hmmm, that might be useful

#

so this is the script i'm working off so far, but it doesn't appear to be doing anything, i figure something's probably wrong, but i can't figure out what

    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; 
     _position = getPosASL _projectile; 
     _position set [2, 10];
     _projectile setPosASL _position;
}];
#

this is being put directly onto the gunner

hallow mortar
#

Well, for one thing you're setting the projectile's altitude to exactly 10 metres ASL. That's not relative to the plane or the original position, like 10 more or 10 less - it's just 10.

The other thing is that as per the Fired EH's documentation, it must be set on the vehicle, not the gunner, in order to work with the vehicle weapons. If you put it on the gunner it's looking for their personal weapons, which are obviously not doing anything.

forest hill
#

hrmmmm

#

well, before i do anything crazy, i just want to make the bullets move in the first place

#

ok, well the bullets are at least moving to the new position when they shoot now

#

i've just got to figure out how to offset their position to about 20 feet left of where they normally start

hallow mortar
#

Find the position of the new origin point, relative to the vehicle (in its model space). You can work this out ahead of time by trial and error or by placing a reference object and using worldToModel on it, or you can generate it dynamically using selectionPosition if there is a conveniently placed selection. Then use modelToWorldVisualWorld to turn that relative position into an ASL position, setPosASL and voila.

#

Note that this will not change the position of firing effects such as muzzle flash.

forest hill
#

that's fine, i want the flash to stay on the plane, i just need the rounds to actually hit the target, and if moving them is the only way to compensate for the AI not aiming in the correct position, then so be it

hallow mortar
#

You could also change the velocity of the projectiles so they always fly towards the target, if you have a specific target in mind and not just general use

forest hill
#

so, modelToWorldVisualWorld would be


_projectile modelToWorldVisualWorld [0, -20, 0];

or something akin to that?

#

and unfortunately this is general use

hallow mortar
#

Well, you can try doing that, but I don't know whether projectiles have roll rotation. If they do that'll probably work without the other stuff. If they don't, that adjustment won't account for the plane's roll angle at the moment of firing.

forest hill
#

i gave it a shot, this hasn't seemed to do anything


this addEventHandler ["Fired", { 
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; 
     _position = getPosASL _projectile; 
     _projectile modelToWorldVisualWorld [-5, 0, 0];
     _projectile setPosASL _position;
}];

#

I'm gonna try putting _position =getPosASL underneath _projectile modelToWorldVisualWorld

#

since i'm not sure which should come first

hallow mortar
#

That's wrong

#

What you do there is save the projectile's original pos. Then you generate a relative-to-ASL pos, but don't save it or do anything with it. Then you set the projectile's pos to...the original pos you saved

forest hill
#

ahh, ok

#

what would i want to do there to actually save the position i just generated?

hallow mortar
#

_position = ... < this is the part that saves the output of the command into a variable called _position

forest hill
#

got it working

hallow mortar
#

You don't need to do getPosASL on the projectile since you're not using its original position at all

tough abyss
#

What about the things that ARE documented, but don't exist.

forest hill
#

ahh, alright

#

this addEventHandler ["Fired", {  
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];  
     newPos = _projectile modelToWorldVisualWorld [-5, 0, 0]; 
     _projectile setPosASL newPos; 
}];

so that should work?

#

since that's my new code minus the getPosASL

tough abyss
#

Like MagazineGroups

hallow mortar
#

Put a _ before newPos. Without the _ it's a global variable accessible in any instance of any script; you want a local variable that's only valid in this instance of the EH code.

#

Thanks, discord

forest hill
#

gotcha, gotcha

#

ok, well doing that appears to have stopped it from functioning

#

it was working without the underscore

hallow mortar
#

Did you put it on both references to newPos?

forest hill
#

no i did not, and that would be why

#

i'm dumb

#

still not working for some reason

#

weird, thought that would fix it

hallow mortar
#

May I see the new code?

forest hill
#

this addEventHandler ["Fired", {  
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];  
     _newPos = _projectile modelToWorldVisualWorld [-5, 0, 0]; 
     _projectile setPosASL _newPos; 
}];

hallow mortar
#

That looks fine assuming that -5 is in the correct axis

forest hill
#

it is, i've double checked, it's not that they're aiming wrong

#

it's just when i add the underscores, the adjustment just stops working

#

without them the bullets teleport and fire just fine

hallow mortar
#

That shouldn't be the case, the underscores are a proper and valid use of local variables

#

It's exactly the same thing as _projectile, which you will note is working fine

#

Using local variables doesn't change the operation of the code in itself, it just prevents it overwriting or being overwritten by other scripts or instances of itself

forest hill
#

i have no idea, i may just name it some obscenely long variable that there'd be 0 chance of it being overwritten

hallow mortar
#

It would still overwrite itself if two instances of the EH happened to be operating at the same moment

#

(also performance. Not a lot of performance but still)

#

I want to specify again that this is a perfectly normal use of underscores. They shouldn't break it and the fact that they do means something weird is going on, and that needs to be fixed....if we can just figure out what it is

forest hill
#

i don't plan to have any more than 1 of these in operation at any given time, so the first point is sort of moot, but yeah i'd like to see if i can figure this out as well

#

it's just so confusing

hallow mortar
#

You definitely put this in the vehicle init and not the gunner or group by accident?

forest hill
#

yep, it's in the vehicle init

#

and only the vehicle init

hallow mortar
#

Can you add a systemChat str _newPos right after you define it, and see what that outputs? Maybe also a systemChat str (getPosASL _projectile) for comparison (before you setPosASL it)

#

We're looking for cases where it comes out with an empty array, obviously stupid array, or two of the exact same array

forest hill
#

yeah, let me throw that in

#

aaaand it's working now?

#

#justarmathings

#

whatever, it's working and i have ai fired miniguns that can hit targets

#

thank you so much for your help

#

you've been beyond invaluable

tough abyss
mortal saffron
#

Is there a way to set viewdistance for West AI or the plane that they are in, when taking remote control?

slow isle
#

Some time ago I made a mission for air-to-air dogfighting and it's almost finished now. It has some bugs that need to be fixed for the mission to run smoothly, but I have other priorities to focus on and it would be a shame to abandon it. So I decided to leave it here for anyone who might want to continue working on it: https://github.com/PublicLounderr/A3JetsDogfightMission
You can add yourself as an author/co-author

GitHub

Mission for Arma 3 focused on providing fun air-to-air gameplay. Feel free to edit the mission and make pull requests! - GitHub - PublicLounderr/A3JetsDogfightMission: Mission for Arma 3 focused on...

low isle
#

Hi! I have an idea for a big and revolutionary mod, but don't know how to script... Would someone like to join me or even guide me?

sullen sigil
#

step 1 read wiki
step 2 learn 2 script
step 3 make mod
step 4 profit

mortal saffron
sullen sigil
#

mentally

slow isle
#

metaphysically

warm hedge
#

Surprisingly what KJW said is accurate enough. You firstly need to have feasible goal. The goal should be very specific

#

And you need to struggle enough. Maybe years of it

sullen sigil
#

me rewriting my first scripting adventure for the 6th time soon

cold pebble
#

Has anyone got any solid solutions for a way to accurately detect whether an object is colliding with another?
My usecase is I have a build menu, where you select an item and it creates it locally for the client. It spawns infront of them and they control it by moving, turning, and scroll wheel to move it up/down. I currently check if its colliding by running nearestObjects and nearestTerrainObjects with the radius being boundingBox _previewObject select 2 however its not the best solution as it allows some weird behaviour. If anyone has any better collision detection ideas that'd be appreciated, I can link the full code on github if people want to read further into how I'm using it to clarify things

#
private _nextPreviewPos = player modelToWorld [0,3 + _collisionZone,DT_buildElevation];
    _previewObject setPosATL _nextPreviewPos;
    _previewObject setDir ((getDir player) + DT_buildRotation);

    private _nearbyObjects = nearestObjects [_nextPreviewPos,["AllVehicles","House"],_collisionZone,true];
    _nearbyObjects append (nearestTerrainObjects [_nextPreviewPos,["TREE","BUILDING"],_collisionZone,false,true]);

    private _ignoreObjects = getArray(missionConfigFile >> "Core_Settings" >> "ignoreWhenBuilding");
    private _collidingObjects = [];
    {
        if !(_x isKindOf "CAManBase" || {(typeOf _x) in _ignoreObjects || {_x isEqualTo _previewObject}}) then {
            _collidingObjects pushBack _x;
        };
    } forEach _nearbyObjects;

    private _sphereColour = "#(rgb,8,8,3)color(1,0,0,1)";
    if (_collidingObjects isEqualTo [] && {[getPosATL player] call DT_fnc_isNearFob}) then {
        _sphereColour = "#(rgb,8,8,3)color(0,1,0,1)";
        DT_canBuild = true;
    } else {
        DT_canBuild = false;
        {
            drawIcon3D ["\A3\ui_f\data\map\markers\handdrawn\objective_CA.paa",[1,0,0,1],(getPosATL _x vectorAdd [0,0,2]),1,1,0,getText(configOf _x >> "displayName"),0,0.04];
        } forEach _collidingObjects;
    };

    {
        _x setPosATL (_nextPreviewPos getPos [_collisionZone,10 * _forEachIndex]);
        _x setObjectTexture [0,_sphereColour];
    } forEach _spheres;

Thats the full collision detecting snippet

little raptor
cold pebble
#

So I guess I'm already doing #1 above

little raptor
#

I guess but I didn't read it

cold pebble
#

What would 2 entail exactly?

little raptor
#

Intersection of 2 boxes blobdoggoshruggoogly

cold pebble
#

I may be being slow, but how exactly would I implement that?

little raptor
#

Though in Arma maybe that algorithm turns out slower than 3 ๐Ÿ˜“

cold pebble
#

Hmmm

#

So for the lines, I guess I'd need to create maybe 36 lines popping out from the centre of the object in 10 degree intervals

little raptor
little raptor
#

Depending on how big your object is a spherical pattern could work for you tho

#

But I personally recommend using something similar to the soldier collision geometry (with fewer edges and faces tho)

#

If you don't know what it is, unpack A3's anim data pbo then open the collision models in Object Builder (it's binarized tho)

cold pebble
#

So it could be pretty much any object with varying sizes, as its based on self-building vehicles and a FOB

#

And its configured by the mission maker so they can add anything they want too

little raptor
#

Do you want to allow placing objects inside each other?

#

E.g can they place a radio on top of a table? Or a crate in a house?

#

If yes then 1 and 2 are not gonna work

#

Because the bounding boxes collide

cold pebble
#

Usually the smallest thing that people have is chairs, but they often get placed inside buildings and such

little raptor
#

Then use 3

#

The spherical pattern may be enough for your use case

cold pebble
#

Ok ty

frigid oracle
#

is there a limit to ppEffect index? like a max number it can climb to and slam into a brick wall.

warm hedge
#

Most likely there is. But it probably is easier to break the game first

frigid oracle
#

so if an effect is being created and destroyed, unless the server/client is running for 10 years straight there is no concern of hitting said limit?

warm hedge
#

I have no confirmation though, since am not a dev, but have no experience with such limit so far

frigid oracle
#

Gotcha, good to know! ๐Ÿ‘

tepid vigil
#

I am currently working on a mod that adds a lot of local particles, but some of them need to be consistent to all players. Could I avoid remoteExec etc network traffic by adding serverTime as a seed to all random values for deterministic behaviour thus eliminating the need to remoteExec? How likely is this to desync?

frigid oracle
#

"The syncing is happening every 5 minutes, but you can force the next sync earlier by executing estimatedTimeLeft command"
I would assume it wont be 100 percent matching as the number could be ยฑ , but would self correct every now and then. (im a newb so take me with a grain of salt)

tepid vigil
#

Return Value: Namespace on the server, Nothing on clients or in single-player.
They shouldn't be able to without an exploit of some kind

#

Well if your mission / mod offers a route for malicious users to run code, let alone remote exec, then you've kinda done yourself in. If they can remoteExec with no restrictions then anything is possible

#

Input fields for example are a common place to inject code. Remote code execution is a pretty broad topic and I won't go into detail here, but the best way to ensure remoteExec safety is to use cfgRemoteExec

#

In Arma the usual exploits are stuff like gaining access to dev console etc. Badly made missions can pretty easily be exploited enough to get the dev console open

#

People carrying out these attacks is pretty rare though, I've only seen it happen once. Public zeus is probably the most common place where people do this

tepid vigil
frigid oracle
#

fair

finite bone
#

How would I go about in finding all available images in the game? (For example: \a3\Missions_F_Orange\Data\Img\orange_overview_ca.paa) - Is there a specific link in the A3 wiki that has a collection of these? (including their paths)?

finite bone
#

Gee thanks!

proven charm
#

that's the one I use anyways, not sure if there are others

finite bone
#

Disregard - I did a dumb thing!

barren fable
#

anyone know why i would be getting "could not load mission" yet the mission loads fine with no errors in .rpt?

modern meteor
#

Hi, I am spawning some units during a mission via script. Single and group units on the EAST side. Dynamic Simulation is enabled for the mission but it seems that these units do not get simulated. How can I activate dynamic simulation for spawned units?

modern meteor
#

Got it, thank you!

finite bone
#

When we go unconscious in ACE how exactly does it prevent us from communicating and interacting? Is it by disabling global simulation or disabling user input or other method?

winter rose
frigid oracle
#

is waitUntil { ppEffectCommitted _handle }; acceptable or should I use a sleep on the waitUntil? every example I see does not do that for this case use.

warm hedge
#

waitUntil requires to execute it every once in a while, so sleep is better IMO?

pulsar bluff
#

the less frequent evaluation the better

oblique pewter
#

how do i run a script on a spesific player?

#

using their name doesn't work so i need help

opal zephyr
#

@oblique pewter You can remoteexec it using the players unit object

oblique pewter
#

what is a unit object

opal zephyr
#

the vehicle that is the player, what "_player" would be on clientside

#

do all you have to go off of is the name?

oblique pewter
#

yeah i only have the name

opal zephyr
#

which name? The steam one?

oblique pewter
#

the in game name

opal zephyr
#

ok the profile one

oblique pewter
#

yes sir

manic flower
#

Can anyone help me

oblique pewter
opal zephyr
#

one sec

#

had to find the syntax for that

oblique pewter
#

all good

#

where you able to find it?

opal zephyr
#

@oblique pewter ya, just writing a quick script for it, sorry its taking awhile, was multitasking

#

@oblique pewter Here you go:

_name = "Jeff";
[
    if (name _x isEqualTo _name) exitWith {["compile preprocessFileLineNumbers 'PATH TO SCRIPT'"] remoteExec ["spawn", _x];};
] forEach allUnits - entities "HeadlessClient_F";
#

Thats set up to spawn an sqf file on the specific player that has the name matching the "_name" value

oblique pewter
#

where do i put the sqf file

#

can this work for jips?

opal zephyr
#

jip compatibility depends on where you put the code I gave, what is your goal with it?

oblique pewter
#

adding scripts to players in zeus

opal zephyr
#

Are players getting zeus throughout the mission? Or just defined in 3den

oblique pewter
#

yes

opal zephyr
#

hm, might be an event handler you could leverage, or just do regular checks

oblique pewter
#

If i had steam id how owuld i do it

opal zephyr
#
_id = "767676545767676";
[
    if (getPlayerUID _x isEqualTo _id) exitWith {["compile preprocessFileLineNumbers 'PATH TO SCRIPT'"] remoteExec ["spawn", _x];};
] forEach allUnits - entities "HeadlessClient_F";
opal zephyr
oblique pewter
#

what if i want to play a sound for a specific player

opal zephyr
#

use playsound and remoteexec

somber radish
#

Anyone know how to make tasks (placed in 3den) available for all clients on a dedicated server?

#

A quick lil script or something?

acoustic abyss
thorn saffron
#

Question: if I remoteexec a script on a client and in that client side script I set a mission namespace variable, will that variable be set.for other clients as all?
I do not want to use profile namespace.

meager granite
#
{missionNamespace setVariable ["somevar", 123, true]} remoteExecCall ["call", _player2];
```Original remoteExec caller will end up having `somevar` set after some time
sharp parcel
#

Could use a hand with this code. I am getting an error

if (player isKindOf "B_mas_aus_recon_TL_F_ma" || player isKindOf "B_mas_aus_recon_medic_F_ma" || player isKindOf "B_mas_aus_recon_M_F_ma" then {
 player synchronizeObjectsAdd [Requester];
 BIS_supp_refresh = TRUE;
} else {
 player synchronizeObjectsAdd [Requester2];
 BIS_supp_refresh = TRUE;
};
thorn saffron
meager granite
thorn saffron
#

Ah, its the bool at the end. For some reason I thought it was JIP stuff. I completely missed it

meager granite
thorn saffron
#
_doTheThing = false;
{_doTheThing = true} remoteExecCall ["call", _player2];

I assume this should make it so scripts that run on _player2 side will have the value of _doTheThing return as true, while others will have it as false, right?

#

Ah, localNamespace is what I was looking for

meager granite
#

The variable is local in your example though, I guess you wanted global there

thorn saffron
#

No, I actually wanted a local variable, I just didn't explain it well enough.

meager granite
#

local variables visible only withing their scope, if you're remoteExec'ing something, it creates a new scope

#

Unless you're going to call something inside that remoteExec'ed scope that's gonna use that local variable

thorn saffron
#

I want to set a variable on one of the clients, but not others. In a way so other scripts executed by that client can read that variable

tough abyss
#

Never heard of that

barren fable
#

fixed it., had marker total as 185 and actually had 186.. duh

hallow mortar
#

Yes, you want a scope global variable but not a network global variable

manic sigil
#

Had a jimmy neutron brain blast moment.

Im making a more linear, story-heavy scenario with a full squad that the player can control at will, because I think A2 had the best writing even if A3s voice work is superior. Problem is, that means I need each character to have a line for each situation, depending on who is in control when they do A Thing, etc.

I had whole nesting sets of switch-dos to determine who did A Thing, select their proper name and their line for my dialogue system; even trying to keep it limited this was a dozen lines of code for two, three places in each event.

I also had a whole 'move a marker to track where a piece of intel was being carried', but I was using it several times so figured, time to functionalize it.

In the midst of recoding it, I realized I could use the initial location to Select from an array of responses for each character, instead of writing whole if-thens.

But where to put these arrays? I dont want to define it every time I call the function, so Id need somewhere discreet to place them that can be easily called upon, while only referencing the unit they're attached t-

...

So anyways each of the characters now has a "DialogLines" variable in their namespace, with an array of about a dozen and growing strings, and now I have to redo all of my previous code to replace whole blocks with '_talker getVariable's and everything is totally normal.

sharp parcel
#

hi there. I am using an edited version of GF Missions and I am noticing on each of the mission SQF's, there a ZEUS section of code that's generating errors. The code is

Zeus addCuratorEditableObjects [_Loc nearObjects 1000];

and the error is
Zeus addCuratorEditableObjects [_Loc nea>
21:17:19 Error position: <Zeus addCuratorEditableObjects [_Loc nea>
21:17:19 Error Undefined variable in expression: zeus

hallow mortar
#

It's looking for something with the variable name zeus (presumably a curator entity) and failing because there isn't one in the mission

manic sigil
sharp parcel
#

heavily edited and I'm just going through trying to find and fix errors. I've just added the variable name to a zeus module and will test.. Thanks so much for the input guys, really appreciate it. I've been searching for a working automated and dynamic mission generator and this is the closest I've managed to locate for sometime

sharp parcel
#

Thanks legends @manic sigil and @hallow mortar

manic sigil
#

Note, that will simply quiet the voices, it will not make the delusions go away.

Or, yknow, that merely made the errors stop reporting, youll have to do extensive testing to see if the actual results are stable and practical.

still forum
sullen sigil
#

Is there an engine way to create custom chat commands (#mycustomcommand)

#

Think I may be oblivious

still forum
#

CBA does it with script, chat eventhandler

sullen sigil
#

Ah that'll do thanks

frigid oracle
finite bone
#
player addEventHandler ["Fired", {
    private ["_shooter", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    _shooter = _this select 0;
    _magazine = _this select 5;
    _nearestObject = nearestObjects [_shooter, ["Door"], 2];
    _nearestSurface = lineIntersectsSurfaces [eyePos _shooter, eyePos _shooter vectorAdd (eyeDirection _shooter vectorMultiply 2), _shooter, objNull, true, 1, "VIEW", "FIRE", true];
    if (!isNil "_nearestObject" && (!isNil _nearestSurface select 3) && _magazine == "rhsusf_5Rnd_Slug") then {
        _door = _nearestSurface select 3;
        if (_door == _nearestObject && locked _door == 2) then {
            _door setVariable ["locked", 0, true];
            hint "Door Unlocked";
            [_door, 'Door_1_rot', 'Door_Handle_1_rot_1', 'Door_Handle_1_rot_2'] execVM "\A3\Structures_F\scripts\Door_open.sqf";
         }
    } else { 
        hint "Not near any door";
    }
}];
``` I am trying to get my if condition and door check working but get stuck with type conversion errors and divisible by zero erros when not near any surface.
winter rose
#

then take your code in the debug console, output variables as you go and see where the error is

finite bone
#

but i am in the right direction yes?

winter rose
#

no idea, that was not your original question

finite bone
#

basically im trying to open up a door when it gets hit by a shotgun slug (as long as the player is actively viewing the door and is within 2m of it)

winter rose
#

advice, do funnel your code

if (cond1) then
{
    if (cond2) then
    {
        if (cond3) then
        {
            // hadouken code
        }
        else
        {
            // failure
        }
    }
    else
    {
        // failure
    }
}
else
{
    // failure
};
```turns into```sqf
if (!cond1) exitWith { /* failure */ };
if (!cond2) exitWith { /* failure */ };
if (!cond3) exitWith { /* failure */ };

// stuff
finite bone
#

so this basically boils down into getting these two to work together: ```sqf
_nearestObject = nearestObjects [_shooter, ["Door"], 2];
_nearestSurface = lineIntersectsSurfaces [eyePos _shooter, eyePos _shooter vectorAdd (eyeDirection _shooter vectorMultiply 2), _shooter, objNull, true, 1, "VIEW", "FIRE", true];

winter rose
astral bone
#

what is a door

hallow mortar
#

It's a partition on a flexible mounting that can be moved to block or unblock an entryway, but that's not important right now

astral bone
#

no no, it's so much more then that. It's a symbol. ok anyway

wind hedge
#

guys, a call {}; inside a while loop won't exit the whole while loop right? sqf while {true} do { call { if !(alive player) exitWith {sleep 1}; if (damage player > 0.9) then {player setUnconscious true;}; }; };

winter rose
#

yep

wind hedge
#

I am rewriting some code and whish to improve upon but don't want to do the whole work if that exitWith inside the call {} doesn't work inside the while loop.

winter rose
#

more like "an exitWith inside a call inside a while" but yeah, only one scope

wind hedge
winter rose
#

that's still an ugly way to do so ๐Ÿ˜„

still forum
#

you want to skip one iteration, aka continue, so you can just use continue

#

IMO also easier to read

wind hedge
#

Ohhh I keep forgetting that continue is a thing! Thanks!

astral bone
#

ary # 0 is the same as ary select 0 right?

hallow mortar
#

Yes

astral bone
#

Yay.

wind hedge
astral bone
#

Also, is a default value always called for getVariable?
I wanna have it so if a variable is defined, use that, otherwise use a string.

(obj) getVariable ["something or other","Floor " + str((count _formatList) - _forEachIndex)]```
winter rose
#

yes, called

astral bone
#

hmm- probably won't matter for preformance, but any ideas on a way to improve it?

meager granite
#

There is getOrDefaultCall which addresses that, but its for hashmaps, not objects

astral bone
#

alright

#

plus there is the huge security risk of my elevator teleporting script

params["_plr","_floor"];
diag_log ("[ELEV_TELE]: " + str(_plr)+" _ "+str(_floor));
_plr setPosASL getPosASL _floor;
meager granite
#

Curious who needed it and why

winter rose
#

IDK, isn't it "just" everyBackpack backpackContainer _unit?

#

aaah no, maybe someone can have a backpack inside a vest or something

#

"ok"

hallow mortar
#

items and magazines don't include backpacks in inventory, so if a player had extra backpacks in their pocket (some "backpack" items are pretty small, leg strap bag etc), there was no way to detect it

meager granite
winter rose
#

yeah that ^^

hallow mortar
#

Does that even work? The docs for everyBackpack imply it only works on certain types of cargo space

meager granite
hallow mortar
#

I don't remember seeing it on FT, so it's probably CDLC stuff. I wouldn't be surprised if SOGPF adds individual pouches as backpacks or something

meager granite
#

๐Ÿค”

finite bone
# winter rose `nearestObjects [_shooter, ["Door"], 2];` doors are not objects

Finally got it working as intended sqf player addEventHandler ["Fired", { private ["_shooter", "_magazine"]; _shooter = _this select 0; _magazine = _this select 5; _houses = nearestObjects [_shooter, ["house"], 10]; if (count _houses > 0) then { _house = _houses select 0; // _shooter sideChat format ["Nearest House: %1", _houses]; private _intersects = []; { _intersects = ([cursorObject, _x] intersect [ASLToATL eyepos _shooter, (screentoworld [0.5,0.5])]); if (count (_intersects select 0) > 0) exitwith { _intersects } } forEach ["FIRE","GEOM","VIEW"]; // _shooter sideChat "Found Intersect"; if (count _intersects > 0) then { _intersect = _intersects select 0 select 0; _dist = _intersects select 0 select 1; // _shooter sideChat "Checking _is_door"; _is_door = [false,true] select (["door",_intersect] call BIS_fnc_inString); // _shooter sideChat "Checking _magazine"; if (_is_door && _dist < 3 && _magazine == "rhsusf_5Rnd_Slug") then { // _shooter sideChat format ["Breaching Door: %1", _intersect]; _select_door = format ["%1_rot", _intersect]; // _shooter sideChat "Animating"; _house animate [_select_door, 1,false]; }; }; }; }];

winter rose
#

exitWith
but GJ!

astral bone
#

uh- any idea on how to rotate a group of objects by .012 degrees? ๐Ÿ˜… I accidently rotated a composition and now I wanna rotate it back. xD
I'm guessing I'd need to use coding to do it

winter rose
#

Ctrl+Z

astral bone
#

yes but I had done this in another map

#

then copied it, and then realized "Oh hey, everything is actually off by .045 degrees :]

astral bone
#

that's not percise enough xD

proven charm
#

how do you even noticed so small change? ๐Ÿ˜„

astral bone
#

I have OCD :P

#

It's better atleast so-

proven charm
#

0.1 seems to be the minimum and thats soo small change

sullen sigil
#

0.1 isn't a very small change

proven charm
#

IMO in rotation it is..

sullen sigil
#

wheres that duck with sunglasses meme

winter rose
#

offset by -0.145 then by +0.1 ๐Ÿ˜„

sharp grotto
#

Can you use a normal .paa resource for a map marker without creating a mod for the markerCfg ?

winter rose
#

no, but you can use drawIcon

winter rose
#

it means the benchmark stopped to avoid risking taking too long and potentially blocking the game

granite sky
#

uh, depends. Some operations are unavoidably slow in SQF.

#

That is a command that you should not be doing in realtime.

#

Any sort of high-frequency checking.

#

I can't imagine why you'd need to get an array of every map object within 4km of the player anyway.

hallow mortar
#

player nearObjects 4000 is extremely broad. You should at least filter it down to only look for MissileBase type objects.

meager granite
#

If yes, then you can build an array and inAreaArray it when needed

granite sky
#

Fired EH on vehicles seems like an acceptable solution.

#

Well, you can also dump all the missile into an array and then inAreaArray on the CIWS.

#

There won't be many missiles at once, I imagine.

#

I mean just have a global array of active missiles that you add them to when fired.

#

And then the CIWS monitor loop can do globalMissileArray inAreaArray [_ciwsPos, 4000, 4000]

#

It's fast. But which way around you should do this depends on how many ciws you have and how many missiles.

#

inAreaArray takes an array that you made yourself.

#

It's not like nearObjects or nearEntities.

real tartan
#

is there a way to determine if weapon attachment is source of light ( laser or light ) via config ?

granite sky
#

checked the type-filtered nearObjects but it's not much faster. Likely normal for the isKindOf filtering.

hallow mortar
#

It's probably bad that I do nearObjects ~3 times every check, per vehicle, for my APS then ๐Ÿค”

granite sky
#

Certainly sounds like it :P

hallow mortar
#

Only 80m radius though, and no noticeable issues on Livonia with ~20 active tanks, so I'm not rewriting it now :U

granite sky
#

oh yeah, 80m is fine.

frigid oracle
#

Just use nearObjects to do a 1 time cache into a table so you have all the missiles you need indexed for faster checks?

granite sky
#

are you joking...

sullen sigil
#
mymissiles = [];
{
  if (_x isKindOf "missile") then {mymissiles pushBack _x};
} forEach allMissionObjects``` ๐Ÿ™‚
granite sky
#

plz stahp :P

hallow mortar
sullen sigil
#
{
  private _namespace = _x;
  {
    _namespace setVariable [_x, 0, true];
  } forEach allVariables _x;
} forEach [missionNamespace, parsingNamespace, uiNamespace, localNamespace, profileNamespace, serverNamespace, missionProfileNamespace];``` run for better fps ๐Ÿ™‚ (please dont)
meager granite
tough abyss
tough abyss
astral bone
#

There's no way to remove a userAction from a door right?

#

I wanna have a door I can lock, but the door's modded and doesn't "come with a lock"

tough abyss
proven charm
astral bone
#

what if I change simulation-

proven charm
astral bone
#

the door is a modded door. Other doors in the mod, simulation disabled means they don't show the open/close options.
But never tried it mid-game

little raptor
#

another way is creating simple objects

astral bone
#

simulation does not work on these doors :I

#

ok, energy shield I guess xD

little raptor
astral bone
#

I needa be able to do it mid-game :P

#

I could replace them with the static version, but then if it's opened and I tell it to lock, then it wouldn't animate.

sullen sigil
#

does the static version still have the animationsources

#

alternatively you could always make a compat if you want to make a mod but thats probably a massive pain

modern meteor
#

I assign a target to my AI squad and order to Fire. If I want to abort the attack and force the AI squad to stop firing then what is the best and most reliable way to do that? It seems like combatmode Green or Blue and ForgetTarget is not enough hold fire.

modern meteor
#

I tried the code below but it does not stop them from attacking a manually assigned target. Any ideas?

{
_x doTarget objNull;
_x doWatch objNull;
_x commandWatch objNull;
_x setCombatMode "BLUE";
}forEach (units group player);
granite sky
#

remove their magazine :P

#

Does it stop eventually with setCombatMode "BLUE"?

brisk lagoon
#

Hey so I want to attach a flag pole to a vehicle in the corner of it, how do I find what is the required X and Y for the positioning?
I tried to attach it without X,Y,Z but it just in the air

granite sky
#

You want a general solution or a vehicle-specific one?

brisk lagoon
granite sky
#

In that case just find a good point for those vehicle types and hardcode it.

viral birch
#

Anyone familiar with creating modded intro scenarios that play in the background of the main menu? Got mine working, but when I hit the Back button after opening Multiplayer, the scenario breaks/gets lost instead of continuing. Any ideas?

brisk lagoon
opal zephyr
brisk lagoon
#

Gotcha thanks!

wind hedge
#

Guys, anyone knows the radious of sqf getEnvSoundController 'shooting', example usage: sqf (((position _x) getEnvSoundController 'shooting') < 0.9) || // recent firing around position

#

"around position"... how large around? ๐Ÿ˜…

meager granite
#

Wish there was a way to JIP queue remoteExecCall, without broadcasting to current clients

#

Only to future ones

south swan
#

If you only care about code not being executed - you can broadcast the "don't actually do it" variable to the current clients first tanking

meager granite
#

You can do that with isRemoteExecutedJIP check

#

But I just don't want to send huge array each time I add an item to it

#

Actually I wonder if changing an array\hashmap after JIP broadcasting will send original or updated version to JIP? ๐Ÿค”

#
hs = createHashMapFromArray [[1,2],[3,4]];
hs remoteExecCall ["something", 0, true];
//...some time later...
hs set [1, 100];
```What will client get after JIP? `[[1,2],[3,4]]` or `[[1,100],[3,4]]`? ๐Ÿค”
south swan
#

Some derping around with clients actively requesting the array may also work

meager granite
#

Yeah, having clients request the array from server themselves would be a solution too

manic kettle
shut carbon
wind hedge
#

The value goes from 1 when no shooting happens around and then to 0.X depending on how heavy/long the nearby shooting is... What I don't know is the distance of that "nearby" area...

#

Also I don't know if the command considers the source of the firing (the unit firing) or the impact location of the bullets or both?

shut carbon
#

i think it's broken

#

position doesn't matter, it always evaluates from player.

#

it does however not activate if you're too far away from the sound, so that distance is evaluated, yes, somehow.

manic kettle
#

I'm having an issue where game master modules are breaking mid mission. It's inconsistent so it's hard to pin down the cause

Does anyone know code to assign curator to players mid mission?

granite sky
#

Run as local to assign yourself:
[player, allCurators#0] remoteExec ["assignCurator", 2]

#

It's a fiddly command because it needs to run on the server.

modern meteor
bronze mulch
#

The AI has init

[this] spawn movement;

where movement is the script below

while {alive _self} do {
    //When it is not dead
    {
        //Return the visibility between player and the anomaly
        _canSee = [objNull, "VIEW"] checkVisibility [eyePos player,eyePos _self];
        if (_canSee > 0.7) then {
            //Disable AI movement when it is seen by player
            _self disableAI "MOVE";
            systemChat "Disable AI MOVE";
        } else {
            //Enable AI movement when it is not seen by player
            _self enableAI "MOVE";
            systemChat "enableAI MOVE";
        };
        //Repeat this for every player in the server
    } forEach units player;
}

This is suppose to stop the AI from moving when a player is looking at him. It works when there is objects or particle blocking the sight. However it doesn't consider where the player is actually look at. I would want the AI to start moving when player turn around. How may I do it?

wind hedge
# shut carbon position doesn't matter, it always evaluates from player.

if it always evaluates from the player, then running a fnc on the server for ai units like this: sqf VAL_fn_unitsInCombat = { private _unitsInCombat = []; _unitsInCombat = (units _this) select { !(isNull (getAttackTarget _x)) || // Ai has target (((position _x) getEnvSoundController 'shooting') < 0.9) || // recent firing around position Ai unit !((getSuppression _x) isEqualTo 0) // Ai unit being shot at }; _unitsInCombat }; private _unitsInCombat = []; _unitsInCombat = _group call VAL_fn_unitsInCombat; if (_unitsInCombat isNotEqualTo []) then {{_x enableAi "ALL"} forEach units _group;}; won't truly work as intended.

#

But will work if run on the client for Ai units in the player's group

vital hawk
#

Hey guys, i'm trying to add some custom factions to Zeus, but i'm totally new to this. I was able to get the required tools and open up the config. I added the correct unit name to the CfgPatches, but they dont seem to show up.I'm sure there must be a missing step. Any help?

stable dune
stray flame
#

hey so if there are things like

onPlayerKilled.sqf and onPlayerRespawn.sqf

is there any equivalent for player going unconscious/ revive state?

#

I have a few scripts set up that gives players their loadouts on respawn that they died with. And One mod takes away all mags when in revive state meaning if they die and respawn they wont have any mags. If I could get it to save loadout when the player goes down I belive that could fix it

bronze mulch
modern meteor
#

To assign a target to an AI unit with the doTarget command is easy. The AI will continously aim at the target until it's destroyed. But I've not found any command to unassign it if the target is still alive, like the radio command "no target".
Is it possible anyway ?

sullen sigil
#

does using objnull work

stark fjord
modern meteor
stark fjord
#

You could run assignedTarget and getAttackTarget in a loop and unassign them until both of them return objNull, like commandWatch objNull

brisk lagoon
#

can someone tell me, on ORBAT group description, what is the line for the background while viewing the group? is it
"texture =" or "Insignia =" ?

winter rose
winter rose
#

it's evil

stable dune
#

I was about asking have he talked with chatGpt, he's code doesn't make sense , or does in sqf _self is equal to _this.
Because he doesn't use params like

params ["_self"];

And code will run pretty fast without sleep and units player doest either make sense.

winter rose
#

"did chatGPT give that to you?" ๐Ÿ˜

stable dune
#

Yeah, better

winter rose
#

mb ๐Ÿป

little raptor
#

But if it's an enemy you can't stop them from firing because they retarget it

#

You can set their combat mode to "blue" but they won't attack anyone else either

brisk lagoon
#

class CfgORBAT
{
class HQ
{
id = 0;
idType = 0;
side = "East";
size = "Squad"
type = "HQ";
insignia = "orbat\Iraq.paa";
commander = "UNKNOWN";
commanderRank = "Captain";
text = "Free Iraq Military HQ";
textShort = "Free Iraq HQ";
description = "The seadquarters squad of The Free Iraq Military, lead by current unknown commander";

         class 1stArmor
         {
                     id = 1;
                     idType = 0;
                     side = "East";
                     size = "Division"
                     type = "Armored";
                     commander = "UNKNOWN";
                     commanderRank = "Lieutenant";
                     text = "%1 Free Iraq Platoon %3";
                     textShort = "%1 %3";
                     description = "1st Armor Platoon lead by current unknown commander";
         
         subordinates[] = { TEST };
                     
         class TEST
         {
                     id = 1;
                     idType = 0;
                     side = "East";
                     size = "Squad"
                     type = "Armored";
                     commander = "UNKNOWN";
                     commanderRank = "Sergeant";
                     text = "TEST";
                     textShort = "TEST";
                     description = "TEST";
         };
     };
 };

};

#

I am fairly new at this so take it easy on me ๐Ÿ˜…

#

I am trying to end up with something like this eventually

warm hedge
#

Make sure you saved the Description.ext on Eden Editor

brisk lagoon
#

I did ๐Ÿ˜ฆ

warm hedge
#

It does not saved/loaded everytime you change Description.ext but when you save the mission in Eden Editor

brisk lagoon
#

I will try to load the mission again

warm hedge
#

No need to load

#

Just save

modern meteor
warm hedge
#

(Weeelll load will do the same thing but Ctrl+S simply do it)

brisk lagoon
#

it doesn't appear

#

I have no clue what I am doing wrong

warm hedge
#

subordinates[] = { 2ndBCT }; // Subordinates, searched on the same level as this class.According to BIKI you don't need to have subordinates[] = { TEST };

brisk lagoon
warm hedge
#
{
    class First
    {
        class Second_A
        {
        };
        class Second_B
        {
            class Third_A
            {
            };
            class Third_B
            {
            };
        };
        class Second_C
        {
        };
    };
};```Basically idea is this
brisk lagoon
#

ohhhhhhhhhhh

#

ok cool, let me try that real quick just to make sure I got it completely

brisk lagoon
warm hedge
#

No idea what you tried to create so can't say

brisk lagoon
#

(I need 2nd DIV to be separated)

warm hedge
#

Separated as in?

brisk lagoon
#

on the same row as 1st DIV, and the test squad under 1st div

warm hedge
#

Show me the config

#

Wait you already do

brisk lagoon
#

How do I share like xml of the code or something? I know you can do it I forgot how

#

yeah haha in the link there

warm hedge
#

Am I okay to overwrite what you got entirely?

brisk lagoon
#

yeah of course

#

it will help me learn this correctly

warm hedge
#

Firstly please do indent very carefully

#

Your indent before was very confusing

brisk lagoon
#

Yeah this is actually like the third time I am doing this so ๐Ÿ˜…

warm hedge
#

Therefore... you can see what's wrong with it

brisk lagoon
#

Yeah true

brisk lagoon
warm hedge
#

This is what you mean?

brisk lagoon
#

Yes haha

warm hedge
#

Added the comment

brisk lagoon
#

I am still having trouble, I am too stupid for this, quick question though
when I move back the class line, do I need to move everything below it as well?

#

or just the class line

winter rose
#

it helps you see what is inside what

warm hedge
#

This but VEEEEERY required/good to have habit

#

Most of the times/software you can select multiple lines and press Tab or Shift+Tab to make entire lines go up or down

winter rose
#

thiscpp class A { class A1 { class A1_1 {}; }; class A2 {}; }; or```cpp
class A
{
class A1
{
class A1_1
{
};
};
class A2
{
};
};

warm hedge
#

Bad boo, Lou bad you have no clue how to make a good code boo

#

vs

#

Oh not so bad

winter rose
stark fjord
#

Does anyone know more about knowsAbout what is the magic number in arma3?

In my testing, when it reaches 1.5, ai knows something is off and starts returning fire in general direction of a player or scans the area, but doesnt actually know where player is. At value >2 Ai will defo know where player is and start engaging player. If player is hit during that time value will climb to 4 instantly.

brisk lagoon
#

I literally want to get my head through the wall because I don't get it

#

it sounds simple

#

but I just cant get ittttttttttttttttttt

brisk lagoon
#

so it doesn't matter?

winter rose
#

I prefer the Allman style, bracket below

warm hedge
#

Unrelated:

private _isTheConfigDefinedInTheCfg = {
    params ["_cfg","_property"];
    if (!isClass _cfg) exitWith {false};
    count configProperties [_cfg,"configName _x == _property",false] != 0
};

[configfile >> "CfgGlasses" >> "G_Sport_Blackyellow","name"] call _isTheConfigDefinedInTheCfg;
[configfile >> "CfgGlasses" >> "none","name"] call _isTheConfigDefinedInTheCfg;```Is there any way to make it smarter to detect if the property is defined in the config? The expected return is `false` and `true` in this context
warm hedge
hallow mortar
# brisk lagoon so it doesn't matter?

Arma doesn't actually care about the arrangement of whitespace and line breaks (except inside strings); you can do it however you like and it will work. The purpose of doing it in a particular style is to make it human-readable.

warm hedge
stark fjord
# brisk lagoon got it

You can do it all in one line if you want ๐Ÿ™‚ class A{class A_A {};class A_B{};}; spaces/newlines/tabs are just for easier human readibility, machine doesnt care, this isnt python (thank god)

paper ridge
#

Not sure if I've used the wrong terminology in my searches, but I can't find much information about the disabling of cameras in vehicles via scripting (not by config). Specifically, I'm trying to disable the camera that pilots have access to in certain jets ie the vanilla wipeout. Any pointers in the right direction would be helpful, cheers.

modern meteor
#

Can someone remind me how to clear the audio backlog when using disableAI "RADIOPROTOCOL"?

brisk lagoon
#

the other 2 units disappeared

warm hedge
#

Oh no, you have broke it again notlikemeow

brisk lagoon
#

I don't know what I am doing wrong, I really don't ๐Ÿ˜ญ

warm hedge
#

I sorted it out

brisk lagoon
#

trying

#

still the same

#

๐Ÿ˜ฉ

#

now it doesn't appear at all, I think if I do this "};" after a class

#

it won't read the rest

winter rose
brisk lagoon
#

Ok I managed to make all the units again, but they are in one column still, instead of 2
(I am trying to get A Squad under 1st Div, and 2nd Div on it's own under HQ

#

I am sharing the code in a sec

winter rose
#

well yeah, you got all under one class

brisk lagoon
#

I deleted the row so it will be under HQ

#

and it still didn't do it

hallow mortar
#

You are starting classes, using {, but never ending them, so it's being read as everything being subclasses of the first class

#

Or, well, you are ending them but after everything else, rather than where they should be ended

brisk lagoon
#

Ok I think I get what you mean, so I am supposed to close the A squad class in that case?

winter rose
#

yeah
your current classes are like that (I removed the noise):```cpp
class CfgORBAT
{
class HQ
{
class 1stArmor
{
class AlphaSquad
{
class 2ndArmor
{
};
};
};
};
};

#

so at one point you need to close HQ and open AlphaSquad ๐Ÿ™‚ like this```cpp
class CfgORBAT
{
class HQ
{
class 1stArmor
{
};
};

class AlphaSquad
{
    class 2ndArmor
    {
    };
};

};

brisk lagoon
#

Ok I was about to ask if I did it correctly but when I paste the code to pastebin it doesn't look right

#

all the spacings are weird, and on Notebook ++ its looks normal

#

was I doing something wrong this whole time? maybe how I write it? lol

still forum
#

maybe you're mixing tab's with spaces

#

press that button.
Tabs are arrows, spaces are dots

brisk lagoon
#

so this is how my notebook ++ looks like

#

And that's here

still forum
#

Usually you decide for one style
either only tabs, or only 2-space indent or 4-space indent

#

yeah you're mixing tabs and spaces

brisk lagoon
#

oh... lol

still forum
#

The width of a tab, depends on the editor/tool/website you view it in.
A tab may be 4 spaces wide, or 2 spaces, or in case of pastebin apparently 8 spaces wide

brisk lagoon
#

is there a way to fix it, or I need to do it manually for each line now?

hallow mortar
#

In Notepad++ you can select a block of lines and tab them (or untab them) all at the same time

#

So select everything, shift+tab until it's flat, then select blocks and apply the correct number of tabs

#

Also, if you go to Settings > Style Configurator, select C++ in the Language box, and add ext in the User Ext. field, you'll get syntax highlighting in description.ext

brisk lagoon
#

Ok yeah I fixed it thanks

#

reminder (I am trying to get A Squad under 1st Div, and 2nd Div on it's own under HQ)

#

oh wait, I sapced 2nd div too far by accident

hallow mortar
#

Well you've put Alpha inside 2nd Div, not 1st Div, and 2nd is now a top-level element and not under HQ

brisk lagoon
#

oh oops you right

hallow mortar
#

I think there might be a few more organisational levels between Squad and Division btw

brisk lagoon
#

no yeah I am aware this is all testing because I have no idea how to do that haha..

#

I fixed it ( I think)

#

but it still doesnt do what I want it to do

#

now only hq and 1st div shows

hallow mortar
#

There is probably a }; in the wrong place, but I can't see the new code so I don't know where

brisk lagoon
#

updated the code now

#

maybe the one that closes the HQ?

#

do I need to delete it?

#

(I have no idea what I am talking about btw, I am a rookie lol)

hallow mortar
#

You don't need to delete it, you need to move it to after the close of 2nd Div, because currently you close HQ and leave 2nd Div outside it

#

Also, Alpha is still in 2nd Div

brisk lagoon
#

ahhhh frick, let's keep it there for now, I want to first separate the divisions

brisk lagoon
#

to the bottom I mean

hallow mortar
#

You need to move the }; that closes HQ to after the }; that closes 2ndArmor, so that 2ndArmor is contained within the HQ class

brisk lagoon
#

ALMOST THERE ๐Ÿ˜ฎ

#

I messed up something though

#

lol

#

maybe, A squad needs to go after 1t div line?

#

so right now the class is under 2nd div, but same column as 1st div

hallow mortar
#

The horizontal spacing in Notepad++ is for human readability and does not influence how the game interprets it

brisk lagoon
#

oh ok

#

oh

#

I am stupid

#

I did 2nd div as a squad and A Squad as Divison

#

lmao

winter rose
hallow mortar
#

The config classes follow the same hierarchical structure as what is displayed in the end, it's just...sideways, compared to the game's visual presentation

brisk lagoon
#

I DID IT YAY

#

my goodness, it took me one hour and a half, I really REALLY appreciate all your help and patience

#

all of you that helped me, thank you sincerely

#

now time to test more stuff with it and hopefully not break it

winter rose
kindred zephyr
sullen sigil
#

contact, all man, 100m, front

brisk lagoon
#

Look DAD(s) I AM DOING IT ALL BY MYSELF

brisk lagoon
hallow mortar
#

You have added 47th platoon as a subclass of the 22nd platoon, and 99th platoon as a subclass of 47th. Since I assume platoons are not meant to be subunits of other platoons, what you should do is add each of them as a parallel subclass of 1st company - the same way you previously had the 1st and 2nd divisions as parallel subclasses of the HQ.

brisk lagoon
#

ohhh

hallow mortar
#

(Note: platoons are typically numbered within their company, so you would have, say, a separate 1st through 4th platoons within each company, and never reach numbers like 99)

brisk lagoon
#

You are completely right I thought about making regiments and in the same time created platoons

brisk lagoon
#

that's what I did

sullen sigil
#
class platoon1;
class platoon2;
class platoon3;
//instead of what you are currently doing, which is:
class platoon1 {
  class platoon2 {
    class platoon3;
  };
};```
hallow mortar
#

No, don't do that

#

This is correct, it's a hierarchical structure that's supposed to have subclasses

#

I mean it's a little bit wrong but mostly correct

sullen sigil
#

as in for the platoons

hallow mortar
#

Move everything in the 1st company class right by one tab. This is not a functional thing, but it will help you to see that the 1st company is at the same level as the command squad, and that you have closed the 1st company class but not the FIM class.

brisk lagoon
#

beautiful ๐Ÿ˜„

#

thank you

#

Ok now I will try to expand with another unit and will try to add assets as well

digital hollow
bronze mulch
#

But isn't cursorObject needs to be exactly pointed at the AI?

digital hollow
#

ah, you want (in field of view) and (not obscured)?

bronze mulch
#

Yes, similar to scp-173 if you know the reference

winter rose
stark fjord
#

A very complicated way would be using eyeDirection +-90 degrees and check if player is facing ai. But youd have to do this locally on each client and then compile all results on machine local to ai and then decide to move it or not

#

And youd still have to test LOS

winter rose
#

I would:

  • run checks on each player (let's trust player's machines sometimes!)
  • if the player view changes, have it call a function on the server with remoteExec
  • make the server do all the stuff through that function
bronze mulch
#

I think I'll look into the eyeDirection function after my arma 3 game since that seems a more direct and easy approach. It's good to see that it works even in A2 tho. Now I know it must work in A3.

brisk lagoon
#

ok so

#

I thought it will be easy because I figured it out but now I am missing something again

#

I need the motorized infantry separate as well

#

I tried to type the class below the 1st armor co. and it didn't work

#

I tried also to do it after the 1st armor co. and the Pt's. and it didn't work

bronze mulch
hallow mortar
winter rose
#

Welcome aboard the mad train!

brisk lagoon
#

I am actually figuring it out, I am getting excited like a kid in a candy shop hahaha

bronze mulch
#

Sure it is a mad train. Had to spend 30 minutes just to call a function I wrote ;D

stark fjord
# bronze mulch I'll look in to this flow later. Since I just started learning scripting in Arma...

Id do:
Server would remoteExec a function on all clients in theoretical view distance, that function would check, every N time:
If player is facing general direction with eyeDirection +- FOV/2
If that passes id then run:
[objNull, "VIEW"] checkVisibility [eyePos player, getPosASL _veryNotMovingAi] != 0 (or some threshold like 0.1)
remoteExec result true/false on server into a function which would control AI movement, containing array of all players and true false visibility check. If any is true then hold AI if all are false do movement.

hallow mortar
bronze mulch
brisk lagoon
#

now the only thing I am curious is how do I replace the logo (Top logo)
and add a logo to the background

winter rose
#

what does the doc say? ring-ding-ding-ding-ding-diding

winter rose
brisk lagoon
#

so I will surprise you now, I did it haha

The Insignia worked, but it didn't replace the top logo, it added a picture under text when you hover it

#

and the texture, in the bottom of the page it says it needs a directory path

#

and I tried it and it didn't work as well, probably did something wrong

winter rose
#

nah, it is explained at the bottom of the page
use __EVAL

brisk lagoon
winter rose
#

nooo no no no nooo

#

try this please?```cpp
__EVAL(getMissionPath "someFolder\SomeImage.paa");

brisk lagoon
#

So this did change the top logo, but no background still

#

and I do have insignia

#

so I wonder what is missing

#

Ah whatever, not first priority for now, I will try to add assets to the unit now

#

Does the end of this line supposed to be } or }; ?

assets[] = { CFP_O_IQARMY_T55_01, 2 }, { CFP_O_IQARMY_T72_01, 2 }

#

or I might not even type it correctly

hallow mortar
#

As the documentation shows, the line is ended with the line end character, ;

proven charm
#

put another pair of {} assets[] = {{ "CFP_O_IQARMY_T55_01", 2 }, { "CFP_O_IQARMY_T72_01", 2 }};

brisk lagoon
#

trying

proven charm
#

and quotes

brisk lagoon
#

uhm

#

ohh

#

never mind

#

I missed a bracket

#

it works, thanks!

brisk lagoon
#

I am here yet again because I am missing something, sorry in advance lol

so I did it for each of the Motor Squads, and it shows that only on the third one, any clue why?

hallow mortar
#

This is hypothetical because it's not documented, but it could be that the ORBAT viewer expects assets to be detailed at the lowest possible level on the chart. For example, if you list a tank company and all its platoons, the tanks would be shown at the level of the platoons where they're assigned, not at the company level.
Since you've set up your 2nd and 3rd squads as sub-units of the 1st, it probably thinks that's what you're doing.

agile cargo
#

I'm trying to use BIS_fnc_guiMessage that is called upon clicking a RscButtonMenu that I created and added in the escape menu (RscDisplayInterrupt). The issue is that it just crashes the game. I tried using spawn , but it still just crashes...

fnc_sendReview.sqf
private _editBox = uiNamespace getVariable [QGVAR(sendBoxCtrl), controlNull];
private _listbox = uiNamespace getVariable [QGVAR(sendBoxListboxCtrl), controlNull];

if (isNull _editBox || isNull _listbox) exitWith {};

private _message = ctrlText _editBox;
if (_message == "") exitWith {};
[] spawn {
    _result = ["Are you sure? You won't be able to send a new review during this playthrough of this mission.", "Confirm", true, true] call BIS_fnc_guiMessage;
};

playSound "3DEN_notificationDefault";
class ga_adminMessages_sendBoxButtonBase: RscButtonMenu {
    ...
    action = QUOTE(call FUNC(sendReview));
    ...
};
#

It works if I call that same piece of code from the debug console

fleet sand
hallow mortar
#

It is executed in scheduled in the code they posted

agile cargo
#

yeah, it is inside a scheduled env ๐Ÿ˜•

proven charm
#

put a sleep 3 before the BIS_fnc_guiMessage call ๐Ÿค”

toxic jungle
#

Can anyone tell me why I get this error when executing this function:
_psrTechnicalSpawn = createMarker position player; _psrM2H = createVehicle ["B_PSR_M2HB_High", getMarkerPos "psrTechnicalSpawn", [], 0, "NONE"]; _psrM2H disableCollisionWith this; _psrM2HPos = [0,-1.4,0.68]; _psrM2H attachTo [this, _psrM2HPos]; createVehicleCrew _psrM2H; createVehicleCrew this;
despite the code working flawlessly when put into the init field of a 3den object?

#

I'm trying to get it to execute through event handlers every time a certain unit is created

fleet sand
hallow mortar
#

In an Editor object's init field, this is a magic variable that refers to the object in question.
In other contexts (such as event handler code), this can mean something else or nothing at all

velvet merlin
brisk lagoon
velvet merlin
#

we are trying to draw a frontline on the 2d map using map markers
plus to fill the area "inside"

however we didnt manage a more complex frontline as we cannot figure out how to define the area if a point is twice on the y axis

or in general terms how to define an area (or better multiple) that should be filled with a different color inside?

agile cargo
#

what different approach would you suggest? I need something to prompt the user and I do need to get a response from that

#

note that this is running when the escape menu is open

willow hound
agile cargo
#

there are multiple pause menus, they all have the same id? (RscDisplayMPInterrupt, RscDisplayInterruptEditorPreview, RscDisplayInterrupt, RscDisplayInterruptEditor3D, RscDisplayMovieInterrupt)

willow hound
velvet merlin
#

with findDisplay you need to determine the context you are in

velvet merlin
fleet sand
willow hound
final vessel
#

And besides, that code is not on github

fleet sand
# velvet merlin yep, but using Python and "advanced" libraries - not in pure sqf ๐Ÿ˜ฌ

Oh didnt see the code is not on github but here is also a good thread for a "Fog of war" myb you could also use this https://forums.bohemia.net/forums/topic/232213-bearing/?tab=comments#comment-3427907 for map markers frontline filling.

grim belfry
#

any script for import objects to editor ?

final vessel
velvet merlin
velvet merlin
#

yeah was quite an impressive project by the engineer guy

final vessel
final vessel
brisk lagoon
#

Bro what the hell, I some how managed to break the file without touching anything/

willow hound
brisk lagoon
#

If I would have lost all of that I would gave lose my mind

#

actually no

#

I didn't figure it out

#

did I just lose all my progress that I made in that scenario?

grand stratus
#

I have no way to really test this, I'm curious if using getPlayerVoNVolume _unit will return 0 when used on a player you have 'muted' via the player menu. If a player mutes someone ingame, I also want to hide all the chats they send as well, and I'm curious if checking getPlayerVoNVolume == 0 would be a quick and easy way to accomplish this.

brisk lagoon
#

I think it something related to the ORBA file, because it saved when it was out of the folder

#

I found the problem god this game is so stupid, I had a # in the file somehow

little raptor
#

this game is so stupid, I had a #
yep that's the game's fault alright

#

your iconText or iconType function is not returning anything

wind hedge
#

Guys, most modded solutions found on the workshop for the very common "Ai units firing though walls" use a combination of linesIntersectWith and/or onEachFrame and other loops on every unit which seem very expensive. Can something like that be achieved with the "EpeContactStart" Event Handler for a less performance intensive solution. Here is what I got so far: sqf VAL_fn_epeContactStart_Ai = { params [ ["_unit", objNull, [objNull]] ]; if !(local _unit) exitWith {false}; if !(alive _unit) exitWith {false}; if (isPlayer _unit) exitWith {false}; _unit removeAllEventHandlers "EpeContactStart"; _unit addEventHandler ["EpeContactStart", { params ["_unit", "_object", "_selection1", "_selection2", "_force", "_reactForce", "_worldPos"]; if !(alive _unit) exitWith {_unit removeEventHandler ["EpeContactStart", _thisEventHandler];}; // optimization if (_object iskindof "building"๏ปฟ) then { if (_unit call VAL_fn_isTouchingBuilding_Ai) then { _unit disableAI "WEAPONAIM"; private _contactPos = getPosATL _unit; 0 = [_unit,_contactPos] spawn { params["_unit","_pos"]; waitUntil {sleep 1; (!alive _unit || _unit distance _pos > 2)}; _unit enableAI "WEAPONAIM"; }; }; }; }]; true };

#

and

#
VAL_fn_isTouchingBuilding_Ai = {
    params [
        ["_unit", objNull, [objNull]]
    ];
    if !(local _unit) exitWith {false};
    if !(alive _unit) exitWith {false};
    private _building = nearestObject [_unit, "building"];
    if (eyePos _unit distance _building > 2) exitWith {false}; // clearly not touching the wall
    private _touchingWall = false;
    private _relPos = _building worldToModel (getPosATL _unit);
    private _boundingBox = boundingBox _building;
    private _min = _boundingBox select 0;
    private _max = _boundingBox select 1;
    private _relX = _relPos select 0;
    private _relY = _relPos select 1;
    private _relZ = _relPos select 2;
    call {
        if ((_relX > (_min select 0)) and (_relX < (_max select 0))) exitWith {_touchingWall = true;};
        if ((_relY > (_min select 1)) and (_relY < (_max select 1))) exitWith {_touchingWall = true;};
        if ((_relZ > (_min select 2)) and (_relZ < (_max select 2))) exitWith {_touchingWall = true;};
    };
    _touchingWall
};
little raptor
#

no

wind hedge
little raptor
#

it won't work on units
and I don't see how that's related to shooting thru walls?

#

and I doubt anyone can fix it because those commands use the same algorithm

wind hedge
little raptor
#

oh that's what you mean by firing thru walls
well it still won't work because units are not PhysX objects so they won't ever make Epe contact with anything

wind hedge
little raptor
#

and I've seen it a lot

wind hedge
#

Attaching a small physixs enabled item to the unit could make epe contact fire? If there is such object of course

wind hedge
little raptor
#

then that attaching will waste performance blobdoggoshruggoogly

brisk lagoon
wind hedge
little raptor
wind hedge
#

It isn't released yet, right?

little raptor
#

I guess I can teach the inferior way ๐Ÿ˜…

#
onEachFrame {
  someAI setVelocity [0,0, -1]
}
#

AI won't be able to pass thru walls with that

#

but if you use it like that they will wobble on slopes

#

so you can try it like this too:

if (isTouchingGround someAI) then {someAI setVelocity [0,0, -1]};
little raptor