#arma3_scripting

1 messages · Page 508 of 1

cosmic lichen
#

never used it myself though.

digital jacinth
#

that is already working, but i rather meant for scripts, like hitting restart when editing mission files

cosmic lichen
#

Oh sorry.

languid tundra
#

Maybe a for loop over the first n-1 elements and then add the last. Would at least get rid of the conditional. Needs to be benchmarked though.

cosmic lichen
#

with allowFunctionsRecompile = 1; maybe?

digital jacinth
#

hmm

#

that would be an idea

cosmic lichen
#

@languid tundra I'll try that,thanks

#

I actually think that would be slower. Since I do not have access to _x inside the loop and need to return the element everytime.

languid tundra
#

Yeah, that's why I said that it needs to be benchmarked.

cosmic lichen
#

Performance isn't really relevant here. Since it's only executed in the editor.

#

I guess I'll put that in a function so in the future it's a one liner to export things

digital hollow
#

You could just add the comma and new line every iteration and delete it at the end.

cosmic lichen
#

Thought about that too. Guess select should work?

languid tundra
#

Yes, it does.

#

Alternative to the for loop would be to feed froEach with the n-1 array, but that would internally allocate an extra array...

digital hollow
#

Have you tried joinString with the newlines?

tough abyss
#
_attributeValues apply {str _x} joinString (","+endl)

maybe @cosmic lichen ?

languid tundra
#

lol, go for joinString seriously!

tough abyss
#

shit

digital hollow
#

May not even need apply {str _x}

tough abyss
#

He used it

#

I mean str _x

languid tundra
#

joinString does it for you already

#

no need

tough abyss
#

you mean [1,2,3] joinstring "" will work?

languid tundra
#

yes, it will

tough abyss
#

well maybe he wanted extra ""

languid tundra
#

could be done with the separator though

exotic tinsel
#

hey, i could use somehelp with some code im trying to get working. Im trying to execute code remotley on a client from a server side addon. I need to be able to pass values in to it.
this is the call to the function that is supposed to remotely execute the code on the client.

[_Msg, {systemChat _this}, 1, _squadname] call utility_6_fnc_apply;

this is the code in the function that is supposed to remotely execute on the client.

params ["_ValuesForClient","_codeForClient", "_targetClientType", "_targetClientFilter"];

private _allHCs = entities "HeadlessClient_F";
private _allHPs = allPlayers - _allHCs;
{
    switch (_targetClientType) do {
        case 1: 
        {
            //this is for selecting players in squad            
            
            private _RoleDesc = roleDescription _x;
            private _temp = _RoleDesc splitString " - ";
            private _squadname = _temp select 0;
            if (_squadname == _targetClientFilter) then
            {                
                [_ValuesForClient, _codeForClient] remoteExec ["call", _x];
            };
        };
    }    
} forEach _allHPs;

error in getting

Error in expression <lter) then
{                
[_ValuesForClient, _codeForClient] remoteExec ["call", _x];>
  Error position: <_codeForClient] remoteExec ["call", _x];>
  Error Undefined variable in expression: _codeforclient
frigid raven
#

If I create a unit on the server-side I can still do selectPlayer on that unit for a player to take it over aye? But it will be local to the player afterwards 4 ever?

languid tundra
#

Yes, you can and it will stay local to the player unless you have some scripts or he disconnects.

#

@exotic tinsel
It would probably be better to not use remoteExec in a loop, but use -2 as the target instead and do the exception for HC inside the code you pass.

still forum
digital jacinth
#

cfgfunctions

still forum
#

Mod CfgFunctions or mission CfgFunctions?

#

for mod you have to set allowFunctionsRecompile. And I think there is a BIS function that you can call to recompile all functions

cosmic lichen
#

BIS_fnc_recompile

digital jacinth
#

yup
diag_mergeConfigFile ["P:\diwako_dui\config.cpp"];[] call BIS_fnc_recompile;

#

that is what i am doing, tho i believe i am missing allowFunctionsRecompile

#

tho no idea where to put that, i am only finding it for description.ext

cosmic lichen
#

in your description.ext

digital jacinth
#

anywhere specific?

still forum
#

description.ext should be enough to restart the mission

#

they are only stored in missionNamespace, and that's cleared when you exit the mission. So it HAS to recompile anyway

digital jacinth
#

nah, doesn't work i am doing something wrong...

still forum
#

Do you have the files in correct path in your Arma directory?

digital jacinth
#

pbo prefix is diwako_dui. I made a junction link in my root a3 folder called "diwako_dui" that links to the roo git folder where the config.cpp is located

#

same in the p drive

still forum
#

junction? I always use symlink.

#

dunno if Arma cares

digital jacinth
#

well starting up arma makes it load the unpacked files. For some reason I cannot make changes to sqf files and then restart the mission to make them apply.

#

wait a minute, when looking into the functions viewer they are recompiled but the systemchat command still shows the old value.. this is confusing

digital jacinth
#

Yeah I am giving up on this. i put allowFunctionsRecompile = 1; inside the mod config, the mission, into cfgFunctions, in the class in cfgFunctions and inside the child class functions. even cfgpatches and root config. I do see the changes in the functions viewer after mission restart, but the old code is still executed.

exotic tinsel
#

anyone know a quick solution to allow for incapacitated player to show up on map?

frigid raven
#

discord needs a quote feature

#

like if you agree

languid tundra
#

At least you can already use links

slim oyster
#
discord needs a quote feature
like if you agree```
#

I hate the lack of shortening on the direct links

frigid raven
#

ugly

frozen knoll
#

@exotic tinsel simple as to start off... you could then add condition to check player side etc
_drawOnMap = findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { { if (!alive _x) then { private _name = name _x; _this select 0 drawIcon ["pictureheal",[1,1,1,1],getPos _x,26,26,getDir _x,_name,0,0.07,"PuristaSemiBold","right"]; }; } forEach playableUnits; }];

exotic tinsel
#

@frozen knoll thx mate, ill test now

frozen knoll
#

for me i use variables to determine if a player is conscious or not and check that

rancid ruin
#

@tough abyss i wasn't whining, don't be a bitch

surreal vapor
#

Hello scripting people. I'm a little new to this. Can anyone tell me if it is possible to get 2D bounding boxes of objects on the screen? Similar to this image: https://i.imgur.com/4HUX6RK.jpg
But instead of actually drawing the boxes, save the coordinates of the box to a text file (also save an image of the screen)?

still forum
#

take the normal bounding box, and worldToScreen all points

surreal vapor
#

sweet, thank you!

#

In case I need any detailed help (I have never modded a game), is it OK to offer to pay people here for help?

still forum
surreal vapor
#

thanks again!

#

One potential challenge: how hard would it be to adjust the bounding box based on other objects blocking the view? For example, a soldier peeking above a barrier might only have a box around his head. Or a soldier completely behind a building would have no box.

still forum
#

oof

#

lineIntersects can probably kinda do it

#

but. It's basically just a single line from your camera to the target

#

so the more granularity you want, the more lines you need

surreal vapor
#

yeah i figured it could be pretty tough

#

i at least don't have to run it in real time if that makes it more possible

young current
#

@surreal vapor out of curiosity how do you intend to use the script? it does look like an interesting scifi-ish sensor input hud element

mint kraken
#

So I have a type 12 control (tree list) but I want to loop through the tree. But I am not sure what array to get in order to loop through it. My idea is that I add all players, then every now and then it refreshes the player list. My idea is why remove the list when u can just loop through them and see if they are online or not.

young current
#

wouldnt checking each player be slower than just dropping a new list?

mint kraken
#

Wouldnt it look weird? It would kind of collapse everything

young current
#

dunno

#

does anyone look a the list all the time?

mint kraken
#

Its for an admin camera, and if an admin is "patroling" they would see the menu just collapse every now and then.

young current
#

Id wager if the list isnt many hundreds long it should pretty much draw it in single frame

mint kraken
#

How would I loop through a tree anyways?

young current
#

that I dont know. 😄

mint kraken
#

hmm

mint kraken
#

anyone have any ideas?

tough abyss
#

Loop through a tree - either depth first or breath first are the usual ways.

quartz oracle
#

hey guys, im new to scripting in arma and i want to ask how i can get the number of kills a team (for example bluefor) has made ?

astral dawn
#

I think you should look into event handlers. Add a killed event handler, inside which you check who has killed the given unit and adjust the score array.

#

I might be wrong, probably it is already done in arma somehow, I don't know for sure

quartz oracle
young current
#

would that be what you are after

quartz oracle
#

oh yes thanks alot

astral tendon
#

Does anybody knows how to disable and heal players from the ACE hear ringing?

still forum
#

disable in general, or specific players only?

#

using earplugs is not an option?

lost copper
#

@astral tendon you should try to disable ringing by editing CBA Mission Settings

astral tendon
#

Its because I need to disalbe it for cutscenes

lost copper
#

In editor try "Ctrl + Alt + S" shortcut

astral tendon
#

I dont wanna totaly disable that feature, only for that especific moment

lost copper
#

So you want do disable this effect for small time interval?

astral tendon
#

Yes, or to cure the player from it before start the cutscene

lost copper
#

Hmm

still forum
#

[0] call ace_hearing_fnc_earRinging;[] call ace_hearing_fnc_updateVolume to disable ringing after it happened

lost copper
#

Or use @still forum variant(

still forum
#

Yours adds earplugs, mine stops ear ringing after it happened, so mine will still have players get their ears blown

astral tendon
#

@Dedmen your function only disalbe the ear ringing? is there a way to heal from it instead?

lost copper
#

Heal, of course

still forum
#

Mine heals it

#

like I said

lost copper
#

His variant is more powerfull😀

still forum
#

it stops ringing

astral tendon
#

its take some time to work, is there a way to make it instant?

still forum
#

Mine should be instant. I thought

astral tendon
#

It seems to make it last shorter

#

Its has this line

if (_strength < 0.05) exitWith {};
#

Maybe it does not work calling with 0?

still forum
#

oh

#

ye

astral tendon
#
[0.06] call ace_hearing_fnc_earRinging;
[] call ace_hearing_fnc_updateVolume;

Calling like this also not work

ruby breach
#

Undefined variables

lost copper
#

@astral tendon did you add script_component.hpp in your mission?

astral tendon
#

No

lost copper
#

i think it's important

astral tendon
#

Isent that already in ACE it self?

lost copper
#
#include "\z\ace\addons\hearing\script_component.hpp"
still forum
#

no it's not

#

just take the method of adding earplugs

lost copper
#

Isn't that right, @still forum ?

astral tendon
#

The problem is that I need to heal the ear ringing that the player might aready come and can have during the cutscene

lost copper
#

About adding script_component.hpp

quartz oracle
#

Hi guys im new to scripting in arma and somethink in this code doesnt work
i think its somewhere in the if statement but i dont know where it is exacly

player addMPEventHandler ["MPKilled", 
    {
    if( side _instigator == east) then 
        { 
            GLB_Kills_east = GLB_Kills_east + 1;
        };
    if( side _instigator == west) then
        {
            GLB_Kills_west = GLB_Kills_west + 1;
        };
    if( side _instigator == resistance) then
        {
            GLB_Kills_guerrila = GLB_Kills_guerrila + 1;
        };
    
    hint parseText (str GLB_Kills_east + str GLB_Kills_west + str GLB_Kills_guerrila);
}]
ruby breach
#

I've already answered you

#

You have undefined variables. _instigator is undefined

#

Deleting and re-asking the question isn't going to give you a better answer

frozen knoll
#

Use hint format

#

make sure you have a ; on the very end

#

Define instigator with params

#

params ["_unit", "_killer",”_instigator”];

#

hint format can keep the kills separate so you see how many kills for each unless you just want kills for all sides as a total

quartz oracle
#

@ruby breach sorry but i dont know you meant me

frozen knoll
#

hopefully you get what i mean valon.... you could also just go
_instigator = _this select 2;

#

`
player addMPEventHandler ["MPKilled",
{
_instigator = _this select 2;
if( side _instigator == east) then
{
GLB_Kills_east = GLB_Kills_east + 1;
};
if( side _instigator == west) then
{
GLB_Kills_west = GLB_Kills_west + 1;
};
if( side _instigator == resistance) then
{
GLB_Kills_guerrila = GLB_Kills_guerrila + 1;
};

hint parseText (str GLB_Kills_east + str GLB_Kills_west + str GLB_Kills_guerrila);

}];
`

quartz oracle
#

yes ill try it

#

how do i do it that the hint is seperatet
do i just have to do more hints

ruby breach
frozen knoll
#

hint format["East Kills %1 | West Kills %2 | Guer Kills %3",GLB_Kills_east ,GLB_Kills_west ,GLB_Kills_guerrila];

quartz oracle
#

thx

#

when i shoot him and he goes intro knockout (or how its called in arma)(where a teammate can revive him / he can force respawn) does it count as kill in my script ?

frozen knoll
#

i believe so.... test it and you will know 😃

quartz oracle
#

doesnt look like

#

it

frozen knoll
#

and after respawn ?

#

kill shows ?

quartz oracle
#

looks like it doesnt work :/

frozen knoll
#

where is GLB_Kills_east and your other 2 variables defined?

#

check your rpt for errors also

quartz oracle
#

its defined in the same script as the eventhandler (init.sqf)
and whats the rpt and how i can acces it ?

frozen knoll
#

for example defined like
GLB_Kills_east = 0;
before the eventhandler ?

quartz oracle
#

yep

exotic tinsel
#

how do you get a units loadout from a server side addon script?

frozen knoll
#

paste %localappdata%/arma 3

#

into a windows explorer address bar

#

and look for the latest while testing

quartz oracle
#

i bought arma 3 from steam is it in the steam arma file or in the one in dukuments

frozen knoll
#

%localappdata%/arma 3

languid tundra
#

There is an issue with getUnitLoadout returning "" on non-local machines. So it's best to remoteExec code on the client and send the result back.

exotic tinsel
#

crap

quartz oracle
#

does the latest get generatet always or just if there are errors ?

frozen knoll
#

if theres errors it will generally show

quartz oracle
#

ohh

#

now it work

#

i havent changed anythink

#

at least half way...

#

it have registert my kill but not my friend kill (me: east, myfriend: resistance)

tough abyss
#

@languid tundra do you have a link, curious to read about this issue

frozen knoll
#

seems like your on the right path valon .... good luck

languid tundra
#

The original issue is that when you change the locality of a unit, it can lose all its gear. There are countless threads in forums etc. When I investigated the issue in more detail, I noticed that you can predict if the unit will lose its gear, when you see that the machine you will it transfer to returns "" for getUnitLoadout.

tough abyss
#

I mean for the developer this should be extremely easy to track. The command returns array, so in order to return "" it has to literally return type string, and to find which branch returns string should take like 10 seconds for someone with code

languid tundra
#

Oh wait, it probably was an empty array instead 🤦

tough abyss
#

Anyway thanks for the link, nothing to be concerned with, looks like the use of command with global effect in local field, resulting in execution for every client. If there is an undefined behaviour in SQF this will be it, results are totally unpredictable when this happens, there are tonnes of examples with setObjectTextureGlobal being placed in init an fucking up spectacularly and unpredictably, same shit different day.

radiant needle
#

Does any one know if setVariable ["tf_unable_to_use_radio", true] applies for both transmit and receive?

quartz oracle
#

@frozen knoll idk i think not it just worked 3 times right now an we killed each other more than 6 times

surreal vapor
#

@young current I'm hoping to use this for training/testing an object detector. Normally we have to draw boxes by hand on thousands of images. So if we can use a videogame and make the boxes automatically, it could be a huge help.

frozen knoll
#

i dont know how you have it in your init.sqf but it should only be called on the server and added to player when connecting

quartz oracle
#

GLB_Kills_east = 0;
GLB_Kills_west = 0;
GLB_Kills_guerrila = 0;

player addMPEventHandler ["MPKilled", 
    {
   _instigator = _this select 2;
    if( side _instigator == east) then 
        { 
            GLB_Kills_east = GLB_Kills_east + 1;
        };
    if( side _instigator == west) then
        {
            GLB_Kills_west = GLB_Kills_west + 1;
        };
    if( side _instigator == resistance) then
        {   
            GLB_Kills_guerrila = GLB_Kills_guerrila + 1;
        };
    
    //hint parseText (str GLB_Kills_east + str GLB_Kills_west + str GLB_Kills_guerrila);
    hint format["East Kills %1 | West Kills %2 | Guer Kills %3",GLB_Kills_east ,GLB_Kills_west ,GLB_Kills_guerrila];
}];
#

that is how it look right now @frozen knoll

frozen knoll
#

remember running something in a inti.sqf will execute everytime a player joins

#

everytime you have a player join the kills will be reset to 0 for them

ruby breach
frozen knoll
#

for me personally the way i handle this is server side i create addPublicVariableEventHandler
"getPlayerData" addPublicVariableEventHandler {_this select 1 spawn myScript_getPlayerData};

#

myScript_getPlayerData = {
_player = _this select 0;
_player addMPEventHandler ["MPKilled", {_this call myScript_fnc_onPlayerKilled}];
};

#

and then local (player side when connecting)

#

i call it

quartz oracle
#

it shouldnt be just a scoreboard it should spawn vehicles if a teams get to many kills

ruby breach
#

Nothing you've given us would result in any vehicles being spawned.

quartz oracle
#

the lines that spawn the vehicles are comming later

tough abyss
#

@surreal vapor quite clever, is Arma realistic enough for that?

quartz oracle
#

Right now i just want to make the killcounter working

frozen knoll
#

first mention of vehicles since ive been reading

#

basically you need to make sure the eventhandler is added to the player from the server when player connects

#

otherwise you will have issues

quartz oracle
#

how can i make sure it is, is there some way I can check if the other player have the event handler on them ?

frozen knoll
#

investigate what i wrote above as a starting point

undone rivet
#

Can anyone please help me im new to arma 3 scripting and i want to figure out how to attack an obj to a vehicle please pm me if you can help

frozen knoll
#

some of that is taken from (but highly watered down) a working MP game mode im writing

high marsh
#
obj_1 attachTo[veh_1,[0,0,0],""];
#

second param is offset

quartz oracle
#

also in which file do i have to put think that you shuld run from the debug console als lokal ?

frozen knoll
#

depends if you want to just have a mission file or also create a server side folder for handling server functions
i would do the later but if your just making something not to complex and just want to use some MPevents then make use of the initServer.sqf

quartz oracle
#

because i have this mod
https://steamcommunity.com/sharedfiles/filedetails/?id=1420266916

and he says:

publicVariable "DCON_Garage_Enabled";```
Put any of these somewhere in your mission file or run it locally on the console. By default this value is set to 1

and i want to have in on 0, when i do it via console run lokal it works but if i run it via init.sqf it just deactivates it for me
#

it should deactivate it for everyone

frozen knoll
#

readup about what executes what and when

quartz oracle
#

ok

#

look like its because of the reviving that you have to kill the player not just knock him out

frozen knoll
#

your having 2 conversations one about ur mpKilled and one about vehicles tackle one thing at a time 😉

quartz oracle
#

ive fixed it with the mpkilled it was because of the revive think

radiant needle
#

Is there any event handler that would fire when a mine detonates?

still forum
#

Yeaaaaa.... Kinda.... It's complicated

#

there is a config EH in the ammo

radiant needle
#

I'm surprised killed doesnt fire it

surreal vapor
#

@dusty tulip Not 100% sure, but some people have had success using "synthetic data" from video games

exotic tinsel
#

is it possible to have command messages show up for all players and not just squadleads? if so any direction on how would be very appreciated

west venture
#

Command channel?

#

Sorry, that's a no. What you can do is either just use Side channel (like the rest of us scrubs) or make a custom channel.

tender vector
#

Is there a way to remove the explosion crater decals that are left by mortars and such in an area?

frozen knoll
#

for heli crashes i use

#

//delete craters made by heli crashes _crater = nearestObjects [player,["CraterLong"],250]; { deleteVehicle _x; } forEach _crater;

#

put it inside a loop

tough abyss
#

@tender vector I think you could just delete object of type ”#crater" at the explosion position

harsh vine
#

hello👋 does anyone know how to make an Event Handlers for injured players for example : " Player 1 was injured by Player2 " and i would also like one for ai's too for example "Player 1 was injured by AI"

fleet hazel
#

Hi guys. I have my character's coordinates relative to the model. I received them: cursorObject worldToModel (getPosATL player)
and got: [-3.00928,2.45508,-4.37009]. How do I spawn the object at these coordinates, relative to the cursorObject.

#

_model = "Land_MetalBarrel_F" createVehicleLocal [3.00439,2.06445,-4.37009]; dont work

winter rose
#

@fleet hazel modelToWorld iirc

fleet hazel
#

@winter rose cursorObject modelToWorld [3.00439,2.06445,-4.37009] ?

quartz oracle
#

is there a way can can add a event handler to all vehicles in the mission
i want to attach a GetOut event handler to every vehicle in the game thats starts a timer when the player exits the vehicle and respawns the vehicle after the vehicle doesnt got used for an amount of time. it should also be reatacht when the vehicle get respawnt and the timer should stop / reset when a player gets back in ?

vernal mural
#

@harsh vine pretty straightforward. The "hit" eventhandler already contains the type of damage and the origin of the injury

#

BTW, I was wondering if there is a way to identify a weapon uniquely ? I would like to keep track of an object even when it is placed on the ground by a player, or passed to another player. I know it's not possible for items, but as weapons can be passed directly with attachements, they can be differenciated from each others in a given WeaponHolder. So there might be a unique identifier ?

vernal mural
minor needle
#

I wrote a script that allows me to blacklist items depending on combat role and it works ok so far, but it simply removes the item from people's hands/inventory. Is there a way I could hide the items from the BIS arsenal instead? Cant do it in Eden since its supposed to adapt to the player's chosen role

vernal mural
minor needle
#

If I run that script in initPlayerLocal on every player's client they all get a different arsenal I'm guessing?

vernal mural
#

[object,itemClasses,removeGlobally] call BIS_fnc_removeVirtualItemCargo
removeGlobally parameter let you decide if the removal should be for everyone, or only on the runner's machine. So as long as you run it with this parameter set to "false", from the initPlayerLocal script, yes, each player will see it's "own" arsenal

minor needle
#

Alright I'll try that

#

Thanks

cold pebble
#

@quartz oracle getOutMan evh on each player would work

tough abyss
#

@fleet hazel no, you pass the same value you got from worldToModel, unaltered.

fleet hazel
#

@tough abyss What? I you dont undestend

winter rose
quartz oracle
#
{ params ["_vehicle", "_role", "_unit", "_turret"];
sleep 10; 
_vehicle setdamage 1;
}];```
i do somethink wrong but i dont know what 
please help
#

the error should be in line 3 btw

thorn saffron
#

Is it possibile to select units to command by using scripts? I mean select a member of your squad like you select him using the F keys.

young current
#

you can list all units in group, select any of them and run commands on them. But at least some of actions when they end will return the unit back to the formation/under squadleaders commnad

lost copper
#

@quartz oracle You can't use sleep in EH body. Try to do this with spawn

thorn saffron
#

I want only selection. I want to select a specific unit like you would do normally with a keybind.

quartz oracle
#

how exacly ? im new to scripting in arma

lost copper
#
this addEventHandler ["GetIn", {
     params ["_vehicle", "_role", "_unit", "_turret"];
    (_vehicle) spawn {
        sleep 10; 
        _this setdamage 1;
    };
}];
quartz oracle
#

ok thanks ill try it

lost copper
#

I'm not sure, but this syntax should work

young current
#

trawling through scripting commands page is always helpful 😜

thorn saffron
#

I wasnt sure if it would even be there. The arma command menu is kinda closed, like there is no way to trigger orders like take cover and such.
Still thanks, that is exactly what I needed.

tough abyss
#

There is AI scroll menu order for taking cover?

thorn saffron
#

Yup under 1 IIRC

tough abyss
thorn saffron
#

The thing is there is no way to trigger the vanilla "Take Cover" function/ order. This leads to every AI mod having to script its own version of the command.

quartz oracle
#

@lost copper doese the spawn do other thinks too because vehicles start spawning in each other ?

lost copper
#

@quartz oracle did you change code inside "spawn" block?

quartz oracle
#

whats the spawn block 😄 😦

lost copper
#
spawn {
    //code here
}
quartz oracle
#

no i havent

lost copper
#

And where you execute EH code?

quartz oracle
#

i used the exact script you gave me

#

in the vehicle init

lost copper
#

In attributes of vehicle?

quartz oracle
#

yep

lost copper
#

Code, written in this field, executes on every client, include server. Also EH fires every time, when player get in the vehicle

#

So you can try to add this EH only on server side

quartz oracle
#

but this vehicle havent spawn in it self just all the other

lost copper
#
if (isServer) then {
    this addEventHandler ["GetIn", {
        params ["_vehicle", "_role", "_unit", "_turret"];
         (_vehicle) spawn {
                    sleep 10; 
                    _this setdamage 1;
            };
    }];
};
#

@quartz oracle This vehicle doesnt spawn when mission starts?

quartz oracle
#

no at the start of the mission al went right but after a few minutes and destoryed vehicles they startet to spawn on itself

lost copper
#

Hmm. Can you check respawn of this vehicle without this code?

quartz oracle
#

yes ive deletet the code and i test it again

thorn saffron
#

Say I have 2 array like this [1, 2, 3] and [3, 1, 2] and I want to see if they have the same values inside, regardless of the order. How do I compare them?

still forum
#

are there duplicates in the arrays?

thorn saffron
#

no

still forum
#

count (_array1 arrayIntersect _array2) == count _array2

tough abyss
#

This will only work if count arr1 == count arr2 to begin with

#

Normally you would sort both arrays and compare them

still forum
#

if they have the same values inside

#

If they don't have the same number of values, they cannot have the same values

tough abyss
#

Comparing [1,2,3,4] and [1,2,3] will return true using your method, no?

still forum
#

of the longer array is _array2 then yeah. If they ahve different number of elements it would be more efficient to compare lengths first

cerulean whale
#

Question, with extdb3 is there a way to bypass the .ini file and just put in a query as a string? (For testing)

tough abyss
#

And comparing [1,2,3] with [1,2,3,4] will return false, yes?

still forum
#

if the longer array is _array1 yes

tender vector
#

@tough abyss @frozen knoll I have tried using the script

private _craters = allMissionObjects "#crater";
for "_i" from 0 to ((count _craters) - 1) do 
{ 
 private ["_crater"]; 
 _crater = _craters select _i; 
 deleteVehicle _crater; 
};
``` But it does not seem to be removing craters caused by mortar strikes. Any ideas?
high marsh
#
_craters = allMissionObjects "#crater";
{
    deleteVehicle _x;
} forEach _craters;
#

Should be a little more concise.

tough abyss
#

It seems you cannot delete it with deleteVehicle. This works though

{ _x hideObject true } forEach allMissionObjects "#crater";

it is ok to hide it it will self delete when engine cleans craters up @tender vector

high marsh
#

Nice observation M242

#

I thought craters were like any other object except their simulation was specifically "wreck" or some other static type.

tender vector
#

Thanks a lot for your help

vapid drift
#

Anyone know how to continue playing mission music through the endMission screen vs the success music or an immediate silence as is currently the case?

high marsh
#

if it's a mission, no.

#

a mod could probably do this

vapid drift
#

yeah, just a mission

#

I guess I could just sort of create my own

high marsh
#

why not?

vapid drift
#

lol man everything is such a pain in the butt

high marsh
#

¯_(ツ)_/¯

tough abyss
#

don't end mission with endMission, simples

high marsh
#

Never let it end :^)

vapid drift
#

lol

jade imp
#

is it possible to make a certain respawn point only available for a certain group?

tough abyss
#

Yes, with base respawn option if you place respawn marker and name it with group leader then it will be used by that group. For example group leader name is bob then respawn marker named respawn_bob will be used by bob's group members

jade imp
#

okay, thank you!

#

would it be possible to make the marker's name a variable? such as 'groupowner'? I have an action that creates a group and makes the caller the owner, which means the owner isnt one definite person

tough abyss
#

You can name the leader dynamically with setVehicleVarName

drowsy axle
#

if ( "ACE_earplugs" find (getUnitLoadout player) ) then {
    hint "Your Character already has a pair of Earplugs."
} else {
    hint "Your Character doesn't have a pair of Earplugs, here you go."
    player addItemToUniform "ACE_earplugs";
};``` How can I do this correctly? ` "ACE_earplugs" find (getUnitLoadout player)` Returns a Generic Error in Expression.
#

You know... I don't know how I cannot read the wiki...

#

Am I blind or something...

#

"ACE_earplugs" find (getUnitLoadout player) should be (getUnitLoadout player) find "ACE_earplugs" and getUnitLoadout returns a number.

lost copper
#

You use wrong command @drowsy axle, gimme a minute

#
  1. find return the index of first element in array, which is equal to element, that you want to find. If command can't find it -1 returns.
    So correct expression looks like:
    ((_array find _obj)>-1)
    This code returns bool for "if" construction
lost copper
#
  1. getUnitLoadout returns a Unit Loadout Array, specified in CfgVehicles or mission config. I think, that you want to analize current unit loadout, so you need to get all items from uniform, backpack and vest of the unit.
    This containers can be getted by "everyContainer" (https://community.bistudio.com/wiki/everyContainer) and items from each container can getted by "itemCargo" (https://community.bistudio.com/wiki/itemCargo). In the end you will get 3 array of classnames you should only try to find "ACE_earplugs" in one of them, @drowsy axle.
drowsy axle
#

I believe if ACE is to auto place EarPlugs that it's in the Uniform

lost copper
#

By default ACE add ear plugs for units with heavy weapons (machineguns, AT launchers, etc.). But you always can add one ear plugs for each unit in mission 😁

tough abyss
#

This script is giving me a blank init error box. I'm trying to make it so you read enemy documents to get your next objective

#

this is the script in the init field of the documents: this addAction ["Read documents",{ player createDiaryRecord ["Diary", ["Intel", "Enemy forces are planning an attack on <marker name='attack'>Checkpoint Lima</marker> using suicide bombers"];

unreal leaf
#

Thats all the code?

#
    "Read documents",{
        player createDiaryRecord [
            "Diary", 
            ["Intel", "Enemy forces are planning an attack on <marker name='attack'>Checkpoint Lima</marker> using suicide bombers"];

You are missing 2x] and 1x}

tough abyss
#

so at the very end it should be ]]};

unreal leaf
#

]}]

#

you need to count the amount of brackets you open

astral tendon
#
[guy1] join grpNull

Does that makes the unit actually join a null group for one frame or he creates a new one and joins?

queen cargo
#

tells you all you need

astral tendon
#

"To have a group member leave a group, join him with the grpNull group"
this anser is incompleted

#

Do they always keep in the grpNull? what is the side of grpNull? when do they leave it?

queen cargo
#

if you would read the full paragraph, you would come to the conclusion, that joining grpNull is impossible using join

#

but beware, as brand new group is created for the leaving unit and this could result in the number of groups in a mission growing out of control.

astral tendon
#

So, they don't actually join a grpNull, they create a new one and then join.

queen cargo
#

according to the biki, yes

astral tendon
#

Is there a way to know if a object have simulation? like I know that a ball in the have has simulation but the VR arrow does not have, is threre a way to check that?

queen cargo
#

better cross check that

#

(can be done using discord bot sqf-vm ... but i do not have the class names for either of those you listed)

astral tendon
#

Its seems like objects that have the option in the editor to make they simple objects usualy have simulation but im not 100% sure

queen cargo
#

uhm ... what?

#

gimme the classes of those two ... i am not sure how that is actually done or consult #arma3_config as chances are, they actually know what makes an object have simulation

astral tendon
#

Land_Bodybag_01_empty_black_F (has simulation) and Sign_Arrow_Cyan_F (don't)

#

I was trying to use they to attach agents making animation as wounded.

still forum
#

@drowsy axle CBA_fnc_uniqueUnitItems
"ACE_earplugs" in (player call CBA_fnc_uniqueUnitItems) That's just about how ace does it

astral tendon
#

and by making the object invisible it does make it still with out disable the simulation, because swichmove in a non simulated attach object make the animaton akward

queen cargo
#

getText (configFile >> "CfgVehicles" >> "Sign_Arrow_Cyan_F" >> "simulation") => "house"
the other one is not in my config on discord actually

#

but this should give you some idea about how to check

tough abyss
#

Got a relatively simple question. I just want to define a group as the squad leader’s name (e.g. a1). I heard you can put the following in the init of the SL: a1 = group this . I think I might be doing something wrong.

#

So, when the SL passes through a trigger, it applies to the rest of the squad

digital hollow
#

The first part is fine. Second part: apply what?

tough abyss
#

A basic script like Combat

digital hollow
#

So setCombatMode when the group reaches a certain spot?

#

You can put that code in the waypoint as well, which would probably be simpler.

tough abyss
#

@digital hollow it isn’t that simple

#

The code that is

#

I need the trigger to apply to the whole group

digital hollow
#

The group is available in the waypoint script, im pretty sure.

tough abyss
#

It’s much more than that. I’ll have to test it later

tough abyss
#

This script is working properly, but the command "deleteVehicle intel" is happening right away. I'm trying to make it so you read the documents and then they disappear, which is tied to a trigger !alive intel;

#

this addAction ["Read Documents", deleteVehicle intel,{ player createDiaryRecord ["Diary", ["Intel", "Enemy forces are planning an attack on <marker name='attack2'>Checkpoint Lima</marker> using suicide bombers"]]}];

#

What's a good way to make it so the task is completed when the intel is picked up?

#

Basically, I want "deleteVehicle intel" to happen AFTER you select the "read documents" action

languid tundra
#

Please use the syntax below for making your code more readable:
```sqf
my code
```

Also your code has a syntax error, consult the BIKI https://community.bistudio.com/wiki/addAction.
Note that deleteVehicle intel does not count as type "CODE", but {deleteVehicle intel} does.

nocturne basalt
#

hi guys. Im running a script that is triggered with the engine eventhandler. this script start a while loop that keeps running as long as the engine is on, and takes a few seconds to loop once.

my problem is this. if (for some reason) someone turns on and off the engine very fast, I end up with having multiple instances of the same loop running. I would like to terminate the older ones if a new one starts. Can I detect instances of running scripts and terminate them?

winter rose
#

@nocturne basalt you could via scriptDone and terminate for example

languid tundra
#

Or use something like CBA_fnc_addPerFrameHandler/CBA_fnc_removePerFrameHandler instead of a while-loop.

nocturne basalt
#

Ok thanks gonna check it out

#

@winter rose where would you store the script id? I run it with execVM in the eventhandler. So next time the EH is triggered I wont know what the last id was

#

Maybe diag_activeSQFScripts to fetch them?

tame axle
#

Hi all I'm trying to add an 'addaction' to one unit, but everyone close to him can see and use the action. How can i make it private to a single player/unit.
sqf myPlayer2 addaction["Execute the file","test.sqf"]

#

sqm myPlayer2 addaction["Execute the file","test.sqf"]

#

sry, not sure of the tag for code.

vapid drift
#

@tame axle in the condition you could do something like "player == _originalTarget"... that might work?

tame axle
#

using that in the init of the unit.

vapid drift
#

No, hold on a sec

tame axle
#

ah, the 'condition' parameter of the addaction function...

nocturne basalt
#

@tame axle set the radius to 0.1

vapid drift
#

yeah, that would probably work too

tame axle
#

thanks radius worked. cheers

tame axle
#
this addAction ["<t color='#0000FF'>Commence Insertion","scripts\teleportGroup.sqf",nil,1,true, true, "", "true", 0.1, false];
frozen knoll
#

have i completely overlooked something.... is there a quick way to get loaded magazine and ammo amount of a particular weapon... lets say primaryWeapon ???

#

i just got it by the below but it seems like there should be a fast way

#

`_magmagazinesAmmoArray = magazinesAmmoFull player;
_weaponMag = [];

{
if (((_magmagazinesAmmoArray select _forEachIndex) select 4) == (primaryWeapon player)) then
{
_weaponMag append [((_magmagazinesAmmoArray select _forEachIndex) select 0),((_magmagazinesAmmoArray select _forEachIndex) select 1)];
};
} forEach _magmagazinesAmmoArray;`

#

this is so i can remove the mag and add it back later with correct ammo amount

ruby breach
#

@frozen knoll Wouldn't it be easier to just use something like ```sqf
getUnitLoadout player param [0,[]] param [4,[]] param [1,-1]; //returns PrimaryWeapon's Primary Muzzle ammo count, or -1 if no weapon/magazine found

frozen knoll
#

yep definitely a quicker way 👍

#

cheers mate

tough abyss
#

has anyone gotten a hold of the source for killzonekids make_file (file writing extension) or have a source i can use? i need to be able to write to a text file from a single player session. ive tried to make my own extension but for whatever reason, extensions i compile dont seem to have any effect in a3. made sure they are in 64 bit, release instead of debug, followed instructions on a3 site and on killzone kids.... but with all the updates to visual studio (im using the latest) it feels like there could be some crazy setting deeply baked into it that doesnt let it work for me!

#

at a glance ```// a3filewrite_64.cpp : Defines the exported functions for the DLL application.
//

#include "stdafx.h"
#include <fstream>
#include <iostream>

__declspec(dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
void write(char *text);

int strncpy_safe(char *output, const char *src, int size)
{
int i;
size--;
for (i = 0; i < size && src[i] != '\0'; i++)
{
output[i] = src[i];
}
output[i] = '\0';
return i;
}

void write(char *text) {
std::ofstream myfile;
myfile.open("D:\1.txt");
myfile << "Face" <<"\n";
myfile.close();
}

void RVExtension(char *output, int outputSize, const char *function)
{
char message[] = "Hello";
//write(output);
write(message);
char outputs[] = "output";

//strncpy_safe(outputs, function, outputSize);
strncpy_s(output, outputSize, "IT WORKS!", _TRUNCATE);

}

#

i was unsure if a3 extensions needed to be named name_x64.dll and called with just the name part cause the doc was weird on that, so i tried renaming my dll to _x64 (its named _64 cause thats how i named the solution)

#

but that changed nothing

#

i dont know if its anything wrong in the DLL that just makes it not load on a3 startup, or if its not compiled properly. how even could i know?

#

and other extensions work - i dropped killzonekids make_file_x64.dll into aram3 root and it worked right away

#

ive also disabled battleEye

still forum
#

https://discordapp.com/channels/105462288051380224/105462984087728128/531987876649369600 🤦
Ya'll literally only need to copy paste what ya'll been told. https://discordapp.com/channels/105462288051380224/105462984087728128/531940186238615563 don't understand why so many people have problems with copy pasting
i need to be able to write to a text file @tough abyss https://github.com/pennyworth12345/ConfigDumpFileIO/releases

how even could i know? dependency walker. Check if the exports are correct and there are no missing libraries
Maybe compiled as /MD instead of /MT ? That adds a requirement on additional libraries

tough abyss
#

not sure what youre saying withe the first two links, i am using the code syntax, its clearly there

#

i'll give that configdump thing a look, cheers

still forum
#

the first two links are not targeted at you. Just processing all the backlog from while I was sleeping

tough abyss
#

the entire message block @ 'd me lol

fringe widget
#

I was wondering if someone might be able to kindly help me with the Animdone event handler?

astral dawn
#

@fringe widget Probably people can help you here if you describe your problem

fringe widget
#

Alright, so I am trying to use the push up animation "AmovPercMstpSnonWnonDnon_exercisePushup" in combination with the Animdone event handler to create a loop in which my ai unit does push ups continually. This is followed by romoteexec'ing this into mp.

My main concern is that the event handler doesn't loop this animation. My scripting knowledge is very poor so in the interim I gave the ai cycle waypoints and used this code on the move waypoint as a juryrigged method of making them repeat it. But I'd like to know for my future use how to make them repeat the animation.

My code:
if ( isServer ) then{ [this, "AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExecCall ["playMoveNow", this, true];this addEventHandler ["AnimDone",{ params ["_unit", "_anim"];if ( _anim == "AmovPercMstpSnonWnonDnon_exercisePushup" ) then{ [_unit, " AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExecCall ["playMoveNow", _unit, true]; };}];};

astral dawn
#

First of all make sure that your event handler gets fired at all, add some diag_log or systemChat into it

#

Also embed your code into discord like this: ''' at start of code block and ''' at the end.

#

''' are the ' at your ~ key actually, the one which is above tab

#

Also... waht is this and why do you have to remote call the code on the owner of the AI? Is AI owned by a separate machine, not by server?

#

Oh I think you add the code into the init field of the ai guy, right?

fringe widget
#

right

#

the handler seems to have ran.

astral dawn
#

and... does this branch get activated? if ( _anim == "AmovPercMstpSnonWnonDnon_exercisePushup" ) in other words, does it return the proper animation name?

fringe widget
#

yeah I don't really know what I'm doing with diaglog or system chat within that script. should've been more upfront

astral dawn
#

just do systemChat format ["_unit: %1, _anim: %2", _unit, _anim]; inside the event handler or something of that kind. Also check how to use the .rpt file and how to use the diag_log command (it's really simple). This should be enough to debug your simple script for now.

fringe widget
#

yep so that branch is activated.

tough abyss
#

@fringe widget what do you need remote exec for?

fringe widget
#

@tough abyss running the animations in mp

tough abyss
#

And why do you need it to be persistent?

fringe widget
#

I want the ai to continue doing the animations if thats what you mean?

tough abyss
#

Playmove is global already

fringe widget
#

I couldn't get it to work

tough abyss
#

No I mean the use of persistent flag in remote exec

fringe widget
#

can you expand on that for me? haha

tough abyss
#

No, there is wiki for that which I assume you read before using the command, right?

fringe widget
#

I don't understand the term 'persistent flag'

tough abyss
#

The 3rd param in remote exec, right after the target param

astral dawn
#

Find out who owns your AIs. See owner on wiki.
If they are owned by server all the time then there is no use to use remoteExec at all, because they are local to the server already.
If they can join player's squad then they will be local to player as far as I know, then playMove must be executed on player's machine.
But I assume your AIs are owned just by server right now.

tough abyss
#

Or, create an agent on the server and loop it in animation and skip all malarkey with AI and ownership

fringe widget
#

returns a 0 for owner. @astral dawn

tough abyss
#

i was unsure if a3 extensions *needed* to be named name_x64.dll and called with just the *name* part cause the doc was weird on that, so i tried renaming my dll to _x64 (its named _64 cause thats how i named the solution) it needs to be compiled in 64-bit mode and it needs to be named name_x64.dll and it needs to be called "name" callExtension... which is clear as day from wiki https://community.bistudio.com/wiki/callExtension @tough abyss

astral dawn
#

You only need to bother with it if you are in multiplayer

tough abyss
#

@fringe widget if it returns owner 0 in MP you are executing command on client and not server

fringe widget
#

okay so the leader isn't soing the animation because hes the drill sergeant or whatever. the others that are, aren't 'leaders' so therefore they will not be local? or have I ballsed that up?

astral dawn
#

all units in one group are local to one computer
but if your units are just local to the server, you don't need the remoteExec at all

tough abyss
#

What is the purpose of your animation @fringe widget ? You want a group of soldiers doing push-ups continuously for immersion?

fringe widget
#

yes @tough abyss thats it

tough abyss
#

Why didn't you say so straight away, very difficult to help someone with the XY Problem (google it if you want) . Anyway, you dont need AnimDone EH as pushup animation is endless. Put a group of AIs in editor and add this to the leader's init:

if (isServer) then
{
    {
        private _pos = getPosASL _x;
        private _dir = getDir _x;
        private _a = createAgent [typeOf _x, [1,1,1], [], 0, "NONE"];
        deleteVehicle _x;
        _a disableAI "ALL";
        _a setDir _dir;
        _a setPosASL _pos;
        _a switchMove "AmovPercMstpSnonWnonDnon_exercisePushup";
    }
    forEach units group this;
};
peak plover
#

What happens if someone jips

#

Will the animation persist properly?

tough abyss
fringe widget
#

can confirm JIP works. @tough abyss thanks for your help. I was a bit nervous posting for the first time. Is there an easy way to remove these ai of their weapons and vests?

#

I wasn't sure where to place the removeallweapons command or if it would work.

tough abyss
#

should work

#

place it after deletevehicle

#

removeAllWeapons _a

#

AAAAAAA! just noticed a little problem, this is hilarious!

#

After each set of push ups the unit gets up and then starts over. When unit gets up, it makes a tiny step forward. So after some time it "walks away" from original position

fringe widget
#

hahaha thats great

tough abyss
#

and if you have leader facing group you can see how it is going to go

fringe widget
#

i means its almost comical enough to leave in

tough abyss
#

yeah dont know if one would want to tackle this, might overcomplicate the code, not worth it

marble pasture
#

quick question, because I still have no idea what I'm doing. I've go barrels that need to be loaded onto a truck that are going to be an objective trigger. I have an event handler to check if they've been loaded with ace3 cargo. that works. but I cant figure out how to numerically count them. At the moment I've tried a few different things and havent gotten it to work. Currently I've got 4 barrels listed in an array _barrelarray_1 = [barrel1,barrel2,barrel3,barrel4]; and I should be able to use that to check if any of the barrels have been loaded?

frigid raven
#

quick question, because I still have no idea what I'm doing for a short time I thought my "second me" has an own discord account

marble pasture
#

Well... I did not expect the arma script pool to be this deep when i jumped in.

tough abyss
#

It is deeper

winter rose
#

follow the white rabbit… 🐇

marble pasture
#

snorts I aaaaaaaaaaam, Im loving learning it all. Its just instances of 'oh this should be easy...." never are, and I havent learned that lesson yet, lol

#

really though, I can use an array set up like that to replace me going "this or this or this or this" becuase that's so... brutish.

winter rose
#

do you have experience in other languages?

#

(I am tempted to add "forget about it" ^^)

marble pasture
#

Java, some C++ but its been a loooong time since i've had to use those. I'm slowly moving into scripts from the art and modeling side of things. turns out I like making missions a whole lot.

digital hollow
#

It looks like ace cargo keeps what a vehicle is carrying in an object scope variable. You can get it with

private _loaded = _interactionVehicle getVariable ["ace_cargo_loaded", []];
#

Are you already referencing the ace github?

marble pasture
#

had to leave for work, so I can't look at my code at the moment. Though here's the gist of the concept

_barrelarray_1 = [barrel1,barrel2,barrel3,barrel4]

["ace_cargoLoaded", barrel_loaded] call CBA_fnc_addEventHandler;
 
 barrel_loaded = {
     params ["_item", "_vehicle"];
     if (_item isEqualto _barrelarray_1 && (!alive _item) then {
         hint "barrel loaded", barrelcounter1 = barrelcounter1 + 1, 
            if (barrelcounter1 = 3 then {hint "Objective Complete"});
     };
 };``` 
The Hints are just visual checks that pop up when things happen. I've been able to get it to work with a single object instead of an array, but adding multiple objects has been stopping me.
still forum
#

https://discordapp.com/channels/105462288051380224/105462984087728128/523163631211380776 Found it!
@astral dawn
https://github.com/dedmen/Intercept_FastScript
Only took me a month to accidentally step on it. Could use this to ignore the 3ms limit of the scheduler or do something else fancy.
It's not really a scheduler though. It's the script VM evaluator.

That project was fun while it lasted... Something like 2x as fast script execution on AMD processors was the result I think. I should probably fix that up to get the FPS boost back.

queen cargo
#

uhm ... wut?

astral dawn
#

So... it's an alternative sqf VM? 😕

still forum
#

It's the evaluator part of the SQF VM inside the Arma engine

#

replaced virtual function calls by static lookup. That removed one or two memory jumps that had to wait for RAM to return results. That made scripts run a whole lot faster on AMD, almost no effect on Intel CPU's

astral dawn
#

Oh that looks fun... I think i've read something about C++ tables for virtual functions... so this addon messes with these tables?

still forum
#

Nope. It circumvents the lookup of these tables

#

I check what type a certain class is, and call the method directly instead of looking for the method in the vtable which would require a memory lookup

astral dawn
#

Honestly I have no idea how one would perform such a thing for a program which is already compiled and deployed (arma)

still forum
#

By writing Assembler 😄

astral dawn
#

Why does Intel handle this thing better than AMD?

still forum
#

Better prediction maybe ¯_(ツ)_/¯

#

We all know Intel runs Arma better than AMD

queen cargo
#

does it still?

still forum
#

yeah. Not as much difference. But still enough difference

queen cargo
#

if one applies all fixes required to get them on a sane level i mean

#

in regards of their prediction cheating

astral dawn
#

Allright, so you mean that with this... almost hack of yours, you can potentially replace the scheduller method calls with something else and mess up arma to an unimaginable degree, right?

#

It's also interesting why C+ compiler doesn't perform such an optimization 🤔

still forum
#

It can't

#

and mess up arma to an unimaginable degree, right? sure. 😄 Very easy with Intercept

astral dawn
#

What if... reimplement the whole SQF machine, but make each command which alters a global state(or arma object) or accesses engine protected by a mutex, then we would be able to spawn scripts on separate cores?

#

Hmm... still will be bound to the single arma's thread on engine manipulations though... but might boost pure calculations without global variable access
Nvm I think we have discussed a similar thing here already

frigid raven
#

Wow I never felt so incompetent like when reading all the stuff you discuss here

still forum
#

but make each command which alters a global state That would be... every command.

#

So what use would that make if every single command was in a mutex but you could execute on multiple cores?

astral dawn
#

But local variables don't alter a global state

#

That's why they are... local

still forum
#

they do

astral dawn
#

uh?

#

In a sense that a spawned script's state is global?

still forum
#

You are limiting your understand of global/local on what you can observe in SQF

#

that's not all that exists though

#

the memory allocator for script values is a global pool allocator.

astral dawn
#

So you mean that when I do _a = 3; and _b = 6; in our supposed multithreaded SQF VM, they both would wait for a global allocator to allocate space for _a, then for _b? I guess It would need a local per-thread allocator then?

still forum
#

Yeah

astral dawn
#

I'd guess that making a local allocator is not so hard? Considering that @queen cargo already has an SQF virtual machine and there is an Intercept to potentially interface it with the engine 🤔

tough abyss
#

X39 is not using Arma data types

astral dawn
#

But neither intercept does?

#

I mean they both use some approximation, right?

still forum
#

Intercept does.

tough abyss
#

How do you mean?

still forum
#

no

tough abyss
#

Intercept hacks it as it is

still forum
#

I prefer the term "interfaces"

#

When you say hack people always think of wallhacks and aimbots and that crap

tough abyss
#

People give words different meanings all the time

astral dawn
#

How can you potentially do that reliably? What if they decide to repack a few structs inside the RV code for whatever reason, won't this interface break?

still forum
#

It would break. But they don't

tough abyss
#

Yep

queen cargo
#

@astral dawn you can use SQF-VM and implement that ... actually, implementing everything threaded would be fairly simple without the rendering part (which is the actual reason why all of that is so "hard")

still forum
#

Some things could be multithreaded internally. Like nearestObjects and similar. That do lots of work in engine. That would be a fairly simple optimization. But because these commands are so slow, few scripts use them anyway

queen cargo
#

i still highly doubt that there is an actual need for keeping that on a single thread
why exactly does stuff like setPosition eg. need to run on a single thread? only reason that would come into my mind would be so that it does not alters eg. simulation stuff or when other commands use it

on the other hand, what if all of those "properties" that get changed max. on per frame basis, would then be mirrored?

#

in the end, there are ways to get everything multithreaded, i am fairly sure about that

slim oyster
#

Can you return a config of a control from an onLBSelChanged UI eventhandler? I am trying to set a var on onLBSelChanged change and get the name from the config property text. It works fine on attributeload/save because those EH return a config value. Is there some magical command or function I am missing?

tough abyss
slim oyster
#

hmm, no command/fnc to return the current config path? I could use the classname if I point directly to the attribute category config but I want to use this control in a few different attribute groups.

still forum
#

You can only have text in a listbox though?

#

what config path fo you want?

#

what is in that listbox?

slim oyster
#

same config as returned from attributeLoad eventhandler in an 3den attribute

still forum
#

what 3den attribute? what type?

slim oyster
#

My own attribute, creates a combobox with available ace arsenal mission loadouts.

still forum
#

just a normal combo box?

#

or some special config entry combo box?

slim oyster
#

no it inherits from combo

#

it just doesn't have any config values for the combo itself, all of the values/entries are added on attributeload

still forum
#

what config path do you expect?

slim oyster
#

similar to the way the combopreview for some of cfgmusic are

still forum
#

ace arsenal loadouts are not config values

slim oyster
#

in attributeSave and attributeLoad it gives the _config parameter which is a direct path to the current attribute entry

still forum
#

or do you want the mission.sqm config that contains the attribute?

#

that's engine code. No command or script for that afaik.
maybe getMissionConfigValue command? or similarly named. Don't know how you'd find that exact attribute with that though

slim oyster
#

I want it to be able to find the path without accessing mission.sqm since this is an addon for mission makers and for use in 3den

#

Hmm, i feared that

#

any good way to pass the _config attributeLoad parameter to other EH?

#

There's no namespace/var storage specifically for controls right?

still forum
#

last 2 lines in description of that command

slim oyster
#

oh no way

#

thanks arma 3

#

that was exactly what I needed, perfect

#

hmm, i wonder why EH on controls don't have _config passed to them anyways, since their attributeload will give them that

#

now I'm just going to give them a var for that and immediately access it, strange

still forum
#

because it doesn't make sense

slim oyster
#

true haha, thanks for the help

still forum
#

There being a config to fill the control is specific to 3DEN attributes

#

that's why you have the 2 special attribute functions

#

Why modify all dozens of eventhandlers for that single usecase

slim oyster
#

but EH can be different based on the config, so anything within Cfg3den could have a different EH...

#

my guess is that they just didnt see any use for it

still forum
#

Reimplement every control eventhandler twice?

#

Just for that single usecase?

slim oyster
#

since all the vanilla 3den stuff works off of saving/loading mission and expression on postInit

#

yes 😉

quartz oracle
#
_Timer;
_TimerRunning;

this addEventHandler ["GetIn", {
    _TimerRunning = 0;
    _Timer = _TimerTime;
}];

this addEventHandler ["GetOut", {
    _TimerRunning = 1;
    _Timer = _TimerTime;
}];

while {(_TimerRunning == 1)} do 
    {
    if(_Timer <= 0) then
    {
        this setDamage [1, false];
    };
    
    else 
    {
        sleep 1;
        _Timer = _Timer - 1;
    };
};

i do somethink wrong but i dont know what please help

still forum
#

I can see lots of wrong things

#

what do you want to hear first?

slim oyster
#

use the eventhandlers to call to a function that starts the timer and can exit when unit is out of vehicle

still forum
#

I have like.. Half a dozen or more problems in that stuff

vapid drift
#

Am I missing something obvious here? This is executed by the server but all players are not receiving the actions:

    [player,
        [
            "Turn radio on",
            { ["radioOn"] execVM "radio.sqf"; },
            "",
            1.5,
            false,
            false,
            "",
            "'ItemRadio' in assignedItems player && !(player getVariable 'TFR_radioIsOn') && TFR_spawned"
        ]
    ] remoteExec ["addAction", 0, true];```
Only the player hosting is getting the actions
still forum
#
  1. use private keyword when creating local variables.
  2. Line 2 and 3 do nothing. If you want to create a variable you have to assign something.
  3. use booleans for _timerRunning.
  4. the parenthesis in the while condition are useless.
  5. invalid semicolon before else
  6. you should stop the timer once it get's to 0, not just on the GetOut eh.
  7. your local variables don't magically carry over to the eventhandlers. You probably want to setVariable onto the this object.
  8. your _TimerTime variable is kinda useless, you can just write the value directly when you set _timer.
  9. Why are you setting _timer when you stop the timer in getIn? It will be reset anyway when you restart the timer so that one set is useless.
  10. once your while loop exits once it will never run again. As _timerRunning is not set to 0 it will run the while condition once and then just exit
#

@vapid drift This is executed by the server There is no player on the server. You are telling everyone to add your action to.. nobody.

#

is that TFR aka TFAR? The radio mod?

vapid drift
#

@still forum doesn't the 0 flag in remoteExec tell it to execute on the server as well as each player? Also, no, TFR is a custom tag

still forum
#

Yes it does

#

But as I said. There is no player on server

#

you are executing objNull addAction ... on the server as well as each player

#

which adds the action to nobody. objNull is a non existent object

#

it will just be ignored

vapid drift
#

ok, I misunderstood the order of things

still forum
#

Also 0 doesn't make sense. adding a action on a server doesn't make sense, the server cannot execute actions

vapid drift
#

I thought it was a lazy way of doing it

marble pasture
#

_barrelarray_1 = ["barrel1","barrel2","barrel3","barrel4"];

["ace_cargoLoaded", barrel_loaded] call CBA_fnc_addEventHandler;
 
 barrel_loaded = {
     params ["_item", "_vehicle"];
     if (_item isEqualto _barrelarray_1 && (!alive _item) then {
         hint "Load Trigger Activates", barrelcounter1 = barrelcounter1 + 1, 
            if (barrelcounter1 = 3 then {hint "Objective Trigger Activated"});
     };
 };```
Maybe you can assist with this? the intent is to have a a trigger activate when the barrels are loaded into a truck via ace cargo.  I can get it to work with a single barrel but not with multiple barrels.
still forum
#

barrelcounter1 = 3 that's not how you compare values

#

if (barrelcounter1 = 3 then missing closing parenthesis

#

then {hint "Objective Trigger Activated"}); one closing parenthesis too many

#
["ace_cargoLoaded", barrel_loaded] call CBA_fnc_addEventHandler;
 
 barrel_loaded = {

You need to edfine the function BEFORE you add the eventhandler

#

_item isEqualto _barrelarray_1 that will never happen. A single object won't be equal to an array of strings

#

if (_item isEqualto _barrelarray_1 && (!alive _item) then missing closing parenthesis

#

&& (!alive _item) you only want dead barrels? Can barrels even be alive?

marble pasture
#

the !alive check if the barrel object has been physically removed.

slim oyster
#

@still forum Just a note, I've redefined all Cfg3den controls that inherit the title control class to have an additional EH to set the passed _config value to any child controls in 3den 😃 seems to work great. Adding a namespace for displays and controls was perfect

marble pasture
#

appreciate the assistance, btw mr Ded

still forum
#

if the barrel object has been physically removed. That means it will be objNull. isNull command checks that

marble pasture
#

Oh, i tried it with isNull and it didnt work, then with !alive and it triggered my text notifier

still forum
#

what?

marble pasture
#

yeah

still forum
#

object isEqualTo stringArray returned true? wtf

quartz oracle
#

@still forum how do i do booleans ?

still forum
#

Wait

marble pasture
#

Oh, no. not that. So before I tried this code

still forum
#

your _barrelarray variable is undefined

tough abyss
#

@vapid drift the reason only hosting player get the action is because he is the server, all other players will also get the action when they approach hosting player

still forum
#

@quartz oracle true false

marble pasture
#

I made this code work using a sigle object, before I tried this array nonsense.

vapid drift
#

@tough abyss ok, that makes sense, thanks

marble pasture
#

and when I did that, I ended up using !alive instead of isNull becuase that's what worked on the check.

quartz oracle
#

@still forum what do you mean with wrong think 7 ?

#

and how do i fix it ?

still forum
#

point 7 is made up of two sentences. The second one is telling you how to fix it

marble pasture
#
 
 barrel_loaded = {
     params ["_item", "_vehicle"];
     if (_item isEqualto barrel1 && (!alive _item) then {
         hint "Load Trigger Activates"};
 };
``` the original code looked something like that before I tried to modifiy to work on multipled barrels.
tough abyss
#

If you want each player have own action you should pass other players as argument for add action, currently it is only hosting player on every pc @vapid drift

still forum
#

I'd recommend to just remoteExec "call" instead.

quartz oracle
#

@still forum do you mean me ?

still forum
#

yea

quartz oracle
#

i dont understand correctly (im still new to scripting in arma )

tough abyss
#

&& (!alive _item) you only want dead barrels? Can barrels even be alive? Damage destroyed objects and null objects both return false for alive so you could just combine it

still forum
#

Woah I just had an idea how I can easily circumvent bisign protection even with battleye 🤔 that's dumb...

vapid drift
#

So why doesn't THIS work then?

    { _player = _x;
        [_player,
            [
                "Turn radio on",
                { ["radioOn"] execVM "radio.sqf"; },
                "",
                1.5,
                false,
                false,
                "",
                format ["'ItemRadio' in assignedItems %1 && !(%1 getVariable 'TFR_radioIsOn') && TFR_spawned", _player],
                0.1
            ]
        ] remoteExec ["addAction", _player, true];
    } forEach TFR_playableUnits;```
still forum
#

format You cannot format objects

vapid drift
#

It still only create the action on the server/player

still forum
#

also the condition will run on the player

#

so why not just use player ?

vapid drift
#

I tried that initially... didn't work so I assumed it was still somehow referencing the player similar to earlier

still forum
#

setting JIP flag to true doesn't make sense if you target a specific player and if players will die/respawn when rejoining

#

the player will be a different object when he joins in later

#

where do you execute that code?

#

did you try adding diag_logs to check who you remoteExec too?

#

if that code executes before the other players joined. Then it will of course not execute on them

#

I'd still recommend just remoteExec'ing call, that's much easier

vapid drift
#

so what? Something like

{ player addAction [blah blah blah]; } remoteExec ["call", 0];```
#

or do I still need to reference the players as objects specifically?

still forum
#

yeah

#

do I still need to reference the players as objects specifically Huh? Your example is doing that already

tough abyss
#

Why not put that addAction into player init? Avoid all the hassle of remote exec and JIP

still forum
#

Yeah. just in initPlayerLocal.sqf. even easier. Didn't even think of that 😄

quartz oracle
#

@still forum i still dont know how to fix number 7 :/

vapid drift
#

done, I will do that thing

slim oyster
#

Yes with a wait for TFR_spawned which is their init declare

tough abyss
#

The radio seems to be local so no point abusing network

vapid drift
#

Alright, I'll go tinker for a while

naive oyster
#

is there a dedicated discord channel for arma 3 alive?

still forum
vapid drift
#

so I setup the initPlayerLocal.sqf but it still seems to only be working on the host:

// Sets initial state of radio
    player setVariable ["TFR_radioIsOn", false, true];

// Waits for the crash and spawn to take place
    waitUntil { sleep 1; TFR_spawned };

// Adds actions once spawned
    player addAction [
        "Turn radio on",
        { ["radioOn"] execVM "radio.sqf"; },
        "",
        1.5,
        false,
        false,
        "",
        "'ItemRadio' in assignedItems player && !(player getVariable 'TFR_radioIsOn')"
    ];```
tough abyss
#

Arma 3 !alive 😂

vapid drift
#

It does as expected for the host, as soon as I set TFR_spawned = true I get the action but on the host player only

still forum
#

do you set that variable globally?

vapid drift
#

lol I believe so... TFR_spawned is set to false in the init.sqf by the server

#

should I do it in the missionNamespace and access it that way?

still forum
#

believe so is not confident enough

#

TFR_spawned = true is already in missionNamespace..

vapid drift
#

well... if you weren't asking me, it would be a hard yes

still forum
#

init.sqf is also missionNamespace

#

Don't think that moving stuff from missionNamespace to missionNamespace will change much

vapid drift
#

fair enough

#

in init.sqf:

if (!isServer) exitWith {};
// Definitions
    TFR_spawned = false;```
still forum
#

that's not global

vapid drift
#

and that's why I said "I believe so"

tough abyss
#

Why broadcast player setvariable publicly to other pcs?

still forum
#

publicVariable or setVariable with public flag

vapid drift
#

@tough abyss What do you mean?

tough abyss
#

TFRradioison

#

It gets public broadcast

#

For no reason

vapid drift
#

I guess I'm not sure what you mean. The intent was that each player stored whether or not their radio was on on themselves

tough abyss
#

Is this your code?

vapid drift
#

Yeah

tough abyss
#

So how could you not have any idea? You setVariable on player with public flag

#

What do you think public flag does?

vapid drift
#

Geez man, I just wasn't sure what you were talking about

#

I need whether or not the radio is on to be accessible to other things in the game

tough abyss
#

To me it looks like you need it to hide switching radio action when radio is on from the code you posted, that could be done locally

vapid drift
#

This is one section of code, but whether or not it's publicly available shouldn't affect the funcionality

#

I really do need it public accessible. There are things happening

#

All I'm really trying to figure out is why I can't get this action on each player

tough abyss
#

Ok but another variable that controls wether or not action is added is TFRspawned, do you publicly broadcast it to all clients?

vapid drift
#

Apparently I wasn't? I was under the impression that but declaring a variable outside of some limited scope, it was available publicly. If I understand publicVariable correctly, which I most likely don't along with everything else, this should have done the trick:

if (!isServer) exitWith {};
// Definitions
    TFR_spawned = false;
    publicVariable "TFR_spawned";```
But it didn't
#

I also tried:

waitUntil { sleep 1; (missionNamespace getVariable "TFR_spawned") };```
And again, only worked on the host
tough abyss
#

That’s because it is undefined on all clients

#

Because of the !isServer condition

#

You exit before you define it on clients

#

You should exit after you set it to false

#

There should be rpt logs complaining about undefined variable

still forum
#

Because of the !isServer condition no. publicVariable sends to everyone

#

but the setting to true also needs a publicVariable

vapid drift
#

I did it from the debug console

tough abyss
#

I also tried: that could work if you pass default value to getVariable

#

There is no guarantee server will finish before clients and clients will receive broadcast in time

#

But Dedmen is right, where is your broadcast setting the variable to true?

#

Or is it a typo and it was meant to say true instead of false?

vapid drift
#

for testing purposes, I'm setting it to true from the debug console

tough abyss
#

How?

still forum
#

debug console could mean anything

#

local or global?

vapid drift
#

globaly

#

Hit escape, put TFR_spawned = true in the debug console, execute globaly

tough abyss
#

Exec Global?

vapid drift
#

Yes

tough abyss
#

Check rpts on clients for undefined var errors

still forum
#

or just add diag_logs?

tough abyss
#

Or -showScriptErrors

vapid drift
#

I think I hate this game

iron sand
#

Should I just go make a game

vapid drift
#

wtf... I completely eliminated the requirement for TFR_spawned and I still don't get the action on the client. initPlayerLocal.sqf:

// Sets initial state of radio
    player setVariable ["TFR_radioIsOn", false, true];

// Adds actions once spawned
    player addAction [
        "Turn radio on",
        { ["radioOn"] execVM "radio.sqf"; },
        "",
        1.5,
        false,
        false,
        "",
        "'ItemRadio' in assignedItems player && !(player getVariable 'TFR_radioIsOn')"
    ];```
still forum
#

then check the conditions of the action seperately

#

maybe debug console

vapid drift
#

Yeah, I'm done

iron sand
#

{
"scripts": [
{
"header": {
"cloudId": "touchdevelop.com",
"scriptId": "",
"userId": "",
"status": "unpublished",
"lastUse": 1534535521,
"editor": "touchdevelop",
"name": "asteroids",
"comment": ""
},
"source": "meta version "v2.2,js,ctx,refs,localcloud,unicodemodel,allasync,upperplex";\nmeta name "asteroids";\nmeta icon "Controller";\nmeta color "#ff9955bb";\nmeta rootId "brfq3jQUUoV5pYmDr4BjfPS2";\nmeta hasIds "yes";\nmeta platform "current";\nmeta parentIds "";\n#kHcffg3UF1mtmGhj\naction main() {\n #rbrir7DU6e20OfsW $board := @\u267b→game→start;\n #NEkof1X74vhoLYxa data→highscore := data→highscore;\n #MN4lxUN5J8YV9b9d $playership := @\u267b→game→create_sprite(art→ufo);\n #xWZLmPl4ywR03Cwd $startbutton := @\u267b→game→create_sprite(art→refresh);\n #lA8zbiUUnTA7z82t $movementFlag := $board→create_ellipse(10, 10);\n #bJLBjOaEFSPpHs1d $highscoretext := $board→create_text(100, 40, 20, "high score: " ∥ data→highscore→to_string);\n #PzpM4b02KiELQtnO $asteroid_set := $board→create_sprite_set;\n #IEXtk4Db6Z1pJPzX $laser_set := $board→create_sprite_set;\n #A6uG4SzMtV08nbtl $laser_count := 0;\n #FbEkNqajCRrsK4X4 $counter := 0;\n #SdszqjO72m72mVEx $asteroidsonfield := 0

#

I had to delete 29002 words fuck me

#

9000 characters

vapid drift
#

What the actual f...

initPlayerLocal.sqf:

// Adds actions once spawned
    player addAction [
        "Turn radio on",
        { ["radioOn"] execVM "radio.sqf"; },
        "",
        1.5,
        false,
        false
    ];```

STILL doesn't add it to each player. This is ridiculous
iron sand
#

Idk

#

It’s probably one small thing you added that makes the code not work

#

I honestly don’t know

vapid drift
#

Thanks anyway

tough abyss
#

@iron sand you sure you’re in the right channel? Or even discord?

lost copper
#

@vapid drift try to work with init.sqf and construction:

if (hasInterface) then {
    //adding action to player
};

I understand that is the same, but 😅

delicate lotus
#

okay so I want to draw a marker into 3D world space. I want to get the color of the marker for drawIcon3D.
I know how to return the config array of the marker color. But in some cases the array is not [R,G,B,A] but ["someStuff","someStuff","someStuff", "someStuff"] like for
color[] = {"(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"};
How would I convert that array into a numerical RGBA array?

lost copper
#

@delicate lotus i correctly understand, that now you returs array of strings? or what?

quartz oracle
#
private _TimerTime = 5;
private _vehicle = _this select 0;
private _TimerRunning = false;

_vehicle addEventHandler ["GetIn", {
    _TimerRunning = false;
}];

_vehicle addEventHandler ["GetOut", {
    _TimerRunning = true;
    _Timer = _TimerTime;
}];

while (_TimerRunning == true) do 
    {
    if(_Timer <= 0) then
        {
            _vehicle setDamage [1, false];
            _TimerRunning = false;
        }
    
    else 
        {    
            sleep 1;
            _Timer = _Timer - 1;
        };
};```
im doing somethink wrong i the while loop please help
lost copper
#

@quartz oracle you can't use private variable in this scope

delicate lotus
#

@lost copper it returns sometimes array of strings instead of numbers.

lost copper
#

@delicate lotus can you give an example?

quartz oracle
#

@lost copper so make it not private ?

lost copper
#

@quartz oracle yep

delicate lotus
#

@lost copper
["(profilenamespace getvariable ['Map_BLUFOR_R',0])","(profilenamespace getvariable ['Map_BLUFOR_G',1])","(profilenamespace getvariable ['Map_BLUFOR_B',1])","(profilenamespace getvariable ['Map_BLUFOR_A',0.8])"], the array for the BLUFOR marker color.

lost copper
#

You want to create your personal repawn system for vehicles, @quartz oracle ?

quartz oracle
#

@lost copper gives me still error

lost copper
#

@delicate lotus thi is a code to execute or return array from some function?

quartz oracle
#

@lost copper kindof, i want vehicle to respawn after a specific amount of time after they got abondend

delicate lotus
#

its just the configFile entry for the marker Color

#

but now that you said code...

#

I just realized it has an obvious code structure

#

so I could just do array apply {call compile _x};

lost copper
#

@delicate lotus you need specific color from player's settings?

delicate lotus
#

yeah

#

but It works now

#

so all fine now ^^

#

though I guess I should call that piece of code not every frame. seems kind of expensive. Going to cache the result somewhere.

lost copper
#

Yeah, that sounds good

#

@quartz oracle

#

why you can't use vanilla respawn system?

#

That do the same thing, that you want to realize

quartz oracle
#

does the delay also work for respawn becaus too far away ?

lost copper
#

Yes

quartz oracle
#

ohh

lost copper
#

Check the module in EDEN editor

quartz oracle
#

last time i tested it doesnt worked

#

but ill check it w8 a min

lost copper
#

you can edit radius to respawn and time to respawn

#

it works correctly in my polygon mission 🙂

quartz oracle
#

but not for me

lost copper
#

can you take a screenshot of your module settings?

quartz oracle
#

ive send you a friend invitr

#

e

nocturne basalt
#

hi guys. Is it possible to terminate the previously ran script once a new one is triggered?

Im having this in my eventhandler:
engine = "_this execVM '\WHwalkers\warhound\scripts\init_walk.sqf';";

Im trying to terminate the previous one if a new one is triggered. I know I can save the script handle when calling execVM but how can I use that for next time the EH is triggered?

lost copper
#

@nocturne basalt You want to use "engine" variable every time?

#

And terminate script, if EH triggerered again?

nocturne basalt
#

yes

#

Im am trying to exitwith inside existing scripts, but they just keep stacking up

#

based on an animation value I set

lost copper
#

try "terminate"

nocturne basalt
#

yeah but I need the _handle from last call

#

and I dont have that anymore

lost copper
#

Is "engine" variable global for missionNamespace?

nocturne basalt
#

no its not a variable, its an eventhandler

#

class Eventhandlers
{
engine = "_this execVM '\WHwalkers\warhound\scripts\init_walk.sqf';";
};

#

inside my config

lost copper
#

oh

#

Sorry

nocturne basalt
#

cant I grab the handle from existing running scripts somehow?

#

like "execute engine EH, terminate all other scripts"

#

I am using diag_activeSQFScripts to display them

austere hawk
#

are they both running locally only? if so - set a local variable on the vehicle...

nocturne basalt
#

but its only strings

lost copper
#

In description to execVM command i see this sentence:
The optional argument is passed to the script in private variable _this. In Arma 3 the script handle is also passed to the script in _thisScript variable.

slim oyster
#

If you are just doing a timeout or making sure EH scripts don't overlap a simple var declare will work

nocturne basalt
#

hmm, but the one passed is not the one I wanna terminate. I wanna terminate the previous one

#

@slim oyster how do you mean?

#

@austere hawk how would I use the local variable to check if I should terminate it?

lost copper
#

You can try to create special variable in missionNamespace via sqf you running and save _thisScript value inside

nocturne basalt
#

oh. like storing them all in a global array and terminate them all before I start a new?

lost copper
#

Yep

nocturne basalt
#

🤔 that may work

slim oyster
#

have your EH point to a spawned function that can save the scripthandle within it. If script is not done, terminate it and exec a new one, saving that new scripthandle.

nocturne basalt
#

I'd just declare that variable in an init EH right

#

ok thanks guys I got some new ideas now. gonna give it a go

nocturne basalt
#

I can call it inside the init_walk script which is execVM'd already cant I

#

must just be careful not to terminate the one I just called

tough abyss
#

@nocturne basalt try
engine = "params [""_veh"", ""_eng""]; if (_eng) then {_veh setVariable [""script"", _this execVM ""\WHwalkers\warhound\scripts\init_walk.sqf""] } else { terminate (_veh getVariable [""script"", scriptNull]) }";

nocturne basalt
#

cant use scriptDone since the ones Im terminating are running some loops

#

wow thanks @tough abyss 😁

lost copper
#

@tough abyss seems tricky

tough abyss
#

straight forward, why?

lost copper
#

Not for my level

nocturne basalt
#

worked like a charm @tough abyss thanks alot!

tough abyss
#

np

lost copper
#

How i can create bug report? It's about module in EDEN editor.

winter rose
#

Search first though.

lost copper
#

@winter rose thx. Sorry, if i ask in wrong tread

winter rose
lost copper
#

@winter rose cause of bug was finded, when i try to help @quartz oracle in this thread 😀

winter rose
#

don't worry about it really ^^ (it's night time, too)

marble pasture
#
["ace_cargoLoaded", loadtracker] call CBA_fnc_addEventHandler;  
   
 loadtracker = {  
  params ["_item", "_vehicle"];  
  if (_item isEqualTo barrel_1) then {  
  hint "Barrel Loaded";  
  };  
 }; 

so this code notifies me when I ace load a barrel on a truck. What I'd like to do is make it so that it activates when I load barrel_1, barrel_2 and barrel_3 on a truck. im trying to use a thisList but to no success. help, please?

devout stag
#

You could use a switch statement

#

Or find to check if the object is present in an array.

marble pasture
#

hmmm I will learn these things. expressions I havent heard of yet. Still new in my scripting journey.

winter rose
#

hmm how could one know if the mission is in (Single Player) preview?
is3DEN or is3DENMultiplayer both return false 🤔

marble pasture
#

problem solved isEqualTo needed to be EqualTypeAny

ruby breach
#

@marble pasture isEqualTypeAny (with your example of barrel_1 as a parameter) just returns whether the loaded item is an object, not that it is one of a specific object(s)

marble pasture
#

@ruby breach Oh nooooo, lol. that's a bummer, I was so excited there I failed to test farther than I needed.

#

appreciate the heads up, though!

winter rose
#

@marble pasture ```sqf
if (_item in [barrel_1, barrel_2, barrel_3]) then { hint "yup!"; };

marble pasture
#

@winter rose <3333333 that's exactly what I was trying to do and had no idea how to do it, lol thanks much!

winter rose
#

Anytime! 👍

cobalt idol
#

hi guys, im spawning an ai unity and attempting to strip its gear then refit it
_grp = [getmarkerpos _SFHVTMarker, East, ["CUP_C_R_Functionary_01"],[],[],[],[],[],116] call BIS_Fnc_spawnGroup;
the unit spawns but when i pass
RemoveAllWeapons _grp; I get an error saying generic error in expression.

lost copper
#

@cobalt idol Yep

ruby breach
#

That’s not all the error says

#

It says: Type Group, Expected Object

lost copper
#

Cause you use comamnd for group, but must use for each unit in group

cobalt idol
#

why isnt it displaying
"It says: Type Group, Expected Object" for me?

ruby breach
#

RPT errors

#

Learn to use ‘em. It’ll save you a lot of headache in the future

lost copper
#
{
    removeAllWeapons _x;
} forEach (units _grp);
cobalt idol
#

should i be spawning this one unit in not as a group?

ruby breach
#

Basically you’re trying to remove the weapons from the Group. Game is telling you that it can only remove weapons from one unit at a time

cobalt idol
#

i get that, but can i spawn the unit and not have him be in a group?

lost copper
#

@cobalt idol you can't

cobalt idol
#

okay thanks!

lost copper
#

every unit must be in the group

cobalt idol
#

im trying to not ask why...

ruby breach
#

Then the return value is the created unit

#

(or Nothing, depending on syntax used)

winter rose
#

@cobalt idol try using -showScriptErrors flag, available in the launcher's advanced options – saves your debugger's mind! 😉

cobalt idol
#

awesome thank! why some of these options arent tick boxes in the UI.......

lost copper
#

@winter rose or open a wonderful world, that no escape from them 😅

cobalt idol
#

nvm ill try it befor i post lol

ruby breach
#

Nah, still feel free to post. Just try to report the full error (from the log file) in case it's less obvious what's gone wrong. 😁

tough abyss
#

but can i spawn the unit and not have him be in a group? You can createAgent, agents are groupless

#

But if your question is scripting related, which seems like it is, you are in the right channel, sorry for confusion

devout stag
#

Basically

#

I have narrowed my issue down a bit

#

I want to make my array a global, per mission variable.

#

And or a general missionNamepace variable (editor)

#

That I can then use pushBack as a part of my attribute statement to add the selected object to the array

#

So that I can execute the code on it

tough abyss
#

Seems pretty straight forward, what are you having problem with?

devout stag
#

I am trying to not call every single object in the missionNamepace

#

That is a fundamental requirement

tough abyss
#

someArray = []; to create array, someArray pushBack WHATEVER; to fill, {_x call someFunc} forEach someArray; to call a function for each element of array

devout stag
#

This is also based upon editor attributes

#

Heh, if only it was that easy...

#
class UO_FW_ACRE_RACK_ENABLED {
            property = "UO_FW_ACRE_RACK_ENABLED";
            displayName = "Add Rack to Object";
            tooltip = "Allows objects to be given radio racks defined by ACRE settings";
            control = "CheckBox";
            expression = "_this setVariable ['%s',_value,true]; ";
            condition = "objectVehicle + (object * (1-objectBrain)) + (1 - objectControllable)";
            defaultValue = "0";
        };
#

Here are some of the editor attributes I'm working with.

#

I want to basically make these editor attributes, in this case the class UO_FW_ACRE_RACK_ENABLED

#

to when enabled, add the object the attribute is associated with

#

To an array of objects.

#

I just don't know where or how to create this array.

#

I'm meeting the standards of a repository I'm contributing to

#

So under no circumstances can I poll every single object in the mission to see if it has a certain variable and that variable is set to true

tough abyss
#

So you want to push _this into some sort of array which you would use on mission start to add whatever to the object?

devout stag
#

Or an array that already exists within the missionNamespace

#

But yeah that's pretty much it

#

I'm just figuring out how to add the array that I need

#

I've determined I need an array that is kept within the missionNamespace and can be referenced consistently

#

This array also needs to be accessible through the editor somehow

#

Not one or the other

#

Alright nvm, thanks for the assistance @tough abyss I was just informed by a fellow collaborator that I can make calls to a function directly through the attribute expression.

#

Cheers though kek

tough abyss
#

No arrays then?

slim oyster
#

No need for compiling an array and then doing a foreach or apply on it, you can call functions directly from the attribute expression

#

expression = "_this setVariable ['%s',_value,true]; if (_value) then {[_this] call fnc_functionName;};";

warm sentinel
#

Hey guys, looking for some help with the ace arsenal, I've added;

this addAction ["ACE Arsenal", {[box1, player, false] call ace_arsenal_fnc_openBox;}]; 
[box1, [ "fow_w_leeenfield_no4mk1","ITEM2...","ITEM3","etc...." ]] call ace_arsenal_fnc_addVirtualItems;

It functions, except the ammo tab that show ammo for your weapon, I'm assuming it has something to do with global vs local stuff but im not sure, my scripting skills are rather novice.

tough abyss
#

@slim oyster Assuming the _value is boolean, but it actually looks like number from that config.

still forum
#

@quartz oracle _TimerRunning == true makes no sense. Comparing a boolean to true is the same as the boolean itself.
And you still cannot use local variables in the eventhanlders. I already told you to use setVariable. Just look up setVariable on the wiki.

tough abyss
#

_TimerRunning == true makes no sense it should error

dusk sage
#

Should return false

#

See channel description 😆

still forum
#

I saw that @dusk sage !

#

Ah ffs gif avatar

#

forget it

unborn ether
#

toFixed has a funny bug, if you mess up with syntax it might behave weird. For example I found out that using wrong syntax within one scope with text ctrls will make them all look 0.000000000000

#

Just fun info

still forum
#

what "wrong syntax" ?

queen cargo
#

what Dedmen asks @unborn ether

still forum
#

Sounds to me like you use toFixed NUMBER and wonder that it changes what str command outputs. That is expected behaviour

unborn ether
#

Should be number toFixed value. I've accidentally did toFixed number like it was unary.

still forum
#

that's not wrong syntax

unborn ether
#

Yeah, but why it did touch all text controls around?

still forum
#

because it influences all number to string conversions

unborn ether
#

Well, then it's expected. 😄

tough abyss
#

You didn’t check wiki before assuming it was a bug?

torpid grail
#

Does anyone know what causes a "C0000005 ACCESS_VIOLATION at F196F08A" error?

queen cargo
#

you mean a game crash

torpid grail
#

Yes

queen cargo
#

report a ticket and be done with it

torpid grail
#

But the issue is that it's not random

queen cargo
#

cool
so you can even reproduce and increased the chance of it getting fixed

torpid grail
#

I made something that adds buttons to the inventory and I'm not sure what's causing the crash in the code.

queen cargo
#

then things are fairly easy .. inventory is highly engine based

#

solution stays the same: create a ticket at the arma 3 feedback tracker

torpid grail
#

So could hiding any of the items in the inventory cause a crash?

queen cargo
#

but first, check if your issue might exist there

still forum
#

are you removing UI eventhandlers inside a script maybe?

torpid grail
#

I've narrowed it down to this

    while{player getVariable ["newMenuOpen",false]} do{
        if(player getVariable "groundTabOpen") then {
            ctrlShow [6321,true];
        }else{
            waitUntil{ctrlVisible 6321};
            ctrlShow [6321,false];
        };
    };
#

Somehow that causes a game crash

#

But I'm going to add it to a spawn and see if that helps since I'm using waitUntil

still forum
#

if it is not in a spawn then it should error and exit

torpid grail
#

It's not erroring though is the weird thing

tough abyss
#

where you run this script from

torpid grail
#

From the inventoryOpened Event Handler. The thing is that the buttons are made properly but when I click on one it crashes. I'm messing with the code for a bit to see if I can fix it

tender root
#

ctrlVisibile takes the idc and ctrlShown a actual control

#

therefore ctrlVisible will only work with the currently active dialog

#

not with displays for example

tough abyss
#

You place the code in inventoryopened as it is, no [] spawn {....code...}?

torpid grail
#

It's being called from a buttonAction in inventoryOpened

tough abyss
#

eh?

torpid grail
#

And @tender root I think that's my issue is that I'm not using a dialog, I'm using a display. So I'm going to try with ctrlShown

tough abyss
#

inventoryopened is event handler it gets fired when inventory opened, there is no button action anything in it

#

so where you run this code from?

#

Actually, meh, I'm bored, your problem is UI context

torpid grail
#

I'm using ctrlCreate to make a new button and I'm executing the code from that

tough abyss
#

Don't make ticket, it will not be solved, find different way of doing what you want

torpid grail
#

That's what I'm doing now

devout stag
#

Question in regards to params

#

I want a param to only accept an array as an input

#
["_configArray", "", [[]]],```
#

Is that the correct way to make this parameter?

still forum
#

default value string for something that should only be array?

#

yeah seems correct besides that

winter rose
#

@devout stag sqf ["_configArray", [/*array default value*/], [[]]],

devout stag
#

@winter rose cheers

astral tendon
#

Is there a way to get the vehicle init? like the one we put in the editor?

slim oyster
#

Can an FSM take preprocessor data? Can one #include a bunch of macros and have them used throughout the FSM or does the preprocessing work differently with the FSM states?

frigid raven
#

When creating a unit local to the client and then giving the client control over it with selectPlayer this unit will be synced with the server right? Like it would be the editor places player unit ?

still forum
#

synced with the server?

#

A local unit that the player controls will be local to the player

frigid raven
#

yea but it will appear for others players?

#

and the server can execute logic against it - that's my question

tough abyss
#

@slim oyster I think FSM preprocesses as well

#

You cannot create local unit @frigid raven

slim oyster
#

Didn't seem to work, Neither #include nor #define worked, states that statement not supported: #include directive not supported here

still forum
#

FSM's are not simple text files like everything else that supports preprocessor, so my guess would be no. But I never used FSM's

tough abyss
#

I’ll check it

slim oyster
#

Yeah, makes sense why it wouldn't. Makes the CBA statemachine tempting...

astral dawn
#

Do you really need that FSM editor? Probably you could do with switch statement

frigid raven
#

@tough abyss what does that mean? What happens if I execute createUnit local on my client? nothing? Or automagically delegated to server side?

slim oyster
#

Can you do complex forks in sqf without a bunch of extra variables? This is for AI state evaluation. I could use CBA statemachine which acts as a weirdly scheduled state machine

astral dawn
#

I thought about using it some time... before I read your comment an hour ago that it doesn't support preprocessor 😄

#

Complex forks... what is that?
AFAIK the BI's state machine is good because it eases condition reuse, but i might be wrong

slim oyster
#

Yes it supports complex forking

astral dawn
#

What are you doing with the poor AIs? I have a GOAP framework lying around... still didn't have enough time to play with it though

slim oyster
#

Many things

#

I just wanted CBA error logging macros to track errors and logs

#

sadly not possible without directly calling the functions

astral dawn
#

hmm... yes, you could make wrapper functions for these macros

#

probably i'd do it like this if I were in your place

slim oyster
#

The CBA statemachine can create "an almost FSM" from sqf or config, so preprocessors will work

astral dawn
#

wait, but it would generate callable code... :/ if you place call everywhere instead of a pure macro

slim oyster
#

probably going to use this as an alternative

#

and yeah

tough abyss
#

The unit is created global, on every instance but control of the unit goes to your pc @frigid raven

#

It could be created on server but selectPlayer will transfer control to you with little delay, if you create it locally there will be no delay

#

So what are you asking exactly?

#

Unit is just like vehicle or turret, if it is user controlled user is the master

frigid raven
#

@tough abyss Well I have some "login" functionality. Want to create a new unit - give it some persisted variables and then teleport it to a position. After all of this is done I want to make the player control this unit. After the "setup" is done so to say. All this stuff happens on client side functions atm. I just want to be sure that the controlled unit afterwards hasn't any issues when playing in multiplayer like... dunno being invisible for other players? Just assuming since I have no XP with that.

tough abyss
#

No unit is global it doesn’t matter where you create it