#arma3_scripting

1 messages Β· Page 73 of 1

proven charm
#

you should be able to get the IDD from the GUI class via config browser

modern meteor
#

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";};
edgy dune
#

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?

little raptor
#

you can't compare anything with nil

#

nil doesn't exist

modern meteor
#

oh, i see. thank you!

little raptor
#

dunno about the local one

#

I think neither one run when locality changes

edgy dune
#

ahhhhhh I dont follow. ur saying do_stuff_on_local_change wont run when the locality of myCoolUnit changes?

little raptor
#

well dunno never used it blobdoggoshruggoogly
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

edgy dune
#

understandable neither have i πŸ™‚
My next plan is to follow wat ace does

#

πŸ™‚ and learn off their pain

little raptor
#

the first one (init) won't obviously

#

not sure about the local one

jaunty nest
#

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

pastel crater
#

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

proven charm
jaunty nest
proven charm
#

name the groups in editor to something like "theEnemy1" etc then do sqf Player setvariable ["MARTA_hide",[theEnemy1,theEnemy2]]; // etc

jaunty nest
proven charm
#

yes

#

not units but groups

jaunty nest
coarse dragon
#

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?

jaunty nest
#

Player setvariable ["MARTA_hide",[UAF1,UAF2,UAF3,UAF4]];

hallow mortar
coarse dragon
#

yea

hallow mortar
proven charm
hallow mortar
#

That says "description.ext"

#

don't put code in description.ext, it's a config

jaunty nest
jaunty nest
jaunty nest
hallow mortar
#

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.

hallow mortar
#

Well, there's your problem

jaunty nest
#

thats all i know how to do

hallow mortar
#

No, because this is script, not config

jaunty nest
#

ohhh

#

are you saying description.ext is a config?

hallow mortar
#

...Yes

jaunty nest
#

i misunderstood

hallow mortar
#

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

jaunty nest
#

so like init.sqf

#

oh okay

proven charm
#

yes init.sqf is one option

jaunty nest
#

@proven charm @hallow mortar works just fine Thanks for being patient lmao

coarse dragon
#

well shit. thats them all broken. cant undo it rip 5 hours of set up

#

hm was just a conflict. fixed it

winter rose
#
  • you don't use onXXX, just XXX
  • also it may not make sense to add an onLoad after creation
coarse dragon
#

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

winter rose
coarse dragon
#

do you know of anything that could suit my pointing needs?

hallow mortar
#

You can script it yourself using switchMove and setAnimSpeedCoef

coarse dragon
#

they dont work for that ive tried them :9

hallow mortar
#

.....sure

coarse dragon
#

its an object

hallow mortar
#

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.

drifting sky
#

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?

hallow mortar
coarse dragon
#

the anims can only be used with this

hallow mortar
hallow mortar
drifting sky
#

does it have to be a unit vector when setting orientation?

hallow mortar
#

What's a unit vector?

drifting sky
#

has a length of 1.

#

as opposed to something like this: [12,-6,2]

coarse dragon
#

its not a unit

#

its a anim object

hallow mortar
hallow mortar
# coarse dragon its not a unit

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.

drifting sky
little raptor
little raptor
hallow mortar
drifting sky
little raptor
#

no

drifting sky
#

it wont cause any distortion of the object I presume

little raptor
#

but you shouldn't use setVecotrDir

#

use setVectorDirAndUp

little raptor
#

just use setVectorDirAndUp and provide an up perpendicular to dir

#

they don't need to be normalized

drifting sky
#

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?

little raptor
#

because using setVectorDir alone has "side effects"

#

it might rotate the up

#

which might affect the lift of the rocket

hallow mortar
#

I would love for those side effects to be documented

drifting sky
#

hmm... you think the lift will be important for rockets like fired out of rpg7 or mawws?

coarse dragon
hallow mortar
#

The guide I linked contains instructions on how to do that

little raptor
coarse dragon
hallow mortar
little raptor
#

no it's impossible

#

up must be perpendicular to dir

gilded niche
#

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.

little raptor
coarse dragon
#

do you know which section?

hallow mortar
little raptor
#

assuming _dir is not [0,0,1] ofc

hallow mortar
little raptor
#

ok will add

coarse dragon
#

yaaay

drifting sky
#

with setVectorDirAndUp does it recalculate the up vector from the two provided? (dir cross up) cross dir)?

coarse dragon
#

it didnt work notlikemeowcry

drifting sky
#

if so, I should be able to just get away with setVectorDirAndUp [_dir, [0,0,1]], right?

little raptor
#

if you do it like I showed no

little raptor
#

I think it calculates a new side, in which case yes

#

you can try it

little raptor
#

or setVelocity (vectorNormalized _dir vectorMultiply _speed)

gilded niche
#

Hey do any of yall know how to make a police vehicle beacon turn on?

coarse dragon
#

i set it at 2. and he points super quick. then moves his arm down again but only half way

hallow mortar
hallow mortar
hallow mortar
coarse dragon
#

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."

hallow mortar
#

Yes, that [the guide] is correct

gilded niche
coarse dragon
#

so 3 is super fast loop

hallow mortar
gilded niche
#

What's the channel name?

#

Alright thanks I appreciate this alot

hallow mortar
coarse dragon
#

jezz

#

i put 3. it does it super fast. Thus why i said what i said

hallow mortar
#

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

drifting sky
#

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?

coarse dragon
#

-1. normal.
1 slow at putting arm up. but then resets very quick.
2. same, but never puts arm all the way back down

hallow mortar
# coarse dragon -1. normal. 1 slow at putting arm up. but then resets very quick. 2. same, but n...

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.

manic kettle
#

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

granite sky
#

_object setVectorDirAndUp [[0,1,0], [0,0,1]]

manic kettle
#

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];

manic kettle
manic kettle
# winter rose 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

winter rose
#

how did you get _pos?

manic kettle
#

getPosATL

#
_objectClass pushBack (typeOf _x);
_objectPosition pushback (getPosATL _x);
_objectVectorDir pushback (vectorDir _x); // or vectorDir
_objectVectorUp pushback (vectorUp _x); // or vectorDir
winter rose
#

I smell some shenanigans

manic kettle
#

i'm ripping my hair out this is so dumb lol

hallow mortar
#

Can you check _pos (e.g. systemChat str _pos) to prove it actually has a Z of 0?

manic kettle
#

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

manic kettle
#

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

manic kettle
#

no

little raptor
manic kettle
#

I assume you mean map originated, no i'm spawning it in through zeus/command

little raptor
#

yeah. terrain obj = obj baked into terrain and cannot be modified

manic kettle
#

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?

little raptor
little raptor
manic kettle
#

or on the ground. Its dependent on the slope/incline the H-barrier is on

little raptor
#

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... meowsweats

#

fixed an error in your own code (why 2 setPosATL...?)

manic kettle
#

debugging

little raptor
#

well if it didn't work that was why

#

it should work now

manic kettle
#

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

little raptor
manic kettle
#

no thats my original code, it doesnt work

#

puts it in the ground, see here

little raptor
#

so you did setPosATL after rotation?

manic kettle
#

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 πŸ˜„

little raptor
# manic kettle no thats my original code, it doesnt work

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;
manic kettle
#

oh wow, that works perfectly. Is there a downside to using posWorld?

little raptor
#

no

#

in fact it's better and faster

manic kettle
#

nice. Thanks leo!

little raptor
#

np

drifting sky
#

Is there any risk with using checkVisibility with the VIEW LOD? For example, in places that aren't near a player.

little raptor
#

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

drifting sky
#

if there are ai fighting in an area, does that mean that VIEW and FIRE LODS are loaded there?

little raptor
#

yes

#

(again they're loaded gradually)

drifting sky
#

k thanks.

#

Is there a quick way to determine if a weapon is or has a grenade launcher muzzle?

edgy dune
little raptor
#

you can do it on 1 PC

#

that's why I said run 2 Arma instances

#

i.e. run it twice

edgy dune
# little raptor you can do it on 1 PC

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?)

granite sky
#

isServer returns true on the host.

drifting sky
#

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.

granite sky
#

lineIntersectsXXX?

#

lineIntersectsSurfaces with FIRE geometry I guess.

#

I guess the "stop" part is tricky.

drifting sky
#

I'd like to ignore trees if there's a way, since grenades and rockets can go through them.

granite sky
#

They do? :P

#

With lineIntersectsSurfaces you can walk through all the intervening objects and check them, but good luck reverse-engineering Arma physics.

tranquil nymph
#

cameraEffectEnableHUD true right after the camCreate effect

gilded niche
#

Do anybody know how to create different types of task and how to add dialouge?

cedar cape
#

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
warm hedge
#

cannot disable Global channel for the admin or server host, because Global channel is always available for the admin

drifting sky
#

Is there a way to check if an AI has finished switching weapons?

proven charm
#

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?

meager granite
#

Fastest as in earliest since start?

#

Try allUsers apply {getUserInfo _x select 10} but it will probably have lots of nulls

proven charm
meager granite
#

BIS_fnc_listPlayers is (allUnits + allDead) select {isPlayer _x}} with some fluff

proven charm
#

funny you mention allusers/getUserInfo because I was just testing that in initPlayerServer,sqf and it seems to give valid player object

proven charm
meager granite
#

Maybe its null at earlier stage, preInit or something

proven charm
#

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?

winter rose
proven charm
#

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 πŸ™‚

meager granite
#

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.

proven charm
#

aah that explains it, thx Sa-Matra πŸ™‚

modern meteor
#

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;
        };
meager granite
#

command="execVM '\Loadouts\MC.sqf'";

modern meteor
#

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?

meager granite
#

Can't help, didn't use these menus to know.

modern meteor
#

Many thank. I'll have a closer look

modern meteor
#

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

proven charm
#

file path ok?

stable dune
desert palm
#

how can I set object scale in MP :<

winter rose
#

painfully

desert palm
#

ohoh what does that mean

winter rose
desert palm
#

thats what im reading rn, is there an example on what to paste in the init?

winter rose
#

not on this page

desert palm
#

where can I view em

winter rose
#

you would have to write it πŸ‘€ we help people writing scripts here

desert palm
#

oh thats painful

winter rose
#

welcome to our world!

modern meteor
#

@proven charm yes, the file path is correct. Not sure why does not work

stable dune
#

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.

modern meteor
#

Ok, how can I do functions of my files? Haven't done this before.

stable dune
# modern meteor 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

modern meteor
#

Thanks a lot prisoner. Last question, once I defined the functions, how do I execute them within the config.cpp?

stable dune
modern meteor
#

Got it, thank you. I give it a shot

sullen sigil
#

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

winter rose
#

you can through scripts

sullen sigil
#

yes you just remove the magazines from it

#

either config or script sided

winter rose
#

there is no "aircraft loadout" equivalent unfortunately

sullen sigil
#

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

modern meteor
#

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.

meager granite
#

Do diag_log ['My expression test', _this] instead of your function

#

if it logs, then it gets called

modern meteor
#

You mean in config.cpp or ingame debug console?

meager granite
#

in your expression

#

Is there any way to get what current action is selected apart from tracking it with inGameUISetEventHandler?

agile flower
#

Hello, can anyone give me any guidance on how to do multiple simultaneous while loops?

warm hedge
#

What purpose? What kind of thing you imagine?

modern meteor
agile flower
warm hedge
#

Why it is needed to be separated?

meager granite
agile flower
proven charm
warm hedge
agile flower
#

I know, and my sound loop cancels after 5 mins

warm hedge
#
0 spawn {
  while {true} do {
    playSound "sound";
  };
};

0 spawn {
  while {whateverTheCondition} do {
    hint "bra bra";
  };
};```
agile flower
#

cheers bro, I tried this but didnt see a hint, will try again

warm hedge
#

Oh, the example I made doesn't have sleep on it... but you know the idea

agile flower
#

sorted

#

thanks

quiet gazelle
#

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;
hallow mortar
granite sky
#

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.

little raptor
#

There is also BIS_fnc_sortBy

granite sky
#

Another BIS function that there should be a command for :/

#

Would be neat with Dedmen's new mini-VM.

polar belfry
#

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

gilded niche
#

Do anybody know how to put a player in an animation and after some time the player gets out of the animation?

lunar goblet
#

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

lunar goblet
#

I'm also attempting to figure out how to format the whole thing because I'm stupid, but yes that would probably work

open fractal
#

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

little raptor
lunar goblet
#

And how would I add a certain amount of time to the action?

#

like to make it take 30 seconds

manic sigil
#

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.

polar belfry
#

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

manic sigil
#

Despawn?

polar belfry
#

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

manic sigil
#

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.

polar belfry
#

Is there a way to delete the sams and AAs I spawned

manic sigil
#

Fired eventhandler on the sams, reference _projectile in the params?

polar belfry
#

No...

faint oasis
#

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.

manic sigil
faint oasis
manic sigil
faint oasis
granite sky
#

There is actually setMissileTarget

faint oasis
#

yeah xD

#

i just checked

granite sky
#

usually if there's a BIS function, you should read that to see what it's doing and then write your own :P

faint oasis
#

and i found setMissileTarget

manic sigil
#

That too, if you want to render a launcher and all.

faint oasis
#

because it's saying "Munition"

faint oasis
#

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" ?

faint oasis
winter rose
faint oasis
torpid mica
#

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?

granite sky
#

What use is the actionID to the server?

torpid mica
#

on the sever some more code is executed which should also delete that action on some condiion. therefore i need the actionId

hallow mortar
#

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

torpid mica
torpid mica
hallow mortar
#

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

glad fable
#

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.
hallow mortar
#

You're creating them as vehicles, not as units. They're not very smart without brains. Try createUnit instead.

glad fable
#

Ah, okay thank you.

#

Trying now

#

Yep, that did it, thank you.

gentle fjord
#

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

warm hedge
#

We have no idea what is the context

gentle fjord
#

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

warm hedge
#

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?

gentle fjord
#

I swear I have been squinting for 20 minutes

#

I erased the white space, I have no idea what it is

glad fable
#

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?

hallow mortar
#

getVariable requires a default value in that syntax

#

The second parameter is not optional

glad fable
#

Ah

#

Yeah, that works, thank you.

crisp violet
#

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;  
 }; 
}; ```
meager granite
#

Where do you call this from?

#

Do you have AI disabled for enableAI to work at all?

#

AI features are all enabled by default.

crisp violet
#

I'm running it from the server execute, yes I have in the object init for each unit in the editor this disableAI "all";

meager granite
#

What's with your ticks\time checks? Do you want this to execute after certain time?

crisp violet
#

yes, I have it set to 11 to skip it since the script isn't working

meager granite
#

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)

crisp violet
#

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

meager granite
#

while stops running after hardcoded 10000 iterations to avoid freezing the game, thus your lag spike of 10000 calls of _activateAI function

crisp violet
#

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

meager granite
#

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"
crisp violet
#

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

meager granite
#
// 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

crisp violet
#

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

meager granite
#

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`
crisp violet
#

that sounds so much easier, I wish I had posted here before I started manually updating each unit's loadout lol

meager granite
#

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.

gentle fjord
meager granite
gentle fjord
#

hm I guess I should be looking elsewhere for a script error then

meager granite
#

Looks like it doesn't like code inside arrays, maybe dedmen will fix some day

gentle fjord
#

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

tough geode
#

Or at least some of them πŸ€”

meager granite
#

Oh true, it just doesn't recognise createVehicleCrew as a command.

tough geode
#

Yeah looks like it doesn't throws errors for some of them because it get recognized as public variable instead as script command

polar belfry
#

so how would I write it in trigger

lunar goblet
#

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)

modern meteor
#

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?

proven charm
modern meteor
#

Are inside house positions defined as roads?

proven charm
modern meteor
#

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

manic sigil
little raptor
polar belfry
#

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?

polar belfry
#
_missile setDir getDir player;
_tgt = player ```
#

I think this would be good

hallow mortar
#

You should probably set its target to the player's vehicle, not the player

manic sigil
#

As far as testing code that works, but yeah, either target vehicle player, or if youre doing multiplayer coding... youve got some work ahead.

hallow mortar
#

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.

polar belfry
#

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

hallow mortar
#

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

polar belfry
#
_missile setDir getDir player;
_tgt = vehicle player;```
#

just added 10 to the whole thing

#

for terrainheight that should make it 10 m

hallow mortar
#

Why are you involving getTerrainHeightASL?

polar belfry
#

I want it above terrain

#

and searched online and someone used it

hallow mortar
#

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.

manic sigil
#

Heck, Id just pick some arbitrary spots in the area and selectRandom[[position 1],[position 2,...]

hallow mortar
#

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)

polar belfry
#

how about a 3d heading? what do I use?

hallow mortar
#

In 3D you use vectors, not headings

#

vectorFromTo and setVectorDirAndUp

manic sigil
#

Hrn. Would projectiles like the missile show up on nearEntities?

hallow mortar
#

I had to use nearObjects for it, and I would have liked to use nearEntities, so probably not

manic sigil
#

... another thought.

Do missiles thay have been launched and are tracking you lose track if your faction and the other faction setFriend to allies?

polar belfry
#

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

slow brook
#

Need a hand with determining if player is in a slot.

manic sigil
# polar belfry the No-fly zone is the main enemy island. i'll raise the no fly zone later in an...

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}

polar belfry
#

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

manic sigil
#

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.

polar belfry
#

yea

#

by virtually launching them you mean like my script attempt?

manic sigil
#

Yeah, spawning the missile in rather than relying on a vulnerable launcher.

polar belfry
#

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

manic sigil
#

As long as your players understand that that's the intent. Nothing breaks immersion like unplanned immersion breaking.

polar belfry
#

yea

#

now need a way to add the 3d vector thing

#

any advice?

hallow mortar
#

If you don't want them to SEAD the radar you can always not give them SEAD missiles

manic sigil
#

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.

polar belfry
#

it's that we use firewill and pylon blacklisting is painful, we have a lot of mods

manic sigil
#

"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."

hallow mortar
#

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

polar belfry
#

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

hallow mortar
#

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

polar belfry
#

yea I haven't tackled that yet

#

I edited it

#

for the vectorfromto

hallow mortar
#

That will correctly return a 3D vector from the missile spawn point to the player's position

polar belfry
#

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

hallow mortar
hallow mortar
polar belfry
#

They will be flying over there so yea engines will be hot and they have a radar

hallow mortar
#

The seeker's acquisition cone is also relevant, which is why we're trying to point it directly at the target.

stray flame
#

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;

??

hallow mortar
#

Almost, but you can't use units like that. It doesn't accept an array of groups (and that's not a proper array)

stray flame
#

ah yeah

hallow mortar
#

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

stray flame
#

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);
hallow mortar
#

Use () to ensure proper order of operations

stray flame
#

like that?

hallow mortar
#

Yes

stray flame
#

thank you

polar belfry
#

so how would I fix the _missilePos = [getPosATL player select 0, getPosATL player select 1, (getTerrainHeightASL (getPosATL player)) + 4];

polar belfry
#
_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;
};
winter rose
#
getPosATL player vectorAdd [0,0,4]
polar belfry
#

oh

#

so my first iteration was well

#

just needed other variables

#

_missilePos1 = getPosATL player vectorAdd [0,0,4];

lethal cave
#

roger doger, thanks!

polar belfry
#

modified the code
would this code work now?

hallow mortar
#

That's going to create the missile exactly on the player's position, but 4 metres higher. Is that where you want it?

polar belfry
#

no I want it around 600 meters behind and 150m to the left and above 4m from the terrain

hallow mortar
#

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.

proven charm
hallow mortar
winter rose
#

getPos' alt syntax, or sin/cos calculation, etc

proven charm
#

something wrong with the argument string?

sullen sigil
#

used it in something that sounds similar

hallow mortar
#

I was just gonna say getRelPos

sullen sigil
#

if it works it works 🀷

hallow mortar
# hallow mortar Secondly, determining "left" and "behind" can be complex. At the moment, we're w...
// 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.

polar belfry
#

will run test

hallow mortar
#

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.

polar belfry
#

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

hallow mortar
#

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.

polar belfry
#

oh

hallow mortar
#

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.

polar belfry
#

yea

#

by server safe I mean that it won't break the server

#

I put it on "repeatable" and not on "server only"

hallow mortar
#

"not server only" is not the same as "not server"

#

What's the trigger condition?

polar belfry
#

I just put Blufor Present

#

condition is "this"

hallow mortar
#

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)

manic sigil
#

Oh boy, multiplayer coding, my favorite topic 😭

polar belfry
#

crap

hallow mortar
#

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.
polar belfry
#

thanks

hallow mortar
#

*corrected code

polar belfry
#

gonna run this

#

btw what is thislist

hallow mortar
#

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......... 😐

polar belfry
#

there is no anyone

#

did you mean anybody

#

?

hallow mortar
#

"Anyone" and "Anybody" are fundamentally the same thing

#

Yes

polar belfry
#

I think the activation is faulty

#

the script if activated through debug spawns the missile

hallow mortar
#

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"}?

polar belfry
#

I fixed it and trying it right now

#

nope

stark fjord
#

Does it give an error?

polar belfry
#

no

hallow mortar
#

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.

polar belfry
#

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?

hallow mortar
#

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

polar belfry
#

ok

hallow mortar
#
[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.
polar belfry
#
[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;
};
}```
modern meteor
#

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.

polar belfry
#

you can put the while loop under you variables like I did

hallow mortar
#

...Don't

hallow mortar
modern meteor
#

The while loop creates the variable again if it got deletes in the while loop

#

So it cant be outside

modern meteor
#

But it should only be created once

hallow mortar
modern meteor
#

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]];
hallow mortar
modern meteor
#

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

hallow mortar
polar belfry
#
[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;
  };
}```?
hallow mortar
#

It would be easier to keep track of with proper indendation, but I think that's right

modern meteor
hallow mortar
#

Well, that's not what I suggested doing 😐

modern meteor
#

oh, sorry. then i misunderstood

hallow mortar
#

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.
still forum
#

I wonder if
isNil {isNull EnemyTag1} is faster :harold:
I would expect no because it does new scope and stuff

sullen sigil
#

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 notlikemeowcry

hallow mortar
hallow mortar
sullen sigil
#

ah, ty -- i can try search a bit more now

distant egret
#

I believe that was the final working version

sullen sigil
#

wait i can just erm
get relative vdirup -> worldtomodel -> modeltoworld the other one

hallow mortar
sullen sigil
#

ah you legend, couldn't find it

sullen sigil
sullen sigil
#

it does not

#

and what i did previously is just... a bad method meowsweats

polar belfry
#

it works

sullen sigil
little raptor
sullen sigil
#

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

little raptor
#

what is the square?

#

another object?

#

or in general, how is its rotation defined?

sullen sigil
#

Different object of same classname with different rotation

little raptor
#
// before rotation
_relDir = _otherVeh vectorWorldToModel vectorDir _playerVeh; 
_relUp = _otherVeh vectorWorldToModel vectorUp _playerVeh;
// after:
_newDir = _otherVeh vectorModelToWorld _relDir;
_newUp = _otherVeh vectorModelToWorld _relUp;
sullen sigil
#

_otherVeh being the square underneath?

little raptor
#

yeah

sullen sigil
#

I think I tried something like this before but I'll retry that way instead of trying to fiddle around with apply meowsweats

#

Thanks πŸ™‚

little raptor
#
_relDirAndUp = _dirAndUp apply {_otherVeh vectorWorldToModel _x};
sullen sigil
#

i assume _otherVeh changes after teleportation too?

#

so first two lines it's blue square then second set it's green square?

little raptor
#

yeah

sullen sigil
#

gotchu thanks

proven charm
#

speaking of apply can you select only some values for the new array? or will the resulting array always be the same size?

little raptor
#

well I know you can terminate it using exitWith/breakWith, but not sure if you can skip some using continue

proven charm
#

hmm interesting

little raptor
#

I'm guessing it won't work

#

yeah it doesn't

#

you can only terminate it

proven charm
#

just tested too with continue. it makes the element null

little raptor
#

but you can do this to remove some meowsweats

(_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 πŸ˜…

proven charm
#

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 πŸ˜„

sullen sigil
#

foreachindex my favourite gender fr

little raptor
#

even if it did you're not supposed to use deleteAt on an array you're iterating on

proven charm
#

true very bad practice

sullen sigil
#

you're not? meowsweats

little raptor
#

no

sullen sigil
#

more functions to rewrite then

little raptor
#

that will cause the loop to skip the next element

sullen sigil
#

oh

proven charm
#

if you loop backwards from end to start then you could use deleteAt there

little raptor
sullen sigil
#

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

trim tree
#

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 πŸ˜„

little raptor
#

yes

#

it won't check the while condition for the next 25 seconds

hallow mortar
#

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.

little raptor
#

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;
};
little raptor
#

what doesn't work?

trim tree
#

hold on

#

when you cancel playSound3D, does it play the sound till the end, or does it cut off?

little raptor
#

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

trim tree
little raptor
#

just keep in mind that it doesn't work with sound paths

#

you need to give it a cfgSounds entry

trim tree
#

ahhhh
πŸ˜„

restive hinge
#

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...

hallow mortar
#

Your ! is in the wrong place

restive hinge
#

Is should be before trigger or the expression?

hallow mortar
#

! 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.

restive hinge
#

Right, thanks

hallow mortar
#

!(_lootCache inArea _cacheTrigger)

#

("an expression" can be just a single variable or command, provided it is or returns a bool)

atomic burrow
#

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?

restive hinge
#

Do you use ACE?

atomic burrow
#

Yes!

digital hollow
#
  1. set up a whitelist box for each role/playertype and place them where players can't access
  2. have action on accessible box do the logic to decide which specific whitelist the player should get, then open arsenal using that box.
atomic burrow
#

OK - thanks! Is there a reference for how to write that logic somewhere? I only found out today I could do something like this

restive hinge
# atomic burrow Yes!

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

digital hollow
# atomic burrow OK - thanks! Is there a reference for how to write that logic somewhere? I only ...

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;
atomic burrow
atomic burrow
digital hollow
atomic burrow
#

Thank you both again! I will go put this new knowledge into my mind and try to implement it correctly

restive hinge
#

Basically any boolean

#

I guess it would work like this:

player == mySoldier
hasty gate
#

is it possible to change player fov via scripts? I'm trying with:

cameraOn camSetFov 0.25;

but it doesnt work

modern meteor
#

Is there a way to automatically delete the save file/reset a mission when the mission has failed?

hallow mortar
winter rose
meager granite
#

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
spice kayak
#

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;

still forum
#

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

south swan
#
_meme = ["array", "of", "identifiers"];
_result = _meme select (_meme findIf {!isNil _x && {!isNull (currentNamespace getVariable _x)}});```...although it'd weird out if `findIf` returns -1
still forum
#

isNull doesn't take string afaik?

south swan
#

yeah, it most certainly doesn't notlikemeow

restive hinge
meager granite
winter rose
#

Not to be confused with: ? (SQF)

still forum
#

SQS*

indigo wolf
#

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.)

stark fjord
#

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.

quiet gazelle
#

i always use MS Excell for SQF editing
i'm scared

graceful juniper
#

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

sullen sigil
#

_unit setVariable ["ACE_Medical_MedicClass", 1, true];

stray flame
#

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

quiet gazelle
#

i guess that depends on your hardware

stray flame
#

hm, would there be an effective replacement?

#

instead of say 50 out-of-bounds triggers

sullen sigil
#

would it not be simpler to have inside of boundary triggers? πŸ€”

stray flame
#

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

sullen sigil
#

i dont understand why the but is a but

quiet gazelle
#

you could go for invisible walls if you're into that sort of thing

stray flame
#

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

quiet gazelle
#

you could define the playing area as a polygon and run a script that checks if the players are inside it

stray flame
#

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

stark fjord
#

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

stray flame
#

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

quiet gazelle
#

nah

stray flame
#

I'll hope for the best

quiet gazelle
#

50 triggers every 3 seconds will probably be fine

stray flame
#

should be

#

especially since they most likely wont ever need to activate simultaneously

astral bone
#

is Say3D broken? Is so, how?

warm hedge
#

Define broken

astral bone
#

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

cosmic lichen
#

Not sure why it was in that category. Maybe a copy & past mistake.

#

Command should not be broken

hallow mortar
quiet gazelle
#

is creating a super simple object faster if another super simple object with the same model already exists in the mission?

manic sigil
#

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 :/

stark fjord
quiet gazelle
manic sigil
#

Had a feeling that was the way, but couldn't think how to implement it.

rain mural
#

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.

hallow mortar
#

I would guess it just records the position of the group (either average or leader) every x seconds

#

*and then connects them with drawArrow

rain mural
#

That's my guess as well. Would certainly be cheaper than unitCap

meager granite
#

Wait until unit\group center moves X meters from last position, add position to array, repeat

stark fjord
#

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

rain mural
#

That method also makes sense. The arrows do seem equidistant.

stark fjord
#

Unless your whole mission takes place within 100m

rain mural
#

Split it into 1m segments? πŸ˜‚

#

Would be pointless at that level of detail.

hallow mortar
#

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).

rain mural
#

Ooh ok. Perhaps I'll look at trying both and see what happens.

stark fjord
#

Sure i guess record every minute. Would still give plenty precision and only 120x3d array

rain mural
#

You could use a 2d array and normalize the vec2

#

For direction

stark fjord
#

Distance based one just prevents cluttering if players dont move. Maybe hybrid between the two

twin oar
#

I’m trying to use the Warlords modules but it’s not letting me select a sector to cap

#

Any help?

stark fjord
stark fjord
#

But perhaps you just plop down exfil marker for last entry in array πŸ™‚

rain mural
#

Yeah

boreal parcel
#

whats faster even if only marginally, isEqualTo or ==? same for isNotEqualTo and !=

still forum
#

I'd assume isEqualTo

hallow mortar
hallow mortar
#

spoilers: it is a time-based tick and drawArrow

rain mural
#

Appreciated πŸ‘

gloomy aspen
#

Does anybody know if George Flores [GF Scripts] is still active in the community?

little raptor
torpid mica
#

why does vehicle leader _mygroup return myself even when iΒ΄m (player and groupleader) alive and in an vehicle?

little raptor
#

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

torpid mica
#
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

little raptor
#

why should it have any?

torpid mica
#

and it seems like it doesnt return the veicle

little raptor
#

it's not a supply vehicle

torpid mica
torpid mica
little raptor
#

getXXXCargo are supplied stuff... meowsweats

torpid mica
little raptor
#

there's no such thing as ammo level afaik meowsweats

#

you can compare the vehicle's original loadout with its current loadout blobdoggoshruggoogly

torpid mica
#

then i can count.. but thanks... iΒ΄m just dumb.

stark fjord
#

There is ammo but its funky

little raptor
#

that returns ammo count

#

in current mag

#

not a percent like fuel

stark fjord
#

Ye, hence funky πŸ™‚

torpid mica
#

do you know an easy way to tell if vehicle ammo is low? maybe with magazinesAmmo?

stark fjord
#

SomeAmmo if it works on vics

gloomy aspen
#

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;
hallow mortar
manic sigil
gloomy aspen
stark fjord
#

lets take a look, can you pastebin whole script?

gloomy aspen
hallow mortar
#

createSimpleObject uses the object's model centre, not its origin like a vehicle would

gloomy aspen
#

After its been created as a vehicle, thus being at the right height?

stark fjord
#

getPosWorld should retrieve model center

#

but it returns model center of previous tree that was there

hallow mortar
#

The docs for replaceWithSimpleObject say it shouldn't be used for many objects and definitely not in MP, so...not necessarily a good idea

stark fjord
#

do you have a list of stuffs you wanna replace aka GF_Vegetation_Replacement_Tree_array?

gloomy aspen
#

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.
hallow mortar
stark fjord
#

_x*

gloomy aspen
#

Thanks guys, makes sense! I realise ive used the function twice in code above, just ignore that!

stark fjord
#

dunno if it would work with terrain objects. Youd still have to hide them

little raptor
south swan
#
{
    ...
    GF_Vegetation_Replacement_Tree_Objects = _x;
        ...
} forEach GF_Vegetation_Replacement_Tree_Objects;``` ![notlikemeow](https://cdn.discordapp.com/emojis/700311897937018890.webp?size=128 "notlikemeow")
stark fjord
#

yeah im unsure what that is supposed to be

little raptor
#

probably meant to add them to an array meowsweats

#

but for what... blobdoggoshruggoogly

stark fjord
#

it foreaches thru that same array

gloomy aspen
stark fjord
#

you'd create an infinite loop that way

little raptor
#

no

south swan
#

well, not exactly. You'd derp the array loop tries to iterate over

little raptor
#

but anyway it doesn't seem to matter

little raptor
#

it just doesn't do anything

south swan
#

wut

little raptor
#

the variable gets assigned but what you iterate over remains unchanged

stark fjord
#
private _lol = [1,2,3];
{
    _lol = _x;
}  forEach _lol;

hint str _lol; -> 3

little raptor
#

so it will "work" but the next loop call will error out blobdoggoshruggoogly

little raptor
#

it's a wrong example

stark fjord
#

thats basically what its doing rn

little raptor
#

I know

#

but it won't break anything in that loop

south swan
#

systemChat inside the loop would make that test complete

little raptor
#

it would just say 1,2,3

south swan
#

and it does. Fun stuff

stark fjord
#

but loop still loops

little raptor
#

well yeah but you said it would be an infinite loop which is not true

stark fjord
#

yeah, i was wrong

#

it would inf loop if there was pushBack, stead of =

twin oar
#

How do I restrict the arsenal to a specific mod pack?

twin oar
#

Thank you!

sage heath
#

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

stark fjord
#

And how would player mark targets?

sage heath
#

their designator gives an 8 digit grid

stark fjord
#

And then?

sage heath
#

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

stark fjord
#

Are u using vanilla VLS?

sage heath
#

yes

#

i tried ITC but uhhhh dont really like it

stark fjord
#

i did that not long a ago. but player had to plant IR grenades on targets and VLS would fire missile at it

sage heath
#

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

stark fjord
#

ugh i think VLS can only lock on to actual targets as in objects

drowsy geyser
#

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
    };
}];
sage heath
#

sleep?

hallow mortar
#

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];
};```
stark fjord
stark fjord
#

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

sage heath
#

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

hallow mortar
#

Is it necessary for the players to observe the launch?

sage heath
#

yes because they’re gonna have to conduct bda afterwards

#

also who doesnt like a good light show?

hallow mortar
#

Not the impact, the launch

sage heath
#

oh its not necessary for that

drowsy geyser
# hallow mortar e.g. ```sqf if (_object1 getVariable ["paradox_var_epeCooldown",false]) exitWith...

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];
    };
}];
sage heath
#

they dont have to see the launch just the missiles come in

stark fjord
#

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"];```
hallow mortar
sage heath
hallow mortar
sage heath
#

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

stark fjord
sage heath
#

but i figured that can be reworked

sage heath
#

its a little janky but it might work? otherwise im trying drongos artillery

hallow mortar
#

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)

south swan
#

*when

sage heath