#arma3_scripting

1 messages Β· Page 212 of 1

winter rose
#

iiis your helicopter attachTo something?

granite sky
#

For publicVariables it is allegedly ordered. Although I'm not sure if that matters in any context.

blissful current
#

Make sense but why is it smooth when humans fly but not when AI flies?

blissful current
winter rose
granite sky
#

How are you observing this helicopter?

winter rose
#

quantic waves, obviously

granite sky
#

Stuff far from the camera gets fewer updates.

blissful current
#

From inside the heli. I can watch the AI's input to the flight stick and it's like they are having a seizure.

#

But if you set the group ownership to a client (that you want it to be smooth for) their inputs are smooth as butter. There are never any issues with SP or localhost.

granite sky
#

Your unit is one of the heli passengers?

blissful current
#

Yes.

#

Saying this out loud makes me think like Hypoxic said; that the AI's inputs to fly the heli just aren't updated very much over the network.

#

So when it does get updated it looks hitchy.

granite sky
#

I don't remember being flown by AI on DS looking that bad. Did it at the end of Escape missions at least.

blissful current
#

I've tested this issue to be true on a dedicated server as well. I've been able to reproduce it in vanilla ARMA, and the SOGPF Campaign.

#

Certain situations can make it worse, like if the heli is flying close to the ground with elevation changes. Basically, the more inputs the AI has to process, the more obvious the issue will be from the client's perspective.

I'll post a video that will make it more obvious what I am saying.

granite sky
#

oh, that might be normal then. IIRC AI flying input rate is only 15 ticks per second.

#

Although that's the same locally, so I guess it's not that.

#

Probably just not enough network updates compared to manuver rate.

#

Helis can change direction pretty fast

hallow mortar
#

It looks like the AI is making lots of very rapid inputs (you can see the stick vibrating even on the machine where the AI is local) and the network interpolation is magnifying it (state is captured with a down input, no update for a frame or ten during which the client assumes they continue holding the down input, state is updated with an up input, etc.)

#

I doubt there's anything you can do about it

#

It's probably more or less obvious depending on how rough the terrain is that the AI is trying to follow, as well as the agility of the helicopter (twitchy inputs make less of an impact on the helo if it's super fat and takes a long time to respond)

#

You won't see it with human players because human players maintain attitude by putting the collective in one place and holding it there, whereas sometimes the AI maintains attitude by flinging the stick full back and forward 50 times per second

blissful current
#

I tried to replicate the pitch adjustments when testing with human pilots and couldn't get it to act up. Maybe cause I wasn't doing it 50 times a second. I might test it later with a second person to make it easier to test but like you said I think I've hit a wall here.

blissful current
#

Does this look okay? It seems to disable the radio subtitles on the localhost but not the client.

[false] remoteExec ["enableSentences", 0];
dark viper
#

still looking for an answer on this

pallid palm
#

@dark viper sorry m8 im at a loss for this

#

lol the Drug Lab has a bunch of Crack house's around it lol

sharp stag
#

Hey guys, dunno what the best chat for this would be, but feel free to point me in the right direction. Just wondering if anyone has ran into this issue before and found a fix. No matter what mod I use (simplex legacy or dev, Drongos Air Ops, or hermes air lift services) whenever a helicopter is given a waypoint that makes it turn its engine off (for example RTB'ing). It will land as its supposed to, but then it no longer will respond to any waypoints its given. Anyone ran into this before?

fair drum
# dark viper still looking for an answer on this

I use a central location, then based on that location I grab the relative objects and their vectors around it and save my data (you'll have to use Eden commands/objects, normal object grabber commands don't work). I then reverse it while in game. It's not simple if you are newer to scripting.

granite sky
#

What waypoint makes it turn its engine off though?

dark viper
#

i guess you do what you said but backwards

#

yeah I would have no problem doing it that way, just wondering if compositions was possible to make it eassier

dark viper
#

I don't know how to do the 3DEN commands if you have an example

#

never used editor commands

tulip ridge
#

What are you trying to do exactly?

upper path
#

Hi all, I never wrote a script before(outside of fooling around with HTML in VSC) where would I start on building a script for an "black out" for a 300mX300m meter area for lighting in the area or anything that gives off a light source for a night ops?

dark viper
#

like a group and the unit locations to spawn again later i imagine

#

I know how to do it without 3DEN but he piqued my curiousity now

sharp stag
granite sky
#

Ah, well. You'd have to look at their scripts.

#

But I can tell you that in some of those cases Arma AI does not turn the engine back on when given a waypoint.

#

And also that it depends on the heli class :P

hushed turtle
dark viper
#

im interested in how he uses the 3den commands specifically as I have not used them

granite sky
carmine sand
# sharp stag For example RTB in simplex or Egress in Drongos Air Ops. with those ones they la...

You could fake it a bit with giving a regular waypoint (on Activation) or a trigger (on Activation) and heli1 setFuel 0, it lands on best given position or closest helipad. When next waypoint is given you give it fuel back with heli1 setFuel 1. It wants to keep engine on but is not able cause of no fuel. But you got to test it and this way is not sure if it works, sometimes some fake tricks are needed for AI

pallid palm
#

All chopper " Taxi, Extraction, and RTB" Ops can be fixed: or solved: if you take a look at my Chopper Command files: all you Need to do is PM me: and i'll send you the Demo mission

#

like i said before: i have been working with chopper movements: in Arma 3: for a long long time: it seems like my whole life: lol πŸ™‚

#

well not just Arma 3: all the other Arma's before that as well

#

man i remember the choppers in OFP man they really flew Awsome

#

i wish they kept the flight characteristics for choppers from OFP: and put them in Arma 3: they flew Awsome

#

i could stop on a dime: moving a 300mph: with the choppers from OFP πŸ™‚

#

well maybe not that fast but you get what i mean πŸ™‚

delicate tangle
#

Can you use the teamswitch eventhandler to transfer support modules when a unit is switched?

delicate tangle
#

I thought I has but apparently remote control may be different from teamswitch for the eventhandler purposes.

winter rose
#

oh yeah, modules take their sync at the beginning of the game and that's it

fair drum
winter rose
#

afaik

little raptor
winter rose
#

OFP helicopters also maintained their ground altitude πŸ˜„ your UH60 would rise/dive according to terrain below πŸ˜‚

plucky lava
#

Sorry for the sudden drop, I have been trying my best to find the solution but to no avail.

private _duration = 3;

private _end = time + _duration;

while {time < _end} do {

    {
        private _unit = _x;
        private _target = selectRandom _targets;
        [_unit, _target] remoteExec ["doSuppressiveFire", 2];
    } forEach _Ga;
};
sleep 2 + random 2;   // delay between bursts```

Does anyone know what I can add for the gunner to cycle through targets in short bursts?
errant jasper
# winter rose afaik

That matches my investigations years ago. (BIS) modules grab the object instance on (or shortly after) initialization. But,

  • JIP units are not synced to the modules, only units present on proper mission start, so even if the module was coded differently it wouldn't work.
  • On respawn the editor name is actually updated to point to the newly spawned player object, however, the module has already chosen its object reference (which is now not alive).

I remember writing off BIS Task modules, and in general any kind of module syncing with player objects because of this limitation. Even if my own modules would "resync", they would be unable to for JIP players. Now this was years ago, so things may have changed.

winter rose
errant jasper
#

Yeah, I believe it was Moricky himself that "implied" in his answer on the issue tracker that it not a bug per se so no changes would be made.

thin fox
#

Hello. Is there a specific command to remove/unassign weapons accessories/attachs?

hallow mortar
#

removePrimaryWeaponItem and relatives

delicate tangle
#

I have a script (not written by me) which loops, checking if the player has changed and then re-assigns support modules. Is there a way to make that script either a trigger radio call or tie it into the teamswitch eventhandler?

half jolt
#

Hey, I was wondering if an execvm can be given a different name when hovering over the object that has the execvm, like you can with addAction.

pallid palm
#

i use a radio a trigger to assign Support modules, but i never tried it with Ai: i only used it on players

#

i guess you could as long as you had that Ai's name in the trigger call to assigen that Support module to that playable Ai: imho

#
Support1 synchronizeObjectsAdd [p1,p2,p3,p4];  //and so on
#

i don't use a EH for this

hoary saddle
#

anyone familiar with Hearts and Minds. Where do you put the "btc_custom_loc" at?

sterile arch
#

Ok i need help. How do i get a helicopter to take off from a ship with passengers, pick up cargo, and then drop off both at a specific point and after that (depending if the helicopter has survived) return to the ship

dark viper
thin fox
sterile arch
blissful current
#

I'm making a conversation script that will select a convo to play based on what happens in the mission. How does this look so far?

if (_allPrimary) then {
    // intial greet convo
    if (_powFound || _pilotFound) then {
        if (_powRescued) then {
            //pow saved convos
            if (_allSecondary) then {
            };
            if (_someSecondary) then {
            };
            if (_noSecondary) then {
            }; 
        } else { 
            // pow dead convos
            if (_allSecondary) then {
            };
            if (_someSecondary) then {
            };
            if (_noSecondary) then {
            };
        };
        if (_pilotRescued) then {
            //pilot saved convos
            if (_allSecondary) then {
            };
            if (_someSecondary) then {
            };
            if (_noSecondary) then {
            };
        } else {
            //pilot dead convos
            if (_allSecondary) then {
            };
            if (_someSecondary) then {
            };
            if (_noSecondary) then {
            };
        };
    } else {
        // standard convos if pow and pilot were not found
        if (_allSecondary) then {
        };
        if (_someSecondary) then {
        };
        if (_noSecondary) then {
        };
    };
};
dark viper
#

it's a lot of if elses, it is what it is

#

how else to do a bunch of scripted conversations, I can't think

#

imo it would make more sense to just use the numbers of things rescued than 3 different boolean values

#

also, if you're not making completely different conversations (keeping the order and flow the same) you can just put it all in the function and do your checks when it comes to that conversation line. With this you're going to copy paste the same conversation repeatedly with only a small difference

while in the other way your conversation plays and each line is determined by a check and you don't have to duplicate in different code blocks

#

hope it makes sense

#

i'm not sure how one would do this in conversations and sentences config but i'm sure it's possible

dark viper
#

knew i was forgetting something

blissful current
# winter rose FSM!

Is the FSM a script or a separate piece of software in the ARMA 3 toolset?

sharp grotto
#

FSM editor in the arma tools

winter rose
dark viper
#

i know about conversations but can you control the flow with some logic in the config or you do need to make an fsm?

winter rose
#

the conversations system uses FSM, that or you can trigger sentences manually with e.g kbTell

dark viper
#

i dont remember seeing example of control flow for conversations in the wiki but yeah that's what i was wondering

blissful current
winter rose
#

hmm Conversations can only deal with one conversation at a time, iirc?

#

so in MP it might be trouble if multiple conversations can be started at once

#

but you can use FSM without Conversations

blissful current
#

Yeah that might have been it. Okay but you are saying that FSM is independent of Conversations.

winter rose
#

yeah you can use FSM without Conversations and vice-versa

winter rose
blissful current
#

Oh boy... how uhhh... complicated is this gonna be?

sharp grotto
#

not at all, search for flow state machine, general concept. lots of explanation available

winter rose
#

it's "visual scripting" in a way, see blocks as "code blocks" and the whole file as "one script"
junctions as if/else/switch leading from one to another block

blissful current
#

Actually better question, what is the time investment to learn this program? I'm OK with days but months would be another thing.

winter rose
#

is e.g _allSecondary (_powRescued only) the same as _allSecondary (_pilotFound only)?
I wonder, what is your actual script need?

blissful current
sharp grotto
#

If the dialog is not too complex / deep choice trees etc, you can just be lazy and if(_condition) exitwith {//dialog code}; instead of the if then else chain.

blissful current
#

Lots of stuff can happen in the mission so right now I have a bunch of if/else trying to cover it all but its hurting my brain.

winter rose
blissful current
#

Each if statement will result in a different convo, even if they are a little similar. These are audio files that play if that matters.

winter rose
#

ah. mind to break the sentence into smaller bits? this could save you work eventually ^^

blissful current
winter rose
#

yes, like "you did all the side tasks. outstanding!" "unfortunately, the pilot did not make it." "the POWs are back home thanks to you!"

#

if you make the connections "generic" enough, it can feel human enough

blissful current
#

So can all this be achieved with FSM?

winter rose
#

yesss

blissful current
#

I'm guessing once you build the FSM you can call it like you do a function? So I would put that in the addAction code?

winter rose
#

or script ^^

#

you can directly call the fsm with "fileName.fsm" iirc edit: nope

blissful current
#

So the FSM is basically a visual representation of the code in my if statements? What is the advantage here?

sharp grotto
winter rose
# blissful current I'm making a conversation script that will select a convo to play based on what ...
if (!_allPrimary) exitWith {};

private _sentences = ["greetings"];
if (_powFound || _pilotRescued) then
{
    _sentences pushBack (["powLost", "powSaved"] select _powFound);
    _sentences pushBack (["pilotDead", "pilotSaved"] select _pilotRescued);
}
else
{
    _sentences pushBack "nobodySaved";
};

switch { true } do
{
    case _allSecondary: { _sentences pushBack "allSecondary"; };
    case _someSecondary: { _sentences pushBack "someSecondary"; };
    case _noSecondary: { _sentences pushBack "noSecondary"; };
};
winter rose
blissful current
winter rose
#

yes, it's an array filled with strings (just in case you wanted to use kbTell or something
you can use say in there if you want!

blissful current
#

Oh so what happens here? The array collects strings and when it's done then I can play a sound file based on what strings the array contains?

winter rose
#

yes, you could do then foreach + kbTell on that array

blissful current
winter rose
#

nonono

#

if you use say its effect is global, so don't remoteExec it e_e

blissful current
#

I'm using say3d.

winter rose
#

say is local

#

and so is say3D… I really didn't use SQF for a while now @_@

blissful current
#

No worries! So I guess I need to replace _convo with the strings in the array. I understand the idea but not how to implement it.

#
{
    [_x, [_caller, ranger], true] remoteExec [
        "FoxClub_fnc_Conversation",
        allPlayers select { _x distance _caller <= 100 }
    ];
} forEach _sentences;
winter rose
#

I would have only the server run this function*, then remoteExec say instead

#

this way, one head, one decision, spread through the network

modern plank
#

Is there any limitation while using missionNamespace getVariable from scheduled spawn {} script exec? It looks like it fails to see the variables from the unscheduled world, or am I misunderstanding something?

modern plank
#

Maybe I should pass as param my variables....

winter rose
hallow mortar
# modern plank Is there any limitation while using `missionNamespace getVariable` from schedul...

It can get variables if they were in fact global scope variables. Local scope variables (prefixed with _) are not accessible outside the scope they were created in (and there'd be no way to do it anyway, because there could be many local variables with the same name across all the scopes active in the game)

myVariable = 1; // accessible with missionNamespace getVariable "myVariable"
_object setVariable ["myVariable", _someVar]; // accessible with _object getVariable "myVariable"
_myOtherVariable = 2; // not accessible with getVariable```
Scheduled vs unscheduled doesn't make any difference to variable availability.
modern plank
#

Ya, so my issue is coming from somewhere else. Thanks!

blissful current
# winter rose you all good then?

Making progress thanks! The forEach makes all the strings play their sound file at the same time so I put a sleep 10; inside the forEach which resolved it but some files are longer/shorter than others. So now I have an idea to use a waitUntil the function is done:

{
    waitUntil {!(missionnamespace getVariable ["foxclub_var_isTalking", false])};
    [_x, [command, testUnit], true] remoteExec [
        "FoxClub_fnc_Conversation",
        allPlayers select { _x distance command <= 100 }
    ];
    //sleep 10;
} forEach _sentences;
blissful current
#

I looked up the BIKI and it says the only difference is say isn't 3d for cutscenes. So I figured no need to change it.

winter rose
#

because command (commander I assume) cannot say all at once, normally. you could pile all say commands and the commander will say them one by one (as long as there is a sound file to play ofc)

blissful current
#

Same for say3d apparently.

winter rose
#

so why do you need a delay, are you using something else?

blissful current
#

Ah! because there is a response from the boss. It's a convo between two. Like this:
"Ready for debrief sir"
"Ok, lets hear it"
//need pause else these two play at once
"We got the bad guy"
"Excellent work"

But now that I type this out I dont need a response until the _caller is dont talking maybe.

winter rose
#

aaaaaah, then OK, yes it's needed if there is a back and forth

#

I believe this can do!

if (!isServer) exitWith {};

if (!_allPrimary) exitWith {};

[theCommander, "greetings"] remoteExec ["say"];
sleep 8;

[leader playersGroup, "greetingsToo"] remoteExec ["say"];
sleep 10;

private _sentences = [];
if (_powFound || _pilotRescued) then
{
    _sentences pushBack ([["powLost", 10], ["powSaved", 12]] select _powFound);
    _sentences pushBack ([["pilotDead", 11], ["pilotSaved", 15]] select _pilotRescued);
}
else
{
    _sentences pushBack ["nobodySaved", 14];
};

switch { true } do
{
    case _allSecondary: { _sentences pushBack ["allSecondary", 9]; };
    case _someSecondary: { _sentences pushBack ["someSecondary", 10]; };
    case _noSecondary: { _sentences pushBack ["noSecondary", 11]; };
};

for "_i" from 0 to (count _sentences - 1) step 2 do
{
    [theCommander, _sentence select _i] remoteExec ["say"];
    sleep (_sentence select (_i + 1));
};
blissful current
#

What does this do:

for "_i" from 0 to (count _sentences - 1) step 2 do
{
    [theCommander, _sentence select _i] remoteExec ["say"];
    sleep (_sentence select (_i + 1));
};```
winter rose
#

all the sentences + delays stored in the array, say them, and wait

#

instead of the _sentences array being full string e.g ["pilotDead", "allSecondary"] it is [["pilotDead", 11], ["allSecondary", 9]] so "sound" + duration

hallow mortar
#

Shouldn't it use forEach _sentences and then select 0, select 1 from _x then, if they're paired?

winter rose
#

oof, yes, I should get some sleep e_e

blissful current
#

How does it know duration or I assign those?

winter rose
winter rose
#

although… if no more chat from the leader, you can get rid of them

hallow mortar
winter rose
#

but yeah, structure-wise it's a bit cursed πŸ˜„

#

@blissful current replace pushBack with append and it should make a flat array of "string", duration, "string", duration etc

dark viper
#

conversation would be better right

fair drum
#

javascript always creeps into everything πŸ™
say no to flat arrays

@dark viper i'm back home, so let me write something up. how in depth do you want it

dark viper
#

can you change the pausing in conversation cfg?

dark viper
dark viper
#

you're saying you can use 3den commands to get data for later right?

winter rose
blissful current
#

I don't understand why this won't pause the function call, I turn on the variable at the start of the function and off at the end:

{
    waitUntil {!(missionnamespace getVariable ["functionOn", false])};
    [_x, [command, testUnit], true] remoteExec [
        "FoxClub_fnc_Conversation",
        allPlayers select { _x distance command <= 100 }
    ];
} forEach _sentences;
winter rose
#

SQF is… sliced-synchronous

dark viper
winter rose
#

yes

dark viper
#

theres no asynchronous functionality at all in scripting is there

winter rose
#

yep – just that 3ms thing

fair drum
# dark viper you're saying you can use 3den commands to get data for later right?

yeah, so objects in the 3den editor are not traditional objects like you see in the actual game. data (like position and direction) isn't stored in an actual object until initialization. so we have to use 3den commands and attributes to pull the data. We will mainly use

get3DENSelected to gather the objects
get3DENAttribute to gather the data such as "position" and "rotation" and "ItemClass" so that we can modify it to relative position and direction

you can then export this as a hashmap or array (even format - as a big string - it before copy to clipboard for easy vscode pasting)

now you have a data hash that has the class name of the object, the relative position, and its relative direction that we can now build objects in game dynamically using createVehicle or whatever

dark viper
blissful current
fair drum
winter rose
#

@blissful current I'm off for the night, LMK if more halp is needed! (…in about 8h yes ^^) g'night!

fair drum
#

I could actually build something similar for 3DEN Enhanced if you'd take it @cosmic lichen

dark viper
fair drum
#

you'd use copyToClipboard to save it as a string so you can paste it in your code editor for later mission use

dark viper
#

this is a weird workflow but i will come to appreciate it

dark viper
#

i wish there way a way to directly use waypoint objects

fair drum
dark viper
#

i understand

#
        ["light_r", [4.08691,2.9585,-1.1]],
        ["light_l", [-4.16309,2.93945,-1.1]],
        ["platform_rear", [0.0258789,-1.08105,-3.34349]],
        ["platform_front", [0.0263672,0.800293,-3.34282]

is this positions?

fair drum
#

yeah, relative positions based on the center

dark viper
#

in game how would you place this composition

granite sky
#

Although there are ways of writing state machines in plain SQF that aren't too unreadable.

#

The concept of having clearly defined states that you transition between is pretty useful in general.

fair drum
# dark viper in game how would you place this composition

well you need to get the object classname. I chose to store my data differently in the mod example, but there's nothing stopping you from doing something like:

[
  // [objNum, [class, pos, dir]]
  [0, ["centerPosHeliPadClassHere", [0,0,0], 270]],
  [1, ["firstObjectClassname", [1,1,0], 73]],
  // etc
]

then you could iterate through this doing something like:

// somthing that runs in game
{
  _x params ["_objNum", "_data"];
  _data params ["_class", "_relPos", "_relDir"];

  private _obj = createVehicle [_class, _relPos];
  _obj setDir _relDir;
} forEach _myData;

really up to you how you want to structure it. could do a simple array, or a more descriptive array like above, or a hashmap. whatever you want

dark viper
#

thats what i figured

fair drum
#

basically, I'm just telling you how to get the data, which would be with 3DEN commands instead of your typical object commands

#

if you get stuck, post and I can refine

#

i'll write up a version for 3DEN enhanced so that others can use it too. its not a rare question.

dark viper
#

yeah i use 3den enhanced

hallow mortar
#

Just replace units group area_3 with [turret_1, turret_2, turret_3]

cosmic lichen
pallid palm
#

what the hell holy shit πŸ™‚

modern plank
#

Question about the locality of allMapMarkers, I am placing new markers on map but the server does not see them.

#

No locality specified, is there a means to make markers global?

#

Ok, I am using SWT Markers, looks like I need to read swt_markers_allMarkers_params to get the ones I placed.

little raptor
#

which probably means they're not markers but rather icons

dark viper
#

i read your doc and didn't find anything about debugging in therre

fallen locust
#

execVM has no UI component

still forum
#

private makes the code faster. Even if its spawned code.

#

It will yes. It only cares about the \ separator. You can even have emoji's in path if you want.

#

We need a un-animated Arma version of that and turn it into a Discord sticker

#

TGA is not.
.pac, .paa, .ogg, .ogv, .jpg, .jpeg

Please don't use .pac and .ogg though that's nasty.

still forum
#

The sinking happens in the renderer. Most of the engine doesn't even know that it happens.

#

There are two mines.
There is a vehicle which is the "defused" variant, it is inert, doesn't do anything besides laying around.
And a projectile, which is a thing that can fly around and explode and do damage, in the mine case it doesn't fly around.

createVehicle creates a vehicle, not a projectile. That's why second command. createMine will actually spawn a APERSMine_Range_Ammo projectile

#

The engine has 3 binary (2 arguments) isNil commands.

One takes left side ObjectOrGroupOrDisplayOrControl
The other takes left side Namespace
The last takes HashMap
But Location is a different typeName, different type in engine. That was simply forgotten when that syntax was added. Could be fixed, but I don't wanna do it right now

Oh I see in code, there is already a #TODO on it saying exactly what I was thinking of doing.
Looks like I wrote that one.. Someday, surely.

#

No. typeName location is "LOCATION", not "OBJECT"

#

Arma file system is case-insensitive.
It solves that by forcing everything to lowercase internally.

#

Generally something like
_x = call {_a = 2;}

the called function does not return any value, and its then tried to be assigned to _x, but you can't assign nothing, error.

#

I have not seen that with a FSM. But the FSM itself could contain script code that does that?

#

You have no control over the JIP queue to enforce that.
You can just try to be the first publicVariable that runs on the server (like in the servers mod's preInit).
If you then don't modify it again, it will stay at the start of the JIP queue and be the first received by the client.

#

The client will get all your functions if they crash their game and create a memory dump.

#

Cybersecurity is crying out for you.
Security through obscurity is not a good approach.

#

SQF script is not compiled stuff.
It is actually.

With SQFC you could send over only the compiled code without the source code. But that is not officially supported and I can break that any time. And it can still be reverse engineered (if you are able to read SQF assembly)

#

He did literally say "server mod"

tulip ridge
#

I'm basing that off of "with all the data hidden from the user, in mission files" from your message

If that's incorrect, then the message didn't really make that clear

still forum
#

Uh putting that into the mission file is a neat idea. I have not seen it like that before.
Cool use of has include πŸ‘

#

Wow see Ms scripting professional here knowing whats dumb even though they have no idea. Bravo πŸ‘

#

HTTP mission download will make that faster btw. But also repeatedly downloading missions is bad for SSD's so best if avoided indeed

#

Since 2.20 we have compression support.
With this approach the function content could be transmitted compressed, and then let the client unpack it. A bunch of text should compress pretty well

#

If you do the compression approach and compile on client, you can also easily do this.

last cave
#

Who connected the neural network to Dedman? It answers questions like a machine gun.

still forum
#

A client that JIP joins, will also load the whole mission file mid-game. Not much difference there.

#

Huh? functions library does performance optimization? What exactly and since when?

#

JIP will execute in-order. And notably all remoteExec's come in a second queue after the main one.

last cave
#

I was actually thinking about using the config classnames to create a hashmap in the server mod and send players the prepared data from the config, so there would be no need to change the config in mission when there is config data that changes frequently. This could certainly be done with a simple script with arrays, but it's somehow more convenient to write and add things through the config.

still forum
#

What do you mean? The JIP queue is a queue, why would we not?

errant jasper
last cave
#

Someday we'll get to the point where, when downloading a mission, the player will only have mission.sqf and description.ext , along with sound and image files. The mission itself will be jam-packed with content.

still forum
# dark viper how else to do a bunch of scripted conversations, I can't think

Implement own node-graph system 🀣
I built a node-graph dialogue system once, the whole processing was scripted (just the file loading from config was in engine)
It had conversion/import from "Articy: Draft" tool. The conditions would be scripts and the dialogue nodes would be converted, with text-to-speech on top for the audio output.

It would probably not be too hard to write something like that in SQF. Articy: Draft outputs a JSON file. You just need to convert that, and set up a scripted node-graph structure, which is pretty easy now with hashmap

But its alot of work ahead, not worth to just use it once.
Only way branched dialogue makes sense to me is in a node graph.

We need a new better/more modern FSM editor, maybe something browser-based 😍
Ah how nice it would be to have unlimited time.

last cave
#

So many years have passed, and the game's interface is still square and rectangular. Finally, we have a workaround in the form of an HTML interface element, which, according to those who have used it, isn't the most stable or performant.
πŸ˜„

#

By the way, why can't you add the ability to add fonts to missions? Are they compiled directly into the engine when the game launches?

still forum
# tulip ridge

But thats not a Arma version.
It needs to be a bit Arma-y to make it a Arma sticker

tulip ridge
#

Yeah I realized after I sent it

still forum
still forum
still forum
thin fox
#

Lou summoned

still forum
last cave
#

As far as I remember, either there is simply a command or the server administrator's command can output all remote calls to a file

winter rose
errant jasper
# still forum I don't see why it would say that. new remoteExec's are added to the end of the...

Just reading that Red Warning box as-is I say it voids "queue semantics". Well it would be nice to know for sure or have the wiki be more accurate if that statement is wrong (have the warning removed, or the particular context explained). I have been under the assumption that if I did:

[a1] remoteExecCall ["fnc_Foo", 0, true];
[b2] remoteExecCall ["fnc_Bar", 0, true];
  • Then I am not guaranteed that fnc_Foo would be called with a1 before fnc_Bar is called with b2 (for JIPs). Having that guarantee will simplify certain things instead of having to workaround.
  • I would not expect using remoteExec instead of remoteExecCall would give that guarantee since they are scheduled (and might even interleave).
  • As for, updating an entry with same JIP key, without any explicit statement I would assume worst case and that it might remain in the same place in the "queue".
last cave
thin fox
winter rose
#

dammit

still forum
#

on profiling executable with -debug it even exports the raw jip queue contents

hallow mortar
last cave
still forum
#

Oh I found a inefficiency.
It checks if it overrides any older remoteExec, but if you just use true that can never happen.
Thats a bit wasteful, but whatever its all async now

thin fox
#

when pathCalculated EH fires exactly? I'm trying to debug it (systemChat) with an IA with some waypoints but no results shows up

errant jasper
#

It is super nice if that is the case, because something equivalent to a "distributed list" requires either sending full updates, or convoluted workarounds but if remoteExecs are indeed ordered then that simplifies alot.

#

Can we also get definite knowledge on whether overwriting an existing JIP key keeps is position or removes-old-and-append-new to end ?

still forum
still forum
errant jasper
still forum
#

Sorry no wrong

#

I gotta read this fully

#

When a new message comes in.
We iterate over all messages in the queue.
And each message can decide if the new one is considered an override.

If it is, then it can either update the existing message in the queue, or delete it and add a new one, or delete it and add no new one, or update it and add a new one

hallow mortar
still forum
#

remoteExec messages though never do the updating.
They just check if their name or object or group, equals the new message. If yes then the old one is deleted and the new one appended at end.

I don't want to guarantee this though, we could change that. But I don't think we will. It would be more efficient to replace the existing one instead of adjusting the whole jip array, but being efficient doesn't matter anymore, and specifically the RE queue is usually not large.

last cave
#
//Onserver
CodeRemote={
    Diag_log Formattext ["Executed CodeRemote in %1",time];
};
CodeRemote2={
    Diag_log Formattext ["Executed CodeRemote2 in %1",time];
};
remoteExecCall ["CodeRemote",  -2,"2:99999:9999"]; //Join 1 time write this on server
remoteExecCall ["CodeRemote2", -2,"2:99999:9999"]; //Join 2 time write this on server
remoteExecCall ["CodeRemote",  -2,"2:99999:9999"]; //Join 3 time write this on server
//check any ways

client can check every Diag_log s in rtp

errant jasper
still forum
#

yes, yes (The shift to end is also how publicVariable/setVariable works)

next gust
#

im not sure where it was, but I believe seeing a command that returns the positon (Number) of a unit within a group? anyone remember or knows what im talking about?

opal zephyr
#

Does anyone know of a way to get accurate selectionPosition results on the head of a character? The head has subtle animations that play of them turning it and stuff that dont seem to be picked up by this function by default.

granite sky
#

If it fails to calculate a path I guess it doesn't fire at all?

thin fox
thin fox
granite sky
#

I probably have an example somewhere

#

I mean Arma literally takes multiple seconds to calculate an AI path.

dim token
#

Is there a way to remove functions from the JIP queue?

granite sky
#

Ok found one:

dude removeAllEventHandlers "PathCalculated";
dude addEventHandler ["PathCalculated", {
    { deleteVehicle _x } forEach (8 allObjects 0 select { typeof _x == "Sign_Sphere100cm_F"});
    {
        createVehicle ["Sign_Sphere100cm_F", ASLtoATL _x, [], 0, "CAN_COLLIDE"];
    } forEach (_this select 1);

    private _pcCount = _this#0 getVariable "pcCount";
    hint format ["Path count %1", _pcCount];
    _this#0 setVariable ["pcCount", _pcCount + 1];
}];

dude limitSpeed 1;
dude setVariable ["destPos", getPosATL player];
dude setVariable ["pcCount", 0];
dude doMove getPosATL player;

The path count stuff is because it'll sometimes force a recalculation halfway through, for example when moving through buildings. Was trying to figure out why.

#

(the recalculations are bugged and use the wrong Z height. It's why AIs often fail to navigate to upper floors of buildings)

thin fox
#

I think I understand now

formal grail
hallow mortar
#

It really depends on your reference point.
Having precompiled code is faster than compiling it every time (e.g. execVM). Using CfgFunctions means less network traffic than broadcasting a function with publicVariable.
If you were already doing everything the best possible way then there's not so much difference, though it is preferable for other reasons (easier to use for you as a developer, easier for others to interact with because it's visible in the Functions Viewer, etc.)

hushed turtle
#

Yeah, but how does performance of function library differs from doing:

TAG_fnc_someFunction = compileFinal preprocessFileLineNumbers "someFile.sqf";

Function library is still great regardless, since it has advantages like functions being displayed in functions viewer in game.

exotic gyro
#

that's basically what PREP() does

hushed turtle
#

Is that CBA macro?

#

It is

fading gorge
#

how can you go around practically begging for help and then "k" people when you get the answer...jesus

tender fossil
tender fossil
#

Lol, no idea then. I guess BIKI article is wrong...

winter rose
#

I believe the "potential" was about either/or

  • faster loading* (during a loading screen, not during runtime)
  • there could be later improvements added, but apparently not
hushed turtle
#

And compiling from init.sqf would be in runtime right?

winter rose
#

depends on where – e.g before any sleep is still loading (usually)

hushed turtle
#

Interesting, that explains why I was sometimes using waitUntil {time > 0} in thread spawned from init.sqf to make sure I execute some code right after mission starts.

hallow mortar
#

It says "potential" and that's what I was referring to by "depends on your point of reference". There is the potential for you to see performance improvements, depending on what you were using instead. It even directly compares it to using execVM, which will indeed result in performance improvements because execVM compiles the code every time.

hushed turtle
#

I see now, a potential

winter rose
#

well that as well yeah πŸ˜„

pallid palm
#

good info woohoo Awsome

zenith wharf
#

Howdy, pretty new to SQF scripting. Can someone help me determine why Arma is complaining about Error Undefined variable in expression: _chosen_mbt with the following:

_chosen_mbt = [opfor_MBT_ARRAY_X] selectRandomWeighted [_chance_array];
diag_log _chosen_mbt;

AFAIK from the docs(https://community.bistudio.com/wiki/selectRandomWeighted), this should return a value from the values array? I feel like I'm missing something extremely small, just not sure what.

confirmed with other diag_log calls the values of opfor_MBT_ARRAY_X and _chance_array are ["O_MBT_02_cannon_F"] and [1] respectively

hallow mortar
#

Same for opfor_mbt_array_x, but [_chance_array] is the one causing problems. selectRandomWeighted opens the first array and expects to find a set of numbers, but instead finds another array, gets confused, and refuses to work.

zenith wharf
#

ahhhhhh, I knew it was gonna be something like that. thanks for the callout

split ruin
#

I want to export classnames from arsenal crate with

_items = getItemCargo allbox; 
_backpacks = getBackpackCargo allbox; 
_weapons = getWeaponCargo allbox; 
_magazines = getMagazineCargo allbox; 
copyToClipboard str (_items+_backpacks+_weapons+_magazines);

but all I get is empty array ...

[[],[],[],[],[],[],[],[]]
#

how to export virtual arsenal items classnames ? πŸ€”

#

oh, there are functions for this πŸ˜΅β€πŸ’« πŸ˜‚

BIS_fnc_getVirtualBackpackCargo
BIS_fnc_getVirtualItemCargo
BIS_fnc_getVirtualMagazineCargo
BIS_fnc_getVirtualWeaponCargo
pallid palm
#

there is a "Export to clipboard" tap in the arsenal: then you can past it into a Script

#

if you like want to get a complete loadout: of one the loadouts you have saved in there: πŸ™‚

#

i load any loadout from the arsenal on my guy: then i hit "Export to clipboard": then i open a .sqf file and past it in there: and see all the classnames in that loadout πŸ™‚

split ruin
pallid palm
#

rgr that m8

#

@split ruin i only use vanilla m8: what do you mean: no such thing in vanilla

split ruin
#

I didn't find export arsenal button in the virtual arsenal crate I have in the mission

#

but export commands are working well πŸ™‚

pallid palm
#

ok cool m8

#

btw its called "Export to clipboard"

#

or : copy to clipboard i forget now lol

winter rose
#

Ctrl+C & Ctrl+V work

pallid palm
#

ummm no this is diff Lou:

#

from the BIS_arsenal

#

there's a tab at the bottom of the BIS_arsenal: called "Export to clipboard": like where it says: load saved loadout:

next gust
#

thats exactly what Ctrl+C does

pallid palm
#

yeah i know thx m8: but if i can just clik 1 time on a tab thats easyer

#

you know less is more πŸ™‚

#

and i use Ctrl+c: when i'm not in the BIS_arsenal: for all the other things

#

yes i'm Aware of all the Ctrl+c Ctrl+v and Ctrl+a but thx any way m8 πŸ™‚

split ruin
#

I am trying to remove external turret from M4 Scorcher ("B_MBT_01_arty_F") without success

//works with CRV-6e Bobcat
_veh animate ["HideTurret",1];
pallid palm
#

looks correct to me but what do i know πŸ™‚

sharp grotto
#

animate - "Activates given object animation. Animation is defined in CfgModels animations class. Class names listed in CfgVehicles AnimationSources bound to "Proxy" controller "
https://community.bistudio.com/wiki/animate

#

guess the model doesn't have it (oversight) or it has a different name?

warm hedge
#

It does not necessary to work on every model. It may work on certain model, vice versa is true

pallid palm
#

cool good to know

warm hedge
#

That also does mean it may have different name

split ruin
#

what I should be loking in config of the vehicle ?

#

ther is only this

animationList[] = {"showCamonetCannon",0,"showCamonetPlates1",0,"showCamonetPlates2",0,"showCamonetTurret",0,"showCamonetHull",0};
#

all is about the cammo net I guess

warm hedge
#

Config Viewer may not tell you it. animationNames command to check potential animations

little raptor
little raptor
#

also it'll be very limited

pallid palm
#

lets keep it the way it is its perfect

eternal ingot
#

andybody have any idea on how to change outfits on trigger activation in arma 3?

hushed turtle
#
thisList apply { _x forceAddUniform "U_AntigonaBody" };
thin fox
eternal ingot
#

@hushed turtle ur gonna have to elaborate that

hushed turtle
#

Forces uniform on all units who activated trigger. It's easiest example I could think of.

eternal ingot
#

can i make an outfit,Save it,Then get that outfit in the trigger?

#

to swap out for another

hushed turtle
#

LIke entire loadout?

eternal ingot
#

basically,Yes,if i made an outfit saved it,Then on a trigger get that outfit to swap out for another?

hushed turtle
eternal ingot
#

ya im clueless,Too many words that i dont know

#

do i just find all the names of what i want and use the coding from that link? just swap out what it says

hushed turtle
#

You can get loadout from Virtual Arsenal

eternal ingot
#
comment "Exported from Arsenal by AshDaddy";

comment "[!] UNIT MUST BE LOCAL [!]";
if (!local this) exitWith {};

comment "Remove existing items";
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;

comment "Add containers";
this forceAddUniform "U_B_ParadeUniform_01_US_decorated_F";
this addHeadgear "H_ParadeDressCap_01_US_F";

comment "Add items";
this linkItem "ItemMap";
this linkItem "ItemCompass";
this linkItem "ItemWatch";
this linkItem "ItemRadio";

comment "Set identity";
[this,"GreekHead_A3_06","male01eng"] call BIS_fnc_setIdentity; is it like this?,But with different clothing```
pallid palm
#

or you can get a loadout from a folder in the mission root: Loadouts ```sqf
// in the units init
USMC = group this; _handler = this execVM "Loadouts\NAMSoldier.sqf";

eternal ingot
#

idk how to do that

mortal folio
#

im having an issue in scripted creation of a zeus module - code's below, but basically; it works fine for the most part; i can spawn stuff, delete stuff, move stuff, but for some reason i cant double-click stuff (the edit window with health values and whatnot doesnt show) - figured it's the edit coefficient but that's set to 0 so i'm not sure why it's behaving the way it is

_module setVariable ["Addons", 3, true];
_module setVariable ["BIS_fnc_initModules_disableAutoActivation", false];
_module setCuratorCoef ["Place", 0];
_module setCuratorCoef ["Edit", 0];
_module setCuratorCoef ["Delete", 0];
_module setCuratorCoef ["Destroy", 0];
_module setCuratorCoef ["Group", 0];
_module setCuratorCoef ["Synchronize", 0];```
split ruin
#

@eternal ingot you put you loadout export in a file named NAMSoldier.sqf in a folder named Loadouts, then run it like @pallid palm suggests, idk why you need to rename the group and the "_handler = " ...
your file should look like

params ["_unit"];
comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

comment "Add containers";
_unit forceAddUniform "U_B_ParadeUniform_01_US_decorated_F";
_unit addHeadgear "H_ParadeDressCap_01_US_F";

comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";

comment "Set identity";
[_unit,"GreekHead_A3_06","male01eng"] call BIS_fnc_setIdentity;

//and in the units init field
[this] execVM "Loadouts\NAMSoldier.sqf"; 
eternal ingot
#

ok so i should put that sqf into the mission folder?

Then make an outfit in game

Export it to that sqf

then into the trigger with the sqf file

split ruin
#

@eternal ingot

  1. export the loadout form the arsenal with ctrl+c
  2. make a folder named "Loadouts" in mission folder
  3. make a file inside called "NAMSoldier.sqf"
  4. paste with ctrl+v what you have exported previously in the NAMSoldier.sqf file
  5. rename "this" with "_unit"
    6)add this line
params ["_unit"];
  1. save
  2. paste in the units init field
[this] execVM "Loadouts\NAMSoldier.sqf"; 
#

names are arbitrary, you can call the folder where you put loadouts whatever you wish, same with the names of the files where you store the code for each loadout

eternal ingot
#

do i put params ["_unit"]; at the very top of the file?

split ruin
#

yeah

#

this way it will know what object the code must be applied to

eternal ingot
#

srry, The sqf or folder?

split ruin
#

sqf

eternal ingot
#

perfect,I will try my best to make this work,Any problems ill come back for some help,Thanks

pallid palm
#

make a folder named loadouts

eternal ingot
#

in the mission folder right?

pallid palm
#

yep

eternal ingot
#

πŸ‘

pallid palm
#

then put all your loadout.sqf in that folder

#

like NAMSoldier.sqf

#

then you can call it on any solider you want

#

like ```sqf
[this] execVM "Loadouts\NAMSoldier.sqf"; or _handler = this execVM "Loadouts\NAMSoldier.sqf";

#

is diff if you want to do it on Ai

eternal ingot
#

wtf is all that!!!!

#

no just for myself and maybe for my whole group of AI teammates

pallid palm
#

then use the 2end one

eternal ingot
#

so where it says _this,Change to the name of whoever its wanted for?

pallid palm
#

no just leave it at _this

eternal ingot
#

but the other guy said _unit?

pallid palm
#

_this _unit same thing kinda

eternal ingot
#

alright,Ill try my best with this info thanks scott

pallid palm
#

rgr m8

#

if you want me to send you a mission with this all set up i will

eternal ingot
#

if you want but i will still have to get the understanding of it before using it

pallid palm
#

ok cool good on you m8

#

yu'll get it after 2 trys im sure

#

i have like 35 loadouts in my Loadouts folder πŸ™‚

#

some are for the ammo box with _player in the script: and the other are for the the group with _this in the loadout script

eternal ingot
#

im thinking of trying my hardest to make B02 maps and make a campaign on it,But one of the missions is gliding down through planes and stuff and ofc having no weapons,Landing then with a weapon and no parachute etc...

pallid palm
#

oh shit lol

eternal ingot
#

well its either going to be really good or bad,But if its bad,I will keep trying till i get the best possible

pallid palm
#

in the mission i would send you it has Para drop from a flagpole and all set up with loadout that you can change to anything you want

eternal ingot
#

ah,Even better,That would be good

pallid palm
#

Pm me and ill send it to you

#

and you can rip it apart and see all i have done

#

and you can even play the mission if you want πŸ™‚

eternal ingot
#

ya i will,That would give me maybe a few ideas too

pallid palm
#

ok m8 have fun and thx for the the complement

#

lol Skully said im some secret bohemia interactive game dev: lol he he: he's fun lol

#

cuz i made 1000 missions πŸ™‚

azure mural
#

does anyone know if the move commands (doMove, commandMove, etc) have higher precision than setting waypoints? my AI heli doesnt land exactly on the designated spot and I'm trying to figure out why

granite sky
#

IIRC doMove and move waypoints have the same completion radius. Landing is different though.

hallow mortar
#

If you need to target an exact spot rather than letting the AI pick what it thinks is a good spot nearby, you can try landAt syntax 3. But you're still subject to the AI's ability to actually be precise when maneuvering the vehicle, which is not perfect.

azure mural
#

understood I'll give it a go, thanks y'all!

granite sky
#

I think waypoints like TR UNLOAD would attempt to land on an invisible helipad if you placed one near the waypoint marker.

#

Without that it'd just pick somewhere random in a radius, which could be quite far off.

#

same behaviour as land, I guess.

azure mural
granite sky
#

Are you sure there wasn't an invisible helipad there :P

azure mural
#

lmao yeah and the ground next to the building where it crashed after the rotors exploded

versed trail
#

any idea what counts as the "main menu" when it comes to the restrictions of playMission? I've got a button set up on the main menu to launch a mission and I cant convince even the example commands listed on the wiki to work

azure portal
#

Does anyone know if there's a way to script a vehicle to make its' engine noise louder?

warm hedge
#

No, it's a part of config

azure portal
#

Thought that'd be the case...ohh well, quiet cars it is then

old owl
#

Hey guys. Currently playing Antistasi with some friends at the moment and ran into a random script error when attempting to save a loadout in the Arma 3 Arsenel. Here it is:

23:57:45 Error in expression <aveInventory_data",[]];
_nameID = _data find _name;
if (_delete) then {
if (_nam>
23:57:45   Error position: <find _name;
if (_delete) then {
if (_nam>
23:57:45   Error find: Type HashMap, expected Array,String
23:57:45 File A3\functions_f_bootcamp\Inventory\fn_saveInventory.sqf..., line 75

I looked at the BIS_fnc_saveInventory and checked both profileNamespace variables. The variable bis_fnc_saveinventory_data was [] and the variable was true.

I tried to save a loadout in the Eden Editor to debug as I was on a modded server and got the same script error in the Eden Editor.

Does anyone have any advice of what other variables I may need to investigate to fix this issue? Not sure where the Hashmap is coming from.

#

I imagine this will all fix if I create a new profile but a few other friends had the issue too and resolved it by creating new profiles so figured it'd be pretty cool if I found what I need to clear on the profileNamespace to fix it.

#

Oh my god

granite sky
#

You probably have a mod that's writing that saveInventory var correctly. So you'd want to figure out which one it is and remove it first.

#

Although it may have happened in the past...

old owl
#

Just ran:

(allVariables profileNamespace) select {profileNamespace getVariable _x isEqualType createHashMap}

Looks like bis_fnc_saveinventory_data is a hashmap tweaking_cat

granite sky
#

yeah, it's not supposed to be. Hashmaps postdate the BIS arsenal :P

old owl
#

Hahaha aaaarghhhhhh

#

I wonder how that happened meowsweats

#

I guess probably one of the mods as you said

#

Hmmm I can't even seem to set the variable. Might just be time to create a new profile lol

granite sky
#

Should work. I've fixed those before.

#

profileNamespace setVariable ["BIS_fnc_saveInventory_data", []]?

old owl
#

Currently running this with no success:

{
    _x setVariable ["bis_fnc_saveinventory_data", nil];
} forEach [profileNamespace, missionNamespace];
saveProfileNamespace;
#

Previously was setting it [] changed it to nil to troubleshoot

#

If that hashmap was compileFinal it would throw an error for that upon setting right?

granite sky
#

I'm not sure. compileFinal doesn't adequately describe what it does.

#

Pretty sure it wouldn't be restart-persistent anyway.

#

So you could just start without mods, go into the editor debug console and set the thing.

#

If for some baffling reason it was restart-persistent in profilenamespace then you're likely out of options beyond derapifying the vars file.

old owl
#

The command compileFinal just basically makes a hashmap or code block read only. Went to try the theory out and just ran this:

profileNamespace setVariable ["cheese", compileFinal createHashmap];
// No result
profileNamespace getVariable ["cheese", 2];
// []
profileNamespace setVariable ["cheese", 2];
// No result
profileNamespace getVariable ["cheese", 1];
// []

Interestingly enough- looks like somehow that variable got compileFinal. Idk what on earth kinda mods they got loaded for that kinda trolling but is what it is I suppose πŸ₯²

#

I've never really messed around with the Antistasi or Eden Editor files though so maybe it is something else I am not seeing. Seems too bizarre to be right but seems to be exact in reproduction

granite sky
#

Apparently it used to be possible to write code to profilenamespace with compileFinal and that was fixed in 2.00

#

If it works as you say then it's unintentional behaviour and should be fixed by BI.

#

And almost certainly intentional griefing by someone.

old owl
#

By the above looks to be possible. Very bizarre. Will probably toss something in #arma3_feedback_tracker but just gonna poke around a bit more to make sure I am not trolling somehow first

granite sky
#

Was that restart-persistent? Like you couldn't overwrite "cheese" on that profilenamespace even after a restart?

old owl
#

Oh, I didn't try that- good thought. I'll close my game down and give that a whirl

#

Wow. Still won't change meowsweats

#

I got mods loaded still so gonna load Vanilla as one last sanity check

#

Wow still no change

#

I see that comment on the compileFinal wiki for code blocks. I think the ability for hashmaps was only added recently (around the time of hashmap objects maybe?) so might have just been overlooked.

#

Also just confirmed:

isFinal (profileNamespace getVariable "bis_fnc_saveinventory_data")
// true
dusk gust
hushed turtle
#

How to add items into a backpack in cargo? Or create backpack, add items and then put the backpack into cargo?

smoky spade
#

Hi everyone,comeing here because i try to find help. So i make a gate with frame and everything for dayz,and i want that gate to open ,i make the axis and the dor in memory , in bulldozer the gate open when i use scroll but not when i play animation. I tryd in game also but nothing there,can someone help me with that ?

warm hedge
smoky spade
warm hedge
#

Take this question to DayZ server sir

hushed turtle
#

everyContainer is what I was missing

hushed turtle
#

Following code creates light source object, which stays turned off thanks to enableSimulation false

private _light = createVehicleLocal [ "#lightpoint", player, [], 0, "CAN_COLLIDE" ];
_light setLightBrightness 5;
_light setLightColor [ 1, 1, 1 ];
_light setLightUseFlare true;
_light setLightFlareSize 5;
_light setLightFlareMaxDistance 1000;

light = _light;
light enableSimulation false;

I can later turn it on by:

light enableSimulation true;

BUT
Later running:

light enableSimulation false;

No longer turns it off. 🀣

#

Just Arma things I guess blobdoggoshruggoogly

drowsy geyser
#

Why not use switchLight command?

#

Its a specific command to turn light's on/off

hushed turtle
#

That only works with street lamps

drowsy geyser
#

That command works for almost every light

tawny moat
#

Hello there, does someone know or even have a script where a helo follows the player (like the vanilla stalking function) but that it will always face its sides to the player ?

If thats too hard, is it possible to make the helo stalk the player and loiter the player position ?

thin fox
tawny moat
#

Any example of that im not really experienced with scripting

granite sky
#

IIRC you can just keep the same loiter waypoint and move it. So just setWaypointPosition in a loop.

#

Everything else is related to the things you haven't specified in your question. Like how are you creating the heli & the waypoint.

formal grail
#

Spent a lot of time but figured this out just today.
How to make it so that the text font size in drawIcon on the map stays the same size regardless of zoom (ctrlMapScale):
Feed this into the text size parameter:
linearConversion [0.05, 0.1, ctrlMapScale _map, _textScale / 2, _textScale, true]

warm hedge
#

Likely it is about Condition (and other settings), not On Activation

#

So do tell about it

#

One thing to consider, what about other side and test it? I have a (conspiracy) theory why it might not work

#

Okay then here is the theory

#

It is detecting a rabbit

#

You might try to detect CAManBase and civilian

granite sky
#

If you're firing artillery then it might be corpses too.

warm hedge
#

That is maybe true too

granite sky
#

well, I guess unconscious rather than corpses.

warm hedge
#

(Which is stupid logic of this misterious game anyways)

granite sky
#

I think rabbits are supposed to be sideAmbientLife but this is not the sort of thing that I'd trust :P

winter rose
#

sees an MXM-equipped rabbit

formal grail
#

Enemy. Rabbit. 12 oclock. Kerry, engage!

warm hedge
#

Why the hell you removed your question

errant jasper
#

Not wise to engage a rabbit unless you've find some Holy Hand Grenade of Antioch mod.

carmine sand
#

Asking here cause its a script πŸ˜…

Does anyone know where bis_fnc_fire is located? I mean the file itself. I need to check it what causes when i execute it via keybind why it fires 30shots in 1sec πŸ˜…

(fire doesnt work it makes bad recoil to the sky which you cant stop, bug since A2) (vehicles)

carmine sand
#

Oh i forgot this option 🫠 thank you coolfrog

drowsy geyser
#

is there anyway to hide the inventory icon on corpses?

warm hedge
drowsy geyser
#

yes but for corpses

thin fox
drowsy geyser
#

i mean hiding this icon

thin fox
#

Oh I misunderstood

drowsy geyser
#

i think i can do a while loop to check if cursorObject isKindOf "CaManBase" then showhud false else true
bad idea haha

old owl
# drowsy geyser is there anyway to hide the inventory icon on corpses?

Might be able to do removeAction for the action ID but honestly not sure if that's possible. Something like this might still be helpful though?

player addEventHandler ["InventoryOpened", {
  params ["_unit", "_primaryContainer", "_secondaryContainer"];

  (!alive _primaryContainer && _primaryContainer isKindOf "Man")
}];
#

Wouldn't remove the icon but would effectively prevent the player from accessing the inventory.

pallid palm
#

hello all : i forget how do i remoteExec this on the server ```sqf
[p1] execVM "force_leader.sqf"

hushed turtle
#
[p1, "force_leader.sqf"] remoteExec ["execVM", 2];
pallid palm
#

oh nice thx so much @hushed turtle

#

@drowsy geyser

#

this would pervent someone form getting any Wewapons form a dead enemy AI

//Server Run
if (!isServer) exitwith {}; 

addMissionEventHandler ["EntityKilled", {
    params ["_killed", "_killer", "_instigator"];
     
    if ((isPlayer _instigator or side group _instigator isEqualTo west) &&
    (side group _killed) isEqualTo East) then
    {
        removeAllWeapons _killed;
        removeAllItems _killed;
        removeAllAssignedItems _killed;
    };
}];
#

but could still get Ammo and nads and stuff: you can add any removeAll type you want

fair drum
#

You still have a ground weapon container to deal with

thin fox
pallid palm
#

@fair drum well also i have my cleanup script running and that takes care of that πŸ™‚

#

its works perfectly for me on a Hosted server πŸ™‚ along with my cleanUP script it all works great: also i have in the Params: that you can turn this Off or On if you want

thin fox
#

ah I guess if is checking group side, it's fine

hushed turtle
#

One dirty way of locking inventory is disabling simulation. It's kinda dirty because it allows you open the inventory and see items, but you you're unable to take them.

pallid palm
#

oh that is dirty lol

still forum
hushed turtle
#

Had no idea that command existed to be honest

thin fox
pallid palm
#

nice m8

#

its so cool you can have many diff ways

thin fox
#

I found that is too complicated to try to block players from viewing enemy's inventory, at least on a dynamic scenario like lib

pallid palm
#

i think my way is the best πŸ™‚ no just kidding

#

πŸ™‚

thin fox
pallid palm
#

im just having so much fun i just had to say that πŸ™‚

#

yes sir thats what i wanted yup

#

but you can change it to what you need also

thin fox
#

it totally scenario dependable

pallid palm
#

yes sir

thin fox
#

Last small op that I did I just block the players from opening enemy inventory using inventoryOpened, had to make an array with enemy spawned units, ugly (because in this case you can't check enemy side)

pallid palm
#

along with my cleanUP script it all works great

hushed turtle
#

I guess cleanest would be removing all items in uniform, vest and in backpack and then locking rest by disabling simulation

pallid palm
#

for some reason i dont like disabling simulation on anything i dont know why πŸ™‚

#

must of been somethig that happen to me when i was a baby lol πŸ™‚

#

oh i know why now: cuz it might disable simulation in the Simulation we live in like in real life πŸ™‚

#

and i dont want to disable that simulation πŸ™‚ he he

hushed turtle
#

Disabling simulation improves perfomance

#

It's good to do on objects far from player for example. Like units on the other side of the map. When player gets close you enable simulation again and they will be behaving normally and at same time while player was far away they weren't eating system resources

tulip ridge
#

Is there not a direct way to get the current magazine for a given muzzle?
Something akin to like a _unit currentMagazine "muzzle"?

Thought of some less than ideal ways like grabbing unit loadout or saving the "slot" that the weapon was in and then doing primary/handgun/secondaryWeaponMagazine, but that doesn't work for muzzles

hallow mortar
#

There isn't a command specifically for that, but weaponState can do it, and addWeaponItem and (2.22) removeWeaponItem can manipulate magazine by muzzle

#

weaponsItems can also provide the information, but less efficiently

tulip ridge
#

Thanks, knew there had to be something for it

modern plank
#

Question about AI guys: I want to start the mission with all AI stuck at spawn, ready for any late joiner, but they have to remain static, quiet. I have this:

{
  _x setDamage 0;
  _x allowDamage false;
  _x disableAI "AUTOTARGET";
  _x disableAI "TARGET";
  _x disableAI "FSM";
  _x disableAI "MOVE";
  _x stop true;
  _x setBehaviour "CARELESS";
  _x allowFleeing 0;
  while {!conversationDisabled _x} do {_x disableConversation true};
  _x setVariable ["BIS_noCoreConversations", false];
  _x setSpeaker "NoVoice"; 
} forEach (playableUnits - allPlayers);

executed by the server at mission startup. And it looks great...Then I start a mission, it teleport only the human players, we play, then we teleport back the humans on the initial spawn. Then, some AI start moving, to regroup with their humans lead and so on. I see no reason why, nothing has changed for bots from my POV. Sometimes even at start time I see 2 or 3 moving bots.

Any idea? Am I supposed to execute this regularly?!??

hallow mortar
#

disableAI is a Local Effect command (so are some of the others but that's the important one right now). If this code is executed only on the server, then the disableAI is only affecting the AI while it's local to the server. If the AI are in a group with a human leader, they will at some point become local to that human player's machine, where the command has not been executed and so disableAI is not in effect.

#

The solution would be to execute disableAI (and some of the other commands) on all machines.

hushed turtle
#

If AI is far away and players don't see them you could also do disableSimulation false and hideObject true on all these AI to save performance on them.

pallid palm
#

@hushed turtle well i like what your saying: but in most cases there's no Ai on the map untill players get close to the objectives: but i will use what you said on the missions the have Ai already in the Mission πŸ™‚

hushed turtle
#

I was surprised how much improvement that can make. I was able to have like 40+ fps with 300 units in 100 meters radius just because most of them were hidden and had simulation and AI disabled.

#

If you have option to spawn them later then go for it of course

modern plank
blissful current
#

The BIKI says that pushback puts the element at the back of the array. So why does convo2 play before convo1 then?

private _sentences = ["convo1"];

// hvt convos
switch (true) do
{
        case ( _hvtPass ):
        {
            _sentences pushBack "convo2";
        };
        // other cases
};
old owl
hushed turtle
blissful current
modern plank
#

Coz my loop would be way simpler:

 _x enableSimulation false;
 hideObjectGlobal  _x;
} forEach (playableUnits - allPlayers);
hushed turtle
#

Probably not worth it to go that far

#

You would have to test it how it behaves

#

I never tried playing unit who has simulation disabled, it shouldn't really work in theory

modern plank
#

Then, player enableSimulation true;player hideObjectGlobal false; is not that complex too ^^

#

will test soon.

hushed turtle
#

As far as disableAI goes, you can just run disableAI "ALL" loop on all of them in init.sqf

old owl
#

Plus honestly have never really had that kind of problem with pushback. Could maybe try this to sanity check:

private _sentences = ["convo1"];
...
_sentences = _sentences + ["convo2"];
blissful current
hushed turtle
old owl
blissful current
hushed turtle
blissful current
#

I wonder if it's the way I call the function with forEach.

old owl
#

Your usage of forEach is right although forEachReversed does actually exist haha. You have verified the actual array indexes are off right? When remoteExec is ran there is no guarantee one machine will get a message first over another

#

Oh apologies nevermind you said you checked that

#

Honestly pretty stumped

little raptor
#
 [_sentences, [command, testUnit], true] remoteExec [
        "FoxClub_fnc_Conversation",
        allPlayers select { _x distance command <= 100 }
    ];

and change your fnc to accept an array

modern plank
old owl
#

An array of objects also work

modern plank
#

So: you should pass the array of owner _x

#

instead of just _x

#

I guess.

#

allPlayers return the objects...not the ownerId

#

(am I wrong?)

old owl
#

It returns the objects- you can remoteExec to

hallow mortar
#

You don't need to get owner, remoteExec is smart enough to figure out the object's owner using a reference to the object itself

errant jasper
#

You are not wrong, but also you can use object just fine.

modern plank
#

I see, should work with objects too.

granite sky
#

remoteExecs don't necessarily come out in the right order at the far end. IIRC they're usually reversed. So do what Leopard suggests.

old owl
#

Reversed??

#

Haha no kidding

hallow mortar
errant jasper
#

Well recent discussion suggest that they do.
But remoteExec (no Call on end) I would guess you have no guarantee that it will not be preempted (and another remoteexec take its place).

granite sky
#

remoteExecCall is guaranteed. Maybe.

#

And remoteExec with commands probably acts like remoteExecCall.

old owl
#

I thought remoteExecCall just ran the script in a non scheduled environment?

granite sky
#

But remoteExec just put things into the scheduler at the far end, and the scheduler does not preserve order.

#

remoteExecCall doesn't put anything in the scheduler.

#

All remoteExecs are likely sent and arrive in order. But the order that functions are put into the scheduler is not necessarily the order that they're executed.

fair drum
#

cough Use CBA events cough

old owl
#

Ah okay I see what you're saying now apologies.

errant jasper
#

Yeah, I use CBA events for pretty much everything. Just beware that CBA does not process JIP messages in-order.

granite sky
#

I think there's an open debate about whether JIP remoteExecs arrive in the order that they were added to the queue.

#

The wiki says no but that's quite weird.

errant jasper
#

I discussed this with Dedmen recently. He called me out on saying it was not actually a queue and I countered with the BIKI says the messages are not processed in order, so what does queue mean. He then looked at the implementation and was quite confident they were processed in order.

#

As for why the red warning on remoteExec was added by KK we are not sure of, because that red label does seem to be wrong.

granite sky
#

Apparently there was an old bug where non-JIP remoteExecs could arrive before JIP remoteExecs, which certainly confused the hell out of me.

#

Fixed fairly recently, I think.

#

Oh, they could even arrive before JIP publicVariables.

errant jasper
# granite sky Oh, they could even arrive before JIP publicVariables.

Yeah, that is not ideal. I try really hard to reframe any problem so to not require JIP processing, and letting most logic be handled passively by getVariable/publicVariable data, because I don't fully trust BIS JIP ordering, and CBA seems to process JIP tag using allVariables which eliminates ordering.

granite sky
#

It's an awful lot easier if you can trust JIP ordering :P

pallid palm
#

lol that was funny @fair drum i could just hear you saying that lol

granite sky
#

I did an accidental large-scale public test of JIP ordering recently and it does seem to work correctly in 2.20.

#

Didn't have remoteExec ordering in there though, just publicVariable vs publicVariable vs remoteExec.

old owl
errant jasper
#

Yeah, and the automatic JIP removal for Objects and Groups in remoteExec is a trap. Because the JIP ID is derived from the object/group there can be only one such attached, so unless you own and check the entire "codebase" to ensure only you use it that way, one would collide with any other usage.

old owl
#

Genuinely my most hated part

#

Pretty much forces you to come up with unique identifiers and be forced to manage them well or congrats it's staying in there

#

NGL I'd probably use it way more if those collision issues you mentioned weren't a thing. Just feels like playing with fire though sadge

#

Idk I guess more or less appropriate depending on circumstance too. Tossing remoteExec ["", "whatever"]; in a deleted event handler doesn't really bother me

granite sky
#

Another option is you check if the object is null in the JIP call and then delete the JIP entry if it is.

#

So then the dead JIPs only fire once :P

errant jasper
#

That is true. Of course since it runs on the JIP we now have to message the server back in order for it to be removed.

granite sky
#

Yeah it's not ideal, but it's also impossible to screw up by missing an EH.

hallow mortar
#

{ } denotes a Code type - preserved code which can then be executed with e.g. call or other commands. forEach does not accept Code for its right-side argument. You need to make an Array.
It looks like you want to make your array from the units in two groups. units returns an array but can only be used on one group at a time, so you need to use it twice and combine the results, e.g.

... forEach (units group_1 + units group_2);```
#

Note that units can be used on a unit and will simply assume you mean that unit's group, so you don't need to do group if you already have a reference to a unit in that group - units some_unit will work

pallid palm
#

lol i just added a cool thing to my training missions: where you can hit 0 0 9: and put a marker on each enemy in the mission: but i made it so the markers only lasts for 60 seconds: then the markers disappear πŸ™‚ and you only get to do this 1 time so you must w8 to use it: for if you cant find the last enemy: πŸ™‚

#

and it also shows a count down Hint of how long the markers will be on πŸ™‚

#

i call it the markerMode.sqf πŸ™‚ before i had it so you could turn the markers On or Off at will but that was to much

#

yes NikkoJT saved my life like 100 times also: πŸ™‚ and others also

pallid palm
#

hello all: would this be correct way to use this

#
{ "disableSimulation" true; } forEach (allUnits select {side _x == east});// or what ever side you want

//code
//then after that you can Do

{ "disableSimulation" false; } forEach (allUnits select {side _x == east});// or what ever side you want
cosmic lichen
#

no

#

Using AI?

pallid palm
#

yes on Ai: oh did you mean em i using Ai program no: no way i hate that stuff

#

or is this better

#
//Disable Simulation for all East Units
{ [_x, false] remoteExec ["enableSimulationGlobal", 2]; } forEach (allUnits select {side _x == east});// or what ever side you want

//code
//then after that you can Do

//Enable Simulation for all East Units
{ [_x, true] remoteExec ["enableSimulationGlobal", 2]; } forEach (allUnits select {side _x == east});// or what ever side you want
#

i dont know how to do it

#

what would be the correct way

cosmic lichen
#

This one seems correct, but you can use units <SIDE>

#

On the other hand you don't need to use remoteExec at all with eh global variant of enableSimulation

pallid palm
#

can you fix it for me im not sure how

cosmic lichen
#
if (isServer) then
{
  { _x enableSimulationGlobal false } forEach units east;
};
pallid palm
#

ahhh wow Awsome cool m8 thxs you

#

would this work also ?```sqf
if (!isServer) exitWith {};

//or some code here as well maybe

{ _x enableSimulationGlobal false } forEach units east;

// then ofcorse after that
//some code

{ _x enableSimulationGlobal true } forEach units east;

cosmic lichen
#

yes

pallid palm
#

ahhh cool thxs man your Awsome @cosmic lichen

blissful current
sharp grotto
pallid palm
#

ok cool i'll check it out thx m8

#

oh wow cool Awsome @sharp grotto

dark viper
#

guys im late to this discussion but it's unclear to me, Dynamic Simulation does not hide the AI right? they are visible just statues i presume

tulip ridge
#

Correct, they are not hidden

dark viper
# tulip ridge Correct, they are not hidden

dunno how much it matters for performance that they are not simulated but rendered but it would be cool if could connect some event handler to hide the AI when their Dynamic Simulation is toggled on and off

#

can't find an event for it

#

thought there might literally be a "Dynamic Simulation changed" event

tulip ridge
#

They still follow the normal object rendering process

#

They're just not like explicitly hidden

dark viper
tulip ridge
#

Needs to be within your object view distance setting at the bare minimum

dark viper
#

even that's pretty taxing if it's not in your actual FOV

#

I'll take any method of improving performance in ARMA 3 missions if possible

granite sky
#

but I was mostly working on stuff within ~1.5km of the camera. I'd hope rendering didn't have much cost outside object draw distance.

pallid palm
#

nice good to know

#

i mostly always spawn in the enemy when the players get close to the objective: i try to make sure that players don't see the spawn in of corse

#

or feel the spawn in

#

it just depends how you go about it really imho

hoary saddle
#

Hey guys. So I'm trying to simulate a cargo ship pulling up to a pier to offload supplies. The ship is static so its attached to a civlian boat and cargo is attached to the cargo ship.

I want it to run indefinitely so I'm trying to make it either delete at the end of the map, and spawn again at the start point, or hide it at the end point, and teleport it back to the start point. Any ideas?

pallid palm
#

iv done this very thing you talk about: but i have a Tank loaded on the Cargo ship and the ship drops off the Tank and then the Tank Attacks your base πŸ™‚

#

@hoary saddle so if you like i can send you the mission and you can rip it apart and see what i have done

hoary saddle
#

dude that would be awesome

pallid palm
#

i have the Script in the mission that you are asking about: but you would have to Edit it to your liking: because in my mission players must try to Destroy the Tank before the Ship unLoads the Tank πŸ™‚ and if players Destroy the Tank: the Ship Explodes and Sinks: and after a timer runs down the ship respawns at sea

hoary saddle
#

that sounds awesome

pallid palm
#

ok so PM me ok

pallid palm
#

Awsome Guy you are @hoary saddle Nice talking to you about Arma 3

hoary saddle
pallid palm
#

you bet my brother any time

#

my Missions bring people together: πŸ™‚

unborn prism
#

Hey, what's the code string to open the rear hatches on an Ifrit?

pallid palm
#

i didn't even know there is a rear hatche on an Ifrit hmmm

#

i'm not sure but something like this maybe

#
{car1 animateDoor [_x, 1]} forEach ["door_back_L","door_back_R","door_L","door_R"];
still forum
# granite sky But remoteExec just put things into the scheduler at the far end, and the schedu...

Maybe should fix that.
The scheduler sorts and executes oldest scripts first.

New scripts are set to age 99999 (in seconds), so they are immediately the oldest.
But, yeah the sorting doen't preserve order for elements with same age.

This system seems a bit badly implemented anyway. Every frame we iterate through all scripts and bump their age.
We could just store the last-executed timestamp and use that instead, then we don't need to update.
And if we then for new scripts just do lastUpdate = currentTime - 9001, they would sort correctly.
If I have a FT ticket with repro I can fix it πŸ˜„

still forum
still forum
errant jasper
#

Always seen scheduled scripts and thus remoteExec as unordered and racy so the newly added being first doesn't bother me, but I am sure there are plenty of examples where people assume otherwise. I would guess this affects non JIP usages so example 8 would be incorrect if the order was functions.

#

More bothered by JIP state not being synced before JIP remote exec. So all JIP executions cannot rely on any publicVariable/get Variable being up to date. So handlers have to handle both the case where the distributed state indeed has this state set but we don't know at handling time. Fortunately most JIP messages are order independent and idempotent but it still sucks for those 5 percent where there is a dependency on distributed state in the handler.

still forum
hushed turtle
#

Remember saying it's weird radius in BIS_fnc_holdActionAdd can't be set using parameter. And now it's coming in 2.22, it almost looks like somebody is taking notes... coolfrog πŸ˜€

old owl
errant jasper
cyan dust
#

Good day. Not sure where to post. I sometimes see AI enemies stuck at place refusing to go to the waypoint, this happens with both ground and air vehicles, and on a rare occasion with infantry.
Is there a way to debug this? Like to know the reason AI is failing to proceed to the next waypoint? πŸ€”

Edit: I incorrectly described the problem as 'stuck on a waypoint', should have used 'refuse to go to a waypoint' instead. Sorry for inconvenience

gritty crane
gritty crane
cyan dust
gritty crane
#

that is already fair πŸ€” try set it to 80, if it is ok for you if they do not follow the exact path you plotted.
If that doesn't work, i don't know.
Ah - esp. for air vics, but also land vics, do bigger waypoints. because of their turning radius at higher speeds

#

also, with air vehicles i had a similar problem, where the plane was circling around to get the waypoint because of a huge height difference from WP to WP, check that, too.

#

like, set it to ~ 250m or something, experiment a little.

pallid palm
#

@cyan dust this is what i have in a script to add waypoints to my Ship
maybe this can help you in some way

 private ["_grp","_wp0","_wp1","_wp2"];

 // some code

 // some code

 // some code

_wp0 = _grp addWaypoint [getMarkerPos "WP0_Ship1", 0];
_wp0 setWaypointType "Move";
_wp1 = _grp addWaypoint [getMarkerPos "WP1_Ship1", 0];
_wp1 setWaypointType "Move";
_wp2 = _grp addWaypoint [getMarkerPos "WP2_Ship1", 0];
_wp2 setWaypointType "Cycle";
#

i never really use waypoints in my missions: but this one mission i did πŸ™‚

thin fox
#

and are you using AI mods?

cyan dust
# gritty crane that is already fair πŸ€” try set it to 80, if it is ok for you if they do not fo...

I guess it's fair to try, thanks, but my problem is that they do not move toward the waypoint at all not that they can not complete it. Maybe I should add one more right under the group leader's vehicle as a 'waypoint zero' or smth (currently I just remove all waypoints and create new ones where I want them to go). Still doesn't answer the question why some groups move and others don't notlikemeow
As for planes - yeah, that happens too. Although it gets even weirder when helis and UAVs have no such problem, only the plane with unit pilot has.
And sometimes 'artillery' waypoints silently fail for no apparent reason.
All in all, I'm pretty sure the problem is in waypoint placement, I just don't know what exactly wrong with it, hence the debug question.

cyan dust
cyan dust
pallid palm
#

so your saying the groups don't even try to move to any of the waypionts ?

pallid palm
#

hmmmmm how are you defining the groups

#

like can we see your script

#

```sqf
// Copy text on all this and remove all the ( back slashes = \ ) and your code goes here
```

cyan dust
pallid palm
#

this is just a small sample```sqf

if (!isServer) exitWith {};

private ["_grp","_grp2","_wp0","_wp999"];

_grp = createGroup east;
// some code here like
//Lifeboat Driver
"O_Diver_F" createUnit [getMarkerPos "Divers", _grp, "vc1=this", 0.030, "COLONEL"];
sleep 1;
vc1 assignAsDriver Lifeboat;
vc1 MoveInDriver Lifeboat;
sleep 1;

_wp0 = _grp addWaypoint [getMarkerPos "WP0_Ship1", 0];
_wp0 setWaypointType "Move";

_grp2 = createGroup east;
// some code here
_wp999 = _grp2 addWaypoint [getMarkerPos "WP999_Ship1", 0];
_wp999 setWaypointType "Move";
// and so on

pallid palm
#

we would still like to see your script: its ok m8: others can help also

#

you have to put yourself out there: to learn as i did so many times

#

and boy did i get help πŸ™‚

#

im not so good at it: but with the great guys in here: well you know

#

i wanted to learn real bad: so of course i posted so many bad scripts: and the guys in here helped me so much: i love all the great guys in here: thay are Awsome

#

to many names to say: but it was lots of cool people in here helped me

thin fox
#

but we still don't know how you set up your scenario

cyan dust
#

It's nothing fancy really

TAG_SYSTEM_AddWaypoint = {
    params ["_group","_pos",["_type","MOVE"]];
    private _wp = _group addWaypoint [_pos,(TAG_SYSTEM_Settings get "WAYPOINT_RADIUS_PLACE")];
    _wp setWaypointType _type;
    _wp setWaypointCompletionRadius (TAG_SYSTEM_Settings get "WAYPOINT_RADIUS_COMPL");
    //return
    _wp
};

TAG_SYSTEM_ClearWaypoints = {
    // private _group = _this;
    {deleteWaypoint _x} forEachReversed (waypoints _this);
};

_pos - for ground vehicles zCoord is 0, for air vehicles some random height 100-300

I think I'll try adding logs for group leaders using that event, maybe that would shed some light
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#PathCalculated

Thank you

hushed turtle
#

addWaypoint radius seems to create waypoints close to center usually. Count waypoint's position yourself if you want even distribution within the radius.

hushed turtle
#

Just trying it out right now and it does even spread across the radius. Hmm, I remember it was creating waypoints mostly close to center. πŸ€”

hallow mortar
# gritty crane ? both addaction/holdactionadd ranges can be set via params since quite some tim...

addAction has had a radius parameter since A3 1.64. But BIS_fnc_holdActionAdd did not make that parameter accessible when using the function, despite using addAction internally - if you wanted to set a radius on your holdAction, you had to do it manually using a distance check in the condition.
In 2.22 that will change, and the action radius will be directly usable when using BIS_fnc_holdActionAdd. That change went onto dev branch on the 12th (#arma3_branch_changelog message) but hasn't gone to profiling branch - and won't, until the 2.22 stable release, because it's a change to a function and functions are Data, not Engine, so they can't change on prof.

hushed turtle
#

I wish I had my original code. Chances are was just counting radius wrongly which lead to waypoints being close to center

granite sky
granite sky
cyan dust
#

I'm looking at two groups right now that are refusing to move πŸ€”
The strangest thing is that those two groups have a callsign of a previous group that was already eliminated (e.g.: "Alpha 1-1") and no matter what I try via console - they don't move
What I tried so far:

  • setWaypointPosition for each waypont (checked with markers - they do actually change position and checked with free camera - these positions are unobstructed)
  • setVehiclePosition for group vehicle
  • move for group
    All of that has no effect notlikemeow
    I would need to spend more time testing to be 100% sure that only such groups (having someone else's callsign) are affected, but so far
#

Hmmmmm. One of the groups was finally 'fixed' by this abomination, another ignores it, but it was close to an enemy so maybe that plays it's part as well

[] spawn {
_grp = "Bravo 1-4" call SMTH_GetEnemyGroup;
_veh = vehicle leader _grp;
private _crew = (crew _veh) select {alive _x}; 
_group leaveVehicle _veh; 
{_x disableCollisionWith _veh; _x moveOut _veh} forEach _crew; 
sleep 5;
_veh engineOn true; 
_group addVehicle _veh; 
{_x moveInAny _veh} forEach _crew;
};
granite sky
#

Sometimes you can just move the vehicle slightly in zeus and it'll start moving.

cyan dust
hallow mortar
round hazel
#

Hey folks, does anyone know if using publicVariable "_variable" in initServer.sqf will cause issues with what the variable holds for different players?

#

Edit: Nevermind, found my answer! initPlayerServer.sqf is what I want to be using i believe

granite sky
#

You don't use publicVariable on local vars anyway. Not sure if it throws an error, but it should.

round hazel
#

How do I go about broadcasting the variable to all devices, from a script that only runs serverside?

tulip ridge
#
missionNamespace setVariable ["YourPrefix_someVariable", _value, true]; // can also use machine ids to only set it on specific machines

// or
YourPrefix_someVariable = _value;
publicVariable "YourPrefix_someVariable";
granite sky
#

If a variable name starts with an underscore in SQF then it's local-scope.

round hazel
round hazel
granite sky
#

The two methods have identical effect. IIRC it's even the same network message ID.

round hazel
#

In that case I'm rather stumped, give me two seconds and I'll post the issue I'm having

tulip ridge
#

Identical effect, second is faster if the variable already has the value you want set

round hazel
#

To be as brief as I can, in my mission I have coded a camera to reveal objects in the world to the player when it is looked through (It occupies the binocular slot). In order to try and make this work in multiplayer, I create a list of lists of objects (Each list is of objects in a specific area), then set a variable as the index of the list in which the objects in that area can be found. I then cycle through each one, revealing it locally.

It is important to note, previously I gather the objects in the area by their editor layer. This worked in Singleplayer, but only runs on the server in multiplayer. Therefore, I run that function on the server and broadcast the resulting list globally.
Another thing to note; My code for checking ADS works fine, it worked for the previous attempt and I see no reason why multiplayer will change that. The code that I believe includes the problem child is included below.
I recieve no errors in the editor, but no objects are reveal when looking through the camera.
Running the following code the debug menu (in the editor multiplayer) with 'Local Exec' produces the desired result;

private _objects = GhostObjects select (player getVariable ["ghostLocation"]);
{
  _x hideObject true;
} forEach _objects;
#

initPlayerServer.sqf

params ["_playerUnit", "_didJIP"];
if(!_didJip) then {
    securityLevel = 3;
    travelStarted = false;
    waveSpawn = false;
    bossActive = false;
    bossHealth = 3000;
    night = 0;

    _ghostLayers = ["ghostCabin","safeHouseOutdoorSpectral","safeHouseIndoorSpectral", "campSpectral", "theatreSpectral"];
    {
        private _layerEntities = getMissionLayerEntities _x;
        _objects = _layerEntities select 0;
        {
            _x hideObjectGlobal true;
        } forEach _objects;
    } forEach _ghostLayers;
};

_ghostLayers = ["ghostCabin","safeHouseOutdoorSpectral","safeHouseIndoorSpectral", "campSpectral", "theatreSpectral"];    
GhostObjects = [];
{
    private _layerEntities = getMissionLayerEntities _x;
    _objects = _layerEntities select 0;
    GhostObjects pushBack _objects;
} forEach _ghostLayers;
publicVariable "GhostObjects";

initPlayerLocal.sqf
These functions are called when looking through the cam


TAG_fnc_hideGhostObjs = {
    params ["_playerUnit"];
    
    if ( (player getVariable ["ghostLocation", nil]) != nil ) then {

        private _objects = GhostObjects select (player getVariable ["ghostLocation"]);
        {
            _x hideObject true;
        } forEach _objects;
    };
    
    if ( (player getVariable ["realLocation", nil]) != nil ) then {

        private _objects = GhostObjects select (player getVariable ["realLocation"]);
        {
            _x hideObject false;
        } forEach _objects;
    };
};

TAG_fnc_camON = {
    params ["_playerUnit"]; 
    [player] call TAG_fnc_showGhostObjs;
    //10 cutRsc ["cameraOverlay", "BLACK IN", 1, false, false];
    filmGrain ppEffectEnable true;
    resolution ppEffectEnable true;
    colourCorrect ppEffectEnable true;
    while {true} do { 
        10 cutRsc ["cameraOverlay", "PLAIN DOWN", -1, false, false];
        uiSleep 1;
        10 cutRsc ["cameraOverlay2", "PLAIN DOWN", -1, false, false];
        uiSleep 1;
    };
};
granite sky
#

if ( (player getVariable ["ghostLocation", nil]) != nil )

#

This is incorrect. You can't use nil in a comparison.

#

Nicest method these days is player isNil "ghostLocation"

#

Older method is isNil {player getVariable "ghostLocation"}

round hazel
#

much obliged, ill test it out!

#

Fantastic. It works in singleplayer, I'll have to wait a bit to test it in multiplayer due the the server being shared, but I don't see a reason why it won't. Thank you so so much @granite sky !

granite sky
#

This is one of those cases in if statements that executes neither the true or false clause and also doesn't throw an error, even in scheduled.

#

They're pretty common :P

tulip ridge
#

Anyone had any luck with making editorPreviews for units with their backpacks? Vanilla function doesn't, and I've tried tinkering with it with no luck

pallid palm
#

@tulip ridge what is editorPreviews for units with their backpacks: can you explane what that is: cuz im not sure what you mean: is that something in CBA: or something like that ?

#

oh w8: after thinking about it: now i think i know what you mean:

hoary saddle
#

hey everyone Im trying to createa a cellphone tracking device. It's supposed to find all all "Item_SmartPhone"s with a certain distance and put a pulsing marker on it. Its no longer throwing errors and I have no clue why. Anyone have any ideas?

{
_objectslist = nearestObjects [sat, ["Item_SmartPhone"], 2000];
_posArray = [];
{
_pos = getPosATL _x;
_posArray pushBack _pos;
} forEach _objectList;
beaconblip = createMarker ["beaconblip", _x];
beaconblip setMarkerShape "ELLIPSE";
beaconblip setMarkerColor "ColorGreen";
beaconblip setMarkerSize [100, 100];
while {true} do {
"beaconblip" setMarkerPos (getPos _x);
_i = 200;
while {_i > 5} do {
beaconblip setMarkerSize [_i, _i];
_i = _i - 5;
sleep 0.1;
};
sleep 1;
};
};

thin fox
#

!sqf

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
hoary saddle
#
// {
_objectslist = nearestObjects [sat, ["Item_SmartPhone"], 2000];
_posArray = [];
{
    _pos = getPosATL _x;
 _posArray pushBack _pos;
} forEach _objectList;
beaconblip = createMarker ["beaconblip", _x];
beaconblip setMarkerShape "ELLIPSE";
beaconblip setMarkerColor "ColorGreen";
beaconblip setMarkerSize [100, 100];
while {true} do {
 "beaconblip" setMarkerPos (getPos _x);
 _i = 200;
 while {_i > 5} do {
  beaconblip setMarkerSize [_i, _i];
  _i = _i - 5;
  sleep 0.1;
 };
sleep 1;
};
};
hint "good!";
granite sky
#

Items aren't objects in A3.

#

you'd need to search through unit & container inventories to find them.

hoary saddle
#

the phones are laying on the ground currently

granite sky
#

In that case they're items inside weapon holder containers.

#

Probably GroundWeaponHolder.

hoary saddle
#

not following. The first section where the array is created works, it was used to create fires on objects in the area. The part thats not working is the first beaconblip and down.

granite sky
#

Well, the first and second halves of the code aren't joined up.

#

You create an array of positions and then don't use it.

hoary saddle
#

I thought thats what the "_x" was for? I'm still learning lol

granite sky
#

There's also a hanging end bracket in there I think?

hoary saddle
#

All the brackets matched up according to NPP

#

so would I use _objectsList or _posArray instead of _x?

granite sky
#

The brackets might match if you hadn't commented one out the start.

hoary saddle
#

ok, I thoughts how you joined everything that goes together

granite sky
#

_x only means anything inside a loop over an array, like forEach or apply.

hoary saddle
#

now its throwing an error after taking the first and last bracket out.

granite sky
#
{
  // _x is the current array element here
} forEach _array;

// _x doesn't exist here
sharp grotto
granite sky
#

Probably meant something like this:

private _objectslist = nearestObjects [sat, ["Item_SmartPhone"], 2000];

{
  private _pos = getPosATL _x;
  private _mrkName = format ["beaconblip%1", _forEachIndex];
  createMarker [_mrkName, _pos];
  _mrkName setMarkerShape "ELLIPSE";
  _mrkName setMarkerColor "ColorGreen";
  _mrkName setMarkerSize [100, 100];

  [_mrkName, _x] spawn {
    params ["_mrkName", "_object"];
    while {true} do {
      _mrkName setMarkerPos (getPosATL _object);
      _i = 200;
      while {_i > 5} do {
        _mrkName setMarkerSize [_i, _i];
        _i = _i - 5;
        sleep 0.1;
      };
      sleep 1;
    };
  };
} forEach _objectsList;
#

Not sure if you want the pings to be in-sync or not.

#

Those will probably start roughly in sync and then drift out over time.

hoary saddle
#

it works! hell yea thank you.

blissful current
#

Why is performance on the client better than the local-host? I've been running some tests with add/deleteing AI and triggers. It's pretty clear straight away that triggers barely have a performance impact while AI quickly will tank performance as well as view distance settings.

Even if I delete all the AI and triggers, the client still has a sizable performance boost over the local host. So what else is going on behind the curtain on the local-host but not the client?

old owl
#

@hoary saddle If you're doing this in an MP mission I would reccomend setting all of your marker commands local except for the last one like so:

  _mrkName setMarkerShapeLocal "ELLIPSE";
  _mrkName setMarkerColorLocal "ColorGreen";
  _mrkName setMarkerSize [100, 100];

Doesn't really matter but just a network performance tip πŸ™‚

hoary saddle
#

will do

#

I appreciate it man

old owl
#

I don't really know a whole lot about AI though if I am being honest. Other than that it uses server resources, and that headless clients are a good way to offload weight on server

blissful current
#

Not my question. I'll simplify; I have a blank mission. No triggers, AI etc. The local-host has around 10fps less than the client.

#

Why?

hallow mortar
#

AI usually (but not always) is local to the machine hosting the game, whether that's the DS or a player hosting locally. So AI presence will have an impact, quite a serious one if there are lots of AI. The host also has responsibility for various things like the JIP queue and anything that has to be global. A player machine hosting the game is acting as a server, and it has to do anything a server would have to do.
Also, if your hosting client and other client are not on different machines, but are just 2 copies of the game running on the same machine for testing, then they are competing for your system resources and the share may not be equal.

old owl
#

That is a better way of explaining what I was trying to say

#

In the case where you are hosting the mission, you are the server so isServer is true. Therefore your client is also processing server tasks, which is additional load your client is taking.

blissful current
#

Good point that they are competing for resources since I'm testing on the same machine.

blissful current
old owl
# blissful current What other server tasks are going on besides the JIP queue that Nikko spoke of?

That would depend on your mission- I have no idea. Anything AI though is gonna be processed on your client since you are server when you are running a local mission. Very possible there isn't really much else. From my understanding AI takes a large impact on server performance over almost anything else. If you were running a lot of intensive scripts (I.E. scripts with onEachFrame or other code on frame) that would have a large impact.

Again I don't really know a whole lot about AI- just speaking from a performance standpoint

#

Whoops didn't mean to hit send yet

#

@blissful current Not sure how much client performance is an issue for you but if it is check this out:

https://community.bistudio.com/wiki/Mission_Optimisation

I'm pretty unknowledgeable from an AI stand point since I do dev stuff for a life server that doesn't utilize any (lol) but performance is a constant juggle for us. If you are struggling with performance best tips I could give is:

  1. Spawn mission objects locally via createSimpleObject (performance preferred) or createVehicleLocal.
  2. If possible, only spawn objects on the client that need to be spawned via proximity to the player.
  3. Reduce the usage of drawIcon3D and other code that runs on each frame. Probably one of the largest client reducers for us outside of objects.
blissful current
#

Very cool info. Thanks! Generally speaking, are triggers or event handlers more expensive performance-wise?

old owl
# blissful current Very cool info. Thanks! Generally speaking, are triggers or event handlers more ...

I am actually not sure. I think it would depend on what is being done with the trigger or event handler. An event handler like EachFrame or Draw3D would almost always be more intensive than a trigger as triggers are generally proximity based. Pretty sure each trigger condition is also evaluated on each frame though so that could vary depending on how many you have in short proximity and how much you are running in them.

blissful current
#

FiredMan is common EH.

hallow mortar
#

Event handlers are better in principle because they only do anything when the engine event happens. Triggers need to regularly run their condition code, and they are also a simulated object in the world, which does count for something (though not a lot, it's not a very complex object).
That doesn't mean you should only use EHs, though. There aren't EHs for absolutely everything you want to do, and sometimes triggers or waitUntil are more useful.

hallow mortar
old owl
#

Which is very nice. Wish other commands like addAction had those same parameters.

blissful current
hallow mortar
hallow mortar
old owl
blissful current
#

How often does an addaction condition evaluate?

#

Same as a trigger?

hallow mortar
blissful current
#

Ah OK.

old owl
#

Only within proximity distance though

blissful current
#

Very cool.

old owl
#

If it is on the player though it will always be evaluated regardless of distance set I think

blissful current
hallow mortar
old owl
#

This is kind of interesting:

If a client has a low-end machine, they should not lead a group of many AIs as these would then be locally computed.

I thought AI was all handled on server? What is ran locally?

hallow mortar
old owl
#

Huh wow. I guess makes sense locality wise. How would it handle a host leaving mission? The AI itself isn't still local to just that client though right?

hallow mortar
#

The host can't leave the mission. If they do that the game ends.

old owl
#

Sorry I don't mean mission host I mean client

blissful current
#

If they are leader of the AI group it will be transfered.

hallow mortar
#

If the AI's owner leaves, it gets transferred to whatever machine has the next best claim. If another player inherited group leadership, they get the AI. If the AI become free range, they go to the server.

blissful current
#

I did a bunch of testing on this a few weeks ago and I'm hazy but basically I couldn't nail down exactly how it chooses the "best" claim.

#

It's not always in editor creation order. I can say that.

#

Meaning the order units are added to the group.

hallow mortar
#

The new group leader has the best claim; doesn't matter how they got group leadership. If the AI is the group leader, the server has the best claim.

old owl
#

Very interesting. I guess that also explains why HC's are possible. All this kinda makes me wanna make a mission with AI just to understand it a little more but all seems so black magic to me. So much of AI behavior is defined by the engine- seems tricky πŸ˜…

blissful current
#

The AI will be transfered to another human player in the group. I assume since that player is the new group leader and in control of the AI then ownership is also transfered.

hallow mortar
#

There is a connection between group leader and owning the AI, but they're not the same thing

blissful current
#

And best claim of group leader is weird too. I was able to get it to toss group leader to AI even if humans were in the same group, under the condition that the human group leader disconnects from the server.

#

So in my mission right now I have a EH that detects groupleader change and will give it back to a human if AI gets it.

#

You need to manually remove EH right? They can fire as many times as possible until you do remove it?

hallow mortar
hallow mortar
foggy stratus
#

I'm using BIS_fnc_holdActionAdd to create an action. When run from editor code I see the text "Hold space to request Extraction by PBR" under icon in center of screen.

#

But when compiled into my mod, and run from my mod I do not see the "Hold Space to..." text.

#

But the Hold action still works. How do I make it so we always see the "Hold Space to..." text? Here's the code that creates the action:

#

jboy_extractPBRActionID = [ player, format["<t color='%1'>Request Extraction by PBR</t>","#FFFF00"], // color is yellow "\a3\ui_f\data\igui\cfg\simpletasks\types\Boat_ca.paa", // idle icon "\A3\ui_f\data\map\markers\nato\b_naval.paa" "", // progress icon "jboy_currentTargetBox isNotEqualto [] and time > 5 and count (jboy_sogUnits select {alive _x}) <= 7", // start condition - Unit should be deployed to target box ao "true", // progress condition { }, // start code { }, // progress code { // completion code params ["_target", "_caller", "_actionId", "_arguments"]; showCommandingMenu ""; //hint ("Do extract by PBR! "+str _actionID); player removeAction _actionID; [] Spawn { // SHITLOAD OF CODE HERE.... };// end spawn }, { }, // cancel code [], 4, // duration seconds 8, // priority true, // remove on completion false // show in unconscious state ] call BIS_fnc_holdActionAdd;

pallid palm
#

```sqf
Copy text on all this and remove all the ( back slashes \ ) and your code goes here
```

hallow mortar
tulip ridge
midnight pike
#

I’m not sure if this is the right place or even the right channel to ask, but I have a question about a script. I’m looking for a script for an β€œairburst” explosion (an aerial artillery barrage.) with adjustable timing at different moments. I tried making one myself in an SQF file, or using various workshop tools, but nothing concrete worked. Most of my code didn’t work. I’d like to know if someone has one and would be willing to share it, or maybe advise me on how to create one using a script template.
Thanks in advance

jade acorn
#

Show your code

hushed turtle
#

If you need it to explode at specific moment, then you may need to use triggerAmmo on it.

hushed turtle
#

Does it show progress?

pallid palm
#

oh Awsome thx @tulip ridge wow i did not know that

foggy stratus
versed trail
#

Fired and FiredMan both have a listed restriction that they dont trigger when the camera is not within range where the shot would be audible. How does it work on the server with no camera, does it fire for every shot or none of them at all?

foggy stratus
verbal shoal
#

Hey yall, can anyone help me with some scripting? I am trying to change some ace medical UI things (specifically the outlined figure that tells you what is hurt, with a different model).

I know config coding and such but scripting just kicks my ass lol. Any help would be appreciated

granite sky
#

If you're not intending to change the number of body parts, you can probably just swap the images in medical_gui\data\body_image

#

no scripting involved.

verbal shoal
#

lemme try thanks lol

meager granite
#

I wonder if there is a way to check if player has game minimized so "say" command sounds wouldn't queue up and turn game into screamer once you set focus back to it

verbal shoal
stray kindle
#

iirc some of the time variables don't increase when the game has no focus

pallid palm
#

hello all: whitch one is the correct way ?
or whitch one is the Better way ?

0 = [] spawn SFA_fnc_Camo;

0 spawn SFA_fnc_Camo;
tulip ridge
pallid palm
#

ahhh ok i see thx so much @ Dart

hushed turtle
#

I thought it's slightly better to use 0 for performance reasons.

#

If wanted to pass nothing I would do spawn SFA_fnc_Camo, but we can't do that until 2.22

tulip ridge
pallid palm
#

that's what i was thinking but others said no

hushed turtle
#

So you're saying spawn by default takes _this as left side argument? πŸ€” I mean it's going to in 2.22

pallid palm
#

and so does call i think

pallid palm
#

copy

hushed turtle
#

Seems dumb to me. I don't use any arguments on left with call when I want no arguments to be passed. It's makes code cleaner compare to using []. So, I'm in fact passing arguments anyway for no reason whatsoever, despite not typing any.

tulip ridge
#

Yes

hushed turtle
#

Over time I learn more and more strange things about this language

#

Happy to see it being replaced in the future 🀣

tender sable
# hushed turtle Seems dumb to me. I don't use any arguments on left with `call` when I want no a...

Technically you are not passing in anything. Best to think of it this way: _this is always available in any scope whether it's call, spawn, if..then, while..do, etc.. when you omit the left side parameter of a call etc.. the current _this just carries into your spawned/called code block. When you specifiy [] or 0 or whatever, the _this in the spawned/called code block now becomes something else.

pallid palm
#

so i should just do like that there

spawn SFA_fnc_Camo;
hushed turtle
#

Not yet

#

In 2.22

tender sable
#

If you never use _this in your spawned code, you should be fine

pallid palm
#

ahh ok cool

tender sable
#

and yes in 2.22

pallid palm
#

i see ok thx so much guys

#

i'm so glad i did not change all my missions untill i found what was correct πŸ™‚

tulip ridge
#

You should just use [] if you're not explicitly wanting to pass anything
You can run into issues if you just blindly pass stuff

tulip ridge
pallid palm
#

oh i see yes ok Awsome thxs so much @ Dart

#

and other guys too πŸ™‚

hushed turtle
tulip ridge
#

It still gives a params error because the wrong type is being passed

#

The default is used with a warning

#

If you don't want to pass anything, you use []

tender sable
#

If you are using params with no left side argument you are certainly using _this inexplicitly. So yes, then provide the proper arguments you need to pass. To be honest, this is more about scope then passing arguments. When you call a function for example, you aren't sending in just the left side args or _this . You are also passing in the entire stack of private variables from the previous scope automatically. I am not aware of any way around that. Adding [] or 0 simply overwrites _this in the local scope. it doesn't wipe out any other private vars from previous scope (e.g. _unit or _myVar) hence why it's also best practice to always use private keyword. I wish there was a way to block the previous variable scope from being passed entirely to a called function but, I am not aware of any hack/trick that does so.

tulip ridge
#

https://community.bistudio.com/wiki/privateAll does that

Disables the implicit inheritance of local variables, as defined in the parent scope.
By default, any local variables defined in a parent scope are available to the lower scope code.
After using privateAll, parent scope variables can no longer be accessed implicitly. However, it is still possible to explicitly access parent scope variables using the import command.

tender sable
#

well ... that is amazingly good news to me. πŸ˜‚ . Does it also remove/private _this ? because if so, then you still don't need to pass a [] or 0 if using that.

tulip ridge
#

Not sure, haven't used it myself personally

tender sable
#

I was looking att example 2 but can't see it answer my question exactly. But it looks like it does

hushed turtle
#

So should I just use privateAll in of my functions? meowsweats

tender sable
#

I wouldn't attach any overall rule but, using that would keep the variable stack clean in a function if that is what you desire.

pallid palm
#

so Awsome guys really cool: thx so much: i love you guys πŸ™‚

hushed turtle
#

Hmm, I always declare local variables with private or params so I guess I don't really need it

pallid palm
#

private or params is fine imho

tender sable
pallid palm
#

cool

#

private makes them private for that scope correct ?

tender sable
#

using privateAll (having just seen this exists myself) would seem to help. And looks like you don't need to use private but I would consider that being a bad habit because the moment you don't use privateAll, you could be in a world of hurt

hushed turtle
#

πŸ€”

tender sable
#

no

#

when I said overwrite, I really meant it creates a new local inner-stack with a new _this and when you exit that scope and return, the previous _this is still there

pallid palm
#

oh shit πŸ™‚

hushed turtle
#

I though _this would be new in each function automatically

tender sable
#

you CAN overwrite other private variables though if you dont use private or privateAll. I suggest really digging into that scope page I linked to. it explains very easily how the variable stacks work

tender sable
pallid palm
#

oh nice shooo: thats good πŸ™‚

tender sable
#

Note: I should add that spawn is a special case. (I believe) Spawned code is typically not attached to the parent scope and none of the above applies.

#

I dont really use spawn so I can't speak as an expert on it

hushed turtle
#

I meant:

_this = [1,2,3];
_this call
{
    _this set [0,100]; // will change in _this in outside scope too
    _this = []; // Will this change _this from outside too?
};
#

I don't think it will

thin fox
tulip ridge
#

You can

thin fox
#

okay

#

πŸ€“

tender sable
#

He's not assigning, he's modifying a referenced array. and yes it will change the previous scope. If not simply because arrays are referenced objects data types

tulip ridge
thin fox
tulip ridge
#

If it wasn't possible, the first _this = [1, 2, 3] wouldn't work

hushed turtle
# tulip ridge No, `_this` after the call is `[100, 2, 3]`

So, _this is kinda like private by default. That's what I was asking. Which also means that privateAll won't do anything at all.

But If I omit the left side agument? Does call take _this by default like pamars does or does it use _this from outside? Like without having new local var in call scope

tulip ridge
thin fox
#

since it's a magic variable, that takes parameters/argument as I understand

hushed turtle
#

I don't see reason why engine should not allow overwriting it to be honest

tender sable
#
_this = [1,2,3];
_this call // applies new _this on inner scope (due to left side arg)
{
    _this set [0,100]; // will change in _this in outside scope too
    _this = []; // Will this change _this from outside too?
};
_this // [100,2,3]
tulip ridge
#

It really shouldn't
Hemtt will give a warning / error if you do it. Most tools don't check that though

tender sable
#
_this = [1,2,3];
call // no new inner scope created yet 
{
    _this set [0,100]; // will change in _this in outside scope too
    _this = []; // Will this change _this from outside too?
};
_this // []
thin fox
hushed turtle
tender sable
#

I like to think of it as just default behaviour of a new scope. Nothing is being passed. You just have access to previous PARENT scopes variable stack

#

when you provide a left side paramter list it just creates a new inner scope with new _this

#

I should have said parent not previous

hushed turtle
#

And I thought that's how it worked entire time. It's just our chat today confused me

#

What spawn {} in 2.22 does then? Is _this undefined by default? That's what I would expect

tender sable
#

I havent tested but my guess is that since spawn doesn't get parent scope it's all new anyway?? again, just a guess

#

I am not sure why it was added except for maybe people hated having to pass an empty [] all the time

#

so yeah, probably undefined?

hushed turtle
#

Code is more clean without it. Maybe it will be empty array by default. That makes more sense to me than passing _this by default. (like params does it)

pallid palm
#

i used to think that --> [ ] ment this if it was empty

#

which is maybe not a bad way to think of it

#

yes i know its a empty Array really πŸ™‚

#

btw guys sorry for opening that can of worms: i just wanted to be sure πŸ™‚

#

lol i had to change like 20 missions back to what i had before πŸ™‚

#

thx to god i did not change them all: Shooo πŸ™‚

#

btw hello @stable dune

stable dune
hallow mortar
# tulip ridge No

If you know the function accepts no parameters, it is faster to use 0 than []. Creating an empty array is slower than passing 0.

pallid palm
#

oh no lol πŸ™‚

hallow mortar
#

You should use [] if the function does accept parameters but they're all optional and you don't want to use any of them.

pallid palm
#

oh shooo ok lol πŸ™‚