#arma3_scripting

1 messages Β· Page 505 of 1

still forum
#

external includes are not found

drowsy axle
#

Right, so I can still make a mission in the editor?

#

and it works.

still forum
#

yeah

drowsy axle
#

Oh lol.

#

Do they plan to fix it?

still forum
#

but if you want external includes in description.ext you have to copy it into the mission pbo

#

Well the bug existed for over 2 years now sooooooooooo...

drowsy axle
#

Oh

#

shit

still forum
#

Or was it 3 years? Basically since 3DEN release

drowsy axle
#

Like, it would be sooo cool. To have all my functions and shit in one mod, so that any mission or person could reference that function/file

still forum
#

You mean when the concept of a preprocessor was created? That was in 1960s

#

To have all my functions and shit in one mod, so that any mission or person could reference that function/file Uh.. Why not just put them into a mod then?

#

Just use CfgFunctions from your mod

tough abyss
#

What would be an efficient way to log/save positions and then display them on the map later? I tried using an array and drawing the positions to the map using createMarker, but that seems to have performance issues.

still forum
#

you can use the drawIcon command to draw them on map when map screen is open

#

But performance wise not sure if that's better than markers

tough abyss
#

right now, it seems that the markers lag behind the actual movement, here's my code, which I know is pretty crap, but right now I'm just trying to get the bare bones working.

#
frameNumber = 0;
listNumber = 0;

addMissionEventHandler ["EachFrame", 
{
    if (frameNumber % 5 == 0) then
    {
        {
            listPositions pushBack (getPos _x);
        } forEach allUnits;
    };
    
    frameNumber = frameNumber + 1;
}];

_handle = [] spawn
{
    while {true} do
    {
        sleep 0.1;
        
        systemChat str (count listPositions);
        {
            _m = createMarker [(str listNumber), _x];
            _m setMarkerShape "ELLIPSE";
            _m setMarkerSize [0.5, 0.5];
            listNumber = listNumber + 1;
        } forEach listPositions;
        
        listPositions = [];
    };
};```
still forum
#

wait..

#

Wat

#

your code is scheduled

languid tundra
#

while {true} πŸ˜„

still forum
#

it might suspend inside your forEach listPositions loop, and then your EachFrame executes and adds new positions

tough abyss
#

ok

#

oh

still forum
#

Also "lagging" yeah.. That's scheduled code.. It lags

tough abyss
#

I didn't kind of see it

#

better?

listNumber = 0;

addMissionEventHandler ["EachFrame", 
{
    if (frameNumber % 5 == 0) then
    {
        {
            _m = createMarker [(str listNumber), _x];
            _m setMarkerShape "ELLIPSE";
            _m setMarkerSize [0.5, 0.5];
            listNumber = listNumber + 1;
        } forEach allUnits;
    };
    
    frameNumber = frameNumber + 1;
}];```
still forum
#

I'd recommend to use diag_tickTime instead of every 5th frame.

#

That way you can update every 0.1 seconds or so. Instead of like.. every second for very low FPS players, or 20 times a second for very high FPS players

tough abyss
#

Thanks Dedmen and oOKexOo.

#

πŸ‘

drowsy axle
#

How would I reference that? @still forum Just use CfgFunctions from your mod

astral dawn
zenith totem
#

I may be overlooking something, but I can't seem to find a way to get what DLC an item requires reliably, pulling the DLC from the item and looking up it's appID in CfgMods isn't entirely accurate
i.e. The m-900 falsely identifies as Helicopters DLC while the Spar-17 has no DLC in it's config

#

Required being defined as you'll get watermarked using a weapon or can't enter a vehicle if you don't have the DLC

ruby breach
zenith totem
#

Not helpful Parameters:obj: Object

#

I need to get it from classname / config

ruby breach
#

Β―_(ツ)_/Β―

#

There's no command that takes classname. And if the config is incorrect as you've said, then there's probably not a reliable way

still forum
#

@drowsy axle CfgFunctions in a mod is same as in a mission. You define the functions the exact same way, and then you call them the exact same name

meager granite
#

@zenith totem My function from KotH:

// Params: Config
// Returns: String
client_func_getConfigDLC = {
    private _addon = configSourceModList (configFile >> "CfgPatches" >> configSourceAddonList _this select 0) select 0;
    if(isNil"_addon") exitWith {""};
    _addon;
};
#

Actually, have the whole thing, to also check if you own DLC required for config class or not:

client_ownedDLCs    = getDLCs 1;
client_configsDLC    = "true" configClasses (configFile >> "CfgMods") select {getNumber(_x >> "appId") > 0};
client_namesDLC        = client_configsDLC apply {toLower configName _x};
client_idsDLC        = client_configsDLC apply {getNumber(_x >> "appId")};

// Params: Config
// Returns: String
client_func_getConfigDLC = {
    private _addon = configSourceModList (configFile >> "CfgPatches" >> configSourceAddonList _this select 0) select 0;
    if(isNil"_addon") exitWith {""};
    _addon;
};

// Params: String
// Returns: Bool
client_func_isDLCOwned = {
    private _index = client_namesDLC find toLower _this;
    if(_index < 0) exitWith {true}; // НС Π”Π›Π¦
    client_idsDLC select _index in client_ownedDLCs;
};

// Params: Config
// Returns: Bool
client_func_isConfigDLCOwned = {
    _this call client_func_getConfigDLC call client_func_isDLCOwned;
};
#

Example usage:
(configFile >> "CfgWeapons" >> "arifle_SPAR_01_blk_F") call client_func_getConfigDLC => "expansion"
(configFile >> "CfgWeapons" >> "arifle_SPAR_01_blk_F") call client_func_isConfigDLCOwned => true

#

(configFile >> "CfgVehicles" >> "C_Heli_Light_01_civil_F") call client_func_getConfigDLC => ""

#

M-900 returns no DLC requirement like it should

drowsy axle
#

Ah righty. Sounds cool @still forum

cold pebble
#

Does anybody know of the top of their heads if nearestEntities sort by distance?

still forum
#

It doesn't

#

that command doesn't exist

cold pebble
#

My bad

#

nearEntities

#

nearestObjects πŸ˜„ nearEntities

still forum
cold pebble
#

Nah, I meant nearEntities

#

Getting them mixed up

peak plover
#

You can manually sort too

still forum
#

https://community.bistudio.com/wiki/nearEntities
According to Code Optimisation, this function is the fastest and should be used instead of nearestObjects when suitable.
And that is probably because it doesn't work. Looking it up right now gimme a few secs

#

oh holy macaroni... nearEntities iterates through all vehicles :U
Yep. not sorted by distance

cold pebble
#

nearEntities iterates through all vehicles

#

So it is actually faster then nearestObjects? πŸ˜„

digital jacinth
#

maybe if you have nothing placed down on the map.

still forum
#

nearestObjects uses the quad tree to find nearby objects... That should be faster if you have lots of objects on map

cold pebble
#

Then that comment is a bit misleading then πŸ€”

#

Thanks anyway πŸ˜ƒ

waxen tendon
#

is it possible to attach a map marker to a player?

peak plover
#

No

digital hollow
#

You can set up a perFrameHandler to move the marker every x seconds, probably best using CBA_fnc_addPerFrameHandler.

waxen tendon
#

Thanks

#

Is it possible to attach a waypoint to a player?

#

or is it the same?

digital hollow
#

waypointAttachVehicle is explicitly for GET IN type waypoints. I'm not sure if it is supposed to work for stuff like DESTROY

#

In the editor I believe you can drop a destroy waypoint onto a player character, right?

still forum
#

these are for attaching something to the waypoint. not other way around

#

Like the waypoint doesn't move with the object, it just set's the target object that the waypoint belongs to

digital hollow
#

Ah, makes sense. The same then.

waxen tendon
#

Thank you!

quartz coyote
#

Hello fellow scriptors.

I am looking for a way for a server executed script to create a public variable when a specific player triggers an event and eventually increment this new variable if he does it again (Just like the score variables in a scoreboard - individual to each player)

still forum
#

Depends on what you wanna do. Like if you set the target of a destroy waypoint to a player, the AI might automatically run to that players current position even if the waypoint is elsewhere

#
{
    private _oldValue = missionNamespace getVariable ["TAG_MyCoolVariable", 0];
    missionNamespace setVariable ["TAG_MyCoolVariable", _oldValue +1 , true];
} remoteExec ["call", 2]
#

you have to use the wavy line ~ to strike text. Not a dash

quartz coyote
#

I added some detail to my request, would that change your answer ?

still forum
#

no that doesn't change it

#

execute that code. And the variable will be incremented server side and broadcasted to all players

quartz coyote
#

ok so if an other player triggers this, will he have his own variable with his own increment ?

still forum
#

no

quartz coyote
#

ah

#

well thats what i'd need

#

like in a scoreboard, i'd need every player to have his own var incremented with each time he triggered

still forum
#
{
    private _variableName = format ["TAG_MyCoolVariable%1", remoteExecutedOwner];
    private _oldValue = missionNamespace getVariable [_variableName 0];
    missionNamespace setVariable [_variableName, _oldValue +1 , true];
} remoteExec ["call", 2]
#

Variable will be as you see above. Name and the owner ID.
So TAG_MyCoolVariable3 for example

#

You could also send the player name along as argument

quartz coyote
#

This is very complicated for me to understand but I will save this and experiment it to understand it

#

thanks for your help

quartz coyote
#

@still forum this script should be executed server-side right ?

still forum
#

no

#

the remoteExec executes the code on server already

quartz coyote
#

My loop in which i'd like to execute this is server-side

#

so all I'd need to do is delete the remoteExec ?

still forum
#

no

#

then remoteExecutedOwner won't work anymore

#

So you have the object of the player available?

#

you could use his name or ownerID then to generate the unique variable name

quartz coyote
#

hold on, I will adapt this to my situation, and show you

#
private _variableName = (GetPlayerUID eastPlayer);
private _ESM_touchFlag = missionNamespace getVariable [_variableName 0];
missionNamespace setVariable [_variableName, _ESM_touchFlag +1 , true];```
still forum
#

global variables always need to ahve a tag

#
private _variableName = "MyTag_"+(getPlayerUID eastPlayer);
private _ESM_touchFlag = missionNamespace getVariable [_variableName, 0];
missionNamespace setVariable [_variableName, _ESM_touchFlag +1 , true];
quartz coyote
#

I see

#

so this would work server side

#

so now I'd like to understand how it works

#

if I get it all right :

#

I set a variable called _variableName that takes my player's UID

#

I set a second variable that takes my first var's name and vallue

still forum
#

UID as a string. String part is important as get/setVariable needs string type as variable name

quartz coyote
#

then I set my second first var to increment itself

still forum
#

I set a variable no. GETvariable. not set.
takes my first var's name no. The name of the var would be "_variableName"
It get's a variable with the name of what's inside the _variableName value. And the 0 is the default value in case a variable with that name doesn't exist

quartz coyote
#

ah great in understand

#

thanks

frigid raven
#

Is there a vanilla functions/command to get all units that are visible in the Field of View of a player?

#

Like the thing choppers do when they have this target scanning

tough abyss
#

Not sure if this should go in scripting, or mission making, editor maybe? Anyway, I've noticed players slot in with their profile glasses instead of the ones that are default in their loadouts from the editor. Is there anyway to prevent this? I want my players to load in with the default glasses I chose when making the loadouts, not their gucci 2035 combat goggles they chose in the profile screen.

queen cargo
#

doubt it @frigid raven

still forum
#

Wait a few seconds before applying the loadout @tough abyss

tough abyss
#

Ah, ok. I'll just add in the intro script a little glasses change. Thanks! πŸ˜ƒ

still forum
#

Problem is that glasses and custom face is applied a little after the game started, and potentially after your loadout script. Thus overwriting your changes again.
Making sure that your loadout script executes after that vanilla thing fixes that

peak plover
#

after init?

still forum
#

after init is before init

tough abyss
#

I guess the waituntil player == player would fix that.

still forum
#

no

tough abyss
#

I guess time > 5 would be enough then lol. It doesn't have to be perfect haha

still forum
#

the vanilla code does essentially the same

tough abyss
#

your screen is black for ~15 seconds at start anyway. I can just put it somewhere in there.

still forum
#

I'd say waitUntil {!isNull player} (which is what you are ACTUALLY doing with that player == player) and then sleep 5 seconds after that

tough abyss
#

Ok, should I start use waitUntil {!isNull player}; instead of player == player? For future reference I mean. Which one of the 300 versions of doing this would be best practice?

still forum
#

== is just missusing the fact that comparing null types (player returns objNull) always returns false

#

best version is the one that's readable and understandable

tough abyss
#

well, isNull makes most sense then haha

still forum
#

if you see player == player you think "wat?!"
If you see !isNull player you think "yeah, wait till player is there"

tough abyss
#

exactly πŸ˜ƒ

slim oyster
#

Is it possible to get getMissionConfigValue from set attributes in 3DEN in preInit? (not waiting for the expression to set a variable) aka accessing the missionconfigfile customattributes class?

ember verge
#

Is there a way to make a on off switch bar on the gui editor that will stay in the screen where i can add my script and that i can enable with the arrow keys

silk ravine
#

I once again need your help bois

#

I wrote up some scripts which are in here:
https://codeshare.io/GLbLLk

Fnc_popup is compiled via the #include in the init.sqf
init.sqf runs first and remoteexecutes stuff from Fnc_popup
addAction then makes further use of Fnc_popup

Error:
popup and swivel targets in case "switch" do not at all behave like scripted. They just execute as normal targets would (i.e. shoot them, let them pop back up)

still forum
#

Fnc_popup is compiled via the #include in the init.sqf πŸ€” CfgFunctions?

silk ravine
#

Fnc_popup = compile loadFile "customization\popups.sqf";

#

Oh and btw everything works on player host but not when actually tested on a dedicated server

#

also I should probably use preprocessFileLineNumbers

#

but that will not change my problem

still forum
#

servers init.sqf can execute before the client's init.sqf

#

meaning the remoteExec might arrive on the client, while the funciton is still undefined

#

that's why you should use CfgFunctions

#

Also remoteExec ["Fnc_popup", 2]; that doesn't make sense

#

you are inside a isServer check. That means you are already server

#

no sense in remoteExec'ing to server then

#

Line 58. You are checking a condition for every single target, even though the condition variable never changes

#

Check the condition once, and do 2 different forEach loops instead

silk ravine
#

ok so I have to look into CfgFunctions, I never used that before.
And do the condition change to 2 forEaches

still forum
#

the check in line 30 is also not really useful. The forEach loop just does nothing if the array is empty, you don't need a if to skip the loop

#

Also you set BIS_poppingEnabled to false 4 times, shouldn't once in init be enough?

silk ravine
#

Yeah that is still a left over from when I tested something with the swivels. I should totally remove that from anywhere except switch case "init"

#

the check on line 30 is for myself to see if there are actually any targets or swivels present around the object I call it on

tough abyss
#

Why would you remoteExec popups everywhere?

silk ravine
#

I do not, I only execute it on the server

#

only in the init.sqf dedmen said it wont make sense to make a status because its alsready with in a isServer condition

#

@tough abyss

#

oh wait

tough abyss
#

You originate the remoteExec on server with no target. No target == all clients

silk ravine
#

won't it be globally executed even if its within a isServer condition?

#

oh damn, the target was right

languid tundra
#

Honestly, I generally don't see any reason that one would need a remoteExec in init.sqf.

#

Also if you just have server specific stuff, why not just put them in a initServer.sqf instead?

silk ravine
#

because I am already confused enough and actually only need help with why those god forsaken popup and swivel targets won't do what I need them to xD
If it has potential to fix my issue, it has priority, other fancy stuff can be put somewhere else, can be done once all that shit works.

languid tundra
#

I'm not even sure whether the vanilla swivel targets work properly in MP as such...

silk ravine
#

I personally have the feeling that the eventhandler more specific the CBA function is somehow failing

#

they do not, but a dude from armamaniacs posted something about adding this: _target setVariable ["BIS_exitScript", false]; into the swivels init would make it somewhat work with in MP

still forum
#

A CBA function not working correctly... Is unlikely.

#

It has worked flawlessly for years. I doubt the error is in CBA if there is a error

silk ravine
#

that is likely because the targets which are executing the else condition in line 43 have no CBA assigned and won't Terc 1 none the less

#

even tho the eventhandler tells them to

#

weirdly enough switch case "init" and "reset" just work fine

still forum
#

no cba assigned?

silk ravine
#

uhm... well they do not call a cba function

#

sorry

#

language barrier

#

using words is hard

#

could it be an issue with the variable _popenabled?

still forum
#

don't see how

silk ravine
#

yea also can not be because all the systemchat were shown when I tested it

#

so its not the condition

silk ravine
#

currently doing the double condition to two forEach's thing

#

still no idea why the stuff within the eventHandler wont work

silk ravine
#

So up until now I am pretty sure its some sort of locality or compatibility issue with addEventHandler

#

or me missing the need to put some weird condition aomewhere specific

#

MP notes: "Killed" and "Hit" eventhandlers are executed where given unit is local.

#

W A T O,O

still forum
#

OwO

#

I thought your targets are on server tho

#

meaning they are local to server

silk ravine
#

they are

still forum
#

doesn't matter then ^^ As long as code runs on server

silk ravine
#

then why would this still fail on dedicated

#

I am so confused. It works perfectly on player host

#

wtaf

still forum
#

no

#

they fire everywhere and get copied to everywhere

silk ravine
#

oh nice fork bomb dud

still forum
#

did you try adding diag_logs? are the eventhandlers not being called?

silk ravine
#

well not until I place it in a loop πŸ˜‚

#

diag_logs?

#

so much new words today

still forum
silk ravine
#

I could actually use a systemChat in each eventHandler which would tell me if its fiored or not

#

or 2 to see if the CBA function executes well within an EH

#

WAIT

#

I can at least say that the event handler at line 47

#

is not working at all

still forum
#

or just diag_log and you'll know if it's working and also if it fires on server or client

#

you can also use

#

to check that they are local. which they should be if placed in mission.sqm

silk ravine
#

@still forum all that is running in remoteExec server only... would the server actually transmit the locally created eventHandlers to the connected clients?

#

eg. do they even need to be synced to the clients to show the clients the properly setup targets?

still forum
#

no

#

Do Hitpart and hit both not work?

silk ravine
#

The swivels are currently all in a weird spasm condition when on dedicated, fully extended in terc 0 not doing swivel at all

#

they seem to suffer from the same issues like the popup ones which us Hit and not HitPart

#

I will test one more time just to make sure

still forum
#

lul

#

it's drunk

silk ravine
#

@still forum If I would want to execute code on each connected or jip client for every object of a specific class (Target_Swivel_01_ground_F & Land_Target_Swivel_01_F) , how the hell can I do that?

still forum
#

remoteExec without target parameter

#

or target -2 for everyone except sdservnern

#

server

silk ravine
#

hm thats actually better than the if condition I had in mind

#

should so be possible via execVM as long as the code is set to if ("isDedicated)

#

because I really do not want to pre compile that

#

just run it once from the init.sqf

silk ravine
#
[] remoteExec [
    "{_target setVariable ["BIS_exitScript", false];} forEach entities "Target_Swivel_01_ground_F";
    ",
    -2,
    true
];
#

that is all I could come up with x,)

still forum
#

as you can see in the syntax highlight.. that won't work

#

also if you'd read the wiki page for remoteExec you'd see that the argument there is a command or script function name

#

And yours is neither

zenith totem
#

@meager granite
Still doesn't work perfect, I'm thinking there's no way at all to reliably pull this information
i.e.
(configFile >> "CfgWeapons" >> "optic_Arco_blk_F") call client_func_isConfigDLCOwned => false
(configFile >> "CfgWeapons" >> "optic_Arco_blk_F") call client_func_getConfigDLC => "expansion"
(configFile >> "CfgWeapons" >> "bipod_01_F_blk") call client_func_isConfigDLCOwned => false
(configFile >> "CfgWeapons" >> "bipod_01_F_blk") call client_func_getConfigDLC => "mark"

still forum
#

you could check if the item icon for Arsenal is DLC

zenith totem
#

I already looked at vanilla arsenal prior to sa-matra giving that code and it looked to be the same check, which also returns the marksmen for bipods

#

Ace arsenal seems to be same check as well

still forum
#

Yeah

#

but as far as I know there were no problems with that code in ace arsenal

zenith totem
#

I'm loading up with ace now to check

#

Bipods also return as marksmen DLC in Ace Arsenal

still forum
#

Yeah. Is that not correct?

zenith totem
#

They're a free platform feature, you don't need the DLC to use them

#

But yeah, that check won't know that

still forum
#

They say DLC = "Mark"; in config

zenith totem
#

That's also not a reliable property

#

The m-900 is marked as Heli

still forum
#

afaik the game itself iterates through CfgPatches and collects the units/weapons arrays from there

zenith totem
#

I don't think there is a way to determine what content is locked/premium or not from script commands without erroneous results

still forum
#

The game itself also uses the config though

zenith totem
#

The game uses it how?

#

In it's own arsenal, sure

still forum
#

no. arsenal is just for logo's, not specifically DLC

zenith totem
#

But the premium content locks seem to be some BIS magic

still forum
#

It's in engine yes

silk ravine
#

okay, I tried again (FYI I am new to the complicated side of SQF, I am really trying my best to learn this, but I am not a programmer or coder or what not.)

if (isDedicated!) then {
    _localTargets = entities "Target_Swivel_01_ground_F" + entities "Land_Target_Swivel_01_F";
    {
        ["BIS_exitScript", false] remoteExec ["setVariable", -2, true];
    } forEach _localTargets
};```
still forum
#

@zenith totem do you have a example classname for a real DLC item?

zenith totem
#

That gets flagged as DLC but isn't?

silk ravine
#

oh wait, thats bull shit as well, nm

still forum
#

No a real one

zenith totem
#

arifle_SPAR_03_khk_F

#

That returns correctly with the checks though

languid tundra
#

SPAR is APEX, isn't it?

zenith totem
#

Yeah

silk ravine
#

@still forum

if (!isDedicated) then {
    _localTargets = entities "Target_Swivel_01_ground_F" + entities "Land_Target_Swivel_01_F";
    {
        _x setVariable ["BIS_exitScript", false];
    } forEach _localTargets
};```
#

no reason for a remoteExec anymore

still forum
#

@zenith totem
configFile >> CfgHints >> WeaponList
Has a list of weapons and their DLC appID if they have a DLC

And then there is also CfgMods >> Expansion>>Assets which lists the assets that belong to a certain DLC
Apex in this case

#

Just search for the classname in a AIO config and see where it appears

zenith totem
#

Got a link to one?

zenith totem
#

Thanks

zenith totem
#

@still forum I don't see any pragmatic approach on those config entries

configFile >> "CfgHints" >> "WeaponList" seems to just be an entry for UI which defines a weapon to show on the hint, it just seems more of a "try this content", here's a classname.

configFile >> "CfgMods" >> _dlc >> "Assets" also seems to be a dead end, some show base classes in their reference but others like the ERCO only have a specific variant listed

#

i.e. All three items here are DLC Items

private _assetRefs = []; 
private _dlcs = "isClass(_x >> 'Assets')" configClasses (configFile >> "CfgMods"); 
{ 
    _assetRefs append (("!(getArray (_x >> 'reference') isEqualTo [])" configClasses (_x >> "Assets")) apply {getArray (_x >> "reference")}); 
} forEach _dlcs; 

[ 
    _assetRefs select {"arifle_SPAR_03_khk_F" isKindOf [_x#1,configFile >> _x#0]}, 
    _assetRefs select {"optic_Arco_ghex_F" isKindOf [_x#1,configFile >> _x#0]}, 
    _assetRefs select {"optic_ERCO_khk_F" isKindOf [_x#1,configFile >> _x#0]} 
]
[[["CfgWeapons","arifle_SPAR_03_base_F"]],[],[["CfgWeapons","optic_ERCO_khk_F"]]]
#

I'm thinking my next action is to file a ticket with a request for either
A) A command to check DLC status of given class/config
B) Fix/add config properties for required DLC (Not sure what the current DLC property is meant to represent)

zenith totem
drowsy axle
drowsy axle
young current
#

it cant find this

#

for whatever reason

#

possibly some classes are not closed right and the class order is messed up

#

Id recommend packing with Mikeros PBOProject as it gives out far better debug info

tough abyss
#

@silk ravine you can pass array of types to entities, this way you don’t need to add the results from 2 different searches

#

Also _target inside call scope in remoteExec will be undefined, it is a separate scope

#

Oh wait, it is not even a call scope, you write a code where it should be the name of the function or command? Pretty sure slapping things randomly hoping this time it will work won’t work.

meager granite
#

@zenith totem So what are you trying to do exactly?

#

Bipod is from Marksman DLC but doesn't show DLC warning if you don't own it?

zenith totem
#

Determine what items show the premium content watermarks and what vehicles are locked if you don't own the DLC.
Bipods come from the Marksmen DLC, but they're a free platform feature anyone can use so shouldn't get flagged as a DLC item for my usecase

meager granite
#

πŸ€”

zenith totem
#

I can't rely on the config method you use as it flags stuff like MXM (Khaki) as an Apex item but it's usable by all IIRC

meager granite
#

There must be some kind of config reference that triggers restrictions then

#

So M-900 doesnt?

#

I own all DLC to check myself and have no alt accounts

zenith totem
#

You can uninstall the DLC in steam to check

#

I was testing on an alt account on my laptop until someone pointed that one out to me, can't risk redownloading all my workshop mods lol

#

M-900 has no premium content lock, yeah

vagrant apex
#

Yeah m900 came with heli dlc but as a free item

#

For everyone

meager granite
#

So

#

After spending last hour looking all over config, turns out the answer is configSourceMod

#

configSourceMod (configFile >> "CfgVehicles" >> "C_Heli_Light_01_civil_F") => ""
configSourceMod (configFile >> "CfgVehicles" >> "B_Heli_Transport_03_F") => "heli"

#

@zenith totem

#

Then you do same check against getDLCs 1 to see if you own that DLC

#

If you don't, you'll get restrictions

#

With my scripts above, change contents of client_func_getConfigDLC to simple configSourceMod _this

frigid raven
#

Is there a way to override existing functions through another addon? I have like a core addon that has the func fnc_doStuff and then I have a integration addon that has also a function fnc_doStuff. Depending on a specific condition evaluated by script logic I want to have either one or the other logic to be the one that is called through call myMod_fnc_doStuff

#

I know about namespacing but think about it as having an error message "that function already exists" appearing rather than a quiet override of the latest function loaded

meager granite
#

But other than that, no

tough abyss
#

Yeah, you can override all functions but this will break Arma unless you carefully duplicate essential functionality @frigid raven doubt you wanna go that way

frigid raven
#

@tough abyss My use case is that I have vanilla functionality but when the integration addon is loaded it should executed script calls that are dependend on ACE3

#

For now I have therefore functions that are suffixed with _ace3 but I do not like that approach much because I have to create a check for ACE3 before chosing whether function should be called, the vanilla or the ace3 one

tough abyss
#

Sounds complicated

frigid raven
#

I am complicated

#

So to clarifiy. Is it possible to have duplicate function names with CfgFunctions? Because both addons would have that? Or do I have to omit the CfgFunctions definition in the integration addon and therefore recompile them manually via Script Logic?

#

I think the second approach is the only one that works eh?

young current
#

If integration addon is dependant of the core it will be run after it and everything that has same class name will be updated/overriden

frigid raven
#

Yea ok I see

#

But without CfgFunctions defined I have to manually override / recompile them aye?

#

That's my goal actually. Depending on a specific editor module configuration the "integration" addon should override just some, not all, functions

#

Gonna try it out later - thx for the infos so far

peak plover
#

Is there a way to know if a thing has physics?

#

A object for example a box or a crate

digital jacinth
#

meaning if oyu get an object with 0 mass it is most likely a non physx object

tough abyss
#

Unless someone setMass to 0 on it

peak plover
#

Β―_(ツ)_/Β―

frigid raven
#

When developing a mod unpacked and having it within the mod directory (packed) and unpacked in the Arma3 root - do I still have to ... bind the P: drive thingie that is mentioned everywhere?

#

Why I ask? I managed to get it working with filePatching etc. to adhoc change files without repacking .pbo etc.
But one day it stopped working so I went back to packing and moving the Mod Folder all the time. I just realized that I might have missed to rebind the P: Drive again after I restarted my PC πŸ˜„

peak plover
#

If this is scripting related

#

just put

call my_fnc_temp;

into the functions that are in your mods

#

and define that function in the debugu console

#

or profilenamespace

#

Depending on what you're testing

still forum
#

@meager granite After spending last hour looking all over config, turns out the answer is configSourceMod Will return true for an item in a DLC even if it is free to use, even though none comes to mind

#

@frigid raven you can overwrite the config entry via config patching. But you can't do it with script logic. You can compile manually without compileFinal.
Or use the CBA scripted functions system. Then you can run conditions before the functions get compiled
@frigid raven no arma doesn't look on pdrive

silk ravine
#

@tough abyss wenn now know that the issue lies in 2 parts. 1) the event handlers that work perfectly on player host will not fire at all in dedicated environment. 2) the code to fix swivel targets provided by armamainiacs mod functional swivel targets does not work. Working on both. But the eventhandler thing is definitely the more concerning issue here because we can't explain that behaviour.

#

If you want to look at it it's in there but note that we will replace addMPEventHandler with addEventHandler by next commit. We just threw it in because we grew frustrated with how FUBAR the whole training target thing was done. Looks like it was a sloppy side project noone ever actually finished.

astral tendon
still forum
#

lul who wrote that πŸ˜„

#

can you find me a classname of a vanilla magazine? 30rnd stanag?

sleek token
#

30Rnd_556x45_Stanag

still forum
#

foxed

earnest ore
#

Hrm. Is the deletion of empty magazines when reloading a rifle or what have you handled by the engine via black magic?

astral tendon
#

Czech Space Magic *

zenith totem
earnest ore
#

You can see in his issues section that the mags still get deleted when you toss the weapon.

zenith totem
#
player addEventHandler ["Reloaded", {
    params ["_unit", "_weapon", "_muzzle", "_newMag", "_oldMag"];
    _oldMag params ["_oldMagClass", "_oldMagAmmo"];
    if (_oldMagAmmo isEqualTo 0) then {
        _unit addMagazine [_oldMagClass, 0];
    };
}];
#

If it's already gone by that point, you'd probably need to add a keydown event handler to pick up the reload before the engine processes it, you'd probably have issues with other scripts blocking the input to engine but your script firing and adding an empty mag anyway

#

Or a pretty bad solution to that issue, loop and keep track of what mags the player is using and add an empty mag of that type on a reload EVH

#

You may be able to use EVHs like the reload itself to get rid of the loop if that's the only way you can get that idea to work

#

You'd need to expand the script to figure out if it's Throw/Put / whatever you don't want an empty mag for too.

earnest ore
#

Figured i'd try and take a crack at the 'ammunition and magazines as seperate items' approach from Dayz and Tarkov.

#

Guess i'll be fighting with Czech space magic.

ornate sky
#

Hey guys, how can I get a player unit reference dynamically for the purpose of scripting player specific events in a live zeus mission?

Assume I have access to ares script module/debug console.

For example, a player JohnDoe joins my zeus mission. I want to use allowDamage on JohnDoe.

#

Can I extract the object reference from bis_fnc_listPlayers?

#

By using a name="JohnDoe" filter? I guess that would work, gotta test it though

still forum
#

allPlayers
ARRAY select CODE

#

But the name has to 100% match

#

which isn't that easy everytime

ornate sky
#

Is there a way to get object reference by player list as admin?

tough abyss
#

findIf

digital hollow
#

I'm pretty sure the unit you drop the module on gets passed into the parameters. You can check it, maybe just drop the module on a unit and hint str _this;

#

With Zeus and debug console you can use curatorSelected as well.

ornate sky
#

That's cool, I didn't know that

#

Thanks @digital hollow that's quite useful

digital hollow
#

Yeah I have a ton of curatorSelected # 0 # 0 snippets ready to go =p enjoy
(that gets you the single unit you select)

tame lion
#

I may be misunderstanding the problem, @ornate sky you could just doop the code module on the unit. The code module returns an array returning pos and object. Ex: [[x,y,z], objNull]

#

Use _player = _this select 1 to get the player you want to modify in your Achilles module

ornate sky
#

Yes, that will work I believe, because I did not know the module passes anything, I don't know why I missed that

lost iris
#

How can i use isKindOf to find if a class name is clothing?

still forum
#

isKindOf "UniformBase" I guess. Or something similar

lost iris
#

"U_B_CombatUniform_mcam_tshirt" isKindOf ["UniformBase", configFile >> "CfgWeapons"]

#

returning false

#

i cant find that keyword

still forum
#

Uniform_Base

#

forgot the underscore

lost iris
#

if is Vest_Base, Backpack_Base etc for the other items of clothing or is there one term i can use for all?

#

Uniform_Base worked btw

still forum
#

backpacks are CfgVehicles and "Bag_Base"

#

But. That's what mod makers are supposed to use

#

Mod makers don't always do what they are supposed to do

lost iris
#

Its for vanilla anyway, but where are you finding this or is this just knowledge

still forum
#

Vest might be "Vest_Camo_Base" but many mod makers don't follow that and use "ItemCore"

lost iris
#

im creating a util function where i can pass in a class name for nearly any item and get the displayname

still forum
#

There is BIS_fnc_ItemType which returns what type an item is

#

And not using the faulty isKindOf method

lost iris
#

bookmarked, I will use that function then instead thanks

smoky atlas
#

Hello, I'm currently with a problem. I want to add a protective shield around a turret on a vehicle with the Attachto command. I have so far been able to, but it's not rotating with the turret. I found out you have to use setDir and getDir. Now, I'm not good with scripting, so if anyone could help me out. I currently have this:

#
_vehicle = _this select 0;
_turret = _this select 1;
while {true} do
{
_tanktur = getDir [_vehicle,[0]]; //get direction of commander turret(if you want the gunner turret just make it [0]
_tanktur setDir _turret; //set direction of your turret
};
#

But this throws an error

ruby breach
#

Well aside from the fact that we don't know what _vehicle or _turret are, or whether this is being executed in an unscheduled environment improperly, or what the error even is, what I can say is that you're using the wrong syntax for getDir

smoky atlas
#

I'm executing it like this in the init line:

#

null = [this, kit] execVM '\hades_hmmwv\functions\setdir.sqf';

#

in the init line for the vehicle used

#

kit is the static object that's going to be attached

ruby breach
high marsh
#

Yeah, wrong syntax of getDir either way

#

Also, use params.

smoky atlas
#

I'm a total beginner at scripting, I have no idea what you're talking about

ruby breach
#

Read the wiki

smoky atlas
#

Well, I don't really find the wiki quite helpful

#

Sorry to say

ruby breach
#
getDir
Description:
    Returns the object heading in the range from 0 to 360. 

Syntax: getDir object 
Alternative Syntax: pos1 getDir pos2  
``` Nowhere there does it say anything about `getDir Array` being a valid syntax
#

If you can't help yourself, there's really not much that we can do to help you.

#

Spoonfeeding you answers isn't going to accomplish a lot. Because then you don't even know why you're doing what it is you're doing

smoky atlas
#

Well, okay then. How would I get the heading of a vehicle's turret?

ruby breach
smoky atlas
#

alright, thank you

#

Alright, I have managed to make it work, it rotates with the turret now, but the shield is now backwards

#
_vehicle = _this select 0;
_turret = _this select 1;
while {true} do
{
_currentturret = currentweapon _vehicle;
_array = _vehicle weaponDirection _currentturret;
_dir_degrees = (_array select 0) atan2 (_array select 1);
_turret setDir _dir_degrees; //set direction of your turret
};```
frigid raven
#

from the documentation: https://community.bistudio.com/wiki/Modules

// 0 for server only execution, 1 for global execution, 2 for persistent global execution
isGlobal = 1;

Can sb. tell me the difference between global execution and persistent global execution? Is it like being added to the JIP queue so new players will receive that code as well?

smoky atlas
#

Would _dir_degrees = (_array select 0) atan2 (_array select 1) + 180; work?

#

Nevermind, got it working. Thank you all!

tough abyss
#

while {true} without any delay will execute many times per frame, while simulation is only once per frame, so you are wasting your CPU, nothing is wrong with that if that's all you have in mission

cunning crown
#

Hey, quick question: What do the # does in _musicClassArray # floor random _arraySize;. Can't find any documentation on it (script based on Walords Jukebox). If I delete it it doesn't work anymore but if I replace it by select, it works so is that the same or is there a difference?

austere granite
#

= select

cunning crown
#

no difference at all?

austere granite
#

the former is for tryhards

#

tbh

cunning crown
#

Okey well thanks but why isn't that mentioned on the wiki?

#

ah no, nvm, didn't read the last comment on select -_-

queen cargo
#

@austere granite nope, there is the Important difference of predecence

#

@cunning crown # is executed first most of the times while select is just on Spot 4

#

More Info at

cunning crown
#

Oh, interesting to know, thanks πŸ˜ƒ

tough abyss
#

dont use it

astral dawn
#

OMG I wish I could return all the time I have wasted typing select everywhere πŸ˜„

lost iris
#

Any ideas on what the Error Zero divisor means?

winter rose
#

@lost iris well… :3

#

you tried to delete by zero, or select over an array capacity, or an undefined/badly defined variable

astral dawn
#

@lost iris What does the full error text say?

lost iris
#

I think its fixed i changed my array from this [["",[]],["",[]],["",[]],"","","",["",["","","",""]],["",["","","",""]],["",["","","",""]],[],[]]; to this [["",[""]],["",[""]],["",[""]],"","","",["",["","","",""]],["",["","","",""]],["",["","","",""]],[""],[""]];

#

It may be because some of the arrays within the array didnt have quotes with in them maybe

astral dawn
#

For complicated arrays, I suggest you use new lines and tabs like you typically do with {} brackets, to make it more readable

open vigil
#

My eyes

winter rose
#

You probably did a select 0 on an empty array @lost iris
Now that they are all filled the issue is no more

peak plover
#

I don't see why you need an empty array like that anyway

#

Zero divisor means the array element does not exists

#

use param instead of select

zenith totem
#

Does anyone know if curator objects (i.e. from allCurators) are local to each zeus? Or would I need to get the assigned units to remoteExec something to all curators?

tough abyss
#

@winter rose sqf will tolerate non existing select if it is right after the existing one without error, sort of like .end() iterator

#

Same goes for select 0 it should not give error

hollow thistle
#

@zenith totem only the curator module that player is assigned to will be local to him.

still forum
#

@frigid raven Is it like being added to the JIP queue so new players will receive that code as well? Yes. That would alteast make sense.
@astral dawn OMG I wish I could return all the time I have wasted typing select everywhere should have most likely used params ^^

tough abyss
#

It is all fun and games until # fucks up with fucked up preprocessor

leaden venture
#

I'm thinking about getting rid of ASRAI and looking for a way to increase AI reaction times

#

I have the ACEx headless client and it usually gets great frames, but I'm looking for a more reactive set of FSMs, might even write my own

#

I'd really like more aggressive use of suppressive fire

#

way more aggressive movement

#

and faster aiming

tough abyss
winter rose
#

@tough abyss true! (so might have been a select 1 πŸ˜‹)

#

@leaden venture also setSkill

digital jacinth
#

Is there a way to make AI lean left and right? I thought there was an animation for this, but that wasn't it.

tough abyss
#

You can try switch move or play move, I think those are called xxx_adjust

digital jacinth
#

adjusts are just stances, leaning is something else.

cold pebble
#

1.91 hey πŸ˜„

#

I assume isSpeech will be optional, and default to false? πŸ€”

tough abyss
#

1.91 must be mistake, we are at 1.87 so there is 1.88 release then 1.89 dev then 1.90 release before that, sound implausible

still forum
#

no it's not

#

1.90 is on RC

#

And we are on 1.88 on current stable

tough abyss
#

Dev is 1.87 how could it be

still forum
#

Did the weekly dev branch update already happen?

#

1.90 RC started a few days ago

tough abyss
#

Dunno dev updates are rare and shallow

meager granite
#

@still forum It will return no mod for say M-900 which means its available without owning the DLC

#

(I am fast with responses, yes)

outer hinge
#

Do I need a script or something in order to be able to go into Zeus, spawn a weapons squad, then assign the weapons squad to a player already in game?

I know I can join the weapons squad with Ace... But I want to be able to take command when I join.

Alternative, can I just set my rank to always out rank the spawned in AI, join their group, and it auto give me lead?

digital hollow
#

In Zeus you can group anyone to anyone by selecting the subordinates and Ctrl + Click dragging to the new leader.

outer hinge
#

So I can ctrl + click & drag onto a player (NOT AI)?

digital hollow
#

If the player is part of that Zeus' editable objects (has a circle).

#

If player is not, you can use script to add

outer hinge
#

By default I cannot see the circle unless I add in the Ace utility (forget what it's called) which allows me to see pre mapped items & players

digital hollow
#

You can run this in debug console or server init to add everything {_x addCuratorEditableObjects [allUnits + vehicles, true];} forEach allCurators;

outer hinge
#

Or well.. Use that source at least

digital hollow
#

The commands are there. The use case as an example, probably not.

outer hinge
#

Alright sweet. I will do some research. Thank you.

azure jay
#

ty

frigid raven
still forum
#

that means you are not supposed to use it and that it's argument or return values might be changed at any point without notice

frigid raven
#

Ah alright

#

so when I want to use addons API I have to look for functions that are marked as Public to avoid any problems

still forum
#

Yeah. OR just trust that they might break your code

frigid raven
#

I have trust issues

astral dawn
#

How are variables and arrays implemented in the engine? I mean it's most likely a C++ struct or class. Any idea what fields there are inside them?

still forum
#

Why? any specific question about it?

astral dawn
#

Was thinking, should I rather make an array with a few elements, or make the elements separate variables. What would take less space.

#

And it's just an interesting thing to know on its own

queen cargo
#

@astral dawn check sqfvm
it is as close as you can get to actual engine sources without having engine sources

#

and to your question, it depends on how you want to access them:

private _tmp = missionNamespace getVariable ["MyVariables%1", _index]``` would be a classic case for an array
#

however, if you want to just "save space"

#

then just do not do it
it is not worth it

astral dawn
#

it is not worth it
Allright 🀷
Looking at SQFVM

tough abyss
#

Roughly arrays are vectors, variables are hash maps

astral dawn
#

Thanks... if it's std::vector, it takes about 24 bytes for housekeeping, as I've found in the internet. I guess it's smaller than an entry in a namespace (allvariables).

still forum
#

@astral dawn What would take less space. well variables store the name of the variable and the value. The array just the value

#

it is as close as you can get to actual engine sources without having engine sources Actually Intercept is closer. As it's the exact same binary layout

tough abyss
#

No RV is not using STL it is all hand rolled

astral dawn
#

The array just the value
And the 'housekeeping' stuff because it is an array, which appears to be 24 bytes.

still forum
#

if it's std::vector, it takes about 24 bytes for housekeeping depends on data type

#

Each item may have overhead too

astral dawn
#

No RV is not using STL it is all hand rolled
You mean it doesn't use std::vector?

still forum
#

yes

tough abyss
#

No it doesn’t

astral dawn
#

Oh allright, thanks
rv::vector πŸ˜„

tough abyss
#

GameArray

still forum
#

AutoArray

tough abyss
#

FindArray

astral dawn
#

It will take some time to understand πŸ™„ Thank you

rancid ruin
#

anybody dabbled with the enfusion scripting in dayz yet?

still forum
#

Wrote like 5 lines

rancid ruin
#

how long were the lines?

still forum
#

20 chars or so

#

Ah. I remember

#

it was my performance test finding out that enscript is 1000x faster than SQF

rancid ruin
#

what kind of stuff did you test?

still forum
#

Just some loops and math operations and time keeping

rancid ruin
#

there's no docs for it yet right?

still forum
#

Simple stuff like 5*5*5*5*5*5*5*5*5*5*5*5

#

There is

#

there is a doc file in the files

rancid ruin
#

oh nice

#

any idea how the UI system works on enfusion yet?

#

is it still painful?

still forum
#

yeah. It's nice

#

Workbench has a click/drag UI designer

rancid ruin
#

jesus

still forum
#

Kinda C# like. With On-clicked events in the Enscript class that you can bind to the UI

rancid ruin
#

so is it a whole new system, or just a nice editor for the painful dialogs from arma?

still forum
#

both

rancid ruin
#

i don't know whether that gives me hope or not

#

might have a play around with enfusion soon but without any AI or vehicles i dunno how fun it'll be

young current
#

everything DayZ modding related is 10x more painful than Arma modding right now

astral dawn
#

Why?

still forum
#

Because most of it is broken or half implemented

austere granite
#

when are you going to make a VS code plugin for enscript dedmen? πŸ˜„

#

I fully trust you to do it

still forum
#

never

#

why

#

The workbench stuff is good enough

#

and I never could make vs code plugins πŸ˜„

austere granite
#

nice being able to use familiar editor

void ivy
#

Is there a function that can be called to return the current status of flaps for a VTOL?

languid tundra
#

Maybe animationSourcePhase

void ivy
#

Thanks, will look into that

#

Similar question, is there a function for checking whether or not auto-vectoring is currently on? I don't imagine that correlates to any defined animation.

languid tundra
#

There exists a isAutoHoverOn command

void ivy
#

Nice! Thank you.

astral tendon
#
_x addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
    
    if (( getDammage _unit)+ _damage >= 1) then {_unit setdamage 0.9} else {_unit setdamage ((getDammage _unit) + _hitDamage)};
    systemChat str _damage;
}];

So, this atually avoid units to die and get really low healt, but how does this overrides the return of damage by the handle? I though that it must return something from it like 0.

#

otherwise the unit would still get the damage still, but some how is just returning nothing?

still forum
#

correct

#

it has to return something

#

it doesn't

astral tendon
#

so how does the unit still alive afther setdamage 0.9 + the damaga that it returns? or the order is the oposite?

still forum
#

most of that code is garbage that doesn't work

#

( getDammage _unit)+ _damage >= 1 If the unit would get more than 100% damage. Then set it down to 0.9, If the unit wouldn't already die from the shot it will execute the else statement which does... nothing. Literally. It does nothing

astral tendon
#

it does.

still forum
#

_hitDamage is undefined. Meaning number+nil returns a nil. meaning _unit setDamage nil get's silently ignored and does nothing

astral tendon
#
_x addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
    
    if (( getDammage _unit)+ _damage >= 1) then {_unit setdamage 0.9} else {_unit setdamage ((getDammage _unit) + _damage)};
    systemChat str _damage;
    
}];

still, the unit does not die

#

and the code return no value

still forum
#

maybe "nil" automatically falls back to 0 ?

astral tendon
#

How can I check what is returning?

still forum
#

you can't

#

or well. you can't see what the engine does

#

it's obviously returning nil as systemChat returns nil

languid tundra
#

How about systemChat str getDamage _unit at the end?

astral tendon
#

no, the chat is actually returning the damage made, even when its above 1.

languid tundra
#

Just to see what _unit setdamage ((getDammage _unit) + _damage) does

still forum
#

But that doesn't matter. As you return nil at the end

#

and if Arma really falls back to 0 if you return nil...

#

I don't have time to check that now

#

but would explain why he doesn't die

astral tendon
#

unless if the handle returns the damage before the code

still forum
#

how would it?

#

It can't see into the future

astral tendon
#

because, if it was returning afther the code the unit would die.

still forum
#

what?

#

no it wouldn't. If my idea is true

#

then any hit would do 0 damage

#

not killing the unit

astral tendon
#

the code would be aplied and then the handle would do the damage, killing the unit

still forum
#

Do you even read what I'm writing?

astral tendon
#

so if the handle has no code returning the damage made then it just returns 0 or nil?

still forum
#

If you return nil. You will have returned nil

#

what the engine does with that nil is unspecified

#

but it needs to have some kind of fallback

astral tendon
#

like

this addEventHandler ["HandleDamage", {
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
systemchat str  _damage;
}];
#

the unit would still be alive?

still forum
#

if it does fallback to 0 on nil. Then that code would make the unit invincible

languid tundra
#

Yes, if you don't put _damage; or another number at the end of the code, you make the unit essentially invincible.

still forum
#

Also if there is a second HandleDamage handler after yours. Then your return value will be ignored

#

that might also be happening

astral tendon
#

just check that and the unit still dies

languid tundra
#

hmm

#

but if you put false or 0 at the end, the unit should not die for sure.

still forum
#

unless there is a second HandleDamage overriding it

languid tundra
#

ofc

#

Apparently, only the latest one matters

still forum
#

Maybe a race condition resulting in seemingly random behaviour
The handlers getting added in different order every time

astral tendon
#
testguy = group player createUnit ["B_RangeMaster_F", position player, [], 0, "FORM"];
testguy addEventHandler ["HandleDamage", { 
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"]; 
systemchat str  _damage; 
}];
#

this guy still dies

#

one shot

languid tundra
#

Then don't play with nil, but return an actual value as the EH expects...

still forum
#

Yeah stop playing around with undefined behaviour

astral tendon
#

thats the thing, even if I add nothing to return but use setdammage seems to override the effect

still forum
#

Wait a second

#

I thought you wondered why he doesn't die. Not that he dies

astral tendon
#
testguy = group player createUnit ["B_RangeMaster_F", position player, [], 0, "FORM"];
testguy addEventHandler ["HandleDamage", { 
    params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"]; 
systemchat str  _damage;
_unit setDammage 0;
}];
#

this guy now is invunerable

still forum
#

yeah your first code doesn't prevent the unit from dying

#

did you mean to ask why he doesn't die?

astral tendon
#

yes

languid tundra
#

I hypothesize that in rare cases he still dies.

#

When you apply extreme damage

astral tendon
#

because the handle is supouse to do the damage if it does not return anything

#

Thats why im saying that the handle return the damage before the code

#

or some how gets ignored by setdammage

still forum
#

ask me that again in 9 hours and I'll look it up

astral tendon
#

can I let that in chat for you for more look at it?

languid tundra
#

Isn't it often the case that when a unit gets damage, that the EH gets triggered multiple times? diag_log would be way better than systemChat...

still forum
#

could be yeah. You can see multiple systemChats too tho

languid tundra
#

Maybe the damage that would kill the unit is in an earlier trigger and a later trigger can cancel it with your _unit setDammage 0; part. Who knows

astral tendon
#

There is also the problem that if it did return the damage before the code, it could kill the unit before the code

languid tundra
#

Not if it only can get killed after all EHs are done.

#

They are related to different selections of the unit when I remember correctly. I did some logging a while ago, but can't remember all details.

frigid raven
#

Sorry for interfering other questions. Feel free to answer when time.
This is executed on my dedicated server side

["CAManBase", "killed", { call coopr_fnc_onKilled }] call CBA_fnc_addClassEventHandler;

But coopr_fnc_onKilled is never called. When testing in preview it does work but - that's not an excuse but an info

languid tundra
#

CAManBase ... wasn't this just an Arma 2 thing?
Nvm it still exists

jovial idol
#

So i have my file for door animating but i am unable to to get the door to open, cant seem to make a decent SQF for opening doors

#

any help?

#

with the statement for Doors

languid tundra
#

What did you try?

jovial idol
#

for statment i done this = statement = "[this] execVM ""\doortester\data\fn_frontdoors.sqf"";";

languid tundra
#

Doesn't tell me anything though

jovial idol
#

what do you mean by what did i try? thats what i thought you meant cos thats what i used in the Config for like door actions etc.....

languid tundra
#

Do you use something like

_building animateSource [_source, 1];
jovial idol
#

nae

languid tundra
#

_source would be a class name of a subclass of ```sqf
(configFile >> "cfgVehicles" >> typeOf _building >> "AnimationSources")

jovial idol
#

@languid tundra this is what i have done & thats what i get when i go to open the door, im still learning on how to animate doors & that

languid tundra
#

What I was interested before is what is the code of \doortester\data\fn_frontdoors.sqf?

#

You were asking about SQF after all

#

nvm

jovial idol
languid tundra
#

you forgot double quotes at the end

jovial idol
#

thats what the sqf has

languid tundra
#

The error message even says missing ""

jovial idol
#

missing what? i dont see it

languid tundra
#

Check the statement attribute in the image you posted.

#

statement = "[this] execVM ""\doortester\data\fn_frontdoors.sqf"

#

you only have a single double quote at the end

#

instead of three

jovial idol
#

So only have 1 (") at the end?

languid tundra
#

whut?

jovial idol
#

So just have a single double quote? that 2 of these ? = ("")

languid tundra
#

Good, you fixed the first issue

jovial idol
#

Yeah but now i have this when its in the right folder lol

languid tundra
#

Well, how does your folder structure look like?

#

for the PBO

jovial idol
languid tundra
#

So doortester is the PBO name

jovial idol
#

yeah

languid tundra
#

Hmm, you don't work with PBO prefixes. Have to think about what the default is...

#

Unless you specify one in the Addon Builder...

jovial idol
#

hmmm im no to sure what you mean by Default. still learning how all this stuff is done πŸ˜„

languid tundra
#

You are using BI tools for packing the PBO, aren't you?

jovial idol
#

yeah

languid tundra
#

Open the Arma 3 Addon Builder and click on OPTIONS

#

You should have an entry called Addon prefix there

jovial idol
#

yeah i have that the box below its blank?

languid tundra
#

Add doortester there for fun and see what happens

jovial idol
#

then pack the pbo?

languid tundra
#

yeah

#

I though by default the PBO name would be used as prefix, so it should be unnecessary...

#

Still, let's see what happens

jovial idol
#

So it should work now when i load it up on arma? iv been at this for hours trying to figure this out to, always assumed it was a typo lol

languid tundra
#

Well, typo would be a likely explanation...

jovial idol
#

yeah got the same thing, "Script \doortester\data\fn_frontdoors.sqf not found :L

languid tundra
#

what's the path of the actual fn_frontdoors.sqf?

#

including the file name

jovial idol
#

P:\doortester\data\fn_frontdoors.sqf

languid tundra
#

funny

#

but wait

#

lol

jovial idol
#

Thats the path i have of it lol

languid tundra
#

Your PBO Addon folder structure is flawed anyway

jovial idol
#

flawed?

languid tundra
#

maybe

jovial idol
#

idk what flawed means lol

languid tundra
#

Where do you put the PBO?

jovial idol
#

in a addonns folder for the models i make & put in, normally its just static models which dont need memory lods & Sqf's for lol, but i put it in "C:\Users\Stephen Allen\Desktop@Tester\addons"

languid tundra
#

Nvm, I didn't think it though. If you had a faulty structure, your config woudn't work in the first place, but it does as you can interact with the door and get a script error.

jovial idol
#

see i dont know any other way to have a door animate open with the statment for opening doors in the config so i just put in in a sqf but if theres an easier way that would solve this issue then id be sorted but i dont know another way

languid tundra
#

The script error tells you that the suggested path to the script passed ot execVM is wrong. Don't see the error yet though.

jovial idol
#

hmmm, is there any way i could do it another way with out using a script unless i could use the default arma one? dont know if that would work

languid tundra
#

Sure, there are various ways. You could put the code in a function defined in cfgFunctions and call it or put the code directly in the statement attribute.

jovial idol
#

well i wouldnt be to sure how to put that in the cpp, would have to create a cfg functions bit like cfg vehicles would i not ?

languid tundra
#

But again, if you pass the wrong path, you will get errors again.

#

It's the preferred way to define functions

jovial idol
#

yeah, well you know how i would call user actions for open door close door etc.... on this? or would i have to completely change that aswell because the way i have done my code is pretty dodgy to be honest lo

languid tundra
#

Let's first check how the door opening interaction is done by BI.

#

BI's way would be preferred, since it also allows scripters to lock doors.

jovial idol
#

oh i see well im still learning so its only a learning curve sort of thing for me, been watching videos on it & thtat so im prosuming the door opening interaction is on that link you pasted for Arma 3 Functions libary

languid tundra
#

You can learn a lot from how BI implemented stuff. It's not always superior to other approaches, but can still be a guide for a first implementation.

jovial idol
#

il need to see about using BI's way about it, cos the way i have done it is obs the complicated way to do it lol

languid tundra
#

I'm checking out the config

jovial idol
#

my config?

languid tundra
#

Nope, one of BI

jovial idol
#

ah i see isee

languid tundra
#

How would I πŸ˜„

jovial idol
#

screenshot i sent xD

languid tundra
#

Check for instance Land_i_Stone_HouseSmall_V2_F in the config viewer.

#

BI has created a function already

#

statement = "([this, 1, 1] call BIS_fnc_Door)";

#

condition = "((this animationSourcePhase 'Door_1_sound_source') < 0.5) && (cameraOn isKindOf 'CAManBase') && ((this animationSourcePhase 'Hitzone_1_source') < 0.99999 )";

jovial idol
#

so if i add that in as a statment on my Config it might work?

languid tundra
#

You will have to adjust the condition

#

Door_1_sound_source and Hitzone_1_source are likely different names in your case.

jovial idol
#

i would probaly just leave hitzone source the same & the door sound could just make that my sound for it ? like the path?

languid tundra
#

You can use the same names for sure

#

Btw. the lines I copied is for the openDoor case

jovial idol
#

oki doke cheers lad, sort of got it working now πŸ˜„

astral tendon
#
3.39002e-007 > 1 //false

why is it returning false? isent that high than 1?

tame portal
#

3.39002e-007is 0.000000339002

west mesa
#

hello, was wondering if anyone could give me a hand (would be very appreciated), one of the things I have a hard time wrapping my head around in arma is how to reference an object without giving it a name with a script (so I can copy and paste without having to edit the script or rename anything) for example the current mission I'm working on I want to stand in a trigger area and have the block under it change color so I made this script _nObject = nearestObject [player, "Land_VR_Block_05_F"]; _nObject setObjectTextureGlobal [0,"#(rgb,1,1,1)color(1,0,0,1)"];
This works but the problem with it is, it targets me so if another player is in the trigger area it will change the closest VR block near me.

astral tendon
#
"ReviveDelay" call BIS_fnc_getParamValue; //return 0

this does not return the right value I set in the editor, is there other way to see the the values of revive?

ruby breach
#

@west mesa You want to change the color of the block under the trigger? Use thisTrigger as the argument in nearestObject. WIll return the block nearest to the trigger object, and not to the player triggering it.

west mesa
#

@ruby breach hm when I replace player with thisTrigger I get an undefined variable error

ruby breach
#

Is the code you provided in a function being called by the trigger, or in the trigger itself?

west mesa
#

the trigger is calling a script

ruby breach
#

Pass thisTrigger as a argument to your script

west mesa
#

@ruby breach alright thanks, gonna have to look up how to do that not the best at scripting πŸ˜› but i do appreciate your help!

ruby breach
west mesa
#

thanks

astral tendon
#

when a unit is unconscious it lost all actions and the AI canot heal that unit, nay fix to get the vanila actions back?

tough abyss
#

What actions it lost?

frigid raven
#

Just restating the question from before - mybe now sb. is awake to have an idea what the problem here is?
This is executed on my dedicated server side

["CAManBase", "killed", { call coopr_fnc_onKilled }] call CBA_fnc_addClassEventHandler;

But coopr_fnc_onKilled is never called. When testing in preview it does work but - that's not an excuse but an info

tough abyss
#

What does it return?

still forum
#

I have seen the same question when I went to bed yesterday πŸ˜„

#

My thought was killed might be local. But shouldn't be

peak plover
#

@frigid raven ```sqf
["CAManBase", "initPost", {_this call score_fnc_unitInit},true,[],true] call CBA_fnc_addClassEventHandler;
score_fnc_unitInit = {
params ["_unit"];
if (!local _unit) exitWith {};

_unit addEventHandler ['killed',{_this call score_fnc_onKilled}];

};

#

cba doesn't have killed I think

#

Can't remember but I think that's why it's like this

frigid raven
#

But how does it work on my preview then?

still forum
frigid raven
#

@tough abyss good questions - need to debug later in the evening

peak plover
#

Β―_(ツ)_/Β―

#

I wrote this a long time ago

#

but I tried using cba with killed

#

and for some reason I ended up with that

still forum
#

@tough abyss There we go. Dev-branch update is out.
Increased Dev-branch EXE version to 1.91
Added: say3d command extension to exclude speech category sounds from the filtering

astral tendon
#

Is this local or is for servers?

still forum
#

local

#

I don't quite understand your question

#

stuff on server is also local

#

local to the server

#

So I guess the answer is.. "Yes" ?

astral tendon
#

Kinda

#

I need to make it for every client or only for the server?

still forum
#

Depends what you want to do

#

If you want to execute the code on every client. You of course want it on every client.

astral tendon
#

for exemple:

addMissionEventHandler ["EntityKilled", { 
 params ["_unit", "_killer", "_instigator", "_useEffects"];
systemChat "some one died!"; 
}];

If I put that on initserver.sqf all players will have the systemchat when a unit dies?

tough abyss
#

That should only run the once so probably best on the server although there are other ways to do it too without it running on the server.

still forum
#

if you put that in initServer noone will have the systemChat

#

because systemChat only prints locally. Meaning on the server. And a dedicated server doesn't have a chat

astral tendon
#

so that is "local"

still forum
#

local means on the machine where the code runs

#

If you add the eventhandler on the server, the code will only execute on the server. If you only add it on a client, it will only execute on that client

astral tendon
#

Yeah, thats what I need to know.

unborn ether
#

Is it me or created displays and dialog now have built-in fade in timer?

tough abyss
#

@still forum Must be all those hot fixes

void ivy
#

Looking to have a script that runs for a given vehicle wherever that vehicle is local that continuously checks certain conditions and takes actions as appropriate. Only part I'm confused about currently is what's the best hook to start that loop and what conditions should I be checking to make sure loop terminates so that I don't have it running after locality has changed, vehicle has been removed, etc...

north lynx
#

Greetings, did someone maybe know how to hide objekts at the MianMenu-Arsenal? Maybe even with an example?

#

*main

west mesa
#

In a mission I know you can blacklist and whitelist objects from Virtual Arsenal, however I don't think you are able to hide or disable items from VA when opening it from the main menu not unless there's a mod that does it .

high marsh
#

"hide" ? Why not?

quartz coyote
#

Hello
I'm looking to adapt the size of my dynamicText depending on the UI size of each player for it to be automaticly adapted and not work for some and bug for others.

[format["<t color='#FF0000' size = '2 * (getResolution select 5)' shadow='1' align='center' font='PuristaBold'>Match will start in %1 seconds</t>",(Preptime)],-1,safezoneY + safezoneH - 0.2,1.5,0,0,4002] spawn bis_fnc_dynamicText;} remoteExec ["bis_fnc_call"];```
Would this work ?
solemn aspen
#

Looking for a little help with an sqf for some crates here:

//this goes in the init field of the crate 
//nul = this execVM "loadouts\SOCOM_riflebox.sqf";

if(!isServer) exitWith {};
_crate = SOCOM_Supplybox; 

        clearMagazineCargoGlobal _crate;
        clearWeaponCargoGlobal _crate;
        clearItemCargoGlobal _crate;

            _crate addWeaponCargoGlobal ["SMA_HK417_16in",5];
            _crate addWeaponCargoGlobal ["SMA_HK416CUSTOMCQBafgB",20];
            _crate addWeaponCargoGlobal ["SMA_HK416CUSTOMGLCQB_B",20];
            _crate addWeaponCargoGlobal ["SMA_HK416_GL_ODPAINTED",20];
            _crate addWeaponCargoGlobal ["sma_minimi_mk3_762tsb_wdl",5];
            _crate addWeaponCargoGlobal ["hlc_rifle_416D10_gl",20];
            _crate addWeaponCargoGlobal ["hlc_rifle_416N_gl",20];
            _crate addWeaponCargoGlobal ["hlc_pistol_P229R_Combat",20];
            _crate addWeaponCargoGlobal ["hlc_muzzle_556NATO_M42000",20];
            _crate addWeaponCargoGlobal ["SMA_supp1BOD_556",20];
            _crate addWeaponCargoGlobal ["sma_gemtech_one_wdl",5];
            _crate addWeaponCargoGlobal ["sma_gemtech_one_blk",20];
            _crate addWeaponCargoGlobal ["hlc_muzzle_TiRant9S",20];
            _crate addWeaponCargoGlobal ["hlc_muzzle_556NATO_KAC",20];
            _crate addWeaponCargoGlobal ["SMA_SFPEQ_HKTOP_BLK",20];
            _crate addWeaponCargoGlobal ["SMA_ANPEQ15_BLK",20];
            _crate addWeaponCargoGlobal ["optic_LRPS",5];
            _crate addWeaponCargoGlobal ["sma_spitfire_03_rds_black",20];
            _crate addWeaponCargoGlobal ["SMA_ELCAN_SPECTER_GREEN_ARDRDS_4z",20];
            _crate addWeaponCargoGlobal ["SMA_eotech552_3XDOWN_wdl",20];
            _crate addWeaponCargoGlobal ["SMA_MICRO_T2_3XDOWN",20];
            _crate addWeaponCargoGlobal ["hlc_acc_TLR1",20];
            _crate addWeaponCargoGlobal ["HLC_optic228_Siglite",20];
            _crate addWeaponCargoGlobal ["HLC_bipod_UTGShooters",5];
#

Would prefer to stay away from arsenal if at all possible.

still forum
#

I have seen that before... Was caused by tons of people adding/removing items at the same time

solemn aspen
#

Problem is there is only me doing it in that video. Also at most of the times guys are on the server there are maybe 2 guys working on the crate at same time

devout stag
#

I'm currently encountering issues in the hide and get loadout functionality.

#

My get/put goggles functions are working as intended.

devout stag
#

I fixed this issue, was due to the scope of my variables.

astral dawn
#

So I convert player's eyePos into his vehicle object's model space. Store it and every time interval I compare the new value with an old one like this:

// _unit is player
_nul = isNil {
    private _eyePosNewVeh = (vehicle _unit) worldToModelVisual (ASLTOAGL (eyepos _unit));
    private _eyePosOldVeh = _unit getVariable "eyePosOldVeh";

    if ((_eyePosOldVeh vectorDistance _eyePosNewVeh) > 0.15) then { 
        systemChat format ["=== Prev pos: %1, new pos: %2, distance: %3",
            _eyePosOldVeh, _eyePosNewVeh, _eyePosOldVeh vectorDistance _eyePosNewVeh];
    };
    _unit setVariable ["eyePosOldVeh", _eyePosNewVeh];
};

It's fine until the vehicle starts to move. Then the eyePos in vehicle's space starts to jump around. Like vehicle's position and player's eyes pos are not in sync. Any way to avoid this?

languid tundra
#

You probably shouldn't mix commands with the visual postfix with one without it like here
private _eyePosNewVeh = (vehicle _unit) worldToModelVisual (ASLTOAGL (eyepos _unit));

astral dawn
#

I tried to replace worldToModelVisual with worldToModel but it still works bad

still forum
#

You probably shouldn't mix commands with the visual postfix with one without it like here doesn't matter

astral dawn
#

Well it started working nice when instead of ASLTOAGL (eyepos _unit) I got player's VISUAL position.

#

But how do I get his eye pos in visual scope then?

languid tundra
#

Aren't the ones without visual more of an average?

still forum
#

visual ones are interpolated

#

they are the thing that you are actually seeing being rendered

languid tundra
#

Well, then. What about the isNil part? Are you using scheduled env?

astral dawn
#

yeah

languid tundra
#

Why not something like a for each frame EH?

astral dawn
#

Yeah I tried to debug it in onEachFrame {}

#

by attaching a test sphere to the car at the returned position

#

it was jumping around as well

languid tundra
#

Hmm. Anyway, BIS_fnc_addStackedEventHandler would be the preferred approach.

still forum
#

so problem is eyePos is jumping around?

languid tundra
#

Apparently

still forum
#

Yeah. It does that when you move fast

#

I got a fix

astral dawn
#

hmm I'll test it, thanks

astral dawn
radiant needle
#

How come when I use unitCapture and UnitPlay, tires dont move on the replay?

ruby breach
#

Because the function doesn't record animation states?

radiant needle
#

Tires should still spin

#

I'm watching tutorials, and on theirs, tires and even steering wheel moves

ruby breach
#

Just tested in the editor. The functions are inconsistent between replaying on the player unit, and an AI unit. AI unit nothing moves. Player controlled unit the tires would spin, but on a vehicle like the Zamak some tires would rotate backward. Things like engine sounds are also dependent on the player or AI having the engine on before the replay begins.

#

tl;dr: Bad functions are bad

astral dawn
#

@still forum
Thx a lot, _unit modelToWorldVisualWorld (_unit selectionPosition "pilot") did the trick, although I used "head" selection. Also lineIntersectswith works a lot better if supplied visual coordinates.

radiant needle
#

Why isn't this working?

[(_this select 1),0.1] spawn {
_Vehicle = _this select 0;
systemChat str (_Vehicle);
_Time = _this select 1;
_Vehicle addEventHandler ["Fired", {
_Vehicle setVehicleAmmo 1;
}];
};
#

If I do _Vehicle setVehicleAmmo 1; outside of the eventhandler it works fine

#

the EH is firing correctly, I added a systemChat

ruby breach
#

Because _Vehicle is undefined in the eventhandler

#
this addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
}];
#

Also, params

radiant needle
#

So how do I define it for the EH?

ruby breach
#

I just gave you how

radiant needle
#

just add params ["_vehicle"]; ?

ruby breach
radiant needle
#

SO just add params ["_vehicle"]; ?

ruby breach
#
fired
unit: Object - Object the event handler is assigned to //argument 0
``` You tell me
#

Is the event handler assigned to the vehicle?

#

If so, then the first param is the vehicle

radiant needle
#

Oh so params is just a shortcut for _this select 0, _this select 1

#

etc

ruby breach
#

Correct, with more functionality to allow you to define default/allowed values

#

It also makes variables private by default, instead of you having to use the private command

radiant needle
#

Okay, but how do I pass variables from the main scope into the EH?

#

Because I notice the _Time variable isnt getting to my EH

astral dawn
#

AFAIK you can't. But you can either store the variable in missionNamespace (not ideal) or in the object you attach the EH to (better)

#

Nothing gets passed into it because event handler is a totally different scope

#

Why do you want time in your EH anyway? WHen the vehicle fires, do you want to know the time when the EH was added?

unreal leaf
#

vehicle1 addEventHandler ["fired", format["_vehicle2 = %1",vehicle2]]; you can do something like this if you really need to

#

you can create event handlers with code {} or with a " "

#

so when you use format you can create some things to pass arguments

ruby breach
#

That's not actually doing anything different though

#

There's really no point to using strings for EVHs, as it just adds compile time

#

All what you posted did is the same as using a global variable in code

radiant needle
#

Does handleDamage not work?

ruby breach
#

The EVH? It works

quartz coyote
#

Hello
I'm looking to adapt the size of my dynamicText depending on the UI size of each player for it to be automaticly adapted and not work for some and bug for others.

[format["<t color='#FF0000' size = '2 * (getResolution select 5)' shadow='1' align='center' font='PuristaBold'>Match will start in %1 seconds</t>",(Preptime)],-1,safezoneY + safezoneH - 0.2,1.5,0,0,4002] spawn bis_fnc_dynamicText;} remoteExec ["bis_fnc_call"];```
Would this work ?
tough abyss
#

It is second time you are asking this, why don’t you paste it in debug console and try it yourself?

unborn ether
#

Is there any non-breaking space character accepted by Arma strings?

#

Oh nvm found it on wiki

wary vine
unborn ether
#

@wary vine Well what to think, looks proper.

still forum
#

@unreal leaf vehicle1 addEventHandler ["fired", format["_vehicle2 = %1",vehicle2]]; you can do something like this if you really need to No you can't. That works with numbers and strings. Not with objects and tons of other things. Please stop telling people that. Use setVariable/getVariable on the object the eventhandler is assigned on.

so when you use format you can create some things to pass arguments You are NOT passing any arguments when using format. You are just putting a string together that happens to contain a string representation of a value.

vague hull
#

Quick question:
Is spawning/keeping logic entities considered a performance hit?

To clarify the terms: how different is it from spawning a (non physx) vehicle/object or a unit?
How many of them could be considered an issue?
By spawning I mean keeping them for the runtime of the full mission, not the actual creation (which is only done once).

I want to use them to modularize script components an so on. Kind of like Singletons

There would be one for each component and about 30-60 in total depending on granularity

still forum
#

logics are simulated yes

#

Why do you need logics? Can't you just run the scripts..... without them?

vague hull
#

Ofc, it's just for grouping them.
Easier to work with probably

#

Basically namespace creation is the goal πŸ˜…

#

I heard ACE uses locations for that

still forum
#

CBA uses them yeah

#

because they have 0 performance impact besides rendering when you have map open

vague hull
#

That's nice

#

I think thats the solution for what I planned

delicate lotus
#

Hey, is addMissionEventHandler global or local? I already looked on the BIKI but it does not say if its local or global.

still forum
#

local

lost iris
#

how can i run a script every 5 mins?

young current
#

one way is to put it into a loop that sleeps 5 minutes

#

what kind of a script would it be though?

lost iris
#

Thats what I did

#

its a script that randomly select and objective location every 5 mins

#

another question as well, is there a way to respawn a player back to the location the unit was placed in the editor, lets say respawn a player back to lobby

#

@young current

young current
#

for that I have to say maybe. Im not that well versed in mission making.

lost iris
#

np, thanks anyway

devout stag
#

Question in regards to ACE, ace_interact_menu_fnc_createAction, I want to reference and add some icons to these interactions. My script (Olsen framework module) is found in modules\advanced_actions\.
The icons which I want to use are in modules\advanced_actions\resources\.

#

How would I properly reference these icons for arg 2 of ace_interact_menu_fnc_createAction?

still forum
#

just use the full path

devout stag
#

I attempted that but it broke telling me the file(s) didn't exist.

still forum
#

well I guess the path wasn't correct then

devout stag
#

So the full path would be modules\advanced_actions\resources\icon_name.paa then correct?

#

I've taken these icons out of the game in various but how would I best reference the icons in the games PBOs?

#

(In terms of efficiency and reliability.)

still forum
#

mission or mod?

#

I assumed mod

#

mission will either work like you posted. or you will need to find the mission fullpath

devout stag
#

Mission

#

What differences would the the 'mission full path' entail?

still forum
#

it's the path to the CUR_MP thingy

#

It's not constant. you need to dynamically retrieve it

#

there is code for it on KK's blog

queen junco
#

Hey there, quick Question. I am currently creating a warlords scenario in the editor. The official "custom asset list" in the discription.ext requires full assets like "B_Soldier_F"(https://community.bistudio.com/wiki/Arma_3_MP_Warlords). Any one has an idea how to use arsenal customized loadouts?

still forum
#

TIL compile and compileFinal are caching results.
Today I also learned, <REDACTED>
And this way you can <REDACTED>. I'm sure that's fun in MP if you can disable whatever function you don't like.

#

@queen junco First have a read of #rules before you seek help

#

Oh crap. Guys. Stop frigging using call compile.
Everything you compile is added to that cache and never removed. Meaning if you use call compile on things like extension returns and such, they all accumulate into what's essentially a memory leak.

So if you continously feed the same string into compile it's not that bad (It's still stupid though...) but if you always compile different things, like database returns, or by format'ing things into eventhandler (Yes, Eventhandler strings or addAction strings are compiled too, everything that is compiled is cached, not just the commands) everything add's up till you exit the game, or it crashes because it's out of memory.

cold pebble
#

Isn't this something for BIS to fix? πŸ€”

#

it'd be weird intended behaviour

still forum
#

I don't really see a fix though. Maybe let cached things expire if they haven't been used for some time? That's probably the best solution

dusk sage
#

Or an option to disable the cache might be good. Seems the ultimate solution was to allow an alternative, like they added whenever ago

still forum
#

They probably knew about it and that's why they added parseSimpleArray. But they should've been WAY more vocal about this problem...

dusk sage
#

Did you find this out by accident πŸ˜‰ ?

still forum
languid tundra
#

Oh God, this explains some memory leaks I created during tests πŸ˜„

still forum
#

Commy just mentioned that in ACE Slack.
Remember when they added parseSimpleArray? BI said it's faster than compile and better and everyone should use it. People profiled it and found it to be actually slower than compile so most people didn't see a need to switch.
Now we know why compile is faster. Because compile only compiles once and then caches the result.

#

lol. You can really see it too. Go into editor and paste that in debug console watch field (random 50000000000) toFixed 20 Then let it run (only in windowed mode) and watch Arma's memory usage in task manager. You can literally see it slowly climb up

umbral oyster
#

parseSimpleArray not caching data?

still forum
#

yeah

umbral oyster
#

but it dont work with string and already the circle of its use is narrowing

still forum
#

Wow..

onEachFrame {
_arr = [];
_arr set [500000,random 1215235345];
compile str str _arr;
};

You can see your memory usage increase in 100MB steps every half a second.

umbral oyster
#

ye, and this all saved in RAM....

winter rose
#

Ouch

umbral oyster
#

replace (call compile) it turns out not to what?

still forum
#

is that a typo? now instead of not?
Honestly.. No idea..
Maybe expect BI to fix it with already upcoming 1.90

umbral oyster
#

unlikely to happen

still forum
#

That's my Christmas gift to BI

winter rose
#

Charcoal*

tough abyss
#

Well that explains a lot of the problems with memory climbing with everything. That is an amazing find. My mods all just compile once and then utilised the returned code but this is so common you see it throughout a tonne of mods

still forum
#

Even compile once is a waste. I didn't check that really. But I think the instructions array is copied and the instructions too. For something that's just compiled once it's a huge waste

#

Compiling the same thing often is "good" now.. Theoretically

tough abyss
#

Shouldn't be a huge waste, it will be hanging around a bunch of references to the code but that is all the compile code is also presumably doing so it shouldn't waste much in the way of memory unless I have misunderstood you.

#

CBA also has its caching mechanism as well and I imagine that is getting called as well (since I use PREP and FUNC).

queen cargo
#

@still forum that is actually wrong on so many levels 😦

leaden summit
#

I have a vehicle spawner spawning boats for the players, it spawns the boat at a remote location and then moves that boat into the boatrack on the destroyer

I'm using the following code in the code line for the vehicle spawner

deletevehicle (getVehicleCargo boat_rack_1 select 0); boat_rack_1 setVehicleCargo objNull; boat_rack_1 setVehicleCargo this;```
and it works fine for the first go, the problem is ```getVehicleCargo boat_rack_1``` is an array that seems to keep growing every time I add a boat. I thought ```boat_rack_1 setVehicleCargo objNull;``` would clear that but it doesn't
#

So as it stands I would have to increment the select 0 every time I spawn a boat which doesn't seem right

#

I guess what I need to know is how to clear that array rather than just filling it with <NULL-object>

outer fjord
#

Anybody know of a nice none-ace repair script that repairs sections of vehicles?

tough abyss
#

@still forum makes sense for functions as they are all string loaded from file and compiled to code and the string never changes

#

I think parseSimpleArray primary benefit was secure data to array conversion from client extension. Now that client extensions need to be approved it is not as important

tough abyss
#

@leaden summit you put that in init?

#

Are you trying it it SP or MP?

leaden summit
#

No it's in a vehicle spawner module (MP)

#

Essentially it is getting run on the vehicles init I guess

tough abyss
#

In MP it will be executed on every client I imagine so you would get dupes and brokens

#

Also maybe you should unload and then delete rather than delete and then unload

leaden summit
#

Everything seems to work right, the boat spawns in the corner of the map and the first time it runs everything is fine, subsequent times though it just continues to fill the array

#

I put getVehicleCargo boat_rack_1 in a watch list and every time spawn a boat I just end up with another <NULL-object> and the boat spawned gets pushed further into that array

tough abyss
#

undefined behaviour is undefined. It might work one time it might work 10 times it might not work at all, you should use if (isServer) or if (local.. if you want to put stuff in init

leaden summit
#

Honestly I've used this vehicle spawner before a lot and added all sorts of commands to the vehicles through it. I don't think it's that.
Hang on I'll load up ARMA again and try without the spawner

tough abyss
#

Not all the time, but depending on if you put local or global commands in it

leaden summit
#

I get what you're saying, god knows I've had my run ins with locality in the past, but it just seems weird that boat_rack_1 setVehicleCargo objNull; doesn't empty the getVehicleCargo array

#

instead it just add another <NULL-object> to the array

#

it could be a case of I have to empty the rack before deleting the vehicle

tough abyss
#

@umbral oyster Try something like
call compile format ["[%1,%2,%3]", random 100,random 100, random 100]
vs
parsesimplearray format ["[%1,%2,%3]", random 100,random 100, random 100]

#

@leaden summit lemmie try, what are the classes for rack and boat?

leaden summit
#

Land_Destroyer_01_Boat_Rack_01_F

#

and I'm currently using a modded boat

#

I think I know what the problem is... it's me I'm the problem

tough abyss
#

Works fine here, still would suggest to unload the boat then delete it

leaden summit
#

I had at some stage turned off simulation on the boat rack and when it worked initially loading the boat I didn't think it would cause issues 🀦

wary vine
#

This won't affect me using compileFinal for my functions though right ?

tough abyss
#

what do you mean @wary vine , what else could you use for function?

cold pebble
#

Thats been mentioning so many times πŸ˜„

still forum
#

@wary vine everything is cached once seen. So your functions are also cached even though there is no need if they just get compiled once. Your code won't dynamically change though so the impact isn't that big.
But there is no alternative for compile. So you have no choice anyway

#

Okey I checked now. The string of the code is cached, but that's stored in the instructions anyway ( refcounted, so there is only one instance of that code) and the instructions are also refcounted. So the only waste is an array of pointers to all the instructions and a couple more pointers. Not really a problem.
The main issue here is that temporary things are suddenly permanent. In a call compile you don't care about the answer for long, you just wanna call and then you throw it away. Problem is it is not thrown away, it stays till you exit the game.
Go to a public server, play a mission there, disconnect. The functions of that mission are still in your memory. Now connect to a different server with a different mission with different functions. Now you have another load.

Especially big for framework missions like Liberation. They have tons of code, that you cannot get rid of anymore once you join the mission once.

I can make a logger I guess πŸ€” log which script files at which lines are calling compile. And accumulating the length. That should make finding problems easy πŸ˜„

tough abyss
#

BI should make a logger for profiling branch

astral tendon
#

color[] = {0.92,0.93,0,1};
how to get other colors?