#arma3_scripting
1 messages Β· Page 212 of 1
For publicVariables it is allegedly ordered. Although I'm not sure if that matters in any context.
Make sense but why is it smooth when humans fly but not when AI flies?
No, should it be?
nope, just another stutter issue I wanted to get out of the way
How are you observing this helicopter?
quantic waves, obviously
Stuff far from the camera gets fewer updates.
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.
Your unit is one of the heli passengers?
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.
I don't remember being flown by AI on DS looking that bad. Did it at the end of Escape missions at least.
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.
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
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
Yeah, this echoes what I noticed earlier Basically, the more inputs the AI has to process, the more obvious the issue will be from the client's perspective..
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.
Does this look okay? It seems to disable the radio subtitles on the localhost but not the client.
[false] remoteExec ["enableSentences", 0];
still looking for an answer on this
@dark viper sorry m8 im at a loss for this
lol the Drug Lab has a bunch of Crack house's around it lol
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?
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.
Possibly relevant: #arma3_ai message
What waypoint makes it turn its engine off though?
i understand all of that except where you said "reverse it while in game" dunno what you mean
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
I don't know how to do the 3DEN commands if you have an example
never used editor commands
What are you trying to do exactly?
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?
read Hypoxic's message, he saves data like a composition in the editor
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
For example RTB in simplex or Egress in Drongos Air Ops. with those ones they land and turn their engine off until they are called again
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
I think by reversing he means the opposite of saving object's vectors and positions, meaning reading saved values and spawning units with it
i know how to do all of that without 3den commands
im interested in how he uses the 3den commands specifically as I have not used them
Generally the process is to identify the lamp object classes that you need to disable, use a command like nearObjects to search for them and either setDamage or switchLight to disable them.
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
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 π
Can you use the teamswitch eventhandler to transfer support modules when a unit is switched?
I thought I has but apparently remote control may be different from teamswitch for the eventhandler purposes.
oh yeah, modules take their sync at the beginning of the game and that's it
I'll give you an example if I have a break at work today
afaik
OFP had a very simplified flight model. A3 uses PhysX. it was just simpler back then
OFP helicopters also maintained their ground altitude π your UH60 would rise/dive according to terrain below π
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?
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.
they did not change anything afaik
I stayed away from modules due to that "set in stone" aspect
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.
Hello. Is there a specific command to remove/unassign weapons accessories/attachs?
removePrimaryWeaponItem and relatives
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?
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.
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
anyone familiar with Hearts and Minds. Where do you put the "btc_custom_loc" at?
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
Lift Cargo, Move, Land waypoints
You could try this:
addMissionEventHandler ["TeamSwitch", {
params ["_previousUnit", "_newUnit"];
yourRequestModule synchronizeObjectsRemove [_previousUnit];
[_newUnit, yourRequestModule, yourSupportModule] call BIS_fnc_addSupportLink;
}];
Not tested
thank you
Thank you, will try
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 {
};
};
};
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
knew i was forgetting something
Is the FSM a script or a separate piece of software in the ARMA 3 toolset?
FSM editor in the arma tools
it is a different file type that handles choices/branches visually
may I interest you in our Lord and Saviour the Conversations system?
https://community.bistudio.com/wiki/Conversations
i know about conversations but can you control the flow with some logic in the config or you do need to make an fsm?
the conversations system uses FSM, that or you can trigger sentences manually with e.g kbTell
i dont remember seeing example of control flow for conversations in the wiki but yeah that's what i was wondering
Ah this is jogging the memory banks now. You helped me get the BIKB working last year but ultimately I had to ditch the idea because it wasn't suited for a MP environment. Can't remember why though, since it was over a year ago.
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
Yeah that might have been it. Okay but you are saying that FSM is independent of Conversations.
yeah you can use FSM without Conversations and vice-versa
but yeah this β seems wordy-wordy
is e.g _allSecondary (_powRescued only) the same as _allSecondary (_pilotFound only)?
Oh boy... how uhhh... complicated is this gonna be?
not at all, search for flow state machine, general concept. lots of explanation available
y e s
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
Actually better question, what is the time investment to learn this program? I'm OK with days but months would be another thing.
a couple of days really
is e.g _allSecondary (_powRescued only) the same as _allSecondary (_pilotFound only)?
I wonder, what is your actual script need?
players select an addAction at the end of the mission then the boss tells them what they did during the mission:
"You got the bad guy, but you forgot to cover your tracks, you did some extra stuff, you even found a POW, etc, etc"
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.
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.
so the _allSecondary sentence does not differ if powRescued/pilotFound/both?
It does:
- "You did all side tasks."
- "You did all side tasks. You rescued a pilot"
- etc etc
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.
ah. mind to break the sentence into smaller bits? this could save you work eventually ^^
Does this mean try to make it modular like plug and play?
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
Yeah I want to try to do that if I can.
So can all this be achieved with FSM?
yesss
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?
So the FSM is basically a visual representation of the code in my if statements? What is the advantage here?
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"; };
};
and this only applies to SQS or SQF, not FSM.
I see some new stuff here. What is happening here? It seems like the sentences variable is changing based on conditions?
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!
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?
yes, you could do then foreach + kbTell on that array
My convo function is called like this:
[_convo, [_caller, ranger], true] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _caller <= 100 }
];
So then I would do forEach on this function for the contents of the array?
I'm using say3d.
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;
I would have only the server run this function*, then remoteExec say instead
this way, one head, one decision, spread through the network
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?
. . . no?
Maybe I should pass as param my variables....
that's the "safest"
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.
Ya, so my issue is coming from somewhere else. Thanks!
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;
you say you use say(3D)?
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.
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)
Same for say3d apparently.
so why do you need a delay, are you using something else?
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.
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));
};
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));
};```
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
Shouldn't it use forEach _sentences and then select 0, select 1 from _x then, if they're paired?
oof, yes, I should get some sleep e_e
How does it know duration or I assign those?
I wanted to make a one-level array then mid-writing went another way π
you assign those, the numbers near the sound name
but let me fix it
although⦠if no more chat from the leader, you can get rid of them
I absolutely hate flat arrays for paired values, but they're all over the game :U
less memory impact π moar performaaance
o p t i m i s e d d d
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
conversation would be better right
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
can you change the pausing in conversation cfg?
doesn't have to be super in depth and I appreciate it
nope
you're saying you can use 3den commands to get data for later right?
yes, but one conversation at a time only in MP
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;
maybe it hasn't started that SQF has already looped back
SQF is⦠sliced-synchronous
you mean with the scheduler saying this right?
yes
theres no asynchronous functionality at all in scripting is there
yep β just that 3ms thing
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
this is awesome, where do I use the commands though? i do all my scripting on inits and triggers executing script files or using the in game debug console
I'm headed to bed. I'll play around with this tomorrow. Thanks!
you would build this in your text editor, then copy paste it to the debug menu in the editor, not in game preview
@blissful current I'm off for the night, LMK if more halp is needed! (β¦in about 8h yes ^^) g'night!
I could actually build something similar for 3DEN Enhanced if you'd take it @cosmic lichen
where does the data go? a file?
you'd use copyToClipboard to save it as a string so you can paste it in your code editor for later mission use
this is a weird workflow but i will come to appreciate it
good night wiki man
i wish there way a way to directly use waypoint objects
@dark viper for instance, I used it to build some data for this composition
https://github.com/hypoxia125/Carrier-Strike/blob/master/addons/game/functions/fn_InitSilo.sqf#L26-L37
and
https://github.com/hypoxia125/Carrier-Strike/blob/master/addons/game/functions/fn_InitSilo.sqf#L88-L116
or this:
to create a cool laptop, sat uplink type composition for a rally point system
the position and direction data was pulled from 3DEN objects when I built the composition
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?
yeah, relative positions based on the center
in game how would you place this composition
just that. if statements can be pretty hard to follow.
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.
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
thats what i figured
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.
yeah i use 3den enhanced
Just replace units group area_3 with [turret_1, turret_2, turret_3]
One can also implement custom commands via command palette
what the hell holy shit π
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.
which probably means they're not markers but rather icons
this is convenient you made advanced dev tools right? is there buttons for stepping through code like in a debugger or do i need to just put breakpoints on every line like I've been doing
i read your doc and didn't find anything about debugging in therre
execVM has no UI component
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.
Oh arma version
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"
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
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.
Who connected the neural network to Dedman? It answers questions like a machine gun.
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.
yeah!!!!!!
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.
What do you mean? The JIP queue is a queue, why would we not?
The big red banner on BIKI thay says "The order of persistent remote execution for JIP players is not guaranteed, i.e. the order in which multiple calls are added is not necessarily the order they will be executed for joining player." which makes calling it a queue pretty useless?
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.
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.
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?
But thats not a Arma version.
It needs to be a bit Arma-y to make it a Arma sticker
Yeah I realized after I sent it
I don't see why it would say that.
new remoteExec's are added to the end of the queue.
The queue is transmitted in-order, and executed in-order.
Maybe the wiki refers to that re-adding the same remoteExec can move it around when you expect it might stay on its spot
mission.sqf π€£
That reminds me of the Arma 2 3D mission editor that would output the mission stuff as SQF script
Technically you can also transmit image files via webbrowser and ui2texture. But its inefficient as heck
summoned
Typo
Loading fonts from mission file should be doable.
But unloading them is not supported, thats too much effort to implement. And you'd need to have unloading because the mission pbo will go away
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
no
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_Foowould be called with a1 beforefnc_Baris called with b2 (for JIPs). Having that guarantee will simplify certain things instead of having to workaround. - I would not expect using
remoteExecinstead ofremoteExecCallwould 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".
lier
well it worked
dammit
on profiling executable with -debug it even exports the raw jip queue contents
I'll have to search for it, but I'm pretty sure it says that because you said the remoteExec JIP queue may not be in order
Oh on my server i have
Objects: 2431 lines
_initMessages - Total: 9257
_initMessagesRE - Total: 122
Messages per Object ~1100 lines
Checked the code again.
JIP processing iterates through the queue with a forEach, and sends a separate network message for each remoteExec to the client.
They would be in-order.
remoteExec is quite complex and does a lot of jumping around.
client to server (just forwarding) to serverclient (validation) to server (just forwarding) (append to jip queue now) to target client
But its all in order
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
My mistake, it was KK #perf_prof_branch message
when pathCalculated EH fires exactly? I'm trying to debug it (systemChat) with an IA with some waypoints but no results shows up
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 ?
I don't know where that comes from, the code says otherwise π€·
Existing key is implemented as "remove old, add new at end"
Super, thanks.
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
Bohemia Interactive: Civil War
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.
//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
- So right now from remoteExec perspective it is either always delete (if order="") or shifted to current end if add/modify?
- If you go to adjusting the existing entry, then warning (on BIKI) would probably be suitable to know that it keeps its position. And what the semantics of an erase then add is for the same key.
yes, yes (The shift to end is also how publicVariable/setVariable works)
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?
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.
groupId alt syntax
When the path is calculated. Can be multiple seconds.
If it fails to calculate a path I guess it doesn't fire at all?
wdym? it takes some time to fire?
that's not the 'problem', I'm just testing this EH to see how it works, but I never got results on it
I probably have an example somewhere
I mean Arma literally takes multiple seconds to calculate an AI path.
Is there a way to remove functions from the JIP queue?
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)
Thanks for the example John
I think I understand now
No idea what kind but it says "potential performance improvements" on the wiki so I assumed (maybe wrongly) there had to be some.
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.)
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.
that's basically what PREP() does
how can you go around practically begging for help and then "k" people when you get the answer...jesus
So also some performance improvements (+ all the rest)
Lol, no idea then. I guess BIKI article is wrong...
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
And compiling from init.sqf would be in runtime right?
depends on where β e.g before any sleep is still loading (usually)
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.
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.
I see now, a potential
well that as well yeah π
good info woohoo Awsome
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
Since _chance_array is already [1], by doing [_chance_array] you're actually creating [[1]] - an array inside an array
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.
ahhhhhh, I knew it was gonna be something like that. thanks for the callout
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
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 π
@pallid palm no such thing in vanilla but I already exported and successfully imported the needed stuff, its all explained here -> https://community.bistudio.com/wiki/Arma_3:_Arsenal
rgr that m8
@split ruin i only use vanilla m8: what do you mean: no such thing in vanilla
I didn't find export arsenal button in the virtual arsenal crate I have in the mission
but export commands are working well π
ok cool m8
btw its called "Export to clipboard"
or : copy to clipboard i forget now lol
Ctrl+C & Ctrl+V work
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:
thats exactly what Ctrl+C does
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 π
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];
looks correct to me but what do i know π
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?
It does not necessary to work on every model. It may work on certain model, vice versa is true
cool good to know
That also does mean it may have different name
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
Config Viewer may not tell you it. animationNames command to check potential animations
when a path is calculated for the AI (iirc also when it fails which just gives an empty array)
if it doesn't fire you're doing something wrong
sadly no it doesn't have a step. I could maybe add it but that'll slow down your code significantly
also it'll be very limited
lets keep it the way it is its perfect
andybody have any idea on how to change outfits on trigger activation in arma 3?
thisList apply { _x forceAddUniform "U_AntigonaBody" };
yeah I think I was doing something wrong with it, thanks
@hushed turtle ur gonna have to elaborate that
Forces uniform on all units who activated trigger. It's easiest example I could think of.
can i make an outfit,Save it,Then get that outfit in the trigger?
to swap out for another
LIke entire loadout?
basically,Yes,if i made an outfit saved it,Then on a trigger get that outfit to swap out for another?
setUnitLoadout
https://community.bistudio.com/wiki/setUnitLoadout
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
You can get loadout from Virtual Arsenal
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```
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";
idk how to do that
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];```
@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";
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
@eternal ingot
- export the loadout form the arsenal with ctrl+c
- make a folder named "Loadouts" in mission folder
- make a file inside called "NAMSoldier.sqf"
- paste with ctrl+v what you have exported previously in the NAMSoldier.sqf file
- rename "this" with "_unit"
6)add this line
params ["_unit"];
- save
- 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
do i put params ["_unit"]; at the very top of the file?
srry, The sqf or folder?
sqf
perfect,I will try my best to make this work,Any problems ill come back for some help,Thanks
make a folder named loadouts
in the mission folder right?
yep
π
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
wtf is all that!!!!
no just for myself and maybe for my whole group of AI teammates
then use the 2end one
so where it says _this,Change to the name of whoever its wanted for?
no just leave it at _this
but the other guy said _unit?
_this _unit same thing kinda
alright,Ill try my best with this info thanks scott
if you want but i will still have to get the understanding of it before using it
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
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...
oh shit lol
well its either going to be really good or bad,But if its bad,I will keep trying till i get the best possible
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
ah,Even better,That would be good
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 π
ya i will,That would give me maybe a few ideas too
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 π
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
IIRC doMove and move waypoints have the same completion radius. Landing is different though.
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.
understood I'll give it a go, thanks y'all!
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.
like on top of a building for example, that was a fun discovery π
Are you sure there wasn't an invisible helipad there :P
lmao yeah and the ground next to the building where it crashed after the rotors exploded
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
Does anyone know if there's a way to script a vehicle to make its' engine noise louder?
No, it's a part of config
Thought that'd be the case...ohh well, quiet cars it is then
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
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...
Just ran:
(allVariables profileNamespace) select {profileNamespace getVariable _x isEqualType createHashMap}
Looks like bis_fnc_saveinventory_data is a hashmap 
yeah, it's not supposed to be. Hashmaps postdate the BIS arsenal :P
Hahaha aaaarghhhhhh
I wonder how that happened 
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
Should work. I've fixed those before.
profileNamespace setVariable ["BIS_fnc_saveInventory_data", []]?
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?
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.
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
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.
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
Was that restart-persistent? Like you couldn't overwrite "cheese" on that profilenamespace even after a restart?
Oh, I didn't try that- good thought. I'll close my game down and give that a whirl
Wow. Still won't change 
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
I verified this stemmed from a PvP server that utilized compileFinal'ing that variable as a "security feature". They have since stopped doing it, but has lasting effects it seems.
How to add items into a backpack in cargo? Or create backpack, add items and then put the backpack into cargo?
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 ?
It's not an easy task, see if these functions are helpful
https://github.com/PiG13BR/PIG-AiO_Menus/blob/main/Supply_Menu/functions/fn_getContainerCargo.sqf
https://github.com/PiG13BR/PIG-AiO_Menus/blob/main/Supply_Menu/functions/fn_addContainerCargo.sqf
Is this question for Arma 3 or DayZ (SA)?
Dayz SA π
Take this question to DayZ server sir
everyContainer is what I was missing
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 
That only works with street lamps
That command works for almost every light
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 ?
You can just do a simple while loop that get the player's updated position, removing and adding the loiter waypoint
Any example of that im not really experienced with scripting
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.
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]
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
If you're firing artillery then it might be corpses too.
That is maybe true too
well, I guess unconscious rather than corpses.
(Which is stupid logic of this misterious game anyways)
I think rabbits are supposed to be sideAmbientLife but this is not the sort of thing that I'd trust :P
sees an MXM-equipped rabbit
Enemy. Rabbit. 12 oclock. Kerry, engage!
Why the hell you removed your question
Not wise to engage a rabbit unless you've find some Holy Hand Grenade of Antioch mod.
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)
Oh i forgot this option π« thank you 
is there anyway to hide the inventory icon on corpses?
https://community.bistudio.com/wiki/lockInventory
Do you mean this
yes but for corpses
I think in this case InventoryOpened EH is your best friend
i mean hiding this icon
Oh I misunderstood
i think i can do a while loop to check if cursorObject isKindOf "CaManBase" then showhud false else true
bad idea haha
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.
hello all : i forget how do i remoteExec this on the server ```sqf
[p1] execVM "force_leader.sqf"
[p1, "force_leader.sqf"] remoteExec ["execVM", 2];
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
You still have a ground weapon container to deal with
not quite sure if this could work, as I tested, because when a unit is dead, it changes its side (idk the timing for this MEH to be able to check the killed side correctly)
@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
good to know then
ah I guess if is checking group side, it's fine
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.
oh that is dirty lol
function library uses compileScript command, so it supports SQFC too.
Had no idea that command existed to be honest
My way of dealing with it is just letting the players get the items, but they are unable to use [most of them], by using others EH like weaponChanged and slotItemChanged lol
I found that is too complicated to try to block players from viewing enemy's inventory, at least on a dynamic scenario like lib
I think it's a smart way actually, but at same time I think the players can get some items, like grenades and medical items as well
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
it totally scenario dependable
yes sir
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)
along with my cleanUP script it all works great
I guess cleanest would be removing all items in uniform, vest and in backpack and then locking rest by disabling simulation
that would work also i think
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
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
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
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
Thanks, knew there had to be something for it
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?!??
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.
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.
@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 π
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
Yes I don't care about the bots being like statues at spawn. But my point is: if a human slot himself inside the bot, will he be able to move then? They are just available slots for late joiners.
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
};
Are you certain your case is running? I've never had an issue with pushBack not tossing the value to the end of the array
I'm assuming you would just revert them back. Now I honestly don't know, how unit who has simulation disabled behaves for players. like when one is trying to join or if he players even can play such unit
Yes because it plays both.
Coz my loop would be way simpler:
_x enableSimulation false;
hideObjectGlobal _x;
} forEach (playableUnits - allPlayers);
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
Then, player enableSimulation true;player hideObjectGlobal false; is not that complex too ^^
will test soon.
As far as disableAI goes, you can just run disableAI "ALL" loop on all of them in init.sqf
Hmmm. Any chance you're pushing back a nil value? Still shouldn't cause the behavior you're describing but can't see much else in your script
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"];
No I just checked with systemChat str _sentences;, and everything is in order there. It must have to do with the function I guess.
I call it like this:
{
[_x, [command, testUnit], true] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance command <= 100 }
];
} forEach _sentences;
Also if they are outside of object draw distance, hideObject would likely do nothing to improve perfomance
Shot in the dark but there's no where else between your first script where you call a file where you utilize the var _sentences right?
I don't think so. But I just verified that my function is playing them backwards. Huh, weird.
I've just tried to team switch into unit who has disabled simulation and it is possible to do it, but you can't do anything when you play that unit. So, you could have them disabled and enable simulation again once some player join and spawns
I wonder if it's the way I call the function with forEach.
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
send the array at once instead of doing multiple remoteExecs
[_sentences, [command, testUnit], true] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance command <= 100 }
];
and change your fnc to accept an array
your remoteExec second argument should be a clientId
An array of objects also work
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?)
It returns the objects- you can remoteExec to
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
You are not wrong, but also you can use object just fine.
I see, should work with objects too.
remoteExecs don't necessarily come out in the right order at the far end. IIRC they're usually reversed. So do what Leopard suggests.
They're supposed to have guaranteed order π€
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).
remoteExecCall is guaranteed. Maybe.
And remoteExec with commands probably acts like remoteExecCall.
I thought remoteExecCall just ran the script in a non scheduled environment?
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.
cough Use CBA events cough
Ah okay I see what you're saying now apologies.
Yeah, I use CBA events for pretty much everything. Just beware that CBA does not process JIP messages in-order.
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.
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.
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.
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.
It's an awful lot easier if you can trust JIP ordering :P
lol that was funny @fair drum i could just hear you saying that lol
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.
Same exact way here. I honestly can't say I've ever had a problem with JIPs ordering ever but definitely prefer it convention wise. Just feels safer to run those scripts somewhere and access that data on demand. Plus I feel like just easier to manage a public variable over a JIP ID when it comes to removing
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.
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 
Idk I guess more or less appropriate depending on circumstance too. Tossing remoteExec ["", "whatever"]; in a deleted event handler doesn't really bother me
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
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.
Yeah it's not ideal, but it's also impossible to screw up by missing an EH.
{ } 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
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
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
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
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
can you fix it for me im not sure how
if (isServer) then
{
{ _x enableSimulationGlobal false } forEach units east;
};
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;
yes
ahhh cool thxs man your Awsome @cosmic lichen
This seems to work! Thanks!
You can also use the https://community.bistudio.com/wiki/Arma_3:_Dynamic_Simulation
Less to manage via extra scripts
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
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
They still follow the normal object rendering process
They're just not like explicitly hidden
I don't know what that is for ARMA 3 I can only guess
Needs to be within your object view distance setting at the bare minimum
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
In my last test, enableSimulation and hideObject were of pretty similar performance value for a broad set of units and vehicles on localhost.
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.
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
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?
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
dude that would be awesome
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
that sounds awesome
ok so PM me ok
Awsome Guy you are @hoary saddle Nice talking to you about Arma 3
yea man you too. You made a pretty sick mission as well. Thanks for letting me look at how you made it.
Hey, what's the code string to open the rear hatches on an Ifrit?
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"];
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 π
No not fixed.
We specifically made changes to allow remoteExec's to happen even earlier now. Most likely before the JIP's
Delete eventhandler makes the cleaning up alot easier now though
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.
More bothered by JIP state not being synced before JIP remote exec
What do you mean? That's incorrect.
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...
π
I'm excited for 2.22 I feel like the script promises are gonna be great for that too
My bad, I misread. I thought you were replying to this
Oh, they could even arrive before JIP publicVariables.
That is good if that is not the case this happens.
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
? both addaction/holdactionadd ranges can be set via params since quite some time now. although, i am on profiling build, might be that.
if you double-click the waypoint, increase the "completion radius", that usually helps. This should go in #arma3_editor , though, i think π
I set it with setWaypointCompletionRadius from code and currently set it to 30 . Is there a value you would recommend?
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.
@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 π
What type of waypoint?
and are you using AI mods?
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 
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.
Thank you, I use something similar, yes
Mostly just 'MOVE'. And no, no AI mods, just vanilla and scripts.
so your saying the groups don't even try to move to any of the waypionts ?
Exactly
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
```
I'm sorry, I'm not sure I get it, could you explain how 'group defining' is involved? π€
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
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
Planes definitely only works right (only do what you want, even by using commands) if you set them with careless behaviour.
For artillery waypoint, never seen that working, we generally use doFireArtillery directly.
but we still don't know how you set up your scenario
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
addWaypoint radius seems to create waypoints close to center usually. Count waypoint's position yourself if you want even distribution within the radius.
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. π€
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.
I wish I had my original code. Chances are was just counting radius wrongly which lead to waypoints being close to center
Non-JIP remoteExecs arriving before JIP publicVariables.
If it's ground vehicles then you're not necessarily doing anything wrong. AIs will sometimes refuse to drive to a waypoint 50m down a straight road.
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:
setWaypointPositionfor each waypont (checked with markers - they do actually change position and checked with free camera - these positions are unobstructed)setVehiclePositionfor group vehiclemovefor group
All of that has no effect
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;
};
Sometimes you can just move the vehicle slightly in zeus and it'll start moving.
yeah, tried it with setVehiclePosition, to no effect, unfortunately
my favourite is when they not only refuse to move, but also immediately delete any waypoints you give them, and if you move them, they try to return to their original spawn position
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
You don't use publicVariable on local vars anyway. Not sure if it throws an error, but it should.
How do I go about broadcasting the variable to all devices, from a script that only runs serverside?
You just use a global variable (i.e. no leading underscore)
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";
If a variable name starts with an underscore in SQF then it's local-scope.
Ah righty, my apologies. I miswrote my query, the variable I am broadcasting is called 'GhostObjects'. My bad
Still having some issues with my code so I'll give that first method a go, thanks!
The two methods have identical effect. IIRC it's even the same network message ID.
In that case I'm rather stumped, give me two seconds and I'll post the issue I'm having
Identical effect, second is faster if the variable already has the value you want set
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;
};
};
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"}
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 !
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
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
@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:
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;
};
};
!sqf
```sqf
// your code here
hint "good!";
```
β turns into β
// your code here
hint "good!";
// {
_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!";
Items aren't objects in A3.
you'd need to search through unit & container inventories to find them.
the phones are laying on the ground currently
In that case they're items inside weapon holder containers.
Probably GroundWeaponHolder.
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.
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.
I thought thats what the "_x" was for? I'm still learning lol
There's also a hanging end bracket in there I think?
All the brackets matched up according to NPP
so would I use _objectsList or _posArray instead of _x?
The brackets might match if you hadn't commented one out the start.
ok, I thoughts how you joined everything that goes together
_x only means anything inside a loop over an array, like forEach or apply.
now its throwing an error after taking the first and last bracket out.
{
// _x is the current array element here
} forEach _array;
// _x doesn't exist here
https://community.bistudio.com/wiki/Magic_Variables
always a good read regarding that (for beginners).
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.
it works! hell yea thank you.
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?
@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 π
I could be misunderstanding your question but if you're saying you're experiencing more lag as a player hosted mission versus when you're playing as a client when it's hosted as a dedicated; it may be because your client is also processing the AI since isServer is true
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
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?
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.
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.
Good point that they are competing for resources since I'm testing on the same machine.
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:
- Spawn mission objects locally via
createSimpleObject(performance preferred) orcreateVehicleLocal. - If possible, only spawn objects on the client that need to be spawned via proximity to the player.
- Reduce the usage of
drawIcon3Dand other code that runs on each frame. Probably one of the largest client reducers for us outside of objects.
Very cool info. Thanks! Generally speaking, are triggers or event handlers more expensive performance-wise?
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.
FiredMan is common EH.
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.
Trigger condition is not evaluated every frame, it's evaluated every [whatever the frequency attribute is set to, default 0.5 seconds]
Apologies, you're correct.
Which is very nice. Wish other commands like addAction had those same parameters.
How do they not do anything? Don't they have to evaluate a condition constantly? For firedMan is it not checking what was fired every time it happens?
"every time it happens" is not "constantly"
You can simulate it for addAction by making the action condition just a global bool, and having a separate system update that bool less frequently.
Yeah kinda realized afterwards I used two on frames and that wasn't a great example, that's my bad.
Every frame
Ah OK.
Only within proximity distance though
Very cool.
If it is on the player though it will always be evaluated regardless of distance set I think
This says to use agents whenever possible for performance:
https://community.bistudio.com/wiki/Mission_Optimisation
But the last comment here says "This also probably means agents cost more resources than normal AI"
https://community.bistudio.com/wiki/createAgent
Are these not contradictory statements?
"probably" is doing a lot of heavy lifting there.
That information was added in 2015 (so before a lot of the documentation and information from BI), as a note (so basically anecdotal).
It might be true. It's also possible that it isn't.
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?
Editor-placed AI is handled by the server by default. However:
- AI that is created on another machine (by script or Zeus) will be local to that machine
- AI that is transferred to another machine with
setOwnerwill be local to that machine - AI that is in a group with a player leader will be local to that player's machine
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?
The host can't leave the mission. If they do that the game ends.
Sorry I don't mean mission host I mean client
If they are leader of the AI group it will be transfered.
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.
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.
I'm talking about the best claim to get the AI, not the best claim to get group leadership
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.
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 π
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.
Yes, the group leader gets the AI, that is what I am saying. But I'm not talking about the process of how the new group leader is chosen, I'm just talking about the rules of who gets the AI. The rules of who gets the AI are quite clear: it's the group leader, and if the group leader is an AI then it's the server.
There is a connection between group leader and owning the AI, but they're not the same thing
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?
Yes, unless it's an object-specific EH and the object is deleted, in which case the EH is deleted with it
It's affected by rank. Higher-ranking units will typically receive leadership if it becomes available. If two units have the same highest rank then things become murkier.
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;
```sqf
Copy text on all this and remove all the ( back slashes \ ) and your code goes here
```
Do you have other actions available at the same time when it's in the mod? https://feedback.bistudio.com/T183273
Editor previews are what displays in Eden / Zeus when hovering over an object in the asset list on the right
There's a vanilla function to create them, but for units it doesn't include their backpacks in the image
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
Show your code
If you need it to explode at specific moment, then you may need to use triggerAmmo on it.
I've checked code of BIS_fnc_holdActionAdd. At first I thought it could be missing dependency in your mod(to make sure your mod loads after everything it needs - it happened to me before), but I don't see how that would change anything to be honest.
Does it show progress?
oh Awsome thx @tulip ridge wow i did not know that
That's the problem! Thanks much.
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?
Thanks for response. See post above from NikkoJT with link. It's an arma bug. But that link has a fixed function you can download and use instead.
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
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.
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
got it working, thanks king πͺ
iirc some of the time variables don't increase when the game has no focus
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;
First is never correct
Second is only correct if you want to pass 0 to the function. If you want to pass "nothing", use an empty array. [] spawn SFA_fnc_Camo
ahhh ok i see thx so much @ Dart
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
That's still passing parameters, it'll just be whatever _this is at the time it's called
that's what i was thinking but others said no
So you're saying spawn by default takes _this as left side argument? π€ I mean it's going to in 2.22
and so does call i think
Same with call
copy
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.
Yes
Over time I learn more and more strange things about this language
Happy to see it being replaced in the future π€£
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.
so i should just do like that there
spawn SFA_fnc_Camo;
If you never use _this in your spawned code, you should be fine
ahh ok cool
and yes in 2.22
i see ok thx so much guys
i'm so glad i did not change all my missions untill i found what was correct π
You should just use [] if you're not explicitly wanting to pass anything
You can run into issues if you just blindly pass stuff
Say SFA_fnc_Camo took a number, doing something like this would cause errors:
SFA_fnc_camo = {
params [["_param", 0, [0]]];
// this is just an example
};
"some string" call {
call SFA_fnc_camo; // Error, function expects number but got a string instead
};
If parameter has default then I just use default if types don't match. So I would never run into that
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 []
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.
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.
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.
Not sure, haven't used it myself personally
I was looking att example 2 but can't see it answer my question exactly. But it looks like it does
So should I just use privateAll in of my functions? 
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.
so Awsome guys really cool: thx so much: i love you guys π
Hmm, I always declare local variables with private or params so I guess I don't really need it
private or params is fine imho
you should always declare private or use params to auto-private them. Always.
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
So overwriting _this in functions overwrites _this in outside scope? Provided the function was called with _this?
π€
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
oh shit π
I though _this would be new in each function automatically
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
nope. not automatically. Only when there is a left side argument to the call
oh nice shooo: thats good π
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
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
_this is a magic variable, I don't think you can assign a value to it like that π€
You can
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
No, _this after the call is [100, 2, 3]
Ok, I don't understand how it's possible π
If it wasn't possible, the first _this = [1, 2, 3] wouldn't work
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
The _this inside the call is a new private variable
What I don't undestand is _this = [1, 2, 3]
since it's a magic variable, that takes parameters/argument as I understand
I don't see reason why engine should not allow overwriting it to be honest
hmm now It makes sense
_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]
It really shouldn't
Hemtt will give a warning / error if you do it. Most tools don't check that though
_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 // []
I mean, just the use of = imply a "modification"
Which means call doesnt take _this as left side argument by default and instead uses one from outside like any other variable
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
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
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?
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)
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
Hello
If you know the function accepts no parameters, it is faster to use 0 than []. Creating an empty array is slower than passing 0.
oh no lol π
You should use [] if the function does accept parameters but they're all optional and you don't want to use any of them.
oh shooo ok lol π
