#arma3_scripting

1 messages Β· Page 104 of 1

cold depot
#

just so I'm clear, if someone makes a Warlords mission in the eden editor...they can't modify it at all?

hallow mortar
# cold depot just so I'm clear, if someone makes a Warlords mission in the eden editor...they...

It might be possible to overwrite the functions from mission CfgFunctions; I'm not sure if that's allowed to overwrite addon CfgFunctions. You can also do whatever other scripting you like, using mission scripts - you could make your own Warlords framework with its own functions and so on if you wanted.
What you cannot do is go into the main Arma 3 directory - not the Missions or MPMissions folder - and make direct manual changes to the base Arma 3 PBOs. Those files are outside of your mission, changes to them will not be included in your mission, they will only apply to your local installation of the game, that is not a proper way to mod Arma.

formal stirrup
#

Is it possible to execute code on specific steam IDs

sullen sigil
#

yes

#

getPlayerUID

cold depot
# hallow mortar It might be possible to overwrite the functions from mission CfgFunctions; I'm n...

ok. thank you for the info. I do all my warlords work via scripts(not the editor).

I know now if someone is building a mission in eden editor via modules they are limited the what the modules are setup to do.

🀞 hopefully if we get an arma 3 datapack it will have files for the base warlords stuff 🀞 It would be very easy if I could host those on github and be able to easily grab/fix/search things as needed.

sullen sigil
#

returns 1 in sp

formal stirrup
#

Thank you kjw

sullen sigil
#

note its somewhat questionable regarding whether or not executing code on specific steam users is allowed in steams subscriber agreement too

formal stirrup
#

Uhhh, im gonna have to go read that now

hallow mortar
sullen sigil
#

thats for servers which are not privy to the subscriber agreement

wooden dove
#

so far the one by POLPOX works

#

addMissionEventHandler ["Draw3D",{BIS_gearKeyPressed = true}] ;

formal stirrup
#

I mean, im just trying to use it to teleport a specific player. Not anything malicious

#

Doesnt mean its not against the agreement

sullen sigil
#

if its part of a mission its fine too

wooden dove
#

but in the start of warlords, theres a cutText(i think?) says "OPEN REQUEST MENU WIHT I" or something like that. Not sure how to get rid of it...

sullen sigil
#

its only for steam workshop published stuff

formal stirrup
#

So wait, im good aslong as i dont put it on the workshop?

sullen sigil
#

ye

#

if theres no involvement with steam subscribers

formal stirrup
#

Oh. were good then

#

sweet

fleet sand
#

Quick Question if anybody knows why this happends so if i put this in init of a static turret that is controled by AI i get this error:

this addMagazineTurret [currentMagazine this, [0],100];
sullen sigil
#

badly made turret

#

has property[] = {""}; somewhere in its config rather than property[] = {};

fleet sand
sullen sigil
#

and

#

possible a mod overwrites it etc too

#

but that is what causes incorrect no entry .model messages apparently

fleet sand
sullen sigil
#

what turret is it

fleet sand
#

All of them.

hallow mortar
#

Perhaps the code is being executed before it has a currentMagazine

fleet sand
#

you guys can test it to just to make sure i am not crazy put this code in init of a turret and put AI on it.

sullen sigil
#

currentMagazine is returning "" on the turrets thonk

#

but when you get in it then it returns the magazine

#

odd

fleet sand
#

But if you put this code on when player is on the turret then it works.

sullen sigil
#

wait is it until a player gets in it meowsweats

#

ah no any unit

#

put ft ticket on for that then ig

fleet sand
#

ok will do.

ornate whale
#

What would be faster to execute? Thanks

  private _i = 0;
  private _timeToLoseTarget = ((_timeToLoseUndetected select _i) select 1);
  while {_knowsAbout > ((_timeToLoseUndetected select _i) select 0)} do
  {
    _i = _i + 1;
    _timeToLoseTarget = ((_timeToLoseUndetected select _i) select 1);
  };
private _timeToLoseTarget = _timeToLoseUndetected findIf { _x#0 >= _knowsAbout };
_timeToLoseTarget = (_timeToLoseUndetected select _timeToLoseTarget) select 1;

What it does basically is that it selects a value from an array based on some value (knowsAbout).

sullen sigil
#

use the ingame code performance checker

#

if base game its the speedometer in debug console next to uhhh server exec iirc

#

if adt its the stopwatch

ornate whale
#
private _timeToLoseTarget = myArray findIf { _x#0 >= _target select 2 };```
Is the part _target select 2 done every time it checks a new _x value or is it done once and then compared with all the items in the array. Would it be better to do the select outside the findIf?
fleet sand
sullen sigil
#

is there a getter for radar target

sullen sigil
#

is there a way to get the current selected one

sullen sigil
#

based thank u

#

no wrong stuff

#

i need the one the vehicle has selected

warm hedge
#

cursorTarget does it IIRC

wooden dove
#

hi its me again. I have this line: addMissionEventHandler ["Draw3D",{BIS_gearKeyPressed = true}] ;
it stops me from using the request menu in warlords which is what I want. The thing is warlords has this text on screen in the start telling everyone to hold I to open request menu. Is there anyway to remove that?

#

oh its polpox

#

or maybe to open the request menu once to remove the text then disable it? if i put a sleep though before addMissionEventHandler ["Draw3D",{BIS_gearKeyPressed = true}] ; it stops working

#

this is all i have in initPlayerLocal.sqf

warm hedge
#

You simply want to ignore your idea and notify players in a different way

wooden dove
wooden dove
#

i can kinda live with it

#

was just hoping i can remove it

#

hahah

warm hedge
#

You need no remoteExec there

wooden dove
#

since its initPlayerLocal?

warm hedge
#

Yes

wooden dove
#

since u need to open the request menu once to remove it

#

is there a way to addMissionEventHandler

#

after the request menu was opened once?

warm hedge
#
uiNamespace getVariable ["BIS_WL_purchaseMenuDiscovered", true]```
wooden dove
#

AHHH
omg

#

thats it

#

THANK YOU

#

where was that

warm hedge
#

fn_WLClientInit

wooden dove
#

Thanks again @warm hedge !

blazing zodiac
#

Does anyone have any insight on why addItemToUniform command isn't working for me for magazines

#

scratch that, it's working fine. It was loading them into my empty weapons

velvet merlin
#

whats the cheapest way to get all units in a marker area? and what for a trigger area?

#

allUnits inAreaArray _area is quite expensive if you have any units

#

for triggers should be: _unitsInArea = list _area;

cosmic lichen
#

Only if the units match the triggers condition

velvet merlin
#

for markers: _unitsInArea = (getMarkerPos _area) nearObjects ["CAManBase",(getMarkerSize _area)#0];

#

well yes. trigger needs to be set up in this way

cosmic lichen
#

But that's bad

velvet merlin
#

and marker woul need to be a cricle

manic sigil
#

Create any-unit trigger that matches the marker area, list units in trigger, delete trigger?

AllUnits select {_x distance marker < radiusOfMarker}?

stable dune
#
private _markerPos = (getMarkerPos "marker1");
private _radius = vectorMagnitude getMarkerSize "marker1"
private _entities = _markerPos nearEntities ["CAManBase", _radius];
private _inAreaEntities = _entities inAreaArray "marker1";

with 300 units 0.0086ms, 20 in area.
and 0.0101ms if 40 in area.

allUnits inAreaArray "marker1"
// 0.0527ms 

This what i used , dont remember who tell me to 1st get max radius (if not using cricle marker) and then check inAreaArray
(edited , correct way to get correct radius vectorMagnitude)

rugged spindle
#

I've placed a prop in the editor (one the large rocks) and AI on the other side immediately tries to shoot through it. Is there a way to stop them seeing through?

drowsy geyser
#

how would i ensure that an action added with addAction can only be used by one player at the time?
example code:

uav1 addAction
[
    "title",    // title
    {
        params ["_target", "_caller", "_actionId", "_arguments"]; // script
    },
    nil,        // arguments
    1.5,        // priority
    true,        // showWindow
    true,        // hideOnUse
    "",            // shortcut
    "alive _target && remoteControlled driver _target != _this",        // condition
    50,            // radius
    false,        // unconscious
    "",            // selection
    ""            // memoryPoint
];

i think this is the wrong way to use the remoteControlled command?

warm hedge
#

Do you mean in MP and you want an action that lasts for a few, and during that nobody can activate that?

drowsy geyser
#

yes it is for MP and the action should not be accessible while the uav is remoteControlled

#

the addAction is in the init field of the uav so anyone can access it

warm hedge
#

But not when the UAV is used by someone?

drowsy geyser
#

if it is used by someone then it should not be accessible by anyone else

warm hedge
#

How about isNull (remoteControlled _target)?

sullen sigil
#

remoteControlled driver _target isEqualTo objNull

warm hedge
#

Dunno comparing with objNull is better than that

sullen sigil
#

probably slightly quicker as doesnt need to check against multiple null types but shrug

#

oh no you're right

#

isNull is quicker meowsweats

warm hedge
#

Because it checks if it is objNull, not any nulls?

sullen sigil
#

i mean this

#

multiple null types for isnull

winter rose
sullen sigil
#

versus just is this the same as that

wise frigate
#

Anyone know why setDir doesn't work accuratley on AttachedObjects
Running this on an attached object but it appars that its very glitchy, sometimes it will roatet the object 90 degrees but sometimes it'll rotate less or more than 90

(_this select 0) setDir ((getDir (_this select 0)) + 90);
warm hedge
#

What's the intention behind getDir there?

sullen sigil
#

its in modelspace, not sure your meant to use setdir on attached objects

wise frigate
#

To get the current direction of the "Object" and then add 90 degrees to it,

wise frigate
sullen sigil
#

setvectordirandup

#

though you may need to write code that interprets it into roll/pitch/yaw

wise frigate
#

DO you have an example?

warm hedge
#

Or simply sqf _this#0 setDir 90?

wise frigate
sullen sigil
warm hedge
#

So I think either store the current value or getDir'ing the attachedTo object

ornate whale
#

Is it possible to use this command, and not get any errors, if the variable is not defined (isNil)? I want to get inside the "then" code, only if the switch variable "stealthUnit" is declared and is equal to true.

if ( _targetUnit getVariable "stealthUnit" == true ) then
    {```
I mean, it works, but I am not sure if comparing Nil and Bool is acceptable.
warm hedge
#
_targetUnit getVariable ["stealthUnit",false]```
warm hedge
#

In case you want to check both nil and bool the same time, here is the way: sqf isNil "_variable" and {_variable isEqualTo true}

granite sky
manic flame
#

Hello, I am playing around with Old Man quest system, is cfgQuest a file itself?

stable dune
tribal sinew
#

should I use setFog with remoteExec or BIS_fnc_setFog πŸ€” ?

granite sky
#

You should read BIS_fnc_setFog and see if it's doing anything interesting.

#

setFog on server should sync to client anyway.

#

(at least in current A3...)

cosmic lichen
#
private ["_fog","_density","_altitude"];
_fog = _this param [0,fogparams select 0,[0]];
_density = _this param [1,fogparams select 1,[0]];
_altitude = _this param [2,fogparams select 2,[0]];
if !(isserver) then {
    [[_fog,_density,_altitude],_fnc_scriptname,false] call bis_fnc_mp;
};
0 setfog [_fog,_density,_altitude];
[_fog,_density,_altitude]

BIS_fnc_setFog

tulip ridge
#

So basically just remoteExec but the old way

granite sky
#

bis_fnc_mp :D

#

yeah just remoteExec setFog on the server yourself.

tribal sinew
#

Roger

#

Was doing so but stumbled upon the BIS one

tough abyss
#

anyone know how the contact campaign blanks work? is it just a script that logs positions of dead people or some other sort of script?

#

or are the people who are hit just forced into an animation?

winter rose
upper siren
#

has anyone used radioChannelCreate recently? I create one and the channel ID returned is 2 which is the command channel. The created channel does exist and work but obviously doesn't have the id 2.

little raptor
#

doesn't radioChannelCreate return the custom channel ID?

#

i.e. you should add...dunno what it was...5? to it

#

yeah 5

south swan
#

big red notification states that Custom Channel IDs are converted to normal Channel IDs internally https://community.bistudio.com/wiki/Channel_IDs
but all related commands (i.e. radioChannelAdd) seem to explicitly mention that they take Custom ID as well blobdoggoshruggoogly

tough abyss
upper siren
#

because it returned 2 which had me confused

#

and it ended up being 7

little raptor
#

obviously the engine can't tell which one you mean with general channel commands

upper siren
#

that seems really convoluted but oh well, it works now. Thanks!

#

While people are looking, I'm trying to create that channel so our pilots can scribble their plans into it.
Only issue is that everytime I doubleclick to create marker it changes the active channel back to group. Is there a way to change that?

hallow mortar
#

It doesn't do that for me

#

You have some extra marker tools mod running, that could be doing it. Maybe it's set to prevent people from doing side markers, so it defaults you to group?

upper siren
#

I've got ACE and Metis markers running, disabling Metis now to check.

#

And Global channel is disabled but this is selfhosted multiplayer so I'm an admin without any map restrictions

hallow mortar
#

It's possible to block markers in a channel without actually disabling the channel. If the mod is doing that (#realism) it could make sense for it to make sure you're not wasting time trying.
This is just a theory, of course, but something is changing the behaviour from vanilla.

upper siren
#

Yeah I've got some channels disabled in description.ext. Metis marker mod wasn't at fault.

#

Still happens with ACE loaded and all channels enabled.

#

drawing lines etc. does not change the channels so it's probably that create marker interface

tough abyss
south swan
tough abyss
#

i need to get laser eye surgery

#

i read the examples not the notes lel

twin oar
#

getting this

granite sky
#

Guessing that's description.ext stuff.

#

maybe missing a close bracket.

twin oar
#

it is and found it

#

too many closed brackets

#

class BIS_WLFTEnabled
{
title = "$STR_A3_fastravel1";
values[] = {1, 0, 2, 3, 4};
texts[] = { $STR_A3_WL_param3_value1, $STR_A3_WL_param3_value2, $STR_A3_WL_param3_value3, $STR_A3_WL_param3_value4, $STR_A3_WL_param3_value5 };
default = 0;
};

#

0 means on?

hallow mortar
#

0 means whatever the script interprets it as. It's hard to know without seeing what those localisation keys resolve to.

twin oar
#

gotcha

drowsy geyser
#

getPosATL uav1 select 2 returns the height above ground but then when the uav lands on a building it still returns the height above ground and not the height above the surface

tulip ridge
#

ATL is based on height above the terrain

drowsy geyser
#

getPos uav1 select 2 returns the height above the surface but now if the uav has an altitude of 100m for example and flies above a building it will subtract the buildings height, is there a command which takes both in account?

south swan
#

u wot

drowsy geyser
#

haha xD sry if it was unclear

#

here altitude using getPos uav1 select 2

sullen sigil
#
private _pos = getPosASL uav1;
if (isTouchingGround uav1) then {
  _pos set [2,0];
};```
drowsy geyser
#

will this work?

#

i mean, if I fly the UAV over a 20m tall building, the buildings height will be subtracted

south swan
#

what do you want from that height?

hallow mortar
#

If you want height over surface, you can use getPos (given a fairly slow update rate to account for its worse performance) - the problems with it won't cause an issue with this specific usage.
If you want height over terrain, use getPosATL.
If you want to include non-"surface" objects like trees, you might need to do some raycasting.

south swan
#

or include all 3 with "Barometric" /"GPS"/"Radio" tags for ASL/ATL/ATLS :3

drowsy geyser
#

I think I'll stick with getPos uav1 select 2, anything else is to complicated fo me xD

winter rose
pulsar bluff
#

is it possible to use thhe "SlotItemChanged" event to detect weapon changed?

#

in the wiki list i see only inventory items

sullen sigil
#

it is not

pulsar bluff
#

doh!

limber panther
#

Greetings everyone!
I need a little advice, can someone help me please? In the following script: sqf _vehicle setPlateNumber format["9MC %1", round serverTime]; _vehicle addAction ["Read plate number", { params ["_target3", "_caller3", "_actionId3"]; hintC format["Vehicle plate number: %1", getPlateNumber _target3]; }];
i have addAction that is displayed to vehicle owner only. But i need this action to be visible and usable by everyone on the server. For this purpose, i'll use remoteExec but i'm not sure about "targets", should i use 0 or 2 ? Thank you.

still forum
#

0 or 2 doesn't really matter

#

worst case you add the action to the server which will never use it, which doesn't matter

tough abyss
still forum
#

oops

#

yes

winter rose
#

we cannot hide it anymore, but Dedmen was never really part of Bohemia

still forum
#

so you want not 2 then

tough abyss
#

this going in my archives

still forum
#

Only been in bohemia once over a couple days

limber panther
#

you are confusing me, so should i use 0 or 2 ?

still forum
#

0 or -2. 0 is safer

winter rose
#

use 0

tough abyss
winter rose
#

not if you have a player-hosted server

#

use 0

#

@limber panther ↑

tough abyss
#

trust in lou

limber panther
#

thanks i'm trying to understand it ...

#

i yeah i think got it now

tough abyss
#

this can help a bit to understand remotexec

sullen sigil
#

real ones just dont use remoteexec

limber panther
tough abyss
#

or initplayerlocal/onplayerrespawn if you have a mission file

sullen sigil
#

no i just use cba events for everything

limber panther
proud anchor
#

anybody know how enemy spawning works in escape or what channel in this discord i could find that out in

fleet sand
#

Hi guys i have a question what would be the best aproach if i want to create something like aimlab in arma.
What would be best aproach to spawn objects in like a 2D grid randomly. Here is example:

still forum
#

just use random to select a grid cell/index.
Convert that to a position.

I don't know if simple objects have hit eventhandlers
can probably just createVehicle a balloon

fleet sand
sullen sigil
#

just createvehicle stuff

winter rose
still forum
#

8x8 grid
random number between 0 and 64

X = number mod 8
Y = number/8

position3D = originPos + [x, 0, y]

limber panther
fleet sand
still forum
#

bottom left

#

you can swap x and 0 to rotate 90Β°

#

you an also do center by just pushing it over by 4, or 4.5 or whatever is that center thing

limber panther
# winter rose correct for an `addAction` it's not important at all otherwise use `[0, -2] sele...

Could you please check it? I feel like i might have missed a ";" somewhere. Also i'm not sure, if the _vehicle should be on the beginning as well as at the end. Why is it at the end anyways? Thank you.

original: sqf _vehicle addAction ["Read plate number", {params ["_target3", "_caller3", "_actionId3"];hintC format["Vehicle plate number: %1", getPlateNumber _target3];}];
remoteExec: sqf [_vehicle, ["Read plate number", {params ["_target3", "_caller3", "_actionId3"];hintC format["Vehicle plate number: %1", getPlateNumber _target3];}]] remoteExec ["addAction", 0, _vehicle];

fleet sand
# still forum bottom left

Thank you very much its working just quick question is there a way to modifie so i dont have 2 objects spawning on top of each other ?

for "_i" from 0 to 4 do {
    private _number = random 64;
    private _xPos = _number mod 8;
    private _yPos = _number / 8;
    private _pos = getposASL pos1 vectorAdd [_xPos,0,_yPos];
    private _ballon = createVehicle ["Land_Balloon_01_water_F", _pos, [], 0, "NONE"];
    _ballon enableSimulation false;
 };```
still forum
still forum
tough abyss
#

how i'd do it given you would need a hit/destroyed eh to remove the position```sqf
private _blacklistpos = [''];
for "_i" from 0 to 4 do {
private _number = random 64;
private _xPos = _number mod 8;
private _yPos = _number / 8;
private _pos = getposASL pos1 vectorAdd [_xPos,0,_yPos];
_blacklistpos append _pos;
if !(_pos in _blacklistpos) then {
private _ballon = createVehicle ["Land_Balloon_01_water_F", _pos, [], 0, "NONE"];
_ballon enableSimulation false;};
};

still forum
tough abyss
still forum
#

Also append is wrong, you wanted pushBack
also you don't need to pre-fill the array with an empty string

#

There is a round command that rounds one number, there isn't one for arrays of numbers

#

Also the array being a private local variable, means that it certainly won't be there inside hit/destroyed eventhandler

tough abyss
#

im sorry and this is not too related but this reminds me of this that my friend sent me a while ago (you guys help massively and this isnt ment to be hositile)

still forum
#

INEFFICIENT*

still forum
tough abyss
winter rose
still forum
#

uh there is a copy button now

tough abyss
#

i feel most discord frontend/gui programmers just thinking of anything else they can make since they basically have it all

fleet sand
# still forum uh there is a copy button now
private _myArray = [];
for "_i" from 0 to 63 do {
    _myArray pushBack objNull;
};

for "_i" from 0 to 4 do {
    private _number = random 64;
    if((_myArray select _number) == objnull) then {
    private _xPos = _number mod 8;
    private _yPos = _number / 8;
    private _pos = getposASL pos1 vectorAdd [_xPos,0,_yPos];
    private _ballon = createVehicle ["Land_Balloon_01_water_F", _pos, [], 0, "NONE"];
    _myArray set [_number,_ballon];
    _ballon enableSimulation false;
    }else {
        _number = random 64;
    };
 };
``` so this is what i have so far just how would i get the element to re roll.
still forum
#

== objnull doesn't work

fleet sand
#

oh isequalTo

still forum
#

no

#
private _number = random 64;
while {!isNull (_myArray select _number)} do {_number = random 64;};
#

just keep rolling until you hit a null

#

Would end badly if all slots are filled, but that shouldn't happen

little raptor
#

you could also do _array - [objNull]

still forum
#
private _myArray = [];
_myArray resize [64, objNull];

to quickly fill array with nulls

still forum
winter rose
#

noice

still forum
#

I didn't know it existed either. I just hoped for it when opening the wiki πŸ˜„

winter rose
#

and I worked on the page after it was introduced πŸ˜†

little raptor
still forum
#

dafunk

#

We want to know what index is empty

little raptor
#

you do

#

that's what that code does

still forum
#

That doesn't feel better

#

I need two lines of comments to explain what that does πŸ˜„
And its alot more complex, for something that rarely fails (we will rarely hit a filled slot). You are reducing the performance cost for when it would fail, but increase the performance cost for every roll

little raptor
#

_filled is indices of filled spots
_constArrayOf0to64 is just [0,1,2,3,4,....,63]

#

when you do _constArrayOf0to64 - _filled you instantly know which spots are free

fleet sand
# still forum ```sqf private _number = random 64; while {!isNull (_myArray select _number)} do...

Would it be something like this ?

private _myArray = [];
_myArray resize [64, objNull];

for "_i" from 0 to 4 do {
    private _number = random 64;
    if(isNull(_myArray select _number)) then {
    private _xPos = _number mod 8;
    private _yPos = _number / 8;
    private _pos = getposASL pos1 vectorAdd [_xPos,0,_yPos];
    private _ballon = createVehicle ["Land_Balloon_01_water_F", _pos, [], 0, "NONE"];
    _myArray set [_number,_ballon];
    _ballon enableSimulation false;
    }else {
        while {!isNull (_myArray select _number)} do {_number = random 64;};
            private _xPos = _number mod 8;
            private _yPos = _number / 8;
            private _pos = getposASL pos1 vectorAdd [_xPos,0,_yPos];
            private _ballon = createVehicle ["Land_Balloon_01_water_F", _pos, [], 0, "NONE"];
            _myArray set [_number,_ballon];
            _ballon enableSimulation false;
    };
 };```
little raptor
#

so no need for while

still forum
#

Yeah you save a while that rarely runs. And replace it by complex code that needs comments to explain what it does and increases performance cost for every roll

still forum
#

literally what I wrote in the _number = line

little raptor
fleet sand
# still forum No. No "if then" at all

Sorry i am confused if i do this:

private _myArray = [];
_myArray resize [64, objNull];
for "_i" from 0 to 4 do {
    private _number = random 64;
    while {!isNull (_myArray select _number)} do {_number = random 64;};
    private _xPos = _number mod 8;
    private _yPos = _number / 8;
    private _pos = getposASL pos1 vectorAdd [_xPos,0,_yPos];
    private _ballon = createVehicle ["Land_Balloon_01_water_F", _pos, [], 0, "NONE"];
    _myArray set [_number,_ballon];
    _ballon enableSimulation false;
 };
``` isnt this just infinte while true loop then ?
still forum
#

no

#

it changes _number

#

The chance of hitting a filled slot a second time, is low

fleet sand
granite sky
#

bear in mind that random 64 will very occasionally roll 64 :/

still forum
#

which in this case would be fine

granite sky
#

Not sure what while {!isNull _nilVariable} does.

still forum
#

it will be nil, which will nil out the while loop and make it exit/skip

granite sky
#

RPT error in scheduled or not?

still forum
#

I think no because its not a variable?

#

so no "undefined variable"

#

Actually I guess its not fine, last grid cell should be row 7 column 7, not 8,0

#

But the random is anyway not fair because the first cell only has 0.5 chance while the others have a 1.0 wide range.
its also not just 64, 63.51 would also round over
but eh, left as exercise for the student

tough abyss
#

is there a way to test if something is equal to a number or larger with operators, if so what signs?

granite haven
#

= bigger or equal

crude egret
#

How can i Add spawned Units (via Script) to the sector tactic? I tried to Add the sync from unit to an existing sector tactic Module after the Units Spawn, but it doesnt seem to Work... After the Units get Out my vehicle, they are supported to Run to the sectors and capture them...

(The Units get spawned, enter my Heli and get Out when i arrive at the AO. And thats where i want them to Run to the sectors)

tulip ridge
#

Is there a way to change a helmet's hiddenSelectionsTextures in-game?

hallow mortar
#

Unfortunately no, helmets are just proxies and aren't accessible by setObjectTexture

tulip ridge
#

I knew setObjectTexture wouldn't work, just wasn't sure if there was some other texture setter. Figured it was a no πŸ‘

grizzled cliff
#

:)

velvet merlin
#

INIT_DISPLAY functions cant be recompiled since the system sets to compileFinal no matter what, right?

#

aka you have to game restart each time to test changes

cosmic lichen
#

Have you tried overwriting the UiNamespace variable?

nocturne bluff
#

Dayum.

#

Sexy.

harsh vine
manic flame
#

Hello, I'm currently refactoring an old sqf script I found that I thought was really useful for my use case. What are some technical issues one may encounter when optimizing SQF code? I come from a TypeScript background.

#

Does nearestObjects have a big performance impact if it were to be ran per frame?

manic flame
#
    _SHIG_check_enemy_weapon = {
        params ["_unit"];
        private _currentWeapon = currentWeapon (_unit findNearestEnemy _unit);
        private _isValid = _currentWeapon == "" ?? true : false;
        if (_isValid) then {
            true
        } else {
            false
        };
    }

Is there a way I can return _isValid directly? Whenever I do return is_Valid sqlint gets angry at me.

cosmic lichen
#

Just return _isValid

#

Wait, that's sqs

manic flame
#

No, should be SQF as far as I know lol

#

Also it seems to work fine now,

cosmic lichen
#

?? and : is sqs

manic flame
#

Those are valid sqf statements as well

#

its general coding, i forgot its name now

cosmic lichen
#
_SHIG_check_enemy_weapon = {
        params ["_unit"];
        currentWeapon (_unit findNearestEnemy _unit) != "";
    }
manic flame
#

Will it return boolean? I need that data.

cosmic lichen
#

Sure

#

not sure what you wanna do with findNearestEnemy though

manic flame
#

hm? why, any issues with that?

cosmic lichen
#

Nah nevermind. So you just wanna see if the nearest enemy unit has a weapon. All good then.

manic flame
#

Yeah, im working on an enhanced surrendering script using ACE & CBA

cosmic lichen
#

I'd probably rename that function though

manic flame
#

It has a lot of if elses so i need to reduce the ammount of code in each line

cosmic lichen
#

to something like

hasWeaponEnemy or so

manic flame
#

Alrighty

#

I kinda need to reduce this... lol

#

So many conditions

#

im not even sure if I can reduce it at all, would love some input on this

cosmic lichen
#

I'd probably sort them from simplest to most complex.

#

and also use exitWith to exit out early.

#

Lazy Eval might be an option as well although it will make this even more messy.

manic flame
#

I managed to kinda sort it out by making a lot of small functions

#

Probably not a good practice, but It makes it much more readable

#

Although now I have a huge chunk of variables

#

Better than having it included into an ifelse statement

#

(also a lot of constants πŸ˜› )

winter rose
#

(that doesn't exist in this form in SQS/SQF)

manic flame
#

Meant ? :

#

Which im guessing neither exists

warm hedge
#

SQF never uses ? character

winter rose
#

? alive player : exit ← SQS valid, equivalent of if (alive player) exitWith {};

manic flame
#

unfortunate, really liked it.

sullen sigil
#

the only time sqf scripters use ? is trying to convey emotions from reading my code

winter rose
#

no ternaries anywhere in Arma, e.g hint (alive player ? "alive" : "dead");

manic flame
#

Alright, thanks.

winter rose
# manic flame **Probably** not a good practice, but It makes it much more readable

the best/most readable would besqf // if (isNull _guy) exitWith {}; // _stuff != objNull DOES NOT WORK + 'alive' below already checks for null (null = 'dead') if (not alive _guy) exitWith {}; if (!anotherTest) exitWith {}; // etc to funnel possible cases and avoid testing everything before checking the result, saving perfs did you or did you not use chatGPT? you also may want to enable script errors to show with -showScriptErrors

sullen sigil
#

with that many conditions as well its a good idea to use lazy eval

manic flame
#

I write my code, the repetitive tasks are aided with copilot

sullen sigil
#

copilot works for sqf? meowsweats

manic flame
#

yeah, it doesnt do much, so I just leave it for the repetitive parts (like writing a dozen variables...)

sullen sigil
#

wonder if it will work with the macro'd hellscape i call my development environment

manic flame
#

Copilot already has major struggles with simple SQF wouldnt wanna know with that

sullen sigil
#

i shall give it a try later today

winter rose
#

say no to macros
use patches 😁

sullen sigil
#
if (GVAR(username) isEqualTo THATCURSEDSCRIPTER) exitWith {RUNAWAY};```
#

πŸ˜„

winter rose
#

!burgerpan @sullen sigil leaking source code!!1!

stoic fractal
#

Hello everyone

#

Anyone have Zombie Scripts for the pub zeus?

queen cargo
sullen sigil
#

tee hee

#

cfgconvert can do preprocessing i keep meaning to edit my registry to do that

queen cargo
crude egret
little raptor
#

this is how lazy eval works:

if (!isNull _target && {
  !isPlayer _target && {
    ...
  }
})

i.e. what's inside {} will only execute if the check succeeds

manic flame
#

I see. It would make my code just lightly better, Im right now looking to see if there's any other alternative

little raptor
#

you mean reading wise?

manic flame
#

Reading wise & performance wise in general

#

Dont like having so many conditions smashed together

#

but i really cant think of anything better at the moment

#

I will probably rewrite using lazy eval as you said and call it off

wicked sparrow
#

Can someone explain to why the array complelty vanishes after I delete some elements out of it?
For context:

_ammoCount is an array like this [10,50,14]
checkFakSlot returns a Bool depending on which ammo number is provided.
Systemchats are here to check how far the code goes, the last ammoCount does not show tho (like not even that it's a empty array, it is just gone)

Lets say our values are [10,10,16]

  • 10 is true
  • 16 if false (should be removed out of the ammo array)

So now the code runs and the syschat returns that 16 was tracked to be false and 10 not.
But now for some odd reason the whole _ammoCount array is just gone. IDK why...

private _ammoCount = [_unit, _mag] call FUNC(getMagazineAmmoCounts);
private _removeFromArray = [];

if ((count _ammoCount) > 1) then {
    systemChat "Bigger then 1";
    systemChat str _ammoCount;
    {
        if !([_unit, _mag, _slotsToGive, _x] call FUNC(checkFAKSlot)) then {
            systemChat "del";
            _removeFromArray pushBack _x;
        };
    } forEach _ammoCount;

    _ammoCount = _ammoCount deleteRange _removeFromArray;

    systemChat str _removeFromArray;
    systemChat str _ammoCount;
    systemChat "here";
};
granite sky
#

you want - there, not deleteRange

winter rose
#

hey, that was not the question :p

wicked sparrow
#

ohhh now I see, I misread the explanation in the array doc.

#

They could have used a better example. FR I thought it just deletes the values provided. But guess I'm just dumb and overthought it.

winter rose
#

wait, what page is that

#

perf page

little raptor
#

looks like Array?

winter rose
#

array it is

wicked sparrow
#

But TBH I could have be so wise to just search for delrng myself.

winter rose
#

you can click to be linked to the command's doc page yes πŸ™‚

carmine sand
#

do you know if scan horizon has been added now?

little raptor
#

afaik no

carmine sand
#

such would do a lot of stuff like watchtowers / lighttowers / guard towers and other stuff easier instead of a doWatch loop

#

since it exists but not external executeable

winter rose
little raptor
#

(search for existing ones first)

carmine sand
# little raptor (search for existing ones first)

maybe you're faster with an example, im trying to make a autonom turret able to give it a bit life so it has to randomly turn in any directions, im currently looking if its possible to have south north west east but seems not, so i could add _x doWatch south etc

#

i cant find anything, and the setFormDir is more for infantry stuff

little raptor
#

well I can only (try to) add scanHorizon for now, which does the same thing as vanilla command

carmine sand
#

that would be great if this could be executeable via EH Init or with an activation cause with this the AI will still attack enemies if its able to see any

ornate whale
#

Would it be faster with a hash map (getOrDefault)? Thanks

StealthAI_CONST_paces = ["stp", "wlk", "tac", "run", "eva", "spr"];
if ( !(_pace in StealthAI_CONST_paces) ) then
  {
    _pace = "stp"; //Default value.
  };
ornate whale
little raptor
#

it'll be just as fast

#

you can always try tho

ornate whale
#

How should the array look as a hashmap [ ["stp","stp"], ...];

little raptor
#

doesn't matter what the value is

#

you just want to use in

ornate whale
#

Oh, I see, thanks.

little raptor
#
StealthAI_CONST_paces_HM = createHashmapFromArray (["stp", "wlk", "tac", "run", "eva", "spr"] apply {[_x, nil]});
ornate whale
#

But it has sto be array of arrays right?

little raptor
#

you need a pair so yes

ornate whale
#

ok

#

thanks

little raptor
#

like I showed the value can just be nil

granite sky
#

can also do this and it fills with nils:
["stp", "wlk", "tac", "run", "eva", "spr"] createHashMapFromArray []

little raptor
#

didn't know that was a thing πŸ˜…

granite sky
#

It's pretty handy when you have one of these with more entries, but I wouldn't expect it to make much difference for a six-entry array.

#

I need to write a feedback thing begging for hashmap array subtraction.

#

large array minus fairly large array is a pretty common use case.

#

and it's n-squared with plain array subtraction.

little raptor
#

imo it's useful yes

#

tho it's a bit confusing
as in should it remove just the keys or should the array be [k,v] pairs

#

maybe an extended syntax for removeRange is better

granite sky
#

I only care about the keys personally.

#

Only reason to involve hashmaps at all is that they're naturally O(1) per key lookup.

#

so you could replace array1 - array2 with keys ((array1 createHashmapFromArray []) - array2)

#

deleteAt or deleteRange override is fine too.

little raptor
#

deleteAt is already a thing

#

it removes a single key

granite sky
#

yeah but it only does one entry at a time.

little raptor
#

well I mean it can't be overriden

granite sky
#

ah I guess you could have an array as key so that doesn't work.

little raptor
#

yes

ornate whale
#

Is there any other command apart from getordefault, so it would return bool if it found the key value?

granite sky
#

in

ornate whale
#

I thought tha this is just for array. πŸ˜„

granite sky
#

_key in _hashmap

ornate whale
#

The hashmap is slower in this case.

little raptor
#

well I told you blobdoggoshruggoogly

#

a hashmap is only worth when you have ~20+ elements

granite sky
#

hmm, actually did array1 - array2 get optimized recently...

manic flame
#

hi, im trying to play a video in arma 3 using this code;

["phant_arma.ogv"] remoteExec ["BIS_fnc_playVideo", ([0, -2] select isDedicated), false];

For some reason the video is just pure black pitch. I used FFMPEG to convert the video (screenshot for reference).

There are no errors or logs in the RPT relevant to this.

#

There's also no audio

#

Its just black

#

Is there a resolution limit to the videos? (Since the video im using is 1080p)

winter rose
manic flame
#

It has to be 100% libtheora?

#

I am using libvorbis

winter rose
#

no idea really

manic flame
#

nvm its the same command actually

#

check a nd compare

hallow mortar
#

Do you have PiP turned on in your graphics settings? Video-on-texture uses PiP and won't work without it.

winter rose
#

The ffmpeg tool provides a conversion output that works in Arma 3 up until ffmpeg's 4.0.2 version

manic flame
#

and uhh yeah should be on regardless

winter rose
#

I highlighted the info in doc

manic flame
winter rose
#

k

manic flame
#

4.0.2

old radish
#

why does this work with items that are placed in editor
_amount = count (_selectedVault nearObjects ["Item_Money_stack", 5]);
but if you pick one up, drop it down in the same spot and run the code again it doesnt recognize it anymore (its not a big deal for my mission, but im trying to count the amount of money stacks sitting on the floor after the players have carried them around)

little raptor
#

nearObjects ["Item_Money_stack"
this doesn't give you the "item". it gives you the object that holds the item

#

items are not objects

#

what you place in editor is just a special object that contains the item

old radish
little raptor
little raptor
#

not 100% sure about the money stack object so test it to make sure it works

#

not sure about this one either but if it works it's better: _pos nearSupplies 5 findIf {"Money_stack" in itemCargo _x} >= 0;

old radish
#

thanks, ill try it

hallow mortar
#

If it doesn't work, try magazineCargo instead of itemCargo. I've run into this before where an """item""" was actually a magazine and I think it might've been with the money

old radish
still forum
# manic flame I kinda need to reduce this... lol

!= objNull doesn't work.
alive objNull would return false, so you can simply skip the != objNull check because thats included in the alive anyway.

I don't know what you're trying there with the ACE captives check? you already check "captive" later, and the ACE things would also set captive, so really you are checking the same thing multipel times?

Also the random selection part at the bottom, I would remove from the condition and put into extra code below

#

You could also combine your conditions into functions.
like

_isNotCaptive = { check ace variable && other ace && other ace && !captive _target };

if (x && ... && _isNotCaptive && ...)

manic flame
#

Thanks!!!

zenith prairie
#

I am working on a jetpack script.
I want to mitigate damage from falling while using a jetpack and I want to be able to use it with ace's medical system.

I was able to achieve the desired results by modifying The damage handler SQF file inside of aces medical engine PBO. But now I need to figure out how to make it work without messing with the stuff contained within the Ace mod.

The plan was to make their mod a dependency, and use the modified damage handler script in place of ace's
But CBA and Ace seem to use a special system that I haven't really been able to figure out.

One way somebody might be able to help me with this is to explain how the ace and CVA add-ons have their mods looking at a directory structure above them.
CBA x\cba\addons...
ACE z\ace\addons...
How can I achieve a similar structure in my mod?

sullen sigil
#

pboprefix

#

arma will look in arma root\z\ace\addons\[...] and if doesnt exist then looks in pbo

#

used for filepatching

zenith prairie
# sullen sigil pboprefix

Thank you! this got me looking in the correct direction. If you use PBO Manager and click view, you can edit headers. this seems to be how the prefix can be edited

sullen sigil
#

no please dont

#

file of name $PBOPREFIX$ with no extension that contains it

zenith prairie
#

is that something particular to mikeros tools?

sullen sigil
#

no

#

literally just a file with that name

zenith prairie
#

just put it in the folder that you pbo?

sullen sigil
#

for instance

#

that tells arma that for that pbo it will look in y\KJW_MedicalExpansion\addons\core\[...] then the pbo

#

if filepatching is enabled

zenith prairie
#

I appreciate your time. Any thoughts on where I should look to resolve this error?

sullen sigil
#

unclosed bracket somewhere in your config i would presume

#

though would recommend hemtt as itll tell you where

zenith prairie
#

I've been hearing about hemtt I will give it a try.

lavish canyon
#

hi guys! how to use ctrlSetPosition for RSCActiveText? Why it don't work?

twin oar
#

Hey guys, having an issue with WL

#

Players join after the start lobby yet don't get the 2500 CP

#

but if they were there at lobby start they get it, any idea?

#

my decscription.ext has

#
class BIS_WLStartCP
    {
        title = "$STR_A3_WL_param12_title";
        values[] = { 0, 100, 250, 500, 1000, 2500, 5000 };
        texts[] = { "0", "100", "250", "500", "1000", "2500", "5000" };
        default = 2500;
    };
#

in the class Params like it's supposed to be

#

do I need to add anyhting for JIP?

little raptor
manic flame
#

Need some help.

Im trying to get a custom sound to play on a trigger, I registered the sound in description.ext;

class CfgMusic
{
    tracks[] = {};
    class obsession
    {
        // display name
        name    = "Taishi - Obsession";

        // filename, volume, pitch
        sound[]    = { "\fx\obsession.ogg", db + 10, 1.0 };
    };
};

And my trigger code;

playMusic "obsession"; 

In my testing, nothing plays.

winter rose
manic flame
#

i dont think so, i'll check right now.

#

Actually, found it.

#

Should I just drop it as is?

#

Oh when I play the preview it doesnt work either

#

I think it might be the format conversion being fucky

winter rose
#

yup
so the game recognises it, the playMusic seems fine, then it's either file path or encoding at fault

manic flame
#

Yeah, re-encoded with audacity.

#

Works fine now

limber panther
#

Hello!
I'm currently trying to figure out two problems. May i ask for a little hint? 😁 When trigger gets activated, the script in on activation field gets executed on every client but i want that to happen on client who triggered the trigger only. How do i do that? I was thinking about using remoteExec and for target use:

Object - the order will be executed where the given object is local
but how do i define this "object" ? Thank you.

granite sky
#

This is an editor trigger with activation statement set in the editor?

limber panther
granite sky
#

I ask because setTriggerStatements is local effect.

#

but if it is running everywhere then you can do something like if (!local (thisList#0)) exitWith {}

#

bear in mind that it is possible for two clients to be in thisList.

#

If you need to check them all then that's a bit different.

limber panther
#

i'm afraid i don't understand you, let me tell you more in detail what i'm trying to achieve

#

imagine 2 vehicles one behind another both driving on the road in the same direction, driver of the rear vehicle uses radio alpha command triggering the trigger, he should get a hint saying he activated it (only him, noone else) and something should happen to the vehicle in the front and that action should be global (seen by everyone), i also need to figure out how to tell the game do that for the front vehicle πŸ˜… but first i need to solve this first part

granite sky
#

What I said should work. Just paste that in at the top of the trigger script.

#

Basically means it'll quit immediately unless the first triggering object is local.

limber panther
#

someone in the past suggested me this solution: sqf ["hi!"] remoteExec ["hint", thisList select 0];
but i don't understand that either

#

how does the thisList select 0 thing work?

granite sky
#

If you need something else to happen on another machine on the same trigger then you'll need to refactor a bit:

if (local (thisList#0)) then {
  // do your hint stuff here
};
#

Within trigger activation statements, thisList is an array containing all the objects that activated the trigger.

limber panther
limber panther
granite sky
#

In this case (radio activation) there should only be one object in the array, but it's still an array.

#

No, it's probably an array containing the one player who activated the radio trigger.

twin oar
#

warlords is frustrating

limber panther
granite sky
#

First part yes. Second part with caveats :P

limber panther
#

what kind of caveats?

granite sky
#

You don't necessarily need to run code everywhere to have an effect for everyone.

limber panther
#

ok let's say i want to create a task with call BIS_fnc_taskCreate

granite sky
#

That normally only needs to run in one place. The BIS task functions are global effect.

#

Unlike createSimpleTask which is local effect.

#

for task stuff you should probably use:

if (isServer) then {
  // do task creation stuff here
};
limber panther
#

@granite sky so this way? I'm getting confused sqf if (local (thisList#0)) then { //hint for 1 player here }; if (isServer) then { // create task for everyone here };

granite sky
#

yes

limber panther
granite sky
#

That's what the channel is for. Assuming that it's about scripting.

limber panther
#

yes, thank you i appreciate it a lot

#

from the previous example, 2 vehicles one behind another on the same road driving in the same direction, the driver of the rear vehicle uses the radio alpha and triggers the trigger, this should create a task for everyone and location of the task should be the front vehicle, so as the front vehicle will move, the task should move with it, but how do i tell the task to follow that front vehicle?

#

i was thinking about using the centre of the screen as an aim point but while driving in 3rd person players look downwards and not to the front

#

@granite sky perhaps is there a script like terrainIntersectASL but instead of terrain it could be the front vehicle? if so i could then use modelToWorldWorld to draw a line in front of the rear vehicle

winter rose
limber panther
winter rose
#

you have two possibilities; either you know which vehicle it is (and you make the task follow with this ^)
or you want to target whatever is at the centre of the screen and then you need to find what is under the cursor then do the same as above

unless I am entirely mistaken on the goal you try to achieve

granite sky
#

Point is that you don't need to keep a position updated if you just want it to track the vehicle. The task framework will do it for you.

thorn saffron
#

Is it possible to change bullet count on a specific magazine that is unit's inventory?

granite sky
#

@thorn saffron No but you can remove all the magazines and re-add what you want.

limber panther
#

let's say i'm driving a vehicle and some random vehicle gets into my way and drives in front of me so i want to tell my teammates about it by making a task that's gonna follow that vehicle @winter rose

thorn saffron
granite sky
#

If you just want to identify the object a player is looking at then that's cursorObject

#

Needs to be run local to that player.

#

If you need that information non-locally then... don't do that.

#

(eyePos + eyeDirection + lineIntersects)

limber panther
granite sky
#

You want to know what's in front of the vehicle rather than anything to do with the player view?

limber panther
winter rose
limber panther
#

just to be sure - you say vehicle closest to point which is 30 meters in front of my vehicle, right?

winter rose
#
  • grab a point 30m in front of said vehicle
  • search entities close to that point
  • eventually search for the one closest to that point, or closest to the player's vehicle
limber panther
limber panther
winter rose
#

whatever floats your goat!

limber panther
limber panther
winter rose
#

then check which one is a vehicle, then check which one is closer to player's vehicle, then launch your script with it, then open the Uber delivery driver to eat that pizza with chocolate toppings, then reevaluate your food choices

limber panther
#

thank you @winter rose and @granite sky for all your help, i'll try to put it all together

tough abyss
#

had a bit of a lapse in brain and cant exactly tell how i would go about modifying certain elements inside of co ordinates? is it just 3 elements in an array?

granite sky
#

yes.

#

_position set [2, 0] to set a Z coord to 0 for example.

brazen smelt
#

What would be the best method to use if I want to have something check if certain items are in a scenario and replace them with an alternative?

In my specific case, I'm looking to replace the Spearhead smoke grenades with vanilla ones.

sullen sigil
#

cba loadout changed eh and check for spearhead smoke

brazen smelt
#

As it would need to find and replace them, even mid scenario (like if a Zeus spawns an ammo crate or a vehicle that contains these items)

manic kettle
#

You could also use the ace item replacement function. Kinda like how in ace if you pick up a vanilla FAK it gives you ace bandages instead

polar belfry
#

hello I would like help with a multiplayer script. I am making a silo scene for an op (Similar to the silos firing in original Cod4).I would like to make a script that launches a large missile straight vertically from a reference object (such as a tin can "p1").

#

I have my old no fly zone script handy and believe it can be modified

#
[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 7;
  };
}```
Maybe remove targeting and set it to aim straight up
golden cargo
#

What you mean by "large missile"?

polar belfry
#

I will replace ammo_Missile_rim162 with the GM luna missile

#

with no collision

#

it's mostly for visual effect

wooden dove
#

hi! is there a difference between ai and ai that replace the player when no one logs in the slot?

#

does isPlayer work?

polar belfry
#

I believe not. Both are AI just one stays there in case the player loses connection

wooden dove
#

if they use the player slot they respawn though right

#

im not sure if im noticing right though, but if i delete one while its alive, does it respawn?

#

they stop respawning if i delete them through zeus

#

or not really sure how it works

#

i tried using a clean up body script i found and they suddenly stop respawning after awhile not sure if deleting them is whats causing it?

#

not really sure how to differentiate them from regular ai

#

im using warlords btw

#

the arma 3 modules thing

polar belfry
#

So if I'm not wrong the AI/ player slot works by replacing a disconnected player with the AI that occupied that slot. In games with no respawn in case the player crashes the AI will take over and the player can rejoin wihout spectating as long as the AI is alive. I think functionally other than that they are the same

wooden dove
#

ohh

#

that makes sense

#

maybe im just not waiting long enough haha

#

thank you!

#

sorry I can't help you btw xD

#

idk anything

polar belfry
#

dw

[thisTrigger] spawn { 
private _missile = createVehicle ["ammo_Missile_rim162", p1, [], 0, "CAN_COLLIDE"];
_missile setVectorDirAndUp [[1,0,0], [0,0,1]];
}

#

would this spawn the missile aiming upwards?

#

p1 is the the can on the floor on the silo

polar belfry
#

so this one blew up in my face

stable dune
# polar belfry so this one blew up in my face

You need disable animation of missile.
You can test from via debug

private _pos = player modelToWorld [0,2,1.6];
private _missile = createVehicle ["ammo_Missile_rim162", [0,0,0], [], 0, "CAN_COLLIDE"];
_missile enableSimulation false;
_missile setPosATL _pos;
_missile setVectorDirAndUp [[0,0,1], [1,0,0]];
polar belfry
#

the position of the missile I want to be the "p1" oil spill

#

but testing

polar belfry
#

Works nicely

#

thanks

#

now will work as to modify the existing no fly zone script just to aim missiles from 500m above the player instead of 5m above the terrain

devout gust
#

Is it possible to disable collision for players on a object placed by script on a dedicated server? The "disableCollisonWith" command seems to require that both objects be local for it to work.

drowsy geyser
#

any way to check if a camera was created via camCreate?

polar belfry
#

is there a way to add an if statement in a trigger activation?

#

not as "condition" but in "On Activation"

winter rose
warm hedge
#

Yes, anything can be done as long as the return value is a boolean

polar belfry
#

I wrote this so far


[thisTrigger] spawn { 
private _pos = p1 modelToWorld [0,2,1.6]; 
private _missile = createVehicle ["vn_sa2_ammo", [0,0,0], [], 0, "none"]; 
_missile enableSimulation true; 
_missile setPosATL _pos; 
[thisTrigger] spawn { 
private _pos = p1 modelToWorld [0,2,1.6]; 
private _missile = createVehicle ["vn_sa2_ammo", [0,0,0], [], 0, "none"]; 
_missile enableSimulation true; 
_missile setPosATL _pos; 
_missile setVectorDirAndUp [[0,0,1], [1,0,0]];
sleep 20

while {triggerActivated (_this#0)} do { 
private _position = vehicle player getRelPos [900,200]; 
_position set [-2,900]; 
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 7;
private _pos = p1 modelToWorld [0,2,1.6]; 
private _missile = createVehicle ["vn_sa2_ammo", [0,0,0], [], 0, "none"]; 
_missile enableSimulation true; 
_missile setPosATL _pos; 
_missile setVectorDirAndUp [[0,0,1], [1,0,0]];
sleep 20 
  };

}```

Missile flies sky high and after 20 seconds all players get locked by a sparow.
I want to add an if statement so it does the sparrow thing  if its above a cerain altitude
fickle socket
#

Not sure this will help but I used "call{triggeractivated trigger7 ;}" within the condition of the effect module. it said true in it but I changed it to the code above and it worked, it was triggered by the trigger. This didnt work when I synced it to the trigger

winter rose
polar belfry
#

ok

carmine sand
winter rose
carmine sand
#

Hmm i dont get it, when i want to add the sleep command i get an error notlikemeow

winter rose
#

it's in a spawn, not in trigger's condition/onAct directly

carmine sand
#

Ah oof facepalm

polar belfry
#

so I'm back

#

can I add a check similar to

( getposatl vehicle player) select 2 < 500

in the "On activation"?

winter rose
polar belfry
#

oh

#

it's like pastebin

winter rose
#

yes
it has issues with # so I recommend using select instead
or params

polar belfry
#

so instead of this#0 what should I write

winter rose
#

this select 0

#

or```sqf
[thisTrigger] spawn {
params ["_trigger"];
// ...
while { triggerActivated _trigger } do {

polar belfry
#

Will this send a missile at my players that fly over 500m and will the missile fly high at them from 900m

winter rose
#

try and see

polar belfry
#

works

#

will set the altitude to something higher

#

can I set an integer
as private int _x=0

warm hedge
#

There is no int or float, just number basically float

polar belfry
#

oh

warm hedge
#

And as you've already noticed there is no need to declare the type when you want to declare a thing

polar belfry
#

ok then I'll do a for loop in the while loop so my players get a few missiles on their backs if they fly over altitude
(I try to simulate AC5 Hrimfaxi but instead of instant death it's sam missiles so it's relatively avoidable

#

and will add a if at the start of the loop so in case they go in safe altitude missiles stop

polar belfry
#

It all worked

winter rose
#

woot

polar belfry
#

Show missile goes to space and any plane above 500 m gets a visit from an RIM-162 missile

#

around 4 actually

#

and in case they duck under 500 an if check stops the for loop with a break

#

so another show missile flies out and the loop continues

exotic flame
#

Is it possible to modify the ai driving programmation ?

winter rose
#

nope

#

everything engine-side remains engine-side
you may eventually force the AI to drive on certain points, but it will still use the Engine to go from one point to another

exotic flame
#

I see, thanks for your answer. I guess i gonna have to wait for Arma 4 to do this.

winter rose
exotic flame
drowsy geyser
daring zinc
#

python style arrays plox

#

array[2:-1:-1]

tough abyss
#

am i that stupid? sleep ( 5 + ( random 3 ) ); gives me generic error

vast zodiac
#

Does anyone know how to add patches to ai when making a faction?

tulip ridge
queen cargo
#

are you in a non-scheduled environment @tough abyss

vast zodiac
tulip ridge
#

You could just put it in an event handler on the base unit for that faction, and then any unit that inherits from it will get the patch you set

tough abyss
#

ehm if it would be it gives a different error. something like sleep is not allowed in this context

queen cargo
#

well your code is perfectly fine

#

thus it just can be that

#

((and the error for non-scheduled sleep usage is unknown for me, never did so))

mighty bronze
#

Hello, I need to destroy the glasses of the windows on a building that is set to not be destroyed (is going to be bombarded)

#

Anyone can help me there? Thanks

winter rose
#

shoot them

mighty bronze
#

Building is set to not take damage

#

Glass is bullet proof

winter rose
#

if the model cannot have broken glass, then you cannot do anything

#

otherwise _building setDamage 0.5 usually works

mighty bronze
#

Model can have broken glasses, and can be destroyed, but in the editor I set it to not be destroyed

#

Now I cant brake glasses.

winter rose
mighty bronze
#

Nothing, glass is still bullet proof

winter rose
#

0.75

hallow mortar
#

I believe [breakable] glass in buildings is usually individual hitpoints, you can damage them with setHit without damaging the whole building, but you'll need to find the names of the selections

mighty bronze
#

_building setDamage 0.99 and they are still there

#

I can shot a nuke and they will be still there, the building is set to no be destroyed.

hallow mortar
#

script commands like setDamage and setHit don't care about whether the building has damage enabled, they don't go through the normal damage system

#

Did you replace _building with the actual variable name of the building?

tough abyss
#

ok the error was befor the line...

hallow mortar
mighty bronze
#

Simbulation is enable, with 0.99 damage nothing happened.

#

Is the school building that came with Livonia

queen cargo
#

well
you usualy check all lines before an error + the line where the error is thrown :P

mighty bronze
#

It seems that 0.999 did it

#

lol

#

thanks both

winter rose
#

if needed, toying with getAllHitPointsDamage + setHitPointDamage may keep the building remains 100% healthy-looking but the glass, as NikkoJT suggested

queen cargo
#

because stuff like this:

_handle = [] spawn {...};``` will give you the error at `_handle`
mighty bronze
#

I will try, thanks, but with is I am fine. If the 0.001 still keeps the builing with out collapsing.

winter rose
#

if the damage is disabled, you can drop 100 nukes on it and it still will withstand the test of time!

queen cargo
#

not at foobar

#

((yes it was the most stupid and easiest example one could make ... but it was the only one which came up in my mind))

dreamy kestrel
#

addWeaponCargoGlobal addWeaponWithAttachmentsCargo never mind, I'm a dummy, was not reading the line correctly. did exactly that, added weapon back sans accessories and such. so running with addWeaponWithAttachmentsCargo seems to me the better choice, preserves the accessories.

little raptor
#

it may destroy other stuff too. it basically destroys anything that's "safe" (won't kill the whole object)

#

usually people name their selections "glass", so you could do this too to be more accurate:

_hp = getAllHitPointsDamage _obj;
{
  _pt = getNumber (configOf _obj >> "Hitpoints" >> _x >> "PassThrough");
  if (_pt == 0 && "glas" in toLowerANSI (_hp#1#_forEachIndex)) then {_obj setHitIndex [_forEachIndex, 1]};
} forEach _hp#0;
ebon wing
#

How do I decrement a variable, anyone know?

#

_unit2 addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; _alive = _alive-1; hint format ["There are: %1 enemies remaining.", _alive];

little raptor
#

_var = _var - 1

ebon wing
#

doesnt work

ebon wing
#

I get a NoN Scalar

ebon wing
little raptor
#

like I said that's a local var

#

your local var isn't visible in that scope

#

i.e. it doesn't exist

ebon wing
#

Its getting created above the code though

#

It should be inherited no?

little raptor
#

and it won't get passed through

#

no

dreamy kestrel
#

depends when the EH code is being run. long after the _alive scope falls off.

little raptor
#

event handlers execute in another "context"

ebon wing
#

oh

#

odd

little raptor
#

you should make your var global

dreamy kestrel
#

not odd at all. life time of the code, scope, etc. reason it out.

#

right if you want memory of it at all. or a var on the object, if you really must.

ebon wing
#

Also, Ive made it a global variable now alive = 5; but its giving me an error

dreamy kestrel
#

so even there, in a function, you declare a local var. what happens to it from the context of another function? class? cannot depend on that being there.

ebon wing
dreamy kestrel
ebon wing
#

oh

little raptor
#

you should use syntax highlighting
also you shouldn't name your vars like that

dreamy kestrel
glass nest
ebon wing
ebon wing
little raptor
#

you should prefix them with a tag, to avoid conflicts with other mods/missions as much as possible

dreamy kestrel
#

yes. spend a little time reviewing the CBA or ACE code on github. they literally define functions all the time. and to give you some idea conventions and such.

little raptor
#

PRC_cntAlive for example

ebon wing
little raptor
ebon wing
#

oooooooo

little raptor
#

they're not actually classes tho, but behave similarly

#

see createHashMapObject

ebon wing
#

Awesome, thanks!

dreamy kestrel
#

more like functional objects, TL;DR; exactly. but still interesting idea.

ebon wing
#

I definitely prefer classes rather than having to make multiple files

dreamy kestrel
#

I do a similar thing stitching together a secondary objectives framework, with boilerplate phase lines and such, setup, tear down, running, completion conditions, etc.

#

I'm not sure the hashmap would have been my first choice there, but still, interesting.

ebon wing
#

Also, can confirm the varible now works

ebon wing
dreamy kestrel
#

good luck @ebon wing and good hunting...

ebon wing
#

Thanks!

limber panther
#

Hello!
After reading the wiki i'm a little confused, what's the difference between lineIntersectsObjs and lineIntersectsWith ? I mean i need the get returned 1 vehicle that's present in that line by the time the script gets used. There might be more objects like rocks, trees, buildings, but i need just one vehicle. If there would be for example two vehicles, i'd then take the closer one. What should i do? Thank you.

little raptor
#

apart from that no difference as far as I know

#

yeah no difference

limber panther
little raptor
#

you mean you want the first vehicle (no matter what it is) that intersects with the line?

#

also you didn't mention what should happen if the object is "obstructed" by some other object (let's say a rock is in the way)

dreamy kestrel
limber panther
# little raptor you mean you want the first vehicle (no matter what it is) that intersects with ...

i'm going to put that on a vehicle that's going to be driving around, obviously i want to exclude the vehicle it is on since it is a start point and intersects the line but i believe i can put that into ignoreObj1, now lets say i am driving this vehicle and some other vehicle appear in front of me, i'll trigger a function and by that i want something to happen to the vehicle that was in front of me by that time, but the line can be intersected by rocks and other objects as well so i need to affect only the vehicle that got into my way, if he leaves the line before i use the function, it can result into some hint saying "you missed" or something like that, also if there is going to be something (e.g. a rock) between my car and the other car, it can result into "you missed" hint as well

#

perhaps i was thinking about using a setVariable after i get that car so i can then easily use getVariable in all the following scripts

little raptor
# limber panther i'm going to put that on a vehicle that's going to be driving around, obviously ...
FW_fnc_getIntersectingVehicle = {
  params ["_obj1"];
  _landOffset = getModelInfo _obj1 select 3 select 2;
  _front = boundingBoxReal [_obj1, "fireGeometry"] select 2 select 1;
  _sims = ["carx", "tankx", "car", "tank", "motorcycle"];
  _firstObj = lineIntersectsSurfaces [_obj1 modelToWorldWorld [0, _front, _landOffset + 1], _obj1 modelToWorldWorld [0, _front + 1, _landOffset + 1], _obj1, objNull, true, -1, "FIRE", "GEOM"] param [0, []] param [3, objNull];
  [objNull, _firstObj] select (tolowerANSI getText(configOf _x >> "simulation") in _sims); 
};

you can call that function and it should gives you the first object that you intersect within 1 m directly ahead of you

tough abyss
#

btw i tested the showChat function to get the ppl disconnecting in ops when they leave. so you dont know if someone is kia mia or anything. //prevent showing of chatbox
[] spawn {sleep 1; showChat false}; this bit works executed on each player machine

limber panther
little raptor
# limber panther wow that looks complicated, may i ask for a few words about it? I'd like to unde...

_landOffset is where the object touches the ground
you said you wanted "vehicles" so I assumed you mean "land vehicles"
so I created a list of simulations for those
modelToWorldWorld translates a position from model coords to world
lineIntersectsSurfaces returns a list of objects and sorts them. I asked that it intersected with fire LOD if possible. fire LOD is the "geometry" that bullets, etc. collide with
out of the list of objs I grab the first obj. then check if its simulation matches the list I provided
if so it returns the object, if not it returns a null object

limber panther
little raptor
#

then getModelInfo returns the location where is my car and names it as _landOffset
getModelInfo gets the model info of _obj1
boundingBoxReal i am lost, what does that do?
it gets a bounding box...

#

similar to what you get when you click on an object in 3den/zeus. a box appears around the object

granite sky
#

It needs to find where the front of the vehicle is relative to the object center.

#

The bounding box stuff is a bit weird because most vehicle models get recentered on loading.

#

I'm never sure which functions work with the recentered model position versus the original.

little raptor
#

not when loading

granite sky
#

Well, that does make more sense.

little raptor
granite sky
#

boundingCenter still returns the original though, IIRC

limber panther
#

originally i thought i could just use the lineIntersectsObjs then somehow select one thing from the array and it will be good to go, but now i am completely lost in that

granite sky
#

well, a lot of the code is just calculating where the ends of the line should be.

limber panther
ebon wing
#

Hey, so I want some AI to respawn after 2 hours, Im thinking ill just run the file where I create them, but when I do sleep 7200; it gives me an error saying it cant sleep at that time.

#

`` _unit4 addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
FAC1_unitsAlive = FAC1_unitsAlive -1;
hint format ["There are: %1 enemies remaining.", FAC1_unitsAlive];

if (FAC1_unitsAlive == 0) then{
    marker1E setMarkerColor "ColorGreen";
    marker1 setMarkerText "Facility #1 - RAIDED";
    txt5Layer = "txt5" call BIS_fnc_rscLayer;
    _texta = "<t font ='EtelkaMonospaceProBold' align = 'center' size='1' color='#FFFFFF'>" + "Facility #1 has been raided"+"</t>"; 

[_texta,/* poz x / 0,/ poz y / 1,/durata/ 5,/ fade in?*/ 1,0,txt5Layer] spawn BIS_fnc_dynamicText;

    sleep 7200;

    execVM "loc1.sqf"

    
}

}];``

granite sky
#

You can't sleep in an event handler, yes. They're unscheduled code.

ebon wing
#

Should I instead call a extra file whichs only purpose is to sleep?

#

and then recall loc1

#

Or is there a better way??

granite sky
#

you can just do:

0 spawn {
  sleep 7200;
  execVM "loc1.sqf";
};
ebon wing
#

What does 0 spawn do?

#

& where should I put it inside the handler?

granite sky
#

spawn takes a parameter. It's just putting something cheap in there.

ebon wing
#

I see, so this is like a dirty trick? Creating a new sort of scope within the event handler?

granite sky
#

more or less.

ebon wing
#

And while sleep is active, other code will still run right?

#

Like other event handlers

granite sky
#

Yes, spawn creates a scheduled thread.

ebon wing
#

I see, aweosme thank you!

ebon wing
#

0 spawn { sleep FAC_timer; execVM "Warzone Locations\loc1.sqf"; };

#

I copied the same execVM I use to call it the first time

fleet sand
ebon wing
#

but doesnt work in the spawn{}

granite sky
#

That doesn't sound very plausible.

ebon wing
#

Is it because I am calling loc1 within loc1?

granite sky
#

recursive execVM calls?

ebon wing
#

mhm

granite sky
#

sounds like an abomination but I'd still expect it to "work"

ebon wing
#

I suppose I could pop everything into a loop

limber panther
#

so i wanted to see what the returned list looks like but it's empty sqf my_vehicle addAction ["hint", { hint format ["list: %1", lineIntersectsObjs [getPosASL my_vehicle, my_vehicle modelToWorldWorld [0, 50, 0], my_vehicle]]; }];

fleet sand
#

Instead of recursive execVM why just not use whle loop ?

ebon wing
fleet sand
#

Here is a simple code that will run every 2 hours.

0 spawn {
    while {true} do {
        systemChat "Test";
        sleep 7200;
    };
};
ebon wing
#

Ill mess around with it

granite sky
#

@limber panther The start and end Z values there are inconsistent. getPosASL tends to return the land contact position (undocumented?) while modelToWorldWorld returns the position relative to the model center.

#

I can never remember which way around model space is anyway so I tend to use this instead:

_start = getPosASL my_vehicle vectorAdd [0,0,1];
_end = _start vectorAdd (vectorDir my_vehicle vectorMultiply 50);
lineIntersectsObjs [_start, _end, my_vehicle];
limber panther
#

@granite sky i am sorry but i'm totally lost in it, can we start from the beginning? i am driving a car and some other car is in front of me, let's say i want to set damage to his car so how do i get his car as a parameter that i can then use in other scripts?

granite sky
#

uh, that code works.

#

Try it in the debug console when you're driving around. Set my_vehicle = vehicle player

limber panther
#

but i need to get that other car, not mine

granite sky
#

yes?

#

Generate a position 1m above land contact center of the vehicle:
_start = getPosASL my_vehicle vectorAdd [0,0,1];
Generate a position 50m in front of that using the facing of the vehicle:
_end = _start vectorAdd (vectorDir my_vehicle vectorMultiply 50);
Return array of objects intersecting that line, excluding the vehicle:
lineIntersectsObjs [_start, _end, my_vehicle];

#

But maybe you need to study SQF a bit more. This is not easy stuff.

#

Also if you don't know any vector maths then Leopard's method might be an easier starting point.

limber panther
#

@granite sky it returns error "invalid number in expression"

#
_start = getPosASL my_vehicle vectorAdd [0,0,1];
_end = _start vectorAdd (vectorDir my_vehicle vectorMultiply 50);
varspace setVariable [name, _start, true];
varspace2 setVariable [name2, _end, true];
my_vehicle addAction ["hint", {
varspace getVariable name;
varspace2 getVariable name2;
hint format ["list: %1", 
lineIntersectsObjs [_start, _end, my_vehicle];
];
}];
granite sky
#

blinks

limber panther
#

i'm sorry i'm really trying but you're getting me more and more confused

winter rose
#

1/ setVariable takes a string
2/

#

see a little colour similarity?

granite sky
#

_start and _end are in ASL world space so you'd need to evaluate them inside the addAction function. Your setVariable/getVariable stuff is busted.

limber panther
granite sky
#

Do you know where the debug console is :P

limber panther
granite sky
#

You should start.

#

Also get Advanced Developer Tools to make it better.

#

It's a bad way to test, but the addAction method would be:

my_vehicle addAction ["hint", {
  _start = getPosASL my_vehicle vectorAdd [0,0,1];
  _end = _start vectorAdd (vectorDir my_vehicle vectorMultiply 50);
  _objects = lineIntersectsObjs [_start, _end, my_vehicle];
  hint format ["list: %1", _objects];
}];
ebon wing
#

Apologies for jumping in, answer once you guys aree done, when loc1 runs it creates these markers `` marker1E = createMarker ["Mkr1E", [12294.837, 8879.797]];
marker1E setMarkerShape "ELLIPSE";
marker1E setMarkerSize [100,100];
marker1E setMarkerColor "ColorRed";

marker1 = createMarker ["Mkr1", [12294.837, 8879.797]];
marker1 setMarkerType "hd_warning";
marker1 setMarkerSize [1.5,1.5];
marker1 setMarkerColor "ColorRed";
marker1 setMarkerText "Facility #1";``

Once all enemies are killed, the markers slightly change to show that the base has been captured, when I re run the whole file, the markers dont change back to original, even though the code for the original markers is ran - since loc1 is ran after enemies are killed

limber panther
granite sky
#

It will return trees as well as vehicles.

#

That's what Leopard's simulation check is for.

limber panther
granite sky
#

I mean, you have to actually line it up. It's only checking one line.

#

But it definitely detects vehicles.

#

In practice one line is problematic because it'll aim up or down with the vehicle, so it could easily miss stuff.

limber panther
#

i would send you a screenshot but i'm not allowed to send pictures here, your script detects trees but not a car

simple stone
#

Heyo.
Im making a mission for my unit. Players need to find Files in enemy invetories to complete a task So far I made this code but im getting generic error in expression in (_xΛ›/x/=="files") massage. Any help ? I have this placed in a trigger
if (isServer) then {
{
if (_x=="Files") then {
private["_countFiles"];
_countFiles = count magazines _x;

        if (_countFiles > 3) then { 
            t1 setTaskState "succeded"
        }; 
    }; 
} forEach allPlayers; 

};

hallow mortar
#
if (_x == "Files") then { ...

_x here is the element you're currently iterating over in forEach allPlayers.
allPlayers returns a list of player objects.
So you're checking to see if _x (an object) is the same as "Files" (a string).
== cannot compare things of different types, so it's causing an error. But this would never work anyway, because no player object will ever be the string "Files", it's literally not possible.

simple stone
#

I see.
Thank you for the explanation.

#

Is there any way to make it work though?

sullen sigil
#

name _x

hallow mortar
hallow mortar
#

You need to go through all players and see if they have a "Files" in their inventory. At the moment, you're (almost, it's broken) going through all players and counting their magazines, then succeeding the task if any player has more than 3 magazines.

sullen sigil
#

oh theyre searching for inventory stuff

#

serves me right for not reading

fair drum
#

you can read?

#

Some of us aren't so privileged 😦

hallow mortar
# hallow mortar You need to go through all players and see if they have a `"Files"` in their inv...

This is a quick check to see if any player has any number of files.

// check against all currently alive playable units (not dead players, virtual entities, etc)
if (((playableUnits + switchableUnits) findIf {
    // see if they have any files
    [_x,"Files"] call BIS_fnc_hasItem;
//  if we found any then...
}) > -1) then {
    // ...spell "Succeeded" right
    t1 setTaskState "Succeeded";
};

If you want to be more specific (e.g. a particular number of files) it becomes more complicated and I don't really want to do all that. You would need count, itemsWithMagazines, and some variables.
You'll also need either a loop (while or waitUntil) or a trigger, to regularly check for this, unless you have some mechanism to cause a check (like an action or reaching an objective or whatever)

simple stone
ebon wing
#

I wanted to ask, how would I go about making FIA shoot at civilian units?

manic kettle
#

Change side relations, maybe...
I'm not sure if it's possible. But would be if you changed the civilians side to blu

ebon wing
#

So, If I change civilians side to blufor, they will still be seen as civilians to players right?

#

Like they would remain in a civ slot?

drifting portal
#

I want to close the edit object display the the Zeus has when he double clicks on an object
using uiNamespace getVariable ["CuratorDisplays_displays", []], allows me to see which displays zeus has open, it's Display #-1 the one I'm looking for, but isn't there a better way to identify the display? like a name or something? because maybe when i do close Display #-1 using an event handler it might be another screen entirely ?

#

using ["CuratorDisplays_displays", []] before double clicking an object yeilds: [Display #312]
using ["CuratorDisplays_displays", []] after double clicking an object yeilds: [Display #312,Display #-1]

#

this is how I know it's that display I'm looking for

#

is there a way to get the classname of the display for example?

formal stirrup
#

Is it possible to use the isTouchingGround function in a while statement?

#

Currently running into issues with running code while false

formal stirrup
drifting portal
formal stirrup
#

Thats for if it IS on the ground, i need it to run while not on the ground

sullen sigil
#

{!isTouchingGround _object}

formal stirrup
#

Sweet, thank you kjm

sullen sigil
#

w

ebon wing
#

Anyone know why this trigger isnt being activated?

``LOC1_trigger = createTrigger ["EmptyDetector", [12301.926, 8876.265]];
LOC1_trigger setTriggerArea [750, 750, 0, false];
LOC1_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];

if (triggerActivated LOC1_trigger == true) then
{execVM "Warzone Locations\loc1.sqf"; hint "DETECTED";};
``

winter rose
ebon wing
#

How do I continuously check if its true

winter rose
#

use the setTriggerStatements comland

ebon wing
#

How can I implement that with execVM?

ebon wing
atomic frigate
#

Im losing my mind

granite sky
#

shouldn't you be in the AI modding channel then

twin oar
#

having an issue with setting an image to a billboard

#

created the pathing and all

atomic frigate
#

Wrote this function but I can't seem to get it to define _targetObjectVarName on line 12, DESPITE the fact that I can confirm addAction on line 8 works.

twin oar
#
this setObjectTextureGlobal [0, "images\welcome.jpg"];
granite sky
#

The code inside the addAction is executed in a different context.

atomic frigate
#

I've tried using _target, this, _this, and just about anything I could think of out of desperation

granite sky
#

params ["_target", "_caller", "_actionId", "_arguments"];

#

Then _target

atomic frigate
#

See, that was what was confusing me on the documentation

#

I am putting that whole line in my addAction?

granite sky
#

Yes.

#

The function's called with an array of parameters. The first one is the target object.

#

You could also use _this#0 if you don't care about the other params.

#

(which you probably don't here)

atomic frigate
#

whats with the '#0', why did that work, and now I have an error for the other variable fml

#

One down one to go at least, thank you vm for that

granite sky
#

#0 just selects the first element from the array.

#

Same as select 0 except shorter and with higher precedence.

atomic frigate
#

So, just to make sure I am understanding this right

#

_var addAction

addAction gets args from _var when its called and because of that, _target, _caller, ect, are avaiable for me to reference?

granite sky
#

It's not really getting anything from _var

atomic frigate
#

_var was just an arbitary name for a random variable (object)

granite sky
#

But as you're adding the action to a particular object, it knows what that object is when it calls the function.

atomic frigate
#

gotcha

granite sky
#

You can pass in other vars using the fourth parameter of addAction.

atomic frigate
#

so now my new issue is that _soundClassName isn't being defined in addAction, and that's because its out of scope of the params of my funciton?

granite sky
#

yes

atomic frigate
granite sky
#

If you pass _soundClassName as the fourth parameter in the addAction, it'll show up as _arguments (or the fourth parameter) in the called function.

#

If you wanted to pass more than one additional argument then you'd need to pass an array in instead.

atomic frigate
#

gotcha

#

Okay this is all making a bit more sense, thank you vm

granite sky
#

Another way is to use setVariable and getVariable on the target object, but you don't need to do that with addAction.

atomic frigate
#

could I use this

#

this#4

granite sky
#

_this#3

#

#0 is the first parameter, #3 is the fourth.

atomic frigate
#

Oh so it IS zero index

granite sky
#

And the underscore matters.

atomic frigate
#

gotcha

granite sky
#

It's this without the underscore in editor init boxes and some other places, but more commonly _this in script.

atomic frigate
#

rog

#

well @granite sky that was a HUGE help and my function finally works I cannot thank you enough

#

Now I gotta make it work in multiplayer πŸ˜‚ but I'll do my due diligence and try to figure it out first

granite sky
#

It's kinda funny, multiplayer addActions are one of the hardest things to get right but often the first thing people try to do.

atomic frigate
#

TO BE FAIR, I got the addHoldAction to work yesterday on something else lol

#

And I think the multiplayer logic itself makes sense to me at the very least

#

at least I'm hoping

barren summit
#

On the subject of addAction... what do you use to make addAction work in dedicated server for created objects? For instance, if you create a civilian:

_e = _grp createUnit[_elder,_village,[],0,"FORM"];```
Just doing:
```_e addAction ["Talk","somefunction.sqf"];```
Won't work since it only runs on the server.  So how do you add an action so that all players are able to interact?  I've tried creating a function:
```add_action = {
    params["_e"];
    _e addAction ["Talk", "talk_to_elder.sqf"];
};```
And then calling it with remoteExec:
```[_e] remoteExec["add_action"];```
So that each client is forced to execute it, but this didn't work either.  I'm guessing there's a solution out there as actions are pretty common in MP.

I've also (successfully) done the following:
```player addAction
[
    "interact",
    "somescript.sqf",
    getPos player,
    1.5,
    false,
    true,
    "",
   "cursorTarget isKindOf 'some_object'"
];```
But I'd rather the interaction be "object sided".
granite sky
#
private _actParams = ["Talk", "talk_to_elder.sqf"]; 
[_target, _actParams] remoteExec ["addAction", 0, true];
#

Now if you were writing a larger-scale mission then you may well want a client-side function to do this sort of action-adding. But then you'd also be using the function library.

#

The true here also adds the action for join-in-progress players, but because it's not storing the JIP key anywhere it won't be possible to remove it from the JIP queue.

barren summit
#

ah ok. I was trying to find info on remoteExec with addAction but couldn't figure it out. I'll give this a try.

granite sky
#

running binary actions with remoteExec is just a lot of brackets :P

#

[_a, _b] remoteExec ["addAction", 0]

Runs this on each machine:

_a addAction _b

formal stirrup
#

Is there a way to delete building ruins as soon as the object is destroyed?

granite sky
#

You can use the mission event handler BuildingChanged to get both the original object and the ruin object.

ebon wing
#

I wanted to ask, Im trying to make a sort of locked crate where the player that clicks "Unlock" in the scroll bar menu when looking at the crate must have a specific item in order to unlock it. My question is, how do I check the inventory of that one specific player for this item?

tulip ridge
ebon wing
#

Wouldnt this check all the players inventories?

#

Or, how does it determine the player it will use

tulip ridge
#

It would check the local player's inventory
Is this for an addAction?

ebon wing
#

an addAction that calls a function that will check the players inv