#arma3_scripting
1 messages ยท Page 90 of 1
i have try spawn but he don't work
errors on?
no
Yes when i have error with script i see error on my screen and in my log arma 3
well post the log message?
Sorry for my late response
code : ```sqf
diag_log "Lacenement John mods";
connectToServer ["37.187.92.41", 2302, "John <3"];
[] spawn {
hint "test";
};```
Log : 19:30:29 "Lacenement John mods" 19:30:29 [CBA] (xeh) INFO: [0,56.658,0] PreStart started. 19:30:29 [ACE] (medical) INFO: Checking uniforms for correct medical hitpoints [681 units] ...
spawn doesn't create a loop. It just creates a new thread that can run separately from the current thread (compare call, which runs the called code in the current thread, so the thread can't continue until it's finished).
That hint is just going to happen at the moment the script runs, which is almost certainly before the game can display hints. (I assume you're using preStart, not preInit - preInit is for mission start, preStart is for game start.)
Evenin' fellas,
Been puzzled with this one for a while, does anyone have a method for converting the output from getItemCargo - ie [["item","item2","item3"], [qty1,qty2,qty3]]
to the format required for addItemCargoGlobal - ie
_container addItemCargoGlobal ["item2",qty2];
_container addItemCargoGlobal ["item3",qty3];```
I know there's likely a way around the data manipulation, potentially using a hashmap but I'm strugglin'.
For context, the end goal is having a vehicle's inventory saved to variables, and then applied to another vehicle, probably replicating it for `item`, `weapon`, `magazine` and `backpack`.
_items = getItemCargo _container;
_array =[];
{
_array pushback [_x, (_item#1)#_foreachindex]
}foreach (_items#0);
_array;
?
_items or _itemArray, pick one :P
Both, both are good.
yeah, pushback would work.
Fixed, pardon me I'm in the gym
oh christ he's in the gym and solving my shit - why did I not think of that
pushback should work nicely, thanks dude
{
_container addItemCargoGlobal _x;
} foreach _array;
fuck it's so simple
I suggest changing the local variables names into something more comprehensible than what I typed
yes I've got some local var names already, thanks man
i need to add to a vector but depending where im located in the world should be the X offset or Y how can i check this?
Good evening all I am just now getting into the arma scripting seen and I am confused on how to set a trigger to spawn a civ truck then have it drive to a location.
Well can you give an example?
In case you still have issues:
Open the editor, place the kind of truck you want. Right click on it, and in the context menu select Log > Classes. Past the string into a notepad.
Then, read this: https://community.bistudio.com/wiki/createVehicle
Plug the class of the truck you want in where appropriate, and tinker around with it.
So I built this function that is intended to guide missiles to its target:
SFSM_fnc_setDirAndPitchToPos = {
params["_object", "_targetPosASL"];
private _targetDir = _object getDir _targetPosASL;
private _distance = _object distance2D _targetPosASL;
private _objectHeight = (getPosASLVisual _object)#2;
private _targetHeight = _targetPosASL#2;
private _heightDiff = _targetHeight - _objectHeight;
private _low = _heightDiff < 0;
private _pitch = [_heightDiff, _distance] getDir [0,0];
_pitch = round((_pitch + 180) % 180);
if(_low)then{_pitch = 0-(180 - _pitch);};
_object setDir _targetDir;
[_object, _pitch, 0] call BIS_fnc_setPitchBank;
};
As someone who almost failed math I am guessing there is a lot wrong with this function, however it works.
I guess some of the geniouses here will be able to do this in fewer lines and even better.
Please roast me guys!
how do i figure out whats wron if everything works and i have an error zero divisor ?
Zero divisor is an error tha occurs if you are trying to select an item from an array that is out of range.
It also occurs if you are trying to divide something with zero:
Out of range error:
_myArray = ["a", "b", "c"];
_myLetter = _myArray select 4;
Division error:
_myResult = 3 / 0;
since there is no division in the function, it must be the access problem ... but i cant find it
zero divisor isnt only for dividing by zero, some errors produce the same message
sqfbin the function
other errors like the one they started their message by mentioning? ๐ค
i dont understant that order ...
https://sqfbin.com < insert sqf, provide link
and of course ... everything works, the amount and size update correctly ...
on the change ...
Make sure all the variable names are spelled correctly and actually contain real data. If any of them are wrong or empty when the function is called, they will default to an empty array ([]) and attempting to select anything in that will cause an error
*the global variables you're retrieving with getVariable, I mean
Try adding e.g. systemChat format ["displayData: %1", str _displayData]; in relevant places so you can see exactly what your variables contain
ty good idea !
result : i used lbsetcursel, that triggerded the onLBSelChangrd, but that that point i didnt save the data, so at the first trigger, there was no data
How would I be able to have light cones be visible during daytime? Not sure if thats just me but it seems like at daytime they're just fully invisible until a certain time has passed
Not possible, arma lighting engine issue
I've used some modded emergency vehicles that still had visible like "lens flare" or whatever you call it during daytime
so it may be?
So I have this bit of code that checks to see playerSide, however i would like the the argument to be either west or east.
Im not exactly sure how the syntax should be... i tried doing with () and {} playerSide isEqualTo west || playerSide isEqualTo east but that doesnt seem to work
if (playerSide isEqualTo west && {player getVariable ["isEscorting",false]}) exitWith {
[] call life_fnc_copInteractionMenu;
};
remove the first pair of brackets on that.
sorry could you write out what you mean?
Is there any way to execute code on the client (mod or otherwise) when they connect to a multiplayer server and are just in the lobby
- I want to ctrlActivate the okay button for them to get them loading into the game automatically
if ((playerSide isEqualTo west || playerSide isEqualTo east) && {player getVariable ["isEscorting",false]}) exitWith {
call life_fnc_copInteractionMenu;
};
Just check 1st in ( ) side with ||, if you don't use ( ) , code will check 1st check before || is that true , or rest of code after || true.
Or did you mean you already tested this ?
just disable the lobby in the description.ext
skipLobby = 1;
that would be smart
i put this in, it didnt work for the east side but still works for the west
so i guess the syntax is correct but my problem lies elsewhere
thats a dynamic light iirc
no light itself is visible
How did you test it?
So your life_fnc doesn't work properly?
What do you have in there?
i found the problem
that statement i posted... it does it later in the script too

Question; I'm looking for a way to check if a config entry is empty (but most likely set).
For example:
_backpacks = [configFile >> "CfgVehicles"] call BIS_fnc_returnChildren;
{
_configName = configName _x;
_parents = [_x, true] call BIS_fnc_returnParents;
if (
"Bag_Base" in _parents
&& _configName != "Bag_Base"
// this line is always FALSE, because both entries always exist (part of 'Bag_Base')
// however I want this to return TRUE when it has no items inside them
&& !(
isClass (configFile >> "CfgVehicles" >> _configName >> "TransportMagazines")
|| isClass (configFile >> "CfgVehicles" >> _configName >> "TransportItems")
)
) then {
// I'm a backpack, do something
};
} foreach _backpacks;
So isClass (configFile >> "CfgVehicles" >> _configName >> "TransportItems") is always TRUE, even when it's empty (no items in the backpack).
I could try to check based on scope = 2, but that slightly messes up the rest of the code I'm using (in very specific cases).
getArray (..) isEqualTo [] ?
it's not an array, but a class with class entries
configClasses ..... isEqualTo [] ? ๐ฌ
I think counting is better over isEqualTo'ing
Both the same, isEqualTo is just faster
Perhaps something like
count("true" configClasses (configFile >> "CfgVehicles" >> _configName >> "TransportMagazines")) > 0
๐ค
Lights can be enabled in daytime with setLightDayLight. You need to bump up the brightness to make them properly visible; I think the game automatically adds 3000 brightness during day but you may need more depending on conditions.
*you can't change config lights (i.e. on vehicles) to do this without a mod - the script command only works on scripted lights
tf, never seen any lighting during the daytime
only the soruces
You can have lightings in daytime. Cluster from Orange does it
what from what
Bomb from LoW
RGB values in Arma are (r, g, b) โ [0, 1]ยณ, not (r, g, b) โ [0, 255]ยณ.
depends what ur working with, can be hex too sometimes
[_x, target1, "", 100, 2, 5] spawn BIS_fnc_fireSupport;
} foreach thingsarty
``` this works... however shows error code... what am i doing wrong then?? Im confused... https://community.bistudio.com/wiki/BIS_fnc_fireSupport
What is the error code that it shows?
Also, that nearestObjects searches for all types of objects near the specified position, which can include map objects, random units, literally anything and not just things that BIS_fnc_fireSupport actually works on.
the SQF may have imprecise loops (e.g 60.1s, etc), the FSM may eat (slightly) more CPU by checking every frame
if you don't absolutely and tremendously need precision, go SQF ๐
depending what kind of iterating you need to do...
i.e. consider finite state machine or what not...
cannot recommend CBA state machines enough...
plus if you do not mind the class configuration, I find it is very self-documenting.
I have anywhere from 2-3 of them running at a given time and they seem to be reasonably good performers AFAIK...
if I understand the CBA architecture, interleaved on the same state machine worker for FSM purposes.
Where would I put a new hud into place? Like, with 3den I listen to the on terrain new event handler, but how would I do that for in game? OnPlayerConnected?
Basically, I think I was an addon version of initLocalPlayer x3
probably being an idiot and it's just "Bro, just use x?"
postinit probs
Q: about everyContainer containers... assuming they are stored in the crate/vehicle, default assumption...
is it possible to add/remove items from the container object while it is in the inventory?
how does available space/capacity roll up, accordingly?
is it possible to gauge space/capacity leading up to the adding of an item?
thanks...
that would call everytime an object is placed, no?
wiki thingy
ok, now what do I check for x3
I guess I could do a while for the display not being a null display?
yes
oh, wait, how do I do it- is it just put a file named XEH_preInit.sqf into the addon folder or
add cpp class Extended_PreInit_EventHandlers { class My_pre_init_event { init = "call compile preprocessFileLineNumbers 'XEH_preInit.sqf'"; }; }; into your mod's config and replace the class and init code accordingly
no need to change init code if you have XEH_preInit.sqf though, sure
that's straight out of cba github, whoops
Ok, lets try now. I think I made it not work by making preinit check if it was server, if yes, then it exited.
buut, if your single player, then it will always be server, so I'ma have it check for interface instead
can- can I not do a spawn inside of the preinit?
maybe it's pre init trying to mess with displays, maybe that's messing something up.
I put a log for "thump thump..." then below that is the spawn so x3
Oh nooooooo, I see what I did I think
if(_rsc==displayNull)then{
head desk
the following line will make the rsc if it doesn't exist.
oh no, I also am not resetting the display to be _rsc
#include "\Ingame_Sys_Time\defines.hpp"
"Thump thump..." call BIS_fnc_log;
[]spawn{
"Beginning inGame Interface Time Loop" call BIS_fnc_log;
private _rsc = uiNamespace getVariable ["RCHT_RSC_IngameTime", displayNull];
if(_rsc isEqualTo displayNull)then{
"RscRCHTIngameTime_layer" cutRsc ["RscRCHTIngameTime", "PLAIN"];
_rsc = uiNamespace getVariable ["RCHT_RSC_IngameTime", displayNull];
};
private _ctrl = _rsc displayCtrl IDC_RATCHET_MENU_SYSTEMTIME;
_ctrl ctrlSetText"00:00:00 __ ";
_ctrl ctrlSetPositionW (ctrlTextWidth _ctrl)+0.01;
_ctrl ctrlSetPositionX (0.5 - ((ctrlTextWidth _ctrl)/2));
_ctrl ctrlCommit 0;
while {!(_rsc isEqualTo displayNull)} do
{
[_ctrl] call RATCHET_SYS_TIME_fnc_updateTimeCtrl;
uiSleep 1;
};
"inGame Time Loop Stopped" call BIS_fnc_log;
};
Am I missing anything else? xD
ok, it isn't updating and the position is still 0,0,0,0 apparently.
but I have plans so I have to return to this later
If the position is [0,0,0,0] you may have other problems because positions traditionally have only 3 elements
position for ctrl is XYWH
Question about pulling from hashmaps.
_pooch = createHashMapFromArray [
["Sheperd",["German Sheperd","Woof","Pet"]],
["Poodle",["Poodle","Yip","Kick"]]
];
_dog = _pooch get "Sheperd";
diag_log format["Result: %1",_dog];
11:52:03 "Result: [""German Sheperd"",""Woof"",""Pet""]"
_dogSaysWhat = _dog select 2;
diag_log format["What's that boy? Jimmy fell into a well?! %1!",_dogSayWhat];
11:52:03 "What's that boy? Jimmy fell into a well?! any!"
The variable _result doesn't work here because the returned value is in double quotes. ""Woof"".
However,
_dog = _pooch get "Poodle";
_reaction = (_pooch get "Poodle") select 2;
diag_log format["Oh no, it's a %1! %2!",_dog select 0, _reaction];
11:52:03 "Oh no, it's a Poodle! Kick!"
Does because _reaction has it's key specified without using a variable.
How do you either create the array so that double quotes aren't returned, of query the array with variables and avoid them?
That's not... its not.. thats...
@grand idol
The variable _result doesn't work here because the returned value is in double quotes. ""Woof"".
No. The second diag_log doesn't work because you got the var name wrong.
Also wrong select number :P
It has double quotes, because the diag_log adds quotes
the value itself does not have double quotes
_dogSaysWhat vs _dogSayWhat
The variable _result doesn't work here because the returned value is in double quotes. ""Woof"".
I don't get this. There is no variable _result, also why is ""Woof"" the problem, when you're selecting ""Pet"" ?
I edited the variable text _dogSaysWhat while posting. when I ran it, they matched.
Change the second part to this and it'll work:
_dogSaysWhat = _dog select 1;
diag_log format["What's that boy? Jimmy fell into a well?! %1!",_dogSaysWhat];
Gonna guess that you split the code across different debug console runs or something and _dog no longer existed then.
Yesh, I had a typo. Console output now works:
12:12:03 "Result [""German Sheperd"",""Woof"",""Pet""]"
12:12:03 "What's that, Jimmy fell into a well? Woof!"
12:12:03 "Oh no, it's a Poodle! Kick!"
I'm troubleshooting something on a much larger script and thought that the "" "" was causing a variable to not populate correctly.
And for the record, I would never condone hurting any dog. But I've met many poodle owners that could use a kick or two.
Is there a way to use a script to trigger someone to spawn (like them clicking the spawn button after dying)
forceRespawn
that's for devs to analyse
feedback tracker, make a ticket w/ mission file + dumps + everything you can provide
Is there a nice way to stop default mortar AI behaviour but still allow them to fire in my scripted version of it?
maybe disable AI
Are there any easy to use pre-made shop and money system scripts out there?
That's the opposite of what I want when reading the docs and testing that ingame that will kill the player and put them on the respawn screen.
I want to take them from the respawn screen ingame to playing ingame via scripts (not description.ext changes)
is the player already initialized?
also give more of a wholistic idea of what you want to create for better understanding
It's fine I found what I needed in RscRespawnControl.sqf
Greetings!
I am creating a multiplayer scenario and i can only test things myself. I don't have other players who could join to test with me. When more players are available, it's too late for me to test and fix possible issues so i need everything, to be perfect. And i just came to a possible issue so i would like to ask you, if it's going to cause any problems or not. Sometimes i need to use remoteExec for scripts like hideObjectGlobal or similar. For "targets" parameter in remoteExec i've been using number 2 (from the wiki: the order will only be executed on the server). I tested everything and it all works. But is it going to work with more players? Can i keep number 2 in there or should i change it to number 0 (on the server and every connected client, including the machine where remoteExec originated) ? What's the practical difference between these two?
this is all relative. usually you dont have to use 2 because unless you are getting into more advanced stuff, you don't need to be telling the server to do something from a client. usually the server tells the clients what to do. it depends on your script
also, if you turn off battleeye, you can start multiple clients of the game by hitting the launcher's play button. then join your hosted mission (created in the editor - preview multiplayer) then join with the extra clients
here's an example: [benzyna1, false] remoteExec ["hideObjectGlobal", 2]; does it matter if there's 0 or 2 or is it going to work either way?
hideObjectGlobal is a server only command. it has to be run from the server, so 2.
but 0 is also a server (+clients) am i right?
so for stuff like hideObjectGlobal all i need is execution on the server and therefore 0 and 2 are both going to work equally fine?
No, hideObjectGlobal must be executed only on the server
some server exec commands are OK to be executed "server and other places too", but hideObjectGlobal is very specific
hm... so using 0 in this case is wrong? if so, why? i've been using 0 in the past for this and i saw no issues
Because it doesn't work if you don't only execute it on the server
That command specifically, is server only
fair enough, but what about this then? ```sqf
this addAction ["Secondary lights OFF",
{
_caller = _this select 1;
[
_caller,
{
yellow1 hideObjectGlobal true;
yellow2 hideObjectGlobal true;
yellow3 hideObjectGlobal true;
yellow4 hideObjectGlobal true;
yellow5 hideObjectGlobal true;
yellow6 hideObjectGlobal true;
}
] remoteExec ["spawn", 0];
}];
don't spawn huge amounts of code like that over the network
make a local function and remote exec that function
*it's OK to spawn large code locally, it's when you use spawn to send large amounts of code over the network with remoteExec that's a problem
yeah that's what i meant
fair enough, but you said 0 won't work and here is a script with 0 that does work, so is there some kind of a loophole i'm missing?
it will work when it is sent to 2 in the list of clients from 0, it won't work when it hits a client, and it may mess things up with many more clients, best to keep to what it is made for
i'm just trying to understand it
we don't get to see the under the hood code for internal commands, so best to stick with the documentation
Perhaps it's not 100% consistent. A lot of things in Arma aren't. However, I can tell you that it has happened to me that with hideObjectGlobal, 0 outright does not work and 2 does, with no other changes. So I would really, really, not use 0. There is no reason to use 0 when only 2 is needed, anyway; even if it works in this particular case, that's extra traffic that's not necessary.
this is the list of all server only commands
https://community.bistudio.com/wiki/Category:Scripting_Commands:_Server_Execution
allright so to sum it up, it's the best to use 2. 0 may also work but it's best to avoid it, am i right?
use 2, otherwise you are playing with fire
understood, one more question, when i write a sript, then run a dedicated server, join it and test the script - if i see it working, will it also work with more players on the server?
yes, but you also have to keep in mind JIP to test for
also do you mean test from debug?
cause if so, then you have to make sure you run the script WHERE you want it to originate (use ADT mod)
what is JIP ? I mean JIP is a chain of grocery stores here but i bet that's not what you meant.
when i write the script, i put it to the mission and then a play the mission to see if it works in practice, i'm not using any debug
join in progress. its clients that join after a mission starts
start the mission, have one client run around and stuff. then join with a second client
oh ok i thought you suggested that because you know about some kind of command or something specific to do to test it
fair enough
guess i'm really lucky, i've been doing multiplayer missions for a long time but never thought about that and never had any problem with it, thanks for the tip
anyways, thank you @fair drum and @hallow mortar for precious information
RemoteExec 0 should "work" for hideObjectGlobal. It's just spamming the network unnecessarily, because the client executions won't do anything.
You'd think that, except that when I said I found in practice that 0 didn't work and 2 did work, with no other changes, I was being literal and serious and that actually happened
Gonna give it a quick repro test in case remoteExec is straight-up weirder than I thought.
Sometimes i need to use remoteExec for scripts like
hideObjectGlobal
gniiiiii
see also https://community.bistudio.com/wiki/Multiplayer_Scripting ๐
christ, it actually doesn't work. Ok.
ah whoops, forgot to flip the bool back :P
Extra weird shit: cursorObject finds hidden objects.
This was on DS btw, in local MP test it was fine with 0
It was a fun several rounds of testing the mission figuring out why the hell things weren't unhiding properly
Good day! Does anyone know if there is anything similar to systemTime but for server system time? Tried looking through the wiki. The only thing that I found is serverTime but it only returns time since last restart so not what I need.
you want the time of the server's computer?
Yes
just run systemTime on the server. if you are looking to grab it so you can use it on a client, use a server function that uses publicVariableClient
good idea. I'll give that a try! Thank you :).
https://community.bistudio.com/wiki/CT_EDIT
Can you change the canModify of edit text after its opened using a command? I tried using ctrlEnable but it kind of broke the Text in my interface
If you can't make ctrlEnable work well enough then I guess not? Plan B could be to define two different edit controls with different canModify values and switch between them.
I am using ctrlEnable and ctrlSetTextColor in a loop. The text is supposed to be black. For some reason when using ctrlEnable, only the first text in the loop is shown and it is white, not black
When I comment it, its all good
Just in case you know: setViewDistance causes a freeze in your game?
For me there is no freeze, but my computer is "good".
Not obstant is takes 3 ms to execute.
On 10K meters range.
uh, if that change causes it to load stuff, I guess
I was running a multiplayer scenario yesterday. There was a 1 minute intro with some music and a few captions. The intro was executed from an sqf file which I have execVmd in init.sqf. Whats weird, only 60-70% heard the playMusic (Yes, they had the music on :P). Aby advice on how to start looking into this issue?
There was no remoteExec etc, just playMusic
without further details, "it should have worked"
Anything else i could provide here?
The code perhaps
Init sqf:
_null = [] execVM "scripts\intro.sqf"
Lemme format the intro.sqf so its more readable.
Sorry for the length, wanted to keep the content :/
So, to clarify: some hear the music some don't? Regardless their audio options?
Yes, exactly. Even people with music enabled didn't hear it. Same goes for me (I was the Zeus) - had music set to around 30-40% and didn't hear it.
I'm unsure whether music would be related to mission loading period - perhaps it was because I executed playMusic way too early, without any delay?
Think I've never heard of such issue
(for the future: https://sqfbin.com saves lives ^^)
Oh, that's useful. Thanks.
try setting a very small sleep 0.01; before, it might requires the simulation to run
Gotcha, will try it next time. When I was testing it before the scenario (by myself) the music was executing 100% of the times I ran the scenario (and I have tested it ~50-70 times minimum).
it might be a jip issue.
Did the people that didnt heard the music join at a different time that anyone else?
If something needs to be synced its best to do so on the runtime.
At what point does your script need to be played? is there a timer or event that must happen to make it play? Disregard, just read the sqfbin.
It was a synchronized mission start, everyone was present
try doing it instead in initPlayerLocal
see:
https://community.bistudio.com/wiki/Event_Scripts
as you yourself have suggested, this might be happening too soon, as init is executed on briefing
will try, thank you 
Is there a way to make trigger activate if a classname dies
a classname cannot die, what do you mean? if a unit of said class dies?
@winter rose yes i mean if a specific unit dies, a trigger activates
Units of same type
I don't think there is such a thing, but you can right-click
if a specific unit dies? like, only one? or one of a certain type?
One of a certain type
@brisk lagoon don't crosspost, although I agree that #arma3_editor is the better place
There is I used it like couple months ago, wasn't on PC for a lone time, Alt E disabled sim for example
try an "EntityKilled" mission event handler and check the type in there
Right
are you sure it's not an Eden Enhanced shortcut?
oh yeah could be then
still cant find it online sigh
found it
w00t
why cant I add static guns to zeus? _zeus addCuratorAddons ["A3_Static_F","A3_Static_F_AA_01"];
doesnt add them
i think i mightve been drunk when i posted this i apologise
it is however the funniest thing i have ever written
hi can any of you help me write a script for the ai plane to drop a gps guided bomb on a given position asl . Please pm
or we can write it here so everyone else can benefit from your question ๐
Sounds good mate sorry ma bad
only laser
I guess you just put a laser target on the ground.
nah, what he should use is just create the bomb on the ground when the plane flies over... or if he really wants to go ham, do bomb creation at the plane and use equations of motion to calculate when it needs to be created
For laser marker bomb scripts i have but dont working on GPS bomba
leave the AI completely out
Test but i Will more real p
When I was writing the divebomb scripts for Antistasi, people suggested that I use LGBs instead because it's easier :P
either works though
yeah better than framing the current vectors of the bomb and changing it depending on the bombs location to the target. sounds like a nightmare for me at least (no calc 3)
I nie mate, but for laser marker stop bomb to position is cool , ok i try writte this scripts for GPS and writte herฤ , thx guys
You can cheat with level bombing and just spawn a dumb bomb directly above the target with no velocity.
It's nearly impossible to see the difference.
(mostly. Sometimes the AI flies bad)
i personally just create them at the ground as the plane flies over and insta blow it up. similar effect, and no one notices
Kinda surprised, you can certainly see the bombs in the air.
I guess people don't notice the absence.
you can yes, but usually there is so much other stuff happening, they don't notice
even the arma 3 campaign creates them on the ground in that one mission (inf showcase) and its partner main mission
IMO the way to go is either don't show the bomb (people will accept the suspension of disbelief - usually you don't see the bomb in movies either) or fully model it with proper direction etc. If you half-ass it where people can see it being half-assed, that's when they'll notice
in laser-guided bombs I managed it) maybe in gps I will also succeed because it's cool when a bomb falls from the sky hehe
Ok, I consider the issue closed, thanks guys. I'll post the script here if I can
Q: re: binos, I expect some require things like 'ammo' i.e. compatibleMagazines in the sense of "LaserDesignators" and the like. are there any other attachment items that may be supported? or would compatibleItems tell me that? mainly I am curious to learn whether I need to parse through those classes for semantics, different accessory classifications and so forth. Thanks...
My goal being to present an appropriately populated virtual arsenal style inventory manager right hand sidebar categories.
~~Is there a way to grab villages from a map (Altis) and transfer them into editor objects? The usage case is to create training areas on the VR map while avoiding manually creating a dozen villages or cities (just running the scenario on Altis would not work for various reasons).
I've tried BIS_fnc_objectsGrabber but that doesn't work on terrain objects. I considered using nearestTerrainObjects to get an array of nearby objects when standing in the middle of a town and then grabbing their position and classname to recreate via script, but terrain objects have special identifers that afaik don't work when used as "object" fields for commands like getPos.~~
I believe I have a stupid question, but... does anyone know how to make an Ace Arsenal available to the passengers of a helicopter? In our clan, unfortunately, many have saved their loadouts there instead of using the BI Arsenal...I know how I generated the arsenal for external access. But it just fails because people spawn already 30m above water 30 clicks before Malden in the helicopter. So they have to equip themself during the flight๐
pretty sure arsenal does not work that way 'in flight' aboard any vehicle...
you can add an ace action to the heli that just opens an arsenal box
But how do I add this Ace-Action to the heli? ๐ I didnt do this since now ๐ ๐
Possibly [_heli, true] call ace_arsenal_fnc_initBox
Their documentation is inconsistent though, so maybe [_heli, true, true]
it also assumes that virtual items have been populated... which is usually more trouble than it is worth. do you really want to do that for any vehicle? or just tell your guys to be prepared.
Q: compatibleMagazines, where do I find the set of known muzzles for a given weapon? I'm assuming that means for things like primary or secondary i.e. GL muzzles. is that config based?
https://community.bistudio.com/wiki/compatibleMagazines#Alternative_Syntax
for instance, along similar lines as with compatibleItems, indicating from WeaponSlotsInfo config:
https://community.bistudio.com/wiki/compatibleItems#Alternative_Syntax
It's just the muzzles[] config entry on a weapon.
The players have access to the arsenal only for their initial equipping and preparation in the helicopter. After the drop-off, the helicopter will be gone, preventing them from engaging in any mischief.
"this" means that the data for that muzzle is in the weapon config. Otherwise it's the named class within the weapon config.
right I guess I am looking for that decoder ring. like how do I make the jump from something like "eglm" to awareness that this is a secondary magazine munition, as in the example?
If it's the second entry then it's secondary?
If you're talking about matching magazines to muzzles then use compatibleMagazines on the muzzles.
is that outlined in the weapon config guidelines for instance?
https://community.bistudio.com/wiki?title=Arma_3:_Weapon_Config_Guidelines
I don't think so. I expect the first entry in muzzles (which is "this" in every case I've seen) is the default selected muzzle and hence can be considered the primary.
Weapons with underbarrel launchers are typically based on weapons without underbarrel launchers, so naturally the primary muzzle data in "this" gets copied over.
It would however be possible to make a weapon where the first muzzle was 40mm and the second was a rifle, I guess.
The SMAW is maybe the closest actual example.
I've got a GL capable platform, for instance, and this is what is reported from its slots:
["AK-15 GL","arifle_AK12_GL_F",["UnderBarrelSlot","PointerSlot"]]
I don't know where that's from.
_y = player;
_weapon = primaryweapon _y;
_cfg_weapon = configfile >> 'cfgweapons' >> _weapon;
_displayName = gettext (_cfg_weapon >> 'displayname');
// isnull _cfg_weapon;
_cfg_weaponSlots = "true" configClasses (_cfg_weapon >> 'weaponslotsinfo');
count _cfg_weaponSlots;
[_displayname, _weapon, _cfg_weaponSlots apply { configname _x; }]
I don't think slots and muzzles are directly related?
again not looking for just muzzles, but really any attachment, generally accessories, magazines.
think along the lines of what arsenal BIS or ACE presents on the right hand side.
that's the set of category thingies I want to identify.
if possible/necessary using the config.
compatibleItems and compatibleMagazines
yes yes yes, I am weighting in that direction. parsing through the config, except for perhaps allowedSlots[] and so forth, seems like more trouble than it is worth.
appreciate the feedback.
Might wanna check BIS_fnc_itemType
It does reliably disguish between optics, muzzle and underbarrel attachments.
yep that has potential, could work. thank you.
btw: both types doesnt work :c But thx for this idea ๐
you do know that you have to define _heli, right
yea
ive changed the "_heli" in "this" and paced it in the ini of the heli - so i thought, it would be defined, isnt it?
might be too early with ACE.
#define MUZZLE_TYPE 101
#define OPTIC_TYPE 201
#define POINTER_TYPE 301
#define BIPOD_TYPE 302
private _compatibleItemsWeapon = compatibleItems _weapon;
private _compatibleOptics = _compatibleItemsWeapon select { OPTIC_TYPE == getNumber ( configFile >> "CfgWeapons" >> _x >> "itemInfo" >> "type" ) };
private _compatibleBipods = _compatibleItemsWeapon select { BIPOD_TYPE == getNumber ( configFile >> "CfgWeapons" >> _x >> "itemInfo" >> "type" ) };
private _compatibleRails = _compatibleItemsWeapon select { POINTER_TYPE == getNumber ( configFile >> "CfgWeapons" >> _x >> "itemInfo" >> "type" ) };
private _compatibleMuzzles = _compatibleItemsWeapon select { MUZZLE_TYPE == getNumber ( configFile >> "CfgWeapons" >> _x >> "itemInfo" >> "type" ) };
just a warning that this can get slow at times
Making this code 4x faster left as an exercise for the reader :P
oh noes
well, one foreach to iterate through the list only once could be a thing
I have some caching ideas in mind ๐
that too once over _compatibleItemsWeapon, forEach, select, whatever, yes.
where is the comprehensive list of ItemInfo type in the wiki? is there one?
https://community.bistudio.com/wiki/Arma_3:_ItemInfo_Config_Reference#type
If it's not there then it probably doesn't exist. Config wikis are mostly incomplete.
What Lou said is the better approach
// weapon types
#define TYPE_WEAPON_PRIMARY 1
#define TYPE_WEAPON_HANDGUN 2
#define TYPE_WEAPON_SECONDARY 4
// magazine types
#define TYPE_MAGAZINE_HANDGUN_AND_GL 16 // mainly
#define TYPE_MAGAZINE_PRIMARY_AND_THROW 256
#define TYPE_MAGAZINE_SECONDARY_AND_PUT 512 // mainly
#define TYPE_MAGAZINE_MISSILE 768
// more types
#define TYPE_BINOCULAR_AND_NVG 4096
#define TYPE_WEAPON_VEHICLE 65536
#define TYPE_ITEM 131072
// item types
#define TYPE_DEFAULT 0
#define TYPE_MUZZLE 101
#define TYPE_OPTICS 201
#define TYPE_FLASHLIGHT 301
#define TYPE_BIPOD 302
#define TYPE_FIRST_AID_KIT 401
#define TYPE_FINS 501 // not implemented
#define TYPE_BREATHING_BOMB 601 // not implemented
#define TYPE_NVG 602
#define TYPE_GOGGLE 603
#define TYPE_SCUBA 604 // not implemented
#define TYPE_HEADGEAR 605
#define TYPE_FACTOR 607
#define TYPE_RADIO 611
#define TYPE_HMD 616
#define TYPE_BINOCULAR 617
#define TYPE_MEDIKIT 619
#define TYPE_TOOLKIT 620
#define TYPE_UAV_TERMINAL 621
#define TYPE_VEST 701
#define TYPE_UNIFORM 801
#define TYPE_BACKPACK 901
most helpful, where did you find this?
We have a copy of that in Antistasi that's unused. There's a note that suggests it might be from ACE, I guess the ACE arsenal code.
#define MUZZLE_TYPE 101
#define OPTIC_TYPE 201
#define POINTER_TYPE 301
#define BIPOD_TYPE 302
private _compatibleItemsWeapon = compatibleItems _weapon;
private _compatibleOptics = [];
private _compatibleBipods = [];
private _compatibleRails = [];
private _compatibleMuzzles = [];
private _config = configFile >> "CfgWeapons";
{
switch (getNumber(_config >> _x >> "itemInfo" >> "type")) do
{
case MUZZLE_TYPE: {_compatibleMuzzles pushBack _x;};
case POINTER_TYPE: {_compatibleRails pushBack _x;};
case BIPOD_TYPE: {_compatibleBipods pushBack _x;};
case OPTIC_TYPE: {_compatibleOptics pushBack _x;};
default {};
};
}
forEach _compatibleItemsWeapon;
thanks, I am familiar with the repo.
Hey anyone here familiar with putting init.sqf type scripts into mods?
Does anyone know what the filepaths to the blue icons are?
CfgVehicles, icon
What do you mean? Do you want a Mod that runs everytime a mission runs?
yea
I am wanting to put a script in a mod that the script would everytime a mission starts
can you elaborate or be more specific please? A pbo path would be preferred, please and thank.
You need the path for what purpose?
CfgFunctions
? are you telling to double check there or what exactly are you saying?
CfgFunctions is your goto
gotcha i will look through there
what does "effect position" mean in cameraEffect? docs dont say much about it
Currently working with the FOW ww2 tanks, ive encountered an issue where the AI bails out pre-maturely
depsite having it in their innit and attributes that they cant dismount, they keep doing so regardless, even when the tank is sprayed by MG fire like with the ha-go
any clues?
Just run #perf_prof_branch and it might almost be 4x
tried both already, unfortunately the AI doesnt care
did you take locality intoaccount and that the setUnloadInCombat is used on vehicle
yup
then im out of ideas :/
allowGetIn could effect and https://community.bistudio.com/wiki/assignAsCargo
vanilla with mx
stable 0.58 0.6
perf v14 0.35 0.36
Well that's only ~2x improvement by a simple switch to prof branch
Also keep in mind there is a alt syntax that already returns you items per slot https://community.bistudio.com/wiki/compatibleItems
what's the best way to detect curator closing?
Do you mean closing the Zeus interface and go back to normal soldier?
getText (configFile >> "cfgVehicles" >> "class" >> "icon")
If you mean the picture shown to next to it, use "picture" instead of "icon"
yes
I did not find EH for curator closing
You just add a display destroyed EH to the curator display
ah, great ๐
ok thx
how can i check whether a unit is stuck? (it's got a waypoint set with setCurrentWaypoint)
Define stuck
checking if its position hasn't changed in T time is unreliable because unit could be standing still intentionally
unable to pathfind
IIRC there was a command to get where the unit wants to go. Don't know if there actually is, since BIKI is down rn
expectedDestination?
does it return where the unit wants to be or where the unit is able to go to ?
maybe worth asking for a Curator EH? UI opened, UI closed, control taken etc?
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Curator
i still don't know how to reliably use it for checking. e.g what if unit is standing still intentionally, so its expected destination is its current position?
ooh
i guess i should check whether unit's position hasn't been changing AND its expected destination is elsewhere
Iirc pathCalculated EH returns an empty path when unit is stuck
13 seconds after a move command is issued
Ah, I forgot that existed
does setCurrentWaypoint to a MOVE type of waypoint constitute as a move command?
Yes
ok
I mean anything that triggers pathfinding
its just that unit can have valid path and still be stuck, this applies to vehicles, not sure about infantry
In that sense it's not reliably detectable
i orderGetIn false the vehicles and teleport them back to base
the game sometimes thinks the waypoint is reached even though it's not. if it thinks that multiple times in a row my STUCK code triggers
the problem is, it's not the most reliable way. sometimes a unit is just stuck and the game doesn't think he's reached anything
so, does expectedDestination return the position at the end of unit's found path or just the position the path was supposed to be found to?
example provided in the docs:
_data = expectedDestination player;
how could player even have a path, what is it even supposed to return
what if unit has found a path, was moving to its destination, but then hid in cover and stayed there for some time, and during that time, is its expectedDestination going to be in that cover or its original destination where it was going to
btw i get these in my log sometimes
Out of path-planning region for O 1-1-C:2 at 12812.8,9915.0, node type Road
expectedDestination has nothing to do with having a path
But the AI leader can give move orders to player
does anyone know why this doesn't work: _zeus addCuratorAddons ["A3_Static_F","A3_Static_F_AA_01"]; i can add other addons but not static guns.
They're not even addons
also I wanted to ask if you can add individual class names and not just addons?
They're objects
Use curatorObjectsRegistered EH
yeah i am ๐
I got the guns with this: unitAddons "B_static_AA_F"
so i dont know why they are not addons
It could be an addon but afaik it's not
hmmm
Check cfgPatches
ok thx
id actually need all static objects from several mods but I guess they all have unique addons?
Ofc they do 
so unitAddons is not to be used with zeus? ๐
wut?
List of addons that have modified the class
oh ok
You say you want to restrict it to certain obj classes
An addon doesn't have just one class
So you can't just use addCuratorAddons
Use this
Use addCuratorAddons to add the addons the class belongs to
Then limit it further using that EH
yeah but I dont know the addons the mods uses
unitAddons and configSourceAddons iirc
this is giving me empty string: configSourceMod (configFile >> "CfgVehicles" >> "B_static_AA_F")
it could be bugged because even configSourceMod (configFile >> "CfgVehicles" >> "Car") returns empty string and that's straight from the wiki
configSourceAddonList (configFile >> "CfgVehicles" >> "B_HMG_01_high_F") is working for me and returns ["A3_Static_F"] but for some reason I cant get staticweapons shown in zeus. nor any vehicles, only some structures
it seems to also need the addon that contains the crew. "A3_Characters_F" for "B_HMG_01_high_F" ๐คทโโ๏ธ
at least it only shown empty stuff for me with only "A3_Static_F" added to curator, but started showing populated ones after "A3_Characters_F" was also added @proven charm
(and empty stuff is shoved into yellow/empty side tab)
that was it, tysm ๐
but I want to be able to place empty guns.... ๐ฆ
I can place them without gunner but I cant let zeus be able to place them with those gunners
then only "A3_Static_F" for allowed addons and yellow side 
Ello, sorry for interjecting. May I know how can I get the admin name and use it in script? (for multiplayer ofc).
with just that I get nothing listed
adding A3_Characters_F was the "fix"
you need to loop some players and use https://community.bistudio.com/wiki/admin
Loop some players..? May I get a wee example?
{
if(admin (owner _x) == 2) then
{
hint format ["%1 is admin!", _x];
};
} foreach allplayers;``` something like that not guaranteed to work :/
:0 okay tysm ^^
allUsers + getUserInfo covers cases when the admin doesn't have a player object, but it needs to run on the server.


Depends what you want it for.
pardon but explain ;-;
1/ do you know scripting? (no shame in saying no)
2/ where is the script executing? (no shame in saying 'IDK')
- kind of
- IDK
3/ for what is it, what's the need ๐
So I want to know the name of admin (among players) if admin logged on ^^ and then use the admin name and init a script for that player name :)
OHH I think this will work
TYSM! Sorry Im a bit a dumb lol
just so you know the allPlayers command may not return all players immediately, there's a delay
. . . MP
okay ^^
Lemme put this in a server and see
if it prints the admin name (my name)
with and without login
I'm wanting to play a sound effect, but I've put some accessibility features in like being able to tweak the volume/pitch since it may be high pitched for some players.
However, if I just use playSound3D [..., YourVolume, YourPitch];, it will use the settings for the person who triggered the sound. I thought I might have been able to use remoteExec to play the sound for each client, but I didn't see an option for "Every client but not the server", if that tolution would even work.
use negative numbers as target
-2 is everything but server. But really it should be
[0, -2] select isDedicated
If executing it on the server. So that you don't kill it off if it's a hosted mission. Make sure to use the local argument for playSound3D.
Just plugging in -2 still seems to use the client's settings, although that may just be because I'm having to test this on a LAN server with my own two instances of Arma
Q: when I want a gear item's mass i.e. weight assuming SI kg, that's in a given class config ItemInfo, correct?
class Suchandsuch {
// i.e. Uniform item, or other, weapon, accessory, misc, etc
class ItemInfo : BaseItem {
mass = DEFINED_MASS; // i.e. 40, etc, per mass config guidelines
};
};
Thanks...
{
if (side _x isEqualTo EAST) then
{
_x addEventHandler ["Killed", {playSound "hit"}];
};
} forEach allUnits;
I got 2 issues with this trigger area, (1)It doesnt count newly spawned EAST units during mission
(2) I'm trying to add cooldown before activating the trigger again any help is appreciated
You wanna use addMissionEventHandler with https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EntityKilled instead
thanks its working now, this is how it looks,
{
if (side _x isEqualTo EAST) then
{
addMissionEventHandler ["EntityKilled", {
params [playsound "hit"];
}]; };
} forEach allUnits;
now i gotta find out to make it has cooldown because the sound can play 10 times when multiple units die together
anyone got any helpful links that could help me restore some functionality of the spectrium device in mp?
now i gotta find out to make it has cooldown because the sound can play 10 times when multiple units die together
Use a timestamp variable
lastPlayed = time;
if (LastPlayed + 60 < time) then {// do stuff}
just reading he says it is in a trigger don't triggers have implemented cooldowns before they can be activated again? or is that how common the area is checked
condition of triggers is checked every ~ 0.5 seconds
So yes, it can trigger quite often.
With that mission EH, you only need to activate that trigger once though.
ah ok wasn't tracking too far just at a glance after i asked my question
Is there a way to start a Timeline (keyframe animation) via script?
Directly without using triggers if possible?
can't see anything on the biki about it, are you doing this to try use it in mp? if so you can use
setvelocitymodelspace and some logic to replicate it a bit more complicated though
though i could be thinking of setvelocitytransformation https://community.bistudio.com/wiki/setVelocityTransformation
getting buried in the other notes...
mass, is this accurate? thanks...
try in config makers, they know better
This might also change with ACE but not sure.
Also default weight is not in KG
It's in bananas ๐
hey, is it possible to use setDriveOnPath with spawned vehicle during mission? It seems i cant get it working, vehicle just dont move
used dostop in script, dont work
is there a way to see all event handlers of a given type?
something is adding a "HandleDamage" event to every object spawned, and cancelling out all damage done.
tried adding it with the script that i mentioned earlier, couldnt get it to work somehow
that's only for mission
isnt HandleDamage only for mission?
no, for object
hmmm
well if all else fails there's https://community.bistudio.com/wiki/removeAllEventHandlers
wait- where does the handler count start
0 or 1?
Like, I add an event handler, the ID will start at 0 or 1
ok, there is 1 other event handler it seems
found also this: https://community.bistudio.com/wiki/getEventHandlerInfo
update: seems to be air vehicles?
I have no idea why it'd be this, but lets try in another mission
mission independent
I suppose to have a game night with my unit, and for the first time I am getting Missing 'description.ext Header minPlayer'
and idk wtf it means, how do I fix that
I am logged-in admin but it wont trigger (I tried settings (owner _) == 0) and it works (so it doesnt think im admin) :( tho I am
ok but I never had it, why do I need it now ffs, do I just dump it into my mission folder?
the Description.ext? probably good to have
where are u running the code?
I tried trigger, an sqf script (triggered using execVM) and I tried "execute code" in zeus.
hard to say whats the problem
I am running code in global (in execute code)
if you want to run that check in client you can just do if(admin clientOwner == 2) then {};
lemme see
wait im on dedicated server
Im not client owner
ig that's what it means?
clientOwner - "Returns the machine network ID of the client executing the command."
ah
nah it did not work
it works on 0
if(admin clientOwner == 0) then { hint "meow"}; ```
not on 2
then only thing I can think of is that your not admin
addMissionEventHandler ["EntityCreated",{
params["_this"];
_this spawn {
uiSleep 2;
_this removeAllEventHandlers "HandleDamage";
};
}];
dumb thing, something is dumbly making the dumb damage be ignored, dumbly, dumb dumb. (Heh...)
u typed the admin password?
some mod maybe?
yes but I dunno what'd be doing it
what are you making "2"?
one sec lemme send u screenshot
maybe admin only works in dedi?
admin - "This is dedicated server command, which queries the admin state of any client on the network by their client (owner) id."
I wanna check if there is an admin amongst players and if yes then start script for that admin
and im using it on dedicated server
perhaps wrong timing or something
uhhh
This should work.... in initPlayerServer.sqf -- params ["_player", "_didJIP"]; if(admin (owner _player) == 2) then { diag_log "Your the admin!"; };
fixed typo
it inits as server starts aye
and i wont be in server when it starts (exactly when it starts)
or it runs the code whenever a player joins?
initPlayerServer.sqf is run when player joins
server maybe already running before that
what if i join and im not admin but after 2 mins another guy joins who's an admin (i didnt left the server) will it run the code for his join as well?
initPlayerServer.sqf runs for all joiners
sorry I g2g, good luck with the script ๐
tysm for help :)
I found a way!!
if (serverCommandAvailable "#logout") then {playerAdmin = player; publicVariable "playerAdmin"}```
Hello!
May i ask for suggestion, which script to use? I would like to give my players in a multiplayer scenario a hint when something happens. More specifically, when 1 player uses an addAction it should give everyone a hint. But hint on its own is just local so after using addAction the hint appears only for the one, who used it but noone else. First i thought ok, i'll just use a remoteExec but then i saw on wiki, that remoteExec shall not be used to send text, which is exactly what i would do, if i tried to use remoteExec for a hint. So when remoteExec is out, i would like to ask, what else can i use, to send a hint to everyone (or everyone in one faction) ? Thank you.
nvm wont work 8(
I mean, the biki lists examples for remoteExec using hint so I don't know from where you got the reference of not using it for hint.
Source: https://community.bistudio.com/wiki/remoteExec
On this page, the second orange box from top. Or did i misunderstand it?
Structured Text != String ๐
Structured Text =/= Regular Text used for hints. Structured texts contains additional text attributes like text size, color, images etc. https://community.bistudio.com/wiki/Structured_Text
see remoteExec's Example 1
I see, well that orange box made me worried that sending a text is a bad thing for a remoteExec.
Ok and is it better for remoteExec target to use 0 or 2 when sending a hint?
I would use 2 but i might be wrong
Does the BIS_fnc_playVideo have the ability to 'pause' a video than stopping it?
2 is targeting the server only
i know
soooโฆ you would be sending a message only to the server, not to any other person? also the server could be dedicated?
see Example 6
-2 is "everyone but the server", but note that a server can also be a player (player-hosted game)
i believe the server is dedicated
you don't code a mission for a specific server hosting
for target 0 is the best choice here?
for a hint? yes
.
yes when using a remoteExec for a hint
"Your Hint Here" remoteExec ["hint", [0, -2] select isDedicated]; is your best all-round scenario.
well so far i do, although i've been thinking about releasing it on the workshop, i've been working onthis single mission for over 3 years
How can I check if the spectator is open for a client?
expensive for just a simple hint
it works, it works fine, just it's a tank to kill a mosquito ๐
Also would BIS_fnc_playVideo_skipVideo skip the video midplay?
Thank you @winter rose and @finite bone for great tips. I really appreciate it.
(well, how else do you want to skip - before playing?)
I think it is "cut the currently playing video" yes
I don't think so
Guys, I am trying to use addWeapon to add weapons to the drivers inside vehicles, such as:
vehicle player addMagazine "rhs_mag_127x108mm_1slt_1470";
vehicle player addWeapon "rhs_weap_yakB";
And this works fine.
But if I try to add, for example, an M2, or a DSHKM, it does not work anymore, for example:
vehicle player addMagazine "rhs_mag_127x108mm_50";
vehicle player addWeapon "rhs_weap_DSHKM";
It makes no sense to me that certain weapons can be added, and certain ones canยดt. For example rhs_weap_pkt does not work, but rhs_weap_pkp does. Is this some sort of a config limitation of certain weapons?
player addEventHandler ["SlotItemChanged", {
params ["_unit", "_name", "_slot", "_assigned"];
}];
I am getting an unknown enum error when I try to run this, but "SlotItemChanged" is in official documentation
2.14
jordan means to say it is not yet in the release build of arma, only the dev branch
im crying thank you
I've been trying to find a script that can change flags, but the only scripts I can find use vanilla textures. How can I modify the scripts so that the path for finding the flag textures is in the mission directory, not the game files? Example of what I mean:
#define NATO_FLAG FLAG_PATH("flag_nato_co")
#define CSAT_FLAG FLAG_PATH("flag_csat_co")
#define AAF_FLAG FLAG_PATH("flag_aaf_co")
#define EMPTY_FLAG FLAG_PATH("flag_white_co")```
Oh thats convenient, thanks
I am calling wrong classnames.
How can i take the number of blufor units in this code and multiply it by 2?
{getNumber (configOf _x >> "side") == 0 and _x inArea thisTrigger} count allUnits < {getNumber (configOf _x >> "side") == 1 and _x inArea thisTrigger} count allUnits
I have a folder of macros in my mission folder: \macros\ which has macro1.hpp.
In a file in some arbitrary folder, i would like to include the macro1 file as such: #include "\macros\macro1.hpp".
This doesnt seem to work.
How do i reference the mission root?
How would I go about in moving a set of objects at a specific direction at a constant speed while none of the involved objects are simulated?
For context: I am trying to move an improvised/diy train made of regular objects in a straight trajectory. All of the objects have simulations disabled. The objects are also added in an array. So lets say the train consists of 35 objects added in an array. I want to move all 35 objects at a constant and direction for a minute or two.
What I was thinking of is making a while loop and use setPos to increment the position by 0.1 every 0.1 seconds but it seems very taxing. Is there an easier/better way of doing this?
is there any way to get the part of object's velocity that's produced by itself to propel itseff? e.g if a vehicle is slowly sliding down the hill with its engine off. its velocity is 100% generated by external force, while the velocity generated by its engine is 0
i would probably attach the train to some NPC and make that NPC invisible and invincible, though getting it to walk on the rails precisely might be hard
maybe it'll work if you generate a lot of waypoints exactly where the rails are
hell, i attached entire buildings to NPCs and made them flying houses
lol i want to make a train now
I know there were some mods that added working(ish) trains to Tanoa, you might dig into those.
velocityTransformation
which one is nil? the hashmap itself?
also how recent are you talking about? there was a breaking change in profiling branch a couple of days ago:
#perf_prof_branch
maybe that's why your data was broken?
only numbers are pushed into the hashmap.
uids are strings tho
yes
whats the best way to consistently fetch a specific location behind a unit?
or just around them, always relative to the unit in question
in this specific example im trying to get a position around a meter away and slightly to the left or right, behind the leader of a group.
modeltoworldworld
getPos (alt syntax)/getRelPos too
getPos , getDir and setDir?
I guess there is no way of changing how often the addAction condition is evaluated? (each frame)
correct
would be good to have feature for this
no.
as in, the opposite of yes
Use lazy evaluation and script a cooldown :D
lol
yea i have bit of lazy eval
you can always create your own analog of addAction tbf with userAction and Scripted eventHandlers
I think I will just waste some CPU cycles there ๐ซค
uhm, your own addAction? Now i'm interested
triggers have "run speed" why not actions too
do they?
action = UI = per frame
let me ask you the other way around: why would you want an action evaluated every second or so?
to make it easier for CPU
each frame is pointless too
AH, the interval. Run speed sounded so alien to me with this context hahaha
don't optimise what does not need to be, really
As a workaround, you could have the actual condition be checked by a slower separate loop that updates a variable, and have the action condition only check the variable
if you have performance issue due to an addAction then that addAction is wrong
good idea! could do something like that
"you own add action" ๐ tbh, why not use an eventScript instead? its even better
no perf issue (yet) as I dont really know how fast the scripts will run , havent done any tests yet
write minimally sane code -> profile -> optimize slowest part 
"premature optimization is the root of all evil" (c)
just that no matter how fast the code it's still waste to run every frame
some code is faster than logic that's used to cache it 
no
UI = on each frame
period ๐
and unscheduled
drawing the action on screen although it is not available anymore is a waste, in both GPU cycles and player UX
if you're that bothered by possible performance waste - move the condition into a variable and drive that by actual event handlers ๐
Splitting the group isn't an option?
limitSpeed does work really well though. I even use it for distance-maintenance in convoys.
Vanilla groups tend to just have the IFV [commander?] as group leader
Odd that doFollow doesn't work as that's what it's supposed to be for
Config mod, raise sensitivity property on units.
Max shooting range is limited by weapon mode configs too.
So you'd probably need to make custom weapons for them.
I managed by creating empty gamelogic targets/picking positions around where I wanted fire, and giving the MGs doSuppressiveFire commands.
Suppression is incredibly powerful and no one believes me. Easily quarters AI accuracy, if you can sustain it.
Yeah, even true for AI vs AI. You can demonstrate it by setting two squads against each other and preventing one from shooting for one test.
They're tricky due to the inheritance.
I did just so; at 100m csat averaged about 30% accuracy unsuppressed, but only 7% suppressed.
Big final part of my onboarding is showing how a supressed AT gunner will either miss horribly, or break down and run away, its great.
Ehhh, maybe not beyond range, i managed by setting the targets level but only about 100m ahead xD
Granted, it was for my mission Haze, so its deep fog they wouldnt be able to engage through anyways.
by any slim chance does anyone know the script that sets the distance value (like when lasing with a bino) for CA_Distance which has idc = 151, I cant seem to find what script is ran onload or what sets the value for idc 151
So I noticed while destroying buildings that it moves them ~100m underground but neither hides them not disables their simulation. Does this mean the game's still rendering them?
With the refract particle, can anyone say how expensive they are to render
with lifetime 2, drop interval 0.05
about that much | |
Hello folks. Iโm making a mission with the CUP CH-146 Griffon. I was wondering if there was an easier way to add solders to the two door turrets. One of them doesnโt show up unless you spawn it in with crew already in it
I'm trying to figure out lights. I used one of the particle calculator mods to get the values I want - sqf this setLightColor [0.0839268,0,0]; this setLightAmbient [0.453124,0,0]; this setLightIntensity 3000;
but the object I put it on doesn't seem to do anything... Do only certain objects work as lights?
Yes.....lights. https://community.bistudio.com/wiki/Light_Source_Tutorial
I wish the setLightColor article said "Light object" instead of "object" for what to put there, then ๐
thanks for the link
Well, it's for setting the colour of a light. It doesn't work on things that aren't lights, they don't have a light colour to set.
Most efficient way of utilising area triggers to activate certain code on the server?
At the moment I have a global trigger which remoteExecutes code on the server, however it has to call a few different functions, it seems inefficient..
Is there more effective ways to monitor & execute when a player enters/exits and area for the purpose of executing code on the server?
I'm trying to add custom uniforms to the game, do I need to add a unit that wears it to have it show up?
I'm using a code template from a youtube video and ALIVE orbat
trying to make a mod that has my custom textured uniform, vests and backpacks with the custom faction I export from ALIVE
thanks
TL;DR trying to play a sound effect, but allow the client to determine volume / pitch for the sound they hear
Still never found a solution to this. Hypoxic suggested doing [0, -2] select isDedicated, but when executing it on the server, no sound played.
This is the code I tried using to play the sound effect
[[
"BNA_KC_Gear\Weapons\Data\Audio\BNA_KC_DroidPopper_Exp.wss",
"",
false,
ATLToASL _position,
ClientVolumeSetting * 2, // Not exact names
ClientPitchSetting,
0,
0,
true // play locally
]] remoteExec ["playSound3D", [0, -2] select isDedicated];
PlaySound3D has global effect. You should not remoteExec it at all
He probably meant other commands, such as say3d
There's a local arg now? 
Since 2.06
local: Boolean - (Optional, default false) If true the sound will not be broadcast over network
If you want to use the client settings, you should make a function that reads those values locally, and remoteExec the function instead
I went to go write an example of what I think you mean, but I'm entirely sure if I understand how to do it
The code is in an event handler, and only reaches this point if it is the server executing it
// fn_playSound.sqf
params ["_sound", "_pos"];
playSound3D [
_sound,
objNull,
false,
_pos,
ClientVolumeSetting * 2, // Not exact names
ClientPitchSetting,
0,
0,
true // play locally
];
["BNA_KC_Gear\Weapons\Data\Audio\BNA_KC_DroidPopper_Exp.wss", ATLToASL _position] remoteExec ["my_fnc_playSound", [0, -2] select isDedicated];
also your 2nd arg was wrong
you had "". wiki says it takes object not string
Yeah I just had it has an empty string since I was just playing it a specific pos
it takes object not string..."empty object" is objNull not ""
I knew it wasn't correct, to be honest, I just hadn't seen much of a point in changing it in all honesty
{
if (side _x isEqualTo EAST) then
{
addMissionEventHandler ["EntityKilled",
{
params ["_killer"];
_killer = param [1,objNull];
if (typeof _killer isEqualTo "B_Plane_Fighter_01_Stealth_F") then {
call{_mech = [getMarkerPos "s1", west, ["B_ION_Survivor_lxWS"],0] call BIS_fnc_spawnGroup;}}
}];
}
} forEach allUnits; this script works fine but isnt working for newly spawned EAST unit during mission
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
And why you need to have multiple EntityKilled MEH?
everytime any jet gets kills out of any east units, it triggers an effect, eg: spawn blufor
You're making multiple eventhandlers to do one thing
Maybe im just waking up, but _killer = param [1,objnull]; feels like its not right, unless im reading the wiki entry wrong.
it is correct but it's unnecessary
well, given that params above would parse the wrong argument into that variable - it's welcome ๐คฃ
EHs always pass the correct type and value so there's no need to check those
so i'd say it should be one of:
private ["_killer"]; _killer = param [1, objNull];
private _killer = param [1, objNull];
private _killer = _this#1;
params ["_", "_killer"];
...
call {_mech = } also looks sus, as call {} doesn't look necessary, _mech variable isn't used (and wouldn't be accessible) anywhere ๐คทโโ๏ธ
[getMarkerPos "s1", west, ["B_ION_Survivor_lxWS"],0] call BIS_fnc_spawnGroup; also doesn't seem to match the function's expected parameters
as 0 is placed as relPositions which expects array of positions
@little raptor did u make that fancy ai commanding mod?!
if you mean All-in-One command menu, yes (this isn't the place to ask this question tho)
Is there a known way\hack to reliably skip player's animation when taking a weapon\item\backpack with action command?
Like when unit does "PutDown" gesture and actual taking doesn't happen until animation finishes, is there a way to make this instant?
player switchMove "amovppnemstpsnonwnondnon_ainvppnemstpsnonwnondnon_putdown";
player action ["TakeBag", _backpack];
onEachFrame {
player switchMove "ainvppnemstpsnonwnondnon_putdown_amovppnemstpsnonwnondnon";
onEachFrame {};
};
```Well, this hack works but not on same or next frame after respawn
@still forum PLZ GIB UNIT takeBackpack ENTITY; which would do the same thing that https://community.bistudio.com/wiki/Arma_3:_Actions#TakeBag does but without actions\animations bullshit.

My original intent for this is: I'd like to retain original backpack object because it contains assembled weapon\drone. If you do setUnitLoadout getUnitLoadout backpack re-creates and so does weapon\drone with all its state reset - full health, fuel, ammo, etc., etc.
I guess I'll have to manually copy everything from old backpack's weapon\drone, save it on a new backpack (which didn't spawn new weapon\drone yet), then when it will be first assembled, I'll have to re-apply that saved state there
I could've just moved old backpack, but Arma is pain
lol I aint asking questions about it lol just found out that the mod I love is made by you, anyways do u have any idea about #arma3_scripting message?
nope no clue
yo bros how does the game tell the classification of items
(e.g in the arsenal the magazines are classified to scopes, weapon mags, grenades, explosives etc.)
long time since i been here :o
because they inherit from base game classes defined in different categories (Put, GrenadeHand etc). It's a #arma3_config question rather than scripting.
now my question - how can I "hide" the game while save screen shows up? I run a plenty of postprocess effects and when game saves or player opens settings, they are temporary nullified. While I don't mind that hhappening in settings, game is saved pretty often and having saturation changed every now and then feels a bit immersion breaking.
wait, so hide the game when you save?
or just the post processing?
although I just got here so x3
by hide I mean cover the in-game world when "Saving game" window shows up
Wouldn't that also be imersion breaking?
less evil I guess
lack of colors is important because player can't distinguish enemies from friendlies. When save happens, player sometimes may spoil who is who if looking in correct direction
Hm- well I'm not sure, I was just curious sorry ๐
well, i mean "How does arsenal categorize stuff" sounds like a scripting question to me ๐คทโโ๏ธ
I guess you can fade the game to black for the save? cutRsc "BLACK IN" for the save? (wait until it's faded to black, then save and fade back in)
custom GUI is hidden when saving, too
and it seems to use BIS_fnc_itemType on importing classes, you can check it in the in-game function viewer or unpacked on P-drive if you have it ๐คทโโ๏ธ
I wanna ask a question but not sure how to ask xD
Should I worry about #include?
it does not bite
a usage case might help
Hmm... Just spawn an object in front of the camera? That would solve the "cheating" issue but not the postprocessing one. Maybe a black texture in front of the camera
worry lots
that might work, thanks for the idea
one function does #include with the display and stuff values. Then that function calls another function for positioning, but I am curious if I should just go with using '313' or do an include and define it in the defines file
#include "\Ingame_Sys_Time\defines.hpp"
"Thump thump..." call BIS_fnc_log;
[]spawn{
"Beginning inGame Interface Time Loop" call BIS_fnc_log;
....
private _ctrl = _rsc displayCtrl IDC_RATCHET_INGAME_SYSTEMTIME; /// Also from the defines
...
_ctrl call RATCHET_SYS_TIME_fnc_updateGameInterfacePosition; /// <--
...
while {!(_rsc isEqualTo displayNull)} do
{
[_ctrl] call RATCHET_SYS_TIME_fnc_updateGameInterfacePosition; /// <--
...
params["_ctrl"];
private _center = (safeZoneX + (safeZoneW/2));
if(count allDisplays > 1)then{
_ctrl ctrlSetPositionX (_center - ((ctrlTextWidth _ctrl)/2));
}else{
_ctrl ctrlSetPositionX ((_center * 1.5) - ((ctrlTextWidth _ctrl)/2));
};
_ctrl ctrlCommit 0;
2nd bit of code is what I have now. That's updateGameInterfacePosition which is being called every 1/4th a second.
which I kinda dislike, but it'd probably take longer to do the position checks xD
general consensus (not only ArmA-related) seems to be "if you intend to a) use the value in 2 places or more; and b) have this code used and edited and fixed for months down the line - better go for #defines/#includes, it'd save you a lot of headache"
Hm- Yea, I am just worried about the defines being done every quarter second xD
they aren't
defines are done once of on loading the file
and if you re-read and recompile sqf file every quarter second - you have bigger problem than some defines 
ace uses macros for basically everything so its fine for performance
Oh wait, #includes isn't SQF is it, it's preprocessing. So the line would be ignored then. or am I understnading wrong
define "ignored"
you can use macros in sqf files
but all macros are resolved at point of compilation
#define would be a) replaced by preprocessor on loading the file
b) never seen by any part of SQF VM (VMs)
You can still use #include in SQF, and will allow you to use defines in your scripts
thanks brother ๐ค
if you run code on each frame, the game isnt reading that code each frame -- it reads it once and executes it each frame
Yea, SQF stuff doesn't see it.
it definitely should do 
I was thinking it'd be like caling a function to retrieve the values. xD
#include is basically just copy this file and paste it here
and thats done when the code object is compiled
findDisplay 301
/// ------------
#define MUH_DISPLAY 301
findDisplay MUH_DISPLAY```
those pieces of code would have exactly the same behaviour and performance, because SQF can't see any difference between them
ok, so that's that. Now I probably wanna use a switch instead x3
is there a way to change how UIs are ordered? My UI is behind the zeus interface xD
itemInfo class
cuts are always behind dialogs
how can i get snow in chernarus winter?
it seems most of the scripts online are out of date
https://community.bistudio.com/wiki/setRain see example 4
What LOD are building door selections defined in? I have a script like so:
{
// door found
} forEach ((_house selectionNames "geometry") select {"door" in toLower (_x)});
This works and is really fast, but is there a chance that I miss some doors by only looking in geometry LOD?
ah yes, don't make a syntax error in a scripted event handler. My computer almost died xD
first of all selection names are always lower case, so no need for toLower
second of all, doors don't necessarily have "door" in them
in any case, you should be able to find them all in geometry LOD
(if the door is supposed to get animated in the geometry LOD which all doors should, since they're doors...)
I've checked through vanilla buildings and some modded ones (CUP, Jbad) and looks like my code works like a charm on them. Thanks for letting me know that the toLower isn't needed
viewGeometry seems to be faster than geometry and doesn't contain duplicates. In geometry some doors have "duplicates" (at least for this purpose), stuff like door_1_handle etc
If you want to read code, see https://github.com/acemod/ACE3/blob/master/addons/arsenal/functions/fnc_scanConfig.sqf#L15
Is there any reliable way to check if a display is open so you're controlling the player no more but mouse?
allDisplays?
But it doesn't tell if is currently open or not
Description: Returns a list of all opened GUI displays.
Like DisplayMain is always hidden behind the missions
ah
getMousePosition is also not reliable
what about using allDisplays and just skipping IDD <= 1 or so
IDD_MAIN is 0 for example
It won't do either, there is always 46
Even if we skip it... there is a lot of possibilities to have uncontrollable displays
what about dialog
Hmm somehow I've never heard of
Let me see if it does...
It doesn't return true if createDisplay'd
My main reason why I'm asking this is to get controlled unit and if you're really controlling it
so you want to check for ANY open display/dialog or a specific one?
because with display you can move still, with a dialog you cant
Doesn'tsqf findDisplay 46 createDisplay "RscDisplayEmpty"make you to control mouse?
that would capture the mouse but not key input
True ๐ค
if you createDialog "RscDisplayEmpty" then both are captured
the player cant move anymore
So hmm, let me sort everything out:
- I want a way to tell if the mouse click AKA
defaultActiondoes the weapon fire before I fire the weapon - There is no way to tell if
- Camera is on
remoteControlis on (workaround exists but I don't want to use it)- Zeus or any other Display is on (getter for
createDisplay)
dialogexists but checking only that wouldn't fit the all cases
Anyone here knowledgeable or experienced with camera editing and PIP (picture in picture) / RTT (render To texture) in UIs - I have a question for you. Why is it that when I run cam cameraEffect ['internal', 'FRONT', 'M9_testRTT']; with the Zeus display open, it switches view to my player with Zeus still open? What I am trying to do is have a small feed that the zeus can monitor while setting up objectives. I have already added the ui elements but for some reason the moment I run that command above to create the RTT source, it messes up the zeus camera and also makes it so I can't open the player list. I did some research myself and found this warning about cameraEffect on the wiki: "One cannot mix and match cameraEffect and can either have multiple r2t (rtt) cameras or a single camera for the whole screen." Does this mean that since zeus uses a full screen camera, I can't overlay an rtt ctrl on the zeus display?
yes that's what the wiki means
I managed to semi-work around the issues by using switchCamera. I can now control zeus and have the overlay, BUT the FOV is locked at like 120 degress. I tried using curatorCamera camSetFOV 0.7; curatorCamera camCommit 0; but it had no effect. This is the biggest issue, since I was able to get the player list working.
I'm just wondering if you have any ideas on how I could fix the FOV but if this is a dead end let me know.
dunno
is there a way to create a custom item and object inside of a mission file?
I don't think so. Missions can only change mission config, and none of the creation functions look in there.
well, you can shove a .p3d into a mission and createSimpleObject it to have a mission-specific object in the world... but no inventory items and no simulated objects i know about
Hi!
Is there a way to disable the dust effect created by a helicopter with engine on on ground?
I tried this, no go
this setParticleParams [["", "", []]];
DustEffects config, but you are going to be creating a mod
Ha, so no "easy" way of doing it..don't want to actually disable it, just for a short video
Thanks anyway ๐
wait so attached objects still stay attached even if the parent entity has Show Model disabled / invisible?
or does it only work on NPC which are turned invisible
yes, this is how I make flying demons
thats interesting
you can get pretty silly with it.
parent: littlebird (hidden)
child: MRAP (hidden)
child of child: lightSource creation
attach the mrap to the littlebird then attach lightsource to the mrap. if you attach the light directly to the littlebird, even though the littlebird is hidden, you will still see the shadow of the cockpit, but it doesn't happen if you use the MRAP as the attachment point
thats pretty wild thanks for the info ill have to try it out
now with light source modifications, you can make a flying/floating navi from zelda or whatever you want
this also means you can technically launch rockets
correct
i have a mission around here somewhere. let me see if i still have it. i might have deleted it. it was a holloween special that featured an attacking flying demon boss battle
that'd be great if you still have it around
speaking of attaching objects, is there an easier way to attach a bunch of objects to a parent rather than individually selecting each and attaching it?
its just time consuming ๐
eh looks like it was lost to the void. I'm sure its out there on someone's computer but I've helped out with so many communities idk where to start lol.
yeah, you create an array of children and their attachpoints, then you attach them all with an apply or forEach
what do you mean by attach points?
[
// object | offset
[obj_1, [1,2,3]],
[obj_2, [4,5,6]],
[obj_3, [7,8,9]]
] apply {
_x params ["_obj", "_offset"];
_obj attachTo [obj_parent, _offset];
};
external in a file/function
oh and another question (sorry for the dumb one) would hiding model also disable the effect?
effect of what
like if I attach an invisible car and it drives would it produce the dirt / smoke from the terrain?
haven't tested cars, but heli's yes. also if hiding a flying object with a pilot, it will disable the vehicle. you need to use unitcapture/play and don't use any crew and have it fly around invisble by itself
Hello sorry for interjecting, may I ask how do I reference the disabledAi in my script (for playableUnits)?
start with what you want accomplish first, not enough info
I have a few playableUnits that needs to be disabled (so they wont spawn unless players are on that role) and I made a script that disables the slots for unauthorised players so now if the playableUnits are not spawned and are disabledAi it will throw an error, any help?
isNull?
what you got so far
here is my script :)
// Unit names
private _uid_SL1 = getPlayerUID SL_1;
private _uid_SL2 = getPlayerUID SL_2;
private _uid_RTO_1 = getPlayerUID RTO_1;
private _uid_RTO_2 = getPlayerUID RTO_2;
// Unused SteamID
private _allowedUID_Unused = ["76561198350976093"]; // J.Powell
// Allowed Slots
private _allowedUID_SL1 = ["76561198105370015", "76561198846755720"]; // SgtDevRupesh, HaddenHD
private _allowedUID_SL2 = ["76561198105370015", "76561198846755720"]; // SgtDevRupesh, HaddenHD
private _allowedUID_RTO_1 = ["76561198105370015", "76561198846755720"]; // SgtDevRupesh, HaddenHD
private _allowedUID_RTO_2 = ["76561198350976093"]; // (test SDR not included)SgtDevRupesh, HaddenHD
// for SL_1
if ((isPlayer SL_1) and (_uid_SL1 in _allowedUID_SL1)) then {
// if allowed
sleep 10;
hint "Welcome";
} else {
// if not allowed
sleep 1;
serverCommand Format["#exec kick %1", name SL_1];
// hint "Restricted slot!";
};
// for SL_2
if ((isPlayer SL_2) and (_uid_SL1 in _allowedUID_SL2)) then {
// if allowed
sleep 10;
hint "Welcome";
} else {
// if not allowed
sleep 1;
serverCommand Format["#exec kick %1", name SL_2];
// hint "Restricted slot!";
};
// for RTO_1
if ((isPlayer RTO_1) and (_uid_RTO_1 in _allowedUID_RTO_1)) then {
// if allowed
sleep 10;
hint "Welcome";
} else {
// if not allowed
sleep 1;
serverCommand Format["#exec kick %1", name RTO_1];
// hint "Restricted slot!";
};
// for RTO_2
if ((isPlayer RTO_2) and (_uid_RTO_2 in _allowedUID_RTO_2)) then {
// if allowed
sleep 10;
hint "Welcome";
} else {
// if not allowed
sleep 1;
hint "Unauthorised slot!";
sleep 1;
serverCommand Format["#exec kick %1", name RTO_2];
// hint "Restricted slot!";
};```
now if Im the only player in the server and those other playable slots are disabledAI = 1 in description.ext then I would get this error saying "undefnied variable in expression".
Then isNil
params?
ye
I see no params there
I read documentation about it and was confused cuz a lot of mods and scripts uses params
params ["_apple", "_egg"];
//same as
private _apple = _this select 0;
private _egg = _this select 1;
yeah im asking just in case its something I could use in the future :)
I dont understand the point of params
More faster, more options
as in processing?
And more easier
[5, 2] call {
params ["_int", "_multi"];
_int * _multi
};
// returns 10
ah
I see
Tysm for this explanation, helping me with the issue and again sorry for the trouble ^^
where is this running?
like in a init field? in a script file? in init.sqf?
ah it has its own file but its executed through initPlayerServer.sqf
params [
["_apple",obj_apple,[objNull]]
];
//same as
private _apple = if (isNil (_this#0) and {(_this#0) isEqualType objNull and isNull (_this#0)}) then {
obj_apple
} else {
_this#0
};```Another params example
now params seem beautiful~
Lol tysm I will add all this to my github so I can reference in future ^^
btw initPlayerServer will run everything in it everytime a player joins?
or once a player join
tho I am using onPlayerConnected
onPlayerConnected "[_id, _name] execVM 'checkSlot.sqf';
";```
I hope this will work
if (isNil SL_1) then {
private _uid_SL1 = getPlayerUID SL_1; // UnitNames
private _allowedUID_SL1 = ["76561198105370015", "76561198846755720"]; // SgtDevRupesh, HaddenHD (SteamIDs)
// for SL_1
if ((isPlayer SL_1) and (_uid_SL1 in _allowedUID_SL1)) then {
// if allowed
sleep 10;
hint "Welcome";
} else {
// if not allowed
sleep 1;
serverCommand Format["#exec kick %1", name SL_1];
// hint "Restricted slot!";
};
};```
isNil takes a string
"SL1"
Null takes an object?
yes
isNull does, isNil doesn't
also, if not isNil
Do you know what is the difference between Null and Nil?
oh yes, thanks I need to flip it
uhh
isNull = object
isNil = str and number?
No, the entire idea of Null and Nil
took me a while to realise there are 2
No
nil means the variable doesn't exist.
Nil = completely non-existent variable
Null = the data has the data type, but no usable info
yeah rn im checking object so isNull
I see
nulls are typed, so there are a load of different ones. objNull, scriptNull, grpNull etc.
isNull detects them all though.
:0
wait so if I use objNull will it work?
tho Im checking variable = object so ig isNull is best thing here
isNull is generally the correct approach.
okay ^^ lemme take screenshot of this chat and save in github lol
And this convo makes me to realize I don't know how it behaves when the player object doesn't exist per disabledAI = 1;
I mean terms of variable
oof testing is the only way to know ig
Editor-assigned variable?
Yeah
if (isNull SL_1) then {} else {
//
private _uid_SL1 = getPlayerUID SL_1; // UnitNames
private _allowedUID_SL1 = ["76561198105370015", "76561198846755720"]; // SgtDevRupesh, HaddenHD (SteamIDs)
// for SL_1
if ((isPlayer SL_1) and (_uid_SL1 in _allowedUID_SL1)) then {
// if allowed
sleep 10;
hint "Welcome";
} else {
// if not allowed
sleep 1;
serverCommand Format["#exec kick %1", name SL_1];
// hint "Restricted slot!";
};
};```
hope this will work
Yeah not sure. I try to avoid those :P
if (not isNil "SL_1" && { not isNull SL_1 }) then
{
wow that's fancy
here is a very compact way of doing the same thing:
// initPlayerLocal.sqf
[] spawn {
scriptName "Unit Authorization Script";
private _allowedUIDs = [
["SL_1", ["76561198105370015", "76561198846755720"]],
["SL_2", ["76561198105370015", "76561198846755720"]],
["RTO_1", ["76561198105370015", "76561198846755720"]],
["RTO_2", ["76561198350976093"]]
];
private _index = (_allowedUIDs apply {_x select 0}) find vehicleVarName player;
/* keep in mind, find is case sensitive so the SL_1 in above needs to be exactly how it is in the editor, for example */
if (_index == -1) exitWith {};
private _accepted = (
getPlayerUID player in (_allowedUIDs select _index select 1)
);
if (_accepted) then {
sleep 10;
hint "Welcome";
} else {
sleep 1;
hint "Unauthorised slot!";
sleep 1;
["myPassword", format ["#kick %1", name player]] remoteExec ["serverCommand", 2];
};
};
ah.. thank you ^^
means a lot!!
TYSM
you don't need any of the extra onplayerconnected based stuff, just use initplayerlocal.sqf
alr ^^
Arbitrary clients can kick themselves with serverCommand?
i think he just needs to add the password argument
ah thats a server only syntax. one sec...
You fixed a bunch of my broken code ๐
tysm :)
Btw why spawn is different from normal? (normal = writing code without spawn in this case?).
cause I want it to run independently of whatever else is in the initPlayerLocal.sqf
and so it terminates itself if the index is -1, instead of terminating all of initPlayerLocal.sqf
Is there a way to get the rotation of an object? (Yaw, Pitch, Roll) to hardcode it / set it later using BIS_fnc_setObjectRotation?
BIS_fnc_getPitchBank | BIS_fnc_setPitchBank is one way
vectorDir | vectorUP is another way
It seems to not maintain the right slope i want it to be
Basically, im trying to create a ramp by tilting the object in the 3DEN Editor, noting its rotational values and replicating it to its exact precision
oh then you want to use attributes
using set3DENAttribute
if you are staying inside of the editor
Its for outside the editor once I note the values in the editor
Like I get the readings from the eden editor, go into the server, create the object with the values from the eden editor (includig yaw, pitch and roll)
vectorUp & vectorDir to read, then setVectorDirAndUp.
I might have messed up somewhere then - Ill try again with vectorUp, vectorDir and setVectorDirAndUp. Thanks! ๐๐ป
You want to be careful with setPosXXX because they often reset orientation.
best bet for exact placement is getPosWorld/setPosWorld, then do the setVectorDirAndUp afterwards.
Ah so setPosASL maybe the culprit here then ill try it out thanks
Once i host a server and fire up the map, the game downloads all the necessary scripts from the mission folder to players right? I don't have to manually give those to them right?
I see. Then there is another reason for why the script is not loading for players. Time to troubleshoot.
It maybe easier to share the script here if you don't mind
Well, it's not my script. It's the simple shop script I found online. It has tons of different things to go through.
This one
Can manual respawns be disabled mid-mission?
what must I put on the trigger to start it the moment the mission starts
I tried running this: sqf _temppos = getPosWorld this; _tempvecup = vectorUp this; _tempvecdir = vectorDir this; this attachTo [rocket_engine_vic]; this setPosWorld _temppos; this setVectorDirAndUp [_tempvecdir, _tempvecup]; however the objects are misaligned to their initial position
(sorry for ping)
is there any specific reason to not use BIS_fnc_attachToRelative (or whatever that's called)?
and precise positioning and rotation in arma is funky thing
rotating and then moving may help
I tried the other way too - setting vectors and then setposworld - still the same result
the objects are offset by 5 - 10 meters compared to its initial position
still stands
also, i'm not really sure about using PosWorld for attached stuff. I am under impression that model coordinates should be used in that case
Both biki and John adviced on using it ๐