#arma3_scripting
1 messages Β· Page 73 of 1
How can i check if the player has an active target? This does not seem to work:
if (assignedTarget player isEqualTo nil) then {hint "nil";};
I guess like so
class Extended_InitPost_EventHandlers
{
class myCoolUnit
{
class blahblahblah
{
init = "[] call do_stuff_on_init";
};
};
};
class Extended_Local_EventHandlers
{
class myCoolUnit
{
class blahblahblah
{
local = "[] call do_stuff_on_local_change";
};
};
};
will do_stuff_on_init run again if the locality of the myCoolUnit changes?
!isNull assignedTarget player
you can't compare anything with nil
nil doesn't exist
oh, i see. thank you!
class EHs run on each clients iirc
dunno about the local one
I think neither one run when locality changes
ahhhhhh I dont follow. ur saying do_stuff_on_local_change wont run when the locality of myCoolUnit changes?
well dunno never used it 
the class Extended_Local probably means it gets added where unit is local
local EH needs to be added everywhere for it to trigger
again I've never used Extended_Local EHs so not sure
understandable neither have i π
My next plan is to follow wat ace does
π and learn off their pain
well it's not difficult to test.
add those 2 EHs to a vehicle
run 2 Arma instances
connect them in a mission where you have placed that vehicle in 3DEN
then make a local AI to the 2nd PC and move him into the vehicle so that its locality changes
see if they trigger again
the first one (init) won't obviously
not sure about the local one
ok so i coultdnt get it to work. im getting this error ',player': 's' encountered instead of '='
Player setvariable ["MARTA_hide",_groupListHere]; //is the script
Don't know if this question belongs here but is there any way in which I can limit the items available on a virtual arsenal per player? Say, player A gets X weapons to choose from player B gets Y and so on
did you put the groups in the list "_groupListHere" ?
no i dint so i have alpha 1-1, alpha 1-2, alpha 1-3 how would i put the groups in?
name the groups in editor to something like "theEnemy1" etc then do sqf Player setvariable ["MARTA_hide",[theEnemy1,theEnemy2]]; // etc
okay can i also name blufor and opfor units and have them in the same line?
okay let me check it out thanks for helping
im using POLO's mod, and i have someone pointing. but i was wondering how could i stop it looping so he just points forward the hole time?
im still getting \description.ext, line 0: ',player': 's' encountered instead of '='
Player setvariable ["MARTA_hide",[UAF1,UAF2,UAF3,UAF4]];
Do you mean POLPOX's Artwork Supporter?
yea
Consult this guide: https://steamcommunity.com/sharedfiles/filedetails/?id=1877568946
weird maybe there's invisible character or something i dunno
would it work with = true or some variation?
:0
config as in server config?
no
thanks
No, mission config.
Which type of config is not important right now, the point is it is a config and not a script file, you can't put ordinary SQF in it. So if that's where you've put this....don't.
If you did not put this in description.ext, then go look in description.ext because something in there is causing this error.
i put it in description.ext
Well, there's your problem
can i throw it into the server config?
thats all i know how to do
No, because this is script, not config
...Yes
i misunderstood
I've missed the part of this convo that explains exactly what you're trying to do with this script, but it probably belongs in init.sqf or something like that
yes init.sqf is one option
@proven charm @hallow mortar works just fine Thanks for being patient lmao
well shit. thats them all broken. cant undo it rip 5 hours of set up
hm was just a conflict. fixed it
- you don't use
onXXX, justXXX - also it may not make sense to add an onLoad after creation
can POLPOX's Artwork Supporter be used to make videos ?
i dont see any way to stop the looping so the guy will point in front for longer
and none of the scrips seem to work
well that didnt work
that's not its goal
do you know of anything that could suit my pointing needs?
You can script it yourself using switchMove and setAnimSpeedCoef
they dont work for that ive tried them :9
.....sure
its an object
I haven't used Artwork Supporter 2, but the original version does, as described in the guide, have a setting to freeze an animation at a moment of your choice. I would be surprised if this isn't in AS2 as well.
Question: In a "fired" event handler, I'm trying to set the velocity of a rocket projectile fired from an rpg7, so that it flies toward a specific position. I notice the projectile is not flying to the correct position. Could it be because the rocket is oriented in the wrong direction, so that its thrust is not aligned with its initial velocity?
Really? I thought you were trying to animate a unit
the anims can only be used with this
Probably. You would want to set its vectorDir (maybe vectorDirAndUp) as well, since it has its own thrust.
And what do you think that uses to apply the animation to the unit?
Hint: it's a script command
does it have to be a unit vector when setting orientation?
What's a unit vector?
Looks like it does. You can use vectorNormalized to convert if you have a...larger one
If you are going to script it yourself, you don't need the animator module (which is a front-end for applying the animation to a unit, there is still a unit involved). You just need a unit, switchMove, and setAnimSpeedCoef. But I would recommend looking a little harder (for example, scrolling down in the Unit Animator attributes to see what other options there are) in case it has its own built-in freeze thing, like the original mod does.
Did you actually find reference that it needs to be a unit vector? I just tried using a non unit-vector, and it seems to be working okay.
Could it be because the rocket is oriented in the wrong direction, so that its thrust is not aligned with its initial velocity?
the rocket that got fired? no
what you modified? maybe
what needs to be a unit vector?
All the examples use a unit vector and that's what I've used π€·
I'm wondering if the vector provided to setVectorDir needs to be unit vector.
no
it wont cause any distortion of the object I presume
no
just use setVectorDirAndUp and provide an up perpendicular to dir
they don't need to be normalized
Why use setvectordirandup, in this case I'm only interested in where the rocket is pointed toward. Does the up vector affect its flight performance somehow?
because using setVectorDir alone has "side effects"
it might rotate the up
which might affect the lift of the rocket
I would love for those side effects to be documented
hmm... you think the lift will be important for rockets like fired out of rpg7 or mawws?
i downloaded the orgnial one.. could you tell me how to frezze the anim after abit?
The guide I linked contains instructions on how to do that
well it's simple. you only provide a dir. the new up is calculated as: (dir cross up) cross dir

The wiki page says the up vector will remain unchanged, is what I'm getting at
Hey, if anybody can help me with this please reply back. I'm trying to know how to make a police beacon start with it being on, and how to make vehicles start with their doors open. I tried doing it with the W123 police car in global mobilization DLC.
if you don't change up the model gets distorted (skewed)
do you know which section?
It's really not far from the start. If you read it you will find it.
yes.
just do this:
_side = [_dir#1, -(_dir#0), 0];
_up = _side vectorCrossProduct _dir;
_proj setVectorDirAndUp [_dir, _up];
assuming _dir is not [0,0,1] ofc
I am not saying that you are wrong because the wiki page says so, I'm saying that if you are not wrong, the wiki page needs to be fixed, because it doesn't mention any of this and it seems important
ok will add
yaaay
with setVectorDirAndUp does it recalculate the up vector from the two provided? (dir cross up) cross dir)?
it didnt work 
if so, I should be able to just get away with setVectorDirAndUp [_dir, [0,0,1]], right?
if you don't make them perpendicular yes
if you do it like I showed no
maybe
I think it calculates a new side, in which case yes
you can try it
also make sure you set the velocity correctly after changing direction. you can simply use setVelocityModelSpace [0,_speed,0] after changing dir
or setVelocity (vectorNormalized _dir vectorMultiply _speed)
Hey do any of yall know how to make a police vehicle beacon turn on?
i set it at 2. and he points super quick. then moves his arm down again but only half way
For GM vehicles specifically, [this,'gm_beacons_blu',true] call gm_core_vehicles_fnc_beaconSwitch
Then 2 is the wrong time index. You probably want an earlier one to catch him mid-point.
I think vanilla vehicles have the option to turn their lights on in their Virtual Garage options. For other mods...it is a mystery
Thanks I appreciate it
that guide be wrong then?
"The box is saying some strange gibberish. They've all meanings however, but let's forget everything, and look at the β-1β. That is the time of the animation. -1 means βdon't let it stopβ. If you want to stop the animation at, let's say 3 seconds, just put 3 there."
Yes, that [the guide] is correct
Also is it possible to keep the doors open??
so 3 is super fast loop
animateDoor, for vehicles that have door animations available. GM vehicles do, and there's a post in the script snippets channel on the GM Discord explaining the animation naming scheme they use
Oh, actually they moved it to the wiki as well https://community.bistudio.com/wiki/Global_Mobilization_Script_Snippets
If you want to stop the animation at, let's say 3 seconds, just put 3 there."
I don't really know how to restate this any more clearly than the guide.
You put in 3, it fast forwards through the animation to the 3-second mark, and pauses at the 3-second mark, because you told it to stop the animation at the 3-second mark
Is there a quick way of checking if a kind of weapon is or has a grenade launcher, or is a rocket (as opposed to missile) launcher?
-1. normal.
1 slow at putting arm up. but then resets very quick.
2. same, but never puts arm all the way back down
These are values in seconds (except -1 for "loop"). They do not have to be whole seconds, and the exact number you need depends on what position in the animation you want to freeze at. There is no "right answer" I can give you.
As the guide describes, the enhanced animation viewer includes a time readout in the bottom left as the animation plays, allowing you to see the exact time you need to put in to pause at a specific point in the animation.
anyone know how to reset an objects rotation to [0,0,0]? I'm trying to do this for H-barriers that auto snap to the ground
_object setVectorDirAndUp [[0,1,0], [0,0,1]]
I'm coming into this issue where H-barriers (that typically snap to the ground on placement) are raised or lowered into the ground. I think this is due to the way i apply rotations. This only happens with H barriers
_obj = createVehicle [_objType,_pos];
_obj setVectorDirAndUp [_Vectordir, _VectorUp];
Tried this, still happens...i'm probably missing something basic hmm
re-setPosATL after rotation
tried a few variations, such as
_obj = createVehicle [_objType,_pos];
_obj setVectorDirAndUp [[0,1,0], [0,0,1]];
_obj setVectorDirAndUp [_Vectordir, _VectorUp];
_obj setPosATL _pos;
still get the above
how did you get _pos?
getPosATL
_objectClass pushBack (typeOf _x);
_objectPosition pushback (getPosATL _x);
_objectVectorDir pushback (vectorDir _x); // or vectorDir
_objectVectorUp pushback (vectorUp _x); // or vectorDir
I smell some shenanigans
i'm ripping my hair out this is so dumb lol
Can you check _pos (e.g. systemChat str _pos) to prove it actually has a Z of 0?
ok so i'm conducting a simple experiment. I have an H-barrier in place, get its information, delete it, and then recreate it.
bob = nearestObject [(position player),"Land_HBarrier_5_F"];
_objType = (typeOf bob);
_pos = (getPosATL bob);
_Vectordir = (vectorDir bob);
_VectorUp = (vectorUp bob);
deleteVehicle bob;
bob = createVehicle [_objType,[0,0,0]];
bob setPosATL _pos;
bob setVectorDirAndUp [_Vectordir, _VectorUp];
bob setPosATL _pos;
this is the result
result of getPosATL [2481.86,6708.01,1.85773]
despite it looking like its at 0 hmm
If i run this multiple times it keeps going up in z direction π’
The problem seems to be the vector somehow π€
OR its that small Z offset thats being weird
are those terrain objs?
no
then this should work
I assume you mean map originated, no i'm spawning it in through zeus/command
yeah. terrain obj = obj baked into terrain and cannot be modified
By setting to 0 i found an offset, of 0.619141 so this works
bob = createVehicle [_objType,[0,0,0]];
bob setPosATL [(_pos select 0),(_pos select 1),(_pos select 2)-0.619141];
bob setVectorDirAndUp [_Vectordir, _VectorUp];
but this isnt ideal at all? and it only happens with h barriers?
Z is measured from the engine computed land contact (if object has one)
what is the problem/question here?
This is the problem. Its spawning them in the air
or on the ground. Its dependent on the slope/incline the H-barrier is on
yes. like I said you're measuring the ATL height of a rotated object, which uses the land contact
which is rotated
this should fix your issue:
bob = nearestObject [(position player),"Land_HBarrier_5_F"];
_objType = (typeOf bob);
_Vectordir = (vectorDir bob);
_VectorUp = (vectorUp bob);
bob setVectorDirAndUp [[0,1,0],[0,0,1]];
_pos = (getPosATL bob);
deleteVehicle bob;
bob = createVehicle [_objType,[0,0,0]];
bob setPosATL _pos;
bob setVectorDirAndUp [_Vectordir, _VectorUp];
also pls stop using position/getpos... 
fixed an error in your own code (why 2 setPosATL...?)
debugging
It does work (yay) but its not ideal that i have to reset the vector of the 1st bob
I could revert it , which is fine. Just an extra bit of processing
what about this?
bob = nearestObject [(position player),"Land_HBarrier_5_F"];
_objType = (typeOf bob);
_Vectordir = (vectorDir bob);
_VectorUp = (vectorUp bob);
_pos = (getPosATL bob);
deleteVehicle bob;
bob = createVehicle [_objType,[0,0,0]];
bob setVectorDirAndUp [_Vectordir, _VectorUp];
bob setPosATL _pos;
so you did setPosATL after rotation?
Yes, i even setPos before + after rotation as you pointed out earlier. Ran it just now as you have it
Just want to say thank you, i appreciate you for answering and giving me one possible solution haha π
then try this:
bob = nearestObject [(position player),"Land_HBarrier_5_F"];
_objType = (typeOf bob);
_Vectordir = (vectorDir bob);
_VectorUp = (vectorUp bob);
_pos = (getPosWorld bob);
deleteVehicle bob;
bob = createVehicle [_objType,[0,0,0]];
bob setVectorDirAndUp [_Vectordir, _VectorUp];
bob setPosWorld _pos;
oh wow, that works perfectly. Is there a downside to using posWorld?
nice. Thanks leo!
np
Is there any risk with using checkVisibility with the VIEW LOD? For example, in places that aren't near a player.
in very far places yes
if the objects are not loaded there checkVisibility won't be blocked
also if you teleport to a new location all objects won't instantly be available
so checkVisibility might return inconsistent results with time
if there are ai fighting in an area, does that mean that VIEW and FIRE LODS are loaded there?
k thanks.
Is there a quick way to determine if a weapon is or has a grenade launcher muzzle?
I need to find a friend to do this with then lol π
you don't
you can do it on 1 PC
that's why I said run 2 Arma instances
i.e. run it twice
oh, okay ill look into that, so will then one instance be considered server (like isserver would return true on one instance and false on the other instance?)
isServer returns true on the host.
Question: Is there a best way to test if a line between two points will intercept a bullet?
What I mean is if there is anything along that line that will stop a bullet.
lineIntersectsXXX?
lineIntersectsSurfaces with FIRE geometry I guess.
I guess the "stop" part is tricky.
I'd like to ignore trees if there's a way, since grenades and rockets can go through them.
They do? :P
With lineIntersectsSurfaces you can walk through all the intervening objects and check them, but good luck reverse-engineering Arma physics.
cameraEffectEnableHUD true right after the camCreate effect
Do anybody know how to create different types of task and how to add dialouge?
1 enableChannel [true, false];
2 enableChannel false;
3 enableChannel false;
4 enableChannel false;
5 enableChannel false;``` im using this code here, it works except global chat wont disable
cannot disable Global channel for the admin or server host, because Global channel is always available for the admin
Is there a way to check if an AI has finished switching weapons?
what is the fastest way to get all players in MP? i have been using BIS_fnc_listPlayers because allPlayers gets delayed in MP start. but its slow because it loops all units to get the players. would looping allUsers work?
Fastest as in earliest since start?
Try allUsers apply {getUserInfo _x select 10} but it will probably have lots of nulls
like fast script execution
Compare execution times
BIS_fnc_listPlayers is (allUnits + allDead) select {isPlayer _x}} with some fluff
i tried but it returned 0ms for some reason, i will try again
funny you mention allusers/getUserInfo because I was just testing that in initPlayerServer,sqf and it seems to give valid player object
wow .. arma just crashed when trying to run that code
Well, I didn't try it myself, I guess it indeed contains player unit right away
Maybe its null at earlier stage, preInit or something
hmm weird result still ( 0ms ) "Result:
0 ms
Cycles:
1/10000
Code:
(allUnits + allDead) select {isPlayer _x}
how can I test preinit, in unit init field?
are you testing in MP? π
yes
well I concluded that no player objects exist in preinit. after that allUsers should have the plr object
is the Cycles:
1/10000 normal because I get 0 ms on everything? it used to work just fine
ah nvm was just too fast code
so allusers apply is too fast for testing π
For security purposes, this command will only run for 1 cycle in multiplayer, unless in-game debug console is available via description.ext option or Eden attribute setting.
aah that explains it, thx Sa-Matra π
Can I do an execVM from the config .cpp? I have the following code but getting an error:
title="Loadouts";
access=0;
atomic=0;
vocabulary="";
contexsensitive=1;
class Items
{
class MC
{
title="MC";
shortcuts[]={};
show="1";
command="execVM "\Loadouts\MC.sqf"";
speechId=0;
};
command="execVM '\Loadouts\MC.sqf'";
Thank you. This works.
My aim is to open a submenu where I can select a Loadout
Each Loadout has an .sqf file
I am using
["Loadout Menu", [10], "My_Loadouts", -5, [["expression", ""]], "1", "1"]
It's part of my custom menu
But when I select it in the menu it autmatically executes one of the .sqf files
Not sure why
It shows 4 different laodouts in the submenu though
But it executes without me selecting anything
Any idea why?
Can't help, didn't use these menus to know.
Many thank. I'll have a closer look
From the config.cpp. For some reason the sqfs do not get executed.
class My_Loadouts
{
title="Loadouts";
access=0;
atomic=0;
vocabulary="";
contexsensitive=1;
class Items
{
class MC
{
title="1. MC";
show="1";
enable="1";
expression="execVM '\Loadouts\MC.sqf'";
};
class Arid
{
title="2. Arid";
show="1";
enable="1";
expression="execVM '\Loadouts\Arid.sqf'";
};
class PMC
{
title="3. PMC";
show="1";
enable="1";
expression="execVM '\Loadouts\PMC.sqf'";
};
class Ranger
{
title="4. Ranger";
show="1";
enable="1";
expression="execVM '\Loadouts\Ranger.sqf'";
};
};
};
I call it from the custom menu with
["Loadout Menu", [10], "My_Loadouts", -5, [["expression", ""]], "1", "1"]
The sub menu opens but when I select any of the options nothing happens
file path ok?
For files, like info in execVM wiki page
If the same script is to be executed more than one time, declaring it as a Function is recommended to avoid recompiling and wasting performance with every execution.
So you should do functions of your files
And then you could just call your function in expression
how can I set object scale in MP :<
painfully
ohoh what does that mean
https://community.bistudio.com/wiki/setObjectScale
ideally to not spam the network:
use setObjectScale on a local object (createVehicleLocal) on each frame
thats what im reading rn, is there an example on what to paste in the init?
not on this page
where can I view em
you would have to write it π we help people writing scripts here
oh thats painful
welcome to our world!
@proven charm yes, the file path is correct. Not sure why does not work
Have you tested add your addon before "\loadouts.."
-->
expression = " execVM 'myAddonName\Loadouts\arid.sqf';"
But still , I recommend do function of your files.
Take couple minutes to do and will be better in long run if you call your files more than once.
Ok, how can I do functions of my files? Haven't done this before.
So you define in config.cpp
CfgFunctions class and to files you need add fn_ before file name
Like
ranger.sqf
// Comes
fn_ranger.sqf
And depends what path you want use. You can define that under Category or name your category by your folder name
file = ""
Just ask if you need more help/ info. Here is a lot of ppl who can help you out
Thanks a lot prisoner. Last question, once I defined the functions, how do I execute them within the config.cpp?
class CfgFunctions
{
class RNB //TAG
{
class Loadouts // Category
{
class ranger {}; //function
};
};
};
Add in file name in folder
fn_ranger.sqf
Would be called
call RNB_fnc_ranger;
Got it, thank you. I give it a shot
attach object to something else (typically a game logic)
on each frame (doesn't work in dedicated servers)
make object simple object
attaching object to something else is the most consistent i've seen in dedicated servers but it's a command provided "as-is" -- good functionality outside of 3den or SP is not guaranteed
you can through scripts
there is no "aircraft loadout" equivalent unfortunately
some pylons for your quadbike?
yeah there's no pylons for vehicles
only changing magazines[] in config or just removing magazines with script
just removeMagazineTurret iirc
Is this the correct way to call a function from config.cpp?
class MC
{
title="1. MC";
submenu = "";
show="1";
enable="1";
expression="call RNB_fnc_MC";
};
It's still not working and I don't even get an error message. When I call the function via the debug console it works fine.
Do diag_log ['My expression test', _this] instead of your function
if it logs, then it gets called
You mean in config.cpp or ingame debug console?
in your expression
Is there any way to get what current action is selected apart from tracking it with inGameUISetEventHandler?
https://community.bistudio.com/wiki/inGameUISetEventHandler
AgentRev's comment suggests it used to fire when you press spacebar (inputAction "Action"), but doesn't seem to happen anymore π€
Hello, can anyone give me any guidance on how to do multiple simultaneous while loops?
What purpose? What kind of thing you imagine?
I am using:
class MC
{
title="1. MC";
submenu = "";
show="1";
enable="1";
expression="diag_log ['My expression test', _this]";
};
When I execute ingamge then nothing happens.
I have a sound looped that plays repeatedly every 60 secs, and I want a separate loop to play a hint every 30 seconds
Why it is needed to be separated?
No idea then, I never used commanding menus
because I want to cancel the hint after someone carries out an ace action, but the sound to carry on
where do you put this code?
Well before I answer:
- multiple
spawnscripts are bad for the performance. - since you only need to have two of them, are not a big concern
- but you want to know this fact that big amount of
spawnscripts makes every (well, basically every) scripted things slower
I know, and my sound loop cancels after 5 mins
0 spawn {
while {true} do {
playSound "sound";
};
};
0 spawn {
while {whateverTheCondition} do {
hint "bra bra";
};
};```
cheers bro, I tried this but didnt see a hint, will try again
Oh, the example I made doesn't have sleep on it... but you know the idea
loop through it and swap out the closest one when you find a closer one
private _closest = [];
private _distance = 10000000000;
{
if (_distance > (_x distance _target)) then {_distance = (_x distance _target); _closest = _x;}
} foreach _coords;
You don't have to write such a function yourself: https://community.bistudio.com/wiki/BIS_fnc_nearestPosition
It does, yes. BIS functions are just SQF code, and that one has to be more general than the forEach loop.
There really should be a command for it.
There is also BIS_fnc_sortBy
Another BIS function that there should be a command for :/
Would be neat with Dedmen's new mini-VM.
how would I put the ammo command in a condition for vehicle rearming?
I did it in the past but I cannot remember it for the life of me
Do anybody know how to put a player in an animation and after some time the player gets out of the animation?
How would I add an action that required a specific role to work? (Like Engineer)
I'm trying to make an AddAction that is called "Drill the Door" that takes 30 seconds, and requires the engineer role.
and ideally on completion it would open a door
I'm also attempting to figure out how to format the whole thing because I'm stupid, but yes that would probably work
you can use getUnitTrait for the condition argument with the addAction command or you can selectively execute addAction for players that meet the condition
I've never used getUnitTrait so this is sort of a guess based on the wiki but you can do something like this:
if (player getUnitTrait "Engineer") then {
player addAction [...];
}
which would prevent the action from being added at all if the player is not an engineer at the point of executing that script
switchMove alone will do the job if the animation automatically loops
And how would I add a certain amount of time to the action?
like to make it take 30 seconds
Make it a Hold Action
There is still a Conditions entry so you can limit by traits of caller, and a setting for how long it takes.
Even a space for 'what happens while doing the action', so you can playMove the caller to make them animate properly doing it.
Thanks
can you dynamically despawn vehicles?
I made a spawn system with points saying it to spawn sams on marked objects on the map (I a oil spill where I want them to spawn
Despawn?
I want to make a no fly zone with AA
I haven't found a way to implement it nicely
I want to do something like in project wingman
You fly in the no fly zone missiles come your way you get out they stop
Hrn... okay, creating the missiles is easy, stopping them will be hard.
I mean, 'hard to circumvent the games engine' hard.
'Rewrite how countermeasures work' hard.
... wait, is there a setStealth function? Hrn.
Is there a way to delete the sams and AAs I spawned
Fired eventhandler on the sams, reference _projectile in the params?
No...
Hi, i have a question ? Is it possible to do a "switchMove" on a unit without disabling the "ANIM" feature and the unit will still be able to aim and shoot while moving ? Because actually i'm using this animation : "AmovPercMtacSrasWrflDf" and this animation can be used for players so it's in "Tactical" and it's faster than the walk speed but you are still able to shoot. I'm asking that because i can't get the AI shooting while playing this animation even if the players can.
Why wouldnt this work for you, if I may ask?
you said "Creating missiles is easy" seriously ? Because i know you can make them using "createVehicle" like bombs etc but can you set a target in them ?
BIS_fnc_exp_camp_guidedProjectile, my good sir.
ah ok interesting
There is actually setMissileTarget
usually if there's a BIS function, you should read that to see what it's doing and then write your own :P
and i found setMissileTarget
That too, if you want to render a launcher and all.
but i have a question
because it's saying "Munition"
How do you do that??
so it's what exactly ? The projectile you made ? So it's the parameter "Projectile" in the event handler "Fired" and the object that you get using "createVehicle" ?
btw someone have an idea about that ?
I⦠don't think your question is "can a switchMove not disable ANIM" etc, rather "how can I make the AI shoot while in tactical stance", no?
Yeah sorry, i searched on google and i think i found something and yeah exactly my question is "Can i make the AI shoot while moving (tactical stance)" π
Hey, is there a way to let the sever know a variable? IΒ΄m remote executing an addaction on an specific client and want to return the actionID back to the server... how would i do that? I know that remoteExec does not feature a custom retrun value by itself, but there must be a workaround right?
What use is the actionID to the server?
on the sever some more code is executed which should also delete that action on some condiion. therefore i need the actionId
The actionID is specific to the client and can be different on different clients
It's better to save it in a variable on the client, which the server then orders the client to reference
and how would i do that correctly?
since i only want to delete that specific action on one client thats what i need
This is the way I do it; expect someone else to come in with a better way 5 minutes later.
Make two functions: one that adds the action, and one to remove it.
For example:
// fn_actionAdder.sqf
mc_var_myActionID = _object addAction [ ... ];
// fn_actionRemover.sqf
params ["_actionIDvar","_object"];
private _ID = missionNamespace getVariable [_actionIDvar,0];
_object removeAction _ID;```
```sqf
// server - to add
[] remoteExec ["mc_fnc_actionAdder",_clientID];
// server - to remove
["mc_var_myActionID",_object] remoteExec ["mc_fnc_actionRemover",_clientID];```
I usually expand my adders and removers to be a bit more universal with more params and such but that's the gist of it
fn_actionAdder > locally adds the action, saves the ID as a network-local/scope-global (missionNamespace) var with a known name
fn_actionRemover > locally removes an action from the object you pass it, using the action ID saved in the missionNamespace var with the name you pass it
server > instructs the client of your choice to execute those functions, and tells it which missionNamespace var to reference and which object
I'm programmatically adding crew to a vehicle. The crew are independent faction, which is hostile to both blu and opfor, yet they will not fire/aggro on me, even if i alert them to my location by shooting the vehicle. I'm adding the crew like this:
private _crewgroup = createGroup independent; // Crew group (for player hostility)
for "_c" from 1 to 3 do
{
private _nc = "I_crew_F" createVehicle _spawnpos;
_nc moveInAny _vic;
[_nc] joinSilent _crewgroup;
};```
What am I doing wrong? A mission editor spawned independent infantryman will fire on me properly.
You're creating them as vehicles, not as units. They're not very smart without brains. Try createUnit instead.
I need a second look, for some reason this is producing a syntax error
[
["B_UGV_01_F", "B_UGV_01_rcws_F", "B_T_UGV_01_olive_F", "B_T_UGV_01_rcws_olive_F", "B_D_UGV_01_rcws_lxWS", "B_D_UGV_01_lxWS", "O_UGV_01_F", "O_UGV_01_rcws_F", "O_T_UGV_01_ghex_F", "O_T_UGV_01_rcws_ghex_F"],
{
deleteVehicleCrew _this;
createVehicleCrew _this;
}
],
deleteVehicleCrew _this;
^^^^^^^^^^^^^^^^^
[ERR][L4|C3|/file.sqf] Expected '}'.
hicleCrew _this;
^
[ERR][L4|C9|/file.sqf] Expected ']'.
(empty means no errors!)
something about _this causing issues?
the wiki page for deleteVehicleCrew says it should be fine
We have no idea what is the context
uh sorry you mean the entire file?
I am editing some object init files, here I will post it
the goal is to simply delete the entire crew of any of those vehicle classes
for kp_liberation. my big issue is it think deleteVehicleCrew has a syntax error but as far as I can tell it is correct
Wait a minute, I thought _this is undefined but if so the error is not like that
Are you sure that you don't have ANY strange characters around there?
I swear I have been squinting for 20 minutes
I erased the white space, I have no idea what it is
Hmm, I'm storing the name of a marker on a vehicle like so: _vic setVariable ["vicMarkerName", format ["aa%1", _i]];, and reading it back out after it's destroyed like
private _id = _vic getVariable ["vicMarkerName"];
hint format ["%1 killed %2", name _shooter, _id];```
(in a damage event handler) and whenever i damage the vehicle it says "shillelagh killed any" instead of the id I saved. Why might this be?
Does destroying a vehicle and replacing it with a wreck occur before damage event handlers are called or something?
getVariable requires a default value in that syntax
The second parameter is not optional
hey guys, I just started dabbling in scripting a couple days ago, would someone be able to help me with one if they have time please? I'm trying to select AI wearing a certain uniform to enableAI, there is a lag spike when I run it but its not enabling the AI, not getting any errors. It runs successfully without the AND _uniform == "U_I_C_Soldier_Bandit_4_F" so I assume I made a mistake there somewhere?
_realTickTime = 11;
_activateAI =
{
_units = AllUnits select {alive _x AND _uniform == "U_I_C_Soldier_Bandit_4_F"};
systemchat str _units;
{
_x enableAI "all"
} forEach _units;
};
while {true} do
{
_ticksBegin = round(diag_TickTime);
if (_realTickTime >= _executeTime) then
{
call _activateAI;
};
}; ```
Where do you call this from?
Do you have AI disabled for enableAI to work at all?
AI features are all enabled by default.
I'm running it from the server execute, yes I have in the object init for each unit in the editor this disableAI "all";
What's with your ticks\time checks? Do you want this to execute after certain time?
yes, I have it set to 11 to skip it since the script isn't working
11 of what? Run it after 11 seconds after execution?
Also AI features being disable\enable are local and only affect AI units if they're local to client that did changes to these features.
So if you'll do enableAI "ALL" from server but client owns AI units, this won't do anything because you didn't enable AI back on clients.
Init fields are run on all clients, including server and client that join later (JIP)
Once the rest of the script is working it would count to 10 seconds and execute, the _realTickTime is set above 10 so that it skips the time, normally it'll be set to 0 so that it counts up from 0. I'm running this all locally through the editor to test
Reason why there is a lag spike is because you're running an infinite while loop that does call _activateAI over and over and over until while hits failsafe execution limit: https://community.bistudio.com/wiki/Scheduler#while_Loops
while stops running after hardcoded 10000 iterations to avoid freezing the game, thus your lag spike of 10000 calls of _activateAI function
oh shucks, I see, so I need to be putting that into a variable and then have it set to false after _realTickTime >= _executeTime
thanks, i'll give that a try
And for the same reason your script didn't work when _realTickTime was 0, your while just did 10000 checks of if (_realTickTime >= _executeTime) (if (0 >= 10)) and stopped due to engine freeze failsafe.
Debug console executes are all done in unscheduled environment, i.e. right away and without any delays between them.
If you want to go from unscheduled (all done instantly in same frame) to scheduled (code execution spread over time), you'll need spawn or (worse idea) execVM
Another issue, you never define _uniform anywhere
To get uniform you need uniform command
private _uniform = uniform _x;
Or just check it inline:
uniform _x == "some_uniform_class"
OH I see, I was reading the example on the wiki backwards
I see now that it bolds the command, and the _uniform was it defining that variable
// This code starts in unscheduled environment
0 spawn {
// Now its a new scheduled environment thread
private _fire_script_at = diag_tickTime + 10; // After 10 seconds
waitUntil {diag_tickTime > _fire_script_at};
// Time has come, get all units with uniform
private _uniformed_units = allUnits select {alive _x && uniform _x == "U_I_C_Soldier_Bandit_4_F"};
{
// Have each and every client do: _x enableAI "ALL"
[_x, "ALL"] remoteExecCall ["enableAI", 0];
} forEach _uniformed_units;
};
enableAI (and disableAI) effect is local and since you were doing "SERVER EXEC", I did remoteExecCall here instead of just enableAI
If I did _x enableAI "ALL", it would've re-enabled AI only on server, but not on clients
And if your bandit units were currently controlled by some client and not the server (if they are in player group for example), they wouldn't be re-enabled
thanks, that makes sense! I see where I went wrong now. I was working on a mission for some friends and have all the AI disabled on start to try to help with performance, and then activate each 'phase' of bandit units based off their uniform as that seemed like the simplest way to select them without giving all of them their own variables
I'm not much of editor user and do everything through scripts so I'd suggest doing something like in unit init lines:
this disableAI "ALL"; this setVariable ["bandit_group", 1];
```And other units have
```sqf
this disableAI "ALL"; this setVariable ["bandit_group", 2];
Then you can select them by this variable group number:
allUnits select {alive _x && _x getVariable ["bandit_group", 0] == 2};
```will select all units that have `"bandit_group"` set to `2`
that sounds so much easier, I wish I had posted here before I started manually updating each unit's loadout lol
There are also ways to sync units to modules, you probably can "group" units in that fashion, get all wanted units synced to some module and re-enable them, but maybe setVariable is simpler, though not as visual as synchronisation lines coming from unit to module in editor.
Haven't done much in editor to know best practice for such task, I do everything through script.
sorry to self bump but anyone familiar with deleteVehicleCrew? I still can not figure this out, it seems right
yet for some reason my scripts is erroring on deleteVehicleCrew and https://sqfvm.arma3.io/vm/ says it has a syntax error
Your code is correct, that checker is wrong
hm I guess I should be looking elsewhere for a script error then
Looks like it doesn't like code inside arrays, maybe dedmen will fix some day
yeah odd I suppose the script error was a number of freak variables
looking into it now, it was a zen error and another script bugging out
Rather feels like https://sqfvm.arma3.io/vm/ doesn't like any commands added after version 1.66
Or at least some of them π€
Oh true, it just doesn't recognise createVehicleCrew as a command.
Yeah looks like it doesn't throws errors for some of them because it get recognized as public variable instead as script command
#arma3_scripting message It threw that errors because it checked only for the old syntax
how would I use that I want it to fire missiles at my players who I know will be using air vehicles for the campaign
so how would I write it in trigger
I'm currently trying to add an action that allows a player to interact with a guard body to answer a pager (if they don't within 30 seconds a separate trigger starts an alarm) and the following code doesn't work:
if (!alive guard3) then {guard3 addAction ["Answer Pager", { hint format ["%1 Answered Pager", name player] }];}
(The variable name of the guard is set to guard3)
Is there a way to avoid that a waypoint is inside a build and instead a new waypoint is being generated until it is outside a building?
you can use https://community.bistudio.com/wiki/nearRoads to get road position for the waypoint but of course that only works if there are roads nearby
Are inside house positions defined as roads?
i think they are just positions
got it
on a different note
I attach an object to the player with attachTo
The object move with the player
sometime the object disappears below the surface while moving around
is there a way that the object moves properly with the player?
for example if the player moves to the first floor of a house the object is also on the first floor
Check the wiki page, an example (2 iirc) includes how to create a missile, youll just have to find the AA missile class name you want.
My primary concern is that it only works within the missiles locking cone, which may be punishingly accurate if the Titan AA is anything to go off of, but I cant say for sure.
If you mean decals it's normal
It shouldn't happen with other objects
ok
will give them the Centurion missiles
and some manpad ones
if I put it on repeatable do you think it will work till the area clears?
You should probably set its target to the player's vehicle, not the player
As far as testing code that works, but yeah, either target vehicle player, or if youre doing multiplayer coding... youve got some work ahead.
Also, you're setting its direction to the same direction as the player is facing. Not the direction from the missile to the player, just the direction the player is facing. Depending on position offset and the seeker cone, it may not be able to lock the target.
Also also, 200 metres is really close at missile speeds
Oh, and dir (not vectorDir) commands are compass headings, which are 2D. You're placing it 200 metres below the target and not telling it to look up.
won't it work if I put vehicle player for MP
?
also how do I make it flying terrain altittude
_missile setDir getDir player;
_tgt = player vehicle;
I tried to make it spawn from terrain
createVehicle's position parameter is in positionATL, so if you want to create at terrain height, simply set the Z value to 0 or near 0 (probably a little more to avoid instant collision)
Your current attempt provides an ASL value, which will cause the missile to be created that many metres above the terrain
_missile setDir getDir player;
_tgt = vehicle player;```
just added 10 to the whole thing
for terrainheight that should make it 10 m
Why are you involving getTerrainHeightASL?
As I mentioned, in createVehicle, the position is ATL. That means Above Terrain Level. That means 0 is exactly on the terrain, and any positive value is above it.
getTerrainHeightASL, as the name implies, gets the terrain height above sea level at the given position. So if the terrain is 100m above sea level, it returns 100. If you then feed that into an ATL command, now you're creating at 100 metres above the terrain. And that gap depends on the terrain height ASL, so if you do it over a mountain, the gap gets a lot bigger.
Heck, Id just pick some arbitrary spots in the area and selectRandom[[position 1],[position 2,...]
You're also still setting the missile's 2D heading to the same as the player's. So if the player is facing north, the missile will also face north. Even if the player is not north relative to the missile. This means the missile may not point at the player. (Well, it pretty definitely won't, since the player is likely to be above it, and you're only setting its 2D heading, not vertical pitch)
player vehicle isn't the right syntax, btw. It's vehicle player (passing player as an argument to the vehicle command, meaning it goes on the right side of the command)
how about a 3d heading? what do I use?
Hrn. Would projectiles like the missile show up on nearEntities?
I had to use nearObjects for it, and I would have liked to use nearEntities, so probably not
... another thought.
Do missiles thay have been launched and are tracking you lose track if your faction and the other faction setFriend to allies?
the No-fly zone is the main enemy island. i'll raise the no fly zone later in an op where they destroy the main radar so they won't ever be allies
Need a hand with determining if player is in a slot.
Okay, to outline fully;
If your players are Blufor and hostiles Opfor, place the AA positions as Greenfor, friendly to both sides.
If a player in aircraft is in the trigger area, Greenfor turns hostile to Blufor; radars start locking and missiles firing. Player leaves trigger area, greenfor turns friendly, and either a) missiles lose lock because POWER OF FRIENDSHIP they cant lock allies, or b) select nearObjects player's aircraft out to a respectable distance, searching for any entries in the Missile's type, apply {_x setmissiletarget objnull}
the reason I wanted the missile spawning thing was cause my players are jumpy last time someone tried this they just SEAD the main radar disabling the site
I mean, thats a valid response :p
But yeah, your options there are invulnerable targets (which would definitely draw criticism of 'why cant I blow them up again', unless you filly explain the intent), or virtually launching them yourself. Fair enough.
Yeah, spawning the missile in rather than relying on a vulnerable launcher.
yea
the idea came to mind from the ace combat 5 mission powder keg
the excuse there was manpad holding enemies. you cannot see them but they can see you
As long as your players understand that that's the intent. Nothing breaks immersion like unplanned immersion breaking.
If you don't want them to SEAD the radar you can always not give them SEAD missiles
I mean, ARMs arent the only way to destroy a radar, but yeah :p
I dunno. If you give God stats, your players will try to kill her. Just game design philosophy; if you dont want your players to spend time/effort to engage a threat you dont want them to, dont create the target.
it's that we use firewill and pylon blacklisting is painful, we have a lot of mods
"The enemy has advanced long-range radar / satellite tracking / psychics tracking your location hooked into the missile battery, you will be unable to completely remove the threat from the air."
From a mission design perspective I would never make a mission where the players can just bring whatever heavy ordnance they like, there's too many ways it can go wrong / be horribly OP
ok so how would I convert this
_missile setDir getDir player;
_tgt = vehicle player;```
to a 3d vector is the question
I tried following the thing in the page
for setVectorDirAndUp and vectorFromTo
maybe something like this?
_missileDir = _missilePos vectorFromTo getPosATL player;```
the missiledir tho looks wrong
That's not the right syntax for vectorFromTo
From on the left, To on the right. Not both on the right
You still don't need getTerrainHeightASL
That will correctly return a 3D vector from the missile spawn point to the player's position
By the way is it affected if the missile is IR, Radar guided?
Cause I used the centurion missile from jet dlc
It's radar
Putting that vector into setVectorDirAndUp is slightly complex due to the peculiarities of the intersection of dir and up, and someone else may have to explain it
The missile's seeker type is relevant for setting its target. If it has a maximum lock range, that applies. If it's an IR seeker, the target must be hot.
They will be flying over there so yea engines will be hot and they have a radar
The seeker's acquisition cone is also relevant, which is why we're trying to point it directly at the target.
Hello quick question
If I want to write a better version of:
units Town_Squad_1 apply {_x hideObjectGlobal false; _x enableSimulationGlobal true;};
units Town_Squad_2 apply {_x hideObjectGlobal false; _x enableSimulationGlobal true;};
units Town_Squad_3 apply {_x hideObjectGlobal false; _x enableSimulationGlobal true;};```
Do I write:
```sqf
{
_x hideObjectGlobal false;
_x enableSimulationGlobal true;
} forEach units Town_Squad_1, Town_Squad_2, Town_Squad_3;
??
Almost, but you can't use units like that. It doesn't accept an array of groups (and that's not a proper array)
ah yeah
You have to do units on each group separately and combine the results into one array
The brutal way is just (units group1 + units group2 + ... ) but for a longer list you'd want an apply or forEach
not a super long list but good to know
{
_x hideObjectGlobal false;
_x enableSimulationGlobal true;
} forEach (units Town_Squad_1 + units Town_Squad_2 + units Town_Squad_3);
Use () to ensure proper order of operations
like that?
Yes
thank you
so how would I fix the _missilePos = [getPosATL player select 0, getPosATL player select 1, (getTerrainHeightASL (getPosATL player)) + 4];
_missileDir1 = _missilePos1 vectorFromTo getPosATL player;
_missile1 = createVehicle ["ammo_Missile_rim162", _missilePos1, [], 0, "CAN_COLLIDE"];
_missile1 setVectorDirAndUp [_missileDir1, [0,0,1]];
_tgt = vehicle player;
[_missile1, _tgt] spawn {
params ["_missile1", "_tgt"];
sleep 0.1;
_missile1 setMissileTarget _tgt;
};
getPosATL player vectorAdd [0,0,4]
oh
so my first iteration was well
just needed other variables
_missilePos1 = getPosATL player vectorAdd [0,0,4];
roger doger, thanks!
modified the code
would this code work now?
That's going to create the missile exactly on the player's position, but 4 metres higher. Is that where you want it?
no I want it around 600 meters behind and 150m to the left and above 4m from the terrain
I would probably go for more like 10-20m in case of trees but that's not the main thing right now
Firstly, as I mentioned before, in positionATL, the ground level is 0. That means your Z axis, height above terrain, can be an absolute number. It doesn't need to be relative to or extrapolated from anything. If you want to spawn 4m above the terrain, just put the Z axis as 4.
huh, https://community.bistudio.com/wiki/parseSimpleArray example 1 shows it should work
Secondly, determining "left" and "behind" can be complex. At the moment, we're working in world space. That means the X, Y, and Z axes are fixed, relative to the world. I can't remember whether X is south/north and Y is west/east, or the other way around, but the point is the coordinate space is fixed and not relative to any object.
getPos' alt syntax, or sin/cos calculation, etc
something wrong with the argument string?
vectorDotProduct may be useful though am very tired
used it in something that sounds similar
I was just gonna say getRelPos
if it works it works π€·
// Position relative to target (we are only going to use the X and Y)
private _position = vehicle player getRelPos [700,200];
// Set the Z value to 10
_position set [2,10];
// Direction from spawn point to target
private _missileDir = _position vectorFromTo getPosATL vehicle player;
// Create the missile
private _missile = createVehicle ["ammo_Missile_rim162", _position, [], 0, "CAN_COLLIDE"];
// Set orientation and target
_missile setVectorDirAndUp [_missileDir, [0,0,1]];
[_missile, vehicle player] spawn {
params ["_missile", "_tgt"];
sleep 0.1;
_missile setMissileTarget _tgt;
};```
Note: the setVectorDirAndUp is just what you had before, I haven't verified that that is correct and I'm not going to, I hate vector maths
parseSimpleArray only supports array elements that are strings, numbers, bools, and arrays of the previous 3 types. One of the things in that array appears to be an object reference.
So this would be the full trigger?
will run test
Hiding it inside another layer of array won't let parseSimpleArray handle it, because it is still not actually one of the supported data types. Remember, it's reading from string, so all it sees is B Bravo 3-5:3 which is just a representation of the object reference, not the engine internal stuff it needs to actually interpret it.
If you can save the vehicle reference to a global-scope variable then you can pass the variable name as string, and retrieve from that. Otherwise no, not really.
is this server safe?
private _position = vehicle player getRelPos [700,200];
_position set [2,10];
private _missileDir = _position vectorFromTo getPosATL vehicle player;
private _missile = createVehicle ["ammo_Missile_rim162", _position, [], 0, "CAN_COLLIDE"];
_missile setVectorDirAndUp [_missileDir, [0,0,1]];
while{vehicle player iskindof "Plane"}do{
[_missile, vehicle player] spawn {
params ["_missile", "_tgt"];
sleep 0.1;
_missile setMissileTarget _tgt;
};
sleep 3;
}```
I want it to attack repeatedly the player if they fly a plane over the zone
It's not safe to run on the server because it refers to the player. On the dedicated server, there is no player.
It is safe to put in a function that the server remoteExecs to the target player, and it is safe to use in a local checker that doesn't run on the server at all.
oh
To be clear, it can be used in a mission that is hosted on a server. It can't run on the server machine, but it can run on clients that are connected to a server.
yea
by server safe I mean that it won't break the server
I put it on "repeatable" and not on "server only"
Okay, well...that setup is going to cause every player in a plane to be attacked, as long as any BLUFOR unit is in the trigger (and it's going to cause all sorts of interesting problems because it's going to run on the server too)
Oh boy, multiplayer coding, my favorite topic π
crap
Change the condition dropdowns to "Anyone Present", and change the condition field to:
(vehicle player in thisList) && {vehicle player iskindof "Plane"}```
That way the condition will never be true on the server, so the important code won't run on the server. Each player will evaluate their own status locally and run their own attacks locally. As a result, only players actually in the zone will be attacked.
thanks
*corrected code
It is a magic variable only available in a trigger, which contains all the things that the trigger is currently detecting based on its configured conditions. For example, when the trigger is set to BLUFOR Present, thisList contains all BLUFOR units currently in the trigger.
Well, I said to set it to Anyone present and to use vehicle player in the condition, and you've done...that instead. It might work, but......... π
I think the activation is faulty
the script if activated through debug spawns the missile
Then the problem is probably the condition, not the activation code.
That being said, the deactivation code is wrong. _missile1 doesn't exist. I would just remove the deactivation code entirely right now.
Did you change the condition code to (vehicle player in thisList) && {vehicle player iskindof "Plane"}?
Does it give an error?
Can you change the condition code to (vehicle player in thisList) && {vehicle player iskindof "Plane"}, please
Also, you've changed the direction in getRelPos to 300, which is ahead and to the left, not behind and to the left. If that's what you want then OK, but it's not what you said you wanted.
oh will fix it
I didn't do the math properly
will test now
Houston we have Impact
it worked
thanks NikkoJT, Lou Montana, ShiningRayde
now we just add a while loop in so the barage happens for every 3 seconds they are in
sleep 3 should be enough right?
You don't need to. You have a repeatable trigger, just set the timeout to 3 seconds.
...Wait, no
Sorry, I got mixed up on how it works
ok
[thisTrigger] spawn {
while {triggerActivated (_this#0)} do {
// rest of code
// ...
sleep 3;
};
};```
Probably make it a bit longer than 3 seconds though unless you want almost certain death. Those missiles will stack up quick.
[thisTrigger] spawn {
while {triggerActivated (_this#0)} do {
private _position = vehicle player getRelPos [900,200];
_position set [2,10];
private _missileDir = _position vectorFromTo getPosATL vehicle player;
private _missile = createVehicle ["ammo_Missile_rim162", _position, [], 0, "CAN_COLLIDE"];
_missile setVectorDirAndUp [_missileDir, [0,0,1]];
[_missile, vehicle player] spawn {
params ["_missile", "_tgt"];
sleep 0.1;
_missile setMissileTarget _tgt;
};
sleep 5;
};
}```
Is there a way to create a variable IF the variable does not exist yet? I want to to avoid that a variable gets multiple times created in a while loop.
you can put the while loop under you variables like I did
...Don't
Everything has to go inside the loop. You need to recalculate all your variables each time it runs.
The while loop creates the variable again if it got deletes in the while loop
So it cant be outside
edited it
But it should only be created once
You can use isNil to check if it's already been created - but variables can't actually be created multiple times. If you define it again it just overwrites the old value.
Well it creates an object
EnemyTag1 = "Sign_Pointer_F" createvehicle (getpos assignedTarget (units group player select 1));
EnemyTag1 attachTo [assignedTarget (units group player select 1),[0,0,2]];
The outer layer with [thisTrigger] spawn { ... }; is actually important
I want to avoid that it creates multiple objects
Otherwise I can't delete the object via deletevehicle
The code is part of a loop
Then use isNil, or missionNamespace getVariable ["EnemyTag1",objNull] and isNull if it could be deleted and then recreated again later.
[thisTrigger] spawn {
while {triggerActivated (_this#0)} do {
private _position = vehicle player getRelPos [900,200];
_position set [2,10];
private _missileDir = _position vectorFromTo getPosATL vehicle player;
private _missile = createVehicle ["ammo_Missile_rim162", _position, [], 0, "CAN_COLLIDE"];
_missile setVectorDirAndUp [_missileDir, [0,0,1]];
[_missile, vehicle player] spawn {
params ["_missile", "_tgt"];
sleep 0.1;
_missile setMissileTarget _tgt;
};
sleep 5;
};
}```?
It would be easier to keep track of with proper indendation, but I think that's right
if (isNull EnemyTag1) then {EnemyTag1 = "Sign_Pointer_F" createvehicle (getpos (units group player select 1));
EnemyTag1 attachTo [(units group player select 1),[0,0,2]];};
Gives an error and does not execute because of undefined variable
Well, that's not what I suggested doing π
oh, sorry. then i misunderstood
Either:
if (isNil "EnemyTag1") then {...```
β¬οΈ This will detect if the variable has never been defined. So, it'll only work once. It can't detect if the object was subsequently deleted, because the variable won't become nil again. (Unless you manually set it to nil)
Or:
```sqf
if (isNull (missionNamespace getVariable ["EnemyTag1",objNull])) then { ...```
β¬οΈ This will detect if the variable has never been defined, _or_ if it was defined and then the object was deleted. So it can work more than once.
I wonder if
isNil {isNull EnemyTag1} is faster :harold:
I would expect no because it does new scope and stuff
Trying to figure out how to get a vectordirandup relative to a model -- blue and green rectangles are same classname but different objects and orientations. red circle is teleported from blue to green but i need the direction to stay the same, anyone able to give a hand?
had something similar working a few months ago but profile corruption bug meant it got lost 
That's a kind of horrible way of doing it and I would probably avoid it just because it's unpleasant to read :U
Thanks a lot NikkoJT
I remember this. It involved vectorModelToWorld, I'm pretty sure.
ah, ty -- i can try search a bit more now
I asked about something similar a little while back. #arma3_scripting message
I believe that was the final working version
wait i can just erm
get relative vdirup -> worldtomodel -> modeltoworld the other one
Here's where you were working on it before. #arma3_scripting message
ah you legend, couldn't find it
except i need vectordirandup now 
i think this method may work though, will try
it works
Yeah I'm completely lost for doing this, previous method is completely lost/what I wrote is crap and I need vectorDirAndUp
what do you need again? what is that red vector?
That's the orientation of the red circle (player's vehicle) showing that it is the same relative to the green square
so effectively the player's vehicle needs to maintain its rotation relative to the square when it's teleported to the other one
Different object of same classname with different rotation
// before rotation
_relDir = _otherVeh vectorWorldToModel vectorDir _playerVeh;
_relUp = _otherVeh vectorWorldToModel vectorUp _playerVeh;
// after:
_newDir = _otherVeh vectorModelToWorld _relDir;
_newUp = _otherVeh vectorModelToWorld _relUp;
_otherVeh being the square underneath?
yeah
I think I tried something like this before but I'll retry that way instead of trying to fiddle around with apply 
Thanks π
well you can use apply yes
_relDirAndUp = _dirAndUp apply {_otherVeh vectorWorldToModel _x};
i assume _otherVeh changes after teleportation too?
so first two lines it's blue square then second set it's green square?
yeah
gotchu thanks
speaking of apply can you select only some values for the new array? or will the resulting array always be the same size?
well I know you can terminate it using exitWith/breakWith, but not sure if you can skip some using continue
hmm interesting
just tested too with continue. it makes the element null
but you can do this to remove some 
(_arr apply {if (_xNotValid) then {continueWith 0;}, _x}) - [0] // assuming 0 is an element that never occurs, e.g _arr is an array of strings
well better just use select π
i made this crazy piece of code which kinda works (at least with some elements) but is nowhere near perfect π ```sqf
a = [1,2,3,4,5,6,7];
r = a apply { if((_x + 1) == 3) then { a deleteAt (_x ); }; _x; };
apply doesnt have _forEachIndex so it will never work π
foreachindex my favourite gender fr
even if it did you're not supposed to use deleteAt on an array you're iterating on
true very bad practice
you're not? 
no
more functions to rewrite then
that will cause the loop to skip the next element
oh
if you loop backwards from end to start then you could use deleteAt there
_newarr = [];
_arr = [1,2,3,4,5,6];
{
_newarr pushBack (_arr deleteAt _forEachIndex)
} forEach _arr;;
_newarr
// [1,3,5]
Tbf most of my functions need rewriting so it's just as well
Or at least need me to go through and comment a shit ton
is that intended behaviour that
while {benzin == true}
do {
playSound3D ["a3\missions_f_tank\data\sounds\powergenerator.wss", generator, false, [6516.65,20010.7,171], 5, 1, 100];
sleep 25;
};
needs to complete the sleep 25 if I change
benzin = false
? I hope you get what I mean π
Yes, the condition is only evaluated once per loop. It checks the condition, then executes all the code in the loop, then checks the condition again. If the condition changes while the loop code is executing, it doesn't know about it until the next check.
if you do this for example, you'll wait 25 seconds but check the condition every second:
_end = time + 25;
while {benzin && time < _end} do {
sleep 1;
};
actually since you use that for playSound3D it's better to do this:
_nextSound = 0;
while {benzin} do {
if (time >= _nextSound) then {playSound3D [...]; _nextSound = time + 25};
sleep 1;
};
hmm, that doesnt seem to work
what doesn't work?
hold on
when you cancel playSound3D, does it play the sound till the end, or does it cut off?
till end
it doesn't cancel it
it just doesn't play it anymore and moves to the next line after while
you can only stop playSound3D using the stopSound command which is not available yet
if you use say3D instead you can stop it by deleting the sound object
alright, ill have a look at that
just keep in mind that it doesn't work with sound paths
you need to give it a cfgSounds entry
How can I check whether an object is not inArea of a trigger?
_cacheTrigger = createTrigger ["EmptyDetector", _lootCache];
_cacheTrigger setTriggerArea [300, 300, 0, false];
waitUntil {(!alive _lootCache) or (_lootCache !inArea _cacheTrigger);};
// Some stuff happens here
This throws me stack violation error...
Your ! is in the wrong place
Is should be before trigger or the expression?
! inverts the (bool) result of an expression, so it needs to be given a whole expression to invert. You can't put it in the middle, between the command and its arguments.
Right, thanks
!(_lootCache inArea _cacheTrigger)
("an expression" can be just a single variable or command, provided it is or returns a bool)
Hello - I've learned how to create a limited arsenal using the whitelist, but that still allows players to grab anything within that limit. Is there a way to limit further based on their player slot?
Do you use ACE?
Yes!
- set up a whitelist box for each role/playertype and place them where players can't access
- have action on accessible box do the logic to decide which specific whitelist the player should get, then open arsenal using that box.
OK - thanks! Is there a reference for how to write that logic somewhere? I only found out today I could do something like this
Place this in init of arsenal object.
You can use my preset for whitelisted items:
_openArsenal = ["OpenArsenal","Arsenal","\a3\ui_f\data\igui\cfg\simpletasks\types\rifle_ca.paa",{
// IN THESE ARRAYS YOU DEFINE ITEMS IDs
_uniformsArray = [""];
_backpackArray = [""];
_headgearArray = [""];
_faceGearArray = [""];
_vestsArray = [""];
_weaponsArray = [""];
_weaponMagazines = [""];
_aceItems = ["ACE_fieldDressing","ACE_elasticBandage","ACE_packingBandage","ACE_bloodIV","ACE_bloodIV_250","ACE_bloodIV_500","ACE_CableTie","ACE_bodyBag","ACE_DefusalKit","ACE_EarPlugs","ACE_EntrenchingTool","ACE_epinephrine","ACE_Clacker","ACE_morphine","ACE_personalAidKit","ACE_SpareBarrel_Item","ACE_splint","ACE_SpottingScope","ToolKit","ACE_tourniquet","ACE_wirecutter","CUP_PipeBomb_M","ItemGPS","ItemWatch","ItemCompass","ItemMap","Binocular","ACE_artilleryTable","ACE_RangeTable_82mm","ACE_ATragMX","ACE_Flashlight_MX991","ACE_RangeCard","ACE_MapTools","ACE_surgicalKit","ACE_UAVBattery","ACE_quikclot","ACE_DAGR"];
_grenadesItems = [""];
_radioItem = [""];
_arsenalArray = _uniformsArray + _backpackArray + _headgearArray + _faceGearArray + _vestsArray + _weaponsArray + _weaponMagazines + _aceItems + _grenadesItems + _radioItem;
[this, _arsenalArray] call ace_arsenal_fnc_addVirtualItems;
[this, player] call ace_arsenal_fnc_openBox;
},{
// HERE YOU DEFINE WHO CAN ACCESS THIS ARSENAL
// You can make an array of SteamIDs for example or use a side check:
side player == independent
},{},[parameters],[0,0,0], 100] call ace_interact_menu_fnc_createAction;
[this, 0, ["ACE_MainActions"], _openArsenal] call ace_interact_menu_fnc_addActionToObject;
Although I'm not exactly sure whether it's the best way to init the logic in case of perfomance
Keep in mind that objects' init fields in editor do not support comments
Completely depends on how you need the system to work. Simplest but least flexible would be manually assigning a box to each player unit like
// different boxes
kab_box_default
kab_box_antiTank
kab_box_sniper
// player 1 unit init
this setVariable ["kab_boxType", kab_box_antiTank];
// player 2 unit init
this setVariable ["kab_boxType", kab_box_sniper];
// action
private _box = _caller getVariable ["kab_boxType", kab_box_default];
[_box, _caller] call ace_arsenal_fnc_openBox;
For defining the arsenal access - Would I be able to assign a variable name to the playable unit, and then use that variable?
If I'm understanding this correctly, I should use X amount of boxes based on X amount of roles I have, define each role as variable A/B/C, and then put the action into the init for the public access arsenal box?
Sorry for the questions and if I'm being annoyingly dense!
yes that's how i've structured it, a hidden box for each whitelist, and a single accessible box.
Not to worry. everyone starts learning somewhere.
Thank you both again! I will go put this new knowledge into my mind and try to implement it correctly
Yep!
Basically any boolean
I guess it would work like this:
player == mySoldier
is it possible to change player fov via scripts? I'm trying with:
cameraOn camSetFov 0.25;
but it doesnt work
Is there a way to automatically delete the save file/reset a mission when the mission has failed?
It is not. You can only change the FoV of scripted cameras.
FoV changing is not very well supported in Arma. Players can only do it themselves with some mod or something, and that's not recommended since it breaks stuff like scopes.
you need to "succeed" the mission, with a fail message
Wish we could do something like ENTITY || ENTITY so it returns first non-null entity
private _cursor = cursorTarget || cursorObject;
Instead:
private _cursor = if(isNull cursorTarget) then {cursorObject} else {cursorTarget};
```which would get even uglier if there was more possible entities
Anyone have any idea what's wrong with this? Can _x / arrays not be used for marker names? D: {_x setMarkerTypeLocal "mil_Pickup";} forEach _allExtractionLocations;
I'd prefer the C# ?? Way
But uff. You'd also want it to work for nil really. Which. Is doable but somewhat unlikely :/
And then do we want the ?? CODE variant too? Ugh
I never want to implement any &&CODE kinda thing again, i just want a jump instruction
_meme = ["array", "of", "identifiers"];
_result = _meme select (_meme findIf {!isNil _x && {!isNull (currentNamespace getVariable _x)}});```...although it'd weird out if `findIf` returns -1
isNull doesn't take string afaik?
yeah, it most certainly doesn't 
http://hia3.com/tools/armafovcalculator-en
RESULT:
fovTop:
1.14
fovLeft:
1.82
Add both calculated values to the ArmA 3 profile configuration file [your_profile_name].Arma3Profile
Default location of a file "%userprofile%\Documents\Arma 3 - Other Profiles\[your_profile_name]"
This is client side only.
Oh yeah, there is ?? in C# that sounds like a better fit. Though still feels rather limited in its usefulness.
Not to be confused with:
?(SQF)
SQS*
When I export a set of objects into SQF does it also export the additional parameters and code within the said objects? (Like the specific texture, code in the object's init field, object variable name etc.)
U can test that quickly. Put some code into init like: ASDF=this; and lol.jpg as texture. Then export it, paste it into your favourite text editor (i always use MS Excell for SQF editing) and press ctrl+F and search for said texture.
i always use MS Excell for SQF editing
i'm scared
With ACE there is a module that lets you give other the medic perms through zeus, how could I code a script to make a MenuObj scroll interaction to give the medic perms
_unit setVariable ["ACE_Medical_MedicClass", 1, true];
quick question
how many triggers can a mission have before it approaches any sort of limit?
or causes issues
cuz I have a mission with a lot of "out of boundary" triggers
i guess that depends on your hardware
hm, would there be an effective replacement?
instead of say 50 out-of-bounds triggers
would it not be simpler to have inside of boundary triggers? π€
Yes on paper but I use wild forest map and I made the playable area myself basically
its among valleys and winding hills
a lot of nuck-and crevasse I dont want players sneaking out trough
i dont understand why the but is a but
you could go for invisible walls if you're into that sort of thing
I do have wires running all throughout it to signal where that boundary is
but we have climbing mods so the players will always find a way
you could define the playing area as a polygon and run a script that checks if the players are inside it
ho?
I was thinking maybe area markers would be the solution
the thing is it cant extend too far upwards
cuz there will be one player tasked with flying around on a rescue mission
Triggers marking outside player area. Set to detect any player.
In on activation {_x setDamage 1} forEach thisList
Trigger set to repeatable and server only
yep that is done
I have that working flawlessly
its just
there are like 50 of them
im worried things will break even if they are set to 3 seconds
nah
I'll hope for the best
50 triggers every 3 seconds will probably be fine
should be
especially since they most likely wont ever need to activate simultaneously
Thanks
is Say3D broken? Is so, how?
Define broken
I don't know, thus I am asking. It worked fine last time I used it, but it's in broken commands group on the wiki
Not sure why it was in that category. Maybe a copy & past mistake.
Command should not be broken
https://community.bistudio.com/wiki?title=say3D&diff=prev&oldid=108987
Seems to have been in reference to the note about attenuation when in first person in a vehicle.
I think that was supposed to have been fixed at some point π€
is creating a super simple object faster if another super simple object with the same model already exists in the mission?
I've got a while-do loop that I want to create a series of marker dots while a helicopter is moving. It works, but I'm having trouble how to iterate the createMarker setup; it only creates the first one, since it references the same name over and over :/
Whole script calls probs no.
But model and texture will already be in memory so i guess yes.
_name = "helimarker" + str _iterator
Had a feeling that was the way, but couldn't think how to implement it.
I've just watched UselessFodder's review of Global Mobilization and Force Recon.
The feature which really caught my eye is the playback of the route the player takes through the mission. It gets drawn on the map.
Excluding the obvious, is this possibly achieved with unitCapture or is there another method at play?
Tried looking around to see if I could find any glob-mob scripts but no joy apart from the snippets on the wiki.
I would guess it just records the position of the group (either average or leader) every x seconds
*and then connects them with drawArrow
That's my guess as well. Would certainly be cheaper than unitCap
Wait until unit\group center moves X meters from last position, add position to array, repeat
I mean to capture 1-2h mission in even 30 fps would make a looooong file.
Array recording x,y and dir maybe every 100m would be more than nuff
That method also makes sense. The arrows do seem equidistant.
Unless your whole mission takes place within 100m
I'm pretty sure it's time-based not distance-based. The arrows can be different lengths (very noticeably so if you happen to acquire a vehicle).
Ooh ok. Perhaps I'll look at trying both and see what happens.
Sure i guess record every minute. Would still give plenty precision and only 120x3d array
Distance based one just prevents cluttering if players dont move. Maybe hybrid between the two
Iβm trying to use the Warlords modules but itβs not letting me select a sector to cap
Any help?
Yeah you could get direction by that. Except the last point
Ah true
But perhaps you just plop down exfil marker for last entry in array π
Yeah
whats faster even if only marginally, isEqualTo or ==? same for isNotEqualTo and !=
I'd assume isEqualTo
Force Recon functions can be inspected in the Functions Viewer with GM loaded (Leopard20 Advanced Developer Tools recommended for easier navigation). Position recording is handled in FR gameDirector about line 178; playback is handled by FR showTrackedRoute.
Oh thanks!
spoilers: it is a time-based tick and drawArrow
Appreciated π
Does anybody know if George Flores [GF Scripts] is still active in the community?
last I checked not for a couple of years
why does vehicle leader _mygroup return myself even when iΒ΄m (player and groupleader) alive and in an vehicle?
it doesn't
its string representation may be the same as yours but it's actually not the same
you can check via vehicle leader _mygroup == leader _mygroup
which should be false
hint format ["Vehicle: %1 \n Ammo: %2 \n Fuel :%3", vehicle leader _x, getAmmoCargo vehicle leader _x, getFuelCargo vehicle leader _x];
but this returns my group and says that the vehicle iΒ΄m in (the tank) has no ammo and no fuel
why should it have any?
and it seems like it doesnt return the veicle
it's not a supply vehicle
its fully armed
damn how do i get the fuel and ammo level of the vehicle?
getXXXCargo are supplied stuff... 

fuel
there's no such thing as ammo level afaik 
you can compare the vehicle's original loadout with its current loadout 
then i can count.. but thanks... iΒ΄m just dumb.
There is ammo but its funky
Ye, hence funky π
do you know an easy way to tell if vehicle ammo is low? maybe with magazinesAmmo?
SomeAmmo if it works on vics
Does anybody know what I may be doing wrong here? Im using George Floros' script to replace trees, ive changed it so it creates simple objects to save FPS. However changing it from createVehicle to simple objects now means a lot of the trees it creates are floating in mid air .. Any ideas what i would need to change here?
{
GF_Vegetation_Replacement_Tree_Count = GF_Vegetation_Replacement_Tree_Count + 1;
GF_Vegetation_Replacement_Tree_Objects = _x;
if (!(typeOf _x in _Exclude_List)) then {
private _pos = getPosATL _x;
private _dir = getDir _x;
private _vectorDirUp = [vectorDir _x, vectorUp _x];
hideObjectGlobal _x;
_createVehicle = [selectrandom GF_Vegetation_Replacement_Tree_array, getPosWorld _x, getDir _x, true, true] call BIS_fnc_createSimpleObject;
_createVehicle setDir _dir;
_createVehicle setVectorDirAndUp _vectorDirUp;
_createVehicle enableSimulationGlobal false;
It is returning the vehicle. The vehicle doesn't have a variable name, so it's being represented for human-readability by the group ID and name of its owner. (The actual engine object reference for the vehicle is not human readable.)
Think simple object takes asl
This is actually what I was working on, just an hour before you guys talked about it XD except for recording a helicopter's positions and recreating dummy helicopters to show the flight path.
Thanks mate, im afraid I might need a bit more babysitting to get it fixed though. Changing getPosATL to getPosASL had no effect π¦
lets take a look, can you pastebin whole script?
Of course, thanks mate! https://pastebin.com/qCKfbSAf
createSimpleObject uses the object's model centre, not its origin like a vehicle would
This makes a lot of sense, perhaps I could use the Bis_Fnc replace with simple object in there?
After its been created as a vehicle, thus being at the right height?
getPosWorld should retrieve model center
but it returns model center of previous tree that was there
The docs for replaceWithSimpleObject say it shouldn't be used for many objects and definitely not in MP, so...not necessarily a good idea
do you have a list of stuffs you wanna replace aka GF_Vegetation_Replacement_Tree_array?
Yeah mate its called from a seperate script, thats all working fine. I think @hallow mortar has solved the issue though mate if its using the center of the object
Thanks for looking though!
Nikko, if I was "theoretically" to use the Simple Object replace, do you know how id fit it here? Cant seem to get the syntax right
_createVehicle = [selectrandom GF_Vegetation_Replacement_Tree_array, getPosWorld _x, getDir _x, true, true] call BIS_fnc_createSimpleObject;
_createVehicle setDir _dir;
_createVehicle setVectorDirAndUp _vectorDirUp;
_createVehicle enableSimulationGlobal false;
_createVehicle [this, true] call BIS_fnc_replaceWithSimpleObject; // This cant be right? Surely, haha.
https://community.bistudio.com/wiki/BIS_fnc_replaceWithSimpleObject
There is one parameter for the function, and it's the object you want to replace
[_createVehicle] call BIS_fnc_replaceWithSimpleObject;
_x*
Thanks guys, makes sense! I realise ive used the function twice in code above, just ignore that!
dunno if it would work with terrain objects. Youd still have to hide them
_v = createSimpleObject [selectrandom GF_Vegetation_Replacement_Tree_array, getPosWorld _x, true];
_v setVectorDirAndUp [vectorDir _x, vectorUp _x];
_x hideObject true;
and enable simulation doesn't really do much to trees
but if you want you can add _v enableSImulation false
{
...
GF_Vegetation_Replacement_Tree_Objects = _x;
...
} forEach GF_Vegetation_Replacement_Tree_Objects;``` 
yeah im unsure what that is supposed to be
it foreaches thru that same array
Thanks all! Some good stuff to wrap my head around there, appreciate the help!
The array is called in a different file, the original script is here and here if you wanted to look:
https://sharemods.com/c4bkl9c17axx/gf-vegetation-replacement-script-mod-version-1.0.zip.html
https://forums.bohemia.net/forums/topic/221912-gf-vegetation-replacement-script-mod/
George Floros was super creative, its a shame they dont seem to play anymore
you'd create an infinite loop that way
no
well, not exactly. You'd derp the array loop tries to iterate over
but anyway it doesn't seem to matter
no
it just doesn't do anything
wut
the variable gets assigned but what you iterate over remains unchanged
private _lol = [1,2,3];
{
_lol = _x;
} forEach _lol;
hint str _lol; -> 3
so it will "work" but the next loop call will error out 
what is that supposed to say?!
it's a wrong example
thats basically what its doing rn
systemChat inside the loop would make that test complete
it would just say 1,2,3
and it does. Fun stuff
what ive meant is after the loop _lol would be 3
but loop still loops
well yeah but you said it would be an infinite loop which is not true
How do I restrict the arsenal to a specific mod pack?
Restrict arsenal by only adding specific things. https://community.bistudio.com/wiki/Arma_3:_Arsenal#Add
Thank you!
alright yall, im gonna need some help/reccommendations
so i got a mission where uh, there's gonna be a TLAM strike, there are possibly up to 30 targets the players could mark for destruction, of those strikes there are usually allocated 2 tlams each so thats about upwards of 60+ missiles
im gonna need something beyond the artillery module to help me sort this shizz out
And how would player mark targets?
their designator gives an 8 digit grid
And then?
usually i can see their laser on the zeus menu, my plan was to put down a create target module
then use artillery fire mission to call in every single tlam
obviously this is a tad inefficient
but because of the fluid nature of this its kinda...well
not pre plannable
Are u using vanilla VLS?
i did that not long a ago. but player had to plant IR grenades on targets and VLS would fire missile at it
yeah not gonna be possible with the current design im afraid
i really wish theres a way i could punch in the grids into a list on a console and launch em
ugh i think VLS can only lock on to actual targets as in objects
is it possible to add some kind of a cooldown to this eventhandler, so the code doesn't run continuously?
vehicle player addEventHandler ["EpeContactStart",
{
params ["_object1", "_object2", "_selection1", "_selection2", "_force"];
if (_object2 isKindOf "Car") then
{
//code here
};
}];
sleep?
No, that won't prevent new activations of the EH
The way I would do it is to set a variable on the object when the EH fires. The EH checks that variable before doing any of its stuff, and cancels if it's true. Then at the end of the cooldown set the variable false again so a new activation can happen.
e.g.
if (_object1 getVariable ["paradox_var_epeCooldown",false]) exitWith {};
_object1 setVariable ["paradox_var_epeCooldown",true];
// ...
[_object1] spawn {
sleep 10;
_this#0 setVariable ["paradox_var_epeCooldown",false];
};```
you could try running player setVehicleReportRemoteTargets true; in onPlayerRespawn.sqf
what does that do?
and enable Data Link Receive checkbox on VLS
makes player report laser target to datalink
But player has to lase target, then press T
and VLS will auto fire on it
idk about having the players lase a target for each missile since realistically, a TLAM strike is a saturation attack, they all would have to come in at about the same time
Is it necessary for the players to observe the launch?
yes because theyβre gonna have to conduct bda afterwards
also who doesnt like a good light show?
Not the impact, the launch
oh its not necessary for that
so it would be like this?
vehicle player addEventHandler ["EpeContactStart",
{
params ["_object1", "_object2", "_selection1", "_selection2", "_force"];
if (_object1 getVariable ["paradox_var_epeCooldown",false]) exitWith {};
_object1 setVariable ["paradox_var_epeCooldown",true];
if (_object2 isKindOf "Car" && (_object1 getVariable ["paradox_var_epeCooldown",false])) then
{
//code here
};
[_object1] spawn
{
sleep 10;
_this#0 setVariable ["paradox_var_epeCooldown",false];
};
}];
they dont have to see the launch just the missiles come in
This snippet will fire VLS but actual targeting will be a bitch, since you will have to spawn object there, make it invisible and then fire it. Also this has to run where VLS is local
if (isNull(_tgt)) exitWith {};
west reportRemoteTarget [_tgt, 300];
_tgt confirmSensorTarget [west, true];
_vls commandTarget _tgt;
sleep 3; //Might wanna add that to give AI time to "aim"
_vls fireAtTarget [_tgt, "weapon_vls_01"];```
That's correct, for a 10-second cooldown and for _object1 being the object that has a cooldown.
getting in the targets would require it be done in zeus so this theoretically cannot be pre planned unless someone can come up with a reason why
Where I'm going (slowly) is to skip the launcher entirely, just create a laser target object on each target position, spawn a bunch of missiles in the air somewhere miles away, and set their targets. Since there's no launcher, forEaching becomes a lot easier and there's no sensor faffing.
the context for this mission is, satellite imint is not available and an enemy strike is imminent, there is no isr assets in place and thus the tlam strike would have to go forward with limited intel
yeah that would be better. My mission required launch to be visible (hidden VLS on top of a submarine) so i had to fidadle with sensors
thereβs also a set piece tied to activate for when the vls fires, a bunch of SAMs fire in that general direction, thats just for show of ciurse and it looks really nice
but i figured that can be reworked
i have an idea for this if possible, create a forward/fires observer slot, and give them a unique add action, to tag targets, and for every target they mark 2 tlams will for that target(?)
its a little janky but it might work? otherwise im trying drongos artillery
I'm writing something that will let you bulk specify grid references to be hit (I like this because it allows the grid references to be wrong if the players screw up)
*when
on that last part, me too π