#arma3_scripting

1 messages ยท Page 276 of 1

little eagle
#

I hate "generic error" error messages

#

Ohhh

tough abyss
#

my dll is probably crashing it out yet running successfully, which would be return related

little eagle
#

Are you ending your function with an assignment operator?

tough abyss
#

yes, _null = "bla" callExtension "";

little eagle
#

try returning nil or a boolean

#

the assignment operator is fucked in SQF

#

repro:

_a = {_b = 0};
#

same error

#

fix never

tough abyss
#

yeah its gone now

#

@little eagle Do you hate or love arma 3 SQF?

#

Serious question?

#

so preStart script expects a return?

#

preinit you mean?

#

in functions?

little eagle
#

so preStart script expects a return?
No. It's just a bug

#

Do I LOVE or HATE sqf? Hmm.

tough abyss
#

wait, a general bug for the assignment operator or just in this instance?

little eagle
#

general bug

#

Every SQF command in C++ ends with return GameValueNil or whatever else the command is supposed to return in SQF

#

but the assignment operator is handled differently. As "keyword" and it ends with void

#

that's all

#

fix takes one minute

#

ยฏ_(ใƒ„)_/ยฏ

tough abyss
#

Maybe I forgot about that bug, but I have always returned from scripts like this: _ret;

gray sapphire
#

Dictionary/associative arrays/key-value data structures are incredibly valuable to programming. The *pair functions in (configfile >> "CfgFunctions" >> "A3" >> "Arrays") should probably be surfaced as scripting commands to the benefit of the community. Thanks to the contributors/authors.

tough abyss
#

@little eagle I've become disillusioned with arma 3.

#

The sorts of experiences I just can't do.

#

I've tried a bunch of mission generators Patrol Ops 3

#

Insurgency

#

They also feel..

#

Unimmersive? Along with repeative and boring?

little eagle
#

I never tried those. All I ever play is some bare-bone MP missions with a milsim group.

#

a bunch of markers and preplaced enemies

#

It's all you need

tough abyss
#

30 or more players?

little eagle
#

In the good times yeah

#

But also 20 is enough really

tough abyss
#

Yeah our milsim has been backstabbed a few times.

#

People branching off etc.

#

And I'm the "main" mission dev.

#

And server manager.

little eagle
#

urg

tough abyss
#

Did you know any other programming languages before SQF?

little eagle
#

I had a one semester class programming for whatever reason where we used Java

tough abyss
#

Do you plan your code? Much?

#

With ACE3 ?

little eagle
#

I try to keep things simple and make lot's of reusable code in the common component. I also use pen and paper for complex things, but most of the time I just write stuff

#

then rewrite it

#

then rewrite it again

#

and then it's usually done

#

I like simplifying and rewriting stuff as well as finding work arounds. Stuff real programmers seem to hate apparently

tough abyss
#

So? me writing this piece of code?

#

params [
    ["_object",objNull],
    ["_variableName",""],
    ["_state",false],
    ["_isPublic",false]
];
missionNameSpace setVariable [format ["%1",_variableName],false,true];
diag_log format ["_object: %1",_object];
_HandlerID = _object addEventHandler ["killed",{ 
    // diag_log "EH Fired";
    missionNameSpace setVariable [format ["%1",_variableName],_state,_isPublic];
    "Generalised EH fired" remoteExec ["hint",0,false];

}];        
#

Is good?

#

Smaller is better?

little eagle
#

You cannot pass variables like that inside the scope of event handlers

#

and there is no need to store _HandlerID as variable if you're not gonna use it

#

format ["%1",_variableName] is pointless if _variableName is always a string anyways. it does nothing. might as well leave out the format part

#

the comment is pretty pointless too as it just repeats what the code is instead of describing what it does or why it's used

#

the note sounds confusing

#

isGroupDeletedWhenEmptyWithALongName

#

So is this a fully mission maker controlled thing or does Arma engine use this on it's own

#

the if is kinda superfluous

#

both of them

#

well

#
{
    _x deleteGroupWhenEmpty true;
} count allGroups;
#

I think the point of this is, that you can use it after createGroup

#
addToRemainsCollector _units;
removeFromRemainsCollector _units;

vs:

{_x deleteGroupWhenEmpty true; } forEach _groups;
{_x deleteGroupWhenEmpty false; } forEach _groups;
#

awkward

#

The difference between addTo/removeFromRemainsCollector and deleteGroupWhenEmpty shows a lack of planing ahead

#

Both of these things should've been handled the same way

#

I have no idea.

#

If it were a SQF / FSM thing, then the addTo would be just a glorified setVariable

rancid ruin
#

arma scripting is fun eh

little eagle
finite mica
#

Not sure if I have asked this before, is there a way to draw rectangles on the map with premade functions? I saw some missions and some developer debug screenshots marking specific squared in red

#

I could ghetto it with markers and manual measure ments but i wonder if functsions exist for that

little eagle
#

createMarker

finite mica
#

crap

little eagle
#

what's the problem?

#

there is CBA_fnc_createMarker, but honestly

#

it's worse than just doing it all by yourself

finite mica
#

I was fishing in the bis fncs and saw some GRID functions, hoping that would be it

vague harness
#

Hey guys, I have a script that spawn 3 different type of crates from a flagpole ("B_CargoNet_01_ammo_F";"CargoNet_01_barrels_F";"CargoNet_01_box_F")

#

I am trying to figure out how these can have an addaction on them making them able to repair/rearm/refuel separately

#

I tried to find a simple script that would repair,rearm or refuel (depending on the crate) the nearest vehicle

#

I am not very experienced at scripting and I couln't find ressources online.

vague harness
#

Can I make all crates lets say "B_CargoNet_01_ammo_F" have an action to rearm a nearby vehicle

little eagle
#

sure

#

It's basically all on the wiki

#

just need to put it together

vague harness
#

which I don't know how

#

I went on all of these links before coming here and couldnt figure out how to properly use them

#

I even went in the fnc of the editor and still no clue

little eagle
#

what's the problem?

vague harness
#

could you show me an example of how I would make all crates "B_CargoNet_01_ammo_F" have an addaction

jade abyss
#

oh my, another r2d2

little eagle
#

The black one? I thought that one was cut in the reshoots

#

the wiki has 4 examples for addAction @vague harness

#

bet there are hundreds on google

vague harness
#

Forget it, thanks for the help

#

douche

little eagle
#

D :

#

wake me up when they add entityCreated

#

hope it's both

#

entityDeleted for mission

#

and I hope it triggers before the thing is deleted, so you can getVariable and stuff on the object reference

shadow sapphire
#

Hey, what's an easy way to make a Buzzard grey with scripts?

young current
#

is there a grey texture available for it?

indigo snow
#

if you dont care about texture you can use RGBA as argument

#

e.g. "#(rgb,8,8,3)color(1,0,0,1)"

shadow sapphire
#

Thanks, @indigo snow. I do care about texture, but not a whole bunch right now. Just need some color splashed on there.

finite mica
#

quick question

#

How to check whether an array is empty?

#

is it nil or null?

#

by empty I mean [], not ["",""]

indigo snow
#

count array == 0

#

or array isEqualTo []

jade abyss
#

isEqua... yep

little eagle
#

you add one really weird element with pushBack

#

and then check if that's the first one afterwards

tough abyss
#

Anyone know if there is a way to allow AI to use the support requester modules?

#

To get transport to their task? (ex. sector that is 5km away)?

finite mica
#

Thanks that worked

#

Is it possible to freeze an ais AIM so it wont idle wave the gun around?

#

I tried dowatch and dotarget

little eagle
#

put them in danger mode

#

group _unit setBehaviour "AWARE";

#

if aware doesn't work, try COMBAT

finite mica
#

I got them to shoot and aim per command

#

but when aiming the weapon still sways around

digital pulsar
#

even after doTarget?

finite mica
#

yes, he roughly aims ait it but still is swaying several degrees

tough abyss
#

hello is someone there?

jade abyss
#

nope, all dead.

#

๐Ÿคฆ

kind drift
#

xD

digital pulsar
#

hello sniper

cerulean whale
#

@finite mica remove their ammo and put them in a firing state. Then add ammo back to fire?

finite mica
#

firing state

#

?

#

I dont get what you mean by state.

digital pulsar
#

and if its a cutscene you might consider soldier disableAI "ANIM" after it's aimed up

#

not a good practice in actual game cause the unit is frozen

finite mica
#

Thanks for the advice but that did not work, I am now trying to vectormath the shit out of it to get it 100% on target

#

is there a command in arma to convert a vector to gradient?

#

I got the vectors all on paper but the setvectordir command is not doign what I want

#

ok this is messed up

#

when I target a pop up target, the aim is DEAD on

#

however if it is a human target the aim is always at least half a meter off

jade abyss
finite mica
#

Actually found it in:

#

alternative syntax had what I was looking for

#

I am trying to hack around the ai to make it shoot at a location, instead of an object.

#

got the rotation working however is there a way to force a firing stance so the barrel is pointing at it?

jade abyss
#

erm, wasn't there fireAt or something?

#

doFire blabla

cerulean whale
#

I've done it before but can't remember. I'll take a look

indigo snow
#

does it need to be super precise? doSuppressiveFire might do your trick

#

or maybe spawn like an invisible chicken to shoot at

digital pulsar
#

myeah we got doSuppresiveFire these days

#

but there are workarounds

jade abyss
#

@finite mica

digital pulsar
#
                for [{_i=0}, {_i<_burst}, {_i=_i+1}] do {
                    _offender forceWeaponFire [currentWeapon _offender, currentWeaponMode _offender];
                    sleep 0.3;
                };``` from one of my scripts
#

ofc target first

tough abyss
#

Hey @jade abyss Has anyone updated the scripts by catagory section again yet?

#

in the biwiki?

jade abyss
#

No clue

finite mica
#

@digital pulsar thanks but thats exactly what I wrote on my own lol. Its a small world. For some reason it does not like to aim precisely at the target if it is a human

cerulean whale
#

@GeekyGuy5401 it hasn't been updated in awhile I believe

tough abyss
#

๐Ÿ˜ฆ

#

Having everything catagorized is nice not having to dig through all the script commands

#

in a wall of text @cerulean whale

#

Catagorization is nice particularly if you put array types with array types etc.

#

Everything is neatly ordered.

#

I mean I could do this myself with bookmarks..

#

Eh yeah I might do that.

cerulean whale
#

I just take an estimated guess at the command and chuck it in Google with 'Arma 3 scripting commands' on the end. Works most of the time xD

tough abyss
#

I've got my bookmarks catagorized

#

Arrays with arrays

#

control-structures with control-structures

#

multiplayer with multiplayer

#

I like ordered manuals.

cerulean whale
#

Ye. I had something like that but I couldn't be bothered maintaining it when I was learning c#

finite mica
#

dammit

#

I have tried to have the AI shoot at a specific position. However I found no way to force its aim to adjust up

#

is there perhaps animation commands to force the aim direction?

#

wait a sec, perhaps I can spawn a dummy object on the exact point and ahve the ai target that

tough abyss
#

disable the auto-aiming FSM

#
myUnit disableAI "AUTOTARGET";

#

He should now obey

#

Should make a new AI caching script

#

that disables all AI when the AI are not active.

finite mica
#

Thanks I will try that

#

Unfortunately did not work

tough abyss
#

What is he not doing?

finite mica
#

the weapon bore is directly looking at the target but the bullet goes straight into terrain

tough abyss
#

Considered getting ASR_AI's hithub?

finite mica
#

I can paste you the code if you want to test it

tough abyss
#

Hahah

#

Sure.

#

Sorry I am laughing because if you go into Zeus

#

and watch an AI target a player or another AI

#

they have a lockon reticle like a missile

finite mica
#
_pos = screenToWorld [getMousePosition select 0, getMousePosition select 1];
_pos_asl = ATLToASL _pos;
_dummytarget = createSimpleObject ["a3\misc_f\Helpers\Sign_sphere100cm_F.p3d", _pos_asl];
_pos = [_pos select 0, _pos select 1, (_pos select 2)+ 0]; 



_azimuth = thedude1 getDir _pos;    
_distance = thedude1 distance _pos;
systemchat format ["%1 deg | %2 m | %3", _azimuth, _distance, _pos];
thedude1 setdir _azimuth;
thedude1 dowatch _dummytarget;
thedude1 lookat _dummytarget;
thedude1 forceWeaponFire [ weaponState thedude1 select 1, weaponState thedude1 select 2];```
#

this is a script I call with a keypress

#

waituntil {!isnull (finddisplay 312)};
(findDisplay 312) displayAddEventHandler ["KeyDown","_this select 1 call ACTION_KEY_FNC;false;"];

#
ACTION_KEY_FNC = 
{
        switch (_this) do 
        {
            // T key (20)
            case 20 :
            {
                [player] execVM "client\interface\keypress.sqf";
            };
        };    
            
            
    
}; ```
tough abyss
#

by the way

#

you can syntax highlight in SQF

#

```sqf ```

finite mica
#

where do I put that

tough abyss
#

```sqf (codehere) ```

finite mica
#

sqf
ACTION_KEY_FNC =
{
switch (_this) do
{
// T key (20)
case 20 :
{
[player] execVM "client\interface\keypress.sqf";
};
};

}; sqf

#
ACTION_KEY_FNC = 
{
        switch (_this) do 
        {
            // T key (20)
            case 20 :
            {
                [player] execVM "client\interface\keypress.sqf";
            };
        };    
            
            
    
}; ```
tough abyss
#

3 backticks following the letters sqf

finite mica
#
ACTION_KEY_FNC = 
{
        switch (_this) do 
        {
            // T key (20)
            case 20 :
            {
                [player] execVM "client\interface\keypress.sqf";
            };
        };    
            
            
    
}; ```
#

there we go

tough abyss
#

There you go.

finite mica
#

thanks

#

so this script will order the dude to fire and look at the target, and the place will be marked with a sphere

tough abyss
#

I discovered that and went oh? So they do have a syntax highlighter

finite mica
#

I tried adjusting the position on its Z but it had no effect

tough abyss
#

could make your life easier and unpack your vars using params

finite mica
#

for me this script is an attempt to find otu how precisely I can command an AI with commands.

#

actually, should I send you the whole mission folder if you want to take al ook?

#

then you just start and press T

tough abyss
#
 
_pos = screenToWorld [getMousePosition select 0, getMousePosition select 1];
_pos_asl = ATLToASL _pos;
_dummytarget = createSimpleObject ["a3\misc_f\Helpers\Sign_sphere100cm_F.p3d", _pos_asl];
_pos = [_pos select 0, _pos select 1, (_pos select 2)+ 0]; 



_azimuth = thedude1 getDir _pos;    
_distance = thedude1 distance _pos;
systemchat format ["%1 deg | %2 m | %3", _azimuth, _distance, _pos];
thedude1 setdir _azimuth;
thedude1 dowatch _dummytarget;
thedude1 lookat _dummytarget;
weaponState thedude1 = params ["_weaponName","_MuzzleName","_ModeName","_MagazineName"];
thedude1 forceWeaponFire [ _MuzzleName, _ModeName];

finite mica
#

thanks that is very handy

tough abyss
#

@Python for that idea.

#

import sys argv

#

Unpacking variables into multiple assignment

finite mica
#

If this aim thing wont work out I will look at forcing animations or something

tough abyss
#

with params

#

you can even do this

#
(getPos thing) params ["_xPosition","_yPosition","_zPosition];

@finite mica What is your exact goal?

finite mica
#

to get the weapon to fire at a point on the map

tough abyss
#

Through terrain?

finite mica
#

the problem is that teh ai ignores the Z it appears

#

the base position already is AGL, and the dummy sphere correctly spawns on that point

#

but when the shot is fired, the ai always aims dead horizontal, ignoring all z

#

even on very close targets it will always fire horizontally

tough abyss
#

lets have a looksee at ASR_AI and see how they do it.

finite mica
#

actually I think I got suppressive fire to work

#

still got to hammer out the exact amount of shots but at least it gets the position right

tough abyss
#

yeah the AI will ignore horizontal with lookAt

#

Hmmm I will test

#

@finite mica Yep that confirms it

#

You need doMove

finite mica
#

why?

#

for the Z adjustment?

#

I dotn get it

tough abyss
#

Is this AI following this target?

finite mica
#

currently I only need it to fire at something, not move to it

#

ok so here is what is weird. dosuppressivefire can use a prceise position to shoot at somethign, however dofire needs an object and even then it fails to account for z

#

if the devs would add a dofire suppressive with only firing one shot, that would fix all my problems

tough abyss
#

I wonder @finite mica if this is related to the fact you are using simpleObject

#

because simpleObject removes all raycasting, etc data, and simulation data.

finite mica
#

Yeah I should check that right away

#

that does not change it

#

tried with createvehicle

#

perhaps the object is at fault

#

Is it possible to find doSuppressiveFire in the functions viewer?

indigo snow
#

no since its a command

finite mica
#

If only that command had the option to fire oen shot it would solve all my problems

#

Its the only command that allows to fire at a specific position.

#

I tried disabling ai after one shot, but when teh ai resumes it continutes. Is there away to flush what the ai wants to do?

#

And is there a place where I can make puppy eyes at the devs so they add a new command?

tough abyss
#

@finite mica I got your AI to track

#

TargetFunc = { 
   params ["_unit","_target"];
   _unit doFire _target;

    _unit commandFire _target; 
    _unitDir = _unit getDir _target; 
    _unit setDir _unitDir;
    (weaponState _unit) params        ["_weaponName","_MuzzleName","_ModeName","_MagazineName"];   
    _unit forceWeaponFire [_MuzzleName, _ModeName];  
}; 

[MrAI,OpforTarget] call TargetFunc;
#

And syntax highlighting doesn't want to cooperate.

#

He must be facing to target

#

He also doesn't move.

#

๐Ÿ˜ƒ

#

getDir from pos1 to pos 2

#

No more relative dir crap

#

Now builtin to getDir

finite mica
#

does not work for me, perhaps I am fitting it into the stuff wrong

tough abyss
#

I think I like liberation in comparison to Insurgency

#

More stuff to do.

#

Codes much more efficient and uses cfgFunctions.hpp

#

along with being able to throttle the AI ALOT

#

I like domination but it's hard to change.

#

Never built a script like this before. Anyone have tips on finding a safe LZ about 200-300m outisde a point? On a random side?

indigo snow
#

selectBestPlaces might be your friend

round scroll
indigo snow
#

oh that gradient check is nice

tough abyss
#

awesome, that findSafePos will work perfectly

#

@tough abyss Cloud also try

#

isFlatEmpty

#

The findSafePos is exactly everything I need. Thanks though for the help!

#

Interesting thing is findSafePos

#

is surprisingly simple ๐Ÿ˜ƒ

#

the code of it.

#

heh

#

it already does it internally

#
if (!((count (_testPos isFlatEmpty [_objDist, 0, _maxGradient, _objDist max 5, _waterMode, _shoreMode, objNull])) == 0)) then {}
tough abyss
#

I was thinking. Is it possible to set a waypoint for a vehi vehicle without a driver?

digital pulsar
#

waypoints are given to groups, not vehicles

tough abyss
#

There is any way to write a txt file without the need of a extension?

#

I did a no-ExtDB3 mode in my mission that store all database data in variables. When the server shut down the info is lost. But if i could write the data to a TXT file, i can store all that to use on next server start.

native hemlock
#

Have you thought about using the server's profileNamespace?

tough abyss
#

^ Fast and it's binarized

#

@native hemlock @tough abyss thanks. No. But its persistent to server restart?

dusk sage
#

๐Ÿ‘

tough abyss
#

Can i store data for 320 vehicles (inventory, position angle, damage, fuel) and lots of players (position, complete gear, health, ext)?

#

Yes

#

OMG!

#

its just not "as" secure as a database

#

Ahh... its saved in each client?

#

Or can i save all at server profileNamespace?

#

Right now all the "table" vars are on the server.

dusk sage
#

Each client has their own profileNS

#

Just don't broadcast it ๐Ÿ™ƒ

tough abyss
#

OK, but the server profileNameSpace can hold all the data without problems?

#

Since i will keep zero data on clients profileNamespace

#

All data will be on server profileNamespace

#

If the mission became famous (๐Ÿ™„ ) it can have 1000+ registered players.

dusk sage
#

One step at a time ๐Ÿ˜‰

#

If you want it to be played by 1000's (and store all that data), perhaps you should spend the extra time using something other than PNS

tough abyss
#

Ah ok.

dusk sage
#

I mean you can but try

#

But I'm doubtful anyone here has tried storing that much in it

#

Stood to be corrected though

tough abyss
#

profileNameSpace will be acessed only two times: on server start and before server shut down.

#

This helps, right?

dusk sage
#

Of course yeah

rotund cypress
#

Hey guys, if I want to get a bool as a param, what would the expected data type be?

#

So like [ "_properties", false, [ expectedDataType ] ];

tough abyss
#

@tough abyss thanks.

rotund cypress
#

I guess I'll just use false?

willow pike
#

bool

rotund cypress
#

you cant write bool in there wont work

#

but false will work

willow pike
#

sorry then i got your question wrong.

rotund cypress
#

It will be like this [ "_properties", false, [ false ] ];

#

I know what BOOL is

#

I just didn't know what to put instead of bool in there, cause bool wouldnt work in a param, or not write bool anyways

#

But yeah, false worked

tough abyss
#

Yep

#

I actually wrote a script that used selectBestPlaces

#

Had the Viper-squads spawn in the trees @tough abyss

little eagle
#

you cant write bool in there wont work

You can't write bool in there, but you can write !bool in there and it'll work!

true param [0, false, [!bool]]
-> true, no error
#

๐Ÿ˜›

#

It's all just a question of proper preparations.

#
bool = [not nil];
true param [0, false, bool]

works like a charm

tough abyss
#

Do triggers still not propergate to AI ?

#

on headless clients?

tough abyss
#

@BoGuu#1044 using profileNameSpace now. Everything saves on the server profileNameSpace.

meager granite
#

Since Apex all spaceObject particles start disappearing right away, is there any way to prevent this?

#

It also seems that only some of them start to disappear, rarely particles doesn't fade at all

little eagle
#

I only know of a bug since APEX where particles disappear if their center is off screen instead of the whole particle

meager granite
#

Since Apex? I thought it was like this all the time with particles

little eagle
#

I heard it started to happen specifically after APEX

#

baermitumlaut did stuff with them

thin pine
#

@meager granite i spent two hours trying all kinds of different particle parameters and commands. I couldn't stop the random disappearing either

#

I found that it doesn't always happen though when you use setparticleclass on certain base classes iirc.

meager granite
#

Its also random with "drop" command

#

sometimes particles disappear, sometimes they dont

#

Also if you move camera far away and then back to particle it will appear back even though it faded (if it still has time to live)

jade abyss
#

Is there something different in the "lifetime" of the particles?

#

Or is it also a quality-setting-"issue"?

meager granite
#

I think particles fade regardless of quality settings

#

time to live doesn't seem to affect fading at all, it still fades under will of RNJesus

vague harness
#

How do I make and addaction only available for a vehicle commander?

indigo snow
#

"_this == effectiveCommander _target" if the addAction has been added to the vehicle

vague harness
#

Thanks!

vague harness
#

tried this

#

player addAction ["<t color='#FF0000'>Prepare for Airlift</t>","editmass.sqf",[1],0,false,true,""," driver _target == _this"];

#

and it dosent show up in the driver seat. Anyone?

indigo snow
#

you added it to the player, so both _this and _target are the player

vague harness
#

and the player in mp is _unit right?

indigo snow
#

no

vague harness
#

spawn BIS_fnc_MP

#

added it at the end btw

#

looks like this now

#

[[_unit,"<t shadow='1.5' color='#FF0000'>Prepare for Airlift</t>","call ask"]," driver _unit == _unit",nil,false]spawn BIS_fnc_MP;

#

correction

indigo snow
#

that wont work, _unit wont be defined in the scope created on other clients

#

wait what even is this syntax

vague harness
#

does this makes sense

#

[[_unit,"<t shadow='1.5' color='#FF0000'>Prepare for Airlift</t>","call ask"],"driver _target == _this",nil,false]spawn BIS_fnc_MP;

indigo snow
#

not at all

vague harness
#

rip

indigo snow
#

you'd not even use BIS_fnc_MP anymore

#

you'd use remoteExec

#

taking a step back what are you attempting to even do

meager granite
#

BIS_fnc_MP is just wrapper for remoteExec

indigo snow
#

fair enough, but still

vague harness
#

I am trying to add an action to all ground vehicles

#

but in driver slot only

indigo snow
#

and these vehicles are pre placed?

meager granite
#

Why not add it just to player and then check if you're on driver seat

vague harness
#

thats what I wanted to do

meager granite
#

Add action locally on client, have some variable in condition and have a thread which updates this variable depending on where you are

vague harness
#

Got it, but the thread is a bit out of my knowledge I think

#

@indigo snow yes

meager granite
#
showMyAction = false;
player addAction ["Action", {systemChat "something"}, nil, 0, false, false, "", "showMyAction"];

0 spawn {
    waitUntil {
        showMyAction = (vehicle player != player && driver vehicle player == player);

        sleep 1;
        false;
    };
};
#

in init.sqf or somewhere else where it executes once on client

vague harness
#

@meager granite Thanks

#

so I would put the script that it executes in "showMyAction"

meager granite
#

No, showMyAction is just flag which shows or hides the action

vague harness
#

AH!

meager granite
#

your code should be where {systemChat "something"} is

#

be it file name or script right there

#

"Action" will appear if you're in any vehicle on driver seat, executing it will show "something" in chat

#

Understand how it works and then change to your needs

vague harness
#

Alright, I got it. Thanks a lot

meager granite
#

(typed unit instead of player, got too much of my own scripts in my head)

#

Oh also if you're putting this into init.sqf you'll need to add

waitUntil {player == player};

#

before everything else

#

as player is not initialized and you need to wait for it, so you can add action

#

also action will disappear after respawn, you'll need to add it again

vague harness
#

Ok, sorry but how would I do that?

dusk sage
#

CTRL+C CTRL+V ๐Ÿ˜›

vague harness
#

@dusk sage Yep and after that I will know by myself

dusk sage
#

As he said, just needs to be added before any other code in your init

#

I.e, line #1

vague harness
#

I have no scripting background at all either at school or work

#

so I am learning step by step

meager granite
#

Yes, first line of init.sqf

#

then other stuff I posted

vague harness
#

tried it stock and it dosen't work :/

#

tried it stock and it dosen't work :/

#

here's my init.sqf

#

waitUntil {player == player};
showMyAction = false;
player addAction ["Action", {systemChat "something"}, nil, 0, false, false, "", "showMyAction"];

0 spawn {
waitUntil {
showMyAction = (vehicle player != player && driver vehicle player == player);

    sleep 1;
    false;
};

};
enableSaving [false, false];
waitUntil {!isNil "CLib_fnc_loadModules"};
call CLib_fnc_loadModules;

#

@meager granite

meager granite
#

What exactly doesn't work?

#

no action?

vague harness
#

yes

meager granite
#

I just checked it and it works just fine

vague harness
#

Hold on

meager granite
#

Also I don't know how 3DEN editor works, maybe init.sqf is not executed each time you start the mission, no idea

#

Anyway as long as code is executed, it works

vague harness
#

so could I make an sqf out of this and run it in the init?

meager granite
#

Yes you can have this in init

jade abyss
#

Regarding AddAction:

showMyAction = false;
player addAction ["Action", {systemChat "something"}, nil, 0, false, false, "", "showMyAction"];

0 spawn {
    waitUntil {
        showMyAction = (vehicle player != player && driver vehicle player == player);

        sleep 1;
        false;
    };
};```

iirc the check inside addAction is executed eachFrame.
So locating it to an outside script -> Better choice
Comes in handy, when you check for several things at once.
meager granite
#

Well, I did exactly this, full condition is checked each 1 second

#

while addAction only checks boolean flag

#

@vague harness Change player to this and add this code into init field of player unit

#

You'll need to get rid of waitUntil {player == player} too

jade abyss
#

Yeah, just explained why its "outside"

meager granite
#

Ah, alright

jade abyss
#

Because: I just remembered some Mass-AddAction adds, wich... idk how many checks inside it

vague harness
#

@jade abyss @meager granite So am I correct if I do this 1. Removed the "waitUntil {player == player}" 2. added the whole addaction to all player units 3. changed "player" to "this" in the addaction

#

thin thats it

#

it gives me this message when I try to add it to playable units:

#

Init:Type Script, expected Nothing

jade abyss
#
  1. Why?
  2. erm, okay (" init.sqf " <- ?)
vague harness
#
  1. Sa-Matra: You'll need to get rid of waitUntil {player == player} too
#

2 : Sa-Matra: Change player to this and add this code into init field of player unit

meager granite
#
  1. Remove waitUntil {player == player} line
#
  1. Change player to this in addAction line
#
  1. Add code into init line of player unit
#

As for error, add

nil;

at the end of code

#

Stupid editor doesn't want anything returned by Init

vague harness
#

nil as the very last line?

meager granite
#

Yes

#

If it still complains do
1 = 1;

vague harness
#

Same error

meager granite
#

Try 1=1

vague harness
#

@meager granite No luck

jade abyss
#

1==1 ๐Ÿ˜„

vague harness
#

@jade abyss Nope :S

meager granite
#

Damn stupid editor

#

1 = 0 spawn {

#

Do this

#

I mean change

0 spawn {

into

1 = 0 spawn {
vague harness
#

yep just accepted it

#

@meager granite sebt you a photo in pm

#

"this" is causing it to fail

jade abyss
#

@vague harness That one before was a joke ๐Ÿ˜‰

#

(1==1) = true

vague harness
#

lol

tulip kestrel
#

Hey can anyone here help with setting up rcon for Arma2

torpid oriole
#

Is the Loiter Waypoint not accessible through scripting? When I add a waypoint to a flying unit with the type "Loiter", the waypoint gets marked as "Waypoint" in Zeus and the unit is treating it as a "Move" WP

willow pike
#

did you check that ?

torpid oriole
#

Of course. I am setting the type that way

#

I figured out the problem. The following waypoints were the problem

tough abyss
#

on this array: _glugluArray = [ [ [01,02,03], [04,05,06], [07,08,09], [10,11,12] ], [ [13,14,15], [16,17,18], [19,20,21], [22,23,24] ] ]; There is a easy way to change the value 11 to 99?

#

The code i use is far from simple ๐Ÿ˜ฆ

#
_arr1 = _glugluArray select 0;
_arr2 = _arr1 select 3;
_arr2 set [1,99];
_arr1 set [3,_arr2];
_glugluArray set [0,_arr1];```
woeful void
#

Q: How would one go about scripting it where if a teamkill happens, the killer gets zeus smited?

tough abyss
#

Like trow the guy up 100 m above?

#

Or like to explode grenades on his face?

woeful void
#

nope... I'm thinking zeus lightning bolt and a message across the entire server that teamkillers will be smited. This is destined for a public map

#

and since it's coded into the map itself, I'm removing that option from player zeuses. I'm also running with demigods, a zeus player who can only operate within his home area and when his officer unit is killed, game over for that side.

#

the reason I wanted a map scripted option is so it's /immediate/ when someone TK's.

#

no chance to blame it on someone else, no weasling out of it...

#

that same code can be used to slaughter anyone who kills an innocent ai.

woeful void
#

If it was a door gunner, the entire vehicle is gone.

#

then they get to explain to the vehicle commander and zeus why he opened fire on team mates.

#

I'm also looking at scripting to enforce that only a group can enter the vehicle, starting with the group leader. If you ain't in his group, you don't have a seat. Which means if that group leader has a TK'er.. it's as much on him as it is on the TK'er.

#

it's called being responsible for your people. Something sorely lacking in a lot of players I see on public servers.

rotund cypress
#

What would I set a default value for a param if I wanted to say, pass in position player?

#

Would that be just 0 or something?

atomic jetty
#

@rotund cypress e.g. [0,0,0]

rotund cypress
#

no

#

Its position for a marker

atomic jetty
#

what do you mean? ๐Ÿ˜„

rotund cypress
#

So like position player

#

But it cant be a string

#

And its not x,y,z

atomic jetty
#

do you want to [position player] call funcA; funcA params [['_pos', [0,0,0], [[]]; _marker =createMarker....

#

or what? ๐Ÿ˜„

rotund cypress
#

yes ^^^

#

@atomic jetty

dusk sage
#

[0,0,0], [[]] as insane said

tough abyss
#

@dusk sage Do you know if AI's still don't fire a trigger?
if they are transfered to the HC?

hollow lantern
#

is there somewhere around using Visual Studio 2015 Enterprise for SQF scripting? If so is there a good plugin for syntax highlighting and co ?

tough abyss
#

Why would you want to?

hollow lantern
#

because I like VS 2015 and feel comfortable with

dusk sage
#

VSCode has SQF stuff

#

If you want to stay a long the VS theme

tough abyss
#

Is there a function for force zoom a scope?

willow pike
#

should he still have other interactions like shooting ?

tough abyss
#

is that to me? If so yes. They should be able to shoot but i just need to force zoom a scope in

hollow lantern
#

@dusk sage yeah I saw that and also tried to import the plugin to VS 15 ENT but that wasn't working. I don't want another programm I just want to use my VS. If there is none well then I just stick with Dash

willow pike
#

player switchCamera "Gunner";
@tough abyss

tough abyss
#

thanks

thorn saffron
#

hey folks. I'm porting the ambient combat module from arma 2. seems to be kinda working, but it keeps calling the garbage collector module function that seems to be not available. It was used to remove units that went beyond the spawning radius.
it calls for: "BIS_GC_trashItFunc"
Is there any arma 3 equivalent of this function?

#

look at it closer the script only calls this function twice, maybe I should just do away with it

#

if (_obj) then
{
_array = _scope getVariable "objects";

{
    //Triggers need to be deleted immidiately.
    if ((typeOf _x) == "EmptyDetector") then
    {
        deleteVehicle _x;
    }
    else
    {
        [_x] call BIS_GC_trashItFunc;
    };
} forEach _array;

_scope setVariable ["objects", []];

};

if (_grp) then
{
_array = _scope getVariable "groups";

{
    [_x] call BIS_GC_trashItFunc;
} forEach _array;

_scope setVariable ["groups", []];

};

#

replace it with deletevehicle or something

tough abyss
#

wtf

#

@thorn saffron

#

if (_obj) ?

#

Never seen that before.

#

Kind of counter intuitive

#

Boolean flag to control the flow. Particularly with that name.

thorn saffron
#

that is just bis ambient combat manager module, I didn't change a thing

tough abyss
#

Syntax highlighting please

#

and code formating

thorn saffron
#

how?

tough abyss
#
/*
    File: cleanDyn.sqf
    Author: Joris-Jan van 't Land

    Description:
    Cleans dynamically created content by either deleting it straight away
    or by sending it to the general Garbage Collector.

    Parameter(s):
    _this select 0: mode - String
            obj: objects only
            grp: groups only
            all: all content
    _this select 1: ACM object
    _this select 2: patrol ID
*/

private ["_mode", "_acm", "_id", "_scope", "_obj", "_mrk", "_grp"];
_mode = _this select 0;
_acm = _this select 1;
_id = _this select 2;

_scope = [_acm, _id] call BIS_ACM_returnPatrolScopeFunc;

_obj = false;
_grp = false;

switch (_mode) do
{
    case "obj":
    {
        _obj = true;
    };

    case "grp":
    {
        _grp = true;
    };

    case "all":
    {
        _obj = true;
        _grp = true;
    };

    default {};
};

private ["_array"];
if (_obj) then
{
    _array = _scope getVariable "objects";

    {
        //Triggers need to be deleted immidiately.
        if ((typeOf _x) == "EmptyDetector") then
        {
            deleteVehicle _x;
        }
        else
        {
            [_x] call BIS_GC_trashItFunc;
        };
    } forEach _array;

    _scope setVariable ["objects", []];
};

if (_grp) then
{
    _array = _scope getVariable "groups";

    {
        [_x] call BIS_GC_trashItFunc;
    } forEach _array;

    _scope setVariable ["groups", []];
};
#

There

#

```sqf {code} ```

thorn saffron
#

thanks

tough abyss
#

ACM object.

#

You need to find out what the hell half of this is

thorn saffron
#

this a clean up script for the arma 2 Ambient Combat Manager. It is called by an fsm. I'm pretty sure that it used to remove units that got out of the spawn area around the player

tough abyss
#

You know how to open the FSM?

#

using ArmA 3 Tools?

thorn saffron
#

the whole thing seems to work perfectly fine. The thing is it is calling for the garbage collector module function that is no longer in Arma 3 (AFAIK). I just want to repalce the call to GC for removal with something similar that won't throw errors

#
{[_x] call BIS_GC_trashItFunc;}
tough abyss
#
_x addToRemainsCollector;
thorn saffron
#

no square brackets around the _x ?

#

I thing the _x is the array of each unit of the squad that will be deleted

thin pine
#

Taro do you have a2 functions unpacked?

#

Find that trash fnc and see what it did in a2

thorn saffron
tough abyss
#

add this.

thin pine
#

Most of that garbage collection is incorporated in engine now using description ext parameters

#

Not all features tho iirc

thorn saffron
#
{scriptName "garbage_collector\data\scripts\trashIt.sqf";
/*
    File: trashIt.sqf
    Author: Joris-Jan van 't Land

    Description:
    Sends an object to the garbage collection queue.

    Parameter(s):
    _this select 0: the object.
    
    Returns:
    Success flag (Boolean).
*/

//Valid parameter count
if (isNil "_this") exitWith {};

private ["_object", "_queue", "_timeToDie"];
_object = _this select 0;

waitUntil{!(isNil "BIS_GC")};

_queue = BIS_GC getVariable "queue";

switch (typeName _object) do
{
    case (typeName objNull):
    {
        if (alive _object) then
        {
            _timeToDie = time + 30;
        }
        else
        {
            _timeToDie = time + 60;
        };
    };

    case (typeName grpNull):
    {
        _timeToDie = time + 60;
    };

    default
    {
        _timeToDie = time;
    };
};

if (isNil "_queue") then
{
    _queue = [[_object, _timeToDie]];
}
else
{
    _queue = _queue + [[_object, _timeToDie]];
};

BIS_GC setVariable ["queue", _queue, true];

true}
tough abyss
#
// -----Garbage Collection-----

// -----Corpse Cleanup-----
    corpseManagerMode = 3;
    corpseLimit = 15;
    corpseRemovalMinTime = 120;
    corpseRemovalMaxTime = 300;
// ------------------------

// -----Wreck Cleanup-----
    wreckManagerMode = 3;
    wreckLimit = 15;
    wreckRemovalMinTime = 60;
    wreckRemovalMaxTime = 300;
// -----------------------

@thorn saffron

thorn saffron
#

the thing is the deleted squad is not dead

tough abyss
#

It's fine.

#

The GC will handle it.

thorn saffron
#

it is simply beyond the range set in ACM

thin pine
#

Yeah

#

The engine incorporated disposal manager only does wrecks and corpses iirc

tough abyss
#

Ah.

#

then.

#

deleteVehicle _x; ?

#

Ahhhhh

#

It's a _queue data-structure

#

Hmmm thats easy to deal with.

thorn saffron
#

GC deletes stuff that is out of sight of the player AFAIK

tough abyss
#

the TTL watches how long the AI is active.

#

BIS_GC is a global variable

thorn saffron
#

hmm

tough abyss
#

Bet BIS_GC is a module

thorn saffron
#

yeah

tough abyss
#

if thats the case you can replace it for a GameLogic

thorn saffron
#

its the garbace coletor module from arma 2

thin pine
#

All that trash fnc did was delay removal by 30 secs I assume

tough abyss
#

^

thin pine
#

Tbh taro why not write from scratch?

tough abyss
#

And append the queue.

thorn saffron
#

cause I have no idea about this whole scripting witchery

thin pine
#

Ahhh

#

XD

thorn saffron
#

I think that deleteVehicle might be enough

thin pine
#

Try it :)

thorn saffron
#

its only about removing those units after all

thin pine
#

Just experiment

tough abyss
#

@thin pine Do you know whether triggers respond to HC's?

#

after they transfer from the server?

#

Actually, thats a minor problem. I can just spawn the AI directly on the HC and have the triggers hooked to the HC's

#

And hopefully they'll remain sync'd?

thin pine
#

I believe global triggers are evaluated by everyone. Are you creating local ones?

thorn saffron
#

Advanced AI command alows for controlling spawned units

#

its a mod

thin pine
#

I also thought for a sec you meant HC as in High Command lool @thorn saffron is that what you're on about?

tough abyss
#

@thin pine No this is apart of our Communities framework

#

I've been writing got a hole bunch of API functions that search terrain for trees, and makes AI laydown for auto-ambushing

thorn saffron
#

me? no I'm porting the Ambient Combat Manager module from Arma 2

tough abyss
#

And IED's

thin pine
#

Nvm hehe

#

Right @tough abyss

tough abyss
#

Well there was tools I needed.

#

So I made them.

thin pine
#

Are you asking whether hc controlled ais trigger triggers?

#

Or are you asking whether trigger activation code is also executed on hc?

tough abyss
#

Will the code activate on the HC

#

as in will the trigger "fire"

#

If the AI is on the HC

#

and the trigger is on the server?

thin pine
#

Yes

#

Why would triggers care about locality

tough abyss
#

They do now.

thin pine
#

Ais in player group are local to player

tough abyss
#

You can explicitly tell them to be server-side

#

or not.

thin pine
#

Those should also fire triggers

tough abyss
#

It's just HC controlled AI for a while wouldn't respond to the triggers or waypoints

thin pine
#

Hmm

tough abyss
#

Ha

#

Hey @thorn saffron

#

I found the actual arma 3 function

#

That does exactly what Trashit did

#

@tough abyss cant you help me with my question some pages above (_glugluArray)?

thin pine
#

Tbh its another case of go in-game and verify ๐Ÿ˜›

tough abyss
#

@tough abyss Linear search the embedded array

#

by passing an array.

#

Returning the index

thorn saffron
#

@tough abyss what function is it?

tough abyss
#

then setting it.

#
[_x] call BIS_fnc_GC;

@thorn saffron

thin pine
#

I find it odd to hear that AIs local to HC would not activate a trigger on the server, even if that trigger is locally created on serverside. If that's a thing it must be a bug

tough abyss
#

It was.

#

Not sure if it is fixed.

#

@thin pine an AI on clients activate that triggers on server?

thin pine
#

If that bug is still present I wonder if AIs local to player group leaders won't activate serversided triggers either

#

Sounds like too big of a bug to be still present

tough abyss
#

Is this a question for the @BIMINIONS ?

thin pine
#

Naw

#

It's sumn you could test yourself :P

#

Im on mobile though so I can't unfortunately

#

@tough abyss your gluglu array question. Is this just curiosity while experimenting nested arrays or is it a prototype of something you're working on? It seems simple enough to me

tough abyss
#

@thin pine is for my new save method that uses server profileNameSpace vars instead of MySql.

#

You can do it more than 1 way.

#

You can search your array first.

thin pine
#

I'd say setting single values in a nested array like that is uncommon.

tough abyss
#

then return the index of the array

#

then get the next array

#

and run it through a seperate loop

thin pine
#

Ah

tough abyss
#

@thin pine You know I feel like making a binary search.

#

I can actually do it now.

#

With the new sortability command

#

pushBack is amazing because i can do (_array select 0 select 2) pushBack 15;

thin pine
#

And you were wondering if set does sumn similar?

tough abyss
#

But i cant do (_array select 0 select 1) set [2,"aaa"];

#

Yes

#

Bit verbose.

thin pine
#

I got ya. I wouldn't know a quick route like that. Looks like you're going to have to do it the non simple route

tough abyss
#

There is probably a more efficient way of doing that.

#

a for loop embedded in a forEach would probably achieve what you want.

#

this way you could use the following

#
for "_i" from 0 to count(_largeArray) do { 
    {   
         _x select _i; 
    } forEach _largeArray; 
}; 
#

First pass selects the index

#

And if you wanted to specifically step n numbers

thin pine
#

I assume Donnovan knows how to find the value he's looking to replace. Which is why his prototype uses static indexes and values

tough abyss
#

You can loop each index at 3 at a time

#

by using.

#
for "_i" from 0 to count(_largeArray) step 3 do { 
    {   
         if (_x select _i == _element) then exitWith { ret = _x select _i;  }; 
    } forEach _largeArray; 
};
#

I'm using find function that must do the same

#

find looks for the index

#

it's like pythons list.index() method

#

_playersArray = [[id1,id2,id3],[playerdata1,playerdsta2,playerdata3]];

thin pine
#

I think it all kinda depends on how many indexes your nested array has

#

Oh

tough abyss
#

You need to know what your looking for.

thin pine
#

Just two huh?

tough abyss
#

I search the id and get the index

#

Pretty easy.

#

It's just a nested array.

thin pine
#

With the player id and player data indexes defined, it gets pretty easy indeed. But yeah unfortunately the pushback type of usage won't work with set

#

Would be rad if it did

tough abyss
#

Oh that is a triple nested array

#

id1, id2, id3 are the player steam id

#

omg

#

BI added SLICES!

thin pine
#

((_playersArray select 1) select 2) set [2,getPosATL _unit] won't work unfortunately

tough abyss
#

:(

thin pine
#

Or does it?

#

You tested it right?

tough abyss
#

Eh he

#

Nope

thin pine
#

Test it

tough abyss
#

I will

thin pine
#

Somewhere i hope it works :) after all set modifies the original array

tough abyss
#

I will try

thin pine
#

Fyi you did imply that you tested it. I quote: But i cant do (_array select 0 select 1) set [2,"aaa"];

tough abyss
#

Wow

#

I did it

#

I got a double nested array to search

#
largeArray = [   
        [01,02,03],   
        [04,05,06],   
        [07,08,09],   
        [10,11,12],   
        [13,14,15],   
        [16,17,18],   
        [19,20,21],   
        [22,23,24]   
]; 
[] spawn  { 
      { 
        for "_i" from 0 to count(_x) do {      
        ret = _x select _i; 
        sleep 1; 
        };  
      } forEach largeArray;     
};
#

Lets up the anty.

#

Triple nesting

#

@MrSanchez#5319 this is because there is nothing about that on the set WIKI, but the WIKI can be outdated.

#

I did it

#

@thin pine

#
 
tripleNested = [ 
    [ 
        [01,02,03], 
        [04,05,06], 
        [07,08,09], 
        [10,11,12] 
    ], 
    [ 
        [13,14,15], 
        [16,17,18], 
        [19,20,21], 
        [22,23,24] 
    ] 
];[] spawn  { 
      { 
        for "_i" from 0 to count(_x) do {      
        ret = _x select _i; 
           {   

           subRet = _x; 
           true;
           sleep 1 
           } count ret;
        };  
      } forEach tripleNested;     
};
#

@tough abyss That what you were looking for?

#

Triplenested searcher

#

That thing is nuts.

#

I think I'' replace forEach with count again.

#

It's extremely expensive though

#

Triplenested datastructures and arma 3 do not play nice.

#

Yep ArmA 3 definitely doesn't like triple nested DS's

#

There is simpiler solution which is using a count in a count

#

it works I tested it.

#

But it's reliability is so so

#

Yes correction it definitely works

#

@tough abyss my example was not the best. The actual structure of the array is like that: _array = [[player 1 id,player 2 id,player 3 id],[player 1 data, player 2 data, player 3 data]];

#

Yeah it will mine that fine

#

All you do is check subRet matches your index you want.

#

Or the item you want.

#

You'd probably need to use breakTo in this case.

#

Can this be done with the function find?

#

Maybe.

#

So we don't need the comparison loop

#

never tried.

#

So we don't need the comparison loop

#

When i will access the array i know only the player id.

#

and need to find the player data.

#

You know this is computer science grade stuff?

#

not aware of that

#

DSA (Datastructures and algorithms)

#

if i had player id in the player data, and a array like: _array = [player 1 data, player 2 data, player 3 data,..., player 567 data];

#

should be harder to search a specific player

#

I work with databases

#

So this must have helped a bit

#

There is actually 2 approaches to what you are doing

#

Recursive

#

and Iterative.

#

The solutions I provided are iterative.

#

Recursive is when you call a function inside the function you called

#

Recursion
func { {code operations up here} [] call func; };

thin pine
#

@tough abyss did you try that set thing yet?

tough abyss
#

@thin pine will try now in the game console. Back in one minute.

#

What are you specifically looking for in the array?

#

@tough abyss

#

Because _array find 0;

#

Won't work

#

it will return -1

#

@tough abyss i have an know player object, so i use getPlayerUID on that object and get its Steam ID, and then i need to find its data (gear, weapons, mags, uniform, etc...) in the array.

#

i use _findIndex = (_array select 0) find _playerUID

#

then i use

#

_playerData = _array select 1 select _findIndex

thin pine
#

Patiently awaiting the results ^^

tough abyss
#

f***

for "_i" from 0 to count(tripleNested) do { 
    for "_n" from 0 to count (_i) do { 
       ret = _i select _n;
    };
};
#

Arma 3 not letting me do what I need to do.

#

Hmm

#

Global vars?

#

Its a global var yes, my fault to add the _ at the begining.

#

I store the var into the server profileNameSpace

#

and get it on server start

thin pine
#

An hour later I still have no idea what the both of you want. Hehe

jade abyss
#

Same here

tough abyss
#

I know what he wants

jade abyss
#

I ignore Don usualy @thin pine ๐Ÿ˜„

tough abyss
#

He's mining a triple array for a specific data-entry.

#

eh he

#

its my english

jade abyss
#

Yep

tough abyss
#

@thin pine ([1,[2,3,5]] select 1) set [2,4]; this don't give a error

#

([1,[2,3,5]] select 1) set [2,4]; this don't give a error when i run it on the editor console

thin pine
#

Store the arr in a variable and output the array after setting it

#

See if it changed

tough abyss
#

ok

thin pine
#

If so then hurray saves you lot of code

tough abyss
#

So unreliable

#
[] spawn {     
for "i" from 0 to count (tripleNested) do {
    ret = (tripleNested select i);
    for "j" from 0 to count(ret) do { 
      subRet = (ret select j);
          sleep 1; 
       };
    };
};
#

@thin pine ๐Ÿ’ฉ

thin pine
#

Define unreliable

tough abyss
#

Dawn WIKI!

thin pine
#

Shit?

tough abyss
#

Happy face

thin pine
#

Worksidoodles yes or no

tough abyss
#

it worked

thin pine
#

Good

#
_arr1 = _glugluArray select 0;
_arr2 = _arr1 select 3;
_arr2 set [1,99];
_arr1 set [3,_arr2];
_glugluArray set [0,_arr1];```
#

This was your original question

#

Its now solved

#

Easier way found

tough abyss
#

Thanks a lot...

thin pine
#

๐Ÿ˜‰

#

Now brb as im gonna drown myself in a tub of coffee

tough abyss
#

I'm already with my ccooffee on my side ๐Ÿ˜„

#

So great news. It worked.

#

On a side note.

#

I did some nuttery, other languages allow

#
fn_iterativeDeepSearch = { 
param ["toFind"];      

for "i" from 0 to count (tripleNested) do {
    ret = (tripleNested select i);
    for "j" from 0 to count(ret) do { 
      subRet = (ret select j);
       for "n" from 0 to count(subret) do { 
         subOfSub = subRet select n;
         checkForReturn = subOfSub find toFind;
         if (checkForReturn isEqualTo toFind) then {
         breakTo "LowerScope" 
         sleep 1; 
         }; 
       };
    };
ScopeName "LowerScope"; 
};
#

Need to go. Thanks for all the motivational help. Motivation to go over the WIKI. ๐Ÿ˜„

#

Hey I got it work

#
fn_iterativeDeepSearch = {  
params ["_toFind"];       
ret = 0;
subRet = 0;
finalRet = 0; 
for "i" from 0 to count (tripleNested) do { 
    ret = (tripleNested select i); 
    for "j" from 0 to count(ret) do {  
      subRet = (ret select j); 
      finalRet = subRet find _toFind; 
       sleep 0.05; 
       }; 
    };   
};

[5] spawn fn_iterativeDeepSearch;
#

Problem is on each pass _ret becomes undefined

#

So it works

#

But it doesn't at the same time.

thorn saffron
#

Uh, it seems that the Ambient combat also needs the Functions Manager module from Arma 2. Again, I'm careful about porting stuff like that as I'm afraid it might break something in Arma 3

tough abyss
#

Code?

thorn saffron
#

556 various files

#

taken from the Functions manager config

tough abyss
#

Where does this all plugin to?

#
fn_iterativeDeepSearch = {  
params [ 
["_ret",0], 
["_toFind",0], 
["_finalRet",0], 
["_i",0], 
["_j",0]];         
for "_i" from 0 to count (tripleNested) do { 
    _ret = (tripleNested select _i);  
    for "_j" from 0 to count(_ret) do {   
      _subRet = (_ret select _j);  
      _finalRet = _subRet find _toFind;    
       };  
    }; 
_finalRet;    
}; 

``` ArmA 3 really doesn't like that.
#

spams "_i" and "_j" are undefined

jade abyss
#

try:
_Temp = _i;

inside the 2nd forEach ->
use _Temp

tough abyss
#

I cracked it.

#

using old syntax

#

I think this gets evaluated different

#
tripleNested = [  
    [  
        [01,02,03],  
        [04,05,06],  
        [07,08,09],  
        [10,11,12]  
    ],  
    [  
        [13,14,15],  
        [16,17,18],  
        [19,20,21],  
        [22,23,24]  
    ]  
];
fn_iterativeDeepSearch = {   
params [   
["_toFind",0],  
["_finalRet",0],  
["_i",0],  
["_j",0]];
hint format ["%1",_toFind];        
for [{_i=0}, {_i<count(tripleNested)}, {_i=_i+1}] do  { 
  ret = (tripleNested select _i);   
   for [{_j=0}, {_j<count(ret)}, {_j=_j+1}] do  { 
    subRet = (ret select _j);   
    finalRet = subRet find _toFind;
    sleep 0.05;     
     };   
  };  
 finalRet;     
}; [] spawn { [05] call fn_iterativeDeepSearch; };
#

For some reason.

#

It won't work in unscheduled environment

#

@jade abyss

#

Ignoring the sleep and spawn

#

I know that.

#
tripleNested = [  
    [  
        [01,02,03],  
        [04,05,06],  
        [07,08,09],  
        [10,11,12]  
    ],  
    [  
        [13,14,15],  
        [16,17,18],  
        [19,20,21],  
        [22,23,24]  
    ]  
];
fn_iterativeDeepSearch = {   
params [   
["_toFind",0],  
["_finalRet",0],  
["_i",0],  
["_j",0]];
hint format ["%1",_toFind];        
for [{_i=0}, {_i<count(tripleNested)}, {_i=_i+1}] do  { 
  ret = (tripleNested select _i);   
   for [{_j=0}, {_j<count(ret)}, {_j=_j+1}] do  { 
    subRet = (ret select _j);   
    finalRet = subRet find _toFind;     
     };   
  };  
 finalRet;     
}; 
 [05] call fn_iterativeDeepSearch;
little eagle
#

Why would you ever do that though?

jade abyss
#

boredom

little eagle
#

So what is this supposed to report? [0,1,1] ?

thin pine
#

@jade abyss hehehe

chilly surge
#

Hey Guys, I was wondering if I could set a ACE3 Rearming Point on any other objects, other then the HEMMT/Zamak ammo trucks?

little eagle
finite mica
#

so I have a question about audio

#

is it possible to trigger a gunshot sound by script without a unit? and have it use proper processing?

polar folio
#

a) yes

b) probably not without an elaborate config for that soudn that replicatest he one for the gun sound. haven't looked into the filter stuff but my guess is that not all of it is available outside of the egnine's gunshot implementation. you should probably ask someone who made a sound mod to get complete info on how processing works and is applied

finite mica
#

thanks

jade abyss
#

*playSound

#

@finite mica

tough abyss
#

This might be a silly question, but I keep getting errors with this:

_theGroup = 0;

while {_theGroup == 0} do { _theGroup = [] call getTheGroup; };
#

The function returns 0 unless it can get something

#

I have tried this as well:

_theGroup = 0;

while {if (_theGroup == 0) then {true} else {false}} do { _theGroup = [] call getTheGroup; };
#

Keeps saying "Generic error in expression" with the position of >== 0

rotund cypress
#

Does anyone here know where the mission files for the endgame and similar is located in addons?

tough abyss
#

It is locked up @rotund cypress

indigo snow
#

@tough abyss that probably means the datatypes dont match. Check what getTheGroup actually returns, if its not a number itll error. you get the same error if you do var = 0 + "a";

rotund cypress
#

What do you mean, EBO? @tough abyss

tough abyss
#

Doesn't exactly exist as a .pbo somewhere. I had a look around a while back with no luck.

rotund cypress
#

It has to be somewhere

#

It's not like it's getting pulled out from the computers ass

tough abyss
#

Of course, and I think I came across something, but it wasn't able to be opened.

#

It is in the marksman ebo files I think

#

packaged with the dlc

rotund cypress
#

Wait endgame is only for marksmen dlc?

tough abyss
#

@indigo snow I am trying to get the closest group to a location to prioritize pickups:

closestGroup = {
    
    _returnValue = 0;

    _aliveGroups = aiAliveGroups;
    _currentlyTransported = aiAliveGroupsTransported;
    _grps = _aliveGroups - _currentlyTransported;
    if (count _grps == 0) exitWith { _returnValue };
    _spawn = getMarkerPos "AISpawn";
    _closestGroup = _grps select 0;
    _closestDistance = leader (_grps select 0) distance2D _spawn;
    {
        _distanceTo = leader _x distance2D _spawn;
        if (_distanceTo < _closestDistance) then {
            _closestDistance = _distanceTo;
            _closestGroup = _x;
        }
    } forEach _grps;
    
    if ((leader _closestGroup distance2D _spawn) <= 1000) then {
        _returnValue = _closestGroup;
    };
    
    _returnValue;
};
#

It was released with the marksman dlc, so it is packaged in there if I recall

#

It will return a group if it is applicable

indigo snow
#

so _returnValue is a group type from what I see? you can't use == to compare different datatypes

#

use isEqualTo or isEqualType or something

tough abyss
#

What would be the ideal value to return for no applicable group?

indigo snow
#

grpNull?

tough abyss
#

I will try that.

#

Works perfectly @indigo snow cheers

indigo snow
#

cool!

meager granite
#

Let me shorten your function, because i'm bored

#
closestGroup = {
    private _groups = (aiAliveGroups - aiAliveGroupsTransported) apply {
        [leader _x distance2d _this, _x]
    };
    if(count _groups == 0) exitWith {grpNull};

    _groups sort true;

    if(_groups select 0 select 0 > 1000) exitWith {grpNull};

    _groups select 0 select 1;
};

_closest_group = getMarkerPos "AISpawn" call closestGroup;
#

@rotund cypress Look into addons\missions_f_exp_a.pbo

rotund cypress
#

Ye I found that

#

Thanks anyways

dusk sage
#

:/

jade abyss
#

... -.- and posting Discord of PR... wow

tough abyss
#

Cheers @meager granite just noticed this

thorn saffron
#

is there an FSM syntax for notepad++?

finite mica
#

Is it possible to display dialogues while the map is open?

thorn saffron
#

yeah

indigo snow
#

@thorn saffron Do you mean you want to code out an FSM by hand instead of using the FSM editor?

#

Hasnt been done before afaik

#

Inside the FSM you just use SQF

little pasture
#

Can anyone point me to a doc on using trigger areas to spawn enemy units?

tough abyss
#

waitUntil { !musicPlaying };

#

This should work just fine? When checking a variable?

indigo snow
#

if youre in a contect where you can suspend, yes.

tough abyss
#

Figured that may be the issue.

indigo snow
#
if canSuspend then {
    waitUntil { !musicPlaying };
} else {
    hint "ERROR: can't suspend now!";
};
tough abyss
#

Just changed my calls to spawns, should work now...

#

And she works perfectly.

finite mica
#

Is it possible to read a float variable and select each digit separately like this select?

#

I want to code a grid system and I would liketo check for teh first 3 digits of a position variable

thick oar
#

Turn your float to a string first. str

finite mica
#

mapgridposition is not accessible with this select

thick oar
#

Have a look at the new alternative syntaxes of "select" that deal with strings.

finite mica
#

Thanks, ran into an issue though:

#
(str mapGridPosition player)
#

returns:

"""121188"""```
#

how am I supposed to peel off the triple quotations.

#

actually, wait I think I see the problem

indigo snow
#

? mapGridPosition already is a string

finite mica
#

whoops

#

I wrapped an orange into foil and complained about the extra peel

#

_var = mapGridPosition player;
_var = _var select [0,3];
hintsilent format["%1", _var];```
#

this works as intended, thanks for the help kalband nick

#

amazing how the true power of scripting lies with string operation

#

However one thing appears to maek no sense:

#

However one thing appears to maek no sense:

#
//x-grid position
_x = mapGridPosition player;
_x = _x select [0,3];
//y-grid position
_y = mapGridPosition player;
_y = _y select [3,5];
hintsilent format["%1 %2", _x, _y];
#

Test

#

Why do I have to start at 3,5 for the second part?

#

the string is 6 digits

#

0 1 2 -3 4 5

indigo snow
#

first index is 0

finite mica
#

well thats the wrong part

#

I only get the first 3 digits if I go 0,3

#

if its 0,2 I only get teh first 2

#

Unless I am overlooking something the logic is wrong

indigo snow
#

no

finite mica
#

If anyone wants to see this ingame, you can do so in the developer console.

indigo snow
#

[_startindex,_length]

#

so [0,3] and [3,3]

finite mica
#

oh crap

#

I assumed it was start at, and go to

indigo snow
#

yea its a bit unintuitive, i forgot too

#

its why you always keep the wiki open ๐Ÿ˜„

finite mica
#

I end up with 30 pages open quickly

#

always dumpster diving in the script commands

#

If I fill the altis map witha few thousand 100meter rectangular markers, is that a performance concern?

#

looking at it it would almost a 100 thousand markers so i think that would be a dumb idea

polar folio
#

i would just compare fps with nothing else in the mission. i guess it depends on how the game handles them. probably waaaaay less data than an entity

polar folio
#

i would be interested in that too though. sounds like you are working on insurgency? me too actually. kind of ;D

tough abyss
#

@finite mica Yes it will hog performance particularly, as you will need a means to watch them

#

@little eagle And the reason I did that, is because it's a valid programming technique

#

but arma 3 hates it.

#

It was to iteratively search a triple nested array

polar folio
#

but just idle markers are fine? because there is ways to handle them efficiently i think

tough abyss
#
tripleNested = [  
    [  
        [01,02,03],  
        [04,05,06],  
        [07,08,09],  
        [10,11,12]  
    ],  
    [  
        [13,14,15],  
        [16,17,18],  
        [19,20,21],  
        [22,23,24]  
    ]  
];
fn_iterativeDeepSearch = {   
params [   
["_toFind",0],  
["_finalRet",0],  
["_i",0],  
["_j",0]];
hint format ["%1",_toFind];        
for [{_i=0}, {_i<count(tripleNested)}, {_i=_i+1}] do  { 
  ret = (tripleNested select _i);   
   for [{_j=0}, {_j<count(ret)}, {_j=_j+1}] do  { 
    subRet = (ret select _j);   
    finalRet = subRet find _toFind;     
     };   
  };  
 finalRet;     
}; 
 [05] call fn_iterativeDeepSearch;
polar folio
#

did anyone find a way to fully reset AI. i tried _unit disableAI "Autocombat" and it looks good but once i reenable the AI goes back to danger walk. is there no way to erase all the enemies a unit is aware of from its consciousness?

little eagle
#

set knowabout value to 0 for all spotted enemies

#

and then set the behavior to SAFE

polar folio
#

wait what? how recent is example 3 on the reveal wiki page?!

also thx a lot!

little eagle
#

idk. it's a wiki. should be able to figure it out

polar folio
#

hm. it says the value can only be increased not decreased. is that outdated info?

little eagle
#

idk

#

Don't see why that would be

polar folio
#

so did you use this and it worked? i'm confused. to my knowledge knowsabout could never be decreased

finite mica
#

Does anyone know the map control number?

#

I know the display is 12

polar folio
#

if you tested it i will blindly trust ofc ;D

finite mica
#

The syntax is:

#

_WorldCoord = _Control ctrlMapScreenToWorld _ScreenCoord

little eagle
#

51

#

idd 12 idc 51

finite mica
#

Thanks a lot.

#

is 51 the whole map interface?

#

I think systemchat is broken.

#

It wont show up for me at all.

little eagle
#

no, it's only the map control

#

"map" is a control type

tough abyss
#

I used systemChat today just fine @finite mica

finite mica
#

when I use it with format it wont work for me.

tough abyss
#

paste how you are using it?

#

I used it with format today

#

@little eagle Was my script design terrible?

#

Or is there a better way to deep search an array?

little eagle
#

well it's pretty specific and won't work with 4 deep arrays

#

so it's kinda pointless

#

unless you happen to find an application for exactly that

#

but there are then probably better ways to store data than nested arrays

finite mica
#

@tough abyss now it works, must haev been a typo

#

sorry to cause a fuss

tough abyss
#

Kewl ๐Ÿ‘ all good. Everyone (mostly) is here to help

little eagle
#

I'm here to point and laugh at the mistakes of others.

finite mica
#

I consider myself very advance with specific scripting topics but I trip over random stuff like a total newbcake

tough abyss
#

@little eagle It was for @tough abyss

#

It had a triplenested array

#

That he was using for profileNameSpace storage

finite mica
#

my biggest achievement was my own ghetto dayz clone, where I coded a loot system and persistent player logins (using the SQL plugin someone made). Took me six weeks, then arma3 alpha came out and no one ever noticed.

#

on the bright side i learned a lot from it.