#arma3_scripting
1 messages Β· Page 49 of 1
someone with wiki account should fix that wording.
Which wording?
Oh, i see. The first link doesn't actually list an alternative syntax.
about the {} making it lazy
It also says introduced in A3 1.62, which is nonsense.
Is it?
(Available since ArmA 2:OA v1.62.)
https://community.bistudio.com/wiki?title=a_or_b&oldid=93450 correct version, wrong game? π€£
Most definitely, since that overload has existed since at least A2, if not earlier.
that page revision predating A3 1.62 by half a year if my math is correct https://dev.arma3.com/post/spotrep-00058
Hey there, hope I can find some help here.
I am working on a teleport script, that teleports units and vehicles. I am using BIS_fnc_findSafePos https://community.bistudio.com/wiki/BIS_fnc_findSafePos to find a safe position where to teleport them.
Problem is mainly with vehicles, using this script
private _marPos = getMarkerPos "VDV3";
_vehicles = [B1, B2, B3];
{
private _pos = ([_marPos, 5, 20, 5, 0, 20, 0] call BIS_fnc_findSafePos);
_x allowDamage false;
_pos set [2, 0.5];
_x setPosATL _pos;
_x allowDamage true;
} forEach _vehicles;
(It's part of a bigger function, but irrelevant)
It still happens that the BMPs teleport into each other. Any idea why? Does it not take in account "dynamic" objects and only takes into account map objects? 
Tried adding a 0.5 sleep in there between ports, did not help
@leaden ibex BIS_fnc_findSafePos does a surface collision check but it's only single-point so it can certainly place vehicles inside each other.
As you're using a tiny radius it's going to happen a lot.
I see. So a custom check might be needed. Thanks for the info!
well, you can pass in blacklist areas as well.
I would pass in the vehicles, but given it's Object - Trigger area I guess it only takes in triggers right?
yeah, it uses inArea internally.
For what it's worth, there is no good command or function to place vehicles :P
I'm listening
oh, no good
I am blind
I'll do a custom check, if it's in 5 meters to another vehicle, I'll just generate new position and do it all the time, slowly increasing the minimum and maximum distances
findEmptyPosition is also extremely unreliable.
findSafePos is dangerous to use under heavy restrictions because it'll do expensive checks on 3000 points before giving up.
It's running on client
his bad
excellent
Was thinking about moving it to server side, but I guess not in this case.
The chances of them colliding is around 5% from my testing with three vehicles, so I should be ok
Hi, i have a question ? Is it possible to hide the grass from the Thermal Camera ? Because since the new thermal camera update, it's still not fixed and i'm not able to see a man on the ground while the day or night, it doesn't matter.
setTerrainGrid
Hello,
I am currently piecing together a animation for a mission of mine and I've run into a small problem. I use following script to attach the unit into a helicopter after the animation plays out:
p1 attachTO [heliCIA, [0.9,2.75,-3.30]];
and for the rotating I use this:
p1 setDir 90;
This is working, but has the problem that the rotation is visible to the point in which it annoys me (It's a small thing I know, but still it annoys me alot). I've tried the BIS_fnc_attachToRelative function too and while it keeps the rotation, I was not able to figure out how to change the height the unit after that.
Does somebody have an Idea to change that?
This is a short clip showing my problem: https://www.youtube.com/watch?v=2mjMP8VEBSA
isNil {
p1 attachTo [heliCIA, [0.9,2.75,-3.30]];
p1 setDir 90;
};
```this will make it all happen in one frame π
fixed
Thank you so much Lou! It works like a charm 
ah it's working thank you π
Anyone knows how I can make certain AI to a specific respawn point?
Let's say I have 3 respawn points for BLUFOR but I want team Alpha 1-1 to respawn at respawn point 1 and not 2 or 3.
How can I make that possible?
Do I need a script or is it possible with another method?
Hello can you override commandmenu?
~ and actionskeys F1-F10
the only reliable way is keyDown EH I guess
(if by override you mean disable)
No, I want access my own menu. Currently doing that via keyEh, just thought if you can config them
I didn't found any examples of these
they're not documented
Aa, thats why
iirc they're called RscMenuMove, etc. or something like that
you can find them in the root of configFile
RscMenuMove
RscMenuEngage
RscMenuStatus
RscMenuFormations
Awesome!
so im making an on hit event for a tank - goal is to artificially increase its health via the hit event and counting direct hits from other tanks.
unfortunately this is counting Every hit so that includes shrapnel and bullets. whats the easiest way of filtering out the damage source to just be tank shells that it counts. ive tried just classname matching so if the projectile is say 120m shell it counts but it seems to ignore it
well it's not that easy tbh:
https://community.bistudio.com/wiki/Arma_3:_Damage_Description
so you have to check the projectile and tank armor properties to filter them
some tank shells might just act like bullets against a specific tank
the alternative way is using handleDamage EH
which gives you the calculated damage already
May have jumped the gun a bit on this on, as while it feels better and faster than what I've done before, the rotation is still visible for a very short amount of time. So would it be possible to do it even faster?
says video unavailable
the rotation delay should just be 1 frame tho
So would it be possible to do it even faster?
no. that 1 frame delay will always be there when you use attachTo
Deleted it as it just showed the original rotation.
well I wanted to see how bad it is
Sec
but it should be 1 frame
https://www.youtube.com/watch?v=eX7a3TSYbGY This is how it looks with two attempts with the code of Lou (of course not in a helicopter this time, but demonstrates the exact small problem that I mean.)
The first attempt looks perfect, the second one looks okay for some reason
ah that seems to be related to what you attach it to
it probably has a low update frequency
like static objects
Would it be possible to force a update of the object at the time the attachto with the rotation happens?
try obj setPosWorld getPosWorld obj
isNil {
p1 attachTo [heliCIA, [0.9,2.75,-3.30]];
p1 setDir 90;
p1 setPosWorld getPosWorld p1
};
or try it for heliCIA too
will do, gonna take a few seconds
https://www.youtube.com/watch?v=iNeWVxOUQrk ~~(not HD yet, thanks YT) ~~
This is what it should look like from the beginning to the end. (The rotation happens around https://youtu.be/iNeWVxOUQrk?t=112)
why not upload here? 
No rights to do that as a normal user, can't even upload pictures here
did you agree to #rules and do !verify in #offtopic_bot_cmds ?
Okay, that might have been the reason for it
, thanks. I can now upload stuff too
This is also the whole code that I used, if it is needed or somebody wants to take a look at it.
p1 setDir 90;
p1 switchMove "Acts_NATOCommanderArrival_Commander_1";
p1 enableSimulation false;
sleep 5;
heliCIA animateDoor ["door_main_r_source", 1]; sleep 0.5;
HeliCIAD disableAI "ALL";
p1 attachTO [heliCIA, [0.50,2.619,-2.53]];
p1 setDir 90;
p1 disableAI "ANIM";
p1 enableSimulation true;
p1 switchMove "Acts_NATOCommanderArrival_Commander_1";
[] spawn
{
sleep 0.5;
p1 playMove "Acts_NATOCommanderArrival_Commander_1";
p1 playMove "Acts_NATOCommanderArrival_Commander_2";
p1 playMove "Acts_NATOCommanderArrival_Commander_3";
p1 playMove "Acts_NATOCommanderArrival_Commander_4";
p1 playMove "Acts_NATOCommanderArrival_Commander_5";
p1 playMove "Acts_NATOCommanderArrival_Commander_6";
p1 playMove "Acts_NATOCommanderArrival_Commander_7";
p1 playMove "Acts_NATOCommanderArrival_Commander_8";
p1 playMove "Acts_NATOCommanderArrival_Commander_9";
};
sleep 56.616;
p1 switchMove "Acts_SittingJumpingSaluting_in";
[] spawn
{
sleep 0.5;
p1 playMove "Acts_SittingJumpingSaluting_in";
};
sleep 07.434;
isNil {
p1 attachTo [heliCIA, [0.9,2.75,-3.30]];
p1 setDir 90;
p1 setPosWorld getPosWorld p1
};
p1 switchMove "Acts_SittingJumpingSaluting_loop1";
[] spawn
{
sleep 0.5;
p1 playMove "Acts_SittingJumpingSaluting_loop1";
p1 playMove "Acts_SittingJumpingSaluting_loop2";
p1 playMove "Acts_SittingJumpingSaluting_loop3";
};```
p1 enableSimulation false;
that's why
It is being re-enabled though with p1 enableSimulation true;
yeah, the first two attach to's are not visible, so the rotation isn't really a problem there (the reason for it was to keep the animation that is playing in a static pose until the actual animation sets play)
you might want to ditch those spawns
and instead of sleep use anim EHs
but that's not the point here 
so you mean the last one is the problem?
Yeah
no clue
remove enableSim and disableAI
see what happens
I know it might break the anims
just want to see how the attaching works
will do sec
The whole thing without enableSimulation and disableAI for p1 and just the rotation action
It's generally the same as the other one, but the six second clip also shows the rotation
it looks to be 1 frame
tho on second thought so does this one:
https://www.youtube.com/watch?v=iNeWVxOUQrk&t=112s
yes
If both are 1 Frame (which kinda looks like it, but I can't really tell personally) I now have the choice of either changing the approach to it or just leave it as it is, as for now it "only" bothers me.
you can try p1 setVectorDir [1,0,0] instead too
I doubt that'll change anything tho
if that doesn't work either you can try moving the unit every frame relative to the heli
another idea is attaching another object there first
then attach the unit to that object 
That sounds like that could work though, as I could already set the direction of the object once and then won't need to change the direction of the player anymore right?
well the 3rd idea will work yes (you should attach the object long before attaching the unit tho)
but it's slow af
I'd try the first one first
Yeah, I will try it all. Thank you for your time and knowledge! I prob. will post the end result here if I can fix it.
does anyone know why in MP noone but me can see particleeffects executed by a script?
because they're local
any way to make them not be local?
create them for everyone on every PC
Like executing global, I assume. Despite that I got this script which I apply onto a vehicle, seems like only the driver can see the effects https://pastebin.com/CckcbRKV
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.
change createVehicle to createVehicleLocal
then remoteExec that script
you'll have to move it to its own function or file to do that
(I mean the addAction code not all of it)
also change those global vars to local
you only need them in that script
instead of getPos _target use ASLtoAGL getPosWorld _target
alright I think I fixed it, I will try it on the server once I got people to witness it and tell me if it works
what do you have rn?
same stuff, just replaced getPos _target and createVehicle. Now will put all that stuff into an sqf
It still works so far, but obviously without other people I wont know if its actually working
like I said you must remoteExec it
it won't work otherwise
in action code:
[_this, "myfile.sqf"] remoteExec ["execVM", [0, -2] select isDedicated];
and you can always run 2 windowed instances of the game by disabling BattlEye and connect them together to test MP stuff π€·ββοΈ
You missunderstand, I need a foreign observer. It will always look good on my end, because I am the one executing
Thanks, I will check it out when I can
you execute in one window, you check in another window π€·ββοΈ
Oh, I missunderstood myself
Reposting :
Anyone knows how I can make certain AI to a specific respawn point?
Let's say I have 3 respawn points for BLUFOR but I want team Alpha 1-1 to respawn at respawn point 1 and not 2 or 3.
[13:08]
How can I make that possible?
[13:08]
Do I need a script or is it possible with another method?
I thought about using the "sinc
"sinc_to" option, but it doesn't work for some reason. Maybe I have to retry.
You could swap their side on death and have the respawn point be a different side, then set it back once they spawn. Another way could be what's done in this thread: https://forums.bohemia.net/forums/topic/232112-player-ai-re-spawn/
RemoteExec a script vs a inline function?
how do i implement this error message from the vanilla zeus modules? https://i.imgur.com/hSox1hl.jpg
I found this code snippet on the zeus enhanced git hub but i dont know what this "EFUNC(common,showMessage);" is (if it even is what im looking for)
if (isPlayer _unit) exitWith {
["str_a3_cfgvehicles_moduleremotecontrol_f_errorPlayer"] call EFUNC(common,showMessage);
That's an macro to zen_common_fnc_showMessage
neither. both bad. inline worse
Anyone know why it is showing two hold acitons? It only displays one in singleplayer but it shows two on a multiplayer server.
Code Below
[
HAUB_Falcon_1,
"take transport to UNSC Minotaur",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff1_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff2_ca.paa",
"_this distance _target < 7",
"_caller distance _target < 7",
{},
{},
{ player setPosATL (getPosATL MIN_ENT) },
{},
[],
3,
0,
false,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, HAUB_Falcon_1];```
What is the best way to execute something on all users machine then
TAG_fnc_testRemote = {
[missionNamespace, "arsenalOpened", {
disableSerialization;
params ["_display"];
_display displayAddEventHandler ["keydown", "_this select 3"];
{(_display displayCtrl _x) ctrlShow false} forEach [44151, 44150, 44146, 44147, 44148, 44149, 44346];
}] call BIS_fnc_addScriptedEventHandler;
hint "Remote Exec Received";
};
arsenalbox = this;
remoteExec ["TAG_fnc_testRemote", 0, arsenalbox ];
hey guys i am having and issue with this script, for some reason it wont remove the save loadbuttons for other clients
it only works on my client
am i using the remote exec command wrong?
because you are only defining TAG_fnc_testRemote on your client
do need to write publicvarable berfore it?
does anyone know the function/command for a zeus banner message?
lets say a player activates something then a message get sent to the zeus banner hud
cutRsc ["RscStatic", "PLAIN"]; How would I execvm this so it effects all players at once?
["RscStatic", "PLAIN"] remoteExec ["cutRsc", -2];
if on dedicated
["RscStatic", "PLAIN"] remoteExec ["cutRsc", 0];
if on local hosted
@gaunt tendon Thanks!
hey how should I be creating global variables to be used on server start? Currently I am trying to create them with this in the init.sqf.
I compile the initVariables.sqf script first which contains all the variables such as PMC_Factions and PMC_Bases but when I try to assign or use them I get an undefined error. What am I doing wrong?
if (isServer) then {
[] call compileFinal preprocessFileLineNumbers "scripts\initVariables.sqf";
};
PMC_SaveData = [] call PMC_fnc_loadSaveData;
PMC_Factions = PMC_SaveData select 0;
PMC_Bases = PMC_SaveData select 1;
_assign_faction = {
// using PMC_Faction variable
};
[player] call _assign_faction;
Are you using them on client? (isServer = false)
yes, didnt think about that but even before I used the isServer check and now that I changed it back it still is undefined
Are you broadcasting the variables to clients?
Either way, not enough info to see what's wrong
I am not, should I be publicVariableing all the global variables I create?
You're initialising your variables only on server yet use them everywhere
If script is on clients then just run the script that initialises them instead of broadcasting from server
it all comes done to what you're trying to do
hey i need help with this i cant use remote exec on this script but i need a way to make it so there is no save or load function on an arsenal box for other clients. it just needs to work for every cleint.
[missionNamespace, "arsenalOpened", {
disableSerialization;
params ["_display"];
_display displayAddEventHandler ["keydown", "_this select 3"];
{(_display displayCtrl _x) ctrlShow false} forEach [44151, 44150, 44146, 44147, 44148, 44149, 44346];
}] call BIS_fnc_addScriptedEventHandler;
ah should I actually be using remoteExec to call the script on every client, server included?
No, if script file is already everywhere, just execute it
[] call compileFinal preprocessFileLineNumbers "scripts\initVariables.sqf";
```instead of
```sqf
if (isServer) then {
[] call compileFinal preprocessFileLineNumbers "scripts\initVariables.sqf";
};
why not just remove the if statement and run it for every client ?
right thats what I was, and now am again, doing but like I said it still remains undefined
Just execute it on every client
in init.sqf or something
You messed something up elsewhere then
its for pub zeus, so i dont have access to mission files
I see PMC_Factions yet your comment says PMC_Faction
Do you want to execute it from debug console or something?
spelling error on my part, but trying to assign to PMC_Factions gives undefined as well.
This is how im "creating" the variables in the initVariables script, is this correct?
// Variable initialization, values will be dynamically assigned and removed elsewhere.
PMC_SaveData = [[], []];
PMC_Factions = [];
PMC_Bases = [];
PMC_Approved = ["76561198201550691"];
I am able to use the variables later on after mission has finished starting via debug console
[0, {
[missionNamespace, "arsenalOpened", {
disableSerialization;
params ["_display"];
_display displayAddEventHandler ["keydown", "_this select 3"];
{(_display displayCtrl _x) ctrlShow false} forEach [44151, 44150, 44146, 44147, 44148, 44149, 44346];
}] call BIS_fnc_addScriptedEventHandler;
}] remoteExecCall ["call", 0];
PMC_SaveData = [] call PMC_fnc_loadSaveData;
PMC_Factions = PMC_SaveData select 0;
PMC_Bases = PMC_SaveData select 1;
you're overwriting them right after initialisation with something
- You init them in a file
- Then you call your function and rewrite them
Yes thats what im doing right? is this incorrect?
after I initialize the variables I am trying to assign data too them
arrays basically
You just showed me a script that assigns something to variables
Then you assign them again from your call
ok, then I guess I should change the question as I am thinking you create global variables similar to local, just different naming syntax. How do you create a global variable?
wiki just says use publicVariable
PMC_Factions is already a global variable
public variable is something that gets broadcasted over the network
than I still dont understand, if I am executing the script that initializes the variables above where I wish to use the variable in the init.sqf, why arent they initialized or "Defined"? is it some kind of order of execution issue with my logic?
You initialise then and then instantly overwrite with something else
PMC_SaveData = [[], []];
PMC_Factions = [];
PMC_Bases = [];
...
PMC_SaveData = [] call PMC_fnc_loadSaveData;
PMC_Factions = PMC_SaveData select 0;
PMC_Bases = PMC_SaveData select 1;
And I guess your function makes them undefined or something
Add logging lines each step to see what your variables are
diag_log [1, "PMC_Factions", PMC_Factions];
...
diag_log [2, "PMC_Factions", PMC_Factions];
...
diag_log [3, "PMC_Factions", PMC_Factions];
```etc.
Then see RPT output
dunno why I didnt think of doing this. Thank you, turns out I apparently was really dumb when I wrote that function, for some reason I did the assigning of save data to the PMC_Faction and assigned the bases to the wrong variable as well as didnt even return the save data.
Glad you figured it out
https://community.bistudio.com/wiki/diag_codePerformance
For security purposes, this command will only run for 1 cycle in multiplayer, unless in-game debug console is available via description.ext option or Eden attribute setting.
What security purposes I wonder
Freezing game
You can already do that with lots of other commands
i think battleye related
i forget, i remember when it was debated and it seemed reasonable at the time
Reason why its an issue is because I can't use enableDebugConsole with my UID in there because it also enables debug console to anyone with #login password.
Thus I have to use my own scripted debug console where it doesn't work properly and lots of code needs testing in real environments on a server full of players
i remember when it was in dev experimenting with using it as an execution method, local tho so i dont know
Having to resort to pre-command scripted performance check, pretty annoying to copy-paste extra code
you should have a good idea by now how things perform even before writing
i dont worry anymore about a few 0.0x ms over 10k iterations
for "_i" from 1 to 2 do {_i = 1;} lets disable for unless you're server for security purposes

lol
there was a reason for ti but i forget. maybe it bypassed scripts.txt BE
like it was a way to compile
It still executes it once though, 1 iteration

i was fiddling with it back then as an alternative to eachframe
_results = []
for '_i' from 0 to 9999 do {
_results pushBack (diag_codePerformance [{ private _a = 123; }, 0, 1]);
};``` π
now i am wondering how the results would compare to raw
theoretically you could run that in editor and compare, and statistically filter out the overhead of the for loop from the results
_perf = _result - overhead
there is no overhead from the loop
_sum = 0;
_code = {vehicles};
_iters = 10000;
for '_i' from 1 to _iters do {
_sum = _sum + (diag_codePerformance [_code, 0, 1] select 0);
};
[_sum / _iters, diag_codePerformance [_code, 0, _iters] select 0];
Overhead from individual diag command and floating point error accumulation make manual results much less accurate.
Not as easily
You can replace the allowed to use func, serverside with a mod
_freeze_until = diag_tickTime + 2; for "_i" from 1 to 2 do {_i = [1,2] select (diag_tickTime > _freeze_until);};
Hmm, interesting, gonna look into that
inb4 10000 iterations limit for unscheduled for in 2.14 
The command tells you the time per iteration, not per 10k iterations.
So if it says a few 0.0x ms, that'd be x0ms per 10k
so my code is 10,000 times slower than i thought it was π
That seems like a bug indeed.
while has 10k check so the others should too π€
plz no fix
π
pls leave in a method to crash the client of trolls
Back in OA you could do skipTime with infinity and it would make sky epilepsy-inducingly flash
Imagine using that to punish cheaters β οΈ
π
test in debug console
In what context do you want to use it? Like an foreach loop?
why are animals inherited from man class? you have to do some extra work when using nearEntities
It should have been the other way around π
But what is your intented behaviour? That it exits the exitWith and continuous the original code? Because that won't happen.
Because of remoteExec
Predefined functions on all machines
Breakout and continue are for for loops I believe.
True...
BreakOut does support return value
"camanbase" instead of "man"
sorry?
But an exitWith inside an exitWith will I believe exit out of the next outer scope. But best to test it yea.
presumably your doing sqf origin nearEntities ['man',50] and finding animals in the list
origin nearEntities ['camanbase',50]``` no animals
ooh i have to try that thx!
No
It just exits the exitWith scope 
Which means it just does nothing
Ah idk then I'm not using that anymore after the breakout and continue stuff got added. It was always too complicated with exitWith for me...
If you just view a soldier in config viewer you can see that it inherits from CAManBase after Man
which are actual men
it looks like "SoldierWB" would also work too
yea didnt realize animals wont inherit from CAManBase
unless civs arent captured
I think that's west only
Not sure
true
always used "man" for queries, hope my code isn't buggy now π¬
probably a more efficient way than doing sqf origin nearentities ['camanbase',50] select {((side _x) == west}
Well technically a mod can just skip that class
yea maybe risky, i aint changing from camanbase
heresy
No π±
It's a feature!
Hey I am very new to this and I am trying to see if I can add a custom helmet to a starsim server and currently just testing it myself. Does anyone here know what I might be doing wrong?
Probably more of a #arma3_config thing
Ok, will ask in there thanks
Use multiple playSounds
define it on every client instead, no need to pvar it
change the soundfile's volume
Good day.How do I create a variable for a certain class of equipment so that it then appears in the script instead of its classname?Thank you in advance
_gun = "weapo_arma3Gun"; ??
player addWeapon _gun;
I'm trying to destroy a tank from the T64 mod, I wrote in the tank's init:
_t64 = "_bt64_b";_t64 setDamage 1;``` but nothing happens
I'm not the one to teach you everything that's wrong there but I would read up about variables.
If you simply want a destroyed tank you can do so in the built in editor under "health" or something
or you can put this setDamage 1; in the init field
βοΈ this @steady minnow
what you did here is try to destroy a string (which is impossible and should throw an error)
The problem is that, in the mod in the config, the damage setting is not correctly configured, and the mod is blocked.The tank cannot be destroyed from an RPG .And I'm trying to adjust the tank's damage so that it can be blown up from a standard rpg.I wanted to create a new variable for the tank to use damage not from the mod's coffig, but from my script.
I'm trying to destroy a tank from the T64 mod
not what you said here
anyway you cannot change a config from script like that
you could override the "HandleDamage" event handler to increase damage eventually, but that's a tricky one too
Does it work if you do ```Sqf
this setDamage 1;
in the init field?
If so, you can name the tank something like "t64" in the variable field, and then in your script do t64 setDamage 1;
not using _ since the variable won't be local
All in all I think this might be beyond your abilities at the moment considering the code you previously posted. I would try and find a different soviet tank that can be destroyed normally.
I used the "HandleDamage" handler, but how can I bind it to a certain rpg charge?if you just use it, then the tank burns down from an M4 bullet
Use the firedman eventhandler and log the projectile when you fire the rpg
or actually just run the handledamage and shoot the tank with the rpg, then log the _projectile variable
so if the _projectile returns "Rpg_7_heat" when you shoot it with the rpg, you check if _projectile isEqualTo "Rpg_7_heat" before running your custom damage script
Thank you very much I will try
And how can I register the classnames of a projectile hitting a tank?
Is there such a script?
why not just extend inAreaArray 
good point π
tho it's a bit nasty
the fact that you have to select again to get the actual thing is just meh
(unless it's for some other purpose?) π
I'm gonna guess that's why anyway, since inAreaArray does give you the actual things
what's a good use case for indices though
let me check the ticket
https://feedback.bistudio.com/T170535
Non-object entities have to be represented as positions and to determine which non-object entity was matched by the command, you have to resort to hacky approaches like storing indexes as position Z coordinate which creates additional overhead for high-performing scripts
that was the proposed use case
You could take all the projectiles that are returned when you hit it with all the ammo you want to be able to kill it
then put them in an array like so ```sqf
_killshots = ["classname","classname","classname];
if (_projectile in _killshots && _unit isEqualTo "classNameOfTheTankT64 (Right click in editor, log classname)") then {yourscript};
or smth
_originalArray batchFind _subArray π
returning array of indices π
there's probs a way to find out all projectiles that can be fired from an rpg and match them with all the tanks. Both for ease but also make it fair (RPG will one shot all tanks not just the t64)
but iirc handledamage is assigned to a unit and so it'll only work for that specific unit, so the extra check if it's the t64 is redundant here IG
i guess, though that could be solved with a hashmap
yeah I just commented with that π
huh, you can put an array in a hashmap.
I'd much rather have a nearestInArray command anyway
Z hack works for me :P
Trouble with returning indices is that you can't chain calls
so narrowing down by radius doesn't work.
wait you can just copytoclipboard str _projective
So I am doing a type of RP and I want to create units/vehicles etc that only one player can see/hear. Any ideas?
local units is not possible. local vehicles can be created using createVehicleLocal
typeOf _projectile
I'm trying to attach this.
waitUntil {
_listT64 = player nearEntities [["Tank"], 500];
_listT64 isNotEqualTo [];
};
player addEventHandler ["FiredMan", {
["player", "launch_RPG7_F"]; (damage "Tank");
}];
Only how to link the class of all tanks to damage?
add EHs only once...
that thing is gonna trigger thousands of times
and the code is just wrong
what are you trying to do?
I'm trying to destroy a certain class of tank specifically from rpg 7
The problem is that, in the mod in the config, the damage setting is not correctly configured, and the mod is blocked.The tank cannot be destroyed from an RPG .And I'm trying to adjust the tank's damage so that it can be blown up from a standard rpg.I wanted to create a new variable for the tank to use damage not from the mod's coffig, but from my script.
player addEventHandler ["FiredMan", {
private _projectile = _this#6;
if (typeOf _projectile == "R_PG7_F") then {
_projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity"];
if (_hitEntity isKindOf "insertTankClassHere") then {
_hitEntity setDamage 1;
};
}];
};
}];
I wrote the rpg class from memory tho
you have to check it in the game
and replace insertTankClassHere with whatever tank class you want to destroy
add this once, not in a loop again 
you can try initPlayerLocal.sqf. just put a waitUntil {!isNull player}; at the top of the file before that code, to be safe
oh I misread your code sorry. the EH wasn't in the loop 
if (typeOf _projectile == "R_PG7_F") is this the type of projectile?
yes
And how to recognize him ?
him?
Why not try dePBO the eden .PBOs and ctrl + f for snap? Use Astrogrep for searching a local dir, it's fast and comfy :)
for now just replace insertTankClasshere with Tank and run the code in debug console
then fire at a tank with an RPG7
I have no information about the class of the projectile, where can I find it?
Thanks a lot everything worked
np
Health and well-being
I don't think so. I bet its more a "onSurface" or something
Yeah but without remoteExec how do you signal to the machines to calm them
functions library
or just defining them locally using locally executing scripts
e.g. init.sqf
you don't have to remoteExec everything
How does this stay in sync at all if everything is executed locally
the function is defined locally
you're not sending the whole code
you just send the name of the function to remoteExec
I didn't say don't use remoteExec to call them
I said don't use remoteExec to send the whole inline code
Ah okay well I sajd earlier βremoteExec a script or inlineβ and you said neither, by script i meant function, i probably misunderstood
Can I trouble you again?
sure
Where can I find coolnames of shells for rpg and other anti-tank weapons?
Classmames
I'm asking why, because your script works, but now the tank is burning from an anti-infantry projectile from an rpg. And this somehow does not seem to be true.
well yes I thought you wanted to destroy it completely
I kill it instantly
you can adjust the damage
I think the problem they're having is that it's being taken out by an anti-infantry (i.e. HE) projectile
player addEventHandler ["FiredMan", {
private _projectile = _this#6;
if (typeOf _projectile == "R_PG7_F") then {
_projectile addEventHandler ["HitPart", {
params ["_projectile", "_hitEntity"];
if (_hitEntity isKindOf "insertTankClassHere") then {
_hitEntity setDamage (damage _hitEntity + 1 / 2);
};
}];
};
}];
you can adjust that number 2 for number of shots it takes to kill that tank (right now it takes 2 shots)
it's a naive code but I'm not in the mood to write a complete version
I think rather than locking it to a particular classname, it would be better to check the projectile's config to see if its warhead type is AP, HEAT, or TandemHEAT
I tried to adjust the damage.But if you put, for example, damage 0.5, then there is no reaction to a hit.
the original request was for rpg7 so... 
did you try that code?
I am very grateful for that too
Might be mistaken, but a quick look at eden source tells me BIS uses boundingboxreal for all cases when positioning entities
I am trying to see where a strange empty nested array is coming from in one of my variables but as far as I can tell my code looks alright, is there a way to maybe add an event handler to my specfic variable to trigger whenever the variable is modifed?
no. you can write a wrapper function for it tho
but I doubt it's gonna help you
the only explanations might be:
- you're using bad variable names and another mod is modifying it
- error is in your own code
likely scenario is number 2
arrays are more complicated than other types in SQF. you're probably not familiar with the concept of references
I have been referencing the array wiki when using it but you are correct, for instance, is this code appending one array with the data, or appending a nested array with the data?
PMC_Factions append [[_factionID, _factionName, PMC_Starting_Cash, _factionLeaders splitString ",", _factionMembers splitString ",", ["G1"]]];
I was a little confused on the syntax
gotcha
ill just need to continue searching through and refactoring my code + debugging it till I get to the point where the strange array is added
which one is the "strange array"?
the very first index of the first index here, its 3 empty arrays and im not sure where it came from yet. So far in my testing it hasnt been re added so its possible I previously fixed it and just had to flush the missionProfileNamespace to get rid of it. I also noticed that overall the first index seems to be a nested array though it shouldnt be
[
[[
[[[]]], ["T000","The Red Arrows",500000,["76561198201550691"],["76561198201550691"],["G1"]]
]],
[[]]
]
probably some bad logic I need to rework
why so many levels of arrays? 
nested arrays are extremely slow when you want to modify them
as for that empty array, make sure you're not modifying things by ref incorrectly
an example of ref mod, if you're not familiar with the concept:
_a = [];
_b = _a;
_a pushBack 1; // _a and _b are both [1]
This is supposed to unlock a turret, but I'm getting no effect applying it to a blackfoot:
_vehicle lockCameraTo [objNull, [0]]
Make sure it's being executed locally to the gunner (may be different from the vehicle if it's a player)
I'm running it on my pc in the editor
I am probably going to look into hashmaps as per others suggestions but originally it was supposed to be one array containing 2 arrays, one for faction data, one for base location data. Faction data would contain arrays for each faction. Base data would contain arrays for each factions base.
The arrays you see in the faction data array are for multiple steam ID's and whatnot per faction
The Blackfoot gunner's turret doesn't have the stabilisation feature required to use the main syntax. Use the alt syntax
Ah, you're right. I assumed the 2 length syntax would still work for unlocking.
In all honesty I think you should use HandleIdentity too to check whenever a t64 spawns and then run that
if it's a sp mission and you spawn stuff like your while true loop was meant for
since it's using player it seems to be sp idk
or mb I'm stopid ackthsually
will if () exitWith {} stop a forEach loop?
only if it's directly inside the forEach scope
if it's nested in another scope no
alright then no problem, and I have a question about hashmaps if you dont mind.
My assumption on how I can use hashmaps is something like this, basically nested hashmaps.
is this the correct way of thinking? (I know this isnt the correct way to create a hashmap)
_hashMap = [
[
"factionID",
["HQ", [getPosATL, vectorDir, vectorUp]],
["Objects", [["class", getPosATL, vectorDir, vectorUp], ["class2", getPosATL, vectorDir, vectorUp]]]
]
];
_base = _hashMap get "factionID";
_hq = _base get "HQ";
_hqCords = select 0;
and is this better than the nested arrays, or am I still being inefficient here
idk your "hashmap" is kinda confusing
but it could be faster due to fewer array nesting
is it confusing because of the "key", "hashmap", "hashmap" ? I realize its supposed to be key/value pairs. I am not really sure how to go about this without nesting arrays/hashmaps
any suggestions? when it comes to objects there could really be an unlimited number of objects and I would need to store the class name and positions for later placing them back down
and each faction has unique versions of this data, so their own HQ, and own Objects
yeah that's the reason
but overall I guess the structure is ok-ish
nested hashmaps are not slow iirc
this one had way more nesting tho. the "faction" was 4 levels deep
I couldn't justify that level of nesting before faction data started
yeah that was more supposed to be like
[
[["faction1"], ["faction2"]],
[["base1"], ["base2"]]
]
and also that was the overall save data, not just faction data
switching to hashmaps I was probably going to do something like
[
["factions", [ ["factionID", [data]], ["factionID", [data]] ]],
["bases", [ ["baseID", [data]], ["baseID", [data]] ]]
]
Hey everyone quick question
Im using this to add an interaction to a computer
this addAction ["hack", {hacked=true;publicvariable "Hacked";}];
But on activation of the action is there a way to send a message in chat?
Thought it could be something like
this addAction ["Download', 'systemChat hello"]
Just add the systemChat inside the action statement {}. If you need it to show for every player then you need to remoteExec.
Rly? oO
hi, i find a mod call Azcoder Radiation and in the description it says that any mask or outfit with a substring in it can be use as a radiation outfit/mask, i'm new to moding and scripting but i want to know if i can change the substring of an outfit from another mod and how i can do it (how to find the code of the string open it and all that), sorry for bothering
Unpack the .pbo with Arma 3 Tools and read the scripts to figure how it works
Likely you can change the substring through script in your mission without having to modify the mod
But it all depends on the mod
thanks
Is there a way to spawn a module through a script? I looked in the biki and found how to create a module, but I'd like to call it.
@warm swallow you can make an activator that calls a script you create
not quite sure what "activator" means.
Just trying to know if I can create a module through a script
nevermind! Found this code in biki:
private _grp = createGroup sideLogic;
"ModuleSmokeWhite_F" createUnit [
getPos player,
_grp,
"this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];"
];
sorry, it was a trigger
hi anyone here?
I have a question on a mission i'm making
not sure if it's possible, but in arma anything is possible, right?
It's a capture/hold game where bluefor and opfor are fighting for control of a base that is held by indepentents who are friendly to neither...i have indepentents that spawn and waypointed to certain buildling locations ( specifically air base mike-26 on Stratis...) My question is in 2 parts, A, is there a way to make independent units respawn without making them 'Playable' and B, can I respawn these units to adhere to their original waypoints before they were killed
I want the guerrila to keep respawning and keeping control of the base to add a challenge to the opfor and bluefor teams who are trying to get control of it themselves
i tried there
Use ALiVE ;)
what's that?
A mod for A3.
[
diag_codePerformance [{private _class = typeOf player; _class; _class}]
,diag_codePerformance [{typeOf player; typeOf player}]
]
```=>`[[0.00056,100000],[0.00053,100000]]`
For mission making
If you need player's class twice, its faster to just get it twice than to store it in local variable π€
ahh i've seen that on a server i played on
Locals seem to be really slow for whatever reason.
Its just a matter of number of commands. Usually its better to try to use as less commands as possible.
Similar case, but local variable is tiny bit better:
[
diag_codePerformance [{private _var = player == player; _var; _var}]
,diag_codePerformance [{player == player; player == player}]
]```=> `[[0.00066,100000],[0.00076,100000]]`
I guess it's just all the hashtable lookups for local variables.
= is expensive
Introducing the first variable in a scope is probably the greatest expense, since it has to allocate a new hashtable and unless they swapped it for a better open addressing implementation in A3, it's an array of arrays too.
How about
[
diag_codePerformance [{private _x = 1; private _class = typeOf player; _class; _class}]
,diag_codePerformance [{private _x = 1; typeOf player; typeOf player}]
]
Yeah I think the issue is that the hashtable needs to resize and allocate, if its still empty. Which means it usually doesn't happen/isn't so bad in "normal" scripts
You ever consider creating static hash tables for each code during script compilation instead?
no
Would probably speed things up a lot.
"a lot" is relative π
In the context of SQF execution of course.
Overall it might or might not be a lot. I guess it depends on how many scripts are running.
local _v = 0;
for "_i" from 0 to 1000 do
{
local _v = 0;
};
vs
local _v = 0;
for "_i" from 0 to 1000 do
{
_v = 0;
};
This might be a very revealing comparison.
I don't have arma handy to test it myself right now.
Previously it was called "Generic error in expression"
My guess, your function is ending with
_x = y
};
so no return value
hmm ok ill look into it. occurs only once per session
ALiVE is one of these essential mods for A3 next to ACE3 and TFR/ACRE2 imho. :)
Maybe a random question, but before I waste a bunch of time looking, does anyone know if it's possible to add ACE interations to an object purely through that objects init field?
[[0.00069,100000],[0.00066,100000]]
Assigning local variable and using it twice is still slower
I'm trying to figure why groups are so easy to flee when I have allowFleeing set at 0.2 . im also doing lot of deletevehicle/createunit for spawning the groups so maybe those affect it
courage of the units is above 0.9
wish there was away to get the current "morale" (how close unit is to fleeing)
aah nice!
you could create your own moral function to incorporate damage, suppression, group members killed, etc
if i just get the vanilla working im happy
morale 0.8 and the guy starts fleeing :/
If the group losses by injury/damage or death/destruction are higher than the max strength, multiplied by leader's courage or allowFleeing level , then the group will start fleeing.
cowardice: Number - 1 is maximum cowardice and 0 minimum. A value of 0 will disable fleeing all
The command description on wiki seems to contradict itself
Actually, interesting extra to make you waste more time on testing π
Variable lookup has been improved in profiling branch, its now a separate instruction rather than combined with nular commands and checking if its a command or not
previously with any variable or nular command the engine was checking at execution whether that name is a variable, if it isn't it must be a nular command, and if it then isn't actually a command it just returns a nil.
So I moved that check to compiletime
My test results were good, but not as good as I expected
Actually, that only applies to global variables... so won't apply here.
Locals are already fast because it checks for starting _
But... every nular command also tried to look up a global variable with the same name first.
So all nular commands are getting faster, and I guess also undefined global variables π€
Interesting details, thanks for the insight π€
should've been like that ages ago π
Actually that will make your variable thing even worse XD
Because player will execute faster, so the one without variable will even further ahead
I wonder if removing old crap commands (like these https://community.bistudio.com/wiki/Category:Command_Group:_Game_2_Editor) could speed up script execution a bit?
@meager granite you want to try this one?
Is local still supported in A3?
not since 1.52 iirc 1.54*
[
diag_codePerformance [{
private _v = 0;
for "_i" from 0 to 1000 do
{
private _v = 0;
};
}]
,diag_codePerformance [{
private _v = 0;
for "_i" from 0 to 1000 do
{
_v = 0;
};
}]
]
```=>`[[0.320616,3119],[0.2457,4070]]`
Ah yeah, i'm just used to A2.
Right, as expected. The introduction of a local in the inner scope causes the allocation and later deallocation of a hash table.
I guess old approach of defining all private variables at the beginning of the script could be performance beneficial?
Yeah, possibly.
commands no. Compilation time maybe, but after my change with nulars there is no runtime lookups to commands, only during compile time
And I intend that change to make it to 2.14
Oh yeah makes sense that it would only affect compilation, so not much benefit apart from few ms during loading or something.
Also on compilation its hashtable so, not that much better to have less
[
diag_codePerformance [{
private ["_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "_r", "_s", "_t", "_u", "_v", "_w", "_x", "_y", "_z"];
_a = 1; _b = 1; _c = 1; _d = 1; _e = 1; _f = 1; _g = 1; _h = 1; _i = 1; _j = 1; _k = 1; _l = 1; _m = 1; _n = 1; _o = 1; _p = 1; _q = 1; _r = 1; _s = 1; _t = 1; _u = 1; _v = 1; _w = 1; _x = 1; _y = 1; _z = 1;
}]
,diag_codePerformance [{
private _a = 1; private _b = 1; private _c = 1; private _d = 1; private _e = 1; private _f = 1; private _g = 1; private _h = 1; private _i = 1; private _j = 1; private _k = 1; private _l = 1; private _m = 1; private _n = 1; private _o = 1; private _p = 1; private _q = 1; private _r = 1; private _s = 1; private _t = 1; private _u = 1; private _v = 1; private _w = 1; private _x = 1; private _y = 1; private _z = 1;
}]
]
```=> `[[0.00531,100000],[0.00365,100000]]`
that comparison is useless, you are creating a new variable per iteration, the latter always uses the same and only one
Didn't get you.
the first code, you allocate _v and store a 0 into it. everytime that loop iterates, it allocates a new variable (in that scope), and assigns 0 to it.
the latter code, you allocate _v again, store 0, but this time when the loop iterates, it instead assigns 0 to the one in the parent scope, and no new variables are created (no private).
Do you mean the difference between in behaviour of inline private on assignment vs private ARRAY command?
codePerformance doesn't run code on same scope each iteration, is it?
we are talking about different things here π i meant the for test you did
Ah, it's exactly the point of test, how much more expensive is it to declare a new local in the scope rather than using one from parent.
btw for this one, only use private ARRAY if you aren't going to be assigning anything to it right after, otherwise always inline private
Another test, now with nested scopes:
[
diag_codePerformance [{
private ["_a", "_b", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "_j", "_k", "_l", "_m", "_n", "_o", "_p", "_q", "_r", "_s", "_t", "_u", "_v", "_w", "_x", "_y", "_z"];
call {_a = 1; call {_b = 1; call {_c = 1; call {_d = 1; call {_e = 1; call {_f = 1; call {_g = 1; call {_h = 1; call {_i = 1; call {_j = 1; call {_k = 1; call {_l = 1; call {_m = 1; call {_n = 1; call {_o = 1; call {_p = 1; call {_q = 1; call {_r = 1; call {_s = 1; call {_t = 1; call {_u = 1; call {_v = 1; call {_w = 1; call {_x = 1; call {_y = 1; call {_z = 1}}}}}}}}}}}}}}}}}}}}}}}}}};
}]
,diag_codePerformance [{
call {_a = 1; call {_b = 1; call {_c = 1; call {_d = 1; call {_e = 1; call {_f = 1; call {_g = 1; call {_h = 1; call {_i = 1; call {_j = 1; call {_k = 1; call {_l = 1; call {_m = 1; call {_n = 1; call {_o = 1; call {_p = 1; call {_q = 1; call {_r = 1; call {_s = 1; call {_t = 1; call {_u = 1; call {_v = 1; call {_w = 1; call {_x = 1; call {_y = 1; call {_z = 1}}}}}}}}}}}}}}}}}}}}}}}}}};
}]
,diag_codePerformance [{
call {private _a = 1; call {private _b = 1; call {private _c = 1; call {private _d = 1; call {private _e = 1; call {private _f = 1; call {private _g = 1; call {private _h = 1; call {private _i = 1; call {private _j = 1; call {private _k = 1; call {private _l = 1; call {private _m = 1; call {private _n = 1; call {private _o = 1; call {private _p = 1; call {private _q = 1; call {private _r = 1; call {private _s = 1; call {private _t = 1; call {private _u = 1; call {private _v = 1; call {private _w = 1; call {private _x = 1; call {private _y = 1; call {private _z = 1}}}}}}}}}}}}}}}}}}}}}}}}}};
}]
]
```=> `[[0.00881,100000],[0.0101404,98615],[0.00889,100000]]`
What's interesting is that sometimes it works much slower [[0.0132219,75632],[0.014583,68573],[0.0135597,73748]], probably memory allocation or something.
all makes sense there, the first one you allocate a bunch of variables at once, then all thats left is just the scope lookup (to see if the variable exists already). the second one, it has to do a scope lookup and also allocate one by one (which ofc makes it the slowest), and the last, no scope lookup, but allocating one by one again.
The main comparison was about 1st and 3rd codes, about my thought that old style private ARRAY initialisation of all function locals as first line was beneficial to code performance, and how much.
Not much it seems.
["Message: %1", _hint] call zen_common_fnc_showMessage
how would i turn this into remoteexec?
i have been trying but couldnt figure it out
["Message: %1",_hint] remoteExec ["zen_common_fnc_showMessage"];```
If you want to use the optional target and JIP parameters, they go at the end of the right argument, e.g.
["Message: %1",_hint] remoteExec ["zen_common_fnc_showMessage",0,true];```
to target all machines and add to the JIP queue
Hi, i have a question ? I put some units directly in a VTOL with the editor but everytime i launch the mission they are getting out and the same thing happen sometimes with the zeus when i teleport units inside a vehicle so is there a command to avoid this ? Because when the units are getting in with the "order" instead, it's working.
Hi all, looking for some scripting help and hoping for a miracle.
I've recently made a few missions for my unit which are making use of triggers and hold actions. The triggers are working fine with everyone being able to see/hear the effects (mostly SFX and other audio, with some teleports).
The hold actions, however, seem to be a little finicky. They work fine in 3den (I have used them to do small effects like spawn an explosion or delete doors, which work fine) but the various other effects like screenshake and audio playing don't play for all nearby players and it seems kind of random who does and doesn't hear it.
Is there a way round this? Can it be set to run locally? Should I put the whole sequence inside of a determiner like nearPlayers or something?
Thanks in advance.
thanks man works great
Is it possible to disable channel input for a player, but allow read chat?
https://community.bistudio.com/wiki/Multiplayer_Scripting
You have to make sure any scripting command you use has correct locality
I just bumped into this. It needs to use remoteExec right?
Another important thing is that scheduled script timing is heavily dependend on the number of active scripts in the scheduler. If you have timing problems too that could be the issue (e.g. you use sleep 1 but the script seems to sleep for 2 seconds, etc.)
Not everywhere. You must check the script thoroughly, read the wiki page for every command and see what kinda locality they need
Trying to pass a variable through to a custom function that spawns comps. The function works in other tests just fine. However, I am trying to call it on initServer.
_ZoneComp = missionNamespace getVariable ["ALP_mainZone", ""];
diag_log format ["_ZoneComp value:%1", _ZoneComp];
_compReference = [_ZoneComp, [], [0,0,0], 0, true, true, false] call LARs_fnc_spawnComp;
Upon mission start, I get the Error >>: Type Object, expected string.
In the RPT, this pops out:
11:17:13 "_ZoneComp value:ALP_Area_01"
11:17:13 Error in expression < missionConfigFile >> "CfgCompositions" >> _compName;
Made sure it's calling something valid. Anyone have any ideas?
So what would that look like exactly?
ALP_mainZone is an object, as the error says
this addAction ["Hack", {
bexy_hacked = true;
publicVariable "bexy_hacked";
"Hacked" remoteExec ["systemChat"];
}];
or did you mean remoteExec? @broken plinth
RemoteExec for a mission op. Would that just be the Remote Execution in my INIT?
Edited with remoteExec
That should be fine.
Question for you, if you don't mind.
I was able to get say3D working in 3den using [exectest_1, "Alarm"] remoteExec ["say3D"] instead of just exectest say3D "Alarm";
Is this the correct syntax for locality for the say3D command? I can't see anything on the wiki that specifically mentions locality, though I can see there are a few for say3D in particular that offer quite a few variables like pitch or offset.
Will this work? Do I need to add additional files somewhere in the mission folder or something? Thanks.
Thanks Amp
see the doc: https://community.bistudio.com/wiki/say3D
this icon says "Local Effect" so yes, you need to remote exec say3D π
Oshit, never even clocked those at the top. If it doesn't, can I run it as normal?
if it doesn't what?
if it says "Global effect" then one call on one machine will be broadcast to all the others, yes
then the icon looks like this
Gotcha. And if it has neither, such as in the case of "sleep"?
it is either undocumented or irrelevant
So sleep could work feasibly like this:
Line1 with remoteExec
sleep 5;
Line2 with remoteExec
yes
Legend, thanks my guy.
anytime! π»
Hi guys. How to get all unit names from allUnits to new array?
allUnits apply { name _x }
Ty m8!
Currently trying to convert the following script into a remoteExec format, anybody able to lend a hand? I'm a little confused given it's kind of a multi-stage thing.
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
Is this along the right lines? Only the addCamShake is a local effect, the rest are unspecific.
["forEach (getPos podstart) nearObjects 50"] remoteExec ["addCamShake [20, 6, 50]"]
it's not even correct
I figured it wouldn't be, hence why I need help lmao
I'm not talking about remoteExec. that code is wrong
The original one on this message works
pretty sure it doesn't
I can get you a gif of it working lmao, it does.
it does add the camshakes and then throws an error
Mine doesn't throw an error, weirdly enough.
But if there's an issue there I need to address as well I'm happy to learn. I wanna make some more immersive stuff for my guys.
well I have no idea what you're trying to do with it anyway
it just makes no sense
It's part of a series of stuff that results from a Hold Action command. I can send you the whole thing in PM if you want, or post it here.
I am also using 3den Enhanced to do this stuff, if that matters.
no. I just mean what is that code supposed to do?
you might be running it unschd
I can tell you without running it that it does throw error
It calls a series of sounds and camshakes in a sequence for nearby players.
Then the final part of it deletes an object that allows them to exit the shuttle-esque thing they're in. I tried a setPos but that proved to be kinda laggy, so deleteVehicle works way better.
sleep 5;
breachtop say3d "medium_boom";
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
sleep 3;
breachtop say3d "medium_boom";
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
sleep 1;
breachtop say3d "medium_boom";
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
sleep 1;
breachtop say3d "medium_boom";
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
sleep 1;
breachtop say3d "medium_boom";
{addCamShake [20, 2, 1]} forEach (getPos podstart) nearObjects 50;
sleep 1;
breachtop say3d "DT_C_Overdrive";
{addCamShake [10, 16, 10]} forEach (getPos podstart) nearObjects 50;
sleep 8;
breachtop say3d "Smash_rockHit";
{addCamShake [20, 6, 50]} forEach (getPos podstart) nearObjects 50;
sleep 3;
breachtop say3d "Pod_doors";
deleteVehicle breachtop;
deleteVehicle breachbottom;```
This was the original script. I've already rewritten most of it in the remoteExec format, but the camshake line is giving me a headache.
(That script works perfectly in 3den with no errors, but this is the first serious attempt I've made in designing automated sequences beyond using triggers to blow stuff up)
o.O I strongly disagree.But then, there's also people who disagree with ACE and TFR/ACRE being essential...
Why are you doing addCamshake once for every object within 50 metres?
(and why start a new camshake before the previous one has finished?) the duration is / 2 for some reason, ignore that
Inb4 "i want players inside 50 meters radius to have a camshake"
that code doesn't even work
it's ({addCamShake [20, 6, 50]} forEach (getPos podstart)) nearObjects 50; due to incorrect precedence
so it's running it 3 times for each component of getPos
Well, I've got a feeling that isn't going to be important because artemoz is right
It's mimicking a Warhammer 40k boarding torpedo's point defence systems. But yes, Artemoz is right.
My unit runs two ground squads, so I want them to be able to use the boarding torpedoes without hearing each other's sounds, hence the necessity for the nearObjects.
Unfortunately that code would not do what you want it to do. It just runs addCamShake once for each object nearby. It doesn't apply it to the object - addCamShake only affects the local player's camera and can't accept an object as a target. It just applies a camshake to the local camera, once for each object. 20 objects nearby? The local player gets 20 camshakes.
Right, because it definitely did not function that way in practice. It did what I wanted it to - it gave small camshakes the first few times, then a slightly larger one, then a much larger one. I don't know how, but it worked exactly how I wanted it to when I was testing it in 3den (prior to the knowledge that you need to remoteExec local effects).
I'm not meaning to cast doubt here for the record, I am just confused as to how it worked correctly when I'm being told it definitely shouldn't have.
Testing alone in the Editor doesn't tell you anything about the (lack of) multiplayer effects
Probably you can only have one camshake effect active at a time, so those 20 shakes aren't stacking. But it won't affect other players like that, just the local one.
By local you mean whoever activates the hold action, yes?
Yes
and wouldn't account for distance at all
Right. Do you know of any alternative solutions to get the same end result?
Since say3D is also local effect, you should put this whole sequence into a function. Then in the holdAction, get a list of nearby players (this will require a little logic but not too hard) and remoteExec the function to all of them.
Right. I have no clue how to do that.
or just if (player distance podstart < 50) then {addCamShake [20,6,50]}; and execute globally π€·ββοΈ
How do I write that in a RemoteExec format?
where do you have the script above? sfq file? Function? Whatever else?
I should specify that I am also trying to make all of this in as "lite" a way as possible. I have other people who Zeus for my unit who aren't as technically-inclined, so I often give them stuff they can copy&paste as compositions.
3den Enhanced has a specific area in the Attributes section of objects called "Hold Action". They're being put there, under the "when action completed" section.
whoo boy
As I said, I am trying to do this in a way that it's easiest to disseminate to my community.
It's, uh, a fine line to walk.
my first reaction would be to send the entire script first and still execute globally with something like sqf if (isNil "BAL_ShakeMeme") then { BAL_ShakeMeme = { if (isNil "breachtop" || isNil "breachbottom") exitWith {}; breachtop say3d "DT_C_EngineLoop"; sleep 5; breachtop say3d "medium_boom"; ... deleteVehicle breachtop; deleteVehicle breachbottom; }; publicVariable "BAL_ShakeMeme"; } [] remoteExec ["BAL_ShakeMeme", 0]; π€·ββοΈ
When I use Voice Attack with my SOG AI mod, to execute some of my scripts via some key bindings (specifically T key to invoke my custom menu, followed by 1 to call the first option's script), the following Interact Menu flashes on screen. This is not my menu, and I've never seen it before in all my years of playing ARMA. What is this menu, and why does it appear? https://i.ibb.co/WyssrQx/Capture.jpg
That's the radio menu, the same kind of menu used when you give the AI orders using the F-keys. Custom ones can be made; some mod might be using it.
Where do I put this?
the same "when action completed" field should work
I feel like writing this was probably a waste of time but I don't want to bin it in now I've put the effort in. https://pastebin.com/vF3FXaGW
Didn't work.
I'll try this one real quick. Do I put it same place as well?
No
You need to read it and get how it works. It requires a cfgFunctions entry which is why it was probably a waste of time, since I'm guessing you don't want to use that.
Yea, I'm trying to avoid more complicated stuff like that.
The rest of the sequence runs fine (all the sounds, sleeps etc) now that I've rewritten them with remoteExec, but the camshake is the only part that eludes me. If there really is no alternative, or no way to run the shake with a simple line of code, I'll just have to remove it.
But, y'know, it's pretty fuckin cool and immersive, so I'd rather find a way.
It is possible to do it just purely by remoteExecing everything in the sequence. Use the list-of-targets generator from my script and remoteExec every single say3D and addCamShake to that list. This will work. It's just not a great way of doing it because it causes more network traffic than would be ideal.
If CAManBase is the name for the standard human skeleton, then uh... bad news
That's everything in configFile >> RscGroupRootMenu what you see after you select a group member. maybe something overwrote all of the conditions resulting in everything showing?
It's not a name for the skeleton. It's a name for an underlying config type that man units inherit from.
You can find out if your wonderful custom alien units inherit from it by placing one, going rightclick>view in Config Viewer, and seeing if CAManBase appears in the "parents" field at the bottom.
And if not, just replace CAManBase with whatever is there?
Interesting, thanks. I think my code may be Selecting All units, so I will research that.
Not literally whatever is there. Things have multiple layers of parents. You want to choose one of the high-level parents, to guarantee the nearEntities will pick up any unit your players are using.
Ok so it does inherit from CAManBase.
I'll continue banging my head against the keyboard over this. Thanks for everybody's help thus far.
Anyone have any clue as to why this doesn't work? It spawns and adds the item but it doesn't act as an item. I can only pick it up right kinda if I use inventory and drag it but it doesn't take up space and I can't use it. Also if I pick it up like most people by hand it doesn't go in my inventory and drops the next item I pick up
private _holder = createVehicle ["GroundWeaponHolder", _relPos, [], 0, "CAN_COLLIDE"];
_holder setDir (random 360);
_holder addWeaponCargoGlobal [_classname,_amount];
I've got two objects of the same class -- though one can have its rotation changed loads and the other is always static. How would I go about teleporting the player to the same position on the static object as they are on the rotating one? For example, if they are at the edge of the object but it is rotated by 351 degrees, how would I put them at the same position on the object that is not rotatable?
Genuinely have no idea where to start with this one aside from a bunch of trigonometry but I'm convinced that's 100% not the approach I should be taking
getPosATL > worldToModel on rotating object > modelToWorld on static object > setPosATL
So something like
private _relPos = player worldToModel (ASLToAGL getPosASL temp1);
player setPosASL (AGLToASL (temp2 modelToWorld _relPos))```?
Where temp1 is rotating object and temp2 is the other
And for clarification just in case
the worldToModel should be the other way around. You want the player's relative position to the object model, not the object's relative position to the player model
ah that would explain why i was being put behind the object π
just need to do the same for rotation but think I can figure that one out, thanks -- surprisingly less headache than trig would've been π
ok, rotation isnt quite there and idk why
private _vel = velocityModelSpace vehicle player;
private _dir = vehicle player getRelDir temp1;
private _vehDir = vectorDir vehicle player;
private _relPos = temp1 worldToModel (ASLToAGL getPosASL (vehicle player));
(vehicle player) setPosASL (AGLToASL (temp2 modelToWorld _relPos));
vehicle player setVectorDir [_vehDir#0, _vehDir#1, (_vehDir#2 - (_dir/360))];
vehicle player setVelocityModelSpace _vel;``` is what I'm using at the moment
Except it's turning the player a fair few degrees further than they were. _dir/360 is an attempt to normalise getRelDir to work with vectorDir
only just realised setvectordir is not xyz ive been daft
yeah problem solved nvm
makes no sense
i was doing something stupid
is there a "pushFront" variant to "pushBack" function? I want something stored at the front without overwritting the first index
array insert [index, valuesToInsert, onlyIfUnique]
Not as quick though
oh so specifying 0 wont overwrite 0?
It might be better to build an array reversed and then do reverse once when you're done
i don't think so
oh duh, i guess it is "inserting"... I'll test, thanks
New question.
If I have a action named Con2_Disable, and on its activation I want to delete a said object. How would I do that?
actionName Con2_Disable, delete shield1;
hi, i'm trying to add a sound when a player die but i can't do it with all the scrip i find, how can i do it?.
The script i use is:
in description.ext
class CfgSounds
{
sounds[] = {};
class music
{
name = "music";
sound[] = {"sound\music.ogg", 1,1};
titles[] = {};
};
};
and i try calling it via a sqf or just calling it in game but it doesn't work
I think I need some help with BIS_fnc_guiMessage...Is it just not possible to make a conditional guiMessage??
I want to create a prompt that shows only one of two possible messages but the outcome is the same no matter which message is displayed.
// Return Territory Level (ie: _level = 6;)
_level = _flag getVariable ["ExileTerritoryLevel", 0];
// Compare Territory Levels and then display appropriate message
if (_level <= 5) then {
_result = ["ONLY ASK NEWBIE QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
}
else {
_result = ["ONLY ASK VETERAN QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
};
waitUntil {uiSleep 0.05; !isNil "_result" };
if (_result) then
{
// If they click "Yes", do the things you do
};
// If they click "Nah", do nothing at all
However, the results I am getting are this:
if level >= 5, show veteran question and then show veteran question again after clicking "Yes/Nah" the first time
if level < 5, show veteran question first and then show newbie question after clicking "Yes/Nah" the first time
I don't get it. π€·ββοΈ What am I doing wrong?
You probably call this function twice
Once where _level is always 0 (_flag is null) and then where _level is proper (_flag is not null and returns your wanted level)
Add
diag_log [diag_frameno, "My question function", "_flag", _flag];
```to the top of the function and check the RPT
Is there any way at all to disable collision between two PhysX objects - in my case, vehicles, specifically?
Thanks. I will try this. _flag should not be null because it is defined earlier in the function (I forgot to include it in my example), but it is defined by calling another function so maybe that is somehow not working correctly even though it should be given that it works as intended throughout the rest of it.
As it says on the wiki page for that command, it doesn't work for trying to do it with two PhysX objects, hence the question. Which is weird, given that one of the examples is "vehicle1" and "vehicle2"... but I've tested it and the vehicles still collide as normal, despite the command being run
Didn't use it before, but strange indeed. No idea then.
Dang..
22:54:53 [513983,"My question function","_flag",16b558bf000# 2191751: mast_f.p3d REMOTE]
That result for _flag is correct/what I am looking for. π€·ββοΈ
Still got prompt show up twice?
Yes
Then its from another function elsewhere
Also just noticed, are you sure you have _result privated before your code?
if (_level <= 5) then {
_result = ["ONLY ASK NEWBIE QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
}
else {
_result = ["ONLY ASK VETERAN QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
};
waitUntil {uiSleep 0.05; !isNil "_result" };
Result will always be nil here because its defined in deeper scope
So your waitUntil never completes
Yes. private["_object", "_result", "_level"]; are at the very top of this.
Alright then
_flag is not because it calls another function and needs to be used elsewhere in order to define it
0 spawn {
private ["_result"];
_level = random 10;
if (_level <= 5) then {
_result = ["ONLY ASK NEWBIE QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
}
else {
_result = ["ONLY ASK VETERAN QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
};
waitUntil {uiSleep 0.05; !isNil "_result" };
systemChat str ["_result", _result];
};
```execute this in debug console, it works as it should
means you have another script or something that does the question prompt again
private _result = if (_level <= 5) then {
["ONLY ASK NEWBIE QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
}
else {
["ONLY ASK VETERAN QUESTION", "Confirm", "Yes", "Nah"] call BIS_fnc_guiMessage;
};
```you can setup your assignment like this btw
Correct, it works as it should. That is why I am confused lol. I don't know why else that prompt would run a second time seeing as this function is the only place that it is used.
If you see RPT line of "My question function" just once, yet you have 2 prompts, means another prompt is from another script
Unless there is something else in the function that you didn't post
I understand and agree with what you are saying. I am just stumped as to how that is even possible. Any tips on trying to set up a breadcrumb to even begin to track that down?
....
LOL
I think I found it out, one sec....
If this is right, I am done for the night.
Jesus fucking christ...I can't believe that was the problem. π I somehow copied and pasted it a few lines above by mistake so it was running twice. I just didn't see it because it was much further up.
I was stuck on that for like an hour before bringing it here. Too much time coding today. Starting to make ridiculous and embarrasing mistakes after so many hours. π Thanks for walking my dumbass through it either way @meager granite π»
Glad you figured it out
Me too. Now to hide under a rock. π
It happens when it happens! π
disablecollisionwith is an underwhelming command
the need is often "disable collision with everything" , and the available tool is "disable collision with 1 thing"
my guess is that "attachto" and "disablecollisionwith" are quite similar
you cant have A attachTo [B] and A attachTo [C] at the same time
nor can you have A disablecollisionwith B and A disableCollisionwith C
simultaneously
Didn't it work when you did B A and C A?
basically swap arguments
I think it was something like each object can store one object they're not colliding with or something
So if you wanted to stop A from colliding with B and C, you set A to both of these objects, not B and C to A
isn't disableCollisionWith symmetric? Let me actually check.
example 3 in doc says it is
Guess my info is wrong then
testing seems to confirm π€·ββοΈ Still doesn't allow for any kind of many-to-many raltions
yea best to view it as a little sister of "attachto"
@still forum Have you even looked into volumetric clouds in the game? I wonder how difficult it would be to have them identical between different players? I know that TrueSky was designed to be synced in multiplayer, but I wonder what goes wrong in Arma 3 with it.
Is it some kind of random number generator with different seed between clients? Is it bound to some internal timer that's different between clients?
Not sure how much work is it to debug it, but if its fixable, it will be a huge boost to immersion
arent the clouds another company
They are, but I wonder if something wrong is being fed into them from Arma 3 side so they're not network synced.
Because TrueSky is supposed to be multiplayer compatible and produce same clouds
i use simulweathersync locally at sneaky moments to keep client cloud cover sorta synced. never considered global synced cloud cover tho
lets see what dedmen thinks
That was the first thing I noticed when I player Arma 3 the first time, clouds were different between players
Huge immersion breaker for me
noticable when testing with 2 clients in loopback mode i agree
simulweathersync locally helps altho it has a stutter so you need to pick right moments to use it
It doesn't produce same cloud coverage, my guess is that procedural cloud generation depends on something that isn't network-synced
Like some arbitrary "center" position, or some seed value or some timer, idk.
Knowing that TrueSky was made to be net-synced, it might be fixable in Arma 3
Needing alive depends on what kind of missions you mainly play :P
no, seen it on the side but never looked at it.
Never actually noticed they are different in MP, "huge boost to immersion" is.... quite relative..
I don't look at clouds, and neither do the people I play with
Well, maybe not huge, clouds could be used as reference when spotting, if they were identical between players. I wanted to do that many times in multiplayer myself.
Making it rain only if you're directly under a cloud could also be a thing, but you'll end up with 2 players near each other with one having a cloud above and the other not, would be an immersion breaker as well.
could be a thing but isn't and won't be
Not talking about it being engine thing, I wanted to script that when I saw these cloud position check commands.
Dwarden mentioned something about clouds shadows at one point π
There are clouds shadows!
In Reforger π€

Hi, I was wondering if anyone could help me.
In my fn_assignZeus.sqf I have this bit of code:
params [
["_unit",objNull,[objNull]]
];
private _uid = getPlayerUID _unit;
private _zeusVariable = format ["zeus_%1",_uid];
private _zeus = missionNamespace getVariable [_zeusVariable,objNull];
if (isNull _zeus) then {
private _group = createGroup [sideLogic,true];
_zeus = _group createUnit ["ModuleCurator_F",[0,0,0],[],0,"NONE"];
missionNamespace setVariable [_zeusVariable,_zeus];
_zeus setVariable ["owner",_uid,true];
_zeus setVariable ["Addons",3,true];
_zeus setVariable ["BIS_fnc_initModules_disableAutoActivation",false];
private _missionObjects = entities "Man";
_zeus addCuratorEditableObjects [_missionObjects,true];
_unit assignCurator _zeus;
if !(SS_isZenEnabled) then {
_zeus addEventHandler ["Local",{SS_fnc_zeusLocalityChanged}];
};
["Admin Permissions granted.", player] call SS_fnc_notify;
};
private _adminMenu = [
"adminMenu",
"Admin Menu",
"\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\armor_ca.paa",
{[] remoteExecCall ["SS_fnc_commandMenu",2]},
{true}
] call ace_interact_menu_fnc_createAction;
[player,1,["ACE_SelfActions"],_adminMenu] call ace_interact_menu_fnc_addActionToObject;
Which is being called from initPlayerLocal.sqf through this bit of code:
if (profilename in ["SiegeSix"]) then {
[player] remoteExecCall ["SS_fnc_assignZeus",2];
};
The issue I have is that when loading initially, I'll have access to zeus and the admin menu. When i respawn, I only have the admin menu, yet I don't have zeus access anymore. For info, I have ZEN loaded and the fn_zeusLocalityChanged.sqf looks like this:
params ["_zeus","_local"];
if !(_local) then {
private _unit = getAssignedCuratorUnit _zeus;
if (getAssignedCuratorLogic _unit isNotEqualTo _zeus) then {
unassignCurator _zeus;
[
{
params ["_zeus"];
isNull getAssignedCuratorUnit _zeus
},
{
params ["_zeus","_unit"];
_unit assignCurator _zeus;
},
[_zeus,_unit]
] call CBA_fnc_waitUntilAndExecute;
};
};
and the public variable SS_isZenEnabled is drawn from initServer.sqf
SS_isZenEnabled = isClass (configFile >> "CfgPatches" >> "zen_main");
_zeus addEventHandler ["Local",{SS_fnc_zeusLocalityChanged}]; // nothing happens, you just throw in a function code without calling it
// pick your poison
_zeus addEventHandler ["Local", { call SS_fnc_zeusLocalityChanged }];
_zeus addEventHandler ["Local", { _this call SS_fnc_zeusLocalityChanged }];
Neither seems to work
that may not be the problem, just raising this issue
and I suppose the EH is only added server-side
seems to be called from disregard me it's remoteExec'dinitPlayerLocal though
if !(SS_isZenEnabled) then { may also misbehave is SS_isZenEnabled is nil (isn't defined)
Not sure if there's a question here
Good call
https://community.bistudio.com/wiki/UAVControl
[player1, "DRIVER", player2, "GUNNER"] - player1 is controlling the UAV and is the pilot, player2 is controlling UAV and is the gunner
```How can two players control different UAV units in same UAV vehicle? UAV Terminal doesn't let you connect to a vehicle that's already connected to by another player.
Unless this is for script-connected cases?
Trying connectTerminalToUAV to connect second player, returns true yet its not connected
Oh, you must do direct control with remoteControl command, UAV terminal doesn't allow two players controlling same UAV
More reason to ditch it and script my own
hi, i'm trying to add a sound when a player die but i can't do it with all the scrip i find, how can i do it?.
The script i use is:
in description.ext
class CfgSounds
{
sounds[] = {};
class music
{
name = "music";
sound[] = {"sound\music.ogg", 1,1};
titles[] = {};
};
};
and i try calling it via a sqf or just calling it in game but it doesn't work
Could try looking at Killed event handler?
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
}];
i try calling it via a sqf or just calling it in game but it doesn't work
explain exactly what you do. just saying "it doesn't work" is meaningless
at the start it didn't recognise "music" either as the sound (music.ogg) or the string but now it recognize both but doesn't play the sound, i tried to play the sound with playSound "music" with a sqf that detect when a player is dead and inside the game i try a trigger and the console but nothing work, the sound never reproduced even detecting the .ogg
Try \sound\music.ogg path?
note the back slash \ at the beginning
Also make sure you reload the mission in editor after you change description.ext so changes apply
why should they? they modify it by ref
Why shouldn't they?
Will let you chain it like _array append _array2 append _array3 for example
people.like(javascript-style).method(chaining) π€£
put down a player in editor, run the mission and then try this:
playSound3D ["sound\music.ogg", player]
if it doesn't work either it means something could be wrong with your ogg file
Not just for the sake of chaining of course.
Currently writing this piece of code:
private _crew = if(unitIsUAV _vehicle) then {
(UAVControl _vehicle select {_x isEqualType objNull})
+ (crew _vehicle select {_x call is_not_a_uav_unit && alive _x})
} else {
crew _vehicle select {alive _x}
};
```All fine expect one edge case where same player can be both passenger and controlling the UAV.
So you end up with _crew having 2 of the same unit
I'd make it:
(UAVControl _vehicle select {_x isEqualType objNull})
insert [-1, crew _vehicle select {_x call is_not_a_uav_unit && alive _x}, true]
```(`array insert [index, valuesToInsert, onlyIfUnique]`) but `insert` doesn't return and I have to declare another local variable
If there was appendUnique but it probably wouldn't return the array either
Thus my frustration
Muh microseconds
Its map's Draw event so I'm trying to squeeze as much ms as possible
you're doing all that select and array creation and you're worried about defining a local var?!
π
Wish there was something like liveCrew to return alive and non-UAV crew in one command 
and it seems you'd get objNull in your array if your UAV isn't currently controlled by a player
microsec alone is not important. what percent of the total operation is what matters
Oh shiz, true, thought it would be empty array 
Great idea to return mixed type values in same array, thanks Arma, very cool
change your select code to alive _x && is_not_a_uav_unit and use _x instead of _this in that function and it'll give you 3x more us than not defining a local var would give you 
and that's 3x per iteration
inb4 #define-ing the is_not_a_uav_unit to allow reusing while not creating extra scope in runtime
Most checks will be run against UAV units and that condition will return false most of the time
There are players in UAVs very rarely
But good idea nonetheless
Waiting for this fix to happen: https://feedback.bistudio.com/T170425
either way you won't lose anything
in case you've forgotten, sqf && (|| too) is not lazy. when you run call _a && call _b both will always run
so you would call the function and your alive check would run too
with that change at least the function call is lazy
also the call now omits _x and implicit definition of _this so those 2 will save perf too. and call is removed too. so altogether you get at least ~3x more us than skipped local var def. if the unit is not alive the function call is skipped completely and you get many more us
if(!isNil"uav") then {deleteVehicle uav};
uav = createVehicle ["B_UGV_01_rcws_F", getPos player, [], 10, ""];
createVehicleCrew uav;
is_not_a_uav_unit_cache = createHashMap;
is_not_a_uav_unit = {
private _not_uav = is_not_a_uav_unit_cache get typeOf _this;
if(isNil"_not_uav") then {
_not_uav = getText(configFile >> "CfgVehicles" >> typeOf _this >> "simulation") != "UAVPilot";
is_not_a_uav_unit_cache set [typeOf _this, _not_uav];
};
_not_uav
};
is_not_a_uav_unit2 = {
private _not_uav = is_not_a_uav_unit_cache get typeOf _x;
if(isNil"_not_uav") then {
_not_uav = getText(configFile >> "CfgVehicles" >> typeOf _x >> "simulation") != "UAVPilot";
is_not_a_uav_unit_cache set [typeOf _x, _not_uav];
};
_not_uav
};
[
diag_codePerformance [{
crew uav select {_x call is_not_a_uav_unit && {alive _x}}
}]
,diag_codePerformance [{
crew uav select {_x call is_not_a_uav_unit && alive _x}
}]
,diag_codePerformance [{
crew uav select {alive _x && is_not_a_uav_unit2}
}]
]
```=> `[[0.00404,100000],[0.00406,100000],[0.00372,100000]]`
Indeed, a small performance gain
it's roughly ~9% faster
These guys shaving off a percent of a percent of a ms, meanwhile I'm here defining variables like I'm a thrift store
is it possible to use createSimpleObject object with FX classes and it works in a meaningful way? or is createVehicle[Local] a must with FX?
or weaponholders
yes they need createVehicle
what's an FX class?
_light = "#lightpoint" createVehicle _centerPos;
_lowCloud = "#particlesource" createVehicleLocal (getPos (vehicle player));
_fire = "Land_LIB_FX_Big_Fire" createvehicle [0,0,0]; //cfgVehicle - type house. dummy object with initEH
_smokegrenade = "LIB_NBKS39" createVehicleLocal [0,0,0];//cfgAmmo
that too
can simpleObjects move at all?
no
i'd say it depends on definition of "move" π€·ββοΈ You can setPos* them. You can set the animation phase. If you're willing to negate most of its performance benefit - you can, say, animate them per-frame or something
They will also move if attached to something
I'm sure he just meant normal movement (e.g fall, etc.)
otherwise any object can "move" in those terms
well, i myself found the "animate needs instant flag set to true" part less-than-obvious at point, so i decided to mention it here π€·ββοΈ
Is there any way to increase the update frequency of an object that anyone knows of
the static objects for example have really long update frequency, if that's what is meant here
Attached objects inherit the simulation rate of the object they're attached to. Obviously that can cause other problems, though.
just looking into perf optimizations from replacing createVehicleLocal if possible
Yeah that is what is meant here. Looks like crap when I'm attaching to a static object that is meant to be moving π
Sorry I didn't clarify mb
why is loading map with many static objects so slow? i once put walls around a town and loading took really long. but why, they are just static objects
in your own mission? static objects shouldnt increase load time too much
but they do...
there are systems out there which spawn objects slowly and hold the loading screen up until the spawning is done
Anyone have any clue as to why this doesn't work? It spawns and adds the item but it doesn't act as an item. I can only pick it up right kinda if I use inventory and drag it but it doesn't take up space and I can't use it. Also if I pick it up like most people by hand it doesn't go in my inventory and drops the next item I pick up
private _holder = createVehicle ["GroundWeaponHolder", _relPos, [], 0, "CAN_COLLIDE"];
_holder setDir (random 360);
_holder addWeaponCargoGlobal [_classname,_amount];
try GroundWeaponHolder_Scripted
is there a command to get 3d unit direction
vectorDir
Hello, I have a little problem, I need your help.
Let me explain. I want in my scenario to have a trigger that "Triggers an ambient sound for all players in all the game. And that this via another trigger can be deactivated.
My ambient theme is an ambient noise of war. Something normal audible from everywhere without having a specific distance.
You will probably tell me "There are videos" but the problem is that no matter how much I do as in the "Videos" it's never what I'm looking for". Would you have a solution, help?
have you made the sound already?
in CfgSounds?
@little raptor I'm having trouble understanding what I should do to create a cfgsound, and how it should be linked. If it is txt, sqf, etc... This is my first time using this
you need to make an ogg file. then put it in your mission folder (you can put it in a subfolder if you want)
next you must create a description.ext file in the root of your mission folder and add a CfgSounds class to it like this:
https://community.bistudio.com/wiki/Description.ext#CfgSounds
@little raptor Okay, lets go I tell you that again
@little raptor compared to that in my description.txt I put it or that? How do I place it in relation to that?
respawnOnStart = -1;```
{
sounds[] = {};
class wolf1
{
// how the sound is referred to in the editor (e.g. trigger effects)
name = "my_wolf_sound";
// filename, volume, pitch, distance (optional)
sound[] = { "fx\wolf1.ogg", 1, 1, 100 };
// subtitle delay in seconds, subtitle text
titles[] = { 1, "*wolf growls*" };
};```
don't use google translate on that page...
the config must be exactly like that page
you're translating it
so it won't work
oh yeah, sorry π
yes it's in basic english, it was just me to know what was written lol
this @little raptor my respawndelay, where do I place it?
anyway, let's say you want to add a "war sound" as you said. put your ogg file in sounds\warsound.ogg in your mission folder
respawnDelay = 10;
respawnOnStart = -1;
class CfgSounds
{
sounds[] = {};
class myWarSound
{
// how the sound is referred to in the editor (e.g. trigger effects)
name = "War sound";
// filename, volume, pitch, distance (optional)
sound[] = { "sounds\ambience1.ogg", 1, 1, 100 };
titles[] = {};
};
};
It needs to be description.ext, not description.txt
I have this in my "Beginning" scenario file.
remove the txt file
in the .ext my respawndelay is there.
change your ext file like this
Okay, so what next?
updated this to match your folder
in your sounds folder add your warsound.ogg file
Iβve tried that as well before but it didnβt work
Then I have to know how and where to place the CfgSounds without it blocking my respawndelay, line 1 and 2 @little raptor
I showed you that a hundred times
here
Ah, as much for me I had not seen, sorry.
@little raptor then, in game, how do I make it from a trigger activated by the players it can be audible until having reached another trigger for example or not and deactivated or not.
copy this again. fixed that error
Its done !!!
does it play the sound?
Which line should I touch to increase, decrease the volume?
Yes ! π
to have a good sound, audible without being too loud, how much could I set it to for a war atmosphere like this?
That depends on the sound file. The volume the sound is recorded at, in the sound file itself, also affects the volume. You'll have to figure that out yourself, by trying it and listening to the results.
okay π
Is there a maximum for the setting? or else an infinite number until killing the ears π
@hallow mortar
I have no idea.
okay
Hello everyone. I'm trying to work on a SIGINT type mod. To preface, this entire script could be 100% wrong but I'm still learning. I keep getting a missing ) for the following when trying to execute in game:
private _radius = 1000;
private _units = [];
forEach (allUnits inArea (position Ant_Collect_Deployed), _radius) {
if (side _x in [west, east, independent, civilian]) then {
_units pushBack _x;
};
};
private _blufor_units = _units select {side _x == west};
private _opfor_units = _units select {side _x == east};
private _indep_units = _units select {side _x == independent};
private _civilian_units = _units select {side _x == civilian};
// Clear existing markers
{
if (typeName _x == "STRING" && _x call BIS_fnc_inString && (markerType _x) == "mil_dot") then {deleteMarker _x;};
} forEach allMapMarkers;
// Add new markers for detected groups
{
private _marker_color = switch(side _x) do {
case west: { "ColorBlue" };
case east: { "ColorRed" };
case independent: { "ColorGreen" };
case civilian: { "ColorViolet" };
};
private _marker = createMarker ["", position _x, _marker_color];
_marker setMarkerType "mil_dot"; // Set the marker type to a circle
_marker setMarkerSize 100; // Set the size of the circle
} forEach _units;
// Schedule another sweep in 30 seconds
[] spawn {
sleep 30;
if (!isNull findDisplay 46) then {
[] spawn {call compile preprocessFileLineNumbers "sigint_sweep.sqf";};
};
};```
Any ideas?
oof sorry for the wall
Thanks for your help both of you! I'll make way for my next problem when I have one, surely soon π @hallow mortar @little raptor
your first forEach is backwards
LOL
{
if (typeName _x == "STRING" && _x call BIS_fnc_inString && (markerType _x) == "mil_dot") then {deleteMarker _x;};
};``` This or wouold the forEach be inside the braces with the rest?
That's not the first forEach
if (side _x in [west, east, independent, civilian]) then {
_units pushBack _x;
};
};``` Ah so that to this? ```{
if (side _x in [west, east, independent, civilian]) then {
_units pushBack _x;
};
forEach (allUnits inArea (position Ant_Collect_Deployed), _radius)
};```
Almost. Remember, forEach goes { code } forEach _array.
{
if (side _x in [west, east, independent, civilian]) then {
_units pushBack _x;
};
} forEach // ....BUT WAIT!```
The way you're trying to generate the initial list of units (that stuff with `allUnits`) is also wrong. `allUnits` is an array of units. `inArea` doesn't accept an array, so you can't use it like that. And the syntax is wrong where you're trying to throw in a radius parameter as well.
typename check is useless, as allMapMarkers only return s strings.
BIS_fnc_inString takes more than one argument, you are only giving it one, also you can just use the in command if you want to check if a string contains another string (thats what BIS_fnc_inString does)
The first forEach can be replaced entirely with this:
_units = (allUnits inAreaArray [Ant_Collect_Deployed,_radius,_radius]);```
doArtilleryFire is very unreliable. sometimes the position that is targeted is wrong and sometimes and it just looks in the direction for a moment, then goes back.
Are there functions similar to linearConversion, only to be able to specify arrays of values from which to choose an approximate number?
@hallow mortar I have this displayed but I don't know why, I added a sound in the + file, it works but I have this nonetheless.
{
sounds[] = {1};
class myWarSound
{
// how the sound is referred to in the editor (e.g. trigger effects)
name = "War sound";
// filename, volume, pitch, distance (optional)
sound[] = { "sounds\ambience1.ogg", 5, 1, 100 };
titles[] = {};
}; |LINE 14|
sounds[] = {2};
class myLandingSound
{
// how the sound is referred to in the editor (e.g. trigger effects)
name = "Landing sound";
// filename, volume, pitch, distance (optional)
sound[] = { "sounds\landing.ogg", 4, 1, 100 };
titles[] = {};
};
};```
Remove sounds[] = {2};, it's unnecessary. sounds[] = {1}; is wrong, replace it with sounds[] = {};
ok
You don't need a sounds[] = {}; for every entry in CfgSounds. It's a single thing that only exists once in all of cfgSounds.
ok, so I have to delete what and on which line to add as many sounds as I want on the same document here?
I have change
When I said remove sounds[] = {2}; I meant remove it. Do not have that line.
Yes
You still need the first sounds[] = {}; at the start, but only that one, and without modification. There can only be one of those in all of CfgSounds, and that's all it needs to be.
ok
and suddenly the problem of the 3 Line 14 "of the screen above, what is it?
Ah, I just understood, that was it, like what he tells me that there is already 1 suddenly.
That error was caused by the line you've just removed. You had two of that line, and that's not allowed. I think if you test it now, you'll find the error is gone.
i go test
@hallow mortar its good for me π
@hallow mortar Another important question. The first sounds, "War Ambient". I want them to be permanent as long as there is no trigger that deactivates it, activates it.
Haha, lots of questions... π
because the first sound lasts around "4 minutes" but I think it will stop one moment or another after this time... I wish that it repeats itself as long as they have not not been deactivate.
What is the trigger condition?
I'm thinking
// In this trigger
azul_var_doSound = true;
while {azul_var_doSound} do {
azul_var_soundSource = playSound "myWarSound";
sleep 240; // Change this number to the actual length of the sound, in seconds.
};
// In the other trigger, to stop it
azul_var_doSound = false;
deleteVehicle azul_var_soundSource;```
When the trigger is activated, this creates a loop, and sets a variable to `true`. The loop plays the sound, and saves the sound source object as another variable. It then waits for the duration of the sound to finish. Then it does it again. It does this as long as that first variable is `true`.
Your other trigger, to stop the sound, sets the first variable to `false`, which stops the loop. It also deletes the sound source object, which stops the sound that's currently playing, without waiting for it to play all the way through.
It's the name of a variable. It's good to put your name on variables to make them unique, so they don't get overwritten by other scripts using the same variable names.
Oh ok, and so I put it like this? :Wait
just that and it's good, it repeats ad infinitum until the other variable is set to "False". ?
Yes. Make sure to change the sleep 240; to use the actual length of the sound file in seconds. It's probably not exactly 240 seconds long, that was just a guess.
If you only set the variable to false, the sound that's currently playing will continue to play until it reaches the end. For example, if your sound is 240 seconds long, and you stop it 200 seconds into the current loop, it will keep playing for the remaining 40 seconds. It won't start the next loop, though.
The part with deleteVehicle is what stops it immediately instead of letting it finish the current loop.
π€¦ that's my mistake. I always forget.
ahah Don't worry
azul_var_doSound = true;
[] spawn {
while {azul_var_doSound} do {
azul_var_soundSource = playSound "myWarSound";
sleep 286;
};
};```
Trigger code runs in what's called an "unscheduled" environment. This means the code is done _right now_, without any consideration for what other code wants to do. In this case, you can't have pauses like `sleep`, because you'd freeze the entire game. You have to use `spawn` to create a "scheduled" environment, which lets the game manage how the code is executed.
however when it triggers, so any player can trigger it. But is it specific to the player or is it for example activating and deactivating for everyone at the same time even if they are not in the trigger.
This trigger uses Any player present activation, so it will activate whenever any player enters the trigger, even if that's not you.
If you want it to be player-specific, try changing the Condition field from this to player in thisList.
Keep the Activation drop-down set to "Any player" or "Anyone". Apart from that, yes.
ok
We don't want to actually use the "Any player" or "Anyone" condition itself. That was what having this in the Condition field did. However, we still need the information it would use to detect whether that condition was true, which is contained in the thisList reference. Setting that dropdown tells the trigger to provide that information.
All right
I go test, the first and 2nd trigger
Actually, about that second trigger - does it basically just stop the sound if the player isn't in the area any more? If so, it's possible to bring all of this into the one trigger.
So, I put the "Player in thisList" and set it to "Anyone" - Present. But nothing happens...
I think I misunderstood.
I see it later, I haven't seen it yet
That's all correct. You might need to exit the Editor (save the mission first!) and open it again. The game doesn't always detect new sound files straight away.
I watch, wait


