#arma3_scripting

1 messages Β· Page 691 of 1

little raptor
#
_a = [];
[_a] call {
  params ["_b"];
  _b pushBack 1;
};
_a //_a is now [1]
#

structured text too

#

that also is a reference

wicked fulcrum
#

Hmm, but only applies when you use the designated methods with the array right?
as when I do

_a = []; 
[_a] call { 
  params ["_b"]; 
  _b = [1]; 
}; 
systemChat str(_a); //output == []

But had I used set / push-back then it would have changed. So the reference is only to the elements of the array passed, and not the actual array pointer?

little raptor
#

in other words, when you did _b = [1];, you changed the reference

wicked fulcrum
#

ah, was just about to clarify if it was because a new assignment would change the reference. Alright that makes sense and I got a bit wiser today πŸ™‚
Thanks for the clarification and help!

unreal scroll
#

@wind hedge "Can you create a simple object using the vehicle's model instead of leaving no wreck on the crash site? It would be way more immersive like that"
It is possible, but not logical.
The script works only if vertical velocity is more that 50 m/s. It is enough to completely destroy the plane, and what could left after that is the only some small parts, and I don't have a proper geometry for it.
For velocities below 50 m/s the plane has a standard behaviour.

barren pewter
#

Im trying to learn how to script in arma but have a couple questions

1 how did you learn/what were some simpler scripts you made when you started scripting

2 I was looking at the scripting examples on the arma forum, and ive seen this other places to, but what does _x mean/do

little raptor
#

wait when was that page changed? notlikemeow

winter forge
#

How do I make a task to kill a group of units?

winter rose
edgy bison
#

How can I have Civilians that spawn from Civilian Presence module join a custom group? [this] join grouName in the "Code On Unit Created" box but didn't work. they are still assigned to NULL-group

winter rose
#

most likely because this is not the proper keyword?

winter forge
edgy bison
#

@winter rose i've tried this, [this], but yea i'm not sure what the correct keyword to use.

winter rose
#

did you read the doc?

winter rose
winter forge
#

so not == 0

#

{alive_x}count units outpostGuards == 0

winter rose
#

that's good

#

taking a bit more performance, but way more human-readable, your code is valid

winter forge
#

as of now when the group dies nothing happens

#

it is synced to the success state

#

Just tested out your condition, works just fine now

#

Thank you

cosmic lichen
#

I am having some trouble replacing a selected string in an edit box with a predefined text

if (_length < 0) then //Check if it was selected from right two left
{
  _start = _start - abs (_length);
};
private _chars = _content splitString ""; //Split the whole string
_chars insert [_start + abs (_length) + 1, [_textNew]]; //Insert the new string behind the selected text
_chars deleteRange [_start, _start + abs (_length)]; //Delete the selected text
....join the string again.

Right now it's not properly replacing it.

grim wing
#

how does AI moral decrease

cosmic lichen
#

@grim wing #arma3_ai might help you with that.

robust hollow
cosmic lichen
#

Yes

#

As weird as it sounds. I just noticed that.

#

I thought it was startIndex, endIndex meowfacepalm

#

Thanks for your help connor πŸ˜‰

#
for "_i" from _end to _start step -1 do
{
  _chars deleteAt _i;
};

Gave me the hint that something is wrong with deleteRange (rather with the way I use it) πŸ˜„

tough abyss
#

anyone able to give me a point in the right direction to display the current ingame time via script?

cosmic lichen
#

daytime

tough abyss
#

Ah. tah

sharp grotto
#

I use

[daytime, "HH:MM"] call BIS_fnc_timeToString```
astral carbon
#

hey, how do I add a scope to a weapon (without the player doing it manually)?

#

context, I'm wanting a weapon on the ground to have a certain attachment

#

I looked into addWeaponItem, etc, tho it fails to work for some reason

next kayak
#

Is there a way to set a trigger when a unit is fired upon? I hate having snipers/mgs/ move around when setting an ambush or on overwatch, so I'd like to set them to disable ai or something so they stay still and just shoot- but I don't mind them trying to relocate/hide if they start taking heavy fire. I was searching around the wiki but I can't find anything resembling a "isBeingFiredAt". The idea would be hold/disable moving until "IsBeingFiredAt" and then re-enable it.

unreal scroll
#

@next kayak Catch their combat mode (no EH, cycle needed), I think it is the only reliable way.
FiredNear is just for sounds, so it is useless for long ranges.
Also you can add MPHit EH in addition to combat mode.

next kayak
#

Oh! I hadn't seen that list of event handlers before, looks like there's a "suppressed" EH as well that might fit the bill

#

Hmm, but that one looks very specific, might be too tedious lol

unreal scroll
#

Heh, I didn't see the suppressed EH too πŸ™‚ Seems like I can try to improve my campaign AI scripts now.

velvet merlin
#

private _noAdminExists = isMultiplayer && {(allPlayers findIf {(admin (owner _x)) != 0}) == -1};

#

this doesnt cover self hosted "admin"

#

how to detect such for remote clients?

#

or you need to make a PV with VAR_IsHosted = isServer && !isDedicated; ?

cosmic lichen
#

Was about to suggest that.

#

Available to any admin (voted in / logged in) or server host
This might work

velvet merlin
#

yes this is to detect the admin, but its local only

#
    if (isServer) then
    {
        if (serverCommandAvailable "#kick") then
        {
            missionNamespace setVariable ["ww2_selfhosted",true,true];
        }
        else
        {
            missionNamespace setVariable ["ww2_selfhosted",false,true];
        };
    };

    waitUntil {!isNil "ww2_selfhosted"};

    // Periodically check if an admin is not logged in and force random select factions
    // this is done in a loop over 60 seconds incase an admin did log in
    // but disconnected before confirming their selection
    while {serverTime < ww2_faction_init_timeout} do
    {
        sleep 0.1;

//        if (ww2_faction_init_complete) then {breakOut "root"};

        private _noAdminExists = isMultiplayer && {((allPlayers findIf {(admin (owner _x)) != 0}) == -1) && {!ww2_selfhosted}};

        if (_noAdminExists || (!isNil "BIS_factionSelection")) exitWith {};
    };```
cosmic lichen
#
   if (serverCommandAvailable "#kick") then
        {
            missionNamespace setVariable ["ww2_selfhosted",true,true];
        }
        else
        {
            missionNamespace setVariable ["ww2_selfhosted",false,true];
        };

Can be reduced to missionNamespace setVariable ["ww2_selfhosted", serverCommandAvailable "#kick", true];

#

I'd move the isMultiplayer check to the beginning of the file and just exit if it's single player. Then you can omit the check from the other conditions.

winter rose
#

To self check the admin state of a local client, use BIS_fnc_admin.

tough abyss
#

Got two questions about nearestObjects - i did try to find all vietnam bunkers ( Land_vn_b_trench_bunker_01_01 ) but with nearestObjects im getting the 02_01 and 03_01 too - how to prevent this? I guess this coming from the hint in the BIKI that the comparison is with isKindOf right?

And if i place the bunker in VR , i can attach a spawned laptop ( createVehicle 0,0,0 ) without any problems - but if i go to Cam Lao Nam, all Laptops are @ 0,0,0 and didnt attach - dont have any clue, why this happens

buildLaptop = {
    params ["_building", "_counter"];
    hint format["Building: %1 | Counter: %2", _building, _counter];
    private _terminal = createVehicle ["Land_Laptop_device_F", [0,0,0],[],0,"can_collide"];
    _terminal setVehicleVarName "terminal";
    _terminal attachTo [_building, [-1.85,2,0.19]];
    _terminal setDir 90;
    [_terminal] execVM "Scripts\HackEX\hackex.sqf";
    
    systemChat format["TerminalPos: %1", getPos _terminal];
    
    private _marker = createMarker [format["Marker%1", _counter], getPos _terminal];
    format["Marker%1", _counter] setMarkerColor "ColorRed";
    format["Marker%1", _counter] setMarkerType "mil_warning";
    
};

buildLaptops = {
    params ["_buildings", ["_amount", 20]];
    _blds = [_buildings] call getObjects;
    for "_i" from 1 to _amount do {
        private _building = selectRandom _blds;
        [_building, _i] spawn buildLaptop;
    };
    //{ _x spawn buildLaptop } foreach _blds;
};

getObjects =   { 
    params ["_buildings"];
    hint format["Buildings: %1", _buildings];
    _pos = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");   
    _blds=nearestobjects [_pos,_buildings, 20000];
    _blds;
    
};

[["Land_vn_b_trench_bunker_01_01"]] spawn buildLaptops;
winter rose
tough abyss
winter rose
#

I believe the others are inheriting from the 01_01

tough abyss
#

Thanks, i'll give that a try (filter out with typeOf)

#

@winter rose Works perfectly, tyvm! Now only the problem exists, that the laptops doesnt attach to that building like in VR - they did stuck on 0,0,0 - do you have any hint why this happens on Cam Lao Nam but not in VR? Is it not possible to attach objects to map content itself (in VR the bunkers are place as objects).

winter rose
tough abyss
winter rose
#

no I mean, try to see if it is "usual behaviour" or "CDLC issue" ^^

tough abyss
#

ah this way - no, didnt try but ill give them a try

tough abyss
#

need a hand, unsure what im doing wrong,

initPlayerLocal.sqf

introSeq = [] execVM "introScript.sqf";

introScript.sqf

// Start with a silent black screen.
titleCut ["", "BLACK FADED", 999];
0 fadeSound 0;

// Spawn text effects.
_this spawn {

    
    params[
        ["_missionName", "Operation | Storm"],
        ["_missionAuthor", "by M. Texas"],
        //["_missionVersion", "Version 1.0"],
        ["_quote", "β€œThose who stand for nothing fall for anything.” – Alexander Hamilton"],
        ["_duration", 9]
    ];

    // Starting quote as volume fades in.
    titleText [_quote,"PLAIN"];
    titleFadeOut _duration;
    _duration fadeSound 1;
    sleep (_duration - 2);

    // New "sitrep style" text in bottom right corner, typed out over time.
    [ 
        [_missionName,"font = 'PuristaSemiBold'"],
        ["","<br/>"],
        [_missionAuthor,"font = 'PuristaMedium'"],
        //["","<br/>"],
        //[_missionVersion,"font = 'PuristaLight'"]
    ]  execVM "\a3\missions_f_bootcamp\Campaign\Functions\GUI\fn_SITREP.sqf";

    // Fade from black, to blur, to clear as text types.
    sleep 3;
    "dynamicBlur" ppEffectEnable true;   
    "dynamicBlur" ppEffectAdjust [6];   
    "dynamicBlur" ppEffectCommit 0;     
    "dynamicBlur" ppEffectAdjust [0.0];  
    "dynamicBlur" ppEffectCommit 5;  
    titleCut ["", "BLACK IN", 5];
};

Problem im facing is on a dedicated host, the screen stays black and does not do anything.

#

and local now. Last night, worked fine.

spark turret
#

do you have any error messages?

tough abyss
#

1 mo

#

cant post image

spark turret
#

whats the difference between

car1 attachTo [car2];
//and
[car1,car2] call BIS_fnc_attachToRelative;

?

winter rose
#

the function keeps the inclinations iirc

tough abyss
#

Its saying a [ is missing on line 30

#

line 30

    ]  execVM "\a3\missions_f_bootcamp\Campaign\Functions\GUI\fn_SITREP.sqf";

spark turret
#

yeah you commented out some arrays and left the , semicolon

spark turret
tough abyss
#
// Start with a silent black screen.
titleCut ["", "BLACK FADED", 999];
0 fadeSound 0;

// Spawn text effects.
_this spawn {

    
    params[
        ["_missionName", "Operation | Storm"],
        ["_missionAuthor", "by M. Texas"],
        ["_missionVersion", "Version 1.0"],
        ["_quote", "Those who stand for nothing fall for anything.” – Alexander Hamilton"],
        ["_duration", 9]
    ];


    // Starting quote as volume fades in.
    titleText [_quote,"PLAIN"];
    titleFadeOut _duration;
    _duration fadeSound 1;
    sleep (_duration - 2);
    // New "sitrep style" text in bottom right corner, typed out over time.
    [ 
        [_missionName,"font = 'PuristaSemiBold'"],
        ["","<br/>"],
        [_missionAuthor,"font = 'PuristaMedium'"],
        ["","<br/>"],
        [_missionVersion,"font = 'PuristaLight'"]
    ];  [] execVM "\a3\missions_f_bootcamp\Campaign\Functions\GUI\fn_SITREP.sqf";
    

    // Fade from black, to blur, to clear as text types.
    sleep 3;
    "dynamicBlur" ppEffectEnable true;   
    "dynamicBlur" ppEffectAdjust [6];   
    "dynamicBlur" ppEffectCommit 0;     
    "dynamicBlur" ppEffectAdjust [0.0];  
    "dynamicBlur" ppEffectCommit 5;  
    titleCut ["", "BLACK IN", 5];
};

Ive updated it and now i get no error messages. However the text doesnt apear at all

winter rose
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
ivory lake
# tough abyss ``` // Start with a silent black screen. titleCut ["", "BLACK FADED", 999]; 0 fa...

your parameters arent being passed to "\a3\missions_f_bootcamp\Campaign\Functions\GUI\fn_SITREP.sqf"; also I believe theres already a function for this but w/e
you have

    [ 
        [_missionName,"font = 'PuristaSemiBold'"],
        ["","<br/>"],
        [_missionAuthor,"font = 'PuristaMedium'"],
        ["","<br/>"],
        [_missionVersion,"font = 'PuristaLight'"]
    ];  [] execVM "\a3\missions_f_bootcamp\Campaign\Functions\GUI\fn_SITREP.sqf";

it should be

    [ 
        [_missionName,"font = 'PuristaSemiBold'"],
        ["","<br/>"],
        [_missionAuthor,"font = 'PuristaMedium'"],
        ["","<br/>"],
        [_missionVersion,"font = 'PuristaLight'"]
    ] execVM "\a3\missions_f_bootcamp\Campaign\Functions\GUI\fn_SITREP.sqf";

I believe

tough abyss
#

yep

#

just figured it out

#

πŸ˜„

arctic ice
#

anyone able to help me im trying to make it so only certain people with a set variable can open a door but im unsure whats wrong with it:

if ({player getVariable ['securitypass',0])==0}) then {this setVariable ["bis_disabled_Door_1", 1, false];}

winter rose
#

seeing how you are using this I assume that you are using an init field
don't

willow hound
#

Have you tried without the curly brackets around your condition?

arctic ice
#

wait so don't use an init field how come?

#

yeah i realised my issue with the curly brackets now i have
if ((player getVariable ['securitypass',0])==0) then {this setVariable ["bis_disabled_Door_1", 1, false];}

silk ravine
#

Hi there

#

When I load my mission in the editor, arma suddenly throws me this error, without any relation, file or script named. I have absolutely no idea where this is coming from, any ideas?

15:56:04 Error in expression <         };          };        };      };>
15:56:04   Error position: <;>
15:56:04   Error Missing )
15:56:04 Error in expression <         };          };        };      };>
15:56:04   Error position: <;>
15:56:04   Error Missing )```
pulsar bluff
#

any way to return the players currently selected "throw" weapon?

silk ravine
#

Also when on the server the mission will not show up with any slots?!
The only few things I changed are placing tripwire flares and some motorbikes but removing those did nothing.

winter rose
silk ravine
pulsar bluff
#

@willow hound 😍

vernal mural
#

is there a clean way to check if a player is indoor ? In a confined space ?

little raptor
#

no

winter rose
#

not really really, you can check if the player is within a building's bounding box, and/or use a lineIntersects to chexk if there is a roof above his head

#

buuut it would not be foolproof

vernal mural
#

the idea is to have a better local overpressure effect when using offensive grenades in a confined space

#

I guess even if not foolproof, could be doable

winter rose
#

yep, did that for some rain effects πŸ™‚

vernal mural
#

like checking if in building first, and if yes checking for a line of sight between victim and 'nade (somehow meaning "in the same room")

vernal mural
winter rose
#

to see if the rain would hit the player or not

vernal mural
#

I was pretty sure that rain stops on the roof in A3 πŸ€”

#

anh

#

get it

#

Lou_fnc_isPlayerWet or something like that

ivory lake
#

i thought there might have been a soundcontroller but i was thinking of the 'houses' one

vernal mural
#

never worked with that

#

how is this working ? I see it's possible to define custom sound controllers

little raptor
#

do houses even make a sound? meowsweats

vernal mural
#

looks more like an engine readable value for controlling sound sources more accurately

#

houses local density of object type β€œbuilding”, derived from map <0;1>

cyan dust
#

Good day. From anim viewer I do have anim name and even path, but how do I force unit to play it? πŸ€” I tried playMove and playAction with no luck so far.

little raptor
novel delta
#

If anyone may know, Is there anyway i can make AI only enter combat/alert if they're actually fired at, i've tried the vanila settings to not fire unless fired upon but the AI begins to shoot if they see the other person could shoot at them

winter rose
#

set their AI to CARELESS, and trigger the AWARE/COMBAT mode with a suppressed event

novel delta
winter rose
#

I have no idea.

novel delta
#

alright, regardless i appreciate the answer

#

i'll try it out

barren pewter
#

Im trying to setup up enemy ai that will attack one of six points randomly.
I was thinking about having a varible be set to random 6 and then have a if command for each value that syncs that enemy to one of the points. For a quick test i just set the varible to 1 and had
if (_myVar == 1) then {
opforSquadLeader1 synchronizeObjectsAdd [attack1];
};
I dont get any errors on game start but when the game starts he doesnt do anything. I also double checked to see if ai was enabled and it was. I probably made a really simple mistake because im new to scripting. Thanks ahead of time.

finite sail
#

are they in a building or not?

#

is what I use.. it has a fairly reliable go at getting balconies and roof overhangs and deciding they are not in a building

#

you can convert the boundingboxreal 0 into a marker and do in marker or similar

blissful flower
#

Hi guys. Is it possible to get to know if map is open now? I have tried:
ctrlEnabled 51;
ctrlShown ((findDisplay 12) displayCtrl 51); - always true
ctrlEnabled ((findDisplay 12) displayCtrl 51); - always true
ctrlFade ((findDisplay 12) displayCtrl 51); - always 0
What else to try? πŸ™‚ Thanks.

winter rose
#

*visibleMap?

#

@blissful flower

little raptor
blissful flower
unique sundial
#

@blissful flower type utils 5 in debug console then search for whatever keyword you need like in this case map, many commands are explicit with names

winter rose
barren pewter
#

@little raptor Attack 1 is the cba Attack module. ai groups attack torwards the position of the module when it is synced to that group's leader. Ive used the module many times in simple missions that didnt involve scripting. Im sure there is a better way to do this, I was just trying to see if it was possible to do it with something I was more familiar with. How would you go about making them attack one of several positions?

unreal scroll
#

What EH can I use to catch a bomb explosion? MPKilled/Killed doesn't work with it.

little raptor
# barren pewter <@360154905148653568> Attack 1 is the cba Attack module. ai groups attack torwar...

creating modules with scripts is a bit complicated:
https://community.bistudio.com/wiki/Modules#Spawning_a_Module_by_script
also I think syncing is uni-directional? I'm not sure. but using:

attack1 synchronizeObjectsAdd [opforSquadLeader1];

is safer

How would you go about making them attack one of several positions?
there are many scripting commands for commanding the AI.
you can for example give them waypoints:

_attackPositions = [_pos1, _pos2, _pos3, _pos4];
_group addWaypoint [selectRandom _attackPositions , -1];
little raptor
#

you have to use a loop

unreal scroll
#

Hm... What if I catch the projectile at Fired event? How can I catch the collision?

little raptor
unreal scroll
#

isTouchingGround/EPE is not for projectiles, right?

little raptor
#

no

unreal scroll
#

Sad, thanks. I need an exact time, to simulate some effects...

little raptor
#

they can't "touch the ground"

little raptor
unreal scroll
#

Hmm... I have an idea. How about to attach something to the bomb, and catch the Explosion event. or something? πŸ™‚

little raptor
#

catch killed for that other object

barren pewter
#

@little raptor does -1 in your script mean all of the data in the array?

little raptor
barren pewter
#

Oh, thank you kind sir!

little raptor
#

np

little raptor
somber radish
#

Quick question if anyone knows, what produces the biggest Explotion in vanilla Arma?

#

GBU-12?

#

Is there a way to spawn just the explotion or would I have to go with ```sqf
CreateVehicle

#

?

little raptor
somber radish
little raptor
somber radish
#

Oh nice!

#

Thnx

#

btw

somber radish
#

Thank you!

faint sage
#

Does anyone know how to make AI drive a vehicle after getting in?

copper raven
#

use getIn eh

#
  • doMove
cosmic lichen
#
"d" trim [" ", 0]; // Returns ""

Is that how it is supposed to work?

sharp grotto
#

doesn't look like it in the biki

ruby bronze
#

I know this is a noob question but here goes. How do I easily test changes of an addon I'm making? It's just an addon that changes the vanilla flashlight strength. But I'd rather not have to close the game and restart every time I make a change.

somber radish
copper raven
#

setPilotLight?

tough abyss
# somber radish Oh nice!

If you accept, that SOGPF is vanilla too - the biggest explosion is not the GBU anymore - its the 15'000 lb Daisycutter ( vn_bomb_15000_blu82_dc_ammo ) - and if you dont want that big explosion, have a look on the little sister ( vn_bomb_500_mk82_se_ammo ). Absolutely insane, as you see the airblast too on this explosions.

unreal scroll
#

Can AI planes keep a desired altitude, without following the ground surface?

unreal scroll
#

No, it doesn't work, the plane will follow the ground level

copper raven
#

should follow sea level

#

also make sure you use only one type of the command, not both

winter rose
#

if you want it to fly low, make sure to lower the flyInHeight

cosmic lichen
cosmic lichen
#

Wasn't there a command added to set the icon of a diary entry? setDiarySubjectPicture

quick sigil
#

Is it possible to create another slot for clothing? (e.g. glasses, hats, nvgs slots) I want to make all my custom clothing barefoot and then have shoes as a different object.

unreal scroll
#

@quick sigil Why not to create an action for it? Like "Select [loadout1]", "Select [loadout2]"

quick sigil
#

That would require making every single model with shoes

warm hedge
#

Impossible

quick sigil
#

So possible but only with engine changes?

warm hedge
#

True

#

And mass model coversion

crude vigil
#

Well if you really want to get creative, with a bit of inventory UI tweak (for boot selection/slot), and creating boots as placeable objects as well as an inventory item , then attaching to the characters' feet could maaaybe maybe maybe (like 5%[well, things tend to go wrong when pushing ur luck too much]) work. Not something I would invest time on though. Of course "boots" gotta be modelled properly, covering the actual uniform model's boots which would be a hassle on its own I'd believe.

gaunt mortar
#
    openMap true;
    hint "Choose where you want to be TP";

    mapclick = false;
    onMapSingleClick "clickpos = _pos; mapclick = true; onMapSingleClick """";true;";

    waituntil {mapclick or !(visiblemap)};

    _pos = [clickpos, 250, 1000, 3, 0, 20, 0] call BIS_fnc_findSafePos;
    hint format ["%1",_pos];
    player setPos [_pos select 0, _pos select 1];
    hint 'TPing';

So i currently have that, i'm hitting a generic error in expression at the waituntil "OR".

(End goal being that it create local marker on friendly unit and TP the player around said unit in a kilometer radius
Any one could point me to my error ? ^^'
thanks c:

winter rose
#

use map click EH plz

willow hound
#

Try to spawn your code

gaunt mortar
#

Event handlers.. Should have checked that >.> XD

willow hound
#

Generic error with waitUntil is often a "suspension is not allowed here" problem.

gaunt mortar
#

Mh ok, i guess i get why it's doing that then

#

And time to read the wiki for the EH c:

winter rose
gaunt mortar
#

Create EH when opening the map -> Teleport the player -> Delete EH ?

winter rose
#

no:
add map click event handler that on click:

  • teleports the player
  • deletes itself
gaunt mortar
#

Aaah ok

#

Thanks for the pointer :p

dreamy kestrel
#

Q: is there a way to dynamically add action menus to an object, let's say, as the action is opening, a request/response event sequence?
or better yet, open a sub-action menu given a top level action...

winter rose
#

addAction and scripting πŸ˜„

dreamy kestrel
winter rose
#

doc is a placeholder indeed

gaunt mortar
#

Well, thanks Lou and ansin πŸ‘Œ
Works like a charm :p
Now time to add a timer after death EH

dreamy kestrel
# winter rose doc is a _placeholder_ indeed

my goal there is to present an unload captives menu.
currently I could piecemeal add actions to the vehicle.
but it seems more appropriate to iterate through loaded captives and present a comm menu if possible...

winter rose
#

ooor not use the action menu at all and use an interface

#

action menu is ebol for lists πŸ˜„

dreamy kestrel
#

meh a full on UI is kinda overkill. that's why I am πŸ‘€ on the comm menu potentially.

winter rose
#

if it depends on the amount of people in there, you may want to go simple combobox + OK button instead

I mean, what if you have 20 guys in the vehicle, you have multiple subpages?

dreamy kestrel
#

honestly I don't know how many captives could be loaded, maybe, also depending on the vehicle cargo positions. will not be that terrible.
I just need an easy way to roll them up and present a comm menu. wrapping my brain around that approach.

#

one thing I know for certain, the current approach juggling loaded, unloaded, tracking action IDs, is UNWIELDY and CLUMSY putting it mildly.

little raptor
#

@dreamy kestrel
Comms menu is probably more suitable for that. They are easy to make too

dreamy kestrel
#

using showCommandingMenu, is there a hideCommandingMenu, or the engine just hides automatically?

little raptor
dreamy kestrel
little raptor
#

I don't think the array version exists on the wiki πŸ€”
I may have to write about that later.

dreamy kestrel
#

could just stuff all the vehicle cargo position captives in there in a simple transform.

#

stupid question, how do I connect that with a specific vehicle?

#

I need something like "CursorOnVehicle" visibility perhaps, perhaps naming it something like "#vehnetid:mymenu_unloadcaptives"

#

or perhaps "PlayerVehicleCanGetIn" is appropriate here, i.e. unloading captives from a vehicle, that the player can also get into, might make sense.

tough abyss
#

How can you get the pointer / index of an (simple (one dimension)) array in forEach loops? Is that achieved with Hashmap? Or is that not possible and only be possible in a for loop?

tough abyss
#

It's not like I haven't had the BIKI entry open umpteen times already

little raptor
spark turret
#

is there an array.shuffle() method?

little raptor
#

Not sure how fast it is

spark turret
#

thats alright, just have to shuffle a bunch of markers rarely

winter rose
#

BIS_fnc_arrayShuffle?

dreamy kestrel
dreamy kestrel
dreamy kestrel
#

re: showCommandingMenu, what is the script-string exactly? In the example it seems to want an associative ARRAY, ["expression", ...]?

dreamy kestrel
little raptor
dreamy kestrel
#

and not an array? I am confused...

#

and then, what happens if I would like to pass arguments? if I cannot I think I can workaround that, but I need to know that as well.

little raptor
tough abyss
#

Have another question regarding offloading content to other scripts

I have a script from someone else, which loads the content of another script with call compile preProcessFileLineNumbers like this

_defaultValues = [] call compile preprocessFileLineNumbers ("defaultvalues.sqf");

In the defaultvalues.sqf there are three other arrays, which then returned back. Like this

_accounts = [];
_files = [];
_customCommands = [];

[_accounts, _files, _customCommands];

I have now my own function to offloading the arrays to this function and i want to load this into the defaultvalues.sqf .. but however i did integrate them, it doesnt work
My function file

_customCommands = [];
customCommands;

How to call this in defaultvalues.sqf? Did try with call, but doesnt work

_accounts = [];
_files = [];
_customCommands = ???

[_accounts, _files, _customCommands];

How to achieve that?

little raptor
cosmic lichen
#

If you wanna send your arrays back to defaultValues.sqf then this won't work without modifiying the original function.

tough abyss
spark turret
#

is there a way to move smoke logic around?
I have a bunch of "cool stuff to find" things in a "waiting" area, until the player chooses his mission, then these arrays of objects get moved to the missions destination.
f.e. i have a downed helo and 2 pilots, but i also would like to have smoke

little raptor
spark turret
#

huh, maybe i can just copy the module and delete the old one

#

that works in zeus at least

little raptor
#

or select

#

if this is what you mean:

from defaultvalues.sqf to my_function.

tough abyss
little raptor
#

@tough abyss here's an example:
script 3: return _customCommands

//bla bla bla
_customCommands

script 2:

params ["_customCommands"];
_accounts = [];
_files = [];
//blabla

script 1:

_customCommands = call compile preprocessFileLineNumbers "script3.sqf"; //return from script 3
[_customCommands] call compile preprocessFileLineNumbers "script2.sqf"; //pass the array to script 2
past wagon
#

is there an event handler for when someone talks in chat? and how can I check what channel a player is in?

winter rose
#

I know there is one for people typing, dunno about chatting

past wagon
#

yeah i found the one for typing

#

its exactly what I need except I need one for voice

#

well ive looked through all the event handlers and there isnt one, but could I have a "KeyDown" event handler for when someone holds push to talk?

#

what is the event handler for when a key is pressed?

#

isnt there one called "KeyDown"?

past wagon
#

Am I using the DIK_KeyCode correctly? and how can I check what channel a player is in?

player addEventHandler ["onKeyDown", {
  params ["", "_key"];
  if ( keyName _key == "pushToTalk" && currentChannel player == 5 ) then {
      //show microphone icon
  };
}];

player addEventHandler ["onKeyUp", {
  params ["", "_key"];
  if ( keyName _key == "pushToTalk" ) then {
      //remove microphone icon
  };
}];
tough abyss
# little raptor if you want to pass `_customCommands` from script 3 to script 2 there's no way b...

Thanks a lot for your explanation, but didn't have to do that now, was my mistake ... using underscores in the "tag" definitions of the CfgFunctions quite stupid idea ...

Looks like this now and above all, I don't have to edit a file that is not intended for it (the defaultvalues is, but not the one from the first code block).

/* Original File from other programmer, which i should not edit (aka Script 1 ) - got now here on _defaultValues select 2 the content of Script 3 */
_defaultValues = [] call compile preprocessFileLineNumbers ("defaultvalues.sqf");
/* Original defaultvalues.sqf file from other programmer, which i have to edit (aka Script 2) - doesnt matter if i want to outsource  or not */
_accounts = [];
_files = [];
_customCommands = [] call tag_fnc_customCommands;

[_accounts, _files, _customCommands];
/* tag_fnc_customCommands (file fn_customCommands) aka Script 3 */
private _customCommands = [];

// return _customCommands to defaultvalues.sqf
_customCommands;
brave creek
past wagon
#

oh sweet

#

also, arent there two types of key ID's? what about the type that the keyboard shortcut uses in addAction?

#

because right now im detecting when a player holds down caps lock, but its possible that they dont use caps lock to speak. so, how could I check whether or not they are pressing down whatever their push to talk key is instead of just checking for caps lock?

brave creek
past wagon
#

ohh cool

#

yeah that could work

#

nevermind

#

it says it doesnt work on dedicated server

brave creek
#

currentChannel is client side too.

past wagon
#

wait

brave creek
#

You can use this client side, but not on the server.

past wagon
#

so if this was in initPlayerLocal, then it would be fine?

brave creek
#

yes, when the player is already speaking

past wagon
#

ok

#

yea

#

ok well how do I make an event handler for when a player pushes their PTT key?

#

From the wiki page for addAction:

shortcut: String - (Optional, default "") One of the key names defined in bin.pbo (e.g. "moveForward"). Adding available shortcut will bind corresponding keyboard key to this action. Shortcut availability can be tested with inputAction command

#

ooooo

#

keyName exists

#

perfect

#

how does this code look?

player addEventHandler ["KeyDown", {
  params ["", "_key"];
  if ( keyName _key == "pushToTalk" && currentChannel player == 5 ) then {
      //show microphone icon
  };
}];

player addEventHandler ["KeyUp", {
  params ["", "_key"];
  if ( keyName _key == "pushToTalk" ) then {
      //remove microphone icon
  };
}];
copper raven
#

well that's not going to work

crude vigil
#

Issue 1: it is not onKeyDown, it is keyDown
Issue 2: It is an ui event handler, not object event handler
There are more issues with your idea but thats next level.

past wagon
copper raven
#

read the first link too

brave creek
#

i think this could work:

(findDisplay 46) displayAddEventHandler ["keyDown", {
    if (inputAction "pushToTalk" isEqualTo 1) then {
        private _channel = currentChannel;
        // here your code
    }
}]
little raptor
crude vigil
past wagon
#

ok

crude vigil
past wagon
#

ok

#

so i need to use displayAddEventHandler to add the event handler to a display?

crude vigil
#

well, as the name suggests

past wagon
#

and what exactly is a display?

#

do I need to use findDisplay?

crude vigil
little raptor
past wagon
#

ok

#

but I dont quite get the reason for using findDisplay? why wouldnt it work like this:

46 displayAddEventHandler [ //....

instead of:

( findDisplay 46 ) displayAddEventHandler [ //....

why would we need to "find" it if we already know what the display we are using is?

crude vigil
past wagon
#

ohhh

tough abyss
#

not sure if the correct place, but Im looking for a simple to use database for a dedicated host, however I don't want the hassle of dealing with setting it up on a server.

Is there any options out there that are both easy to implement and can stay within the mission files??

past wagon
#

ohh

#

then why not this:

IDD_MISSION displayAddEventHandler [//.....

?

little raptor
#

the syntax for displayAddEventHandler goes:
DISPLAY displayAddEventHandler ARRAY

little raptor
crude vigil
past wagon
little raptor
#

it can be anything (but in this case undefined, unless you defined it yourself)

past wagon
#

ok

crude vigil
#

also, IDD_MISSION is still a number

#

so that would still not work

past wagon
#

then can you give me an example of what findDisplay would return?

#

i just wanna understand this

little raptor
crude vigil
#

ofc if you include

little raptor
#

display is a GUI element

past wagon
#

what if I did this:

_display = findDisplay 46;
hint str _display;
little raptor
#

for example, when you pause the game, what you see is a display (display 49 in this case)

crude vigil
#

u basically find the display with the ID of 46

past wagon
crude vigil
#

IDs of displays are defined in config, with idd=46 for example.

past wagon
little raptor
crude vigil
#

it would say Display#46 if display is on

past wagon
#

ok

past wagon
#

alrighty so heres my script updated for the display stuff. still not working?

( findDisplay 46 ) displayAddEventHandler ["KeyDown", {
  params ["", "_key"];
  if ( keyName _key == "pushToTalk" && currentChannel == 5 ) then {
      //show microphone icon
  };
}];

( findDisplay 46 ) displayAddEventHandler ["KeyUp", {
  params ["", "_key"];
  if ( keyName _key == "pushToTalk" ) then {
      //show microphone icon
  };
}];
crude vigil
#

Define not working in this context? Is there code in place of comments?

past wagon
#

just pretend that the code there exists and works perfectly

#

how does the rest of it look

little raptor
past wagon
#

sure

brave creek
little raptor
crude vigil
crude vigil
#

currentChannel player is wrong

past wagon
#

I saw what I needed to do

past wagon
past wagon
crude vigil
#

the command has no parameter like "player"

past wagon
#

oh yeah

crude vigil
#

such command would already only work on local player by itself

past wagon
#

its a nular operator

#

right?

little raptor
#

yes

past wagon
#

nice

#

alright ima go test this I will brb

crude vigil
little raptor
#

it does that in that order (action is done last)

crude vigil
#

but action is independent from checking the key to commit action.

little raptor
crude vigil
#

yes but override part is about the commiting the action, unrelated to action key

#

easy to test anyways

little raptor
#

I'm not 100% sure about what I said. You can test it.

crude vigil
#

yeah I know, just wondered the reason why u recall so ^^

#

if inputAction does not work in that context, is there a way to actually find out a way whether or not a button is actually stopped to be pressed, in a scenario of another display coming up front to the display the events are assigned?

#

cos keyUp in the event of another display going in (such as pressing ESC , and stop pressing the key, then close ESC) will result in keyUp event being missed.

little raptor
#

@crude vigil looks like I was wrong

#

it does work

#

you need to use:
inputAction "action" > 0
not == 1
on short press it's not 1

past wagon
#

I put this code in initPlayerLocal, and its not doing anything when I use PTT in direct chat:

waitUntil { !isNull ( findDisplay 46 ) };

( findDisplay 46 ) displayAddEventHandler ["KeyDown", {
  params ["", "_key"];
  if ( keyName _key == "Caps Lock" && currentChannel == 5 ) then {
      hint "You are talking in direct channel";
      //show microphone icon
  };
}];

( findDisplay 46 ) displayAddEventHandler ["KeyUp", {
  params ["", "_key"];
  if ( keyName _key == "Caps Lock" ) then {
      hint "";
      //show microphone icon
  };
}];
#

did I do keyName correctly?

little raptor
past wagon
#

makes sense

#

when will it exist?

little raptor
past wagon
#

yep

#

waitUntil { !isNil ( findDisplay 46 ) }; bad or good?

little raptor
#

isNull

past wagon
#

oh yeah

crude vigil
#

#arma3_scripting message You might wanna pay attention to this and next line as I had mentioned there is an advanced issue apart from first two issues I had listed.

#

but looks good for the start

past wagon
#

when is display 46 not null? because ive waited about a minute and still nothing

crude vigil
#

depends on where the code is being run

past wagon
#

initPlayerLocal

#

its the only code there is so far, this is just a test mission

crude vigil
#

Im not really experienced with those initPlayerLocal stuff (mission related .sqf files) so cant say something accurate, I'd expect it to exist instantly.

#

are you sure it is stuck at waitUntil? put a systemChat below waitUntil

past wagon
#

ok

#

yeah its instant

crude vigil
#

so you see the systemchat after waitUntil?

past wagon
#

yes

crude vigil
#

and u press pushtotalk..

#

and dont see hint?

past wagon
#

yes

#

in direct chat

crude vigil
#

put a systemChat str _this; line before params line, see if the action name is correct etc (ie. as you expect)

past wagon
#

ok

crude vigil
#

wait a minute...

#

_name = keyName 28; // result is "Enter"

#

it gives name of the key

#

not the action name

past wagon
#

yeah but

#

isnt the name of caps lock, "pushToTalk"?

crude vigil
#

does ur systemChat str _this return a value like "caps lock" etc?

past wagon
#

lemme check

little raptor
past wagon
#

ok

crude vigil
#

perks of debugging

#

always systemChat whatever you got in ur hand 😁

little raptor
#

it returns "Caps Lock"

crude vigil
#

let him check, thats how someone goes into debug practices

#

it is a long process to accept the need ^^

past wagon
#

it returns a number for caps lock

#

68

#

*58

little raptor
past wagon
#

no

crude vigil
#

yes u should also systemChat str keyName _key

little raptor
#

_key is a number

past wagon
#

wait

#

yeah thats what I mean

#

yeah _key returns 58 for caps lock

little raptor
#

we already know that meowsweats

past wagon
#

lemme do systemChat str (keyName _key);

crude vigil
#

make sure you always practice what you are doing in here now

past wagon
#

yea

#

keyName _key returns "Caps Lock"

crude vigil
#

so now u know why it doesnt work

past wagon
#

yep

crude vigil
#

the command doesnt do what u expect it to do

little raptor
crude vigil
#

yeah inputAction _key > 0.5

little raptor
#

0

past wagon
#

larger than 0.5? what does that mean

little raptor
crude vigil
#

doesnt matter in ur case, 0 or 0.5

past wagon
#

why not this:

if ( keyName _key == "Caps Lock" ) then {

?

crude vigil
#

what if Im not using caps lock for voice chat?

little raptor
#

so > 0

past wagon
#

oh yeah

crude vigil
#

I think it matters for joystick etc stuff...

little raptor
#

I use keyboard thomeowsweats

crude vigil
#

you are a developer, you gotta love everyone equally regardless of input device type they use :(

past wagon
#
if ( inputAction _key > 0 ) then {
#

well shit

#

whats wrong

little raptor
past wagon
#

i did lemme read again

#

i forget what _key is supposed to be lol

crude vigil
#

u coded it in ur mind, u just didnt write it

little raptor
crude vigil
#

happens 😁

past wagon
#

ok

crude vigil
#

"pushToTalk"

past wagon
#
if ( inputAction (keyName _key) > 0 ) then {
crude vigil
#

also , there is a pushToTalkDirect button as well, maybe u would like to handle it too

past wagon
#

nah its whatever

crude vigil
past wagon
#

"Caps Lock"

crude vigil
#

exactly

#

now check what inputAction takes

#
( findDisplay 46 ) displayAddEventHandler ["KeyDown", {
  params ["", "_key"];
  if ( keyName _key == "pushToTalk" && currentChannel == 5 ) then {
      //show microphone icon
  };
}];

( findDisplay 46 ) displayAddEventHandler ["KeyUp", {
  params ["", "_key"];
  if ( keyName _key == "pushToTalk" ) then {
      //show microphone icon
  };
}];```
Your old code, for you to remember.
little raptor
crude vigil
#

I didnt say thats the final answer

past wagon
#

the name

little raptor
crude vigil
#

keyName _key returns "Caps Lock" , whats wrong with that...

#

Ok Trioxide, do you want Caps Lock as answer?

#

No

little raptor
past wagon
#

"Caps Lock" is the name of the action, which is what inputAction takes, right?

#

wait

crude vigil
#

Leo, Im just going slower for him to compare the values he is receiving

past wagon
#

"Push To Talk"

crude vigil
#

yes

#

you want "pushToTalk"

#

not "Push to Talk"

#

is it equal to "Caps Lock" Obviously not

past wagon
#

yea

#

so

crude vigil
#

actionInput requires the action's name, not the key's

past wagon
#

so

crude vigil
#

what are our actions lets check

little raptor
# past wagon so

you don't even have to read the wiki description. just look at examples:

inputAction "leanLeft"
meowsweats

#

is leanLeft a key? no

past wagon
#

how do I get the actionName from _key?

#

_key returns a number

#
actionName

ohhhh

little raptor
past wagon
#

ok nevermind

#

i cant think rn

#

can you just tell me

crude vigil
#

actionKeys is the missing element here

crude vigil
#

retrieve the actionkeys, check if the _key in inside actionKeys

#

but u dont need it

#

you can do as Leopard linked

little raptor
#

ofc > 0 not isEqualTo 1

past wagon
#

I cant even remember what im trying to do

little raptor
crude vigil
#

if any key is pressed, you ll basically check if "pushToTalk" button is being pressed through inputAction, u dont need to check the key at all

past wagon
#

ohhh

#

yeah

still forum
#

omg... how good that we get eventhandlers for that stuff in 2.06...

#

what a mess

little raptor
#

for what?

#

ohhhhhh

#

you mean addon key config! πŸ˜„

still forum
#

no eventhandlers

#

should already be on wiki

little raptor
#

that's actually very nice!

crude vigil
past wagon
#
waitUntil { !isNull ( findDisplay 46 ) };

( findDisplay 46 ) displayAddEventHandler ["KeyDown", {
  if ( ( ( inputAction "pushToTalk" > 0 or inputAction "voiceOverNet" > 0 ) && currentChannel == 5 ) or ( inputAction "PushToTalkDirect" > 0 ) ) then {
      //show microphone icon
  };
}];

( findDisplay 46 ) displayAddEventHandler ["KeyUp", {
  if ( ( inputAction "pushToTalk" > 0 or inputAction "voiceOverNet" > 0 ) or ( inputAction "PushToTalkDirect" > 0 ) ) then {
      //show microphone icon
  };
}];
#

am I doing the condition with the parentheses correctly?

little raptor
#

leaderboardRequestRowsGlobalAroundUser what on earth?! notlikemeowcry

little raptor
#

although it makes more sense if it is:
inputAction "pushToTalk" > 0 || inputAction "voiceOverNet" > 0 || inputAction "PushToTalkDirect" > 0

crude vigil
#

no lazy evaluation?

little raptor
#

I think it's fast enough?

crude vigil
#

it is never enough

little raptor
crude vigil
#

99.5% cases will be using pushToTalk as it is default so :P

#

gotta check what voiceOverNet is

little raptor
#

let me test:

inputAction "pushToTalk" > 0 || inputAction "voiceOverNet" > 0 || inputAction "PushToTalkDirect" > 0

0.0030 ms

inputAction "pushToTalk" > 0 || {inputAction "voiceOverNet" > 0 || inputAction "PushToTalkDirect" > 0}

0.0032 ms

inputAction "pushToTalk" > 0 || {inputAction "voiceOverNet" > 0 || {inputAction "PushToTalkDirect" > 0}}

0.0034 ms

past wagon
#

huh

little raptor
#

so not that much slower

past wagon
#

0.0004 ms aint much

crude vigil
#

I just thought 1 additional scope actually :>

#

I wasnt serious anyways, just kidding

little raptor
crude vigil
#

thats overkill, that must be sabotaging it meowtrash

#

Thanks for edit sir

winter rose
#

depends on the used key, no? 😬

little raptor
#

exactly

#

if it was true:
0.0012 ms

I was just checking the worst case scenario

crude vigil
#

well I was going to say it too but he ll defend with "it will activate no matter what key is pressed"

#

and I got no plans to counter that

#

so I leave it here meowtrash

winter rose
#

*attacks @little raptor from the left* "@crude vigil, pick right!"

still forum
crude vigil
#

I had that expectation already πŸ˜…

winter rose
still forum
little raptor
#

addUserActionEventHandler ["Reload", "Activated", { systemChat "reloading!"; }];

event: String - event name - see UserAction Event Handlers. Can be one of:

"Activate"
"Deactivate"
"Analog"
crude vigil
#

It is a surprise for release

winter rose
#

After CZ, amma go to Amsterdam to bulli Dedmen >:D

little raptor
#

Ded?!

tough abyss
#

Hello, I'm searching for a quick way to change a group of units' side to east, I've googled it but it all seems a bit much for something that could be done in one line of code?

winter rose
little raptor
tough abyss
#

That's exactly what I'm refering to when I googled, Do I Have to place an additionnal unit to make a group

crude vigil
#

and _units are? :P

winter rose
still forum
#

@winter rose activate, deactivate, analog
unless you think I should change it

#

I can also change it into a StartsWith instead of a Equals. Then you can have all the variants πŸ˜„

little raptor
winter rose
#

hm
only on addUserActionEventHandler

crude vigil
little raptor
#

there's more?!

winter rose
#

got removeUserActionEventHandler 😁

tough abyss
#

Also simple question: what does the "_" do, as in "_x" "_units" "_group" "_obj"? I googled it a few months ago but it never really gave me a straight answer or an example

winter rose
crude vigil
#

No excuses

tough abyss
#

I'm not sure I understand

tough abyss
#

OHHHHH

crude vigil
winter rose
#

that's for the scope and all
but the naming of a variable is "identifier" yep

crude vigil
#

yes but he asked what _ is

winter rose
#

then identifier?

#

Identifiers of local variables must start with an underscore.

little raptor
winter rose
#

links are there agrrr

little raptor
#

I guess you meant what is a local variable? @tough abyss

crude vigil
#

Lou is just trying to make people check as many pages as they can

#

he ll make him read identifiers then make him jump to variables

winter rose
#

…I get paid per view 😭

tough abyss
#

No, I wasnt sure what were "_x" used for. I thought you could use _x as in to say "all those things" or _units as in "all those units"

crude vigil
#

Guess what Variables page contain a link to magic_variables as well

#

lou, u sneaky

still forum
tough abyss
#

What is a magic variable for?

#

Sorry I sound noob but i'm trying to learn

little raptor
#

the page already explains it

#

Magic variables are engine-maintained variables that serve a specific purpose within a given scope and are often used by the engine to push data to a given script or code fragment.

winter rose
#

_x
Represents the current element during a loop with: apply, count, configClasses, configProperties, findIf, forEach, select.

tough abyss
#

Yeah I read that but I understand half of it

crude vigil
#

For a new starter, the definition does not feel clear

little raptor
#

for example, when you loop over an array, you want to know what the current element is, and what is the iteration index
that's where _x and _forEachIndex magic variables come in handy:

{
  if (_forEachIndex == 1) then {
    _x setDamage 1
  };
} forEach [_unit1, _unit2];

kills unit 2, not unit1

winter rose
#

when you have a list, the _x will represent the item of that list

#

and the code will be executed for each item πŸ™‚

tough abyss
#

omfg

#

rigghht

#

Thank you so much

winter rose
little raptor
#

I liked the old one better meowsweats

#

I especially hate that it starts with creating a file meowsweats

#

I'd say show them what a script feels like

#

we need a quick example

#

some people already know programming and can pick it up in one look

#

plus it's called "Introduction"

still forum
#

I wonder how it feels not to know programming

tough abyss
crude vigil
#

Starting a page with file creation just feels like "Okay, I need a file for a script"

#

what next, introduce cfgFunctions? :P

little raptor
#

I was writing a quick intro to sqf a long time ago
I'll see if I still have it and try to complete it
then I'll show it to Lou
maybe he'll like it

winter rose
#

and marry it

#

wait

willow hound
winter rose
#

quit school?

#

joke aside, drop the wiki and good luck πŸ˜‰

willow hound
# little raptor I especially hate that it starts with creating a file <:meowsweats:7076260306131...

Yes, some already know programming, but many do not. Those with established knowledge can skip ahead as their skills allow.
My current plan for the rest of the page is splitting it into something like three sections along the lines of Beginner Scripting, Intermediate Scripting and Advanced Scripting and then list some concepts that readers at the specific level should familiarise themselves with (maybe also provide additional explanation for some of the trickier concepts) plus some example script case studies at each level.

winter rose
tough abyss
# little raptor ```sqf _units joinSilent createGroup east; ``` πŸ˜›

Hey me again, I just tested your code and it doesnt seem to work.. I tried a single unit, I tried a group
I tried this
guardtower1 joinSilent createGroup east; guardtower2 joinSilent createGroup east;

and whatever this may be
setSide east forEach unit inAreaArray guardgobad;

basically i want units to go crazy, mentally deranged yea if a unit goes into a trigger area called guardgobad

little raptor
#

a single unit:

[_unit] joinSilent (createGroup east);
shadow knoll
#

if im using ["Open", [false]] call BIS_fnc_arsenal; how do i populate the arsenal with weapons and gear i pick?

unreal scroll
#

Is there any way to print something to console via dedicated server script?

cosmic lichen
#

diag_log

#

or what console do you mean?

unreal scroll
#

@cosmic lichen There is one console as I know - the one you call by pressing Esc or Ctrl-D πŸ™‚

cosmic lichen
#

What kind of text you wanna add there?

#

"rscdebugconsole_expression" this is the variable in profileNamespace which contains the last content added to the debug console

#

remoteExec, setVariable, profileNamespace. Guess that's all you need

unreal scroll
#

@cosmic lichen"rscdebugconsole_expression" this is the variable in profileNamespace which contains the last content added to the debug console"
But if that text hasn't been added to console output, then it will not be there, right? πŸ™‚
I need script that can throw any kind of readable text into console - because copytoclipboard doesn't work in this case.

cosmic lichen
unreal scroll
#

Ok, thanks...
I think the most reliable way is to create a window displaying needed information.

austere hawk
#

whats the easiest way of checking if a unit is still executing a vehicle getOut animation, after giving a moveOut command?

hollow thistle
#

unitReady maybe?

#

It could report not ready a bit longer than the anim tho, usually until unit gets into "get out spot" near the vehicle.

austere hawk
#

hm, i want to avoid that the unit runs to the "get out spot" in the first place.

astral dawn
austere hawk
#

unitReady doesnt work when exiting a vehicle by moveOut, its remains ready all the time

tawny grove
#

hey i want to get into arma 3 moding

#

is ther any videos to help with that

#

ps : i already know c++

young current
#

@tawny grove what do you mean by modding?
What is it you would like to do?

austere hawk
tawny grove
#

add custom character models with custom animations and behaviours

#

add custom maps

young current
#

those are all quite intense and different things

tawny grove
#

add logic and enteraction between the player and some static objects

young current
#

for modes you need to first learn modeling

tawny grove
#

i can model

#

animate

#

and code

young current
#

for terrains there is a number of tools and concepts to learn

tawny grove
#

like what ?

young current
#

important part will be to be able to look up stuff on your own

tawny grove
#

cant i just use a terrain i created in blender ?

young current
#

no

#

well partly maybe

#

but mostly no

#

since its not the same

austere hawk
#

focus on one thing first ... logic and interaction -> SQF scripting. Mods -> config.

young current
#

πŸ‘†

tawny grove
#

yeah thats what i want to start on

#

the coding and logic

young current
#

there is arma scripting commands wiki page

tawny grove
#

cause i can use place holders for the other stuff

#

also if i make changes to my code

#

will have to restart the game to see the changes ?

young current
#

depends how you work on it.

tawny grove
#

depends on what ?

young current
#

some development can be done by restarting mission so that your changes get loaded

tawny grove
#

oh i see

young current
#

Id check out what the wiki has to offer

tawny grove
#

i am checking it right now

young current
#

also pinned messages on various topic channels can offer tips on where to look

tawny grove
#

ok got it

astral dawn
#

although... does vehicle _unit return objNull or the vehicle while the unit is exiting the vehicle?

little raptor
#

Use animStateChanged event handler if that is to happen too frequently

astral dawn
#

alternatively as a crude solution you can just check time since the unit started leaving vehicle

#

just assume that unit exits all kinds of vehicles for 2s max...

little raptor
#

Not so reliable

astral dawn
#

then 20 seconds πŸ˜„

#

but I don't know what kind of accuracy X3kJ needs

little raptor
#

But you can check the animation and get how long it takes to finish

#

If you want to go with the time method

astral dawn
#

yeah that's even cooler

little raptor
astral dawn
novel delta
#

Trying to make a storage system for players, maybe work off of their unit if possible (but can just work off faction if not possible)
does anyone have suggestions on how i'd do that or where to start looking?

novel delta
#

my mistake, should've clarified

#

vehicle storage

little raptor
#

but store what exactly?

austere granite
#

Merkava IIA

novel delta
#

ground vehicles in general is what im attempting

astral dawn
#

you need to describe what you want to achieve a bit more

austere granite
#

See, my joke of saying some specific vehicle actually was a good prediction πŸ˜„

novel delta
#

yeah sorry im still a bit new to this in general

astral dawn
#

how exactly should it work?

novel delta
#

ah

austere granite
#

I think you want to let players drive up to sojme place, and despawn the vehicle they drive up, and then be able to spawn it back later again?

novel delta
#

If im following now,
what im trying to-

astral dawn
#

well... you store the class name of the vehicle and any other its properties you want to be saved like damage or inventory

#

delete the vehicle

#

then you recreate the vehicle again with createVehicle and the data you've saved

#

also you will have to create some simple user interface for this

#

this is where the fun begins...

little raptor
#

@novel delta for example:
fn_saveVehicle.sqf

_veh = vehicle player;
if (_veh == player) exitWith {};

MY_saved_vehicle = [
  typeOf _veh,
  damage _veh
];

fn_loadVehicle.sqf

_vehParams = MY_saved_vehicle;
if (isNil "_vehParams") exitWith {};
_vehParams params ["_type", "_damage"];
_veh = createVehicle [_type, _somePos];
_veh setDamage _damage
novel delta
#

alright, i appreciate it everyone

#

thanks

astral dawn
#

you can save it to profileNamespace so that data survives mission restarts if you want

little raptor
#

yeah ^

#

and if you want to "store" multiple vehicles you can use an array

astral dawn
#

also a good new modern way to serialize all that data is to use a hashmap

#

then it's also easier to implement backwards compatibility when you decide to update your code

tough abyss
#

How would you remove empty ammo counters after changing around pylons through script? Bombs/rockets used on default loadout now show 0. Would like to get rid of them completely because switching through them wastes time.

unreal scroll
#

In addition to this: #arma3_troubleshooting message
There is a function called OT_fnc_getsave_server:

_data = profileNameSpace getVariable OT_saveName; 
waituntil {!isNil "_data"};
server setvariable ["OT_Save",_data,true];

I'm trying to exec it locally (to run the script on my dedicated server):

remoteexec ["OT_getsave_server",2];

Assuming that it will set the OT_Save variable.
But remoteexec doesn't work in this case.
I can do server exec:

spawn OT_getsave_server;

and it works fine.
What could be a problem?

outer fjord
#

What would be the best way to hide everything on a unit say for their gear? Trying to take preview screenshots

little raptor
unreal scroll
#

Yes. Most of other functions work (can't say 100% for all, just noticed this problem)

little raptor
#

@unreal scroll

_data = profileNameSpace getVariable OT_saveName;
waituntil {!isNil "_data"};
this is wrong

#

it never becomes true

#

also you don't have to wait for it

unreal scroll
#

Hm... Then why it works?

little raptor
#

if it doesn't, it won't

unreal scroll
#

It doesn't exist before. Above is the whole function body

little raptor
#

then it doesn't work

unreal scroll
#

No, it works πŸ™‚

little raptor
#

it shouldn't

#

@unreal scroll is OT_saveName an array?

#

or a string?

#

if it's a string it shouldn't

unreal scroll
#

It is an array. Can you explain why !isNil "_data" should never becomes true?

little raptor
#

if it's an array your waitUntil is useless

#

it's always not nil

unreal scroll
#

The array is very large, the process can get up to 10-15 seconds. So it is for a fail-safe purpose.

little raptor
#

it never moves forward until something is done

unreal scroll
#

True πŸ™‚
"if it's an array your waitUntil is useless
it's always not nil"
I'm just checking that the data exists. The purpose is not the elements counting. No matter, does it contains something or just an empty array.

little raptor
#
_a = missionNamespace getVariable ["blabla", 1];
!isNil "_a"
#

go ahead and try it

#

do you even have blabla?

#

no

#

but it exists

queen cargo
little raptor
#

because you're giving it a default value

queen cargo
#

It is pretty much equivalent to

_data = 1;
Waituntil { _data != 1 };
#

Just that you're lucky and the variable in missionNamespace is already set

little raptor
#

because of default value, not because of luck

unreal scroll
#

As I said, I've got it, thanks.

"Just that you're lucky"
No, I'm just too careful πŸ™‚
I always use such checks in missions, when manipulating objects.

"he's using an array
it already exists"
No, I just assumed that the script could get further, without having anything _data. Taking in account that it is single-threaded and we're not manipulating objects, it is nonsense, that is just a useless thing, not a real problem.

queen cargo
#

It simply would remain that way forever and create a deadlocked script

unreal scroll
#

"It simply would remain that way forever and create a deadlocked script"
Also I can type format C: πŸ™‚
Or put a chat-related command to a chat EH.
It is very easy do catch, and it is another thread of conversation - all we do some useless things from time to time.
The real problem - why the remoteexec doesn't work...

pliant stream
#

you can't suspend in fsm can you?

little raptor
pliant stream
#

that's too bad... setFsmVariable could set _data otherwise πŸ™ƒ

#

i've seen some waituntil { !isnull _object } sort of stuff before, but i never encountered any problems requiring this myself. in what kinds of situations would this be useful?

little raptor
little raptor
#

depends what _object is

unreal scroll
#

@pliant stream "in what kinds of situations would this be useful?"
Missions, for example. It comes from here, it is written in auto mode πŸ™‚
Like waituntil {isNull _object}; - if it is supposed it should be destroyed.

"did you put a diag_log at the beginning to check?"
Trying currently πŸ™‚

pliant stream
#

what you're describing is orthogonal to my question

little raptor
pliant stream
#

right. in what situations does an object value change from being null, to being non-null? if the engine is to be considered remotely sound, it should be never

little raptor
austere hawk
little raptor
#

but doesn't mean you can't use it! πŸ˜„

austere hawk
#

what happens if you add multiple eventhandlers of the same type to a unit by script? I know you where limited to 1 EH when using config defined EH for a long time - not anymore - but i'm unsure about "addEventhandler" side of things ?

pliant stream
#

you can have multiple event handlers and get back a handle for removing it. which handler's return value is used i'm not sure off the top of my head

pliant stream
#

if it were to happen i suspect it would be when you create an object on machine A, send a reference to it to B, B checks it for null, but the packets propagating information about the object being created are delayed

still forum
#

That cannot happen

pliant stream
#

these updates are guaranteed to arrive in the order they were sent then?

still forum
#

the network packets are ordered.
a remoteExec with a object reference cannot arrive before the objects creation

unreal scroll
little raptor
unreal scroll
#

class CfgFunctions, as all others.

little raptor
unreal scroll
#

Thanks, sorry for it, need to rest ))

still forum
#

How do I get a UAV pilot unit out of a vehicle?
moveOut script command says "Does not work for UAV crew"
doGetOut also doesn't seem to do much.
The unit is dead I want to get it out to put a new one in

hollow thistle
#

Maybe this?

still forum
#

worked! awesome

still forum
#

now just need to spawn B_UAV_AI. both createUnit and createAgent, the unit is there for half a second and then becomes null

little raptor
still forum
#

I tried

#

same thing, they despawn

#

weird

little raptor
# still forum same thing, they despawn

your UAV is bugged meowsweats
even this works for me:

_gr = createGroup west;
_u1 = _gr createUnit ["b_uav_ai", [0,0,0], [], 0, "NONE"];
_u2 = _gr createUnit ["b_uav_ai", [0,0,0], [], 0, "NONE"];
_u1 moveInAny dr;
_u2 moveInAny dr
#

(tried it on Darter)

#

@still forum are you trying that in MP?

still forum
#

YE

little raptor
#

how do you execute?

#

remoteExec?

#

debug console?

still forum
#

debug console local

#

wow I typed script ingame.
apparently text box didn't have focus.. The typing selected the Respawn button and instantly confirmed facepalm

#

oof that worked now

#

I tried to add them to my player group

#

that somehow deleted them

#

creating a new group works

#

side driver T1 == CIV
why is the driver of my UAV now a civ :U

little raptor
#

createUnit or createVehicleCrew?

still forum
#

Yours

little raptor
#

makes no sense meowsweats

#

I'll check in a minute

still forum
#

join command on the driver unit doesn't work πŸ˜„

#

it seems like it left the group it as soon as I did moveInAny.
The group i created the unit in is now empty

little raptor
#

I changed it a bit

#

I was creating two separate groups before meowsweats

still forum
#

Yes.

_gr = createGroup west;
_u1 = _gr createUnit ["b_uav_ai", [0,0,0], [], 0, "NONE"];
_u1 moveInAny dr;

#

its a single seater

#

I now re-did with createVehicleCrew.
Works now.
driver..... WHAT

#

Driver in vehicle was in blufor group, but side of the driver was still CIV.
Now all of the sudden the drivers group is grpNull. Without doing anything, the driver left its group and is now not in any group

#

what the hell is going on

little raptor
#

try this:

teamMember driver T1
#

if it's not null it's an agent

#

(it should be, because units can't not have groups in Arma; only agents can)

austere hawk
#

weird, AnimChanged EH does trigger before there is a detectable change with command "animationState"
Can anyone explain the difference what makes AnimChanged different to AnimStateChanged?

["anim player=","amovpercmstpsraswrfldnon"," time=",1.572]
["anim player=","amovpercmstpsraswrfldnon"," time=",1.589]
["anim player=","amovpercmstpsraswrfldnon"," time=",1.606]
["anim player=","amovpercmstpsraswrfldnon"," time=",1.623]
["anim player=","amovpercmstpsraswrfldnon"," time=",1.64]
["anim player=","amovpercmstpsraswrfldnon"," time=",1.656]
["anim player=","amovpercmstpsraswrfldnon"," time=",1.672]
["EH: AnimChanged to","amovpercmevasraswrfldf"," time=",1.672]
["EH: AnimStateChanged to","amovpercmevasraswrfldf"," time=",1.672]
["anim player=","amovpercmevasraswrfldf"," time=",1.688]
["anim player=","amovpercmevasraswrfldf"," time=",1.705]
<snip>
["anim player=","amovpercmevasraswrfldf"," time=",2.176]
["anim player=","amovpercmevasraswrfldf"," time=",2.193]
["anim player=","amovpercmevasraswrfldf"," time=",2.21]
["EH: AnimChanged to","afalpercmstpsraswrfldnon"," time=",2.21]
["EH: AnimChanged: Falling detected"]
["EH: AnimStateChanged to","amovpercmstpsraswrfldnon"," time=",2.21]
["anim player=","amovpercmstpsraswrfldnon"," time=",2.226]
["anim player=","amovpercmstpsraswrfldnon"," time=",2.243]
["anim player=","amovpercmstpsraswrfldnon"," time=",2.26]
<snip>
["anim player=","amovpercmstpsraswrfldnon"," time=",2.427]
["anim player=","amovpercmstpsraswrfldnon"," time=",2.444]
["anim player=","amovpercmstpsraswrfldnon"," time=",2.461]
["anim player=","amovpercmstpsraswrfldnon"," time=",2.478]
["EH: AnimStateChanged to","afalpercmstpsraswrfldnon"," time=",2.478]
["EH: AnimStateChanged : Falling detected"]
["anim player=","afalpercmstpsraswrfldnon"," time=",2.495]
["anim player=","afalpercmstpsraswrfldnon"," time=",2.512]
["anim player=","afalpercmstpsraswrfldnon"," time=",2.529]
["anim player=","afalpercmstpsraswrfldnon"," time=",2.546]

little raptor
#

animChanged will trigger when the unit wants to change animation

#

basically when you say: "I want to play animation X", it'll trigger

#

it won't trigger for animations that are just connections/interpolations to that animation

austere hawk
#

ah good to know, thanks

still forum
#

and its group too

little raptor
unreal scroll
#

@little raptor BTW, I've found the cause of another issue with the remoteexec (#arma3_troubleshooting message)
As I supposed, it comes from inattention too, and it was the missed brackets inside the CBA PFH.
It didn't generate any errors. Need to keep in mind that CBA functions don't throw errors even from incorrect syntax...

little raptor
unreal scroll
#

On dedicated

little raptor
#

if you used per frame EH it won't

#

(or in general, all EH's don't throw errors afaik)

tough abyss
#

IM using inidbi2 to have an auto-save feature in a mp mission im creating. Currently i have the server run a script called 'autosave.sqf' that completes an auto-save of player data every 90 seconds. However, i want to change this to a save on disconnect. is this possible?

unreal scroll
#

@tough abysshttps://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#HandleDisconnect

tough abyss
unreal scroll
#

It should works well, but consider the situation when you don't want to save the game at this moment, and just quit.

unreal scroll
#

From my experience in coop campaigns the most reliable and logical way is to have one or more players as some kind of game masters, who can save the game.

tough abyss
#

that would be me. However, i also want to account for accidental disconnects / crashes. Hence why i have an auto save system currently in place. I just wanted to know if i could do it reliably for a player who has disconnected or crashed.

#

currently data saves every 2min 30 seconds.

still forum
unreal scroll
#

"i also want to account for accidental disconnects / crashes"
Good point.
Yes, you could do it. You make a persistent mission, isn't you? Then you should already have a working save system.
Then just do the loadout/character save on disconnect.

#

I would check if the player is alive and in safe place. Care of your lives πŸ™‚
Also you can add something for fail-safe saving, like that: https://youtu.be/N2w3T3DA7eA
If yu're interested, you can visit my discord channel (https://discord.gg/5Jw7ks4), I can suggest you some of fail-safe features/save algorithms.

dreamy kestrel
#

I am still confused, need clarification... when you create a trigger object attached to a target object, when the position of the target changes, does that in effect change the position of the trigger?

austere hawk
#

I'm looking for ideas - i'm currently trying to get rid of this annoying game breaker by myself, as it seems no fix is coming: https://feedback.bistudio.com/T154778
My workaround works mostly OK in stopping the "slide of death" as well as the damage you would receive - but sometimes the glitched state exits on its own before i can confidently say that its in fact in a glitched state. And when that happens you receive a huge amount of damage from a very small fall. Does anyone have a better idea how to detect and intercept this glitched state faster than just comparing height numbers?
https://www.sqfbin.com/imaqibawupuwesemuyuw

if anyone wants to try with the anti-glitch -> see pbo.

still forum
#

Doesn't seem to me like a fix is coming for that

austere hawk
#

my entire collection of walls, trenches and other fortifications is basically unusable on certain maps (i'm guess it depends on terrain grid size or something), as you constantly get into glitched state and die... so i have to do something, otherwise i might as well throw the towel on the whole fortification thing.

sharp grotto
# austere hawk my entire collection of walls, trenches and other fortifications is basically un...

I was plagued as player with the same bug when i still played Arma Exile. Died so many times and was raging like crazy πŸ˜„

My hacky noob attempt to get rid of it.
We run this in a loop (via Exile Thread system every second) and it stops it from happening, using it for more than one year now and so far iam not aware of any downsides.

_fs = ["afalpercmstpsraswrfldnon","afalpercmstpsnonwnondnon","afalpercmstpsraswpstdnon","afalpknlmstpsraswrfldnon","afalpknlmstpsnonwnondnon"];  
_player = player;
_playerpos = getPos _player;
if ((animationState _player) in _fs) then
{
    _f = _playerpos select 2;
    if (_f < 0.1) then 
    {
        _player setvelocity [0,0,0];
    };
};

https://youtu.be/0DGiLA8gCZM

tough abyss
#

Hey y'all,

Can someone tell me what the issue is on the following line?

dep_unit_init = "[_this] execVM (selectRandom ["Scripts\enemyAK12.sqf","Scripts\enemyRPK.sqf","Scripts\enemyRPG.sqf","Scripts\enemySniper.sqf"])";";

From the DEP settings.sqf to add an init to each unit created.

The example shows this: dep_unit_init = "[_this] execVM ""unitinit.sqf"";";

#

It tells me it's missing a right bracket and a semicolon. It's probably quote and semi colon placement issue but I'm not sure what's the correct format

crude vigil
# tough abyss Hey y'all, Can someone tell me what the issue is on the following line? dep_un...

From a simple look, you should notice that there are 11 quotation marks.
Then, you should ask, how can SQF understand nested strings?

dep_unit_init = "[_this] execVM (selectRandom ['Scripts\enemyAK12.sqf','Scripts\enemyRPK.sqf','Scripts\enemyRPG.sqf','Scripts\enemySniper.sqf']);";

or

dep_unit_init = "[_this] execVM (selectRandom [""Scripts\enemyAK12.sqf"",""Scripts\enemyRPK.sqf"",""Scripts\enemyRPG.sqf"",""Scripts\enemySniper.sqf""]);";
//You can keep nesting strings with 2^x formula. (ie. " , "" , """", ...)
tough abyss
#

Nevermind, I figured it out!

tough abyss
#

I did the following and worked:
dep_unit_init = "[_this] execVM (selectRandom [""Scripts\enemyAK12.sqf"",""Scripts\enemyRPK.sqf"",""Scripts\enemyRPG.sqf"",""Scripts\enemySniper.sqf""]);";

tough abyss
late jacinth
#

SrgFatCat3522 β€” Today at 2:57 AM
I am trying to start and return to the same location. I want the trigger to only fire when I return. I am using this script in the init of a trigger to create a trigger for the return. Hope that makes sense. It doesn't work. can anyone help? thx How to use SQF syntax highlighting in Discord

// _trg = createTrigger ["EmptyDetector", getmarkerPos [mark1]]; _trg setTriggerArea [5, 5, 0, false]; _trg setTriggerActivation ["CIV", "PRESENT", true]; _trigger synchronizeTrigger [completetrg]

#

I know I can use "daytime >" but I am trying to spawn the trigger . thx

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
little raptor
little raptor
#

@austere hawk give this a try:

player addEventHandler ["AnimStateChanged", {
    params ["_unit", "_anim"];
    _isFalling = _unit getVariable ["T_falling", false];
    if (_anim select [0, 4] == "afal" && !_isFalling) then {
        _unit setVariable ["T_falling", true];
        _unit setVariable ["T_fallParams", [getPosASL _unit #2, 0, velocity _unit # 2]];
        systemChat "falling";
        onEachFrame {
            private ["_params", "_v0"];
            _v = velocity player;
            if (_v#2 < -6) then {
                _params = player getVariable ["T_fallParams", []];
                _params set [1, _params#1 + diag_deltaTime * accTime];
                _params params ["_y0", "_dt", "_v0"];
                _y1 = getPosASL player #2;
                _dy = _y1 - _y0; 
                
                _dy_expected = -0.5 * 9.81 * _dt^2 + _v0 * _dt;
                
                 if (_dy > _dy_expected*2/3) then {
                    _v set [2, _v0];
                    _params set [1, 0];
                    player setVelocity _v;   
                }

            }
        }
    } else {
        if (_isFalling && {isTouchingGround _unit}) then {
            _unit setVariable ["T_falling", false];
            systemChat "not falling";
            onEachFrame "";
        }
    }
}];

it's for testing. don't actually use it. if it works I'll clean it up and make it into a mod

austere hawk
# little raptor I'll write one when I get up! <:meowsweats:707626030613135390>

cheers! from a handfull of tests - yours seems to prevent dieing, but you can still be stuck for an awefully long time, including the problem of sliding sideways along
idk if you have tested the repro mission yet, but if you run at an angle towards the other side of the "trench", you slide sideways and then die (without intervention). You seem to stop the death, but not the sliding for several seconds. When running straight (from position 2 to 3 in pic), you dont slide normally, you are just stuck a long time in midair. Running diagonally (e.g. pos 1 to 4) results in the sliding on bottom of trench.

#

If you manually execute velocity [0,0,20] while falling, your script stops reduce downwards acceleration when going into negative z direction again, its a bit arkward - BUT i havent czeched what actually happens if you "legitimately" exit a flying vehicle that travels upwards.

unique sundial
#

czechBox

somber radish
#

So anyone know if theres a way to get a returnvalue from a function (Like in C# when using a method) ?

spark turret
#

last variable in the function will be returned

#
_myFunction = {
dostuff;
doStuff;
//return
"uwu"
}
vernal mural
#

is there a way to reverse-browse through a hashMap ? Something like "get" but on values instead of keys ? Lots of programming languages make it possible, I wonder if ArmA can do such a thing. According to documentation, the only way to do so is by iterating on all values and existing loop when wanted value is found

#

which is not very optimal

#

but working nonetheless

austere hawk
#

create a hashmap, where values are the keys and keys are values πŸ˜„ then you can most optimally browse

vernal mural
spark turret
#

just bruteforce search your hashmap every time B)

#

Think outside the box

austere hawk
#

choose a better strategy so you dont have to search through it in the first place...

#

i store some objects in a hashmap for some data. But i also store the key as local var on the object (in case i dont want to use object name as key)

vernal mural
#

what I'm doing could really benefit from a multimap, as reverse searches are relevant

#

however reverse searches can be avoided or made very rare

#

so iterating the hashMap in these rare cases should be a problem

winter rose
#

what exactly are you trying to achieve?

vernal mural
#

plus, it's not a matter of milliseconds, so no problem if it's slow

#

basically, a whitelist

#

storing a whitelist as a hashMap of steamID:nickname

#

when checking if a given player is whitelisted, the steamID is used

#

the nickname is used only when admin want to add/remove offline people from/to the whitelist

proven charm
#

why does BIS_fnc_findSafePos sometimes return position way beyond the maximum distance (maxDist parameter)?

proven charm
#

nvm, I guess that was some kind of default pos..

shadow knoll
#

sorry this is probably super basic and easy to solve but im using this addaction to run a script for an arsenal with specific gear player addaction ["<t size='1.4' shadow='2' color='#AABEA5'>Armory</t>", "vanillaArsenal.sqf", [], 1, true, true, "","([base] findIf {player distance _x < 50}) > -1"]; i already have the arsenal made but every time i use the addaction i made it gives me a whole new addaction to use the arsenal and it also never goes away.

[player,((itemCargo player) + _availableHeadgear + _availableGoggles + _availableUniforms + _availableVests + _nvgoggles + _mainattachments + _seconattachments + _miscshit)] call BIS_fnc_addVirtualItemCargo;
[player,(magazineCargo player + _magazines)] call BIS_fnc_addVirtualMagazineCargo;
[player,((weaponCargo player) + _gunz)] call BIS_fnc_addVirtualWeaponCargo;```
real tartan
#

is there a magic variable that I can diag_log a line of script ? __LINE__ or __FILE__

shadow knoll
#

well i dont want that second action to pop up in the first place

#

my original addaction goes away when i leave a certain radius and i want the script to be executed through that one and not give me another one

copper raven
#

what is vanillaArsenal.sqf?

#

also ([base] findIf {player distance _x < 50}) > -1, why?, just player distance base < 50

shadow knoll
#

thats the sqf for all the gear in the arsenal

#

sorry im still new to this and thats just what i got

real tartan
shadow knoll
#

init.sqf

real tartan
shadow knoll
copper raven
#

can you paste the contents of that sqf file?

shadow knoll
#

which one?

copper raven
#

the arsenal one, or is it what you sent in your initial message?

shadow knoll
#

i sent the main part of it in the intial the rest of it was just the gear i was including

shadow knoll
#

thanks i will look again

little raptor
little raptor
leaden haven
#

Does the setobjectscale command work in MP yet? Thanks. I was running it on server, but it would not run.\

tranquil cradle
little raptor
#

iirc it was

winter rose
still forum
vernal mural
#

more like at most a dozen entries 🀣

#

not to worry about memory

#

it was more of a code quality/readability matter than a performance matter

cyan dust
#

Good day. How do I spawn an entire group of units like the one I see in the Editor? "Recon Squad", "Fire Team", etc.?

vernal mural
#

don't forget to flag created groups for autodeletion when empty

#

you'll avoid strange problems of units not spawning after a while for no apparent reason on long duration/persistent missions

leaden haven
#

So what happened with the diag_setTerrainHeight commands that were in the diag.exe. Where they planned to come to stable or is it still being worked on? You could reshape terrain with scripting commands.

little raptor
#

afaik

leaden haven
#

Damn.,

#

Imagine the trolling with scripters tho, making a massive crater to ruin airbase. LOL.

vernal mural
#

I'm also quite surprised (and excited) at the most recent script commands. Stuff that was missing for long are now coming to the engine, like HashMaps, modded keybinds (CBA might like this very much), some more physx stuff (cruise control, unlocking brakes for towing), etc

#

I wonder why so much stuff, now that A3 is very close to no-support

#

oh and regex manipulation stuff too

#

that's cool

cyan dust
# vernal mural that's cool

Totally agree. I feel lucky to jump in when, for example, hashmaps added, makes a lot of stuff much easier.

still forum
cyan dust