#arma3_scripting
1 messages Β· Page 213 of 1
after all are in the vehicle: this lock true; or this lock false; in the init of the vehicle
but then it seems more real to me that they jump out π
i remember i had to do that on a chopper cuz the players would just jump out lol π
Rambo players that is π
and they would die and burn up all the respawn tickets π
Locking can work; you can also try setUnloadInCombat
hmm, I figured that was only for AIs.
this setUnloadInCombat false;
It is.
They said they put the units back into the vehicles using Zeus, so I assumed they were talking about AI.
agree
Ah yeah, I guess you can't do that to players :P
lol
if you make a script you can π
1 mission i was in the guy teleported me to 0.0.0 in the water cuz i got more kills then him π
i did not go back there π
you can use eaither way
I think you can make this work by just changing their behaviour to careless
when they reach the trigger, change to combat
or AWARE
what ever way is easyer you can do
changing behaviour seems like more cost to me though
but i guess not
i don't know much i'm just a nooby π
i dream of someday when and if: my name trun's Blue Woohoo π like 30 years from now π oh shit w8 lets see 64 + 30 hmmm oh shit lol π
They switch to combat automatically anyway
Hello there, sorry if I'm interrupting,
I was wondering whether there was a way to execute a script for each unit in the area of a trigger, kinda like {} forEach units inArea triggerName but actually functional.
Thanks!
your not interrupting
i'll let the pros do this so i don't mess it up
i hardly ever use triggers π
well sometimes
I'm trying to reduce my use of them as well, but in this case it's the only option (without super heavy scripting ig)
If your trigger's activation conditions are set up to detect the units in question (e.g. BLUFOR PRESENT will only report BLUFOR units, ANY PLAYER PRESENT will only report players, ANY PRESENT will report most objects) then you can use thisList.
If the trigger's activation conditions won't support it (or your code is running from somewhere other than the trigger's code fields), you could try using inAreaArray.
its not to heavy of scripting
//activate when OPFOR are in the _r trigger
_r = createTrigger ["EmptyDetector",_pos];
_r setTriggerArea [200,200,0,true];
_r setTriggerActivation ["EAST","PRESENT",true];
_r setTriggerStatements ["this && {((getPosATL _x) select 2) < 70} count thislist > 0","",""];
_r setTriggerType "NONE";
_r;
thisList findIf { _x getPosATL select 2 < 70} != -1
Could be faster if there are "lot of east ppl" in thisList.
Hey guys. Is there any noticable difference in speed for "myfile.sqf" call compileFinal .... and .... call compileFinal preprocessFileLineNumbers "myfile.sqf"
I don't know the comparison, but I assume it's marginal at best. The reason you should use [] is to explicitly say you're passing "nothing".
If you're unfamiliar with the code, you can't be sure whether 0 means "nothing" if it's some magic number
inAreaArray and forEach are both binary commands, and you want inAreaArray to run first, so:
{} forEach (_units inAreaArray triggerName)
Thanks a bunch!
I'm sorry for asking this question, but I've already tried it several times and it didn't work out. Does anyone have an example of a mod for zeus modules? Preferably with literally 1 module, so that I can understand the structure and how it works in general.
Uses CBA macros for convenience, nothing complicated really
Zeus modules that need a UI are a little more complicated, since you need to make the UI yourself
I already have experience working with UI, I hope I'll figure it out.
I have this to change the weather in MP, and it just works. Question: can it be improved?
I know that I am not the only guy to do such things, so, let's share to be better.
// atmtk_set_weather usage:
// [0.7,0.3,0.3,0.5,true,true,false] call atmtk_set_weather;
// overcast,rain,fog,humidity,ambientLife,ambientSound,snow
atmtk_set_weather = {
_this remoteExec["atmtk_set_local_weather", 0, true];
remoteExecCall["atmtk_im_force_weather", 2, true];
};
atmtk_im_force_weather = {
[] spawn {
sleep 2;
call forceWeatherChange;
};
};
atmtk_set_local_weather = {
0 setOvercast (_this select 0);
0 setRain (_this select 1);
0 setFog (_this select 2);
setHumidity (_this select 3);
enableEnvironment [_this select 4,_this select 5];
private _rain_params = call atmtk_get_rain_params;
if (_this select 6) then {_rain_params = call atmtk_get_snow_params; };
_rain_params call BIS_fnc_setRain;
};
atmtk_get_rain_params = {
[
"a3\data_f\rainnormal_ca.paa", // rainDropTexture - 4 means it has 4 flakes in it. Other available textures: snowflake8_ca.paa, snowflake16_ca.paa
4, // texDropCount - 4 because we are using texture with 4 flakes. Change to 8 or 16 in accordance with other textures used
0.01, // minRainDensity
15, // effectRadius
0.05, // windCoef
25, // dropSpeed
0.2, // rndSpeed
0.02, // rndDir
0.02, // dropWidth
0.8, // dropHeight
[0.101961, 0.101961, 0.101961, 0.14902], // dropColor
0.1, // lumSunFront
0.1, // lumSunBack
0.5, // refractCoef
0.3, // refractSaturation
false, // snow
false // dropColorStrong
];
};
atmtk_get_snow_params = {
[
"a3\data_f\snowflake8_ca.paa", // rainDropTexture - 4 means it has 4 flakes in it. Other available textures: snowflake8_ca.paa, snowflake16_ca.paa
8, // texDropCount - 4 because we are using texture with 4 flakes. Change to 8 or 16 in accordance with other textures used
0.01, // minRainDensity
25, // effectRadius
0.05, // windCoef
2.5, // dropSpeed
0.5, // rndSpeed
0.5, // rndDir
0.07, // dropWidth
0.07, // dropHeight
[1, 1, 1, 0.5], // dropColor
0.0, // lumSunFront
0.2, // lumSunBack
0.5, // refractCoef
0.5, // refractSaturation
true, // snow
false // dropColorStrong
];
};
i wanted to use the music that comes with SOG cdlc in a trigger using playMusic but it doesn't seem to fire:
Any Player
Present
playMusic "\vn\music_f_vietnam\fks_music\vn_the_village.ogg";
You need to use class, not path to file
playMusic "vn_prayer_for_the_fallen";
I don't know class of village track
got it to work with
playMusic "vn_the_village";
the jukebox in 3den is very useful
ty
it's a script command, you'd just run it in the debug console. But setAccTime will prevent you from moving as well because the whole game functionally freezes
What you want it https://community.bistudio.com/wiki/setTimeMultiplier
If they're making a mission they probably want to put it in initServer.sqf
Howdy do guys! so, I typically dont have issues; but today for whatever reason I am having problem with making a drone "explode" like a suicide drone. I've tried to different way and neither has worked, any help would be fantastic.
// suidrone is a drone placed in the editor
private _pos = getPosATL suidrone;
"ammo_Bomb_SmallDiameterBase" createVehicle _pos; // first attempt
bomb="ammo_Bomb_SmallDiameterBase" createVehicle (getPosATL _sudr); // second attempt which I got from a YT video
playMusic "Music_FreeRoam_Suspended_Loop_01";
Missing a description of when exactly you want it to explode.
-# I just realized I didnt even call it for the script to fire lol
IIRC when creating bombs you have to give them a bit of velocity before they'll fall. But if you just want it to explode immediately then use setDamage or triggerAmmo.
well; ideally I'd like it to just explode upon spawning if that makes sense? cause the drone hovers over a window then explodes is my idea. but lemme actually set the trigger right first lol
Use triggerAmmo
got it, thank you!
How would I grab the direction that a tank gunner is looking / which direction their camera is facing? Looking to create a sort of gun-mounted missile "dazzler" and I'm trying to figure out which angles I need to calculate
Thanks
Hello All:
so lets say i have my time set to 11:00am
by the params in the description.ext:
and i have the Date set to (Feb 4 2014): in the Game (Attributes/Environment)
and the (time set in the game (Attributes/Environment) set to (00:00)
so that my description.ext: params can match up
how do i ensure that all that matches up
if someone runs my mission on their own Hosted server
how does that work
All those things you mentioned are packed into the mission file, they're part of the mission. They should work the same no matter who hosts it (unless they have a mod that changes the time)
If you need to set the date by script for any reason, use https://community.bistudio.com/wiki/setDate
oh cool thx so much @Nikko i was woundering π
man thats really cool Awsome Arma 3 hell yeah
man that's so cool i'm glad that's all in the mission
and thx for the link m8 π
There are a couple of scripting ways you could do that, but it is slightly more complicated than you might think because of the way triggers detect and report the units that activate them.
Before getting into that, you could try simply limiting the height of the trigger, if it's flying aircraft that are the issue
I would recommend learning how to do this stuff without triggers. Their limitations are gonna get increasingly annoying for you.
so @burnt matrix maybe explane more on where the trigger is: meaning is the trigger around the enemy: and how big the trigger is: and why does hiding behind mountains: effect the trigger:
You could use vehicle to check if player is in any kind of vehicle. If it needs to be specifically aircraft then it gets more complicated
isNull objectParent is a bit faster iirc
And not that much more complicated, you'd just do an isKindOf check
Something like this would probably work. If it's just the player and not a variety the findIf isn't necessary
thisList findIf {!isNull objectParent _x} isNotEqualTo -1;
By the looks of the Wiki objectParent is better as Dart mentioned. Less command usage so suppose makes sense it's faster but apparently it's also more reliable which I didn't know tbh
Oh
Wait
I trolled
Uhhh hold on
There fixed 
if you're checking air as well then you can combine the checks: objectParent _x isKindOf "Air"
because objNull isKindOf "Air" returns false.
what's the default value for a function parameter if it's not passed a value when called? i assume it's nil
Likely, if we understand the question
If you pasa no value to a function, yes _this will be nil
params [["_parameter", nil]]; same thing as params ["_parameter"];
If _this is nil, _parameter will be nil too
Not sure what it dows mean
123 call {/*_this is 123 here*/};
[player, 123] call {/*_this is [player, 123] here*/};```
ah yeah i haven't been using _this thanks
And params reads _this if you don't specify the array
Inside a function when used with call, _this is the passed arguments if there are any (may not be an array if an array wasn't passed), if any arguments were given. If no arguments are given, _this can be the _this from the parent scope instead, if there is one.
With spawn, the parent scope's _this can't be inherited so it's either arguments or nothing.
Need
I want the bot to be disabled and moved back to spawn position when a player disconnects. He would take it at its initial position if he picks it up again.
Code
addMissionEventHandler ["HandleDisconnect", {
params ["_unit", "_id", "_uid", "_name"];
["DISCONNECT: START", "DEBUG", true] call atmtk_log;
_unit enableSimulationGlobal false;
_unit setPosATL [3892.79,6154.74,0];
private _pos = _unit getVariable["ATMTK_PLAYER_INITIAL_POSITION", nil];
if (!isNil "_pos") then {
["DISCONNECT: unit=" + str(_unit) + " - with initial pos:" + str(_pos), "DEBUG", true] call atmtk_log;
_unit setPosATL _pos;
};
["DISCONNECT: END", "DEBUG", true] call atmtk_log;
true;
}];
Server logs
9:04:54 Game started.
9:04:55 [ACE] (csw) WARNING: <NULL-object> not alive
9:04:55 [ACE] (csw) WARNING: <NULL-object> not alive
9:04:58 Warning: Steam Query data overflow, Mods/Signatures will not be correctly received by clients. Remove unused mods or change your server configuration to allow for more data to be sent.
9:04:59 "TFAR_RadioRequestEvent [[""TFAR_anprc152""],B Alpha 1-1:1 (galevsky) REMOTE] 50.808"
9:04:59 "Send TFAR_RadioRequestResponseEvent [1] 50.808"
9:05:09 [ATMTK] DEBUG: DISCONNECT: END
9:05:09 [ATMTK] DEBUG: DISCONNECT: END
9:05:09 [ATMTK] DEBUG: DISCONNECT: END
9:05:09 [ATMTK] DEBUG: DISCONNECT: END
9:05:09 [ATMTK] DEBUG: DISCONNECT: END
9:05:09 [ATMTK] DEBUG: DISCONNECT: END
9:05:09 [ATMTK] DEBUG: DISCONNECT: START
9:05:09 [ATMTK] DEBUG: DISCONNECT: START
9:05:09 [ATMTK] DEBUG: DISCONNECT: START
9:05:09 [ATMTK] DEBUG: DISCONNECT: START
9:05:09 [ATMTK] DEBUG: DISCONNECT: START
9:05:09 [ATMTK] DEBUG: DISCONNECT: START
9:05:09 [ATMTK] DEBUG: DISCONNECT: START
9:05:09 [ATMTK] DEBUG: DISCONNECT: START
9:05:09 [ATMTK] DEBUG: DISCONNECT: START
9:05:09 [ATMTK] DEBUG: DISCONNECT: END
9:05:09 [ATMTK] DEBUG: DISCONNECT: END
9:05:09 [ATMTK] DEBUG: DISCONNECT: END
I have just picked a unit, moved it away from the initial position, then left the game back to the lobby.
Why so many logs???
Then I reconnected... here is what I have seen: I am inside another unit, and there are many bots on the hardcoded location.
Have you added it multiple times by accident?
the addMissionEventHandler ["HandleDisconnect" is inside a if(isServer) then { };
added once in an init.sqf
@earnest valve depends on your HDD speed and the used preprocessor commands
in the end: use preprocessFileLineNumbers when you use preprocessor commands and/or want script errors with proper line informations
Idk then. It also seems to print in the wrong order.
in general ...
yep. variable set on "player" is not found but OKAY, I can store init pos in a missionNamespace hashmap, but here it is very weird....
dont use call compile <insertYourFavLoadFileCommandHere> at all please ...
always put your code into variables ....
No.
spawn X is nil spawn X
it does not pass _this
12:08:38 Game started.
12:08:39 [ACE] (csw) WARNING: <NULL-object> not alive
12:08:39 [ACE] (csw) WARNING: <NULL-object> not alive
12:08:43 Warning: Steam Query data overflow, Mods/Signatures will not be correctly received by clients. Remove unused mods or change your server configuration to allow for more data to be sent.
12:08:43 "TFAR_RadioRequestEvent [[""TFAR_anprc152""],B Alpha 1-1:1 (galevsky) REMOTE] 84.945"
12:08:43 "Send TFAR_RadioRequestResponseEvent [1] 84.945"
12:08:55 [ATMTK] DEBUG: DISCONNECT: END
12:08:55 [ATMTK] DEBUG: DISCONNECT: END
12:08:55 [ATMTK] DEBUG: DISCONNECT: END
12:08:55 [ATMTK] DEBUG: DISCONNECT: END
12:08:55 [ATMTK] DEBUG: DISCONNECT: END
12:08:55 [ATMTK] DEBUG: DISCONNECT: END
12:08:55 [ATMTK] DEBUG: DISCONNECT: START _unit=B Alpha 1-1:5 - _id=1.6893e+09 - _uid="76561198008556308" - _name="galevsky"
12:08:55 [ATMTK] DEBUG: DISCONNECT: START _unit=B Alpha 1-1:1 - _id=1.6893e+09 - _uid="76561198008556308" - _name="galevsky"
12:08:55 [ATMTK] DEBUG: DISCONNECT: START _unit=B Alpha 1-1:6 - _id=1.6893e+09 - _uid="76561198008556308" - _name="galevsky"
12:08:55 [ATMTK] DEBUG: DISCONNECT: START _unit=B Alpha 1-1:3 - _id=1.6893e+09 - _uid="76561198008556308" - _name="galevsky"
12:08:55 [ATMTK] DEBUG: DISCONNECT: START _unit=B Alpha 1-1:8 - _id=1.6893e+09 - _uid="76561198008556308" - _name="galevsky"
12:08:55 [ATMTK] DEBUG: DISCONNECT: START _unit=B Alpha 1-1:7 - _id=1.6893e+09 - _uid="76561198008556308" - _name="galevsky"
12:08:55 [ATMTK] DEBUG: DISCONNECT: START _unit=B Alpha 1-1:4 - _id=1.6893e+09 - _uid="76561198008556308" - _name="galevsky"
12:08:55 [ATMTK] DEBUG: DISCONNECT: START _unit=B Alpha 1-1:9 - _id=1.6893e+09 - _uid="76561198008556308" - _name="galevsky"
12:08:55 [ATMTK] DEBUG: DISCONNECT: START _unit=B Alpha 1-1:2 - _id=1.6893e+09 - _uid="76561198008556308" - _name="galevsky"
12:08:55 [ATMTK] DEBUG: DISCONNECT: END
12:08:55 [ATMTK] DEBUG: DISCONNECT: END
12:08:55 [ATMTK] DEBUG: DISCONNECT: END
I added the content of the params.... for the same user (I am the unique connected client), it fires 9x events, for all the bots I own in my group I guess.... will try with an if(isPlayer _unit) check.
EDIT> no one is player at that time.
You would be if its a spawn, because it doesn't see local variables of parent scope. Which is why we're not doing that
You are attributing too much "magic" to magic variables. They are not magic, they are just variables
They don't work any different than normal variables
I don't even like calling them magic. It's just engine defined variable
_this is specifically set to nil.
Its not undefined, but it is nil
I thought nil and undefined are the same thing in sqf. At least I didn't notice any difference
oh don't get them started about that, they will turn your brain upside down; I gave up a long time ago! π
I thought nil it's just strange name for undefined π
nil vs undefined makes a difference with child scopes.
{
// _this is undefined here
if (true) then {_this = 5;}
// _this is still undefined here
}
{
// _this is nil here
if (true) then {_this = 5;}
// _this is 5 here
}
Just to confirm setOxygenRemaining is not a global command right? Doesn't appear to be according to:
https://community.bistudio.com/wiki/Category:Scripting_Commands:_Global_Effect
But just wanna make sure setting that constantly with a small uiSleep isn't troll 
I see
So, nil still behaves kinda like value. Variable is defined and has nil value
Dunno about the multiple runs, but it is strange your logs are not individually ordered. Does your logging function spawn off the write to rpt or sumfink?
yes I am logging currently in scheduled env, forget about the order
The 9 iterations = the 8x bots + myself
Trying to identify when I am player, but no one is player.
Switching to PlayerDisconnected.... hoping I will get this info
but how can I get the unit itself....
PlayerDisconnected is fired once, but need to get the unit object from the params now.
Are these 9 units in the same group?
π now I understand, thanks king
can a group finish a waypoint if they're all dead?
Groups with all dead get deleted by the engine
perhaps during the time between last man's death and group deletion, but that may imply velocity π
Any sufficiently advanced variable is indistinguishable from magic
π
oh really?
yes, Iam SL so all the bots of the group belong to me. HandleDisconnect is executed for all of them, dunno how to spot the one I used as a human player.
it's like a garbage collection and not instant right?
Have you tried joining as not-SL and disconnecting and see if you only get one? Looks like this could be some weird "issue" with units changing locality?
Most certainly _this cannot be true 
-# Sorry, that was bad
onHandleDisconnect
params["_unit","_id","_uid","_name"];
if(isNull _unit) exitWith {};
if !(_uid in ["", "__SERVER__", "__HEADLESS__"]) then
{
// Only runs on player units
};
@modern plank That's how ExileMod does it, might work for you.
I confirm, if I don't own bots, the event is executed only once.
And the _uid check provided by @sharp grotto is what I need.
Still worth a #arma3_feedback_tracker shouldn't really fire for these units?!
Yeah, but it would interestin to know, because it seems like the a bug.
Like some accidental interleaving of the player exiting, with also perhaps taking over the second-in command while the game is exiting and so on.
Can be, or just "leaving" means here changing the locality. Should be documented since there is no such diff with playerDisconnected into the wiki. If done on purpose for sure.
No, look at your log, and the debug names. All the disconnect events are for your name and UID (this part doesn't fit if it was only (misnamed) for locality change).
While the wiki may be inaccurate (which I doubt here since), the actual event name "HandleDisconnect" is also from the engine.
Externally it appears like you joined and exited each unit in sequence.
Yes, see also deleteGroupWhenEmpty
https://community.bistudio.com/wiki/deleteGroupWhenEmpty
I can use the deleted event handler to do some of my own garbage collection before it gets deleted by the engine, cause I have some groups stored in other data structures
I should use the hashValue of group in hashMap for this purpose iirc
Deleted event handler won't have a grpNull _group variable right?
deleteGroupWhenEmpty seems like something intended for niche uses like editor defined groups? Script created groups default to deletion, right? But for a editor defined group with a name, that name might be used for scripts so normally one would want to keep it around if, say JIP's refill it again, I would guess.
I don't know what a JIP is and I keep seeing other people talk about it
Join in progress
I would guess "Deleted" gets fired right before group gets deleted and _group will reference the group
So I guess in the example it would be awkward for a JIP player if it tries to be placed in a defined group that got deleted by the engine
"HandleDamage" also fires right before damage gets inflicted, so you can edit the damage your liking π
Yes, otherwise there'd be no point in having that parameter
Why make it different from call
How is that any different?
It isn't, practically.
call doesn't set the variable.
spawn "doesn't" set the variable (nil is basically undefined, in most cases). Its just simpler code wise for me to pass nil instead of making it undefined
k, thanks guys. π
call [without arguments] doesn't actively pass _this to the called code, it just has access to it by inheritance because it's a subscope, same as it can access any other variable from the parent scope (that's why private is important).
spawn creates an independent scope that is no longer attached and doesn't inherit variables.
I got so confused yesterday, when someone told me call takes _this by default, if I don't provide left side argument.
In practice, it effectively does. params automatically looks for _this if you don't specify a target array, and if you didn't provide arguments then it will find the parent scope's _this.
(and of course referencing _this directly does too)
The point is, it does not declare it's own _this variable, it just uses one from parent scope like any other variable
I think two following calls would lead to different results
_this = [1,2,3];
_this call
{
// _this is [1,2,3]
privateAll;
// _this is [1,2,3] // _this is from this scope
};
call
{
// _this is [1,2,3]
privateAll;
// _this is now undefined or nil because it's from parent scope and after privateAll we don't have access to it
};
Haven't tested this, but I think this is what would happen.
Which also means if I call function with some parameters and then from that function I call another function without any parameters, then it will use _this from parent function and I may get param errors or at least unexpected results
I might start using privateAll on the first line of all my functions(with all optional params) just to make sure this madness can't happen
does anyone know how to end revive using script? I have AI medics but using "_unit setUnconscious false;" alone is not enough
Regarding parent scope, since SQF is dynamically scoped, there is no meaningful parent scope for spawned code.
I had some suspicion that it could run setWaypointStatements for the current waypoint in that case.
humm this seems to work: "["#rev",1,player] call BIS_fnc_reviveOnState"
Fail, it doesn not work, the event is executed for all bots.... with the same values for all params.
thx i probably went thru all those but didnt find easy solution parameter wise
try to search within those functions in the function viewer, maybe it's some setVariable thing
ah you've already found it
then add a different check, set a variable on the player units and check for that
use a different/specific unit class for players and check for that etc.
many ways to solve it
yeah it's a little concerning
try using waypointCompleted group event handler
@old owl i found that setOxygenRemaining only seems to work for divers: btw i'm not sure what you were asking: or saying
@proven charm ```sqf
_unit setVariable ["BIS_fnc_revive_incapacitated", false];
think i got it..
ok cool m8
@dark viper you can delete the group count: or groups as it were: but that don't mean the Actual Ai of that group is dead: after the living Ai get KIA: then they get delete by the Corpse Removal or your clean up script
i think you used to be able to have 144 groups count: but i think its higher now:
that's the reason to Delete groups: So you keep the group count down low: so you can keep spawning in Enemy
like every 60 seconds i have this run in a loop: in my cleanUP script ```sqf
{
if ((count units _x) == 0) then {deleteGroup _x};
} forEach allGroups;
with other stuff also of corse
yes it runs on the Server
also sometimes i make the mission counts the groups: for the reason to have a mission win: so in that case you would not want to run this part ```sqf
// {if ((count units _x) == 0) then {deleteGroup _x};} forEach allGroups;
@pallid palm "Destroys the given group - the group must be empty and local to the machine executing this command." https://community.bistudio.com/wiki/deleteGroup
yes sir
i guess that's why i run the cleanUP every 60 seconds: right
i only host so the groups are always local to my machine
plus i have a script: that keeps me being the leader: all the time so the leader: don't change also
so what i guess i should of said was: if the group is still Alive all the other groups: get deleted and then as the last group gets deleted after they die is what i ment
thx man @proven charm
arent player groups local to client?
the leader owns the group iirc
that's why i made that script that keeps the host or player1 being the leader: cuz that can change if the leader dies
is what i found
so yes if in a hosted server: someone other then the host gets the leader pos then yes: the client owns the group iirc
288
i would be happy for some general tips on how to make a crate with equipment save-able π€
you mean like save loadout ?
no, a crate with weapons, ammo, etc
no matter just throw me something I can think on π
this is cool but it just adds gear to a crate, I need to save it whatever is inside
something like saving it to a variable in profile namespace
you can change it to what ever you want
or just put this in any ammo box
this addAction ["<t color='#ff1111'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}];
I need this in the opposite way, it should read classnames and number and save it to a (mission) profile namespace, then load it when the missions starts
why did you need a variable in profile namespace
just my guess on how to save it between mission sessions
oh umm i see ummm
did you ever look at the End_Game Mission: you should rip that mission apart and look in there
in there is what your looking for
you really don't need a variable in profile namespace
you are overestimating my reverse engineering abilities, if i was that good I will just find what I need in Antistasi ... π
then what ... this is the only way I know to save things between missions
all you need is this and you can just copy your box and put it in all your missions
this addAction ["<t color='#ff1111'>BIS Arsenal</t>", {["Open",true] spawn BIS_fnc_arsenal},"",1,false,true,"","(_target distance _this) < 5"];
maybe im not sure what you need
this adds virtual arsenal
I want to save a crate with physical items
physical items ummmm
the items that have certain numbers
unlike the virtual arsenal ones, that are infinite
so do you mean you want to see the Actual gunns inside a open Box ?
yes, the ones you can put inside and then get back from the crate
your script adds certain numbers of items in the crate
I want to save the items that are already in the crate, placed by the player
you can ajust the count on any thing you want to put in that box
oh i see now hmmm
yeah my way the box would always reset to the way it is
during the mission player will put items inside the crate, I want to save them so the player can have exactly the same items when the mission start over
the game has similar mechanic between missions but I think its deprecated or SP only
or hosted server
I use local host
im guessing hosted
rgr that
so you would need to make a script that counts the wep in the box on a loop i guess sand saves it
just get the classnames and the number of items for each classname, save it somehow and then read the classnames and number to load them in the crate on missions beginning
but let me say m8 Some functions may not continue running properly after loading a saved game,
I am not using the "normal" save
right right i get that
for now I save player position just fine
ok cool
every 5 min
ok now i know in the END_Game mission is what your looking for
you must un-PBO that mission and look in there ok m8
you will like it
this is how I save and load player's pos
//initPlayerLocal.sqf
//save
private _posHandle = 0 spawn
{
if ((str player == "ugly1") || (str player == "reaper1") || (str player == "reaper2")) exitWith {};
while {true} do
{
if (isTouchingGround player) then
{
private _ppos = getPosATL player;
missionProfileNamespace setVariable ["KIB_playerPosition", _ppos];
saveMissionProfileNamespace;
} else {};
sleep 300;
};
};
//load
waitUntil {player == player};
private _ppos = missionProfileNamespace getVariable "KIB_playerPosition";
player setPosATL _ppos;
I need something similar but for a crate ...
lol ugly1 π
yeah, that the dedicated fighter pilot lol π
vanilla
oh ok hmmmm
so i'm telling you my friend: if you look in to the END_Game mission: you will find close to what your looking for ok m8
and then you can use that stuff in there to make your save ammo box thingy your taking about
just w8 till you see in that mission yull love it
you probably want to look towards database to store info
i was just thinking that
but i didnt want to lol π
my brain already sore from scripting last night lol
INIDBI2, extDB3, etc.
there should be a scripting way and I will find it
yes i think so: i'm trying to think about how to it as well
I had found this in one post, but a bit old:
"For single player / private multiplayer, profileNamespace would be your best bet. For everything else, extDB3.
iniDBI is really only useful in the same context that profileNamespace is, so it's redundant. Any large scale, performance reliant data basing is going to require SQL.
Everything is serverside only so you don't have to worry about that, but if you use profileNamespace you need to make sure that it's being used on the serverside so that you're not writing little databases on each client."
this will get the classnames https://community.bistudio.com/wiki/weaponCargo and so on for backpack and ammo
If you're loading all saved data at startup then there's not a lot of value in using extDB.
getBackpackCargo
getMagazineCargo
getWeaponCargo
π€© π₯³
Aren't you trying to save contents of crate, loadout, etc. between missions? Those are just getters
I have to get the classnames first, right, then save them as an array in a variable just I did with the player position
so, your issue is not persistent data, or transferring between missions, but retrieving crate contents?
nothing to save if don't get what I am saving first -> classnames and numbers and then when mission starts I spawn what I have saved
imho
I should set a different variable for every type of item
then it will work
and I will be using initPlayerLocal.sqf because I want this box to be personal for every player
It can get quiet complex, depending on what you want to save and how precise (Ammo count for example).
Stuff is all over the place in terms of needed commands (getItemCargo,everyContainer,magazinesAmmoCargo,weaponsItemsCargo and the same again for any containers inside the container.
yeah, its a mess really ...
sounds like more work then its worth m8
ok lol
didn't I give you the retrieval in this post: #arma3_scripting message
There should be a getContainerLoadout / setContainerLoadout that does everything π
oh nice
I want it to exist so badly, maybe in 2.22 π
you can do it m8 i believe in you
thank you guys, I have the path, I will get to write the damn thing π€
holy shit that's Awsome @past pollen #arma3_scripting message
After all this years we really should have getContainerLoadout / setContainerLoadout and for vehicles getVehicleLoadout / setVehicleLoadout
This would make alot of stuff easier for beginners and everyone else ^^
And last time I tried to simplify/improve a player loading function of a mod with persistence (ExileMod) with the help of getUnitloadout/setUnitloadout, it was buggy (empty gear for others etc) 
Can i just ask why are you doing loop of 5 min and not just use EH on Disconnect to save last known position ?
Also you dont need spawn in InitPlayerLocal.sqf because its scheduled.
Well it would prevent complete loss on a crash
You do both usually yea
Which variables is it good practice to name like this so they don't conflict with mods? Of course not all need it. Is it just the ones you mean to broadcast?
missionNamespace getVariable ["foxClub_var_createCheevos", false]
If it's a mod then you should do for every variable.
If it's a mission then you can hope that none of your mods are poorly written :P
global variables yes, broadcast or not
I just have a bunch of server-only trigger conditions written like the above, but was wondering if I really need the foxClub bit.
Well, think about it. All SQF code shares missionNamespace. If two separate routines are using a global variable with the same name but expecting different things in it, then they're going to break.
If you're writing a mod then the expectation is that it's compatible with other arbitrary mods. Or at least that it's not incompatible for dumb and easily avoidable reasons.
Oh so I don't have to specifically declare missionNamespace for code to be in that "container".
Any help on why the code in the if statement isn't executing?
In the version that works, I used if (condition) exitWith {myCode};
However, that didn't want to play nice with the sleep statement so I adjusted it to exitwith after running the sleep, but now not even the hint is displaying when the code is ran.
Fig 1: Broken version (if-then with exitWith inside then), not even the hints will fire
Fig 2: The working version (exitWith, commented lines) works so far as executing the code inside successfully, but doesn't work with sleep
1: exitWith only works in syntax of your second post as part of an if statement
2: are you executing this in a scheduled environment. If not, sleep is not valid.
I call a function which points to this file. Nothing particularly fancy.
Also put in an if statement for the case I'm trying to make work on the off chance it freaked out the compiler or smthn. //if (engineOn _plane == false) exitWith{_plane engineOn true;};
Sleep command works just fine elsewhere in the script, I think Arma just didn't like putting a sleep command in an extiWith
The other sleep in the script uses a spawn, I think that should help me out
missionNamespace is the default namespace. If you just write myGlobalVar = 1 then that's setting that var in missionNamespace.
Would one of these be preferred over the other?
- foxClub_var_variableName
- foxClub_variableName
Not for these reasons, no.
Adding prefixes like var_ or fnc_ is a convention for your own benefit or not.
SFA_EX_ChopperFinish =
SFA_EX_ChopperStart =
Can help with order/searchability/readability etc
TAG_Group_FunctionName
TAG_Group1_SubGroup1_FunctionName
TAG_Group_VarName
TAG_Group1_SubGroup1_VarName
ExileMod did that name convention good for most of the stuff and it makes it so much easier to work with, compared to other stuff I saw.
So, the code nreaks in the previous version as as soon as the if-exitwith-engineon line is uncommented (ignoring sleep issues)
Now, I've tried using a spawn block in the same structure as an existing one to allow the script to sleep , but even with the if-exitwith-engineon code commented, it breaks the script in the same way. Not even the hint ABOVE the if statement works like this
no effect ingame with no error messages - no hints, the call_bis_fire doesn't happen, etc., like the script didn't run.
ah thanks for that underscore fix... that actually fixed it up to where I am so far as seen above
Looks like uncommenting the last if-exitwith line still breaks it all... hmmm
What is the thought process of when to move code from an addAction to a separate sqf, if any? I was going to put a bunch of code in it but thought I can also execVM or put it in a funciton.
I'm not sure the optimal use case for each of those.
Have you tested just
_plane spawn {
sleep 1;
if !(engineOn _this) then {
_this engineOn true;
};
}
I think it's about keeping your code clean, if you have a lot of code to execute on that addAction, it's best to separate them just for your own sanity
typically for organization. typically in most code bases in many languages, the sweet spot is 100-300 lines of code per file.
Not sure if this matters but I write them without the ()
systemChat str _sentences;
over 1000+ you probably should break it up (or use #includes if you need it to be in one function)
What is the reason? I have 1700 in initPlayerLocal as of now. This is bad?
its all about organization when you have a bunch of people working on one codebase
lots of tech debt is bad organization
So my mission should run okay still. And since I'm the only one working on it then no problem?
execVM is only good for spare execution/single execution since it has to recompile the code everytime
If you use something often, make it a function
I reworked it, realized I didn't need to swap the exitWith to a then in the first place. Seems to work with AI now.
The wonders of talking about it with someone next to me for 20 seconds, getting an idea, and immediately putting down my drink to rush to the PC
its fine until it becomes unmanageable for you.
if you intend on moving to OOP based things like reforger, its good to learn how to consolidate. a good book to read is Refactoring by Martin Fowler.
when setting an object texture is there a way to make it not repeat?
I have a 40m x 40m object and the texture repeats like this
my current work around is scaling a 5m x 5m object by 8
It's pretty much down to the interaction between the texture itself and the object model.
If the texture itself contains tiling, then that's what'll appear (solution: use a different texture). If the model's texture map is tiled, then that's what'll appear (solution: use a different object). There's no control over that through scripts.
Thanks, I guess I will just stick to scaling the object
anyone familiar with the setPlayerRespawnTime function? It says its local and the wording implies it only affects the player its used on. However, in practice it seems to apply globally, and only when the server executes it.. but it doesnt feel consistent, not sure whats up. Looking for insight if anyone has it
technically no need to do this since the engine will do it automatically
the caveat being that named variable groups need to set DeleteWhenEmpty or whatever it is
and I like to do avoid any polling when possible as I assume the performance will be impacted
even Triggers themselves are just glorified polling scripts. Thats why too many break your performance, at least thats what I've heard
I appreciate the amount of Events in ARMA 3, should be much more performant than constant polling if you have a lot of logic
That and the default interval is way too low for 99% of use cases
Most things don't need to run every 0.5 seconds
has anyone else run into "No Entry" errors with removeItems? for some reason its throwing an error after attempting to query CfgWeapons for inventory items
no entry usually means one of the configs isn't complete (bad mod). can you gather the full path from the log for us?
sure! one sec
im iterating over a list of items from I believe the apex DLC
no mods?
Nope.
just ace and CBA
What is the code you run and supposed to achievve
the code snippet causing the error is just this:
//missionNamespace var defined in init.sqf
PB_IntelItems = ["Item_Files","Item_MobilePhone","Item_SmartPhone","Item_Laptop_Unfolded","Item_FileTopSecret","Item_FlashDisk","Item_SatPhone"];
{_unit removeItems _x} foreach _intelList;
I can post the full 55 line function if you'd like, didnt want to clog the channel
No...? _intelList is undefined to me
You can use Pastebin if your code is too big to directly post
i'll just link the code in the git repo one sec lemme push
What on Earth line 12 to 17 supposed to achieve
something that should be completely unnecessary
It seems completely nonsense to me
i found in testing that when put these items in the units inventory their classname completely changes
So the "items" you can place in the Editor are not actually the item, they're just an invisible container that's preloaded with the actual inventory item
oh is that how it works?
Inventory items can't exist in the world on their own, they only exist as inventory records. They always have to be in a container.
tldr: inventory classname and the classname you put in Eden is NOT equal
interesting okay so I guess theres a discrepency between the item name itself and the container name then
You can see what item a preloaded container contains by looking at its TransportItems config
Files is a valid name of an inventory item class, but it's technically a magazine, not a weapon. The error you're getting implies that something is trying to treat it as a weapon.
yeah I saw it was classed as a magazine, is there a another function that is meant only for magazines or something?
there sure is https://community.bistudio.com/wiki/removeMagazines
thanks for the help y'all I appreciate it!
Based on the documentation and similarity to addItem I would expect removeItems to also work with magazines though. Need to do a little testing. Also it should probably be a less catastrophic error even if it gets an invalid classname.
it'd be a luxury if it did tbh, I'm gonna give removeMagazines a whirl real quick
yep it works
How to investigate "undefined behavior: waitUntil returned nil. True or False expected" errors?
My scriptDone is failing:
_hdl = _im_id spawn {
_this call atmtk_reinit_vehicles;
["ScriptDone", 'DEBUG', true] call atmtk_log;
};
waitUntil { scriptDone _hld };
But the spawn exec looks good, I have my log "ScriptDone" printed out.
Should the spawn return a specific value?
Variable name is spelled wrong
You save the script handle to _hdl and then check whether _hld is done. That variable doesn't exist, returns nil, script error
i would like to alter the inventory of spawned vehicles players will come across and insert limited items like smokes and grenades
for the remove weapon it lists as individual weapons player has to remove, isn't there a remove all or wipe all instead?
clearWeaponCargoGlobal etc
Should do the trick assuming it's global:
clearBackpackCargoGlobal _container;
clearWeaponCargoGlobal _container;
clearMagazineCargoGlobal _container;
clearItemCargoGlobal _container;
ty
Hello !
I saw that the sea level had been raised. Is there a command that allows me to do this ?
No, but you can lower the terrain
or this here in almost anything
clearMagazineCargoGlobal this;
clearWeaponCargoGlobal this;
clearItemCargoGlobal this;
clearBackpackCargoGlobal this;
I would like to create a small mod that requires advanced medical mod, like ACE medical stuff or KAT as dependency. I wonder whether they support replacing a wounded human player with AI (on the fly) or not? Like so that the AI has same medical status as the human player after the swap
and btw if you say no mods and then say just CBA and Ace them are Mods π
Me? I tried to express that I actually need to have either one of them as dependency
no no not you m8
Ah aight π
up there Hypoxic ask a guy if he had any mods and he said no: just CBA and Ace
like that's a standerd or something π
you know: i cut my teeth in Arma: "meaning i was friends with and started playing Arma with" one of the guys that started CBA and ACE
his Nick was Sickboy
What is the Reply feature?
The reply feature lets you respond to a piece of conversation in the channel without having to recapture the context. This is especially useful in conversations that can ...
oh thx @thin fox
π€£ π€£ π€£
lol π
π
lol π
hello again m8s: umm is there a way to switch to left handness like you know for your gun
Ctrl + A ingame?
really
so its like select All but only in game
@tender fossil ummm is that linked to a controll what's the name if it is: cuz it dont seem to work
From what I've read of ACE medical it should work fine. The medical state is stored identically, and the decisions that depend on human vs AI look it up on the fly.
That's nice. Basically what I'm aiming for is a system that replaces human player with AI when a medic starts treatment (human player respawns then). If medic(s) manage to keep the patient alive and well till arrival to base or field hospital with medevac, the team gets a respawn ticket (or equal reward) per patient. The point of the system is to let players focus on combat while still allowing simulation of full medevac chain for medics
You can, there are API functions to serialize / derialize the state. So you can get the player's state, teleport them somewhere, spawn a new AI, apply the medical state
Thanks! I'll have a look π
It might be tricky to define your conditions here. ACE/KAT can be quite complex. For example, it's possible for a player to just be briefly knocked out, and they'll get back up on their own after a short time. What happens if someone sticks a bandage on them during that time? It doesn't make any difference to their recovery chances, they were going to be fine anyway, but does it count as starting treatment and force them to respawn?
Good point. I wonder if there's a way to detect cases where patient's status is severe enough to justify medevac e.g. with some core variable(s)
With common ACE settings that's pretty situational. There's no health state that you can't recover from.
(aside from actual death)
I'm trying to create an action that delete a wall, and puts a different wall in its place.
I've used createVehicle with 3D coords, and it kept spawning a couple meters away, never in the proper spot,
Ive tried using a marker, the wall never spawns at all.
ive tried spawning the wall on the previous wall before deleting first wall.
I'm not really sure what else to try
Maybe the best way is to just let the medic make the decision then
Probably works best, can make a treatment action for it so they can do it right from the medical menu
You'd probably need an offset. Even if the walls are of similar size, they don't necessarily have a similar model center.
its the exact same wall, just a door that faces the opposite way
Use getPosWorld/setPosWorld then.
createVehicle with CAN_COLLIDE might be ok but if you want a precision copy then getPosWorld/setPosWorld is the way.
Thanks, that gets it actually deleting and spawning. Still 1m to the front though. Gonna try the offset
nvm, its not working at all and without errors lol
obj = nearestObjects [[5129,3186,0], ["Land_Bro_MSWR_Doorway_Rubber"], 3];
door = "Land_Bro_MSWR_Doorway_Mirrored_Rubber" createVehicle setPos "obj";
door getPosWorld setPosWorld obj;
deleteVehicle obj;
no clue why its not working.
Is the original object a map object?
it was placed down in 3den
ah yea thats just one of the things i tried
It's not a thing to try, it's a syntax error :/
yea im aware now, but nothing else was working. So i just started typin stuff
also the other line is wrong too.
what otherline?
door setPosWorld getPosWorld obj;. You have it backwards.
Which is also a syntax error. Are you running without show script errors enabled?
_obj setPosWorld getPosWorld _obj;
this is what the biki says.
and no, I'm getting errors, and when I wasnt getting errors, it still wasnt working.
This is your code:
door getPosWorld setPosWorld obj;
{
_obj = nearestObjects [[5129,3186,0], ["Land_Bro_MSWR_Doorway_Rubber"], 3];
door = "Land_Bro_MSWR_Doorway_Mirrored_Rubber" createVehicle position obj;
deleteVehicle obj;
door setPosWorld getPosWorld obj;
};
my bad, I posted the wrong thing. This is the lasted code i've tried with 0 errors and not working.
obj/_obj confusion there.
And maybe don't delete the original before you read the position from it.
can you explain the confusion? because I've gone back and forth with it
You have _obj in the first line and obj everywhere else.
These are two different variables.
All the variables here should really be local & private, but consistency will work.
error postion. type array, expected object, location
private _obj = nearestObject [[5129,3186,0], "Land_Bro_MSWR_Doorway_Rubber"];
private _door = "Land_Bro_MSWR_Doorway_Mirrored_Rubber" createVehicle position _obj;
private _pos = getPosWorld _obj;
deleteVehicle _obj;
_door setPosWorld _pos;
ah wait
you used nearestObjects rather than nearestObject.
Could also throw a select 0 on the end, but this should work in context.
nearestObjects returns an array, and you want the first entry of that.
gotcha, working now.
so dont use getposworld and setposworld in the same line, use them to get a _pos and then set it? thats best practice how you have it?
It's not that you can't use them in the same line, it's that you can't use getPosWorld on an object after you've deleted it
yea that makes sense. I appreciate it.
Having an issue with addAction, I run a loop on several objects to add an addaction, but for some reason, 2 actions are being added for every object. I tripple checked my missionfile, and I dont have the loop running twice
quadruplecheck? are you looping the wrong array of objects? even though addaction is local, some other kind of locality issue, like someone JIPing?
Dedicated server problem >>>
I have an interesting situation with a HashMap Object.
I created this structure code.
_a= [1,2,3,4,5,n,n,n];
_Array=_a apply {
_hmo=createHashMapObject [_declaration, [_x]];
if (count _hmo == 0) then {diag_log formattext ["ErrorCreate %1",_x]};
[_x, _hmo];
};
_Hm=createHashMapFromArray _Array;
missionNamespace setvariable ["WorldZoneHMO",_Hm,true];
Using the RTP file with the #delete method, I discovered that all of my HashMap Objects were being deleted twice and recreated three times.
Could this be because I wrapped the references to the HashMap Objects in a HashMap? This is certainly usable to some extent, but it's incredibly silly when instead of making changes, I'm recreating the entire HashMap Object. And I have a lot of data in it, and I have 43 HashMap Objects inside the HashMap.
What is the best way to send my HashMap Objects to players that the server updates locally?
Should I create a global variable for each HashMap Object?
@tough abyss even then you should put the code into a variable
@agile pumice 99% of the times, its the programmers fault
so give us some proper examples and we might be capable of helping
otherwise i will get some "fancy bugs" i still have in my pockets into this chat where you can guess where the problem is located at
So, I checked. I realized something. In my situation, sending the hashmap object to players doesn't make sense, since they're recreated with every new change rather than attempting to modify elements within themselves. I'll need to send internal changes to players using a remote call with arguments bound to the required key. Total crap. It's easier to create "Logic" and update all setvariables in it, but it's a shame to have wasted 2 days already.
In the end, I decided that the Hashmap object will always be local to the server. I'll also have a regular hashmap in which I'll store all the dynamic data players need to see and update the variable every second.
When you're replacing hashmap then yeah, entire hashmap will get replaced. It's to be expected
As soon as I am considering broadcasting a big object like a hashmap, I am asking if it is not preferable to let eveyrone build the hashmap up locally, like the whole list of objectives/vehicles/whatever and so on.... and just broadcast the current index/key of it. The less on the network, the better. At least for MP.
You could remote execute a function which would update hashmap pairs. Send pairs as param
Yeah, I thought about that too. So now I'm thinking about the best way to create a function that will replace data using arguments. The problem is that I also need these changes in JIP, but then sending individual changes loses the point. Because I also need to change the data in JIP, and JIP can't be created without a global call. So, individual changes aren't suitable either. Because even if I send them to JIP, what's better: one JIP or 150 JIP calls with detailed changes, each with the required argument.
Maybe it's not too bad idea to send entire hashmap for once for JIP
Build your local WorldZoneHMO hasmap on all computers, with initial values (can be empty, but your 43 hashmap created).
Then the server runs [key,val] remoteExec["update_my_hasmap", 0, true] whenever it needs... if you need to update just a few pairs at once.
If you have suddenly to update all of your 43 hashmaps, you have an architecture problem and your implem should be completely different.
It could be multiple pairs per one remoteExec
Also name of the hashmap needs to be in params otherwise you would need function per hashmap
Another headache is that I have a first hashmap that stores map area polygons (updated every second). The second hashmap contains hashmap objects with methods and properties, and it's linked by keys to the first hashmap (used to build and configure missions with pre-prepared data). Now I need a third hashmap linked to the first and second hashmaps with hashmap elements that stores the property keys of the second hashmap.
Wow wait. Explain what you are trying to achieve.
Why everybody needs to get them and so on.
Because instead of refreshing polygons everywhere, it could worth to request the server only when clients need to use these polygons.
I mean.... I doubt that all players will use all of the polygons every second or two.
Are the polygons static or do they change also (I mean their shape)?
Cause polygons may exists only on the server and the server throws events like zone taken.... He has the position of all units and can evaluate in a scheduled spawn the who is where every 2s and so on...
Static compute each machine. Dynamic use a CBA namespace and setVariable with public=true.
So explain your usecase....
My mission processes 5,273 coordinate points that were previously unloaded from the editor, and I can even load them back into the editor and display them as markers using my tool. I created all these points manually using Ctrl+V in the editor. The server processes this data and sends the finished hashmap to the players. On my client, the game would freeze for about 10 seconds, but I didn't notice this on the server. That's why I have to go to so much trouble to remove processing requirements from clients. A polygon can have over 200 positions, which means 200 coordinates are stored in a single key in the hashmap in the array view. And I have 43 polygons, as you can see.
Still doesn't answer galevsky's question whether it changes or not. If not then put the precompute the data into the mission.
I'll then assign parameters to these polygons (areas/zones). These include the side that captured it, which control points need to be captured, which side is attacking, and what the players' side's reputation is with the area. And so on, the list will grow as the mission expands and new capabilities are added.
So the mesh is completely static? Only associated data changes?
Ahahah
Ok
So you have a simple array of polygons... A second array containing a hashmap that defines a set of properties.
On server only.
Roughly speaking, instead of Inarea, I now have Inpolygon and I use positions not in circles or rectangles, but in polygons
And clients sends data to server only when necessary. For their position it is useless for example.
And server will send zones updates whenever a zone is captured. And I doubt that all zones will change at the same time.
Are you sure you need associated data to be global? What are the clients doing with it that is not triggered directly by an update?
Of course, I could simply create a separate global variable for each zone with a hashmap containing the property keys. And associate it with another variable using an array or hashmap: Key->hashmap variable. Then I could change the zone properties individually without transferring data from all zones.
will copy the return of gangFlags in a sec
I suggested CBA namespaces because that is basically just an object, so you can update "keys" individually and publish them. You could of course use any object CBA namespaces just picks something efficient.
The player can select which zone to capture via the map with a mouse click. However, I currently don't have information about which side has captured the zone because I haven't passed the hashmap object to the player that contains this property. (I've disabled variable broadcasting at the moment. The capture mission works, but players have no idea what's happening with the zone.) I can manually activate the capture via the console using a method in the hashmap object.
I have a vanilla server... we no use CBA
Could try createSimpleObject ["Static", [-1000, -1000, 0]]. All CBA does for a global namespace: https://github.com/CBATeam/CBA_A3/blob/82394429c1f50770cc04c7fde592838a0ff8c954/addons/common/fnc_createNamespace.sqf#L32 where for a global namespace the dummy vehicle is defined as https://github.com/CBATeam/CBA_A3/blob/82394429c1f50770cc04c7fde592838a0ff8c954/addons/common/CfgVehicles.hpp#L4-L7.
So to update say, I dunno owner side of a zone something like this:
private _zoneEntry = TAG_Zones get "13"; // Returns the "namespace object".
_zoneEntry setVariable ["TAG_OWNER", east, true];
the array is built using pushBack in the flag's init in the sqm
Something like that, I am just updating the owner property, but just add other processing into the updates made by the server.
zones are known eveywhere... to create markers on cli, to manage associated porperties on the server.
The server -every 3s (example)- maintains zones properties...and thows events only when and where it is necessary
Note "can be -2" this won't be invoked on hosted server machine.
this is why there is a BUT π
I also prefer doing a remoteExec on '0' then protect the function content with a if(hasInterface)
Well, it is the concept, then extend to your needs, but as you see, everything is optimized: cli just executes markers update when necessary... so no extra process for nothing ; And server processes the updates... that can be optimized too.
Here I am checking every 3s forEach ZONES forEach players which is big, 43x times the number of players.
You may optimize it with bigger sectors....
like divide the map in 4/5 big sectors (= a cluster of polygons)
Then you check if the player is in the sector and check the inPolygon only for the polygons of the sector... which becomes 10x times the number of players. Better.
gangFlags returns [gang_8,gang_1,gang_6,gang_2,gang_3,gang_9,gang_4,gang,gang_7]
Because it is useless to test the player on sectors on the other side of the map...
You can also compute the sector dynamically first from the current position. (this method is called 'boxing', it is done this way to manage to display a mockup with millions of parts in a computer: you first define a restricted area and load for display only the ones that may be needed.... not the millions ones.)
Just store the last known polygon the player was in on the object. Verify it, and if miss, find out what the new one is.
ya, could be, the boxing has to match your requirements. You get the sectors aside, maybe 4 or 5, and you are done.... but it does not work if you can have jets and flying players matter. If not it is ok. Well, do the boxing you need.
That is why it is crucial to know what the exact purpose and requirements are. Because yeah, distance objects won't be anywhere near realtime up-to-date on player machines whose player is far away.
The only way to even include a fast-mover in this would be for the server to forcible send owner-status/position updates out explicitly, just to see a 0.5s flicker of ownership change back and forth over a zone.
Ya. The easier is to say "capturing players are on the ground" and you avoid a lot of burden. π
@last cave you may prefer this more generic implem:
Here all the cli have a local copy of properties updated when necessary by the server, then do the local processing you want. ( β οΈ not tested, but I am quite confident that this kind of implem matches your needs)
You can also build a hashmap into the server spawn {} and push changes inside.... then call once the cli_update_zone_property with the hashmap instead of prop_name and prop_value.
Where's gang_5?
Hiding
In MP? Yes
Well
Maybe
Do you publicvariable the array at any point?
Also why even pushback from the init when i assume you know as mission maker which ones are planted but thats another issue
createDialog ([] call foobar) why is this dialog created twice?
rly need help guys
foobar content:
http://pastebin.com/raw/71Ysng8f
cough @agile pumice cough
is there a way to check when an artillery projectile has been fired?
"Fired" EventHandler?
i managed to do it using artillery shell mission handler
i dont publicvariable it
its just easier for me to copy and paste the flag several times and not worry about remembering to rebuild the array manualy
Well your addAction is going over every flag twice, there is no bug where multiple actions are added
i dont understand why its occuring twice, could you explain it to me?
Because you made a mistake somewhere
I cant tell where from what youve shared
But addaction works fine
It all starts with properly debugging what youre doing - try adding a bunch of diag_logs, see where things go wierd
Try from a blank mission
Go wild
Any way to create a flashlight by scripting? I can create light, but I'm unable to shape it. It casts light on entire area in all directions. setLightVolumeShape doesn't seem to do anything
https://community.bistudio.com/wiki/Light_Source_Tutorial#Heli_Spotlight dunno if this can help you
Is it possible to set the ~~throttle ~~and landing gear state of a vehicle (Jet/Heli) via sqf?
Couldn`t find any functions in the wiki
Throttle:
https://community.bistudio.com/wiki/setAirplaneThrottle
there is a command for throttle but I think it only works for player, and gear state maybe with action
Looks like it can and quite funny to see Dark souls light as example 
Something like: https://community.bistudio.com/wiki/setUserActionText ?
That works with the LandGear, unfortunately throttle did not work.
But that is ok.
IA?
because that command only works for player unit
https://community.bistudio.com/wiki/setAirplaneThrottle does not set throttle to 0.5
Examplescript:
params ["_target", "_player", "_planeClass", "_startAltitude", "_startDirection", "_startSpeedProportion"];
if (isNull (objectParent _player)) exitWith {};
if (_target != (objectParent _player)) exitWith {};
_player assignAsDriver (objectParent _player);
_player moveInDriver (objectParent _player);
(objectParent _player) engineOn true;
_player action ["LandGearUp", (objectParent _player)];
private _maxSpeed = getNumber (configFile >> "CfgVehicles" >> _planeClass >> "maxSpeed");
private _speed = (_startSpeedProportion * _maxSpeed);
private _velocity = ([sin _startDirection, cos _startDirection, 0] vectorMultiply (_speed / 3.6));
(objectParent _player) setDir _startDirection;
(objectParent _player) setPos [0, 0, _startAltitude];
(objectParent _player) setVelocity _velocity;
// does not work:
(objectParent _player) setAirplaneThrottle 0.5;
But then the player can set the throttle manually
first off, just define the
private _parentObj = objectParent _player;
at the start, you use it a ton.
Second, where is this being run? setAirplaneThrottle needs to be run where the object is local
Nevermind, now it works ... sometimes
It is running locally.
The critical part is to make sure you're creating a #lightreflector (directional light source) and not a #lightpoint (non-directional light source)
Help me out here,
The AMT - Support mod creates a dapsBlacklist Global variable, it is found within the start.sqf which runs in CBA's Extended_PostInit_EventHandlers, being it post init, how can i ensure i can create a mod/script that will run only after the start.sqf script runs, so i can add my unit's ammo to it?
Make an addon that requires the AMT addon that defines the variable and make a script in PostInit to add it to the array
does PostInit scripts run in order based on requiredAddons? at least CBA's XEH do?
All of CBA's extended event handlers do
Couldn't tell you with vanilla CfgFunctions' pre/postInit = 1, but those run scheduled anyway so meh
yeah, as long as CBA's XEH does that it should be fine, ty ty
Does anyone know an open source rcon client? I mean, a client where you can watch a chat, write there, ban / kick
I'm trying to setup a teleport script for a squad of AI, man1, man2, man3, man4, man5 I have a trigger and on activation they each teleport to a specified location
The problem I have is what do i put in the Condition field so they teleport one at a time when each unit gets inside the trigger
So when one of them enters the trigger area,
That specific unit will be teleported to point x.
Not that way if one of them enters in area -> everyone gets teleported?
correct
//Condition
[man1, man2, man3, man4, man5] findIf {_x inArea thisTrigger} != -1
//On activation
private _units = [man1, man2, man3, man4, man5] select {_x inArea thisTrigger};
{
_x setPosATL yourXxPos;
} forEach _units;
You could do something like this
Thank you Iβll try this
@stable dune you the man: you help us so good: i like you m8
What am I doing wrong? Why does my "#lightreflector" lights up some objects and some just doesn't?
private _reflector = createVehicleLocal [ "#lightreflector", [0,0,0], [], 0, "CAN_COLLIDE" ];
_reflector attachTo [ player, [0.0, 0.15, 0.15], "Head", true ];
_reflector setLightColor [1, 1, 1];
_reflector setLightAmbient [1, 1, 1];
_reflector setLightIntensity 10000;
_reflector setLightConePars [60, 10, 1];
_reflector setVectorDirAndUp [ [-0.35,1,0.2],[0,0,1] ];
Have you tried the same position with a "known good" reflector (e.g. weapon flashlight)? It could just be a weird interaction between the notoriously dubious lighting engine and that specific object, not something you're doing wrong.
With pistol flashlight everything works.
Also just trying reflector light in town and in jungle and buildings and trees work just fine. There might be issue with tunnel objects
If you keep moving into the tunnel, does it light up?
It does not
Sounds like an engine bug anyway. Make an issue with replication details and maybe it'll get fixed.
I'm guessing that it's an object bug too, and there's a small difference between #lightreflector and the engine weapon light implementation.
It behaves same even with S.O.G. Nickel Steel mod
Hey, im trying to change the scale or size of some NPC's and no luck for now
Someone know how to do it?
what did you try already?
setObjectScale
that's the one
see its documentation π
https://community.bistudio.com/wiki/setObjectScale
Try, especially the last parameter:
https://community.bistudio.com/wiki/setLightAttenuation
That works! Reflector with very long reach lights up everything. I didn't think about that.
There are several tunnel objects with exactly same layout with only difference being props inside of them. Strange thing is, one would get lit, but other one didn't, even though they are basically same. Maybe it would get lit if I tried lower floors I was only in top floor.
Hello ,so I have a script on a tank that when the vehicle fires it should eject a shell. I am running into a problem where sometimes it would eject two shells. I noticed it happens more often if I switch ammo on the maingun from shell to rocket ammo (haha funny tank that can shoot shells and rocket). The gunner has the main gun, coax mg and a laser des as its weapons. Initially I thought it was cause I didnt have a local check, and I do a check to make sure it runs only on the gunners pc right after but that didnt seem to help, any ideas what could be possible problem?
The script is called from the Fired EH on the vehicle it self.
here is the script, minus the long part of actually spawning teh shell cause its long but I can post if needed
params["_firedEHParams","_extraParams"];
_extraParams params [
["_animations",[]],
"_ejectionPos",
"_ejectionEnd"
];
_firedEHParams params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_player = missionNamespace getVariable ['bis_fnc_moduleRemoteControl_unit', player];
if(!(local _unit)) exitWith {}; //turns out this is needed lol
if(!(_player isEqualTo _gunner)) exitWith {}; //prevent driver from triggering the shell ejection
/// only for shells
if ((_ammo isKindOf 'ShellBase') ||(_ammo isKindOf 'MissileBase') ) then {
if (!alive _unit) exitWith {};
//lots of stuff to spawn shell, gets its position etc etc, but main thing is im using createVehicle
//shellmodel createVehicle position
};
unrelated to the issue itself but why on the vehicle and not on the weapon?
but most likely your issue is in the part you didnt post
personally i'd put debug in the fired eventhandler to see if the eh is firing twice or not
but most likely depending on how you're spawnign the shell it's probably somewhere there
i saw that the T-90 or something from rhs or csla did it on vehicle so I figured that be a good way
here is the full thing
ah 1 sec message was too long
Use pastebin if it's to long
yeah those scripts predated weapon eventhandlers iirc
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
not sure why it added span class="re5"> to the start of the pastebin
ooh ok you're using an actual object
ah okay, ill try moving it to weapon
yeah so it can hit people (and has) very funny
word of advice I suggest using class Thing; for that rather than ThingX
it looks worse but physx loves sending things to the moon
will it still cause dmg if it hits players?
idk
okay I will try Thing
I always set their mass low so it doesn't cause any issues
and see wat happens
its what the AT gun shells etc use in spearhead
and the like, side skirts breaking off tanks
cuz we had like, a side skirt blasting off a panzer iv and it'd hit the tank that was near it and send it to the moon
I did notice the ejeting shells would cause other tanks era to go off when hit with it 
but anyway as for the problem the only thing I can see happening is the fired eh is running twice - you put a locality check which stops it from MP
so idk what could be causing that
ill try weapon maybe that fixes the problem
hello i was wondering, im new to scripting and trying to learn arma scripts why is that some scripts using the debug menu work for global exec and local exec but not for server exec?
We cannot tell the answer without the actual code and situation
im testing out how execs work on a server right now im trying to have players and targeted factions specific voices so they dont sound weird e.g russians using the arma 3 english voice
without the actual code
Most of those functions setIdentity, setFace, setSpeaker are local effect only
All 3 execute buttons do entirely different things, so it makes sense the same code doesn't "work" for all 3
So server exec has pretty much no meaning on a dedicated server for those commands
Is it possible to allow player to use NVG and weapon flashlights only under certain conditions? There is VisionModeChanged event handler and it seems like that could be used to remove NVG from inventory and put it back, on vision mode change to make it unusable. But I don't see anything like that for flashlight.
I don't think there is an EVH that gets triggered when turning on/off weapon attachments
I guess you could just check isFlashlightOn every frame and turn it back off
if (player isFlashlightOn currentWeapon player) then {player action ["GunLightOff", player]};
There is the user action EH for that action (headlights?)
that shouldβ’ work
I was about to ask if there is a way to detect when light key gets pressed. I could turn of his flashlight every time he attempts to use it
best thing about scripting is doing things like this
I was almost wanting to suggest that but wasn't sure if that was too hacky. You could probably run a keyDown event handler with the isFlashlight command to handle it
"hey admin I can't turn on the flashlight, oh it's arma, another bug"
Isn't onKeyDown a display/control event handler? Only working in dialogs?
The main game display is a display (findDisplay 46)
But I think you should try the user action EH first, it's more plug-and-play and less chance of false detections
What a hack π€£
Yeah. I've seen some pretty funny tricks come out of that display. Iirc killing that is an alternative to endMission 
I remember a while ago unpacking a bunch of Arma PBOs just to kinda try and better understand Arma more under the hood. Entire perspective changes when you realize everything in Arma from the moment you boot is a mission and everything you look at is displays with controls. Joining a multiplayer mission just takes you from one to another. Kinda art π¨
If I remember correctly, in CoD1 main menu is mission
Does that make the menu the main mission?
Checking files I don't see any menu map. I've seen menu mentioned in soundaliases file(defines sounds for missions) between missions. So, I guess it's not actually mission. Whatever
Are variable names with bis_ protected? For instance, I want to setvariable [βbis_typeβ, _type] on a group.
I think a bis_ function tag is prohibited but Im not sure about variable names.
Technically only compileFinal functions and Hashmaps are final.
So variables with bis_ are not prohibited?
You can overwrite it, yes
This is how to disable player's weapon flashlights. Maybe someone is curious. π¦
addUserActionEventHandler ["headlights", "Activate",
{
TAG_holdsL = true;
// Without following EH, flashlight will be turned on while L is pressed
addMissionEventHandler ["EachFrame",
{
player action ["GunLightOff", player];
if !(TAG_holdsL) then
{ removeMissionEventHandler ["EachFrame", _thisEventHandler]; };
}];
}];
addUserActionEventHandler ["headlights", "Deactivate",
{
TAG_holdsL = false;
player action ["GunLightOff", player];
}];
I was playing around with it for while and this is what I've figured out. Laser would need "IRLaserOff" action instead. Maybe it would be more clean to check if player is pressing his light switch key, instead of using global variable?
Originally I used while loop in spawn without any suspension, instead of EH and it lowered my framerate from 140 fps to 110. π€£
Yeah scheduled will do that
im blocking actions like this:
0 spawn
{
waitUntil {!isNull findDisplay 46};
(findDisplay 46) displayAddEventHandler ["keyDown",
{
params ["_display", "_key", "_shift", "_ctrl", "_alt"];
private _blockedActions =
[
"headlights" // lots of other actions here
];
if (_blockedActions findIf {inputAction _x > 0} != -1) then
{
true;
};
}];
};
I use the following Fired event handler below to capture muzzle, ammo, and projectile names. Works fine with player weapons. But when I fire a grenade launcher from a gunner position on a PBR boat, this eventhandler does not fire. How do I capture this info when gunner in a vehicle?
player addEventhandler ["fired",{copyToClipboard format["%1",_this]; hint format["%1",_this];}];
I just answered my own question lol. This works:
vehicle player addEventhandler ["fired",{copyToClipboard format["%1",_this]; hint format["%1",_this];}];
alternatively, it might save you some time using the FiredMan event to log player and vehicle weapons together:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#FiredMan
This EH must be attached to a soldier and unlike with "Fired" EH, it will fire regardless of whether the soldier is on foot or firing vehicle weapon.
this addEventHandler ["FiredMan", { params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"]; }];
Sweet, thanks man!
How do I apply a certain camo scheme on a certain vehicle class name that gets spawned?
Also how to fetch all camo names that can be applied on a certain vehicle class name?
Are you talking about texture sources?
Yes, the ones that come with vanilla/modded vics
TextureSources class in the vehicle config. Somewhat related but there's also the textureList property which sets weighted randoms for what skin is picked.
TextureSources can also be limited to a specific faction with the camo's faction property
So tl;dr, grab stuff with configProperties and filter by faction if its not an empty string
if I remember right there isnt an eventhandler to detect when the zeroing of a vehicle mounted weapon is changed, what would be the best way to detect then? listen to when the inputAction for zeroingUp, zeroingDown, gunElevAuto are pressed?
okay cool thanks
Is there a similar command to setDriveOnPath but for units, something like walk on path?
They are not.
Only on mission/uiNamespace, where such variable already exists, they might be protected from being overwritten. But creating a new variable with such a name is not
i've gotten the texture i want to be applied on all I_APC_Wheeled_03_cannon_F that get spawned
texture from config viewer
textures[] = {"A3\Data_F_Tacops\data\APC_Wheeled_03_Ext_IG_03_CO.paa","A3\Data_F_Tacops\data\APC_Wheeled_03_Ext2_IG_03_CO.paa","A3\Data_F_Tacops\data\RCWS30_IG_03_CO.paa","A3\Data_F_Tacops\data\APC_Wheeled_03_Ext_alpha_IG_03_CO.paa","A3\Armor_F\Data\camonet_AAF_FIA_green_CO.paa","A3\armor_f\data\cage_G3_co.paa"};
what would be some reasons to ```sqf
addEventHandler ["FiredMan", {
};
i can't think of any
The reason to add an event handler to a unit, which activates when that unit fires, is usually so you can detect when that unit fires.
Maybe you want to work with stealth mechanics and alert (or de-alert) nearby enemies.
Maybe you want to delete the bullets.
Maybe you want to add event handlers to the bullets so they can have some scripted effect.
Maybe you want to make an infinite ammo system.
Maybe you want to track shots fired for statistics.
Maybe you want to attach something to the bullets.
Maybe you want to make nearby allies wait for your shot.
There's lots of reasons. People do a lot of things with scripting.
oh nice i see thats cool good ideas man
delete the bullets hay that would be good for training π
really nice @hallow mortar thx so much for your explantion m8
Events and Evemthandlers are the most awesome way to interact with a system. Really Glad arma has Them and we can even expand on Them.
yes sir i use addMissionEventHandler to my missions alot
Hi friends!
Does anyone have any good developer tools they commonly use or situationally tend to find super helpful they would like to share?
I very rarely ever do anything with particle effects due to not wanting to deal with the setting of all the parameters. It did get me thinking though, something like that probably is better created in a UI.
Alike- does anyone have any good tools for network monitoring? I feel like I recall Dedmen sending some maybe sending some in #perf_prof_branch or #dev_rc_branch somewhere at some point but couldn't find where.
Oh yeah! I think I remember Lou sending that at one point! Is everything on there "reputable" per se? I see stuff from Leopard20 which is a name I know and trust (π) but also see a lot of other really neat looking stuff but just kinda have a tin foil hat. Is everything sorta vetted before being added?
I once made a external particle editor that let you live-edit particle parameters while the effect was running in-game.
Someone made a ingame UI that lets you edit particle effects in Eden, its not linked on the wiki page. Its some workshop mod.
Don't know of any comprehensive tool for network monitoring.
There used to be ArmaServerMonitor (ASM) for Arma 2, but that wouldn't really do much, just graph the fps and playercount.
Nowadays you could build something bigger, that could graph per-player bandwidths, queue sizes, maybe message types.
I did prepare something in engine to get really deep access to networking code and statistics via an extension.
Live per-player info of number of messages/bytes in/out.
Per message-type number/bytes in/out.
Variables/remoteExec's by name
Basically what networkDiagInterval does, but all the info instead of only the top10 items.
But I never had the time to actually do something with it.
reputable yes. But maybe not up-to-date
Looking for script assistance for detecting a satchel charge being planted within a trigger zone.
_plantedBombs = nearestObjects (getPosATL bombTrigger) [_bombClass, _bombClass, 10];
_bombsInArea = [];
{
if (_x inArea bombTrigger) then {
_bombsInArea pushBack _x;
};
} forEach _plantedBombs;
if (count _bombsInArea > 0) then {
hint "Bomb planted successfully!";
bombTrigger setTriggerActivation ["NONE", "NONE", false];
};
};```
this is what I have but i'm not really sure this working, no errors thrown but not functional either. Can anyone help?
There is this for particle GUI https://steamcommunity.com/sharedfiles/filedetails/?id=1613905318 I've found it's not super stable though
Thats the one I meant
You need to check for the ammo from the magazine, not the magazine itself
projectileCreated mission EH might also be helpful for you
_plantedBombs = nearestObjects (getPosATL bombTrigger) [_bombClass, _bombClass, 10];
The syntax is nearestObjects [pos, [type], radius]
not nearestObjects pos [type, type, radius]
That's a syntax error.
_plantedBombs = nearestObjects [getPosATL bombTrigger, [_bombClass], 10];
Not sure if it can detect projectiles like that though.
@still forum If the particle tool you made is available to the public would love to try it out if you have it somewhere! Also same with the networking tools. I think even having the ability to see live player info, messages, variables, etc would be huge in being able to see what we could do better. If you were willing to send links to either of those- would love to give them a whirl π
Should be pretty easy to test though.
Plant a satchel.
Stand next to it, run in debug console
nearestObjects [getPosATL bombTrigger, [], 10] apply {typeOf _x} and see if your satchel class appears
okay, I'll give it a go here
Your forEach loop can be replaced by inAreaArray.
_bombClass = "DemoCharge_Remote_Mag"; // #TODO fix this name
_plantedBombs = nearestObjects [getPosATL bombTrigger, [_bombClass], 10]; // Find all bombs in roughly the trigger area.
_bombsInArea = _plantedBombs inAreaArray bombTrigger; // Filter to only bombs that are actually inside the real trigger area
if (_bombsInArea isNotEqualTo []) then {
hint "Bomb planted successfully!";
bombTrigger setTriggerActivation ["NONE", "NONE", false];
};
It was made closed source back for the Vietnam CDLC development. It is long since broken and I don't have time to fix it, and you wouldn't be able to fix it if I open sourced it (I'm not sure if I even still have the source)
Oh yeah I do have the source, last working for Arma 2.04 π
That networking tool also doesn't exist, its just something I wanted to build, I never did and likely won't
Might also be able to use "TimeBombCore" for nearestObjects too if you wanna extend it to other bomb class names as well :D
Ah okay no worries. That's totally understandable- does sound like a lot of work. If you do ever by some chance find the itch to go back to it and get a working demo running definitely ping me as I'd love something like that.
Thank you for all the responses 
is the satchel charge ammunition named SatchelCharge_F or is that only its world model?
SatchelCharge_Remote_Ammo for satchels, DemoCharge_Remote_Ammo for demo charge
This page shows the ammo of vanilla magazines: https://community.bistudio.com/wiki/Arma_3:_CfgMagazines or you can find the magazine in CfgMagazines in the Config Viewer and look for its ammo property
If you're using ACE, the ACE Arsenal also shows a magazine's ammo class in the top left panel when you select it
There is also ACE Arsenal mod. Adding just arsenal from ACE without anything else
Unfortunately I don't see the ammunition class with ACE in the arsenal just the magazine name when hovering over the magazine in question. But the biki was informative. No errors thrown but the hints don't show up as needed. probably an issue on my part since I'm just trying to do this with a trigger instead of an SQF
ACE has some kind of small box showing additionall info about weapons and magazines
Oh they don't show the details for explosives magazines because ????
Thanks ACE
Anyway, the wiki page is correct for vanilla and the config viewer will work for everything else
its okay, I need to try this script from an SQF π thank you for all your help
Hey guys, what would be the correct way to use an array, hideObject and forEach?
i've got private _array = ["1-42 varNames"];
and Id like to hide/Unhide the array.
https://community.bistudio.com/wiki/forEach
{
_x hideObject true;
} forEach _array;```
You gonna need getVariable, if you have var names in strings, rather than just var names
I appreciate the quick reply, but I'm getting a hideObject error. Type String, expected objects.
Then it's what Jouklik said, you've listed your variable names as "strings" rather than justTheVariableName. Use getVariable to retrieve the variable from a string of its name, or make them not strings
I will give that a shot. Thanks guys.
Keep in mind if this is about playable units (I assume its not because you wouldn't hide players) you need to be careful because the variables might not be set and just be nil, which can throw errors.
(I wanted to fix that, I can easily fix that but..... That would probably break scripts that use isNil to check if a player slot is empty β οΈ )
Sadly no.
@granite sky https://community.bistudio.com/wiki/BIS_fnc_scriptedMove hidden gem
technically ain't gonna follow an exact path but the unit will go through walls if it needs to and go in a straight line towards the destination
so you could technically keyframe path points and voila you got a path
Yeah you can do the animation thing, but what you can't do is just give an AI path directly to the engine.
Which is kinda silly because you can read the path with the PathCalculated EH.
true
Well, I moved come code around and the issue's been resolved
I made a new function, and call it from the flag's init in the sqm
Hello, quick question: how do I make it so that when the scenario starts, it shows me in the bottom right where I am and what time it is? And can one more year be added before 'Ostwind'?
Could someone please give me a hand real quick? Can I in any way replace the singular unit name in bold with an array of unit names? I want to define multiple.
if (vehicle player == player) exitWith {};
if (typeOf (vehicle player) != **"TBD_MTLB_VMK"**) exitWith {};
GVAR(ZERO_LINE) = GVAR(ZERO_LINE) + 0.03;
}, {
}, [DIK_PGUP, [false, false, false]], true] call CBA_fnc_addKeybind;```
openGPS true;
You can set date in editor under intel. Alternatively use setDate
if !(typeOf vehicle player in ["type1", "type2", "type3"]) exitWith {};
Is it possible to create a server only trigger from a .sqf that isn't initServer.sqf?
_trg = createTrigger ["EmptyDetector", objNull, true]; // don't need a location for it
_trg setTriggerStatements ["missionNamespace getvariable ["foxClub_var_XYZ", false]","missionNamespace setVariable ["foxClub_var_XYZ", true, true];",""];
Set third parameter to false and execute it only on the server
May need to do isServer check
Cheers mate, thanks a lot, I am too dumb for these things 
How do I execute it only on the server? Like this?
[
{
_trg = createTrigger [
"EmptyDetector",
objNull,
false
];
_trg setTriggerStatements [
"missionNamespace getVariable ['foxClub_var_XYZ', false]",
"missionNamespace setVariable ['foxClub_var_XYZ', true, true];",
""
];
}
] remoteExec ["call", 2];
Or maybe put it in it's own .sqf and remoteExec that instead?
InitServer.sqf
He wants to execute it from client by the look of it
Correct. I've only done editor triggers so this is my first time writing one.
Recommended approach is to create function and remote execute that function
Instead of sending code through network
It will only be done once. I often hear that functions are for multiple uses. So why a function instead of execVM?
Functions from function library get compiled on loading, avoiding potential performance loss from compiling during mission runtime. That being said this is short script and won't any harm
Awesome thanks for the help!
How does this look? It seems to work fine, but is there a way to verify it's only running on the server?
_trg = createTrigger [
"EmptyDetector", // type
objNull, // position
false // makes global
];
private _conditionPerfectMission = {
(missionNamespace getVariable ['foxClub_var_XYZ', false])
};
private _activationPerfectMission = {
["cheevo_perfectScore","SUCCEEDED"] call BIS_fnc_taskSetState;
hint "fired";
};
_trg setTriggerStatements [
toString _conditionPerfectMission,
toString _activationPerfectMission,
""
];
Called with:
["scripts\achievementTriggers.sqf"] remoteExec ["execVM", 2];
remoteExec ["execVM"...]
Why...
Or just hit the one of the default keys [ = shows GPS on left ] = shows GPS on right
cuz that's the way the wiki says to do it but i don't do it that way either
i do it the way you taught me @tulip ridge
[.......] remoteExec ["SFA_fnc_INS_ChopperFinish", 2];
```but of course this here is with a function
or who ever is was that taught me that i forget: it may have been Jouklik
Yeah the proper way is to just make a function and use CBA events or remoteExecCall it
well i dont use CBA so well you know
It will only be done once. I often hear that functions are for multiple uses. So why a function instead of execVM?
oh yeah then execVM is ok
I understand now that the function is more performant for long code since it's compiled at start.
yes sir
But is there any other reason that a function is the "proper" method? I'm not challenging the statement btw, just trying to learn.
yeah functions only compile 1 time like this
SFA_fnc_RTB_Chopper = compileFinal preprocessFileLineNumbers "INSEX_Chopper\RTB_Chopper.sqf";
``` so they never compile again: but the execVM compiles every time its run:
Now lets say I wanted to delete _trg which exists only on the server. I tried to do that from the ADT console but it says that _trg is undefined:
deleteVehicle _trg;
hmm that looks correct to me but i don't know much
this is how i do it @blissful current ```sqf
_r = createTrigger ["EmptyDetector",_pos];
_r setTriggerArea [300,300,0,true];
_r setTriggerActivation ["EAST","PRESENT",true];
_r setTriggerStatements ["this && {((getPosATL _x) select 2) < 70} count thislist > 0","",""];
_r setTriggerType "NONE";
_r;
while {true} do {
if(triggerActivated _r) then {
sleep 3;
_mkrname setMarkerColor "ColorRED";
deleteVehicle _r;
};
};
Well yeah, it's a variable local to the script
So it's not defined when you try to delete it from ADT
ahh yes i see now
So I just need to delete the underscore (which makes the var global IIRC)?
btw what is ADT
Advanced Developer Tools, it's a mod
oh shit ok lol: no wonder i didn't know
Yes, but what do you need it to be global for?
So that I can delete it. The code to delete it runs in initPlayerLocal.sqf. Meanwhile, _trg exists in initServer.sqf.
can you put a if statement in the trigger script
Well, I'm pretty sure it exists in initServer.sqf cause I remoteExec the code that creates the trigger to just the server.
so if someone joins the server then it can be deleted is that what you want
is this a dedacated server
or hosted server
I allow players to create and delete this server-only trigger. That's basically it. I've completed to code to create the trigger on the server. Now I just need to write the code to delete it. Sounds like all I need to do is make it a global var but I'm curious to see why Dart was asking why I need to do that.
cus if its hosted server then the host will never be able to delete the trigger
Why not?
cuz you have the delete trigger in the initPlayerLocal.sqf whitch is for JIP iirc
That doesn't seem like it should matter. In my experience so far anyway (could be and often are wrong)
well like i said i dont know much m8 just trying to help
No worries, neither do I π€£
so the initSever.sqf and the init.sqf is for all players that are in the lobby at start
Same for initPlayerLocal:
https://community.bistudio.com/wiki/Event_Scripts#init.sqf
i found that the initPlayerLocal.sqf is kinda only for JIP players at least thats what i was thinking
i guess it all depends on how you script it
It runs for mission host as well if you're playing LAN
what about playing on the net ?
It's not only because my code within it works fine for clients and local-host. I can say that at least.
ok i see
"Executed locally when player joins mission (includes both mission start and JIP). See Initialisation Order for details about when exactly the script is executed."
That's what the wiki says.
"(includes both mission start and JIP"
ok copy that
no wounder my missions work so good π
if you saw my initPlayerLocal: you may crap your pants it loaded π
well its only 52 lines π
but i get alot done in there π
why do we even have all them sqf if they all do the same thing π
i know i know lol π
i guess we could do everything in the init.sqf if we really wanted to right
its just the order of exec that would be the bees knees i guess in there π
and all the #includes and stuff
why are you making a trigger, yet also making a loop? put that stuff in the trigger activation statement, or just use the loop
well see i have many locations that the trigger making script gets exec at: i didn't show the whole script: but it w8's till the trigger get triggerActivated: so the loop delete's the trigger as per needed
then use a scriptedEventHandler instead, you'll then only have the trigger checking instead of multiple other things checking to see if that trigger is done
so if i show the whole script you can show me the best way ?
i never used scriptedEventHandler
so i would be lost
or could you give a sample
_r = createTrigger ["EmptyDetector",_pos];
_r setTriggerArea [300,300,0,true];
_r setTriggerActivation ["EAST","PRESENT",true];
_r setTriggerStatements [
toString {this && {((getPosATL _x) select 2) < 70} count thislist > 0},
toString {
[missionNamespace, "ScottyTriggerEvent", []] call BIS_fnc_callScriptedEventHandler
},
""
];
_r setTriggerType "NONE";
// Somewhere else
[missionNamespace, "ScottyTriggerEvent", {
// Do something
}] call BIS_fnc_addScriptedEventHandler;
// Somewhere even different
[missionNamespace, "ScottyTriggerEvent", {
// Do something different
}] call BIS_fnc_addScriptedEventHandler;
now when trigger pops, it executes all these codes in different places. Its like the Observer pattern.
oh i see yeah: i don't use any mods so that's killer what you showed me thx m8 @fair drum
holy shit man that's so cool: wow totaly Awsome m8 thx @fair drum
i love BIS version stuff
this is also how you allow people to interact with your mod without making a mod itself.
say I have a mod script that causes a player to be flashbanged:
// logic for flashbang
// ui changes for flashbang
// broadcast that the event happened
[missionNamespace, "TAG_playerFlashBanged", [_player, _amount]] call BIS_fnc_callScriptedEventHandler;
now if someone wants to say, make the player explode if they are flashed over 50%, they could add:
[missionNamespace, "TAG_playerFlashBanged", {
params ["_player", "_amount"];
if (_amount > 0.5) then {
// stuff here to make _player explode
};
}] call BIS_fnc_addScriptedEventHandler;
ahhh i see
this is why you have a event variable table on most big mods. Those events you can use to modify the experience of the mod, without making changes to the mod itself. like doing something when the arsenal is opened/closed, etc. You basically create your own custom event handlers.
oh nice really nice
Here's an example of what Hypoxic is saying:
["lambs_danger_OnArtilleryCalled", {
params["_caller", "_groupCaller", "_artilleryGun", "_targetPos"];
private _playersInArea = allPlayers select {_x distance2d _targetPos < 200};
["KPLIB_artilleryFiring", [gunner _artilleryGun, _targetPos], _playersInArea] call CBA_fnc_targetEvent;
}] call CBA_fnc_addEventHandler;
I'm adding a lambs event handler raised when a registered enemy artillery piece fires, so I use this EH to warn players in the target area
https://github.com/nk3nny/LambsDanger/wiki/Event-handlers
i see ok nice
my full script is 117 lines π
ok i have a Questions what Actually deletes the triggers or e'm i missing something: or e'm i not understanding this correctly:
Since there is no specific delete trigger command it's most likely:
deleteVehicle _trg;
Since triggers are objects, just like vehicles are
@thin fox ok cool or in my case ```sqf
deleteVehicle _r;
the problem im having is.
i have a package warehouse with shelves and a unit that constantly patrols around them, i need to prevent him from going through the shelves and i was wondering if its possible to keep the unit on a predefined path
BIS_fnc_scriptedMove, as linked by Kharos, is a potentially valid solution for that.
You could also try just iterating over your path array using move/doMove/etc and waitUntil. It's not as tidy as an engine solution but it is an option.
Oh yeah, typical Arma AI. Enables noclip cheat anytime it decides to. Goes through objects, possibly getting stuck in them. Gives zero *****.
Hey,
I'm looking for a way to use the βflicker effectβ from the memories in the βRemnants of Warβ campaign from the Laws of War DLC in my own mission.
I don't mean the transitions, but rather the flickering βballsβ that show where I can awaken a memory.
So also with this glowing effect.
Does anyone have any ideas?
Because I can't find anything about it on the internet.
Try to find it in campaign files
The glow is just a light source: https://community.bistudio.com/wiki/Light_Source_Tutorial
It is just about particle and light effect. Terms of particle it is same thing with the effect around fire (aka refract) and light is about #lightpoint
https://community.bistudio.com/wiki/Arma_3:_Particle_Effects
https://community.bistudio.com/wiki/Light_Source_Tutorial
is there a way to check for NaN's? i have a small case where a variable is scalar NaN, but it only returns that in hints, every time i do a check using that variable nothing works
if i do
if !(_variable == 0) then {hint "text"};
which is supposedly false because it's not 0 it's NaN, but that just doesn't work,
Functions could have some optimizations via bytecode. Which doesn't matter at all to your one-time use-case.
Function would use less network traffic with remoteExec, because generally the name will be shorter, than the full path you'd have to provide for execVM. Doesn't matter enough either.
Not variable equal to zero?
You mean variable not equal to zero?
Way to check for NaN is https://community.bistudio.com/wiki/finite
it doesn't return true or false, it returns the text bool for some reason
Oh
your variable is nil then
not NaN
also known as "undefined"
isNil "_variable" in that case
the quotes matter
But I recommend finding out where that comes from and fixing it there, instead of handling it everywhere else π
i see, ty
i'm playing with vectors
-# which i hate
and when it points to nothing, such as the sky it returns that, the quotations made it, ty
that's why i wanted a check for it, so in case that happened i can do something else
- being a function makes it visible in CfgFunctions and so inspectable in the Config Viewer, which is better for accessibility
- being a function makes it easier to
callif needed - it's easier to write the name
- if you change file paths, you can do all updating in one pass in CfgFunctions, rather than having to hunt down every existing reference in your script files
There are plenty of cases where it doesn't make a lot of substantial difference - one-time executions of single simple files with no performance sensitivity. But it's good to get into the habit of just using functions all the time. Small efficiencies add up. And if nothing else, it looks tidier.
In the case of remoteExec specifically, using execVM adds another layer of complexity in how you formulate the remoteExec parameters, and there's no reason to do that to yourself
Thank you, but how do I make it look like that ?
https://community.bistudio.com/wiki/BIS_fnc_typeText
https://community.bistudio.com/wiki/BIS_fnc_textTiles
Support structured text.
https://community.bistudio.com/wiki/Structured_Text
[
[
["2034-05-10 ", "align='center' shadow='1' size = '0.7'"],
["08:15", "align='center' shadow='1' size='0.7' font='PuristaBold'"],
["", "<br/>"], // line break
["KORE, WESTALTIS", "align='center' shadow='1' size = '0.7'"],
["", "<br/>"], // line break
["1 Jahr ", "align='center' shadow='1' size='0.7' font='PuristaBold'"],
["VOR STRATIS", "align='center' shadow='1' size = '0.7'"]
]
] spawn BIS_fnc_typeText2;
I'm sure there is some function that actually puts the time and players location there, but I can't find it
For the time
([daytime, "HH:MM"] call BIS_fnc_timeToString);```
Can I just put this easy into a trigger?
You can put it anywhere
Just do it in initPlayerLocal.sqf
Typo detected π€
is there any way i can disable the head bob via script for a sp mission?
No
if true then {
["Happy Thanksgiving everyone :)"] remoteExec [-2, "hint"];
};
private _menu = ["turkey", "ham", "mashed potatoes"];
skipTime -1000;
_menu deleteAt (_menu find "turkey");
playSoundUI ["gobble_gobble", 1e12, 1, false, 0, true];
If you're tired of bots being unable to find their way while patrolling, or if they've spawned near objects they can't exit, here's a minimal solution. (added for each unit created)
_unit addEventHandler ["PathCalculated", {
params ["_unit", "_path"];
if (count _path == 0 ) then {
if ({_unit distance _x <= 600} count allplayers == 0) then {
_pos=getposatl _unit findEmptyPosition [5, 100,typeof _unit];
_unit setposatl _pos;
};
};
}];
But in rocks can be problem... no know why but 'findEmptyPosition' select position in rocks...
Maybe there was 5 meters of clearance inside of rocks? π€£
findEmptyPosition is garbage :/
findSafePos is also garbage. Although I think it does protect you from rocks at least.
findSafePos is basically a nearObjects check plus a raycast from above.
I never quite figured what findEmptyPosition is doing but it's not good.
_distances=nearestTerrainObjects [player, ["ROCK"], 50,true] apply {[((boundingBox _x) select 2) / 2,_x getdir player ]};
player setposatl (player getpos (_distances#0))
``` )
If it only checks for objects positions and it doesn't care about actual object size, then it is indeed garbage π
Use boundingBoxReal instead to be more accurate, since boundingBox returns box you see in the editor. Like ones on your screenshots on some units.
The Ρomposition position is beautiful (dynamically selected through selectBestPlaces), but the bots can sometimes walk one meter back and forth, back and forth, even if there is no obstacle in front of them (ROOOOCK).
And you would probably want to move them some where outside of any no interior object, not just rocks
He in trap
AI in this game was always struggling in high objects density areas. Failing to move and just staying on spot forever.
What's funny is that bots cancel a waypoint when they can't reach it.
Sometimes they even ignore walls.
bruh
Bruh x2
I don't know what algorithm is used, but clearly if there is an opportunity to jump, they won't hesitate to do so.
any way to put a helipad on a carrier deck ? π€
Same way you would on terrain
it is invisible
Probably inside of it
I already tried to replace it vertically with alt + mouse drag but even its on the deck it stays invisible
Oh the vanilla ones are decals, the texture will always stick to the ground
any way to have helipad on the deck ?
I don't think there's vanilla models for the helipads that aren't like that
The helipad is still physically there though, the texture will just be on the sea floor
so it will work normally just it won't be visible ?
Won't be visible on the carrier, correct
I need it so we can return to base with a heli transport support
Yeah, you can getPosASL if you want to verify though
Carrier might also having helipads built into the model, no clue though
I will test it with the transpot module ...
it has to land somewhere I guess
@tulip ridge AI heli just hover high above the deck of the carries and won't land
without halipad
Use a PFH with an interval of 10 seconds, check if ceil random 10 == 10
So yeah it doesn't have any built in
Would've been cool if they did add some
lol with "invisible" helipad the heli transport is hovering and spinning above the deck wtf π
yeah iv been trying the same thing no luck yet
but i was trying to get heli to land on the front of a destroyer π
maybe set a marker in the midd of the helipad:
and make chopper land at marker
maybe move the marker up or down by alt key
Sometimes instead of SQF files scripts, i see people set up missionflow.fsm or something
What is that and how does people figure that shit out
an FSM is a "pathed script"
see https://community.bistudio.com/wiki/FSM
theres a FSM editor in A3 tools that is a visual node style respresentation of a FSM file
There was an issue with this but it was supposed to be fixed in the 2.20 hotfix in June π€ https://feedback.bistudio.com/T193098
sweet
i did get the chopper to land or hard land on the deck: but its not what i want π
How do I convert this sqf [[_microAirVehicle, "prop_end"],"rhs_fnc_sayGlobal"] call BIS_fnc_MP; to remoteExec as BIS_fnc_MP is deprecated?
I think this will work
[_microAirVehicle, "prop_end"] remoteExec ["rhs_fnc_sayGlobal", 0];
Hello Guys,
I'm encountering a problem with my mission's debriefing system and would appreciate some help.
The Problem:
I have defined multiple debriefing classes in my description.ext (e.g., End1, End2, End3) to cover different mission outcomes. My intention is for a specific ending to trigger based on in-game conditions (e.g., if OPFOR wins, show End2).
However, no matter what conditions I set in my triggers or which trigger fires, the mission always ends with the debriefing defined in class End1. Even when Red team (OPFOR) kills Blue team (BLUFOR), it still shows the "Blue team won" debriefing (which is currently End1 by default).
I am trying to achieve this using triggers. For example, a trigger activates when "OPFOR is absent" (meaning count (sideUnits opfor) == 0).
Here's my CfgDebriefing block from description.ext:
class CfgDebriefing
{
class End1
{
title = "USA Victory!!"; // (Currently defaults to this regardless of outcome)
subtitle = "Convoy passed!";
description = "Democratization of Vietnam is successful!";
pictureBackground = "";
picture = "";
pictureColor[] = {1,0,0,1};
};
class End2
{
title = "Vietcong Victory!";
subtitle = "Americans stopped!";
description = "For Uncle HO!";
pictureBackground = "";
picture = "b_inf";
pictureColor[] = {1,0,0,1};
};
class End3
{
title = "USA Victory!";
subtitle = "Vietcong eliminated!";
description = "For Uncle Sam!";
pictureBackground = "";
picture = "b_inf";
pictureColor[] = {1,0,0,1};
};
};
My Question:
What do I need to do to make sure that each specific ending (e.g., End2, End3) is correctly activated by its respective trigger, instead of always defaulting to class End1?
Thank you in advance for your help!
Yep that works π
If it doesn't see here:
https://community.bistudio.com/wiki/Arma_3:_CfgRemoteExec
When testing and going to refresh your changes are you going back to player selection lobby or are you going back to the screen where you select your mission? If you're going back to lobby it will not repack with your config changes if you're hosting a mission as the player. If I'm wording this correctly the PBO needs to repack in order for those changes to take affect
@low swallow from what i can see in you post
// not sure what your Condition is ?
//this would be a mission Win onActiveation
["end1"] remoteExec ["BIS_fnc_endMission"];
//------------------------------------------------
// Condition is
{side _x == West} count allUnits == 0;
//this would be mission failure onActiveation
//VC Ai win Here
["end2", false] remoteExec ["BIS_fnc_endMission"];
//-------------------------------------------------
// Condition is
{side _x == EAST} count allUnits == 0;
//this would be mission Win onActiveation
//US players win Here
["end3"] remoteExec ["BIS_fnc_endMission"];
//=========================================================
// not sure what your Condition is ?
//this would be mission failure
["end4", false] remoteExec ["BIS_fnc_endMission"];
// not sure what your Condition is ?
//this would be a mission failure
["end5", false] remoteExec ["BIS_fnc_endMission"];
you have 3 win Conditions you need to set all 3 like you see up there: but we really need to see the Trigger Conditions : You must have diff Conditions: in each trigger: to fire each diff trigger ```sqf
//you can't have the same thing in each Condition Of the triggers
// or it will default to the 1st Win Condition
or the count down: of each trigger is critical:
depending on your Respawn time:
!code
Please use !sqf from now on (!enforcescript soonβ’)
!sqf
```sqf
// your code here
hint "good!";
```
β turns into β
// your code here
hint "good!";
@pallid palm You can just type !sqf to show to to format sqf code
Any function(s) to add an offset easily on a position? Something like [initPos] move To(dir, dist) that returns the array with changed values. Just to know if I need to implement myself or if it already exists.
Hum... You have to compute the X and Y value outside