#arma3_scripting
1 messages ยท Page 37 of 1
hmm yeah i tried that in drawdoown 2035 ir didn't work. i renamed my character with zeus enhanced too
any ideas?
there was a command called something like "no select player" and it just, it worked but it would select a random stationery NPC, and was unpredictable and uncontrollable
selectPlayer
or selectPlayer, eventually
also selectPlayer.
none, that's the beauty of it
there is one command to switch player, and that's it
oooh you're joking ๐
Try not troll, Lou! 
yes POLPOX
you can point at a unit and use```sqf
selectPlayer cursorObject;
lol as long as he wasn't intending to be rude I don't care it was whitty ๐
omg thank you I'll try that
^ this will make you take control of the unit at which you point with your cursor (in normal mode, not Zeus)
what is that supposed to mean?
Move player into given unit. Some usage advices:
Try avoiding selectPlayer on editor-placed units in multiplayer, as it may, on occasion, lead to some undefined behaviour.
If you need to selectPlayer into another unit, consider creatingUnit dynamically.
does that say "just dont use it in MP at all"?
no it says to not use it on editor placed units
๐...
you're not saying I can't use it on Zeus spawned units right?
i'm not actually sure at which point its UB
i assume maybe if some other player joins and picks that playable unit one used selectPlayer on
very vague
working on a scenario, onPlayerRespawn.sqf is running on mission start instead of when a player respawns
is there any way to prevent this/why is this happening
respawn on start is disabled
(putting this here also, just in case)
https://community.bistudio.com/wiki/Event_Scripts#onPlayerRespawn.sqf
This event script will also fire at the beginning of a mission if respawnOnStart is 0 or 1, oldUnit will be objNull in this instance. This script will not fire at mission start if respawnOnStart equals -1.
THANK YOU!
godsend
just adjusted to respawnOnStart = -1; and onPlayerRespawn.sqf is still firing at mission start
In search of a script for animations on a protesting crowd I came across Grumpy's post on bi forums where he publishes his script [Link: https://forums.bohemia.net/forums/topic/215768-scripting-a-group-of-protesting-civilians/?page=2] And when I tried to use this script only as an animation without an attack, this started happening to me on the dedicated server (I removed the part about the attack from init and initserver..)
Dedicated Server:
https://streamable.com/ohh6p1
Eden editor test as MP:
https://streamable.com/9psh9q
Any idea how to fix the animations so they don't make such a mess?
2 hours ago, swift39 said: Thank You... I am away with work for a couple days so will switch it over when I get home. When you say it should work fine in SP is that a typo or do I need to script different for MP? Anyway thank you again everyone, I am enjoying the learning process and will post my...
Anyone know how to disable the keydown serach in listboxes/trees?
How do I check if a vehicle is alive or not?
I am trying to setup a mobile respawn that is dependent on whether or not the vehicle is destroyed or not
where is onPlayerKilled called?
is it only run local to the player or is it global
by the engine i think
and it's local
similar to killed eh
if(alive _vehicle) then {};
i'd not use it though, it runs scheduled and i suspect it's also recompiled on every exec
I assume "_vehicle" would be the variable name of the vehicle?
its only going to be used to remoteExec something on the server
just easier than dealing with the weirdness of attaching killed EH to a player and then it persisting or not
this script does work, however when I destroy the vehicle the else script I put afterward does not seem to work
if (alive _vehicle) then
{
while {true} do
{
"Respawn_east_1" setMarkerPos getPos Defender1;
sleep 2;
};
}
else
{
Hint "Respawn vehicle destroyed";
};```
Well, you have an infinite while loop there?
I have changed the while loop to also be while {alive _vehicle} do but that doesn't seem to stop the while loop
to be fair it is my first time trying to script in arma
It'll stop the loop, but then it still won't print the destruction message. You need to put the while on the outside.
Should work:
while {alive _vehicle} do {
"Respawn_east_1" setMarkerPos getPosATL Defender1;
sleep 2;
};
hint "Respawn vehicle destroyed";
Worked perfectly thank you!
I assume that if I wanted to delete the marker I would simply just add
deleteMarker "respawn_east_1"
after the hint ofcourse
Yes.
Worked out well, thanks very much!
EH is faster
huh?
prob setting the respawn on unit init and disabling it on kill
Nah, the slow part is the periodic update anyway. EH is just complicating things there.
Assuming that Defender1 is an object that moves.
Defender1 is indeed the name of the truck that will be acting as the mobile respawn
I was wondering if it was possible to use an if statement to check if multiple were destroyed and output either a systemChat or a hint message
id like to use a certain mod's mod.paa in a script
but since it's not in a specific pbo and it's just named mod.paa how would i reference it?
do i list the filepath as something like @[modname]/mod.paa?
sure, [_object1, _object2, _objectN, ...] findIf { alive _x } < 0
as your condition
the path would be the virtual path, if it doesn't have pboprefix (or is a folder), then it's simply the way pbo/folder is structured, else it's the corresponding pboprefix (pbo)
alrighty I'll check that out next time Im on arma ๐
the .paa sits outside of any addons folders, is it even possible to use it ingame in this scenario?
the script is running from another mod and there are other mods loaded which i presume all have their own mod.paa s
then you're out of luck i think
alright
but how come the mod itself is not in a pbo?
the mod is the mod.paa is not
by mod.paa i mean the little png that goes next to all the assets that a mod adds to denote what addon its from
most seem to be called just mod.paa
i would just copy the .paa to your mission folder and use it there
Not without permission...First.
How do CT_GROUPS work?
Not sure, but have you tried setting an onKeyDown or onKeyPress event that returns false?
I think you mean true, but yes i have. :/
Yeah
Is it basically a way to apply groups of settings to groups of controls?
Or does it also work like a container bit like how JFrames work in Java?
Kinda. You can move, hide and disable a group of controls together, and anything that falls outside the group will not be rendered (you can enable scrolling)
Dunno. Never worked with Java
It's kinda similar to a window in windows
Probably also similar to how a XAML file works too.
Container then manipulate the elements inside of the container.
Yeah kinda
SQF uses cpp as a template structure gotcha.
Would using an array be a good quick and dirty way of creating typing text?
Typing text?
And is there anything special I need to perform on a UI element to make it attach to the a position in 3D?
Go from UI coordinate space to world coordinate space
I don't want to use DrawIcon3D it's too limited
Similar to how BIS_fnc_textType2 works
I've never used that fnc. But anyway an array can be used to quickly build strings using joinString
Awesome.
BIS_fnc_typeText; is pretty useful unfortunately I want it centered.
Right at 0.5 0.5
You mean apart from moving it every frame?
Also keep in mind that UI ctrlCommit has a 1 frame delay so at low framerates your ctrl won't follow the "world" smoothly
So maybe just use DrawIcon3D then?
I mean it works but lacks the flexibility I wanted.
And if I need to stack text below it I can just do pos vectorAdd [0,0,z];
or vectorDiff
You can use ctrls but it has a few problems of its own:
- You have to control drawing manually (size, position, when not to render at all, etc.)
- You have to perform more calculations so it's slower
- The delay problem
Must be why Bennies CTI mainly used static targets.
Like town locations when drawing the Strategic HUD
That one
What I am doing is forwarding data from UAV drones to infantry based on how well the drone knows the data.
Any command that is good for that?
I've been using KnowsAbout too fairly good effort
or NearTargets
At least NearTargets doesn't update immediately and the drone takes time to map out the data.
Setting maxHistoryDelay to a really high number seems to keep it away decent enough
targetKnowledge
knowsAbout is not very useful for that
NearTargets works,
There is also targetsQuery
What is faster?
They don't do the same thing so their performance varies. It depends what you want to do.
Since you say you want to know how well it knows the target I'd say use targetsQuery
But it's slowish
Basically I am polling within limits targets in an "area"
Both friendly and enemy but applying drawIcon3D differences when the targets are different sides.
Type of targets I am looking for is statics, vehicles, infantry.
Dunno hard to say which works best. You gotta try them out yourself
hmm, action menu is hidden when player in steerable parachute?
any way around this? like maybe attaching addaction to the parachute itself?
there is no official support for it, so no
either make your own extension or use something like extDB3
afaik no way besides restarting the game
or using another name for you paa 
why isnt this working properly? marker with variable name military_11 exists and is set to colorOPFOR through the eden editor yet the unit still gets hidden
if !(getMarkerColor "military_11" isEqualTo "colorOPFOR") then {
hideObjectGlobal this;
}
isEqualTo is case-sensitive
try using == perhaps?
no change
try then copyToClipboard getMarkerColor "military_11";? this should copy the marker's color to your clipboard
if a (non-complicated) code does not work, check the values ๐
Where did you get "colorOPFOR" from?
what the hell
my bad lol, colorOPFOR came from 2 places, the bohemia color wiki and because when you hover over the color in the editor you get a popup saying colorOPFOR
hmm, this page has both: https://community.bistudio.com/wiki/Arma_3:_CfgMarkerColors
but yeah, string matching
If you compared the color array it might actually return true :P
If you don't want to guess which of those any given marker uses, you can account for both:
getMarkerColor "military_11" in ["ColorOPFOR","ColorEAST"]```
ah good idea, thank you. I guess thatll teach me to trust the editor popups
markers = [];
{
_marker = createMarker ["marker_" + str _x, getPos _x];
_marker setMarkerType "o_inf";
_marker setMarkerSize [1, 1];
_marker setMarkerAlpha .8;
_marker setMarkerColor "ColorOpfor";
_marker setMarkerPos getPos _x;
} forEach vics;
I have this script to, when given an array vics, creates a marker on each of them. Is there a way to make this continuously update. I've tried several ways but it never works.
Continuously update as in create and delete markers as vehicles are added and removed from vics or continuously update as in update the position of the marker to the current vehicle position?
Sorry, I should have been more specific. I mean, update the markers over a set interval for each element in the vics array.
So the array remains constant.
while {true} do {
sleep 1;
{
private _marker = ("marker_" + str _x);
_marker setMarkerPos (getPos _x);
} forEach vics;
};```
This will update the position of the existing markers once a second; place it after the existing code. It won't account for changes in the array or whether the vehicle is alive or not.
Replace `true` at the start with a bool variable if you want the ability to turn it off later.
I just had a thought. The code I've been testing up until now is in the init.sqf file. That wouldn't affect how the code runs, correct?
It works! I wonder what I was doing wrong lol, the code you provided was very similar to code I had already tried, hmm. Thanks!
It won't break it, however:
- You should use the local versions of the marker commands to avoid duplicate markers, since init.sqf runs on all machines
- Anything you place after the
whileloop I posted [in init.sqf] won't run until after the loop exits, unless you usespawnto turn it into a separate thread, so watch out for that.
I thought the local version of marker would only create it on the machine that it was executed on, no?
Yes, and init.sqf runs on all machines
This will be moved out of init.sqf! I was just using it for testing.
Probably should've mentioned that.
Also, just to make sure, to ensure JIP compatibility, I should add an if (isServer) {} around it, right?
That doesn't really have anything specific to do with JIP compatibility, it just makes sure the commands run only on the server. Sometimes that improves JIP handling (prevents global commands being run again later), sometimes it breaks it completely (local commands that need to run on clients won't work).
In this case you do want to only run on the server, since you're using global commands that will take effect on all clients; you can use an isServer check or you can move the code [or the calling of the code] to initServer.sqf
I checked the createMarker docs and it turns out you can't actually create duplicate markers, though you should still avoid using duplicate global commands.
yea. I'm going to add an ifServer because this will run after init. Thanks!
private txt5Layer = "txt5" call BIS_fnc_rscLayer;
I'm getting an error that this line doesn't have a semicolon for some reason...
You can't use private on global variables
oh, lol
Hey sorry, just a quick question, I'm trying to have a rocket spawn in and destroy a ground vehicle with lock on, like the Titan does, and this script usually works for anything flying, but doesn't appear to for ground vehicles.
Would anyone know why? Cheers ๐
_tgt1 = Tgt1;
_missile = createVehicle ["M_Titan_AT",[12702.8,6927.14,4],[],0,"CAN_COLLIDE"];
_azimuth = [12702.8,6927.14,4] getDir Tgt1;
_missile setDir _azimuth;
[_missile,_tgt1] spawn {
params ["_missile","_tgt1"];
sleep 0.1;
_missile setMissileTarget _tgt1;
};```
In what way doesn't it work?
I'd have been inclined to give the thing a bit of velocity.
It doesn't appear to lock onto the vehicle, in the wiki, it says that the return value is true if successful, but mine always returns false on setMissileTarget
Also if it's ACE the target might need a heat signature.
Is the target warm and in line of sight? The Titan is IR-guided
Right, that makes sense, it may be that.
I didn't think that would effect the script, but it makes sense
Works like a charm, can't believe it was that simple. Thanks! ๐
Now curious whether vanilla Titan needs heat. I thought it didn't.
If you don't mind me asking too, how would you recommend setting velocity for the missile?
It does, though it also has SACLOS guidance if no lock.
PCML doesn't, it has a visual sensor
setVectorDir with vectorFromTo + a bit of Z + vectorNormalized, then setVelocityModelSpace.
This is gonna be a first for me, but I'll give it a go haha
Vectors are pretty useful :P
hmm, I have this vague recollection that something was too slow for setVelocityModelSpace
Missiles are usually pretty good at providing their own velocity tbh. It might help with the Titan since its acceleration curve is slow as balls, but if it's coming from a ways away it shouldn't make much difference
It would be nice to know this so I can use it in future though, so if I can get it working now, would be really cool
So for my understanding, a vector doesn't follow the object by default if you use something like setDir, so just using something like this
if (!isServer)exitWith{};
_tgt1 = Tgt1;
_missile = createVehicle ["M_Titan_AT",[12702.8,6927.14,4],[],0,"CAN_COLLIDE"];
_azimuth = [12702.8,6927.14,2] getDir Tgt1;
_missile setDir _azimuth;
_missile setVelocityModelSpace [0, 10, 0];
[_missile,_tgt1] spawn {
params ["_missile","_tgt1"];
sleep 0.1;
_missile setMissileTarget _tgt1;
};```
Wouldn't give it forward velocity. I need to set the vector first with setVectorDir and vectorFromTo.
To be fair, I haven't tested this out, this is purely speculation from what I've read on the wiki haha
Actually got it right first try lets go.
Probably not a huge accomplishment for any of you, but I'm glad I managed to work that out ๐
Be a good feature if you could do that.
Diagnosis exe lets you to do that
Vector spaces are relative to certain "coordinate spaces" Model coordinate space has a different origin point to world.
You could easily find the vector orientation by using drawLine3D
I did something similar to normals on geometry surfaces.
E.g the map geometry normals.
By converting screenspace to world then adding a vector to the point draw at the beginning of the 3D line
That's what I was trying to get at, but you've explained it 10x better haha. Thanks for clarifying anyway ๐
All game programming is literally the same Model space is different to world coordinate space (Global Coordinate space). Another name for it is Local coordinate space.
That is what you'd call it in say blender 3d
Now that's a software I'm familiar with ๐
There is also camera / screen coordinate space as well 2D plane basically
Is it me or does arma 3 try really hard to encourage bad code?
considering it's written for the lowest common user/unexperienced/casuals, I don't think that's a fair assumption
It's easier to write bad code because good code often requires a deeper understanding of how Arma and SQF works. I wouldn't describe that as trying to encourage bad code, though - it's more of a symptom of the hacky, ancient, and convoluted nature of the engine and language. It's not on purpose, bad code is just the path of least resistance sometimes.
"write once, never touch again, if you need to change anything - rewrite the entire script" ๐
there is merit to writing something simply at first, especially in iterative game design
hacking something together in 3 hours, seeing if people like it... if not , then you've only wasted 3 hours ... if so, then yes, take more time to re-write it in a manner which takes into account more edge/corner cases etc
arguably, good code means good architecture. And good architecture either means that user needs to implement it (which takes way more effort than slapdashing a quick and dirty script) or a developer needs to implement it (which frequently leads to very restricting game logic)
anyone here done a "dynamic groups" system to manage player groups? is it better to create the group locally on the player, or create on server and manage all from server?
any reason to not use the vanilla dynamic groups? https://community.bistudio.com/wiki/BIS_fnc_dynamicGroups
i use it now but its not a great fit, and has some annoying bugs. also it doesn't fit with my roles system
I'm trying to rewrite the following code using RemoteExec so it runs on all clients:
if (isServer) then {
{
_marker = createMarker ["marker_" + str _x, getPos _x];
_marker setMarkerType "o_inf";
_marker setMarkerSize [1, 1];
_marker setMarkerAlpha .8;
_marker setMarkerColor "ColorOpfor";
_marker setMarkerPos getPos _x;
} forEach caches;
{
[_x, -1] call ace_cargo_fnc_setSize;
} forEach caches;
};
this is what I have:
if (isServer) then {
{
_marker = createMarker ["marker_" + str _x, getPos _x];
[_marker, "o_inf"] remoteExec ["setMarkerType"];
[_marker, [1,1]] remoteExec ["setMarkerSize"];
[_marker, .8] remoteExec ["setMarkerAlpha"];
[_marker, "ColorOpfor"] remoteExec ["setMarkerColor"];
[_marker, getPos _x] remoteExec ["setMarkerPos"];
} forEach caches;
{
[_x, -1] call ace_cargo_fnc_setSize;
} forEach caches;
};
is this correct, and/or how would I use remote exec with call in the 2nd part?
o_O
all of the used marker commands are Global Effect ones, so they don't need any remoteExec
including the ace_cargo_fnc_setSize, it also has global effect
that means "use createMarkerLocal, then setMarkerTypeLocal, then setMarkerSizeLocal, then... and in the end use one global command, say, setMarkerPos"
is there like a rule of thumb to determine what has to be synced to JIP and not?
so change all commands to local except the last?
yes
gotcha
https://community.bistudio.com/wiki/BIS_fnc_dynamicText
to make sure I'm doing this correctly. Since this has local scope, I would need to remote exec this?
["<t font ='EtelkaMonospaceProBold' align = 'center' size='1.8' color='#8fa1c9'>" + "Phase 1"+"</t>", 0, -.3, 5, 1, 0,_txt5Layer] spawn BIS_fnc_dynamicText;
https://cdn.discordapp.com/attachments/737175675818999898/1056468772271161425/image.png GE = "Global Effect" = engine takes care of making every client consistent. If you see LE ("Local Effect") and want the effect to be present everywhere - you remoteExec ๐คทโโ๏ธ
gotcha
I see
Hmmmm
There is this waning the forums...
So how would I execute this on all clients?
"<t font ='EtelkaMonospaceProBold' align = 'center' size='1.8' color='#8fa1c9'>" + "Phase 1"+"</t>" is not a Structured Text, it's a String ๐คทโโ๏ธ
One more question, sorry. If I remote exec an entire function, then the contents of that function doesn't have to be remote Exec if it normally would, because it is running on the target machines, correct?
"contents" as in "code"? You only need to remoteExec the function itself, but make sure the function is present on client machines as well.
"contents" as in "arguments"? Arguments get computed on the calling machine and remoteExec sends the already calculated values
"contents" as in "code". I'm just not sure whether or not I need to use remoteExec on the function.
||```sqf
timer = {
if (isServer) then {
[_this select 0] spawn
{
ELAPSED_TIME = 0;
_duration = (_this select 0) * 60;
START_TIME = diag_tickTime;
while {ELAPSED_TIME < _duration} do
{
ELAPSED_TIME = diag_tickTime - START_TIME;
publicVariable "ELAPSED_TIME";
sleep 1;
};
};
};
if !(isDedicated) then
{
[_this select 0, _this select 1] spawn
{
_duration = (_this select 0) * 60;
while {ELAPSED_TIME < _duration } do
{
_time = _duration - ELAPSED_TIME;
_finish_time_minutes = floor(_time / 60);
_finish_time_seconds = floor(_time) - (60 * _finish_time_minutes);
if(_finish_time_seconds < 10) then
{
_finish_time_seconds = format ["0%1", _finish_time_seconds];
};
if(_finish_time_minutes < 10) then
{
_finish_time_minutes = format ["0%1", _finish_time_minutes];
};
_formatted_time = format ["%1:%2", _finish_time_minutes, _finish_time_seconds];
private _h = format ["%2 %1", _formatted_time, _this select 1];
private _textc = "<t font ='EtelkaMonospaceProBold' align = 'center' size='.5' color='#Ffffff'>" + _h +"</t>";
private _txt4Layer = "txt4" call BIS_fnc_rscLayer;
[_textc, .95, -.25, 1, 0, 0, _txt4Layer] spawn BIS_fnc_dynamicText;
sleep 1;
};
};
};
};
sorry for the code deump
sqfbin.com is good for big code pieces
if you define the code yourself - it all depends on how and where it's defined. If you define it in, say, init.sqf (or some other script that gets executed everywhere, or in mission's CfgFunctions) - every client and server has the code. If you define it in, say, initServer.sqf (or inside if (isServer) then { block) - it is only defined wherever the code is run and you need to send the function over the network first (i.e. with publicVariable)
It's defined in a script that is called with execVM after server init. I'm guessing that, I can just call the function, and broadcast the result by remoteExec the BIS_fnc_dynamicText
So I wouldn't need to get rid of the isServer and isDedicated statements
Does anyone know what would cause this hint to show up while scripting? I'm not sure if it's something I did or the game.
Oh my god, i wish i knew this
everytime i open this channel i learn something new
I don't see a hint function in your code snippet. Where did you insert it, or is this an unprompted hint?
its unprompted
No clue honestly. Does it persist if you remove calling either BIS_fnc_rscLayer or dynamic text? That would tell you if it originates from something wrong you did for either. If it does persist then it occurs before then
hmmm
yo bros is there an EH for when player remote controls a unit?
cool
if player remote controls a soldier unit (thru zues not teamswitch) is it considered as new unit or uav in the EH?
@icy warren wrong channel ๐ see below
Are you looking to play with people?
pick one channel:
#looking_for_game to tell others you want to play
#looking_for_unit to tell others you are looking for a group
#communities_arma3 to browse through advertised groups
Note: Please follow the templates in those channels (if applicable), and don't use them for discussions.
IDK
damn
try and thou shalt see?
trying to get a few AI's to switch to random animation but right now they all choose the same animation from the array,
How would I get them to choose a different animation from the array?
_randomAnimation = selectRandom [
"Acts_A_M03_briefing",
"Acts_Abuse_Akhanteros",
"Acts_A_M01_briefing",
"Acts_Arrival_Response",
"Acts_BoatAttacked01",
"Acts_Dance_01",
"Acts_Explaining_EW_Idle03",
"Acts_Gallery_Visitor_01",
"Acts_Grieving"];
{_x switchMove _randomAnimation;}forEach (allUnits select {side _x isEqualTo resistance});
_randomAnimation is always going to be the same as you're only running it once
^
also (allUnits select {side _x isEqualTo resistance});, use units resistance
can someone give me an addaction line that i can add a UAV terminal (nato) to the players Terminal item? im somehow cant get it to work (0 scripting knowledge)
Are you talking about the UAV terminal that goes into the player's inventory?
yes
then create an addaction on each player for what you want.
classname should be easy to look up in the editor it will be added to an object to give the player the uav terminal if he doesnt have one just need to figure out the full line ๐คฃ thx
you mean running the same code for every unit?
Oh! Well in that case you wouldn't need to add it on the actual UAV item then lol. It can be wherever, it just matters what the logic is.
you call selectRandom once atm, and run the result on every unit, thus same animation is played on all units
{
_randomAnimation = selectRandom [
"Acts_A_M03_briefing",
"Acts_Abuse_Akhanteros",
"Acts_A_M01_briefing",
"Acts_Arrival_Response",
"Acts_BoatAttacked01",
"Acts_Dance_01",
"Acts_Explaining_EW_Idle03",
"Acts_Gallery_Visitor_01",
"Acts_Grieving"];
_x switchMove _randomAnimation;
} forEach (allUnits select side resistance);
no
no?
you slow down the code for no reason by doing that
what's the better solution then
array literals are expensive
well it doenst respawn after that so one can pick it up but not the others!
you can just spawn it in the palyer's inventory.? show the code you have so far
sofar nothing as the idea is just there and im currently doing another thing i get to it later
private _animList = [
"Acts_A_M03_briefing",
"Acts_Abuse_Akhanteros",
"Acts_A_M01_briefing",
"Acts_Arrival_Response",
"Acts_BoatAttacked01",
"Acts_Dance_01",
"Acts_Explaining_EW_Idle03",
"Acts_Gallery_Visitor_01",
"Acts_Grieving"];
{
private _randomAnimation = selectRandom _animList;
_x switchMove _randomAnimation;
} forEach (units resistance);
ah.
just needed a hint in the direction as additem was the wrong one
so you're good now?
I've been looking to optimize some old config code in the project I am working on, but this is the best I could do, can it be optimized further? Currently running this takes like ~25ms (with RHS loaded)
// Filter the scope only once
private _filteredWeaponConfigs = "
(getNumber (_x >> 'scope') == 2)
" configClasses (_cfgWeapons);
private _allWeapons = _filteredWeaponConfigs select {getText ( _x >> "simulation" ) == "weapon"};
private _allDetonators = _filteredWeaponConfigs select {getNumber ( _x >> "ace_explosives_Detonator" ) == 1};
private _allAttachments = _filteredWeaponConfigs select {_t = getNumber ( _x >> "ItemInfo" >> "type" ); _t == 301 || _t == 302 || _t == 101};
private _allUniforms = _filteredWeaponConfigs select {getNumber ( _x >> "ItemInfo" >> "type" ) == 801};
private _allHelmets = _filteredWeaponConfigs select {getNumber ( _x >> "ItemInfo" >> "type" ) == 605};
for now yes maybe i got a question later if it doenst work at all thanks again im off for now Christmas dinner part 2 is coming XD
you could loop once
Yeah, forEach with cases in commonality order is probably better.
The _allAttachments code would need to be rewritten for that though, I tried adapting it to a forEach loop but I had some difficulty rewriting that particular condition as if statements don't accept variable assignments in the condition
Something like this:
private _typeHM = createHashMapFromArray [
[101, _allAttachments],
[301, _allAttachments],
[302, _allAttachments],
[605, _allHelmets],
[801, _allUniforms]];
{
if (getText (_x >> "simulation") == "weapon") then { _allWeapons pushBack _x; continue };
private _t = getNumber (_x >> "ItemInfo" >> "type");
if (_t in _typeHM) then { (_typeHM get _t) pushBack _x; continue };
if (getNumber ( _x >> "ace_explosives_Detonator" ) == 1) then { _allDetonators pushBack _x; continue };
} forEach _filteredWeaponConfigs;
With this method, it is 2x faster but all the arrays from the hashmap are empty when checked
// Filter the scope only once
private _filteredWeaponConfigs = "
(getNumber (_x >> 'scope') == 2)
" configClasses (configFile >> "cfgWeapons");
private _allWeapons = [];
private _allDetonators = [];
private _allAttachments = [];
private _allUniforms = [];
private _allHelmets = [];
private _typeHM = createHashMapFromArray [
[101, _allAttachments],
[301, _allAttachments],
[302, _allAttachments],
[605, _allHelmets],
[801, _allUniforms]];
{
if (getText (_x >> "simulation") == "weapon") then { _allWeapons pushBack _x; continue };
private _t = getNumber (_x >> "ItemInfo" >> "type");
if (_t in _typeHM) then { (_typeHM get _t) pushBack _x; continue };
if (getNumber ( _x >> "ace_explosives_Detonator" ) == 1) then { _allDetonators pushBack _x; continue };
} forEach _filteredWeaponConfigs;
// Verify the sums
[count _allWeapons, count _allDetonators, count _allAttachments, count _allUniforms, count _allHelmets]
Appending doesn't work either 
_allAttachments append (_typeHM get 101);
_allAttachments append (_typeHM get 301);
_allAttachments append (_typeHM get 302);
_allUniforms append (_typeHM get 605);
_allHelmets append (_typeHM get 801);
ehh wut, that should work
just for the context: initial configClasses is half of the runtime already. Just {getNumber (_x >> "scope")} forEach _filteredWeaponConfigs would be half of the remainder (quarter of the initial runtime)
The arrays in the hashmap are stored by reference. Probably something else wrong.
hmm, what exactly has simulation == "weapon"?
...weapons? I am not really familiar with the configs actually being looped here, this is from a fork of Overthrow that I am contributing to, and the code is like 4 years old at this point. The config related code has always been messy and buggy
first helmet i've checked has that as well
removing continue in the simulation type check gives the sane counts in the end, but doubles the execution time
checking for getNumber (_x >> "type") in [1,2,4] for primaries/secondaries/handguns reduces the (long) runtime by roughly 25% ๐คทโโ๏ธ
giving (on my machine) 10 ms just for initial configClasses, 15 ms for that + {getNumber (_x >> "scope")} forEach..., 30-32 ms for configClasses + check config type + check for ace detonator + check ItemInfo type
economy of scale at work. With 2.5k+ classes in the array no matter what you do it'd be slow anyways ๐คฃ
inb4 "run it once during mission creation, cache the result into a separate array in .sqf file, include that with the mission"
Yeah, I know it's kind of dumb to start optimizing this because well, like you said, it's going to take a really long time regardless (at least when when talking computing times)
And yes, it only runs once and caches
so get whatever is more readable for your eyes and be done with it, i guess ๐
The initialization function where this runs takes like 20 seconds to execute though, and I think it's really absurd and no function should take that long to execute. So I am picking off some low hanging fruits in optimization to try to cut down on that time
20 seconds measured how? Something like logging the timestamps in the beginning and the end?
run in unscheduled and it will be faster
Just starting the mission and waiting for it to load, there aren't that many functions to execute during initialization so this one must be taking a bulk of the time. 20 seconds is a rough estimate
A directCall would certainly be faster, gonna have to try that out
well, there is a isNil {} hack
yea I know ๐
#define directCall isNil ๐
This is where you implement your own scheduler + isNil to grind config :P
~~Apparently this isn't even getting all uniforms, due to RHS for example using their own types. RHS uniforms are apparently of type = 131072 ~~ Edit: I am dumb (once again) and I wasn't looking at ItemInfo
need help with this? wasn't sure to replace first 'player' with _this and then second 'player' with _target? i tried these
if (player distance player < 5) then {
hintSilent "Hello there!";
};
if (_this distance obj1 < 5) then {
hintSilent "Hello there!";
};
if (_this distance player < 5) then {
hintSilent "Hello there!";
};
Need a bit of context here. Where is this code being run?
i've tried the init of a player but want to try initpLocal
just tried initplocal, nothing happened. preferably wanting it to with a hint for when a player get's certain distance of another friendly player
An if is a single check at the time the code is executed. If it's not true at the time of that check, it does nothing (or the else code if present) and then continues, it doesn't wait for the condition to become true. For that, you need a waitUntil, or a loop to repeatedly check.
it worked but only worked once.
[] spawn {
waitUntil {(player distance obj1 < 5)};
if (player distance obj1 < 5) then {
hint "Hello there!";
sleep 5;
hintSilent "";
};
};
UPDATE:
this works, just dont know if it's bad to do XD
_0 = [] spawn {
while { true } do {
waitUntil {(player distance obj1 < 5)};
if (player distance obj1 < 5) then {
hint "Hello there!";
sleep 5;
hintSilent "";
};
};
};
you could just write one loop. and the second check is redundant
[] spawn {
waitUntil {
if (player distance obj1 < 5) then {
hint "Hello there!";
sleep 5;
hintSilent "";
};
false;
};
};
works wonders! thank you! how would this work if it was a player's distance from another player?
" player distance _x < 5" ? i want to use it in initPLocal. i know there isn't an array so im lost XD
you mean all other players or just a particular one?
you could do something like:
[] spawn {
private _removehintTime = time + 5;
waitUntil {
{
if (player != _x && player distance _x < 5 && {
[side _x, side player] call BIS_fnc_sideIsFriendly
}) then {
hint "Hello there!";
_removehintTime = time + 5;
};
} forEach allPlayers;
if (time > _removehintTime) then {
hintSilent "";
};
false;
}
}
oh and I forgot to add one thing
@radiant siren fixed
(it would trigger when player was near himself which ofc is always true!)
ideally for better performance you should use "static" friendly sides instead of that BIS function, which is relatively slow
awesome! appreciate it as always! ๐ โค๏ธ
no problem. also this should work a bit faster
[] spawn {
private _removehintTime = time + 5;
private _fnc_getSides = {
[east, west, civilian, independent] select {
[_x, side player] call BIS_fnc_sideIsFriendly
}
};
private _lastSide = side player;
private _friendlySides = call _fnc_getSides;
waitUntil {
if (_lastSide != side player) then {
_lastSide = side player;
_friendlySides = call _fnc_getSides;
};
{
if (player != _x && player distance _x < 5 && {
side _x in _friendlySides
}) then {
hint "Hello there!";
_removehintTime = time + 5;
};
} forEach allPlayers;
if (time > _removehintTime) then {
hintSilent "";
};
false;
}
}
it might be better to use side group player instead of side player tho
e.g. when a unit is a captive he changes side to civ
so he becomes friendly with other sides (including enemy)
but side group player doesn't change
ill give it go. ๐ ill try all of those options! thank you again! ๐
guys, do you have some ideas to check if light (lamp, gun light, ... ) is pointed at object?
e.g. if object is lit by light ( can be partially )
Also, kind of a engine question but why is == often faster than isEqualTo in the evaluation field of configClasses? At least in my tests it is, even though it really shouldn't be
less letters? ๐คฃ
this is probably the closest you get to that: https://community.bistudio.com/wiki/cursorObject
You can use https://community.bistudio.com/wiki/getLightingAt if it doesn't matter which light is illuminating it
how much faster?
I mean for one things isEqualTo can compare between types
so internally it does have a type check
while == has overloads for different types
but at best it should only be <10-20% faster
(which is probably 0.0001-0.0002ms per check)
this addAction ["Give Nightvision googles","[_player linkItem "NVGoggles"]]
gives me missing ] what did i miss? (it is set on an object)
many things...
thought so ... :-I
your ] is outside the ""
and even if it was inside the syntax is wrong anyway
this addAction ["Give Nightvision googles", {player linkItem "NVGoggles"}]
hm ok i try that im not good at arma 3 scripting
and "not good" is a Hard Understatement!
Depending on what is being checked, but something along those lines yes, maybe even less. I'd use this information more as "I can use == for readability without having to worry about performance losses" than an optimization tip
now for the next magic trick how to remove a addaction added by the game to an item for pickup neverendingstory
OR make the item Respawn after it was taken by the player fml
this addAction ["Give Nightvision googles", {
_this#0 removeAction _this#2;
player linkItem "NVGoggles"
}];
@little raptor that didnt solve the problem as far as i could find out there is no solution to it! (Engine hard coded) if i place a Nvgoogle item on the map it will get the addaction to pick it up no matter what special states the item has suck to be honest but i couldnt find a workaround
adding the code in the init just gives it a second addaction!
I misunderstood your question
yeah my english is not the best
I thought you wanted that action to disappear
yes sort of BUT the action from the game/engine itself not the user addaction but after reading a bit around this is undoable
and i dont know how to respawn items
well for your question, iirc you can do what you want either by using enableSimulation on the container item or using lockInventory
and if that doesn't work you can just remove the actual item and add a prop instead
this addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
if (_item == "NVGoggles") then {
_container enableSimulation false
}
}];
try that first
it isnt a container but an item (nv googles) set to pretty much ONLY to show the item (disabled simulation etc. etc.) but it still has the Standard Pickup option
will do!
1 sec
in Arma items cannot exist on their own
they should always be placed in containers
when you put them on the ground they're placed into invisible virtual containers
and when you put them in your inventory they're placed in your backpack, vest, etc. containers
hm well ok but were do i get a prob then ? there is only the item in the EDEN editor @little raptor ?
this addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
if (_item == "NVGoggles") then {
_fakeItem = createSimpleObject [getText (configFile >> "CfgWeapons" >> _item >> "model"), getPosWorld _container];
deleteVehicle _container;
}
}];
this code is not fully done tho because it deletes the whole container (even if it isn't virtual)
but give it a try nonetheless
and by "prop" I meant simple object. the object has to be created dynamically, so 3den is useless here
welp did nothin uhm ok maybe the item name is wrong 1sec
how do you test it exactly?
running the mission
you should drop your own NVG and see if it shows the pickup action for it
it doesn't work with NVG items you've put on the map yourself
uff okay i give up just the addaction with a bright and bigger text let the player find it out
@little raptor But thanks for your help!
How would I convert setParticleParams to a global command? I've tried this code, but it showed up as invisible when I ran the script with it.
[_ps1, [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6],
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.45], [0.2, 0.2, 0.2, 0.45], [0.35, 0.35, 0.35, 0.225], [0.5, 0.5, 0.5, 0]],
[0.25], 1, 0, "", "", _ps1]] remoteExec ["setParticleParams", 0, true];
You should remoteExec entire particle commands
do you mean remote exec the creation as well?
also @warm hedge are there any examples of using remoteExec with particle commands online. I was looking for some reference for it but I couldn't find any.
Yes, a particleSource is a local object so
ah
Quick Question, Maybe someone knows how to do it.
Long story short, Goal is to Disable the Arty computer on specific vehicles (Static Artillery/Static Mortars) but leave it on for Vehicles that would have an artillery computer (Paladin, Himars, MLRS, ect).
Did some digging and found this----> enableEngineArtillery false;
However that just disables it for everything, and if i change the value to true it enables it for everything.
Any possible way to enable it just on specific vehicles?
When I was texting it originally, I had everything at local, and it worked. I changed everything except for the particle creation to use remoteExec, and now they won't show up at all. Shouldn't the changes still be made, if the particle is created on my machine, and then remoteExec executes the params on my machine?
is thing MP or SP
hmm, It's not possible to remove default actions, so your best bet might be to add an EH for Activate to see if the _activated object was one of the weapons you mentioned
Gotcha Thanks ๐
Yea. Since enableEngineArtillery is local you can set it for each player in MP,.
enableEngineArtillery is a local command. So you can use a typeOf to remove it from the ones you don't want it on probably
If player is in _whitelistedartillery then enableEngineArtillery true
Else enableEngineArtillery false
that doesn't make sense
We gave the same answer tho
Nvm sorry, I just meant the naming convention
@warm hedge When I create the particle with remoteExec I get an error In my other particle settings saying that it received a string instead of an object.
Here is the relevant code:
private _ps1 = ["#particlesource", _posATL] remoteExec ["createVehicleLocal", 0, true];
[_ps1, [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6],
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.45], [0.2, 0.2, 0.2, 0.45], [0.35, 0.35, 0.35, 0.225], [0.5, 0.5, 0.5, 0]],
[0.25], 1, 0, "", "", _ps1]] remoteExec ["setParticleParams", 0, true];
[_ps1, [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]] remoteExec ["setParticleRandom", 0, true];
[_ps1, .1] remoteExec ["setDropInterval", 0 ,true];
No I meant execute every codes regarded to particle in ONE remoteExec(Call)
ah. So I would make the creation into the function and then remoteExec that?
No need to make a fnc, you can just pass {} code into a remoteExecCall and ask it to execute a call command on everyone's end
thanks, ill try that now!
{
private _ps1 = "#particlesource" createVehicleLocal _posATL;
_ps1 setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6],
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.45], [0.2, 0.2, 0.2, 0.45], [0.35, 0.35, 0.35, 0.225], [0.5, 0.5, 0.5, 0]],
[0.25], 1, 0, "", "", _ps1];
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps1 setDropInterval 0.1;
} remoteExecCall ["call", 0, true];
I wrapped the function like you said, but am not getting any result now. @warm hedge
private _posATL = (_this select 0) modelToWorld [0,0,-1];
particle1 = {
_pos1 = _this select 0;
private _ps1 = "#particlesource" createVehicleLocal _pos1;
_ps1 setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6],
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.45], [0.2, 0.2, 0.2, 0.45], [0.35, 0.35, 0.35, 0.225], [0.5, 0.5, 0.5, 0]],
[0.25], 1, 0, "", "", _ps1];
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps1 setDropInterval 0.1;
};
[_posATL, particle1] remoteExecCall ["call", 0, true];
I have since modified it to this, but without getting it to work. The error is stating that _pos1 is an object, not an array, so _ps1 is not defined.
what is _this select 0 meant to be?
Kinda guessing here but I think _this in this case is your particle1 object, not whatever locality this is running inside... you need to define_this before particle1=
Maybe even have to pass it in, depending
Which _this?
Top of the code _this select 0
this whole thing is inside of an addAction, so _this select 0 refers to the object getting called.
for the line ```sqf
private _posATL = (_this select 0) modelToWorld [0,0,-1];
Include the addAction code
It's generally better not to use _this select 0 if you can help it.
instead unpack it with params
Here is the top to where I am, it's pretty big:
{
_x addAction ["<t font ='EtelkaMonospaceProBold' align = 'center' size='1' color='#c73c20'>" + "Destroy Cache"+"</t>", {
caches_destroyed pushBack _this;
publicVariable "caches_destroyed"; // Updates value
//(_this select 0) removeAction 1;
[(_this select 0), 1] remoteExec ["removeAction", 0, true];
//vehicle (_this select 0) lockInventory true;
[vehicle (_this select 0), true] remoteExec ["lockInventory", 0, true];
_txt5Layer = "txt5" call BIS_fnc_rscLayer;
_txt5aLayer = "txt5a" call BIS_fnc_rscLayer;
["<t font ='EtelkaMonospaceProBold' align = 'center' size='1.8' color='#c73c20'>" + "Cache Destroyed"+"</t>", 0, -.3, 5, 1, 0, _txt5Layer] remoteExec ["BIS_fnc_dynamicText", 0, true];
["<t font ='EtelkaMonospaceProBold' align = 'center' size='.8' color='#Ffffff'>" + str count caches_destroyed + "/" + str count caches + "</t>", 0, -.15, 5, 1, 0,_txt5aLayer] remoteExec ["BIS_fnc_dynamicText", 0, true];
private _posATL = (_this select 0) modelToWorld [0,0,-1];
particle1 = {
_pos1 = _this select 0;
private _ps1 = "#particlesource" createVehicleLocal _pos1;
_ps1 setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6],
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.45], [0.2, 0.2, 0.2, 0.45], [0.35, 0.35, 0.35, 0.225], [0.5, 0.5, 0.5, 0]],
[0.25], 1, 0, "", "", _ps1];
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps1 setDropInterval 0.1;
};
[_posATL, particle1] remoteExecCall ["call", 0, true];
Yeah definitely use params
params ["_target", "_caller", "_actionId", "_arguments"];

just stick that at the top of the code portion, correct?
Params internally does a bunch of checks in the background
_this and _target in this context are the same, right?
Not exactly, but for your case yes
[(_this select 0),(_this select 1),(_this select 2),(_this select 3)] params ["_target","_caller","_actionId","_arguments"];
Is essentially what happens behind the scenes
I'm still getting the error, hmm
{
_x addAction ["<t font ='EtelkaMonospaceProBold' align = 'center' size='1' color='#c73c20'>" + "Destroy Cache"+"</t>", {
params ["_target", "_caller", "_actionId", "_arguments"];
caches_destroyed pushBack _target;
publicVariable "caches_destroyed"; // Updates value
//(_this select 0) removeAction 1;
[_target, 1] remoteExec ["removeAction", 0, true];
//vehicle (_this select 0) lockInventory true;
[vehicle _target, true] remoteExec ["lockInventory", 0, true];
_txt5Layer = "txt5" call BIS_fnc_rscLayer;
_txt5aLayer = "txt5a" call BIS_fnc_rscLayer;
["<t font ='EtelkaMonospaceProBold' align = 'center' size='1.8' color='#c73c20'>" + "Cache Destroyed"+"</t>", 0, -.3, 5, 1, 0, _txt5Layer] remoteExec ["BIS_fnc_dynamicText", 0, true];
["<t font ='EtelkaMonospaceProBold' align = 'center' size='.8' color='#Ffffff'>" + str count caches_destroyed + "/" + str count caches + "</t>", 0, -.15, 5, 1, 0,_txt5aLayer] remoteExec ["BIS_fnc_dynamicText", 0, true];
private _posATL = _target modelToWorld [0,0,-1];
particle1 = {
_pos1 = _this select 0;
private _ps1 = "#particlesource" createVehicleLocal _pos1;
_ps1 setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6],
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.45], [0.2, 0.2, 0.2, 0.45], [0.35, 0.35, 0.35, 0.225], [0.5, 0.5, 0.5, 0]],
[0.25], 1, 0, "", "", _ps1];
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps1 setDropInterval 0.1;
};
[_posATL, particle1] remoteExecCall ["call", 0, true];
updated code to this point
systemChat format ["%1",_target];
``` See what comes back
?
It's a script debugging technique
oh ok
hint format ["%1"_somevar];
any
yes
It's not getting passed correctly for some reason
wait, this might be, but I'm going to restart the mission to make sure somethings not being fucky
so tiny bruh
Type Number Expected Array
Type number expected array
Says it all
it's getting a number when it should be getting an array
so Im probably selecting an element within the pos array
yep, just one set of brackets lol
I appreciate the help debugging
thanks for the tip
One more question:
Can I combine this code:
particle1 = {
_pos1 = _this select 0;
private _ps1 = "#particlesource" createVehicleLocal _pos1;
_ps1 setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6],
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.45], [0.2, 0.2, 0.2, 0.45], [0.35, 0.35, 0.35, 0.225], [0.5, 0.5, 0.5, 0]],
[0.25], 1, 0, "", "", _ps1];
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps1 setDropInterval 0.1;
};
[[_posATL], particle1] remoteExecCall ["call", 0, true];
to where I call remoteExecCall and have the params in the same line?
Yep you can use params to unpack function vars as well
Also
Avoid complex inline functions you can't debug them.
what does that mean?
oh

Does anyone here know how I can set a trigger to an IED that activates when a certain item is picked up?
But more complex an inline function the more difficult it is to debug.
How would I combine this btw, I tried the way I thought and got an error.
Grab EH
Give some context or an explanation please
particle1 = {
_pos1 = _this select 0;
private _ps1 = "#particlesource" createVehicleLocal _pos1;
_ps1 setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
1, 8, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [1, 3, 6],
[[0.2, 0.2, 0.2, 0], [0.2, 0.2, 0.2, 0.45], [0.2, 0.2, 0.2, 0.45], [0.35, 0.35, 0.35, 0.225], [0.5, 0.5, 0.5, 0]],
[0.25], 1, 0, "", "", _ps1];
_ps1 setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ps1 setDropInterval 0.1;
} [[_posATL], particle1] remoteExecCall ["call", 0, true];
Event handler that listens for Get
Not a valid combination of expressions?
[] spawn {
_container addEventHandler ["Take", {
params ["_unit", "_container", "_item"];
// Evil surprise delay by random amount between 1 and 30 seconds
sleep round((1 + (random 30)));
_IED setDamage 1;
}
}];
};
Then put in the code setDaamge on "Mine or IED whatever"
If you want to delay it just wrap it in a [] spawn {} call so you can use suspending / delaying
Alright where do I put this script now?
On the container?
Alright
If you put something on the ground ArmA 3 creates something called a groundweaponhold
Which is literally a container invisible though
When you "take" the EH registers a player took it from the "container"
Then runs the random sleep timer
Ah that makes sense
Going kaboom at a random interval between 1 and 30 seconds
interesting
Everyone loves the element of surprise I actually wrote something interesting a script that was designed to place IEDs in the most scary way possible terrorism style
I made the code look for bushes, rubbish piles, etc
And then shove the IED under the bushes.
Players hated it.
Probably one of my most hated scripts, I said but realism?
Don't you want realism?
๐ฆ
oh god you monster
I'm hosting a Vietnam OP with my friends and I know one of them likes AKs so I want to rig it ๐ญ
I just hope he picks it up and gets absolutely vaporized
Imma try this rq
With the random timer might scare the crap out of him.
Especially after he picks it up
Also
You could leverage a grenade pin pulling sound from the game
then using playSound3D
On the AK I know I am evil.
๐
โArma scripting sent me to the ERโ
Hey Chief, since you seem to know a fair bit about locality, I was wondering.
if (isServer) then {
[] spawn {
while {true} do {
sleep 1;
{
_marker = ("marker_" + str _x);
_marker setMarkerPos (getPos _x);
} forEach vehicle;
};
};
};
will this update the position for each vehicle (it is being called on the server)
Found it.
playSound3D ["a3\sounds_f\weapons\grenades\grenade_pullpin.wss", getPosATL _IEDThing, false getPosATL _IEDThing,1,1,0];
Yes it should setMarkerPos is global
Which means any operations will be broadcast across all clients
Yep! I thought so just wanted to make sure
It didn't exactly work
@warm swallow vehicles rather than vehicle there btw
It didn't work
It gave an error
Probably a scope issue.
When you do [] spawn {} the scope of variables change
same with [] call {}
Any local variable outside those commands become undefined unless explicitly passed
Well I have the IED variable set to "IED"
It has to be an object name
In the init field when you "place an object"
that is the objects name
"IED" means a string if you do this
_IED = "IED" // Not an object
Hey all, I'm trying to figure out how to reference FSMs registered in the functions library with execFSM?
So paste this in?
Did you use the FSM editor to make it?
No you need to give the AK a name
a variable name
Then use that.
@tough abyss Can I send you some code in private DMs? I'm trying to figure out if execVM is necessary on it.
No sorry I have math work to do.
no problem, thanks for your help
Yes I used the FSM editor to make it
Yes, I've read this and created the fsm but I'm trying to figure out how to reference it for the execFSM call when it's registered in the functions library like this:
class reinforce
{
file = "some\addons\path";
class reinforce { ext = ".fsm"; };
};
I'm not even sure that you can register them in the functions library.
All the FSM commands take a filename.
If you use the addons creator
It will unpack all the A3 .pbo data files
Inside there is a missions_f look at the FSM code in that
for one of the missions
https://community.bistudio.com/wiki/Arma_3:_Functions_Library if you go about two thirds of the way down you'll see you can register fsms there
but there's no example
Is there any particular reason you are using an FSM instead of a script?
I'm using it for the high level "brain" for helicopter based reinforcements on an area. Just using to to clean it up instead of having a mess of conditionals for that piece. Each state and condition just call a function dedicated to them so the code is all still well separated and the high level logic is extremely easy to understand and adjust
Huh. I just realised i could build a tool using powershell for looping through all my directories and building a cfgFunctions.hpp automatically...
powershell or python
Wonder if thats how the CBA_A3 guys did it. hmmm.
Yep looks like it is
this is the way
I wrote a simple tool in powershell for generating description.ext's but I think I know why the CBA_A3 team used python.
System Agnostic.
So I might go that route unless Ruby is better.
easy script either way if we're just talking cfgfunctions
Maybe a universal tool for generating multiple types of configs even GUI templates
I got deja vu and looked it up
we already talked about this lmao I used a batch script and you said use powershell
Yeah powershell is far far more flexible.
More expressive too.
And allows things like parallel work jobs etc.
As I said Python and Ruby are more OS Agnostic.
unless you're the type of maniac to install powershell on Mac and Linux
I use it there, for issuing remote powershell commands
Powershell is uniquely OOP based from the core.
.... Going off topic.
i concur
Hmm I just worked out how to get the gradient of a terrain element. Get the position using ScreenToWorld [0.5,0.5] convert that to a point add a vector to the tip after obtaining the normal.
Then take the vectorCross product. of the point
Giving the normal end.
Then the gradient perpendicular to the normalSurface. which you can then take the vector Diff of the cross product to reverse the vector arrow, giving you a tangent line to the surfaceNormal
And then you just find the gradient using the end points of the vector.
Is it possible to exclude vehicle from targets list or prevent target detection?
Hello! I was doing some bug testing with a friend for the script I wrote, and for some reason the text, that appeared on his screen was cut off from the top, while on my screen it appeared as normal. Here is the relevant code below:
["<t font ='EtelkaMonospaceProBold' align = 'center' size='1.8' color='#8fa1c9'>" + "Mission 1"+"</t>", 0, -.3, 5, 1, 0,_txt5Layer] remoteExec ["BIS_fnc_dynamicText", 0, true];
["<t font ='EtelkaMonospaceProBold' align = 'center' size='.8' color='#Ffffff'>" + "Sabotage the Boats"+"</t>", 0, -.15, 5, 1, 0,_txt5aLayer] remoteExec ["BIS_fnc_dynamicText", 0, true];
Does anyone have suggestions for how i could modify this script to only allow certain entity names use it?
so for example Player1 and Player2 could use it but Player3 and so on couldnt?
this addAction ["Teleport", {player setPos (getPos TP1)}];
any way to get the cloud height (distance from ground to cloudbase) for a terrain?
A million different ways. Here's one
Set in the units init:
this setUnitTrait ["tpaccess", true];
Then in the addaction create an if statement
If (player getUnitTrait "tpaccess" == true then
Setpos
in theory i'd be able to change "tpaccess" to whatever to allow for multiple teleporters that work exclusively?
Right
Tpaccessbase1
Tpaccessbase2
Thanks a bunch
A true is not equal to a "true"
"true" == "true" is true but true is a boolean value
Also an addAction is a local command, you can if ing to execute addAction
Or... yeah addAction's condition would work
Yeah agreed. If statement to add teleport addictions is obviously better, just a step more complicated. Not by much
If your teleport ability can be enabled or disabled mid mission, condition solution is the goto
Good point. Say a base is overrun and you want to disable that tp or something
the intent for this was just so that I can restrict arsenals to specific roles by having them spawn in a different location and teleport to/from the main base
i.e so a regular soldier isnt grabbing a sniper kit
Yeah this is exactly how my group does a custom ace arsenal script. If the unit has the trait sniper, they get sniper added to their arsenals. Some missions we restrict radios and do one for radioman etc
in my mission there is this script with intro and music at the beginning of the music, however it only works when the mission has respawn, because I want to do the same thing with the intro but only with a mission that does not have respawn (one life mission), is it possible and does anyone know what changes need to be made
this is the script, working with respawn
Move it from onPlayerRespawn.sqf to init.sqf
I don't know, do you want to play the music track "intro" at the start of the mission?
If you do, then leave that in there and just add the other script as well. If you don't, then remove it.
actually it is not necessary because the music is triggered by another script
Also I'm concerned about your file names. I'm worried that because you have file extensions turned off, your init.sqf may actually be "init.sqf.txt" or something like that. I really recommend turning on "show file extensions" in Explorer.
ooooooh yes.
Whats the best way to countdown a trigger from deactivating? I am running a scenario where the players will only get shot at while holding weapons. so ive set a trigger Condition: currentWeapon player != "" Activation: player setCaptive false Deactivation: player setCaptive true . i want to add like a 30 second timer so that if a player puts up his weapon mid combat he will still be shot at. any ideas?
scripts
@winter rose if the x or y position or BIS dynamic text is greater than 1, will it show clipped off of the screen. I have a script using it and on my screen it shows as normal near the top while for the other person is shows clipped at the top? Any ideas how this inconsistency could happen.
it depends on the safezone and the UI size setting value
Appreciate it!
BIS_fnc_dynamicText is rather outdated in how it was written now. It still uses things like _someParamCheck = if (cond) then {doSomething};
We can now check that with params instead.
Is there a better alternative to dynamic text now? I donโt need the text to be dynamic lol
What do you want it to do?
there is BIS_fnc_typeText1 and BIS_fnc_typeText2
If that is your goal.
It just matters about the text positioning
You can always ctrlCreate your own rscStructuredText element
old, but still valid (and ok performance-wise because it is a one-time call)
are there other issues with it though?
I'm having issues with running this script in a object init on a dedicated server as it works in singleplayer.
nul = [this] spawn { params ["_unit"]; sleep 1;
private _myArray = missionNamespace getVariable "TFI_Arsenals";
_myArray append [_unit];};
This perfectly appends the object in an array in singleplayer however it gives this error on the server.
where do you define TFI_Arsenals?
In initPlayerLocal
server doesn't run that init script (dedicated), thus it's undefined there
Why does the object not get append on the client?
actually you probably have a race condition
what's that sleep 1 for?
you just try to play waiting games with the init script?
best thing to do would be to ensure that it's defined in the initbox
I need it to wait for both the missionNamespace and the actual script using the array to run after the object was append
private _myArray = missionNamespace getVariable ["TFI_Arsenals", []];
_myArray pushBack this;
missionNamespace setVariable ["TFI_Arsenals", _myArray];
hi @ all. im searching for a solution for making my script start only if the loading screen in a MP session is finished. the sound is allready there, but still my loading screen, (takes about 10 secounds) and then the script is allready running. also, is there a good function to snycronize missions scripts till all players are loaded in and the mission loading screen is gone ? thx !
I have other objects that need to be append the same way so I would need it to be added instead of replacing.
this isn't replacing anything
My bad, I didn't it read it correctly and it did work thanks
How can i script a SA-20 using pook mod pack. Just trying to learn here
How does a change of locality affect event handlers?
Like, when I add a Killed EH to a vehicle and several different players hop in the driver seat?
Cause that should change the locality of the vehicle to the driver, right?
Does the EH have to be added on all clients then, or how does that work?
Right, thanks, I forgot that existed
tho you could also use a Local EH to handle locality changes
what would that look like?
In this case I think MPKilled is best, cause I really only need to know about it on the server
actually I don't think killed EH can be added to every client
it's arg local
you should do it via Local EH if you wanted to go that way
see the wiki's example. you just do if (_isLocal) then {_entity addEventHandler ...}
But that would necessitate code to check if locality changed, would it not?
Cause it's local here now, then someone else becomes driver, whoops, locality changed and the EH is useless
So instead of tracking locality, MPKilled is easier, is it not? Then I only need to check if I'm the sever and I'm done
The Local event handler fires when locality changes
oh! Right, I read that wrong, I thought it was the keyword local
But still, if I just want to make sure that the server learn of the vic being killed MPKilled is easier, or not?
Cause otherwise I would have to manage the EH on the client that loses locality, otherwise I run the risk of adding it twice if locality changes back to that client
just add it everywhere, it will only fire where locality is at that point ๐คฃ
Code path starts on the server, 0 benefit to doing that xD
well MPKilled (and other MP EHs) fire on every PC
even if you add it to one PC
Which is fine, cause it will ensure that the server also knows about it.
It looks like the name of the action includes a number, presumably the index of the throttle you want to adjust which can be 1, 2, or 3 (aircraft can, in theory, have multiple engines with separate throttles). So e.g. planeOne action ["ThrottleFull1",planeOne]; to adjust engine 1's throttle.
However, because this action isn't fully documented, and there are several similar actions related to things that aren't simulated in Arma 3, like the APU and engine starters, it's very possible that it's a Take On Helicopters action that isn't fully implemented in Arma 3. I would not count on it working.
how would i do FOB creation
placing down objects/vehicles isnt an issue, i can do this with a mod
but how would i make it so players can turn it into a spawn point
thats for eden
You have to configure respawn in Eden (or description.ext) in order to use it at all in the mission.
Once it's configured, you can use the script commands and functions (mostly functions) linked on that page to control it.
In EH, you cannot change the local var, there must be a global var that is used
Yeh,
Yes what Nikko said.
Learn how the configurations work then apply https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition
Anyone ever thought about making a script that somehow detects the hill markers on the map?
I've been wondering if that's even possible
_nearbyLocations = nearestLocations [position player, ["RockArea", "Hill"], 100];
etc
:0
thank you very much
You're an angel
๐
I've got a quite big list of information to gather before mixing and writing of scripts to accomplish my goals.
:) I decided to go back to arma 3 scripting and mission editing after a big while (2 years? I don't even know anymore XD)
Patroling around cities is a simple problem.
Getting enemies into buildings is a little bit harder but not very, I've written a drawIcon3D before to loop through all the buildings mount points.
Dynamic spawn script eh also not too difficult might be a good idea to leverage the dynamic simulation system to improve mission performance
bit of advice to go slow and dont give up, also beware feature creep, keep it simple until the core is working
So, I want to create a Huron box that spawns a vehicle, and then deletes the box, but I want to avoid calling on the object variable, so that I can place down a large number of these without changing the variables throughout the script for every single one
But when I call on this within the addAction script, it doesn't understand
suggestions?
Always post what exactly you've done, sir
Sorry
call{
this addAction["Warthog FAV",
{
_position1 = getPosATL creator_1;
_rotate = getDir creator_1;
_hog1 = createVehicle ["OPTRE_M12_FAV", _position1, [], 0, "CAN_COLLIDE"];
_hog1 setDir _rotate;
deleteVehicle creator_1
}
];
};
This works
creator_1 is the variable name of the Huron Container
But I need to not have a variable name that needs changing
Because I want to copy/paste like, 30 of these
into a mission
Loop through the object containers "huon containers"
https://community.bistudio.com/wiki/addAction
In the code field of the addAction, you can place this:
params ["_target", "_caller", "_actionId", "_arguments"];```
This will allow you to reference `_target` instead of a fixed variable name
then decide which side you want to spawn them on
On god, thank you so much
Might be a good idea to make the box non-colliding.
Spawn a Warthog on the box without disabling collision bad things will happen.
You should add a contingency check to see if the box is intersecting with the vehicle
I don't know what that means, please elaborate?
Just change the order of the lines so the box is deleted before the vehicle is spawned. You've already saved its position so you don't need it any more, and it's a simple way to avoid any problems.
Thanks, I went and did that after thinking about it
ok so i have one respawn down, and the respawns are all configured
how do i make it so players can place down a respawn
to make a fob
I have only one respawn "respawn_west". I have linked the spawn point to a vehicle we can move around. Give the vehicle a variable name like respawn_vehicle and then past this in the init.
if (isServer) then {
[respawn_vehicle, "respawn_west"] spawn {
params ["_veh", "_mk"];
while {sleep 10; true} do {
_mk setMarkerPos (getPos _veh);
};
};
};
yeah, i dont want the respawn to be a vehicle
i want it so its like the fob creation in KP liberation
problem with a vehicle respawn is they would spawn in the vehicle
and if it gets exploded it ruins it
i want it so the FOB will always stay as a respawn
Wrong, my way you spawn outside and you can set the vehicle to be invulnerable
i see, could you make the vehicle something tiny or invisible
like the zeus mechanic
blufor respawn
is it possible to make it so players can place one of these
well only certian people
but yeah
I've only done it with a vehicle but I suppose you could do the same with something like a road cone
could i make it like the blufor respawn object
or somebody in zeus could do it
however
if it was done in zeus how do i make it carry into restarts
i have alive which is for the asymetric mission and its all persistent
but as far as im aware it only saves markers and objects placed by players, not a respawn placed by zeus
That's why I have it linked to a vehicle. If you move things with zues it won't save the new position. With a vehicle you can move it with zues, get in and out and it will save the new position
no no, if i place a respawn normally in zeus will alive save it
when it restarts
Have not tested that.
Tested it quickly. Alive did NOT save the zues placed respawn
yup that's why I made that txt. So I can follow the guidelines when the execution phase begins
what's a "memPoints texture"?
Guessing here, but it's probably doable.
Tie respawn function to a specific item being spawned... Event handler init can do it
When alive spawns it, it should add it.
how would i do this?
no no, alive saves stuff
along with other thins, but the persistence feature saves things placed by players when the server restarts
like if use the R3F Logistics mod (alive compat version) and place down objects with that, if you have alive and persistence enabled it all saves when the server restarts
Yes I'm aware how r3f works. I'm taking about tying the respawn point adding to one of those objects. So if it's created, it's also a spawn
i was actually thinking the same thing earlier
i was hoping i could get it to work with the zeus respawn though
since it may be bugged if its an object
the easiest option might be to make it a tent actually
one of those dome tents from combat patrol and then just make it a respawn
or something else like that
how would i make this spawnable in the r3f factory though?
yes iirc
actually no I was thinking of PIP 
if I recall correctly
like I said I confused it with PiP
like mirrors
not sure about MFD
so how do i do it?
Well again there's a few ways.
You could make a script that searches for all items of a classname and then applies the spawn at that position. This could run every 1to5 minutes or so. That's probably the easiest way
i have no idea how to do advanced scripting, i equally dont know how to add objects to the r3f factory
Sanity check needed about trigger locality and deleting editor placed triggers:
So afaik an editor-placed trigger is a "global" in the sense that each machine (server/client) maintains a local copy of it which can be changed at will with setTriggerActivation etc without out affecting the copies of the trigger on other machines.
And deleteVehicle is an AG EG command, so what happens when a client calls deleteVehicle on their local copy of the trigger? Is the trigger deleted for all or only for the client executing the deleteVehicle?
So afaik an editor-placed trigger is a "global"
you can have it server-only
but to answer your question, I believe the trigger is created locally on all clients+server, therefore a deleteVehicle deletes only the local one, it is not a replication, it is a duplication
thx lou, remoteExec it is
Missing some nuanced thing here, trying to get a custom sound file to play. Script looks like this:
speaker_1 say3d ["gametime", 50];
Desc.ext looks like this
{
tracks[]={};
class track01
{
name = "gametime"; // Name for mission editor
sound[] = {"\gametime.wav", 1, 1.0};
titles[] = {0, ""};
};
};```
Getting a sound not found error. Sound file is in the mission folder
Where's your sound placed in relation to your mission.sqm?
couple of things to try, first double check your spelling (assume you've done that), try removing the first , confirm that wav is supported (tbh i've been using ogg and wss so long i dont remember which are supported...)
yeah, tripple checked spelling, and I used wav like a week ago
first *backslash
when changing mission config remember to go to editor and save. that usually updates it
before previewing again*
Aight running again, one sec
Negative
I think I'm just gonna change over to playsound3d
It'll let me define the damned file path
I can confirm this is the case. I even had you change the wiki for this server-only flag hehe
I have a question on something that's been bothering me for a while. Let's say I'm making a local variable
_myvar = 1
Why do people define it instead by
private _myvar=1 ?
Wouldn't it already be local to whatever you're working in?
If you don't private it, it exists in every scope of the script. If you do, it only exists in the innermost (and its children) scopes. It is nice to have if you want to include a call in the script so it won't confuse variables
So if I don't private it and do
Call someotherscript.sqf
That script can access _myvar without passing arguments?
I... do think that is false, variables in outer scope can be accessed whatsoever, it is rather the way not to bring inner var into outer
Let's assume I'm executing this code on some object, a vehicle. What is an example of an outer scope?
That script can access _myvar without passing arguments?
it will be accessible either way in that case
are ya happy now
_var = 4; // introduces a new _var
call {
_var = 123; // assigns to _var of parent scope
private _var = 2; // introduces a new _var, "private" to this scope (doesn't do a lookup to see if it was defined previously)
_var = 3; // assigns to _var of this scope
};
hint str _var; // result is 123
That makes sense, thanks.
_var = 4; // introduces a new _var
this is assuming that we're in the top level scope, if for example this script was called from some upper scope that had_vardefined, it would instead assign to it
always private your variables, this way you ensure you don't fall into some debugging headaches ๐
Will do
and have a giggle by yourself when you write private _parts;
[0, "BLACK", 5, 1] spawn BIS_fnc_fadeEffect; isn't fading to black, vision is just getting blurry...what'd i get wrong
is setOvercast a humidity variable?
Hi, I want to add a Hold Action at a certain position. Is there some invisible dummy object I can use to register the action on to simulate this?
BIS_fnc_holdAction is the function name
Yes, I"m wondering what dummy object I can use.
What sort of thing is it meant to do?
In this mission there is a gigantic alien turret (OPTRE Tyrant) big enough to walk inside. I want the player to approach "the core" inside it and execute a hold action.
You can use any object.
Then disableSimulation to freeze it.
then hideObject true
Then you should still be able to interact with it via holdAction
Yeah test it.
What is the standard way to do a display when opens on a key press and closes when the key is released? the issue arises when the display is opened "key down", the key events stop functioning so the "key up" is not detected.
i have tried adding the "key up" in new display but result is not great
Just tested it, hideObject breaks the hold action. I assume it's because the object cannot be the player's cursorTarget if hidden.
Hmmmm.
That's why I'm wondering if there is a good dummy object that can be used without being hidden. Like something that is big enough to be a cursorTarget, but transparent or invisible.
Wonder if createSimpleObject allows init fields
I added the hold action to the grass cutter, but I think it doesn't work since it can't be the player's cursorTarget.
Don't use cursorTarget to trigger
it use the params _caller
_caller is the object the holdAction is attached to
I'm not using cursorTarget directly... I assumed that's what BIS_fnc_holdAction uses internally.
I have the source code for it I'll have a look
I'm just doing a basic BIS_fnc_holdAction with "true" as the show condition.
Nope no CursorTarget
my_objective_hold = {
params ["_target"];
[
_target, "Set Tactical Nuke", "", "", "true", "true",
{}, {}, {systemChat "Hold Action triggered"}, {}
] call BIS_fnc_holdActionAdd;
hideObject _target;
};
Ok, well regardless of cursorTarget it doesn't work with a grass cutter, but does work with "visible" objects like a balloon or basketball. It also doesn't work if the target object is hidden.
6: CODE - code executed on start; arguments passed into it are [target, caller, ID, arguments]
0: OBJECT - target (_this select 0) - the object which the action is assigned to
1: OBJECT - caller (_this select 1) - the unit that activated the action
2: NUMBER - ID (_this select 2) - ID of the activated action (same as ID returned by addAction)
3: ARRAY - arguments (_this select 3) - arguments given to the script if you are using the extended syntax
_this select 1 is what you want.
That is the "caller" or the object performing the action.
cursorTarget is a horrible way to addActions without adding some checks.
Use in the condition section how close the player has to be to the object
Sorry if I wasn't clear. I'm not using cursorTarget, and I know how to use BIS_fnc_holdAction, I use it all the time. The issue is that I need to use it on an object that is not visible to the player.
(_this select 1) distance2D (_this select 0) <= 60;
You should still be able to get the object.
Give it a variable name then hide it
See if the object exists.
Yes, I hid the object. Problem is, once the object is hidden, the player cannot look at it and get the UI to start the hold action. I edited my above code snippet for clarity.
There is an Invisible Wall object that you can use as a dummy for actions. It does have collision, but it's not too big so it's reasonably easy to disguise.
Perfect. The invisible wall works. Thank you.
is there a knowsAbout that target a side?
I need to know if a specific group sees a side
In theory one cannot see a side. If you mean if one sees an unit from a certain side, you can probably iterate units
Yeah, any unit from a certain side
The idea is group X from opfor will fire flares if they see any indfor
Then units Independent findIf {OPFOR knowsAbout _x > 1} != -1 is a good way to do I think. Not tested, I'm on the phone
that could work, but what about I just loop this in a pfh:
combatBehaviour scout_group == "COMBAT"
the group would start on SAFE
if they switched to combat, I can assume they saw some shit
reposting a question that got buried ๐
What is the standard way to do a display when opens on a key press and closes when the key is released? the issue arises when the display is opened "key down", the key events stop functioning so the "key up" is not detected.
i have tried adding the "key up" in new display but result is not great
You can use a EH to detect change behavior
Is there any command to get compatible ammo for a underbarrel grenade launcher (without knowing the muzzle name beforehand)? For main muzzle I can use CBA_fnc_compatibleMagazines or vanilla equivalents, but I'm unsure of how to apply this to UGL muzzles since the UGL muzzle config name changes depending on the mod author's naming conventions.
without knowing the muzzle name beforehand
Why? You can just fetch it from config
Hmm this seems nice
you probably have to poll inputAction or something, but it's tricky to find the equivalent key mapping. i'm pretty positive that there is a better way though ๐ค
Not particularly a major question. But does someone have the helmet randomizer script handy? Im at work rn and i wanted to look at it on my down time and i dont have access to my main pc
I'm not sure there is a "the" helmet randomiser script. There are essentially two basic ways to do it and neither requires more than a couple of lines of code.
You can use https://community.bistudio.com/wiki/BIS_fnc_unitHeadgear to randomise headgear and facewear, or you can just make an array of helmet classes, use selectRandom to pick one, and use addHeadgear to apply it.
Is there an addon\mod that lets you edit terrain live and then export your changes as setTerrainHeight array(s)?
Didn't @split coral did that?
Yeah. No proper exporting function in the mod yet though. But the changed heightmap can be copied fairly easily from 3den
found an ammo type id like to use for artillery but cant find a way to use it (compatible magazine)
"M_Mo_230mm_AT_LG"
and "R_230mm_LG"
"12Rnd_230mm_rockets" only seems to fire unguided "R_230mm_HE"
have you tried: vehicle magazinesTurret [turretPath, includeEmpty]
or compatibleMagazines [weapon, muzzle] ?
yep, all i have is the cfgammo i want .. cant find the cfgweapon or cfgmagazine for it tho
looking for laser guided MLRS
Great tool, thanks, gonna try to figure how to turn your array into plain setTerrainHeight array
I'm away from my Arma at the moment, so I won't try to remember the specifics, but the heightmap in the mod is handled in two formats. The other is a simple hashmap with 2D positions as keys and altered/original Z as values. The other format is a bit more complex array with a rudimentary compression and is stored as a scenario attribute. The hashmap will be easier to convert to usable array.
did you loop through config?
Could you please tell me how I could pull it from config? I've looked through some cfgWeapons for various mods and many UGLs are named differently ("EGLM","UGL", "gp34", etc) and most of the examples I've seen online assume that you know the muzzle config name beforehand. I've done some stuff with fetching names from config before but I'm not versed enough in it to figure this out unfortunately.
Example from CBA (how can I find the proper _glMuzzle for any given _rifle?):
_mags = [configFile >> "CfgWeapons" >> _rifle >> _glMuzzle] call CBA_fnc_compatibleMagazines
configFile >> "CfgWeapons" >> _rifle >> "muzzles" defines what it is as an array, if it has multiple muzzles it should return like ["this","EGLM"]
@queen cargo read-only, write access only to #105792225270616064
still dont rly got why ... anyway
cause i can always ban them later ;)
i guess you were not in skype @a2EOL chat @queen cargo
wonders why someone ask why well known Cheater is marked as Cheater in @cheaters rights group
nope @fallen locust
it was... interesting
anyway, i don't think this belongs to scripting chat ... (i need mass fast select message prune) please continue in #offtopic_arma or #arma3_questions
well dwarden :P because he is not well known to me ^^
is there a way to make arma accept comments in editor-init fields?
if not, i would like to talk to a manager
whats a proper way to check in sqf if ACE is present?
apart from sth along isNil "ace_function"
hit EH doesn't fire when hit by FFV from unit inside of vehicle but does when same unit is outside -- anyone else having a similar issue?
see the notes here: https://community.bistudio.com/wiki/comment
probably a classic cfgPatches check for whatever ace main is called
if (isClass(configFile >> "CfgPatches" >> "ace_main")) then { /* ace is loaded*/ };
Thanks, I'll go play around with that
"ace_main"
thx, editted
nvm, hit eh doesnt work from ffv if AI is on careless for some reason
tickit? ๐๏ธ
need to test unmodded first but definitely makes sense as careless behaviour causes tons of issues
I thought this was general misclick, no idea who he was and thought it may have been a joke
My bad <3
cant find any steps to reproduce even with modded, seems super inconsistent but its definitely happening 
"Hit" does not always trigger, too
seems to be much more common when used with ffv
however i was testing with a blackhawk so rotary cannons probably trigger it enough lol
adding keyup to the new display seems to work fine, can you give an example on why the "result is not great"?
is there a function to get the first x elements of an array as a new array?
_myArray[0:10] ?
select
aah thanks
if it was joke, i served him as deterrent example ;)
Hello!
Need an advice..
I got this script, basically meant to loop an animation and to break the loop (and the animation) if shots are fired near the AI.
It works BUT the AI will keep doing his animation till the while loop ends and only then he'll stop it.
How do I make him stop the animation instantly once the shots are fired?
keepup = true;
0 = dude4 spawn {
waitUntil {time > 0};
dude4 playMove "AmovPercMstpSnonWnonDnon_exercisePushup";
while {keepup} do {
waitUntil {animationState dude4 != "AmovPercMstpSnonWnonDnon_exercisePushup"};
[dude4,"AmovPercMstpSnonWnonDnon_exercisePushup"] remoteExec ["playMove",0,True];}
};
this addEventHandler ["FiredNear", { keepup=false; dude4 switchMove ""; dude4 removeEventHandler ["FiredNear", _thisEventHandler]}];
instead of ```sqf
0 = dude4 spawn {...}
you can do
```sqf
tag_scriptHandle = dude4 spawn {...}
and then ```sqf
terminate tag_scriptHandle;
Oh so if I have an active script going with a while loop or waituntil going you can end it with terminate?
alternatively you can add a check like
waitUntil {animationState dude4 != "..."};
if !keepup exitWith {};
``` to prevent the script from continuing
I think it removes it from the scheduler immediately and stops the execution, but I may be wrong. In that case, option B should work. I'm a little rusty with SQF syntax but you can follow the logic
animation can be confusing so you might get other suggestions for best practice
just replace waitUntil {animationState dude4 != "AmovPercMstpSnonWnonDnon_exercisePushup"}; with if (animationState dude4 == "AmovPercMstpSnonWnonDnon_exercisePushup") then { continue; };
also add a small sleep
if I recall correctly playMove does not need to be executed on all clients, just the object's owner. There may be weird behavior if you execute on all machines
it'd be better if you used anim event handlers instead
Thanks lads, I'll try
Terminate works like a charm!
Also I removed remoteExec from playMove as you're right, it's GE
Thanks!
i will check. in my tests i ended up having to release the key and then press it again to get the following 'keyup' event
Wrote a small function to turn your 3DEN attribute's GF_deformString made by DEFORMER into setTerrainHeight array and apply it:
// Params: String
// Returns: Nothing
fnc_applyDEFORMER = {
private _array = call compile (_this select [1,1e6]);
private _grid = getTerrainInfo # 2;
private _sets = [];
{
private _grid_x = _x # 0;
for "_i" from 1 to count _x - 1 do {
private _y = _x # _i;
private _grid_y = _y # 0;
for "_j" from 1 to count _y - 1 do {
_sets pushBack [
_grid * _grid_x
,_grid * (_grid_y + _j - 1)
,_y # _j
];
};
};
} forEach _array;
setTerrainHeight [_sets];
};
```posting in case somebody finds it through search:
- Call with "x[..." string from `mission.sqm`'s `GF_deformString` attribute
- Does NOT support `adjustObjects` flag as I personally didn't need it
Usage in another mission without addon enabled
Again, thanks for the great addon.
I guess I could have mentioned that there already was a function in the mod that unpacks the deformString ("uncompressMap" in GF_fnc_deformFunc) but I assume it didn't take many seconds for you figure out yourself. ๐ Good job ๐