#arma3_scripting

1 messages · Page 165 of 1

pallid palm
#

roger m8

#

and in my mission script i tell all how Dart and you helpped me

granite sky
#

The issue with for/sleep is that sleep won't actually sleep for 0.01 seconds, so timing will be off.

#

Most likely it'll just sleep for one frame, or two if you have very high FPS.

faint burrow
#

uiSleep?

granite sky
#

Nah, the only difference with uiSleep is that it doesn't wait when paused in SP.

faint burrow
#

Thought that it's more accurate. I must have confused it with some other command.

granite sky
#

Because the SQF scheduler only runs once per frame.

#

In-line with everything else that happens in the main thread.

#

you can do while/sleep 0.001 and use diag_deltaTime, but as you can't guarantee that your code will be called every frame under heavy script load, it's not entirely safe.

#

you can use diag_tickTime instead but the accuracy goes if the server's been running for a long time. On the plus side that's not a huge problem in Arma.

#

Proper method is to use an EachFrame mission event handler.

#

(with diag_deltaTime)

willow hound
# willow hound Why?

Ah I got confused and thought you meant that sleep might suspend for less than the specified amount of time.

versed trail
#

Is there a scripting command to force AI to move forward for example? Waypoints aren't working for my intended use case

pallid palm
#

oh my yes awsome super cool woohoo Arma 3

#
if (isEngineOn Helo2) ExitWith {
    "Pilot:  BlackHawk  We CanNot Help  Wait One" remoteExec ["systemChat"];
};
#

god i love this game

open hollow
#

its posible to detect when the player started and ended listening a radio in TFAR?

i saw this eventhandlers, but ontangent but its local for the player.
https://github.com/michail-nikolaev/task-force-arma-3-radio/wiki/API:-Events

what i want to do is to play a sound when another player starts and end transmiting on the radio

GitHub

TeamSpeak integration for Arma 3. Contribute to michail-nikolaev/task-force-arma-3-radio development by creating an account on GitHub.

#

im not sure what OnRadiosReceived really does, i guess is an inventory thing

little raptor
versed trail
#

Does that actuall ymove them or does it just play the moving animation?

#

ah, I'm trying to do it for a vehicle specifically. dont think it would work that way

hallow mortar
#

You could try move. It's a bit lower-level than waypoints and sometimes works better.

#

If those are all numbers, vectorAdd

#

Don't use setPos + getPos. They're slow and use an inconsistent Z axis.

#

Try with getPosASL and setPosASL.

thin fox
#

Hello. I'm executing this code with remoteExec (client and server). It's a timer.
How come that on dedi this only works (timer showing for the client) if I call this script twice, literally?

tough geode
thin fox
#

waitUntil {([true] call BIS_fnc_countdown)};

tough geode
mellow jolt
#

I need some help with concating strings and then converting them into the right format to be read as a variable in a loop.

I'm making a group spawning script that I'm having do a bunch of stuff so I can split it later into simpler parts as needed. Issue I'm getting stuck on is naming each unit generated with a unique ID and then loading that ID into a generic variable I use later in the loop to assign skills, kits, random spawn dispersion, etc.

I keep getting the attached error about missing a ; which I think is because I'm trying to have the game read a string as a variable?

_unitCount = 5;
_groupID = createGroup OPFOR;

unitArray = ["vn_o_men_vc_01","vn_o_men_vc_02","vn_o_men_vc_03","vn_o_men_vc_04","vn_o_men_vc_05","vn_o_men_vc_06","vn_o_men_vc_07","vn_o_men_vc_08","vn_o_men_vc_09","vn_o_men_vc_10","vn_o_men_vc_11","vn_o_men_vc_12","vn_o_men_vc_13","vn_o_men_vc_14","vn_o_men_vc_15","vn_o_men_vc_16","vn_o_men_vc_17"];

Index = 0;
while { Index < _unitCount } do
{
    _unitIdentify = format["unit_%1 = this", Index]
    _unitID = format[unit_%1, Index];

    _unit = selectRandom unitArray;
    _unit createUnit [_dest, _groupID, _unitIdentify];

    _unitID setSkill 0.5;
    _unitID setSkill ["aimingShake", 0.15];
    _unitID setSkill ["aimingSpeed", 0.30];
    _unitID setSkill ["aimingAccuracy", 0.40];
    _unitID setSkill ["commanding", 0.40];
    _unitID setSkill ["courage", 0.40];
    _unitID setSkill ["general", 0.30];
    _unitID setSkill ["reloadSpeed", 0.30];
    _unitID setSkill ["spotDistance", 0.20];
    _unitID setSkill ["spotTime", 0.40];
    _unitID setSkill ["endurance", 0.40];

    Index = Index +1;
};```
mellow jolt
#

oh my god I'm dumb. I was looking where the # was, not at the end of the line

mellow jolt
tough geode
#

createVehicle
position: Object; Array format Position2D or PositionATL (PositionAGL if watercraft or amphibious) - desired placement position

#

Is helipad an object or just a postion?

mellow jolt
#

What's the issue you are hitting with addAction?

#

Sorry I meant the inventory clearing

tough geode
#

this addAction["Spawn MH-6", {createVehicle ["B_Heli_Light_01_F",helipad,[],0,"CAN_COLLIDE"]}] You could try it like this

tough geode
# mellow jolt Continuation error for mine. Now it seems I am getting a string instead of varia...

_dest = getpos tgt1;
_unitCount = 5;
_groupID = createGroup OPFOR;

unitArray = ["vn_o_men_vc_01","vn_o_men_vc_02","vn_o_men_vc_03","vn_o_men_vc_04","vn_o_men_vc_05","vn_o_men_vc_06","vn_o_men_vc_07","vn_o_men_vc_08","vn_o_men_vc_09","vn_o_men_vc_10","vn_o_men_vc_11","vn_o_men_vc_12","vn_o_men_vc_13","vn_o_men_vc_14","vn_o_men_vc_15","vn_o_men_vc_16","vn_o_men_vc_17"];

Index = 0;
while { Index < _unitCount } do
{
    _unit = selectRandom unitArray;
    _unitID = _groupID createUnit [_unit, _dest, [], 0, "NONE"];
    _unitIdentify = format["unit_%1", Index]
    missionNamespace setVariable [_unitIdentify, _unitID];

    _unitID setSkill 0.5;
    _unitID setSkill ["aimingShake", 0.15];
    _unitID setSkill ["aimingSpeed", 0.30];
    _unitID setSkill ["aimingAccuracy", 0.40];
    _unitID setSkill ["commanding", 0.40];
    _unitID setSkill ["courage", 0.40];
    _unitID setSkill ["general", 0.30];
    _unitID setSkill ["reloadSpeed", 0.30];
    _unitID setSkill ["spotDistance", 0.20];
    _unitID setSkill ["spotTime", 0.40];
    _unitID setSkill ["endurance", 0.40];

    Index = Index +1;
};

Beware that in MP if unit is created in remote group with older syntax, the unit init will execute on calling client sometime in the future, after the unit is created on remote client, therefore the following code will fail:

// real example of the bad code
"O_Soldier_AR_F" createUnit [position player, someRemoteGroup, "thisUnit = this"];
publicVariable "thisUnit";
hint str isNil "thisUnit"; // true!
// the unit reference is nil because init statement has not been executed on this client yet
#

Not actually sure the _unitIdentify = format["unit_%1 = _unitID", Index] part works
Think it should work to what i changed it just use getVariable to get the unit

#

But watch out spawning to helis like this will allow them to spawn inside each other 😛

mellow jolt
#

Can you post your addAction code?

mellow jolt
mellow jolt
#

testing an addAction that does what you want right now

tough geode
#

Shouldn't:

this addAction ["Spawn MH-6",{ _veh = createVehicle ["B_Heli_Light_01_F", getPosATL helipad, [], 0, "CAN_COLLIDE"]; clearBackpackCargoGlobal _veh; clearItemCargoGlobal _veh; clearMagazineCargoGlobal _veh; clearWeaponCargoGlobal _veh;}];

work ?

mellow jolt
#
["Spawn MH-6", 
 { 
   //added a variable name to the helicopter by adding a variable name and equals sign to the left
   _heliSpawn = createVehicle ["B_Heli_Light_01_F", getPosATL helipad, [], 0, "CAN_COLLIDE"]; 

   //clearing all the inventory item types
   clearMagazineCargoGlobal _heliSpawn;
   clearWeaponCargoGlobal _heliSpawn;
   clearBackpackCargoGlobal _heliSpawn;
   clearItemCargoGlobal _heliSpawn;

   //clearing the variable name from the helicopter so it doesn't cause any trouble later
   _heliSpwan = objNull;
 } 
];```
#

Ahh SLIN you're too fast for me

#

I added the // comments in discord. may not work in-game with those.

tough geode
#

@mellow jolt Can you explain to me why putting the unit in a Variable won't work for you didn't rly get you explanation ^^

#

Global commands are MP synchronized

#

Doing it normally will only clear it where the command gets executed ^^

#

Yeah in this case for the player using the action ^^

mellow jolt
#

Also, because it took forever for someone to tell me this, if you need to transfer information from an addAction into a script you have executing inside of it, add params ["_target", "_caller", "_actionId", "_arguments"]; inside the action like so:

["Something",
 {
   execVM "scripts\somthing.sqf";
   params ["_target", "_caller", "_actionId", "_arguments"];
 }
];```
The Params are automatically generated variable created by the `addAction` that can be passed to things inside to do various things.
#

.
For instance you can make a self destructing addAction by writing it like this so it notes it's own actionId and removes it as soon as it's done executing. (_target is the action holder)

["Recall Helicopters",
 {
   execVM "sequences\helicopterStart_2.sqf";
   params ["_target", "", "_actionId"];
   _target removeAction _actionId;
 }
];```
You could also have an `addAction` on an object that looked at who triggered with `_caller` it and use it as a booby trap to set off a script on someone who interacted with an object you place in the world.
#

oh I meant self destructing as in if you want the action to remove itself from whatever has it. Like a button you can only press once

#

that second addAction is for me as a zeus to let me have some helicopters lift off from an LZ once my players get out, but once they do, I don't need the action clogging up my menu, so it self destructs and deletes itself

mellow jolt
# tough geode <@291347127530029056> Can you explain to me why putting the unit in a Variable w...

sorry got distracted.

I'm not well versed with timing. I don't fully understand what you have under your correction of my code, but it sounds like there may be an issue where the unit variables may not be synchronized between players and the server possibly causing issues when I execute speak3d commands.

I'm making a (very late) horror op that has lots of audio based events and invisible entities using speak3d with individual speaker ID's so that I can stop them early if the players meet certain criteria or just because I'm trying to reuse as many audio files as I can and I stop them early in certain places. Having a unit variable get disconnected when trying to remoteExec to the players to cut that units speaker ID would be annoying if not immersion breaking in some spots.

tough geode
#

Make the Variable containing the Unit public and it shouldn't be a problem

_unit = selectRandom unitArray;
_unitID = _groupID createUnit [_unit, _dest, [], 0, "NONE"];
_unitIdentify = format["unit_%1", Index]
missionNamespace setVariable [_unitIdentify, _unitID, true];
_speakUnit = missionNamespace getVariable [unit_1, objNull];
mellow jolt
#

sorry, I've also not gotten my head wrapped around public and private variables yet. is it the use of missionNamespace setVariable that makes it public?

tough geode
mellow jolt
#

ahh I see

#

and having a player remote executing a function with setVariable in it set to public will cause them to phone home even though they are executing locally?

#

if set to true, the variable is broadcast globally and is persistent (JIP compatible) must cover that

tulip ridge
#

Yes, it is also set for the local machine

tulip ridge
tough geode
#

Yeah if the variable is set to public no matter which machine is setting the Variable it will broadcast to all clients + server. If you need the unit only known on the machin executing the code keeping it private is enough ^^

tulip ridge
#

Private and global are different

Global means the variable is in the global scope. Such as mission variables, variables on an object, etc.

#

Private is only for local variables, i.e. variables that start with an underscore

tough geode
tulip ridge
#
_localVar = 0;
private _privateVar = 0;

TAG_globalVar = 0;
missionNamespace setVariable ["TAG_syncedGlobalVar", 0, true];
mellow jolt
#

so the TAG_globalVar is accessible, but I would need to use getVariable or something to find it before I could call it?

#

if I wasnt on the machine that generated it

tulip ridge
#

Global variables can be accessed by just writing out the name if you're in that same namespace

So these two statements are identical (if running in missionNamespace)

TAG_globalVar = 0;
missionNamespace setVariable ["TAG_globalVar", 0];
#

The second one is mainly for if you need to sync a variable across machines, or if you need to set a variable in a different namespace

with missionNamespace do {
    TAG_globalVar = 0; // define var in missionNamespace
    uiNamespace setVariable ["TAG_globalVar", 0]; // define var in uiNamespace
};
pallid palm
#

hay @tulip ridge i just want to say, iv been trying for years and years, to have my chopper script run the way it does, after you helped me , it works so great, your the Best mate ever

tulip ridge
#

Nice, glad it's working for ya

pallid palm
#

thx you so much your the Best

mellow jolt
#

yeah, I've just started learning at the beginning of October and started on the effects side. I'm just recently coming around to the network side of things

pallid palm
#

i started learning 15 years a go and i still need lots of work

#

only thing i can do is help you with your GolfSwing he he

#

Arma 3 1st, Life 2ned, he he

tulip ridge
#

The box itself is where you can put code that will run when the vehicle respawns.

The tooltip shows what parameters are passed to the code you put in

#

Would be easier to use params ["_newVehicle"] but yeah

#

If you don't need to do anything extra with the vehicle, you can just leave it blank

thick hatch
#

It works. you are a savior.

slim trout
#

Hi guys. Im making a module for zeus to change the fog based on the setFog Array. Parameters of the fog are to be set by sliders. How can i read the choosen value from the slider to pass it over to private variable upon execution of the script, after i press the "OK" button to launch it?

#

I think i figured it out. Is it good?

#
_fogTime = sliderPosition 1900; _fogDens = sliderPosition 1901; _fogDecay = sliderPosition 1902;
_fogAltitude = sliderPosition 1903;

_fogTime setFog [_fogDens, _fogDecay, _fogAltitude]; ```
thick hatch
#

ANyone know where to find the mission config file?

#

As in, this thing;

#

I'm trying to add a font to my mission by putting the .paa & .fxy folder in my mission folder, then editing the config file to add it. But I can't find where to do that?

#

is in the init?

warm hedge
#

Mission's config is not Mod config

thick hatch
warm hedge
#

Yes

south swan
# thick hatch

you scroll down below the "configFile" part of tree to find "missionConfigFile" blobdoggoshruggoogly

thick hatch
#

could I run a command in my mission's init file to add a font?

#

or in my mission's config

warm hedge
#

No

thick hatch
#

;-;

#

So it has to be a mod?

south swan
thick hatch
#

Yeah I get it, sorry to be a numbskull lol
I'll pack it into a 1kb addon for my mission

still forum
#

looks good I'd say... but whats the range of the _fogTime slider? i guess its 0-1 but what when anyone wants a time bigger than 1 second

slim trout
#

im using sliderSetRange [1900, 0, 600]; inside module init upon GUI launch

#

so hopefully the slider range will be 0-600

#

didnt test it yet

tough abyss
#

Use systemChat str _var and diag_log _var to debug.

pallid palm
#

Copy that Be There in No Time---- WooHoo Arma 3 Yeah

#

oh no,,, we lost contact with the Aircraft WooHoo Arma 3 yeah lol

#

im having too much fun in Arma 3

#

what a great game

#

and what great help we have here on Discord

#

all my fun in Arma 3 is because of all the great guys that helped me here in discord, thx to all you guys you guys are so Awsome, i freeking love you guys

amber oriole
#

Good evening, please advise - writing a script for my mission to play random music when activating the radio, but arma gives an error, referring to “this” before “say3D”. And so with all methods of playing sound, the eternal error with this. Script:

private _sound = nil; 
this addAction ["Поймать радиостанцию", {
    if ((isNil "_sound") == true) then {
        _sound = this say3D format ["music\radio_music%1", random 4];} 
    else {deleteVehicle _sound}
;},nil, 1.5, true, true,  "",  "true",  3, false,  "", ""];

Thanks in advance!

still forum
# open hollow its posible to detect when the player started and ended listening a radio in TFA...

No. The ingame script doesn't know that there is a transmission coming in
That is fully handled inside teamspeak.
The game knows that another player is speaking, but not whether that speech is reaching you.

So you can detect when someone else is sending (Just add OnTangent on the player and remoteExec broadcast the information to other players) but not detect when player is receiving something.

tulip ridge
# amber oriole Good evening, please advise - writing a script for my mission to play random mus...

The statement of the code doesn't know what this is, because it runs in a different scope.

this addAction ["Поймать радиостанцию", {
    params ["_target"];
    private _sound = _target getVariable ["TAG_sound", objNull];
    if (isNull _sound) then {
        _sound = _target say3D format ["music\radio_music%1", random 4];
        _target setVariable ["TAG_sound", _sound, true];
    } else {
      deleteVehicle _sound;
    };
}, nil, 1.5, true, true,  "",  "true",  3, false,  "", ""];
amber oriole
tulip ridge
# amber oriole You're my savior! Thank you so much!

I made some other changes, such as removing the private _sound = nil;, because it doesn't do anything on its own, and the code inside the action doesn't have access to it anyway, so it does nothing.

This also saves the sound to the object making the sound, since it wouldn't have access to variables from a previous time it was used

hallow mortar
#
{heliArray select 0} lockInventory true;```
Wrong brackets type. You have used `{ }` which are for enclosing a Code data type. You should use `( )`, which are for forcing order of operations.
#

No.

tulip ridge
#

No

#

Just create the array before adding the action

#

Also that's a global variable, which means it should be prefixed / tagged.
If you're unfamiliar, it's just an identifier that's unique to you, the mission, the mod, etc. to prevent conflicts.

For example, BOT_heliArray, or whatever you would like

open hollow
tulip ridge
#

You're still doing {heliArray select 0}

#

Well yeah, you're doing pushBack [0, createVehicle ...]

#

pushBack always adds to the end of an array, it doesn't accept an index, if that's what you're trying to do

open hollow
#

pushback add it to the end

tulip ridge
#

So just do pushBack createVehicle [...]

open hollow
#
GAS_heliArray = [];
this addAction ["Remove Last Spawned", { GAS_heliArray deleteAt (count GAS_heliArray - 1) } ]; 

this addAction ["Request   MH-6", {
  private _v = createVehicle["B_Heli_Light_01_F", getPosATL GAS_helipad, [], 0, "CAN_COLLIDE"];
GAS_heliArray pushback _v;
 _v lockInventory true
}];

*dont use chatgpt 🫣 *

#

chaty trends to create weird syntax on sqf

#

Usually new ppl in this channel, asking why the code dont work... usually cames from chatGPT, nothing personal

#

not meant to be rude

#

if you are new scripting you are doing it really good 😄

thin fox
#

Don't blame him, a lot of ppl comes here with chatgpt scripts lol

open hollow
#

it has nothing wrong either, in other languages works quite well, just like in sqf it dont works at all

hallow mortar
open hollow
#

fixed the {}

tulip ridge
#

It's because the vast majority of code will be bad, that goes for any language.
ChatGPT just spits out the same stuff it finds, which causes a feedback loop of bad code being the most of what people see.

hallow mortar
#

FYI, array deleteAt -1 is not supported. That syntax does not support negative indexes and can simply silently fail if you try it.

#

Only syntax 3 (array of indexes) supports negative indexes. Try array deleteAt [-1].

tulip ridge
#

Also the statement of the second action only ever locks the vehicle of the first object in the array, not the last thing that was spawned

tranquil nymph
#

@slim trout How is your dialog opened?

tulip ridge
#
private _vehicle = createVehicle [...];
GAS_heliArray pushBack _vehicle;
_vehicle lockInventory true;
hallow mortar
#

It didn't. It doesn't say syntax 1 supports negative indexes.

tranquil nymph
#

Are you using BI's contrived dialog system and the module config property?

hallow mortar
#

Because the vehicle was deleted but the reference wasn't removed from the array (because deleteAt was silently failing), the last element in the array would just be a leftover objNull. Obviously attempting to delete that doesn't do anything.

#

Yes, originally negative indexes weren't a thing in Arma, so people got used to relying on the "silently fail when negative" behaviour. So when negative indexes support was added, it could only be added as part of a new syntax, to avoid breaking the old usage.

slim trout
#

Dialog works, pops out, even the function to apply the fog works. The only issue Im facing now is making sure the slider range is not default 1-10

#

Was thinking about writing a function for dialog opening

tranquil nymph
#

Ah I see

#

Yeah, having a function dedicated to initializing a dialog isn't a bad idea

slim trout
#

Yea. The one thing im facing right now is implementing the slidersetRange. Wrote a simple script like: sliderSetRange [1900, 0, 600]; sliderSetRange [1901, 0, 10]; sliderSetRange [1902, 0, 1]; sliderSetRange [1903, 0, 5000]; and then adding a line on onLoad = "_this call compile preprocessFileLineNumbers 'fogInit.sqf'"; seems not to work

#

will simple _x sliderSetRange [1900, 0, 600]; work?

tranquil nymph
#

Do like this:

params ["_display"];
_slider = _display displayCtrl <idc>;
_slider sliderSetRange [1900,600];
slim trout
#

idc is 1900

tranquil nymph
#

Since you're passing _this from the onLoad event, which contains the display

slim trout
#

and there are 4 sliders on this gui

tranquil nymph
#

Right, I'm only showing the basic principal 😃

slim trout
#

Yes, writing it right now, gonna paste here

#

To check if i got it.

tranquil nymph
#

It's more explicit this way, think the form where you use the idc rather than the control only works with createDialog

slim trout
#

Do i need one _display param per slider?

tranquil nymph
#

Nope, that's for the whole function

slim trout
#
params ["_display"];
_slider1 = _display displayCtrl 1900;
_slider2 = _display displayCtrl 1901;```
tranquil nymph
#

That won't work, it will only work when you call the function like so:

onLoad = "_this call compile preprocessFileLineNumbers 'fogInit.sqf'";
#

Since the display is stored in _this

slim trout
#

thats how im calling the script

tranquil nymph
#

but that event only fires after the dialog is created?

#

Wait, does createDialog raturn the display now?

#

Looks like a nope

slim trout
#

i got it like

#
{
    
    idd = 6000;
    movingenable = 0;
    onLoad = "_this call compile preprocessFileLineNumbers 'fogInit.sqf'";```
tranquil nymph
#

Inside your fogInit file is where you'd initalise the sliders

slim trout
#

yes

tranquil nymph
#

Using the code I gave it should work, I was confused because you posted _dialog = createDialog "Fog_Module";

#

Which wouldn't make sense inside the onLoad event 😛

slim trout
#

a yea, thats the optional thing

#

was going to delete the onLoad line and just launch the gui trough the function

#

which then would be added to zeus module

#

so adding params ["_display"]; _slider1 = _display displayCtrl 1900; _slider2 = _display displayCtrl 1901; to Fog_init

#

will work then?

slim trout
#

Works perfectly, thanks!

dire island
#

I'm trying to pass a local variable _r to an event handler:

_unit1 addEventHandler [
    "Killed", {
        systemChat "TEST STRING"; //this shows up in systemChat
        _r = _unit getVariable ["VLRS_AT_R",0];
        systemChat str _r; //this doesn't. I don't even get an error message that _r isn't defined, and I don't get "0" or "" either.
    }
];```
What am  I missing?
faint burrow
#

_unit is undefined in EH -- missed params ["_unit"];.

dire island
tulip ridge
cold pebble
#

Is there an EH/clean way to detect when somebody changes their FOV? aka scopes in/zooms in?

worldly kite
#

hi, in my clan a really big problem that some of them is a loot monster, always tries to loot enemy bodies. If i spot them from zeus i strike them with lightning, but most of the time i can't see it. Can someone share a script with me, when someone opens a dead enemy's inventory a zeus lightning strikes down? maybe a hint with the player's name would be great also

cold pebble
#

Yea works great, ty 🙂

tulip ridge
#

👍

cold pebble
#

Now my follow up, is there a clean way to find out if somebody is just zooming in with right click/+

tulip ridge
#

Not really

You could add an key handler for right click, but that's kinda meh

cold pebble
#

Yea I had a feeling it may come down to that, I'm trying to avoid locking anything to specific keys

#

That EVH for scoping is a great start tho

tulip ridge
#

Yeah there's zoomTemp and some camera actions

Can't grab specific ones easily on my phone, but you can just search for "camera" / "zoom"

cold pebble
#

I’ll have a look tomorrow, thanks for all the suggestions!

faint trout
#

Heya all, my marker that I create via create3DENEntity wont accept the Color change.

_mrk set3DENAttribute ["Color", ["ColorRed"]];
// or
_mrk set3DENAttribute ["Color", "ColorRed"];

wont work, does someone know a fix? 😄

little raptor
#

RGBA array

hallow mortar
#

"baseColor", not "Color"

#

Also, I'm really dubious of that claim about it being an array on the wiki. I don't think that's true. I think it's a string with a CfgMarkerColors class, like every other case where you manipulate marker colours.

mellow jolt
#

I'm having a ton of trouble with titleText, cutText, and valign.

I'm trying to fade out the screen, display one group of text of text at the top of the screen, add another below that without hiding the first, then add a third, and then fade all text and fade back in. I can't get valign to have any effect however and I can't work out how titleText and cutText is interacting as far as if they are overwriting each other or I'm just not using the cutText layer correctly.

This is the text script I'm working with right now

2 cutText ["", "PLAIN",0, true, true, true];
titleText ["", "BLACK OUT",3];
uiSleep 3;
1 cutText ["<t size='3'><t color='#ffffff' valign='top'>Lorem Ipsum</t></t>", "BLACK OUT",3, true, true, true];
uiSleep 6;
2 cutText ["<t size='3'><t color='#ffffff' valign='top'>Lorem Ipsum<br/><br/>Lorem Ipsum</t></t>", "BLACK OUT",3, true, true, true];
uiSleep 6;
1 cutText ["", "PLAIN",0, true, true, true];
2 cutText ["", "PLAIN",0, true, true, true];
titleText ["", "BLACK IN",3];```
#

the second text block being a repeat of the first with the second text section added is an attempt to solve the issue of the second cutText covering the first, but now neither of them are showing

pallid palm
#

holy cow wow

#

i just use BIS info TXT

#

mayb theres sonthing in here can help you

#

there many diff kinds of BIS fnc infoText

mellow jolt
#

I wasnt aware of that function, I'll have to look througyh them, but I have this text set to an audio track so the timeing is limiting

pallid palm
#

yeah i see im sorry m8 im not good enought to help you

#

mayb DART can help hes a super pro

mellow jolt
#

ooh, BIS_fnc_dynamicText looks promising

pallid palm
#

yes

#

can you just run an intro with music and txt in it

#

i put all that stuff in an Intro

#

and then give the player an optins to play the intro or not in the params

#

well that what i do anyway it may not be the best way

#

heres a small EX of 1 of my intros

#

i hope that helps you my brother

mellow jolt
#

BIS_fnc_dynamicText is actually perfect, but it looks like it's covered by titleText. Testing to see if I can work around it

#

Thanks for the tip

pallid palm
#

cool

#

rgr mate

#

or roger mate

mellow jolt
# pallid palm cool

Got it sorted, but it does require a few more pieces to keep the game from messing with the text and black out mask. Here's the final product if you want to use it in the future.

private _otl0 = ["otl_0"] call BIS_fnc_rscLayer;
private _otl1 = ["otl_1"] call BIS_fnc_rscLayer;
private _otl2 = ["otl_2"] call BIS_fnc_rscLayer;
private _otl3 = ["otl_3"] call BIS_fnc_rscLayer;
private _otl4 = ["otl_4"] call BIS_fnc_rscLayer;

//Fade out the screen, speech, environment, and sounds (leaving music for audio effect)
_otl0 cutText ["", "BLACK OUT",3, true, true, true];
ACE_Hearing_DisableVolumeUpdate = false;
3 fadeSpeech 0;
3 fadeEnvironment 0;
3 fadeSound 0;
uiSleep 3;

//lock in the fade out for the duration of the text
_otl0 cutText ["", "BLACK FADED",13, true, true, true];

//text blocks
["Lorem Ipsum", 0, 0.05, 13, 3, 0, _otl1] spawn BIS_fnc_dynamicText;
uiSleep 3;
["Lorem Ipsum", 0, 0.15, 10, 3, 0, _otl2] spawn BIS_fnc_dynamicText;
uiSleep 3;
["Lorem Ipsum", 0, 0.25, 7, 3, 0, _otl3] spawn BIS_fnc_dynamicText;
uiSleep 3;
["Lorem Ipsum", 0, 0.35, 4, 3, 0, _otl4] spawn BIS_fnc_dynamicText;
uiSleep 8;

//fade back in
_otl0 cutText ["", "BLACK IN",3, true, true, true];
3 fadeSpeech 1;
3 fadeEnvironment 1;
3 fadeSound 1;
uiSleep 6;
ACE_Hearing_DisableVolumeUpdate = true;```
#

This would be executed locally for each player using execVM

pallid palm
#

nice man cool

#

nice so i was able to finaly help some one cool'

proven charm
#

i wanted to use object as key for hashmap but it isnt supported. can I use "str object", is it reliable?

warm hedge
#

Depends on your situation. IIRC save/load and/or MP can make mess with it

proven charm
#

oh saving wont be a problem as the hashmap is recreated from time to time

warm hedge
#

I am not 100% sure about save/load but MP surely can do it

proven charm
#

ok

warm hedge
#

But if that's what you really want, you can reconsider the idea since setVariable can work

proven charm
#

setVariable how?

warm hedge
#

yourObj setVariable ["YourValue",0] can do the trick no?

proven charm
#

not sure i follow 🙂

#

you mean like create unique id for the object?

warm hedge
#

An object can accept setVariable, which basically do the same thing with HashMap'ing an object and store a value within, no?

proven charm
#

ah i see. but cant use that im building a list of objects

cosmic lichen
#

Just be aware that it changes between sessions

warm hedge
#

Wait, list of object? What it does mean

proven charm
warm hedge
#

And what is _key in this context?

proven charm
#

str object

warm hedge
#

That sounds what you really can do with setVariable

proven charm
#

sorry i dont get it XD. maybe too early here or something

#

but im happy with the current implementation

warm hedge
#

My theory:

  • devicesInEnemyBases being an array which stores objects
  • The objects within store values [_side,time etc] using setVariable
#

Mainly because I'm not sure how that HashValue workarounds can work 100%ly

proven charm
#

so you mean like creating a regular array and not hashmap where the objects are stored?

warm hedge
#

That's my suggestion/method

proven charm
#

ah ok

#

well hashmaps are fast so... i doubt performance is a problem

#

so if hashValue works im happy with that

faint burrow
#

If you're going to use devicesInEnemyBases in loops, it's better if it's an array.

proven charm
#

ok might change to that because I also need to delete the objects from the hashmap and I dont know if deleteAt works well in hashmap foreach loop

meager granite
#

if its a vehicle it will return group name of commanding unit

#

if you assign vehicleVarName later, it will change to that

#

hashValue object is the way to do it

proven charm
#

oh right, wont be using that then

faint burrow
proven charm
#

but you are using keys...

faint burrow
#

And?

meager granite
#

if object isn't null you can do _hashmap deleteAt hashValue _object

proven charm
meager granite
#

When I use objects as keys I sometimes add Deleted EH to the object so it cleanups the hashmap it was used in

proven charm
meager granite
#

CODE forEach HASHMAP has both keys and values in it as _x and _y

faint burrow
faint burrow
#

While iterating through them is possible with forEach, it is less efficient than looping through Arrays.

proven charm
#

hard decisions 😄

little raptor
warm hedge
#

forEachReversed at least

little raptor
#

So e.g. you should get the keys separately and loop over them, then check the values using get (in a separate container)

little raptor
warm hedge
#

Yeah just realized context

little raptor
#

Hashmaps don't have a "direction" exactly so...

#

It might work tho. Depending on the hashmap implementation

proven charm
little raptor
#

It can lead to stuff skipping for example
In the worst case it can lead to crash (don't remember how safe the engine looping was so could be either here)

proven charm
#

I'm surprised this code prints all the keys and doesnt skip anything ```sqf
_hm = createHashMapFromArray [["a", 1], ["b", 2], ["c", 3]];

{

systemchat format ["test %1", _x];

if (_x == "b") then
{
_hm deleteAt _x;
};

} forEach _hm;

meager granite
#

Can there be skipping with forEach HASHMAP? 🤔

meager granite
#

Oh yeah there can be

little raptor
#

The inner arrays can have skipping yeah

meager granite
#

Why order isn't guaranteed then though?

little raptor
#

Because of hashing

meager granite
#

Oh yeah, makes sense

#
h = createHashMap;
for "_i" from 1 to 10 do {h set [_i, _i]};
{h deleteAt _x} forEach h;
h
``` => `[[6,6],[10,10],[2,2],[4,4],[5,5]]`
#
h = createHashMap; 
for "_i" from 1 to 10 do {h set [_i, _i]}; 
{h deleteAt _x} forEach keys h; 
h
``` => `[]`
little raptor
#

Basically this is how the hashmap works in A3:
hash key, and % by buckets count to select an array (i.e. bucket), then put the key value in that array

meager granite
#

I was thinking that forEach does keys HASHMAP by itself already

little raptor
#

No it just iterates each outer array then each inner array

proven charm
#

weird question but are keys and *values * command return in correct order?

little raptor
#

They should yeah

#

Wasn't there a split command tho?

proven charm
#

just asking because hashmaps usually dont have order

little raptor
#

toArray

little raptor
proven charm
#

thats what i meant

little raptor
#

Well in this case you don't add anything so keys and values commands should iterate in the same order

proven charm
#

sounds bit hazardous 🙂

#

because i do deleteAt

#

like Sa-Matra pointed out

#

I will probably just use array then. thx for the help guys 🙂

still forum
#

str object is not reliable.
If someone uses setVehicleVarName, that changes

#

It seems that I am late to the conversation.

still forum
faint burrow
#

Then I think it makes sense to add, for example, word "slightly".

pallid palm
#

what would you use hashmaps for ?

#

what reason?

#

im trying to learn

winter rose
#

it is faster to lookup data from a hashed key (without having to parse through all items)

faint burrow
pallid palm
#

ahh i see ok thx Lou

meager granite
#
Searching 842 files for "createHashMap"
2114 matches across 116 files
pallid palm
#

wow i never use them before

meager granite
pallid palm
#

awsome

#

book mark lol

#

looks cool

#

i guess cuz i make 10 player missions i have hardly a need

winter rose
#

it does not matter the amount of players, but the systems used 🙂

pallid palm
#

copy that

#

i can see the need for this in a huge mission

hot sapphire
# pallid palm i can see the need for this in a huge mission

Hey buddy, if you understand data arrays, you will also understand Arma's HasMap basics in data structure that contains key-value pairs. Otherwise, there is no need to learn it and use this advanced system in a basic code. This is my opinion.

exotic gyro
#

Hashmaps aren't that advanced, they're just a tool that can be used for particular data

flint topaz
#

hashmaps are my friend

#

they keep me safe at night from all the unstructured data that lurks in the dark

winter rose
#

boo

winter rose
#

↑ ☝️ meowthis 👆 ↑

#

see pinned message 😊

brittle badge
#

yes realy. but i didt find something to that waht i need to do in forums

warm hedge
#

You have (un)fortunately this channel for such purpose

brittle badge
#

okey, let me explain

winter rose
#
  • what are you trying to achieve (different from "how do you want to do it")
  • where do you get stuck
    ideally, use steps (e.g "I want to get all soldiers around said vehicle, then if there is room for all of them put them in it")
warm hedge
#

tldr. You cannot jump into the conclusion

tulip ridge
#

Not even specifically, it's horrible for any programming language

#

Also TIL you can change what message you reply to with Ctrl and Up/Down arrow

brittle badge
# winter rose - what are you trying to achieve (different from "**how** do you want to do it")...

to put it very briefly, the following problem:
I've tried different ways to fix a bug for my Zeus scenario that keeps happening on my server.
To fix this bug, I have to spawn VirtualCurator_F a unit (preferably (Class C_Soldier_VR_F)) in the locked interface of (Class ModuleCurator_F) at the start VirtualCurator_F of the mission, which should not be defined as playable in the editor, but only serves to reflect the unit as Zeus. So that means, the unit should spawn at start, be the character/player unit of Zeus, but not be played by him or something like that, but should be the character of Zeus (immortalized and placed in the editor)

winter rose
brittle badge
# winter rose wait, rewind a bit, what is the bug? first things first 😄

on my server, when I load the addon EZM, I have the choice to create a playable character and join a side channel, as soon as I select (Create Character) it loads the character and puts me in the 1st person so I can't do anything more in any of my Zeus slots. Because he can't find a playerZeus to what he can apply it to. when I turn it off with the player spawn, then the EZM interface of zeus appears but plays an error code sound all the time and repeats in the bar at the top "FinalBiologic is now the game master"If it doesn't go away, I place a unit for taxation, but if it does, I never come back to the Zeus interface afterwards. Regular everything works on my mission I tried it for so long and also made my own watcher perspective after death for a few seconds. But for that I have to use "Respawn 3" in the description ext and turn off the respawn on start, which then leads to leads to an error code (because the respawn is only generated by Zeus) no respawn found, which then closes the circle. I can record a short video

winter rose
#

it's ok
but yeah it's a mod-related bug, so custom script workaround it is (unfortunately)
unless you can convince EZM to update their thing ofc 😄

brittle badge
#

my editor and script settings, in MP it works. but you see the error code in the left corner after start in MP. i will show now on server (i will put it on youtube and send a link thats better i think right?

faint trout
little raptor
#

So wiki is wrong then

little raptor
golden thicket
#

hey i was curious if it was at all possible to animate the rotor blades of a helicopter? what i'm trying to achieve is a crashed helicopter where the rotor blades are still spinning (ideally a bit slowly), i've specifically tried using

this animate ["hrotor", 0];

and have played with different values for it as well as animateSource and have dug into the config files and used animationNames to try different stuff to no avail, does anyone have any ideas?

vapid scarab
#

So i am dealing with this wierd problem.
When I call my function, it does not call the function. When called, it is expected to to exit early and re-spawn itself.
When I spawn the function it works fine.

Easy enough work around, just spawn the function.
But what is going on with it not even calling?

tulip ridge
#

Also diag_log doesn't return anything

#

And if it did return the message that was logged, you would log your message twice

vapid scarab
#

I think you missed the issue. The debug variable is undefined (because for some reason, my XEH_preinit function didnt run).
So if i call the function, it should get an error that the debug is undefined. It doesnt.
When I call the function, it does not call.
When I spawn the function, it does get called (rather, spawned) and it throws an error that debug is undefined.

tulip ridge
#

No, because you wouldn't get a pop up error for unscheduled (i.e. called) code

vapid scarab
#

.
Also, if set the debug variable, spawning will result in 2 logs, then an error cause im not passing any params
But calling results in no erros and no logs

tulip ridge
#

*in most cases

vapid scarab
#

I spawned it just now. I got my logs and errors.
I called it, i should get the first log at least, and if it works correctly, I should get 2 of the first log (call -> log -> exitwith into spawn -> log -> errors that end execution).
I dont get any logs. I dont get any errors (which I shouldnt get any errors? I didnt know call didnt throw errors)

tulip ridge
#

Yeah unscheduled code usually doesn't display pop up errors

The first thing I see is that you're setting message to the return of diag_log, which doesn't return anything, and then outputting that message.

But that shouldn't be any different between scheduled and unscheduled

vapid scarab
#

Oh i see. I didnt notice that... ops. But that will still log something. I still get the logs from spawning

#

ill retry now.

tulip ridge
#

I mean, it should return nil and then log nothing since the input is nil

#

diag_log having some return when running in scheduled would be... interesting

vapid scarab
#

_msg = diag_log format ['[BAX] (%1,%2) %3', _fnc_scriptName, LINE, "Drop Pod activation called: " + str _this];

_msg will be nil. But the right hand still executes and logs that

tulip ridge
#

I mean for the second diag_log / hint

vapid scarab
#

the stuff below wont, yeah

tulip ridge
#

Which you seemed to imply you were getting, but I could've misunderstood

vapid scarab
#

things are working better. I fixed the debug variable not getting initialized.

But the issue is still there.

#

I ran a diaglog that printed the debug variable value. It is set.
So the droppod function got called, it should hit that first debug log, logs to output.
Then it exits and re-spawns itself, log again twice, then start throwing errors because there weren't any necessary params and end execution at least.

Also, since it is getting re-spawn, shouldnt it start printing out those thrown errors on screen?

#

but there is not anything...

#

i might be doing something stupid. I am fine with the workaround. I just want to understand what is going on here that I dont understand, and what i mistake might be making

#

I am doing something stupid. But also something i have somehow never ran into before. I was just missing a ; that was stopping the call? I have never seen that before. Oops

tulip ridge
#

Odd, I thought syntax errors would cause errors on startup when they're compiled

You can also open the file in ADT (i.e. open the file so you can edit the copy) to check basic errors

vapid scarab
#

same. Another mistake is when i was testing with spawn, I was expecting errors since i was passing an object needed, so I just didnt read all the errors.

thin fox
#

Hello guys. Is it possible that the deleteTask function is so slow that can actually delete the created one in this code? (It's a PVP scenario, the same task can appears from time to time).
If I put a sleep in between the deleteTask and createTask functions, this does not happens (the task is not deleted)

mellow jolt
#

is there a way to define the size of an image use in a composeText command? I'm trying to display some images over a black cutText background, but my images just show up tiny.

private _otl01 = ["otl_01"] call BIS_fnc_rscLayer;

_text_1 = composeText ["", image "images\outro_1.paa"];

_otl00 cutText ["", "BLACK OUT",3, true, true, true];
uiSleep 3;
_otl00 cutText ["", "BLACK FADED",300, true, true, true];
[_text_1, 0, 0.5, 5, 2, 0, _otl01] spawn BIS_fnc_dynamicText;
uiSleep 5;
_otl00 cutText ["", "BLACK IN",3, true, true, true];```
#

There doesn't seem to be a way to apply formatting to the actual image instead of the text

hallow mortar
#

I'd suggest using an RscPictureKeepAspect UI control instead

mellow jolt
#

unfortunately it doesn't seem to

hallow mortar
#

Well no, not like that, use it in a structured text string, not with the image command

tough geode
# mellow jolt is there a way to define the size of an image use in a `composeText` command? I'...
private _otl00 = ["otl_00"] call BIS_fnc_rscLayer;
private _otl01 = ["otl_01"] call BIS_fnc_rscLayer;

_text_1 = parseText "<img size='1' image='images\outro_1.paa'/>";

_otl00 cutText ["", "BLACK OUT",3, true, true, true];
uiSleep 3;
_otl00 cutText ["", "BLACK FADED",300, true, true, true];
[_text_1, 0, 0.5, 5, 2, 0, _otl01] spawn BIS_fnc_dynamicText;
uiSleep 5;
_otl00 cutText ["", "BLACK IN",3, true, true, true];

Should allow you to change the size as needed

mellow jolt
#

sigh New issue. There seems to be a defined area in the center of the screen where the text/image can display no matter the size. What should I be looking into to overcome this? I assume it's a UI element?

#

Nevermind. I'll just make the text block taller

tough geode
#

It could look something like this

//Centered Version
private _otl00 = ["otl_00"] call BIS_fnc_rscLayer;
private _otl01 = ["otl_01"] call BIS_fnc_rscLayer;

_text_1 = parseText "<img size='10' image='\a3\Data_f\Flags\flag_Altis_co.paa'/>";

_sizeW = 150;
_sizeH = 90;
_otl00 cutText ["", "BLACK OUT",3, true, true, true];
uiSleep 3;
_otl00 cutText ["", "BLACK FADED",300, true, true, true];
[_text_1, [0.5 - pixelW * pixelGrid * (_sizeW/2), pixelGrid * pixelW * _sizeW], [0.5 - pixelW * pixelGrid * (_sizeH/2), pixelGrid * pixelH * _sizeH], 5, 2, 0, _otl01] spawn BIS_fnc_dynamicText;
uiSleep 5;
_otl00 cutText ["", "BLACK IN",3, true, true, true];

//Centered but lowered
private _otl00 = ["otl_00"] call BIS_fnc_rscLayer;
private _otl01 = ["otl_01"] call BIS_fnc_rscLayer;

_text_1 = parseText "<img size='10' image='\a3\Data_f\Flags\flag_Altis_co.paa'/>";

_sizeW = 150;
_sizeH = 90;
_otl00 cutText ["", "BLACK OUT",3, true, true, true];
uiSleep 3;
_otl00 cutText ["", "BLACK FADED",300, true, true, true];
[_text_1, [0.5 - pixelW * pixelGrid * (_sizeW/2), pixelGrid * pixelW * _sizeW], [0.9 - pixelW * pixelGrid * (_sizeH/2), pixelGrid * pixelH * _sizeH], 5, 2, 0, _otl01] spawn BIS_fnc_dynamicText;
uiSleep 5;
_otl00 cutText ["", "BLACK IN",3, true, true, true];
#

Switched the image so try it with your own ^^

mellow jolt
mellow jolt
#

The images I'm using are all the same page of text cut into blocks with transparent windows cut out so the end effect is a page of text fading in one paragraph at a time

tough geode
meager granite
#

I somehow have another client 20 seconds behind in serverTime thronking

#

estimatedTimeLeft fixed it, still very strange

lyric pasture
#

Hello. Does anyone know if it's possible to disable ace hearing in game through something like a function? Thanks you 🙂

tulip ridge
#

Are you not trying to disable it entirely or something?

The setting for it is how you can turn it off

lyric pasture
#

I'm wondering if there's a way where I can turn it off while in game but I think the menu seems like the only way.

proven charm
#

unless a new thread is created but why would that be done

#

maybe you need to use unique _taskID and not use the old one

keen orchid
#

is player action ["GunLightOff", player]; working? it doesn't seem to have any effect.

faint burrow
keen orchid
#

i thought that was for ai?

faint burrow
#

Didn't check.

keen orchid
#

doesn't seem to work sadly 😦

thin fox
#

the first time that that code runs, it works, the task is created normally, the second time, it creates a new one (you can see in the map) but less than a second later it gets deleted, then the third time works normally lol, forth time don't... and so on

thin fox
faint burrow
#

A workaround:

_taskExists = [_taskID] call BIS_fnc_taskExists;

[...] call BIS_fnc_taskCreate;

if (_taskExists) then {
    [_taskID, "CREATED"] call BIS_fnc_taskSetState;
};
thin fox
faint burrow
#

I think so.

thin fox
#

gonna test it out, thanks Schatten

thin fox
#

sad

faint burrow
#

Hm, works for me.

thin fox
thin fox
#

First time > task cancelled > second time (also it notify twice)

proven charm
#

i wonder why there isnt flatbed tempest? can this be done via script? I tried removing textures but it looked quite bad

golden thicket
fair drum
mellow jolt
keen orchid
#

i think my problems may just have been arma jank?

warm hedge
#

Kind of. Weapon mounted light/laser is lil bit janky feature

lyric pasture
#
 _particle = "#particlesource" createVehicle getPos player; //doing createvehicle and createvehicleLocal same result
_source1 setParticleParams [
            ["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 0, 8],
            "", "Billboard", 1, 3,                    
            [0,0,0], //start at 0 0 0        
            [0,0,0],                                
            0, 0.005, 0.003925, 0.1, [0.25, 0.75],        
            [[1,0,0,0.5], [0,1,0,1], [0,0,01,0.25]],    
            [1],                                    
            0, 0,                                    
            "", "",                                    
            player                                        
        ];
        _source1 setDropInterval 0.02;
        _source1 attachTo [player, [0, 0, 1]]; //doesn't do anything ```

This doesn't seem to be applying the attachTo.. Note sure, I'm new to particles and everything works fine except the attachTo
tulip ridge
cold pebble
#

Is there a reliable way to tell when a player enters and exits a UAV? Can't find any good eventhandler for it

cold pebble
#

I did see that, I guess I can just check _vehicle with iunitIsUAV

#

Probably as VisionModeChanged won't give an easy way to detect if you left the UAV

#

the note

fair drum
#
if (missionNamespace getVariable [QGVAR(disableVolumeUpdate), false]) exitWith {};

private _volume = GVAR(volume);

// Earplugs and headgear can attenuate hearing
_volume = _volume min GVAR(volumeAttenuation);

// Reduce volume if player is unconscious
if (lifeState ACE_player == "INCAPACITATED") then {
    _volume = _volume min GVAR(unconsciousnessVolume);
};

[QUOTE(ADDON), _volume, true] call EFUNC(common,setHearingCapability);

QGVAR(disableVolumeUpdate) extends to ace_hearing_disableVolumeUpdate

tiny shard
#

Hi there. Now CSWR has a Video Tutorial playlist. So, if you want to try, feel free the rise questions.
https://www.youtube.com/watch?v=kUdOFMLCy7k&list=PL9C3CUvV0NhM0HspcB9ajPNBj9lLy3ozN

CSWR is an Arma 3 script that allows the Mission Editor to spawn AI units and vehicles (by ground or air paradrop) and makes those groups move randomly to waypoints forever in-game.

Download the script (on GitHub):
https://github.com/aldolammel/Arma-3-Controlled-Spawn-And-Waypoints-Randomizr-Script

Download the Notepad++
https://notepad-plus-p...

▶ Play video
mellow jolt
#

Need some more help. Trying to figure out what I'm doing wrong with setGroupIdGlobal. When I use is in the following partial code I end up with strangely random group names like [any_any, any_18, any_14, Alpha 1-5, and_15]. The code works otherwise.

_groupVariablePrefix = "test"; // variable prefix used for groups created
_groupNamePrefix = "test"; // name prefix used for groups created
_unitVariablePrefix = "test"; // variable prefix used for units created
_unitNamePrefix = "test"; // name prefix used for units created
_groupsArray = [""];
_groupCountLoop = random [(_groupCount - _groupVariation), _groupCount, (_groupCount + _groupVariation)];

IndexGroup = 0;
while { IndexGroup < _groupCountLoop } do
    {
        _groupID = createGroup _groupSide;
        _groupVariable = format["_groupVariablePrefix_%1", IndexGroup];
        missionNamespace setVariable [_groupVariable, _groupID];
        _groupName = format["_groupNamePrefix_%1", IndexGroup];
        _groupID setGroupIdGlobal [format ["%1_%2", _groupPrefix, IndexUnit]];

        _groupsArray set [ IndexGroup, _groupName];

        _groupArray = [""];
        _groupMemberArrayName = [_groupVariable,"unitArray"] joinString "_";     
        _groupMemberArrayName = format["_groupMemberArrayName_%1", IndexGroup];
        missionNamespace setVariable [_groupMemberArrayName, _groupArray];

        IndexUnit = 0;
        while { IndexUnit < _unitCountLoop } do
            {
                _unit = selectRandom unitArray;
                _unitPrefix = _groupID createUnit [_unit, _dest, [], 0, "NONE"];
                _unitIName = format ["%1_%2_%3", _groupID , _unitPrefix, IndexUnit];
                missionNamespace setVariable [_unitIName, _unitPrefix];
                _groupArray set [ IndexUnit, _unitPrefix];
            };
    };```
lyric pasture
fair drum
placid spear
#

Was there any recent changes to how doWatch works? In the past I've been using it to get turrets/vehicle gunners to aim in a specific direction, but now once they look at it, they start glancing around. No additional AI mods are being used

fair drum
#

disabled related AI states?

placid spear
#

Relevant code block

    params ["_azimuthMils", "_elevationMils", "_gun", "_vrBlock"];
    _azimuthDegrees = _azimuthMils * 0.05625;
    _elevationDegrees = _elevationMils * 0.05625;

    _x = cos(_elevationDegrees) * sin(_azimuthDegrees);
    _y = cos(_elevationDegrees) * cos(_azimuthDegrees);
    _z = sin(_elevationDegrees);

    _directionVector = [_x, _y, _z];

    _vrBlockPos = getPosASL _gun vectorAdd (_directionVector vectorMultiply 1000);
    _vrBlock setPosASL _vrBlockPos;
    _gun reveal _vrBlock;
    _gun doWatch _vrBlock;
};```
#

Its frusterating, because as of 2 weeks ago, I was using this for mult-hour ops without the currently seen behavior

fair drum
#

try doTarget and use it on the gunner

placid spear
#

Yeah, tried those things as well. Stuff like mortars just ignore/don't point the tube correctly, and anything else won't shift targets to anything else

mellow jolt
lyric pasture
fair drum
#

my brother in miller... please refrain from saying things like this. this doesn't add to the discussion.

pallid palm
#

copy that

lyric pasture
fair drum
lyric pasture
lyric pasture
#

Yes

fair drum
#

one sec

fair drum
# lyric pasture I think that's still at 0,0,0. Even this doesn't work for me ```_particle attach...

remove attachTo

_particle = "#particlesource" createVehicleLocal getPos player;
_particle setParticleParams [
    ["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 0, 8],
    "", "Billboard", 1, 3,                    
    [0,0,1], // this is the offset for the reference object    
    [0,0,0],                                
    0, 0.005, 0.003925, 0.1, [0.25, 0.75],        
    [[1,0,0,0.5], [0,1,0,1], [0,0,01,0.25]],    
    [1],                                    
    0, 0,                                    
    "", "",                                    
    player // this is the reference object                                
];
_particle setDropInterval 0.02;
lyric pasture
#

I see I guess it's already attaching there.. I appreciate your help

fair drum
#

if you need to change it at any time, do something like this:

XAE_savedParticleParamsExample = [
    ["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 0, 8],
    "", "Billboard", 1, 3,                    
    [0,0,1], // this is the offset for the reference object    
    [0,0,0],                                
    0, 0.005, 0.003925, 0.1, [0.25, 0.75],        
    [[1,0,0,0.5], [0,1,0,1], [0,0,01,0.25]],    
    [1],                                    
    0, 0,                                    
    "", "",                                    
    player // this is the reference object                                
];

_particle = "#particlesource" createVehicleLocal getPos player;
_particle setParticleParams XAE_savedParticleParamsExample;
_particle setDropInterval 0.02;

XAE_savedParticleParamsExample set [5, [0,0,2]];
_particle setParticleParams XAE_savedParticleParamsExample;
lyric pasture
#

Yeah that's what I'm looking for, thank you!

remote cobalt
#

Hey Folks, I was working with GUIs for a while but with every iteration I realise I still struggle with them.

Does anyone know a good tutorial about GUIs that goes a bit deeper than just placing a text and a listbox?

The Wiki is nice, but leaves a lot of questions and what I found on YouTube was pretty simple.

I know, I have to work my way through the Wiki and I already did, but I was curious if anyone knew some good resources to read.

junior moat
#

hello! im making a function to use vehicle in vehicle loading for a basic logistics system for my mission. currently, i have a function that executes this code:

_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];
_sortedVehicles = [_vehiclesList, [], {getPos _objectToLoad distance _x}, "ASCEND"] call BIS_fnc_sortBy;


if (count _sortedVehicles > 0) then {
    _logisticsVehicle = _sortedVehicles select 0;
    if ((_logisticsVehicle canVehicleCargo _objectToLoad) select 0) then {
        _logisticsVehicle setVehicleCargo _objectToLoad;
    } else
    {
        hint "Vehicle can't load cargo";
    };
} else
{
    hint "There are no vehicles in 10 meters";
};

this works for all non-vehicle things (things like supply crates), but when trying to load an actual vehicle into another vehicle. it tells me that "Vehicle can't laod cargo". and i understand why this is happening, i'm just not 100% sure how to fix it. im assuming the nearEntities is also adding the vehicle to be loaded into the _sortedVehicles array. and obviously the nearest vehicle to that vehicle is the vehicle itself so its trying to load the vehicle into itself. my question is, is there any way to exclude that vehicle from the array?

Got it working! heres the code incase anyone is curious:

_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];
_sortedVehicles = [_vehiclesList, [], {getPos _objectToLoad distance _x}, "ASCEND"] call BIS_fnc_sortBy;
_logisticsVehicle = "";

if (_sortedVehicles find _objectToLoad == 0) then {
    _logisticsVehicle = _sortedVehicles select 1;
} else {
    _logisticsVehicle = _sortedVehicles select 0;
};

if (count _sortedVehicles > 0) then {
    if ((_logisticsVehicle canVehicleCargo _objectToLoad) select 0) then {
        _logisticsVehicle setVehicleCargo _objectToLoad;
    } else
    {
        hint "Vehicle can't load cargo";
    };
} else
{
    hint "There are no vehicles in 10 meters";
};
meager granite
#

Back in the day this was only available on VBS wiki but now on Arma wiki too

junior moat
#

hm, came across this issue when i try and load a vehicle into another vehicle using my script when there are no available vehicles for it to load into

sharp grotto
#

Then exit before you run the rest of the code if undefined ?

junior moat
sharp grotto
#

Put after line 10

if(_logisticsVehicle isEqualTo "") exitWith {hint "There is no Vehicle to load"};

So it will cancel if there is no vehicle to load

tender fossil
junior moat
#

its still giving me an error which is strange

tender fossil
#

I.e. if you select an element that doesn't exist in array, the variable becomes undefined

junior moat
#

also, _logisticsVehicle is defined before any of the If statements as "". wouldn't that mean that it should never be empty? or am i being incredibly stupid

tender fossil
junior moat
#

ah interesting

tender fossil
#

Especially this part sqf private _array = ["a", "b", "c", "d"]; _array select 0; // "a" _array select 3; // "d" _array select 4; // nil - no error shown _array select 5; // error in your case it might be the _array select 4 issue

#

Why does it work like that – no idea

hallow mortar
#

Just count the list of vehicles from nearEntities immediately after you generate it, and if it's 0, exit there

junior moat
#

cause thats still giving me an error, now on line 16, but still the same error that _logisticsVehicle is undefined

#
_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];

if (count _vehiclesList < 1) exitWith {hint "There are no vehicles within 10 meters"};
tender fossil
#

Post the whole function

junior moat
#
_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];

if (count _vehiclesList < 1) exitWith {hint "There are no vehicles within 10 meters"};
 
_sortedVehicles = [_vehiclesList, [], {getPos _objectToLoad distance _x}, "ASCEND"] call BIS_fnc_sortBy;
_logisticsVehicle = "";

if (_sortedVehicles find _objectToLoad == 0) then {
    _logisticsVehicle = _sortedVehicles select 1;
} else {
    _logisticsVehicle = _sortedVehicles select 0;
};

if (count _sortedVehicles > 0) then {
    if ((_logisticsVehicle canVehicleCargo _objectToLoad) select 0) then {
        _logisticsVehicle setVehicleCargo _objectToLoad;
    } else {
        hint "This vehicle can't load cargo";
    };
} else {
    hint "There are no vehicles within 10 meters";
};
hallow mortar
#

It's probably the "if sortedvehicles find objectToLoad then ..." part

tender fossil
#

The variable can still become nil here: ```sqf
if (_sortedVehicles find _objectToLoad == 0) then {
_logisticsVehicle = _sortedVehicles select 1;

hallow mortar
#

If the objectToLoad is the only object in the array, then it will be index 0, in which case you try to use index 1, which doesn't exist because there's nothing else there

junior moat
#

ah i see

hallow mortar
#

Why not just subtract the objectToLoad from the array as a first step?

junior moat
#

i added that part because previously, when i tried loading specifically vehicles into other vehicles, it was trying to load the vehicle into itself as it was the closest vehicle. so that was my solution to overcoming that

hallow mortar
#
_vehiclesList = _vehiclesList - [_objectToLoad];```
then count and exit if 0, and then you don't need any further checks to try and work around `_objectToLoad` being detected
junior moat
#
_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];
_vehiclesList = _vehiclesList - [_objectToLoad];

if (count _vehiclesList < 1) exitWith {hint "There are no vehicles within 10 meters"};
 
_sortedVehicles = [_vehiclesList, [], {getPos _objectToLoad distance _x}, "ASCEND"] call BIS_fnc_sortBy;
_logisticsVehicle = "";

if (count _sortedVehicles > 0) then {
    if ((_logisticsVehicle canVehicleCargo _objectToLoad) select 0) then {
        _logisticsVehicle setVehicleCargo _objectToLoad;
    } else {
        hint "This vehicle can't load cargo";
    };
} else {
    hint "There are no vehicles within 10 meters";
};

alright so i have this, you think this would work?

hallow mortar
#

You don't need the "if count sortedvehicles > 0" - you know that must be true because you counted it before sorting it

junior moat
#

gotcha

#

alright i have this:

_objectToLoad = _this select 0;
_vehiclesList = (getPos _objectToLoad) nearEntities [["Car", "Armored", "Air"], 10];
_vehiclesList = _vehiclesList - [_objectToLoad];

if (count _vehiclesList < 1) exitWith {hint "There are no vehicles within 10 meters"};
 
_sortedVehicles = [_vehiclesList, [], {getPos _objectToLoad distance _x}, "ASCEND"] call BIS_fnc_sortBy;
_logisticsVehicle = _sortedVehicles select 0;

if ((_logisticsVehicle canVehicleCargo _objectToLoad) select 0) then {
    _logisticsVehicle setVehicleCargo _objectToLoad;
} else {
    hint "This vehicle can't load cargo";
};

and it appears to be working great! thank you for all the help o7

hallow mortar
#

For a user QoL thing, you might want to make a distinction in response between vehicles that can load cargo (but are currently full) and vehicles that can't load cargo at all. At the moment you report both as just "can't load cargo", which could be misleading.
I'd suggest reporting the vehicle display name too, so the players can understand which vehicle is being detected as closest and reposition if needed.

junior moat
foggy stratus
#

I'm using setTerrainHeight to create a hole, and then placing objects in the hole. The center of the hole created is not the same as the position I give the command. This makes it difficult to decorate the hole. I remember reading somwhere that this command is driven by whatever the lowest cell size for a grid coordinate is for a given map (it those are the right terms). When I use this command, how can I find the true center of the hole created? Here is the commands I'm using:

#

_pos2 = _pallet modelToWorld [0,3,0]; _pos2 set [2,-.5]; (setTerrainHeight [[_pos2],false]) remoteExec ["call",2];

#

I think the answer may be to pass setTerrainHeight a position whose x/y coords are rounded to whatever the lowest cell size is for the map?

hallow mortar
proven charm
#

what if you create object in server and then do remoteExec on client and do something with the object, how do you know if the object is already created on the client?

#

can you check like isnull on the client to wait until the object is created?

fair drum
proven charm
#

yeah in not checking the variable but more of the object the variable points at

fair drum
#

are you using createVehicleLocal on the server?

proven charm
#

createVehicle

fair drum
#

then don't worry about it

proven charm
#

i thought i maybe trying to do something with the object before the object is created in client as well on the server

fair drum
#

i haven't had an issue with it. even down at the frame level

proven charm
#

hmm ok

fair drum
#

guess i can't say, "don't at least keep an eye out for it", but yeah, never had an issue

proven charm
#

i'll make some debug checks..

hallow mortar
#

Do you mean the server is sending a remoteExec to the client to do something with the object? If so, then you're fine - messages are handled in order, so the client will receive the object creation message before the remoteExec

proven charm
#

i wonder how that works though because the remoteExec cant be tied to the object creation

tender fossil
#

createVehicle has global effect so I guess the queue is handled by the engine, if that's what you mean

proven charm
#

yeah im sure it is. just question is when client also creates the vehicle

tender fossil
#

Before the remote exec at least

#

Like NikkoJT wrote above

proven charm
#

thats what you guys keep telling me 😁

tender fossil
#

It would be a nightmare if the order wasn't guaranteed on both ends. So I would assume that engine adds some kind of numbering to the actions getting sent over the network and that the receiving end respects the order of those

proven charm
#

true

tender fossil
#

Then again, BIKI says: "The order of persistent remote execution for JIP players is not guaranteed, i.e. the order in which multiple calls are added is not necessarily the order they will be executed for joining player." ...I wonder why that is...

proven charm
#

because of networking

hallow mortar
#

The order of live broadcasts is guaranteed, but remoteExecs for JIP are stored in a queue (separate from the JIP queue for other types of broadcast, apparently) which is not guaranteed to stay in order

#

I think this is bad, especially since it's inconsistent with the main JIP queue, but this is how it is

proven charm
#

i thought its because in net packets may get lost so the order of arrival may vary. not that i know which protocol arma uses

hallow mortar
#

Arma uses a system where some messages can be guaranteed: the sender will keep sending them until there is a report of successful complete receipt. Not all messages are sent like this, but important ones are.

proven charm
#

so in that case it may take a while before its successful

hallow mortar
#

"a while" is relative

proven charm
#

yes

hallow mortar
#

a client that's failing to receive this remoteExec will also be failing to receive any subsequent messages, so it will still be in order

#

er, or failing to receive the creation message. You know what I mean

proven charm
#

but its "normal" in some protocols to lose packets

tender fossil
hallow mortar
#

It's normal for some packets to be lost - and it's also normal to keep trying until those packets are received, if the packets are important.
Packets that aren't important (e.g. per-frame position updates) can be ignored if lost because the next update will force things back into sync anyway. remoteExec and object creation are important, so the engine makes sure they get through.

proven charm
#

makes sense

remote cobalt
#

Hey folks,

does anyone know a way to get the magazine size of artillery?

proven charm
remote cobalt
proven charm
thin fox
obsidian hornet
#

hi, trying to make a script template (to be used in public zeus) to make objects interactable such that if you interact with it a message will appear to all players.

so far i only have this script

this addAction ["ACTION", {hint "INSERT MESSAGE"}];

however when a player interacts with the object, the hint only appears to that one player.

stable dune
#

You need use remoteExec to broadcast that to everyone.
Hint is local event

proven charm
#

@remote cobalt this also seems to work: ```sqf
gun ammo (currentWeapon gun)

stable dune
#

Many examples, and you will easily get your hint for everyone,
And addaction event is local, it only will be executed on a client who used an event

remote cobalt
brittle badge
#

How can I spawn a waypoint for a unit via a trigger? that the unit only gets the waypoint when it has passed a trigger?

#

i dont use trigger often but now i make a escape mission and my normal missions ar zeus and warlords/zombie warlords

brittle badge
#

thanks

brittle badge
proven charm
#

you can make the waypoint to a specific coord: ```sqf

groupName addWaypoint [[11,222], 0];

pallid palm
#

hello friends would this set up work

#
if (local player) then
{
    //all this runs client
    //all this runs client    
    //all this runs client    
   //all this runs client
   //all this runs client
};
//Server Run
if (!isServer) exitWith {};
// this runs server
sleep 1;
Exit;
proven charm
pallid palm
#

oh ok

#

thx m8

#

i did not know that thx

blissful current
#

I need to write some code whose value returns the player closest to a group of AI that changed their behavior state (aware to combat).

Basically, I have a section in my mission where players have to sneak past a patrol. The trigger area condition is BLUFOR detected by OPFOR. When the players are spotted the player closest to the enemy patrol (the one most likely to have been spotted) will say "We've been spotted!".

I already have a solution for getting the player to speak. But I need a way to FIND the player that caused the behavior change. With my limited knowledge, I'm guessing I will be using some form of combo of findIf, (switchableUnits + playableUnits), and maybe an event handler for the AI behavior change.

proven charm
#

actually you probably meant if (hasInterface) then rather than local player

pallid palm
#

ok i try that thx friend

proven charm
#

because player is always local in client

pallid palm
#

this would be on a DED server

proven charm
#

player doesnt work in dedi

#

its client only command

pallid palm
#

oh shoot thats right

#

well at least im trying to learn

#

lol

#

ok thx m8 i start working on it right now thx you very much friend

blissful current
#

Awesome this seems like a great starting point!

brittle badge
# proven charm you can make the waypoint to a specific coord: ```sqf groupName addWaypoint [[1...

My problem, I can't find a tutorial or anything anywhere that helps me to figure out how to work with a trigger to get the following: I (as a player) run into a trigger, then I activate (me as a player) a waypoint that I have placed is displayed. As soon as I have passed this waypoint, the next waypoint takes place and the waypoint that lies on it should disappear again with the help of a trigger when it has been completed as visibility. This should be repeatable

proven charm
brittle badge
# proven charm not sure i follow. maybe you could tell what your trying to achieve?

A player abseils down from an airplane. He is now alone on the island without GPS, map, etc. He sees a waypoint in front of him and follows it. He reaches the waypoint. Now the waypoint is to disappear and a new one appear. The player follows these again. After reaching the waypoint, this waypoint should be removed from visibility. If the player respawns in the helicopter and has to abseil again. So the same thing must be repeatable.

flint topaz
proven charm
brittle badge
brittle badge
fair drum
#

Just now waking up and I'll help you when I come back to existence soon.

brittle badge
#

Thanks for any help 🫶🏻

fair drum
#

sorry for the delay, I pushed a patch to modules enhanced last night that broke the teleport menu cause I was dumb, so I had to fix that real quick. let me do a little write up for you.

you want to do it via trigger?
or have it progress automatically to next waypoint without triggers?

#

@brittle badge

brittle badge
#

over trigger yes

brittle badge
fair drum
brittle badge
fair drum
#

and are you going to have other waypoints in the system other than these trigger induced ones?

brittle badge
fair drum
#

make a discord thread for this

brittle badge
fair drum
#

that green lol

#

so the red guy at the top left is what we are working with?

brittle badge
#

You will see 3 waypoints that lead from the plane, to the island, up to the mountain and into a valley. These are now only used so that I can set the aircraft correctly, but these 3 waypoints will later be the ones I want to activate with triggers. the other 2 waypoints are for the plane. and the rest for a military convoy

fair drum
#

ok so the large diag waypoints will not be there in the end. what about that bio module? is that a waypoint or just a synced module?

brittle badge
fair drum
#

oh it looks like there is a waypoint under that module, nvm

brittle badge
visual bay
#

does anyone know if it is possible to hide the map grid lines with a script or mod? did not find anything on the internet

fair drum
blissful current
# blissful current I need to write some code whose value returns the player closest to a group of A...

Here's what I got so far. It looks okay but one thing that maybe wont work is the distance part. The wiki says it returns a number in meters but perhaps like this it will get the closest player? The other part I'm having trouble integrating is I dont want the code to run if the patrol group that spotted the players is dead within a few seconds. I wanna give players some breathing room here. I might have to just place this code block on the groups individually instead of the forEach.

// 3 groups players must sneak past
_patrolGroup = [group1, group2, group3];

// event handler checks for state changes
{
    _x addEventHandler ["CombatModeChanged", {
        params ["_group", "_newMode"];
        
        // Check if the patrol went to 'Combat' mode
        if (_newMode == "COMBAT") then {
            
            // Get the player closest to the patrol unit that triggered this
            private _players = switchableUnits + playableUnits;
            private _closestPlayer = _players select {
                _x distance _group
            };
            
            // Make the closest player speak
            [_closestPlayer, "We've been spotted!"] remoteExec ["say3D", _closestPlayer];
        };
    }];
} forEach _patrolGroup;
granite sky
#

The code in select needs to return a bool (true/false) so this won't work.

#

There is no good way to find the closest unit to a point in A3. I could suggest some bad ones.

blissful current
#

Hmmm well. How bad are we talking?

#

Does bad mean inconsistant?

granite sky
#

Also a group isn't a valid input type for distance

#

You need to pick a metric. Group center can be calculated manually, or use the leader.

#

Fastest method is probably:

private _leader = leader _group;
private _distances = _players apply { _x distance _leader };
private _index = _distances find selectMin _distances;
private _closestPlayer = _players select _index;
granite sky
#

Apparently that one is super spammy, but also an option.

blissful current
#

Spammy meaning?

granite sky
#

It fires a lot.

blissful current
#

Maybe there would be a way to activate it only at the time in the mission it is necessary?

granite sky
#

You could do something like use KnowsAboutChanged to record the unit, and then do your thing in the CombatModeChanged handler.

granite sky
#

You can even install an event handler within an event handler recursively and crash Arma :P

blissful current
#

I'm unclear of what the wiki says about KnowsAboutChanged. It says it returns numbers. What exactly is it checking for that's changed? AI behaviour?

granite sky
#

See knowsAbout

blissful current
#

Ahhh. This might work. I wouldn't need to check distances either so that could solve that issue.

#

Okay here's what I got:

// 3 groups players must sneak past
_patrolGroup = [patrol1, patrol2, patrol3];

// event handler checks for state changes
{
    _x addEventHandler ["KnowsAboutChanged", {
    params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
        
        // Check if the AI patrols know about a player
        if ((_targetUnit in (units playergroup)) && {_newKnowsAbout > 1.5}) then {
            
            _group removeEventHandler [_thisEvent, _thisEventHandler];
            // give players 5 seconds to kill patrol or else
            [_group]spawn {
                    params["_group"];
                    sleep 10;
                    if ({alive _x} count units _group > 0) then {

                     //Fail task
                    ["detected"] remoteExec ["hint"];
            };
          };
        };
    }];
} forEach _patrolGroup;
#

It will check the 3 patrols. if a patrol group sees the player then the player has 5 seconds to kill the group that spotted them or the task gets failed.

thin fox
blissful current
#

I asked chatGPT to check for errors and it wants me to change if (_group knowsAbout group player;.

thin fox
#

you must use spawn

blissful current
#

Is there a more intelligent AI for scripting help?

thin fox
fair drum
blissful current
#

So I wrapped the sleep and if statement with a spawn as suggested.

#

I think it's time to try this bad boi out.

thin fox
blissful current
#

Ah so I can pass that I think. I saw it does like this somewhere.

thin fox
#

yes

#

params["_group"]; also

#

or change _group (inside spawn) for _this, but remove [] from spawn
_group spawn {....

blissful current
#

Copy that. Launching.

thin fox
#

put like (_group knowsAbout (group player)) > 1.5

blissful current
#

I'm putting this in initServer

blissful current
hallow mortar
thin fox
#

so if is more than 1.5, it will return bool

blissful current
#

Ah this must be the _newKnowsAbout it says on the biki. That returns a number. I'm not sure how implement that tho.

blissful current
thin fox
#

yes, it was just an example

#

you could do something like this if you name your player's group:

if ((_targetUnit in (units playergroup)) && {_newKnowsAbout > 1.5}) then {....
blissful current
#

Actually yes I did previously name it playergroup.

thin fox
#

xD

#

avoid using player if you are playing MP

blissful current
#

Ah yes. I'm forgetful of that one. I've been told more than once that player doesn't exist on the server.

thin fox
#

but that EH of yours might not work

blissful current
#

I opted for your suggestion before even trying what I wrote. It works in SP. Now I'ma test in MP.

#

Okay I'm testing in a MP with a second client open. It appears the sleep isn't working. What I do is use Zeus to delete the AI group after they see the player group but the hint still gets sent almost immediately.

#

Hmm maybe the group not existing breaks it. I'll try to just kill them fast.

blissful current
#

Yeah this is the issue. If I kill them with the delete key it breaks it. I've been killing them with a gun and it seems to work. I guess end is different then.

hallow mortar
#

end is kill, delete is straight up deletion which is not the same as death

blissful current
#

Now for performance reasons what would be the easiest way to turn this off and on? I've gotten some experience with public variables. I kinda know how they work. Could I perhaps wrap the whole code block in an if statement in a variable like so?

if (PatrolSpotting) then {

// in the code I can then turn it off if it runs.
missionNamespace setVariable ["PatrolSpotting", false, true];
};
blissful current
#

Well, I don't want to delete it if the other patrols still haven't seen the players. But yes I guess after a certain point in the mission it isn't needed anymore.

blissful current
thin fox
blissful current
#

Ah, okay. And then if the player doesn't encounter the other 2 patrols then later in the mission I can just remove the EH for them in a trigger elsewhere.

thin fox
#

of course

thin fox
#

it removes the same EH for that unit/group

#

if has more than one

blissful current
#

Okay and since I have a different EH that isn't this type it shall not be effected if I specify the type.

thin fox
#

the thing is that you don't need the event ID in this command

thin fox
blissful current
thin fox
#

yes it should work

blissful current
#

Do event handlers "stop" after the condition is met? For example if the player is detected and runs away from the group that saw them. Is that group able to REDETECT them, or is the EH "complete" and wont do its thing again?

#

I guess the pure existence of removeEventHandler means they always run till you tell it to stop.

thin fox
#

until it's not removed, it will fire

blissful current
#

I guess I'm trying to figure out how to test that it has stopped firing to see if my code works.

#

Okay so I should break contact then rengage and see if I get my hint again. That will tell me.

thin fox
#

that way you can see if it stops firing

winter rose
blissful current
# thin fox put a `systemChat "test"`

Interesting. I tried it without the removeEventHandler and it only sent the systemChat twice, then never again. So perhaps it does turn itself off?

#

Oh maybe it was only once actually cause I remoteExec'd systemchat which might not be necessary.

thin fox
remote cobalt
#

Hey folks,

how can I check if a variable I am giving is a single object or an array?

Is there a way to check variables for their kind they are off?

remote cobalt
fair drum
blissful current
#

Now that I got that sorted I saved this part for last. I think it might be hard. Instead of the systemchat I want to have the group fire a flare into the air. I guess I need to make sure to put a flare in the groups inventory first. But how to actually make 1 person in the AI group fire the flare?

remote cobalt
fair drum
#

add the flare when you want to use it

#

or even easier, create the flare ammo, add velocity to it, and launch it in the air. now you dont even need to use AI

blissful current
remote cobalt
fair drum
#

or, use a handflare, then launch the unit into the air with a parachute 😉

blissful current
#

If possible I'd like the player to see the unit fire the flare for immersion. But I'll give up that idea if it's a PITA.

#

Or at least watch a flare go up.

#

Not necessarily watch the unit fire it.

#

I'd like to add a loud whistle if the in-game flare doesn't have one for auditory player feedback.

#

Ah, I see selectweapon and fire commands on the biki. So I guess I need to separate these by a sleep?

remote cobalt
# blissful current If possible I'd like the player to see the unit fire the flare for immersion. Bu...

Well, that falls under the category "is it worth it".

No code for you but how you would approach it (and I am not sure if this could work):

Spawn an object in the Air where you want the unit to shoot. Use createVehicle then setPos with the right height.

Then use doTarget for the unit you want to fire. This is needed for the next:

doFire: The unit fires onto the target.

Just before that, use the selectWeapons function.

Not sure if this could work, but its worth a try

#

Also, selectWeapon could give you some trouble. A safer approach could be to remove every weapon from the character and just give him a flare gun.

flint topaz
tulip ridge
# remote cobalt Or you can spawn Flares above the group just falling down: ```sqf if (!isServer...

You can just use vectorAdd, and also create _flarePos outside of the loop to not create the same array multiple times


if (!isServer) exitWith {};

params ["_pos", "_number", "_delay"];
private _flarePos = _pos vectorAdd [0, 0, 90];

for "_" from 1 to _number do {
    private _flare = createVehicle ["Sub_F_Signal_Red", _flarePos, [], 0, "FLY"];
    _flare setVelocity [random 2, random 2, 0];
    sleep _delay + (random 5);
};
blissful current
#

Ill try removing his kit.

thin fox
#

if you manage to do this flare thing, tell me cuz I want it too lol

blissful current
thin fox
fair drum
#

so does LAMBS

thin fox
fair drum
#

this is a good idea for an environment effect for Modules Enhanced. I'm gonna go make a repeatable ambient flare launcher. except i'm actually going to create and launch, then detonate the shell.

lost grove
#

any easy or straightforward way of converting Dir and Up to XYZ degree values,
like converting Dir [1,0,0] and Up [0,0,1], to Rot [90,0,0]

fair drum
#

there are some pitch bank functions that do the math for you

abstract bay
#

one group has a "retreat" code if a certain number of soldiers are killed, it works but only when it finishes its current waypoint and then retreats, and I want it to remove the current waypoint and retreat immediately? this doesn't works: ```private _fnc_retreat = {
params ["_group"];
waitUntil { sleep 1; {alive _x} count units _group <= 3 };

{
deleteWaypoint _x;
} forEach waypoints _group;

_wpp = _group addWaypoint [getMarkerPos "escapepoint", 0];
_wpp setWaypointType "HOLD";
_wpp setWaypointSpeed "FULL";
_wpp setWaypointCombatMode "BLUE";
};```

merry shard
#

Hey guys, a while ago someone gave me this teleport script to tp everyone in an area trigger. I'm trying to reverse-engineer it and use it to only send a hint to the player(s) that are in an area trigger ("beepzone" is the trigger's var name). What would I replace the teleport parts with? Or is there an easier way to do this?

    _x inArea beepzone;
};
private _teleportPos = getPosASL destination;
{ 
    _x setPosASL _teleportPos; 
} forEach _players;```
lost grove
# merry shard Hey guys, a while ago someone gave me this teleport script to tp everyone in an ...

private _players = ([] call CBA_fnc_players) returns an array of all players in the server,
select { _x inArea beepzone; }; limits this array to players just inside a trigger called beepzone
private _teleportPos = getPosASL destination; just stores a destination value (where all the players get teleported)
{ _x setPosASL _teleportPos; } forEach _players; in a foreach loop, '_x' represents the current element, this code is what actually teleports people

merry shard
fair drum
#

once given a velocity with setVelocityModelSpace how do we allow the engine to take over velocity physics again?

hallow mortar
#

It immediately does, next frame

fair drum
#

for CfgAmmo things (in this instance, flares, F_40mm_Green) it doen't seem to. its locked at [0,0,0] once set

#

and if you use [0,-10,0] its locked at -10, gravity doesn't effect it

#

just sits there lol

remote cobalt
# blissful current I see what you mean. He took out the flare gun (me: Yay it works!) only to then ...

Yeah, overwriting the Ai behaviour is impossible without modding and deep AI knowledge. And even with that, when the AI has entered some fsm, they never gonna leave that no matter what you do. This has been the bane of many mission makers, and even some of the best AI modders.

That's the reason most people here would recommend to go for the "spawn" option, if with velocity up or just starting them in the Air, doesn't matter.

Regarding the air spawn: Most flare ammo would fly high up without flare and then fire the flare load after a few seconds (so it's not that unrealistic). If you want to give it a little extra nudge, play some sounds with playSound3D when the flares are fired.

winter rose
fair drum
#

okay, so if given a velocity of 0, it breaks, but when given a value other than 0, say -10, it stays at -10 velocity until the flare engine code starts, then will be taken over by gravity physics.

merry shard
open hollow
#

there is way to detect granades? ive tryed both nearentities and nearobjects but cant detect them

hallow mortar
#

Make sure you're searching for the CfgAmmo class, not the CfgMagazines class (e.g. magazine HandGrenade fires ammo GrenadeHand)

open hollow
pallid palm
#

Hello friends
If (i have a script, that has a spawned in chopper called _Heli, on a DED Server) then
{
How can i teleport to The _Heli, from a Flagpole that has a Addaction in the Flagpole
};

#

every one is Sleep 7hrs; i guess🙂

lost grove
#

to The Heli, or IN the heli

pallid palm
#

in the Heli

lost grove
#

moveInCargo

pallid palm
#

tyes

#

but it seems to not see the _Heli

#

so would it be moveInCargo _Heli

lost grove
#

kinda

#

player moveInCargo _heli

pallid palm
#

oh yeah lol ofcorse

#

ok i try it

#

thx m8s

pallid palm
#

it keeps saying Error Undefined variable in expression: _heli

#

and the script clearly say _heli is difined

#

hmmmmm

lost grove
#

show full script

tulip ridge
pallid palm
#

// this is my telepot script that get execVM from the flagpole
if (!hasInterface) Exitwith {};

if ((Alive _Heli) && (CanMove _Heli) && Alive Pilot2 && (_Heli emptyPositions "CARGO" == 8)) then {player moveincargo _Heli} else
{
"Waiting For Empty CargoPosition On BlackHawk" remoteExec ["hint", 0];
if ((!Alive _Heli) or (!CanMove _Heli) or !Alive Pilot2) then
{
"HQ Chopper Is Down Wait ONE" remoteExec ["hint", 0];
};
};

#

oh ok i see so ummm

lost grove
#

there is no _heli

pallid palm
#

oh no

tulip ridge
#

You don't define _heli in that script

pallid palm
#

oh ok so

#

hmmm

#

so i must defin _heli in the script ?

#

so mayb i can use the class name in the script

lost grove
#

nope must be object

pallid palm
#

hmmm

#

there smoke coming out my ears lol

#

man i should do drugs lol

#

no lol

#

so mayb i can change the _Heli to Helo

#

or Helo1

lost grove
#

unless that is an object referance, it likely won't work

#

try using the varable name of the object

pallid palm
#

yeah so in the chopper script i should change the _heli to Helo1

#

then in my teleport scrtpt also

#

Dart said Variables that being with an underscore are local variables, meaning they are only defined in that scope

#

hmmm

#

its not really that important that i can teleport to the chopper i was just wanting to do so

#

is there away i can pass the _heli to my teleport script

lost grove
#

when you put an underscore in scripts, it doesn't inherently do anything, it just clarifies things so you dont mix up _vectorDir with the actual vectorDir command, its a good habit

pallid palm
#

ok cool

#

so i can change _Heli to Helo1 lets say in the chopper script

lost grove
#

it should work?

pallid palm
#

ok cool ill try it

#

thx again friends love you guys you guys make my game work and make my day

tulip ridge
#

All local variables have to start with an underscore

#

For another example:

params ["someVar"]; // Error: invalid local variable name
pallid palm
#

ahh haaa it worked thx m8s

#

i see yes cool

#

ahh ok yes thx Dart you da man

#

Dart is a super pro i love him

#

where would we be with out him

#

id be w8ting on the tarmack lol

#

ok im back in the editer bb soon

brittle badge
# winter rose can I haz a smol summary of the issue plz?

The problem has been solved for now, another problem still exists but I will explain that later, I have to go now. I'll be back in the evening. It was about me as a player walking into a trigger and then activating a waypoint with a restriction of e.g. 100 meters activation completion

#

It's under thread "FinalBiologic help"

mortal pelican
#

just to be sure, since i've never really done a lot of arma 3 scripting. this should just work, right?

#

like, i don't need to do anything else to make it so that when this unit is damaged, the independents become hostile to blufor

#

and same here, this'll just delete the respawn position, right?

pallid palm
#

man thx text is so small i can hardly see it

#

i guess i can see it

mortal pelican
#

first one is
Damaged
independent setFriend [west, 0]
second one is
Deleted
farmspawn call BIS_fnc_removeRespawnPosition;

remote cobalt
#

Hey folks, I am stuck with groups and groupIDs and I was hoping someone could help me.

I am writing a teleport script with a GUI. That contains a list of all playergroups and a button to teleport to the selected group.

We earlier did this with predefined groups but now I was curious if I could get it working without that.

In the listBox of the GUI there is the name of the groupID and as data the group as string.

#

getPlayerGroups:

#
_groups = [];

{
    _groups pushBackUnique (group _x);
}forEach allPlayers;

{
    lbAdd [1000, (groupID _x)];
    lbSetData [1000, _forEachIndex, str _x];
} forEach _groups;
#

The teleport function would look like this;

#
_index = lbCurSel 1000;
_teleportGroup = lbdata[1000, _index];

hint _teleportGroup;

// Get the group Variable from String from listbox
_group = missionNameSpace getVariable _teleportGroup;

//Get a unit from the group to teleport to
_target = units _group select 0;

//Check if you are the target
if (_target == player) then {
    if (count (units _group) < 2) then {
        hint "You are the only member of this group. Select another Group";
    }
    else {
        _target = units _group select 1;
    };
};


if (vehicle _target == _target) then {
    _centre = getPos _target;
    _teleportLocation = [];
    _max_distance = 2;
    while { count _teleportLocation < 1 } do
    {
        _teleportLocation = _centre findEmptyPosition [1, _max_distance];
        _max_distance = _max_distance + 2;
    };
    
    player setPos _teleportLocation;
}
else {
    if ((vehicle _target) emptyPositions "cargo"== 0) then
        {hint "No room in vehicle. Wait until your Group dismounted."}
    else {
        player moveincargo vehicle _target;
    };
};
#

The teleport function does not work, because "missionNameSpace getVariable _teleportGroup;" gives back a String of the group, for example "B Alpha"

Even though this is what "group" returns, it is not enough to use this as a data type, because "units _group" doesn't return anything.

Does anybody have an idea what I am doing wrong here or how I could get this to work? Feels like I am missing something important here that maybe has to do with objects and variables, but I am right now at a loss.

cosmic lichen
#

You got a reference to the group in your local variable already.

#

Make that global or store it in the display.

#

The index of the group is identical to the index of the selected row, provided the player can't sort it.

lost grove
#

you want to look at the command "UID" call BIS_fnc_getUnitByUID so you can pick individual players by their steam ID's rather than thier group.

also look at the moveOut command, so you can teleport players, even in vehicles!

south swan
#

lbSetData [1000, _forEachIndex, str _x]; wot

remote cobalt
#

@cosmic lichen I am sorry. I can't follow completely. You talking about the _teleportGroup variable?

south swan
#

lbSetData [1000, _forEachIndex, >>str _x<<]; here you convert Group to String which breaks it. Because you can't convert String representation back to Group blobdoggoshruggoogly

remote cobalt
south swan
#

you can setVariable on UI controls

remote cobalt
#

That was why I was using: missionNameSpace getVariable _teleportGroup

south swan
#

why would there be a variable named that?

remote cobalt
#

Because I would get it from the ListBox?

thin fox
south swan
#

and why should missionNamespace have a variable named after a random string of characters?

#
displayCtrl 1000 setVariable ["groups", _groups];
{
    lbAdd [1000, (groupID _x)];
} forEach _groups;

...

_index = lbCurSel 1000;
_teleportGroup = displayCtrl 1000 getVariable "groups" select _index;

// do whatever you want with that group```
thin fox
#

don't forget about UI event handlers eh, it's useful

south swan
#

i don't see how EHs relate to data storage, tbh

thin fox
remote cobalt
proven charm
#

I'm curious of what kind of script errors stops executing a script? seems like the scripts are continued to run after error but if there is like error in the while condition then the loop wont run

blissful current
# remote cobalt Or you can spawn Flares above the group just falling down: ```sqf if (!isServer...

After messing around for a couple hours without progress I decided to play around with your code. I trimmed it down because I just need one flare to fire and the code is in initServer so I dont need the exitWith. I get an error tho. I think it's because its looking for a position to put the flare and doesnt know where. So could I use the param _group to get the base position?

// 3 groups players must sneak past
_patrolGroup = [patrol1, patrol2, patrol3];

// event handler checks for state changes
{
    _x addEventHandler ["KnowsAboutChanged", {
    params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];
        
        // Check if the AI patrols know about a player
        if ((_targetUnit in (units playergroup)) && {_newKnowsAbout > 1.5}) then {
            
            //removes EH from the specifc group
            _group removeEventHandler [_thisEvent, _thisEventHandler];
            
            // give players a few seconds to kill patrol or else
            [_group]spawn {
                    params["_group"];
                    sleep 5 + (random 5);
                    if ({alive _x} count units _group > 0) then {
                        
                    //fire flare
                    params ["_pos", "_number", "_delay"];
                    _flare_pos = [(_pos select 0), (_pos select 1), (_pos select 2) + 90];
                    _flare = createVehicle ["Sub_F_Signal_Red", _flare_pos, [], 0, "FLY"];
                    _flare setVelocity [random 2, random 2, 0];

                    //subtitles and task failure
                    ["playersspotted", [objNull]] remoteExec ["FoxClub_fnc_Conversation"];
                    missionNamespace setVariable ["PlayersSpotted", true, true];
            };
          };
        };
    }];
} forEach _patrolGroup;
#

_flare_pos = [(_pos select 0), (_pos select 1), (_pos select 2) + 90];
Basically this part is what I don't understand. What position is the param _pos? Is it the players' position? The enemy group?

cosmic lichen
#

Does that even work?

blissful current
#

Which part? Everything seems to work minus the flare.

cosmic lichen
#

Yeah, because that params is wrong

hallow mortar
#

At the moment it's nothing. It's not defined. That params was never given any new inputs, it's still working from the spawn's arguments (i.e. _group).

blissful current
#

Is it cause it's in the spawn? Maybe I need to pass it first?

cosmic lichen
#
{
    _x addEventHandler ["KnowsAboutChanged", {
        params ["_group", "_targetUnit", "_newKnowsAbout"];
        
        // Check if the AI patrols know about a player
        if ((_targetUnit in (units playergroup)) && {_newKnowsAbout > 1.5}) then {
            
            // Removes EH from the specifc group
            _group removeEventHandler [_thisEvent, _thisEventHandler];
            
            // Give players a few seconds to kill patrol or else
            [_group]spawn {
                params["_group"];
                sleep 5 + (random 5);
                if ({alive _x} count units _group > 0) then {

                private _pos = getPosATL leader _group;
                _pos = _pos vectorAdd [0, 0, 90];

                private _flare = createVehicle ["Sub_F_Signal_Red", _pos, [], 0, "FLY"];

                _flare setVelocity [random 2, random 2, 0];

                //Subtitles and task failure
                ["playersspotted", [objNull]] remoteExec ["FoxClub_fnc_Conversation"];
                missionNamespace setVariable ["PlayersSpotted", true, true];
            };
          };
        };
    }];
} forEach _patrolGroup;
hallow mortar
#
_flare_pos = [(_pos select 0), (_pos select 1), (_pos select 2) + 90];```
You can make this line simpler by using `vectorAdd` instead
median mortar
#

Hey, can I have a script for placing arsenal to NPC? Also disable any of his movements

#

Please

hallow mortar
blissful current
hallow mortar
#

The leader of the group changes when the previous leader dies. There can only be no leader if there are no living units, in which case the script stops before that anyway.

median mortar
cosmic lichen
#

@blissful current I have updated the code, formatting and unused vars

hallow mortar
#

Even if it did pick up a dead leader somehow, it wouldn't break, because it doesn't rely on the leader being alive. It might look a bit odd that the flare appeared over the leader's dead body, but that's basically fine.

hallow mortar
#

You probably want to use it in "AmmoboxInit" mode.

blissful current
#

What is the benefit of vector add? Im looking at the wiki and dont understand.

cosmic lichen
#

It's faster and simpler

hallow mortar
#

It's easier to read, and faster because there are less commands.

cosmic lichen
#

It just adds two vectors [1,1,1] vector add [1, 1, 1] becomes [2,2,2]

blissful current
#

It seems to add numbers together. So what is it doing to the flare?

cosmic lichen
#

It adds the elevation

blissful current
#

so 0 + 90 is 90?

#

Like that?

cosmic lichen
#

Yes

hallow mortar
#

It's doing exactly the same thing as the code that was previously there with the _pos select 0 etc, but better.

#

It takes the position of the leader, which is a 3-element array in format [x, y, z], and adds 0 to every element except the z axis, where it adds 90.

blissful current
#

I understand that this code grabs the leader position.

private _pos = getPosATL leader _group;
                _pos = _pos vectorAdd [0, 0, 90];

But how does this also grab the leader position?

_flare_pos = [(_pos select 0), (_pos select 1), (_pos select 2) + 90];
cosmic lichen
#

It doesn't, that was missing before

#

I added private _pos = getPosATL leader _group;

hallow mortar
#

In the very first version, it didn't, because the code was written with the expectation that you'd figure out _pos yourself and provide it as an argument.

blissful current
#

Ah Okay then I get it now. vectorAdd is indeed easier to read. Thanks so much for explaining yall.

#

It spawns 3 white trails for a couple seconds. I see in the code it should be red though.

#

Is it default behavior to just be a few seconds as well?

#

Can playSound3D "move" so that I could mimic a whistle sound moving from the ground to 90 meters up?

blissful current
#

How can I look up other classes to choose from? I can guess what might be appropriate but that seems inefficient.

hallow mortar
#

You can open the Config Viewer and look in CfgAmmo (with Advanced Developer Tools loaded, ideally). Look for flare projectiles, and their submunitions if they have any.

#

One thing to note is that the flares are described according to their light colour. A flare that burns with a red light may not generate red smoke. Vanilla flares don't show up particularly well in the day.

blissful current
#

That is supposedly F_40mm_Red

hallow mortar
#

Now try it at night

blissful current
#

There is a slight glow of red. Eh, whatever, lol. On to the next thing. Can I playSound3D "move" so that I could mimic a whistle sound moving from the ground to 90 meters up?

tulip ridge
#

Oh wait I'm thinking of say3D

blissful current
#

Oh interesting. Does F_40mm_Red count as an object?

hallow mortar
#

Try it and find out

tulip ridge
little raptor
#

Oh nvm you mean play a "move" sound, not move the sound meowsweats

blissful current
#

How would I skip an index like this:

playSound3D [getMissionPath "sound\flarelaunch.ogg", command, false, [0, 0, 0], 5, 1, 200];

The biki says that default is [0, 0, 0] but I actually want to skip that index. If I put that in there it overrides command. I tried nil but it gave me an error that it expects 3 values.

hallow mortar
#

getPosASL command

merry shard
#

How would I select a handful of players that already have variable names in their init? (My group does ops with up to 3 zeuses, so they're z1, z2, z3)

#

They're also all in a squad together, if it'd be easier to just select the squad

merry shard
#

Okay, slight change to the question. I got a hint to show up for the zeus squad, and now I'm trying to also get it to play a sound as well but I'm getting an error (screenshot attached). Here's my script right now:

{
 playSound "Alarm"
};```
("zeuses" is the variable name of the squad) Do I need to define a sound in the mission files for it to play, even if it's one that's already in the game? Or am I doing this wrong
hallow mortar
#

You're comparing player (object) to zeuses (group)

blissful current
#

In the case of a group of humans. If the leader dies does leader get switched to a different player?

hallow mortar
#

Yes

hallow mortar
merry shard
blissful current
#
[[leader group1, _randomMessage], "sideChat"] remoteExec ["sideChat"];

How does it determine who will get control of AI in a mix of human and AI group?

hallow mortar
#

The group leader has control

#

Leadership inheritance is determined by the unit's rank, and then by ??? if two have the same rank (probably creation order)

blissful current
#

So group leader always has control. So if they die then leader is switched to different unit, however they wont control AI?

merry shard
#

Alright well the error is gone but the sound still didn't play. Do I need to define it in the mission files? I'm pretty sure it's a vanilla sfx

blissful current
hallow mortar
blissful current
#

This means that in MP that some is ALWAYS the leader. I guess unless everyone is dead. Then it would return objNull?

hallow mortar
#

I don't know what happens if everyone's dead. It could return objNull, or it could return the corpse of the last leader.

merry shard
#

Okay theoretically I got it working, thanks guys

blissful current
hallow mortar
#

Yes, because they are the group leader

abstract bay
#

is it possible to use a script to make the AI ​​automatically deploy a static weapon when the enemy is nearby, dissamble it when there are no more enemies?

blissful current
#

Why does this play a sound:

[]spawn {
[command, "flarelaunch"] remoteExec ["say3D", 0];
};

but this doesn't, all I've added is a volume adjustment:

[]spawn {
[command, "flarelaunch", 200] remoteExec ["say3D", 0];
};
thin fox
blissful current
#

I haven't tried that one yet. I've got the flare sounds working with my groups. This is something a little different. If OPFOR enter a trigger area then it pops a flare from the group that entered the area. It all works besides the sounds. From my debugging I've narrowed it down to adding the volume adjustment.

hallow mortar
#

Remember:

_left command _right;
[_left, _right] remoteExec ["command"];```
what you have done is this:
```sqf
[_left, _rightPart1, _rightPart2] remoteExec ["command"];```
blissful current
#

Ah I need square brackets on the right side?

#
[command, ["flarelaunch", 200]] remoteExec ["say3D"];

Ill try this.

#

Tyvm, that got it!

fair drum
#

@blissful current if using ace, they change the settings on all flares. might want to see what they look like on vanilla.

tulip ridge
blissful current
#

I'm trying to set this loop to play every 5 seconds and control it with a variable. The control part doesn't work at the moment but the code within is. I thought I could just turn it on and off with missionNamespace setVariable ["speakersloop", true, true]; but I guess not?

//init.server
while {speakersloop} do { 

[selectRandom ["speakers1", "speakers2", "speakers3"], [HanoiHannah]] remoteExec ["FoxClub_fnc_Conversation", allPlayers select {_x distance speakers <= 100}];

sleep 5;

};
#

When I get it working the sleep will actually be closer to 2 minutes cause I'm afraid of clogging network traffic. (unsure if this matters)

hallow mortar
#

You can turn it off by setting the variable to false, which will cause the while loop to exit. But then the loop has exited. You need to make a mechanism to start it again. waitUntil may be what you need.

#

Something like this:

fox_var_radioLoop = true;
while {true} do {
    waitUntil {
        sleep 5;
        missionNamespace getVariable ["fox_var_radioLoop",false]
    };
    while {missionNamespace getVariable ["fox_var_radioLoop",false]} do {
        [selectRandom ["speakers1", "speakers2", "speakers3"], [HanoiHannah]] remoteExec ["FoxClub_fnc_Conversation", allPlayers select {_x distance speakers <= 100}];
        sleep 5;
    };
};```
#

(Alternatively, make the loop a function, and just spawn the function again when you want to start the loop again)

merry shard
#

I'm looking through script stuff, what does the 0 in front of "spawn" do in this example?

tulip ridge
#

It's essentially used to pass "nothing", since just doing:

spawn {
    sleep 5;
    hint "after (at least) 5 seconds...";
};

Would pass the value of _this to the given code

merry shard
#

I really need to look up tutorials on the basics. All I know is that the 0 makes it work but have no idea what _this even means lmao

#

But thank you

#

Well actually from what I've seen _this looks like it's an array but still

tulip ridge
#

_this is a "magic variable" that is just whatever parameters are passed to a bit of code

private _someFunction = {
    _this;
};

[] call _someFunction; // _this = []
0 call _someFunction; // _this = 0
[""] call _someFunction; // _this = [""]
#

Some commands, notably call; spawn; and params, will use _this as a default value for the left argument if nothing is there.

For example, _this call {...}; and call {...}; are essentially the same

#

You can run into some issues when stuff is accidentally passed that you may (or may not) know

fnc_hintObject = {
    // This function expects an object, and will use objNull if no value is passed
    params [["_object", objNull, [objNull]];
    hint typeOf _object;
};

fnc_paramError = {
    // You might expect this to pass nothing to hintObject
    // but this actually passes whatever parameters are passed to fnc_paramError
    call fnc_hintObject;
};

0 call fnc_paramError; // Error: fnc_hintObject expected an object, but instead got 0
tough abyss
#

I have found a script that I've been looking for but I'm not sure how to use it.
I have created a sqf file in the mission map but whats next haha

warm hedge
#

description.ext does nothing to do with loading time

#

Then what did you figured out 🤔

#

It is about the environment, see spawn

slender chasm
#

Need some assistance, I'm putting NPC Voice lines in my game, one of the lines activates while in a moving vehicle, and I want that to play on the Group or Side Channel Radio so it's louder, does anybody know how I can do that? Here's the script for the interaction.

{
    class Roadtalk_levine_Line_1
    {
        text = "The silence in here is... deafening.";
        speech[] = { "\talk\levine-4.ogg" };
        class Arguments {};
        actor = "levine";
    };
    
    class Roadtalk_walker_Line_2
    {
        text = "Hey man, you know good and damn well we haven't seen a bunk in at least 48 hours. Do me a solid and shut the fuck up so I can take a nap.";
        speech[] = { "\talk\walker-1.ogg" };
        class Arguments {};
        actor = "walker";
    };
    class Roadtalk_armstrong_Line_3
    {
        text = "For the love of God, please!";
        speech[] = { "\talk\armstrong-1.ogg" };
        class Arguments {};
        actor = "armstrong";
    };
    
    class Roadtalk_lopez_Line_4
    {
        text = "Brother, we've got 2 minutes until we're dismounting. Your 'sleep' had better be potent, otherwise you're gonna be a walking corpse when we get there.";
        speech[] = { "\talk\lopez-1.ogg" };
        class Arguments {};
        actor = "lopez";
    };
    
    class Roadtalk_walker_Line_5
    {
        text = "Shut the fuck up already!";
        speech[] = { "\talk\walker-2.ogg" };
        class Arguments {};
        actor = "walker";
    };
};

class Arguments {};
class Special {};
startWithVocal[] = {hour};
startWithConsonant[] = {europe, university};```
#

Excuse the explicits, just more realistic Dialogue.

blissful current
obsidian hornet
#

hi need some help with hold actions and hints. idea here is to have template for hold action + hint. Im getting an error everytime i input the object in a code. Thanks in advance 🙂

[
this,
"ACTION GOES HERE",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 2",
"_caller distance _target < 2",
{},
{},
{ "hint goes here" remoteExec ["Hint", 0, true];},
{},
[],
12,
0,
True,
False,
] remoteExec ["BIS_fnc_holdActionAdd", 0, this]

glossy raft
#

anybody knows what the locality effects are for setMagazineTurretAmmo?

#

it's not documented on the wiki

obsidian hornet
#

"hint goes here" remoteExec ["Hint", 0, true]; maybe the ordinary hint script will suffice for this to appear to everyone?

faint burrow
#

What's the error?

tulip ridge
tulip ridge
#

The last element in an array should not be followed by a comma

obsidian hornet
#

i see

#

will try that

#

oh i cant send images here

#

init: missing;

obsidian hornet
#

sorry quite new to this lmao

tulip ridge
#

I know, I was explaining the differences between what you said, since you asked "maybe the ordinary hint script will suffice for this to appear to everyone?", which doesn't make sense because those do very different things