#arma3_scripting
1 messages ยท Page 108 of 1

First, Is this THE Sa-Matra?
oh lol it was instantly suggested
Yup
Sorry for not reading the whole thing before replying 
You're good
Oh, big fan
Anyways, yeah If thats the only way ig ill run that
So, just some invis obj should do yea?
Yeah, game logic should do
Logic is the simplest one, but I'm not sure how well it will work. Attached objects inherit simulation rate of whatever they're attached to, but I guess it might not be relevant for inventory actions?
As long as it cant be pushed, or airlifted and can still be opened.
I don't think it'll affect much
Ill give it a try, thanks lads!
Just tested it and it works, except crate no longer a physx object, so other object pass through it (vehicles), but not units.
Could that be fixed by adding a invis object with physics inside of the crate?
Yeah, probably
Sweet, thanks!
Also logic is unit, you can createAgent it or use another basic object, I'd suggest HeliH but that's a helipad that AI can use, not sure if its a good idea.
UserTexture1m_F or something perhaps
Building seem to be very basic too
Good idea with the building - ill spawn it in right on the crate, Im doing everything inside SQF so my script is as plug and play as possible. Ill read up on making logic units!
Got curious and tested it, you can hook the crate but it won't move anywhere
You can use enableRopeAttach to stop the action
Thats definitely gonna come in handy in the future, didn't know it existed
More I do the more impressed I am with SQFs functions
Wait till you encounter that something seemingly basic is impossible or require huge crutches and workarounds 
Actually attaching a crate to an invisible object is already a such workaround
Ohh yeea, I already had some run ins with that. Locality and addActions was a big pain in the ass for me. Luckily @stable dune was a big help
Im at the point where I spend 1 hour going through the links in Additional info whenever I find a new function so I dont try to make workarounds for things I dont need
Back when I started I opened this: https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands (but for OA) and went through every command and having a quick read just to get an idea what commands exist at all
Perfect reading when curled up in bed during a storm

how would i make all unit look at players on a dedicated server. i tried different things with doWatch in a loop, but no succeess. its just for immersion
Post your code
Also try glanceAt and lookAt
or just setdir
Not sure how MP-compatible these commands are though
Knowing Arma they might be completely local
Is there an alternative for quickly creating smoke emitters apart from BIS_fnc_moduleEffectsSmoke?
i have a file called "version.inc" in the root of my mission, and i want to #include it from a script in a folder called "functions"
what would be the path?
if i put the wrong path the game crashes for some reason
#include "..\version.inc"
you have to go one directory back
how do you mean?
You can consider adding your own ui like this mod does https://steamcommunity.com/sharedfiles/filedetails/?id=1631723641
Is there anyway to set the fromObject when using ropeCreate on an object which isn't under the transport class?
no. it has to be transport
You can potentially use a helper object for rope start, and attach it where you need to. ace fastrope helper can be handy.
Yeah, that is what I was thinking. Using an invisible base object from CBA
When scripting a module, how do I access synced objects?
do you have classname for that
save me 30 seconds of github looking up im not supposed to be touching github im on a break
ace_fastroping_helper
I have a general question for looking up a variable. How should i find variables like Cba_missionTime or Ace_Player, or Ace_mainActions Where are those types of variables stored ?
Unintentional reply? anyway, those are just global variables. (probably not ace_mainActions tho)
allVariables missionNamespace https://community.bistudio.com/wiki/allVariables
Ok and is there a way to make this somehow to look all global variables from a certiann mod ?
Filter for mod tag in variable name.
Oh nice thank you very much.
Hi guys, I'm currently working on a script which should mark certain players from one side on the map. I have the part with the marking already done but am now facing a problem how to identify which player is from which faction and triggered the script. Accordingly, another part of the script should be triggered.
For example:
If a player from Bluefor has triggered the scirpt, the part which marks the Opfor players will be triggered.
Of course the same should work the other way around.
Do you have an idea how I can determine the side which triggered the script and execute a this or that function?
Thanks for your help ๐
Check the side with the side command. see Example 1 here https://community.bistudio.com/wiki/side
Thanks. How can I define the part that is executed when the statement is not true?
else command https://community.bistudio.com/wiki/else
Or a separate if for each side for which you want to do different things.
okay perfect. Thanks
Can someone explain to me why
["CAManBase", "Reloaded", {
params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
//if (isPlayer _unit) exitWith {};
_oldMagazine params ["", ["_roundsLeftold", -1, [0]]];
systemChat format ["_roundsleftold: %1", _roundsLeftold];
}, true, [], true] call CBA_fnc_addClassEventHandler;
prints out _roundsleftold: any?
to me any is not a number so it should use the default -1 ,no?
https://community.bistudio.com/wiki/Anything I guess any can be of type number...
well, luckily any > 0 returns false, so I'll just go with it ๐
can reproduce when loading from empty mag empty weapon, no old mag 
_oldMagazine seems to be not present at all when doing that 
yup, I've tried it with rocket launcher, the RPG-7V2 from RHS
guess makes sense, at type of reload the shooting has happened so there's nothing in the launcher
me and my wording. "Empty" as in "no mag in weapon", sorry for confusion
ah right, yeah so same basis
what is a faster read operation?
- Reading from missionConfig
- Reading from missionNamespace variable
namespace
I think I'm going in the right direction, just having trouble pulling the information for the missiles now. I'm using the RHS Apache, when I put in the command to pull weapon firemodes (hint str (getArray (configFile >> "CfgWeapons" >> currentWeapon player >> "modes"));) it only seems to be giving me information for the main gun and not the missiles. I also tried DenV's code here: https://community.bistudio.com/wiki/weaponsTurret, but it still doesn't tell me anything about the missiles
try weaponState vehicle turret syntax
can i find anywhere in the config the DLC icons?
CfgVehicles entries provide DLC names but not the icons
CfgMods
Just a quick question will the contact scripts be available for the base game in the future?
files in "contact" folder will not be added to basegame no. They will stay as separately loaded
Thank you so much!
Just curious if configfile / missionconfigfile is also blocking or if its just configclasses
another question, how would i go retrieving all armed aircraft (planes, helis and drones) in the games?
i found this from someone's mission but this doesn't include drones and some aircraft like kajman and buzzard, any idea why?
("(configName(_x) isKindOf 'Air') && (getNumber(_x >> 'scope') == 2)") configClasses (configFile >> "Cfgvehicles")
Kajman and Buzzard are both scope 2 and kindOf air, so they should be returned by that if it works at all.
Bear in mind this is returning an array of data type Configs, not an array of data type Strings (classnames), which might be affecting whatever you're trying to do with it.
maybe i'm doing something wrong in my code:
{
private _weapcount = count getArray (_x >> "weapons");
private _currentVeh = _x;
{
if (_x isKindOf ["SmokeLauncher", configFile >> "Cfgweapons"]) then {
_weapcount = _weapcount - 1;
};
} forEach (getArray( _x >> "weapons"));
if (_weapcount > 0) then {
private _category = "";
if (toLower getText(_currentVeh >> "vehicleClass") != "autonomous") then {
if (["plane", toLower getText(_currentVeh >> "simulation")] call BIS_fnc_inString) then {
_category = "Planes";
} else {
_category = "Helicopters";
};
} else { _category = "Drones" };
(aircraft get _category) pushBack (configName _currentVeh);
};
} forEach (("(configName(_x) isKindOf 'Air') && (getNumber(_x >> 'scope') == 2)") configClasses (configFile >> "Cfgvehicles"));
(sorry for indent)
basically it just takes that array of configs and sort them as strings in a hashmap looking like this
i'm not sure what the smoke launcher part does (and why is it even useful when working with aircraft?), again i just tweaked someone else's code
This isn't the issue, but you don't need those toLowers; != and BIS_fnc_inString (by default) aren't case sensitive
ah, thank you
The smoke launcher check is reducing the weapon count by 1 if the weapon it's checking against is a smoke launcher, so that weapon doesn't count for the final total. This is probably so that vehicles with only smoke launchers aren't counted as "armed".
(Aircraft countermeasures launchers are kindOf SmokeLauncher, so this should work for both air and ground)

wtf arma
thanks for the explanation
They both work in fundamentally the same way, so one inherits from the other to save having duplicate implementations of the basic functionality. isKindOf checks the full inheritance tree.
well it'd be more intuitive if it was called "Countermeasure" or something like that
maybe flares weren't a thing when they added smoke launchers, idk?
That seems quite likely.
How significant is the difference?
If you dont mind me asking, here is my scenario. Im asking more so out of curiosity than anything. I already having caching done.
Say I have all this data defined in a config in the mission file. Is it worthwhile exporting the data to namespace variables if its only being read a few times over the course of 2 hours for an individual player?
In my scenario, I have a faction with multiple loadouts defined for it (this is for a custom loadout script). The only time the data needs read is on mission start when players are assigned loadouts, whenever a player goes to view loadouts to change their loadout, and whenever a player changes their loadout.
Caching takes like 30 seconds to script
Saves performance
You can measure the difference in debug console
this addaction ["Get In",{(_this select 1) setpos [markerPos "exit1" select 0, markerPos "exit1" select 1, 0]}];
How would i add the radius parameter to this script?
I'd like for the addaction to only be avaliable for when you are within 5 meters.
Like so:
this addAction
["Get In",{
params ["_target", "_caller", "_actionId","_arguments"];
private _getMarker = getMarkerPos "exit1";
_caller setpos [_getMarker select 0, _getMarker select 1, 0];
},
nil,
1.5,
true,
true,
"",
"true",
5,
false,
"",
""
];```Also i cleandup a bit of your code.
Thankyou! Do i have to always add in the other parameters?
You dont have to you can take it out and instead of caller just put _this select 1 if you want
this addAction
["Get In",{
private _getMarker = getMarkerPos "exit1";
(_this select 1) setpos [_getMarker select 0, _getMarker select 1, 0];
},
nil,
1.5,
true,
true,
"",
"true",
5,
false,
"",
""
];```
Thankyou! Just curious as Im still fairly new to sqf and scripting in general. What was messy about it in the first place?
Its just for you so you can read it better. You can do it how ever you want.
But in my example i saved marker position in variable so i can use it in setpos and if need bee i can use it somewhere else but with your. You basicly are calling 2 times getmarkerpos when its only needed once.
Gotcha thankyou!
_playerClose = [];
_markerpos = getMarkerPos "Solo_Arena_Area";
{
if ((_x distance _markerpos) < 80) then
{
_playerClose pushback _x;
};
} foreach allPlayers;
_nearplayercount = count _playerClose;
try
{
if (_nearplayercount > 1) then
{
throw "Reduce Total Number of Players in Arena to 1";
};
};
Does this make sense, I can't test multiplayer on my test server.
So what are you trying to do with players in radius of marker ?
kick back and stop the script if more than 1 players is near the marker
using the throw
try this myb:
private _markerPos = getmarkerPos "Solo_Arena_Area";
private _nearPlayers = allPlayers select {_x distance2D _markerPos < 80};
if(count _nearPlayers > 1) exitwith {
systemChat "Reduce Total Number of Players in Arena to 1";
};
im trying to get this simple script to spawn a vehicle with an add action but its not working
any ideas
this addAction createVehicle _Dos_Drop_Pod = "Spawn Drop pod" getMarkerPos "pad1";
you're trying to apply the addaction to the vehicle or the addaction creates the vehicle
add action creates the vehicle
i was trying to be clever ive seen this teleport script before that has an interact and thought i could just use that to do vehicles but apparently not
_Variable, //Thing that you want to apply the addaction to
[
"Spawn Vehicle", //Text
{//Script
Your Vehicle creation Script
},
nil, //Arguments
1, //Priority
true, //showWindow
true, //hideOnUse
"", //shortcut
"true", //condition
10 // Radius for addaction to show
]
so i could do this for any item?
i was trying to add this to a computer terminal
so the players interact with the terminal to get the vehicle
the _variable has to be an object assigned to that variable
oh so it can be anything then
yes
where do i define what vehicle i want to spawn though?
You can do it like this:
this addAction ["Create Vehicle", {
private _veh = createVehicle ["Class_Name_Vehicle", getMarkerPos "pad1",[],0,"None"];
}nil,1.5,true,true,"","true",10,false,"",""];
``` All you need to do is copy the class name of a vehicle and put it between "" next to CreateVehicle.
seems easy enough
so to be clear like this
this addAction ["Create Vehicle", {
private _veh = createVehicle "Dos_Drop_Pod" ["Class_Name_Vehicle", getMarkerPos "pad1",[],0,"None"];
}nil,1.5,true,true,"","true",10,false,"",""];```
??
Yea that should work if the class name is correct.
actuall no
Where you see Class_Name_Vehicle instead of that you want to put
Dos_Drop_Pod so like this:
this addAction ["Create Vehicle", {
private _veh = createVehicle ["Dos_Drop_Pod", getMarkerPos "pad1",[],0,"None"];
}nil,1.5,true,true,"","true",10,false,"",""];
chucking up errors
class name is the bottom one right?
There's no comma after the }
private _veh = createVehicle ["Dos_Drop_Pod", getMarkerPos "pad1",[],0,"None"];
},nil,1.5,true,true,"","true",10,false,"",""];```
yea between } and nil is missing comma ,
hmm still not spawning i can interact fine but it does nothing
It should create droppod in the location where marker is. Just so you know it will spawn it on the ground and not flying.
yeah thats what i need so people can walk into it and then choose a landing point
Make sure the marker is named pad1 and not Pad 1 or something like that.
im such a dumbass
its a marker
not an object
heres me wisihing it would appear on this
there we go
@fleet sand @granite sky my thanks amigos it works like a charm
the exitwith didnt work legion, so i defaulted back to the try catch.
try
{
if (_nearplayercount > 0) then
{
throw "Reduce Total Number of Players in Arena to 1";
};
}
catch
{
format ["%1 Gladiator Detected, Beginning Solo Arena", _nearplayercount] remoteExecCall ["systemChat",-2];
};
_nearplayercount with just me in the area is absolutely showing as 1, but I'm getting the catch, where the throw isn't working.
I want it to check the player count in the radius and if its greater than 1, it terminates the code, until the if argument is met
I havent see try catch in SQF to be used in a while but it would be something like this:
[_nearplayercount] try
{
private _NPC = _this select 0;
if (_NPC > 0) then
{
throw "Reduce Total Number of Players in Arena to 1";
};
}
catch
{
[str _exception] remoteExec ["systemChat", [0,-2] select isDedicated];
};
If you want to benchmark scripts. You can benchmark scripts in debug console
Unfortuantely that doesn't work either, with the previous one i put a diaglog inside next to the throw, its going into there, but the throw just isn't working
try
{
if (_nearplayercount > 0) then
{
diag_log "Inside throw";
throw "Reduce Total Number of Players in Arena to 1";
};
}
catch
{
format ["%1 Gladiator Detected, Beginning Solo Arena", _nearplayercount] remoteExecCall ["systemChat",-2];
};
So I'm getting "Inside throw" showing in my server rpt. but the throw isn't displaying or stopping the script
I have a coop mission where my friends command squads by making them squad leaders, making their squad mates playable units, and then having them be ai controlled at the start. Is there a way that I can prevent squad mates from respawning, until a squad leader dies, and then have all of the dead squadmates respawn, adn the alive ones teleport back to the respawn so the squad can be together again? Because what happens is, if one of us moves say 2km from the respawn, then gets in a fight, and half of the squad dies, then half of the squad will be with the squad leader while the other half is over at the respawn, and they have to walk 2km to reconnect with the squad leader. So in a nutshell our squads get split apart from us, their leaders, over time, and i cant come up with a fix
Don't respawn the ai themselves. When players respawn, replace their ai squad mates.
So when i have a friends squadmate die, i sohuld just like spawn one in for them in zeus and connect them to their squad
Well, this is scripting. So consider spawning the AI via a script that runs on respawn.
got a bit of a kerfuffle, after much logging and pulling hairs... addAction, I know for a fact I am getting the action to attach to the object successfully, I have the ID in the log. however, is not appearing in the menu. I wonder if it is a priority collision in the menu why it is not showing, having verified at least one other such action with the same priority?
really perplexing, even something as brain dead as this, not appearing in the action menu and I am looking right at the unit...
_y = cursorobject;
_id = _y getvariable ['my_testid', -1];
_y removeaction _id;
_id = _y addaction ['Test action', { systemchat name (_this#0); }, [], -1000, false, true, '', 'true', 1];
_y setvariable ['my_testid', _id]; // verified _id == 2
Is -1000 even a valid priority?
may got er sorted, possible radius issue
oh yeah, 1m is very short.
pulling my hairs out over it, after biasing the sector pressure, and running out of sectors in which to reasonably verify ๐คฃ
https://community.bistudio.com/wiki/BIS_fnc_playMusic is there anyway to stop a song using this command?, or should one use playsound etc for a music track that can be stopped
or is remotexecuting this command betterhttps://community.bistudio.com/wiki/playMusic ?
BIS_fnc_playMusic is almost certainly using playMusic internally, in which case passing "" as the track class will stop whatever's playing
thank you
question, I am trying to spawn a missile that hits the target, I want it to spawn at random direction from the target, 2 km away, 1 km higher. I know how to get position of the target, but how do I do the whole random part?
[[8132.62,4392.19,1110.44], "ammo_Missile_Cruise_01", mfammotarget1, 180, false, [0,0,0.25]] spawn BIS_fnc_exp_camp_guidedProjectile;
to replace coordinates to say: spawn 2 km away, 1 km higher than mfammotarget1
The spawn at random direction part that alludes me
_position = AGLtoASL (_targetObj getRelPos [2000, random 360]) vectorAdd [0,0,1000];```
- generate a random number between 0 and 360
- use that as a direction for getRelPos with distance 2000
- add 1000 to the Z axis of the resulting position
- convert from AGL as provided by getRelPos, to ASL as required by the function
(Last two might happen in opposite order depending on how the order of precedence shakes out, but the result is the same either way)
Hmm I am getting an error, saying its not a 3d vector
Nvm I found a work around
Is there a smart way of removing a weapon + all compatible magazines from a units loadout?
Something like this probably
{_unit removeMagazines _x} forEach (magazines _unit arrayIntersect compatibleMagazines currentWeapon _unit);
_unit removeWeapon currentWeapon _unit;
compatibleMagazines is exactly the command I've been looking for, thanks!
Sometimes when testing custom single player respawn scripts I end up locked out of the editor. Hitting [Esc] in mission doesn't bring up the menu to allow returning to the Eden editor so I have to kill the Arma3 task and re-launch it.
Anyone know if there is a keyboard shortcut or other way of getting a locked out mission to fall back to the Eden editor?
How can I get the variable name of the unit that the player is controlling? To be precise - I want to do this inside initPlayerLocal.sqf, so the player object is _player.
What I wanna do is prevent intro from executing in case
- The player is a zeus character
- The player JiP'd
if (!_didJIP || _player != zeusCharacter_1) then {
_null = [] execVM "scripts\intro.sqf";
}
This doesnt seem to work 
Do you have params ["_player", "_didJIP"]; there?
Args are passed in _this
yep yep
should i try _this with select or #?
diag_log ["_didJIP", _didJIP, "_player", _player, "zeusCharacter_1", zeusCharacter_1];
See what logs
Also get rid of that _null = assignment before [] execVM, its a relic of a buggy editor which required no returns in Init field.
roger
checked the rpt
12:49:49 ["_didJIP",false,"_player",zeusCharacter_1,"zeusCharacter_1",zeusCharacter_1]
Ah, you need to change your condition:
!_didJIP && _player != zeusCharacter_1
Show only only if NOT jip and NOT zeus
(only init-loaded players)
wont it prevent JiP intro only for the zeus character?
Or
!(_didJIP || _player == zeusCharacter_1)
```same thing
Your condition is to show the intro, not prevent it
i want to prevent it for all of the players when they jip OR when its a zeus regardles of JiP
You want it only for init-loaded players, right?
wdym by init loaded?
non-JIP
oh, yes
- The player is a zeus character
- The player JiP'd
Did you want BOTH these conditions or either of them?
Thought you never wanted to show intro to Zeus players
either, i dont want the intro for zeuses at all
Then you need this condition
Only show intro if:
- NOT JIP
and - NOT Zeus
Guesses:
- You
closeDisplaywrong displays - You delete player-viewed camera before doing
... cameraEffect ["terminate","back"];
Not sure if you can recover from that with some key combo
anyone know how to recreate the mission intro text you can set in editor? also triggers when you change scenario name (mainly looking for a function) able to make a ui element if i need to
Don't know which intro text you're talking about exactly, but there are plenty of BIS_fnc_ functions that might be it: https://community.bistudio.com/wiki/BIS_fnc_textTiles
Check other in "See also"
OnLoadName ? ๐ค
yeah looks like a good place to start
https://community.bistudio.com/wiki/File:BIS_fnc_textTiles.gif this is exactly what im after
thx
ah its editing of it i see
Thx m8. I'm working the BIS Helo MP Support modules into an SP mission and they do all kind of funky stuff with the MP respawn code kicks in. I don't have control over that directly so am hacking around it to make it play nicely with SP. It's mostly working but sometimes I lock myself out.
Might play around spawning a watchdog that kills the mission after a couple of minutes while debugging.
Not sure if it will work, maybe you can attach a KeyDown EH to some display that does endMission "END1";
{_x displayAddEventHandler ["KeyDown", {if(_this select 1 == 0x58) then {endMission "END1";}}]} forEach allDisplays

(0x58 is F12)
private _riotBackpack = _baseBackpack + ["JLTS_riot_shield_item",1];```
Hello I dont suppose anyone knows how id go about adding an array to an array of arrays. The method I have shown seems to throw errors.
Array + merges two arrays. You have one array that is an array of two arrays, and one that is an array of a string and a number, so + will result in array of two arrays, one string and a number.
You just need to turn your riotshield thing into an array of arrays as well. It'll be an array of one array, but that still counts.
Or, in other words, use more []
err- closeDialog doesn't seem to be working in eden ๐
That seems to not work in eden either. I am guessing it's b/c simulation isn't enabled in eden?
ah yes, I've just remembered, this isn't actually needed
https://38.media.tumblr.com/07b50157f1061e8fa1501b574036605d/tumblr_nksu4lpSJU1u9u8o0o1_500.gif Scripting in Arma sometimes..
is there a better way of doing something like this?
_x setVariable ["diwako_dui_radar_customIcon", format [GVAR(path), _rank]];
i want the path to be able to be changed via cba settings but it looks like it may not be compatible with format like that
wait, nvm, it works -- just forgot to set the variable properly later on 
can it take up perf having alot of unsused files setup in: CfgFunctions?
for example ive got quite some server side files that clients dont need to use ever, could i leave those out of CfgFunctions and just define them in a server side file with:
compile preprocessFileLineNumbers "";
I don't think amount of function variables matters for performance what so ever
Well, they're all variables in the global namespace so maybe a tiny cost, but probably not measurable.
Does someone know why on earth my units 20 seconds after killing getting teleported 1000 meter under the ground ?
Unless it's your code that's doing it, it's off-topic :P
Idk if its my code doing it 
idk if there is a scripting command which can cause such issues
it only happens with Units not agents
You can certainly move bodies underground if you want to.
but that would be like 2 meters under the ground, right ?
here they just 1000 meters under the ground
This sounds like a "remove mods until it stops doing it" problem anyway.
yea probably 
What are you trying to do?
It's possible to make a mod that changes the total number of particles allowed in Low particles setting?
Hopefully not? :P
is there anyway one can run code from the debug console or other interaction methods from a player and have the code run and persist through server restarts?
Does this setting even make difference for max number of particles?
I messed around with them some time ago and got an impression the max number is always the same
Quality only affects which particle config is used for generation
qualityLevel in particle configs
you save the code you want to run as a string and store it in the player's profile name space. you then run code on start that pulls that string'd code out, compiles it, and runs it
I need help getting in the direction of who knows how to change what weapons are available to specific aircraft, yall know anyone who csn help with that?
Specifically I wanna take the brimstone from FIRAWS and add it onto other aircraft than the tornado
So I run that command where? I've never done anything with modding before
this would be scripting not modding. You have a lot to read to get started:
If you are asking for one of us to write it for you, we can, just might be a bit due to life stuff
I'm just trying to find the knowledge on how to make it changeable by players mid.mission
I'm assuming it's gonna take going into the mod file itself, saving a separate copy and modifying that one
no need for mod. you'd put that command in the aircraft's init box in editor with no server filters since the command is a local execution command
And it adds that weapon as a possibility to load mid missiom
no, that overrides the pylons the aircraft has on mission load
Gotcha
whats available would be in the mod direction and thats a whole slope to go down
well i'm off to the gym, so i can help in a few hours
Copy that, I'll keep digging
move over to #arma3_config for mod stuff
is it possible to get the length of a line drawn on the map
i.e not necessarily straight, could double back on itself
oh theyre called polylines, neat
As Daddymen sayd, Low decrease max particle number and density, High increase max particle number but also increase density in a greater way (much more). This is why particles tend to vanish more commonly when someone is using High.
I want the best situation: The particle count limit from Ultra and the particle density from Low.
I have a super bomb in my mission. On Low there is no "vanishing" smoke. On High, very soon, smoke start to get deleted because it reach the limit. So the guy use High to avoid smoke deletion and have smoke deleted all the time 
I want to increase particle limit on Low setting to lead smoke in my mission to another level, and tell my mates to use Low when we are playing.
Low is the best configuration now for this experience, but it still have some "vanishing" smoke, High is just a waste of time, at least on this mission, smokes vanish all the time.
It's so strange because people set particles to Ultra High Super believing that they will have a better particles experience, but they will not have ๐ซ
They will have immersion breakes everywere.
Hello guys.
Is there a way to reduce the volume of a video played with BIS_fnc_playVideo ?
I tried fadeSound, fadeMusic, fadeRadio, fadeSpeech, fadeEnvironment but none of them worked
Those commands you tried affecs the entire game.
It's viable to extract the video sound, change the volume, and remix it into the video?
It would be nice to have some kind of ArmAReactions tumblr like devops, dba and security reactions for example.
Just to be clear before I make a ticket - is there no event handler to detect if unit's identity/face has been changed?
Hi. So I'm writing a script to create a deployable shield around a vehicle, and then another script to delete said shield whenever the use decides to. I got the shield to deploy as intended, but I'm having trouble getting the other script to delete the shield.
Here is the deploy script
_MedPathfinder = _this;
_speed = 0;
_MedPathfinder setVariable ["MedPathfinder_ShieldUp", true];
_MedPathfinder setVariable ["MedPathfinder_ShieldDown", false];
_MedPathfinder setFuel 0;
_shield = "Aux501_Weapons_Grenades_Special_Object_Squad_Shield" createVehicle [0,0,10000];
_shield attachTo [_MedPathfinder, [0,-1.4,-2], "attach_point"];
_shield setVectorDirAndUp [[0,0,-1], [-1,0,-1]];
_shield disableCollisionWith _MedPathfinder;
And the delete script
_MedPathfinder = _this;
_MedPathfinder setVariable ["MedPathfinder_ShieldUp", false];
_MedPathfinder setVariable ["MedPathfinder_ShieldDown", true];
_MedPathfinder setFuel 100;
deleteVehicle _shield;
why two variables?
_MedPathfinder setVariable ["MedPathfinder_ShieldUp", false, true];
false - shield is down
true - shield is up
I suggest adding true on third index to make it public
I'm new to writing scripts so I did what I knew worked. I'm doing two user actions on the vehicle. Scroll wheel to activate the shield, and scroll wheel option to deactivate it
how do you call this script?
class UserActions
{
class PathfinderShieldUp
{
animPeriod=5;
condition="(player == driver this) AND (alive this) AND !(this getvariable [""MedPathfinder_ShieldUp"",false])";
displayName="<t color='#FE2E2E'>Deploy Shield";
displayNameDefault="<t color='#FE2E2E'>Deploy Shield";
onlyForPlayer=0;
priority=10;
radius=100000;
showWindow=0;
statement="0 = this spawn Aux85th_FnC_MedPathfinderShield_fnc_PathfinderShieldUp";
textToolTip="<t color='#FE2E2E'>Deploy Shield";
userActionID=54;
};
class PathfinderShieldDown
{
animPeriod=5;
condition="(player == driver this) AND (alive this) AND !(this getvariable [""MedPathfinder_ShieldDown"",false])";
displayName="<t color='#FE2E2E'>Disable Shield";
displayNameDefault="<t color='#FE2E2E'>Disable Shield";
onlyForPlayer=0;
priority=10;
radius=100000;
showWindow=0;
statement="0 = this spawn Aux85th_FnC_MedPathfinderShield_fnc_PathfinderShieldDown";
textToolTip="<t color='#FE2E2E'>Disable Shield";
userActionID=54;
};
};
I see where the two variables doesn't make sense but when I only used one it didn't work. Though it could've been a skill issue on my part
! means "not", therefore the return value has to be false in order to satisfy the condition
so use ! when shield is down (shieldup = false) and dont use it when its up (shieldup = true)
Gotcha
!(this getvariable [""MedPathfinder_ShieldUp"",false])
// shield is up, do something
(this getvariable [""MedPathfinder_ShieldUp"",false])
// shield is down, do something
now, im not big on scripting either, so i might have missed some detail
All good. That's working for me with the single variable. So thank you for that information.
Now I just need to get the shield to delete itself on the execution of the second script
that's the only thing not working now
one variable less in this world
_MedPathfinder = _this select 0;
_speed = 0; //what is this for?
// shield is up
_MedPathfinder setVariable ["MedPathfinder_ShieldUp", true, true];
// check how much fuel the vehicle has
_MedPathFinderFuel = fuel _MedPathfinder;
// store fuel in variable
_MedPathfinder setVariable ["MedPathfinder_Fuel", _MedPathFinderFuel, true];
// remove fuel from vehicle
_MedPathfinder setFuel 0;
_shield = "Aux501_Weapons_Grenades_Special_Object_Squad_Shield" createVehicle [0,0,10000];
_shield attachTo [_MedPathfinder, [0,-1.4,-2], "attach_point"];
_shield setVectorDirAndUp [[0,0,-1], [-1,0,-1]];
_shield disableCollisionWith _MedPathfinder;
// store the shield inside a variable so we can address it later
_MedPathfinder setVariable ["MedPathfinder_Shield", _shield, true];
remove part:
_MedPathfinder = _this select 0;
// shield from previous function is now addressed
private _shield = _MedPathfinder getVariable "MedPathfinder_Shield";
_fuel = _MedPathfinder getVariable "MedPathfinder_Fuel";
_MedPathfinder setVariable ["MedPathfinder_ShieldUp", false, true];
// return the amount of fuel vehicle had before
_MedPathfinder setFuel _fuel;
deleteVehicle _shield;
I hope I didnt forget something lol
let me know if it works
what this for?
Vortex is asking for help with his functions
oh ok
Testing it now
The speed was a leftover from another script I was using as the baseline
I did get it working butttt I do like the addition of tracking its fuel level. We typically don't worry about it but I appreciate the attention to detail
So I'm testing your script now
@waxen hearth Tis not working friend. I try to activate the shield and nothing happens
can i see your cfgFunctions?
class CfgFunctions
{
class Aux85th_FnC_MedPathfinderShield
{
class functions
{
class PathfinderShieldUp
{
file="85th_Vics\Pathfinder\init\fn_PathfinderShieldUp.sqf";
class PathfinderShieldUp
{
};
};
class PathfinderShieldDown
{
file="85th_Vics\Pathfinder\init\fn_PathfinderShieldDown.sqf";
class PathfinderShieldDown
{
};
};
};
};
};
class CfgFunctions
{
class Aux85th
{
tag = "Aux85th";
class Aux85th_MedPathfinderShield
{
class createShield
{
file = "\85th_Vics\Pathfinder\init\fn_PathfinderShieldUp.sqf";
};
class deleteShield
{
file = "\85th_Vics\Pathfinder\init\fn_PathfinderShieldDown.sqf";
};
};
};
};
cfgVehicles >> yourVehicle
class UserActions
{
class PathfinderShieldUp
{
animPeriod=5;
condition="(player == driver this) AND (alive this) AND !(this getvariable [""MedPathfinder_ShieldUp"",false])";
displayName="<t color='#FE2E2E'>Deploy Shield";
displayNameDefault="<t color='#FE2E2E'>Deploy Shield";
onlyForPlayer=0;
priority=10;
radius=100000;
showWindow=0;
statement="[this] call Aux85th_fnc_createShield";
textToolTip="<t color='#FE2E2E'>Deploy Shield";
userActionID=54;
};
class PathfinderShieldDown
{
animPeriod=5;
condition="(player == driver this) AND (alive this) AND !(this getvariable [""MedPathfinder_ShieldDown"",false])";
displayName="<t color='#FE2E2E'>Disable Shield";
displayNameDefault="<t color='#FE2E2E'>Disable Shield";
onlyForPlayer=0;
priority=10;
radius=100000;
showWindow=0;
statement="[this] call Aux85th_fnc_deleteShield";
textToolTip="<t color='#FE2E2E'>Disable Shield";
userActionID=54;
};
};
change your statements to be as above
Got it working now
Thank you very much for your help. I'm sure I would've brute forced it eventually but this taught me much
You're welcome
this probably doesn't happen enough for them to warrant a listening on a units identity/face
What'd be a good way to check if all of a vehicle's seats are filled?
I think this also counts dead units in the seats. If you want something more complex, use https://community.bistudio.com/wiki/fullCrew
Basically what I was looking for, just couldn't find it
@tough abyss they are as blocking as "player". I haven't looked at the code, but presuming they weren't complete idiots, all it'll do is return a reference to a confignode in memory. The clue is that configclassES allows you to pass in code and have it run - uninterrupted.
I previously proposed a command, I think I used atomic as a keyword, but deschedule would be another option, such that atomic { a=1; b=2 } would run that block as a critical section.
Can you spawn just an explosion?
No. You can spawn a bomb
ok
Where do i put init.sqf?
do i put it beside mission.sqm
or inside mission.sqm
nvm
Hello, I am having issues with my mod that is suppose to save loadout on death and then restore it when spawned back in
I need help
I would post this question in config makers but I think this issue may be closer to that of a script
HAMSCH_EH_onPlayerKilled = player addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
player setVariable ["HAMSCH_Saved_Loadout",getUnitLoadout player];
}];
HAMSCH_EH_onPlayerRespawn = player addEventHandler ["Respawn", {
private _loadout = player getVariable ["HAMSCH_Saved_Loadout",[]];
player setUnitLoadout _loadout;
params ["_newObject", "_oldObject"];
deleteVehicle _oldObject;
player switchMove "UnconsciousFaceDown";
player playMove "UnconsciousOutProne";
private _radio = (_loadout select 9) select 2;
if (_radio isEqualTo "") then
{
hint "Radio not found";
};
}];
What could be the fault?
it works in like lan tested server but I tried it with friends and nothing
it just sets the loadout to be the same as when the match started
the previus script
initPlayerLocal.sqf
onPlayerKilled.sqf
onPlayerRespawn.sqf
tasked to do this was very reliable
Have you tried change your player.
In 1st
_unit setVariable ["HAMSCH_Saved_Loadout",getaunitloadout _unit];
2nd
params ["_newObject","_oldObject"];
private _loadout = _oldObject getVariable "HAMSCH_Saved_Loadout";
_newObject setUnitloadout _loadout;
Huh?
ah
replace 1 with 2
So like this?
HAMSCH_EH_onPlayerKilled = player addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
params ["_newObject","_oldObject"];
private _loadout = _oldObject getVariable "HAMSCH_Saved_Loadout";
_newObject setUnitloadout _loadout;
HAMSCH_EH_onPlayerRespawn = player addEventHandler ["Respawn", {
private _loadout = player getVariable ["HAMSCH_Saved_Loadout",[]];
player setUnitLoadout _loadout;
params ["_newObject", "_oldObject"];
deleteVehicle _oldObject;
player switchMove "UnconsciousFaceDown";
player playMove "UnconsciousOutProne";
private _radio = (_loadout select 9) select 2;
if (_radio isEqualTo "") then
{
hint "Radio not found";
};
}];```
or no I think thats wrong
may need to be more specific
I keep getting this error even though there is a ;
would anyone be able to help?
ctrlDeleteAllControls? That#s not a valid command
Oh
allControls _ctrlGroup apply {ctrlDelete _x} ;
is what you wanna do
or just ctrlDelete _ctrlGroup
my eventhandler doesn't seem to trigger. No hints when sel is changed:
createDialog "RscAssetIdentificationDialog";
_comboBoxCtrl = (findDisplay 1337) displayCtrl 2100;
_comboBoxCtrl_Options = ["Technicals", "Light Armor", "Heavy Armor"];
{_comboBoxCtrl lbAdd _x} forEach _comboBoxCtrl_Options;
_pictureCtrl = (findDisplay 1337) displayCtrl 1200;
_pictureCtrl ctrlShow false;
fn_comboBoxCtrl_curSelChanged = {
params ["_control", "_lbCurSel", "_lbSelection"];
hint str format ["%1\n%2", _lbCurSel, _lbSelection];
//_pictureCtrl ctrlShow true;
};
_comboBoxCtrl ctrlAddEventHandler ["onLBSelChanged", "_this call fn_comboBoxCtrl_curSelChanged"];```
name is wrong
onLBSelChanged doesn't exist and should give you a script error
also _this call... is not needed
_comboBoxCtrl ctrlAddEventHandler ["LBSelChanged", fn_comboBoxCtrl_curSelChanged];
I forgot about that. I'm going to try and add the event handler to the config's RscControlsGroup class instead
Thanks dedmen
I am attempting to open/load the gui editor project I had saved to config earlier. Trying ctrl + I to no avail with configFile >> "RscAssetIdentificationDialog" (error display not found)
How did you save it to config?
I have a damage handler running on a vehicle, and when returning 0 for it (to make the vehicle not take damage) it would repair the vehicle if it was already damaged
Rough breakdown:
- Vehicle is damaged (let's say
0.3damage) before the damage handler is created - Damage handler is created
- Vehicle takes damage, damage handler returns
0(for no damage) - Vehicle is restored to 0 damage
I'm not running any setDamage commands, so I assume the return value from the damage handler is being set for the vehicle's health, rather than subtracting from it (or well, I guess adding to it)?
Yes. So's the input damage value.
To prevent new damage you have to go look it up with getHit or whatever.
Ah gotcha, seems odd though
Main reason I was doing it this way was because I needed the amount of damage the vehicle should take, appreciate it
So basically just get the damage of the selection and re-apply the damage?
Something like:
this addEventHandler ["HandleDamage", {
params ["_vehicle", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit"];
_selectionDamage = _vehicle getHit _selection;
_vehicle setHit [_selection, _selectionDamage];
}];
Q: about commanding menu expressions, they can be multiple lines? i.e. something like, ["expression", "do something; do something else"]?
Should be able to
I went to go check my chat wheel mod to see but then realized they're all one line function calls
Definitely not this, went to test it and a single shot just immediately killed the vehicle lmao
// Predefined controls
#define IDC_OK 1
#define IDC_CANCEL 2
#define IDC_AUTOCANCEL 3
#define IDC_ABORT 4
#define IDC_RESTART 5
#define IDC_USER_BUTTON 6
#define IDC_EXIT_TO_MAIN 7
class RscAssetIdentificationDialog
{
idd = 1337;
onLoad = "[""onLoad"",this] call fn_handleDialogControls"; // changed expression and function call
class controls
{
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT START (by J. Hachi, v1.063, #Cygyku)
////////////////////////////////////////////////////////
class Background: IGUIBack
{
idc = 2200;
x = 0 * GUI_GRID_W + GUI_GRID_X;
y = 0 * GUI_GRID_H + GUI_GRID_Y;
w = 40 * GUI_GRID_W;
h = 25 * GUI_GRID_H;
};
class ScrollBar: RscSlider
{
idc = 1900;
text = "Page"; //--- ToDo: Localize;
x = 15.5 * GUI_GRID_W + GUI_GRID_X;
y = 23.5 * GUI_GRID_H + GUI_GRID_Y;
w = 9 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
type = CT_SLIDER;
style = SL_HORZ;
tooltip = "Change page";
onSliderPosChanged = "_nul = [""sliderMoved"",this] call fn_handleDialogControls;"; // added onSliderPosChanged event handler
};
class Picture: RscPicture
{
idc = 1200;
text = "#(argb,8,8,3)color(1,1,1,1)";
x = 0.5 * GUI_GRID_W + GUI_GRID_X;
y = 0.5 * GUI_GRID_H + GUI_GRID_Y;
w = 39 * GUI_GRID_W;
h = 22.5 * GUI_GRID_H;
};
class StructuredText: RscStructuredText
{
idc = 1100;
text = "RSC Asset Identification Cheat Sheet"; //--- ToDo: Localize;
x = 9 * GUI_GRID_W + GUI_GRID_X;
y = -1.5 * GUI_GRID_H + GUI_GRID_Y;
w = 22 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
sizeEx = 3 * GUI_GRID_H;
};
////////////////////////////////////////////////////////
// GUI EDITOR OUTPUT END
////////////////////////////////////////////////////////
};
};```
Conventionally you'd return _selectionDamage, and the setHit is unnecessary unless there are other handleDamage EHs installed on top. You might need a special case for _selection == "" too.
Yeah fair point, was thinking I needed to apply the damage manually from my first instance
is that in description.ext?
Try missionConfigFile >> "RscAssetIdentificationDialog"
That worked, thanks. I should have known
I may just be having a moment but I'm trying to switch over a percent and set a value based on it. Just something like:
_somePercent = ...;
switch (_somePercent) do
{
case _somePercent >= 10: {...};
case _somePercent...
};
(Also I'm aware that the example isn't correct, just wanted some sort of example)
โจ linearConversion โจ
Awesome, works fantastic
When I changed the line from removeItem to removeItems because I wanted to delete all items of a given type, not just one, the script did not remove any at all. Do you have any idea why?
if (
!params [
["_itemClassNames", [], [[]]],
["_side", nil, [east]]
]
) exitWith {
["MAJ_fnc_removeItem invalid arguments: %1", _this] call BIS_fnc_error;
};
private _sideUnits = units _side;
{
private _unit = _x;
{
if (typeName _x == "STRING") then {
systemChat format ["removed %2 from %1", _unit, _x];
_unit unassignItem _x;
_unit removeItems _x;
};
} forEach _itemClassNames;
} forEach _sideUnits;
Is there anyway to make it so if you take a picture of am object with the Camera from WS it will activate a trigger for a task. Basically want to do a gather intel task where the goal is to take a photo of a SAM Battery but not sure if thats even possible
A "take photo" action, condition must have camera, script checks line of sight for the target. Overall concept anyway. Take it in parts.
Ill see what I can do, thanks
is there anything I could use to check that opened arsenal is that from main menu?
So here I have a trigger that activates when a player gets within 2 meters of the downed pilot in this case pilot_2. The script functions fine however I am getting annoyed that I have to constantly change the variable for each new pilot e.g. pilot_3 pilot_4 and so on.
is there a way I could make it so i don't have to change the variable each time?
findIf
How would I implement that in?
are these pilots all near each other? or are you having the player go to different parts of the map
different parts of the map
missionName // "Arsenal"
you can synchronize the pilot to the trigger, then get it in the code with synchronizedObjects thisTrigger
So I would just put that where I have the pilot variable instead?
like sqf [synchronizedObjects thisTrigger join player; synchronizedObjects thisTrigger enableAI "MOVE"; synchronizedObjects thisTrigger setCaptive false;
Read the biki page and see what the command returns, that will tell you how to get the pilot object.
I get that it gets my an array of what objects are synchornized but I don't understand how I actually use that array within the activation field.
player distance thisTrigger <2;
Why can't I just do this as the condition and ```sqf
thisTrigger join player; thisTrigger enableAI "MOVE"; thisTrigger setCaptive false;
this as the activation? As I understand it thisTrigger is just whatever the trigger is synched too correct?
thisTrigger is the trigger object. I think you want to use thisList
Also enableAI and setCaptive uses an object not an array
wouldn't thislist be an array then?
Which means you can use forEach
I still don't really follow... I just ended up abandoning using a trigger all together and exclusively used the actual pilots init field. seems to work fine now.
Is there anyway to switch camera but keep actions and the scrollWheel?
Probably not, but maybe you can switch control to Logic unit and use it as camera?
Logic constantly suffocates though so you'll need to disable the effect
Or you can just create your own mousewheel menu or other menu
how can I get RscCombo to work?
when i simply put the wiki example the Combo doesn't appear
i tried adding items to it but nothing
import RscCombo as Combo;
...
class testCombo: Combo
{
x = "pixelW * 5";
y = "0.1 + 0.05 + 0.005 + pixelH * 5";
class Items
{
class Alphabet
{
text = "Sort alphabetically";
default = 1;
};
class Mod
{
text = "Sort by mod";
};
};
};
Also specify w and h
Try adding items with script
Also make sure you reload mission completely for configs to update (load it again in file selection)
Default has
w = 0.12;
h = 0.035;
```though
class testCombo: Combo
{
x = "pixelW * 5";
y = "0.1 + 0.05 + 0.005 + pixelH * 5";
w = 0.33;
h = 0.1;
//sizeEx = 0.085;
class Items
{
class Alphabet
{
text = "Sort alphabetically";
default = 1;
};
class Mod
{
text = "Sort by mod";
};
};
};
this is my new config
but it still doesn't work
(i reloaded the mission)
Decided to try the config myself. The issue is missing idc, game config doesn't have a default idc = -1; so have to specify it
15:59:41 Warning: no idc entry inside class KingOfHill_Badges/controls/testCombo
Warning in RPT but no popup window
With idc your config works
oh ffs I had this same exact issue with another class
idc gets me all the time
thank you for the help, it does show up now
Just be careful with absolute values for x,y,w,h. It might not look for others as it looks for you.
my UI is basically just the safezone
i don't mind stretching
any ideas why my Items won't appear?
class WTK_MIS_gamemodes
{
class Waves
{
text = "Waves";
default = 1;
};
class Invasion
{
text = "Invasion";
};
};
class gamemodeCombo: Combo
{
x = "pixelW * 5";
y = "0.1 + 0.05 + 0.005 + pixelH * 5";
w = 0.2;
h = 0.05;
class Items: WTK_MIS_gamemodes { };
idc = 302;
};
i might be misunderstanding what the : symbol does
from my understanding it copies all the properties from another class
Have you tried putting them in directly?
To me that seems right but- welp xP
well it works when they are directly in the class
so it should theorically work when it's separated right
Could do an import
Import from a file and said file just has what would be in items
Wait is it import or include-
include is to import a whole file and import is to import a base class
a specific one
but i don't think it'd work
Include should
Class items{
#include MyFile.hpp
};
\\ MyFile.hpp
Class Option_A{
Text="A";
Default=1;
};
Class Option_B{
Text="B";
};
Im on mobile so please excuse and capital mistakes x3
But the games just sees it as 1 big file.
Class items{
\\ MyFile.hpp
Class Option_A{
Text="A";
Default=1;
};
Class Option_B{
Text="B";
};
};
you can include directly inside classes?
Yea, its basically copy pasting the file referanced right where the ibclude is
#include is a preprocessor command, which means it's handled before any of the code is interpreted or executed by the game. All preprocessor stuff is resolved by the time the game sees the file; it is essentially invisible and can be done anywhere, as long as the end result is valid.
Help. Forgive me i was not sure where to post this. Recently i tried uploading OGV. video to custom mission, however the audio becomes out of sync the longer it plays. Does anyone know of a solution?
not so much stretching but the multi-display scenario...
if you have pilot_1, pilot_2, pilot_3 etc:
(thisList select {"pilot" in (toLowerANSI vehicleVarName _x)}) apply {
_x setCaptive false;
_x enableAI "MOVE";
[_x] join player;
};
set activation to anybody
multi screen?
whenever the game displays on 2 or more screens
yes AFAIK, that can translate into 'safe zones' if you read the docs
i see
multiple safezones?
what if i want my ui to appear on one screen only
I'm just throwing it out there as a for instance. the docs are pretty clear what the scripting commands and such are about. Best of luck.
Good afternoon. Im having trouble with the teleport script not working for me
not sure what scripting commands you are talking about
any idea why this code doesnt work?
while {true} do {
_orange = nearestObject [player, "Orange"];
_distanceThreshold = 5;
if (alive _orange && {_distanceThreshold > (player distance _orange)}) then {
player setDamage 1;
hint "You were killed by the nearby orange!";
};
sleep 1;
};
What "doesn't work"?
I dont know why, but im unable to figure out how returns work at all?
Heres a small code snippet, the _return variable contains the right boolean, but whenever i try to access it from another script it just says either any or <null> and i cant seem to figure it out, any help is appreciated. This is just some sample code.
CheckPermissions = {
private _isAdmin = false; //Getting this value from somewhere..
private _return = true;
if(_isAdmin == false) then {
_return = false;
};
_return;
}
To use the _retrun, you need to call the script and assign it. Ex
CheckPermissions = {
private _isAdmin = false; //Getting this value from somewhere..
private _return = true;
if(_isAdmin == false) then {
_return = false;
};
_return;
};
_evaluateFunction = [] call CheckPermissions;
_evaluateFunction;
// _evalutateFunction will be true or false, depending on what your function should return.
I tried something like that too, but i'll try again!
_result = [] call CheckPermissions;
hint format ["Result: %1", _result];
Are there any script errors? It looks like it should be proper
it wont activate correctly
i have an Orange which is with the variable orange and an normal infantry dude
the _orange is the orange and then the player in line 2 should be the player
from my limited knowledge
From what I can tell nearestObject [player, "Orange"]; will return <NULL-object>.
The "Orange" classname shouldnt exist.
The class should be "Land_Orange_01_F" making the script nearestObject [player, "Land_Orange_01_F"];
Im stupid, the only ones are from calling it from outside the function.. isn't it enough to sqf "call compile preprocessFile "path..""? 
I wouldn't ever use preprocessFile to process a function; What I would do is add the file into a "Functions" header, then its always usable.
//description.ext
class CfgFunctions {
class Functions {
// Tag is the prefix of your function ex. Kru_fnc_whateverFunctionName
tag = "Kru";
file = "core"; // If you have sub-folders in your mission, you will want to navigate to it here Ex. \core is where you have functions
class whateverFunctionName {};
};
};
// Above is now compiled on run-time of mission, and no need to pre-process any file.
_valueReturned = [] call Kru_fnc_whateverFunctionName;
Using a preprocessFile will process the file and run the function, but as far as I know should basically never be used unless necessary
Thanks! Ill look into it more
need help figureing out my rp life files with how to config and move to editor
You generally should prefer preprocessFileLineNumbers
Using it is fine, but CfgFunctions should be preferred for functions
For a boolean parameter, do you need to do params ["_name", false, [true, false]] or will just either true or false work for available types?
Only one is needed, thought I remembered there not being an example on the wiki but I was incorrect.
https://community.bistudio.com/wiki/params#Examples
"that kind of feature can be really dangerous because all scripters will start to paste all their codes into one Non-scheduled piece of code, so We're not planning to changing anything on current implementation"
The last time this feature was asked for
@candid sun ... so add this line to the very end: (toString _retStr) and the function will work
@meager granite and that is a serious concern
most people simply do not know when some code has to be run in one step
still i dont feel like thats a reason against some callBlock command
It indeed isn't. There are countless ways to fuck up performance already.
The value in the brackets just represents the allowed data type not its actual value. Would be bad for numbers otherwise 
Does anyone know of a script that will respawn a/any vehicle group with ai a set number of times?
Thanks.
Could someone help me/point me to the right direction for this;
I'm having AI in the game that give Intel when dead, that part i know how work with, but how can i make it so that it also adds new map markers with the same command?
Any scripts you made so far?
Pretty much only the thing found here;
https://community.bistudio.com/wiki/BIS_fnc_initIntelObject
Example 3 says a way to inject a code
Sorry, but im having a bit of a stupid moment and don't see it?
// Add a scripted event that notifies all clients via systemChat when the intel is found:
[
this,
"IntelObjectFound",
{
params ["", "_foundBy"];
private _msg = format ["Intel found by %1", name _foundBy];
_msg remoteExec ["systemChat", 0];
}
] call BIS_fnc_addScriptedEventHandler;```This part
Sorry, i'm very new to scripting so don't understand that, but i'll try to figure it out thanks
where on that part should i put that it executes a sqf? cause i cant seem to figure it out
You can replace the code in the {...} to do your own stuff, like run sqf, or unhide/create marker.
thanks, figured it out now
does the MusicEH MusicStart trigger on a Headless Server?
It executes where it has been added. That means it has local effect. So assuming all computers run the following piece of code, you can do this to exclude headless clients or a dedicated server from having the EH.
if (hasInterface) then
{
addMusicEventHandler [...];
};
You have to check where you are putting this code, if it's init.sqf it runs only on the server. If you place it in a trigger, in default, it will run on all computers. Always check BI wiki page.
Ive been using this script suite for vehicles with ai respawning set number of times.But after respawning group twice the group is being spawned as civilian.Civilian sided T-140's...Cant work it out
heres how iam executing it -
veh = [this, 100, 10, "spawnMarker", "operationMarker", "Attack", "start"] execvm "Init_respawn.sqf";
I think they're asking more about whether music EHs function on any headless system, given that headless systems don't have any capacity to output music.
I'm not sure on that one myself. I know they'll just ignore anything to do with UI but I've never tested music.
If the headless system actually simulates playing music (even though it doesn't output) then yes it'll work. If it just ignores music commands, then no.
Trying tp paste code for script but being blocked...
Init_respawn
pastebin wont let me...
You're banned from pastebin? :D
no
that is the core of my question - it seems to be not simulating the music stuff on an headless server, but i ask to make sure im not making a mistake.
never used it b4
pastebin is banned in turkey for example, so not everyone can use it.
pastebin is telling iam not allowed to post...Iam in Australia..
You will probably not run into any errors if you use it, but it probably wonยดt do anything. But there are better ways to tie game logic to an event/trigger, since UI related functions have no meaning in the context of a computer without a user.
evening ! is saySound broken in terms of adjusting volume in the description.ext somehow?
volume is not changing for me
mhhh
what is saySound?
sorry...this commands
ls1 say "barking"
works
it still ignores the volume definition here
{
name = "bark"; // display name
sound[] = { "sounds\bark.ogg",5, 1, 250 }; // file, volume, pitch, maxDistance
titles[] = { 0, "bark" }; // subtitles
};
and the distance too
i tried another command, which does nothing
playSound3D ["sounds\bark.ogg",ls1];
yes, playSound3D takes an absolute path, see playSound3D
what do you mean? don't you notice a difference when between 0.1 and 5?
what is an absolute path please?
yes
no difference to hear at this command
for noise
for mods it is like in the example
prefix\addon_name\folders\data.ogg
so full specified relative to the pbo
for missions you can get the first with "getMissionPath"
This will return the absolute path until inside your mission folder (like where init.sqf and stuff is located)
i tried to get it in the debug console with the "getMissionPAth", but i dont get it

shouldnt it be just the missionname then like this:
playSound3D ["Operation_Silent_Viper_1\sounds\bark.ogg",ls1];
i do not fully understand
no
The mission path isn't just the name
playSound3D [getMissionPath "sounds\bark.ogg",ls1];
Shouldn't need the mission name
this now yes
https://community.bistudio.com/wiki/getMissionPath
check Example 1. It will clarify things pretty easy.
great,that works! thanks a lot !
Remember read the docs and examples carefully ๐
yea, working a bit too long today i guess^^ ๐ฌ
Hi guys, recently I created a report about the problem I faced: https://feedback.bistudio.com/T175874
Say, I have two functions:
fnc_getitems = {
_magstoremove = [123];
[_magstoremove]
};
fnc_check = {
_set = ["",0,[]];
_magstoremove = _set#2;
_magstoremove
};
call fnc_check; //returns []
Both have the same local variable name inside, but, following the logic of most programming languages, it should have different scopes. so _magstoremove variable should live only withing each function scope.
But if I call the second function in this way:
fnc_getitems = {
_magstoremove = [123];
[_magstoremove]
};
fnc_check = {
_set = ["",0,[]];
_magstoremove = _set#2;
call fnc_getitems; // calling the first function, no matter with params or without
_magstoremove
};
call fnc_check; // returns [123]
- seems like this variable leaks from one function to another.
Leopard said that it is normal.
Did I miss something?
call runs code inline
essentially
although hmm the way I understood it was the same as you and it should be a different scope but i guess it's more inline than I thought
following the logic of most programming languages
SQF is not like other programming languages. it doesn't have "functions".
Mmm... It's not very intuitive yet. Where is it described in more detail?
Just maybe don't mislead people with the name "functions" then?
not a problem / works as intended / use private keyword on varibles in the inside scope if you don't want it to modify outside ones 
https://community.bistudio.com/wiki/Variables#Scopes related doc, i suppose?
A local variable is only visible in the Script, Function or Control Structure in which it was defined.
SQF is not like other programming languages. it doesn't have "functions".
works as intended
You guys are contradicting yourselves and the manual.
Local variables get passed into child scopes. It's a bit... unusual.
its beautiful
Easy to fuck up in ways that are very hard to spot.
Local variables get passed into child scopes. It's a bit... unusual.
Of course they should pass there. But I suppose, not a local variable, defined inside the child scope/function (that is not exsist?) passes to the upper scope?! ๐
what
private _var = 123;
private my_fnc_thing = {
_var
};
call my_fnc_thing```
will not return 123
however if you do not private it i (think) it will
Yes it will.
wtf is the point of private then
lol
private my_fnc_thing
did you mean to put it in the function?
"private" = "variable belongs to this scope and not up" = "variable would be destroyed when this scope is destroyed" ๐คทโโ๏ธ
i dont know im so tired
Actually it'll throw a syntax error because private my_fnc_thing is invalid :P
I assume you meant:
private _var = 123;
my_fnc_thing = {
private _var
};
call my_fnc_thing
```? (which is still wrong, but less wrong)
i just prefix all local variables with private
my_fnc_thing is global...
oh yeah
OMG. Okay, let's forget programming, just putting private anywhere I could get ๐
sqf is its own beast and its a brilliant one
There should have been a callSafe that creates a fresh scope.
callThread ๐
It's not a thread :P
doesn't remoteExecCall do that already?
iirc it does
spawn
Yeah but it doesn't return values or call immediately.
hell yeah because we all love the scheduler
(it would be somewhat usable if people didnt use the damn scheduler as a way to wait)
it does call immediately locally iirc
yeah but looks like it still does pass the vars 
In SP right :P
yeah
abomination of the day
well it might be possible based on my tests, but I'll have to discuss it with Dedmen
I wouldn't bother. Feels like the window for that particular design decision is past.
Curious how much performance penalty there is for creating a fresh scope though.
https://community.bistudio.com/wiki/Arma_3:_Difficulty_Settings
Can I set these per mission?
If you use a different profile for each mission, sure.
Thats about what I thought. How do I access the set difficulty?
Can anyone tell me the right language to program a trigger with to detect only planes/helicopters
like "enemy present, but only works if it's a plane/helicpter"
use inkindof and side
thisList findif {_x isKindOf "Air" && side group driver _x isEqualTo east} != -1;
or whatever enemy side is
So these are "players, don't leave this area" sam sites
and players are blue
so that should be west instead of east?
yes
Thanks.
ok, im trying to get my first script to work in arma 3... Its a fine wine of copy pasteing ๐
But it doesnt quiet work and im not sure why
I want one pp-effect at day time and one at night time:
if !(daytime > 19.5 OR (daytime > 0 && daytime < 4.7)) then { hint "DAY"; DAY = ppEffectCreate ["colorCorrections", 1501]; DAY ppEffectEnable true; DAY ppEffectAdjust [0.95, 0.95, -0.03,[0.0, 0.2, 1.0, 0.0],[1.0, 1.0, 1.0, 0.6],[0.2,1.0,0.5,-0.5]]; DAY ppEffectCommit 0; ppEffectDestroy NIGHT; } else { hint "NIGHT"; NIGHT = ppEffectCreate ["colorCorrections", 1501]; NIGHT ppEffectEnable true; NIGHT ppEffectAdjust [0.88, 0.88, 0.003,[0.9, 1.6, 1.0, 0.01],[0.45, 0.52, 0.55, 0.3],[0.5,1.0,1.5,1.1]]; NIGHT ppEffectCommit 0; ppEffectDestroy DAY; };
where does one find default sounds to play though a script
@tough abyss You script works. Why do you think it isn't?
You just don't need to check daytime for negative values, I doubt it could happens ๐
@golden verge First result from google:
https://forums.bohemia.net/forums/topic/178184-playsound3d-and-vanilla-sound-list/
Is there a list of all vanilla sound effects? I know, the names can be found out with triggers and searching the mission.sqm. But I need the full path and file name to be able to play it with playsound3d. These work: playSound3D [A3\Sounds_F\sfx\alarm_independent.wss, player]; playSound3D [A3\Sou...
i did this currently
"3DEN_visionMode" call BIS_fnc_playSound;
and it works i dont know where to find the sounds i actually want to play
im just lost as my "3DEN_visionMode" doesnt have a .wss on the end
Hum, thats even more frustrating... for me it doesnt change pp effect when using "skiptime" in the console for example.
And i have tried to commit the script from an objects init, i dont know...
*ofc i have also tried the script in the debug console
maybe there is a smarter way to switch pp effect at a certain time... for example 19:00
You need to make a loop to check conditions, otherwise it runs only once - at the mission start ๐
aha
Need an example?
can you guide me in the right direction? or even better, complete the code
yes please
// The scrip works even without it, but it is better to adjust variables from the very beginning
DAY = ppEffectCreate ["colorCorrections", 1501];
DAY ppEffectAdjust [1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
DAY ppEffectEnable true;
DAY ppEffectCommit 0;
NIGHT = ppEffectCreate ["colorCorrections", 1501];
NIGHT ppEffectAdjust [1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
NIGHT ppEffectEnable true;
NIGHT ppEffectCommit 0;
[] spawn {
while {true} do { // you can use your own condition, with 'true' it runs all the time the mission is running
sleep 30; // the period in seconds
if (daytime <= 19.5 && daytime >= 4.7) then { // it is better to use non-invert logic, it is better for debugging
hint "NIGHT";
ppEffectDestroy DAY;
NIGHT = ppEffectCreate ["colorCorrections", 1501];
NIGHT ppEffectEnable true;
NIGHT ppEffectAdjust [0.88, 0.88, 0.003,[0.9, 1.6, 1.0, 0.01],[0.45, 0.52, 0.55, 0.3],[0.5,1.0,1.5,1.1]];
NIGHT ppEffectCommit 0;
} else {
hint "DAY";
ppEffectDestroy NIGHT;
DAY = ppEffectCreate ["colorCorrections", 1501];
DAY ppEffectEnable true;
DAY ppEffectAdjust [0.95, 0.95, -0.03,[0.0, 0.2, 1.0, 0.0],[1.0, 1.0, 1.0, 0.6],[0.2,1.0,0.5,-0.5]];
DAY ppEffectCommit 0;
};
};
};
NP
ok last n00b question i hope...
Can i execute the code from an objects init? like in my image i posted ? Do i need to name the "variable name" to something special?
Or is the only/best way to include it into the missions init.sqf?
You can run your code from any object init - the object itself just need to exist at the needed time.
But it is recommended to use logical layout - like, global scripts in mission init field. Or in sqf files or in functions, called from there, or from special sqf files like initPlayerLocal or initServer. Scripts for objects - in the object init, if needed.
As for variables - it is better to use prefixes, and not to use simple words for variable naming.
DAY = bad
MyMod_Day_effect or MyMod_DAY = good
hi, anybody knows how to detect if a door from, in this case, a container is open?, i have no clue how to do it
To detect if container was opend you use EH Container Opend
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#ContainerOpened
But if you are talking about shiping containers then you would check for animation with Animation phase
https://community.bistudio.com/wiki/animationPhase
Animations can be retrieved via the config viewer - you need to find the object >> animationSources or so.
Hello fellas,
Is there a command to set control attributes like padding when they are created using
ctrlCreate
```?
Im trying to do the aligment of the columns for a ListNBox control since everything is aligning to the right.
https://community.bistudio.com/wiki/CT_LISTNBOX
Nope. You want to make a control class
_packet set ["score", (_packet get "score") + _final_score];
```Wish there was a shorthand of something like:
```sqf
_packet add ["score", _final_score];
```muh microseconds
And same for arrays but with indexes
is there a way to spawn an explosive charge on a timer?
like spawn a demo charge that will go off in x seconds
private _bomb = createVehicle ["SatchelCharge_Remote_Ammo", getPos player, [], 0, ""];
_bomb spawn {
sleep 3;
triggerAmmo _this;
};
Try it
will do
private _hits_hashes = _unit getVariable "hitparts_by_hash" getOrDefaultCall [_hit_hash, {createHashMap}, true];
```I love hash maps ๐ฅน
Wish getVariable was also able to do that
getVariableCall or something
Or use same name for ENTITY getOrDefaultCall ARRAY
Depends on your definition of functions.
The SQF language itself doesn't have functions, it only has blocks of code.
But people who write scripts, create script variables that contain CODE, and call them functions.
Every scope is a "fresh scope"
The difference is that sub-scopes have a reference to their parent.
If local variable cannot be found in current scope, its parent is searched, and all the way up the chain.
what private does is don't go up to search in parents when setting the variable.
VBS also has a "privateAll" command that basically severs the connection to the parent
essentially all variables set after running privateAll will be implicitly private
But that also means if you then want to read a specific variable from parent scope. You can't.
So they added another "import" command that allows you to load a variable from parent scope into the current one, so you can access it.
I'm guessing what I'm encountering with nearestObjects vs nearEntities is a bug. On an empty map using BIS_fnc_codePerformance nearestObjects [player, ["Man"], 50];averages 0.005 ms, player nearEntities ["Man", 50] averages 0.0039 ms. Placing down about 80 AI with enableSimulation false outside of my 50 meter radius results are now 0.0058 for nearestObjects and 0.0078 for nearEntities. If the AI are within the radius though nearestObjects is 0.059 ms and nearEntities is 0.014ms. I haven't tested this yet in a multiplayer environment or with more objects on the map.
It's much clearer now, thanks. So it is better to look at sqf "functions" like just a piece of code at the same hierarchical level.
But does spawn has different behavior from it, as mentioned above?
Spawn creates a new instance of a script. Instead of executing things in the current script
Also spawn runs asynchronously. So it couldn't refer to variables in another script that has exited and was deleted long ago.
a custom rscClass with the modified attributes and just call it using the ctrlCreate?
also see
https://community.bistudio.com/wiki/Scheduler
@unreal scroll
Thanks, I read most of A3 manuals a long time ago already, just wanted some explanation from people familiar with the structure, to avoid the problems described above.
scheduler is an important read as other scripts can influence the speed of it and shouldn't really be used to just wait in your code
it is useful for running high cost code that you cant send out to an extension or something however cba functions really should be used for while loops, sleeps etc
and shouldn't really be used to just wait in your code
Alternatives? CBA functions? Without error logging? Not a good choice for me.
see:
CBA_fnc_addPerFrameHandler
https://cbateam.github.io/CBA_A3/docs/files/common/fnc_addPerFrameHandler-sqf.html
CBA_fnc_waitAndExecute
https://cbateam.github.io/CBA_A3/docs/files/common/fnc_waitAndExecute-sqf.html
CBA_fnc_waitUntilAndExecute
https://cbateam.github.io/CBA_A3/docs/files/common/fnc_waitUntilAndExecute-sqf.html
all run unscheduled so will influence framerate as opposed to how long other scripts take to execute
they will return script errors if you have an error
can also just use diag_log if need be
yeah, because SQF scheduler checking "should this piece of code run now" is totally worse than CBA's scheduler loop checking that same very thing ๐ฟ
they will return script errors if you have an error
No they won't. Man, I'm digging into it for four or five years actively ๐
No, CBA functions will NOT return eny errors inside its code. Believe me, or just check it.
you are probably writing bad code or testing it badly then
because it does
i use cba per frame handlers for my capital ships mod extensively and whenever i run the mod in release branch it bitches at me 24/7 for no angular velocity commands
I don't see the point in arguing with you. Just look at what I write.
no
i know when im right which is right now
All code that has a visible effect for the user or requires time specific guaranteed execution shall be written in unscheduled space.
(cba cba cba its for cba)
Especially for KJW who doesn't even bother to verify elementary things which he claims.
[{
params ["_unit"];
speed _unit > 0
},{
params ["_unit"];
_veh = [];
if (speed _veh > 0) then {};
hint "All is done";
}, [player], 3] call CBA_fnc_waitUntilAndExecute;
Catch the error please.
may i recommend you try and test your "verifying" outside of cba
because there is no undefined variable error in base a3
๐คฏ
oh wow what the fuck is happening therer
oh well it gets the point across anyway
Oh wait, you can't read the log? Okay, O'll help you, this is without CBA:
16:19:32 Error in expression < _veh = [];
if (speed _veh > 0) then {};
hint "All >
16:19:32 Error position: <speed _veh > 0) then {};
hint "All >
16:19:32 Error speed: ะขะธะฟ ะะฐััะธะฒ, ะพะถะธะดะฐะปัั ะะฑัะตะบั
16:19:34 Ref to nonnetwork object 1825876: <no shape>
This is with CBA:
editing the code after getting the reply is kinda low
oh cool we be changing our examples after the fact now
how desperate are you to win an internet argument
because i am not at all
i know when i am right which is right now
please do not try and argue about functions that you rather clearly seldom use when they are the community standard
it just makes you look stupid
editing the code after getting the reply is kinda low
Man, I'm writing from memory, I'm not in game every time.
Trying to shift the focus is silly. You are being shown that CBA does not return an error. You claimed that it does.
What are you talking about?
except it does
Examle please, for the case provided above.
Cba is not scheduled
you misunderstand what he means by scheduler
You can check this by running the diag all active sqf scripts
scheduler is just something that decides should this bit be run now
sqf scheduler is The Scheduler
cba scheduler is the handler that goes oop still got to wait until this execute
sqf scheduler is just dragged down by other scheduled scripts
CBA looping over all waiting scripts every frame is equivalent to their own scheduler implementation
"scheduler" in this context is unclear and I hate that it means two things now
16:21:57 Error in expression <ams ["_unit"];
_veh = [];
if (speed _veh > 0) then {};
hint "All >
16:21:57 Error position: <speed _veh > 0) then {};
hint "All >
16:21:57 Error speed: Type Array, expected Object``` from literally your new example
Besides the Accursed Scheduler
sqf scheduler is just called the scheduler because it has no other name
in practice it is just the sqf scheduler
why are you trying to get the speed of an array
stop it
because it checks what should be run and stuff
because we're having a stupid argument in the Internet
and back to dual mening of "scheduler" - i've tried to prevent that by explicitly telling "CBA's scheduler loop"
What's this all about? It looks as stupid as possible. The topic:
they (CBA functions) will return script errors if you have an error.
There is one of hunderds examples I had, that proves it doesn't. Any questions?
just don't use the scheduler for things you want to actually run
artemoz literally showed you it from the log
sqf scheduler yes
cba scheduler no
The Scheduler
it errors when run with CBA. It errors when run in vanilla. Same behavior, no extra difficulties involved
The Accursed Beast
The Scheduler (derogatory)
lower case s to make it the lesser scheduler
sqf scheduler is useful for things like kjw imposters where i do a lot of LOS checks etc
stops it taking up too much framerate
aside from that
I don't have any errors from CBA functions errors. Never had. With any version.
yuck
and once more
i mean, i have it disabled as well, i'm just running in 3DEN where it's on by default 
i bet he has showscripterrors turned off
You've lost ))
https://youtu.be/nNzfOvSvtIk
lmao
Results get worse for nearEntities with larger number of mission objects. Using the most heavy mission.sqm I could find (Altis Life) and standing in the middle of nowhere nearestObjects [player, ["Man"], 50] was 0.0057 and player nearEntities ["Man", 50] was 0.0148.
with how fucked that pause menu is
Or spawning a ton of AI on the server
jenna moment
run just cba
Jenna's liberation fork
i can guarantee either you have a mod breaking cba or you have script errors turned off
have you tried, you know, actually moving your goddamn unit for the condition to turn true?
CBA is a frame eater
change my mind
I wont
you also think theres no such thing as excessive macro usage X ๐
~you're still~in a dream~frame eaaateeeer~
If you macro my mod I'm gonna kill you
Kjw's giant pull request
ACE's fragmentation is much much worse
have you tried, you know, actually moving your goddamn unit for the condition to turn true?
Hm, it works from a console, but not for server scripts.
CBA is a frame eater
No, it is just hard to debug on a server.
nearly every macro use is excessive macro use
thats so mean
MACROs are great for eh.. borrowing code from other mods
that sounds awfully close to "scripts that run on server don't show errors on my local screen" which is strange
Remove all mods, run a random scenario, check frames
Load CBA, repeat, see significant amount beyond measurement error missing
armas netcode is something but its not "im going to share every script error with every connected client" something
*functions
wait you are mildly interested
not mildly infuriating
i always thought your username was mildly infuriating
After excessive exposure to Arma that would be more correct
thats why i thought it
Mildly_Overexposed
Although CAD and forum software are doing their part, not sure what's worse
inb4 "i've opened FreeCAD forums once and my life changed entirely"
I'll never touch the curse that is FreeCAD, the paid ones are bad enough
definitely Arma, CAD becomes catharthic after the first 500hrs of using any software
@south swan that sounds awfully close to "scripts that run on server don't show errors on my local screen" which is strange
Even if the server is local? Does it seem strange to you? ๐
CBA's code only checks until it finds one that shouldn't run.
Which might be the first, so it might only check one piece of code whether it should run.
But the engine always checks all scheduled scripts, even if you have hundreds/thousands. or atleast until the 3ms time limit is over.
Which might even already be over before it manages to execute the first line of script because the checking/sorting took too long
doesnt happen
Yes it does. Scripts don't have any control over whether to report errors or not.
The thing thats different is that in unscheduled scripts, a undefined variable is not considered to be an error.
For undefined variables you do not get an error, but not because you don't get any errors.
All errors are still present and will still be thrown
i mean, if we're at "thousands of threads" territory - we're only one (although big) assumption from "thousands of waiting entries in CBA's waitAndExecArray getting sorted every frame when the new ones are added" ๐
but that's arguing for arguing sake already, i just admit i've never written or debugged anything big enough to get either of solutions even close to their limits
Yeah well duh.
If you don't make the player run (change its speed) and the broken code never runs, then ofc it never errors..
Also is that 3 second timeout supposed to be a trick, to make us not see the error if we are too slow and it times out?
Here is your error.
Copy-pasted exactly your code, then quickly (to get past your tricky timeout) exit console and start running with player.
eyyy, heavy artillery is here
Okey then please show an example that proves your point and disproves all the other experienced scripters that have the opposite of your opinion
No you have.
Like wtf.
You have code that only executes if your player starts running within 3 seconds of executing it.
You do not run at all, thus the code with the error never executes.
And then you try to use the no error popping up as proof?
Reducing the distance from 50 to 5 nearestObjects [player, ["Man"], 5] is now 0.0042 and player nearEntities ["Man", 5] is around 0.0146.
I am absolutely serious here btw.
Because if you can show me one, that's a bug that I gotta fix
@still forum One moment, I'm making the test function.
WTF... I can't reproduce it now with test functions. I need to dig in - there could be more specific cases, as I used nested CBA functions (maybe it was the cause?).
But this is the reason I was needed to rework all the mod (hundreds of CBA function calls written before) to spawn procedures - I just didn't see any error inside.
So, I mistook the bug for a feature, and never thought it is the bug - so it is hard to find the real case, all functions are rewritten and fixed.
I'll try to reproduce it in the real campaign code. Maybe it is for dedicated only - I test the campaign mostly on dedicated.
The difference with all your previous examples was just that the code that had the error, was never executed.
And errors are only printed when trying to be executed
Don't pay any attention to it, I never ran CBA functions from a console, only as a part of server scripts. So not "tada", guys, at least the problem existed, and it was the bug. I was wrong about it being a "feature", yes, so sorry.
And I can't say for sure right now if the bug is gone because of a game update, or just because the CBA functions are no longer used.
I'll try to get some missions code from backup.
server scripts show the debug message on the server
which you arent
server scripts show the debug message on the server
Because it shows error in the dedicated server log maybe? Which I read line by line?
I didn't say it doesn't work for you, I just said it was a bug. For me, yes. Do you expect to have the same bug? I doubt it, as my scripts are... very complex, to be short ๐
And if the bug is still unknown, it most likely requires some specific conditions. I just need to recreate it.
my brother in christ i wrote an entire physics engine in sqf using cba functions and not once had this issue
your scripts are only very complex if they are written poorly
Your favorite thing, as I see it, is shifting accents.
๐คจ
can you please stop beating the same dead horse? Thanks in advance.
Such a shame that HitPart triggers separately for direct hit and for splash damage
you can check if is direct
Because HandleDamage combines both damages in same EH fire streak
The issue is that there is no easy way to tell separate hits
For example if you have is_direct=true fire and then is_direct=false fire
Does it mean it was single hit (direct and then explosion) or it was one direct hit and then one mess but splash hit? Is such case even possible?
I'm testing it by shooting RPG at a unit, it does 3 fires:
Direct, Splash, Splash
isnt it the same for handleDamage but x4?
Handledamage fires multiple times in the same frame after all
It'd be nice if there was a good way to associate splashes with their directs, but I definitely don't want them to be merged. Distinguishing between them is useful.
There is a flag in each hitpart array
at least for hD, the behaviour is to happen once per hit per type per selection
๐ค
I'm trying to do a seemingly impossible task, associate HitPart with HandleDamage
Indeed, fake HD fires aside looks like That Direct+Splash+Splash triggered single sequence of HD calls
Shooting 1 bullet through 2 legs triggers 2 HitParts: Direct, Direct and also 2 sequences of HD
I wonder if situation where HitParts triggers like Direct+Splash+Splash could mean 2 separate hits?
First hit: Direct+Splash
Second hit: Splash only
Is this even possible in the engine? Is there a projectile that passes through doing splash and then another splash separately?
Now wondering whether a bullet passing through two legs does twice as much general damage.
Iirc the damage is proportional to projectile's speed change?
Or just speed at impact 
Looks like it does:
https://pastebin.mozilla.org/eVzAZs2J/raw
Second leg only got ~0.3 overall damage compared to first leg getting ~0.4
Not sure if velocity falloff or just smaller intersection.
First leg penetration should reduce speed. I'm like 98% sure
2 legs: [vectorMagnitude [-283.549,-694.871,-275.549], vectorMagnitude [-162.136,-397.224,-175.385]] => [799.483,463.503]
1 leg: [vectorMagnitude [-528.987,550.867,-235.394]] => [799.182]
Arma's default injury modelling is pretty basic but yes, it is true that your speed is reduced when you're shot in the leg
from HitPart
lost like 45% of its speed
I shot approximately through center of both legs btw
Well, looks like leg shots can yield you more damage if you hit both
I guess the common arm -> body would also do that, although body shots do little general damage.
(assuming some body armour)
I want to test if gross overpen does less damage
With 4 AI next to me the result for nearestObjects [player, ["Man"], 7] is 0.0053 and for player nearEntities ["Man", 7] it's 0.0155. So it seems like there is a sweet spot for nearestObjects being faster than nearEntities for smaller searches and the number of objects that match the type you are looking for within the radius.
it does
atleast with vehicles and the like
like this was toyed with a while ago so maybe I'm misremembering a detail but with the ammo rack components in spearhead we had to make them very dense but easy to penetrate cuz otherwise tank shells would sail right through them, dealing very little damage
Does A3 have a workable APHE fuzing model, or is it all just the same "AP" as pure kinetic penetrators like APFSDS?
Inb4 it's dumb HE model
soooo.... playMusic "" is supposed to trigger a "MusicStop" Eventhandler, but it doesnt?
Do i do something wrong here?
Hm
so it does, but only when there is an actual track being played ...
guess that makes sense
do you mean in the sense of 'penetrates x amount to detonate'?
because nah - can probably do something scripted with hitpart
Q: not sure what the best channel is for this question, looking for some javascript based templates, maybe they use gulp, etc, to package addons, mods, etc? I don't mind adapting example code to suit our internal organizational patterns, folders, files, that sort of thing. wonder if such a thing exists?
ah yes, I should probably do scripting in notepad++ or something instead of all in the debug console
Small scripts it's fine, but even when using advanced dev tools, large/long scripts- Well, I just had an if statement twice xD
if(count _memPoints == 0)then{
continue;
};
if(count _memPoints == 0)then{
}else{
... // DO STUFF if it has valid mem points
};
sooo yea- xD
waitUntil {...} to sleep or to uiSleep? I'm not clear the difference...
what do you want to wait for?
for a var to become available, at the time of the spawn may not be defined yet
Suspend execution of script for given UI time. uiSleep is a sleep method to delay script execution where script time/simulation time is stopped. uiSleep is basically using the system time (uiTime more specifically) and not simulation time. So in the cases where sleep would get stuck indefinitely, uiSleep can still be used to effectively delay script execution for example in pause or in a mission briefing or an editor or when simulation is paused in general.
well you really shouldn't wait for a var to become available. if you do, it typically means you're doing something wrong
but in any case, it depends how the var becomes available. uiSleep means wait in UI time (what you experience as human). sleep means wait in game time (e.g. it could be slower or faster due to time acceleration, game pause, etc.)
sounds like uiSleep for the win. thanks.
Known bug but.. also a bug that was fixed months ago
๐
well.. i use the current stable, so if its "fixed" ... should i make a bug report?
There should be a old FT ticket that you should be able to find
if not fixed it should be reopened not a new one
https://feedback.bistudio.com/T173412 here it was
added a comment ๐
onMissionLoad seems to not function in same way as other 3DEN event handlers?
My Function:
checkUnits
[] spawn {
if ("ace_arsenal" in activatedAddons) then {
// Unit calls fnc after ACE Arsenal loadout is applied
["ace_arsenal_displayClosed",{
[] spawn {
uiSleep 0.1;
{
if (_x isKindOf "Man") then {
[_x] call Deg_TB_fnc_checkBalaclava;
};
}forEach allUnits;
systemChat "ace_arsenal_displayClosed";
};
}] call CBA_fnc_addEventHandler;
// Detect face change in ACE Arsenal, issue correct balaclava face if balaclava goggles are worn
["ace_arsenal_displayOpened", {
[] spawn {
[] spawn {
while{uisleep 0.01; !(isNil "ace_arsenal_center")} do {
if(!(isNil "ace_arsenal_center") && "Deg_TB_" in (goggles ace_arsenal_center) && !("Deg_TB_" in (face ace_arsenal_center)))then{
ace_arsenal_center call Deg_TB_fnc_checkBalaclava;
};
systemChat "ACE Arsenal Is Open";
};
};
};
}] call CBA_fnc_addEventHandler;
};
};
Expected:
systemChat for events when ACE Arsenal is opened/closed
What works:
- Init
- onMissionNew
- onMissionPreviewEnd
- executing the code from console after mission load (3DEN)
Does not work:
- onMissionLoad
I'm fairly new to scripting so I'd appreciate any suggestions?
Config.cpp
class Cfg3DEN
{
class EventHandlers
{
class Deg_TB_3DEN_EH
{
Init = "[] call Deg_TB_fnc_checkUnits";
OnMissionNew = "[] call Deg_TB_fnc_checkUnits";
OnMissionPreviewEnd = "[] call Deg_TB_fnc_checkUnits";
OnMissionLoad = "[] call Deg_TB_fnc_checkUnits";
};
};
};
trying to find the command groups for those things in the map, log briefing and such. is that diary?
thanks I'll have a look, it vaguely rings a ๐
@waxen hearth Do you know if the event is firing at all?
Yep, tested with additional systemChat. Event itself fires, but CBA event handlers are not applied to mission.
I tried spawns inside spawns, without spawn, nothing seems to work. I tried to delay with uiSleep, still nothing.
What about the activatedAddons check?
I have no idea what that does. Both activatedAddons and activateAddons are undocumented.
everything under IF is triggering as well, its just that event handlers are not applied
however they are applied with init, onMissionNew, and onMissionPreviewEnd
just not with onMissionload

That suggests that CBA is clearing out the event handlers after you add them.
wouldn't uiSleep delay work around this? or you're suggesting CBA somehow clears them after they're added?
which does not happen with other 3den EHs, as said before
shrugs
You're dealing with two sources of undocumented initialization order here.
You'd probably need to read CBA at least.
wait no
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.
So, this is meant to help me make powerlines for terrain builder. But the lines aren't QUITE right-
other side is similar, it's not actually on the map1 or map2 points
is it scale? does scale mess with rotation?
I know I'm doing something wrong with my math, but I have no clue what
idek if it will work with 3 or more, instead of 2
How to make the bullet projectile effect for screenshots
what
Well I mean the yellow light that comes after you shoot
ok, tracers. i guess open console and initiate camera, set time to 0 during shooting?
Wait, I named the wrong thing, I mean how to create the muzzle flash for static scenes for screenshots
People usually use mods like POLPOX's Artwork Supporter, which has a function to make units continuously fire
Is that when you run the tests multiple times on different spots to make it reproducable and not an anomaly?
Hello guys,
I have written a script which marks the enemy players on the map for a certain time. The problem is that dead players are also shown on the map. Does anyone have an idea how I can make it so that only living players are displayed?
Here is my script:
hint "Gegner werden auf der Karte angezeigt";
sleep 1;
if (side player == west) then {
hintSilent "Spieler ist auf der blufor seite!";
sleep 1;
hintSilent "";
sleep 1;
for "_i" from 1 to 30 do {
sleep 0.1;
_playerPosition1 = getPosATL p1;
_playerPosition2 = getPosATL p2;
_playerPosition3 = getPosATL p3;
_playerPosition4 = getPosATL p4;
_playerMarker1 = createMarker ["marker1", _playerPosition1];
_playerMarker1 setMarkerType "hd_objective";
_playerMarker2 = createMarker ["marker2", _playerPosition2];
_playerMarker2 setMarkerType "hd_objective";
_playerMarker3 = createMarker ["marker3", _playerPosition3];
_playerMarker3 setMarkerType "hd_objective";
_playerMarker4 = createMarker ["marker4", _playerPosition4];
_playerMarker4 setMarkerType "hd_objective";
sleep 1;
deleteMarker "marker1";
deleteMarker "marker2";
deleteMarker "marker3";
deleteMarker "marker4";
}
} else {
hintSilent "Spieler ist auf der Opfor seite!";
sleep 1;
hintSilent "";
sleep 1;
for "_i" from 1 to 30 do {
sleep 0.1;
_playerPosition5 = getPosATL p5;
_playerPosition6 = getPosATL p6;
_playerPosition7 = getPosATL p7;
_playerPosition8 = getPosATL p8;
_playerMarker5 = createMarker ["marker5", _playerPosition5];
_playerMarker5 setMarkerType "hd_objective";
_playerMarker6 = createMarker ["marker6", _playerPosition6];
_playerMarker6 setMarkerType "hd_objective";
_playerMarker7 = createMarker ["marker7", _playerPosition7];
_playerMarker7 setMarkerType "hd_objective";
_playerMarker8 = createMarker ["marker8", _playerPosition8];
_playerMarker8 setMarkerType "hd_objective";
sleep 1;
deleteMarker "marker5";
deleteMarker "marker6";
deleteMarker "marker7";
deleteMarker "marker8";
}
};```
Maybe someone has an idea and can help me. ๐
if(alive p1) then {
_playerMarker1 = createMarker ["marker1", _playerPosition1];
_playerMarker1 setMarkerType "hd_objective";
};
``` for each `createMarker`
but you really should start using Arrays
And indentation :P
Okay, thanks. This is my first project and am not so confident with arrays yet but thanks for your feedback ๐
Are you blinking markers using createMarker/deleteMarker?
yes
you should use setMarkerAlpha for that instead. Either version might be irregular in MP though.
They must be updated when the player moves
setMarkerPos
yes I did this
In an ideal world you do this stuff client-local using the setMarker*Local commands but that might be a bit much if you're new.
nearestObjects and nearEntities work differently
nearEntities goes through all entities in the world while nearestObjects addresses grids with list of entities currenty in that grid
is it possible to add backpack to a backpack
If the backpack allows that, yes AFAIK
number of addressed grids increases with radius in nearestObjects
nearEntities always goes through every entity and does radius check for each
@meager granite Thanks, that makes sense. I ran some more tests with different amount of objects and the time for nearEntities linearly increases on the object amount, it made a lovely graph too https://i.gyazo.com/d1cfcc04826d5a6e4515e1d13890e565.png
morning guys. ive got a issue with animations on dedicated server. seems like the initializaton of the code is executed too late. units are doing the anims, but they look in different directions and are on slightly different places. i executed the code in the init, initserver and in the units init line, no luck. even tried remoteexec, no luck too. they play the anims but issue remains. using the "normal" Bis function
[civ_3, "LISTEN_BRIEFING", "ASIS"] call BIS_fnc_ambientAnim;
is there a way to make them execute the code earlier and trustfully so they dont port around?
This function is not a good idea in multiplayer but sadly there are no alternatives except you wanna use mods.
@winter rose I remember you wanted to write some new functions for this?
hah!
got it working
using snappoints, (i use cyan arrows, hiding the model, and then executing the functions in the init, makes them do things perfect)
thanks revo
you have to syncronize the unit with the snappoint
works perfectly
@queen cargo thanks for fulfilling your promise but i'll stick with mine, it's much faster
21ms vs 0.06ms
as i said
it has room for improvements
its going through it char by char
and doing that the most old way you could imagine
something's broken somewhere with it too, it returns "ESCAPE" not "foobar" lol
16:48:53 #########################################################
16:48:53 "Frame 4119232: FiredMan: B_Soldier_F"
16:48:53 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","arifle_MX_GL_F","GL_3GL_F","Single","G_40mm_HE","3Rnd_HE_Grenade_shell","1780686: ugl_slug.p3d (G_40mm_HE)","<NULL-object> ()"]
16:48:53 #########################################################
16:48:53 "Frame 4119238: HitPart: I_Heli_Transport_02_F"
16:48:53 ["1eb7dd52040# 1780351: heli_transport_02_f.p3d (I_Heli_Transport_02_F)","B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","1780686: ugl_slug.p3d (G_40mm_HE)",[6836.83,16286.6,87.2636],[-66.8329,42.3681,9.25785],[],[80,8,6,1,"G_40mm_HE"],[0.613409,-0.788473,-0.0451515],1.64285,"a3\data_f\penetration\armour_plate_16mm.bisurf",true]
16:48:54 #########################################################
16:48:54 "Frame 4119280: HitPart: I_Heli_Transport_02_F"
16:48:54 ["1eb7dd52040# 1780351: heli_transport_02_f.p3d (I_Heli_Transport_02_F)","B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","1780686: ugl_slug.p3d (G_40mm_HE)",[6836.83,16286.6,86.9409],[0.000613212,-0.000788219,-2.54834],[],[80,8,6,1,"G_40mm_HE"],[0.420269,0.171321,0.891079],1.61775,"a3\data_f\penetration\armour_plate_12mm.bisurf",true]
16:48:54 #########################################################
16:48:54 "Frame 4119290: HitPart: I_Heli_Transport_02_F"
16:48:54 ["1eb7dd52040# 1780351: heli_transport_02_f.p3d (I_Heli_Transport_02_F)","B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","1780686: ugl_slug.p3d (G_40mm_HE)",[6836.83,16286.6,86.9411],[0.000420269,0.000171321,-0.0874062],[],[80,8,6,1,"G_40mm_HE"],[0.420269,0.171321,0.891079],1.61775,"a3\data_f\penetration\armour_plate_12mm.bisurf",true]
... etc 100 times ...
So if you hit a vehicle with a grenade point blank it triggers hundreds of HitPart but none result in HandleDamage (on soldiers too)
I wonder if there is a way to tell apart such HitPart fires from ones that produce HandleDamage response? Any ideas?
(Grenade falls through the vehicle triggering HitPart several times a frame while its inside vehicle geometry)
There is no way to reliably check if fuseDistance was traveled it seems
I know that if you shoot tank\arty through trees it explodes several times during flight, can same happen with vehicles?
Can single HE shot pass through vehicles and explode twice?
Is there a special case for trees foliage or something?
