#arma3_scripting
1 messages · Page 677 of 1
you said it was the t-14 right?
yay since I don't want to load that up and go config searching, you need to find the magazine that vehicle holds, once you have that, find the turret and match that magazine, THEN get me the classname of the cfgAmmo value
or actually to make it easier on you give me a sec
i need a class name of the projectile that comes out of the turret when that weapon is fired. you can either start searching for me or wait lol
so
its is not the magazine class name, or the ammo class name
just... hold on lol
No one has any advice for me
put this in the vehicle init box, and fire the weapon. then paste the result
ammoProjectiles = [];
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
ammoProjectiles pushBack typeOf _projectile;
copyToClipboard str ammoProjectiles;
}];
…what's your issue again?
gotcha
I printed out the _projectile in Dammaged EH
thats what I got several times
fragments?
well
it printed the same thing
with different id this time
I guess I did the same thing you did
but simpler
lol
@hushed tendon```sqf
private _players = allPlayers;
if (_players isEqualTo []) exitWith {};
_players = [_players] call BIS_fnc_arrayShuffle;
private _lurker = _players deleteAt 0;
private _runners = +_players;
yup now do it with typeOf _projectile, i want the class name
oh well
["rhs_ammo_3of26"]
thats boring
literally the same thing on display screen
lol
["rhs_ammo_3of26","rhs_ammo_3of26","rhs_ammo_3of26"]
I think it repeated itself because I shot 3 times
private _runners = allPlayers;
if (_runners isEqualTo []) exitWith {};
private _lurker = _runners deleteAt floor random count _runners;
@fair drum sorry for tagging just in case you didn't see it
faster (less readable 😛) but faster
Q: I am looking for nearestObjects of "Building" classes. That is all well and good.
I can use configOf for the objects themselves and gain knowledge of their 3D dimensions? Height, width, etc?
So this is defining the _runners , selecting one to be the _lurker, and removing the _lurker from the _runners array? Because I'm still having the issue of the _lurker being one of the ones killed off (~4/5 times) when I run a script to kill all _runners.
So this is defining the _runners , selecting one to be the _lurker, and removing the _lurker from the _runners array?
yep
Maybe I just need to give a sleep so it can process the code
k wait one
Nope. Even with a sleep and that new bit of code the person who is supposed to be the _lurker (I can tell by them being dressed up) is still getting killed when I kill all _runners.
I know it's weird
so unless your "players" array isn't unique, it's nonsense
I have it in a function here, it could just be the function. Wait one for the whole bit of code
fnc_definePlayers = {
params ["_runners"];
if (_runners isEqualTo []) exitWith {};
private _lurker = _runners deleteAt floor random count _runners;
sleep .5;
hint str(_runners);
{_x setDamage 1;}forEach _runners;
};
private _players = [p1,p2,p3];
[_players] call fnc_definePlayers;
It's in an sqf that's being execVM by the initServer.sqf. So I don't think so.
thank you
Run it directly from the debug console, without anything else
try this
private _buildings = nearestTerrainObjects [[0,0,0], ["HOUSE"], 100000];
_buildings apply {
_x addEventHandler ["Dammaged", {
params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"];
private _skipProjectiles = [ //array of ammo classnames that have fragmentation
"rhs_ammo_3of26"
];
_skipProjectiles = _skipProjectiles apply {
toUpperANSI _x
};
if ((toUpperANSI typeOf _projectile) in _skipProjectiles) exitWith {diag_log format ["%1 projectile skipped", typeOf _projectile]};
if !(gunner _shooter isEqualTo []) then {
if (_damage > 0.5 && isPlayer (gunner _shooter)) then {
counter = (counter + 1);
publicVariable "counter";
systemChat ["%1 shot %2",name (gunner _shooter)];
};
};
}];
};
I feel scared looking at this
i figured you're going to run into more fragmentation based projectiles so i made a section so you can add them
It's not running multiple times. Tried debug and if it was running multiple times all three would have a chance of dying but only two out of the three do.
wait what
What?
so if you run the code in debug, does it work as you expect it to, or no?
don't shoot me but it didn't work
It works but I still run into the same problem of the person dressed as the _lurker sometimes dying
that has nothing to do with the function
even though I'm only killing off those who are in the _runners array
as in its still counting multiple? or just nothing. if just nothing, check the rpt file. I put an error log in it
you also don't return the lurker from the function, instead you run selectRandom later at line 19
so you roll the dice again, which obviously has a small chance of matching what the function randomly picked
it didn't fire
and you shot the frag round?
yes
check the .rpt file
where?
Dammit. Was not checking any other parts of my code
run time
then just do a search for "projectile skipped"
fnc_definePlayers = {
params ["_runners"];
if (_runners isEqualTo []) exitWith {};
private _lurker = _runners deleteAt floor random count _runners;
{ _x setDamage 1 } forEach _runners;
_lurker // return
};
private _players = [p1,p2,p3];
private _lurker = [_players] call fnc_definePlayers; // use it now
_genSpawn = selectRandom [genSpawn_1,genSpawn_2,genSpawn_3];
_gen = createVehicle ["Land_Portable_generator_F", getPosATL _genSpawn, [], 0, "CAN_COLLIDE"];
_gen enableSimulationGlobal false;
the last one
is at 5pm
the last file
f
Yep, it works now. Thanks for helping me with my oversight.
well
no project destroyed
skipped
eh it is what it is. go finish the rest of your mission and we might revisit it later. I'm going out.
pm me exactly what you copy pasted
cause there were a few edits I made since I first posted it. don't know if you got those
Would BIS_fnc_storeParamsValues & BIS_fnc_getParamValue be the correct way to call upon a mission parameter value? I'm trying to make a script conditional on whether a parameter is set to on/off and I'm a little confused as to how to pull the value from the parameter. Been looking for examples without much luck
you would only need to use BIS_fnc_getParamValue, BIS_fnc_storeParamsValues runs automatically
have you read this page already? https://community.bistudio.com/wiki/Mission_Parameters
Edit: I'm incredibly dumb.
I had quotation marks in the wrong place.
It all works now. 
I'm trying to make the name of the spawned generator change based on the number of the for loop. I'm almost certain this won't work so I'm looking for advice.
_generators = []
fnc_setupGenerators = {
params ["_numGenerators","_genSpawns"];
for "_i" from 1 to _numGenerators do { systemChat str _i;
_genSpawn = selectRandom _genSpawns;
_gen = "_gen_" + _i;
_gen = createVehicle ["Land_Portable_generator_F", getPosATL _genSpawn, [], 0, "CAN_COLLIDE"];
_gen enableSimulationGlobal false;
_generators = _generators + _gen;
};
};
The first time the loop runs I'm hoping for _gen to equal _gen_1, with the second run making _gen be _gen_2. This is so I can name each generator spawned a different name so I can manipulate each one individually.
kinda interesting to see another person making a dead by daylight game. I saw another earlier this week that was looking for help on one too. grabs popcorn may the race begin!
you are overwriting your _gen when you do your createVehicle
are you trying to make them local or global variables, or just added to the _generators array?
is there a way to test network load on a server? trying to see how network intensive some of my scripts that contain public variables are.
for all ACE 3 guys out there
is there a way to find how many fragments does a shell produce? according to there variables:
ACE_damageType = "shell";
ace_frag_charge = 3200;
ace_frag_gurney_c = 2440;
ace_frag_gurney_k = "1/2";
ace_frag_metal = 16000;
ace_rearm_caliber = 125;
Global and added to the array. I’m just looking for a way to change the name of each spawned generator for each run of the loop.
_generators = [];
fnc_setupGenerators = {
params ["_numGenerators","_genSpawns"];
for "_i" from 1 to _numGenerators do {
systemChat str _i;
_genSpawn = selectRandom _genSpawns;
_gen = createVehicle ["Land_Portable_generator_F", getPosATL _genSpawn, [], 0, "CAN_COLLIDE"];
_gen enableSimulationGlobal false;
missionNamespace setVariable ["_gen_" + str _i,_gen];
_generators pushBack _gen;
};
};
Thanks!
Can someone explain why and how addWeaponGlobal is broken (especially since addMagazineGlobal was apparently fixed in 2.00) and whether to use addWeapon or addWeaponGlobal if I'm doing a forEach allPlayers?
How did you do, I said?
Right now I'm just wondering why the wiki page for it has a big "broken" sign on it, came across it as I was learning inventory commands since I want to wipe player inventories for a deathmatch race event at the end of the mission
private _headlessClients = entities "HeadlessClient_F";
private _humanPlayers = allPlayers - _headlessClients;
{
removeAllItems _x;
removeAllWeapons _x;
_x forceaddUniform "Dominos_Uniform";
_x addVest "V_PlateCarrierSpec_blk";
_x addWeapon "hgun_test_pistol_f";
_x addMagazine "TAS_6Rnd_00Buck";
_x addMagazine "TAS_6Rnd_00Buck";
_x addMagazine "TAS_6Rnd_00Buck";
_x addMagazine "TAS_6Rnd_00Buck";
_x addMagazine "TAS_6rnd_Slug";
_x addMagazine "TAS_6rnd_Slug";
_x addMagazine "TAS_6rnd_Slug";
_x addMagazine "TAS_6rnd_Slug";
_x addMagazine "TAS_6rnd_Slug";
_x addMagazine "TAS_6rnd_Frag";
_x addItem "FirstAidKit";
_x addItem "FirstAidKit";
_x addItem "FirstAidKit";
} forEach _humanPlayers;
this seems to work but not sure if it'll work in dedi, also not finished
Those commands are all global AFAIK so will work
hmm alright thx
How do I get the name of the current terrain?
That however is the internal name and not the one the user sees
What is the internal name? Is is the same as the ending on mission files?
correct
Okay, thanks. I'll write a name converter.
you could grab it from the config with worldName, too
something like```sqf
getText ("CfgWorlds" >> worldName >> "displayName")
Oh yeah, that's brilliant.
"description" seems to be used instead of "displayName"
is it possible to disable the global ban list for a arma 3 server without disable complete battleye
?
huh… why?
Because my friends account has global ban
disable BE, that's it
yes i know but i need battleye for rcon control
then your friend cannot play with you 🤷♂️
but i think there is a way because i played on a other server and there he also can join and they have also activated battleye
I am not aware of that then. anyway, not through #arma3_scripting. maaaybe through #server_admins.
ok thanks
Any way of looping something every one in-game second? This solution is bad as it eventually drifts away from the actual time:
while {true} do {
sleep 1;
}
After being called a thousand times, there's a difference of a second or two from time.
Use "EachFrame" EH
And instead of sleeping a full second, only sleep 0.1 seconds and check the time difference since the last time you needed the execute code.
This way you counter the fact that a frame takes longer to run.
If I recall correctly there's also a function in CBA which handles that 🤔
I want simulation time in this case, not system time which uiSleep uses.
interval = 1;
counter = 0;
addMissionEventHandler ["EachFrame", {
counter = counter + (["delta"] call BIS_fnc_deltaTime);
if (counter < interval) exitWith {};
systemChat format ["%1", time];
counter = counter - interval;
}];
Outputs
1.003
2.005
3.012
4.009
5.004
This seems to work. No longer drifts away. Thanks.
is there a way to check if there is a unit seated on a given cargo position of a vehicle ? Something like _veh getUnitCargo 4, which would return objNull if the seat is unoccupied or the relevant unit otherwise ?
there is the getCargoIndex command, you can use that to figure out if the position is taken
Does anyone happen to know the name of the function that kills you depending on the vehicle you are in meaning it kills you with an AA missile when you are in a jet or helicopter, with an AT mine when you are in a vehicle and with an APERS mine when you are on foot.
I stumbled upon it couple of weeks ago but can't remember the name.
Edit: Found it, it's BIS_fnc_neutralizeUnit.
like cycling with forEach units _veh and checking if _veh getCargoIndex _x is equal to the desired position ?
not very efficient
no but should work
https://community.bistudio.com/wiki/fullCrew maybe? pretty sure the return order is always the same
BIS_fnc_deltaTime
diag_deltaTime
is ACE fragments random? (in terms of numbers)
ohhhh that looks neat !
Good day. Is there any event handler for weapon change? Like "OnWeaponChanged"?
nope
Pity. Thanks.
CBA can help you https://github.com/CBATeam/CBA_A3/wiki/Player-Events
Thank you
Hey there, hope you're all doing well. Does any1 know how to set a tooltip on a controls table? i can't get it to work
#arma3_gui may know 😉
Maybe, thank you
This is probably pretty easy to see but I'm missing it, does anyone see what's wrong with
{_x moveinany dropship2;} foreach (group group2lead);
units group group2lead
AH ok. Right
units group2lead should work too, no need for group 😉
Awesome. Thanks!
I'm trying to get the name of the generator in the addAction and I don't really understand how to do so.
fnc_setupGenerators = {
for "_i" from 1 to PUB_numGenerators do {
_genSpawn = selectRandom PUB_genSpawns;
PUB_genSpawns = PUB_genSpawns - [_genSpawn];
_gen = createVehicle ["Land_Portable_generator_F", getPosATL _genSpawn, [], 0, "CAN_COLLIDE"];
_gen enableSimulationGlobal false;
[_gen] call fnc_addActionGen;
missionNamespace setVariable ["_gen_" + str _i,_gen];
PUB_generators pushBack _gen;
};
};
fnc_addActionGen = {
params ["_gen"];
_gen addAction [
"Repair", {
systemChat str _gen;
}, nil, 1.5, true, true, "", "true", 15, false, "", ""];
};
systemChat str (_this#0); in the action code
I need the _gen = part. Like _gen_1, the whole reason for this
missionNamespace setVariable ["_gen_" + str _i,_gen];
I'm trying to get the generators name. Pretty much trying to find what generator it is, like if it's _gen_2.
I realize the systemChat str was wrong.
private _genName = "_gen_" + str _i;
missionNamespace setVariable [_genName,_gen];
_gen setVehicleVarName _genName;
...
systemChat vehicleVarName(_this#0);
this then?
or, maybe set a variable with the name, or parse the string as an argument to the action, or format it into the action code, etc etc?
My brain's working a little bit better now. I'm trying to find the variable name for _gen. Seeing as the for loop is creating generators that have a name of _gen_ but a number is added to the end because of _i in
missionNamespace setVariable ["_gen_" + str _i,_gen];
yea...
hey all having issuees getting all the compatible muzzle attachments names. I am trying with the MX and it is returning an empty array.
_pWeap = primaryWeapon player;
diag_log _pWeap;
_MuzzleSlot = getArray (configFile / "CfgWeapons" >> _pWeap >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems");
diag_log _MuzzleSlot;
this outputs
19:52:51 "arifle_MX_pointer_F"
19:52:51 []
my end goal, is to after i have this array of compatible muzzle items, i would run through the players inventory and remove any that are there. im doing this to stop people having suppersorrs
can anyone give me a heads up as to what im doing wrong?
compatibleItems does not appear to be an array
configProperties[configfile >> "CfgWeapons" >> "arifle_MX_pointer_F" >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems","true",true] apply {configName _x}```
what does this do?
sorry for being dense
it is a config class, not an array, so that returns all property names of that class (attachment names)
Small question. Is this:
{PUB_genTotalScore = PUB_genTotalScore - 3}sqf
and this:
{PUB_genTotalScore - 3} ```sqf
the same thing?
To use syntax highlighter, check the pinned
sqf, and put Enter(break line)
the bottom throws out a return (if that's what you want), the top changes the variable itself
im trying to change the var, thanks @fair drum and @warm hedge
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
hey POLPOX I have a small question actually. You made a small mod that changes the VR skybox for screenshot use. Do you know if that mod is able to be played in multiplayer?
thanks
It does only changes the skybox/lighting. nothing should conflicts with something
thanks
So yes. Never tried tho
@robust hollow your a genius thank you man
there a way to get the chosen element when a player is selecting their respawn inventory with the respawn inventories template? matter of fact, is there a way to get the selected element when a player chooses a respawn location? I typically find their spawn location through distance comparisons to each other.
There was a fairly new command to put for example a briefcase to units hand, wasn’t? Or did they just tweak some memory point stuff? Can’t find anything related...
Isn't. If you meant attachTo, maybe...?
I'm not sure... I saw this video where unit was walking around with briefcase in his hand and it was looking much better than it used to look.
That's just an attachTo
Allright. Thanks.
I have a really stupid question, but idk how to do it
{
if (side _x == east) then
{
null = _x spawn INF_fnc_infecthim; };
} forEach (allUnits);
i want this to loop every second
while is the command
while {true /* some better condition */} do {
sleep 1;
{_x spawn INF_fnc_infecthim} forEach units east;
};```
tnx
alright scripting gurus I am running into some trouble. I am building a mission that will have set kits based on player slot/role. I can get the player slot to start with the kit I made. Respawn gives the base units stuff not the custom kit. I am a novice at all this so can use some direction. Also running into an issue with a script line not sure if there is a better way to put this or swap function. Of course the sqf thing doesnt work...
if ("DemoCharge_Remote_Mag" in _itemsPlayer) then {_playerRole = "SEAL_AMMO";};
ty
can you somehow create object if you only know the file name? ("walkover_01_f.p3d")
if you know the full path you can create a simple object
I just have the filename, not full path
but you can't create the full object with just the model (an object needs a config)
then no
unless you search in the config to find it
(but there's no guarantee it's defined in the config)
right
And there could be multiple configs using the same model
but how do you have just the name?
if you have the name you probably have the path too?
with nearObjects
so use getModelInfo and get its path
anyone know if it is normal that on dedicated server, the hold action is doubled and the trigger associate to it is not working?
eg: i put a hold action with deletevehicle on the object. Then a trigger with !alive . it work well on multiplayer and singleplayer but on dedicated, the holdaction, get doubled and the trigger dont activate
lets see the code for the adding of the hold action
it sounds like your execution location or which computers you are executing it on is messed up
@fair drum what was the website to paste the code?
so that object's init box gets fired on every machine already. meaning if you remote execute it to every machine, you get 1 full send to everyone for the server, then n amount of sends for every client that connects. if you had 60 players, you'd have 61 actions
omg
so what you want to do is add a if !(isServer) exitWith {}; before the code so that it ignores any clients
if you want other code that the client will see, its better to just put the server code block in a if (isServer) then {//code}; block
or even more simply, you can just call the hold action without remote executing it at all, which will then fire on the client when that object loads for them
Bonus points for both code structure and your sanity as the mission grows if you move that code from the init box into initServer.sqf 🙂
i like to have a debug line that berates me in every single function that if I end up calling the function on the wrong machine, it yells at me calling me an idiot
Anyone know how to properly delete tasks?
[player, ["task1"], ["Task description", "Task title", "Task"], objNull, true, -1, true] call BIS_fnc_taskCreate;
["task1", player] call BIS_fnc_deleteTask;```
The task remains in the map menu.
Any help appreciated
single player, multiplayer, dedicated, where you calling it?
wat?
if it's for everyone just put it in initPlayerLocal.sqf
it was a basic fix for the immedate problem he was having
he can move everything outside the editor if he wants
@fair drum i tried what u suggested of adding the is server and the exith with but it is still doubling
I am testing single player, but will be MP. everything says global so didnt think it would matter
nope, that exitWith was meant to be a blank scope {};
if !(isServer) exitWith {}; ** before the code **
it reads, if the machine isn't the server, leave silently now and never come back 😉
sorry i dont get this blank scope and before the code. i put the is server before the code no?
yea i noticed that in mp
if !(isServer) exitWith {}; //if the machine isn't a server, do nothing and leave.
//code if it passes the server check
yeah. but like leo and ansin mentioned, you need to start moving things outside of the editor. its easier to manage.
and say your editor save becomes corrupted, you don't lose EVERYTHING.
you at least get to keep your scripts
while you're active and to answer previous question, I am interested in singleplayer for now
let me throw your code in so I can see what you are experiencing
the current reason as to why i prefer to keep things on editor is bc some of my script is not reflected into the server's editor object and trigger.
Most likely bc of the local vs global variable and all. still learning but thanks for the tips
A long a glorious road brother, keep going! Im curious what your working on, i like collecting things
i was trying to make a zombie mission with a build a rocket to escape concept from left4dead with a few changes and skill/perk
sounds awesome, looking forward to seeing it live
tried doing a multiplayer given most of my coding knowledge are based around it. but it will my kill fps and slow my game when i spawn like 100 zombies. so i am trying to move to dedicated
spoiler alert! 😠
? how so? XD
I changed it to the side when I was testing
["task1", west] call bis_fnc_deleteTask
and it worked. Do you need this to be for an individual unit?
I was going to start playing left4dead!
start playing left4dead in 2021?
dont worry that is a custom mode, the build the rocket. XD so no spoiling
I was deep in studying back when it came out! 
probably the better idea. or else you could have been like me and enter medical school at 30...
not that there's anything wrong with that lol
Hypoxic is the man, thank you. Groups work and testing the various types shoulda been happening. thanks for answer and lesson. woot problem solved
yea tbh medical school is hard. who care if it take a bit more time. as long as u can become wha tu want
a lot of people start it later in life. you end up doing something else like nursing or paramedic, end up liking it and want to go farther. some people have left engineering to do it as a career change.
i don't have family or kids so it was a no brainer.
Yea it is often the case nowadays where i am. people like to switch major a bit to make sure that what u want before pursuing it
btw, @fair drum the code work, but the trigger is not fired. do you know why?
you are using a separate trigger right?
yes
why do you use a trigger?
just do whatever you want when you delete it
to set a task to complet
you can do that too
hes saying you can put the code directly into the completed scope on the hold action that contains a bis_fnc_tasksetstate
and avoid the trigger all together
in other words: when you know "when" something happens, why do you loop to find when?!
it's like knowing that the store opens at 8AM, but keep going there from 12AM every minute to check!
Q: about triggers, what is "EmptyDetector"? Is that a class/config somewhere?
It is an object specifically for Triggers
Since it is an object, yes it is a class/config inside cfgVehicles
Is there a way to disable a certain PBO with a script? There is a mod that my community wants to use, but a PBO inside breaks some weapons
I want to write a quick compat mod for it since I believe the author has stopped supporting
theres always deleting it, repacking it, and distributing it to the people as a local mod
Not a good idea
I dont like stealing from those who dont deserve it
Create a mod and overwrite the changes or use the delete keyword
delete keyword where is this? Looking for something like it on wiki but can tfind
so i would make a PBO which has a class file which deleted the bad PBO? Or the classes in that PBO?
The classes
If it's a vanilla class you wanna reset the class to the default values though, not just delete it 😄
someone said it changes the value of an RPG shot so ill need to figure out how to set it to default. To make sure it loads after another mod, I would make this mod dependant on the bad mod right?
requiredAddons of your mod needs to contain the broken mod.
To find out the default values, just start vanilla a3
I guess my follow on question is, what is the config then? can we derive from it? add new bits to it? etc...
Yes, through modding you can inherit from it or modify it
select isn't copying anything
Out of curiosity does anyone know if this is set right? It's not triggering and I dont know if its inside the SQF that its failing or its not even loading it
"Intro.sqf" remoteExec ["Execvm", -2];
note that if the mission is player-hosted, he won't see the intro
remoteExec 0, no -2
Got it. and -2 if I dont want the host to see it, correct?
or, as some like to do,```sqf
[0, -2] select isDedicated
2 = server
-2 = everyone but the server
That's even better! Brilliant man! Thanks!
oh ok never mind... I see, it was another typo... 🙂
apparently spawned bombs have a damage source as the player that died when the handleDamage event occurs. interesting...
alright what am I missing...
[
player,
[
"HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
if (_source == _unit) then {
_damage = 0;
};
diag_log str _damage;
_damage;
}
]
] remoteExecCall ["addEventHandler", (allPlayers select {_x distance _carrier <= 300})];
currently everything is working as wanted but the unit still dies. the diag_log is returning 0 when the player is killed by one of the scripted bombs (_source for a scripted bomb is the unit that died apparently). I have a return of damage which according to the wiki should give the resulting ending damage. Does something that has the potential to instagib a unit not work with this?
looking to make the unit invuln to any of the gbu bombs I'm using for scene explosions but still damaged by any players that shoot at them.
first of all, why remote exec? the handler will fire locally only
This EH can accept a remote unit as argument however it will only fire when the unit is local to the PC this event handler was added on.
the bombs can be the source itself iirc
anytime I return the source, it always gives me back my unit object
if I return the str _projectile, I get ""
can be splash damage
hmmm. so to figure out a way around this...
well. the diag_log returns a TON of 0s so its at least picking up the fragmentation
okay so I changed some stuff for the diag_log, apparently it was just too much for me to even see.
https://sqfbin.com/uneguloxixinefutetid
looks like the bomb does have a projectile triggering at start with a null object source then all the fragmentation counts as the player
at what size of a block of code would you consider, hey I should put this in another file?
the general rule for me is if something is used in more than one place then it becomes its own function (and file). code size is irrelevant.
I'm just in the cleaning up code part of the project. its all working but man is it a mess in organization.
code that is constantly recompiled(e.g eventhandler code), boilerplate code
all of my code currently is in different functions besides files added to init.sqf. Just decluttering by making even more functions now lol
Has anyone figured out how to change the decals on the RHSUSAF vehicles? They have documentation up for the AFRF vehicles, but the same does not seem to work for USAF
The decal on the right is what specifically I'm referring to. The numbers on the left just jsut changed with its callsign
https://i.gyazo.com/768db79944c913e2cce460ddb497bcd6.jpg
there a faster/cleaner way to do this?
private _side = [west, east];
private _northowner = selectRandom _side;
_side = _side - [_northowner];
private _southowner = _side # 0;
private _sides = [west, east];
private _north = (floor random 2) % 2;
private _south = (_north + 1) % 2;
private _northOwner = _sides select _north;
private _southOwner = _sides select _south;
probably works
Mine
Execution Time: 0.0026 ms | Cycles: 10000/10000 | Total Time: 26 ms
Yours
Execution Time: 0.0033 ms | Cycles: 10000/10000 | Total Time: 33 ms
Never thought of using modulo tho. Interesting
suprising time difference honestly, I would of thought array modification would be slow
probably due to modulo arithmetic in floating point numbers
- more SQF commands = slower
- would have please :sob:
private _northOwner = selectRandom [east, west];
private _southOwner = [west, east] select (_northOwner == west);
```maybe
@fair drum is performance really important here?
What a hacky solution :P
YES!
nah, more clean is what I want. your use of select is what I was looking for. Something that picks one, then picks the opposite
- more SQF commands = slower
in that case, "mySideSelector" callExtension "selectSide" 😛
You could then use an array variable and do == east with my code
for moar perfz
Hi, I am working on a script to restrict map markers to only be shared with players that are close by. It works by subscribing to the "MarkerCreated" mission event, then creating a local copy of the marker with createMarkerLocal if player is close enough to the marker owner, then later deleting the non-local marker. It seems to work, however I noticed the player cannot later delete the scripted marker from their map (i.e. using the Delete key). This would be important, for example in case the player needs to delete markers during the planning phase or during the mission.
It seems the markers my script create are immutable by the player, similar to markers that are part of the mission file. Is there any way to convert these markers to be editable by the player, i.e. such that player can delete them if needed?
https://community.bistudio.com/wiki/createMarker
Second note
is there an equivalent of publicVariableServer for setVariable? Global on that gets fed to every other client as well. I just want server.
I guess I could just remoteExec it. just wondering if there is another way
yes, see the wiki:sqf missionNamespace setVariable ["myVar", 42, true /* or 2, -2, 0, etc */]
you could also recreate the marker in direct chat channel
you probably just want to keep the marker name you got.
Not rename it to some custom _USER_DEFINED thing. That way the players name will also show properly on the marker
Good day. Is there an event handler to check if player layout changed? I tried "Put" but it is working in half of the cases (for example picking up a backpack does not trigger it)
loadout, no
"for example picking up a backpack does not trigger it"
yes because "Put" is put down, wheras "take" is take.
If you only take one of the two you won't get all of it
Does that mean there's a separate EH called "Take"? 🤔
yes
Interesting, I wasn't sure if it was possible to create markers in direct channel from a script, as it does not seem to be allowed by the in game map GUI.
I think I've got a working script that works by copying the source marker locally with a unique suffix in the name. Since each player gets their own local copy of the marker, they can alter or delete it as they please independently from other players. This is what I was looking for, as I want to be able to distribute markers to leaders during briefing, then they can independently work with the markers during the mission.
addMissionEventHandler ["MarkerCreated", {
params ["_marker", "_channelNumber", "_owner", "_local"];
// systemChat format ["Vanilla marker: %1, channel: %2, owner: %3, local: %4", _marker, _channelNumber, _owner, _local];
if (_marker find "LOCAL" != -1) exitWith {}; // Break recursive loop
if (player distance _owner <= 7) then {
_markerChannel = markerChannel _marker;
_markerColor = markerColor _marker;
_markerDir = markerDir _marker;
_markerPolyline = markerPolyline _marker;
_markerPos = markerPos _marker;
_markerText = markerText _marker;
_markerType = markerType _marker;
_localMarker = createMarkerLocal [
format ["%1 LOCAL %2", _marker, getPlayerID player],
_markerPos,
_markerChannel,
_owner
];
_localMarker setMarkerColorLocal _markerColor;
_localMarker setMarkerDirLocal _markerDir;
if (count markerPolyline _marker >= 4) then {
_localMarker setMarkerPolylineLocal _markerPolyline;
};
_localMarker setMarkerTextLocal _markerText;
_localMarker setMarkerTypeLocal _markerType;
};
[_marker] spawn {deleteMarkerLocal (_this select 0);} // Schedule to fix crash
}];
Actually, if all your local markers have the same name in MP. I think it might also delete the remote local markers if player goes to mal and deletes his own marker
Yes I got that issue. This script gives each one a unique name by appending the player's Client ID.
Ho ly cow, it is working xD Thanks a lot, man, appreciate it
I already asked this in the forums but I want to be absolutely sure... is there a fast way to reload new magazine to mortar? I am deleting all mags and adding just one, but the reload takes time
If it's not possible maybe a feature request could be made?
thx I did already play with that command but didnt get good results...
That is THE command. You probably did it wrong
maybe
[] spawn
{
m = vehicle player;
{
m removeMagazines _x;
} foreach (magazines m);
m addmagazine "8Rnd_82mm_Mo_shells";
m setWeaponReloadingTime [gunner m, currentMuzzle (gunner m), 0.0];
};
that's the code I have
but it loads slow
setweaponreloadingtime is for the reload time between shots within a magazine not when switching magazine/loading a new one
confusing i know
right
I don't think there's an easy way to do it for a vehicle, infantry you can
this used to work but i havent tried it recently but you can try removing the vehicles weapon and readding it after you have the magazine you want loaded available, it should load the first available magazine immediately
If it's an AI vehicle and not player just delete it and create a new one
It's AI im creating but then I want to remove the mags and add just one
Hey that seem to work! atleast reloading is faster now but not instant
Uhm.. FYI.. HashMap forEach is not savegame compatible.
If you save during forEach, and load the save it'll crash 🙃
any way to circumvent that (in a next patch I assume, if any)?
do not use it in scheduled 😄
yeah. don't sleep in forEach loop (in general there is barely any reason to use HashMap foreach anyway :U)
using keys and forEaching over them would work fine too
yay!
private _side = [west, east];
private _random_id = round random 1;
private _southowner = _side # (1 - _random_id);
private _northowner = _side # _random_id;
private _southOwner = selectRandom [west, east];
private _northowner = [west, east] select (_southOwner == west);
someone do benchmark plox
you're using array literal so it's slower! 😛
not with bytecode optimizer :U

bytecode optimiser for BIS fnc wen?
yours is faster 
mine: 0.0028 ms
yours: 0.0024 ms
that's weird. original was also 0.0028
ms
profiling branch compat mod
then one day in release?
I'll update it today already
also, can FSMs be bytecoded too?
no
then one day in release?
:3
I guess hashmaps dont have null?
have null?
like configNull etc
ok yeah that's what I meant
Result:
0.0014 ms
Cycles:
10000/10000
Code:
private _sides = [west, east];
private _southOwner = _sides deleteAt random 1;
private _northOwner = _sides # 0;
Result:
0.0018 ms
Cycles:
10000/10000
Code:
private _side = [west, east];
private _random_id = round random 1;
private _southowner = _side # (1 - _random_id);
private _northowner = _side # _random_id;
Result:
0.0017 ms
Cycles:
10000/10000
Code:
private _southOwner = selectRandom [west, east];
private _northowner = [west, east] select (_southOwner == west);
heh
isnt random 1 in range of 0 ... 0.99 ?
random 1 could be 1 but most unlikely
yeah, so?
deleteAt should round anyway
that means [0,1] deleteAt 0.51 should return 1
no need for explicit round
i thought it takes index
someone know why the mk41 vls don't detect the "hand laser designator" ?
you scripting that laser? or is it a player
the VLS doesn't have its own detection of data net. If you don't have another unit that provides the data net info, you have to use reportRemoteTarget
its weird, but thats the solution I found if you don't have another data net unit like a rhino/aa or something
no the game rounds the index
as sharp said all numbers in sqf are floats
when should I be using compile final?
when you don't need to recompile? 😄
when you save into a global variable and want to be protected against someone else overwriting your variable
the catch is that I cannot change that variable in later code correct?
ye
so this would be good for things like variables that won't change that are put into a init.sqf for example
for functions
oh you mean variables that have stored functions? do I have to worry about that if all the functions are declared in cfgFunctions then? I thought I remember reading that cfgFunctions is a safe place and people can't mess with it
would be nice to have final unary command tbh
yes I know, I just didn't know the commands accept the floating points as is
floating points always have the .
that's why they're called floating point 
was mainly referring to the selection by floating point
hi, I have a "simple" script that allows the player to control the impact point of a Titan AT turret. But I don't know why the setPos does something strange on hills. Does setPos make some checks when moving vehicles? Or how could I ensure that I move it where I want it? The fact is that I'm not sure I understand why that happens so I'm a little lost XD.
You can see the code in the link that follows with a video (minute in the video 01:00). https://forums.bohemia.net/forums/topic/234346-setpos-working-strange/
watching that linked video as a not very good at math person made me nervous at what went into that
don't use setPos
use an absolute position format
such as setPosWorld or setPosASL
ok thanks, I'll take a look at it 😍
and definitely don't use getPos
It worked with setPosWorld
... _target setPosWorld AGLToASL (screenToWorld [0.5+_sensitivity_aux,0.5]); ...
With setPosASL don't
thx for your help
ok XD
np
are hash maps case sensitive for the keys as a string?
yes
Hey not be best with scripting here but is there a way I could make Respawn Button on Escape menu only visible/functional when lifestate = Incapacitated if not then thats fine I can make other things work 🙂
You currently have respawnButton = 0; in your description.ext and its not showing up while incapacitated?
would it matter if I got the respawn manually box checked in respawn settings on the mission editor itself at first?
anything in description.ext overwrites anything in the editor attributes area, so it shouldn't matter
JIP queue is guaranteed to fire in the order JIP IDs were created right?
hey guys i'm having a very strange issue with a loot spawning script where identical code is working in one place but not another. I've been messing with this since last night and I still can't get the loot to spawn on the uniform or backpack slots, only the vest portion is working. There are also other loot arrays that are successfully spawning into uniform and backpack slots with no issue, it's specifically the ACE medical stuff that isn't working for me:
_MedicalLoot_uni1 = selectRandom [
"ACE_fieldDressing",
"ACE_packingBandage",
"ACE_elasticBandage",
"ACE_quikclot",
"ACE_morphine",
"ACE_epinephrine",
"ACE_splint",
"ACE_tourniquet",
"ACE_bloodIV"
];
_MedicalLoot_vest1 = selectRandom [
"ACE_fieldDressing",
"ACE_packingBandage",
"ACE_elasticBandage",
"ACE_quikclot",
"ACE_morphine",
"ACE_epinephrine",
"ACE_splint",
"ACE_tourniquet",
"ACE_bloodIV"
];
_MedicalLoot_back1 = selectRandom [
"ACE_fieldDressing",
"ACE_packingBandage",
"ACE_elasticBandage",
"ACE_quikclot",
"ACE_morphine",
"ACE_epinephrine",
"ACE_splint",
"ACE_tourniquet",
"ACE_bloodIV"
];
_uniform = uniformContainer _unit;
if (floor (random 5) < 4) then {
_uniform addItemCargoGlobal [_MedicalLoot_uni1, _Random_Amount_1];
};
_vest = vestContainer _unit;
if (floor (random 5) < 4) then {
_vest addItemCargoGlobal [_MedicalLoot_vest1, _Random_Amount_1];
};
_backpack = BackpackContainer _unit;
if (floor (random 5) < 3) then {
_uniform addItemCargoGlobal [_MedicalLoot_back1, _Random_Amount];
};```
```sqf
see the pinned messages
ah
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
allllllmost there...
oh i have the sqf backwards lmao
sqf goes at the top ```
HOT
bingo
random amounts not defined
oh sorry i left that part out, it is
the whole script is giant so i didn't want to post it
for example what's happening, i have this section to spawn from four different arrays and everything is defined properly, but for some reason the medical one is being left out. I even went and copy/pasted all the parts of the working vest lines over the uniform and backpack slots and renamed and it's still not spawning them strangely
if (floor (random 5) < 4) then {
_uniform addItemCargoGlobal [_addItemCargoGlobal_Array_uni1, _Random_Amount_1];
};
if (floor (random 5) < 4) then {
_uniform addItemCargoGlobal [_addItemCargoGlobal_Array_uni2, _Random_Amount_1];
};
if (floor (random 60) < 3) then {
_uniform addItemCargoGlobal [_CashChance, _Random_Amount];
};
if (floor (random 5) < 4) then {
_uniform addItemCargoGlobal [_MedicalLoot_uni1, _Random_Amount_1];
}; ```
why not just use
addItemToBackpack
addItemToUniform
addItemToVest
I bet if the others are working, and the medical is being left out, you probably ran out of space
since medical is the last one called
i tried putting it at the front as well as playtesting enough, i'm finding enemies with empty enough inventories and still no medical stuff spawning 😦
but also i think (i might be wrong) i have to use addItemCargoGlobal so that it works server-side and everyone sees the same loot?
okay, the uniform inventory i had spawning 80% of the time, the vest is 80%, and the backpack is 60%
and do you care where the items end up on the body?
nah order is irrelevant
it's a survival gamemode so really there just needs to be some degree of ACE medical items spawning for players to loot lol
if you want i'll send you the script i'm using
wait one
okay, i just realized I did a stupid and got the backpack working
_backpack = BackpackContainer _unit;
if (floor (random 5) < 3) then {
_uniform addItemCargoGlobal [_MedicalLoot_back1, _Random_Amount];
};```
it was still set to add the item to _uniform after I copy/pasted.. BUT, uniform still isn't working. could it be that it's getting canceled out by me trying to spawn too many possible items in the uniform inventory?
this was more like what I was thinking
https://sqfbin.com/udadomodihulivaxazim
yeah that looks like it might work better since my current script isn't checking for inventory space
thanks a ton, i think that will solve the problem
or at least get you in the ball park
yeah definitely, but if I set the else {}; (where you have the diag_log format) to do nothing will it just continue on to the next attempt to spawn an item, like I have it in my original? There's like 3-5 chances to spawn an item from different arrays for each inventory
or does it interrupt it and make it skip the rest (which is what it seems to be doing with the uniform? if it can't load in something heavy then it also doesnt seem to load in a light bandage or cash item afterwards either)
yeah it just chugs along until it encounters an error
nice, i'll try this out, thanks
luckily i think i only need to adopt the canAdd check for the uniform since the loot spawns aren't big enough in the other slots to even cause an issue apparently
is there a way to get all vehicles that have been addVehicle 'ed to a group?
https://community.bistudio.com/wiki/addVehicle i only see add and leave, no "get" command
if not, guess you could just add the vehicle object to the groups namespace with setvariable
that means i would have to detect every case where some AI script appropriates a vehicle? That sounds tricky...
How do mission makers deal with fog? After a while of my dedicated server running, it gets foggy and rainy. How can I stop this? It is supposed to be an arid climate. I am running Alive mod, but the weather module still lets it get rainy and foggy. Thanks.
try it without alive mod and find out if its really that or something else you did. make sure you have the weather forecast turned all the way down in the editor. if it is alive mod, then you have to go to them
set the weather parameters
then use
forceWeatherChange
there's an option in eden than disables weather changes in a mission
afaik
Thanks, I will try that.
Maybe that will force it to use Alive module instead of vanilla.
Turn manual overwrite on and set the fog to 0
I think it's manual override! 😄
How can I go back in time with the skipTime thing?
negative value?
Tried that but didnt work
Or i did it wrongly
Can u give me an example
Lets say from 10am to 5 am
5h behind
how would you go 5h later?
Tried that but didnt work
how would you go forward in time withskipTime?
The bohemia page says skipTime time in seconds here
oh really?
I think
don't think, read?
Yeah ive read it
I either understood it wrong or its like that
Lemme recheck
duration: Number - Hours to skip.
A positive value will create a forward time jump, a negative value will jump backwards.
One second is roughly 0.00026 hours.
Any calculations must be enclosed in parentheses, e.g. skipTime (_seconds/3600)
Guess its hours after all :p
So
Skiptime -5
?
yyyup, you got it!
Great thanks :)
you did all the work ^^ gg!
and if it doesn't work you have setDate
It worked all g
Thanks
Quick question tho
Is it possible to change the position of the title
titleText
is there an event handler for detecting lifeState changes?
No
in that case https://community.bistudio.com/wiki/BIS_fnc_dynamicText might be what you need
hmmm back to the think tank. trying to write something that removes squad leader respawns on incapacitation and then re-add them (or disable enable).
just use some damage eventhandler and check o nit
I guess you could try checking it in hit eh/frame after
Or just a loop 
It's not really expensive command iirc
Or write your own respawn that does not work on incapacitated, as I assume you're using BI respawn position.
yeah I make a respawn, store its respawn value in the particular object namespace, then remove it when I need it
I just meant lifeState. don't know about those
oh okay
is there a way to get VSC to ignore an error? the SQF language hasn't been updated in 2 years and it's missing the hashmaps + insert commands
which extension are you using?
SQF Lanuage 2.0.3 - Armitxes
SQF-VM Lanuage Server 0.1.20 - SQF-VM
Arma 3 CfgFunctions 1.1.9 - Hakon R Rydland
it is getting updated appereantly, up until 2.00 even
https://github.com/Armitxes/VSCode_SQF/blob/development/env/shared/commands/json/arma3.min.json so these are for auto completion and what not from what it looks like, but the highlighting (from what i understand) hasn't been touched whatsoever https://github.com/Armitxes/VSCode_SQF/blob/development/syntaxes/sqf.min.json
and also the development branch isn't on vsc extensions, you can download the source and replace it in your .vscode folder, like mentioned here: https://github.com/Armitxes/VSCode_SQF/tree/development#manual-installation
I've got this trigger off the workshop that is supposed to go off when you put something in a box
"FirstAidKit" in (itemCargo medBox);
this works fine but I'm trying to do it with a money roll.
I've tried the display name with no spaces, the class name, and the loadout export name. so far nothing. Any ideas what the money roll would be called in this case?
Money(Roll), Item_Money_roll, Money_roll
Money_roll it is
hmmm i'll try this again then
"Money_roll" in (itemCargo medBox);
hmm ok weird. loading the workshop comp without mods has the code in a call{} function.
After putting the mods i'm using back on it's gone.
call{"FirstAidKit" in (itemCargo medBox);}
yeah looks like this without mods, didn't think they could change scripts like this
hmm ok, still nothing with
call{"Money_roll" in (itemCargo medBox);}
using this is anyone wants to try this too
The call{} is created by the editor, it's hidden by default but I guess this is just a bug.
ah right
"Item_Money_roll" in itemCargo medBox;
ok well yeah the first aid one works, but the Money_roll or Money_Roll is no good. I'll try Item_Money_roll again
Your class name was wrong. That's it
I believe it is CBA doing that as a way to prevent the 0 = thing
na Item_Money_roll is no good either
call{"Item_Money_roll" in (itemCargo medBox);}
currently this, i'll remove the call but it worked fine with the first aid kit
Could be.
Ah okay. Now I get why it's not working, it's a magazine not item
So magazineCargo
So weird
yeah no dice. could be a thing like with the flash disk. I remember trying to do something with that, like checking if people had it in their inventory and it not liking it, but working fine with map
i'll try magazineCargo, thanks
it's in CfgVehicles but is a magazine... Good job
No it's a CfgMagazines item
Because you can insert those moneys into your wallet, it's obviously a magazine 😛
"Item_Money_roll" in (magazineCargo medBox);
?
configfile >> "CfgVehicles" >> "Item_Money_roll"
actually wait Money_roll, brb
Ah yeah. In the editor it's item_ and when picked up it turns into "money_roll"
Love that system
"Money_roll" in (magazineCargo medBox);
yup that's on the money
weapon holder yeah 😄
thanks again everyone
Too bad BIS_fnc_itemType doesn't return a proper category for these items.
Was about to read that 😄
Hi everyone. Can someone give me a good and reliable command for getting a helo to land, wait 30 seconds for the players to get out and then start again (engine on when on the ground). Also for the extraction the opposite way. I googled a lot and there a a lot of combinations but they won't work. At the moment I use: - waypoint "load" and waypoint time settings "30 seconds" -invincible helipad But the helo just keeps hovering in the air above the helipad, waiting 30 seconds and then fly away. I also tried the command "heli1 land helipad1" (variable names). Same problems. If I use the waypoint "cargo unload" it works, but I want the players to get out manually. Hiw do you guys solve this landing problem? Thanks for answers. (I'm writing here because most of the posts in the inet are from 2017 or older. And we know arma changes...)
- Anonymous
here you go :p
but is in #arma3_editor message #arma3_editor
I've answered him already. 🥷
I feel this has probably been asked time and time again, and the answer is probably obvious but ¯_(ツ)_/¯.
Does using the third parameter with setVariable have the same network impact as a publicVariable?
yes
Does anyone know how to make players drown... outside of the water?
I am aware of an oxygen system, https://community.bistudio.com/wiki/setOxygenRemaining. But I would like this to enable this manually. Does anyone know what the "diving flag" is that I can manipulate via scripting?
no can do.
what are you trying to achieve? killing without blood?
Oof, poetic.
No, simulating no air. Either a burning house, or in the future, a mission on another planet, where players are required to keep their suits on/damage results in decompression, and such things.
Guys. Can you offer me a hand here? How would you go about having a script that places a marker when someone is ACE-unconcious? It's a script for a purpose to do evacuations on AI.
Its easy enough to make a custom system for that if you really want to. You wouldn't need any diving flags and can just use those commands directly.
I'm guessing you are looking for the function: ace_medical_fnc_setUnconscious
Source- ACE3 Github: https://github.com/acemod/ACE3/blob/master/addons/medical/functions/fnc_setUnconscious.sqf
And then probably messing around with https://community.bistudio.com/wiki/createMarker
Make sure this local function, leads to a globally executed createMarker.
@austere granite The BIKI states, and I can confirm via testing, that setOxygenRemaining has no effect outside of the water. How would we do this? Do we need to create a separate Mod?
via #arma3_scripting 😄
OK truly I don't expect or want a pre-made solution. Just asking for brainstorming from someone who maybe knows how the dive mechanics work 😄
private _oxygen = 100;
while { sleep 1; true } do
{
_oxygen = _oxygen + ([+1, -1] select _isInSmoke);
};
if _oxygen < 1 then setDammmmmage
you would have to script the post-processing effects if you want them though
Might also wanna consider respirators and such, but that's easy to do
Agreed, that is a kind of drowning mechanic. But as you say it ignores the post processing and players will immediately start bleeding.
_oxygen = (_oxygen + ([+1, -1] select _isInSmoke)) min 100
guess you don't wanna have 110% oxygen
Yup respirators and the "if" conditions can come later. Just wondering how to activate the drowning condition.
The point i made and also Lou... is that there's not really a need to lock yourself into the quite limited SQF command, and better to just do a properly scripted solution, which means you won't suddenly get stuck due to the command not doing what you want.
you can't have the vanilla drowning outside of water
best luck = script your solution yes
I do believe the oxygen gets used for "damage effects" FSM by default... but meh i never liked those anyway.
I will assume you have access to a higher power Lou :D. So I guess my open question is two-fold
Can this be modded in any way? ... Or maybe
Where in the game PBO's can I find the oxygen functions, so we just recreate them ?
It was at game release, so that rules out DLC PBO's.
its engine stuff, nothing in PBOs
So I guess the ... relatively... straightforward solution would be to recreate a bleeding system as in ACE3, making custom ppEffects and sounds to simulate lack of oxygen (and return to normal). Hmmmm.
@cosmic lichen Thank you! So this controls the suffocation timer, the ppEffects, and scales them with the Oxygen level. At least if I can read this hairball of code correctly.
Especially love this part under the "suffocating" check:
&& !(player isKindOf ""Animal_Base_F"")
Like would a remote controlled chicken not drown?
But why is this an FSM file? 🤨
Is it to simplify the "if => then" and case logic?
Yes
FSMs have the advantage that the logic can be display as a diagram which makes it easier to comprehend
Ah, with FSM editor. Thanks
How can we check if a player has visited "Diary: Record7" diary subject?
Did you write the record yourself?
yep
You can add an expression to it when you create it. That expression could then define a variable.
@cosmic lichen on the wiki, when i click on the arma version icon (in script command page)
it takes me to general arma info instead of list of other commands released in same version
Click on the version
Ye it's annoying
You know who to blame 😉
Did diag_activeSQFScripts get updated with this update but isnt in the changelog? Noticed that one of the scripts I made based on it went haywire after updating the server
Afaik no
Hm. Alright.
imagine if diag_activesqfscripts would generate an alternative handle for the scripts listed, so we could terminate scripts that dont belong
and have only whitelisted scripts running
Would someone give me some tips on how to alter stamina? I'd like to change it to be 150% of existing. I've placed this in description.ext but notice no change, even if I make it ten fold.
class CfgMovesFatigue { staminaDuration = 90; //total amount of stamina // REMOVED FOR BREVITY };
thanks
@severe ravine With https://community.bistudio.com/wiki/setFatigue
How does the new sqf bytecode functionality work?
You can compile your sqf scripts to .sqfc files, and if you have the .sqfc file next to your .sqf and use CfgFunctions or compileScript command, it will load the bytecode from the .sqfc file
How does one create an sqfc file?
and there's only support for running bytecode from sqfc files? You can't remoteExec or call compile bytecode?
No remoteExec, no compile.
There's ArmaScriptCompiler on github
does that mean you can release your mission without .sqf files?
No
you need to put the .sqfc next to the source .sqf which will be used as fallback in case of issues
No compile at all
right
The bytecode was already compiled
And also some script optimizations to make some things run faster
cool
How does one compile sqfc btw?
ArmaScriptCompiler on github
Would this also work if i use this for example (That's how the Exilemod does it).
So i can just place the sqfc in the same folder ?
private ['_code', '_function', '_file'];
{
_code = '';
_function = _x select 0;
_file = _x select 1;
_code = compileFinal (preprocessFileLineNumbers _file);
missionNamespace setVariable [_function, _code];
}
forEach
[
['ExileClient_gui_safeXDialog_event_onDepositButtonClick','custom\SafeX\ExileClient_gui_safeXDialog_event_onDepositButtonClick.sqf'],
['ExileClient_gui_safeXDialog_event_onDropDownSelectionChanged','custom\SafeX\ExileClient_gui_safeXDialog_event_onDropDownSelectionChanged.sqf'],
['ExileClient_gui_safeXDialog_event_onInventoryListBoxSelectionChanged','custom\SafeX\ExileClient_gui_safeXDialog_event_onInventoryListBoxSelectionChanged.sqf'],
['ExileClient_gui_safeXDialog_event_onListBoxSelectionChanged','custom\SafeX\ExileClient_gui_safeXDialog_event_onListBoxSelectionChanged.sqf'],
['ExileClient_gui_safeXDialog_event_onWithdrawButtonClick','custom\SafeX\ExileClient_gui_safeXDialog_event_onWithdrawButtonClick.sqf']
];
plus a compiler to build the ArmaScriptCompiler exe
There is CI on that repo where you can download prebuilt exes from
Cool
I haven't tried the update from yesterday but some scripts do not compile to sqfc. Will make a ticket in the next days (GitHub)
Yesterday just added some Lua script config work, no changes on compiler itself
Ok
Will compiling before hand have much significance for missions with only a few dozen scripts? Or are they more for altis life situations with a metric heck load of scripts?
Depends on what the scripts ri
Do
They load faster, and might also execute a bit faster
For scheduled scripts in general, it probably doesn't matter
But when you have hundreds of functions that need to load and also run in unscheduled, it matters more
worth for EH too I guess
Q: when we spawn objects like phones, tablets, laptops... these are objects like any other... can they suffer damage as well and be 'killed' per se?
i.e. when 'shot', or blown up, or a building falls in on them?
what is "this"?
A helicopter I put in
it may be too early to trigger
You can't make units land like that in zeus?
daaaang
Is there anything wrong with this script? I cant figure out why it isnt working. nothing gets added to the crate
_weaponArrayOne = [
["srifle_EBR_F", "20Rnd_762x51_Mag"], 1,
["arifle_Katiba_F", "30Rnd_65x39_caseless_green"], 2,
["arifle_MXM_F", "30Rnd_65x39_caseless_mag"], 1,
["srifle_DMR_03_multicam_F", "20Rnd_762x51_Mag"], 2,
["arifle_AK12_F", "30Rnd_762x39_AK12_Mag_F"], 1,
["arifle_ARX_hex_F", "30Rnd_65x39_caseless_green"], 2,
["SMG_03_TR_khaki", "50Rnd_570x28_SMG_03"], 2,
["", ""], 3];
for "_i" from 1 to 4 do {
_weaponAndMag = selectRandomWeighted _weaponArrayOne;
_weapon = _weaponAndMag select 0;
_mag = _weaponAndMag select 1;
AirdropCrate addWeaponCargoGlobal [_weapon, 1];
AirdropCrate addMagazineCargoGlobal [_mag, 3 + (round random 4)];
};
_weaponArrayTwo = [
["LMG_Mk200_F", "200Rnd_65x39_cased_Box"], 2,
["LMG_03_F", "200Rnd_556x45_Box_F"], 2,
["launch_RPG7_F", "RPG7_F"], 1,
["V_HarnessOGL_brn", ""], 1,
["",""], 4];
for "_i" from 1 to 2 do {
_weaponAndMag = selectRandomWeighted _weaponArrayTwo;
_weapon = _weaponAndMag select 0;
_mag = _weaponAndMag select 1;
AirdropCrate addItemCargoGlobal [_weapon, 1];
AirdropCrate addMagazineCargoGlobal [_mag, 1 + (round random 1)];
};
_itemArray = [
"HandGrenade", 1,
"optic_Arco_blk_F", 2
"optic_Hamr", 2];
for "_i" from 1 to 2 do {
_item = selectRandomWeighted _itemArray;
if (_item == "HandGrenade") then {
AirdropCrate addItemCargoGlobal [_item, 1 + (round random 3)];
}
else {
AirdropCrate addItemCargoGlobal [_item, 3 + (round random 2)];
};
};
it is in init.sqf and I am testing on singleplayer
every connecting player will add weapons to the crate
(but that's not the issue)
ok
I don't see an issue I'm afraid
Hi guys, i have some problem with moving a spawned group into a vehicle - it always complains, that 3 elements are provided, 2 are expected
what is AirdropCrate ?
// Execute Position
private _destPos = _this select 0;
private _spawnPos = _this select 0;
private _cargoVehicle = "CUP_B_MH47E_GB";
private _infantrygroup = "CUP_B_USMC_InfSquad";
// Spawn Reinforcmentgroup
_reinforcementgroup = [
[_spawnPos select 0, _spawnPos select 1, 0],
WEST,
(configfile >> "CfgGroups" >> "West" >> "CUP_B_USMC" >> "Infantry" >> _infantrygroup)
] call BIS_fnc_spawnGroup;
// Spawn Chopper
private _veh = [_spawnPos, 0, _cargoVehicle, west] call BIS_fnc_spawnVehicle;
// Move Group into Helicopter
{
_x moveInCargo _veh;
//systemChat format["pos is %1", _x select 0];
} forEach (units _reinforcementgroup);
//{ _x moveInCargo _veh } forEach (units _reinforcementgroup);
//_reinforcementgroup moveInAny _veh;
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
its a standard cargo net crate. thats the variable name
if you run that code from the debug console does it work?
havent tried
then you know what to do
BIS_fnc_spawnVehicle returns
Array:
0: new vehicle (Object).
1: all crew (Array of Objects).
2: vehicle's group (Group).
Anyone know what command i should look for?
I want to put blood on the units? to make it look like a zombie and a not a civ walking around
damage them?!
setDamage yeah
lol - thanks a lot!
lol i guess no other way. thanks
I tried using setStamina, but despite the wiki description that actually sets current not maximum. setFatigue appears to be for the old Fatigue system.
that's to set the value itself, not the max amount
for max amount, see setUnitTrait* 🙂
I found a setUnitTrait, includes LoadCoef which I experimented with but it has undesirable side effects, otherwise it just appears to be for medic/engineer/etc.
loadCoef makes the person carrying weight feel less loaded; increasing the top stamina value is not possible without a mod I'm afraid
you can disable stamina though.
Any ideas?
depends. most of them don't
I've checked alive Target_Building for missions with a building that needs to be blown up. I've used that for scripted objects and stuff just thrown down in Eden.
event handlers
@severe ravine no, not the buildings themselves. alive, damage, etc, yes... the other bits, phones, tablets, laptops.
okay, so if player can find the bits among rubble, broken ruins of a building, more power to them, for immersive effect
perfect, fair enough, thank you
hey guys what would be the proper way to check a cargo container for a weapon and spawn a set ammo type for it if it exists? I'm working with this but it's not working right (_itemcrate is defined already just in a different part of script):
_mk200check = getWeaponCargo
_itemcrate;
if ("LMG_Mk200_F" in _mk200check) then {
_itemcrate addItemCargoGlobal ["200Rnd_65x39_cased_Box_Tracer", 1];
};
@undone dew ok so two things
getWeaponCargo is going to return [["riflename"],[1]] , so i would use just WeaponCargo since it returns ["rifle1","rifle2","etc"] just an array of strings not nested
also the big thing is you need to use addMagazineCargoGlobal for mags
i see, i'll test it out real quick
i already did i got you fam
here ill post the code
`` _mk200check = WeaponCargo
bbox1; hint format ["%1",_mk200check];
if ("arifle_Mk20_plain_F" in _mk200check) then {
bbox1 addMagazineCargoGlobal ["200Rnd_65x39_cased_Box_Tracer", 1];
}; ``
just change the rifle and box name back to yours
it works, thank you so much!
yep yep np
its for a randomized weapon crate script so if it selects a weapon from an array it gives it ammo 😄
oh got you , iv got something that might help you there .. one sec
_mags = getArray (configFile >> "cfgWeapons" >> _weap >> "magazines"); ///returns an array of all compatible mags for weapon///use select to isolate one///
_weap is what ever weapon you want to use and it will give you an array of mags it can use
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
oh i see
you can {bbox1 addMagazineCargoGlobal [ _x , 1]; }forEach _mags; /// or _oneMag = _mags select 0;
oh i just thought of something, will the original work if it detects multiple of the same item? or will it only give magazines to the first instance of the weapon?
@dense galleon see my post above ^^
@undone dew yea it will only give one mag but ive got some code that will help you
sorry @winter rose im gonna try and do the `` right this time 😁
for [{ _i = 0 }, { _i < 2 }, { _i = _i + 1 }] do {
_weaps = "getNumber( _x >> 'scope' ) isEqualTo 2 && { getNumber( _x >> 'type' ) isEqualTo 1 }"configClasses( configFile >> "CfgWeapons" ) apply { configName _x };
_weap = selectRandom _weaps;
_mags = getArray (configFile >> "cfgWeapons" >> _weap >> "magazines");
///returns an array of all compatible mags for weapon///use select to isolate one///
_box addWeaponCargoGlobal [_weap, 1];
{_box addMagazineCargoGlobal [_x, 1];}forEach _mags;
};
```
lol thanks i look like a doof there
ok i think i see how this works, thank you times a million, i'll see if i can implement it.
but that will give you 2 random weapons and all the mags that go with them in a box
you just gotta handle the spawning the box part
right
use ranged for https://community.bistudio.com/wiki/for example 1
_weaps = "getNumber( _x >> 'scope' ) isEqualTo 2 && { getNumber( _x >> 'type' ) isEqualTo 1 }"configClasses( configFile >> "CfgWeapons" ) apply { configName _x };
you're looking up entire cfgWeapons every iteration, that's not needed
thanks @copper raven , im new to using the getNumber code above with configClasses , i know mostly how it works but i could use some advice on making it more efficient
define it outside the loop
hmm, only obstacle i'm hitting is i don't need to worry about the random weapon spawning, just spawning magazines for the weapons that are in the cargo. I'm modifying this script as a base and it already handles the weapon spawning with random chances: https://www.armaholic.com/page.php?id=24196
so i think i just need to use WeaponCargo at the end of the script to get the array of weapons that are in the cargo and then spawn appropriate magazines for each iteration
oh i see , yeah i was using the bit above because i use mod weapons and want to get all without having to input them manually
right, i'm trying to use some specific weapons because the intention was to make the boxes spawn specific (heavy) weapons
LMGs and snipers
{
_mags = getArray (configFile >> "cfgWeapons" >> _x >> "magazines");
_oneMag = _mags select 0;
_box addMagazineCargoGlobal [_oneMag, 1];
}forEach _magscheck; ```
idk how efficient this is but this would work for spawning 1 mag for each weapon in the box
you could spawn more of one type of mag or all of the compatible mags
hmm i'm getting an error if i put it at the end of the script:
Error >>: Type array, expected String```
it because it returns an array like this ["compatiblemag","compatiblemag2","compatiblemagTracers","compatiblemag","compatibl mag", ect.]
i see
you have to select one of the mags like _oneMag = _magArray select 0;
or all of them with a forEach loop
there is no CONFIG >> ARRAY
@copper raven could you help us out again here im not sure why this doesnt work now
yeah it's beyond me xD
https://community.bistudio.com/wiki/getWeaponCargo returns array of arrays
not array of strings
use https://community.bistudio.com/wiki/weaponCargo, or properly adjust the input to >>
_magscheck = getWeapon _box;
{
_mags = getArray (configFile >> "cfgWeapons" >> _x >> "magazines");
_oneMag = _mags select 0;
_box addMagazineCargoGlobal [_oneMag, 1];
}forEach _magscheck;
like so?
omg that is 100 percent my fault sorry
You shalt be banned from this server now.
😄 j/k, happens
i was pasting from my notepad and went back to getWeaponCargo / facepalm
@undone dew no use weaponCargo
OH
@winter rose thank you for your mercy 😅
i think it works o_o
i actually came to the channel for a question of my own 😅 im using player nearSupplies 10; to find weapon containers near the player but i need to exclude the players own inventory from the search and im having a hard time , any ideas ?? thanks
my thought was to try something like this but no joy
itemsList = (player nearSupplies 10) select {(_x in (everyContainer player)) == false};
private _nearSupplies = player nearSupplies 10;
private _nearSuppliesNoPlayer = _nearSupplies - everyContainer player;
I guess
@winter rose thanks i just tried and no joy but that is a good thought ill play with , also i swear im trying to do the sqf highlighting here but it doesnt wanna work right i may need to update my discord or something
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
` ` ` s q f 😉
hint "God gave us cone cells for this reason!"
Linebreak is important, otherwise it won't work
Lou is the most forgiving mf ive ever met, I literally spelt a variablename wrong once, which messed up my entire code, and he didnt even flip out 😛
(╯°□°)╯︵ ┻━┻
@dense galleon ```sqf
private _nearSupplies = player nearSupplies 10;
private _nearSuppliesNoPlayer = _nearSupplies - [backpackContainer player, ...];
just put all player containers manually
backpack, vest, etc.
got it ill try that out thanks @little raptor
wait the command returns the player himself 
private _nearSupplies = player nearSupplies 10;
private _nearSuppliesNoPlayer = _nearSupplies - [player];
i was thinking the same thing 😄 reading the command description(don't have arma open) 😄
My Duuude!! @little raptor got it , thanks a ton
that works perfect ive been trying to work that out for while thanks guys
Hello everyone, Could anyone tell me why the hint within this add action does not work (anymore) It's been a month or two but i am pretty sure it worked before:
this addAction ["<t size='1.5'>Pickup Key 1</t>", {
hint "You picked up a key!";
},[],1.5,true,true,"","alive _target",10,false,"",""];
I can pick the key up but it does not show the hint ( or does anything within the brackets ) anymore
works for me 🤷
any one know how to make a prop interaction that full heals the player?
Thanks for confirming this for me, it must be a mod then
prop addAction ["Healmeplz",{player setdamage 0}];```
?
thanks
That's weird, the script doesnt works for me even when loaded without mods in a new scenario
don't see why that wouldn't work
Hmm, it seems that it doesnt works on certain items anymore where they did before
it works fine on a keyboard, sadly not on any of the default arma keys
I am not sure if this is the right place to ask but I've been trying to add a add action to a key object however the only key like object this seems to work on is the inventory item key which already has a default pick up action assigned to it. Disabling simulation on the item in question does not seem to help and I can not turn it into a simple object.
A possible way would be to look for a event handler for picking up things and match the keys but I'd really rather have a addaction on the object itself. Do any of you have any ideas on how to make this work?
@sonic thicket that is strange your addaction works on other item objects but when i try to use it on the key object "Land_Key_01_F" no joy , question tho what do you want to happen once you "pickup" the key ? since an object like that doesnt really go in your inventory, are you planning to make a virtual/scripted key in a virtual inventory?
if so you could always put the key on a desk or shelf and add the addaction to the desk/shelf object
Is it possible to change someones callsign mid-mission?
With a trigger or something
Yes. setGroupId IIRC
There's another key, the Item_Key but that has already bound a interaction to it. Putting it on a desk could indeed be a nice solution for some locations but some keys are located in really cramped or open spots where a desk wouldn't make much sense.
The important part of the keys exists out of a single line, some_unlock = true;
which again is bound to a conditioned trigger that opens doors
@sonic thicket ok so using the inventory item version "Item_Keys" i can give it your addaction and it works, but like you said it still has the default "Take Keys" addaction as well. I do know that if you setDamage on the keys to 1 (dead) the model wont change but it will take away any addactions it has. im not finding other ways to remove that "Take Keys" default action rn sorry
I see, if DMG is 0 it doesnt displays any addactions, thanks anyway 🙂
im currently trying out removeaction and removeallactions
looks like those are for user added actions, i tested and no change
i would consider maybe doing the whole check if the item is in the players inventory and if yes satisfy a condition, or place the Non inventory key item somewhere and then place a less noticeable object underneath and put the addaction on it, for example ive used the Oil spill and trash objects before for similar reasons and you wouldnt notice they were there
or an invisible helipad or helper object
I was just about to write that one down, some replacement for addaction. But yeah, oil spills might be a better idea
it will at least get you going until you find another solution
Tried the spills, they didnt worked, currently trying out the invis helipad but will need to go after trying that one
Ok i think this is the right channel to ask, im using unitcapture for the 2nd time, and im trying to capture both a units movement and firing data, I have setup both init.sqf and wp1.sqf files properly, i do the route i want, hit esc, use f1 to capture the movement and f2 to capture the firing data, and as ive read up in tutorials, pasted f1 data into a spawn BIS_fnc_UnitPlay; and the f2 data into a spawn BIS_fnc_UnitPlayFiring;
So far i have no scripting error warnings pop up, but for some reason the unit won't fire the weapons at all, ive tried basic syntax fuckery like moving the unitplayfiring above unitplay but for some reason its not reading the data
any idea what could be causing this? I feel like its something very simple, but im not sure what
i've also checked and made sure basic stuff like unit name is right in both functions (the vehicle moves according to the set path but just won't fire)
Thanks anyway though, ill try more tomorrow but I will need to go for now
no prob ill try some of them out for you
this addeventHandler ["Take", (execVM something.sqf}]
I think this will be the nicest solution ^ Add a eventhandler on the key and then execute a script that has all the different cases for all different keys in it
yeah that sounds like a good plan, and you were right the trash objects didnt work for the addaction, although the luggage ones did
you could do addaction "Search Luggage" and find the key , would be simple but with a little more work the eventhandler would be great
hey all, i have this in an external script that is called from initserver and im curious why _allplayers comes out to be nothing even though I have myself and 2 HCs connected
"testpw" serverCommand "#lock";
_allPlayers = call BIS_fnc_listPlayers;
diag_log _allPlayers;
{
_allplayer = _x;
"testpw" serverCommand format ["#kick %1",name _allplayer];
}foreach _allplayers;
sleep 150;
"testpw" serverCommand "#unlock";
i dont really need the HCs, i chose that function as im just looking to kick players anyway
and to my knowledge that function is the earliest way to get players but im now not sure
well let me review what you are trying to do. you want the game to lock the mission, then kick all the players, then wait, then unlock the mission?
exactly
im running this at the beginning of a server restart to give the server enough time to spawn stuff and init
tell me, load in, get to playable state, then call the function in your code
just the listplayers
It runs fine for me
the script does work
im just worried that im firing it to early meaning that the _applayers isnt working
add a waitUntil {time > 0} then?
or however many seconds after the mission loads?
also to clean your code up a bit do:
//Old
_allPlayers = call BIS_fnc_listPlayers;
diag_log _allPlayers;
{
_allplayer = _x;
"testpw" serverCommand format ["#kick %1",name _allplayer];
}foreach _allplayers;
//New
private _allPlayers = call BIS_fnc_listPlayers;
_allPlayers apply {
"testpw" serverCommand format ["#kick %1", name _x];
};
thanks for that "apply" bit of knowledge. useful command
only downside I find is not being able to use _forEachIndex when wanting to do some array manipulation
Can i get some help please? I'm pretty sure the issue is something with:
wp1 = (firing data);
[vehicle, wp1] spawn BIS_fnc_UnitPlayFiring;
I don't have any issues so far with getting the unit to execute the movement side of the data with the f1 copy, its just the firing of its weapons that it does not seem to want to do
ill add a delay, thanks man
post your files into separate links on sqfbin.com, label them in the message, then paste them all here
ok will do that
I don't think there's much you can do. I think the firing thing is buggy anyway.
But you can post it nonetheless. It might be caused by your own code.
Ok very basic init.sqf
https://sqfbin.com/ilikatowucogifatuqim
and wp1.sqf
https://sqfbin.com/ramakuvuyimepaveferi
I think i did this right
i forgot how big chonky boi these files get. Hope it didn't crash the website for me lol
yeah im noticing its pretty slow on my end as well
and how are you calling these and where?
its only like 3 minutes of data so its not even as bad as it can get from what some people stuff into these things
uh what do you mean?
for calling im using radio linked trigger
lemme get the code one sec
rec = [] spawn wp1;
um what first few line? Im not sure exactly what you mean
like I'm expecting a bis_fnc_unitPlay or bis_fnc_unitPlayFiring somewhere
you got that anywhere?
kk one sec
too chonky
your heli flies around fine?
its unitplay being buggy then. its not reliable enough
damn really?
could it be like
vehicle specific?
im using a CUP heli not a base game one, i was wondering if that was theoretically causing the issue
try using a base game one then to test it
there is one other notable change
the steam page that suggested the BIS_fnc_UnitPlayFiring had both functions use wp1
wp1 =(array here, this part works fine);
[HELI1, wp1] spawn BIS_fnc_Unitplay;
wp1 = (weapon data array here);
[HELI1, wp1, true] spawn BIS_fnc_UnitPlayFiring
but that was not working so i thought maybe having both use wp1 might be a source of the issue
so i changed wp1 to _shoot for the weapon data
i will rig up a quick custom mission and test with a base game helo
I'm headed to bed for the night. hopefully someone else will help you through the rest of it but its getting late.
@still forum groupcreated is mission event handler, not object/group event handler right?
is it possible to request all ai in the area come to heal you?
or does this only work if you're the group leader?
I guess I could have it remotExec something to the group leader requesting that the whole group heal that unit
Group event handler? 
I've never heard of it but judging from the name it's a mission EH
No. It's something you'll have to script on your own
well thats kind of what i mean like
can i script an AI reviving me
from my googling you'd do something like ai_medic action ["heal", player_unit];
Yeah ive seen people script medics in many different ways