#arma3_scripting
1 messages Β· Page 635 of 1
maybe andUp works but normal setVectorDir doesn't, mh
I've had issues with setting rotation of attached objects
can you send me a example line?
@still forum
_unit = typeOf player createVehicleLocal [0,0,0];
_unit attachTo [player, [0,0,0]];
_unit setVectorDirAndUp [[0,-1,0],[0,0,1]]
I attached to a memory point, and setVectorDirAndUp just does nothing for me π€£
whai
_unit = typeOf player createVehicleLocal [0,0,0];
_unit attachTo [player, [0,0,0], "launcher"];
_unit setVectorDirAndUp [[0,-1,0],[0,0,1]];
launcher does exist
maybe in some other lod
what's that thing up his a$$?! π
A bollard
I'm trying to attach a thing to my launcher position, but doesn't work without rotation :/
I shouldn't have broken it 
a literal "manpad"
oooh size factor!
can we get that so we have soldiers of different sizes as well? π
you opened the Pandora's box now
or RC tanks π
yes please!
oh my, the possibilities!
@jade abyss β !!!
still can't really get the setVectorDirAndUp working right :/
attached objects have a relative orientation to parent, but that command doesn't modify it.
Maybe we need seperate command to do that then.. with MP sync 
setVectorDirAndUp doesn't seem to modify the attached object orientation, atleast not when attached to a mempoint π€
hmpf
can you send screenshot of how your script looks for you?
This is it for me, he stands behind me
There surely is a BIS function that turns euler angles into VectorDirAndUp right?
dunno
there will if you do it π
eeeee
if it's "polar" its a bit different
no, it's not. it's in spherical coordinates
so yeah that's the one
note to self:
the amount of light flares (tracers) you can display at once is around 40/50
it will just render the closest 50 ones
when do bullets get deleted by the garbage collector?
when they hit for sure
BIG MAYBE after 8s of lifetime?
bullets or cases?
bullets themselves
BIG MAYBE after 8s of lifetime?
they have a life time in their config
yeah seems about right with the 8s
timeToLive
sounds like a feel-good song
whats a good eventhandler to detect if the bullet is no more to delete its lgiht?
i used waitUntil isNull but uh thats not that performance friendly π
so.. ill have to run a coroutine for every fired bullet?
none of them work work on bullets
we don't have "coroutines" in arma
Is it possible to make a 'force push' script? Bascially when i hit a key it would just apply x amount of force to a object
addForce?
Yea like that but
forces are only possible with PhysX objects
I tried git addForce, it didn't work
Yea that's the goal really
the alternative is velocity
Just push physx objects around abit like a gravity gun
I know zombies and demons manages to give their units alot of force in their hits but that would be config related i guess
not necessarily
you can do it with event handlers
plus it's not force
it's velocity
any way, if you want force addForce is your only choice
maybe addTorque too
Well ... technically, spawn is indeed a coroutine. It runs on the same thread afterall. However, you barely have any control about the scheduler indeed, which means you cannot pause a spawned script or resume it
just look in #arma3_animation :u
@vestal field
findDisplay 46 displayAddEventHandler ["KeyDown", {
params ["", "_key"];
if (_key == 33) then { //F
_obj = cursorObject;
_mass = getMass _obj max 1;
_obj addForce [player weaponDirection "" vectorMultiply _mass*2,[0,0,0]];
};
}]
Wondering if anyone can help me, as I can't really find much documentation on the wiki, I'm trying to add a new radio channel just for map markers, and only for specific players. I have the following code in init.sqf
// Air Radio
if (isServer) then {
_unitList = [S001,S002,S003...];
_radioIndex = radioChannelCreate [[255,0,0,0.8], "Custom Radio", "%UNIT_NAME", _unitList]; // Create radio channel
_radioIndex enableChannel [false,false]; // Disalllow text/voice messages
};
But I'm seeing the following error in the server RPT log
if (isServer) then {
_jhcUnitList = [S001,S002,S003,S004,S005,P001,P002,P003,>
14:58:03 Error position: <S001,S002,S003,S004,S005,P001,P002,P003,>
14:58:03 Error Undefined variable in expression: s001
14:58:03 File mpmissions\__cur_mp.Altis\init.sqf..., line 35
There is no unit/object named S001
Those are the names we've set for playable units
Obviously not, as they dont exist
Works when I host a LAN server, just not on dedicated
and where and how do you set the names exactly?
They're set in mission.sqm
is this a case issue? s001 vs S001?
SQF is case insensitive
its a player slot thats empty, no AI no unit
Ahhh, that would make sense
What would be the best way to add on a player-by-player basis then? I've tried doing the radioChannelCreate in init.sqf and then radioChannelAdd in initPlayerLocal.sqf but it didn't work.
My problem is I only want units in that list to use the radio.
Onjoin?
store them as strings, get them via getVariable with objNull as default value
Through playerconnected ir similar
If the unit needs to exist when the script runs, then run the script as the unit is created
But if I run it every time a unit is created, won't it create multiple channels?
Cant you create the channel in init and join players to it as they connect?
Anyone knows a way to change a CBA setting externally? What I mean is following: A checkbox setting value is stored in the variable XX_var1. Can be true or false, dependent on the checkbox setting.
Now, I change this variable externally, for example if I set in the debug console
XX_var1 = true;
But when I open cba settings, respective checkbox will stay unchecked, though the variable was set to true. How do I manage to have that CBA checkbox set external?
Makes sense, so something like
init.sqf
if (isServer) then {
_radioIndex = radioChannelCreate [[255,0,0,0.8], "Custom Radio", "%UNIT_NAME", []]; // Create radio channel
_radioIndex enableChannel [false,false]; // Disalllow text/voice messages
};
initPlayerLocal.sqf
if (_playername in _unitList) then
{
CHVD_maxView = 10000;
CHVD_maxObj = 10000;
_radioIndex radioChannelAdd [player];
}
Not tested -
init.sqf or initServer.sqf
if (isServer) then {
myCustomRadioChannel = radioChannelCreate [[255,0,0,0.8], "Custom Radio", "%UNIT_NAME", []]; // Create radio channel
myCustomRadioChannel enableChannel [false,false]; // Disalllow text/voice messages
};
onPlayerRespawn.sqf
if ( str player in ["s001", "s002", ...] ) then {
["myCustomRadioChannel", player] remoteExecCall ["publicVariableClient", 2];
waitUntil {!(isNil "myCustomRadioChannel")};
myCustomRadioChannel radioChannelAdd [player];
};
You could use missioneventhandlers. I dont remember the soecifics, but make sure that the unit is alive/created before you try to join it
The initPlayerLocal might run befire the unit even exists
@tough abyss imgr link
problem is server creates the radio channel id# but I don't think that # is broadcasted / synced to players? Could be wrong
Howdy folks...
...so I want to put a cooldown time for a repetable radio trigger that executes a .sqf script. Not a problem with a true; false; variable at the beginning and end of the script:
support = false;
//stuff
sleep 60;
support = true;
playSound3D ["A3\dubbing_f\modules\supports\misc_new_available.ogg", player];```
What I would like is a hint that comes up if the player calls the support with the radio trigger that says: "support will be available in: countdown time"...any suggestion?
So a scheduled task with "waitUntil alive player" (pseudocode)

Only 2 months and im already getting rusty to the degree i dont remember the syntax of these commands

waitUntil { not isNull player };
```β¦or use `initPlayerLocal.sqf`
why those true false?
Allow text but not voice I believe
Oop, wrong reply
@winter rose is initPlayerLocal good for this?
Does init after the unit is created?
Well, i usppose so
It comes after init.sqf, right?
So after the mission.sqm aswell
did you try steam overlay?
or maybe nvidia shadow play
I unloaded all my mods but still cant play official servers
I get a error with something with "addons"
and key
what does it have to do with scripting?
β #arma3_troubleshooting , not #arma3_scripting @tough abyss
Just tested this
15:42:52 Error in expression <(_this select 0) publicvariableclient (_this select 1)>
15:42:52 Error position: <publicvariableclient (_this select 1)>
15:42:52 Error publicvariableclient: Type String, expected Number
Because I put in the trigger condition the this && support; variable.
Not good?
what trigger?
As I stated here..
#arma3_scripting message
the script is called with a radio trigger...
Fisher I've implemented publicvariableclient wrong, wait one
Thank you
onPlayerRespawn.sqf
if ( str player in ["s001", "s002", ...] ) then {
[clientOwner, "myCustomRadioChannel"] remoteExecCall ["publicVariableClient", 2];
waitUntil {!(isNil "myCustomRadioChannel")};
myCustomRadioChannel radioChannelAdd [player];
};```
what's a radio trigger?! π
Trigger activated by radio channel: "alpha","bravo"....π
R you trolling me???
π
no I don't know what they are. I'm not a mission maker
anyway, you can just put the code in the activation code
it's a trigger that triggers when you press 0-0-1 (Alpha) to 0-0-9 (β¦other letter)
the time has come.
i am willing to learn how to differnetiate between reference and value clone
anyone able to explain how to do the two things?
you're referring to arrays?
i am willing to reward that person up to 1 virtual cookie πͺ
Thanks Ryko, I'll try that now
yes arrays
well, how to i make a reference and how do i make a value clones
one a reference, one a clone?
yeah
Ok.....anyway, you can just put the code in the activation code... like?
@spark turret
_array = [];
_ref = _array;
_copy1 = _array + []; //shallow copy
_copy2 = +_array; //deep copy
so you want to activate the radio trigger, then it shows a hint, and after 60 seconds does something?
@spark turret further reading:
https://community.bistudio.com/wiki/%2B
Basically I want to prevent the player from spamming the support request (activated by a radio trigger)..
ok. but if it's a one time thing why not just delete it afterwards?
ok. so what you wrote should be fine...almost
thanks will read up
almost?...I start to know you and I'm getting scared here...hahahah..
you can't define (initialize) it there
where then? init?
triggers don't have init
mission init.
no not that
maybe this
if (time < missionNamespace getVariable ["nextSupport", 0]) exitWith {
systemChat format ["Support will be available in %1 seconds", round(-time + (missionNamespace getVariable ["nextSupport", 0]))];
};
nextSupport = time + 60;
[] spawn {
sleep 60;
playSound3D ["A3\dubbing_f\modules\supports\misc_new_available.ogg", player];
};
try that in your trigger activation code
I'll test it now..report back asap
thank you

@serene quiver also don't forget to set your trigger condition to this
@tough abyss ctrl+alt+prtscr on windows to copy current active window
Roger that
@serene quiver I think I misunderstood what you wanted.
or maybe I didn't
let me know if it does what you want
@little raptor Told me to validate my data in arma
Im doing it rn but its loading forever
he didnt see my error btw
π₯³ Yap..EXACTLY what I want. THANK YOU
can i put my pc on sleep while its validating @little raptor
ive had that before, forgot why and how to fix. according to biki my code is correct?
//define parameters for the sound (playSound3d)
_left = [
_sound,
objNull,
false,
_position,
_volume,
_pitch,
0
];
[_left,_shots,_id, _fireRate] spawn {
params ["_left","_shots","_id","_fireRate"];
for "_i" from 0 to _shots do {
_left remoteExec ["playSound3D",_id];
sleep _fireRate;
};
};
error:
17:26:55 Error when remotely executing 'playsound3d' - wrong number of arguments (7) passed, must be either 0, 1 or 2
playSound3d takes 7 arguments, so i dont get why it doesnt want them now
[[]]
Not getting any errors now (woohoo!), but it doesn't seem to add the radio channel
[_left] @spark turret
Only thing is
16:24:56 Server: Object 7:6 not found (message Type_120)
16:24:56 Server: Object 7:7 not found (message Type_92)
but I have no idea what that is
are your units named s001 or S001? because converting it to strings will probably make it a case issue... ie., try changing it to str player in ["S001", ... if your unit variables are S001
toLower
you could do that, or you can be consistent with your variables
variables are not case sensitive
in is case-sensitive yes
I'm using code that was already there and working in onPlayerRespawn to set viewdistance
Unit names are definitely capitalised
anyway, str in is an awful way to do so π
or you could use findIf
Hey, I'm not saying it's perfect, I'm just saying it's a means to an end when you can't ensure the variable is there or not
@tough abyss change it to str player in ["S001" and see if that works, if it does then you can either keep on rollin' with that or find a prettier way to do it
when you can't ensure the variable is there or not
isNil
isNull
only check isNull if its not isNil
Sure, add an extra step
_playername = str player;
if (_playername in _unitList) then {
Has worked for us before
Just adding your code inside the if statement
It works!
why string? doesnt your unitList hold objects?
Added to onPlayerRespawn.sqf
customRadio enableChannel false;
It's player objects, so if the slot isn't filled, the variable doesn't exist
also a guess, but str player will not catch respawned players bc their object changes iirc. could use name player
respawned players keep their vehvarname I believe
yeah, that's my experience
For anyone else - or myself when I forget, below now working
init.sqf
if (isServer) then {
customRadioChannel = radioChannelCreate [[255,0,0,0.8], "Custom Radio", "%UNIT_NAME", []]; // Create radio channel
customRadioChannel enableChannel false; // Disalllow text/voice messages
};
onPlayerRespawn.sqf
if (str player in ["Unit1", "Unit2"...]) then
{
[clientOwner, "customRadioChannel"] remoteExecCall ["publicVariableClient", 2];
waitUntil {!(isNil "customRadioChannel")};
customRadioChannel radioChannelAdd [player];
customRadioChannel enableChannel false;
}
So you've got specific units which are tied to air channel - are they also units of the same class? Or rank? I'm just trying to imagine a better identifier to when they get added to a channel rather than a specific unit variable name, so Leopard20 can be happy
The reason we have it like that is because we're a Milsim, so it's to separate out the different roles
Could you use rank as a differentiator? If the player is a certain rank, they get added to the channel?
thanks ill give this a try
Hi everyone, I have a problem with the addon compiler.
I am calling a file for a function class testFunction {file = "test.sqf";};
It compiles the folder and Arma 3 detects the category, but can't find the file test.sqf.
The sqf and the config.cpp are in the same folder.
post your cfgFunctions
hy, I created a bear for arma 3 named Brownbear_F. I added the bear to the automated spawned Species on my map. how can i find one with script command in editor debug console?
`class CfgFunctions
{
class blue_mind
{
class Test
{
tag = "testtag";
postInit = 1;
class testFunction {file = "test.sqf";};
};
};
};`
try near(est)Objects
nearestObjects [player, ["Brownbear_F"], 1000];
postInit should be part of the function, not its category.
but I don't think that's the issue
Have you made it into an addon?
or is that in the mission folder?
if it's an addon, you must add the addon path too
I made it to an addon, but I didn't knoe, that I needed to add the path. I will try it.
@fading tiger something like "MyAddon\test.sqf"
@little raptor It give back many of this values under the debug execute window: 0x2cbe4180,Agent.
@little raptor That's it, thank you very much. I appreciate it.
@little raptor no i have too much trees, is there a possible setpos player command to see it?
My_Animals = nearestObjects [player, ["Brownbear_F"], 1000];
onEachFrame
{
{
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\CrewAimIndicator\gunnerAuto_ca.paa", [1,1,0,1], ASLToAGL aimPos _x, 0.5, 0.5, 0, str _forEachIndex];
} forEach My_Animals;
};
to setpos:
player setPosASL getPosASL (My_Animals#0);
get the index from the icons, and use it like (My_Animals#index)
nice! thx a lot @little raptor
hey guys ive put
//--- Control Chat - Format: {channelID<number>, disableChat<bool>, disableVoice<bool>}
disableChannels[] = {
{0, true, true}, //--- Global Chat
{1, true, true}, //--- Side Chat
{2, true, true}, //--- Command Chat
{3, false, false}, //--- Group Chat
{4, false, false}, //--- Vehicle Chat
{5, false, false}, //--- Direct Chat
{6, true, true} //--- System Chat
};``` into my description.ext
however i can still manage to type in chat, does it not necessarily mean i cant type but others just wont see it?
This is in your description.ext?
yeah should it be in a init.sqf?
I think it's not working properly there - surest way is to put
2 enableChannel [false, false];
``` in your `initPlayerLocal.sqf`
(Obviously one statement for each of the channels you want to affect)
ahhh because enablechannel is a local command IIRC
Yup
thanks ill give it a go
π
it worked but global channel was still there :/
0 enableChannel [false, false];
1 enableChannel [false, false];
2 enableChannel [false, false];
3 enableChannel [false, false];
4 enableChannel [false, false];
5 enableChannel [false, false];
6 enableChannel [false, false];```
unless global cannot be stopped
You can't remove that channel, or direct channel. But only a logged-in admin can use global anyway
yup
last quick question
if lets say on a dedi i would want to login as the admin how would i do it with every channel disabled haha
unless i keep direct open maybe
I think when you're in the lobby screen the sqf isn't run yet, so group channel isn't yet disabled, and further, since direct can't be disabled, you'll always have a channel to type in
ohh okay makes sense thanks for the help bud
you could remove their radio
does a unit not having a radio actually do stuff?
iirc, it takes away all the chat channels,
i dropped my radio, i still had global channel, but that might be because I'm host/client in my test serevr
Huh, I didnt think it actually did anything
I'll have to test that at some point, thanks 
π
Hello..
would createTrigger be more performance-friendly/efficient than a regular trigger? Let me explain: I have 9 composition (bandits camps) that spawns randomly on 36 markers scattered around Altis. To have guards patrolling the camps I set up triggers (BLUFOR present) so they spawn once the player gets near them. As you can imagine, there're a LOT of triggers around the map. I thought that maybe get the trigger to spawn JUST where they're needed would be better. Is it? And how?
I looked up the https://community.bistudio.com/wiki/createTrigger page...
Something like this?
_trg = createTrigger ["EmptyDetector", getPos ???];
_trg setTriggerArea [400, 400, 0, false];
_trg setTriggerActivation ["WEST", "PRESENT", true];
_trg setTriggerStatements ["this", "execVM "spawn_guard.sqf";"];```
Thank you
NOTE the ```sqf
setPos ???``` that because is unclear to me what to put here. I could use setMarkerPos "marker" but then I have to create 36 of themm.I'm confused.
Lots of triggers isn't a good idea. I'd run something a bit differently; a single routine which checks every X seconds to see if your player is in the vicinity of, say, a marker. And if so, then you run your spawn_guard.sqf script
And how you do that?
untested -
myFancyDetector = [] spawn
{ while ({alive _x} count allPlayers > 0) do
{ sleep 20;
{ if ( [allPlayers select {alive _x}, getMarkerPos _x] call BIS_fnc_nearestPosition < 400 ) exitWith
{ (getMarkerPos _x) execVM "spawn_guard.sqf"; };
} forEach myMapMarkers; // predefined array of your markers
}
};
I assume you'd need to pass a position to spawn_guard.sqf
exactly..
I'm gonna test that script now..report back asap
Doesn't seem to work...mmm..just to be clear, this is how I tested it:
VR map,
1 player.
3 markers: "marker_0","marker_1","marker_2"
In the init.sqf:
private myMapMarkers = ["marker_0","marker_1","marker_2"];
myFancyDetector = [] spawn
{ while ({alive _x} count allPlayers > 0) do
{ sleep 5;
{ if ( [allPlayers select {alive _x}, getMarkerPos _x] call BIS_fnc_nearestPosition < 5 ) exitWith
{ (getMarkerPos _x) execVM "spawn_guard.sqf"; };
} forEach myMapMarkers; // predefined array of your markers
}
};```
spawn_guards.sqf: `hint "activated";
`
would need to see the errors produced in your rpt
I kind of whipped that up quickly, no idea if the format is 100% correct
no errors..just nothing happened
private myMapMarkers = ["marker_0","marker_1","marker_2"];
thats wrong, you dont private global variables.
they're strings
correct form?
what do you mean? unless myMapMarkers had an underscore at the start, it is a global variable, which you dont private
I assume you popped the player within 5m of your map marker?
Oh duh, yeah he's right
Just do myMapMarkers = ["marker_0","marker_1","marker_2"];
nope..I walked there if it's what you mean
I was confusing that with private ["marker_0", "marker_1"]
well the BIS_fnc_nearestPosition command is comparing all the players to each map marker one at a time and seeing if a player is within 5 meters of the iterated markers
but start by removing that private statement π
im not sure i understand this either
[allPlayers select {alive _x}, getMarkerPos _x] call BIS_fnc_nearestPosition < 5
the way i read it, that checks if an object is less than 5
yeah, your original trigger specified 400m radius, which is why I had used < 400 instead of the < 5 you put in
oh man I'm quite tired it seems
either way, an object isnt a number so you're not comparing it correctly
That'll just return the closest object
Yeah didn't want to walk that far..lol
Well it's a farther walk unless your marker is 5m away from you
it's way more than 5 meters, tha's for sure..
myFancyDetector = [] spawn
{ while {alive player} do
{ sleep 5;
{ if ( player distance2d getMarkerPos _x < 400 ) exitWith
{ (getMarkerPos _x) execVM "spawn_guard.sqf"; };
} forEach myMapMarkers; // predefined array of your markers
};
};
The 400 is specific, it means if a player comes to within 400m of the map marker, it'll launch your script. If you make it 5m, the player will have to come to within 5m of the map marker.
can optimize that with findIf instead of count (both for the while and if conditions)
Sure could, I'm whipping this out pretty rough
Frankly I wouldn't use {alive _x} count allPlayers > 0 as a while condition anyway, I'd just use while {true}... in fact that's probably another reason it isn't working
Forgot to say: it's SP mission..if that make a difference
It certainly does
sorry about that!
that feels about right
Still no joy though..even If I move the markers further away....
Or do it the other way around. Attach a trigger to each player and check if the camps are in the trigger
Even simpler with a SP mission. Attach ellipse marker to player, make marker invisible, check inArea _myMobileMarker
Attaching a trigger to the player is a great idea!!! Just to be clear.... in the condition of the trigger check for an object common in every camp, then "on act" it executes the "spawn_guard.sqf", right?
Furthermore, I have to do that for every playable unit, right?
well im not sure if you can move the normal, blue triggers. but the next best and very similar thing is an area marker. it can do 95% of the things a real trigger can
yeah for every unit that should trigger the camps
ah wait, you cant attach markers. only loop their position
Hold on....thought of something..
at every camp location/marker I have EOS (https://forums.bohemia.net/forums/topic/144150-enemy-occupation-system-eos/) spawning additional units scattered around a wider area. (it uses markers) can I use the already-created trigger to get the guard.sqf to run?
yeah sure
it might be easier to write yourself a loop that gets the distance for every player to every camp, and triggers if the distance is smaller than 2km or sth
while {Run_Loop} do {
{
_player = _x;
{
_distanceToCamp = _player distance _x;
if (_distanceToCamp < 2000) then {
systemChat str ["player",_player,"triggered",_x];
};
} foreach [_camp1Pos,_camp2Pos,_camp_n+1Pos];
} foreach allPlayers
sleep 2;
}
something along these lines
Thank you..I'll test that (put that in the init.sqf, right?)
you will have to modify it first
you need to define run_loop and also the camp positions
π ..ok...ππ»
I'm gonna try the attach-trigger also.You CAN attach the normal "blue" trigger to a player..
Triggers check for their condition much more often, so i would guess they are more performance costly
I see....no wonder with more than 40 triggers my mission in struggling...
Lol yeah that might be the case
The advantage the loop has, is that you can control how long it sleeps.
ok..how you define the run_loop? and as far as the camp positions, is the markerPos enough ?
or the name of the marker?
Yeah "x distance y" can take objects or 3d positions.
Run_loop is just a global boolean so you can kill the loop from outside.
Just define it as true above
is that english? lol..
Its a variable that is true or false = boolean and can be accessed from outside the script = global
Just put "true" as the while condition, you dont really need the run_loop
while {true} do {
{
_player = _x;
{
_distanceToCamp = _player distance _x;
if (_distanceToCamp < 2000) then {
systemChat str ["player",_player,"triggered",_x];
};
} foreach ["marker_0","marker_1","marker_2"];
} foreach allPlayers
sleep 2;
}```
Hm does "distance" allow markers as input?
Zagor you are trying to feed it a marker, but it only takes positions. So you have to get the markers positio first and feed it that.
With this
while {true} do {
{
_player = _x;
{
_distanceToCamp = _player distance _x;
if (_distanceToCamp < 2000) then {
systemChat str ["player",_player,"triggered",_x];
};
} foreach [getMarkerPos ["marker_0","marker_1","marker_2"];];
} foreach allPlayers
sleep 2;
}```
while {true} do {
{ //player forloop _x = player here
_player = _x;
{ //marker forloop _x = marker_n here
_distanceToCamp = _player distance (getMarkerPos _x);
if (_distanceToCamp < 2000) then {
systemChat str ["player",_player,"triggered",_x];
};
} foreach ["marker_0","marker_1","marker_2"];
} foreach allPlayers
sleep 2;
}
I've got an interesting question;
I have an array with an undefined amount of values, and I would like to return a random selection from it based on a given percentage.
eg. An array with 100 values, and a percentage of 30% should give 30 random values.
It works!!Thank you ma, how do I get to execute the "spaw_guard.sqf" now?
hold on..I'm getting this..lol
while {true} do {
{ //player forloop _x = player here
_player = _x;
{ //marker forloop _x = marker_n here
_distanceToCamp = _player distance (getMarkerPos _x);
if (_distanceToCamp < 2000) then {
execVM "spawn_guards.sqf";
};
} foreach ["marker_0","marker_1","marker_2"];
} foreach allPlayers;
sleep 2;
};```
if (index mod (count array*0.3) == 0) then {its one of the 30% indices}?
sth like that? not sure i get the prblem
yeah like that. problem is, that way it gets executed every 2 seconds. so you need a way to stop spamming guards, once the camp went active
i would make a second array that stores all active camps. once the players activate one, it gets added to the _activeCamps array and the loop will see that and not run the script a second time
rough concept off the top of my head
private _array = +_source;//[...]
private _percent = random 1;
private _output = [];
for "_i" from 0 to floor(count _array * _percent) do {
_output pushBack (_array deleteAt floor random count _array);
};
_output
"" i would make a second array that stores all active camps"" ....how do I do that since the camps are compositions that spawn randomly?
maybe an array of objects contained in the camps?
i/e: myCampObjects = ["box1","box2","box3"]; ?
and "activeCamps array" where it goes inside your previous script?
I would say that 99.9% of modern keyboards have the Win key (or similar), so that shouldn't be an issue.
Although I wouldn't use it since ACE uses it by default and will cause more complaining from people who want to use your mod/script in combination with ACE.
as long as people can rebind it, nobody will really complain π
variables can be integers as well
missionNamespace setVariable ["money", 100000000];
money == STRING
missionNamespace setVariable ["money", "100000000"]; isEqualTo money = "100000000000"
so you are checking if a string (money) is greater than a number.
missionNamespace setVariable ["money", 100000000]; ?!?
now it's a number
We all do.
But then there's arma π
Sorry, i didnt mean actually storing the camps themselves but rather a value that represents the camp.
So like:
_activatedCamps = [];
_activatedCamps pushback "Marker_Camp1";
//camp1 is now "marked" as active. Check with:
If ("Marker_Camp1" in _activeCamps) then {
//is already active
}
That way you can check before you activate it on player proximity. Otherwise you get new guards every 2 seconds
I'm sorry..but how to "insert" that in the script you wrote above? I wouldn't now how..sorry mate
np
Yah LOL..they were spawning like crazy.
//empty list that will hold all already active camSetPos
_activatedCamps = [];
//loop that checks for player proximity to non-active camps every 2 seconds
while {true} do {
_inactiveCamps = ["marker_0","marker_1","marker_2"] select {
//filter out already active camps from this array
!(_x in _activatedCamps)
};
{ //player forloop _x = player here
_player = _x;
{ //marker forloop _x = marker_n here
_distanceToCamp = _player distance (getMarkerPos _x);
if (_distanceToCamp < 2000) then {
_activatedCamps pushBack _x;
execVM "spawn_guards.sqf";
};
} foreach _inactiveCamps;
} foreach allPlayers;
sleep 2;
};
its pretty dirty code
sorry kinda burned out for today π
I would know if it's dirty or clean..lol..to it work or it doesn't. THANK YOU..you've been more than helpfull.
A prettier version would be to start with an array of inactive camps and delete each camp from it when its activated.
"Find" and "deleteat" are the methods you could use for that
EDIT: WORKS!!! Thank you @spark turret
//empty list that will hold all already active camSetPos
_activatedCamps = [];
//loop that checks for player proximity to non-active camps every 2 seconds
while {true} do {
_inactiveCamps = ["marker_0","marker_1","marker_2"] select {
//filter out already active camps from this array
!(_x in _activatedCamps)
};
{ //player forloop _x = player here
_player = _x;
{ //marker forloop _x = marker_n here
_distanceToCamp = _player distance (getMarkerPos _x);
if (_distanceToCamp < 50) then {
_activatedCamps pushBack _x;
execVM "spawn_guard.sqf";
};
} foreach _inactiveCamps;
} foreach allPlayers;
sleep 2;
};```
@spark turret Now how I can get a group spawn only at active markers?
guardGroup= [getPos ???, EAST, (configfile >> "CfgGroups" >> "East" >> "CFP_O_WAGNER" >> "Infantry" >> "cfp_o_wagner_infantry_security_detail")] call BIS_fnc_spawnGroup;
wp1 = guardGroup addWaypoint [getPos ???, 0];
wp1 setWaypointType "GUARD";
wp1 setWaypointSpeed "FULL";
wp1 setWaypointBehaviour "AWARE";
wp1 setWaypointFormation "DIAMOND";```
Something on the line of:
```sqf
if (player = <500 _activatedCamp ) then {
guardGroup= [getPos ???, EAST, (configfile >> "CfgGroups" >> "East" >> "CFP_O_WAGNER" >> "Infantry" >> "cfp_o_wagner_infantry_security_detail")] call BIS_fnc_spawnGroup;
wp1 = guardGroup addWaypoint [getPos ???, 0];
wp1 setWaypointType "GUARD";
wp1 setWaypointSpeed "FULL";
wp1 setWaypointBehaviour "AWARE";
wp1 setWaypointFormation "DIAMOND";} else {exitWith {}};```
???
call compile format["%1", cursorObject]
4:22:01 Error in expression <2ab29410080# 1779940: hatchback_01_f.p3d>
4:22:01 Error position: <ab29410080# 1779940: hatchback_01_f.p3d>
4:22:01 Error Missing ;
Hello, has anyone got this problem nowadays? I'm stuck with this (the only way I found to solve this problem is to not parse the object in a local variable and do everything I want inside the call compile, but it's really ugly)
objects dont work in strings like that
you may want to try this
object to string -> netID cursorObject
string to object -> objectFromNetID _netID
(BIS_fnc_netID if SP)
_inactiveCamps = ["marker_0","marker_1","marker_2"] select {
//filter out already active camps from this array
!(_x in _activatedCamps)
};
_inactiveCamps = ["marker_0","marker_1","marker_2"] - _activatedCamps;
if (player = <500 _activatedCamp ) then {
wat?
getPos ???
don't use getPos for waypoints and stuff. (positioning where height is important)
this started poping up in my rpt logs today. maybe even there yesterday. im not sure. can someone tell me what this means. Yes we have made changes to our framework but dont know when this started.
Ref to nonnetwork object <No group>:0 (Logic)
Ref to nonnetwork object 1821648: <no shape>
@lucid shale got those log entries too. Plenty of them. Would like to know too where they come from. Had no time to investigate yet.
Another question: I would like to get direction and position of a fired weapon. Could be an infantry held weapon or some vehicle weapon. I tried to get _muzzle from fired event, but no luck
And another question π
I want to addForce to an object 90Β° from it's current direction. Any math crack here?
@little raptor First of all again, thanks a lot for your help. I have implemented your system to detect glitched units now and it works for 95% of them but there are still a few units glitched into certain buildings that don't seem to get detected. Do you have any suggestion for a backup system?
@proper sail yes, I need vector in format [x,y,z]
Isn't there a nice function for that?
you can try the view LOD too.
another thing that is useful is getPos _unit select 2 < 0
why are you call compile'ing at all anyway?
Your code above looks like it could be a getVariable
that's wrong
it compiles:
<2ab29410080# 1779940: hatchback_01_f.p3d
which is not a valid expression in SQF
hence the error
if you compiled: "cursorObject" it would work (call compile "cursorObject")
but as Dedmen said, I'm not sure why you're compiling that in the first place
The last thing doesn't work (that was my first idea as well) since the units are not glitched below the ground (height < 0) instead they are above ground but glitched into buildings.
Thanks for advice, Lou
I know, I tested it but it doesn't work. As long as you are above a surface (e.g. ontop of a building) it works but if you glitch through the roof it doesn't calculate the height below the roof but above the next surface below.
can you show me a screenshot of your stuck units?
there's another way you can do this too:
_testObj setPosASL (getPosASL _unit vectorAdd [0,0,2]);
getPos _testObj select 2 < 2 - _error;
_error is up to you
you need a testObj that has to be created only once
π I know..ahhahaha..it was just to give an idea..i/e: when the player gets closer than "X" meters from the ACTIVATED camp (object?marker?) the guards' group spawn ON THAT marker/camp. Still can't figure it out...without using a trigger.
What would I use then? TY
Should I swap that part also?
_x is the camps marker in that case so you can call getMarkerPos _x to get its position and feed that to the groups spawn and waypoint
it's faster
but you only had 3 elements there so it wouldn't metter much
Yeah...I got this working with:
while {true} do {
_inactiveCamps = ["marker_0","marker_1","marker_2"] - _activatedCamps;
{ //player forloop _x = player here
_player = _x;
{ //marker forloop _x = marker_n here
_distanceToCamp = _player distance (getMarkerPos _x);
if (_distanceToCamp < 500) then {
_activatedCamps pushBack _x;
//execVM "spawn_guard.sqf";
guardGroup= [getMarkerPos _x, EAST, (configfile >> "CfgGroups" >> "East" >> "CFP_O_WAGNER" >> "Infantry" >> "cfp_o_wagner_infantry_security_detail")] call BIS_fnc_spawnGroup;
wp1 = guardGroup addWaypoint [getMarkerPos _x, 0];
wp1 setWaypointType "GUARD";
wp1 setWaypointSpeed "FULL";
wp1 setWaypointBehaviour "AWARE";
wp1 setWaypointFormation "DIAMOND";
};
} foreach _inactiveCamps;
} foreach allPlayers;
sleep 2;
};```
Thank you. Actually, in the actual mission (that was for testing) there're 36 markers...so I guess that makes a difference..right?
???
What's the difference between the "normal" array in the script and a "global" one?
depends on where you what to use it
https://community.bistudio.com/wiki/Position
https://community.bistudio.com/wiki/count (alt syntax) or forEach
I recommend watching a youtube tutorial on "access modifiers". Programming language doesnt matter, its a Universal concept and very important
Uh ib4 dedmen corrects me saying "private" isnt an access modifier.
I see..that will make a difference on SP missions as well?
yes, global variables means global scope variable
not public (aka on every machine)
Very important difference, especially in multiplayer
it isn't reeeee (didn't follow the conversation)
Whats the correct term then?
technically, private is a "keyword"
the universal concept of "access modifiers" probably doesn't really apply to SQF
you are talking about variable scoping here, access modifiers is usually referring to classes in object oriented programming, which SQF doesn't have
Yeah okay thats fair.
I use variable scoping and access modifiers as the same thing bc its essentially the same for everything i have worked on so far
This is getting deeper than I wanted..lol....
NOW... how do I convert this
[ [[6907.65,22232.2,4.0887],[5402.73,21881.2,4.27298],[3608.01,20017.2,4.27237],[3795.7,17489.6,4.27268]] call BIS_fnc_selectRandom, random 360, drugComposition ] call BIS_fnc_objectsMapper;```
in this? (using markers instead of X,Y,Z)
`[getMarkerPos "myBase", 0, _objectsArray, 0.5] call BIS_fnc_objectsMapper;`
_markers apply {getMarkerPos [_x, true]}
returns an array of positions
drugComposition
?!
LOL....I'm making a "narcos" hunt mission..LOLLLLL
call BIS_fnc_selectRandom
selectRandom
the fastest way to do what you want:
getMarkerPos [selectRandom _markerArray, true];
Basically I have 12 "hideouts" house composition that randomly get positioned on the map among 36 markers....
ok....let me see if I can get this right...
yeah, I was doing UI so the goal was to store vehicle objects inside a RscListBox and when I click a button then it would do actions on the selected vehicle
_MyCompositionArray = ["camp1","camp2","camp3"];
[ getMarkerPos [selectRandom _MyCompositionArray, true],random 360, drugComposition ] call BIS_fnc_objectsMapper;```
ok ??
_MyComposionArray
are those markers?
yes
getMarkerPos [selectRandom _MyComposionArray, true]]
the last ] is redundant
you can use setVariable instead (store the list of variables in a way that match the list box indices)
Yeah...they're UBER helpful...always...ππ»
@tough abyss example:
_variables = [];
_lb setVariable ["variables", _variables];
lbClear _lb;
{
_lb lbAdd _x;
_variables pushBack _something;
} forEach _data;
now to fetch the data:
(_lb getVariable ["variables", []]) select lbCurSel _lb; //get data attached to the current lb selection
Like that?
_MyCompositionArray = ["camp1","camp2","camp3"];
[ getMarkerPos [selectRandom _MyCompositionArray, true],random 360, drugComposition ] call BIS_fnc_objectsMapper;``````sqf
_MyCompositionArray = ["camp1","camp2","camp3"];
[ getMarkerPos [selectRandom _MyCompositionArray, true],random 360, drugComposition ] call BIS_fnc_objectsMapper;```
@little raptor I'm already doing that for another menu ^^ https://i.gyazo.com/4b8963c2890c1bc95f35c48fc5b0ad6a.png
I thought we just could compile vehicles like players
you can, in a way
if you use vehicle var names
but the variable name must also match the vehicle var name
yeah
store a variable on the listbox, just a list of vehicles sorted by index.
Then when someone clicks on it, you have the index, and the list and can just pick the vehicle from the list.
And yes I reply before I read further messages :U
^^
sadly..it's not working...mmm here the complete init.sqf:
https://sqfbin.com/ecaweyoqonakuraguxuz
ps:units do spawn..just the composition is M.I.A.
it's optional
it is, but he's providing the units array
[ getMarkerPos [selectRandom _MyCompositionArray, true], drugComposition ]
wrong params
@serene quiver what you wrote here was already correct:
I don't know why you changed it
Because is not spawning the composition...
it is
I just tested it
Just replace [ getMarkerPos [selectRandom _MyCompositionArray, true], drugComposition ] call BIS_fnc_objectsMapper;
With [ getMarkerPos [selectRandom _MyCompositionArray, true],random 360, drugComposition ] call BIS_fnc_objectsMapper;
See the syntax. You are providing the composition in place of the azimute
= you give 2 input parameters, but Bis_fnc_objectsMapper wants 3.
to be fair, the function params is not written properly
yeah
[position, azimuth, objectsArray, badChance] call BIS_fnc_ObjectsMapperParameters:
position: Position - (Optional, default [0,0])
azimuth: Number - (Optional, default 0) the template orientation
objectsArray: Array - created with BIS_fnc_objectsGrabber
param in the middle is optional which doesn't make much sense
even the first one is!
xD
Thank you all..got this working with:
_MyCompositionArray = ["marker_0","marker_1","marker_2"];
[ getMarkerPos [selectRandom _MyCompositionArray, true],random 360, drugComposition ] call BIS_fnc_objectsMapper;```
Youre building a singleplayer map with 40 bandit camps? OldMan 2.0?
LOL..no the "camps" are 12, but they spawn randomly on 36 positions..so to give player replayability value...
You could enhance variation by selecting the guard groups randomly from multiple different groups
btw...how do you post images/screenshots here, not just the links...?
Cant. Gotta upload to a Host and link
ππ»
Before...
https://ibb.co/CM5Bpgm
Can you embed it?
12 FPS? π
THAT is something I have to learn.Never quite understand it very well
There is nothing to it.
For example
That boat in the middle with all those waypoints
Select it and add it to it's own layer
Then just hide the layer.
I see..just like when you edit a texture file with GIMP...shows and hide layers..
reminder to myself that i have like 6 attempts of makinf dynamic occupation systems where points of interests are dynamically selected and patrols randomly visit them, and none of these attempts was ever finished
yes
and it doesn't effect the way the mission i launched, right?
nope
Layers are just for the editor, however, you can get all objects assign to a layer during the mission, which would allow you to show hide all entities of a layer
mmmm...interesting..so for instance...if the mission tasks don't allow you to "see" a certain part of the mission, you could hide them and call them once it's the right time?
Yes
awesome...and how would you call the layer mid-game?
i/e: I have an HVT..to find him you have to collect various intel to reveal his position...
so to avoid stumbling upon him before collecting the intel, you could "hide" the layer that has him with his waypoint and all..correct?
You cannot hide the layer but the objects it contains
well let me rephrase that: you "hide" the HVT and his waypoints, and "call" it later on?
yes
Sorry,one more question: are the hidden units in layers saving performance?
I guess that if the engine doesn't have to render them, it will save performance...right?
Oh boy..I just discovered something REALLY useful, then!
I guess on a mission like the one above it will have a significant impact..
im no expert on performance, (in fact most of my works are super unperformant π ) but theres more mechanics that help save performance.
disable simulation is one, and the vanilla, built in dynamic simulation mechanic. it freezes far away units to save up their AI (and collision?) calculations
Any suggestions on how to test a script for its performance in multiplayer?
Hey, what's wrong with this? can't get to work....
I hide the layer "civis" with this in a gamelogic: (and it works):
[] spawn {
{ _x enableSimulation true;
_x hideObject true;
} forEach (getMissionLayerEntities "civis" select 0);```
...then I want to "show" the units once a task is assigned, with
```sqf
player addEventHandler[ "TaskSetAsCurrent", {
params ["_unit", "_task"];
if ( _taskReal isEqualTo ( "task1" call BIS_fnc_taskReal ) ) then {
_x enableSimulation true;
_x hideObject false;
} forEach (getMissionLayerEntities "civis" select 0);
}];```
NOT working...got this error:
`18:58:27 Error in expression <n true;
_x hideObject true;
} forEach (getMissionLayerEntities "civis">
18:58:27 Error position: <forEach (getMissionLayerEntities "civis">
18:58:27 Error foreach: Type Nothing, expected code`....???
what does the error tell you?
so do you see it now?!
nope..lol..what code is missing?
what is code?
At this point..ain't not sure..
you are mixing and if statement with a foreach
they need their own scopes.
you cant do
if (true) then {
} foreach [1,2,3]
probably to you..still, I wouldn't know how to fix it.
player addEventHandler[ "TaskSetAsCurrent", {
params ["_unit", "_task"];
if ( _taskReal isEqualTo ( "task1" call BIS_fnc_taskReal ) ) then {
_x enableSimulation true;
_x hideObject false;
getMissionLayerEntities "civis" select 0);}
}];```
About that?
and did the forEach just magically disappear?
lol....I like you man...
Believed or not I'm just like you in my line of work...hahha
what you were doing
if (something) then {...} forEach [];
the engine executes this first: (according to https://community.bistudio.com/wiki/Operators#Rules_of_Precedence)
if (something) then {...}
then it uses the return value (what is returned by the then, and if condition is false, nothing) as the "code" for forEach
anyway, the answer to this riddle was this:
if (true) then {
{
} foreach [1,2,3]
}
player addEventHandler[ "TaskSetAsCurrent", {
params ["_unit", "_task"];
if ( _task isEqualTo ( "task1" call BIS_fnc_taskReal ) ) then {
_x enableSimulation true;
_x hideObject false;
} forEach [getMissionLayerEntities "civis" select 0]
}];```
???
nope..
player addEventHandler[ "TaskSetAsCurrent", {
params ["_unit", "_task"];
if ( _task isEqualTo ( "task1" call BIS_fnc_taskReal ) ) then {
{//foreach start
_x enableSimulation true;
_x hideObject true;
} forEach [getMissionLayerEntities "civis" select 0]
} //end if
}];
you need to keep your scopes separate
THANK YOU..
foreach needs its own {bla bla } block and so does if (this) then {that}
_x generic error in expression..
what line
19:31:34 Error in expression < ) ) then {
{
_x enableSimulation true;
_x>
19:31:34 Error position: <enableSimulation true;
_x>
19:31:34 Error Generic error in expression
probably because getMissionLayerEntities already returns an array
tbh if you are not quite sure what you are doing i would split things up first
and not directly execute something for your foreach loop
i.e
_mylayer = getMissionLayerEntities "civis" select 0;```
but thats just my opinion
As long as it gets the job done, it's all good to me...more efficient? prettier? more professional? Doesn't matter to me...even if it's down and dirty, as long as it works..it's GOLD to me..hahahaha
player addEventHandler[ "TaskSetAsCurrent", {
params ["_unit", "_task"];
_mylayer = getMissionLayerEntities "civis" select 0;
if ( _taskReal isEqualTo ( "task1" call BIS_fnc_taskReal ) ) then {
_mylayer enableSimulation true;
_mylayer hideObject false;
}
}];```
about this ??? @proper sail
player addEventHandler[ "TaskSetAsCurrent", {
params ["_unit", "_task"];
_mylayer = (getMissionLayerEntities "civis") select 0; //now you can diag_log this easily
_findTask = "task1" call BIS_fnc_taskReal; //now you can diag_log this easily
if (_task isEqualTo _findTask) then {
{//foreach start
_x enableSimulation true;
_x hideObject true;
} forEach _mylayer;
};
}];```
also the wiki says that bis_fnc_taskReal requires 2 parameters
[taskName, owner] call BIS_fnc_taskReal
YESSSSSSSSS....thank you a lot,man!!
I'm trying to make a persistent multiplayer mission right now, how would I go about creating and defining variables that I would like to modify further down the line but wont be reset every time the mission is loaded?
Merlin is right, never try to develop in a whole big script. Make smaller modular parts, test those, then put together
@fiery orbit search this thread, you'll find some previous discussion on persistent variables
thank you
@cunning oriole your script seems to run on every machine instead of being centralised on the server
Store the queue in missionNamespace or only on the server (remoteExec)
yes, same, because this remoteExec code means "execute the code here"
Server-side:
waitUntil { sleep 1; count allPlayers > 1 };
["go!"] remoteExec ["hint"];
```@cunning oriole
@ded would you mind dropping the script youβre using to follow the turrets orientation with attachto? Been racking my brain trying to write one for the last day or so
it seems you're trying to pair up players.
you can simply do that server side.
why would you need a queue for that?
that's no released yet
but you can do it with onEachFrame
I don't need the object scaling - just the script to update the object position relative to the turret
that too is part of the update
I don't follow. Can you explain what you're trying to do in more details?
@slow cargo #community_wiki message
it's just a new parameter added to the command
Ah, that's exciting and frustrating - thought they were already using a perframe handler rather than the fancy forbidden magic
Much appreciated!
Can anyone tell me what's wrong with this?
[] spawn {
player addEventHandler[ "TaskSetAsCurrent", {
params ["_unit", "_task"];
_mylayerPilot = (getMissionLayerEntities "pilotTaskCustom") select 0;
_findTask = "Task04" call BIS_fnc_taskReal;
if (_task isEqualTo _findTask) then {
{
_x enableSimulation true;
_x hideObject false;
} forEach _mylayerPilot;
};
}];
};
waitUntil {"Task04", "SUCCEEDED",true};
[] spawn {
player addEventHandler[ "TaskSetAsCurrent", {
params ["_unit", "_task"];
_mylayerShip = (getMissionLayerEntities "sinkShipCustom") select 0;
_findTask = "Task05" call BIS_fnc_taskReal;
if (_task isEqualTo _findTask) then {
{
_x enableSimulation true;
_x hideObject false;
} forEach _mylayerShip;
};
}];
};```
Thank you..
I'm trying to "reveal" the layers after task is completed, or better assigned..
The first layer shows up just fine when the task04 is ASSIGNED, as intended, but then the second layer stay hidden....mmmm...
i dont have any experience with tasks, but couldnt you do something like this and forget the waituntil and spawned addEventhandlers?
player addEventHandler ["TaskSetAsCurrent",{
params ["_unit","_task"];
private _layers = switch _task do {
case ("Task04" call BIS_fnc_taskReal):{(getMissionLayerEntities "pilotTaskCustom") select 0};
case ("Task05" call BIS_fnc_taskReal):{(getMissionLayerEntities "sinkShipCustom") select 0};
default {[]};
};
{
_x enableSimulation true;
_x hideObject false;
} forEach _layers;
}];
Am I right assuming addForce does not work with simple objects?
Simple Objects can't have any velocity so yes
I've been noticing some weird issues with hideObjectGlobal recently, I've had cases where I used that on a vehicle in multiplayer and a few clients are able to still see parts of the vehicle, like the floating crew or helicopter rotors, but that only happens on some players, is there some kinda bug with hideObjectGlobal?
thanks for answer @warm hedge. And I made the observation, that disableCollisionWith doesn't seem to work either for those simple objects. Or am I doing something wrong?
it should work. I've never tested the command on simple objects.
you can just disable simulation
I did disable the simu, but it looks crappy having casings floating around in air
If it isn't working on Simple Objects, maybe a bug? Honestly the command is really glitchy tho
I don't know. Sometimes it seems to work, but when there are loads of objects, things begin to glitch. Maybe a load related problem...
plan attachTo [tonk, [0,0,0.2], "usti hlavne", true];
plan setVectorDirAndUp ([[[1,0,0], [0,0,1]], 90, 0, 0] call BIS_fnc_transformVectorDirAndUp);
plan setObjectScale [0.2,0.2,0.2];
update wen?
So is that command how its gonna go to retail or π ? or is that just your private one>
plan setObjectScale [0.2,0.2,0.2];
as in xyz factors
so a mix of the two options
oki
So a few times when just testing stuff, my combatmode == "RED" trigger doesn't trigger despite me shooting all over the place. Ill try adding more squads to the condition maybe
Its just not consistent, which is weird
try detecting behaviour instead
I think it might have to do with ace? Maybe? Because sometimes i just stand Infront of the squad no shooting the trigger triggers, sometimes i kill like 10 people, and nothing, i think i tried it but got some errors, I'll try it again
combat mode in SQF means "rules of engagement"
and AI never change it
if you want the AI to react to you "shooting all over the place", try behaviour (as Lou said)
i remember trying behaviour after i realized combat mode is not consistent, but i got some error, cant remember it now, ill try it again
i put in a group and it says it expect an object
i did
(behaviour boys == "COMBAT")
oh ig it says unit
i have a script running on a loop and i want to be able to change its parameters during runtime.
i thought about creating a "hashobject", basically a hidden object, which holds the parametres as variables attached to it. script pulls params on each run, if you wanna change it, you can just change the params and the script will use those on the next run.
any other, better idea to achieve that?
so is it just like one.. unit and it doesnt work for the group
pinky you can use "leader _myGroup" to get a unit (easily)
behaviour
Returns the behaviour of the unit's group. For Arma 3 behaviour explanation see Arma_3_AI_Behavior
? @ember path
I think what you want is https://community.bistudio.com/wiki/setBehaviour
no i want to check if the behaviour is something not set it as something
Ooh okay
setBehaviour on group or unit (and applies to all units anyway)
behaviour on unit only
BI 
slaps the computer this bad boy can fit some strange behaviour in it
computer falls to pieces
any better way to modify a public variable and synch it?
_array = missionNamespace getVariable ["IRN_ambient_battle_modules",[]];
_array pushBack ["hello world"];
missionNamespace setVariable ["IRN_ambient_battle_modules",_array,true];
_behaviour = behaviour _bi;
hint _behaviour;
Retuns "Weird" 
@serene quiver
might wanna check that out for your random bandits:
markers: Array - (Optional, default []) if the markers array contains any markers, the position is randomly picked from array of given markers plus desired placement position. If any of the markers were given z coordinate with setMarkerPos, the vehicle will also be created at given z coordinate.
can i custom- name vehciles i create by script?
yes thanks
okay so i built myself a helper object that holds a ton of variables in its namespace, like colors and sounds etc.
how bad is it to pull these variables out of the object, into my script every couple seconds? stays on local machine.
sorry yeah i just set the behaviour to the unit (aka boy) and it worked....but im sure i did this before and it didnt.. oh well
now its much more consistent
not bad, a HashMap would be better probably π€£

Isn't CBA doing something like this with locations?
well according to your paper object namespace is kind of a hashmap
yeah revo, thats what i read and promptly stole the idea π
any builtin commands to get all the muzzles of a weapon?
yes cba os dpong tjat
{
_tmp = _x select 1;
//update var from hashObject, if undefined use old var
(_x select 1) = _hashObject getVariable [_x select 0,_x select 1];
if (_debug && !(_tmp isEqualTo (_x select 1))) then {
diag_log ["################# VARIABLE CHANGED #####","old",_tmp,"new",_x select 1];
systemChat str ["################# VARIABLE CHANGED #####","old",_tmp,"new",_x select 1];
};
} foreach [
["minDistance",_minDistance],
["maxDistance",_maxDistance],
["salvoFrequency",_salvoFrequency],
["salvoAverage",_salvoAverage], //average amount of salvos per "skrimish",
["expAverage",_expAverage],
["end",_endTime],
["tracerEveryX",_everyX],
["tracersRndVec",_rndVec],
["percentTracers",_percentTracers],
["expColor",_expColorPalette],
["expSize",_expSize],
["expSounds",_expSounds],
["shots",_shotSounds],
["debug",_debug],
["center",_center]
];
i wanna update the variable defined in the foreach array, but im a noob concerning references.
it seems (x select 1) cant be set to a different value. any suggestions?
missionNamespace setVariable [(_x select 0), (_hashObject getVariable [_x select 0, _x select 1]), true];
@winter rose i think i get what you mean, im not sure how to do it tho.
sth like
{
_this set [_idx,_hashObject getVariable ["nameOfParam",_this select _idx]];
} foreach _this;
?
my answer to that very intricate question shall be wut
im trying to update my private variables in my script by pulling values from an object i abuse as a storage container for the variables
so i can change the scripts params during runtime
{
_x params ["_varName", "_varValue"];
private _defaultVar = _hashObject getVariable [_varName _varValue];
if (_debug && !(_tmp isEqualTo _varValue)) then {
diag_log ["################# VARIABLE CHANGED #####", "old", _tmp, "new", _varValue;
systemChat str ["################# VARIABLE CHANGED #####", "old", _tmp,"new", _varValue];
};
} forEach [
["minDistance", _minDistance],
["maxDistance", _maxDistance],
["salvoFrequency", _salvoFrequency],
["salvoAverage", _salvoAverage], //average amount of salvos per "skrimish",
["expAverage", _expAverage],
["end", _endTime],
["tracerEveryX", _everyX],
["tracersRndVec", _rndVec],
["percentTracers", _percentTracers],
["expColor", _expColorPalette],
["expSize", _expSize],
["expSounds", _expSounds],
["shots", _shotSounds],
["debug", _debug],
["center", _center]
];
``` @spark turret something like this for example
private var = manual change⦠or an awful usage of call compile
okay so no foreach here?
@robust brook that looks good, but i still need to assign _defaultVar `s value to _minDistance or whichever variabel got updated
hm or could i pull every variable, into an array and used "params" on that array right below?
ill just bruteforce it with single line commands lol
_arr = [
["key", "diffval"]
];
_arr = _arr apply {
_x params ["_key", "_val"];
_val = _hashObject getVariable [_key, _val];
[_key, _val];
};
something like this?
hm yeah i think thats the right direction
and the parse that array into the variables so i can use the _keys to get the values
it will simply update the _arr with values from _hashObject if it exists.
and using ```sqf
missionNamespace setVariable [_key, _val, true];
which also works within a forEach (if you don't need to modify the original array)
i didnt wanna store the parameters in missionnamespace bc maybe you got multiple instances of the script running
ill look into your method later, ill bruteforce for now
so wait, you simply want to update private _variables?
I disagree with such design @spark turret, but I may have some ugly thing
inb4 self writing code
our arma sqf overlords will be gentle
here:
{
private _value = _hashObject getVariable [_x, call compile format ["_%1", _x]];
call compile format ["_%1 = _value", _x];
} forEach ["varname1", "varname2"];
that's ugly, that's not performance-friendly, but it works (β¦or at least, should)
Although I agree with Lou here.
I guess it's a system to store settings in variables, which does make sense.
Although in that case I wouldn't use hashmaps... And just use default variables which can be overwritten
no
poopy local var update π
Lol very strong feelings on me just having a way to change a scripts settings during runtime
Is that so bad?
it's not great, and you compile (twice) every loop
as a debug, sure
as final code, no
if I were your employer, I would make you pay me to accept that π
Well how else could i change setting during runtime?
_var = _hashObject getVariable ["var", 0];
```or, better, store your variables in an array (if you always get everything) then use `params` on it```sqf
private _array = _hashObject getVariables ["variables", []];
_array params ["_param1", "_param2", "_param3"];
hint str _param1;
Mhm yes thats my bruteforce way rn.
Ill look into only updating on var change later
The moment you need a variable in a script, check if a variable is set, if not use default
No need for fancy storage when it can't execute code the moment it changed (unless you have a loop somewhere which waits for changes)
Hey what file would I need to put
showscoretable 0 would it be a local command or server?
Trying to stop scoreboard coming up during the mission as its causing people to be wreckless to bump up their scores
And also showchat false I'm assuming that stops people seeing the chat in game also
your case is a lot simpler than what you make it out to be: just store your variables in an array. no need for "hash objects".
probably local. the wiki doesn't say anything
Yeah ill try initPlayerLocal.sqf first
i cant get showChat false; to work π¦
ive tried the enableChannel script but its not working correctly either
There's allUnits to return an array of all units... what's a way to get all triggers on a map?
Alternatively, a way to get all sideLogic, something allUnits explicitly doesn't count?
You could check all objects on the map and filter by "EmptyDetector" (= trigger object)
anyone got a smart idea on a function that randomly selects a point in a circle, and the point is at least x Meters away from each player?
i mean i could brute force it in a loop 
ELI5?
explain like I'm five.
Go to primary school.
I would say "Ask an adult", but than I still have to explain something which can be found on the wiki or Google
I guess he wants to ask how to do that in script?
units sideLogic
but I think that doesn't work yet? Don't remember when I did that.
allUnits select {side _x == sideLogic}?
but that returns modules too, not only triggers
oh allUnits doesn't count sideLogic?
allMissionObjects maybe, but that's bad oof
I dunno if this can do sideLogic https://community.bistudio.com/wiki/units
someone tested yet? the new side syntax?
or entities "EmptyDetector" ?
I don't think empty detectors are "entities"
not sure about circles, but it's much easier to do with a rectangular area. (i.e position that is inside a square of width "2*r", which doesn't fall inside other square regions).
@still forum thanks for trying to help. I think I managed to find a work-around to this. Not the ideal solution and requires some extra prep-work in the editor, but should still work.
allMissionObjects will work, but is performance wise bad
but you'll only run it once so its probably fine
correct
Alright, waited 10 mins to ask this. In regards to attachTo, I want to attach Zeus editable area to the player character, however, it doesn't update after initialization. I've attempted to correct that with while-do, however it doesn't seem to work. I am a complete novice when it comes to this stuff.
Anyone attempt this before?
you might be trying to attach the module itself, which won't work (the module only triggers a script that takes the position at time T)
Yeah, that seems accurate. Is there another way?
script-wise there may be (but I am not a Zeus expert)
Where do i find the script the module executes?
addCuratorEditingArea returns nothing, it can't be attached.
script modules are in arma3/addons/ some pbo
you may not attach the editing area, but you may set it repeatedly
I recommend taking a look at how the official missions do it @green sonnet
like a marker
Can't treat it like a marker. Only option is delete and recreate at new position.
Maybe there's a BIS function for it, dunno.
So, is there some kind of timer/loop I can do to delete the edit area, and recreate it at player position, every second or so?
btw, Zeus commands and functions:
https://community.bistudio.com/wiki/Category:Command_Group:_Curator
https://community.bistudio.com/wiki/Category:Function_Group:_Curator
not necessarily kill/create, just teleporting it maybe
some things cant be glued to players (or anything else) and need to be teleported. markers f.e.

@spark turret a Curator area is neither a trigger or a marker or an object (no set(Marker)Pos)
they are areas defined by script to format [centerPosition, radius] (I believe)
and therefore cannot be moved, only created/deleted
well, shame that this script doesnt have settings which can be changed during runtime π
https://community.bistudio.com/wiki/addCuratorEditingArea
It can update the position but it only works from server, so this is going to be fun 
addCuratorCameraArea
addCuratorEditingArea
removeAllCuratorCameraAreas
removeAllCuratorEditingAreas
unfortunately, no moving anything ^^
not really supposed to be that much either π
nice catch, indeed!
(as shown, I am not a Zeus expert ^^)
well, a server-side loop that edits that area every 2-5s is not going to cost too much either, so why not
For each player, and you have to remember the IDs for each
for each player? for each Zeus you mean?
He said player character, not sure.
ah yep (well if each player is a Zeus, then we are both right ^^)
if there are only 2-3 Zeus, easily done I think
Might be able to circumvent storing the ID using owner.
At least, attempting to.
Problem is new people joining and others leaving
Where each player (Edit: a player on each side) is a "commander" that can only build around them, creating tactics while keeping player involvement.
I also attempted to sync editable area's around warlords points, but I have no clue what I'm doing, this is just me experimenting. lol.
Have you scripted before?
Nope!
π
Arma 3's language seems well documented though, so I'm just messing around and seeing what I can learn.
The closest I come is a basic knowledge of Unreal engine blueprints, as far as my scripting knowledge goes.
//Spawn this code on the server!
while {true} do {
{
someCurator addCuratorEditingArea [owner _x, getPos _x, 100];
} forEach (call BIS_fnc_listPlayers); //Don't need HCs
sleep 5;
};
```This is a rough layout.
It doesn't properly treat players disconnecting, it only works with a single curator and it needs more work before it does what you'd like it to do.
`allCurators` may or may not be useful here, don't know.
Alright, gonna treat this as a learning lesson... Couple of questions after trying what I thought to be the answers. (They weren't.)... I'm suppose to replace _x's with obj such as my characters variable name, right?
No, _x is a magic variable within forEach.
https://community.bistudio.com/wiki/Magic_Variables
So if I execute your code through the debug menu, executing on server side, it should create a edit area around my character?
super quick question:
Does deleting a vehicle also delete the crew?
it gives me a generic error after clicking server exec with no modifications.
Just try it
The code wants to be executed (on the server) with spawn.
Alright, time for me to sleep.
Play around with the code, look up as much as you can in the documentation and ask in here whenever you need more advice or ideas.
Thanks for the base guideline!
In the description.ext you can name the author of the mission. Can you reference that in other scripts?
Eg I'm working on a simple intro script for our mission makers and would like it to say "<authorname> presents..." and preferably draw the name from the description.ext. is that possible?
getMissionConfigValue "author"
Oh awesome thank you
So uh... What is spawn and how do I get the code executed with it? lol.
see the wiki: https://community.bistudio.com/wiki/spawn
how do I get the code executed with it
what?
is there a way to force a unit to reload with a script?
probably something like https://community.bistudio.com/wiki/reload
possibly https://community.bistudio.com/wiki/Arma_3_Actions#LoadMagazine if you only want to reload a single weapon (rather than all of them with reload ^)
Pico was here! π«
@past tiger aaaaaand? π
Last forum update about new stuff & changes in Arma 3 is from 19 november, i look everyday to see if there is a new update. 14 days with no updates.
π
Dedmen is cooking tons of changes and fixes, i'm sure.
Any way to set all Opfor AI sub-skill at scenario?
{
_x setSkill [...];
} forEach (units east);
(units SIDE since A3 v2.01.146926)
I have all this
drugBox addEventHandler ["killed", {execVM "Scripts\radiomessage.sqf";}];
drugBox1 addEventHandler ["killed", {execVM "Scripts\radiomessage.sqf";}];
drugBox2 addEventHandler ["killed", {execVM "Scripts\radiomessage.sqf";}];
moneyBox addEventHandler ["killed", {execVM "Scripts\radiomessage.sqf";}];
moneyBox1 addEventHandler ["killed", {execVM "Scripts\radiomessage.sqf";}];
moneyBox2 addEventHandler ["killed", {execVM "Scripts\radiomessage.sqf";}];
weaponBox addEventHandler ["killed", {execVM "Scripts\radiomessage.sqf";}];
weaponBox1 addEventHandler ["killed", {execVM "Scripts\radiomessage.sqf";}];
weaponBox2 addEventHandler ["killed", {execVM "Scripts\radiomessage.sqf";}];```
running inside a gamelogic.
And this in another:
```sqf
null = [] execVM "Scripts\intel\intelDrop1.sqf";
null = [] execVM "Scripts\intel\intelDrop2.sqf";
null = [] execVM "Scripts\intel\intelDrop3.sqf";
null = [] execVM "Scripts\intel\intelDrop4.sqf";
null = [] execVM "Scripts\intel\intelDrop5.sqf";
null = [] execVM "Scripts\intel\intelDrop6.sqf";
null = [] execVM "Scripts\intel\intelDrop7.sqf";
null = [] execVM "Scripts\intel\intelDrop8.sqf";
null = [] execVM "Scripts\intel\intelDrop9.sqf";
null = [] execVM "Scripts\intel\HVT_intelDrop1.sqf";
null = [] execVM "Scripts\intel\HVT_intelDrop2.sqf";
null = [] execVM "Scripts\intel\HVT_intelDrop3.sqf";```
It works, BUT...is there a better way to do it? 
yes π
LOLLL...I bet!!..HAHAHAHA
loops and format
?
forEach, for and format
and there's no need for null =
there's no need for anything
it fact it's better that way
Throw it into init.sqf while you're at it
{
_x addEventHandler ["killed", { execVM "Scripts\radiomessage.sqf" }];
} forEach [drugBox1, drugBox99];
``````sqf
{
execVM format ["Scripts\intel\intelDrop%1.sqf", _x];
} forEach [1,2,3,4,5,6];
forEach [1,2,3,4,5,6];
for "_i" from 1 to 6
slower iirc
then this ^
I should do a https://community.bistudio.com/wiki/Code_Optimisation#Equivalent_commands_performance for vs forEach as a reminder
it's not a fair comparison
Ah guys this does not need optimisation
ok then faster to write
there is no comparison as of now
I mean in your forEach example, first you create an array
then loop thru it
so it's slower
but when you use for, there won't be an array, so it becomes faster
otherwise for should never be used instead of forEach
using for, then from, then to might be slower, no?
it would not be the first time a command is nulled by another
Do your intelDrop#.sqf scripts do something different each or do they all do the same just for different objects?
depends on the number of elements in the array you create
good point
why not just use paramters
which is why I want to compare
The same stuff indeed
let me check first..hold on..almost the same...
GOM_fnc_intelDrop = {
params [["_side",east]];//defaults to east if no side is given
//you can replace _enemies with an array of units that should drop the intel
//_enemies = allUnits select {alive _x and side _x isEqualTo _side};
_enemies = [intel];
{
_x addAction ["<t size='1.5' shadow='2' color='#ff9900'>SEARCH BODY</t>",{
params ["_object","_caller","_ID","_enemies"];
_object removeAction _ID;
_guaranteedIntel = {alive _x} count _enemies <= 3;//if 3 or less enemies are alive every kill will give intel
if (random 100 < 100) then {
systemchat "You found some intel!";
[] execVM "Scripts\intel\stash_intel_1.sqf";
} else {
systemchat "You found nothing";
};
},_enemies,6,true,false,"","!alive _target AND _this isEqualTo vehicle _this AND isPlayer _this",2];
} forEach _enemies;
};
//init the intel drops
_init = [east] call GOM_fnc_intelDrop;```
Nope, they exec `different stash_intel_1.sqf `
I'd say your method would be faster or identical for up to 3 elements in the array, after that for is faster
just a guess
dunno and will test Β―_(γ)_/Β―
forEach has _forEachIndex and array creation,
for uses string and min two other commands
can be interesting either way
uses string
they're fast, but compiling them could be slow (but it should happen once)
Btw would that mean then having a seperate loop for the different kinds of boxes? And wouldn't it be smarter to just throw all the boxes into an array and then forEach that?
use parameters and format
no need to create hundreds of scripts for that
there is no loop for boxes? π€¨
I'm sure is smarter.....how?
I mean the forEach that adds the event handler to the drug boxes 
That is way above may paygrade....
thanks, will integrate it soon
Maybe I should explain better what all those scripts achieve: hold on..
np, I'll send the "official" numbers in #community_wiki
they all add the same code, so no need to separate⦠or I didn't get it
At the moment you just do [drugBox1, drugBox99];, what about the other kinds of boxes?
aaaaaall of them, I just didn't want to copy/paste π
drugbox, moneybox, pastabox, your call
Ah
I have 9 stashes spawning on the map randomly. There are 9 units (defined by the above script _enemies = [intel]; ), that when killed drop this script: https://sqfbin.com/uyepivojijogeguteyom that reveal a location of the randomly placed stashes. The same concept works for HVTs (3) of them...
So there's a LOT of files in that intel folder...lol...
https://imgur.com/Rw35Rzw
ps: Just in case...
HVT_intelDrop1>3:https://sqfbin.com/sotigalacekamayuwihi
HVT_intelFound1>3:https://sqfbin.com/ivimunojeqeneborifes
intelDrop1>3:https://sqfbin.com/awixuwedovudazusubam
stash_intel>3:https://sqfbin.com/vagitenaropoqetuhiva
Trust me, I didn't write this (GrumpyOldMan kindly did it for me a few years back) and I wouldn't know how not even if you and I stay here all day long with you trying to teach me. I surely didn't use those scripts in the most efficient way, but back then (I'm overhauling the mission so you know..) "efficiency" came WAY after "it works..who cares".
I find a for loop more complicated to write.
you need to know to set the variable name in quotes, and the from and to and whether last value is inclusive or exclusive.
for forEach you simply just list what you want without having to think
Btw that will change when script optimizer comes around, the forEach will win
what is "script optimizer"?
JIT Compiler?
no assembly optimizer
It will turn the forEach array into a constant, instead of rebuilding the array everytime you run that code
hmm, does it? I think it's constant already
it's outside the loop
its not
forEach [1,2,3];
in sqf assembly is
push 1
push 2
push 3
makeArray 3
callOperator forEach
my optimizer turns that into
push [1,2,3]
callOperator forEach
I don't get it.
then why can we "exitWith" a forEach and it becomes faster?
If you run ArmaScriptProfiler (which includes SQF-Assembly)
you can do
_code = optimizeCode {{} forEach [1,2,3,4,5]}
because when you stop sooner, you stop sooner?
thats totally unrelated to what I said
also exitWith has the same speed for:
{
if (true) exitWith {};
} forEach a;//[1,...1000]
{
if (true) exitWith {};
} forEach b: //[1]
Yes.. Also unrelated to what I said
you are iterating over a variable here, you are not creating an array. Which is what i talked about
so you mean array creation becomes faster?! that's nice!
no, it becomes instant, if you only put constants in an array
like basically every usage of params will be faster then, and your forEach example
besides numbers, strings and namespaces, what else is constant? objNull, etc. for example?
Only real constants are string, number, code.
but bool/null types can also be turned into constants instead of calling commands
I'd really like it if bools were constants too.
my optimizer does that too yeah
namespaces are constant too, no?
yeah... I guess
string, number, code plus these https://github.com/dedmen/SQF-Assembly/blob/master/src/BytecodeOptimizer.cpp#L5-L22
from mid 2019, there are probably more that were missed
noice!
π ...cool..(as if I know what the heck you guys were talking aboutπ ) but exactly how that translates to my original "problem"? (which is how to make it more efficient) Thank you.
it doesnt. we were talking about something else
@little raptor ..I know you probably will send me to a Wiki page of some sort (trying to teach how to fish instead of feeding a fish?) but I'm not trying to learn how to fish here...give me the fish and I'll eat it..hahahah
so. from here.
we won't fish for you, but we can explain how to fish, little by little, and provide fish example to learn by it. now anyone not wanting to follow this is obviously free to not contribute.
Awesome...so where do we start then?
reminds me that i have a poopton of scripts i need to put documentation in and release
I kinda lost track of the original question(s), so please link or summarise them?
LOL...ok...let me go back a bit....
#arma3_scripting message which refer to the original question:
#arma3_scripting message
You already took care of the "drugBox" thing...that's done..
now I have to work on the "intel" part
for reference: #arma3_scripting message
#arma3_scripting message
to which I replied
#arma3_scripting message
Yep..the eventHandler part, I understood it and already applied in the mission...the second part
{ execVM format ["Scripts\intel\intelDrop%1.sqf", _x]; } forEach [1,2,3,4,5,6];
I don't understand:
how the script knows which intelDrop.sqf refer to the right intelFound?
I mean...they refer to each other, but there's a lot of them...https://imgur.com/Rw35Rzw
Make an "init.sqf" file in the mission root folder and put this stuff in there. If it's a multiplayer mission, we need to use a different file though, so just let us know if that's the case.
{
_x addEventHandler [...];
} forEach MyArrayOfBoxes;
{
[_x] execVM "...";
} forEach MyArrayOfIntelDrops;
```Now the second loop needs you to alter your `intelDrop.sqf` script slightly and then you're good to go:
The syntax used here passes the value inside the [] left of `execVM` to the script you are executing. You can then use that value inside the script by referencing `_this # 0` or, more elegant and readable, by using `params`.
Is a SP...BTW
If MyArrayOfBoxes and MyArrayOfIntelDrops are the same, you only need one loop with both lines of code.
Then init.sqf is the way to go.
It's a file that is executed when the mission starts.
yep...at least I know that!..hahha
if MP, it get runs on every client so yep, that's the diff
No they are not the same. So you know what I'm talking about...
#arma3_scripting message
I see..thank you. I basically play and try to build missions in SP almost exclusively.
Hey people.
I planned
_hashMap get _key
_hashMap get [_key, _defaultValue]
but that's not possible because in the first variant _key could also be an array.
So I need to rename the second one.
_hashMap getOr [_key, _defaultValue] (Get value OR default)
_hashMap getDefault [_key, _defaultValue] (Get with possible default value)
or any other ideas? I think getOr is better
why not make keys only "static" types, string, number, object? would an array be compared by value or reference?
object is impossible.
would an array be compared by value or reference?
both
but that wasn't my question :u Array key support is important removing that is not an option
If you cant use get for all hashmap uses, wouldbt it be better the rename all? Like "getHash" and then for all cases?
Instead of splitting it up into 2 things
That won't help with the problem at all. Still need two command names.
I'm more in favor of a command name like getValue or something, because just get... don't like that.
How about array syntax only: _hashMap get [_key] and _hashMap get [_key, _default]?
I'm just asking for a oppinion on the name. I'm not asking you about changing fundamentals that were decided weeks ago.
Array syntax only could work yeah. But add's performance overhead on every get, but this container is intended to provide high performance, not make you waste performance everytime you want to use it
if there is a get, there is a set - which is already kind of taken
Then i choose getOr
and how does one "set" them?
with the set command. Not related to my question though
I just want to get an opinion on the naming so I can continue working on on it..
Result:
0.0128 ms
Code:
HashMap get ["test"]
Result:
0.0097 ms
Code:
HashMap get "test"
yeah array is no option. 20% premium just to no have to write the "getOr" instead.
getOr is simple enough
getValue and getValueDef for me. Has good readability I think.
I agree with LM, get is too ambiguous.



^ bi behaviouring weirdly