#arma3_scripting
1 messages ยท Page 81 of 1
Should be.
Remind me never to ask Marko for a simple solution again XD
butbutbut, i linked you exactly that
I was going to offer a better one for triggers but I got here late it seems
YOU LINKED ME TO THE MF PARACHUTE BIBLE ๐คฃ
its written right there in first 10 comments ``` * Example:
- [_vehicle] call zen_common_fnc_ejectPassengers
- Public: No
*/``` ๐
Only I don't have ZEN loaded while I make the mission because using any aspect of it makes a dependency in the mission file and the unit I'm in don't use ZEN
then... one thing you may try. it will look silly, and im not sure if they will deploy chutes, but what happens if you press G on flying xian?
When I don't have zeus because it's a zeusless scenario?
Pretty sure he's not Zeusing his mission, it's entirely editor made.
Yeahhhh
hold on.
that script in a nutshell is very simple... just looks complicated
Anything over like, a paragraph, is a huge mental nope
I trigger scum 90% of my "scripting"
nothing wrong with triggers
Hell even the starting parachute drop in the first mission was made almost entirely by people who weren't me
private _passengers = crew _vehicle select {assignedVehicleRole _x param [0, ""] == "cargo"};
{
unassignVehicle _x;
moveOut _x;
} forEach _passengers;
Should I use that instead of the other one?
replace _vehicle with your vehicle name.
You may wanna add parachute and slight delay to that. Or its gonna look like mass suicide pact
You mean to say you don't enjoy shotgun-shitting out paratroopers?
Without parachutes *
They have a parachute already but the slight delay could be a little useful, but as they should already be on the ground before the players get even close by, should be fine
Add sleep <seconds>; after move out
And that is more or less what that "parachute bible" does, excluding some checks, optimizations, and attaching parachute even if unot doesnt have one.
You will probs also wanna put the whole shebang in spawn.
[My_helo] spawn {
params[["_vehicle", objNull]];
if (isNull _vehicle || !alive _vehicle) exitWith {};
private _passengers = crew _vehicle select {assignedVehicleRole _x param [0, ""] == "cargo"};
{
unassignVehicle _x;
moveOut _x;
sleep 2;
} forEach _passengers;
};
If this works then idk why I need the rest and my ignorance shall just make me use the stuff that does the same with less algebra
it will most likely work, they will just shotgun eject
this will also eject dead people ๐
That's fine
They're all AI, won't be in visual range of the players when they do parachute and I added a slight sleep timer anyway
guys is not possible spawn npcs with weapons in altislife mod?
Can anyone recommend good videos or forums to get into Arma scenario scripting?
This would be the forum; as for videos, there's plenty to choose from but a good number are dated.
There's this one, fairly recently, though I feel it jumps pretty quickly from 'how scripting works' to 'this is how I personally design encounters', so grain of salt: https://www.youtube.com/watch?v=JSqU7EvSv04&t=6841s
Join in future operations: https://discord.gg/UselessFodder
Support the channel and community: https://patreon.com/UselessFodder
Buy awesome tactical games: https://nexus.gg/UselessFodder
In this tutorial, we will make a complete mission in the Arma 3 Eden Editor and show how to set up Arma 3 missions, create waypoints, set enemy patrols and...
Good evening!
Trying to use ACE3's Event Handlers to detect when a player picks up / places an item with the "Carry" function ACE3 adds...has anyone done similar or familiar with how to use the EH?
I found this, but how do I point it to the item in question?
As far as I can tell, that event is only triggered for attaching items like chemlights to the player. Not for carrying, or attaching objects explosives to a vehicle.
was afraid you would say that haha, been doing testing and it hasn't been working out
all good though, i'm sure i'll find another route
As far as I know, the only ACE event generated for carrying is the setMass, and I think that's only triggered for physX objects like the crates.
Might be (ab)usable though, depending on your requirements.
[QEGVAR(common,setMass), [_target, _mass]] call CBA_fnc_globalEvent;
i'm currently wondering if i can just edit the 'drop' function that ACE has
would create a different dependency / version of ACE, but would fix the issue i think
I'm hoping to save items to my inidbi db whenever a player drops them, instead of using loops to check
it looks lke ACE uses the attachTo command for it's carry mechanic, but I don't see a BI Event handle for that either
There's a feedback tracker thing for it.
I don't know if BIS know or care about issue subscriber numbers but no harm in ticking it: https://feedback.bistudio.com/T169479
Can anybody remind me real quickly what getHideFrom returns when the believed position isn't known?
never mind!
anyone know how one may be able to stop animals from spawning in a mission? cant find a module for it and the biki page relating to animals doesnt show much
you can just hide or delete them when they spawn 
enableEnvironment [false, true];
```this?
should work thanks
Hello :D
I have a question once again, the command allMissionObjects linked https://community.bistudio.com/wiki/allMissionObjects
The biwiki highlights that This command is quite performance heavy. Use with caution!, does anyone know how performance heavy it is? any data or examples of this?
I am attempting to use this in initServer or initPlayerLocal:
allMissionObjects "EmptyDetector";
to detect all triggers in the mission and place a marker on them before the players load onto the mission.
very
well it depends on the terrain tho
e.g. in VR it's not that bad, but on Altis it could lead to FPS drop
iirc it takes >15ms on Altis
all triggers in the mission and place a marker on them before the players load onto the mission.
in that case it's fine
there's also allObjects which is much faster but it's not available till v2.14
does anyone know how performance heavy it is? any data or examples of this?
you can just run your own performance test using the debug console
just click on the speedometer button
Oh, that's what that button does, never touched it before. Thanks
I assume if the mission has more objects of its own, this could possibly increase? specially if you start going into thousands of objects/entities?
yeah
but I think it goes thru the terrain objs as well
which is why it's slow
in that case mission objects shouldn't matter much because terrains have hundreds of thousands of objs (e.g. 1.8M on Altis)
Hmmmmm, I might be better off making it check through a layer called "Triggers" instead of using this command then.
It's less automation but I'd rather not risk it with performance if it ends up causing issues.
VR: Execution Time: 0.1145 ms
Altis: Execution Time: 25.0250 ms
well like I said if it runs once at start it doesn't matter. it's just 25ms
On this note, I also want https://community.bistudio.com/wiki/getSlotItemName from it xD
I honestly can't wait for the one above, would've made my job a bit easier with some scripts.
well you can use getUnitloadout
Oh this actually returns it in the same order every time and even places an empty string if there is nothing in a slot 
It's perfect, thank you again
Wonder if there is even faster way to know if entity is a unit or not than _unit isKindOf "CAManBase"?
Some unary command perhaps?
Thinking about it, config branch checks are not fully reliable, who knows if some mod decides to have a tank under CAManBase branch, it is possible.
getText(configOf _unit >> "simulation") == "soldier" is even slower but 100% reliable
I would say if CAManBase don't work, blame the unit's Mod
yeah someone doing a non-unit under camanbase is psychotic
like I wouldn't be surprised if someoen has done it but still
Having something like BOOL = isSoldier ENTITY would be perfect
But then you might need similar commands for other simulation types
I've got a general question in regards to writing scripts, which of the following would be a better practice when writing scripts? taking into consideration that this needs to be done not just on the map but also other items in the loadout. One is more understandable but has variables that are unnecessary, the other is more "efficient" but less readable:
Sample 1:
private _currentPlayerLoadout = getUnitLoadout player;
if (((_currentPlayerLoadout select 9) select 0) == "") then {
player linkItem "ItemMap;
};
Sample 2:
private _currentPlayerLoadout = getUnitLoadout player;
private _currentPlayerMap = (_currentPlayerLoadout select 9) select 0;
if (_currentPlayerMap == "") then {
player linkItem "ItemMap";
};
Unless you're doing this code for 100 entities each frame, it shouldn't be this big of a deal.
If you'll be checking _currentPlayerMap 10 times later in the code of course its better to assign it into variable, if you need to squeeze as much per frame performance as possible, then you might skip some variable assignment and do selects inline in the condition.
Noted, thank you for explaining ^_^
Readable and properly structured code leads to having less bugs
Premature optimization is evil yada-yada
that's called micro-optimization and it's not important whatsoever
Dont we have "BIS_fnc_hasItem"?
unless something gives you dozens of microsecond diff don't worry about it
It returns boolean and all
if ([_currentPlayer, "ItemMap"] call BIS_fnc_hasItem) then {
blahblahblah
};
he wants to check if unit has no linked map item
Are your searches always on linked items? (Map, GPS, radio etc)
Wish hashmaps accepted entities for keys. Yes, its not reliable because entity can go null and not serialisable but I still use it all the time, would save me additional hashValue command call.
Mostly, not all of them.
I am not checking if the player has "ItemMap" I am checking if the player has ANY map from different mods.
If he doesn't then he gets one.
If so, there should be bo need to get the whole loadout.
Something like:
If ((items _currentPlayer) findIf {"ItemMap"} < 0) then {
link your map here
};
Oh... accounting for mod assets and whatnot are a real pain ๐
It is...
The script is part of our quality assurance system, in the case a mission maker forgets to give the players a map, a radio, a compass or some other necessary item the script kicks in and does it at the start of the OP.
Here is an older version of the script that I am updating with the getUnitLoadout command to improve further:
https://github.com/SkippieDippie/A3A-Event-Standard-Files/blob/Nomas_dev/A3AEventMissionBase/initScripts/initEquipment.sqf
what command would one use to move an object and/or bool into an array?
familiar with all but insert and set
What exactly is your need?
looking in to it insert is what im after thank you
just simply merging an object and a bool into an array insert does the job
so does pushBack and every other command in that list 
Anyone familiar with Webknight's two primary weapons mod? I wanna look into if I can save the additional weapon on respawn along with the rest of the loadout
just overwrite whatever bit of the function handles it clearing upon death; but as a warning the mod is written incredibly poorly and i dont think its even registered in cfgfunctions
alternatively you can make a variable that saves every couple seconds with the second primary then overwrite whatever variable he uses in a respawn eh
I would just want it to save that weapon the same time it saves the rest of the loadout
something I currently have a functional script for
then save to a different variable and overwrite the one he uses in a respawn function
hmm
but that wouldnt spawn the second weapon
and afaik theres no way to do that
like i said, incredibly poorly written mod
sad
I'll check it out but I just hate how some second primary weapon mods just gives the interaction prompt on screen at all times to swap or put it in a 2nd slot
mine does not
Any names or links I can go by to find it?
"kjws two primary weapons"
press 4, swap weapon. can blacklist classes from being swapped too if you dont want an lmg to be stuck on someones back
im going to be rewriting the code behind it at some point but end-user pov it's fine
I do like it
I think that webknight's is a lil flashier due to the nicer animation/placement but
If this actually works with what im trying to do
I dont see a reason not to use it
yeah i dont know how to do animations
probably requires a p drive which i refuse to set up
2 different types of modders I suppose
reworking its code is on the list of things to do but that list is very extensive and i am burning myself out on useless projects right now
understandable
i also want to make it integrate with vanilla inventory but you know how gui stuff is
honestly it not doing that is mostly fine
the only ones I see actually integrate with vanilla inventory are the ones that place it in the launcher slot
yeah i hated those
now, to figuring out how to save this 2nd primary weapon on respawn
one sec let me get the things
my current system is weird and its all becouse PIR is weird
now step on it ๐
writing a thing for you hamsch i'll sqfbin it shortly
ho my
sqfbin is apparently no more btw ๐ข
WAIT IT IS BACK!
its working for me
i think this should work
https://sqfbin.com/dihobuxiguxemohinaku
but this was my first """good""" mod so its pretty piss poor
Unless you are obese, you should be fine.
youre too nice
and as per usual sqfbin just does not want to highlight my code
i might rework the code as a weekend project as i can just do it all in debug console
but meh
it works, even if barely
if it works, im happy
if it works ๐
my only comment would be that the workshop page could make do with a fancier look
my problem with it is i want to rework it but it'd be a purely backend rework for a mod that seemingly completely works fine for end users
meaning peoples second primaries on persistent modes would be lost and nothing else would happen really
hm, I can get that
oh and i hate the fact the prefix is just kjw
Don't write "sqf" at the start. It doesn't take instructions and because that would be invalid it doesn't detect the code type correctly and assumes plain text.
oh forgot to delete that
It should work otherwise, but honestly it's a janky site that I'm basically just leaving up because it's handy 
It was out for half a day because apparently Namesilo refused to charge my paypal.
huehuehue (added some stuff too :p)
https://sqfbin.com/uhubepewonubugufudaq
it felt like an eternity, like at least 2-3 days
no my code must be awfully formatted
i really need to rewrite the whole thing i hate the variable spam
I like that you feel my presence above your shoulder
Weird. Could've been. Cloudflare is how I found out and that shows 1 day. It looks like it could've been 3 days though as that would line up with the grace.
my radiation mod has like 20 functions purely because of you
all it is is just a variable increasing when you have a bloody lineintersect be good
okay, testing the respawn thing now
Should I have posted what my current respawn save loadout thing is right now?
no it should be fine
hm
wait hang on
well first attempt no luck
haha
hang on a moment
I will post my current method in the meanwhile to be on the safe side that im getting it right too
onPlayerKilled.sqf
params ["_oldUnit", "_killer", "_respawn", "_respawnDelay"];
_primaryWeapon = [primaryWeapon player, primaryWeaponItems player, primaryWeaponMagazine player];
_secondaryWeapon = [secondaryWeapon player, secondaryWeaponMagazine player];
player setVariable ["Hmch_Saved_primWeapon",_primaryWeapon];
player setVariable ["Hmch_Saved_secWeapon",_secondaryWeapon];
onPlayerRespawn.sqf
params ["_unit", "_corpse"];
if (isNull _corpse) exitWith {};
player setUnitLoadout (getUnitLoadout _corpse);
_primaryWeapon = _corpse getVariable ["Hmch_Saved_primWeapon",["",[""],[""]]];
_secondaryWeapon = _corpse getVariable ["Hmch_Saved_secWeapon",["",[""]]];
player addWeapon (_primaryWeapon select 0);
player addWeapon (_secondaryWeapon select 0);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 1);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 2);
player addSecondaryWeaponItem ((_secondaryWeapon select 1) select 0);
//this part was for a respawn TP thing dont mind it
if !(_corpse isEqualTo objNull) then {
_nearPlayers = nearestObjects [_corpse, ["OPTRE_UNSC_Marine_Soldier_Unarmed"], 500, true];
_teammates = _nearPlayers select {alive _x && _x != player};
player setPosASL (getPosASL (_teammates select 0));
};
deleteVehicle _corpse;```
PIR is to blame why this is somewhat convoluted
think that should work
its just making temp variables
you can get rid of the second load of private (but not the variable redefines themselves)
First part would go into onPlayerKilled.sqf right?
since thats what saves the loadout
nonetheless, I wanted to reiterate a thank you for the service provided to the community โค๏ธ
hmm, bad luck thus far
oh pea brain kjw again
I can send my current file configuration
//in playerkilled bit
private _oldGunItems = weaponsItems player;
player setVariable ["Hamsch_nuts", _oldGunItems];
//in the loadout restore
private _oldGunItems = player getVariable ["Hamsch_nuts",[]];```
i hate this mod
am also trying to debug my own right now too after 4 hours of sleep
onPlayerKilled.sqf
params ["_oldUnit", "_killer", "_respawn", "_respawnDelay"];
_primaryWeapon = [primaryWeapon player, primaryWeaponItems player, primaryWeaponMagazine player];
_secondaryWeapon = [secondaryWeapon player, secondaryWeaponMagazine player];
player setVariable ["Hmch_Saved_primWeapon",_primaryWeapon];
player setVariable ["Hmch_Saved_secWeapon",_secondaryWeapon];
private _oldGun = player getVariable ["KJW_ShotgunClassname", ""];
private _oldammoClassnames = player getVariable ["KJW_ShotgunAmmoClass", ""];
private _oldAmmoCount = player getVariable ["KJW_ShotgunAmmoCount", 0];
private _oldGunAttachments = player getVariable ["KJW_ShotgunAttachments", []];
private _oldSecondaryAmmoClass = player getVariable ["KJW_ShotgunSecondaryAmmoClass", ""];
private _oldSecondaryAmmoCount = player getVariable ["KJW_ShotgunSecondaryAmmoCount", 0];
player setVariable ["Hamsch_ShotgunClassname", _oldGun];
player setVariable ["Hamsch_ShotgunAmmoClass", _oldAmmoClassnames];
player setVariable ["Hamsch_ShotgunAmmoCount", _oldAmmoCount];
player setVariable ["Hamsch_ShotgunAttachments", _oldGunAttachments];
player setVariable ["Hamsch_ShotgunSecondaryAmmoClass", _oldSecondaryAmmoClass];
player setVariable ["Hamsch_ShotgunSecondaryAmmoCount", _oldSecondaryAmmoCount];
onPlayerRespawn.sqf
params ["_unit", "_corpse"];
if (isNull _corpse) exitWith {};
player setUnitLoadout (getUnitLoadout _corpse);
_primaryWeapon = _corpse getVariable ["Hmch_Saved_primWeapon",["",[""],[""]]];
_secondaryWeapon = _corpse getVariable ["Hmch_Saved_secWeapon",["",[""]]];
player addWeapon (_primaryWeapon select 0);
player addWeapon (_secondaryWeapon select 0);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 1);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 2);
player addSecondaryWeaponItem ((_secondaryWeapon select 1) select 0);
// in a respawn eh or wherever you restore the loadout
private _oldGun = player getVariable ["Hamsch_ShotgunClassname", ""];
private _oldammoClassnames = player getVariable ["Hamsch_ShotgunAmmoClass", ""];
private _oldAmmoCount = player getVariable ["Hamsch_ShotgunAmmoCount", 0];
private _oldGunAttachments = player getVariable ["Hamsch_ShotgunAttachments", []];
private _oldSecondaryAmmoClass = player getVariable ["Hamsch_ShotgunSecondaryAmmoClass", ""];
private _oldSecondaryAmmoCount = player getVariable ["Hamsch_ShotgunSecondaryAmmoCount", 0];
player setVariable ["KJW_ShotgunClassname", _oldGun];
player setVariable ["KJW_ShotgunAmmoClass", _oldAmmoClassnames];
player setVariable ["KJW_ShotgunAmmoCount", _oldAmmoCount];
player setVariable ["KJW_ShotgunAttachments", _oldGunAttachments];
player setVariable ["KJW_ShotgunSecondaryAmmoClass", _oldSecondaryAmmoClass];
player setVariable ["KJW_ShotgunSecondaryAmmoCount", _oldSecondaryAmmoCount];
// below handles spawning the shotgun object.
private _shottyObj = createVehicle ["GroundWeaponHolder", [0,0,0]];
private _oldGunWeaponItems = {
if (_oldGun isNotEqualTo "" && { (getNumber (configFile >> "CfgWeapons" >> (_x select 0) >> "type") == 1) }) exitWith { _x };
continueWith [];
} forEach _oldGunItems;
_shottyObj addWeaponWithAttachmentsCargoGlobal [_oldGunWeaponItems,1];
private _relPos = [-0.521984,-0.69026,-0.099307];
private _vectorDirAndUp = [[-0.775624,0.621418,0.110659], [-0.630396,-0.771462,-0.086297]];
[_shottyObj, "spine3", _relPos, _vectorDirAndUp] call KJW_fnc_attachToBoneRelative;
//params ["_unit", "_corpse"];
//player setUnitLoadout (getUnitLoadout _corpse);
//params ["_unit", "_corpse"];
//player setUnitLoadout (_corpse getVariable ["Saved_Loadout",[]]);
//player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
player setUnitFreefallHeight 200;
if !(_corpse isEqualTo objNull) then {
_nearPlayers = nearestObjects [_corpse, ["OPTRE_UNSC_Marine_Soldier_Unarmed"], 500, true];
_teammates = _nearPlayers select {alive _x && _x != player};
player setPosASL (getPosASL (_teammates select 0));
};
deleteVehicle _corpse;```
yeah its all good just stick these bits in there somewhere
with the restore bit withthe rest of the getvariables
the playerkilled bit doesnt matter where it goes but make sure private _oldGunItems = player getVariable ["Hamsch_nuts",[]]; is line after private _oldSecondaryAmmoCount = player getVariable ["KJW_ShotgunSecondaryAmmoCount", 0];
where is it that i can change the arma logo at the top of the load screen with a different graphic?
// in a respawn eh or wherever you restore the loadout
private _oldGun = player getVariable ["Hamsch_ShotgunClassname", ""];
private _oldammoClassnames = player getVariable ["Hamsch_ShotgunAmmoClass", ""];
private _oldAmmoCount = player getVariable ["Hamsch_ShotgunAmmoCount", 0];
private _oldGunAttachments = player getVariable ["Hamsch_ShotgunAttachments", []];
private _oldSecondaryAmmoClass = player getVariable ["Hamsch_ShotgunSecondaryAmmoClass", ""];
private _oldSecondaryAmmoCount = player getVariable ["Hamsch_ShotgunSecondaryAmmoCount", 0];
private _oldGunItems = player getVariable ["Hamsch_nuts",[]];
player setVariable ["KJW_ShotgunClassname", _oldGun];
player setVariable ["KJW_ShotgunAmmoClass", _oldAmmoClassnames];
player setVariable ["KJW_ShotgunAmmoCount", _oldAmmoCount];
player setVariable ["KJW_ShotgunAttachments", _oldGunAttachments];
player setVariable ["KJW_ShotgunSecondaryAmmoClass", _oldSecondaryAmmoClass];
player setVariable ["KJW_ShotgunSecondaryAmmoCount", _oldSecondaryAmmoCount];
// below handles spawning the shotgun object.
private _shottyObj = createVehicle ["GroundWeaponHolder", [0,0,0]];
private _oldGunWeaponItems = {
if (_oldGun isNotEqualTo "" && { (getNumber (configFile >> "CfgWeapons" >> (_x select 0) >> "type") == 1) }) exitWith { _x };
continueWith [];
} forEach _oldGunItems;
_shottyObj addWeaponWithAttachmentsCargoGlobal [_oldGunWeaponItems,1];
change player getVariable ["Hamsch_nuts",[]]; to player getVariable ["Hamsch_nuts","butt"]; and see if it returns a different error plz
where is the
private _oldGunItems = weaponsItems player;
player setVariable ["Hamsch_nuts", _oldGunItems];``` bit in your `onPlayerKilled.sqf`
Sorry I got lazy
was that in there when you tested it last?
as private _oldGunItems = player getVariable ["Hamsch_nuts",[]]; is returning the default value
it spawned that AAF gun next to my respawn location it seems
wonder if weaponItems actually works on dead players ๐ค
yeah thats part of the mod
eventhough I didnt have it
your second primary is dropped on your corpse; i dont think i actually set that as a variable to delete either, one mo
What I mean is that it didnt spawn a random gun on my body after I die before
having had an operation with this respawn save loadout thing just this weekend it didnt happen then
thats erm
odd
yeah
it shouldnt be using an f2000 at all the command should be failing 
Its weird
give me 10 and i'll add a cba setting for gun not being removed on death
probably the simplest approach tbh
I see
you also should be able to use call KJW_fnc_shotgunHandler instead of everything below // below handles spawning the shotgun object.
try that actually
okay so
i'll add a cba setting and update the mod that'll stop it clearing the variables upon death right now
all you should need is call KJW_fnc_shotgunHandler to spawn the shotgun again on player respawn
okay so
replace this:
// below handles spawning the shotgun object.
private _shottyObj = createVehicle ["GroundWeaponHolder", [0,0,0]];
private _oldGunWeaponItems = {
if (_oldGun isNotEqualTo "" && { (getNumber (configFile >> "CfgWeapons" >> (_x select 0) >> "type") == 1) }) exitWith { _x };
continueWith [];
} forEach _oldGunItems;
_shottyObj addWeaponWithAttachmentsCargoGlobal [_oldGunWeaponItems,1];
private _relPos = [-0.521984,-0.69026,-0.099307];
private _vectorDirAndUp = [[-0.775624,0.621418,0.110659], [-0.630396,-0.771462,-0.086297]];
[_shottyObj, "spine3", _relPos, _vectorDirAndUp] call KJW_fnc_attachToBoneRelative;```
With:
call KJW_fnc_shotgunHandler
in fact i'll do it for you
give me 10 minutes and i'll get an update out for all this
Sure thing
Honestly im surprised this respawn save configuration thing isnt its own mod tbh
Besides having to adjust it for these mods it seems like it would make for a good mod given its worked reliably so far
Not that I know much about how stuff works its magic to me
repair the mod and disable the setting then retry; comment out anything related to my mod from those scripts
i've got to go now though, dm/tag me here/comment on the ws page with any issues you encounter
How do the save game commands work? (saveGame, loadGame, etc)
What do they save? where? How does it determine what to save?
will do. Thank you
saveGame trigger a "normal videogame" savegame
loadGame loads the last autosave as explained here https://community.bistudio.com/wiki/loadGame
what is a normal videogame save game? mainly asking to see if the commands would be any use for me wanting to dynamically save mid-game placed objects without have to write a script for it.
for multiplayer as well
it would yes
but that only works on player-hosted server iirc
unsure about Zeus-editable things and all that
alright gotcha, ill stay away from that then and probably work on saving to something like the profile namespace.
Another question, what would be more performance friendly and effecient?
Global array that has items appended to it whenever they are built, then being saved to the profile namespace every minute
or
Doing a nearEntities scan with a radius of likely 2-300 meters in multiple locations on a map (up to five at a time), then sorting through, modifying and merging the arrays to be saved in the profileNamespace every minute
I imagine the former option would be best
missionProfileNamespace*
I have Global Arrays with Multiple Sub Arrays for different sets of Things that store the Object, Position and Rotation and various other details server side
I am having a harder time finding those settings than I should lol
Am I misunderstanding what CBA settings are?
yeah thats exactly what I was thinking, and then for captured enemy vehicles im thinking maybe ill add an EventHandler to enemy vehicles on creation, and when a player gets in the vehicle it gets added to a captured vic sub array. Probably use a hashmap to store the sub arrays
this is it right???
(as in addon settings)
hashmaps are the way to go I think with my method I just haven't refactored it yet
as for Captured vehicles I would make it when they get taken to a blufor FOB or equivalent that it gets added
Just a small loop every 30 seconds to check for the vehicle and add it to the list if it isn't already there, but an EH should work fine
FSM's function similar to Switch Statements, it looks for the lowest? priority condition that returns true in order
I can't remember if the priority starts with the highest or lowest first
yeah, im not sure how ill do it yet but im thinking before each save ill just do a distance2D check on the vehicles in the captured array and move the ones close enough to the actual save sub array
The goal of an FSM is to only have one condition be met and continue down that path
and of course if there are multiple it will pick the highest priority, if you are right about that
No luck when trying. Will try again later
The event handler would be a very hands off approach but yeah it could lead to vehicles being very far away from everything and still saving out there
Not to my knowledge
Only one branch should exec
Unless someone else can shed light on it but in my minimal experience so far It only does the one unless you make it loop around back to the statement
But then it would just execute the same condition again in that case
Yeah I used a random Number as part of an AI I did with an FSM so it looked for the Number and another Condition along with it to decide things, I also gave it a short delay after each thing to simulate it thinking, I have posted it before #arma3_scripting message
Does it say "Hmmm" and show buffering icon above it?
Hahahah, I should have done that, it would have been funny
Cba settings
Are a thing
I had an idea to make an FSM for Agents to make them play a similar role to AI, It wouldn't be great but I wonder if it would let me have dumber but more Numerous AI
Only if Arma AI are horribly suboptimal :P
Squawk Codes for Arma 3
I am just curious of the performance differences, either way it's a good learning experience for making AI
Since I will need a couple for Commander Level Stuff
is it faster to (crew _veh) apply { _x disableAI "ALL"; etc; }; or should I just forEach it?
fractionally faster.
use forEach for readability
hmm, I prefer apply for readability.
array <command> code, I can get that
we could ask Dedmen or KK for an array forEach code version ๐
oh, maybe apply doesn't work out faster if you're not using the output array.
They're both kinda suboptimal like that. apply makes an array, forEach generates forEachIndex.
lol, ill use apply. I want to squeeze any ounce of performance I can. oh btw the apply is inside a for loop if that makes it worse
hmm actually another question, im using BIS_fnc_spawnVehicle to create my vehicles/crew, is this optimal or is createVehicle/createUnit a faster way to go?
I would imagine the spawnVehicle function does things faster and more efficiently than I could, creating and assigning the crew etc
You can read the code.
(you should read the code)
Generally it's not a performance question, because the cost of the SQF is tiny compared to the cost of creating vehicles and units.
The other potentially-slow part is finding a suitable place to spawn them.
A misused BIS_fnc_findSafePos can be brutally slow, for example.
Isn't there a command to fill a vehicles crew?
createVehicleCrew, yeah
there is, and from reading the code BIS_fnc_spawnVehicle makes use of it
looks like the function honestly does anything I would know to do
a lot of functions are like that, the marker ones for example
I guess the best improvement I can probably do for spawning vehicles is make the function spawn on exact cords. Just need to try and determine if the position is safe beforehand
if its worth it
CreateVehicle has that no? the last param string
"CAN_COLLIDE", yes.
You would NONE i believe iirc
It just checks of the model could fit there from the wiki
Would that be slower than a manual check though?
Not sure about slower, but it's not super-reliable.
oh you know what, I was assuming BIS_fnc_spawnVehicle had a param for exact position. Looks like it doesnt?
the wiki doesnt mention anything about it, but it does make use of a _precidePosition variable, but it gets the value for this from the sideOrGroup param?
_precisePosition = _this param [4,true,[true]];
if im reading correctly
Well its a bool by the looks not a position
oh wait, its actually a fifth param that the wiki doesnt mention
hmm
yeah, the code says:
Parameter(s):
_this select 0: desired position (Array).
_this select 1: desired azimuth (Number).
_this select 2: type of the vehicle (String).
_this select 3: side or existing group (Side or Group).
_this select 4: (optional) force precise position (Bool, default: true).
wiki doesnt mention it though, interesting
indeed
Does createVehicle have a radius it can use? if so its likely a bool that controls if it uses 0 for the radius or not maybe?
Not at the pc so I cant look myself
only use of the bool I can see so far is after vehicle creation:
if (_precisePosition) then
{
_veh setPos _pos;
};
That is always true since the param defaults to true
yes
looks like it has a placement radius
right, why not just change the _pos before vehicle creation?
why use setPos after
Maybe the createVehicle is unreliable in positioning like John suggested about the Last Param on it
hmm I guess so, it does use "none" when creating vehicles
So its a sort of backup that always makes sure that it actually gets placed there in the event that createVehicle places it in a wonky position
im gonna change it to false and see what happens
If you are confident that its spawn position is clear then you could use CAN_COLLIDE and skip the position check all together
just like John said earlier
im gonna do some tests for speed and see if I can do the position checks and placement any better than the function then, yeah
Bear in mind that completely safe placement is hard
Arma just lacks good functionality for it.
I cant even think of a good way to test it
maybe a trigger and check if anything is in its area, but that's not great either
or maybe it would be?
oh well that's for tomorrow me to find out
trigger is just a point area check. Like doing _a distance2d _b < _radius
tried using the watch lines in the debug console, did not do it correctly I guess.
I remember seeing someone do it, how do you run the script in the debug console where it tells you how long it took to finish running?
diag_codePerformance usually, but that's not appropriate for anything that creates objects.
So diag_tickTime before/after comparison.
yeah im seeing that lol. I seen the speedometer button in the debug console and got this
Result:
0.0078 ms
Cycles:
1/10000
Code:
[trigger_military_1, "military_1"] spawn TRA_fnc_spawnMilitary
I assume thats not accurate since im spawning the creation of vehicles/infantry though right
Yeah, that's only checking how long it takes to run a spawn.
And then hopefully throwing the spawn away :P
private _startTime = diag_tickTime;
// your code here
diag_log format ["Time elapsed: %1", diag_tickTime - _startTime];
Might not be very consistent. Like first run might be far slower than subsequent runs for the same object types.
probably wanna multiply by 1000 for milliseconds.
got about 2.7 seconds
"Time elapsed: 2.77393"
would you consider that good or bad lol
how much stuff are you spawning here...
well im spawning what I expect to be the minimum, about 19 infantry + 2-3 vehicles
Any sleeps/waitUntil in there?
going for a max of about 30 or more infantry in the future
yes, 3, each in a for loop similar to this
for "_i" from 1 to _patrollingInf do {
_group = createGroup TRA_enemySide;
_squadPos = (getMarkerPos _marker) getPos [random _captureRadius / 2, random 360];
[_unitObjs, _group, _unitArr, _squadPos, _captureRadius] spawn {
params ["_unitObjs", "_group", "_unitArr", "_squadPos", "_captureRadius"];
for "_j" from 1 to 5 do {
_unit = _group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"];
_unit enableSimulationGlobal false;
_unit allowDamage false;
_unit hideObjectGlobal true;
_unit disableAI"ALL";
_unit setBehaviour"CARELESS";
_unit setSpeaker"NoVoice";
_unit disableConversation true;
_unit enableMimics false;
_unit enableStamina false;
_unitObjs pushback (_unit);
sleep (((abs(50 - diag_fps) / (50 - 20))^2) * 2);
};
[_group, _squadPos, _captureRadius / 2] call lambs_wp_fnc_taskPatrol;
};
};
If you're testing perf then comment out the sleeps...
wait, it's spawning these 5-man groups in parallel though?
It's sleeping per unit but only within the inner spawn?
(why is there an inner spawn?)
without the sleep's its about 0.7 seconds
"Time elapsed: 0.737793"
another I didnt think about that scenario
Again it won't measure the performance cost of the inner spawn.
I'm not entirely sure what it's doing for 0.7 seconds there though :P
could be the switch case/hashmap assignment earlier in the script plus some variable assignment using round() I guess
gotcha, well thats fine then
it was only curiosity
can I somehow get rid of certain road types from a map with a script? Wanted to replace or completely hide some asphalt road types. nearRoads returns segments of all roads near the center and that's about it
measured the spawns now as well, looks like my original 2.7 seconds was coincidentally close, unsurprisingly loop one does finish well after the other loops.
13:22:26 "Time elapsed: 0.595215"
13:22:27 "Time elapsed Loop two: 2.21826"
13:22:27 "Time elapsed Loop two: 2.22119"
13:22:27 "Time elapsed loop three: 2.45703"
13:22:27 "Time elapsed Loop two: 2.479"
13:22:28 "Time elapsed loop three: 2.68408"
13:22:28 "Time elapsed Loop one: 2.72412"
13:22:28 "Time elapsed Loop one: 2.7251"
I know im reiterating my question here, but spawning 19 + 2 vehicles with like 2-3 crew each, is this bad? good? or about average? idk
Never actually tested it. Marked down as "expensive but unavoidable".
If you're creating vehicles unnecessarily then definitely don't do that :P
IIRC even something like addWeapon is painfully slow.
gotcha, yeah may end up settling with the fps dip is unavoidable as well. I do think I have minimized how noticeable it is though.
Your parallel spawns are probably not ideal there :P
very true, ill see what I can come up with there as well
Yes but you cannot edit in 3den has to be ingame
Anyone know a script to prevent AI from moving without disabling pathing?
Like once in battle then they will move
disabling pathing is the typical way.
https://github.com/hypoxia125/Hypoxic-Framework/blob/main/addons/main/functions/fn_moveOnCombat.sqf
I remember a rimmy video where he managed to use a line of code that disable pathing until combat
Iโm not sure how well it works with it being combined with other orders though.
doStop but that will make your units stupid and not communicate with each other
so you'll have to doFollow after which then you might as well just do pathing
Thatโs probably the best thing I can do right now
I canโt have the ai stupid in urban combat
If they don't have a waypoint then they won't move if out of combat.
At least that's the vanilla behaviour. They just stand there.
that's if he doesn't care about them always going back to formation
I really donโt care for formation thereโs going to be a lot of ai artillery fire so I want it to be a bit random
well between all of us you have 3 ways now you can experiment with to figure out what you like the best
Thanks for the help Iโll test them out and use the best one
is my second condition on the trigger wrong?
the first time the trigger is activated it has the marker_name_active variable created and assigned to the trigger as false if it doesnt already exist, then in the script called on activation the trigger is passed in and setVariable is used to assign the variable as true.
Even though the variable is true after the first activation, when a player re-enters the trigger it still activates once again.
format["this && (thisTrigger getVariable ['%1%2', false] isEqualTo false) && (TRA_zonesActive < TRA_maxZonesActive) && (TRA_activeAi < TRA_maxAiActive)", str _x, '_active'],
-- figured it out, I was doing str _x when _x is already a string
okay, I did manage to find that out and turning off or on that weapon removing setting didnt really fix the issue
if its on, the F2000 will spawn like before
if its off, a floating gun will be left where my body was that I cant touch
Question once again :D
Is there a command or script I can use to get the ID of a layer in the editor?
Returns what's inside the layer not the Layer ID, I need the layer ID specifically.
Huh... yeah, not seeing a Getter.
odd, what happens when you press 4? Might just rework the whole thing when I'm home ngl
Yea and nothing in the editor
pressing 4 is fine. all normal. Its just saving loadout and loading it when dying/respawn where issues appear
dont do anything with my mod in the respawn scripts, comment everything like that out
guys is normal praetorian kill in shipยดs too?
Excuse me?
i add praetorian c1 "b_aaa_system_01_f"
for destrou hellis in one zone
but is destroy boatยดs or ships too
Normal
it's possibel make for destroy air vehicles?
like isKindOf "Air";
i dont know because praetorian not have condition in editor
only have box txt init
I don't think there is a good and straightforward way to make it shoot only air targets
๐ฅ
Could you do a repeating check, if !(_target iskindof "air"), dotarget ""?
Is it possible to script deleting of vehicle tire marks on the ground? They seem to sometimes get stuck and not ever garbage collected. Also, is there a way to delete destroyed vegetation?
How can i open arsenal... FOR NOT ME... BUT... For a different NPC from a specific box? Is that possible?
["Open",[true,box,unit]] call BIS_fnc_arsenal```
ty
Does anybody knows if there is any script that makes ai throw flares on trigger?
I want to get when the up, down, left, and right arrows are pressed on the keyboard but this is kind of confusing me. What code should I be looking for?
200, 203, 205, 208 I assume but what are the lower in the list up/down/left/right arrows?
mmm, I have played myself it seems. tried setting an event handler/switch case for 203/205 and now no key other than the left and right key does anything. Neato, its way too late for this, im going to bed
Not like that
They're objects. You can find them using allMissionObjects (and maybe allObjects too)
Real or virtual AI?
They're the same thing
Look closely. The lower ones use the same macro. They're just aliases
You must return false at the end of a keyDown EH if you don't want the key to be overridden
If you always return true you can't do anything anymore
wiki says disableCollisionWith has global effect
Real ai already placed
Is there any way to get the relative position of a listbox element? I'm trying to tie listbox entries to another control that cannot be represented as a string.
is that possible?
so you mean the local player still collides with whatever _asset is?
its index is its relative position
how would I calculate a ctrlPosition from index though?
?
Would I just have to do the listbox's step * index?
ctrlPosition?
yes
im trying to do ctrlPosition but with index. But the individual lb elements are not a control so it doesnt work for that.
well it's not simple. as you said the relative Y is index * height but there's also the scrollbar to take into account
where do you run this?
that is true. The first you stated could work if there was no scrollbar, but yea it wouldn't be dynamic.
So is there no way to retrieve its position?
there is
what are you trying to do Happy?
Tie a control's position to an element of a listbox
what kind of ctrl tho?
ic
a combo box.
You've said a listbox then is a combo box, which exactly it is?
he wants to show a combo box next to a listbox item
no sorry, both.
A listbox is the main element right. The combo box is tied to the position of a listbox's index
yea
Hmm
Since I don't exactly know what it is, but you'll need
- the row height
ctrlScrollValueslbSize
https://community.bistudio.com/wiki/CT_LISTBOX#itemSpacing
Maybe? spacing * index + 1?
well you can do this:
- abs Y (but relative to listbox) is index * itemheight
- check scroll bar via its command (don't remember its name) =>
ctrlScrollValuesas polpox said - if scroll bar percent is > 0:
3.1 total height is count * itemheight
3.2 Y of center of view is (h_total - h/2) * scroll + h/2 (h is listbox height)
3.3. if you subtract it from the abs Y you get its current rel Y, (relative to the center of listbox ofc)
then you just add it to listbox pos
thank you! I'll see what I can come up with an report back.
This would need to run in a loop right?
Depends how you want to run
I think we have an EH for it
ctrlAttachTo lol
i dont see any for changing scroll unfortunately
you need 2 EHs. one for scroll bar one for index changing
pretty sure we did 
would the default spacing of elements just be the size?
size?
there's an itemHeight entry in config
or something like that
don't remember
yea
CT_LISTBOX#rowHeight
I think you also need to add it to itemspacing
well it's obviously how it's supposed to work. just run it on all players individually
collision is checked locally
@little raptor @warm hedge I love you it worked.
But I only have it working for static LB right now.
That's fine though, I will update if I need more space for stuff.
THANK YOU SO MUCH
well just find which weapon and flare round it can use. then use the forceWeaponFire command.
you can also add a FiredMan event handler to adjust the projectile's velocity to go exactly where you want
_lbIndex = _statMenu lbAdd "COMBO BOX HERE:";
_ctrlHeightNew = (_lbIndex * 0.04 * safezoneH);
_ctrlHeight = ((ctrlPosition _lb) # 1) + _ctrlHeightNew;
_combo ctrlSetPositionY _ctrlHeight;
This is the code that worked for me
_scroll = ctrlScrollValues _lb#0;
if (_scroll > 0) then {
_h = ctrlPosition _lb # 3;
_rowHeight = 0.04 * safezoneH;
_h_total = lbSize _lb * _rowHeight;
_ctrlHeight = (_lbIndex * _rowHeight );
_relY = _ctrlHeight - ((_h_total - _h / 2) * _scroll + _h / 2);
_ctrlHeightNew = ctrlPosition _lb#1 + _h / 2 + _relY;
};
didn't test but it should work 
so I'd just spawn a loop with that?
you never set the position but yea
I guess 
well you should also check if the item is in view:
abs(_relY) < _h / 2
grr
yeah already is fix yesterday (vehicle player) in thisList && (!((vehicle player) isKindOf "Ship"))
_cfgPath = configFile >> "CfgWorlds" >> worldName >> "Names";
_cfgClasses = [];
{
_class = configName (_x);
if (_cfgPath >> _class >> "type" == "CityCenter") then {
_cfgClasses pushBack _class;
};
} forEach ("true" configClasses _cfgPath);
How would I correctly compare the entry of type? This throws me an error at == operator...
What error specifically?
I'm pretty sure you need getText to retrieve the content of a config property, you can't just plug in the config itself in this context
_cfgPath = configFile >> "CfgWorlds" >> worldName >> "Names";
_cfgClasses = toString {getText(_x >> "type") == "CityCenter"} configClasses _cfgPath apply {configName _x};
I've got a big problem with respawns in multiplayer (this is my first MP mission so maybe I'm missing something)
What I have:
- Two respawn position modules called respawn_guerrila and respawn_west
- Two empty markers called respawn_guerrila and respawn_west
- Multiplayer respawn settings set to "Custom position"
What I expect to happen: INDFOR and BLUFOR players respawn on corresponding spawn points
What actually happens:
- INDFOR and BLUFOR players respawn on corresponding spawn points in local multiplayer (in other words it works good)
- INDFOR and BLUFOR players respawn on their dead bodies on dedicated server (in other words it's broken)
The only workaround we found is for the Zeus to place "Blufor respawn" and "Indfor respawn" modules after the game has started. The freshly spawned modules do not work either, however this somehow fixes the initial "respawn position" modules.
I'm really lost here and the fact it only happens on dedicated server makes it nightmarish to debug.
if you have modules, you dont need markers, afaik they serve the same thing
So I thought. I did not have markers at first but added them when I realized that the modules don't work
also whats your respawn delay?
10 seconds
actually, module dont seem to work, use marker instead
they work with respawn menu tho
When running the local multiplayer, I can see the respawn marker on the map. But on dedicated server it is absent
problem with marker is that zeus can't relocate the respawn afterwards
This is the position of Respawn Position module that I've placed in eden. It shows up and works in local multiplayer, but does not work on dedicated
what's respawn menu?
ah it's when you get to choose the spawn point I guess
ye
I don't see this menu in my mission
guess it's the MenuPosition from here https://community.bistudio.com/wiki/Arma_3:_Respawn
You can, by clicked add editable objects.
It works with Respawn Position modules but it does not work with map markers I think. The legacy system uses map markers instead of modules if I understand this right.
Anyways, we use MenuPosition and works well with zeus, if you decide to use it, create file description.ext in your mission, plop this in: and use respawn modules
respawnDelay = 10;
respawnTemplates[] = {"MenuPosition"};```
10 here is respawn delay
The problem is, none of these things work until zeus places Blufor Respawn module ๐ Then the Respawn Position magically fixes itself
yep was about to add this into the .ext.
Will export to our dedicated server and report back
i did run a mission without menu position and i remember having no issues, but tbf i never moved it, or had to move respawn point
could be an issue if you want to move it later, as you cant simply move markers with zeus
well for us the respawn point was not working even without moving, we all just spawned on our dead bodies
I'll see if respawn menu works
just a warning respawn delay must not be 0, or it wont work
Yeah I'm planning to keep it at 10 to let the playerbase reflect on their choices ๐
I ran some tests in local multiplayer and it seems like there is a problem.
I've made custom loadouts for my players and I have this code in onPlayerRespawn.sqf. This makes sure that the players always respawn with the same loadout that they had at the beginning of the mission.
_loadout = player getVariable "Saved_Loadout";
if (isNil "_loadout") then {
player setVariable["Saved_Loadout", getUnitLoadout player]
};
player setUnitLoadout(player getVariable["Saved_Loadout",[]]);
The problem is, after adding MenuPosition the players now respawn with the default loadout of the units they're playing as.
You need to set respawn on start
nevermind, it actually does not even give them the loadout at the start
the first time they spawn they have the default loadout o_0
respawnOnStart=1; add that to des.ext see if it helps
That did not help however respawnOnStart = 0; did fix the loadout issue, thx!
Hmm i thunk that was default... oh well. As long as it works!
Now the scariest part, uploading to the dedicated server and testing ๐ brb
Dont be afraid of ds, its only a machine, it cant hurt you
the amount of mental pain scripting in arma has inflicted is hard to overestimate ๐
Ok so this thing worked for dedicated, thanks!
Awesome
A new problem emerged after introducing the new respawn system.
Here is a respawn point.
Before the new system the players respawned in the hallways, but now they spawn on top.
I suspect the game is confused thinking that the respawn position is obstructed
of just shoots itself in the foot with using PositionAGLS
fixed by putting this into onPlayerRespawn
_pos = getPosATL player;
_pos = [_pos select 0, _pos select 1, 0];
player setPosATL _pos;
Hey,
Is there way to play sound/music inside of the strategic map while calling BIS_fnc_strategicMapOpen to open the strategic Map Module?
I've tried to just start the music when BIS_fnc_strategicMapOpen happens, but BIS_fnc_strategicMapOpen mutes everything.
hmm perhaps set simulation parameter to true, it might work. but ive never dealt with strategic map
I am not using it like that though - I use the module and then call it via script with [openStrategicMap] call BIS_fnc_moduleStrategicMapOpen;
So I would need to re-activate it otherwise to test that (which I will do try in a couple of minutes) and if that doesn't work I think I will switch to not the module version.
Should not be a problem of simulation as far as I can tell - will test more. nvm it is the problem.
Have changed it, thanks for helping!
Now I just need to figure out how to stop the music when it closes and how to play a map close sound. (trying to do it with playMusic and playSound) Any ideas?
playMusic "" will stop it
I know, though I will need to stop after a player closes the strat map, which I haven't figured out. Edit: Found something in the functions viewer, now gonna try with isnull _display
I'm trying to call ace functions from my function but it seems I pass the variables the wrong way?
// Object Init
[this, player] execVM "fn_arsenalWEST.sqf";
// fn_arsenalWEST.sqf
params ["_arsenal", "_unit"];
_arsenal = _this select 0;
_unit = _this select 1;
_openStorage = [
// Action name
"OpenStorage",
// Name of the action shown in the menu
"Storage",
// Icon
"\a3\ui_f\data\igui\cfg\simpletasks\types\box_ca.paa",
// Statement
{
// hint won't execute...
hint "Hello World!";
},
// Condition
{
side _unit == west
},
// Children code
{},
// Action parameters
[_unit],
// Position
[0,0,0],
// Distance
100
] call ace_interact_menu_fnc_createAction;
// This gets executed!
[
// Object the action should be assigned to
_arsenal,
// Type of action, 0 for actions, 1 for self-actions
0,
// Parent path of the new action
["ACE_MainActions"],
// Action
_openStorage
] call ace_interact_menu_fnc_addActionToObject;
How would I call the variables correctly if it's the case?
I tried to describe the case as simple as I could...
The addActionToObject function executes.
use params ["_unit"]
or _this#0 or whatever
As far as I understood your problem, you need to put this in init.sqf
if (hasinterface) then {
[] spawn {
waitUntil {
alive player
};
player setVariable ["loadout", getUnitloadout player, false];
player addEventHandler ["Respawn", {
player setUnitLoadout (player getVariable "loadout");
}];
};
};
params ["_arsenal", "_unit"];
_arsenal = _this select 0;
_unit = _this select 1;
and this is not needed
params automatically does that for you
Where? At the top of my function?
How do I address the arsenal object then?
https://ace3.acemod.org/wiki/framework/interactionmenu-framework
ace_interact_menu_fnc_createAction
ace_interact_menu_fnc_addActionToObject
These are the funcs
looks like it passes these:
params ["_target", "_player", "_params"];
so unit is _params params ["_unit"]
// Statement
{
params ["_arsenal", "_player", "_params"];
_params params ["_unit"];
// hint won't execute...
hint "Hello World!";
},
// Condition
{
params ["_arsenal", "_player", "_params"];
_params params ["_unit"];
side _unit == west
},
or just chain it : private _unit = _this#2#0
Okay, I got a bit further with this now. Currently using: isnull _display
and _display = finddisplay 506;
which is the display for the strat map ig;
Both work if its true, now my question is how a) make it check that the strat map has closed instead of it checking if it is open and b) how to then combine it with a playMusic and playSound?
Both work if its true
what is true?
make it check that the strat map has closed instead of it checking if it is open
reverse the condition using!...
true in this case, when the strat map is open
I had something with waitUntil, which checked everytime when it was open and that worked - but also wasn't able to destroy the loop after one completion.
what was your code?
waitUntil { sleep 1; if (isnull _display) exitWith { true }; playSound "MapOFF"; false};
should be this one, though I already have removed it - this is just out of my memory (which I put in a diffrent .sqf)
well it's not correct
if display is null then it's closed
waitUntil {!isNull findDisplay 506};
playSound "MapOn";
waitUntil {isNull findDisplay 506};
playSound "MapOff";
you can also use an event handler to check if it's closed
works! Thank you!
https://pastebin.com/vKkCGcxt when using [true] call life_fnc_radiation2; I get an error that says Error Suspending not allowed in this context why is this?
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.
Try
[true] spawn life_fnc_radiation2;
it triggers it properly but my health isnt going down and after about 10 seconds i just die
How can I get procedural textures to align more closely with their true RGB values?
In most cases, the value I set becomes lighter (sun maybe?). If I try to decrease RGB through texture, it becomes black inadvertently.
_BG setObjectTexture [0, "#(rgb,8,8,3)color(0.1,0.1,0.1,1)"];
use a different material
? I mean setObjectMaterial
Do you know what would be a good material? I don't see a predefined list
dunno. try removing the material first
if it's not good enough you can just make your own material
the material i'm trying to apply the texture to is the blank screen asset
@sharp grotto do i have problems in my code which is causing this?
hey, how do i give "splendid camera" perms to other players in my server?
i am noob at at scripting
AFK inspiration moment, would someone be kind enough to sanity check a short script? Intent in comment blocks:
what is this capitalisation
and indentation
kill me now
does alive take a group now?
AMMA INVOICE YOU MY CODE REVIEW AT THIS (I)RATE
Hey, if the only issue besides 'alive group doesnt make sense and you could have looked into that to double check first' is that I typed this up on a cellphone keyboard during a very boring 12 hour shift where indents are a nightmare and capitalization at the whims of the predictive text, ill take it. Thank you!
how dare you write code at work!! I don't!!!1!
I haven't checked it all, but the alive thing was the most in my face one
and the lack of private, of course
I would not recommend the "spawn one per group" thing, too
Thats true, the scenario its going in could have a significant number of groups appearing, and I did plan ahead by assigning the markers as variables to the groups themselves. Workable problems, I think.
do you plan to regularly add groups or not?
Yeah; this bit will have to be on its own timer, which should free up some of the Spawn stacking. At the moment its configured for a on-call use to test when I actually can sit down and test.
wait one
do any of you boys know why i only take 0.1 damage and then nothing else when i have a loop? https://sqfbin.com/ohaqowohidamexatitat
because you only set _damage in the start and never update it in the loop?
โ
ahhh, thank you so much
also, are you sure player having any one piece of CBRN gear should be enough for them to not take damage?
they require all 3
ah i sent the old code
in my current one its if !((_uniform isEqualTo "U_C_CBRN_Suit_01_White_F") && (_backpack isEqualTo "B_SCBA_01_F") && (_goggles isEqualTo "G_RegulatorMask_F")) then {
new exploit: dress up, enter hotzone, drop CBRN gear, still get no damage ๐
Far too kind, ill keep this handy as I tinker with my attempt - no sense wasting a learning opportunity, but more carefully crafted code is always appreciated ^_^
tbh I felt you might have taken my fake rudeness as potentially a bit real so guilt made me write that and I am sorry if I ever offended you in any way shape or form and I hope we can stay Discord channel neighbours after that really because it's nice having you here and all
private _group = _x; is missing from my code, too
but anyway
good luck with your code ๐
oh wow and SHININGRAID_fnc_ReconGroups append SHININGRAID_fnc_ReconGroups; โ SHININGRAID_fnc_ReconGroups append _groupsToAdd;
thanks, got that sorted!
You did come on a little strong, not gonna lie, but we're all good ๐ ive been around long enough to know you dont respond that harshly unless its a bit... but also long enough to know that 'heres my untested code' is just a shade better than '... that I got from an AI'.
And hey, if it gives me a chance to see how The Prosยฉ๏ธ would handle the same thing Im working on, its worth a little sass.
thanks ๐ค and hopefully no sass is required for code assistance - just the usual jokes here and there everyone has to endure ๐ ๐
First of all thank you for posting this ๐
Second, I'm not sure if this code won't have the same problem that I had, the problem being that when players have their first spawn into a spawnpoint (and not into the actual unit with the overriden loadout) the loadout saved to the "loadout" variable will be the default one for the unit class
Either way, making sure the players first spawn happens into a unit and not into a spawnpoint fixed the problem, still appreciate the help though
if the same condition is used for more states, the condition and action code will be compiled to more different places in the compilation result. But only one of them can be used during decompilation! So, one cannot freely change the compilation result in text editor (decompilation can indeterministically copy such changes to all places or ignore it at all).
What do I used to let people make groups in a server?
https://community.bistudio.com/wiki/Arma_3:_Dynamic_Groups Dynamic Groups
Thank you!
Lou do you know of anyway to make WL Aircraft Arrival work with dynamic airports, like the USS freedom
I would personally suggest using == for a situation like this where you can be sure both types in the comparison are the same, and you're comparing classnames. The reason for this is that isEqualTo is case-sensitive and == is not, and it's really easy to make case mistakes when putting in classnames. Using ==, you don't need to worry about this.
(or if you use in to check against an array of possible classnames, use toLower to force everything to be the same case regardless of input case)
I've tried that but deletevehicle doesn't seem to have any effect on them.
nope, sorry
Much appreciated!
you're welcome!
I don't say it is impossible, but I don't know WL - and my guess would be that WL arrived after dynamic aircrafts iirc, so it might be tricky to override that behaviour
[_x, _ctrlTV, _itemHashMap, _selectHashMap, _AttachTypes] spawn {
params["_x", "_ctrlTV", "_itemHashMap", "_selectHashMap", "_AttachTypes"];
private _typeIndex = _AttachTypes find "secondaryMags";
(_itemHashMap get toLower(_x)) params ["_displayName", "_picture", "_addonClass", "_addonIcon", "_category", "_specificType", "_descriptionShort", "_class"];
if (isNil "_displayName" || isNil "_class") then {
(false)
};
format["name: %1 class: %2", _displayName, _class] call BIS_fnc_3DENNotification;
[_ctrlTV, _typeIndex, _displayName, _class, _descriptionShort, _addonIcon, _selectHashMap] call _fnc_initTVItem;
(true)
};
I've got this spawned function that I'm trying to run asynchronously and _displayName keeps giving me undefined variable even though I'm testing it
I'm pretty sure it's the way I'm trying to kill the spawned, do I just return a value? or is there a break function to kill a spawn?
Context of the script?
trying to change the WL sector module from being square to round
Well, one thing I notice alongside you don't have the marker name, you're using wrong quotation
How do I find the marker name?
I don't know, I'm not familiar with WL scripts
I looked at the SQF and couldn't really figure it out
Hey,
wanted to ask something again regarding BIS_fnc_strategicMapOpen. Is there a way to remove a mission from the Strat Map after it has been selected and also to reappear if a mission was finished. Currently looking on having more than 3 missions in the Strat Map.
This is my BIS_fnc_strategicMapOpen thingy:
findDisplay 46,
[11685.615,15898.968,0],
[
[
[12816.17,16668.49,0],
{trgconOBJ01 = true},
"Scavange a battlefield.",
"A heavy clash between the FIA and AAF happend in this area. According to rumors some weaponory has been left behind. Somebody should look into it...",
"Kosta",
"",
1.5,
[ player ]
],
[
[10959.119,17249.828,0],
{},
"Scout area around...",
"We have reports of AAF partrols in this area.",
"Kosta",
"",
1.5,
[ player ]
]
],
[
[0,0,0],
{},
"Mission 3",
"Mission 3",
"Kosta",
"",
1.5,
[ player ]
]
],
[
[
[14864.262,16588.461,0],
configFile >> "CfgORBAT" >> "BIS" >> "B_1_A_1_2",
configFile >> "CfgORBAT" >> "BIS" >> "B_1",
[],
10
]
],
[
"marker_1",
"marker_2"
],
[
[
"\A3\Ui_f\data\Logos\arma3_white_ca.paa",
[0,0,0,1],
[12462.769,17745.64,0],
8,
8,
0,
"Mission Logo",
true
]
],
0,
false,
1,
true,
"Current missions",
false,
"\A3\Ui_f\data\Map\GroupIcons\badge_rotate_%1_gs.paa"
] call BIS_fnc_strategicMapOpen;```
Thanks in advance
How do I know if the groups feature worked
can anyone tell me what these messages mean? They have been getting spammed in my servers RPT the last few weeks, started around the same time we began noticing drastic performance drops/server freezing.
23:20:22 Server: Object 2:1381 not found (message Type_117)
23:20:23 Server: Object 2:3094 not found (message Type_124)
23:20:23 Server: Object 2:3093 not found (message Type_124)
23:20:25 Server: Object 2:1374 not found (message Type_118)
23:20:29 Server: Object 2:1381 not found (message Type_118)
23:20:29 Server: Object 2:1780 not found (message Type_96)
23:20:30 Server: Object 2:1374 not found (message Type_117)
Many more where this came from
Hmm, i think it means that object wasnt found...
an object on the server is not found
probably a client is asking the server to update it or something?
you should probably show the logs to Dedmen
just put this in your server.cfg
{
LogObjectNotFound = true; // logging enabled
SkipDescriptionParsing = false; // parse description.ext
ignoreMissionLoadErrors = false; // do not ingore errors
queueSizeLogG = 1000000; // if a specific players message queue
// is larger than 1MB and #monitor is running,
// dump his messages to a logfile for analysis
};```
change to LogObjectNotFound = false;
If error isnt logged, its not an error xD
If there a (mostly) painless way to search and replace a specific piece of gear on all units on the map?
Specifically looking to replace GL rigs with special rigs due to some nonsense with ace medical going on
I imagine it can be done, but would this tank performance if it's constantly running and searching?
I assume this is on ai
I think best practice if you know the classnames of the units would be to use a CBA init event handler.
A vanilla option that applies this to all ai would be an entity created event handler. This will run code on every spawned entity. Then you check if they have the rig on, remove it, and add the new one.
Much better to run it just once than do a looping script
Ideally the script would be used in multiple different missons/scenarios not made by me, just hosted on my server for buddies
so I don't have access to the unit classnames in this case
and the units might not be spawned when I initially run the script
Then just a entitycreated handler will do the trick
Roger that, thanks for the help! I'll read up on it.
the entitycreated event is not necessarily appropriate .. have you seen how often it executes?
each time a footprint or butterfly or bit of dust/pollen is created, etc..
I asked yesterday about adding an ace action and passing variables to a function, and Leopard20 told me to use this construction:
#arma3_scripting message
But since then I had no success in understanding this and making it work.
I tried a different approach and make separate actions, thinking it might be an issue...
But the actions aren't event inited.
If anyone could check the code, I'd appreciate it: https://sqfbin.com/aqotoxeqokiletowesig
I created some smoke and want to change the draw distance of it.
Some player use high view distance and the smoke just draw when they zoom on it.
I want ot make it more consistent. Can i do that via particles setParam?
try changing your condition to true and see if they work then.
Nope, the conditions are fine... I changed to true didn't make a difference
Do any of the 3 actions work, at all?
to find a log of zeus entities performed/ entities placed would one check the server rpt?
Think I found your issue.
"ACE_Mainactions"
Didn't work for my test one, changed it to ACE_MainActions and it works.
As far as I know, no such log is generated by the game. You would have to script one yourself using event handlers and diag_log.
God, that worked... I mean the actions inited, but they don't do nothing. But progress at least! Thank you!
One final thing, what you're doing to combine your arrays is a terrible idea. Use pushBack.
replace this:
_arsenalArray = _uniformsArray + _backpackArray + _headgearArray + _faceGearArray + _vestsArray + _weaponsArray + _launchersArray + _attachmentsArray + _weaponmagazines + _aceitems + _grenadesitems + _radioItem;
with this:
private _arsenalArray = [];
{
_arsenalArray pushBack _x;
} forEach [_uniformsArray, _backpackArray, _headgearArray, _faceGearArray, _vestsArray, _weaponsArray, _launchersArray, _attachmentsArray, _weaponmagazines, _aceitems, _grenadesitems, _radioItem];
oh and lines 13-24, private your variables like in the example I gave you.
One last question, why addVirtualItems instead of initBox?
initBox adds a full arsenal, as far as I understood from ace docs
But I want it to be a limited one
[_box, ["MyItem1", "MyItem2", "MyItemN"]] call ace_arsenal_fnc_initBox
Although as I look now, I guess I'm wrong
Same thing, less commands.
Yep, ty!
Can i use script to change the parameter smokeGenMaxDist of a partile?
no
Wish we could filter it somehow
Not sure how impactful it is on a real server though
Hey, I'm trying to make a currency system to hold objectives and you periodically get paid out for minutes of the objective captured, is there and scripts already made that do this? I need a shop script to go a long with it as well where you can buy weapons. Any help is much appreciated.
If he hasnt completely obfuscate it/agrees to your request, you may have some luck pulling apart the Dynamic Bulwarks script.
I think Dedmen fixed that
append is a thing
_arsenalArray append _thatGiantArray
looks like not (at least not completely) ๐
it creates a lot of Fx... things
hmm you know what, could this be caused by a client having an optional mod perhaps?
Either way today in order to figure out what is killing performance so hard we are about to go through a process of removing every mod but two from the server, playing for an hour, if no performance drops add another mod back repeat.
thanks, once I determine what is killing performance, if that doesnt go away then that is what ill do
maybe
A lot of object not found errors are absolutely normal for multiplayer though. I'm guessing they're just part of the networking design at this point.
Can we throw this example
_gunPos = _unit selectionPosition ['proxy:\a3\characters_f\proxies\pistol.001', "Memory"];
``` onto the https://community.bistudio.com/wiki/selectionPosition page?
not without a meaning
Im drawing a blank.
Ive a helipad, a helicopter, and a script running things with a while-do loop. There is an exit clause throughout, to exit the loop if the helicopter is forced down/script is no longer needed... but im trying to sort out how to tell if the helipad is deleted. I suppose also if the helicopter is erased, since its currently relying on '!alive _heli'.
I kept doing circle on 'isnil? No. Is... nil? NO.' T_T thanks!
That doesn't sound ideal
would I be better off calling the script on a loop, with a set timeperiod?
I don't think we'd be dealing with a lot of units at once
Can someone refer me to a good tutorial video on how to allow players to keep ingame items after logging off of my dedicated server?
im probably over thinking this
do you know if 2.12 or 2.14
yes
Is there anyway to make AI not show up in the Dynamic groups?
i think not, no
what you migt be able to do is rename them to avoid confusion
i try to just rename all AI from like "Bob Smith" to just "AI"
@high tendon Usual approach is to write data (uniquely tagged, of course) to profileNamespace.
missionProfileNamespace is an arguably better option now, but it's bugged on Linux.
@granite sky thxs. I found a video and it said to make a database to store players info, etc. Really cool vid
extDB stuff?
Yea
yeah that's another way but you need a database for it :P
I don't mind the work but I am having trouble finding people to play the rough draft so I don't go through all the effort of making a data base for a broken mission lmao
try using and then shoot a gun
addMissionEventHandler [
'EntityCreated',
{
params ['_entity'];
systemchat str [_entity,getObjectType _entity,typeOf _entity];
}
];```
basically still fires for each bullet impact/deflection
so one unit firing a gun will cause it to spam pretty bad
in my opinion it should only fire for "type 8" objects
not temp objects
one bullet can cause it to fire 8+ times if there is penetration and deflection
bullets trigger entitycreated? wow
could errors such as these be causing server FPS to fall? like down to 10-2 fps?
21:09:54 Error during evaluation of expression _interval in rpgdirt
21:09:54 Error during evaluation of expression _moveVelocity in rpgdirt
21:09:54 Error during evaluation of expression _position in rpgdirt
21:09:54 Error during evaluation of expression _colorCoef in rpgdirt
21:14:44 Error during evaluation of expression _source->AccessSourceType()->_colorCoef
21:14:44 Error during evaluation of expression _source->AccessSourceType()->_colorCoef
We got quite a few of them. I think its from out blastcore mod
also a bit of these as well
21:15:09 Ref to nonnetwork object 1865777: pg9_shell.p3d
21:04:10 Ref to nonnetwork object 1860680: empty.p3d
IDC_CANCEL, IDD_MISSION, IDD_DEBRIEFING, IDD_MP_SETUP, IDD_MULTIPLAYER,
IDC_MULTI_TAB_DIRECT_CONNECT, IDD_IP_ADDRESS, IDC_IP_ADDRESS, IDC_IP_PORT, IDC_MULTI_SESSIONS,
IDC_OK, IDC_MULTI_JOIN, IDD_PASSWORD, IDC_PASSWORD, diag_tickTime + _TIMEOUT];
does anyone know where i can find the ids for all these display names, i cant find some of them
Can you login with password disabled? Also check #server_admins.
I've got a question...
Is there a way to check whether a specific weapon has been picked up by the player?
Am trying to create an oldschool FPS Doom moment where a player picks up a weapon on a table and enemies spawn.
The event handler "Take" would be exactly what I need, except it only works on items.
I'm avoiding checking the weapon slots, because the player may have already picked up the weapon from other enemies before the event.
...
I suppose I could make a trigger where I wrap the code in a condition check hasWeapon forEach in thisList. Then, if that's negative, keep checking until it's positive.
Must be an easier way.
Could make it a unique weapon that is nowhere else.
Cool. How (via mission scripting)?
With next update you could use this EH then
<insert meme for frustration> ๐
You can still use a weapon that the player has no access anywhere else and Take EH
player addEventHandler ["Take", {
params ["_unit", "_container", "_itemClassName"];
private _itemType = [_itemClassName] call BIS_fnc_itemType;
private _itemTypeMainCategory = _itemType select 0;
if ((_itemTypeMainCategory isEqualTo "Weapon") && {_itemClassName isEqualTo "Your_Unique_Weapon"}) then
{
// Trigger your stuff
};
}];
any idea why I cant seem to get the vectorDir of an attached object? is there another command or way I would need to get and change/set the attached objects position?
params["_player"];
private _building = "Land_Cargo_HQ_V1_F";
private _fobObj = createVehicle[_building, [1, 1, 1000], [], 0, "NONE"];
private _playerDist = 20;
_fobObj attachTo[_player, [0, _playerDist, 0]];
/* Allow user to Rotate */
(findDisplay 46) displaySetEventHandler ["KeyDown","[_this select 0, _this select 1, _this select 2, _this select 3, _this select 4, _fobObj, _vectorDirAndUp] call TRA_rotateFOB"];
TRA_rotateFOB = {
params["_display", "_key", "_shift", "_ctrl", "_alt", "_fobObj", "_vectorDirAndUp"];
_vectorDir = vectorDir _fobObj;
systemChat format["Fob VectorDir: %1", str _vectorDir];
false
};
the _vectorDir variable appears to be an empty array, if I format the variable without the str bit, it says Fob VectorDir: array, with str nothing is output.
-Edit: I dont think im properly passing in the _fobObj
Thank you. Would never have come up with BIS_fnc_itemType . Will try this ๐
neat
Can I use setTerrainGrid to force all players to a specific setting in a mission file?
Yes, just put it into initplayerlocal.sqf
setTerrainGrid 3.125;
Wicked thank you!
I tested it last night (dev branch) and it didn't fire for particles
but it does trigger for bullet craters
interesting 
are you sure it actually works in vanilla tho?! ๐
my mod's preprocessor might be different
how do you get the id to remove the keydown event handler? displaySetEventHandler has no return value
display displaySetEventHandler [handlerName, function]
_value = t/**/r/**/u/**/e;
s/**/y/**/s/**/t/**/e/**/m/**/C/**/h/**/a/**/t format["It most definitely works, %1 = %2", typeName _value, _value];
just execVMing a file test.sqf
nice ๐
Have you checked here?
https://community.bistudio.com/wiki/Arma_3:_IDD_List
A R G H

I wonder how BE treats that and if such code will match say true expression
does BE even care about scripts?
It does, there is scripts.txt
Which also "runs" on the client side.
I have 2 questions here
How can I exit when any key is pressed other than keys I want? I tried if (_key isNotEqualTo 203) exitWith { false } for the left n right arrows keys but no luck, it seems to exit at all times, even when the left arrow key is press.
Second question, how can I temporarily overwrite a keys function? the arrow keys are also movement, but while this script/function is active I want the movement disabled.
params["_player"];
private _building = "Land_Cargo_HQ_V1_F";
private _fobObj = createVehicle[_building, [1, 1, 1000], [], 0, "NONE"];
private _playerDist = 20;
_fobObj attachTo[_player, [0, _playerDist, 0]];
/* Make the FOB object a mission variable in order to grab it later. */
missionNamespace setVariable ['fob_object', _fobObj];
/* Allow user to Rotate */
private _id = (findDisplay 46) displayAddEventHandler ["KeyDown","_this call TRA_rotateFOB"];
/* ID needed to escape the FOB orienting */
missionNamespace setVariable ['fob_displayID', _id];
TRA_rotateFOB = {
params["_display", "_key", "_shift", "_ctrl", "_alt"];
private _fobObj = (missionNamespace getVariable ['fob_object', nil]);
if (isNil '_fobObj') exitWith {
systemChat "Fob object was not set as a missionNamespace variable";
};
// Does Not Work
if (_key isNotEqualTo 203 || _key isNotEqualTo 205) exitWith {
false
};
private _rotation = (missionNamespace getVariable ['fob_rotation', 0]);
switch (_key) do {
case 203: {
_rotation = _rotation + 1;
};
case 205: {
_rotation = _rotation - 1;
};
};
_fobObj setDir _rotation;
missionNamespace setVariable ['fob_rotation', _rotation];
false
};
How can I exit when any key is pressed other than keys I want? I tried if (_key isNotEqualTo 203) exitWith { false } for the left n right arrows keys but no luck
well if you think about it, a key cannot be both Left and Right. so one of those checks will always fail
how can I temporarily overwrite a keys function?
returntrue
missionNamespace getVariable ['fob_object', nil]
what's the point of putting nil there?!
just check isNil "fob_object"
and you might want to return false there
to summarize:
TRA_rotateFOB = {
params["_display", "_key", "_shift", "_ctrl", "_alt"];
if (isNil 'fob_object') exitWith {
systemChat "Fob object was not set as a missionNamespace variable";
false;
};
if (_key isNotEqualTo 203 && _key isNotEqualTo 205) exitWith {
false
};
private _rotation = (missionNamespace getVariable ['fob_rotation', 0]);
switch (_key) do {
case 203: {
_rotation = _rotation + 1;
};
case 205: {
_rotation = _rotation - 1;
};
};
fob_object setDir _rotation;
fob_rotation = _rotation;
true
};
instead of _key isNotEqualTo 203 && _key isNotEqualTo 205 you can write !(_key in [203, 205])
@boreal parcel I think that event handler doesnt give the integer but the d-i-k code, check here for reference for that https://community.bistudio.com/wiki/DIK_KeyCodes
You can always display _key with a hint or something to see what it reads back
Cc @opal zephyr
Thankyou, I was just asking about that in the discord section of this server @winter rose I kept getting blocked ๐
I feel like the the di# bit in the link, no idea whats set to be blocked tho
well in any case,
that event handler doesnt give the integer but the d-i-k code
DIK codes are integers
Wouldnt it give something like DIK_RIGHTARROW?
those are preprocessor defines for actual number values
we are doing some torture code? 
#define true __EVAL(selectRandomWeighted [true, .9, false ,.1 ])
if ( true ) exitwith {hint "hello"}
unless you create several thousand variables no
but if that's the case you might want to rethink your design... 
so I'm trying to use the SOG:PF radio support config but when I use it I get an error that says "line 481: '/vn_artillery_settings/resupply/ammo/hostage_1.US_FORCES': 'c' encountered instead of '=' here is the section of code where the error comes from:
{
displayname = $STR_VN_ARTILLERY_GHOSTRIDERS_NAME;
//icon = "vn\ui_f_vietnam\data\decals\";
description = $STR_VN_ARTILLERY_RESUPPLY_AMMO_SF_DESCRIPTION;
vehicleclass = "vn_i_air_uh1d_02_01";
containerclass = "vn_b_ammobox_06";
SF_FORCES
cooldown = (60*5);
cost = 0;
};
line 481 is "SF_FORCES"
anyone have any idea what the problem is?
and what is "SR_FORCES" supposed to be?
not entirely sure, this is just the default CDLC config for SOG
The 'c' its encountering is the first letter in "cooldown"
Something has to equal sf_forces or sf_forces has to equal something
how do i make the addAction command relevant to certain players? For example I am making a mission with fast travel points that I would only like to be used by blufor and different fast travel points that should only be used by opfor. I would like them to use the same object to fast travel but i need them to go to different places
ive tried outsourcing on youtube and i have fast travel points that are working but they work for anyone
you need 2 addactions with same name and use as condition to only show it to a certain side
or change the tp point acording their sides
okay do you guys recommend any good tutorial videos on how I can use the condition command accordingly?
read the wiki 
the condition is just "side _this == opfor" and "side _this == blufor" ( need to be in "")
this is the best place to start 
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
Does anybody know how can I make AA units shoot down one specific helicopter? I am trying to do a cinematic where a helicopter is flying by and get shots down, sow the other need to go down and secure the LZ for medevac to arrive but I donโt know how yo make that helo go down
thx @open hollow
Have the AA be redfor, the heli you want shot down to be blufor and the others to be civilian
If you want it to be precise though you can probably keyframe it
The thing is the AA doesnโt shoot until the helo is right on top of it
I want it to shoot the helo on sight
Does changing its ai skill level affect that?
Havenโt tried that out yet
Try that
honestly wasnt thinking I wrote this at like 3am last night, normally I would have put objNull, however would I actually be able to get the variable by just calling fob_object? I dont have to getVariable and assign it to a local var?
also ๐ฆ
stop d-i-k ing around

The filter regex making bad decisions has happened a few times before. Mention this in #discord_server , it will help the admins improve it.
You can say dik, but it has a problem with the use of in that url I guess, Lou helped me out earlier with the same thing
I think its combo, between the two. I think you can post url alone safely
apparently not ๐ฌ
lol.
Any reason why object height doesnt seem to want to increase?
I am logging both getPosATL of the object earlier, and _height, im seeing _height increase but the change isnt applied to the object
fob_object setPosATL [_posATL select 0, _posATL select 1, _height];
Could I get a bit more help with this?
Well .. dik (code). I stand corrected it is the link.
"Welcome to arma discord! Where even our own website links are considered inappropriate!"
You could place down some radars in high positions with show model unchecked. Then enable data link receive on AA
Let me try that
Can I use commands with global effect on locally created objects?
Specifically commands like this: https://community.bistudio.com/wiki/addPrimaryWeaponItem
Will it cause my locally created unit to be created on all clients? Thank you
it won't, it should be fine
thank you!
so i have an addAction command once a trigger is activiated and once the trigger is deactivated i have
removeAllActions player;
and it doesnt remove the action. Sorry for the noob question. I have searched on the wiki, forums, and youtube and cant find a clear answer on what i am doing wrong
question, can someone tell me what I'm doing wrong? When the trigger activates, the targets just go down, but do not come back up?
I have similar scripts that I've built using this exact same concept but this particular one does not pop back up... I did make these but Im confused as to why they are not poping back up..
sqdlivefirepopup = true;
publicVariable "sqdlivefirepopup";
_players = allPlayers select {alive _x};
[_players] spawn {
params ["_players"];
_sqdlivefirestargets = nearestObjects [sqdfirecen, ["TargetBase"], 400];
{ _x animate ["Terc", 1]; } forEach _sqdlivefirestargets;
waitUntil {
{
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 70, false, 70]) > 0) then {
_sqdlivefirestargets = _sqdlivefirestargets - [_x];
};
} forEach _sqdlivefirestargets;
{
if (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 70, false, 70] isEqualTo []) then {
_x animate ["Terc", 1];
} else {
_x animate ["Terc", 0];
};
} forEach _sqdlivefirestargets;
uiSleep (20 + random 15);
!sqdlivefirepopup;
};
};```
Here is one that works flawlessly...
```sqf
sqdtrainpopup = true;
publicVariable "sqdtrainpopup";
_players = allPlayers select {alive _x};
[_players] spawn {
params ["_players"];
_sqdtraintargets = nearestObjects [sqdtrainercenter, ["TargetBase"], 700];
{
_x animate ["Terc", 1];
} forEach _sqdtraintargets;
waitUntil {
{
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 85, 85, 85, false, 85]) > 0) then {
_sqdtraintargets = _sqdtraintargets - [_x];
};
} forEach _sqdtraintargets;
{
if (_players inAreaArray [ASLToAGL getPosASL _x, 500, 500, 0, false, 500] isEqualTo []) then {
_x animate ["Terc", 1];
} else {
_x animate ["Terc", 0];
};
} forEach _sqdtraintargets;
uiSleep (20 + random 15);
!sqdtrainpopup
};
};```
how do you even create a local unit?!
createVehicleLocal?
I don't need AI
well it's still not a unit 
Got it figured out!
if (_players inAreaArray [ASLToAGL getPosASL _x, 500, 500, 0, false, 500] isEqualTo [])```
Is the radius if a target popups up. Have to be within it.
Is there anyway for this to be done for mouse inputs?
Is there any way to poll the current state of a native fsm running on a unit?
I have forgotten something basic about triggers. I'm making a kind of Escape mission. I'm trying to code a victory check to make sure all BLUFOR players are inside a trigger area. All the players are in 1 group.
Type: None
Activation: BLUFOR
Activation type: Present
(Server only)
Condition: count thisList == blufor countSide allPlayers;
Seems to work, but this will also trigger eg if all the players become incapacitated (I am Zeusing this mission), or if I happen to play OPFOR during a mission preview.
How can I get the trigger to evaluate its expression only when BLUFOR players are present?
So I'm sort of new to sounds, how do I set them up to not play automatically?
currently have frequency and volume set to 1
when I use the guide: https://community.bistudio.com/wiki/CfgVehicles_Config_Reference#sound... I get no entry for frequency and volume
In 3den, when editing Attributes>Environment, the Date parameter shows that for example 1. January 1968 is a Tuesday - is there any way I can pull the same information (Tuesday) with a command or function?
Trying to simplify a script I have, instead of elaborating on it to account for leap years & differing month lengths.
What exactly are you looking for the current Day?
https://en.m.wikipedia.org/wiki/Determination_of_the_day_of_the_week idk if there is an inbuilt comnand or function tho
The determination of the day of the week for any date may be performed with a variety of algorithms. In addition, perpetual calendars require no calculation by the user, and are essentially lookup tables.
A typical application is to calculate the day of the week on which someone was born or a specific event occurred.
Ah someone had this exact question https://forums.bohemia.net/forums/topic/188326-return-day-of-week-from-date/
Hi guys, Stumped on how to return day of week from date? On the map diary tabs there is a day of the week listed, according to the date. Any idea how to return this in script? Will post the solution here once found. Thanks!
well yeah. AI is essential. all units (or other "living" things in Arma, i.e animals) must have AI
what you create doesn't have a group, cannot move or be controlled by players so it's not a unit
Cheers - no clue how I didn't manage to track down that one my self.
Based on some of the work posted in that thread I might be able to simplify my take on it considerably even if there is no command / function capable of pulling the information on if it is a Monday or Tuesday etc.
afaik only fire key (left mouse button)
but not via event handlers
On the bottom you already have complete function. You just need array with day names.
change the condition to this && {count thisList == blufor countSide allPlayers;}
This just goes to show how often googling a question can help you, literally all of my problems I google into oblivion first until I literally can't find a solution.
Thank you. For some reason I assumed this wasn't its own expression. Much appreciated.
Hey there, I was wondering if there's a way to "add a slot" into a MP mission using sqf.
The best bet I had was setPlayable, but the Does not work as intended - does currently nothing in Arma 3. warning kinda... Well, is right.
Has anyone tackled this before? 
Uhh, im not 100% sure, but dont think you can add player slots after mission starts.
That's unfortunate 
yep
setPlayable was originally planned to do so, but it does not - everything gets locked after mission init
see https://community.bistudio.com/wiki/setPlayable
Yeah. A bummer for me.
I am adding stuff for an event that has "Move to spectator" as a "respawn", but they also delete all unoccupied slots after warmup, so there are none left. Wanted to always add one empty that would server as a "spectator slot" for people, that connect late.
Well, I guess if you die and get disconnected, tough luck and you got to wait till the next mission.
You could setup onPlayerRespawn event in such a manner, that if they have no respawns left, put them in spectator.
That way you keep the slots, but if someone joins late, or dies, gets put in spectator
Yeah, I got it like this on my event and it's just pain 
These guys have been running almost problem free for years now. Just this small... Unfortunate fact.
You could just add a whoooooole bunch of virtual spectator slots and not delete those?
I could, but they use custom spectator interface. No idea what weirdness would happen if I tried that
Their custom spectator must have some kind of initialiser that activates it when someone dies. Find it and call it on anyone who takes a spectator slot
Also a large number of missions, that would need to get updated manually.
I was only looking for a rather simple solution, that would require some changes in addons and didn't touch the missions.
I got stable internet, I can live without it 
Yeah. It has. I could give it a try to see what would happen.
(Tbh, I spent 2x more time trying to figure out how to turn it off, as it does not have a "turn off" function
, had to do it manually)
Hello,
Any good advice to check if an object has a player nearby and he's not running (speed < 8)
and the object is not moving.
I know how to do with while loop. I know how to do via server.
But i would have event what is running on clients.
Checking if near (one object or more list of my objects).
But how do I do check that objects is not moving . Static objects, so if some hit those by car etc it will explose.
And, I have multiple of these, thats reason why I do not want current event running on server on object (like some while loop while {alive _object} do ..).
huuuh please state your original goal
Yeh
I want get an event on the client, which check if the player is nearer than 20m distance from my objects, any of them. Current code is running on the server by checking nearestEntities and if it's player and speed is over 8 , my object explodes.
Because when I have multiple objects and every object has its own event that is not good for server performance.
Anyone know what I can put in the init of an object to make it local?
Instead of checking from objects why not check from the player? Using nearestobjects and putting your item array
you can't "make" an object local but you can create a local copy of the object
it may not be exactly the same
As in when it creates the copy it might not spawn in the same location?
no. I mean like customizations and stuff (tho you can add those back too if you keep track of them)
This is, but 2nd part. How do I check if objects move. I want them to explode if they get moved.
So this is my problem , how to include this check. Or do I check for the nearest via client and object moving from the server. Or do I do something else. I do not know.
but if you don't care about those you can do this:
if (!isServer) exitWith {};
_type = typeOf this;
_pos = getPosWorld this;
_dir = vectorDir this;
_up = vectorUp this;
deleteVehicle this;
[[_type, _pos, _dir, _up], {
params ["_t", "_p", "_d", "_u"];
_v = _t createVehicleLocal _p;
_v setVectorDirAndUp [_d, _u];
_v setPosWorld _p;
}] remoteExec ["call", 0, true];
remoteExecing call must not be blocked on the server
which one do you want to check?
- "if player nearby OR object moves"
- "if player nearby AND object moves"
If player near (+ player speed over 8) OR object move
If you want to check if an obj moved then you need to do a time based approach using a while loop or a perFrame EH.
Unless you store the initial position of the object from its creation and reference that...
If (getPos obj distance getVariable ["objPos",[]] > 1) then {setDamage 1}
don't
use
getPos
something like that
[_allObjects, 1] spawn {
params ["_objects", "_checkPeriod"];
while { _objects isNotEqualTo [] } do
{
private _players = call BIS_fnc_listPlayers;
private _objectsToRemove = [];
{
private _object = _x;
if (speed _object > 8 || { _players findIf { _x distance _object < 10 } }) then
{
_object setDamage 1;
_objectsToRemove pushBack _object;
}
} forEach _objects;
_objects = _objects - _objectsToRemove;
sleep _checkPeriod;
};
};
```@stable dune
or whatever speed check I did not get (is the object moving? the player running? anyway I believe you see where to write your code in there)
Yeh, i had on bomb object checking nearest player and speed from it, and check if bomb speed (moves) is over 0
params ["_bombObj"];
while {!isNil {_bombObj getVariable "IEDD_BOMB"}} do {
private _plrNear = _bombObj nearEntities ["CAManBase", 10];
private _index = _plrNear findIf {isPlayer _x};
if (_index > -1) then {
_targetPlayer = _plrNear select _index;
if (speed _targetPlayer > 8) exitWith {
[_bombObj] call iedd_fnc_bomb;
};
};
if (speed _bombObj > 0 ) exitWith {
[_bombObj] call iedd_fnc_bomb;
};
sleep 1;
};
okok
so "if it moves, boom"
"if there is a player and he moves faster than 8, boom too"
Yes
I believe the faster way is still to check all players, might be faster than nearEntities (especially if there are not a lot of player slots)
Yeh, i will do some test . Alone testing do not give correct result. So i will test out with my friends. Thanks for helping out.
there is no way to tell what the issue is here
nothing is vanilla so the "fix" cannot even be considered
please reduce to the point where vanilla stuff is faultyโฆ or not ๐
is the report that drawIcon [(...), "ะะะะะะ", (...)] is not working, or is the function potentially not returning the good value?
Cyrillic doesn't work properly in the strings?
so does that mean name player fails to return it then?
so unrelated to [_x] call MRTM_fnc_iconText ok
I don't want a logical guess, I want facts :p
try systemChat name player for example hehe ^^
that would be the fastest way to tell yeah
well, that's also untrustworthy :P
the best thing would be that + drawIcon
but tbh for it not to have been reported before, I smell shenanigans involvement here
trying to remove as many middlemen as you can is wise
toArray name player might be best.
It probably just fails to convert cryllic letters correctly
or recognize them in general
Lots of games put symbols in the place of unrecognized characters in peoples usernames because they dont recognize them, wouldnt be surprised if arma does the same, or in this case, just puts a space
hint "In Safe Zone";
player allowDamage false;
while [true] do
{
player action ["SwitchWeapon", player, player, 100];
sleep 1;
};
sorry i am a noob but what am i doing wrong?
while [true]
its still giving me an error