#arma3_scripting

1 messages Β· Page 591 of 1

knotty mantle
#

yeah that is the other option...

echo cloud
#

Is there a way of checking if an entity (like a mortar) is in range of an object?

hallow mortar
#

Going through the clipboard assumes the clipboard won't be cleared by other actions before the next mission is run (outside your control and therefore extremely unreliable). If you want to have stuff persist between missions you would probably want to save stuff to the profile namespace or whatever.

#

@simple notch This script should automatically dynamically assign players' membership of a custom channel depending on whether they have RTO equipment, allowing the RTO role to be passed along when someone inevitably gets shot in the head.
https://pastebin.com/MjKFu7M6
(give it 10 minutes for someone to point out I've made a huge mistake though)

knotty mantle
#

Is profilenamespace on the server persistent even if server is restarted?

#

Do i need to use saveprofilenamespace to make it persistent

echo cloud
#

@hallow mortar Sorry, I worded that badly. I want to check if there is a mortar inbound to a location.

digital hollow
#

It's persistent with saving. I use it for ghetto player log.

still forum
#

you need to use save

#

someone needs to

hallow mortar
#

@echo cloud detecting whether a mortar round is going to come to that location is outside my knowledge, but you can detect whether mortar rounds are nearby using https://community.bistudio.com/wiki/nearObjects. Won't tell you if it's inbound, outbound, or throughbound though.

spark rose
#
airconvoy1_grp move getMarkerPos "airconvoy_mark_1";
sleep 6;
airconvoy2_grp move getMarkerPos "airconvoy_mark_2";
sleep 6;
airconvoy3_grp move getMarkerPos "airconvoy_mark_3";
waitUntil 
{
    airconvoy_1 distance getMarkerPos "airconvoy_mark_1" < 400; 
};
[airconvoy1_grp, [3926.053, 10283.298, 0], convoyland_1] spawn BIS_fnc_wpland;
sleep 5;
[airconvoy2_grp, [3960.072, 10316.619, 0], convoyland_2] spawn BIS_fnc_wpland;
sleep 5;
[airconvoy3_grp, [3843.103, 10200.769, 0], convoyland_3] spawn BIS_fnc_wpland;
waitUntil {
    (visiblePosition airconvoy_1) select 2 < 1
};
airconvoy_1 setFuel 0;
waitUntil {
    (visiblePosition airconvoy_2) select 2 < 1
};
airconvoy_2 setFuel 0;
waitUntil {
    (visiblePosition airconvoy_3) select 2 < 1
};
airconvoy_3 setFuel 0;
#

this works fine for getting 3 helicopters to take off, fly across the map, and land

#

however, it doesn't work if the player does what he's supposed to do, and shoots 1 or 2 down

#

nested if then statements kill me. How do i make this work if one or more helicopters are missing?

exotic flax
#

Where does it stop working? And does it give errors?

spark rose
#

it gives no errors, but if one of the helicopters is dead, they will just sit hovering by the landing pads and not land

hallow mortar
#

It will fail the waitUntil if the airconvoy_1 helicopter is the one that dies

winter rose
#
waitUntil 
{
    airconvoy_1 distance getMarkerPos "airconvoy_mark_1" < 400; 
};
#

yep

exotic flax
#

BTW... A if...else statement for each group/unit is advised, so it doesn't wait on the first group when dead...

winter rose
#

waitUntil theyAreClose or theyCantMove

exotic flax
#
waituntil {
   alive unit && unit distance getmarkerpos "marker" < 400
};
#

???

hallow mortar
#

that would still pause the script forever if the unit was dead

#

why not use addWaypoint etc. to preload them with a set of waypoints rather than doing all this waitUntil stuff?

spark rose
#

I've tried alot of different ways, this gets them where they need to go the most reliably so far

winter rose
#

wow, the BIS_fnc_wpland wiki page is []fest Oo
gonna fix that

spark rose
#

Can i do this with sqf case

#

?

#

i don't know much about using it but may fit the bill?

#

or maybe just run a different script for each helicopter, as clunky as that seems?

hallow mortar
#

I mean, probably, but my hunch is that you'd end up with a ton of repeated code

#

my preferred method is with a careless pilot and a set of waypoints. Never had much trouble with that and it's very resilient against casualties.

fair drum
#

i need help real fast

#

i need to spawn people instantly that are waiting to respawn

#

for some reason they have 1 hour to respawn

hallow mortar
#

setPlayerRespawnTime?

fair drum
#

setrespawn time isnt working

hallow mortar
#

it is a local command so make sure to execute globally

winter rose
#

for some reason they have 1 hour to respawn
well maybe there is another issue to fix first?

exotic flax
#

Incorrect mission settings, and I believe there's a Zeus module which allows you to change it, although could be Achilles/ZEN only

hallow mortar
#

it sounds like this is a situation that is currently in progress

fair drum
#

well they are in the mission atm

#

im using the execute code module

hallow mortar
#

have you made sure to execute setPLayerRespawnTime globally

fair drum
#

yes

#

im just gonna have to restart them after i check the pbo

spark rose
#

i just went with 3 separate scripts...going to keep it going amateur style

hallow mortar
#

there are a number of respawn functions listed on the wiki that could theoretically be useful. Unfortunately, none of them are documented

echo cloud
#

Another question, why can I createVehicle Bo_GBU12_LGB but I cannot with Sh_82mm_AMOS or mortar_82mm?

hallow mortar
#

What sort of error is being generated?

exotic flax
#

Isn't the difference that one is in CfgVehicles and the other in CfgAmmo/CfgMagazines?

echo cloud
#

Yep

#

Figured it out

spark rose
#

how do i drop guys out of an airplane with their backpacks?

winter rose
#

you push them

simple notch
#

I'm trying to make a script that removes all the weapons from a player if they dont join the mission in progress and for some reason it isnt working

#

Is there an easier way than just pasting my code lol

winter rose
#

@spark rose action "eject"

#

@simple notch without code, it's hard to know

simple notch
#

Lol

#

Okay so I have my initPlayerLocal, this is saying what to do if it is JiP or not

winter rose
#

```sqf please - see pinned message

spark rose
#

haha

simple notch
#

ugh

still forum
simple notch
#
_unit = _this select 0;
_isJIP = _this select 1;

if(!_isJIP) then
{
   [_unit] call LtP_fnc_playerSpawn;
};

if(_isJIP) then
{

};
#

Okay so I have my initPlayerLocal, this is saying what to do if it is JiP or not

#
private ["_player"];

_player = param[0]; 

removeAllWeapons _player;

#

fn_playerSpawn ^

#
class LtP
{
  tag = "LtP";
  class functions
  {
    file = "functions";
    class playerSpawn {};

  };
};

#

functions.hpp ^^

winter rose
#

_player = param[0]; no.

simple notch
#

replace it is select 0?

winter rose
#

NO

simple notch
#

😒

still forum
simple notch
#

FeelsBad

winter rose
#
private ["_player"];
_player = param[0]; 
removeAllWeapons _player;
```↓↓↓
```sqf
params [
  ["_player", objNull, [objNull]]
];
removeAllWeapons _player;
simple notch
#

wtf is objNull

winter rose
#

1/ defaultValue
2/ possible types

#
// _unit = _this select 0;
// _isJIP = _this select 1;
params ["_unit", "_isJIP"];

if (!_isJIP) then
{
  [_unit] call LtP_fnc_playerSpawn;
};
/* NOT NEEDED - or use an "else"
if(_isJIP) then {};
*/
#

now your code should work… unless your function is not well defined.

#

(it should have worked before)

simple notch
#

hmmm it still didnt work

winter rose
#
class LtP
{
  tag = "LtP";
  class functions
  {
    file = "functions";
    class playerSpawn {};

  };
};

@simple notch I hope all this is wrapped in a CfgFunctions, and that your file is %ROOT%\functions\fn_playerSpawn.sqf

simple notch
#

respawn = "Base";
disabledAI = 1;

class cfgFunctions {
   #include "functions\functions.hpp"
};

#

This is the description.ext ^

winter rose
#

CfgFunctions, just in case

simple notch
#

And my functions\fn_playerSpawn.sqf if just in my mission folder

#

like in the mission

winter rose
#

and if you call it from the debug console, it works?

astral dawn
#

Sometimes I wish there was a command like _file = openFile "test.vars";, then it would be possible to

_value = _file getVariable "myVar";
saveFile _file;
closeFile _file;

I mean imagine if file operations could work exactly same way vars.arma3profile works, just you know, do it with a different file instead of same predefined file.

One can dream, right? πŸ€”

winter rose
#

open door to viruses, yay! I think this is the main reason why this is disabled ^^

astral dawn
#

how can one open door to viruses with that, if it writes not binary data but data in same format as vars arma3profile file (binarized config as I understand)

winter rose
#

at least an exploit (in MP) where you saturate one's HDD

astral dawn
#

just needs to be ensured that one can't exit the folder with something like ..\ etc

#

well I can saturate it by writing to your profile namespace too πŸ˜‰

winter rose
#

hmm, you could crash the game, but not saturate the HDD I think

simple notch
#

How do I call it from the debug console?

astral dawn
#

I can crash your game with GUI commands easily πŸ˜„

simple notch
#

IIm doing it through a dedi

winter rose
#

yes, but not tank my PC @astral dawn πŸ˜„

#

@simple notch try in the editor? if you test your mission every time on a dedi, it will take a long time

astral dawn
#

and if I remoteExecute something like
_thatFileOnLousComputer setVariable ["varname", lotsofstuff];, well, it makes no sense since file handle can't be serialized anyway across network

#

DayZ has native file IO btw 🀷

winter rose
#

{} remoteExec call ?

DayZ maybe has better security too :D

#

but I don't know the exact reason as to why it was not made possible for Arma. Never needed, I guess

astral dawn
#

Well same reason as other unfinished things, nothing special

spark rose
#

if i want to tell an aircraft to move directly OVER a player, not to him... ```sqf
killer0 move (position tester) select 2 = 200;

#

?

winter rose
#

no

spark rose
#

😦

winter rose
#
private _testerPos = getPosATL tester;
_testerPos set [2, 200];
killer0 move _testerPos;
spark rose
#

aha! okay, so get player pos, then modify it

winter rose
#

yup

spark rose
#

thanks Lou!

winter rose
#

when in doubt, split in smaller steps πŸ˜‰

echo cloud
#

How do I get an object to execVM on a dedicated server? it doesn't seem to be executing when I load the mission onto the server. (I am putting execVM in the init of the object)

#

The execVM works when I make an MP game in editor, just not on the server

winter rose
#

ideally, don't put anything in init fields

#

as it runs for every player

echo cloud
#

Alrighty. How do I then make it execute for one single object?

winter rose
#

as it runs for every player
what I mean by that is that an init field execution is multiplied by the number of players

#
if (isServer) then { this execVM "myScript.sqf"; };
```should do
echo cloud
#

Alrighty, I'll give it a whirl

#

Thx

#

No dice

#

It doesn't seem to activate

winter rose
#

what does your script do?
try replacing it with a "_this setDamage 1" script

#

@echo cloud if your script uses player, think again

echo cloud
#

It doesn't

#
_weapons=["Sh_82mm_AMOS","Sh_155mm_AMOS","R_80mm_HE","R_230mm_HE"];
while {0==0} do {
{
if !(position _this nearObjects [_x,1000] isEqualTo []) then {
     hint "INCOMING";
     speak say3D "incoming";
     speak_1 say3D "incoming"; 
     speak_2 say3D "incoming"; 
     speak_3 say3D "incoming"; 
    uiSleep 60;
    };
}forEach _weapons;
};```
#

Yes I know it is a while true loop go away xD

#

It is a mortar/missile incoming detector

astral dawn
#

you can just write while{true}

echo cloud
#

Alrighty

#

Fixed that

#

But the script doesn't even start when I did if (isServer) then {this execVM "mortar_detector.sqf";}; in the init of the object I wanted it in

#

Am I just being dumb?

astral dawn
#

never used init fields tbh, I'd do it with init.sqf

#

if (isServer) then {myObject execVM "mortar_detector.sqf";};
myObject veing the object name assigned in editor

#

much cleaner IMO πŸ€”

#

hint "INCOMING";
for whom will it hint if it's on deidcated server?

#

hint has local effect, shows message on the screen of computer where hint is executed

echo cloud
#

Oops

astral dawn
#

You'd have to removeExec that

echo cloud
#

RemoteExec global or client ID

exotic flax
#

although the say3D should broadcast

astral dawn
#

although the say3D should broadcast
it says local effect πŸ€” although I've never used it myself

echo cloud
#

playSound3D is the way to go I guess

#

say3D is direct and playSound is global (within range)

astral dawn
#

most proper way is to make desired effect with commands giving the right effect, and remove execute whatever must be remote executed

#

ideally you'd like to have some function like onMortarIncomingLocal which is then run on clients which plays sounds, shows messages, etc

echo cloud
#

Alrighty, playSound3D is not working. The path to the audio should just be "SOUND.OGG" as it is in the root dir with init, right?

#

(I plan on cleaning this up later btw)

winter rose
#

nope, see the wiki page - it needs a full path

echo cloud
#

Got it

#

Thanks Steam forums

winter rose
#

getMissionPath thanks wiki :p

fair drum
#

what can i use to determine if a player is looking at something? trying to pop a trigger with it.

hallow mortar
#

cursorObject

fair drum
#

k so I'd have to use some sort of if statement then

hallow mortar
#

for a trigger condition it might (untested) be as simple as cursorObject == yourObjectName in a global trigger

fair drum
#

hmmm ill try it

hallow mortar
#

if you want to detect when a specific player is looking at something, that's gonna be a whole other thing

fair drum
#

nah just any player in the game

#

there a better way at show/hiding markers instead of changing the alpha?

robust hollow
#

not really. options i can think of include changing the alpha, size, position or icon (to empty).

exotic flax
#

create/remove when needed/unneeded?

fair drum
#

i think it might be less code just to change the alpha than creating/removing it

exotic flax
#

less code doesn't mean it's better πŸ˜‰

hallow mortar
#

Changing the alpha is extremely simple. I'm not really sure what a "better way" would consist of.

fair drum
#

using a module instead. its okay, the alpha change is fine

tame lion
#

Question regarding creating Cameras and creating pip images on screen. I have a script that is going to create and destroy the same UI element which will be a PIP camera view of a unit. Is it better practice to create/destroy the camera and terminate it each use? Or would there be a better alternative to doing so? I was thinking about just (un)hiding the display control/UI element instead of terminating/destroying the camera object.

exotic flax
#

I don't believe the the camera does anything, other than creating a view point which can be used. So destroying the control (or image on object) should disable the feed and improve client side FPS again.

tame lion
#

okay, that was basically what I was getting at. is it better to create/destroy a camera and ui control or would it be better performance to just hide the UI control and leave the camera up. Thanks @exotic flax

exotic flax
#

I don't believe you need to destroy the camera, just stop relocating it since the position is static, so continues the script even when not used

#

although when not needed you can easily destroy it as well

frozen canopy
#

how do i properly use an array in an array? I've been trying to avoid this, but I desperately need to know how to do it to optimize my code. I want to use the following code: ```["

_ent = player nearEntities ["Man", 1000];

"] call BIS_fnc_codePerformance; ```

exotic flax
#

that code should work without problems, so what do you want to do exactly?

frozen canopy
exotic flax
#
['_ent = player nearEntities ["Man", 1000];'] call BIS_fnc_codePerformance; 

should work

#

problem is quotes in quotes πŸ˜‰

frozen canopy
#

ah, works like a charm

#

thank you πŸ™‚

fair drum
#

so I have to do a remoteexec for showing chats on side channels for all clients? like:

cmdr sideChat "I have a few missions for you.";

I'm not too familiar with using remote exec but I'm guessing the syntax is something like...

cmdr sideChat "I have a few missions for you." remoteExec ["sideChat", 0]

?

warm hedge
#

If you want to do remoteExec, syntax must transformed from:
A command B
to:
[A,B] remoteExec ["command"]

fair drum
#

so...

[cmdr, "I have a few missions for you."] remoteExec ["sideChat", 0]

?

warm hedge
#

Correct, AFAIK

fair drum
#

its so much easier when people explain it like A command B.

warm hedge
#

That's how we have to think about it

fair drum
#

and between messages its probably good to use a sleep 5 or something or the chat will get clogged?

warm hedge
#

Yes

fair drum
#

and I want uiSleep correct? does that one have to be [] spawn as well?

#
[cmdr, "I have a few missions for you."] remoteExec ["sideChat", 0];
uiSleep 3;
[cmdr, "First, I need you to destroy 3 FIA weapons caches. I have marked the general area on the map for you."] remoteExec ["sideChat, 0"];
uiSleep 3;
[cmdr, "Next, I need you to destroy an NATO supply helicopter that is helping FIA forces between Vigny and Lolisse."] remoteExec ["sideChat, 0"];
uiSleep 3;
[cmdr, "Finally, word of a NATO vehicle factory is finished preparing APCs for the FIA. Destroy those vehicles."] remoteExec ["sideChat, 0"];
uiSleep 3;
[cmdr, "Check your tasks on the map for more info."] remoteExec ["sideChat, 0"];
warm hedge
#

In Multiplayer (at least I assume) there's no significant difference between sleep and uiSleep AFAIK so would work

fair drum
#

it keeps flaggin an error next `#uiSleep 3; yada yada

#

generic error in expression

copper raven
#

run code in scheduled

fair drum
#

i was afraid that would be the next thing I have to learn lol

warm hedge
#

Scheduled = spawn, execVM
Unscheduled = call, Event Handlers
(not really, there's more thing to explain but this is for rough understanding)

And sleep, waitUntil and other β€œwait” commands can only valid inside Scheduled environment

fair drum
#

still throwing expression errors with

[] spawn uiSleep 3;
#

sigh... does it need to be

[] spawn {uiSleep 3};

lets see

#

the answer is yes, even though there is no mention of it on uiSleep wiki

warm hedge
#

Your code does work technically, however it only does wait then end itself. You need to include everything include chat commands into one spawn scope

fair drum
#

yeah i notice that it only reads the first line, then the sleep, then nothing else

#

so...

[] spawn {
    [cmdr, "I have a few missions for you."] remoteExec ["sideChat", 0];
    uiSleep 3;
    [cmdr, "First, I need you to destroy 3 FIA weapons caches. I have marked the general area on the map for you."] remoteExec ["sideChat, 0"];
    uiSleep 3;
    yadayadayada
}

still only reads the first chat line though

warm hedge
#

Would work though... How'd execute it?

fair drum
#

i have it on a trigger that has a condition of triggerActivated of another one. my unit says the first chat line then doesn't continue

#

im throwing that in the onActivation box of the trigger in the daisy chain

warm hedge
#
[cmdr, "First, I need you to destroy 3 FIA weapons caches. I have marked the general area on the map for you."] remoteExec ["sideChat, 0"];```
`"sideChat, 0"`
Hey!
fair drum
#

whats up

warm hedge
#
[cmdr, "First, I need you to destroy 3 FIA weapons caches. I have marked the general area on the map for you."] remoteExec ["sideChat", 0];```Should be, I mean
fair drum
#

awwwww poo facepalm

#

well now i feel even more stupid. its working now haha

hallow mortar
#

If you want to be very clever, put all your dialogue remoteExecs in one sqf, in a case system organised by each dialogue "event" and with the case selector variable as a param for the script. Then your trigger can just be ["eventcasename"] execVM "dialogue.sqf" for each event. All dialogue in one easily-managed file, easy-to-read triggers, locality is easy because you make it server-only and remoteExec everything, and everything works because it's a scheduled script. Nice and tidy.

fair drum
#

I understand most of that, except this case system you are talking about

hallow mortar
#

params ["_case"];
switch _case do {

#

case "event1" : { dialogue, sleep etc. };

jade abyss
#

In Multiplayer (at least I assume) there's no significant difference between sleep and uiSleep AFAIK so would work
@warm hedge sleep can be affected by the FPS/ShedulerLoad, so executing (much) later than supposed/expected.

warm hedge
#

Hmm good to know

velvet merlin
#

how to kill an active splendid camera with sqf?

warm hedge
#

Maybe closeDialog closeDisplay?

#

Lemme test it quick

#
findDisplay 314 closeDisplay 0```Did work like a charm at least on my environment
velvet merlin
#

yeah but you are stuck in camera view, right?

warm hedge
#

Nah?

#

...Let me check in Vanilla

velvet merlin
#

ok its fine if you are in an unit

#

but if you do it while in Eden/launching 3d preview without unit, you get stuck

warm hedge
#

Looks that's an intended behavior

velvet merlin
#

TEST_SplendidCam = missionNamespace getVariable ['BIS_fnc_camera_cam',objNull]; TEST_SplendidCam cameraEffect ['terminate','back']; camDestroy TEST_SplendidCam; (findDisplay 314) closeDisplay 0;

#

this should work too, but doesnt for me ["Exit",[]] call BIS_fnc_camera

spark rose
#

So I can put this into the init of a unit placed in 3den, and it is not targetable by radar. ```sqf
radarTarget = 0;

#

but i don't know how to alter it via script

#
vehiclename radarTarget = 0
#

does not work

winter rose
#

what? no.

#

So I can put this into the init of a unit placed in 3den, and it is not targetable by radar. ```sqf
radarTarget = 0;

@spark rose nope, you can't
all you do here is define a global variable to 0.

spark rose
#

aha

#

well i just decided not to simulate the guy till i need him anyway

#

cheap tricks πŸ™‚

winter rose
#

hideObject exists too

spark rose
#

yep. i did hideObjectGlobal and enableSimulationGlobal

haughty fable
#

how can i send a script in the chat correctly?

young current
#

see pinned messages

haughty fable
#
_muerto = _this select 0;
_instigator = _this select 2;
_instigatorName = name _instigator;
_muertoName = name _muerto;
_playerID = getPlayerUID _instigator;
_getTkCount = missionNamespace getVariable format ["tk_count_%1", _playerID];
if (isNil _getTkCount) then {_getTkCount = 0}
if (side _instigator == side _muerto) then {
    _newTkCount = _getTkCount + 1;
    if (_newTkCount == 3) then {
        missionNamespace setVariable [format ["tk_count_%Βͺ", _playerID], 0];
        serverCommand format ["#kick %1", _playerID];
        parseText format ["%1 ha matado a 3 aliados y ha sido kickeado. <br/><img size='5' image='textures\ghana.paa' />", _instigatorName] remoteExec ["hint"];
        "Astronomia" remoteExec ["playMusic"];
    };
    if (_newTkCount == 2) then {
        missionNamespace setVariable [format ["tk_count_%1", _playerID], 2];
        _instigator setDamage 1;
        hint "Has matado a un aliado. \nEste es tu segundo y ΓΊltimo aviso.";
        format ["[FUEGO AMIGO] %1 ha matado a %2, este es su segundo aviso.", _instigatorName, _muertoName] remoteExec ["systemChat"];
    };
    if (_newTkCount == 1) then {
        missionNamespace setVariable [format ["tk_count_%1", _playerID], 1];
        _instigator setDamage 1;
        hint "Has matado a un aliado. \nEste es tu primer aviso.";
        format ["[FUEGO AMIGO] %1 ha matado a %2, este es su primer aviso.", _instigatorName, _muertoName] remoteExec ["systemChat"];
    };
};
#

what im trying to do is to is that everytime someone does a friendly kill, he gets warnings, for example in the first warning is a hint saying to dont do it again, then the second one one he dies and in the last one he gets a song and an image and then he gets kicked out

#

But i cant make it work, any idea?

#

(Im not very good at scripting)

exotic flax
#

How do you call this script?
What isn't working exactly?
What have you already tried?

haughty fable
#

im calling this script via this command ```sqf
this addEventHandler ["Killed", {_this execVM "tk.sqf"}];

#

wich is on the init of every unit

#

any idea?

young current
#

does it do anything?

haughty fable
#

when i kill the first one, it doesnt do anything, when i kill the second one it says not defined variable and when i kill the third one doesnt do anything again

winter rose
#
"tk_count_%Βͺ" // due to that
haughty fable
#

still the same

winter rose
#

isNil takes a String or Code, not Number

haughty fable
#

then what should i do?

winter rose
#

oh wait, it can't work iirc? side dead = civilian

haughty fable
#

so if someone dies his side will be civilian?

winter rose
#

yes; btw: if someone (accidentally) kills 3 people at the same time (e.g grenade) he will immediately be kicked; is it what you want?

haughty fable
#

yes!

winter rose
#

okido

#

here you go; should work @haughty fable

params ["_victim", "_instigator"];

private _realVictimSide = _victim call BIS_fnc_objectSide;
if ([side _instigator, _realVictimSide] call BIS_fnc_sideIsEnemy) exitWith {};

private _instigatorName = name _instigator;
private _victimName = name _victim;

if (isNil "YERAY_playerTeamKills") then { YERAY_playerTeamKills = 0; };
YERAY_playerTeamKills = YERAY_playerTeamKills + 1;

switch (YERAY_playerTeamKills) do
{
    case 1:
    {
        _instigator setDamage 1;
        hint "Has matado a un aliado. \nEste es tu primer aviso.";
        format ["[FUEGO AMIGO] %1 ha matado a %2, este es su primer aviso.", _instigatorName, _victimName] remoteExec ["systemChat"];
    };
    case 2:
    {
        _instigator setDamage 1;
        hint "Has matado a un aliado. \nEste es tu segundo y ΓΊltimo aviso.";
        format ["[FUEGO AMIGO] %1 ha matado a %2, este es su segundo aviso.", _instigatorName, _victimName] remoteExec ["systemChat"];
    };
    default
    {
        [format ["#kick %1", getPlayerUID _instigator]] remoteExecCall ["serverCommand", 2];
        parseText format ["%1 ha matado a 3 aliados y ha sido kickeado. <br/><img size='5' image='textures\ghana.paa' />", _instigatorName] remoteExec ["hint"];
        "Astronomia" remoteExec ["playMusic"];
    };
};
#

it will work even if a west soldier shoots at an independent (friendly) unit

haughty fable
#

thank you πŸ˜† , let me try it

#

now, when i kill someone (in the eden editor) it jumps into the third one directly

#

(the third one is the one that you called as default)

winter rose
#

booting the game to debug

haughty fable
#

k thanks

#

it will be for a dedicated server, i dont know if that changes anything

winter rose
#

try adding if (isNull _instigator) exitWith {}; under params?

#

last edit:```sqf
parseText format ["%1 ha matado a 3 aliados y ha sido kickeado. <br/><img size='5' image='textures\ghana.paa' />", _instigatorName] remoteExec ["hint"];
// ↓
[parseText format ["%1 ha matado a 3 aliados y ha sido kickeado. <br/><img size='5' image='textures\ghana.paa' />", _instigatorName]] remoteExec ["hint"];

#

and ```sqf
private _realVictimSide = _victim call BIS_fnc_objectSide;
private _realInstigatorSide = _instigator call BIS_fnc_objectSide;
if ([_realInstigatorSide, _realVictimSide] call BIS_fnc_sideIsEnemy) exitWith {};

it works now!
haughty fable
#

and ```sqf
private _realVictimSide = _victim call BIS_fnc_objectSide;
private _realInstigatorSide = _instigator call BIS_fnc_objectSide;
if ([_realInstigatorSide, _realVictimSide] call BIS_fnc_sideIsEnemy) exitWith {};

it works now!

@winter rose

#

where do i add that part?

winter rose
#

replace the call BIS_fnc_sideIsEnemy line with that

#

it's to replace the side checks, because after killing two people you are "renegade", not "west" anymore

haughty fable
#
params ["_victim", "_instigator"];
if (isNull _instigator) exitWith {};
private _realVictimSide = _victim call BIS_fnc_objectSide;
private _realInstigatorSide = _instigator call BIS_fnc_objectSide;
if ([_realInstigatorSide, _realVictimSide] call BIS_fnc_sideIsEnemy) exitWith {};

private _instigatorName = name _instigator;
private _victimName = name _victim;

if (isNil "YERAY_playerTeamKills") then { YERAY_playerTeamKills = 0; };
YERAY_playerTeamKills = YERAY_playerTeamKills + 1;

switch (YERAY_playerTeamKills) do
{
    case 1:
    {
        _instigator setDamage 1;
        hint "Has matado a un aliado. \nEste es tu primer aviso.";
        format ["[FUEGO AMIGO] %1 ha matado a %2, este es su primer aviso.", _instigatorName, _victimName] remoteExec ["systemChat"];
    };
    case 2:
    {
        _instigator setDamage 1;
        hint "Has matado a un aliado. \nEste es tu segundo y ΓΊltimo aviso.";
        format ["[FUEGO AMIGO] %1 ha matado a %2, este es su segundo aviso.", _instigatorName, _victimName] remoteExec ["systemChat"];
    };
    default
    {
        [format ["#kick %1", getPlayerUID _instigator]] remoteExecCall ["serverCommand", 2];
        [parseText format ["%1 ha matado a 3 aliados y ha sido kickeado. <br/><img size='5' image='textures\ghana.paa' />", _instigatorName]] remoteExec ["hint"];
        "Astronomia" remoteExec ["playMusic"];
    };
};
#

like that?

winter rose
#

perfect! πŸ‘Œ

#

AIs will still shoot at the player since he killed two friendlies, if you want to avoid this see addRating)

haughty fable
#

i killed only one player but i got the first and the second warning?

winter rose
#

that is weird? I tested it and it worked just fine. using mods?

viral basin
#

Hey there, i tried using Dynamic Simulation for the first time and couldn't use it on playable Units. is it only usable on AI and objects or am i doing smth wrong?

hallow mortar
#

Well, players can't be dynamically simulated because dynamic simulation turns off simulation for things. You don't want to turn off simulation for players - and you couldn't anyway, because it's based on distance from a player (and players are always right on top of a player for some reason)

viral basin
#

gotcha thanks

round scroll
#

looking for some ideas why this code doesn't run dedicated server, yet in SP and hosted for host it works fine: [_nimitz # 0, "ttt_nimitz_lowerLaunchbar", [_closestCatName, _plane, _nimspots], false] call BIS_fnc_callScriptedEventHandler;

#

is it because _nimitz # 0 is probably local to each client?

#

or on the server?

#

guess I gonna try with missionNamespace instead

winter rose
#

most importantly, what is _nimitz?

round scroll
#

it's a 'JDG_carrier_Spawner' Nimitz core object:

#

private _nimitz = player nearEntities ["jdg_carrier_spawner", 150];

#

seems it works when I hook the scripted eh to missionnamespace

#

or rather, an array of JDG_carrier_Spawner objects probably

#

hopefully one πŸ˜„

craggy wraith
#

Hi All, Am after some help with scripting I am trying to stop others players being able to connect to my uav once I release controls. Has anyone done something similar? Thanks

ashen warren
#

Im thinking most likely u would want to set up a player slot that is designated for one drone but I am unsure on how to do that.

craggy wraith
#

this is for a multiplayer exile server

ashen warren
#

hmmmmmmm. I wonder if there is an init line or something that can set all spawned UAV terminals are forced to have u directly interact with the UAV so it will only work for you.

craggy wraith
#

something specific for the drone maybe? Like a code to enter to access that drone

oblique arrow
#

can other players connect to a drone if someone else has already connected it?

craggy wraith
#

no

oblique arrow
#

I mean when you've connected to it in the terminal

craggy wraith
#

yes, if you connect but do not use the drone someone else can take it

#

Say I am using it to locate a player, I mark the player and then "release controls" (back to my player) someone can then "open uav terminal" then connect to my drone and take it.

ashen warren
#

I wonder why there isn't a UAV passcode option for arma.

#

at least it would make people have to know the pin to access the drone

#

but then if there is a large list of drones, it would probably not help as they might just shift in the list if they are all the same drone model name

craggy wraith
#

yeah I guess that makes sense

#

I will keep looking see if I can do something

craggy wraith
#

if someone is already connected you cant see the name in the list and they do have different names like "Alpha 1-1", "Alpha 1-2" ect..

ashen warren
#

would anyone happen to know how to make a

"if then and then" statement? I want a song to play before another song but I am unsure on how that would work entirely

gentle plaza
#

Why not just have a trigger play the 1st song and another trigger play the 2nd song with a delay?

oblique arrow
#

or just play the song, set a delay, play next song all in one piece of code?

ashen warren
#

I’m just kinda curious how I can incorporate that into this

#

It would have to be in the top section where it is calling for combat music

young current
#

best would be to ask from whoever wrote it

exotic flax
#

although based on the pastebin I can already tell it won't work at all...

#

probably removed too much code while making it your "own"

tropic thunder
#

The best I can do so far is just providing a callback and using remoteExecutedOwner to remoteExec that callback to the client, but I'd like to populate the response field in the debug console

exotic flax
#

like... what is ["fnc_ChopReward", { // code }]; doing, when is it called, how is it called?

#

if you would have tested it in-game you would know it doesn't work πŸ€”

oblique arrow
#

ablobdoggowavereverse @tough abyss

young current
ashen warren
#

does anyone have a quick code line to detect altitude?

#

if (getPosASL player >= x=100) then hint format ["yes"];

#

wasn't sure if this was correct?

young current
#

lose the x=

#

and getposASL player select 2

#

as the getpos gives you array of 3 values, X,Y,Z out of which Z is height

ashen warren
#

if (getPosAsl player >= [0,0,100]) then hint format ["yes"]; this correct @young current ?

young current
#

you probably should try it instead of asking me πŸ˜›

warm hedge
#
if (getPosASL player select 2 >= 100) then {hint "yay"};```
ashen warren
#

yep thanks, that fixed the problem @warm hedge

#

few {} changes on the actual section of the script for it and its working like a charm

sage flume
#

In my Co-op mission, when I respawn, I want to only keep my "current" loadout,....that I had when I died. I got that Ok,...

#

However when I respawn, the weapon I had is still lying on the ground. What script command could I add to "clean it up" or "delete" it?

#

I've tried a few variation but notta

exotic flax
#

EH "Respawn" -> deleteVehicle _corpse ?

#

not sure if it also removes the weapon (which is a weapon container), although I believe it's tied to each other, since if I remove a body in Zeus it also removes the container next to it

sage flume
#

removeAllWeapons player;
removeGoggles player;
removeHeadgear player;
removeVest player;
removeUniform player;
removeAllAssignedItems player;
clearAllItemsFromBackpack player;
removeBackpack player;

normal abyss
#

Is there any reliable way to pass through variables to missionEventHandlers?, such as the Draw3D one, without relying on globals?

sage flume
#

oh phooy, I didn't mean to do that

#

and then,

#

player setUnitLoadout(player getVariable["Saved_Loadout",[]]);

exotic flax
#

@normal abyss you could store data in missionVariables and use those inside a mission EH

sage flume
#

I may have to look at putting the script in the onplayerkilled instead of in the onplayerrespawn

normal abyss
#

That's my current idea on the solution, issue with that, for what I'm trying to do is setting up a handler for updating that, if there's no other way I guess that's the pain I must suffer.

exotic flax
#

any custom handler/trigger/script should be able to update a missionVariable, and since Draw3D is running on each frame, it should also update the moment it changes

normal abyss
#

That would mean instead of passing data, I'd have to prepare an array and run a foreach since it could be running multiple Draw3DIcon's at once. Where as if I could just pass it through it'd save me some slack.

exotic flax
#

Draw3D runs local only, so you'll need a way to send it to all clients anyway, and have it up to date the moment it's needed (since the EH won't run when not needed)

#

and mission EH's don't take parameters at all, so using missionNamespace getVarialbe ["key", "val"]; is probably the only option (which also needs to be broadcasted to all clients)

normal abyss
#

Ah okay, when updating missionNamespace I imagine it's the same as setVar?

missionNamespace setVariable["varName",'Data',true];
exotic flax
#

yes

winter rose
#

aaare you using mods?

tame lion
#

in a for loop, can I use a variable that has already been defined earlier in the script? I have a variable _time which is tracking, you guessed it, time that could be flowing forwards or backwards depending on a condition. would this throw an error?

for "_time" from _time to 0 step -1 do {
//stuff
sleep 1;
};```
#

and would it affect the _time variable that is outside the scope of the for loop? like if _time was equal to 30 before the above loop, would it equal 0 after the loop?

ionic timber
#

hey how to hide the list of people at stake when we consult the map?

slim oyster
#

Do the config commands cache values for quicker subsequent command usage in a mission?

round scroll
#

still not figuring out the scripted eventhandler stuff with dedicated server... somehow the scripts added via BIS_fnc_addScriptedEventHandler are not executed when BIS_fnc_callScriptedEventHandler is called. It works in SP though. I changed the namescape to missionnamespace, but no luck

round scroll
#

found it, the add scripted eh calls were in a block with isServer, so never added on the clients ...

still forum
#

@slim oyster no

winter rose
#

@ionic timber wut?
@tame lion I think you can, but if not, just rename your second _time as _time1 or _countdown

ionic timber
#

I'm talking about the players menu menu tab @winter rose

digital crown
#

Ive got a script on my Exile server that takes how much Respect you have and assigns it a rank. It prompts a text display when you first log in to show your rank and a message saying how much there is to go. Problem is it doesnt display once you reached the next level (respect req).

#

it only displays when you first load into the server

#

anyone know a way to set this as a keybind to show and make it automatically pop up once you meet the level requirement and "level up"

winter rose
#

@digital crown ```sqf, see pinned messages

warm hedge
#

This is not how the pinned message taught you, use ```<- this

digital crown
#
waituntil {!isnull (finddisplay 46) && {alive player} && {typeOF player != "Exile_Unit_GhostPlayer"}};
if ( alive player ) then {
uiSleep 2;

_Respect = ExileClientPlayerScore;

    case (_Respect > 0 && _Respect < 2500):
    {
    _rank = "Private";
     [parseText format["<t size='0.8'font='PuristaMedium'color='#4bbaff'>Your Rank is %1</t><br/><t size='0.4'font='PuristaMedium'>You need to earn 2,500 respect total for the next rank!</t>",_rank],0,0,10,0] spawn bis_fnc_dynamictext;
    };

    case (_Respect > 2499 && _Respect < 5000):
    {
    _rank = "Private First Class";
     [parseText format["<t size='0.8'font='PuristaMedium'color='#4bbaff'>Your Rank is %1</t><br/><t size='0.4'font='PuristaMedium'>You need to earn 5,000 respect total for the next rank!</t>",_rank],0,0,10,0] spawn bis_fnc_dynamictext;
    }; ```
digital hollow
#

When switching personal weapons, the weapons HUD shows red until the new weapon is read, and obviously firing is disabled while it's red. How could I script disabling weapons in a similar way?

winter rose
#

@digital crown only put cases in switch, nothing else Oo

still forum
#

, nothing else Oo
Well you can if you want to

#

its crazy but....

winter rose
#

I will redirect you every instance of debugs for that

still forum
#

but the way you are using it.. a if/then/else would be way more sensical and easier to understand

winter rose
#

also, you could only use switch cases to define rank and respect points to earn, then display once after the switch

digital crown
#

Can someone fix this for me, I can send paypal

winter rose
#

I can 4 free

digital crown
#

Saweeeet

#

Basically I need the rank text to show up once they have enough respect for each level, to show them they're leveled up obviously, instead of only when you first log in like it is now

winter rose
#

btw is this all your code? becan neither switch nor if are closed

digital crown
#

And would be great to be able to put it on a hot key or something so it will be able to be shown when people need to check it,. Or some other idea

#

No I've adapted it from another guys

#

Oh you mean the whole thing

#

No. One sec

winter rose
digital crown
#

ok

winter rose
digital crown
#

@Lou Montana#8901 so just plug in the other ranks and upload this into the same spot as my old one?

#

Also is it possible to put it on a hot key as well that will pop up a text saying your rank and then how much respect you have left until the next rank?

#

@winter rose

winter rose
#

just plug in the other ranks and limits

as for the popup, it's another thing

digital crown
#

Ok

#

Thanks broski

signal kite
#

is it possible to turn off the crosshair during a running MP game via console? if yes - how?

winter rose
signal kite
#

@winter rose it just works as long as the player doesn't switch weapons

winter rose
#

the cursors parameter? πŸ€”

signal kite
#

yes

winter rose
#

very weird. unexpected behaviour

#

any mods?

signal kite
#

lots

#

works in Vanilla - seems to be a Mod issue

winter rose
#

thanks for confirming πŸ‘

digital crown
#

@winter rose On my last one on the list, Do I delete the " _nextRank = x" bit

#

since theres not a next rank

#

so my last two entries are:

#
    {
        _rank = "Secretary of Defense";
        _nextRank = 2000000;
    };
    
    case (_respect > 2000000:
    {
        _rank = "President of the United States";
        
    };
    ```
#

Also @winter rose When i first log into the server, it doesnt say the rank

winter rose
#

you can delete yes, it will remain 0 iirc.

as for the execution, IDK how you do it! Β―_(ツ)_/Β―

digital crown
#

what do you mean

#

@winter rose This is the whole code after i added in the other ranks, but its not working in game

winter rose
#

seems ok - when do you run it? and is ExileClientPlayerScore defined at that moment?
any script errors?

digital crown
#

the original one i just put int he customs folder inside the mission PBO and it made the text with rank appear when you first log into the server

#

problem being, it only showed when you first log in, if you get enough respect to level up, it didnt trigger a text with your new rank

#

it would only show next time you log in again

winter rose
#

wait, I don't get it - the code https://sqfbin.com/linatosucomewizadewi, does it work on login or not?

digital crown
#

no

#

does not do anything

#

when i get respect, no message, when i first log in, no message saying what rank i am

winter rose
#

we did not do anything to get it to display on "getting respect", as you never mentioned that before

do you use the -showScriptErrors Arma parameter?

digital crown
#

i just meant, when i get enough respect to trigger the next level, not every time i get a small amount

winter rose
#

I know
and we didn't do anything about it

#

Where do you put this code?

digital crown
#

custom folder inside mission pbo

winter rose
#

Where?

digital crown
#

folder named "custom"

#

inside mission pbo

winter rose
#

exact location plz

digital crown
#

Exile.Altis.pbo

#

unpack that

#

make new folder named "custom"

#

place Ranks.sqf inside this folder

#

repack pbo

#

place repacked pbo inside mpmissions folder

winter rose
#

I don't know Exile structure, so maybe you place ranks.sqf or useThisScript.sqf but this script still has to be called

digital crown
#

hmmmm

winter rose
#

if it worked before, I guess it was called?

craggy wraith
#

Hi, am working on an EventHandler and I'm struggling with setOwner command. (UAV) AR-2 Darter, when this specific event happens I want the "player" to become the "owner" of the object. I'm not sure what the object (AR-2) class name would be. Any help with this?? Thanks

winter rose
#

get the classname: typeOf _myUAV
setOwner does not set ownership of a UAV, it sets an object's network ownership

#

@craggy wraith ↑

digital crown
#

Im trying to see whats different between your code, and the original code i sent, because the first one loads for some reason

winter rose
#

@digital crown the waitUntil part is different

#

maybe reset it (same location as mine) to what yours was

craggy wraith
#

ohhh god that has totally threw me off now.. πŸ˜‚ maybe am little out of my depth here. its a steep learning curve.

winter rose
#

@craggy wraith ok: what do you want to do here πŸ™‚

craggy wraith
#

its a multiplayer exile server, All the players are the same alliance. When you connect to your uav and then disconnect another player is able to take control of it.. So what am trying to do is when you connect to that UAV you become the owner so another player is unable to take control if that is even possible? I was doing this by an EventHanlder the event trigger would be "connecting to the uav" and so on...

winter rose
#

not without some advanced scripting, EH indeed

craggy wraith
#

exactly and that's way above my capability's at this time πŸ˜‚ but am still trying...

vague geode
#

Does anyone know a way to place an IR grenade on the map that never stops blinking?

vague geode
#

Or does anyone now after how exactly many seconds they stop blinking?

distant oyster
#

is it possible to recompile an addon function?

grim coyote
#

Allowrecompile = 1 to description.ext

#

*allowFunctionsRecompile

spark rose
#

Is there already a way built into the game to track civilian deaths? Or do i need to build it?

winter rose
#

buiiild

spark rose
#

πŸ™‚

winter rose
#

@spark rose if they don't respawn, you can maybe use allDeadMen (not allDedmen) and BIS_fnc_objectSide+isKindOf

#

but honestly, a Killed EH on each civilian is better

#

or even better maybe, entityKilled mission EH

fair drum
#

is there a doAction for scanning the horizon?

winter rose
#

no afaik

#

it is strangely only accessible from the commanding menu

fair drum
#

hmmm mk. i'll have to change my idea then.

winter rose
#

you can still script it

distant oyster
#

*allowFunctionsRecompile
@grim coyote Thanks πŸ˜„

simple notch
#

Trying to write a script that removes all weapons if you kill someone but I'm not really sure what i'm doing lol. Heres my code.

onPlayerKilled.sqf:
params [
    "_oldUnit",
    "_killer",
    "_respawn",
    "_respawnDelay"
];

removeWeapon _killer;
simple notch
#

correction I have no idea what i'm doing*

winter rose
#

removeAllWeapons* @simple notch

simple notch
#

It doesn't work πŸ€”

civic oracle
#

what is virutal arsenal under in scripting command wiki?

civic oracle
warm hedge
civic oracle
#

What's the difference?

warm hedge
#

Commands = Engine-driven, Functions = made of (a lot of ) commands

civic oracle
#

aha idk why I asked that, I didn't get that at all. Anyway ty for the link

jaunty ermine
#

Is there an easy way to return all available weapon attachments into an array? currently trying to use _array = ("true" configClasses (configFile >>"CfgWeapons"); to return everything, but I need to limit the scope to just weapon attachments.

warm hedge
#

Your code doesn't make sense, but you just can change the condition (the "true" part) to make scope smaller

jaunty ermine
#

that's the part I'm confused at, I'm not sure what to add there to slim the scope down.

warm hedge
#
"getNumber (_x >> 'ItemInfo' >> 'type') in [101,201,301,302] and getNumber (_x >> 'scope') == 2" configClasses (configFile >> "CfgWeapons") apply {configName _x};```
jaunty ermine
#

thank you so much @warm hedge ❀️

slim oyster
#

Is there a way of setdate/time on a client machine (specifically headless client) that does not automatically sync with the server time?

oblique arrow
#

i dont think you can have multiple times independent of eachother

#

that'd definetly πŸ¦† with a lot of scripts

winter rose
#

@slim oyster not without (very) periodically overwriting local time, and even that is not guaranteed.

Main question would be: why?

slim oyster
#

Night AI are terrible and I want a headless client to cheat by giving it a different local time

#

For time via scripts I always use CBA_missionTime and I would assume engine has gametime internal stuff for sim as setdate globally works fine

chilly wigeon
#

One of the ways I've dealt with that in the past is by config patching a special pair of NVGs to not have a model, then auto-equipping them to AI, not sure if that's a solution that would work for you

slim oyster
#

Could experiment with that

#

I am just looping setdate and it works well was just wondering if there was a better way for this behaviour

#

Setdate to dusk/dawn for night missions is yielding some great results

exotic flax
#

full moon also works good

finite sail
#

nearentities doesn't return flagpoles that are placed in script

#

didnt expect that

winter rose
#

entities are living things, afaik

#

try nearObjects

finite sail
#

i know what you mean, but vehicles are living things by your definition

#

made by createvehicle

#

flagpoles also created by createvehicle, but are not entities

#

logics aren't entities, i know that and I sort of get that

winter rose
#

ah well, living things and vehicles ^^

finite sail
#

but yeah, surprised flagpoles arent

#

i like nearentites, its very cpu cheap

#

will try nearobjects, though it can only search for a single class at a time

#

ugh, nearobjects cpu expensive

#

ok, workaround time

real tartan
#

is "InventoryClosed" EH persistent to unit after respawn ?

narrow pollen
#

How do I use variables in 'Structured Text' ?

#

I think I got it

craggy wraith
#

Anyone got some good knowledge of EventHandlers?

finite sail
#

some, @craggy wraith , which ones are you asking about?

#

also, are you using ACE?

craggy wraith
#

nope

finite sail
#

πŸ™‚

craggy wraith
#

I have an event and the trigger but I'm not sure how to set the outcome when this event happends I want "isUAVConnected" to be true.

#

Player addEventHandler ["connectTerminalToUAV" ,
{
_person = (_this select 0)
_uav = (_this select 1)

finite sail
#

ok, keep writing, nmore info needed

#

ah ok, here we are πŸ™‚

craggy wraith
#

then once the "player" has triggered the event I want "isUAVConnected" to be true

#

but I'm not sure how to add that/ the code for it.

finite sail
#

this connectterminaltouav eventhandler.. i cant find any documentation for it

craggy wraith
finite sail
#

ah ok, its not an EH

#

its a command

craggy wraith
#

ohhh 😦

finite sail
#

so, back to basics, you want to sense when a player connects a terminal to a uav?

craggy wraith
#

I want to stop another player connecting to a uav once I "release controls" in game, so I thought using "isUAVConnected" keeping it true would stop this

finite sail
#

right

craggy wraith
#

and instead of connectterminaltouav would "WeaponAssembled" work?

#

as you assemble the drone from the bag?

finite sail
#

good, call, cant say either way on that

#

that may work

#

ok, give me 5, been called afk

craggy wraith
#

okay thanks πŸ™‚

finite sail
#

ok, back.. had someyummy cake

#

so, you want to prevent players using a particular UAV?

craggy wraith
#

nice!!πŸ˜‹

#

yes

#

all on the same alliance (Exile Server)

finite sail
#

i cant' see a command that would reject a terminal, or refuse a connection

#

ah wait, this might be it

#

example 2, might be relevent

craggy wraith
#

Once a player is already connected to the uav another player cant connectt

finite sail
#

yes

#

but once player a disconnects, player b might connect and you want to rpevent that

craggy wraith
#

so can I keep that connection so to speak even if I disconnect

#

yes

finite sail
#

ok, so this isnt real code, but this is how I would go about this

#

on the UAV itself, crate a variable using setvariable

#

that has the name of the player who is allowed to connect to it

craggy wraith
#

ahh...

#

can that name be added automatically once the "player" connects?

finite sail
#

yes

craggy wraith
#

and then it belongs to them

finite sail
#

so the first player would store his name on the uav, so to speak

craggy wraith
#

yes

finite sail
#

then using example 3 on the remotecontrol page i linked earlier

#

you can get who is connected

#

you'll need to do this in a loop as there is no eventhandler

craggy wraith
#

I can never done a loop before, I will read into them.

finite sail
#

look up while

#

while {alive myUAV} do {}

#

something like that

craggy wraith
#

sorry I'm not sure what you mean by that?

finite sail
#

you're going to write a loop that checks who is connected to the uav, this loop will run around every half second or so

craggy wraith
#

okay am with you

finite sail
#

it will check who the player connected to the uav is

#

if it's not the same as the setvariable we did earlier, it will disconnect him

#

using example 2 on the remotecontrol wiki page

#

job done,that'll be Β£50 please

#

πŸ™‚

craggy wraith
#

okay so example 2 to set player then example 3 to create the loop?

#

πŸ˜‚ πŸ˜‚

finite sail
#

because there is no EH

craggy wraith
#

okay thannks πŸ™‚

finite sail
#

you'll need a loop that checks who is on the uav

#

the first player who connects, the loop will write hisname to a variable on the UAV (setvariable)

craggy wraith
#

and that will still keep the remote even when he disconnects ?

finite sail
#

no

#

i dont think we can do that

craggy wraith
#

ahhhhh

finite sail
#

the loop will then check for new connections to the uav

#

if the new connection name isnt the same as that already stored on the uav, disconnect him

craggy wraith
#

ohhhh

#

yeah

#

thats kinda what I want

finite sail
#

it will mean that the 2nd player will briefly get connected, but will get disconnected almost straight away

craggy wraith
#

thats fine as long as it kicks him off after the "remotecontrol" has noticed its not the set player.

finite sail
#

yep

craggy wraith
#

thankyou so much!!!!

#

wish me luck πŸ˜‚ πŸ˜‚

finite sail
#

Β£60

#

charge for luck wishing

#

πŸ™‚

#

im much cheaper than @winter rose , but thats because hes good

craggy wraith
#

hahaha I will bare that in mind πŸ˜‚

finite sail
#

you might want to consider that what you want requires some 'hacky, unorthodox' code

#

and a bit of mission redesign might enable to use better code

craggy wraith
#

is it that bad..??? πŸ˜‚

finite sail
#

not necessarily

craggy wraith
#

I hope notπŸ˜‚ 🀞

finite sail
#

sometimes we have to write some hacky code like this in order to achieve what we want

#

we've all done it

craggy wraith
#

exactly as long as it works

finite sail
#

yes, lets go with that lol

#

my point is... if the code we are forced to write because there is no good EH, is so nastly, and I would describe this loop as less than nice

#

I might rethink the requirements.. ie, think of another way, perhaps change the mission story a little so that the mission doesnt need to ahve a single player only allowed to use a UAV

#

am I making any sense?

#

*notices the rest of the room staying very quiet and not backing me up on this lol

craggy wraith
#

Yeah I see what you are saying

finite sail
#

cool

craggy wraith
#

Maybe if it's too hard then I will have to leave it but I appreciate the help so far!!!

finite sail
#

very welcome mate

#

good luck

hollow cloak
#

is there a way to stop the idle animations trying to make blend in mission but sometimes they give it away

young current
#

where are the animations trying to blend?

winter rose
#

no I think he means the idle animations when you sit still - @hollow cloak are these AI?

#

@finite sail I am not that expensive? :p

hollow cloak
#

No the player usually tilts head or looks around when stood still sometimes

winter rose
#

usually when you lower your gun yes

hollow cloak
#

Sometimes for an unarmed civ though

winter rose
#

yep

#

if the civilian lies down, it reduces the risk

a solution could be to manually list the idle animations and to switchMove on animation changed EH

hollow cloak
#

Okay thank you

boreal pike
normal abyss
#

Are there any solutions to finding the location that a bullet has made first contact (Including terrain)

young current
#

for what kind of purpose?

#

you can track a bullet with fired eventhandler, but I dont think there is a proper evenhandler to see where it hits something

#

perhpas handleDamage eventhandler if the bullet is able to take damage

#

My gut say no though.

normal abyss
#

I've already tried tracking the bullet, but when using FiredMan/Fired EH, the projectile position is always the unit who had fired position.

young current
#

you are using it wrong then.

exotic tinsel
#

is there a way to prevent/disable the ability for player to assign them selves to a task? i have been search the web and i cant find anything.

oblique arrow
#

iirc you can set it so that only the group leader can assign a group to a task in the mission settings in the editor

exotic tinsel
#

yeah i found that. im trying to disable it all together so no one can.

oblique arrow
#

Not sure if thats possible

molten roost
#

is there a command to change high command ownership to a different unit?

#

oh i suppose using hcSetGroup to a different player does the same thing

royal marten
#

Currently in the process of making an add action script upon selecting the action it hides an object named A1

#

this addaction ["Test Drop", {(_this select 0) hideObject A1;}];

#

Does this seem to be correct?

fair drum
#

im not really understanding this line of code that well:

for [{_i=(count _units)-1},{_i>0},{_i=_i-1}]

can someone explain?

unique sundial
#

same as for (i = units.size() - 1; i > 0; i--)

warm hedge
#

Remove "on" from EH name, as UIEH article notes

exotic tinsel
#

@warm hedge sorry i did that first and it didnt work and i posted my version of trying it back on. my bad. Ill update my snippet.

exotic tinsel
#

Ok i have to be doing something wrong!. I have tested 9 possible options out of desperation. none of them work when i double click on my map control. I have confirmed my ids are correct because on my "draw" works on it. Please Help.
Here are all the tests

waituntil {!isnull ((findDisplay 1234) displayCtrl 2200)};
_id = ((findDisplay 1234) displayCtrl 2200) ctrlAddEventHandler ["MouseButtonDblClick","systemchat 'testing 1';"];
_id = ((findDisplay 1234) displayCtrl 2200) ctrlAddEventHandler ["onMouseButtonDblClick","systemchat 'testing 2';"];
_id = ((findDisplay 1234) displayCtrl 2200) ctrlSetEventHandler ["MouseButtonDblClick","systemchat 'testing 3';"];
_id = ((findDisplay 1234) displayCtrl 2200) ctrlSetEventHandler ["onMouseButtonDblClick","systemchat 'testing 4';"];
_id = (findDisplay 1234) displayAddEventHandler ["MouseButtonDblClick","systemchat 'testing 5';"];
_id = (findDisplay 1234) displayAddEventHandler ["onMouseButtonDblClick","systemchat 'testing 6';"];
_id = (findDisplay 1234) displaySetEventHandler ["MouseButtonDblClick","systemchat 'testing 7';"];
_id = (findDisplay 1234) displaySetEventHandler ["onMouseButtonDblClick","systemchat 'testing 8';"];
_id = ((findDisplay 1234) displayCtrl 2200) onDoubleClick "systemchat 'testing 9';";
exotic tinsel
#

@still forum mate can you help me out? the internet has nothing to offer regarding custom double clicking on map events. Is this just not a working thing?

#

I found IT! Larrow For the win!

plucky wave
#

Best way to init a file on each client from within a PBO? Presuming config.cpp -> CfgVehicles somewhere..

winter rose
#

CfgFunctions @plucky wave

#

do you want to run on each client, or on each vehicles?

plucky wave
#

On each client, ideally passing the player entity to the executed script

winter rose
#

if it is run on each client, you can use the player command

plucky wave
#
class CfgVehicles
{
    class Land;
    class Man : Land
    {
        class EventHandlers
        {
            class list_init
            {
                init = "_this execVM '\test_directory\data\test_file.sqf';";
            };
        };
    };
};```
#

Given something like this, when would this execute?

#

Lives in config.cpp

winter rose
#

this would run the script for every man (and read from the disk each time)

winter rose
#

(why not the A3 version?)

#

if you want one function to run once (per mission or per game instance), see CfgFunctions @plucky wave

cosmic lichen
#

That's the first that came up. Is there an arma 3 one?

winter rose
#

ninja'd meowthis

cosmic lichen
#

I only see weapon related ehs there

winter rose
#

wat?

cosmic lichen
#

Didn't know they work in CfgVehicle Configs. I've never worked with that stuff

#

Yeah right, there is the init EH

plucky wave
#

Follow up question, anyone had issues execVM'ing a script from config.cpp once its binarised?

winter rose
#

no, but it is not recommended (performance issues)

candid cape
#

Hi , I need help with an script

#

When the script runs, it makes an animation, what happens is that I want it not to do it in a specific place.

#

I want to make some like this

#

if (case isEqualTo "houdini") exitwith {player playMoveNow "";};

#

But it don't work

#

help me pls

warm hedge
#

I don't get it. What do you wanted to make?

surreal peak
#

for starters thats not how select case works

#

something like

if ((getPos player) inArea _AREANAME) then {player switchMove"";};

Would reset a players animation in a given area

winter rose
#

@candid cape we will need moarrr details πŸ˜‰

surreal peak
#

although more detail definately needed

candid cape
#
if (_param isEqualTo "menu") exitWith {
    if (vehicle player != player) exitWith {hint "Venga va, no me seas vago"};
    if !((["pop_ganzua"] call ica_fnc_tengo) >= 1) exitWith {hint "Necesitas una ganzΓΊa"};

    private "_dificultad";

    _dificultad = param [1, 0.9];
    if (_dificultad < 0.9) then {_dificultad = 0.9};
    if (_dificultad > 0.99) then {_dificultad = 0.99};
    player playMoveNow "CL3_anim_lockpick"; ```
#

The script says that the animation always runs, so I want that when I run a specific "case" the animation doesn't run

#

Is this "case"

#
case "houdini":{
                _unit = player;
                if (vehicle player != player) exitWith {hint "No puedes estar en vehiculo para usar hudini"}; 
                _unit setVariable["restrained",FALSE,TRUE];
                _unit setVariable["Escorting",FALSE,TRUE];
                _unit setVariable["transporting",FALSE,TRUE];
                detach _unit;

                titleText["PLAIN","Has conseguido abrir las esposas."];


            };```
queen cargo
#

use tripple ` and sqf suffix (```sqf) for code blocks in discord please

surreal peak
#

@candid cape look at the pins, should be quite simple to see how to make code blocks

#

Thats alot more readable, thanks!

#

is ica_fnc_tengo a custom made function? I tried googling it and it only came up with some old pastebins

candid cape
#

The script is in Spanish, this function do not pay attention hahaha

#

It's for known if you have any object on your inventory

surreal peak
#

I see, makes sense

#

I just want to clarify what you mean by "case", is the case of "houdini" a variable a player has? Where is "houdini" assigned to?

winter rose
#

if not houdini then play action

candid cape
#

What this script does is execute a menu, as if you were forcing a lock, in this case it is the lock of some handcuffs.

So to execute the "case" it would be like this: ["menu", 0.9, "houdini"] spawn ica_fnc_ganzua

#

if not houdini then play action
@winter rose can you write it well pls ?

surreal peak
#

if !("houdini") then {switchAction ""};

winter rose
#

ouch

surreal peak
#

I read your words litterally

#

what would you do?

#

im also fairly certain I miss understand what he wants

candid cape
#

In this script there are several "cases", this script is characterized by forcing locks, be it car, doors ...

#

And in all of these an animation is executed as if it were forcing something

#

And I need that in the case of "houdini" it is not executed, because it would not make sense

winter rose
#

a script case is different from using the case command

#

case must be inside a switch, which you do not use at all so forget about this command

#

simply do a```sqf

if (_myVar != "houdini") then
{
/* do stuff */
};

surreal peak
#

now I just realsied I forgot to put a variable with "houdini" with my example

#

need more coffee

candid cape
#

That's the swich that you says

winter rose
#

then you are using a switch/case, ok

#

simply do a```sqf

if (_myVar != "houdini") then
{
/* do stuff */
};

this still stands?

candid cape
#

I am thinking of doing another function, another exclusive script in which the animation does not appear

still forum
#

switch (condition) do {
if (condition == "test") then {hint "test"};
case test2: {hint "test2"};
}

(ignore me just being funny)

peak bridge
#

is there a way for an hint to be to the trigger player only?

#

In an addAction, in this case

winter rose
#

yes

#
hint "this is a local hint";
peak bridge
#

oh, hint is local to the player? gotcha

winter rose
peak bridge
#

so this in the init of the npc:
[this,["Evacuate","evacuate.sqf"]] remoteExec ["addAction"]

#

plus this:

_civ = _this select 0;
_player = _this select 1;


if(side _player == resistance) then{
    hint "This person does not trust non-medic personnel";
}
else{
    _civ assignAsCargo (assignedVehicle _player);
    [_civ] orderGetIn true;
}
#

The npc will obey and every player will see it obey, but only if the player who triggered isn't resistance side

#

got that right?

winter rose
#

@peak bridge use ```sqf please (see pinned message)

tough abyss
#

so uh

#

quick question

winter rose
#

quick answer?

tough abyss
#

does anyone know how i can make the decontamination shower activate using a trigger?

tough abyss
#

so "[this, 5.4, 4,2, true] spawn BIN_fnc_deconShowerAnimLarge;" right?

#

honestly im still really new to this whole thing

warm hedge
#

Replace this to your object name but that's it, I think

tough abyss
#

oooooooooh

#

i gotchya

winter rose
#

@peak bridge it will hint where the person executes the action, so player-side yes

peak bridge
#

Thank you very much πŸ™‚

#

Oh, and is the remoteExec properly implemented? I'm new to the MP scripting, that's why I'm asking

winter rose
#

Actually, you should not use remoteExec - init fields are run for every client

tough abyss
#

so i got it to turn on when triggered but it refuses to turn off again

#

wait

#

nvm

#

i just added 2 more triggers : ^)

#

oh wait im retarded

#

i just had to set it to repeatable

peak bridge
#

How should I add said addAction then?

winter rose
#

just addAction

#

no remote execution

peak bridge
#

But will the other players see the NPC run to the vehicle as the script says so?

winter rose
#

so you should only remoteExec the orderGetIn command

#
[[_civ], true] remoteExec ["orderGetIn", _civ];
```@peak bridge
peak bridge
#

So I should only use remoteExec if a command has EL or AL in it, otherwise i can just use the command regularly.
IE: addAction is AG EL, meaning it shows up to everyone, but it's effects (code dependent) are local.
But since in the code I'm using assignAsCargo, which is EG AL, this will be executed everywhere.
And orderGetIn has one Local, meaning that i need to remoteExec it for every player to realize it's effects.
Am I getting close?

winter rose
#

for addAction it means that the argument doesn't have to be local: you can add an action to another player for example. but he will not see it

#

that's effect local

#

assignAsCargo is argumentGlobal and effectGlobal - so no need to worry about anything here

#

orderGetIn the argument must be local (the civilian), and when he is told to do so, the effect is global (a.k.a everyone will see him getting in the vehicle)

#

remoteExec has two functions:

remoteExec ["addAction"] will exec the addAction on every computer on the network - good to have a global effect with an otherwise local effect command

remoteExec ["orderGetIn", _civ] will exec the command only where _civ is local (for an AI, usually the server) - good to have a "global" argument for a command that only takes a local one

#

(aaand sorry for the wall of text.)

peak bridge
#

(aaand sorry for the wall of text.)
@winter rose No need to worry, it helped me understand AL/G and EL/G πŸ™‚

winter rose
#

perfect! glad to help

peak bridge
#

And for good measure I copied and pasted on a text note

winter rose
peak bridge
#

I read it several times, but had some trouble understanding it

#

You made it clearer.

narrow pollen
#

How do I filter duplicates in 'group' object again? So for example if there's AI in there that are local to someone

winter rose
#

@narrow pollen use case?

narrow pollen
#

I receive a group object from a client on the server, and want to filter out duplicate ID's, put that in array to use with remoteExec later

#

I had exactly that in my code a while ago, but didn't need it anymore, now I need it again but forgot how to do it :/

#

Or can I just use that group object, and not care about it?

#

It's for use in remoteExec with music

#

Nevermind I found it again πŸ˜„

#

(units _ximgroup) apply {_groupOwnerIDs pushBackUnique (owner _x)}; //Retrieving ID's for players in group

winter rose
#

or```sqf
_arr arrayIntersect _arr;

slate sapphire
#

Hello, I have a request, is there a working script that spawn crew in vehicles, I need for ship cos actual one is not working properly with turrets, do you have an example script or can you help me ? I need to spawn big frigate from mod HAFM with all turret manned, in my old warfare code, I have problem and only partial crew spawn so I need some hints, Thanks!

winter rose
#

@slate sapphire createVehicleCrew?

slate sapphire
#

is there option to set the class of the crew using this command or it will read the config?

winter rose
#

this one will read the config

slate sapphire
#

my problem is that I need specific crew and I need to count the crew to see if it's not more than the group limit set by mission parameter

winter rose
#

Β―_(ツ)_/Β―

slate sapphire
#

I know Dr. Gregory H.

winter rose
#

personally?

slate sapphire
#

hehe no just by serie hehe

autumn swift
#

Hello I have a problem regarding my onPauseScript.

I have defined a pausescript in my description.ext file. The main purpose of the script is to delete some custom HUD elements when the player enters the pause menu. The script itself works fine but it breaks the debug console on dedicated servers. For some reason it doesn't appear in the pause screen anymore even when I am logged in as admin. Removing the onpauseScript fixes the problem... Anybody have an idea? I have enableDebugConsole = 1; in my description already

surreal peak
#

for starters showing the script would help @autumn swift

digital hollow
#

The PIP driver cam custom info seems to match the fov of the pilotCamera. Is there a way to get the fov by script?

normal abyss
digital hollow
#

That's neat. is the pilotCamera its own camera object? or would this fnc only apply to the pip cam being used for the custom info?

winter rose
#

on a side note I found a bug in Arma 2 (IDK about OA)

for "_i" from 0 to 2 do { hintSilent str _i; }; // works
for "_myIndex" from 0 to 2 do { hintSilent str _myIndex; }; // doesn't work… can you guess why?
indigo wolf
#

Hello, I'm trying to setup a PvP mission more or less like the game Deceit. I'm currently trying to seamlessly select a certain % of random players to become the villain and spawn as villains (OPFOR faction) at different position while the remaining players respawn as the regular civilians (BLUFOR Faction) every 5 minutes during the mission.

At the initial stage when everyone connects and loads up in the mission this is run:

btk_fnc_MPexecVMLocal = { 
    params ["_villain"];

    if (_villian isEqualTo player) then {
        [] execVM "villain.sqf";
        hint "You are the villain! Hunt everyone!";
    }; 
};

if (isServer) then {
    private _playerList = if (isMultiplayer) then { playableUnits; } else { switchableUnits; }; // For testing in editor mostly
    private _randomPlayer = selectRandom _allPlayers;

    sleep 15;
    [[_randomPlayer], "btk_fnc_MPexecVMLocal",true] call BIS_fnc_mp;
};

So ideally for the dead it would be:

btk_fnc_MPexecVMLocal = { 
    params ["_villain_res"];

    if (_villain isEqualTo player) then {
        [] execVM "villain_respawn.sqf";
        hint "You are now part of the Villains! Hunt everyone!";
    }; 
};

if (isServer) then {
    private _playerList = if (isMultiplayer) then { playableUnits; } else { switchableUnits; }; // For testing in editor mostly
    private _randomPlayer = selectRandom _allPlayers;
    if (_randomPlayer = allUnits select {isPlayer _x && {!alive _x}};) then {
    _grp = createGroup East; // become OPFOR
    [_randomPlayer] joinSilent _grp;
    [[_randomPlayer], "btk_fnc_MPexecVMLocal",true] call BIS_fnc_mp;
    }
};
#

However this does not work. I'd like to know how to make sure that the player stays in the spectator menu until he get auto-respawned by the script (every 5 minutes) and moments before respawn, he/she gets put into the villain unit to hunt other players in the hero unit.

Example: If the mission is played by 10 people, initially there will be 1 villain chosen at random with 9 other heroes. Assume 6 heroes die. Now after 5 minutes, when they respawn, 3 of the dead players are randomly chosen and are assigned to villain unit and are spawned at villain side of the map while the other 3 are spawned as the usual heros at their side of the map.

winged wing
#

Is there a way to hide squad logos on vehicles per mission?
E.g. They'd be shown in a COOP mission, but hidden in a TVT mission.
The only way I've found is with a config.cpp, which wouldn't be per mission.

autumn swift
#

@surreal peak this is the onPause script

params["_pauseMenu"];
_abortButton = _pauseMenu displayCtrl 104;

("rsc_health_bar" call BIS_fnc_rscLayer) cutText ["","PLAIN"];

_pauseMenu displayAddEventHandler [ "Unload", {
    //When pause menu exits, close dialog
    [] spawn AAD_fnc_healthBar;
}];

_abortButton ctrlAddEventHandler [ "onMouseButtonClick", {
    ("rsc_health_bar" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
}];

// Disable respawn button if player is not in a match!
if (!(isNull player) && !(player getVariable ["isInMatch", false])) then {
    _respawnBtn = _pauseMenu displayCtrl 1010;
    _respawnBtn ctrlEnable false;
};

I have no idea why setting this as the onPauseScript prevents the debug console from being displayed....

winter rose
#

check description.ext for missing ;

also, try with an empty script see if it still breaks stuff @autumn swift

autumn swift
#

Hmmm, turns out I was wrong. It was not caused by the pausescript. The solution is to use the alternative syntax: enableDebugConsole[] = { "76561198XXXXXXXXX", "76561198YYYYYYYYY", }; instead of enableDebugConsole = 2; and whitelist per player uid

#

Why the latter does not work is something I don't understand, but I atleast its solved now

surreal peak
winter rose
#

@surreal peak don't forget to add a description (#rules)

#

@autumn swift how did you "whitelist per player uid" if not with this array syntax?

autumn swift
#

I meant that in order to make it work, I have to whitelist by player UID using the enableDebugConsole[] array syntax

#

enableDebugConsole = 2; seems broken for me, the only way to make it work atm is to use the array version

winter rose
#

ok, I did read that wrong then πŸ™‚

neon crane
#

http://www.armaholic.com/page.php?id=33195
Is someone familiar with this Script?
I put it into my mission as i should, with the folder and all that, but i just don't get the action to unlock/lock vehicles in the mission.

#

If someone has a good alternative and could send that to me would be nice

fervent kettle
#

as far as I can see you need to add your steam UID to the whitelist, did you do that?

tough abyss
#

hey guys, is there a solution for switching the strange motions sensor lights OFF for the buildings of CUP objects. found scripts but they dont worked for the takistan cup objects with the lights

smoky verge
#

trying to teleport everyone in the server in a position
{{_x setPos(getPos t1)} forEach allPlayers}
this doesn't seem to work

still forum
#

what is that
{} around the outer?

smoky verge
#

good question

#

let me try

#

yup I'm a big dum dum

#

thanks @still forum

brave jungle
#

Generic error on getting parts from an array:

_unit = _unitdata select _int select 0; for example.
I can get the first array, systemChat str _unitdata select _int; which shows it fine, getting a parameter like the unit class throws a generic error in expression when using: _unit = _unitdata select _int select 0;

an example of _unitdata would be [["I_AP_Bandit_PKM_01",[945.476,5954.43,57.0832],"STAND","AWARE"],["I_AP_Bandit_PKM_02",[959.018,5945.47,55.8208],"STAND","COMBAT"]];

So i'm left with ["I_AP_Bandit_PKM_01",[945.476,5954.43,57.0832],"STAND","AWARE"], I have no idea why the second select isn't working tho. I know its gonna be something easy but staring at it too long yada yada

#

Oh I should mention its in a forEach loop of the array and _int in the iteration of the loop so it goes through the entire array

still forum
#

why is _int the iteration, why do you select by index instead of just using _x

brave jungle
#

Why am I overcomplicating it 🀣

still forum
#

exactly

brave jungle
#

Yeah literally took two secs to fix

#

ty for the second pair of eyes

winter rose
#

he's curious after all

oblique arrow
#

actually what is _x?

winter rose
#

the element currently iterated

#
{ sleep 1; hint str _x } forEach [1,2,3];
```will "result" in```sqf
sleep 1; hint str 1;
sleep 1; hint str 2;
sleep 1; hint str 3;
oblique arrow
#

Ah nifty

smoky verge
#

speaking of forEach
was it this to affect all opfor?
{_x setDamage 1} forEach [side == EAST];

winter rose
#

nope

#
private _eastUnitsArray = allUnits select { side _x == east };
{ _x setDamage 1 } forEach _eastUnitsArray;
// or one-lined
{ _x setDamage 1 } forEach (allUnits select { side _x == east });
#

@smoky verge ^

smoky verge
#

that was my second guess of course

spice arch
#

Need some help with the dreaded convoys. Got 3 vehicles, Strider HMG, Strider, Zamak Transport in a column. The drivers of all 3 vehicles and the 2 in the Strider HMG are in one squad with the lead driver being the squad leader. Assigned a variable name to each vehicle object. Set this in the init.sqf:

w1_2 setConvoySeparation 20;
w1_3 setConvoySeparation 20;```
The lead vehicle just keeps driving off on its own. The 2 followers seem to do an okay job staying together. Why is this happening?
finite sail
#

@spice arch all the drivers need to be in the same group

#

make the convoy lead driver the group leader

#

if the other vehicles don't drive, add their gunners to the drivers group too

#

vehicles that won't convoy unless their gunner is in the driver group too...

#

children of APC_Wheeled_02_base_F, MRAP_02_base_F, Offroad_01_AT_base_F, Offroad_02_unarmed_base_F

#

its possible vehicles with other base classes will show the same behaviour, but these are good to start with. I think it's related to vehicles that don't have a commanders seat. For these, it seems the gunner has command

spice arch
#

Thanks @finite sail I've got all of the drivers and convoy lead driver in the same group as well as the commander and gunner in the HMG strider. I've got some passengers loaded in the other vehicles and will test around with what happens if I remove them or from the unarmed strider.

finite sail
#

cool. let me know how you get on.

spice arch
#

Convoy Testing Report:

Methodology: totally within basic EDEN editor and using waypoints and minor application of the setConvoySeparation command.

Tested: (HMG Strider lead, Strider 2nd, Zamak Transport 3rd)
-Vehicles with separate groups using the setConvoySeparation command
-Drivers grouped, but crew seats (commander + gunner) separate
-Random seating order of convoy group. I.E.: placement order of drivers didn't matter, 2nd driver in last vehicle, etc.
-Passengers in crew seats

Ok did a few iterative tests and came to these conclusions/best practices:

  1. All drivers and crew members (commander + gunner) seats must be in the same group.
  2. Place all vehicles empty first in the order of the convoy (lead to following vehicles)
  3. Place all the drivers and crew members in the order of the vehicles. (did not confirm if commander/gunner -> driver ordeer matters or not). I.E.: Place all 3 members of the HMG Strider in first. Place the driver and commander of the 2nd Strider next. Place the driver of the Zamak last.
  4. Set the convoy squad to column formation and safe/aware mode.
  5. Place multiple move waypoints to control the overall spacing throughout the drive. Observed the convoy elements waiting a bit at each waypoint for straggling vehicles to catch up a little.
  6. Not sure of the impact of the setConvoySeparation command. Tested with values of 20 and 15 and also wtihout the command (not rigorous and small sample size so keep that in mind). With the command at 15 seemed to perform slightly better in terms of keeping a closer spacing but honestly even without the command the performance was okay. No vehicle actually maintained the exact values and were usually between ~50-100m apart which for the most part works well for a convoy.
  7. Place the passengers last, DO NOT place passengers in any crew slots. The fire from vehicle positions of the Zamak are okay though.
    @finite sail
#

For the purposes of my scenario, I used a transport unload waypoint with the convoy group; passengers disembarked to move onto their assigned move waypoints to flank a fortified position and engage targets inside the position. One disadvantage was that once the convoy arrived, I didn't have a non-specialized script method for dismounting the secondary strider or zamak to act as additional troops.

I'm sure we can obtain more versatility and precision through scripts controlling the spawning of units and vehicles, group behaviors, and waypointing but using the above practices I was able to get a realistic looking convoy that moved to a dismount position and the passengers move on foot to seize a fortified position using only the basic editor.

exotic tinsel
#

@winter rose @queen cargo oy! where is the category:formatters sqf for visual code guys!!!!

native warren
#

Does anyone know of a way to allow launchers to be used on ATV's, I have at current made it so I can fire normally from them but when I try to allow launchers nothing happens.

fair drum
#

so far I've been working with forEach in regards to single units in a group. can you do the same with groups as a whole? something like:
~~```sqf
{_x setSpeedMode "FULL"} forEach group [g1,g2,g3]

actually you just do:
```sqf
{_x setSpeedMode "FULL"} forEach [g1,g2,g3]
wind hedge
#
> private _vObjectsArray = [];
> private _vObjects = [];
> private _vObject = objNull;
> private _dist = 4;
> //if (cameraView isEqualTo "EXTERNAL") then {_dist = 5};
> private _startPos = player modelToWorldVisual [0,1,1];
> _vObjectsArray =  nearestObjects [_startPos, ["ALL"], _dist];
> if !(_vObjectsArray isEqualTo []) then {
> private _cameraPosASL = AGLtoASL (positionCameraToWorld [0, 0, 0]);
> private _cameraDir = (AGLtoASL (positionCameraToWorld [0, 0, 1])) vectorDiff cameraPosASL;                        
> _vObjects = _vObjectsArray select {
>     private _lambda = ((getPosASL _x) vectorDiff _cameraPosASL) vectorDotProduct _cameraDir;
>     ([player, _x, 0.1] call BIS_fnc_isInFrontOf &&
>     (_lambda > -1) &&
>     {!isObjectHidden _x});
>   };
> };
>   if !(_vObjects isEqualTo []) then {
>     _vObject = _vObjects select 0;
>     systemChat format ["vObject: %1",_vObject];
>     [_vObject] spawn {
>         params ["_vObject"];
>         for "_i" from 1 to 50 do {
>             drawLine3D [ASLToAGL eyePos player, ASLToAGL aimPos _vObject, [0.1,0.1,0.1,0.1]];
>             sleep 0.1;
>         };
>     };
> };
> ```
#

πŸ‘† I am using that code to get nearby objects so I can show a proper menu for each item. The problem is that I keep getting some underground objects and the debug systemchat just says: OBJ 315 <ANY>

#

And the drawLine3D clearly goes underground so the object is underground

#

How can I fix that, tried everything I can think of

signal kite
#

@wind hedge can you check via if-loop if your objects have getPosATL values >= 0 and discard the ones which do not?

winter rose
#

@exotic tinsel …wut?

fervent kettle
#

Is someone confortable with ACE scripting and can tell me if I can remove all ace interactions from a single unit?

mortal crypt
fervent kettle
#

Oh sorry, shouldve said what I have tried already:
googled the exact same as you, tried this here [OBJECT,0,["ACE_MainActions","ACTION"]] call ace_interact_menu_fnc_removeActionFromObject;
(wich didnt work)
and also looked up the github.
To clearify, i want to remove "external" actions from a unit, so that A cant use B`s interactions

brave jungle
#

Your object in question is called OBJECT right?

#

Otherwise ofc it wont work

#

Same with ACTION

fervent kettle
#

wait, so the unit has to be called OBJECT? Cause it aint an object like ammo crate or smth

winter rose
#

what is it then?

#
[OBJECT,0,["ACE_MainActions","ACTION"]] call ace_interact_menu_fnc_removeActionFromObject;
// ^^^^ how is the game supposed to know the target? :)
brave jungle
#

No

#

I mean

#

OBJECT is in caps so you know you need to chance it

#

the same with ACTION

#

like Lou said, the game can't mind read

#

so like [myUnit,0,["ACE_MainActions","anACtionToRemove"]] call ace_interact_menu_fnc_removeActionFromObject;

#

then the unit called myUnit will have the action anActionToRemove removed

#

obvs that isn't a real action but you get my point ( Idon't know any off the top of my head)

mortal crypt
#

Hey i`m looking into particleArray,
https://community.bistudio.com/wiki/ParticleArray
Under point 14(animationPhase) are the different numbers depending on the lifetime of the particle?
@mortal crypt That was true, it is depending on the lifetime.

#

Just for the curios

brave jungle
#

First time I read that I thought you were answering your own question

#

🀣

mortal crypt
#

Well I did.

brave jungle
#

I meant like as another person if you get me, instead of just updating yourself on it

fervent kettle
#

so like [myUnit,0,["ACE_MainActions","anACtionToRemove"]] call ace_interact_menu_fnc_removeActionFromObject;
@brave jungle ikr i have changed that, but how can i remove ACE interaction with that unit in general?

brave jungle
#

youd have to get a list of actions they have, then, and its probs an array but make sure to check, use a forEach _actionArrayName loop to remove each action.

_someArray = ["some", "ACE", "Actions"];//This is the list of actions, I don't know how you would do this off the top of my head
{
  [myUnit,0,["ACE_MainActions",_x]] call ace_interact_menu_fnc_removeActionFromObject;
} forEach _someArray;
sacred dirge
#

Hey, was wondering if anyone could lend me a hand. I am trying to add a scroll option on a ship I am making that allows you to "climb" pretty much teleport out of the water an on board it's deck. Would anyone know how to do so? I wanted to make it so you would swim to the point select it and teleport you to a memory point. I have tried several different ideas all of which have failed.

brave jungle
#

The carrier is 23m from sealevel if placed normally, use bis_fnc_setHeight. Thats what I did in a mission when I fell off once

smoky verge
#

when using X disableCollisionWith how can I disable X collisions with everything in the area?

winter rose
#

forEach

smoky verge
#

but is there something to specify "everything"?

winter rose
#

nope

smoky verge
#

welp
sounds like I'll have a fun 2 hours
maybe I can save my youth with layer names

winter rose
#

mind the locality, too

smoky verge
#

oh but I guess bullets would still hit it
or are they children of the units?

brave jungle
#

remoteExec πŸ˜‰

winter rose
#

@smoky verge bullets would hit

smoky verge
#

mhmm thats a problemo

peak bridge
#

How can I change just the radius of an addAction?

smoky verge
#

there is a radius parameter

brave jungle
#

just add the radius while making the action

smoky verge
brave jungle
#

no.9 if I remb right

restive leaf
#

You trying to create a aafe zone type thing @smoky verge ?

smoky verge
#

oh no
a large object that I've used attachto with has weird collision boxes and it obstructs the way

restive leaf
#

Ah, okay

peak bridge
#

Yeah, but I have to put in all the other params too 😒

smoky verge
#

they're all optional
so you can just do "","" etc

#

just have your radius at the right place

winter rose
#

an example below has all the default values

brave jungle
#

@peak bridge can use Nil as well, or just put in place what the default value is

#

Yeah that ^

#

Beat me πŸ™‚

winter rose
#

@brave jungle you cannot always use nil - this is a command, not a function

smoky verge
#

wrong tag

brave jungle
#

God all over the place aren't I haha

winter rose
#

"he is a bit confused, but he has the spirit" πŸ˜„

brave jungle
#

πŸ˜„

finite sail
#

I get like that a lot, but i prefer Belgian beer to spirit

brave jungle
exotic flax
#

What are you trying to do/get? Because that function just returns a path and nothing else (in short; give path, get path)

brave jungle
#

Here is my code extract:

  _groups = [];
  _configgroups = "true" configClasses (configfile >> "CfgGroups" >> _side >> _curSelFac >> "Infantry");
  {
    _groups pushBackUnique ([_x, "", true] call BIS_fnc_configPath);
  } forEach _configgroups;


  { lbadd [2102, getText( _x >> "name")];  } forEach _groups;

Im after every group of the selected side and then getting the display name and adding it to a list box

#

But just as I went to explain I don't actually think i need it anymore as i'm using a forEach loop in a path array already.

#

second pair of eyes would help here actually

exotic flax
#
_side = ""; // asume correct value
_curSelFac = ""; // asume correct value
("true" configClasses ((configfile >> "CfgGroups" >> _side >> _curSelFac >> "Infantry")) apply {
   lbadd [2102, getText( _x >> "name")];
};

Shorter and should work without storing data in one-use variables

#

In case you need pushBackUnique:

_side = ""; // asume correct value
_curSelFac = ""; // asume correct value
private _groups = [];
("true" configClasses ((configfile >> "CfgGroups" >> _side >> _curSelFac >> "Infantry")) apply {
   _groups pushBackUnique (getText( _x >> "name"));
};
{ lbadd [2102, _x]; } forEach _group;
brave jungle
#

Awesome i'll merge it in, thanks!

#

("true" is that supposed to be there? Theres no closing )

candid cape
#

Hi , I want to make an script that when you open your Inventory and your press the "ESC" it close the inventory

#

Can anyone helpme ?

exotic flax
#

@brave jungle the "true" part should be there, this is the fixed line:

("true" configClasses (configfile >> "CfgGroups" >> _side >> _curSelFac >> "Infantry")) apply {
#

@candid cape I'm not entirely sure, but I don't think that's possible without breaking the function of the ESC key in Arma itself (opening the menu)

candid cape
#

If you do it fast, it becomes a form of duping, because you open the inventory and quickly hit the "ESC", move your objects to a car and go out to the lobby. My idea is to do a "closedialog" or something similar to fix it @exotic flax

exotic flax
neon crane
#

as far as I can see you need to add your steam UID to the whitelist, did you do that?
@fervent kettle yeah

#

of course

brave jungle
#

@neon crane so you made a folder called scripts and added the unlock.sqf into it. You made an init.sqf file and added the whitelisted steam IDs in the array, keeping the " " etc. You've made sure the path exists? You made sure the init.sqf file is a .sqf file and not a renamed .txt file? Make sure file extensions is on via View >> View Filke extensions in windows explorer

#

If you've done all that

#

theres no reason why it shouldn't work

#

Unless like, the script is old/broken or something

spice arch
#

Anyone have any info about the evaluation of this line:
count alive units groupname
Been using this to check how many AI are still alive and the evaluation seems delayed by almost a minute sometimes

I.E. AI get killed, the count doesn't change until several seconds later despite multiple checks

finite sail
#

groupname is a group?

spice arch
#

yep

finite sail
#

count alive (units groupname)

spice arch
#

oh yeah sorry thats what I meant

finite sail
#

{alive _x} count (units groupname) is even better, i think

spice arch
#

does that resolve the issue of the alive status being delayed?

finite sail
#

probably not, but you need to get the syntax right first

spice arch
#

oh the script is working

#

the issue is just how delayed the updated count is

#

interestingly enough when I use the zeus interface to delete the units, the count updates correctly and immediately

#

but say I take a rpg and blow up the vehicle and units inside, it takes like ~20s-1m before the count updates

finite sail
#

what is the actual line of code you're using to count them?

spice arch
#

the only thing I can think of is it is somehow tied to how the AI don't always know a unit is dead until a status check is performed (5-5)

#

@finite sail
((((count units w1_inf1) + (count units w1_inf2) + (count units w1_inf3))/18) < 0.3)
I have this in the condition of a trigger

#

where w1_inf1 and ... is the variable name of a predefined group

finite sail
#

you cant count group members like that

#

oh wait, sorry, misread

spice arch
#

hmm maybe i need the alive command

finite sail
#

all your doing is counting the number of blokes in the group

#

{alive _x} count (units groupname)

#

count ((units groupname) select {alive _x})

#

if you prefer,

#

id go with the top one

spice arch
#

thanks man! I see what I did wrong.

finite sail
#

πŸ™‚

#

lev, you british?

spice arch
#

nope, US

finite sail
#

i think the delay in counting dead theory is a red herring

#

you know what red herring is?

spice arch
#

yes definitely, i was counting the group members which is a different thing

#

the system clears out dead guys on its own time

finite sail
#

true, but such a long delay is odd

spice arch
#

which was why the zeus deletion of units was working instantly, deletion = 0 units right away

finite sail
#

don't get distracted by that, im pretty sure the thing about group leaders being unaware of the death of their mates is not relevent here

spice arch
#

yeah, switching out the lines, wrong code = wrong thing being evaluated

finite sail
#

the script when working, is getting the actual status of the group members, not their status as perceived by the leader :)_

#

ok cool

#

ah i see, zeus was DELETING the units, not killing them

#

yes, i can see how that would mislead you

spice arch
#

yeah πŸ˜… , also when i killed them manually via play testing, the units persist for sometime. you can see the behavior when controlling the zeus interface, like the dead guys persist as being part of the unit for a little while

#

made me assume that the script was working fine but puzzled me on why it took so long to detect dead guys

finite sail
#

i dunno mate. a dead unit is a dead unit according to alive command

spice arch
#

yeah i left out the alive part πŸ˜