#arma3_scripting

1 messages ยท Page 480 of 1

knotty sun
#

hehe

#

I think it's complaining about the addAction title I gave it, but I don't see the issue

still forum
#

different error now?

knotty sun
#

yea, "please start server first". I'll have to wait a minute ๐Ÿ˜›

#

woops wrong log

#

currently no whining so gonna check it out client ๐Ÿ˜„

#

do remoteExec need a timeout before sending the next? sqf [_veh,["Open BIS Virtual Arsenal",_fnc_arsenal,[],2,false,false,"","",5]] remoteExec ["addAction",0,_veh]; [_veh,["Summon Vehicle Drop",_fnc_garage,[],1,false,false,"","",5]] remoteExec ["addAction",0,_veh]; [_veh,["Request Medical Attention",_fnc_heal,[],1.5,false,false,"","",5]] remoteExec ["addAction",0,_veh]; only the last one sent is visible without any RPT errors

still forum
#

do the others throw errors?

knotty sun
#

nope

#

RPT is clean

#

if I disable the last one, the previous one appears

#

maybe the JIP object causes an issue here?

#

overwriting the queue or something

calm bloom
#

Hello, comrades! I have a question again.

Have anyone found a way to track primaryweapon reloading before it ends?

digital jacinth
#

what you mean with track reloading before it ends?

#

the reload EH fires at the end

calm bloom
#

yep

#

Lately, interesting addon hit workshop - KKA3 TFAR Radio animations. It has a sad bug - if animation playactionnow'ed during reload cycle, one magazine (new one) is deleted.
Looks like it happens because game is 'reserving' it, and kinda adds it into weaponitems.

Im willing to fix this, but i cant find how to fire reload event handler before it is ended, while another reload related mod "goko mag drop" spawns an empty magazine in the middle of reloading, but i dont get how it does that

digital jacinth
#

only way io can see is to track animatinos

knotty sun
#

@still forum it's the _veh part of JIP, it sends the same netID, overwriting the JIP queue (after some extensive reading)

still forum
#

why do you pass _veh at all even?

knotty sun
#

saw it used on the wiki for an example involving a vehicle, instead of true which was my initial guess

wary vine
#

anyone know the max size of procedural textures ?

winter rose
wary vine
#

mine looks fooked when i tried 1024 or over

winter rose
#

Perlin noise?

wary vine
#

r2t

winter rose
winter rose
#

didn't set a ratio?

wary vine
#

"#(argb,512,256,2)r2t(rendertarget0,1.33)";

#

is the best i can get it to look

halcyon crypt
#

is it still possible to override BIS scripts by using the proper $PBOPREFIX$?

#

I need to override a script that is execVMed from within a BIS module

#

there's a pretty bad bug in there that's breaking my stuff ^^

#

I've done this in A2 once or twice until a fix was made by BI but not sure if it's still a thing in A3

still forum
#

@knotty sun last parameter is the JIP "context" Just use true there.

#

@halcyon crypt it shouldn't be... But ACE is overwriting BIS scripts without proper pboprefix. I think the check for that is borked

halcyon crypt
#

can you point me to an example for that?

#

within ACE that is

tough abyss
#

Have you reported that bad bug @halcyon crypt ?

still forum
#

I completly missed the execVM part :D
You can also just override the script the module executes by just editing it's config
That might be easier than messing around with pboprefix

halcyon crypt
#

@still forum thank you ๐Ÿ˜ƒ

#

@tough abyss I haven't yet, first I need to make sure that this the actual problem ^^

tough abyss
#

@halcyon crypt what is it then?

halcyon crypt
#

the HC module removes all control event handlers on the map control when you no longer have HC groups under your command

#

which breaks a lot

#

like the mouse cursor with the coord and altitude

#

ACE map pointing

#

C2

#

etc

still forum
#

(โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป

halcyon crypt
#

HC as in High Command

still forum
#

That's probably why almost no one uses that stuff ๐Ÿ˜„

halcyon crypt
#

hehe

#

it's probably an oversight I guess

#

it's the only module function that does this

#

the rest all use the stacked ones

#

well the HC module does use stacked EHs for adding but not resetting

#
//--- Reset GUI
{
    (uinamespace getvariable "_map") ctrlSetEventHandler [_x, ""];
} foreach ["mousemoving","mouseholding","mousebuttondown","mousebuttonup","keydown","keyup"];
#

as a workaround I can just set that variable to controlNull before removing the last group but meh

#

don't want to edit mission files

tough abyss
#

Must be ancient, no one uses seteventhandler

halcyon crypt
#

it is ๐Ÿ˜›

halcyon crypt
#

oh I'm sure it is but certain missions rely on it

#

and it's quite useful for the solo play environment

inner swallow
#

Yeah we still use it

#

In fact, started using it again

#

Wish they had kept working on it though

halcyon crypt
#

is the feedback tracker still the place to get BI script bugs fixed or is it a lost cause?

#

with most of the team moving to other projects

still forum
#

They were quite active lately fixing feedback tracker bugs

#

I think in last dev-branch update we had a bug fixed that only was reported a couple days before that

halcyon crypt
#

interesting

#

I'll give it the benefit of the doubt then ^^

#

first I have to relearn phabricator ๐Ÿ˜„

#

any comments to improve the thing?

still latch
#

Hello.
Can some one explain. Is there any difference in variable initialization?

private _varName = 5;
_varName = 5;
waxen tide
austere granite
#

Private is essential knowledge. Read that over and over till you understand it

scenic pollen
#

@still latch If in function A you define variable _myVar (without using private) and then call function B (from within A) and B also has a variable _myVar, then B will overwrite _myVar in both A and B. However, using private ensures both _myVar variables are separate.

#

At least that's probably the most common use case

#

But not the only one

still forum
#

via execVM, and B also has a variable _myVar

#

no

#

execVM and spawn launch new script instances

#

Local variables don't carry over to new instances

scenic pollen
#

Ah yes you're right, should be via call

still forum
#

Also putting private infront of variables increases performance if you are in a deeply nested call tree
But most people probably don't care about that part

scenic pollen
#

I've amended my comment

still latch
#

@still forum oh. Thank you. Will care :)

scenic pollen
#

Btw params always sets the variables to private, which is very useful.

still forum
#

Yeah. No one should be using _this select more than once to get parameters

scenic pollen
#

@still latch No thanks for me? ๐Ÿ˜ฆ

#

I'm quitting Arma lol

austere granite
#

good

still latch
#

Of course thank you too))

scenic pollen
#

๐Ÿ™‚

#

@austere granite rude

#

gonna report you

#

(joking btw lol)`

still forum
#

โ”ฌโ”€โ”ฌ ใƒŽ( ใ‚œ-ใ‚œใƒŽ)

#

reports @austere granite

austere granite
#

Dude I'll just make 500 new accounts and PM everyone that you're bullying me, that'll surely work

scenic pollen
#

oh god lol

#

@still latch Here's an example:

_funcA = {
  _myVar = 1;
  [] call _funcB;
  hint str(_myVar); // Outputs 2
};

_funcB = {
  _myVar = 2;
};

[] call _funcA;

However, if we used private for both variables then the hint would output 1.

still forum
#

you can use sqf to highlight as sqf code

scenic pollen
#

Oh nice

austere granite
#

You are nice

scenic pollen
#

Wait does that work for all discord servers (for sqf I mean)?

austere granite
#

yes

scenic pollen
#

noice

austere granite
#

discord > steam

#

which doesnt do any code blocks at all

#

Does anyone have any clean written basic group systems under a fancy license THAT WORKS WITH AI?

I'm too lazy to cleanup the overkill frontline group system for another thing i'm working on, figured I'd use the BIS one for now, but it doesnt list AI. I want to be able to create groups and put AI in them

scenic pollen
#

The AI prefer to work alone

#

They are too good for puny humans

still latch
#

@scenic pollen yep I got it. Scopes goes deeper and deeper that is why I need to define private in every sqf/{} for "idiot security"

austere granite
#

and performance

still latch
#

Yep

still forum
#

Don't yall forget ma perf bois

still latch
#

@still forum cant get sqf highliting work from mobile.

minor lance
#

Hello!

#

is it possible to add 2 lines with different size to a sible row in ListBox?

#

for example witha parsetext command?

mellow obsidian
#

Is there anyway with nearObjects to only get eden placed objects. Or for that matter any easy way to get eden placed objects position. (Not with BIS_fnc_objectsGrabber)

still forum
#

I think while you are inside 3DEN there are commands to grab every placed object

#

But do you mean ingame? Like.. Not in editor ๐Ÿ˜„

mellow obsidian
#

Yeah exactly in 3DEN, oohh need to look for that

minor lance
#

esporting to txt, you get a list of all objects with positions

#

exporting*

mellow obsidian
#

You mean open the SQM right adam?

minor lance
#

nope

#

in 3den, click file->export->TerrainBuilder

#

and you get a list with all objects and positions

mellow obsidian
#

Oh, ill look into that now! Thanks!

minor lance
#

np ๐Ÿ˜„

still forum
minor lance
#
"ClutterCutter_large_F";206759.859375;6671.509766;0;0;-0;1;4.95;
"ClutterCutter_large_F";206759.90625;6664.634766;0;0;-0;1;4.95;
"ClutterCutter_large_F";206759.953125;6657.838867;0;0;-0;1;4.95;
"ClutterCutter_large_F";206760.0;6651.22168;0;0;-0;1;4.95;
"ClutterCutter_large_F";206759.8125;6680.115723;0;0;-0;1;4.95;
#

Thats the output

#

Why there is not a "lbSetStructuredText"

#

๐Ÿ˜ฆ

mellow obsidian
#

Both of them kinda works so cheers for them ๐Ÿ‘
But to go more in-depth what im looking for and doing is: First place stuff in the 3DEN grab their positions so I can later build them up from an sqf file. So I would require the same syntax as for example createVehicle

austere granite
#
/*
    Function:       ADA_Store_fnc_exportBuildings
    Author:         Adanteh
    Description:    Exports building array in proper format for store files, _layerID refers to the name of a layer in 3DEN
    Example:        ["Layer 1"] call (uiNamespace getVariable 'ADA_Store_fnc_exportBuildings')
*/
#include "macros.hpp"

params [["_layerID", "ExportLayer"]];

private _array = [];
if (is3DEN) then {
    private _layerIndex = (all3DENEntities select 6) findIf { (_x get3DENAttribute "name") select 0 == _layerID };
    if (_layerIndex == -1) exitWith { _array };
    private _layer = (all3DENEntities select 6) select _layerIndex;
    private _entities = get3DENLayerEntities _layer;

    {
        private _className = (_x get3DENAttribute "itemClass") select 0;
        private _position = (_x get3DENAttribute "position") select 0;
        private _direction = (_x get3DENAttribute "rotation") select 0 select 2;
        _array pushBack [_className, _position, _direction];
    } forEach _entities;
};

private _linebreak = toString [13,10];
private _nextLine = "," + _lineBreak;

private _allText = format ["[%1%2%1]", _lineBreak, ((_array apply { "    " + str _x }) joinString _nextLine)];
copyToClipboard _allText;
_array;
#

@mellow obsidian that allows you to put things in a layer and then export that ezpz

#
    private _objectsArray = call compile preprocessFileLineNumbers _fileName;
    private _objectsCreated = [];
    {
        _x params ["_className", "_posATL", "_direction"];
        private _object = createVehicle [_className, _posATL, [], 0, "CAN_COLLIDE"];
        _object setPosATL _posATL;
        _object setDir _direction;
        _objectsCreated pushBack _object;
    } forEach _objectsArray;

that's the format

#

Additionally add full rotation (instead of yaw only), enableSimulation and so on, basically grab whatever attribute you need

#

also findIf isn't highlighted as command, seems like discord's sqf needs an update

meager heart
#
worldSize
#
disableMapIndicators
austere granite
#
if (worldSize > 1) then { hint 'hi' };
#

๐Ÿ˜ฎ

#

FIX!

meager heart
#

oh also...

#
lbSetPictureRight 
lnbsetpicturecolorselectedright
ctrlSetPixelPrecision
ctrlAnimateModel
ctrlTextWidth
mellow obsidian
#

Amazing Adanteh! Thanks! How do I use this though?

austere granite
#

either use cfgFunctions, and then use the example (just replace ADA_Store_fnc_exportBuildings by whatever you call it). I think creating a .sqf file in your mission folder also works and then just doing sqf ["SomeLayer"] execVM 'yourfilename.sqf'

#

I think that works too when you're loaded in eden

#

then it'll copy the proper text with proper formatting on your clipboard, so you can paste it into some file

mellow obsidian
#

Ahh I see, cheers.

austere granite
#

you gotta make a layer, click the button in the bottom left, then drag objects into that and it'll export that

mellow obsidian
#

Ohh thats what that parameter is for, many thanks

#

Should I execute ingame (play as character) or in the 3DEN?

austere granite
#

3den

mellow obsidian
#

Had some issues with a mod blocking debug in 3den but it all works now. Many thanks Adanteh, this is amazing!

drowsy axle
#
        while {c130_inAir} do {
            c130_ussFreedom allowDamage false;
            hint 'allowDamage isEqualTo False - Deck';
        } else {
            c130_ussFreedom allowDamage true;
            hint 'allowDamage isEqualTo True - Deck';
        };``` Is this correct usage of `allowdamage` and `else` within a `while` statement?
still forum
#

do doesn't take array

#

allowDamage is correct yeah

#

but you can't pass ARRAY to do

#

and else on a while doesn't make sense anyway

drowsy axle
#

Best to change it to an if?

#
        c130_ussFreedom setPos _deck;
        c130_ussFreedom setDir _deckDir;
        if (c130_ussFreedom distance2D ussFreedom < 100) then {
            c130_inAir = false;
        };
        while {c130_inAir} do {
            c130_ussFreedom allowDamage false;
            hint 'allowDamage isEqualTo False - Deck';
        } else {
            c130_ussFreedom allowDamage true;
            hint 'allowDamage isEqualTo True - Deck';
        };``` Full script (is it called within an addAction)
still forum
#

If you want else then that's the only possible option

#

(is it called within an addAction) If you don't spawn then the while won't work anyway

#

It will freeze your game for a while and then just exit

drowsy axle
#

Okay.

minor lance
#

@meager heart Thanks!

digital jacinth
#

I do have a question about the function ace_interact_menu_fnc_addActionToClass. Why can't I use "CAManBase" as type for this? Judging from the config way to add actions it should work, but for some reason it does not with scripts.

#

Do I really need to add it each CAManBase Object by hand?

halcyon crypt
#

it should work

digital jacinth
#
// works
[typeOf dude, 0, ["ACE_MainActions","Medical"], _action] call ace_interact_menu_fnc_addActionToClass;
// does not
["CAManBase", 0, ["ACE_MainActions","Medical"], _action] call ace_interact_menu_fnc_addActionToClass;
halcyon crypt
#

it's essentially an ACE specific wrapper for CBA_fnc_addClassEventHandler which I know works

#

hmm

#

I'm guessing that the CBA part of it works fine

#

so the EH on CAManBase is set

#

but something ACE related isn't taking it or something

#

no clue beyond that though

opaque topaz
#

@digital jacinth probably need to specify that you want the interaction to be inheritable

digital jacinth
#

hmm so that is what that flag does, huh

opaque topaz
#
 * Arguments:
 * 0: TypeOf of the class <STRING>
 * 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
 * 2: Parent path of the new action <ARRAY>
 * 3: Action <ARRAY>
 * 4: Use Inheritance <BOOL> (default: false)
#

4 needs to be true

#
["CAManBase", 0, ["ACE_MainActions","Medical"], _action, true] call ace_interact_menu_fnc_addActionToClass;
#

pretty sure that is the problem

digital jacinth
#

hmmm, nope. still nothing

opaque topaz
#

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

digital jacinth
#

actually, hang on. I added it to all the actions EXCEPT the one i wanted to test...

#

it works now

mellow obsidian
#

Anyone know how to convert the values given from get3DENAttribute "rotation" (Degrees) to vector, so I can use setVectorUp
Or does a different method to set rotation on x/y axis?

meager heart
#
private _value = (_object get3DENAttribute "rotation") select 2;
_object setVectorDir [sin _value, cos _value, 1];
```maybe
meager heart
#
private _vectorDir = _object vectorFromTo _targetObject;
private _vectorAt = vectorNormalized (_vectorDir vectorCrossProduct [0, 0, 1]);
private _vectorUp = _vectorAt vectorCrossProduct _vectorDir;
_object setVectorDirAndUp [_vectorDir, _vectorUp]; 
```maybe x2 ๐Ÿ˜ƒ
#

also if that for some ui things we have ctrlModelDirAndUp and ctrlSetModelDirAndUp

mellow obsidian
#

Hmm.. I seem to be unlucky. Its from Adanteh's script above. Wanna grab all rotation (x/y/z) and then create the object with those attributes

meager heart
mellow obsidian
#

Correct but direction is only the rotation on Z axis, as far as im aware

mellow obsidian
#

Yeah Im doing so i believe:

        private _direction = (_x get3DENAttribute "rotation") select 0 select 2;
        private _rotationX = (_x get3DENAttribute "rotation") select 0 select 0;
        private _rotationY = (_x get3DENAttribute "rotation") select 0 select 1;
        _array pushBack [_className, _position, _direction,_rotationX,_rotationY];

But that gives me the rotation in degrees and im trying to convert it to vectors

    _x params ["_className", "_posATL", "_direction", "_rotaionX", "_rotaionY"];
    private _object = createVehicle [_className, _posATL, [], 0, "CAN_COLLIDE"];
    _object setPosATL _posATL;
    _object setVectorDir [sin _rotaionX,cos _rotaionY,0];

But no luck. However im might just be super tired right now and missing something super basic ๐Ÿ˜„

#

Also tried the setVectorUp

still forum
#

Yeah there was something special to 3DEN rotations.
But my vector math is not up to spec, needs to be recalibrated.

meager heart
#

maybe x3 ez way will be with just getPosWorld vectorUp and vectorDir in that grabber function ๐Ÿ˜ƒ

versed steppe
#

Anyone knows how to script a "roll aircraft" that takes into account if it's a small sports plane or a b52?

#

Thinking I either have to do some model size and then guess its performances but would be great if could just plane applyAlieron [1,"left"]

austere hawk
#

add torque

scenic pollen
#

Is it better for a frequently called (every 1s) server-side script to run for 18ms in unscheduled, or 100s of ms in scheduled? Which one has the overall lesser impact on server performance?

still forum
#

scheduled can only run 3ms per frame. That's designed so that it can't have any major impact on anything else

#

So with scheduled you are on the safe side.

scenic pollen
#

Sorry, I meant 100s of ms total time spent in scheduled (due to the 3ms limit)

still forum
#

yeah. I understood it like that

#

20ms is not that bad for something that runs only once per second. On clientside you wouldn't want the fps drop. On serverside isn't not that bad

#

the question that I'd ask though is.. Why is it slow? Why not make it run faster?

scenic pollen
#

So if I have a script that's very intensive, and run it in scheduled, it shouldn't affect performance? I thought this was the major contributor to performance issues in missions?

still forum
#

correct. No it isn't

scenic pollen
#

Whoa

still forum
#

What you probably mean by the second thing is that.. Because if 3ms are filled no other script can run that frame and everything else is pushed back.
If you make things like UI buttons or any interaction as scheduled. That could delay the actual execution of the script by quite a lot of time.

#

Technically even up to hours.
You don't want to wait an hour after pressing the respawn button till you actually respawn

#

Also scheduled scripts are in general slower than unscheduled.
Because in scheduled mode, the scheduler checks for the 3ms timeout after every single expression that was executed.

scenic pollen
#

I see. So scheduled scripts shouldn't impact major things such as AI performance?

still forum
#

correct

scenic pollen
#

Excellent, thanks for your explanation

umbral oyster
#

copyToClipboard doesnt work in MP?

still forum
#

Correct.

#

with scheduled you are always on the safe side "performance" wise. Besides ofcourse if other people put important stuff that has to execute quickly into scheduled...
But that's their fault then

#

still. 18ms script.. It can sure be optimized.

scenic pollen
#

Yeah 18ms is slow, but I'm not sure how to speed up performance beyond the optimisations I've already made. My script is iterating over every unit + vehicle, and calling an extension for each one.

#

Perhaps it's better if I show you the script

#

This is called every 1s, in an unscheduled environment

still forum
#

Is the Extension the actually slow part? How fast does it run if you just comment out all the extension calls?

scenic pollen
#

Good question. I haven't tried this with the latest version of my script, so perhaps the DLL is a bottleneck. However, the DLL isn't really doing much - just appending some values to a dict. I tried threading the DLL, but this is in fact slower (spawning the thread takes longer than just executing the code synchronously)

still forum
#

You usually don't spawn the thread. It should already be running and waiting for work

scenic pollen
#

Yeah I considered that too (using a thread pool). Perhaps this is the route I should take. I wanted to avoid threading though, since each DLL call operates on the same variable (so could result in conflicting writes). This may be my only option though

still forum
#

the same variable (so could result in conflicting writes) Make the variable as small as possible.
In TFAR for example I use a work queue. The thread only locks it for a very short time when it takes a job out.
First thing would be to test if the extension is actually the problem though.

scenic pollen
#

Yep you're right. The if statement made use of those two variables before - I must've forgotten to move it.

still forum
#

_entityCount = _entityCount + 1; Just return true at the end, and false in the exitWith's and let count take care of the counting for you

scenic pollen
#

Good tip, thanks ๐Ÿ‘

still forum
#

Also you are doing all the rounding in SQF.
You could also move that to the seperate thread of your extension

scenic pollen
#

I did wonder whether SQF rounding was slow

still forum
#

same for your parseNumber to turn bool into number. Just do that in extension

#

every SQF command is "slow". Less commands == better

errant jasper
#

But do you really need to go through allUnits every frame? For my own recorder, I only do it ~7 seconds, but more often for fast moving vehicles.

still forum
#

every second. not every frame

#

Arma Engine internally also differentiates between veryslow, slow, fast, veryfast Entities

scenic pollen
#

It's every 1s atm, but that's really only for stress testing. In the end I'll probably only run it every 3s

#

Arma Engine internally also differentiates between veryslow, slow, fast, veryfast Entities(edited)
How so?

#

And what do you mean by slow/fast etc?

still forum
#

For example buildings are veryslow, They don't need to be updated often

#

bullets are veryfast, they are updated as often as possible.

scenic pollen
#

And are you saying there's a performant way to filter this when calling allUnits (for example)?

still forum
#

not really. Atleast not accessible from script I think

#

you could make a intermediary list and refresh it every 10 seconds or so.. But that's alot more work and won't really help you much

scenic pollen
#

Ah I see. I thought that's what you were building up to haha

tough abyss
scenic pollen
#

@still forum For things like rounding (or other math operations), is it quicker to make a synchronous extension call that does the rounding for us, than to call SQF round by itself?

#

Just trying to figure out exactly how much is worth moving to an extension

still forum
#

no

#

sqf command is faster

#

But you pass them to the extension as string anyway

#

just pass the unrounded value directly

#

if the extension needs to round it, it can just do it in a seperate thread

scenic pollen
#

Cool, makes sense

still forum
#

Also your extension might be slow because you are doing all the string parsing

#

you should just copy the strings and send it off to a queue to be processed by a second thread.
That can then take care of the parsing and rounding and everything that's needed

scenic pollen
#

Yeah, it does indeed look like threading is the way to go

#

(assuming the extension is what's causing the bottleneck)

austere granite
#

Anyone happen to have a function that adds given classname to cargo inventory? Aka give it a classname and it goes into box, so it handles whether its item, magazine or weapon?

#

or nevermind.... i already have it myself with tiny adjustment ๐Ÿ˜‚

unborn ether
#

How is that possible that createMarkerLocal becomes global?

#

Not remoteExecuted to everyone, so not shared on every PC.

#

Just created on one PC and with some magic it becomes visible to everyone.

austere granite
#

if you use any global command on it, it'll turn into a global marker

unborn ether
#

Seriously?

#

Jeez.

austere granite
#
_marker = createMarkerLocal blablal;
_marker setMarkerColor "ColorBlack";
#

and tada its global

#

yep

unborn ether
#

Is that noted somewhere on wiki?

austere granite
#

Gotta make sure you use local commands on it

#

i think so

#

NOTE: Local markers have own set of local commands "XXXXLocal" to work with. If you use global marker command on a local marker, the local marker will become global marker.

unborn ether
#

Thanks

#

Using for years, just noticed that, just occasionally.

scenic pollen
#

See this is where SQF should raise an error (e.g "Error: Used global command on local marker") instead of just silently performing some other unexpected function

still forum
#

It can't though.

#

Because it doesn't know whether a marker is global or local

#

If it knew that we wouldn't need specific local/global commands. As the command could just check whether the marker should be local only

scenic pollen
#

True, but overall it's just bad design (or at least could be better)

#

As in it should know whether a marker is local or global

#

But then tbf we all complain about SQF but I can't think of any other game that is so open and has such a dedicated scripting community

still forum
#

Yeah I also don't know why it would be hard to add a variable to it..

#

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

scenic pollen
#

Yeah I'm assuming the devs have a tough time having to build on top an engine that's a decade (or more?) old

still forum
#

Some of it is 2 decades old

scenic pollen
#

Oh wow, didn't know this was where RV started

tough abyss
#

Any idea why the following has no return?

_vehicle = vehicle player;

_vehicleWeapons = (_vehicle weaponsTurret ((assignedVehicleRole player) select 1));
_vehicleMagazines = _vehicleWeapons apply {getArray (configFile >> "CfgWeapons" >> _x >> "magazines")};
#

_vehicle weaponsTurret ((assignedVehicleRole player) select 1) works just fine, for a Slammer it returns ["cannon_120mm", "LMG_coax]. Both have a magazines[] entry in the config...

errant jasper
#

It works fine here. But I mean the result of an assignment expression is nil, so that is the return value?

tough abyss
#

Ah shit

#

I forgot to actually return _vehicleMagazines.

#

Thanks @errant jasper.

still forum
#

@elder vigil Read #rules before you continue

elder vigil
#

okay and?

still forum
#

You might wanna delete your violation.

scenic pollen
#

@elder vigil I'm guessing it's rule "9) Do not cross-post" since you asked the same question on #arma3_questions

tough abyss
#

Two questions:

  1. How does one go about un-nesting an array? Turn [[1,1],[2,2],[3,3]] into [1,1,2,2,3,3].
  2. How do I go about removing dupliate entries from an array? [1,1,2,2,3,3] into [1,2,3]
still forum
#
_arr = [[1,1],[2,2],[3,3]]
_unnested = parseSimpleArray ("[" + (((str _arr) splitString "[],") joinString ",") + "]");
_noduplicates = _unnested arrayIntersect _unnested ;
#

(โ•ฏยฐโ–กยฐ๏ผ‰โ•ฏ๏ธต โ”ปโ”โ”ป

tough abyss
#

Nice, thanks @still forum!

mellow obsidian
#

Is there anyway currently to set an init of a object/vehicle or is that fully removed?

still forum
#

init eventhandler? Init box in 3DEN? what init?

mellow obsidian
#

Oh crap my bad, i'm pulling an init from the Init box of 3DEN and then with scripts placing that object backdown and would like to place the init from 3DEN aswell

still forum
#

you are creating objects via script and want a init script running on them

mellow obsidian
#

Very much correct, saw that the setVehicleInit got removed a couple of years back. So wonder if there is a smart and safe work around

still forum
#

just execute the script right after createVehicle

mellow obsidian
#

Thats what im currently trying. But when the object has init code of an addaction I cant seem to get it to work.

_initcode; //code with the init code from the object
_object //the object itself 

Is how I have it set up

sleek token
#

hey everyone fsm stuff again:
any ideas why isServer is not true on a dedicated server when checked in a condition?

still forum
#

can you show me your actual code @mellow obsidian ?

#

@sleek token AI FSM? or AI unrelated and 100% sure it's running on server?

sleek token
#

ai unrelated stuff, i am doing missionflow and HC balancing with fsm

mellow obsidian
#
params ["_callFile","_enableSimulation","_allowDamage"];

private _objectsArray = call _callFile;
private _objectsCreated = [];
{
    _x params ["_className", "_posATL", "_vectorDir", "_vectorUp","_initCode"];
    private _object = createVehicle [_className, _posATL, [], 0, "CAN_COLLIDE"];
    _object setPosATL _posATL;
    _object setVectorDirAndUp [_vectorDir,_vectorUp];
    _object enableSimulation _enableSimulation;
    _object allowDamage _allowDamage;
    if( _initcode != "")then{_object ??? _initCode}; //   <----This is the part im working on 
        
    _objectsCreated pushBack _object;
} forEach _objectsArray;

sleek token
#

it's strange the fsm is running fine while tested in editor and being hosted localy but as soon i try i to run on a dedicated server instance it never executes past isServer

still forum
#

_object ??? _initCode -> _object call _initCode

ruby breach
#

is _initCode actually code, or a string? I don't remember if != requires the same type is why it matters

strong shard
#

@ruby breach yes, != requires same types for both operands, isEqualTo - no

mellow obsidian
#

Looks like its a string Gnashes

private _initCode = (_x get3DENAttribute "Init") select 0;

becomes

"this addAction [""a useless action that does nothing"", {}];"

Trying the call but gotten some errors from it so trying to figure out why currently

indigo snow
#

Replace this with _this and compile it

mellow obsidian
#
_object call compile _initCode;

Works!
Hats off to all of you!
Many thanks

lean estuary
#

Can anyone point me in the right direction with making extensions scheduled. (Tfr exists so it should be possible right)

dusk sage
#

Extensions 'scheduled'?

errant jasper
#

? The term scheduled refers to the "context" the code runs in. Pretty sure from SQF perspective there is only unscheduled when using callExtension.

lean estuary
#

allow suspension

errant jasper
#

Spawn threads, and return immediately so SQF can keep running. Then later check back with another callExtension command.

lean estuary
#

does the freeze when calling a extension end when returning something or when the dll reaches the last line of code (At vacation atm so cant test)

dusk sage
#

When you return to the engine

#

You'd have to spawn a thread to continue executing extension side, like Muzzleflash said

lean estuary
#

Interesting, thanks.

sleek token
#

isnt the post init executed on the serverside as well?

#

im having trouble cause a script doesnt execute on serverside after isServer check

#

systemChat "im running it in 30sec";
sleep 30;
missionHandle = [] spawn EB_MAINMISSION_fnc_missionAI;
lean estuary
#

How to get contents of groundweaponholder?

ruby breach
#

getMagazineCargo / getWeaponCargo / getItemCargo / getBackpackCargo / etc

tough abyss
#

@sleek token Does it execute before isServer check?

sleek token
#

idk

#

i guess it kinda has todo with suspending

#

because switching all code to initServer.sqf fixed all my problems

tough abyss
#

You can guess or you can test, itโ€™s up to you of course

sleek token
#

I will try it out later, i never put anything before the check

tough abyss
#

I doubt isServer command is broken so I expect it wonโ€™t execute either because the whole script doesnโ€™t execute for some reason

#

But until you test it you got yourself a Schrรถdinger's cat

errant jasper
#

Running something in post-init is unscheduled, right? So if you did that then it probably got aborted at the sleep command.

#

Where-as initServer.sqf (and the other init*.sqf files) are run scheduled.

sleek token
#

nope post-init is scheduled but it will be suspended for the time the mission is loading

errant jasper
#

Ah, yeah forgot post-init was odd one that did not run unscheduled.

#

I just tested this

if (!isServer) exitWith {};
sleep 20;
["Hello World"] remoteExecCall ["systemChat"];
#

It works, sorta. I tested on both editor, locally hosted, and dedicated.

#

Strange thing is it does seem to run twice.

#

Firstly I am stuck in the loading screen for an additional 20s while the server (including editor) before the game will start.

#

Then after the game start, I can run around, and when 20s have passed from start I get the message.

high marsh
#

Does it happen to run twice when running local?

errant jasper
#

I am only guessing it runs twice because of the delay (happening twice). I only see the "last" message, because I am not ingame before that - still loading.

#

But yes the behaviour is the same in editor, hosted MP and dedicated.

high marsh
#

Shouldn't happen even if you don wait.

#

Oh, well it could be that you are indeed exeucting this twice? Where is it being executed?

errant jasper
#

I have a fresh mission, just a player, and a post-init in CfgFunctions which should run once per machine on loading right? I am looking at my clock watching seconds tick. I sit at the loading screen for roughly 23s (20s + 3s normal loading time) before I get in the game, the another 20s before the message.

#

This is my CfgFunctions part:

            class myPostInit
            {
                file = "myPostInit.sqf";
                postInit = 1; 
            };```
#

If I remove the sleep, I get into the game after the 3s and then immediately get the message.

indigo snow
#

20s from the server that will block the players from loading in plus 20s from the client itself

errant jasper
#

Yeah, but then the dedicated server still gets it wrong.

#

I still wait twice when joining a dedi.

sleek token
#

@indigo snow btw that explains another problem i had...

errant jasper
#

Something strange is definitely going on:
I change sleep time to 5s: I now wait additional 20s still in loading, and then 5s ingame before the message.
Remove sleep time completely: Wait < 3 seconds loading, and message immediately.
Okay change sleep time to 5s again: I now wait additional 20s in loading again, and then only 5s ingame.

indigo snow
#

Might be a crowded scheduler

sleek token
#

yep

indigo snow
#

Still sounds wierd for it to be that

errant jasper
#

If I add a sleep > 0, Arma will somehow create delay/work for ~20s . Then it will also do the actual sleeping. So if I sleep 40, it will take 20s before I get into the game, and then another 40s for the "actual sleeping". With 5s it become 20 + 5 and so on. But if the sleep is not there or 0s you will not get the additional 20s.

#

I am not really convinced there is 20s of scheduled work to be done in vanilla Arma, only one unit on map, but whatever.

#

My take away is, try hard not to have to sleep in post init.

#

And @sleek token I closed Arma now, so did not try with spawn. But my code continued running on the dedicated, after the sleep as expected. Essentially this worked for me in post-init:

if (!isServer) exitWith {};
sleep 15;
["Hello World"] remoteExecCall ["systemChat"];
[str clientOwner] remoteExecCall ["systemChat"];```
#

And the number for the last command was 2 which is the server.

sleek token
#

allright thanks for testing this out

#

however i moved all my init code to initserver

#

this "bypasses" the limitation for function libs

scenic pollen
#

Is there a standard way we handle DLL exceptions in Arma? Every time my DLL raises an exception, Arma crashes. I get that I should be correctly handling exceptions in the DLL, but an error could occur at almost every line - surely I don't need to surround everything in a try/catch?

knotty arrow
#

anyone knows any way to do silent footsteps?

minor lance
#

Anyone know the way to remove footsteps sounds?

#

we come together XD

knotty arrow
#

its for a special player not for all players

sonic cradle
#

Does the engine have issues with nested for or while loops?

#

currently just putting two big circle marker with 2 dot markers inside it

#

my guard bools and exitWiths won't fire and break loops, so it goes on and on endlessly

meager heart
#

kinda ez way > map control ctrlAddEventHandler > "Draw" and no loops ๐Ÿ˜ƒ

sonic cradle
#

eh, this is more of a test for some dynamic mission creation I have planned for later

#

the map markers are proof of concept for it

#

and I've no experience on ctrlAddEventHandlers ...

meager heart
#

afaik there are no issues with loops in loops aka nested loops, except that every loop can/will impact performance, if that was done wrong... also depends where you have those loops (scheduled/unscheduled)

sonic cradle
#

you're right. There's nothing wrong with it. I had a trigger that was being triggered constantly, running my script endlessly.

#

changed it to trigger once, poof, no more loopy loops

willow rover
#

is there a way of creating a unit at the players position and having a init field still?

minor lance
#

Hello! I have a problem with calling scripts. If I have variable _test in my main script and in that script I do [] cal test_fnc_test;. In that script i called i have a variable called _test too but as different scripts should affect the main one. After called, first variable value is equal to the value in the call script. EXAMPLE:

test_fnc_test = {
    _test = player;
    _test
};

_test = 0;

[player] call test_fnc_test;

hint str _test;

//_test == player WTFยฟ?

Am I crazy or its made to work like that?

snow pecan
#

You need to use private

sharp pewter
#

Is there a way to change the way an object explodes? I'm trying to change the way the "cup -usmc vehicle service point" blows up. By defualt it's just a big 3 sec explosion then the object disappears and leaves a crater. I want to make it so when it explodes the ammunition starts "cooking off" and the object changes leaving only a shipping container so that it looks like the ammo boxes and fuel barrels were destroyed.

still forum
#

@lean estuary Can anyone point me in the right direction with making extensions scheduled. (Tfr exists so it should be possible right)
You can't. And TFAR doesn't.
or when the dll reaches the last line of code Do you even know how dll's work at all?

@sleek token how do you launch that code?

@errant jasper Firstly I am stuck in the loading screen for an additional 20s while the server That's because the loading screen waits till all postInit scripts are done.
Some idiots put waitUntil and sleeps into there, and then you get that bug that the waitUntil never exits and you end up in a endless loading screen.
IMO postInit scripts should be handled as if they were unscheduled. (I use the CBA postInit which actually is unscheduled)

@scenic pollen but an error could occur at almost every line - surely I don't need to surround everything in a try/catch? The fix for that is what people call "good code"
Just don't write code that could crash anywhere.

@sonic cradle Does the engine have issues with nested for or while loops? no.

@willow rover is there a way of creating a unit at the players position and having a init field still?
Yes? Why not? If you spawn the unit with createUnit just call your initCode manually right after that.

@minor lance [] cal test_fnc_test; Typo in there. It's call

opaque topaz
#

Damn Dedmen knocking out these questions left and right

still forum
#

Like every morning

#

yawn

meager heart
#

Groundhog Day ๐Ÿ˜„

errant jasper
#

Still surprised, that there is 20s of postinit to run in vanilla Arma. I just assumed postinit was unscheduled so never had the problem myself.

hollow thistle
#

So to be sure, will postInits be always executed in the order they are in CfgFunctions as sleeps in there will just prolong the execution instead of giving the scheduler time to execute something else?

still forum
#

scheduler runs it's...... Uh.. Need to look that up

queen cargo
#

I doubt that
My assumption is that it runs Alphabetical

still forum
#

no

queen cargo
#

Isnt the Config stuff properly hashed?

#

With buckets etc? Oo

still forum
#

Nope.

#

That's a optional extra that's used for things like CfgVehicles. And only if you search by name. Not if you iterate

queen cargo
#

This now... Is horrifying

still forum
#

Inside loading screen the scheduler runs it's 50ms (instead of 3ms) per frame of scheduled code.
But the initFunctions.sqf (Functions_f.pbo) script calls all postInit script in a loop while iterating through the list of postInit functions. And ends the loading screen when it's done.
And as we know call waits till the script is done.

They are executed by order of definition/initialization. Things like requiredAddons plays into that.
If you put an addon into your requiredAddons, it's pre/postInit functions will execute first, it's functions will also be compiled first.

opaque topaz
#

^ that is juicy information

#

maybe someone will pin it

hollow thistle
#

Thanks Dedmen.

still forum
#

What part of that is useful?
Besides the "never sleep/waitUntil in postInit" which I tell people quite often

opaque topaz
#

idk, in case I'm run into some weird bug and knowing that is useful

#

and could solve my problems

still forum
opaque topaz
#

although, seems like it's probably something I will never have to worry about

still forum
#

Just always think about that your postInit script is delaying the loading screen.
If you don't want that then add a layer of [] spawn {}

#

Added notes to the startLoadingScreen/Scheduler/CfgFunctions wiki pages

meager heart
#

imo better just do not suspend any "init" scripts at all/in general (not only in posInit) init/initPlayerLocal/initServer... etc

#

also like so ^ you will have less players rage quit after they got old while waiting for mission start ๐Ÿ˜ƒ

still forum
#

init.sqf suspending is fine.. But it's evil because you always have to think about which line to put new stuff in.
I prefer to do everything unscheduled when I can

meager heart
#

@still forum after spending some time in this channel, I'm trying the same tbqh ๐Ÿ˜„

still forum
#

Also unscheduled stuff has way better profiling tools wink wink

meager heart
#

๐Ÿ˜ƒ

still forum
#

Same lag just distributed over a longer timespan

#

you can do the same in unscheduled. Only spawn limited number per frame

peak plover
#

Yeah

still forum
#

It's just that you have to actually use your brain and think about what implications the things, you are doing, have

queen cargo
#

@tough abyss that is a horrible lie

still forum
#

And I also find it's way more fun having to think about exactly what you are doing. Instead of just throwing a splat of code onto the wall

#

Someone's having fun with SQF over here! Burn him ๐Ÿ”ฅ ๐Ÿด

peak plover
#

You can spawn units in unscheduled and have no stutter.

#

Just because you tried spawning 10 units during a single frame doesn't mean unschedueld is bad

queen cargo
#

@peak plover spawning units is always horrible Performance wise... If you got a low fps System, a single Spawn Hits you hard

scenic pollen
#

The fix for that is what people call "good code"
Ouch

scenic pollen
high marsh
#

@scenic pollen
Are you evil?
Yes man, you are.

scenic pollen
#

Mwhahaha

still forum
#

eyetwitch

waxen tide
#

@queen cargo please elaborate?

peak plover
#

more so if you spawn a unit which has clothes and weapons you haven't seen with your client

#

like spawn in a AAF squad and then another one

#

2nd time is less laggy

#

then spawn in a csat squad

queen cargo
#

Spawning in units always is laggy for the Client doing so..

still forum
#

loading models and textures from disk. Initializing the unit's state. Maybe spawning a new AI group. Transmitting the new unit over network..

waxen tide
#

Well i haven't analysed it down to the deepest level, but on reasonably well scripted missions i do not experience lags when units are being spawned. I have a decent CPU tho and my arma runs from SSD. If a lot of stuff is spawned in bulk, yeah i get a small lag, sure. But if its spread out in tiny portions it seems fine, no lag no fps drops nothing.

#

๐Ÿค” Now is this really a matter of bad arma engine design and/or bad scripting habbits or should you guys finally replace your Phenom CPUs

still forum
#

If a lot of stuff is spawned in bulk, yeah i get a small lag, sure. But if its spread out in tiny portions it seems fine, no lag no fps drops nothing. That is exactly what we were talking about.
And SSD has a huge effect on exactly this

waxen tide
#

But what about the "clothes your client hasn't seen yet" ?

#

I thought an SSD would impact that the most

still forum
#

Yes.

waxen tide
#

But once that item is loaded, re-use of it for spawning 100 AI shouldn't matter?

still forum
#

That's what I just said didn't I?

#

correct

#

Once you have all the stuff in memory, spawning more is "fairly" cheap

#

But you still have the setting up unit state and AI and transmitting over network stuff

#

Also don't forget about unit init scripts

queen cargo
#

@waxen tide got some money? My CPU Upgrade is currently preparing to pay the car repair..

waxen tide
#

Well maybe i should be more specific. I would have thought that SSDs help with loading textures and models from disk, while a fast cpu will help with spawning lots of objects

#

You need to set priorities. Stop eating for a month or something.

#

So X39 by "low fps system" you mean someone with a really old PC or just a high load mission environment with lots of stuff already going on?

tough abyss
#

Haha, good luck explaining someone how to spread AI creation per frame in unscheduled instead of telling them to use spawn and be done with it

waxen tide
#

I'm already doing that. We had that discussion like 2 weeks ago or something.

#

But everyone i tested it with in MP has a good to very good cpu so i'm wondering if there is more things to do for people with old systems.

#

I mean you could get arma to pre-load the data by pre-placing units etc.

queen cargo
#

Theoretically, yes
Thing is: the Client doing the task will lag
If the Client is an actual Player or the server does not matters... Unless they improved it a lot since last time I worked on xinsurgency ๐Ÿคทโ€โ™‚๏ธ

waxen tide
#

๐Ÿค” You mean the client that actually spawns the units takes a hit, but clients to which the new units are being synced to do not ?

still forum
#

does not matters ๐Ÿ”จ

waxen tide
#

@queen cargo Can you clarify what you mean with "the task"? I'm a bit of a slowpoke today.

still forum
#

spawning the object

little ore
#

Hey Guys, im trying to create Templates for AI's, cause there are no Units defined in the Niarms mod . i wanna define classes in the description.ext to spawn this Unit with a script. problem is im not really sure how to start to describe it : class B_Soldier_GL_F_niarms { .... .

still forum
#

can't do it in description.ext

high marsh
#

hmm. What about playMoveNow ? It wouldn't ignore the que like switchMove does and hopefully respect the animation set it's being moved into right?

#

@tough abyss

polar folio
#

isn't the keyword "hopefully" when it comes to playMove? maybe add a setUnitPos "DOWN" too. might help with reliability

high marsh
#

Possibly, there is no assurance with any of it. As the player controller probably doesn't like getting forced to do things

#

Especially when AI FSMS are telling it to do one thing when you're telling it to do another

#

I imagine intercept could help with this engine layer stuff?

still forum
#

Theoretically yes. Practically no cuz I'm probably the only guy that could and I don't have free time

high marsh
#

setUnitPos seems promising

meager heart
#

idk if that will be any faster but there is alt syntax for the createUnit with init ๐Ÿค”

minor lance
#

Is there any way with a camera to make a "photo" ?

#

like get the picture and save it to a variable or something

tough abyss
#

You can freeze the scene and save composition and when you want to view photo, hide everything that wasnโ€™t on photo and recreate composition. Doable but major hasslehoff

unborn ether
#

Where do you configure the vanilla helicopter sling loading?

#

Or its just scripted-only with sling* and rope* commands?

winter rose
#

@minor lance no, but you can use screenshot command to save a png =|

minor lance
#

Yeah I know that command but i cant use that ingame in my pone

#

phone*

minor lance
#

Is there anyway to lock player from going STAND from PRONE?

polar folio
minor lance
#

Thanks ๐Ÿ˜„

#

And also when doing playActionNow, can I check for that animation?

fast escarp
#

Is there a function which locks to a specific coordinate on the map? Can't seem to find it but rather be sure ๐Ÿค”

#

By locks I mean moves to XY

#

Kind of like pressing show on map when you got am objective.

copper raven
#

ctrlMapAnimAdd ctrlMapAnimCommit

rustic pendant
#

Is there any like a radiation detector script ?

high marsh
#

Radiation detector? What?

rustic pendant
#

Like a it will play a sound in a specific area when you have an specific gadget

fast escarp
#

Sick thanks sharp.

high marsh
#
if("ItemGPS" in (items player)) then {
    if((player distance (getMarkerPos "marker_zone")) < 10) then {
        //beep beeep
    };
};
unborn ether
#

@rustic pendant There is no radiation in Arma ๐Ÿ˜„

rustic pendant
#

Iknow hahaha

#

Lets say you are in a mission to find some stolen radioactive material, let say in Fallujah , I guess you can use triggers that play the sound louder as you get closer to the radioactive material position

#

But it will only play the sound if the player has a specific device

high marsh
#

๐Ÿคฆ ,
snow. Look at what I posted and adapt it to what you need. It'd be best that you also learn how to use SQF yourself.

rustic pendant
#

Thanks Midnight

high marsh
winter rose
#

^ it would lower the general game sound level

high marsh
#

@winter rose My take on this would be that the sound will only play if you're close enough to be concerned about it at all, you'd need the headphones to hear it anyways. But I guess you could also use say or playSound3D to emulate a speaker

winter rose
#

I would define multiple sounds in CfgSounds, with 10%, 20%, โ†’ 100% volume

high marsh
#

Oh, duh. Yeah that would be more effective

winter rose
#

if it's a playSound player-side. if the sound is on the object itself, a shorter sound radius would do it

high marsh
#

Huh? playSound is local effects, so no one would hear it anyways if it was player side

winter rose
#

But it will only play the sound if the player has a specific device
it might be a local effect, only hearable by the player, that I don't know

pulsar anchor
#

I might be missing something, but I cant find a command for the following problem:
I have got two objects a and b. I have a rope attached from a to b. An eventhandler is applied to b and when it fires I need the rope object for further instructions.

"ropes" does not work for b only for a (startpoint of rope). But as I have multiple ropes going away from a I cant use that.

Does somebody has a suggestion? Thanks.

indigo snow
#

When you create the rope set a variable on b containing the rope object

pulsar anchor
#

Yeah I guess thats the way to go. Not the prettiest.

#

Alright. Ill go for it. Thanks.

sleek token
#

any idea what could the ai make immortal if its not allowDamage?

#

strange error, while in local ai dies normaly but in mp they don't give a fu*ck

meager heart
#

you can try allowDamage but this time without locality issues ๐Ÿ˜ƒ

sleek token
#

i tried this allready, but nope that doesnt work

#

isAllowedDamage says it is allowed to take damage anyways

#

i checked the attached event handlers, one or more HandleDamage eventhandlers have been attached to this unit

#

but it is not done in my code

meager heart
#

show it maybe..

sleek token
#

is there a way to see the code of the eventhandlers in the mission running?

meager heart
sleek token
#

i executed the allowDamage command on the owner side of the ai

meager heart
#

is there a way to see the code of the eventhandlers in the mission running?
add there hint diag_log systemChat....

sleek token
#

?

#

maybe we talking cross purposes, im guessing a mod like ace is messing up the AI

#

i didnt add any eventhandlers to the ai, just want to find a trace where i can look after the issue

sleek token
#

The funny thing is; this only happens on a server. it doesnt happen in the editor

polar folio
#

@sleek token i'd try brute force removeAllEventhandlers just to see, if it's an EH causing it.

outer fjord
#

What function can I use to remove and add the Slat cages in mission?

high marsh
#

@sleek token Always run vanilla when troubleshooting.

#

@outer fjord I believe they are set as animation sources, so look in config and use setAnimationSource

outer fjord
#

Sweet, thanks.

outer fjord
#

Yea, what I want to make is a option to add and remove them as needed.

#

So you can load say a NYX onto a blackfish.

outer fjord
#

Simple goal, simply adding a add action that takes time to take it on and off. Ultimate goal, make it require a engineer class with a tool kit.

fossil yew
#

Is it possible to check if player can see an object?

meager heart
fossil yew
#

thanks

spring vigil
#

Im having issues with making MGI_Halo jump Script work

#

i put the script in the mission folder and put the ex in the object i attempt to play and it says missing _ name .sqf

unborn ether
#

@spring vigil Well its explicit - you mistook the destination folder or its really missing.

spring vigil
#

yeah i thought so as well

#

I canโ€™t post a pic or I would

#

I thing Iโ€™ve figured out an issue I think widows is doing script.sqf.txt

scenic pollen
#

@still forum I'm using ASP for the 1st time. I have the addon enabled, and the Brofiler open. How do I start profiling?

I've tried (in the debug console):

private _scope = createProfileScope "testScope";
profilerCaptureFrame

Nothing is copied to my clipboard, and nothing appears on Brofiler. Sorry, not familiar with this. Not using the Profiling build.

#

Figured it out.
You just need to launch your game with the -nopause startup parameter and the mod enabled (no need to run any script commands). Then open the Brofiler and hit the play button to start profiling. Hit the stop button to stop profiling and view results.

mellow obsidian
#

Im using get3DENAttribute to grab an markers Variable name

private _markerName = (_x get3DENAttribute "name");

_x being the object.
However it returns Null.
The text of the marker works fully fine.

private _markerText = (_x get3DENAttribute "text");

Somebody had this issue before?

sonic cradle
#

Having an issue finding whether positions are greater than a set distance from an array of positions. My check on distance keeps failing when I run it against the array:

#


0 = {if (_safePos distance2d _x < 400) exitWith {
    player sideChat format ["Too close!"];
    _isValid = false;
    }} count array_of_previous_positions;```
#

But I get the error for _safePos only showing 1 element instead of 3.

#
0 = {if (_safePos distance2d _x < 400) exitWith {

Error position: <distance2d _x < 400) exitWith {
Error 1 elements provided, 3 expected```
#

I'm stumped. _safePos is supposed to be a position (an array of 3). Distance is supposed to take in two positions... but _safePos is only feeding it one? huh?

still forum
#

@scenic pollen How do I start profiling? Click the green play butotn in brofiler

#

You just need to launch your game with the -nopause startup parameter Nope. But if you don't you need to be tabbed in

snow cipher
#

hi

halcyon crypt
#

does your debugger/profiler thingy rely on extensions or are you doing some fancy hacking?

snow cipher
#

im a script kiddie in search of help in terms of custom sound adding

still forum
#

Intercept.

halcyon crypt
#

oh right, ofc ^^

still forum
#

Sooo.. A little bit of extensions and fancy hacking if you wanna call it that

#

The old debugger before Intercept was veeery fancy hacking. The new one is just normal intercept (mostly)

late gull
#

Intercept it's pretty, but i'm too noob for that ๐Ÿ˜„

snow cipher
#

i managed to put 3 songs in .ogg without any problem, but after i activate one trigger to play one, i cant play the other ones

halcyon crypt
#

sounds like your triggers aren't setup correctly

snow cipher
#

could be

halcyon crypt
#

or maybe you have to stop the previous song before starting a new one?

#

playMusic "" should stop it

snow cipher
#

class CfgMusic
{
tracks[]={};

class Music1
{
    name = "Music1";
    sound[] = {"\sound\ThreeChainLinks_DieHistoric.ogg", db+0, 1.0};
};
class Music2
{
    name = "Music2";
    sound[] = {"\sound\music2.ogg", db+0, 1.0};
};
    class Music3
{
    name = "Music3";
    sound[] = {"\sound\EspanaUno.ogg", db+0, 1.0};
};

};

= "Music1";

#

wait

#

i think i got it

#

Yup

#

Got it

#

Thanks eitherway

halcyon crypt
#

๐Ÿ‘Œ

scenic pollen
#

I feel like a noob for asking this but how do I skip an iteration of a forEach loop?

tough abyss
#

Remove it from array

scenic pollen
#

Wait, really? That seems really hacky (not blaming you, blaming sqf)

tough abyss
#

Whatโ€™s hacky, you donโ€™t want element to be iterated over remove it. Alternatively you can put if inside the loop and check every iteration if the _x is not that element, but that wouldnโ€™t be wise

scenic pollen
#

Do you mean remove it from the array while iterating over the array, or before?

tough abyss
#

Why remove it while iterating??? I donโ€™t get what you are asking.

#

arr = [1,2,3]; arr deleteAt 1; {systemChat str _x} forEach arr;

scenic pollen
#
{
    if (!(alive _x)) then {
        // Skip this iteration
    };

    // Do stuff
} forEach allUnits;
#

In other languages we would simply use continue to skip an iteration

ionic orchid
#

I invert that boolean and put the processing inside the if()

scenic pollen
#

@ionic orchid I was afraid you might say that haha. Seems to be the only way

ionic orchid
#

it's not ideal, but afaik there is no continue;

#

:/

still forum
#

@scenic pollen if you delete the current element from the array. The forEach loop will skip the next one after that

#

if that helps ๐Ÿ˜„

scenic pollen
#

Oh god ๐Ÿ˜…

tough abyss
scenic pollen
#

That was just a random example

#

But you get the idea

indigo snow
#

you could also check the _forEachIndex instead of deleting, or use select to select parts of the array

late gull
#
asd = nearestObjects [this, ["Land_BarGate_F"], 200];
asd = this nearObjects ["Land_BarGate_F", 20];
hint format["%1", asd];
#

any hint?

scenic pollen
#

@indigo snow Thanks, but in my case I need to check a condition for each element of the array

indigo snow
#

use array SELECT {code} to precondition the selection

#

select will only select elements where the {code} returns true

late gull
#

nvm top my post

scenic pollen
#

Hmm, but wouldn't that command need to iterate over each element of that array (behind the scenes)? I'm aiming for high performance

indigo snow
#

youll be iterating either way, dont sweat the small stuff too much

scenic pollen
#

Yeah but then I'd be iterating twice (effectively)

#

Normally I'd be fine with that (it's a good solution)

meager heart
#

any hint?
3 hints for 5 gates >

player spawn {
    for "_i" from 1 to 5 do {
        private _gate = "Land_BarGate_F" createVehicle (player modelToWorld [0, 10, 0]);
    };
    hint str [
        nearestObject [_this, "Land_BarGate_F"],
        nearestObjects [_this, ["Land_BarGate_F"], 200],
        nearestObjects [_this, ["Land_BarGate_F"], 200] param [0, objNull]
    ];
};
``` into the console ^ and check wiki @late gull ๐Ÿ˜ƒ
late gull
#

@meager heart i want to use it inside a trigger

#

the problem it's the trigger position return an arr[2] and nearestX spect arr[3]

tough abyss
meager heart
#

also this in triggers fields probably undefined, you need thisTrigger or position of that trigger or thisList select 0 < that will be player ๐Ÿค”

minor lance
#

Hello!

#

Is tehre any way to know when a player double clicks the radio inventory slot?

#

this is the control ((findDisplay 602) displayCtrl 6214)

#
class SlotRadio: SlotPrimary
        {
            idc=6214;
            x="41 * (0.03) + (-0.25)";
            y="10.5 * (0.04) + (-0.25)";
            w="2 * (0.03)";
            h="2 * (0.04)";
            colorText[]={0,0,0,0.5};
            colorBackground[]={0,0,0,0};
        };
meager heart
#
onMouseButtonDblClick = "systemChat str ['onMouseButtonDblClick', _this]; false";
```maybe
minor lance
#

Nope

#

((findDisplay 602) displayCtrl 6214) ctrladdEventHandler ["MouseButtonDblClick", "hint str _this"];

#

Doesnt work

gleaming cedar
#

Hello

minor lance
#

Hey!

gleaming cedar
#

How can I spawn a rocket ont he ground

#

hpos = getPosATL heli1;
_rocket = "rockets_230mm_GAT" createVehicle _hpos;

#

Just for explosion effect

minor lance
#

"HelicopterExploSmall" createVehicle getPos heli1;

gleaming cedar
#

Wow thank you god

meager heart
#

MouseButtonDblClick eh works with buttons controls types and maybe with active pictures @minor lance

winter rose
#

yep

#

defining a new _variable = private

#

it's quite ok yes
what do you mean?

indigo snow
#

Dont use that though

#

Just use private _a = 2

winter rose
indigo snow
#

Nice

ruby breach
#

Worse on perf though

#
private["var1","var2","var3"];
_var1 = 1;
_var2 = 2;
_var3 = 3;

// is slower than

private _var1 = 1;
private _var2 = 2;
private _var3 = 3;
winter rose
ruby breach
#

Yes

#

If you're not assigning a variable to them in your code, then your code is probably not that good.

still forum
#

Is Arma's garbage collector just fine when it comes to throwing out variables when the scope is left? There is no garbage collectors @hasty violet

#

Click the 3 dots next to the message. on the right side

ruby breach
#

It's a dev mode feature iirc

still forum
#

private "string" and private [array] are commands

#

private _var is a compile-time keyword

#

it is evaluated at compiletime. And has 0 runtime impact

#

And as the others have 0 runtime impact.. The keyword is infinitely faster.

wary vine
still forum
#

are the variables even required outside of the loop?

#

no they aren't. only _names and _data

#

what?

#

I don't know what you are trying to say with these things

#

You mean no performance difference between only declaring them inside the loop instead of outside?

#

assuming you are using the variable. second one is faster to access the variable

#

When you try to access a variable. It always has to walk up the scopes until it finds it

#

in your second example it's already in the current scope. It doesn't even have to walk anywhere.
In your first example it always has to walk upwards atleast one scope to find it

#

Same happens when you set a variable. It walks up all scopes until it finds it already defined. Or if it reaches the last scope and didn't find it, then it defines it in the current scope

obsidian kiln
#

quick question

#

if i use join grpnull

still forum
#

it creates a new group

obsidian kiln
#

do that group gets deleted after it becomes empty again?

still forum
#

I thiiink.... DeleteIfEmpty is now enabled by default

#

never tried though

#

you can easily test that tho. Just check if allGroups get's smaller

still forum
#

non-null group yes

#

non-null name no

#

CAManBase uhhhh...

#

Think so yeah..

#

Team?

#

can't be

#

because the wiki page says assignedTeam has "MAIN" as default

#

And it returns a string

#

a string cannot be null

#

yeah

#

no

#

unless _x is nil

#

also what you wrote there. Can be expressed as just
_name = [name _x] param [0, ""]

#

maybe even without the []

#

ye

drowsy axle
#

Hello, back again with a quick question. Is this possible with the method's I've used?```sqf
[] spawn
{
_veh = [ // 36 while loops
plane1,plane2,plane3,plane4,c130_ussFreedom,
air1,air2,air3,air4,air5,air6,
car1,car2,car3,car4,car5,car6,car7,car8,car9,car10,car11,car12,car13,car14,car15,
truck1,truck2,truck3,truck4,truck5,truck6
];
{

    _vehName = "true" configClasses (configfile >> "CfgVehicles" >> "_x" >> "displayName");
    _mark = "_x";
    _alive = "ColorBlue";
    _destroyed = "ColorBlack";
    while {TRUE} do
    {
        sleep 1;

        _mark setMarkerPos position _x;

        if (alive _x) then
        {
            _mark setMarkerColor _alive;
            _mark setMarkerText "_vehName";
        };
        if (!alive _x) then
        {
            _mark setMarkerColor _destroyed;
            _mark setMarkerText "_vehName" + ": Destroyed";
        };
    };
} forEach _veh;

};```Taken from: https://forums.bohemia.net/forums/topic/201842-how-to-set-markers-on-vehicles-best-practicemethod/

#

I'm trying NOT to write the same thing 36 times. I have enough hassle with creating the variables in each vehicle AND marker, 72 things to do. I don't want to make it anymore time consuming than needed.

still forum
#

" Is this possible with the method's I've used?" what is this?

#
};
            if (!alive _x) then
            {

what you wrote there is just a very complicated else

#

Also that will stop at the first vehicle

#

because the while never ends

drowsy axle
#

Okay.

#

^ updated script to actually not throw any errors.
In regards to the while loop, is there another way I could achieve the forEach / if statements?

#

@still forum How about this? ```sqf
//[] spawn
//{
_veh = [
plane1,plane2,plane3,plane4,c130_ussFreedom,
air1,air2,air3,air4,air5,air6,
car1,car2,car3,car4,car5,car6,car7,car8,car9,car10,car11,car12,car13,car14,car15,
truck1,truck2,truck3,truck4,truck5,truck6
];
{

    _vehName = "true" configClasses (configfile >> "CfgVehicles" >> "_x" >> "displayName");
    _mark = "_x";
    _alive = "ColorBlue";
    _destroyed = "ColorBlack";

    /*

    while {TRUE} do
    {
        sleep 1;

        _mark setMarkerPos position _x;

        if (alive _x) then
        {
            _mark setMarkerColor _alive;
            _mark setMarkerText "_vehName";
        };
        if (!alive _x) then
        {
            _mark setMarkerColor _destroyed;
            _mark setMarkerText "_vehName" + ": Destroyed";
        };
    */

        _mark setMarkerPos getPos _x;
        _x  addEventHandler ["respawn", {
            _mark setMarkerColor _alive;
            _mark setMarkerText "_vehName";
        }];
        _x  addEventHandler ["killed", {
            _mark setMarkerColor _destroyed;
            _mark setMarkerText "_vehName" + ": Destroyed";
        }];

    //};
} forEach _veh;

//};```

leaden summit
#

I have a resupply script for the mission I'm working on where the players can call in resupply but I don't want them to be able to do it over and over again. What's the best way to limit the script so once they call it they have to wait 24 game hours?

drowsy axle
#

How are you calling the resupply?

leaden summit
#

At this stage it's a script running from an ACE interaction on a laptop. It's spawns a chopper with supplies

drowsy axle
#

ACE. Would you be able to provide the wiki for that?

#

Is it a script you made, using ACE interaction?

leaden summit
#

Yeah well I added the ace interaction to a laptop and that in turn calls a script

drowsy axle
#

Could you provide the script pls

leaden summit
#

Yeah sure it's an absolute disaster script that I've used for multiple missions

#
if (!isServer) exitWith {};

// pull class names from arguments passed through execVM
//slingloading helo
_heli_class = _this select 0; 

// marker positions
_spawn =  _this select 1;
_spawn = getMarkerPos _spawn;

_destination = _this select 2;
_destination = getMarkerPos _destination;

_despawn = _this select 3;
_despawn = getMarkerPos _despawn;


// spawn invisble helipad object for heli to target
_helipad_obj = "Land_HelipadEmpty_F" createVehicle _destination;

    _heli_spawn = [_spawn, 0, _heli_class, West] call BIS_fnc_spawnVehicle;
    _heli = _heli_spawn select 0;
    
// safeguard it

    _heli allowDamage false;
    _heli setcaptive true;
    // get heli's crew and assign waypoints    
    _heli_grp = group (driver _heli);
    _heli disableAI "AUTOCOMBAT";
        
    _heli_grp setFormation "WEDGE";
    _heli_grp setBehaviour "SAFE";
    _heli_grp setSpeedMode "NORMAL";

// delete all of heli crews' waypoints
    while {(count (wayPoints (_heli_grp) )) > 0} do {
        deleteWaypoint ((wayPoints (_heli_grp)) select 0);
        sleep 0.5;
    };
    
    _mvWP = _heli_grp addWaypoint [_spawn,1];
    _mvWP setWaypointType "HOOK";
    
    sleep 5;
    
// tell heli to move to and attempt to land at the destination
    _mvWP = _heli_grp addWaypoint [_destination,2];
    _mvWP setWaypointType "UNHOOK";
    
// tell heli to move to and attempt to land at the destination
    _mvWP = _heli_grp addWaypoint [_despawn,3];
    _mvWP setWaypointType "MOVE";
drowsy axle
#

Place this at the end.```sqf
supplyTimeCalled = time;

supplyTimeTimer = supplyTimeCalled + 86400;

if (supplyTimeTimer isEqualTo time) then {
startSupplyLoop = true;
} else {
startSupplyLoop = false;
};```

leaden summit
#

The supplies are spawn separately at the supplymarker and the chopper picks them up slingloads them to the drop off point and them flys away and despawns

#

OK sweet thanks. I was thinking about just adding a variable which stored the time the last drop was called and them check against that but I wasn't sure if that was the most efficient way

drowsy axle
#

Huh?

#

pastebin one sec

#

It was over 2000

leaden summit
#

Thanks

drowsy axle
#

Added the while {startSupplyLoop OR firstSupply} do { and ```sqf
// Timer
supplyTimeCalled = time;

    supplyTimeTimer = supplyTimeCalled + 86400;

    firstSupply = false;```
#

Do you understand that. Let me know if it works ๐Ÿ˜ƒ @leaden summit

leaden summit
#

Yeah sweet, thanks ๐Ÿ˜ƒ

drowsy axle
#

86400 is 24 hours in game.

#

if you want real time then do serverTime from: supplyTimeTimer isEqualTo time to supplyTimeTimer isEqualTo serverTime

leaden summit
#

Ok cool, thanks again

drowsy axle
#

np

meager heart
#

๐Ÿค”

winter rose
#

@drowsy axle isEqualTo must hit on the precise millisecond of serverTime, it's not a good idea - at the very least round it @leaden summit

#

I would use >=

leaden summit
#

It's all good I'm just using >

winter rose
#

:+1: purrfect then ๐Ÿฑ

tough abyss
#

@drowsy axle "_x" doesnโ€™t do what you think it does. You probably want typeOf _x

drowsy axle
#

@tough abyss I found that out myself ๐Ÿ˜ƒ Thanks though

still forum
#

Sorry Capwell.. Don't have time to explain EVERYTHING to you again for the dozenth time now.
Just read the wiki please. The bullshit you are trying to do in some places just doesn't make sense and the wiki tells you that

mellow obsidian
#

Im using get3DENAttribute to grab an markers Variable name

private _markerName = (_x get3DENAttribute "name");

_x being the object.
However it returns Null.
The text of the marker works fully fine.

private _markerText = (_x get3DENAttribute "text");

Somebody had this issue before?

high marsh
#

Are you sure the variable identification is just under "name" ?

ionic orchid
#

I have some script that deals with editor markers - when I reference the name of a layer I used 'name' and used 'Name' for markers

#

maybe there was a similar casing reason for that (it was a long time ago)

peak plover
#

_x is nothing in that code

#

You have to post the whole code @mellow obsidian

#

_x undefined in your example

mellow obsidian
#

Tried both Dedmen, both returning Null

    private _entities = get3DENLayerEntities _layer;

    {
        private _className = (_x get3DENAttribute "itemClass") select 0;
        private _position = (_x get3DENAttribute "position") select 0;
        private _rotation = (_x get3DENAttribute "rotation");
        private _markerName = (_x get3DENAttribute "name");
        private _markerText = (_x get3DENAttribute "text");
        _array pushBack [_className, _position,_rotation,_markerName,_markerText];
    } forEach _entities;
#

Returns everything in a good manner except "name". Name or name doesn't seems to want to work

peak plover
#

Ok

#

So that means text also works

#

can you confirm the markers are correctly showing in _array?

#

Like text from markers is there?

#

I've never used it with markers, but if the text works, then the 'name' attribute is probably just wrong on the wiki

#

what does _x return anway?

mellow obsidian
#

This is what it returns

#
[
    ["Empty",[5826.91,11569.5,83.04],[231.68],[<null>],["test"]],
    ["mil_end",[5829.02,11566.7,83.04],[91.3723],[<null>],[""]],
    ["flag_Hungary",[5832.05,11570.3,83.04],[0],[<null>],["2222"]]
]
peak plover
#

Hmm

#

this is how markers are in missionsqm

#

As an alternative

#

You can add mission sqm in your description and then config browse it

#
class MissionSQM {
    #include "mission.sqm"
};
indigo snow
#

The actual attribute is configfile >> "Cfg3DEN" >> "Marker" >> "AttributeCategories" >> "Init" >> "Attributes" >> "Name"

mellow obsidian
#

Ill try again with Name instead of name, ill show code an array in a second

#
    private _entities = get3DENLayerEntities _layer;

    {
        private _className = (_x get3DENAttribute "itemClass") select 0;
        private _position = (_x get3DENAttribute "position") select 0;
        private _rotation = (_x get3DENAttribute "rotation");
        private _markerName = (_x get3DENAttribute "Name");
        private _markerText = (_x get3DENAttribute "text");
        _array pushBack [_className, _position,_rotation,_markerName,_markerText];
    } forEach _entities;

Array:

[
    ["Empty",[5826.91,11569.5,83.04],[231.68],[<null>],["test"]],
    ["mil_end",[5829.02,11566.7,83.04],[91.3723],[<null>],[""]],
    ["flag_Hungary",[5832.05,11570.3,83.04],[0],[<null>],["2222"]]
]
indigo snow
#

_x itself is the markername, @mellow obsidian

mellow obsidian
#

Oh look at that

#

Thank you very much

mellow obsidian
#

Was looking there yesterday but im pretty sure it stated "name" then ๐Ÿค” Am I going crazy?

ionic orchid
#

Wacky, in my script I go out of my way to set 'Name' so I can read it back later (I'm creating marker entities from script), so maybe that's why it works for me

unborn ether
#

I do execute this, being in vehicle:

(moveOut player; unassignVehicle player; player action ['eject', (vehicle player)])

First time script gives me exception Error Missing ), on second execution just performs it.
What? Anyone?

still forum
#

is that even allowed?

#

semicolons inside parenthesis?

unborn ether
#

Well kinda yes:

(player setDamage 0; systemChat "healed!";)
#

Or not ๐Ÿ˜„

#

Yeah that was a reason, but behavior is still strange. Why it does it well on second time then?

meager heart
#

if the task was just kick players out moveOut player is enough

unborn ether
#

I don't remember for now why, but I know there are some situation where moveOut is not sufficent

meager heart
#

probably unconscious units...

unborn ether
#

mb can't tell now.

#

Just using this ultimate formula ๐Ÿ˜„

meager heart
#

set pos them 100% ๐Ÿ‘Œ ๐Ÿ˜ƒ

#

somewhere in vehicle modelToWorld area

#

(agl i mean)

unborn ether
#

yeah, ill get used to it.

gray thistle
#

is there a way to set a variable to not change anymore?

#
test = getplayerUID player;
#

this one will change if the player dies

tough abyss
#

It will?

gray thistle
#

yup don't know why

#

but i think it changes to ""

ruby breach
#

You could just not redefine it? Define it only once and itโ€™ll never change

gray thistle
#

ouh

#

God darn it i never used define x.x

tough abyss
#

It should not change unless you do test = ... somewhere else after player dies

gray thistle
#

Never seen the page of PreProcessor Commands
so if i do now this:

#define test (getplayerUID player);

it won't change?

tough abyss
#

Or maybe you have condition and instead of if (test == "" you wrote if (test = ""

gray thistle
#

Nah no condition i just try to store a value

tough abyss
#

Drop #define

gray thistle
#

Okay i will try it intresting sometimes things could be simple... if you find them ^^

#

hm i don't think this kind of command works with commands in arma 3 since it prints the out.

ruby breach
#

What I had meant was to assign a value to a variable (i.e, Serga_PlayerID = getPlayerUID player;) once, and from then on never change it

gray thistle
#

@ruby breach this is what i try

#

if a unit dies the getplayeruid changes to "" even if it is not looped

#

at least i think it is not

subtle edge
#

Has anyone here worked on the Antistasi map? Jets dlc messed up one of the missions.

#

I think its a path error

still forum
#

@gray thistle no it won't change

#

Variables don't magically change

#

and you didn't understand how preprocessor stuff works then

#

getplayeruid well yes...

#

but if you store it in a variable before that it won't

#

getPlayerUID is a command. Not a variable

#

And if you give it invalid arguments it will return ""

gray thistle
#

sure @still forum

InitPlayerServer.sqf

[_player] call ser_perhand_player;

ser_perhand_player = Playerpersistance.sqf

private ["_player", "_playerUID", "_playercheck"];
params ["_player"];

_playerUID = (getPlayerUID _player);
_playerside = (str side _player);

_player addEventhandler ["Killed", {
    [_playerUID, false, _playerside] call ser_fn_updateplayerlifestate;
}];

ser_fn_updateplayerlifestate = fn_updateplayerlifestate.sqf

private ["_playerUID", "_alive", "_lifestate", "_playerside"];
params ["_playerUID", "_lifestate", "_playerside"];

_mapname = worldname;
_alive = if (_livestate) then {1} else {0};

_side_to_update = switch (_playerside) do {
case "WEST": {"updatelifestateWEST"};
case "EAST": {"updatelifestateEAST"};
case "GUER": {"updatelifestateAAF"};
case "CIV": {"updatelifestateCIV"};
};

"extDB3" callextension format ["0:%1:%2:%3:%4:%5", "dcfdb", _side_to_update, _alive, _mapname, _playerUID];

[20:49:23:937463 +02:00] [Thread 14404] extDB3: SQL_CUSTOM: Error No Custom Call Not Found: Input String any:any:Tanoa:any

still forum
#

private ["_playerUID", "_alive", "_lifestate", "_playerside"]; wtf is that?

#

for one params already makes them private so most of these are useless.

#

second use the private keyword

#

[_playerUID, false, _playerside] call ser_fn_updateplayerlifestate; your two variables are both undefined

gray thistle
#

why that? they shouldn't be

still forum
#

local variables carry over into lower scopes

#

not into entirely different script instances

gray thistle
#

uhm question i have arguments defined to carry over into the fn_updateplayerlifestate.sqf why would it not work?

still forum
#

English please?

#

what third part?

#

local variables only carry over to lower scopes

#

Or maybe easier to understand. Scripts that are executed right there and then

#

the eventhandler is not executed there

#

You add code that might execute some time in the future. But at that point your local variables are loooong gone

#

(str side _player); why do you turn that into a string and then compare the string?

#

why not compare the side directly?

gray thistle
#

limitations in the database

still forum
#

What?

#

no..

#

You are not passing that thing to the database

gray thistle
#

there was a reason for that or i was not that far with the logic... but okay this is how i do that right now will probalbly change that then.

back to the arguments:

[_playerUID, false, _playerside] call ser_fn_updateplayerlifestate;

i still don't know why they would not carry over like that

still forum
#

I already explained why

#

read it again then

gray thistle
#

so the eventhandler itself is a diffrent script?

still forum
#

yes

#

How else would it not be?

gray thistle
#

even though the arguments are in the same files?

still forum
#

Does your script freeze till the eventhandler executes?

#

no.

#

Files don't matter at all

#

Scripts can be distributed over hundreds of files and they can all see the variables

#

Or in just a single file and not see it

gray thistle
#

That's what i call a mindblow...

still forum
#

logical thinking :u

gray thistle
#

i thought till now it would carry over like in IFs

gray thistle
#

but yes it makes sense also i compared eventhandlers to spawns...

still forum
#

yes

#

that's the same thing "roughly"

gray thistle
#

but in spawns i can give over the values because they are executed at the point...

#

shit i have to do a lot of rethinking

still forum
#

no they aren't

#

no you can't

gray thistle
#

i did that once with this

{
            //_x addEventhandler ["Fired",{diag_log "ToT"}];//
            //_x addEventhandler ["Deleted",{hint "Gelรถscht"}];//
            [_x] call ser_fn_insertmine;
            hint format ["Gesetzt %1", _x];
            [_x] spawn {params ["_mine"]; waituntil {sleep 1; not alive _mine};systemchat "DEAD";
  }foreach _updated_mines;};
still forum
#

[_x] spawn {params ["_mine"];

#

They don't carry over

#

you are passing a copy of them into the spawn

#

which then takes it and passes it through as _this variable

gray thistle
#

wouldn't arguments then be useless in these cases? this is what i don't get :/

still forum
#

useless?

#

why? what?

#

which case?

gray thistle
#

This is what happens if you work complete alone on a Project without a clue of anything but you try to get things right for other peoples to have fun...
I don't even understand you right now at least i know now that it does not work as i thought it would.... Frustrates me right now...

worthy phoenix
#

Can you make the wind in ArmA 3 more than 110 somehow?

still forum
#

110? km/h?

worthy phoenix
#

Yeah.

still forum
#

that's not enough?

#

I don't know of any limit

worthy phoenix
#

Ahh, that worked, I was looking at things that had similar command name but only had a value between 0 and 1.

gray thistle
#

anyway thanks @still forum for the information i may have to rethink a lot now

still forum
#

One of our weather mods was bugged and steadily increased wind... Snipers weren't happy

meager granite
#

Sending infinite numbers into weather commands used to produce interesting results in both OA and A3 back then. Discovered it after skipTime'ing infinite number due to bug, world turned black and white, some other command resulted in sky blinking black and white each frame.

#

Before numbers were split up into numbers and nans

#

Good thing cheaters didn't know of this, nuking server like this could've killed an epileptic or something

meager granite
inner swallow
#

has scipting gone to far?

still forum
#

I like it

#

Now that NaN and Inf are special... What is the highest possible non NaN number we can plug into that ๐Ÿค”

drowsy axle
#

Good thing cheaters didn't know of this, nuking server like this could've killed an epileptic or something - Damn... that's some nasty shit.

#

Is it possible to have a vehicle shown as true/false with alive. Or does that only apply to units?

ruby breach
#

It works with vehicles

drowsy axle
#

Oh right. @ruby breach Thanks

#
[] spawn {
    _veh = [
        plane1,plane2,plane3,plane4,c130_ussFreedom,
        air1,air2,air3,air4,air5,air6,air7,air8,air9,
        car1,car2,car3,car4,car5,car6,car7,car8,car9,car10,car11,car12,car13,car14,car15,
        truck1,truck2,truck3,truck4,truck5,truck6
    ];
    {
        _vehType = typeof _x;
        _vehName = getText (configfile >> "CfgVehicles" >> _vehType >> "displayName");
        _vehPos = getPos _x;
        _mark = str _x;
        _alive = "ColorWEST";
        _destroyed = "ColorBlack";

        while {true} do {

            _mark setMarkerPos position _x;
            _VehDam = getDammage _x;

            sleep 1;

            if (_VehDam isEqualTo 0) then
            {
                _mark setMarkerColor _alive;
                _mark setMarkerText _vehName;
            } else {
                _mark setMarkerColor _destroyed;
                _mark setMarkerText _vehName + ": Destroyed";
            };
        };
    } forEach _veh;
};```
ionic orchid
#

shouldn't your forEach be inside the while, instead of the other way around

#
[] spawn {
    _veh = [
        plane1,plane2,plane3,plane4,c130_ussFreedom,
        air1,air2,air3,air4,air5,air6,air7,air8,air9,
        car1,car2,car3,car4,car5,car6,car7,car8,car9,car10,car11,car12,car13,car14,car15,
        truck1,truck2,truck3,truck4,truck5,truck6
    ];
    while {true} do {
        {
            _vehType = typeof _x;
            _vehName = getText (configfile >> "CfgVehicles" >> _vehType >> "displayName");
            _vehPos = getPos _x;
            _mark = str _x;
            _alive = "ColorWEST";
            _destroyed = "ColorBlack";


            _mark setMarkerPos position _x;
            _VehDam = getDammage _x;

            if (_VehDam isEqualTo 0) then
            {
                _mark setMarkerColor _alive;
                _mark setMarkerText _vehName;
            } else {
                _mark setMarkerColor _destroyed;
                _mark setMarkerText _vehName + ": Destroyed";
            };
        } forEach _veh;

        sleep 1;
    };
};
#

something like that

drowsy axle
#

Ahhh yeah. silly me

#

Thanks @ionic orchid Works now

ionic orchid
#

awesome

#

I love it when things work

#

doesn't happen enough

drowsy axle
#

Nope

#

It doesn't

drowsy axle
#

@ionic orchid Slight problem... the _mark setMarkerPos position _x; doesn't follow the vehicle once moving..

ionic orchid
#
_mark setMarkerPos _vehPos;
#

try that (since you're not using it

drowsy axle
#

Oh ffs xD

#

Changed it @ionic orchid Still doesn't work.

sturdy cape
#

Hi.i have a vehicle Locking script that allows a player to claim 3 vehicles, using for "_i" from 0 to 4 do { _ctrl = _display displayCtrl (2100+_i); _index = lbCurSel _ctrl; if(_index == -1) then { _code pushBack -1; } else { _code pushBack parseNumber(_ctrl lbText _index); }; }; well but where is this saved to and how to reset? Seems persistent over restarts

#

@drowsy axle
However to answer yours.use a loop with a sleep.

still forum
#

@hasty violet I can't see it

meager granite
#

@sturdy cape Only some displays reset when switching games\missions, I guess you're using some global display to store your stuff

round scroll
#

is there a way to see the JIP remoteExec queue? I guess if you go wild on JIP it can severely slow down if not completely void the JIP process, or?

still forum
tough abyss
#

@round scroll depends on what you need JIP for and how you implement it. You donโ€™t need to make every little thing persistent with own JIP message, you can probably combine most local changes to execute all together from 1 JIP message.

round scroll
#

@tough abyss agreed, it's not my mission, I've been asked to look after it as the JIP is not working and the player gets booted back to main menu. I've checked some function and saw that remoteExec with JIP flag is all over the place. The exportJIPMessages function seems like a good first way to get a feel for the situation.

sturdy cape
#

@meager granite thanks.ive decided to set a persistant variable on those vehicles instead.

tough abyss
#

@sturdy cape Not sure if you noticed but for _i from 0 to 4 will run 5 times not 3

sturdy cape
#

Doesnt matter anyways now.but.thank you

rustic pendant
#

Does the amount of scripts running in a server impacts the FPS ?

tough abyss
#

Yes it certainly can do depending on how they run

polar folio
#

can't test right now but do you guys think a locally spawned (createVehicleLocal) bullet object would do damage to a remote unit?

still forum
#

@open vigil ^

#

@polar folio yes

#

Hit simulation is done locally

#

and you client just tells the other "hey I've just hit you for this much damage"

polar folio
#

well that's great news. thx for the info!

still forum
#

the other client doesn't even have to know what hit him

polar folio
#

i figured as much since it works like that in many games afaik at least.

high marsh
#

@polar folio No, from my understanding damage isn't done locally in many games.

still forum
#

correct. In most games it isn't

#

one of Arma's flaws

#

@tough abyss where did you get that fact from?

tough abyss
#

HitPart EH is basically how it works

#

@still forum Tested just now on dedi

still forum
#

You tested the EH?

#

or you tested creating a local projectile and giving someone a headshot with it?

tough abyss
#

No the local object

still forum
#

The server belives anything you tell him. If you tell the server you've just given someone a headshot, the server will believe you. Even if it never saw a projectile or you shooting

#

Yes you can create projectiles with createVehicleLocal

#

that's exactly what ACE frag is doing.

#

And it works

tough abyss
#

Frag or bullet? Explosions are global

still forum
#

frag

#

Like.. splinters

#

they are essentially bullets

tough abyss
#

Have they got class names?

still forum
#

Yes

#

CfgAmmo

tough abyss
#

Then they are not bullets

still forum
#

What?

#

Bullets are also CfgAmmo classes

#

You mean bullets are not bullets?

#

They are subclasses of 65x39 bullets

tough abyss
#

Ah yeah my bad they are

lusty canyon
#

bullets coming out of grenades reminds me of 762 high calibre

tough abyss
#

Frags are simulated differently afaik

still forum
#

the actual grenades are yes

#

but we were not talking about that

tough abyss
#

Yes I take it back, script created local bullet does kill remote unit

#

Doesnโ€™t even have to be in the same frame as original bullet

tropic orbit
#

does anyone have a script for invade and annex?

drowsy axle
#

@sturdy cape I am using a sleep within the while loop

tender fossil
tropic orbit
#

thanks dude

#

and how would i install this ?

#

@tender fossil

#

nvm ill follow the steps

fierce ingot
#

Does setskill work with numbers greater than 1?

#

this is regarding AI

spring stone
#

Hey, I have a question:

I have an array of weapons. Now I want to have an Array of all Attachments or all magazins of each of these weapons.
Is that somehow possible?

(Basically I want an ACE Arsenal with a selection of weapons and all compatible magazines and attachments)

peak plover
#

You mean the ones that fit ?

spring stone
#

Yes

drowsy axle
#

Do you know how to link a chat, in discord.?