#arma3_scripting

1 messages Β· Page 631 of 1

open star
#

Do I have to define it above the action? because this is going into the init of the game object.

spark turret
#

i remember roughly that the new maps dont have roads as pasted on surface but something else? how do i detect if im on a road or not by script?

spark turret
#

does this detect the pasted road segments?

finite sail
#

yes

spark turret
#

very cool, thanks

finite sail
#

it returns a boolean

open star
#

@little raptor

So I'm using MusicCFG for it
does that not define it because it's not working

finite sail
#

if you're on a road true

#

if you want the actuall road object, you need roadAt

spark turret
#

boolean is fine. working on a script that shakes your camera if you drive offroad

#

and so far the detection was based on surfacetype comparing to a list of allowed surfaces

#

but isOnroad is so much better

finite sail
#

yes

little raptor
#

@open star What's not working? Post your code

open star
#
object addAction ["Music On", 
{
  isNil {
    {
      playSound3D ["FortunateSon", _x]; //music file must be defined
    } forEach [ls1, ls2, ls3, ls4, ls5];
  }
}]```
little raptor
#

You must provide the path to the music file

open star
#

so

little raptor
#

cfgMusic entries won't work

#

also, did you define object?

open star
#

\Music\0FortunateSon.ogg

#

Yeah, I just named it object because I was being lazy.

little raptor
#

Is the music file in your mission folder?

#

If so:

object addAction ["Music On", 
{
  isNil {
    {
      playSound3D [getMissionPath "\Music\0FortunateSon.ogg", _x]; 
    } forEach [ls1, ls2, ls3, ls4, ls5];
  }
}]
open star
#

Yeah right I'll give that shot.

#

giving me an inavlid number in expression error.

little raptor
#

post the full error

#

Also remove the comment

#

Maybe that's what's causing the error

spark turret
#

anyone a smart idea on how to tell if a car is well suspended or not? i guess an 8 wheel APC gets through terrain smoother than a city car

open star
#

yep

#

lmaoo

#

I deleted comment and bam worked.

#

lovin' ASL lmao

spark turret
#

at what point does a player loose his client scripts? apparently not respawning. after relogging on a MP server?

#

if the slot-unit has the script in init, will they be run again on relogging?

still forum
#

What u mean by "client scripts"

#

Relog should reload the mission I think... And thus rerun init?

spark turret
#

im trying to figure out how to reliably give code to every client with as simple edits as possible. so just add the code to the slot-units init field in editor

winter rose
#

won't work like that

#

initPlayerLocal.sqf

spark turret
#

oh crap init field gets run on every client lol
alright ill do initplayerlocal then

#

thx

#

btw, i suspect my script is killing the performance. when i tab out the game for a couple minutes, the frames drop to zero and take like 2 minutes to catch back up. any way to verify?

winter rose
#

if you are talking about Steam FPS counter, it drops to 1 sometimes yes

spark turret
#

Not just the counter. Its literally at 1 fps for 2 minutes straight

winter rose
#

it can happen if all sounds/tasks are added at once when you come back yes

#

since there is -noPause in MP

spark turret
#

hm interesting. very wierd. i dont do any of that.
ill play around a bit more and see if its caused without my script too

worn forge
#

Can't possibly evaluate what's causing your FPS problem without knowing what kind of scripting methodology you're using.

winter rose
#

@spark turret does it happen in SP too?

spark turret
#

it didnt at first, now it did. im restarting, arma compelety ground to a halt

winter rose
#

maybe uiSleep scripts

spark turret
#

i think my install is effed. i restarted and even the main menu is at 1 fps lol. gonna reboot PC, try again and then annoy dedmen until i get a fix πŸ˜„

#

Or i created some kind of ram leak which exists outside or arma with my script :D

little raptor
#

@spark turret Any draws?

#

I mean 3D draws

#

Because I've had that happening before when I used drawXXX3D while game was not focused.

#

Or maybe it happens if you're just using onEachFrame

#

I'm not sure about that one

spark turret
#

no, i have zero clue what caused it. i have a 1 second timed loop with very simple checks like isOnRoad and speed vehicle.

winter rose
#

sleep with sleep or uiSleep?

frosty stratus
winter rose
#

customWaypointPosition @frosty stratus πŸ™‚

frosty stratus
#

Is there a scripted way of setting it as well?

spark turret
#

i use sleep to suspend

tough abyss
#

Ah! That's what

customWaypointPosition @frosty stratus πŸ™‚
@winter rose So that's what they're called. I would also like to know how you disable them. Those things disable all need for range estimation in the game.

frosty stratus
#

If you are running on a server you can disable them in the servers config @tough abyss

spark turret
#

start in veteran mode does similar things

winter rose
#

Is there a scripted way of setting it as well?
nope

I would also like to know how you disable them.
that's a difficulty setting yes

tough abyss
#

Senkyoo!

spark turret
#

can i just use

[thingObject, true] call BIS_fnc_moduleTracers;

to spawn ambient tracers?

#

that seems to simple 🧐

#

hm okay no that doesnt work

crude vigil
#

Key word in there is "module"

spark turret
#

well im following the bikis guide using:

private _moduleGroup = createGroup sideLogic;
"ModuleSmokeWhite_F" createUnit [
    getPosATL thing,
    _moduleGroup,
    "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];"
];

which works for smoke but not the tracers

#

oh my god are you kidding me.
the tracers module is literally spawning an invisible boat with a minigun to fire randomly into the sky LMAO

#
    _veh = createvehicle ["B_Boat_Armed_01_minigun_F",position _logic,[],0,"none"];
    _veh attachto [_logic,[0,0,10]];
    _veh hideobject true;
    _veh setvehicleammo 0;
#

okay no, im gonna make my own method. thats just to dirty

tough abyss
spark turret
#

Will look into it tomorrow thx :)

tough abyss
#

You know all those tacticool screenshots of players inside a helicopter with interior red light?
Well I basically want to recreate that for my MP mission.

Attaching the light cones to the helicopter interior ceiling (using AttachTo or BIS_fnc_attachToRelative) works fine. But when the helicopter executes a BIS_fnc_UnitPlay, the lights have a tiny amount of positional lag. Result is that the helicopter looks like it's pulling a string of Christmas lights.

How do other people fix this?

winter rose
#

they create a light locally I suppose

tough abyss
#

This is helpful.

#

Full examples - Dark Souls hehye

sonic thicket
#

Hello everyone, I tried looking up a way to move an object ( basically create an animation where there is no animation ) but could not find a way on how to do this, would anyone here know a suitable command for this? ( It's for moving a object from top to down or from right/left to the opposite like a sliding door )

sonic thicket
#

vehicles & AttachTo seem to provide a solution πŸ™‚

young current
#

other than that you could setPos each frame

#

and calculate the change to be smooth

little raptor
#

@tough abyss Use eachFrame and visual position instead of attachTo

opal stag
#

excuse my total lack of knowledge here, but is there anywhere I can store and parse custom data on an object? I have a static mortar tube that can be deployed either through vanilla assembly as a backpack item, or through ace as a shoulder launcher item. When it is disassembled to backpack item, arma handles the magazines loaded into it and saves mag quantity and type. When I disassemble through scripts and ace action, I have no way of handling loaded mags. Currently, redploying the weapon through scripts just spawns a brand new fully loaded one. Can I dump a string with magazine classes and quantities somewhere on the launcher item itself when the static tube is disassembled into it?

little raptor
#

I'd say yes
IIRC there is an event handler that detects what object(s) your launcher disassembles to

opal stag
#

I don't have a problem yet with how I want to figure out what is loaded, I just need to find somewhere that says the tube is loaded with "5 HE, 2 Smoke". I am not sure if there is a way to store that info as a string in the init or something that I can parse through later

little raptor
#

There are several magazine commands you can use
As for storing the variable, try setVariable

#

I'm on my phone so I can't provide more info on that

opal stag
#

I can look through that, I am just worried how that will carry to multiplayer if a character dies and respawns with another tube.

opal stag
#

I think I am going to look to see if I can add some kind of custom attribute to the object like ace adds "Is Repair Facility", etc. THank you for the link though, I will read through it

languid oyster
#

I am looking for a way to find out, if an object was spawned inside of a rock. Is there any nice function for that?

willow hound
#

No.

winter rose
#

you could detect distance with rock center and its bounding box, etc

neat sage
#

how would i place a trigger zone that disables the movement of ai when they enter it?

#

cause placing a trigger zone and running disableAI "MOVE" isnt dooing anything in it

winter rose
#

how do you use disableAI? πŸ™ƒ

neat sage
#

{ _x disableAI "MOVE"; } foreach units _this;

winter rose
#

won't work

#

_this doesn't exist
use thislist

#

forEach thislist

neat sage
#

ah

#

thought i was doing something wrong

#

didnt work 😦

#

nvm. i messed up in the condition. worked πŸ™‚

spark turret
#

if you hover over the triggers code name, it displays a tooltip telling you what variables are available iirc.

#

which should be thisList and thisTrigger

winter rose
finite sail
#

firednear eh doesn't activate for mounted units 😦

#

mounted units firing a weapon activates the firednear EH on other nearby units

#

but not on himself

#

same for units in ffv seats, their firednear eh doesnt activate when they fire

winter rose
#

add the event to the vehicle?

finite sail
#

yeah, trying that now

#

i expect that will work

winter rose
#

you could also use "FiredMan"

finite sail
#

yeah, firednear is preferable for this use case

#

its players temporarily made setcaptive true for an infiltrate-the-enemy-town secondary mission

#

if they shoot a weapon, they and players nearyby are setcaptive false

#

so firednear is useful

#

ill test with the eh on the vec first

young current
#

Could be set in the players fired eventhandler too

#

To check where they are when they fire

finite sail
#

that too, but i suspect the same issue with a vehicle turret will arise

young current
#

Possibly

finite sail
#

i dont have a lot of vehicles and there's an existing getin EH , so the framework is already in place for putting the firednear on vehicles

#

thats first

#

oh, its actually a getinman eh, but i can work with that

#

its s shame there isn't a way of checking what EHs are already on an object

#

if i make a new eh everytime a player gets in a vehicle via GetInMan, im going to have multiple eventhandlers

#

if 2 players get in same vec

winter rose
#

add only one EH on every vehicle, that triggers a mechanism that checks which units are there

finite sail
#

yes, only add the eh if the vec is empty?

winter rose
#

no, what about getting in/out?

#

unless you add when empty - remove when empty

finite sail
#

yeah, i'd need to remove the eh when the last player gotout

#

or a player getout - get back in again would duplicate the eh

#

probably easier to {addeventhandler firednear} foreach vehicle

winter rose
#

we would need an "EntityCreated" mission EH… -hint hint-

finite sail
#

hmmm

#

ok, not familiar with that puppy, lets have a look

#

oh i see, you want one, rather than suggesting i use one πŸ™‚

#

hehe

winter rose
#

yup ^^ I felt its lack at some point

finite sail
#

yes

#

just on the offchance, i looked allVariables on the player

#
(allvariables player) findif {"getin" in (tolower _x)}```
#

other eventhandlers are mentioned there, but not the GetInMan,

#

I thought I might be onto something there πŸ™‚

#

but no

winter rose
#

```sqf ^^

finite sail
#

πŸ™‚

#

ugh

#

lol

winter rose
#

see pinned message,
```sqf<line return>
your code
```

#

it's a pain at first but then it's wonderful :p

finite sail
#

yey

#

i think.. is that right?

winter rose
#

not yet, you have "sqf" written

finite sail
#

wow, im good at this

winter rose
#

```sqf
(allvariables player) findif {"getin" in (tolower _x)}
```
becomessqf (allvariables player) findif {"getin" in (tolower _x)}

finite sail
#

done it

#

thanks lou

#

im a bit embarrassed that it took me so long lol

winter rose
#

no one saw anything (and I won't tell against πŸ’°)

finite sail
#

hehe

#

ok, confirmed @young current , fired eh added to player doesn't activate when he fires a vehicle gun

#

as expected

#

will try adding the firednear to vehicles next

little raptor
#

@finite sail

ok, confirmed @HorribleGoat , fired eh added to player doesn't activate when he fires a vehicle gun
Use FiredMan instead of fired

#

or a player getout - get back in again would duplicate the eh
No need to remove it. Just set var and you won't duplicate anything

#

just on the offchance, i looked allVariables on the player
other eventhandlers are mentioned there, but not the GetInMan,
That's only a list of variables. It has nothing to do with event handlers

#

will try adding the firednear to vehicles next
@finite sail
It most probably won't work
Afaik it only applies to entities

finite sail
#

firednear does work on vehicles

#

specifically on quadbikes and prowler

#

it works when a player fires near it, that is

#

firednear eh added to a vehicle also works when that vehicle weapon is fired by a player

#

ok, some progress πŸ™‚

#

aside.. i wish quadbikes had ffv, crazy that they dont

silk ravine
#

Hi there folks, I am sure I did an oopsi, but not sure.
This condition is within a while loop. _x usually means usually whatever the while loop is running through.
Now I want to have the content of my condition fed into my array _shellRegistry, but how?
sqf if ((_cram nearObjects["Rocketbase",_radarrange]) || (_cram nearObjects["MissileBase",_radarrange]) || (_cram nearObjects["ShellBase",_radarrange])) && _canIntercept && _isDecending) then { _x append _shellRegistry; };

midnight spoke
#

Hello guys I'm trying to play Music via a intro.sqf together with a text intro.
I defined the music in description.ext and call the intro.sqf via the init.sqf.
The Intro text works but the Music does not play.
Here is my intro.sqf

_cam cameraEffect ["internal", "BACK"];
CutText ["","Black Faded"];
sleep 1;
playMusic "IntroMusic";

sleep 0.5;
titleText ["Der, der weiß, wann er kÀmpfen sollte und wann nicht, wird siegreich sein.", "PLAIN", 2.0];
sleep 5;
titleText ["und um den Krieg zu ΓΌberleben, muss man selbst zum Krieg werden.", "PLAIN", 2.0];
sleep 5;
titleText ["~Malex Ason", "PLAIN", 2.0];
CutText ["","Black Faded"];
sleep 3;
titleText ["Operation Withering Dusk", "PLAIN", 2.0];
CutText ["","Black Faded"];
sleep 3;
CutText ["","Black in", 0];

_cam CameraEffect ["Terminate","back"];
CamDestroy _cam;

scriptDone introSeq;```

and here the description.ext.

```class CfgSounds
{
    sounds[] = {};
    class Golf22
    {
        // how the sound is referred to in the editor (e.g. trigger effects)
        name = "Golf22";
        // filename, volume, pitch
        sound[] = {"Sounds\c_m01_35_lift_going_down_ABB_0.ogg", 60, 1};
        // subtitle delay in seconds, subtitle text
        titles[] = {1, "Golf 2-2 to Croassroads, we're under fire, Golf 2-2 sustaining heavy fire from our..."};
    };
    class Golf41
    {
        // how the sound is referred to in the editor (e.g. trigger effects)
        name = "Golf41";
        // filename, volume, pitch
        sound[] = {"Sounds\c_out2_85_the_end_of_all_things_MEM_0.ogg", 60, 1};
        // subtitle delay in seconds, subtitle text
        titles[] = {1, "Mayday, Mayday! Golf 4-1 going down!"};
    };
};

class CfgMusic
{
    tracks[] = {};
    class MyIntro
    {
        // display name
        name    = "IntroMusic";
        // filename, volume, pitch
        sound[]    = { "Sounds\IntroMusic.ogg", 1, 1.0 };
    };
};```
Can anybody tell me what I'm doing wrong? πŸ˜„
robust hollow
#

it might be playMusic "MyIntro";

midnight spoke
#

but why spaced_out_thinking

robust hollow
#

because the name property is only a display name, as the comment suggests. its just for show.

midnight spoke
#

oh

winter rose
#

display in e.g triggers yes

midnight spoke
#

Ok so how can I let it play from the intro.sqf

winter rose
#

it might be playMusic "MyIntro";
?

midnight spoke
#

I don't follow my brain stopped working

#

Oh

#

I'm so dumb

#

thank you

willow hound
#

@silk ravine A while-loop has no _x.

silk ravine
#

oof

#

you are right

#

damn

willow hound
#

What are you iterating over?

silk ravine
#

A while loop that has the condition to run as long as the object is alive

#

while that, the loop comes to a point where I want to feed specific objects that come into the range of the looping object.
I basically want to fill _shellRegistry with anything that belongs to the upper if condition and returns true on _isDecending and canIntercept
I just do not exactley know how, without doing nasty array fillers with +

little raptor
#

(_cram nearObjects["MissileBase",_radarrange]) || (_cram nearObjects["ShellBase",_radarrange])
wat?

#

is that supposed to be a "condition"?

#

and even if it was (which it's not), that command is really slow

willow hound
#
{
  _x pushBack _shellRegistry;
} forEach ((_cram nearObjects ["MissileBase", _radarrange]) + (_cram nearObjects ["ShellBase", _radarrange]));

Might do part of what you are trying to do.

little raptor
#

You should do lazy evaluation

willow hound
#

Not sure about _isDecending and _canIntercept, need more info about that.

smoky rune
#

Is there any way to check if LinkedItemsAcc, LinkedItemsOptic, LinkedItemsUnder and LinkedItemsMuzzle in weapon config are not empty in mission environment?

winter rose
#

by config reading yes getArray

sonic thicket
#

Hello everyone, I have two switches with addAction commands. Switch one has the addaction is a "Power on" switch and switch two is a "Open Doors" one.
I want to make sure you cant "Open Doors" without having the "Power on"

I tried using
missionNamespace setVariable ["PowerOn_01", "true"];
in the addaction for the power switch and

in the door open switch but before the addaction.

This does not work though, it throws an exception so how would I use a variable to block usage of the Init script that is assigned to an object?

cosmic lichen
#

You can also set the condition of the 2nd action to "missionNamespace getVariable ["BunkerSwitch_01", false]"

#

Is it single player or multiplayer?

#

@sonic thicket

sonic thicket
#

Testing in Eden but will be a small COOP so Multiplayer

little raptor
#

it throws an exception
unscheduled environment error

sonic thicket
#

Hmm i see, so a [this] execVM would be the solution?

#

Ill go ahead and try that πŸ™‚

little raptor
#

spawn

sonic thicket
#

Oh yeah ofcourse

#

Thanks for the help!

little raptor
#

It would be more optimal to add the action when that other switch activates

#

So no need for waitUntil

#

In other words, add the action where you set BunkerSwitch_01 to true

sonic thicket
#

that idea totally missed me, thanks! that'll be much better indeed πŸ˜„

#

Always good to skip on any loop commands

little raptor
#

yeah. waitUntil can "eat" your scheduler cycles

finite sail
#

waitUntil in the init.sqf

#

always fun when you screw the condition up

#

ctrl alt delete

#

BTW, what we were talking about earlier @little raptor , I did end up using FiredMan

#

works a treat πŸ™‚

little raptor
#

Good to know! πŸ™‚

finite sail
#

indeed

velvet merlin
#

when AI switches to autocombat, it has some timeout threshold to return to normal behavior again (noted by GL radio "clear")
is switching autocombat off and on again achieving the same?

little raptor
#

I don't think so

spark turret
#

is there a model for tracer bullets that already comes with its light source?
if i spawn

_bullet = "ACE_580x42_Ball_Tracer_Red" createVehicle ((position player) vectorAdd [0,0,2]);

it only spawns the bullet without the tracer effect

little raptor
#

@velvet merlin
The only method I know that can return them back to the old state is:

_grp = group _unit;
_tmp = createGroup side _grp;
_cm = unitCombatMode _unit;
_team = assignedTeam _unit;
_unit enableAIFeature ["AUTOCOMBAT", false];
[_unit] joinSilent _tmp;
_unit setBehaviour "AWARE";
[_unit] joinSilent _grp;
_unit assignTeam _team;
_unit setUnitCombatMode _cm;
deleteGroup _tmp;
finite sail
#

7,62 to the face will switch off autocombat

little raptor
#

or setDamage

flint kraken
#

Anyway to fix the "Script #40 issue when making a Exile server?

little raptor
#

That's not really a scripting question. Ask the Exile team

#

is there a model for tracer bullets that already comes with its light source?
@spark turret did you try giving some velocity to the bullet?

spark turret
#

yeah it works. i looked into alias ambient battle and he attaches lightsources. that looks like an Alien flak, not like real tracers

velvet merlin
#

@little raptor thanks. i am aware of the old group switch workaround. what is the difference to combatMode off/on?

little raptor
#

You mean Auto Combat?

velvet merlin
#

yeah i just have experience switching it on and off from player lead AI - for AI only group only either off or on all the time

neat sage
#

guys. how would i go about changing the mode (safe/aware) of all ai units alive from the console?

winter rose
#
{ _x setBehaviour "COMBAT" } forEach allGroups```
neat sage
#

allGroups?

spark turret
#

lou, do you have any smart ideas about my tracers?

neat sage
#

would it matter if they are different sides?

spark turret
#

then do select {side _x == "WEST"}

neat sage
#

ah. thanks @winter rose . will try

winter rose
#

lou, do you have any smart ideas about my tracers?
hum sorry what? well, you could create bullets and set velocity yes?

neat sage
#

how bout if i want all to crouch Lou?

#

{_x setUnitPos "MIDDLE"} foreach allUnits; should work right?

little raptor
#

yes

velvet merlin
brave elk
#

Is there a function that says like:
Am i being looked at or am i out of vision for everyone?

#

If not then [Feature request] I guess πŸ˜‚

little raptor
#

@velvet merlin
set

_unit enableAIFeature ["AUTOCOMBAT", false];

get

_unit checkAIFeature "AUTOCOMBAT";
#

AutoCombat is not a separate behavior

#

It's part of the AI brain

velvet merlin
#

when AI switches to autocombat, it has some timeout threshold to return to normal behavior again (noted by GL radio "clear")
is switching autocombat off and on again achieving the same?

little raptor
#

@brave elk No.
You can loop through all units and find if the line connecting their eyePos to your aimPos falls inside the FOV of the unit. Then do an actual check with checkVisibility

brave elk
#

Right ok thanks

velvet merlin
#

so is it the same, or is it not?

little raptor
#

Nope

#

autocombat off prevents them from switching combat mode (behavior) automatically

#

that's it

#

afaik the period is hardcoded into their "brain" so I don't think it's fixable either

winter rose
#

then what about disabling autocombat then setbehaviour?

little raptor
#

anyway, that's not what kju meant

meager oxide
#

does anyone know if it is possible to add the edit vehicle appearance to a ACE vehicle interaction?

little raptor
#

You mean the virtual garage?

meager oxide
#

Yeah but just for that current vehicle if you get what I mean

little raptor
#
["Open",[ true, _vehicle ]] call BIS_fnc_garage; 
#

opens the garage for the vehicle you want

#

Or maybe it uses it as a position

#

I've never used the garage in scripts

meager oxide
#

Ok ill give it a try, I am trying to get it so you can walk up to the vehicle ace interact and change the camps and components like slatt armour

little raptor
#

If you look at the function file (BIS_fnc_garage) you can figure out how it works.

finite sail
#

is quite good for AI

#

and is fast

little raptor
#

it's 2d

brave elk
#

Thanks

meager oxide
#

ok thanks @little raptor

topaz field
#

Quick question

#

Say I'm running am multiplayer mission

#

and player walks into a trigger and executes this

#

this = [] execVM "talk1.sqf";

#

Will it be just local to him because of this

#

Or will the other players see it also

winter rose
#

the script will execute on every machine the trigger executes, no matter your this usage

exotic flax
#

wouldn't that create an error anyway? since this is protected?

topaz field
#

No the line doesnt cause any errors

exotic flax
#

because that line of code will set the output of that script in a variable called this πŸ€”

topaz field
#

@winter rose So just to make sense of that for my own clarification If I have person A, B & C

#

If B walks into the trigger B will only see it and A & C Wont

winter rose
#

@exotic flax same with 0 = ; maybe because it is unscheduled

#

@topaz field it depends on how your trigger is defined.

exotic flax
#

could be, although I wouldn't do it, since it may f-up other scripts which use this properly

topaz field
#

as in "Present, OPFOR" or "Present, Any player"?

still forum
#

wouldn't that create an error anyway? since this is protected?
@exotic flax
Why would this be protected? Only command names are protected. this is just a local variable

#

And 0 is also not a command name

exotic flax
#

it's Arma, nothing makes sense 🀣

still forum
#

No it's not related to unscheduled

#

Everything makes sense when you understand how it works

exotic flax
#

but not everyone has access to the source code πŸ˜‰

winter rose
#

iirc I tried 0 = 5 and it threw an error, but I might be wrong πŸ€”

still forum
#

It actually sets a variable with the name "0" you can getVariable it.

#

but not everyone has access to the source code πŸ˜‰
@exotic flax
You don't need to.
When I say "command names are reserved variables"
That doesn't mean that the name of a local variable, or a number are reserved variables, they are not commands, and only commands are reserved, so why the hell would they?

#

Just apply some logical thinking

exotic flax
#

this is a global variable, which means it can be overwritten.
And it WOULD make sense to have it protected since it's used all over SQF to prevent that

hollow thistle
#

why, it's only used in unscheduled environments. So there's no risk someone overwrites the value you're working on.

still forum
#

No, this is a local variable (which is not logical, but doesn't change anything here)

#

Might make sense to protect it, but fact is "command names are reserved names" and nothing else.

winter rose
#

so it acts like a _this, 100%?

still forum
#

Yes

#

Probably...? πŸ€”

#

It reads as a local variable, not sure if = will write as a local too

hollow thistle
winter rose
#

kewl
So global var this = 500 will never be impacted (but you can only access it through getVariable in local-this-equipped scripts)

still forum
#

But local/global is irrelevant to the fact that it's not a command

#

Who uses a global variable called "this" anyway :u that's crazy

winter rose
#

yeah well, I still have nightmares after doing true = false in Arma 2 πŸ˜„

exotic flax
#

true, I use that for that 🀣

still forum
#

The reserved variable thing that they did to "protect" is nonsense btw. There is no need to do that to make it safe.

#

I might actually make it properly safe the correct way.
That way all global variable accesses will also become faster...

winter rose
#

moar perf? always welcome, be sure to not have side effects though :3

still forum
#

Every global variable read, first checks if there is a nular command with same name. Everytime you read the variable

#

Even though it already knows that at compile time.

winter rose
#

read, not set?

#

well, yeah I guess.

still forum
#

Oh right, set too, but only for the bogus "reserved variable" check that's actually not needed at all

winter rose
#

yeah both are needed. what would be your solution?

still forum
#

Both? No neither are needed

winter rose
#

well, a check is needed?

still forum
#

You only need to check once at compile time, for the variable reads.

Not check on every read and every write

winter rose
#

so you would catch a call compile "player = 5"

still forum
#

Why catch?
There's nothing wrong with that.
That sets the global variable "player" to 5

winter rose
#

only accessible through getVariable hopefully

still forum
#

Yeah. Like it is now, already

winter rose
#

so you would make the commands "not protected" anymore
I am afraid it will only bring more confusion

#
player = 5; // no error
hint str player; // hurr durr not 5
still forum
#

Will probably have to leave that, as warning to people that they are doing something weird they probably shouldnt

winter rose
#

yes please… keep the script error (+ log warning?) if they don't use setVariable

still forum
#

Could do that compile time too tho

winter rose
#

That's what I thought you had in mind at first

still forum
#

Not sure how big the performance overhead of that "needless" check is

exotic flax
#

... and have more people in this channel with broken scripts from l*fe frameworks 🀣

still forum
#

You read variables more than you write, so the read fix is more important

exotic flax
#

reading variables should be "I don't care what it is, I just return it"
writing variables can have all the checks in the world (so that reading never fails)

#

so player can never be overwritten, but will also not care what it is when getting the value

winter rose
#

hint str setDir ^^

exotic flax
#

currently does nothing too πŸ˜‰

still forum
#

Quite sure that error never existed with non-nular commands.
As only nulars have the weirdness of sharing the same instruction with variables

winter rose
#

do something!

#

enhance!! optimise!.!

still forum
#

exterminate

#

Maybe I should sleep

topaz field
#

If I was to write "global" instead of "this"

#

Would that mean people in multiplayer could also see the effects of trigger or script

little raptor
#

locality of a script has nothing to do with the handle name

exotic flax
#

That doesn't matter...
Triggers will execute the code for everyone, which is why you can use thisList (list of all objects in trigger area, based on 'Activation') to limit on which client it will be executed

little raptor
#

Triggers will execute the code for everyone
there are also local triggers

exotic flax
#

if you use createTrigger to create one, when made in the editor they're (always?) global (unless they added a checkbox for that, never used it)

little raptor
#

there is a checkbox for server only

exotic flax
#

which will than never execute on a client, which doesn't make sense (unless you remoteExec stuff to clients)

little raptor
#

which doesn't make sense
what doesn't make sense?!

exotic flax
little raptor
#

oh. ok. I didn't realize you were referring to that!

topaz field
#

Just decided to be smart and have some initiative but by using "remoteExec" It should execute the script for the clients on the server correct?

little raptor
#

if you want the code to execute on the server only, just set the trigger to server only

#

but to answer your question, the answer is yes. remoteExec ["fnc",2] executes the code on the server

topaz field
#

Well Im a bit confused by the entire situation I have gotten myself into

#

Whats the difference between executing code on the "Server only" and peforming remote exec

#

because I have a script and I know it only executes locally now Im in a wild goose chase looking for a way to make it execute globally and still work XD

#

for a MP Mission

little raptor
#

executing code on the "Server only"
I was referring to the trigger.
The trigger condition only runs on the server and so does its activation code

When you use remoteExec, you ask the server to execute your code on specific target machine(s)

topaz field
#

so

#

Server only executes server wide

#

remoteExec executes server wide but only to specific people

#

or "machines"

little raptor
#

no

#

Server only > Server only
remoteExec > Depends on target

#

If you explained what you're trying to do I could help you out

#

Such as what your script does and stuff

topaz field
#

Yep Let me get it

#

Okay so I have a person

#

And when they enter the trigger (Which is set to "Present","Opfor")

#

executes this in the Activation

#

h2 say3D ["ring1", 150, 1]; execVM "talk.sqf";

#

let me get the sqf

#

sleep 1;
["Dimitri", "Hello?"] spawn BIS_fnc_showSubtitle;
sleep 2;
["Dyatlov", "DIMITRI!"] spawn BIS_fnc_showSubtitle;
sleep 2; ```
#

Now they work

#

But to my little to none knowledge it only executes locally to the person that walks into the trigger which means the rest of the people in the multiplayer server wont hear the noise nor also see the subtitles

#

Which is why I want to make the script execute globally so the rest of the people in the server hears them

little raptor
#

This "person" that walks onto the trigger is not a player right?

topaz field
#

It is

#

it is a player

little raptor
#

Ok so when a player steps onto the trigger, should every player (regardless of their side or where they are) be able to see the subtitle?

topaz field
#

Yes because the players are all on one side together

little raptor
#

and in one spot?

topaz field
#

yep

little raptor
#

well that makes it easy:

topaz field
#

within 50m if we need to be specific for the time period in which the script is being used

little raptor
#

set the trigger to server only (there's a checkbox)
talk.sqf

h2 say3D ["ring1", 150, 1];
h2 say3D ["pickup1", 150, 1];
sleep 1;
["Dimitri", "Hello?"] spawn BIS_fnc_showSubtitle;
sleep 2;
["Dyatlov", "DIMITRI!"] spawn BIS_fnc_showSubtitle;
sleep 2; 

trigger activation code:

["talk.sqf"] remoteExec ["execVM", 0]

if you want to limit it to like players within 30 meters of h2

["talk.sqf"] remoteExec ["execVM", allPlayers select {_x distance h2 < 30}]
topaz field
#

Ahhh okay so Just to understand the activation code

#

What is the use of using execVM

#

Ahh okay that will help me a lot because I believe I might need something like that later on in my mission

#

Thank you very much

little raptor
#

What is the use of using execVM
it executes your talk.sqf script

#

You could also remote exec each part of that in the trigger activation code (although you'd need to spawn the code because of sleep)

#

but this way it is better

#

it would be even better if your script was defined as a function

topaz field
#

I know the scripting done in a3 is unique but what code is it based on?

#

C?

#

JavaScript?

little raptor
#

It bears several similarities to many languages.
The engine code is in C++ afaik
I'd say python and C++ is what it draws most from

#

but it's still very different from those too

topaz field
#

Yea I noticed

#

Also heads up the Say 3D aren't working

#

Let me just test it again

#

Yes they aren't working unfortunately

little raptor
#

the subtitles work?

topaz field
#

Yes

#

But there is no sound played

little raptor
#

well it probably means your sound files are not defined for them

mortal sapphire
#

Scripting is sqf based

#

I misread the question, whoops

topaz field
#

Well when it was all local they played fine

little raptor
#

what is h2? is it defined?

topaz field
#

h2 is a cellphone

#

and the 'has its variable name set to h2

young current
#

is it an object?

topaz field
#

ye

young current
#

and how does not say3D work?

topaz field
#

idk

young current
#

how do yo know it does not work?

topaz field
#

I had leopard do an excellent job and help me with the script right

#

Well because Ive had it working

#

I had it working locally right

#

then leopard helped me make the script global

#

And for some reason it doesnt work since we made the script global

little raptor
#

@topaz field test this:

systemChat str (isClass (missionConfigFile >> "cfgSounds" >> "ring1"))
young current
#

so say3D works but your script does not

little raptor
#

I mean put it in talk.sqf

topaz field
#

Yea its in there

#

wait

#

wait

#

I think

#

I have done a major major major blunder

little raptor
#

if it says false, the problem is the sound file

topaz field
#

like super silly

#

I think ive been looking at the wrong notepad++ tab

little raptor
#

so say3D works but your script does not
the script works, but say3D doesn't! πŸ™ƒ

topaz field
#

Brooo

#

I was looking at the wrong thing the entire time

#

Talk about smol brain haha

#

Im going to drink a bottle of water now

#

that might be wise

ashen urchin
#

Hi, I would like that when the player respawn, he goes the arsenal that opens automatically how to do?
2 hours of research and I just feel like I'm using the wrong words.

topaz field
#

I dont know specifics on how to do it exactly but

#

Once he spawns in a trigger it then opens it for them?

#

So it could be a very simple activation line command

little raptor
#

@ashen urchin look up:
Respawn event handler
BIS_fnc_arsenal

topaz field
#

@little raptor Thank you for helping me make that script global. I've taken what you done and applied it to another line of code I also am using I would just like to ask you if it looks all good.

#

addAction [Answer the Phone", "talk1.sqf"] remoteExec ["execVM", 0]

little raptor
#

No

topaz field
#

Thats a very flat response 😎

little raptor
#

Take a look at the wiki page for remoteExec

#

I'm on my phone atm so harder for me to help now

topaz field
#

Okie dokie, I had a look earlier but couldn't particularly decipher much. But I will look again

#

I understand

ashen urchin
#

@little raptor Thanks to have show me the light smile

little raptor
#

@topaz field long story short:

[unit,  ["Answer the Phone", "talk1.sqf"]] remoteExec ["addAction", unit]
#

Something like that

#

If you want to run it for everyone:

topaz field
#

Thank you I'll give it a crack

little raptor
#

I was gonna say something else:

#
[{Player addAction ["Answer the Phone", "talk1.sqf"]}] remoteExec ["call", 0]
#

Hard to type on the phone!

topaz field
#

So much variety!

little raptor
#

It's because the player object is different on each PC

#

So I passed the code to the client to be executed there

topaz field
#

You are using "Player" as the variable name of the object correct?

little raptor
#

No

#

Player is player

#

It's a command

exotic flax
#

no, it's a magic variable which always contains the player unit

little raptor
#

It's not a magic variable

#

It's a command

exotic flax
#

still magic

topaz field
#

I agree

little raptor
exotic flax
#

it's a thing which always contains the player object

little raptor
#

@topaz field I think you wanted to add the action to h2 right?

topaz field
#

Yes

little raptor
#

If so:

[H2,  ["Answer the Phone", "talk1.sqf"]] remoteExec ["addAction", 0]
topaz field
#

But your second line you produced worked

ashen urchin
#

I have the impression to forget something.. but idk

this addEventHandler [[this, true] call ace_arsenal_fnc_initBox];
little raptor
#

You're not providing the event handler type

#

Maybe this is what you meant:

this addEventHandler ["Respawn", {[_this#0, true] call ace_arsenal_fnc_initBox}];
ashen urchin
#

Why _this#0 ?

little raptor
#

_this is what is being passed to the code (an array)
_this#0 selects the first element of the array

#

@ashen urchin
params ["_unit", "_corpse"];

#

According to the wiki

#

So the first element of the array is the respawned unit

#

The second element is the corpse

ashen urchin
#

Ok, i haven't no more error but it didn't work

#

I put the code directly on my user. But it's better on the respawn point ?

exotic flax
#

put the following on a container (or unit for that matter):

[this, true] call ace_arsenal_fnc_initBox;

and you should be fine.

#

no need for event handlers

ashen urchin
#

It was my first try but it didn't work too, but i just tried on 3den

little raptor
#

I think he wants to show the arsenal after respawn?

ashen urchin
#

I want that player select his spawn, and direct have his arsenal

#

So directly after respawn

little raptor
#

Do you have ace?

ashen urchin
#

yes

little raptor
#

You're using the wrong arsenal fnc

#

It's ace_arsenal_fnc_openBox

ashen urchin
#

Ha

little raptor
#
this addEventHandler ["Respawn", {[_this#0, _this#0, true] call ace_arsenal_fnc_openBox}];
uncut sphinx
#

Is there an event handler that fires locally when the player quits or leaves a mission?

#

I am setting aperture to have brighter nights but the setting does not reset when I quit my mission

ashen urchin
#

@little raptor It works fine, thank you a lot ! smile

uncut sphinx
#

So I would like to just do setAperture -1 whenever the player leaves

ashen urchin
#

But quickly, what's the first _this#0 and the send ?

uncut sphinx
#

_this#0 is the same thing as _this select 0, has higher priority too I think

ashen urchin
#

Not my question, what's the role of both ?

uncut sphinx
#

ah, missed that you were asking about the first one, my bad D:

uncut sphinx
#

Aren't both server-side?

exotic flax
#

it's local, but attached to the mission (if I read the wiki correct)

little raptor
ashen urchin
#

Thank you ! πŸ™‚

tough abyss
frosty stratus
#

I have been working on a Mortar for the last couple of weeks (maybe more) and I currently have a bug were if the mortar is assembled on any sort of a slope it falls over ( see: https://gyazo.com/c1fec85ff2f0d5d965aec602b51159c0 ) however, if I assemble it on flat ground its fine ( see: https://gyazo.com/99c1c4d9a9aa5204dd8887ed018c80bf ) at the moment the assembly code looks like _mortar = createVehicle ["506th_weap_m224mortar", position player, [], 0, "CAN_COLLIDE"]; _mortar setDir (getDir player); however I think I may need to freeze the mortar, align it to the ground correctly and unfreeze it, the problem being I am unsure how to do this correctly.

winter rose
#

@tough abyss render time scope commands are linked in that specific page

tough abyss
#

πŸ˜• Unfortunately they are all information commands like getPosATLVisual . Not setPosATLVisual.

#

So I don't know how it would help me with my "attached lights trailing vehicle" problem.

warm hedge
#

setPos getPosVisual method will do

tough abyss
#

😡 That was fairly obvious. I need some sleep. Appreciate it.

tough abyss
#

Hey folks, I've been having trouble trying to get AI to respawn and head back to the waypoint they were heading to before they died. It's been killing me for like 3 days now, if anyone has any ideas, please DM me. any help would be greatly appreciated!

willow hound
#

The top link was not missing a /wiki and is now broken πŸ˜›

tough abyss
#

I'm still lost, can someone DM me and help me out? I'll give credit to whoever helps in the mission description. This is gonna be a main op for my unit (10th MTN).

cosmic lichen
#

You can just ask here. Maybe someone has a similar issue. Stop PMing ppl. Thanks

tough abyss
#

Okay but i'm looking to share my screen and get real time feedback from someone who knows what they are doing.

willow hound
#

The respawn systems is for players only, it does not work with AI. As such, you have to make your own system.
Like R3vo outlined, you can possibly get it working by adding an EntityKilled Mission Event Handler on the server. From that EH you then execute code that uses createVehicle to spawn a new unit and retrieves the dead unit's waypoint - hopefully with something like (waypoints (group deadUnit)) # currentWaypoint (group deadUnit) (this might not be possible, depending on how well these commands work with dead units!) - and then assigns that waypoint to the newly spawned unit.

spark turret
#

does someone have a step by step guide for dummies so i can learn how to make an editor module?

cosmic lichen
obsidian violet
#

Hello guys!
so I have an issue with deleteing an object.

In a script I create an object in this case _satcom = "Item_SatPhone"

later on I need to delete the object from another scope and I cannot seem to pass the local variable to the other.
So what I wanted to do is a workaround by simply checking for the closest objects to the player and then delete the object from that array

_list = nearestObjects [player, [], 2]; 
_object = _list select 1; 
deletevehicle _object;

This works but ofc if there is another object closer than 2 meters then that object will be deleted instead...
SO I need help with find the specific objec in the _list.

If I perform I hint str _list it returns the following:

[B Alpha 1-1:2 (-Killet-),1f412a10100# 667283: dummyitemsmall_f.p3d]

is there any way to find the "Item_SatPhone" and filter on that?

Thanks for your help

winter rose
#

@obsidian violet make it a global variable

#
KLT_SatcomToDeleteLater = createVehicle stuff;
// ...
deleteVehicle KLT_SatcomToDeleteLater;
```problem solved
obsidian violet
#

That does solve the problem indeed =)
But for future reference how would I find the object in the array in this case mentioned above?

winter rose
#

maybe a nearestObjects using type as filter

#

but it is ill-advised to act like that really (returned array may be empty, etc - many problems)

languid oyster
#

I am having a hard time setting radar always on to static radar vehicles like "B_Radar_System_01_F". No matter, if I set the Combat Mode to "RED", set emission control to 'Active' in the editor, or setVehicleRadar 1, the radar stays off. I am controlling this via taking control via UAV control of the gunner. The radar is always off.

#

Is there a solution to keep that thing on all the time?

winter rose
#

are there mods?

languid oyster
#

A coupple, yes. Ace for example

winter rose
#

try without, because setVehicleRadar should work

languid oyster
#

Ok, trying...

warm blaze
#

why 'crew' command returns empty array from static defense that has a gunner?

winter rose
#

a drone maybe?

warm blaze
#

simple static howitzer

#

I see it has a gunner but crew returns empty array

winter rose
#

maybe mods

warm blaze
#

no mods

#

how can I get gunner from static defense directly? Gunner command ?

winter rose
#

yes
What is this vanilla howitzer's class?

warm blaze
#

talking about vanilla: we can take any static machinegun

#

the effect stays same

winter rose
#

again, without mods?

warm blaze
#

yes

finite sail
#

im standing looking at a mortar... crew cursorobject returns the gunner

warm blaze
#

hm

#

let me check that, thanks

languid oyster
#

Ok, setting the radar on is possible. Checking via isVehicleRadarOn returns 'true'. But when taking command via UAV terminal, on the mfd the radar is not active.

winter rose
real tartan
#

where do I need to run [] call BIS_fnc_showMissionStatus to see tickets ? initPlayerLocal.sqf or initServer.sqf ?

winter rose
#

anywhere you want? I would say it appears on screen immediately. maybe an action, if you need

little raptor
#

@tough abyss @warm hedge you should use compatible position formats. There are like 5 position formats in Arma: AGL, AGLS, ATL, ASL, ASLW. You can find info on them in the dedicated wiki page about positions.
There is no setPosXXXvisual. Only getPosXXX must he visual
And getPosVisual is something you should NEVER use with setPosXXX commands.

#

Because there's no setPosAGLS command (and it makes no sense either)

warm hedge
#

I know, that's just the point of it

winter rose
warm hedge
#

I sometimes still confuse around with positioning NGL! πŸ™‚

winter rose
#

setPositionNGL? thonk
πŸ˜„

little raptor
#

What's NGL?!

winter rose
#

afaik, not gonna lie

spark turret
#

neutral gazelle limbo.

winter rose
#

πŸ€” thonk think_turtle tanking

nocturne garden
#

Would love to see official vs code support with enfusiom engine

still forum
#

That makes no sense, Enfusion has its own IDE

rustic crow
#

Hey guys I was wondering if I could get some help with a script. I don't take credit for this script (flyingtarta) and I am not a talented scripter. But I was wondering if I could get some help modifying it. The script is it spawns shell craters when ever a arty or mortar lands. The script works fantastic, with one minor exception, it spawns craters for bullets as well. Heres the script-->https://pastebin.com/3VcggQMW I think I understand the problem in the code being this line

if (_z < 8) then {_c = "Land_ShellCrater_02_small_F";};                     //changes the crater size if its an mortar

and that if anything is less than 8 then it still spawns the crater. Is there a way to make a less than say 4, for instance, come back as nothing?

little raptor
#

@rustic crow the problem is that it does that for any fired bullet

rustic crow
#

Could I modify it for a specific ammo type fired?

little raptor
#

I think there's some property in the ammo cfg that determines if it's a mortar shell

rustic crow
#

Didn't find anything in the ammo.cfg found it in the CfgMagazines tho

little raptor
#

what did you find?

rustic crow
#

In reality all if I found was its class name, Sh_82mm_AMOS, Sh_155mm_AMOS,

#

Which might be referring to the magazine itself not the projectile

little raptor
#

add copyToClipboard typeOf _bullet

#

after it's fired paste the type here

rustic crow
#

rhs_ammo_3vo18

#

Sorry that took way longer than it should have

little raptor
#

I think it's artilleryLock

#
if (getNumber(configFile >> "cfgAmmo" >> typeOf _bullet >> "artilleryLock") == 0) exitWith {}; //only artillery shells
rustic crow
#

Ill give it a shot here and see

#

That did! Thank you so much @little raptor

tough abyss
#

@tough abyss @warm hedge you should use compatible position formats. There are like 5 position formats in Arma: AGL, AGLS, ATL, ASL, ASLW. You can find info on them in the dedicated wiki page about positions.
There is no setPosXXXvisual. Only getPosXXX must he visual
And getPosVisual is something you should NEVER use with setPosXXX commands.
@little raptor Interesting. But I am afraid this discussion is taking a left turn. Because the position of the lights is fine (it follows the unitPlay of the helicopter its attached to). But they are simply delayed by a fraction of a second. If I look at the output script file for BIS_fnc_UnitCapture, it seems to move the object relative to its starting position. Should I just detach the lights and execute UnitPlay on each light cone object?

queen junco
#

Hey, I got a quick question: I am not that much into Arma scripting, but I try to change a script I found online.

radioJammer = [[jammer1], 3000, 50, TRUE] execVM "TFARjamRadios.sqf";

this is the line of code I am using. It is placed inside the initPlayerLocal.sqf but instead of loading it when the player connects I would like to load it via a script that gets executed mid-mission via execVM.
As far as I figured the issue seems to be that I need to load it for each player locally. I tried that with a call BIS_fnc_MP but I can't seem to get it working...
Here is what I thought could work:

[[radioJammer = [[jammer1], 3000, 50, TRUE], ["TFARjamRadios.sqf"]], "execVM"] call BIS_fnc_MP;

Could anyone tell me what my error is?
Thx in advance

little raptor
#

@tough abyss when there's delay in position updates, that's why. Like I said, detach the light, use onEachFrame (the mission EH one) and update its position by getting the visual position of the helicopter

sacred slate
#

can you place the drone ai crew into a heli?

#

i like to have the blackfoot controlled as a drone

little raptor
#

drone AI is no different than other AI

#

Drones don't have visual lod for crew, so you don't see them

sacred slate
#

hm feels like a pilot fucks up more, like flight height etc. dunno

little raptor
#

no, they're exactly the same

sacred slate
#

ok thx

little raptor
#

@queen junco bis_fnc_MP is deprecated
also your syntax is wrong

#

@sacred slate try the "virtualMan_F"

sacred slate
#

still i would be the pilot if i take controls

little raptor
#

they're invisible

sacred slate
#

otherwise i have cockpit differences.

queen junco
#

Okay... Well, what do I want to use then?

little raptor
#

remoteExec

queen junco
#

okay, thx will try it out ^^

sacred slate
#

ok thx

little raptor
#

still i would be the pilot if i take controls
what do you mean? You're always the "pilot" when you take controls.

#

I think what made you think that the drone AI are different is how they behave when they face an enemy.
you can achieve the same behavior by setting the behavior to "CARELESS" and disabling "AUTOCOMBAT". They will become dumb like a "drone"

sacred slate
#

ah yeah

#

the autocombat does the trick

#

would be so great if you could operate the turret aim while flying

little raptor
#

maybe give the helicopter waypoints/move orders?

sacred slate
#

still not the same. but i am just used to it, from planetside 2, there you have a gunship where you can operate a turret your self

#

i got pitch yaw turn on a wasd'ish layout.

little raptor
#

btw, the unit type that the game uses for drones is "B_UAV_AI" (alternatives for other sides is "O_UAV_AI", etc.)

#

you can try that instead of VirtualMan_F

sacred slate
#

thx

queen junco
#

@little raptor Hey I tried it with a remoteExec. But unfortunately I couldnt get it to work. So maybe I have a different error. It might be something stupid so here is a little more background:

I have an object(jammer1) with an BIS_fnc_holdActionAdd. Once this is complete I want to load a script

remoteExec ["jam.sqf", 0, true];

This should load the script that was originally in the initPlayerLocal.sqf

radioJammer = [[jammer1], 3000, 50, TRUE] execVM "TFARjamRadios.sqf";

So in theory it was supposed to load the script locally for every player once someone completes the holdAction. But instead it is either not loaded at all or not for the players as the TFARjamRadios.sqf includes a visual confirmation with a marker and a debug text. It worked fine with the initPlayerLocal.sqf.

little raptor
#

@queen junco did you read the wiki description?

queen junco
#

I tried to understand it. Thats why I came up with this. As mentioned I am not that experienced with Scripting

little raptor
#

well the command you're trying to run is execVM

#

its arguments are:
left hand: [[jammer1], 3000, 50, TRUE]
right hand: "TFARjamRadios.sqf"

#

so the remoteExec command you want is:

#
[
  [[jammer1], 3000, 50, TRUE], 
  "TFARjamRadios.sqf"
] remoteExec ["execVM", 0, true];
queen junco
#

Ohh, okay. Thx ^^
I will try to figure out all the meaning why this works

flint kraken
#

So i have this restriction pop up in my script log file and wondering how i put it in the script.txt --- https://prnt.sc/vmesmf

#

Im new to all this

little raptor
#

um...what?

#

restriction
you mean error?
Also, post the error on pastebin or something

#

And I mean full error, cause I don't see what that's supposed to be

proper sail
#

@flint kraken Look up how to adjust battleye filters or use battleye autoexception generator

wild prairie
#

Having some issues with deleting FPS markers for my headless clients after they disconnect.

while {true} do 
{
  if (local HC1) then {"fpsmarkerHC1" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC1" remoteExec ["deleteMarkerLocal",0,true];};
  if (local HC2) then {"fpsmarkerHC2" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC2" remoteExec ["deleteMarkerLocal",0,true];};
  if (local HC3) then {"fpsmarkerHC3" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC3" remoteExec ["deleteMarkerLocal",0,true];};

  sleep 0.5;
};```
#

Executing just the contents of the loop with the Debug Console on the server works as expected, markers are deleted, all bueno.

winter rose
#

"FPS markers"?

wild prairie
#

To track server performance.

#
while {true} do {

    private _myfps = diag_fps;
    private _localgroups = {local _x} count allGroups;
    private _localunits = {local _x} count allUnits;

    _myfpsmarker setMarkerColor "ColorGREEN";
    if (_myfps < 30) then {_myfpsmarker setMarkerColor "ColorYELLOW";};
    if (_myfps < 20) then {_myfpsmarker setMarkerColor "ColorORANGE";};
    if (_myfps < 10) then {_myfpsmarker setMarkerColor "ColorRed";};

    _myfpsmarker setMarkerText format ["%1: %2 fps, %3 local groups, %4 local units", _sourcestr, (round (_myfps * 100.0)) / 100.0, _localgroups, _localunits];

        if (local HC1) then {"fpsmarkerHC1" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC1" remoteExec ["deleteMarkerLocal",0,true];};
        if (local HC2) then {"fpsmarkerHC2" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC2" remoteExec ["deleteMarkerLocal",0,true];};
        if (local HC3) then {"fpsmarkerHC3" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC3" remoteExec ["deleteMarkerLocal",0,true];};

    sleep 0.5;
};``` Here's the whole thing.
#

Updates a map marker with the current FPS, and unit and group count. This runs on init for the server and every HC.

winter rose
#

I… don't get why you would deleteMarker then deleteMarkerLocal?

wild prairie
#

It was originally just deleteMarker

#

Which leads me to the issue I'm having.

#

The markers aren't actually getting deleted on the clients when the code is executed via script.

winter rose
#

wait, stop

#

you delete them every 0.5s, but don't re create them πŸ€” and what is _myfpsmarker?

wild prairie
#

Them being deleted should only happen when the Headless Client entities are local, hence if (local HCx)

#
//FPS marker
private _sourcestr = "Server";
private _position = 0;

private _myfpsmarker = createMarker [format ["fpsmarker%1", _sourcestr], [0, 0 - (100 * _position)]];
_myfpsmarker setMarkerType "mil_start";
_myfpsmarker setMarkerSize [0.7, 0.7];

while {true} do {

    private _myfps = diag_fps;
    private _localgroups = {local _x} count allGroups;
    private _localunits = {local _x} count allUnits;

    _myfpsmarker setMarkerColor "ColorGREEN";
    if (_myfps < 30) then {_myfpsmarker setMarkerColor "ColorYELLOW";};
    if (_myfps < 20) then {_myfpsmarker setMarkerColor "ColorORANGE";};
    if (_myfps < 10) then {_myfpsmarker setMarkerColor "ColorRed";};

    _myfpsmarker setMarkerText format ["%1: %2 fps, %3 local groups, %4 local units", _sourcestr, (round (_myfps * 100.0)) / 100.0, _localgroups, _localunits];

        if (local HC1) then {"fpsmarkerHC1" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC1" remoteExec ["deleteMarkerLocal",0,true];};
        if (local HC2) then {"fpsmarkerHC2" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC2" remoteExec ["deleteMarkerLocal",0,true];};
        if (local HC3) then {"fpsmarkerHC3" remoteExec ["deleteMarker",0,true]; "fpsmarkerHC3" remoteExec ["deleteMarkerLocal",0,true];};

    sleep 0.5;
};
winter rose
#

you delete HC1 marker on every machine if e.g HC1 is local on a machine, that makes no sense?

wild prairie
#

if HC1 is local to the server.

winter rose
#

every 0.5s.

wild prairie
#

To check for them being disconnected, yes.

#

I'm aware this is absolute dogshit for performance, I'm trying to get it to work, first.

winter rose
#

instead of deleting them, you could make them create a marker if HC

#
if (!hasInterface && !isServer) then {
  // I iz headless
};
wild prairie
#

I'm doing that, yes, in the HC's init script.

#

The fpsmarkerHCx only exist if they are created by an HC joining the server.

winter rose
#

then a simple deleteMarker would work

#

no remote, no anything

wild prairie
#

It doesn't, though, is the thing. Not in the script at least.

#

If done through debug console, this works absolute wonders.

#

I've gone through simply deleteMarker, to remoteExec deleteMarker, to the iteration you see now.

winter rose
#

then something else is wrong

#

do you have -showScriptErrors enabled? if the script fails before reaching the marker, it halts and you never know what happened

wild prairie
#

Yeah, I'm not getting anything, though, and the loop is working fine, FPS is being updated and all that.

#

Do you think using the HandleDisconnect EH might be a better solution?

robust hollow
#

yes

wild prairie
#
addMissionEventHandler ["HandleDisconnect", 
{
  params ["_unit", "_id", "_uid", "_name"];

  if (_unit == HC1) then {deleteMarker "fpsmarkerHC1"} else
  {
    if (_unit == HC2) then {deleteMarker "fpsmarkerHC2"} else 
    {
      if (_unit == HC3) then {deleteMarker "fpsmarkerHC3"};
    };
  };
true
}];``` This *should* work, right?
winter rose
#

exitWith but yes ^^

cosmic lichen
#

@wild prairie If your maker names are consistent you don't even need that check. You can simply do format ["fpsmarker%1",vehicleVarName _unit];

#

Ah wait

robust hollow
#

I'd probably still check if the unit is a hc, otherwise you're sending a delete message for nothing

cosmic lichen
#

yes

#

But it could be done in one if (condition) instead of three I guess.

robust hollow
#

yea, _unit in [HC1,HC2,HC3]

wild prairie
#

And no bueno.

#

Marker's gone if I go back to the role assignment screen and back, though.

wild prairie
#

Ah, figured it out. Didn't have the loop inside of a scheduled environment.

robust hollow
#

uhmmmmmm, loops are not supposed to be in unscheduled environments.

wild prairie
#

It's been a long day.

past tiger
#

All my players are of the same side, and they can't lock in each other with "r". It's possible to enable "r" lock between then?

vestal field
#

Is it possible to make a script where if a grenade landa near the ai, they'd immediately try to move say; 10 meters away from it?

wary vine
#

just a quick one, am i able to use inPolygon, to check whether a given position, is within a bounding box of an object.

finite sail
#

i have some related code that I posted a few days ago, give me a few secs to dig it out

winter rose
#

@past tiger nope, but you can lock with "T"
if you want them to be enemies, addRating negative

wary vine
#

hmm, im using some code provided by killzone ,http://killzonekid.com/arma-3-bounding-box-utility/ i have the corners of the positions sorted (tested by creating an object on each corner) but im checking against the bounding box of a road, and it seems to be returning the wrong answer

finite sail
#

ah roads

#

thats different

wary vine
#

the roads actually have a proper bounding box

#

(from the testing I have done./)

finite sail
#

why not use isOnRoad

#

and/or roadAt

wary vine
#

I have never had much luck with that working all the time.

finite sail
#

ive found them to be very reliable

#

in what way don't they work for you?

wary vine
#

I have just tried it in the past, and it didn't work 100% of the time.

#

i was hoping by using bounding box, it would be slightly more reliable.

finite sail
#

unless you can be more specific, I can only tell you I've been using isonroad, nearroads and roadat for years

#

and they are reliable

wary vine
#

hmm, just tested roadAt, and seems to be working fine now, thanks πŸ™‚

finite sail
#

roadat player and roadat vehicle player are sometimes tricky

#

but roadat position player and roadat position vehicle player are better practive, ive found

wary vine
#

yeah, im just checking all corners of an objects bounding box,

finite sail
#

yes, i do that to but only for buildings

#

if Im sensing roads, then isonroad is the way

#

also, this might be of interest, it's quite new

#

returns the width, and start and end points

#

though, I've not used this yet, as I say, it's new

wary vine
#

I think isOnRoad, and roadAt should do from what im needing, tyvm

finite sail
#

you're very welcome πŸ™‚

#

can I ask what you're doing with it?

wary vine
#

a small building system.

dusk gust
#

I've noticed that adding a display event handler and then removing the same handler will not actually reset the index of said it. Using displayRemoveAllEventHandlers works properly and resets it. Anyone know if this is intentional?

finite sail
#

the same is true of all eventhandlers

#

the id serial doesn't decrease when an EH is removed

#

so I'm going to go out ona limb and say it's intentional

manic crest
#

im making a mission where players have to breach buildings and look for intel. simple stuff.

i thought it would be cool if i had objects blocking hidden stuff. so i put bookcases and stuff down to hide a little room and other stuff.
ive been trying to it where the players can "move" the objects to access these hidden locations.

i tried to use Addaction, so the players can look at an object and it would be deleted. but my knowledge on arma script is limited. could anyone help out.

so far ive tried

This addaction ["move", "deleteVehicle _Target];
it says _target is undefined. so i named the objects something in the variable names.

This addaction ["move", "deleteVehicle _hidden_1];

it said that _hidden_1 was undefined.

im stuck at this point. i know next to nothing about code.

finite sail
#

I have to say, @wary vine , boundingboxes of roads are huge compared to the actual visible size of the thing

wary vine
#

you would probably have to use a global vs local variable for that.

#

@finite sail boundingbox real seems ok on all the objects I have tried for it.

finite sail
#

ah right, not used real

wary vine
#

gives you slight padding around the outside, but nothing over the top

manic crest
#

global vs local? i know nothing about scripting XD

wary vine
#
This addaction ["move", "deleteVehicle _hidden_1];
``` are you using this in an objects init ?
manic crest
#

yeah

wary vine
#

this addaction ["move", "deleteVehicle (_this # 0)"];

#

try that.

manic crest
#

ok πŸ™‚

wary vine
#

_this # 0 within an addaction, is the object the addaction is applied to,

manic crest
#

that worked wonders. cheers mate πŸ™‚

still forum
#

Quick poll, who is annoyed by double-click selection behaviour in debug console and such, not selecting what you expect it to select.
Only ending on whitespace instead of ending at quote marks and other punctuation?

warm blaze
#

how could I get an array of unit's (man) gear including classnames of weapon, magazines etc ? I mean a simple, flat array of gear without duplicates

finite sail
#

it squeezes out the nesting, if you like

warm blaze
#

I mean, we have getUnitLoadout. It contains some internal arrays with magazines details. I was thinking sqf api could have a tool to make one flat array with unique set of gear elements

finite sail
#

yeah, I know what you mean

#

any help?

still forum
#

arrayFlatten script command needed?

finite sail
#

yeah

#

or a fnc

still forum
#

ok gimme 5 minutes

finite sail
#

πŸ™‚

warm blaze
#

πŸ™‚

still forum
#

5 minutes was just a saying, I need to finish smth else first. I'll get back to you in maybe 30 minutes

plain creek
#

In the contact DLC the aliens bullets have a pretty beautiful animation. How can i script it so that it shoots one from a predetermined position into another position? And can I do that without the contact DLC?

#

I mean just spawn an alien bullet and make it go somewhere.

warm blaze
#

anyway, thanks for help πŸ™‚

finite sail
#

yeah, thats the one. I knew it was around somewhere

still forum
#

it uses typeName

#

oof

#

and private array

#

for the sake of performance please don't do that first one oof

#

the unordered one uses isEqualType atleast, but it uses the bad for loop, which it probably needs tho

fair pilot
#

What's wrong with using private array?

winter rose
#
private ["_var1"];
_var1 = 33;
```is performance and readability wise worse than```sqf
private _var1 = 33;
still forum
#

private array wastes performance.
while private keyword gains performance

worn forge
#

What about declaring multiple values? Is there a break even point?

finite sail
#

isnt the private = value quite new? I think kzks script predates it

still forum
#

Arma 2 had it. it was called local _var = value back then

finite sail
#

ah right

worn forge
#

I guess what I'm asking is, is there ever a good time /place to use the private ["_var"] format

winter rose
#

no

#

only once if you want to make sure the variable is in the upper scope, that's the only only only case really

still forum
#

when you want to private to a specific scope that's above when you set the variable for the first time, and you don't want to specify a default value like 0

finite sail
#

lol, i tested it in the debug performance thingy, expected it to end the universe

#

not sure the results are reliable, f course

#

30 elements private array 0,00004

#

30 individual private variabel= value 0.00003

winter rose
finite sail
#

yes

winter rose
#

it's moar betterest

finite sail
#

SOLD

#

'betterer', I think

#

or besterest

#

not betterest fgs

still forum
#

you are not testing properly

#

your first test needs to be both combined

#

because you first private array the variable, and THEN you also set it

finite sail
#

yes, id did that too

#

was even slower

#

but not 30 elements. took too long to type πŸ™‚

still forum
#

also you can't measure the performance speedup of private'ing variables in the first place, like this. Because that's only visible when you have deeper scopes

finite sail
#

i realise it wasa flawed test, im surprised debug even allows private

astral tendon
#

Is there a way to get the vehicle radar targets? like in a array?

worn forge
#

On the question of the use of the private declaration I'm asking purely in terms of performance. For example declaring 10 local variables in one statement rather than 10 lines, and no values for them ("predeclaring" I guess you'd say)

still forum
#

no, array overhead is too big

finite sail
#

Dedmen mentioned in dispatches

still forum
coarse schooner
#

Woo

worn forge
#

to be fair, I think private ["_var", "_var2"] has a place - for when you need to have the variable there for future tests, ie., running isNil "_var" will break if you haven't declared it locally. Unless you tell me that private _var = nil; is faster? Personally I'd think that
private ["_var1", "_var2", "_var3", ... "_var20"]; is cleaner than

private _var2 = nil;
private _var3 = nil;
...
private _var20 = nil;```
winter rose
#

running isNil "_var" will break
no, that's the point of isNil actually

worn forge
#

I'm sure I've had a problem with not declaring a local variable

winter rose
#
isNil "_unknownVar" // true
```you may mix it up with `isNull`
worn forge
#

Ah yes, that's it

#

Or when you know you're going to populate it with an object later from a command like nearestObjects and it returns zip

winter rose
#

check if isEqualTo [] then yes

winter rose
astral tendon
#

I was using targets but it returns any targets that the unit knows about, not exactly if he has on the radar.

#

Like, he can know a target that is far from his radar

winter rose
#

then you can filter these out by type and distance, checking the config for radar range

but there seems to be no commands for that

compact maple
#

Hello!
Is it possible to get the parent class of an object, like LandVehicle for vehicle ?

winter rose
#

yes

astral tendon
#

just checking, does the radar is interfered by mountains or objects blocking the radar? like in real life? or even just flying low is enough to be out of the radar?

winter rose
#

yep, it plays a role

#

direct LOS is a need

compact maple
#

Thank you @winter rose

still forum
#

okey no arrayFlatten before next week oof.. Maybe make a FT ticket about it πŸ˜„

finite sail
#

i cant log into ft system, it rejects all my pw

#

why isnt ft system using same login as bohemia acount... grr

#

ok, im in

still forum
#

tank yu

finite sail
#

tank yu too

past tiger
#

@winter rose thanks Lou, but if i make then enemy with addRating, they will still be able to share the same vehicle if they want?

winter rose
#

I believe so

finite sail
#

ooo

#

you sure?

#

when you say 'share the vehicle' do you mean get in the same vehicle as passenger?

#

becuase you can't get in a vehicle of a unit you aren't friendy with

winter rose
#

that's how I understood it as well
even with a shared side?

finite sail
#

yeah, if you make him enemy with rating,

#

he will be side enemy, who is enemy to everyone

#

wont be able to getin anywhere if you're side enemy

little raptor
#

that's how I understood it as well
even with a shared side?
They're not on the same side. Units with a negative rating are renegades

finite sail
#

technically, its

little raptor
#

But afaik renegades are enemy to each other too

#

sideEnemy getFriend sideEnemy

#

Should be less than 0.6

finite sail
#

yes, i think that was what i was trying to say, renegades are enemy even to other renegades

little raptor
#

They're enemy to every other side
Even to the animals!

finite sail
#

-1

#

sideenemy getFriend sideenemy

little raptor
#

he will be side enemy, who is enemy to everyone
Oh you said that already. My bad

#

I only read Lou's comment

finite sail
#

my apologies, i came in mid convo

little raptor
#

Are you mocking me?! :)

finite sail
#

no, not at all

little raptor
#

my apologies, i came in mid convo
Cuz that's what I should've said!

finite sail
#

not now, anyway πŸ™‚

spark turret
#

just random info that might be helpful:
you can use these abstract sides to achieve Ai behavior. like sideFriendly if you want a helicopter to not be attacked by anyone.
i think ambientFlyby uses sideCaptive or sth related to have everyone ignore the planes

little raptor
#

Or they're just civilian pilots

spark turret
#

no, i know for a fact that they give them some kind of captive trait to achieve that they are ignored for sure

winter rose
#

you cannot create groups other than west/blufor, east/opfor, resistance/independent, civilian, sideLogic

little raptor
#

How does one become sideFriendly anyway?!

winter rose
#

config, I suppose

little raptor
#

no, i know for a fact that they give them some kind of captive trait to achieve that they are ignored for sure
captives are civilians too

finite sail
#

just one thing., may or may not be relevent.. units that are setcaptive true, are still scored according to their config side

#

so, i a blufor unit kills an opfor unit who is setcaptive true, he gets points as if he killed opfor, not civ

spark turret
#

you mean they are counted as a kill?

finite sail
#

yes

#

for scoring

spark turret
#

lol proof that arma encourages warcrimes

finite sail
#

well, yes... i use it for my roadblock secondary ission.. i take opfor, dress them in civ clothes and setcaptive them

#

so they can drive to my roadblock without players yelling ENEMY MAN FRONT

#

players have to search their car (look in the inventory), the opfor in disguise guys have ied in the car inventory

#

and players can kill them even though they are setcaptive true and get points as if they killed ofpor

little raptor
#

setCaptive True
@finite sail
setCaptive true = set side civilian

finite sail
#

not for scoring, they arent

#

for score, the captive unit is treated as if it were its original side

little raptor
#

Because its group side doesn't change

finite sail
#

probably, but players in lower difficulty modes dont see them (and shout onthe radio) as enemy, they do see them as civs

serene quiver
#

Hi all, I'm pretty new to the Discord thing, and I have a question about a script I'm using/customizing...here it is;
EDIT: it's kinda long...is there a way to get a "spoiler" windows or some thing so is not clogging-up the chat with a wall of code?

still forum
#

no, but youcan just post on sqfbin.com and post link here

serene quiver
#

Right..let me ceck that up

spark turret
#

very helpful for prisoners to stop being annoying

serene quiver
#

OK...done...now the question:
the code block between line 93 trought 114 is the one involved;
what I want to achieve is this: once you designate the target with the laser, the drone will fire at it. I want an addAction that will prompt the player to "confirm" the target, and IF the target is confirmed the drone fire the missile. I tried multiple things,like:

uav1 setVariable ["_confirm",false ];
uav1 setCombatMode "BLUE";
CONFIRM = player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {uav1 setVariable ["_confirm",true ],hint "TARGET CONFIRMED..GOING HOT!";true, true, "", ""}];
if (_confirm == "true") then {player removeAction CONFIRM; uav1 setCombatMode "YELLOW";};
sleep 1;
uav1 fireAtTarget [laserTarget player,"PylonMissile_1Rnd_LG_scalpel"];

but I can't get it to work.

spark turret
#

which part doesnt work

#

like syntax error or does the drone not fire at all?

serene quiver
#

The drone fire no matter what..I want it to wait for target confirmation and THEN fire

serene quiver
#

I try with
or:

       if (_drone getVariable "Mode" == "DESIGNATE") then 
        { 
               if (_info == "true") then {hint "SEND TARGET...";}; 
               sleep 2; 
               if (_info == "true") then {hint "KEEP LASER ON TARGET...";};   
               sleep 3; 
               targetsarray = _drone targets [true, 3000];          
               index = targetsarray findIf {TypeOf _x =="lasertargetW"};  
             if (index>=0) then 
             { 
                myNearestEnemy = targetsarray select index; 
                _drone lockCameraTo [myNearestEnemy, [0]];  
                _drone doTarget myNearestEnemy;  
                _drone doWatch myNearestEnemy;   
               if (_info == "true") then {hint parseText format ["<t> the target is a %1<br/>at grid pos %2...GOING HOT... </t>",getText (configFile /"cfgVehicles" / typeOf cursorObject / "displayName"),mapGridPosition cursorObject];};   
                sleep 1;
                _drone setCombatMode "BLUE";
                _MYid = player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {uav1 fireAtTarget [myNearestEnemy,"PylonMissile_1Rnd_LG_scalpel"], [], 4, true, true, "", ""}]; 
                player removeAction _MYid;
                _drone setCombatMode "YELLOW";
                sleep 2;  
               if (_info == "true") then {hint "MISSILE FIRED!";};   
                sleep 6;  
               }; 
          };
#

no joy

spark turret
#

if (_confirm == "true") = if (_confirm). no need for == true

still forum
#

yes you need it

spark turret
#

fix syntax first

still forum
#

because its a string, not a bool

spark turret
#

aaah yeah okay

still forum
#

which is nonsense too and should also be changed..

#

if you just run fireAtTarget in debug console to test, does that als onot work just by itself?

serene quiver
#

furthermore, the addAction doesn't go away

still forum
#

the addAction code is not in your sqfbin

#

you are deleting the action IMMEDIATELY after adding it?

serene quiver
still forum
#

that doesn#t sound intended, the action would never show up

serene quiver
#

I just want to add theat "function"

still forum
#

ah I see

serene quiver
#

Ok sorry.is getting messy..let me explain better:

still forum
#

your addAction is a syntax error

#

your code is weird and you are missing parameters

#
player addAction ["<t size='1.5' shadow='2' color='#00cc00'>CONFIRM TARGET</t>", {
  uav1 fireAtTarget [myNearestEnemy,"PylonMissile_1Rnd_LG_scalpel"];
  player removeAction (_this select 2);
}, [], 4, true, true, "", ""]; 
serene quiver
#

the script "dronesupport.sqf" is fired by a radio trigger with :
test=[uav1,60,"missiles_SCALPEL","false"] execVM "dronesupport.sqf";

#

when the trigger fire, you get the "main" addAction, which will prompt you for the different "modes" of the drone: standby,manual fire,auto

spark turret
#

Fire the missile from inside the addactions code statement.

#

Your code tries to fire once the var is true but only checks the var once

serene quiver
#

If you choose manual fire, you lase the target, then once acquired the "laserTarget player" drone fire

serene quiver
spark turret
#

Action shows up and is usable?

serene quiver
#

yap

spark turret
#

Mynearestenemy is not defined i guess

serene quiver
#

but the drone fire anyway

spark turret
#

Wait whats the problem with the last codebit?

serene quiver
#

he's not waiting for ""confirm

spark turret
#

Set it to holdfire

serene quiver
#

I did...

#

it fire anyway

spark turret
#

Hm you can disable AI features but that might impact the fire at command too

#

Read up on disableAi

#

I think it has a autotarget feature

serene quiver
#

I put this BEFORE the addAction,

drone setCombatMode "BLUE";

and this after the addAction

drone setCombatMode "RED";

spark turret
#

Yeah get rid of the red part

serene quiver
spark turret
#

Your code does not stop at the addaction. It instantly runs on and execute set"red"

serene quiver
#

How do I stop the code at the addaction?

lucid shale
serene quiver
lucid shale
#

@serene quiver do you know how if statemens work?

serene quiver
#

yes

lucid shale
#

so then if the conditions are right it will not exit.

#

its action you can call as many times as you like by selecting it

serene quiver
#

thank you..I'll give it a try

lucid shale
#

I need help with comparing variables that may or may not contain a group at all times.
What is the proper value to compare against a group instead of objNull?
the following returns this error 'Error Generic error in expression'

private _group1 = objNull;
private _group2 = group player;
if (_group1 == _group2) then
{
  //do stuff.
};
#

nvm im a tart. grpNull

spark turret
#

No stop

#

You dont want to exit, you want to wait until the action was called.

Use waitUntil{your condition here};

serene quiver
ocean folio
#

is systemchat the way you do debug messages here?

#

here as in within arma

spark turret
#

You can also write to yiur .rpt logfile with diag_log

#

But uh im a big noob on debugging. Dont listen to me

ocean folio
#

im a big noob on everything scripts lol

#

from what I can tell, either my init.sqf isnt running or my systemchat messages are wrong

#
systemChat "init start"

//[] execVM "scripts\jammerDef.sqf";

systemChat "init done";
proper sail
#

missing semicolon at your first systemchat

ocean folio
#

that....

#

yeah

#

nods head

proper sail
#

also i dont know how early this runs

#

you might miss the chat if it runs too early and you are not ingame yet etc

ocean folio
#

will there be hell to pay if I put a waituntil in here?

#

does that only suspend the rest of that specific script or does it suspend the whole queue

proper sail
#

i dont think you can wait in init.sqf as its unscheduled

#

might be wrong

#

use diag_log instead

ocean folio
#

based on the wiki I think it is scheduled

#

but you probably know more lol

spark turret
#

Yeah or use

[] spawn {
 //runs parallel scheduled code
Sleep 10;
Hint "hello world";
};
ocean folio
#

interesing

#

no hint

proper sail
#

id recommend you use diag_log, spawning a thread waiting 10s is janky

spark turret
#

But it allows to run suspended code from editor init fields without scriptfiles ;)

ocean folio
#

oh I will need script files