#arma3_scripting
1 messages · Page 66 of 1
when your avarage player gets 35-40 fps all u want is more global functions lol
deleteVehicle / createVehicle / setObjectTextureGlobal / hideObject
all that shit is global
GE
hideObjects can be done on a remoteExecCall, no need to do it each frame
arrived from remote players
Yup, gonna try implementing it soon
Still trying to make drones and terminals useable with as less bullshit as possible
Right now its stock engine UAV Terminal
I'd want to script my own, but remoteControl is bugged and barely usable
i had in mind to do something like using the Contact DLC "ray gun" things to hack into drone and watch its feed via gunner for ~10 sec
I'm still unsure about disabled AI on drones, gonna think about it, have it configurable per server
so enemy drone could have camera hijack
Yeah, gonna use these spectrum devices as a counter-drone measure too
Not sure if its useful to hijack the camera, gonna make it disable AI and scramble drone controls somehow
yea .. i thought maybe being able to 'hack' the enemy drone to briefly show enemy positions on the map for a couple seconds
basically a hold action on the drone from a distance which shows some stationary icons/markers with fading alpha
Speaking of 3rd person camera position, I know for sure that servers has positions of player cameras (not sure how often they're updated)
Makes me wonder if clients have it too
of remote cameras?
Pretty much whatever positionCameraToWorld returns for each client
there might be a selection pos for something like that, but i dont think so
Its used to determine how often and what kind of messages are sent from server to clients
So if client is far away from some entity, its position update and such is sent much less often
While for AI the origin for the view direction vector can be taken from eyePos unit, for human player the origin should be taken from player camera position positionCameraToWorld [0,0,0]
Hm, I wonder if its calculated or uses something from the network
Can be told with some tests
it would be pretty fixed .. like getcameraviewdirection bob vectormultiply -0.1
Oh its only a direction vector, not position
sort of extending the direction in the opposite direction 0.5 or something
direction vector but it would point straight to the camera
maybe not
could probably create some little algorithm to get the camera offset from eyepos+cameraviewdir when in 3rd person
you'd just need a public var for first/third toggle, which wouldnt be too bad
and then run the pink orbs locally
_this#0 drawLine [getPosWorldVisual player, _pos, [1,1,1,1]]; Last Question how to make in here offset on _pos So it dosent go directly from start to finish but to 80 % there.
Well it just dawned on me that your usage of getText is incorrect. >.> There is the problem.
_startPos = getPosWorldVisual player;
_direction = _pos vectorDiff _startPos;
_partialDirection = _direction vectorMultiply 0.8;
_newEndPoint = _startPos vectorAdd _partialDirection;
(_this # 0) drawLine [_startPos, _newEndPoint, [1, 1, 1, 1]];
prompted with ```(_this # 0) drawLine [getPosWorldVisual player, _pos, [1,1,1,1]];
How to make in here offset on _pos So it dosent go directly from start to finish but to 80 % there.```
I tried Chat GPT as well and got this:
private _offset = _pos vectorDiff getPosWorldVisual player;
_offset = _offset vectorMultiply 0.95;
private _offsetPos = getPosWorldVisual player vectorAdd _offset;
_this#0 drawLine [getPosWorldVisual player, _offsetPos, LEG_Color];
do you use the same prompt above?
Yea
odd, dunno
3.5 or 4?
ive been using the same chat for a couple hours so it has some context of vectors, maybe helps
Tried again and it gave me this:
private _pos = [1000,1000,0]; // example position to draw line to
private _startPos = getPosWorldVisual player;
private _direction = _pos vectorDiff _startPos;
private _distance = _direction mag();
private _offsetDistance = _distance * 0.8; // 80% of the distance
private _offsetVector = _direction vectorMultiply (_offsetDistance / _distance);
private _offsetPos = _startPos vectorAdd _offsetVector;
(_this # 0) drawLine [_startPos, _offsetPos, [1,1,1,1]];
lol
@meager granite are you working on that camera position solve?
What exactly?
Is there any way to make DrawLine Thicker ? https://community.bistudio.com/wiki/drawLine
ah i mean to get camera position of remote player
The only way would be have player constantly report it to the server
No way to access that already existing info about player's camera
Maybe getUserInfo should return it
getText looks okay. Add a "systemchat str _squad" to every line to make sure it loads the correct stuff ;)
even better would be _squad = switch ...
there should be some way to get it with trig
go on...
If you have two clients add unit into same group at the same time (Like with remoteExecCall), it breaks a lot of stuff
allUnits doesn't return one of two units, they have the group listed as theirs, yet units group doesn't return that unit, plus they keep trying to join the group triggering UnitJoined over and over
Bet all these issues with players not being returned with playableUnits or allPlayers caused by this
Some mess with group joining that breaks them
The whole system seems to be very unreliable
sec, looking for the right way. Basically (as i'm looking) you are using getText on a parent, not an entry.
Oh, correct
The class structure for squads are like WEST >> Infantry >> BUS_InfSquad and then there are like Unit0 and Unit1 that contain what you are looking for.
init.sqf is ran for everyone including server
https://community.bistudio.com/wiki/Functions_Library_(Arma_3) Look at Initialization Order
- https://community.bistudio.com/wiki/isServer
(i guess, it will go to that)
So im still tinkering with my Mike Force companion mod, and Im looking to make it a little more refined in how its used.
At present, its just... there. Loaded on the server, it starts running as soon as the game boots up. Which is fine if you play on the same map, less so when it starts adding units and looking for Mike Force specific variables.
How would I stop it from firing until 1) an actual scenario is loaded, and 2) that scenario is confirmed to be Mike Force?
Hello folks, I'm making an MP mission and trying to optimise it. I was previously using setVariable on missionNamespace but found out that that would sync the var to clients and generate extra network traffic I don't need. I'm changing to stuff to use global variables where appropriate, but my question is how can I dynamically name/create a global variable like how I would with setVariable? I was previously doing something similar to:
_costVar = format ["%1_Cost", _unitClassname];
missionNamespace setVariable [_costVar, _unitCost];
Any suggestions? Thanks in advance 🙂
Could you perhaps tie the init into something that looks for a variable or something that is unique to Mike Force? If it doesn't find it, don't continue init?
I was previously using setVariable on missionNamespace but found out that that would sync the var to clients and generate extra network traffic I don't need.
false, as long as the code is server-side there is no problem nor any client communication 🙂
if you set the publicVar parameter to true then yes, it is synchronised to clients
Huh. See, I thought that missionNamespace was public so it would sync over regardless. I was thinking it was akin to using a global variable and then publicVar'ing it every time!
I was under the impression that the last param for setVariable was just for JIP queing
it is global on the machine, but it is not automatically synchronised with others no 🙂
see
https://community.bistudio.com/wiki/Variables#Scopes &
https://community.bistudio.com/wiki/Variables#Multiplayer_Considerations as well as
https://community.bistudio.com/wiki/Multiplayer_Scripting
Thank-you! You've saved me a massive headache 🙂
no worries, that's the channel's purpose - don't hesitate!
Thats what I was thinking as a last resort, if theres not a dedicated waitUntilLoadingThisSpecificScenario command. Im fairly sure Im using preInit right now, not preStart, but Im away from my computer and cant confirm... so mostly just gathering ideas.
You could use the missionName command actually
Would probably return something with Mike Force in it
It’s good enough tho, ofc it needs a lot of work. The basic code it writes is pretty fine ngl
You really have to tell him details and it will write the code, if ur code doesn’t work just tell him and he’ll try his best to debug, it’s 50-50 chance it will work but ofc it can point u in right direction sometimes 8)
Ill look into missionNameSpace as an option, seems promising to what I had in mind.
Pretty sure but not entirely, if you need to run something on JIP clients look into this: https://community.bistudio.com/wiki/Event_Scripts (this was a better link then above, >.>)
@night shore This may be what you are looking for
`private ["_fn_fetchGroups","_groupArray","_squad"];
_fn_fetchGroups = {
private ["_children","_units"];
_children = _this call BIS_fnc_returnChildren;
_units = [];
{
_units pushBack (getText(_x >> "vehicle"));
} foreach _children;
_units;
};
_groupArray = ["BUS_InfSquad","BUS_InfSquad_Weapons","BUS_InfTeam","SpecOps"] call BIS_fnc_selectRandom;
_squad = _groupArray call _fn_fetchGroups;
I think you have to use initPlayerLocal.sqf
Try using initPlayerLocal.sqf instead of just init.sqf
How is building collapse damage done? If it anything within the bounding box gets damaged or-?
rip
Quitter.
Is it a problem with people actually JIPing or just running scripts when JIPed?
Boys, made a Ravage scenario to play with the boys but when i saved our progress and logged and later logged back in my friends character turned into AI i dont know if its a script thing but any solution u guys have?
init.sqf -> if(MyVar_GameStarted)exitWith{end missionbla};
After game started -> 30s alter the " MyVar_GameStarted " will be set to true.
just check if(time > 0)
All I remember from init.sqf is when a client Jips player is null for x amount of seconds, it's better to use initPlayerLocal because that is ran after all the important things are set.
Would be a problem, if Server is in autostart
Plus initPlayerLocal is better practice for multiplayer missions because you are telling only the client to run something and not the server.
init.sqf needs to be canned tbh
has anyone figured out the initialisation order in 3den or do i need to do that myself?
As in?
https://community.bistudio.com/wiki/Initialization_Order
This is not what you meant?
it seems like it's different in 3den
🤔 Really?
Expressions of Eden Editor entity attributes are called before CBAs XEH_preInit
which afaik is called with normal preinit
please check the page polpox linked
on the other hand intercepts preInit happens before both
it explicitly says what is initialized in which phase.
that page says preinit happens before Expressions of Eden Editor entity attributes
same for initServer
I learned that init.sqf is obsolete the hard way
my rpt says otherwise
show the RPT then, we're short on magic 8balls
15:43:04 "beofre reload"
15:43:06 Intercept Invoker SQF handler initializing...
15:43:06 Intercept Invoker test result: EL_D148L0 == EL_D148L0
15:43:06 Intercept Invoker initialized.
15:43:06 Intercept Pre-Init...
15:43:06 Intercept Pre-Init Completed.
15:43:06 [[2023,4,7,15,43,6,496],"3den attribute expression"]
15:43:06 [CBA] (xeh) INFO: missionNamespace processed [false]
15:43:06 [CBA] (xeh) INFO: [8348,283.988,0] PreInit started. v3.15.8.220912
15:43:06 [[2023,4,7,15,43,6,827],"XEH_preinit"]
15:43:06 [CBA] (settings) INFO: Reading settings from settings file.
15:43:06 [CBA] (settings) INFO: Finished reading settings from settings file.
15:43:06 [CBA] (xeh) INFO: [8348,284.051,0] PreInit finished.
you can upload full file here or paste its content on pastebin
I think the only reason why init.sqf still exists is because of singleplayer.
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.
after the first "before reload" i loaded a mission with one object that has this in its config attributes expression = "_this setVariable ['rank',_value]; _value call ELD_magicTriangle_scripts_fnc_discoverRank; systemChat 'rank attribute init called'; diag_log [systemTime, '3den attribute expression'];";
after the second i played the mission from editor
after the third i went back to the editor
@sullen pulsar thanks
what about HCs? :D
also my XEH_preInit.sqf has this line ```sqf
diag_log [systemTime, 'XEH_preinit'];
initPlayerServer
and the function that gets called through the objects init EH has this line ```sqf
diag_log [systemTime, 'trench init script'];
they execute it too?
well according to your RPT preInit happens before the editor entity attributes, and that's what it says on wiki
cba preinit is not the same preinit
it might be possible that it is delayed because you have your xeh within a mission, not a mod
doesn't cba preinit get called from normal preinit?
its part of a mod
;D
was about to say :)
https://github.com/CBATeam/CBA_A3/blob/d64453d4ec032fc07c9e615fa41f7990010f1918/addons/xeh/CfgFunctions.hpp#L19
cba preInit gets called from normal preInit
https://github.com/CBATeam/CBA_A3/blob/master/addons/xeh/fnc_preInit.sqf and if i understand the first lines of this correctly it starts writing stuff to log immediately when it gets called
Sometimes I wish there was callX which would put left operand into _x instead of _this
So same function can be both binary command called with call inside loop as well as with callX outside of a loop
Having a wrapper that does _x = _this makes additional scopes and eats up muh microseconds
countThis, findIfThis, applyThis, selectThis 
<-- have the cold and brain is like wobblewobblewobblemashedpotatoewobblewobble
I have no idea about anything HC
_fnc = {
systemChat _x;
};
_fnc foreach _array
Meant to use that _x function the other way around, so you can do "test" callX _fnc
pretty sure HC runs initPlayerLocal
Yes
Headless clients are basically clients just with no interface so they run initPlayerLocal
as someone that still only uses init.sqf until i learn the hard way :) its (!isServer && !hasInterface) for me
Yep, running " if(!hasInterface) exitWith {}; "
Hey guys,
I'm trying to create a little mod and I encountered an issue with executing commands in multiplayer.
Locally I can execute the 'disableAI' function but when playing on a server, clients can't execute that same function,
How can I make the client send a request for the execution of a function? (How can I make the client execute a function server-side)?
remoteExec is the way - but why should it be the client doing this?
There is a Platoon Commander mod that has certain features that only work server-side and I really wanted to play with a friend, so I am working on fixing it.
There are a lot of function calling with the AI so thats why its needed
i just made a mod to test it out.
now it seems like normal preInit doesn't run at all in 3den.
If you think multiplayer scripting is hard to master now you should of seen it before arma 3 ;)
this is my rpt and the only mod i had loaded
ugh
Attributes run in Eden and start on mission. What you have in attributes? Do you just save values to object or run some function there?
preinit is triggered upon mission start, not editor start.
I'm not sure if I understand you at all now
Or setting up ExtDB2 properly giggle
preinit stuff has to be started from an external file, not from an attribute or any other field within editor
oh
i thougth preinit would also run at editor start
Shaddup
then that's what i'm looking for
something that runs on editor start before attributes are initialised
preStart maybe?
XD
I haven't had a chance to mod editor yet, perhaps if you go through eden editor functions you could find something allowing you to parse code on editor start. Or check someone else's mod that alters editor, like 3den enhanced
preStart runs at game launch
just found that aswell
thanks for the help, imma have to mess around with this stuff now
nice to see you back in the fray, Tonic
I almost left again
^^ 👍
lol
I tried to touch altis life and then wanted to cut myself deeply.
no doubt
just stay away from that and its all good
Hey guys I know, lets make a role playing mode where you roleplay a soldier :troll:
It can't be that bad.
Right now I am cringing at the thought of looking at VAS...
lol
Probably won't even look at it and just redo it from scratch, so many things wrong with it.
haha
^, the view distance thing wasn't so bad because I had it brought up-to-date with what I know and optimizations before I left so that was a breeze and rather fun doing the saving part.
Hatchet, I want your PhysX playground btw. I always wanted to be a hotwheel car going through loops in arma.
hahaha, too bad the damn thing doesn't work!
C'mon who doesn't want to do this? https://www.youtube.com/watch?v=vVeoL3F2zCc
been there, done that
You say it doesn't work, I say try it in arma 2 LOL
ha, that is probably valid.
The PhysX ball I thought was interesting, I actually took my limited skills in modeling to make a sphere and put it in arma to make a mini-game.
Oh boy
those actually could be fun in some regard. i did make a hillside thing with boulders out of that. should make a video of that.
My mini-game idea ended up becoming a game. Believe it's called Rocket Jump or something like that lol.
They ever address the issue with roadways and boats?
no, but im sending them files today. so we'll see. the crying will begin soon either way. :D
Have you tried roadways with planes?
I wanna check if something has physics, ie gravity or is a static object, but not sure how to check. What might I wanna check?
yep all is fine except ShipX class.
CfgVehicles simulation, then compare to list of what simulation types are/n't static
simulation = "thingx"; ?
X is physX so yes, but verify for yourself
uh- Candle is static but it's thingx-
Time for actual halo jumping captain 😁
maybe if you nudge it it falls
maybe 0 mass
i mean bar the obvious character issues.. although i haven't tried that movement script in a while..
Att with Movement?
I miss when you could look around while attached to an object, that being taken away in ARMA 3 killed all my hopes and dreams of halo jumping out of a plane since scripted variants would suck even more then they did in A2.
how would i simplify this code into a macro that takes 2 arguments which would replace trenchRankCounter and 0?
if (isNil QGVAR(trenchRankCounter)) then {
GVAR(trenchRankCounter) = 0;
};
would replace trenchRankCounter and 0
what does that mean?
i imagine having a #define somewhere and instead of that code write INITGVAR(trenchRankCounter, 0)
you mean those will become the macro args?
yes
huh, i was not aware. :boo_sounds:
#define DEFINE_VAR(var, default) if (isNil QGVAR(var)) then {GVAR(var) = default;};
DEFINE_VAR(trenchRankCounter, 0)
thank you!
In Arma 2 when attached to something you could still turn, in Arma 3 you can't. You can turn your head with Alt but not your entire body.
This is how I check if google item is equiped
goggles player in [""Google_item""]";
how do I check if that item is NOT equiped?
ah ok. gotcha
!(goggles player in ['Google_item'])
was there logic behind that?
?
breaking the ability to do such, was it intentional, done for other things?
I think it was unintentional considering the effect in A2 was also unintentional I believe.
Might be something to do with the implementation of PhysX
soo like
player addEventHandler ["InventoryClosed",
{
params ["_unit", "_container"];
if
(!(goggles player in ['MF_Division_Beacon_Orange_1_NVG','MF_Division_Beacon_Orange_2_NVG']))
then
{
["Marki_DutyFactor", 1] call ace_advanced_fatigue_fnc_addDutyFactor;
};
}];
haha, from their side of the fence it may be recorded as 'fixed' now.
LOL
that looks like it'd work
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
i have this in the attributes class of a cfgVehicles entry. do i need to escape the brackets in the defaultValue property somehow?
if i place the object in the editor and run get3DENAttribute "neighborRanks" on it i get [[]] back, however if i open its properties and press "ok" it returns ["[]"].
class Neighbors
{
//--- Mandatory properties
displayName = "Neighbor Rank List"; // Name assigned to UI control class Title
tooltip = "Configure all the things!"; // Tooltip assigned to UI control class Title
property = "neighborRanks"; // Unique config property name saved in SQM
control = "Edit"; // UI control base class displayed in Edit Attributes window, points to Cfg3DEN >> Attributes
expression = "_this setVariable ['%s',_value];";
defaultValue = "[]";
//--- Optional properties
unique = 0; // When 1, only one entity of the type can have the value in the mission (used for example for variable names or player control)
typeName = "STRING"; // Defines data type of saved value, can be STRING, NUMBER or BOOL. Used only when control is "Combo", "Edit" or their variants
};
try with "'[]'" 
that works
thanks
[]spawn
{
if (!isServer) exitWith {};
while {true} do
{
if (Alive Player) then
{
profileNamespace setVariable ["stalker_mission_loadout_01", (getUnitLoadout player)];
saveProfileNamespace;
};
Sleep 300;
};
};
I am getting illegal number in expression error on line 3
@jade abyss aye, that script. was a little funny last time i tried it. never really looked at the code behind it though. might have been updated since last year. /shrug
I don't see any errors
unless you have an invis char somewhere
you do. in fact there are 3
need something like that for the PhysX carrier also..
[]spawn
{
if (!isServer) exitWith {};
while {true} do
{
if (Alive Player) then
{
profileNamespace setVariable ["stalker_mission_loadout_01", (getUnitLoadout player)];
saveProfileNamespace;
};
Sleep 300;
};
};
fixed
how tf do you find invis characters????
my mod shows them
Advanced Developer Tools
and thanks
all you have to do is click on the error. then press the Delete key on your keyboard
what program is that? I use sublime
it's an Arma mod 
ohhhhhh
Fixed, Thank you. Next time please tell me directly when you find issue 🫂
Actually all loops were broken, since continue and break commands were introduced. The other loop types are just less likely to crash but they will display invalid data while debugging
First debugger change for 14 months 🤣
do macros still activate inside strings?
single quoted yes. double no
thanks
hello guys! i am having some ideas for a task i need to solve in order to progress with my mod for better airports. I try to explain first what i could achieve and where i would be thankful for any feedback/ideas. What i achieved so far is that i am able to land planes at airports and allow them to taxioff to specific parking slots. Here is a video to better illustrate: https://youtu.be/xEZkxZt4TDA
The downside of the approach i used as shown in the video (i spawned and despawned customized dynamic airports) is that there can never be more than one aircraft at a time being operating on the airport.
I thought a lot of maybe trying to use attach the plane to an invisible vehicle or maybe try to use unit capture. But these methods also have their downsides. Unit capture has the downside of low tolerance against interference from players. Attaching to invisible vehicle will not look like the plane is behaving like an actual aircraft.
My new approach solves many if not all of the downsides that other methods have. I have one customized dynamic airport (lets call it MainAirport) that is used only to initiate the landing process and takeOff process. I use an eventhandler "LandedStopped". This will move the MainAirport along the landing axis far enough away from the airport location. Doing this allows me when i also in the same eventhandler spawn a dynamic airport (lets call it FollowAirport) and setdir and setspeed of the plane (setdir and setspeed acts like a respawn of the plane and therefore the plane tries to search for the nearest taxiIn waypoint it finds, which is my Followairport). The FollowAirport will be moved around like holding a carrot in front of a horse. The FollowAirport only needs TaxiIn waypoints. The FollowAirport should be small for this to work to not interfere with multiple other FollowAirports in it's near vicinity. In fact i made it as small as this: ilsTaxiIn[] = {-2,0,-1,0}; and it is working fine.
I am working on a mod that allows better Airtraffic control once the planes have landed on the Airport.
This clip demonstrates dynamically changed parking slots for different planes.
When the plane exits the runway the Mainairport can be put back in it's orignial place. Even if you would not place it back in it's original place it would still be able to let planes takeoff. The planes do not care about where the Mainairport is located as long as it is on the landing/takeoff axis. This is made possible because the MainAirport has no taxiin waypoints specified. Therefore the plane will imiditealy target the ilsPosition waypoint and takeOff as soon as the plane reached it's takeOff speed.
So what i can achieve is:
Multiple planes operating on the airport each following their own "carrot".
Interference with players (like standing in the way) will lead the plane to stop because it tries to avoid collision. Player moves out of the way and plane will continue it's path.
Because the plane is still operating itself and is not attached to a vehicle the plane will act like an acutal aircraft
Further ideas in the future is to have a acurate towing option with precise movement of towing vehicles (i would like to specify a custom towing car as a plane therefore it would behave the same and follow my carrots)
In the end i want to set this mod up as a tool that mission builders can use. It should be adjustable and dynamically generated. Most of the things now are hardcoded.
Question1: What would be a good appraoch to move the "carrot"? Performancvise what is the best approach? Triggers checking every X seconds? Eventhandler check for collision (I could place an invisible wall on the FollowAirport)? Other approaches?
Question2: Critical view about the whole concept as explained. Do you see any more efficient way to do this without further downsides?
I am happy and thankful for any feedback guys.
tl;dr plz
agree github wiki perhaps?
at which times are functions registered through CBA PREP available?
and can i change when they are available?
i'm trying to run one in the init EH of a 3den object, but when the init is executed while the mission is loaded (into 3den), the function is undefined
id love for you to fix some issues tonic
yuka has made a mess :)
my houses are screwed sometimes they sync containers sometimes they dont
i've now seen i can pull the function from uiNamespace
- how frequently should it move? in any case you can measure the performance of moving it using debug console. if it's not too slow you can move it every frame
- it's hard to say anything about efficiency without knowing the details
I would move more or less every 10 meters traveldistance of the plane. So not that frequently needed. I guess around every 3 to 5 seconds. About the debug console i did not know that it will allow you to also monitor performance. Thanks for the advice. I will look it up
Thats mostly because of Arma :P
SetVariable + Island Obejcts -> Meh, sometimes i don't wanna work
1000 👍 s, such a rich addition, nice job...
just remembered
Altis life is a giant pile of junk mixed with old and new code, no fixing that. Sort of like VAS.
chatGPT for the win lol
@pulsar bluff
executed it like this
execVM "scripts\timeManager.sqf";
};```
and made minor changes to the script
```// timeManager.sqf
0 spawn {
// Configuration
private _dayStartHour = 3; // The hour at which the day starts (6:00 AM)
private _nightStartHour = 21; // The hour at which the night starts (6:00 PM)
private _timeMultiplier = 5; // Time acceleration during daytime (5x speed)
while {true} do {
private _currentHour = daytime;
private _isDaytime = (_currentHour >= _dayStartHour) && (_currentHour < _nightStartHour);
if (_isDaytime) then {
// Accelerate time during daytime
setTimeMultiplier _timeMultiplier;
// Wait for next check
sleep 60;
} else {
// Skip night time
private _nightTimeLeft = ((_dayStartHour + 24) - _currentHour) % 24;
"Skipping night time." remoteExec ["systemChat", 0];
skipTime _nightTimeLeft;
0 setFog 0;
sleep 1;
};
};
};```
Works perfect thanks to you and our impending AI overlord who undoubtedly plans to inslave the human race in order to meld us into a biomechanical flesh battery hive
Is there a getter for https://community.bistudio.com/wiki/setVehicleRadar ?
ahh nice thanks
I'm trying to edit a public flak script to be used in vehicle config using an eventhandler init but can't seem to get it to work
it doesn't throw any errors when in game, just doesn't have the expected outcome on the vehicle
Q: elementary, I hope... if I've got some MP slots ready, I can do playersNumber _side to see the count of those slots?
Returns count of occupied role selection slots for given side
So it will give you how many slots are occupied per side but not how many slots are there.
If you want to have a total number of slots then you would use playableSlotsNumber
https://community.bistudio.com/wiki/playableSlotsNumber
ah ok thank you
Nothing can compare with a pleasure of just writing a script and not trying to fight another engine bullshit
hmm cant say i've experienced this pleasure
Usually doesn't last long as you stumble upon yet another issue, bug or undocumented behaviour
is lovely isnt it
rare
the closer to engine limitations the more rare
.... spend all evening trying to get an isNil to check if a specific variable exists in the missionNameSpace or not, cant sort it out, give up.
Wake up
"variable" in allVariables missionnamespace
Smh my head
isNil {missionNamespace getVariable "variable"};```or```sqf
isNil "variable";```simply?
I tried that, in a lot of configurations, but it just wasnt working out :/
Either it reported a false negative (variable set to Nil/getVariable'd default input set to Nil, still returned false) or it threw a fit because the variable didnt exist in the first place.
Ill poke at it again, since im sure its way faster, but this was going to be a 'check 10 seconds into the mission' thing so unless its cripplingly slow to do, In would do the job.
with missionNamespace do {
isNil "globalVar"
};
```In case you want to hop namespaces
i thought someone was talking shit, nope is just tonic hateing things he made in the past <3
Duly noted; Im mainly using this to check if a specific mission has been loaded for a companion mod Im working on, since outside that specific scenario itd cause issues.
Nothing new there, it is only natural that I hate everything that I do.
i feel that way too, kinda sucks to be honest do all the work just for all the mestakes you made to haunt you for ever
anyone know of a nice way of determining whether your code is running in scheduled or unscheduled? nice as in not this: isUnscheduled = { private "_f"; _f = diag_frameno; sleep 0.001; _f == diag_frameno }; ;D
how would i set the condition of a addAction to check if no player is inside a trigger?
this addAction
[
"title", // title
{
params ["_target", "_caller", "_actionId", "_arguments"]; // script
},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"_trigger = getPosATL _target nearObjects ['EmptyDetector', 3];
count (allPlayers select {alive _x && _x inArea _trigger}) < 1", // condition
50, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];
the above gives me an error
where did you get that code and which error? 🙂
the above is just an example from wiki
i just added the condition i want it to check
ok well nearObjects gives you an array so you need to deal with that
error says:
error 1 elements provided, 5 expected
i wrote this simple code for the condition: ```sqf
_triggers = player nearObjects ['EmptyDetector', 300]; // Change player to _target and set the distance
if(count _triggers == 0) exitWith {true};
count (allplayers inAreaArray (_triggers # 0)) == 0
its not perfect because it only check one trigger. oh and change player to _target
You need select trigger from list of nearObjects. It returns array.
So selelect it from array
perfect, thank you very much both of you! now it does work
Heya, does the description.ext get reloaded when in editor and clicking start ? or do I have to reopen the mission file?
should get automatically reloaded iirc
Thanks 🙂
is there any documentation on how 3den history works?
especially about how objects that have been deleted are initialised when you exit editor preview?
can you send me the snippet you wrote to sync stuff and get value out of it? I cant find it
did I write that?
yeah
someone did.. not sure 😦
my mod does load up
and does things
but its giving me "a string expected object and shit"
didn't I already tell you what to do?
remove is3den
i did
did you do the apply compile thing?
apply compile thing?
read what I said back then
if i can find it 😂
you literally just ping quoted me
¯_(ツ)_/¯
how do I know what you do wrong?
but at least that converts your string
you can also do it like this: missionNamespace getVariable [_var1, grpNull]
but if someone puts a space or something in there it won't work
I dont do it using var anymore
I do ```sqf
// Attribute values are saved in module's object space under their class names (Convoy Group).
convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];// (as per the previous example, but you can define your own).
sleep 5; convoyGroup = hintSilent format [ convoyGroupString ];// will display the bomb yield, once the game is started.
// Attribute values are saved in module's object space under their class names (Convoy Commander).
curatorNameString = _logic getVariable ["SDR_CuratorName", -1];// (as per the previous example, but you can define your own).
sleep 5; curatorName = hintSilent format [ curatorNameString ];// will display the bomb yield, once the game is started.```
I wnana do it using sync
you can't use sleep in there
it did not gave me any error
¯_(ツ)_/¯
yes
it does the thing
its basic hint bruh
module function is unschd afaik
then read the wiki
no it isnt
also, please can u tell me how it will look like for my new code?
but you do still do it via var
idk what you mean "I dont do it using var anymore"
yk the old var code
var1 and var2 kind of
convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];```
well how's this thing any different?
you're just reading some string, as you did before
yeah....
i guess?
ok
I just wanna know how I will transform the string in that code to something usable yk
also default value for strings should be "" (or some other string) not -1
call compile var
oh
I just showed you. the apply compile thing
yeah...
ummm
lemme see
// Attribute values are saved in module's object space under their class names (Convoy Group).
_convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];// (as per the previous example, but you can define your own).
_convoyGroup = [0] apply compile _convoyGroupString param [0, grpNull, [grpNull]];```
yeah something like that
yeah
I will
I am using not so common global name
so I shall be good
if not then I will change it to local
yo
quick question
the player that I'll use wont be "a group" so should I use objNull?
// Attribute values are saved in module's object space under their class names (Convoy Group).
convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];// (as per the previous example, but you can define your own).
convoyGroup = [0] apply compile convoyGroupString param [0, grpNull, [grpNull]];
sleep 5; hintSilent format [ convoyGroup ];// will display the bomb yield, once the game is started.
// Attribute values are saved in module's object space under their class names (Convoy Commander).
curatorNameString = _logic getVariable ["SDR_CuratorName", -1];// (as per the previous example, but you can define your own).
curatorName = [0] apply compile curatorNameString param [0, grpNull, [grpNull]];
sleep 5; hintSilent format [ curatorName ];// will display the bomb yield, once the game is started.```
I hope it will look like this 8)
yes
PHEW
no
the hint part
and the curator is still a group
and the XXXString don't need to be global
dw I changed it
like the first one?
AH
_curatorNameString it should be like this?
_convoyGroupString like this?
// Attribute values are saved in module's object space under their class names (Convoy Group).
_convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];// (as per the previous example, but you can define your own).
convoyGroup = [0] apply compile _convoyGroupString param [0, grpNull, [grpNull]];
sleep 5; hintSilent format [ convoyGroup ];// will display the bomb yield, once the game is started.
// Attribute values are saved in module's object space under their class names (Convoy Commander).
_curatorNameString = _logic getVariable ["SDR_CuratorName", -1];// (as per the previous example, but you can define your own).
curatorName = [0] apply compile _curatorNameString param [0, objNull, [objNull]];
sleep 5; hintSilent format [ curatorName ];// will display the bomb yield, once the game is started.```
like this?
you didn't fix your hints
_convoyGroupString = _logic getVariable ["SDR_Convoy_Group", -1];// (as per the previous example, but you can define your own).
convoyGroup = [0] apply compile _convoyGroupString param [0, grpNull, [grpNull]];
sleep 5; hintSilent format [ convoyGroup ];// will display the bomb yield, once the game is started.
// Attribute values are saved in module's object space under their class names (Convoy Commander).
_curatorNameString = _logic getVariable ["SDR_CuratorName", -1];// (as per the previous example, but you can define your own).
curatorName = [0] apply compile _curatorNameString param [0, objNull, [objNull]];
sleep 5; hintSilent format [ curatorName ];// will display the bomb yield, once the game is started.
I did
I guess I did
no
Does anyone know where to find the data for the placeable unit compositions in the editor (Fire team, Recon patrol) within the config files?
Read the page on format
Iirc cfgGroups
Wat?
format
Wdym?
I said read the wiki not remove it
hint str convoyGroup
hint format [_convoyGroupString]
hint format ["%1", convoyGroup]
hint _convoyGroupString
seriously how hard is it to read the wiki?!
what is the command for chopping off a certain number of decimals wiki search is not being helpful right now
ah toFixed works (probably) thanks -- was searching round, decimal etc
well toFixed is for string representation
round doesn't work as needs to be 0.6 etc
though suppose I could always *10 then divide by 10 
yeah
Cheers, will return to creation now
just needed to rubber duck it and the doctor says i cant talk to myself or he'll diagnose me with schizophrenia
OMG THANK YOU SO MUCH @little raptor & @sullen sigil
FINALLY AFTER DAYS
ITS
EVERYTHING IS WORKING
IM SO HAPPYYYY
😄

pff
I'll give u guys credit in my mod 🙂
Leopard can you explain what this code does??
convoyGroup = [0] apply compile _convoyGroupString param [0, grpNull, [grpNull]];```
I wanna learn 8)
Ofc if you have time 😄
is anyone familiar with https://community.bistudio.com/wiki/createGuardedPoint ?
It does not return an object for me to manage/delete at a later time. If I create a handful of these will groups with a 'Guard' waypoint always go to defend that position regardless of distance? The guard waypoint says it works in conjunction with this function/'Guarded By' triggers. When looking at 'createTrigger' documentation it says it's better to use a 'createGuardedPoint' - does createGuardedPoint create a trigger internally that I can delete?
Basically I want to be able to delete the guardedPoint to avoid rogue AI from going to defend irrelevant objectives when there is no closer guardedPoint.
I think I saw a video on this
In this tutorial I demonstrate how to setup and use guard waypoints.
ARMA III available on Steam - http://store.steampowered.com/app/107410/?snr=1_7_15__13
"This video was created using content of Bohemia Interactive a.s."
"Copyright © 2013 Bohemia Interactive a.s. All rights reserved."
"See www.bistudio.com for more information."
Bohemia Int...
I'm creating/deleting them dynamically so statically placed editor objects won't work for me. I'm also trying to avoid using triggers wherever possible
is there a way to set 3den attributes without that change being recorded in 3den history?
or alternatively a way to change 3den history?
or a way to group scripted parts of 3den history together with user input-made parts?
Hmmm lemme see how I can do it 🙂
It’s waypoint so you can use “waypoint type” or something (check wiki)
seeing as it doesn't give you any reference to delete it with, it might be better to use createtrigger and setTriggerType
is it possible to add another button to the ui at the indicated position?
yeah
it's complicated
can do both
can you give me some pointers on whichever you consider to be the easier method is?
dunno. depends on your skills
the config one involves extracting the 3den configs (or using config viewer) to find where that top bar and buttons are defined then add your own (with proper config patching guidelines, i.e correct inheritance and stuff)
the scripting one is also kinda similar, except you'll use findDisplay and ctrlCreate to place the button there
the key part is the compile part. it compiles a string into a code. a code is an "executable unit" in Arma, i.e. what you wrap in {}
why do I do that? because a string is just text. it's meaningless. when you compile it and execute it you get what that code would return
the apply thing is used in case the code doesn't return anything
in that case you magically get grpNull (well it's not magic, it's due to using param) and your code will still work without throwing errors
a simplified version is:
convoyGroup = call compile _convoyGroupString
:0
but if someone who doesn't know what they're doing puts something like this group1 = ImAnIdiotthat one will throw an error
I meant putting group1 = ImAnIdiot in the module text box
yeah ik
😄
Im gonna make a video on modules
gonna give u credit and gonna quote you lol
plz don't 😬
I don't think it's a good idea to make an informational video on something you barely know anything about
aw why not?
yeah this
@tough abyss ACRE is already that modular.
Also SQF is fine, nothing stopping you from doing anything unless its just not something the engine is capable of.
Is there a way we can get the sound details of a #soundonvehicle or #dynamicsound?
So 'Guarded By' triggers are handled completely differently from other triggers it seems. If I set the variable name in the editor, the trigger will be defined until I change the 'type' to a 'Guarded By' trigger, at which point it doesn't appear in any entities/objects lists within the mission. using 'createTrigger' and manually setting the type to 'Guarded by' doesn't seem to have any effect on the behavior of the AI.
Has anyone found a workaround to be able to delete guarded by triggers after creation?
*Or have an idea of what variable/namespace might have hidden information I could edit manually to achieve the same effect?
the only thing missing from SQF in my opinion really is native hash implementations and possibly better exception handling
so i've done some digging in the configs and i believe the bar that i want the button to be in is defined in configfile >> "Display3DEN" >> "Controls" >> "Toolbar"
what do i do now?
do i just patch in my own section and button mimicking the config of the sections that are already there?
otherwise it is just as good as any other procedural language
(well i mean obviously that is an exageration)
yeah
where do i find the config patching guidelines?
dunno. try this for starters:
https://community.bistudio.com/wiki/Class_Inheritance
already found that one, it doesn't say much about modifying existing classes
it is modifying an existing class
every other example can also be said to be modifying an existing class
this works for adding another seperator to the toolbar.
am i correct in my assumption that i have done everything correctly because it works?
class ctrlControlsGroupNoScrollbars;
class Display3DEN {
class Controls {
class Toolbar: ctrlControlsGroupNoScrollbars {
class Controls {
class Separator1;
class Separator6: Separator1
{
x="34 * ( 5 * (pixelW * pixelGrid * 0.50))";
};
};
};
};
};
how should i choose the IDCs for my controls?
In the biki, it is said that player can be a remote object on the players PC. How can this happen? Possibly with selectPlayer?
"When user is joining dedicated server mission, at the moment of onPlayerConnected the player object is remote to the joining client, as the player unit is created on the server, but once control of the unit is passed to the user moments later, the player objects becomes local to the client and stays local." from https://community.bistudio.com/wiki/player
This is one possible scenario, but how is this video explained? KK has control in this video but player isn't local 
https://www.youtube.com/watch?v=m6IILtfa3cQ
probably something with selectplayer on a remote unit then, comment on the wiki says that if you selectplayer to a unit whose leader is a different player you get half control over it
i guess you'd have to experiment with that a bit if you wanna find out more than what the wiki says
Pretty sure there are timing bugs with selectPlayer too, but they're hard to replicate.
just check what other IDCs that disp uses
or just don't use IDCs (set it to -1). use the onLoad EH to register your ctrl
you need to register them? it just works for me without doing anything
or do you mean obtain reference for coding when you say register?
How does Arma 3 select weapon for vehicle ai crew member according to target type? Is there script or Fsm for it? I want to investigate how is it selected or is it random, in example what script is responsible for selecting mg for enemy infantry or heat vs enemy vehicle
so whats the go with "setTerrainHeight" JIP mode
// first update
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]];
// second update - this will update the JIP queue properly
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 50], [1000, 1005, 25], [1005, 1005, 25]]];```
in second update there is a 50 instead of a 25
is that intentional?
yes
from how i understand it, if you give it the same batch of positions the second time you edit something from that batch, it will remove the old info about that batch from the jip queue
the good and the bad example visually have the same effect, just after the good example, the jip queue will look like this:
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 50], [1000, 1005, 25], [1005, 1005, 25]]];
``` and after the bad example it will look like this
```sqf
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]];
setTerrainHeight [[[1005, 1000, 50]]];
however that's all i can gather from the examples, there's a lot more i'd like to know about this
for example at what point the jip queue being filled becomes problematic
and if setting points to their original height along with neighboring points instead of not modifying them is a good or bad idea
and how big the difference in load on the jip queue is between setting two seperate points individually versus setting both in the same command
i dunno i'd sure love language oop support and references/pointers
also the interpreter implementation could probably be better
does the code from an action added by addAction run locally?
Yes
good to hear, thanks
Hello, I have a few scripts that (together) respawns players with the loadout they died with. I was wondering if there is a way to adjust these to also check (on respawn) if the player has an item? and if they dont, to add it to their inventory.
initPlayerLocal.sqf:
player addEventHandler ["Respawn",{
params ["_newObject","_oldObject"];
deleteVehicle _oldObject;
}];
player addEventHandler ["Respawn",{
player switchMove "UnconsciousFaceDown"; player playmove "UnconsciousOutProne";
}];
onPlayerKilled.sqf:
player setVariable ["Saved_Loadout",getUnitLoadout player];
onPlayerRespawn.sqf:
player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
Basically as a failsafe to players loosing their radios is what I intend.
i think you need https://community.bistudio.com/wiki/assignedItems for that
if(!("ItemRadio" in (assignedItems player))) then { hint "player has no radio!"; };
the radio may still be in inventory just not assigned to a slot
where would I put this?
onPlayerRespawn.sqf?
yes
Hello!. I have a init.sqf inside my mod. I want it to postinit. To simply check if the init.sqf is executed i placed systemchat commands in the init.sqf:
systemChat "init.sqf started";
My init.sqf is not exectued. I put this in the config:
class CfgFunctions {
class DynamicAirportsPLUS {
class Init {
postInit = 1;
file = "DynamicAirportsPlus\init.sqf";
};
};
};
i launch the mission from the editor to test it if that has maybe influence?
if I had a circle I wanted to shrink by 10% every minute, what would be a good way to do it? (it's in multiplayer)
10% of the diameter, or 10% of the surface? :p
what do you have right now?
I have the circle marker and I know which function to use to change the size
If I wanted it to check if the unit has any item in their radio slot, is there a way of doing this too?
since that would be more reliable since im using TFAR
Kinda crude, but I'm not sure there's any other way to efficiently do it.
((getUnitLoadout player select 9) select 2) isNotEqualTo ""
getUnitLoadout's 9th index is all of the "assignedItems" but with static indexes. the 2nd index of that array is the radio
On server, you'd have a loop with a sleep that periodically makes the marker smaller. Using setMarkerSize, it has a global effect, meaning it will make change the marker size for every player on the server.
Ex.
[]spawn{
private _marker = "yourMarkerName";
private _decreaseSize = ((markerSize _marker) # 0) * 0.1;
while {(markerSize _marker select 0) > 0} do {
uiSleep 60;
_markerSize = (markerSize _marker # 0) - _decreaseSize;
_marker setMarkerSize [_markerSize,_markerSize];
};
};
oh sweet, thanks! Where should I put this if I only want to run on the server?
You could put it in the init of server, or a function on the server that you call.
Could also just put it in the init of the mission and check for isServer.
Like
if (isServer) then {
//MarkerCodeHere
}
alright, cheers
is there a way of making map markers dissapear and appear depending on zoom levels?
Like how it is on the map already with things like this
there is, but it is one big scripted thing
see:
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#Map to add a zoom check… which I don't know where it is
@winter rose with "setVehicleRadar", would be good to have link to "isVehicleRadarOn"
on wiki
hm, that seems complicated
added to the seeAlso
How can I take an array that is in a string and convert it back to a normal array?
eg: "['test','123']"
thanks!
@stray flame if it were me I'd do something like this
if (isNil 'TAG_myMarkers') then {
TAG_myMarkers = [];
};
if (!isNil 'TAG_mapCtrl') then {
((findDisplay 12) displayCtrl 51) ctrlRemoveEventHandler ['Draw',TAG_mapCtrl];
};
TAG_mapCtrl = ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler [
"Draw",
{
params ["_control"];
if ((ctrlMapScale _control) > 0.5) then {
{
if ((markerAlpha _x) > 0) then {
_x setMarkerAlphaLocal 0;
};
} forEach TAG_myMarkers;
} else {
{
if ((markerAlpha _x) isEqualTo 0) then {
_x setMarkerAlphaLocal 0.5;
};
} forEach TAG_myMarkers;
};
}
];
add your markers to TAG_myMarkers list
that flow will hide the markers when you zoom out
oh there is BIS_fnc_isInZoom too
https://community.bistudio.com/wiki/BIS_fnc_isInZoom
here is my take: ```sqf
VAL_fn_mapMarkersEH = {
if !hasInterface exitWith {};
if (isNil 'TAG_myMarkers') then {TAG_myMarkers = [];};
addMissionEventHandler ["Map", {
params ["_mapIsOpened", "_mapIsForced"];
if (cameraOn != player) exitWith {};
if !(alive player) exitWith {};
if !("ItemMap" in (assignedItems player)) exitWith {systemChat "You don't have a map in your inventory";};
if !(isNull findDisplay 160) exitWith {};
if (_mapIsOpened) then {
systemChat "MAP active";
if (isNil "V_MAPOPEN") then {V_MAPOPEN = false;};
[] spawn {
if (V_MAPOPEN) exitWith {};
V_MAPOPEN = true;
while {V_MAPOPEN && alive player && "ItemMap" in (assignedItems player)} do {
if ([0.001, 0.02] call BIS_fnc_isInZoom) then {
{
hint "Zoom level is in between 0.001 and 0.02";
if ((markerAlpha _x) > 0) then {
_x setMarkerAlphaLocal 0;
};
} forEach TAG_myMarkers;
} else {
{
if ((markerAlpha _x) isEqualTo 0) then {
_x setMarkerAlphaLocal 0.5;
};
} forEach TAG_myMarkers;
};
sleep 1;
};
V_MAPOPEN = false;
};
} else {
V_MAPOPEN = false;
systemChat "MAP inactive";
};
}];
}; ```
☝️ Should be slightly less performance intensive...
There is also GPS, Arty computer and UAV Terminal maps that aren't considered here
Is there a way to have it so when a vehicle is spawned, it's marked as a different side then normal?
Like, spawn a NATO car, on the map it shows are blue. But instead, I'd want it so the car is considered CSAT unless otherwise known.
(The vehicles I wanna use are technically nato, but I want them to be used by CSAT, so- x3)
call and compile it?
probably easiest way to do that is to use the https://community.bistudio.com/wiki/BIS_fnc_spawnVehicle
the last parameter is the side
Hmm- it seems that the side might be refering to the crew spawned with it, not what that vehicle is shown as.
you can only affect the crew side, not the vehicle side
ah yea, that's what I was wondering
B/c you have a crewed vehicle in the distance you see for a split second, it'll be marked by what side normally operates said vehicle. Then as you get closer, it will change depending on what side the crew is actually on
No way to change that without have a new vehicle in config with another side.
Aww.
sounds like a bug in arma
No- I mean, to me atleast, it makes sense
You see it, but you can't see the crew, thus you'd assume it's on the normal side it'd be found on
You can try having it crewed by invisible uav ai of the desires side, certain elements disabled so it doesn't do undesired things like maybe shoot
But anyway, I got halo assets. Players are insurgents, but they are actually on Nato, the the enemy is vice versa.It's not SUPER important, since it's only visual,
Just, I can see someone doing the "Seeing the vehicle for a split second, so it has normal side colors" then it gets attack/ignored and then- well- yeeea xD
if you want something like this really badly you can always disable the vanilla markers (via disableMapIndicators) and draw your own markers
eh
Now its adding {} before/after it
The exact example in https://community.bistudio.com/wiki/BIS_fnc_isInZoom gives an error: Type number, expected array, line 16.
Maybe the wiki needs to be updated because the command changed its syntax?
well not "maybe", totally
do you happen to know the syntax?
(also #community_wiki exists)
fixed, thanks for the report
Anytime. PS: That was quick!
_myString = str _myArray;
_myOtherArray = call compile _myString;```
thats wh— wait
yeah i was thinking of the syntax, should have said compile and call
won't work in all cases though
for example _myArray = ['te"st']; _myString = str _myArray; _myOtherArray = call compile _myString;
I need a script to activate if these items are NOT equipment by the player, anyone got any idea whats wrong with this?
player addEventHandler ["InventoryClosed",
{
params ["_unit", "_container"];
if
(!(goggles player in
[
'Mask_M40',
'Mask_M40_OD',
'Mask_M50',
'G_AIrPurifyingRespirator_02_black_F',
'G_AIrPurifyingRespirator_02_olive_F',
'G_AIrPurifyingRespirator_02_sand_F',
'G_AIrPurifyingRespirator_01_F',
'G_RegularMask_F'
]))
then
{
["Marki_DutyFactor", 1] call ace_advanced_fatigue_fnc_addDutyFactor;
};
}];
in is case-sensitive, and you use AIr instead of Air perhaps
also just because you attach an EH to player doesn't mean _unit is always the player. the EH is attached to the current player object. it may change due to team switch for example
Doubt it, because this which checks if I got items equipped works great
player addEventHandler ["InventoryClosed",
{
params ["_unit", "_container"];
if
(goggles player in
[
'Mask_M40',
'Mask_M40_OD',
'Mask_M50',
'G_AIrPurifyingRespirator_02_black_F',
'G_AIrPurifyingRespirator_02_olive_F',
'G_AIrPurifyingRespirator_02_sand_F',
'G_AIrPurifyingRespirator_01_F',
'G_RegularMask_F'
])
then
{
["Marki_DutyFactor", 3] call ace_advanced_fatigue_fnc_addDutyFactor;
};
}];
Oh fair point
how's that any different from the last code?
!
use else… then
One is (code) other is (!()) code
player addEventHandler ["InventoryClosed",
{
params ["_unit", "_container"];
if (_unit != player) exitWith {};
if (goggles _unit in
[
'Mask_M40',
'Mask_M40_OD',
'Mask_M50',
'G_AIrPurifyingRespirator_02_black_F',
'G_AIrPurifyingRespirator_02_olive_F',
'G_AIrPurifyingRespirator_02_sand_F',
'G_AIrPurifyingRespirator_01_F',
'G_RegularMask_F'
])
then // I haz filters
{
["Marki_DutyFactor", 3] call ace_advanced_fatigue_fnc_addDutyFactor;
}
else // I no haz filters
{
["Marki_DutyFactor", 1] call ace_advanced_fatigue_fnc_addDutyFactor;
};
// kthxbai
}];
I doubt that's the problem tho 
@little raptor using ADT, if I want to find config values that aren't empty strings, would I use ^(?!\s*$).+ for regex?
using search function
I think you also need to account for the "" 
".+?"?
yeah i haven't used regex before so I'm just sluffing through the read material atm
yeah the hashmap eats a lot of space 
I recommend getting a config dump
the one in my mod doesn't work either 😅
are you trying to search in vanilla configs?
I have vanilla plus cup. Just looking at how they differently define magazine sounds.
CUP seems to use cfgMagazines, while vanilla I'm still searching for
well you can compare the configs directly
just copy 2 config classes
(ctrl+shift+c)
then paste them in VSCode or something
then use diff
or if you want I can get you an AIO dump
(or get it yourself if you have the diag exe)
I noticed they have them in different parents/siblings/childen. CUP uses the magazine class directly, vanilla doesn't seem to use any of the parents that I'm searching through, nor the class directly so that's where I'm trying to find the parent that doesn't have reloadMagazineSound[]={"",1,1}
all to help someone who asked a question on the subreddit lol
well do you want a config dump?
sure I could use one for future reference
I can make my own with diag_exportConfig right?
if you still want it I can DM it
if you have it and you don't have to go out of your way to get it, I'll take it
Okay I like your solution more, thanks
I'm trying to change the texture on Land_Boxloader_Fort_Helipad_Tarp via setObjectTextureGlobal and it's not working. It doesn't have hideSelection. Is there a way to create a fix for it by making a mod that replicates everything except the lack of hideSelection?
unless you make your own model that replaces the existing one i dont think so
I was more thinking of making a new config file that includes the hideSelection so I can use setObjectTexture on it, overriding the default config.bin for the object.
for that to work a vertex group defining the hidden selection needs to be in the model
Oof. That sucks. 😦
you were already told the answer is a no, it is not possible
^ this will not work when the array contains anything else than booleans, numbers or strings
Also call compile str triggers me
yep, a case of crossposting
I'm trying to make a list _camp_grp that includes all the objects synced with an object called trapezoid1 for example. I have "trapezoid" coming from a string called _ao_trim and the 1 is a random int between 0 and 3 called _pick. The code I currently have is
_camp_grp = synchronizedObjects format[_ao_trim + str _pick];but it is throwing an error.
synchronizedobjects takes an object as an argument, not a string
i assume you're trying to select a random one of 4 objects
in that case try ```sqf
_camp_grp = synchronizedObjects (selectRandom [trapezoid0, trapezoid1, trapezoid2, trapezoid3])
you could probably also do ```sqf
_camp_grp = synchronizedObjects (call compile (format[_ao_trim + str _pick]));
or missionNamespace getVariable (_ao_trim + str _pick) for that matter. Still not recommended :3
why even use format when it does nothing?
I'm a beginner idk :P
what does No alive in 10000 ms, exceeded timeout of 10000 ms showing up in my rpt mean?
Ello, sorry for interjecting but can I add some code to the init of any unit using script?
yes
How 8)
just so i'm not misunderstanding you, you want to have a script running in the editor that writes things into units init fields?
More or less, I want to add some code in the init of a specific unit using a script 8)
:0
this is the command you're looking for
Thank you so much!!
i think the init fields name is "init"
what do you mean?
game freeze for over 10s?
could be, i was tabbed out and looking at the rpt when it appeared
Does anyone has a good config for sqf drawLaser [ eyePos player vectorAdd [0, 0, 0.1], getCameraViewDirection player, [1000, 0, 0], // Bright red [], 5, 20, -1, false ];
so that it looks like a laser coming from the weapon but it is visible? The default values here are not realistic looking at all
This is how this code looks
It doesn't follow the weapon though but your character's view direction
i wonder if https://community.bistudio.com/wiki/weaponDirection is render scope
Anyway to make the laser come out of the weapon barrel? I tried: ```sqf
VAL_fn_drawLaser = {
if !(isNil "V_PLAYERLASEREHID") exitWith {removeMissionEventHandler ["Draw3D", V_PLAYERLASEREHID]; V_PLAYERLASEREHID = nil; systemChat "Weapon Laser Off";};
V_PLAYERLASEREHID = addMissionEventHandler ["Draw3D", {
drawLaser [
getPosWorld currentWeapon player vectorAdd [0, 0, 0.1],
(player weaponDirection (currentWeapon player)),
[1000, 0, 0], // Bright red
[1000, 0, 0],
1,
1,
100,
false
];
}];
systemChat "Weapon Laser ON";
}; ```
But sqf getPosWorld currentWeapon player vectorAdd [0, 0, 0.1] Is giving me "type string, needed object" error
https://community.bistudio.com/wiki/selectionVectorDirAndUp
This does work finely on my end IIRC
yeah you'll need to get weapon muzzle selection with selectionPosition and selectionVectorDirAndUp
Its also complicated if you want exact end of the muzzle
Is there an equivalent to sqf eyePos player but like barrelPos currentWeapon player?
I don't think so
I remember it involved something like spawning your weapon as simple model, finding its muzzle end offset and vectors, then deleting it and using the offsets
What about getting the physical location that the laser attachment is supposed to go? Maybe that?
I've used selectionPosition + createSimpleObject + selectionVectorDirAndUp to determine where is the pos
No commands to do that off a weapon held in hands, you'll need a simple object to get offsets
Nothing is easy in Arma
My Mod Visible Laser does terrible workaround there
there is the "usti hlavne" selection, but i guess you cant do <weapon> selectionposition "usti hlavne"
Yeah a weapon on hand is not an object
Maybe if we have a command to get a proxy info
It is an object actually, you can get it with cursorObject, I wonder if you can run selectionPosition against it? 🤔
🤔
But there is nothing like primaryWeaponProxy player to return it normally
So even if you could, its useless
it comes up in selections as a proxy
theres no nice command to get proxy objects of player i dont think
selectionNames can get it, but kinda iffy
Yeah, but you can't get an actual world object that is used as proxy, only positions and vectors where proxy is
At least we have a workaround
cursorObject => NOID mx_f.p3d when you aim at a weapon in unit's hands
Yeah, simple objects is the way to go
Hmm if so maybe we can get it with nearEntities?
Just tested it, it works
[cursorObject, cursorObject selectionPosition "usti hlavne"]
=>
[NOID mx_f.p3d,[-0.32957,0.000438549,0.0830223]]
Gud to know
Not sure if any commands return these proxies, cursorObject returning it might be an oversight
This seems to work: sqf player selectionposition "weapon"
Huh, guess that should also return it
my guess is we can actually get the muzzle pos, but that it will take some guess work to make up for lack of _objects = proxies player command
you'd have to do constant projecting lineintersectssurfaces to get the active proxy
and where to where, i guess "righthand" in a few directions
https://community.bistudio.com/wiki/modelToWorldVisual says it also takes: modelPos: Array - in format PositionRelative ([x,y,z] offset relative to the model centre)
But when I try to use it with sqf player selectionPosition "weapon" which is a Position Relative it says "Type Array, expected Object"
So the wiki could be outdated or am I doing something wrong?
This is what I am trying to do: sqf (player selectionPosition "weapon") modelToWorldVisual [0,0,0];
hey people, I have an issue creating a custom unit
in my mission i want a plot caracter (AI that will help the player) for testing purposes i'll name it Bob but i got issues scripting the new class, and making in appear with this command bob = createUnit ["B_BOB_F", position player, [], 0, "NONE"];
here is as well my script for Bob
selectionPosition returns position, modelToWorld needs object
But you need to move your BOB_NATO_Unit inside CfgVehicles
The amount of comments makes this looks like ChatGPT output
Is there a way to transform a relative position in model space to ASL? For example: sqf _posASL = relativePosToASL (player selectionPosition "head");
modelToWorld
modelToWorldVisual
modelToWorldVisualWorld
modelToWorldWorld
Second "World" here is ASL
Arma tier command naming
did u have a go at the lasers @meager granite ?
i got something working, but theres some imprecision in the weapon selection points
give this a go
should just work for paste & go in editor
of course only works for players gun
KK! Testing now!
Yeah, I use shift + L
Just tested your script, works perfectly! But I got basically the same results with just this:
VAL_fn_drawLaser = {
if !(isNil "V_PLAYERLASEREHID") exitWith {removeMissionEventHandler ["Draw3D", V_PLAYERLASEREHID]; V_PLAYERLASEREHID = nil; systemChat "Weapon Laser Off";};
if (currentWeapon player isEqualTo secondaryWeapon player) exitWith {systemChat "Weapon Laser NOT AVAILABLE";};
V_PLAYERLASEREHID = addMissionEventHandler ["Draw3D", {
private _laserStart = AGLToASL (player modelToWorldVisual [0.23,1.13,1.4]);
private _laserDir = (player weaponDirection (currentWeapon player));
call {
if (stance player isEqualTo "STAND") exitWith {
if (currentWeapon player isEqualTo primaryWeapon player) then {};
if (currentWeapon player isEqualTo handgunWeapon player) then {_laserStart = AGLToASL (player modelToWorldVisual [0.17,1.1,1.4]);};
};
if (stance player isEqualTo "CROUCH") exitWith {
if (currentWeapon player isEqualTo primaryWeapon player) then {_laserStart = AGLToASL (player modelToWorldVisual [0.20,1.13,0.9]);};
if (currentWeapon player isEqualTo handgunWeapon player) then {_laserStart = AGLToASL (player modelToWorldVisual [0.17,1.1,0.8]);};
};
if (stance player isEqualTo "PRONE") exitWith {
if (currentWeapon player isEqualTo primaryWeapon player) then {_laserStart = AGLToASL (player modelToWorldVisual [0.29,1.3,0.27]);};
if (currentWeapon player isEqualTo handgunWeapon player) then {_laserStart = AGLToASL (player modelToWorldVisual [0.27,1.13,0.3]);};
};
};
drawLaser [
_laserStart,
_laserDir,
[1000, 0, 0], // Bright red
[1000, 0, 0],
1,
2,
100,
false
];
}];
systemChat "Weapon Laser ON";
}; ```
yea nice
The only improvement from your script that I could think of is using: sqf private _handPos = player modelToWorldWorld (player selectionPosition 'righthand'); instead of the sqf AGLToASL (player modelToWorldVisual [0.23,1.13,1.4]); that I use... And the benefit would be better laser when leaning
Thanks, and if could complement mine with your right hand stuff would be perfect
Then we will have the ultimate laser weapon that is not a resource hog
there is some weakness in both when looking straight up or straight down
i think thats just weapondirection sucking
Yes, the laser stays higher than the weapon when looking down and vice versa when looking up
I think it is because we are not really using the weapon as the starting point, but rather an approximation of it
And when you look down or up, the weapon model moves but not your model, and we are using the player model to measure the starting point
Too bad Arma is missing a way for getting the posASL of the weapon barrel
Anyway, we got pretty close without destroying our FPS or using mods
That is a win in my book
i tried to get the world pos of the weapon but didnt work... banged it out fast so i dont know, maybe is possible
How to watch connect/disconnect UAV Terminal events?
When player connecting and disconnecting to UAV.
IIRC there is an Eventhandler for it
Oh yeah I misremembered
is it possible for a weapon to fire a projectile that doesnt have physical atttributes? aka just play a sound when fired?
I just remembered that there is unitsBelowHeight
So you can do
_units inAreaArray _trigger unitsBelowHeight 10
```to get units inside the trigger and at certain height limit
Wish there was complimentary:
ENTITY isBelowHeight NUMBER
```for a single entity check
to use with single inArea
Nope, didn't end up trying it, but it shouldn't be too hard
I swear to god, trigger locality is ruining my brain 😕
don't use triggers then
- a trigger is local to the machine on which it is created
- a trigger not made "server-only" is created on each and every machine
- a trigger can run commands that have global effect
that's about all you should know
@mellow scaffold ↑
Well, I am creating a local trigger (createTrigger with false as third arg), but it wasn't firing anywhere when I tried yesterday, I'm about to do another dive on it with a fresh mind.
roger roger!
Insight #1: it's thisList, not _thisList
Insight #2: if you're adding debug logging to a trigger, do it outside of {} foreach thisList; because you may have gotten #1 wrong.
It is a bit silly tho that getting #1 wrong in trigger code/foreach does not elicit an error (it's probably the semantics of {} foreach nil)
It doesn't
I've already posted that script several times
it is because a trigger code is unscheduled and errors are not (always?) shown there
Yeah, that's what I figured. EH (sometimes?) have the same problem
@pulsar bluff @wind hedge
Anyhoo. Now I need to wait for my trusty community member that helps me with testing to see if I finally got triggers right. This thing almost always worked in local MP, but broke hilariously with just 2 players on a DS. And if I can't get it to work, I'll have to make my own shitty trigger implementation using area markers and inArea 😄
You can test things yourself btw
gonna put it on selectionVectorDirAndUp for people to find it
how can I check if a unit vest has a holster?
tried selectionNames but pistol_holstered.001 are in every vest so pls help
And getNumber (configfile >> "CfgWeapons" >> vest player >> "ItemInfo" >> "showHolsteredPistol") always 0
I mean, I have tested it with just me on the DS and it works fine, but so did the old code. True locality of code testing I'd rather do with more than one human connected
im curious did someone use ChatGPT to make an arma 3 script and it worked?
To make from zero, it makes nonsense. To tweak, slightly useable
It's alright. Tho you should probably also mention that it also shows it using a drawLine3D
given it's onEachFrame people should know it is test code 😄
What's the usual consensus for how big the float returned from checkVisibility has to be for "realistic" spotting of AI vs humans? (also, does it take the distance into account or do I have to scale the returned value?)
Anything larger than 0
But AI doesn't use that exact command
Also no it doesn't take day/night/distance into account
fog too
I see. Thanks!
day/night/distance/fog is not used, only "obstacle/particle on the line" correct?
would do?
I'll probably use visibility plus knowledge (knowsAbout) to get a vaguely consistent modeling of how humans would see
Can anyone tell me how to assign certain units certain roles for cfgRoles and the purposes of respawning? I need certain units to have different loadouts from normal even though they're both ostensibly the rifleman unit.
it works fine for basic tasks, if instructed properly
"fine"
i mean it can effectively answer most of the questions asked here for pre-2021 script commands
"setTerrainHeight" example is driving me nuts
// first update
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]];
// second update - this will update the JIP queue properly
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 50], [1000, 1005, 25], [1005, 1005, 25]]];```
why is there a 50 in the second update
it is a value difference
it basically says "update the same batches otherwise the JIP queue does not overwrite and gets clogged"
hmm k
I mean
you still get only one batch in JIP queue. Because X/Y coordinates still match 
As always, @little raptor to the rescue! Thank you! By the way I merged my script with yours and while it works perfectly!
@pulsar bluff Thanks to @little raptor got it working perfectly! If you want to update your mod @warm hedge : https://forums.bohemia.net/forums/topic/241891-release-visible-weapon-lasers-proof-of-concept/?do=findComment&comment=3473994
Hi lads, had an interesting query over on the arma discord, thought Id post the result for other modders: // QS Visible Lasers // Custom laser point offsets QS_laserOffset_array = [ // element format: [arifle_mx_f,[0,0.25,0]], // element format: [srifle_LRR_f,[0,0.25,0]], // element format: [arif...
sqfbin
It fits!
your code fits in sqfbin yes
Here too! 5 more characters left
wrong criterion
(wall of code = no place here)
wall of french related emojis however...
what?
Isn't the current limit there for a reason? Just reduce it to 0 characters then...
But allright
the current limit is set by Discord.
our current limit is "don't place walls of code here".
👌
Guys, I am doing a script that adds weapon inspection. I am just lacking animations for primary and secondary weapons. Anyone knows ones that work?
probably best asking in a different channel -- but i think you may be needing gestures not animations
Yeah, tried all the gestures... none for inspecting weapons. This one works for pistols: sqf player switchmove "Acts_Examining_Device_Player";
then you may need to make ur own
Well, a mod is out of the scope for this project, as it is a purely vanilla mission. Will continue trying different animations
hi guys, I would like to know how to detect if an artillery piece has fired its cannon. Im guessing one would use the Fired EH? But im not sure on how to use it in this case, since it doesnt give me a simple true/false return (afaik) which im after.
My code currently looks like this:
_salve = 0;
while { _salve < 4} do {
private _randomartpos = [[art_area],[]] call BIS_fnc_randomPos;
art doArtilleryFire [_randomartpos, "rhs_mag_155mm_m795_28", 1];
private _readystate = (weaponstate m109) select 5;
waitUntil {_readystate == -1};
sleep 1;
_salve = _salve + 1;
hint str _salve
};
I would like to swap the waitUntil condition to something that turns true if the artillery has fired, because right now the gun takes so long to adjust that _salve reaches 4 before the first shot has been fired.
https://community.bistudio.com/wiki/doArtilleryFire comments suggest you need to use unitReady to check if fire was done or not
Maybe you won't need an event handler here at all
damn, I tried that initially but checked if the gunner of the artillery was ready and that didnt work. Turns out you need to check if the vehicle is ready. So it works now, the only thing that bothers me a bit is that after each round, the gunner "resets" the gun, or rather wants to put it into the neutral position where as I would like it if he kept it aiming high. Would you know how to achieve that?
doWatch in general direction of the target?
Not sure how it messes with unitReady though
ill try quickly
Making AI do what you want it a huge PITA
Maybe do something like ```
art doTarget objNull;
art doWatch objNull;
art doWatch <direction-to-target-position-here>;
Not sure if this resets after firing or messes up unitReady, I suck at AIs
Your doArtilleryFire statement only fires one round at a time. Try setting it to four rounds: art doArtilleryFire [_randomartpos, "rhs_mag_155mm_m795_28", 4]
ok, tried this:
while { _salve < 4} do {
private _randomartpos = [[art_area],[]] call BIS_fnc_randomPos;
art doArtilleryFire [_randomartpos, "rhs_mag_155mm_m795_28", 1];
art dowatch _randomartpos;
waitUntil {sleep 0.2; unitReady m109};
_salve = _salve + 1;
hint str _salve;
};
he only stays on the azimuth to target but not on elevation
that is intentional
because i want to cover a larger area and doing it the way you propose i only get the natural spread of the gun which isnt enough
You can mess with arty shell velocity on Fired event handler to get larger spread
hmm
is there no way to retrieve the current elevation and azimuth of the turret? Arent there indicators for this on some of the vanilla vehicle turret optics? They somehow must obtain that info from somewhere right?
private _vector = _vehicle weaponDirection currentWeapon _vehicle ;
private _azimuth = (_vector select 0) atan2 (_vector select 1);
if(_azimuth < 0) then {_azimuth = _azimuth + 360;};
private _elevation = asin(_vector select 2);
```Code I use in my mission
It might be a little smoother (in terms of animations) using the EH, but I don't know for sure:
ArtyRounds = 0;
art addEventHandler ["Fired", {
if (ArtyRounds < 4) then {
art doArtilleryFire [[[art_area],[]] call BIS_fnc_randomPos, "rhs_mag_155mm_m795_28", 1];
ArtyRounds = ArtyRounds + 1;
} else {
art removeEventHandler [_thisEvent, _thisEventHandler];
};
}];
art doArtilleryFire [[[art_area],[]] call BIS_fnc_randomPos, "rhs_mag_155mm_m795_28", 1];
ArtyRounds = ArtyRounds + 1;
what is the lower portion of the code for?
ill try that 👍
Using the EH may have drawbacks in multiplayer though, because the Fired EH essentially only works where the vehicle is local.
private _azimuth = (_vector select 0) atan2 (_vector select 1);
What is atan2 here?
addEventHandler doesn't make the unit fire, so the last two lines are needed to make the unit fire the first round. When the first round is fired, the EH takes over and makes it fire more rounds as programmed.
ah ok
Sure, you can work around that limitation somehow if needed, the code just gets more complex.
ok, that did the trick
only thing that needed changing was that the eventhandler needed to be placed on the vehicle itself
lets say i wanted to use that script on a larger multiplayer mission and use it somewhat frequently, would i be better of making it a function?
Of course 🙂
and if i included more than one artillery piece, would there be a more "elegant" way of doing so or would i be fine if i took what i have here and simply copied the eventhandler onto the other pieces?
Arctangent: https://community.bistudio.com/wiki/atan2
i thought so 😄 but i didnt know what the 2 stood for
Needs a little adjustment because ArtyRounds is a global variable, but other than that it can be used with multiple units at once.
eventhandlers couldnt acces local variables that got defined in the same script file right?
Its just a quicker function so you don't have to divide and handle 0s yourself
No, they can not.
An easy way to adjust the code would be using art setVariable ["OB_ArtyRounds", _artyRounds] (plus getVariable to get the current value).
hmm, couldnt you simply define the variable inside the EH and instead of it counting to 4 you count till 3?
no because itd define as 0 every time
No, because all local variables from the EH scope are destroyed when the EH code is done.
as well as that
dammit
why exactly use art as the object here? I dont understand the varspace parameter in this command
"any random thing that can be used to link the variable to" 
is there any good way to identify which object in 3den is which object when playing the mission without assigning variable names or attributes?
the only thing i can think of is to log classes and positions to an external file and compare them on mission start
or is there a way to somehow get an objects 3den ID while the mission is running?
the proper answer to this is: what do you want to do
The problem when using the original script with multiple units is that all units would be sharing (i.e. reading from and writing to) the same ArtyRounds variable from the missionNamespace (see https://community.bistudio.com/wiki/Namespace to learn more).
You can't have multiple variables with the same name in the same namespace, but every object has its own varspace (i.e. mini namespace), and it is possible to have several different variables with the same name in different namespaces.
We can take advantage of that by using art setVariable ["OB_ArtyRounds", _artyRounds], because now we can store a different OB_ArtyRounds variable on every unit.
i want to initialize trenches with data about them that i have already saved to an external file (created on 3den save). which trench in the file is which in the mission is what i need to identify. in 3den and 3den preview i can use 3den IDs for that, if the mission is loaded without 3den i can't use 3den IDs afaik.
i don't want to give them variable names or other attributes because that shows up in 3den undo history.
then grab getPosWorld + vectorDir + vectorUp, while not impossible a conflict is quite unlikely
if you need global variables w/ no conflict just use random large number but thats not the greatest of ideas
uuid function would be better
ok, that sounds pretty nested ngl 😄 But I think I understand now, thank you very much 🙂
so that means if i have have two more vehicles called art2 and art3 i would simply write art2 setVariable ["OB_ArtyRounds", _artyRounds];? or art3....
Make it a function, just like you suggested earlier, then it's much easier:
params ["_artillery"];
_artillery addEventHandler ["Fired", {
params ["_artillery"];
private _firedRounds = _artillery getVariable ["OB_firedRounds", 0];
if (_firedRounds < 4) then {
_artillery doArtilleryFire [[[art_area], []] call BIS_fnc_randomPos, "rhs_mag_155mm_m795_28", 1];
_artillery setVariable ["OB_firedRounds", _firedRounds + 1];
} else {
_artillery removeEventHandler [_thisEvent, _thisEventHandler];
};
}];
_artillery doArtilleryFire [[[art_area], []] call BIS_fnc_randomPos, "rhs_mag_155mm_m795_28", 1];
_artillery setVariable ["OB_firedRounds", 1];
```That way you can just use `[Art1] call OB_fnc_artilleryFire`, `[Art2] call OB_fnc_artilleryFire`, ...
Surprisingly, getDir seems to be faster than doing the math
//Execution Time: 0.0020 ms | Cycles: 10000/10000 | Total Time: 20 ms
private _azimuth = (wepDir select 0) atan2 (wepDir select 1);
if(_azimuth < 0) then {_azimuth = _azimuth + 360;};
_azimuth
//Execution Time: 0.0014 ms | Cycles: 10000/10000 | Total Time: 14 ms
_azimuth = [0,0,0] getDir wepDir;
_azimuth
yeah, less commands to run
Binary getDir wasn't a thing when I wrote that piece of script (2012 in OA or something)
when you had to code uphill both ways!
private _azimuth = ((wepDir select 0) atan2 (wepDir select 1) + 360) % 360;
should be faster than the if
i have a function that doesn't work. it just doesn't execute when i call it. there's no errors in the rpt, nothing.
if i comment out everything but line 1, it executes, so the problem must be somewhere in the code.
what should i be looking for to find the problem?
https://sqfbin.com/kurunumozelitawubari
then it fails to compile
how do i figure out what causes it to fail?
it's most likely one of the macros
imma mess with those and check if it works
just to check type ELD_magicTriangle_scripts_fnc_3DENMissionPreview in debug console
see what it returns
I'm gonna guess it's either {} or just nothing
then it should execute
how do you execute it?
from the OnMissionPreview EH aswell as directly with call
neither does anything
[[], [], [], []] call ELD_magicTriangle_scripts_fnc_3DENMissionPreview;
ok i tinkered a bit with it and it works nicely so far. How would i go about being able to choose how many times the artillery fires through the call? I tried this but it obviously didnt work 😄
params ["_artillery","_fireGroups"];
_artillery addEventHandler ["Fired", {
params ["_artillery"];
private _firedRounds = _artillery getVariable ["FEC_firedRounds", 0];
if (_firedRounds < _fireGroups) then {
_artillery doArtilleryFire [[[art_area], []] call BIS_fnc_randomPos, "32Rnd_155mm_Mo_shells", 1];
_artillery setVariable ["FEC_firedRounds", _firedRounds + 1];
} else {
_artillery removeEventHandler [_thisEvent, _thisEventHandler];
};
}];
_artillery setVariable ["FEC_firedRounds", 1];
_artillery doArtilleryFire [[[art_area], []] call BIS_fnc_randomPos, "32Rnd_155mm_Mo_shells", 1];
[art_v, 3] call FEC_fnc_artilleryFire; is how i call that function where 3 is what I hoped what would be picked up by _fireGroups
in my opinion that should at least write "OnMissionPreview line 1" to the rpt
my mod shows a couple of fatal errors:
