#arma3_scripting

1 messages ยท Page 741 of 1

sacred slate
#

_x = vehicle mygroup; hint str _x; ?

#

i do not speak much code yet

#

ok

#

thx

#

_x = (vehicle mjkgrp_eye); hint str _x;

#

shoud be so simple lol

#

well i can't find the solution XD

brazen lagoon
#

can you post the output of units _group? wondering what units are in the group

sacred slate
#

ok

#

[B Eye:1,B Eye:2]

#

_x = units mjkgrp_eye; copyToClipboard str _x;

#

@brazen lagoon ๐Ÿ˜„

little raptor
#

only units (objects)

brazen lagoon
#

can you do (units _group) apply {vehicle _x}?

sacred slate
#

i can't hint that as str

#

but no error

harsh bobcat
#

Hi, can anyone help me abit with this code block, I am trying to make a launch bay with runway lights that slowly enable simulation using a script loop

this addAction ["<t color='#FF0000'>LAUNCH</t>", 
{
params ["_target", "_caller", "_actionId", "_arguments"];
launchbay1LRL_1 enableSimulation true;
launchbay1RRL_1 enableSimulation true;
sleep 0.1;
sleep 5;
for "_i" from 1 to 30 do { 
_target setvelocitymodelspace [0,(_i * 6),0]; 
sleep 0.3; 
}; 
_target removeAction _actionId; 
} 
];

Does anyone know how to make it so that the launchbay1LRL_1 has a +1 after every loop for 30 times?

for "_i" from 1 to 30 do {
launchbay1LRL_(_i+1) enableSimulation true;
launchbay1RRL_(_i+1) enableSimulation true;
sleep 0.1;
};

I tried to do that but the syntax wont allow it. Sorry I am not very familiar with programming

sacred slate
#

how do i adress all units from a array of groups?

open fractal
#

someone correct me if this isnt something you can do

#

alternatively my small brain method of getting all the units in to an array would probably be

_allGroupUnits = [];
{_allGroupUnits append units _x} forEach _groups;
distant oyster
# harsh bobcat Hi, can anyone help me abit with this code block, I am trying to make a launch b...

The first script does not allow suspenstion (sleep, uisleep, waitUntil), so spawn it:

this addAction ["<t color='#FF0000'>LAUNCH</t>",
{
    _this spawn {
        params ["_target", "_caller", "_actionId", "_arguments"];
        launchbay1LRL_1 enableSimulation true;
        launchbay1RRL_1 enableSimulation true;
        sleep 0.1;
        sleep 5;
        for "_i" from 1 to 30 do {
            _target setVelocityModelSpace [0,(_i * 6),0];
            sleep 0.3; 
        };
        _target removeAction _actionId;
    };
}];

All global variables are stored in missionnamespace from where you can get any variable with getVariable:

for "_i" from 1 to 30 do {
    private _bay = missionNamespace getVariable [format ["launchbay1LRL_%1", _i], objNull];
    _bay enableSimulation true;
    _bay enableSimulation true;
    sleep 0.1;
};
little raptor
#

addAction code is scheduled

junior rune
#

Does anyone know where can I find the script that can trace my kill count in operations?

winter rose
#

there is no such thing, it is engine-side only

junior rune
#

friend just told me that you can just enable it in editor

#

to see scoreboard

little raptor
junior rune
#

yeah i am just stupid

little raptor
#

good. problem solved then

modern moon
#

Is there an option to make a hint with an image without text?
I tried it with composeText, formatText and parseText. If there isnt any character, then it wont show the hint. If i add a character like H, then the hint shows up with H and the image
Here are some of my Code Examples:

hint parseText format ["<img image=""%1""/>",_icon]; //no hint at all

hint composeText ["Text",image "data\admission_tickets.paa"]; //works like this: Text|Icon
hint composeText ["",image "data\admission_tickets.paa"]; //no hint at all
hint composeText [image "data\admission_tickets.paa"]; //also no hint at all```
#

I also tried a lot of more variations, but i dont get it to work.

tough abyss
#

I am having a problem when i try to open my dialog it says reousre MyDialog.hpp not found

Here is my Dialog: https://pastebin.com/PArvYBSR

In my description .ext i have #include "MyDialog.hpp"

here is how my files are setup

digital hollow
#

the resource is MyDialog with no .hpp so make sure you're not trying to do createDialog "MyDialog.hpp"

tough abyss
#

so i need to do createDialog "MyDialog" ????

#

still dosent work

digital hollow
#

and does it still say the same error?

tough abyss
#

yep

digital hollow
#

Look in config viewer to see if MyDialog actually made it into the game

frozen seal
#

Hi all!
I'm trying to make AI shoot at APC with small arms. To achieve that, I have spawned a bunch of invisible targets on top of APC.

Question: When I look at the invisible target, the green text "Invisible Target Soldier" appears. How do I make this green text go away? Or can I replace it with an empty string?

#

It's the kind of text that usually says "Rifleman", "Officer" etc

#

Ok I think I found a way to do this, though it's kinda sketchy. Basically the target has to be in a different team than the player, i.e. if the player is opfor, the target should be independent. Then blufor will still shoot at the target (given that they're hostile to independent) but green text won't appear

dusk knot
#

Hi, is there any way to convert a String to an Object? I have a few Objects with a certain naming Pattern like "Rock_0", "Rock_1", "Rock_2" and so on which im just putting in an Array with a for loop, now i want to get the Position (with getPosASL) of it and since the Array is full of Strings, it gives me a Type error because it expects a Object but gets a String (As Expected) is there any way to convert them?
A temporary solution would be to put all the Object Names into the Array without the quotes, but that would kinda be a pain and would require me to manually add and remove them when needed. For example when new Spawns get added/removed

Example code:

_ObjectNames = [];
_Spawns = [];
_TotalObjects = 10;

//Getting the 
for "_i" from 0 to _TotalObjects do
{
    _ObjectNames Set [_i, format["Object_%1", _i]]; //Adds all Object names to the Array. Returns the Object names as Strings to the Array
};

//Getting Spawns from Object
for "_i" from 0 to _TotalObjects do
{
    _Spawns set [_i, getPosATL (_ObjectNames select _i)]; //ObjectNames returns a String, getPosATL Expect an Object.
};```
frozen seal
#
_ObjectNames Set [_i, missionNamespace getVariable (format["Object_%1", _i])];

or something like that

#

that will turn your array _ObjectNames from an array of string to an array of objects so it would make sense to rename it to just _Objects

dusk knot
#

Yeah, thanks alot! That worked PogU

tough abyss
#

someone able to help me why does my dialog not come up in game when i press shift F1

#

waitUntil {!isNull(findDisplay 46)};
(findDisplay 46) displaySetEventHandler ["KeyDown","_this call keyspressed"];

keyspressed = {
_keyDik = _this select 1;
_shift =_this select 2;
_ctrl = _this select 3;
_alt = _this select 4;
_handled = false;
switch (_this select 1) do {

case 59: {//F1 key
    if (_shift) then {
        execVM "MyDialog";
    };
    if (_ctrl) then {
        execVM "YOURSCRIPT";
    };
};
    
case 22: {//U key
    if (_shift) then {
        execVM "YOURSCRIPT";
    };    
};
_handled;

};

distant oyster
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
cold linden
#

has anyone an idea how i get the actual bodypart damage in ace3?

drifting ocean
#
_crate1 = loadbox;

_autorifleman = [["arifle_MX_SW_pointer_F","","acc_pointer_IR","",["100Rnd_65x39_caseless_mag",100],[],"bipod_01_F_snd"],[],["hgun_P07_F","","","",["16Rnd_9x21_Mag",17],[],""],["U_B_CombatUniform_mcam_tshirt",[["FirstAidKit",1],["SmokeShell",1,1],["HandGrenade",1,1],["SmokeShellGreen",1,1],["Chemlight_green",1,1]]],["V_PlateCarrier2_rgr",[["100Rnd_65x39_caseless_mag",5,100],["16Rnd_9x21_Mag",2,17],["Chemlight_green",1,1]]],[],"H_HelmetB_grass","G_Combat",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]]; //loadout code (exported from arsenal)

_crate1 addAction 
["Autorifleman",
    {
     _this select 1 setUnitLoadout 
        
        _autorifleman
    }
];

"Error, undefined variable in expression: _autorifleman"
I'm trying to add an action to an object to load this loadout. What am I doing wrong? How do I get my variable properly defined? I tried putting quotations around the variable, I tried str(loadoutCode), no dice.

copper raven
#

you need to pass it to the action, or just move the whole array instead(but i suppose it's just an example, so the first one)

drifting ocean
#

Rookie mistake. Thank you!

#

I thought that local variables were included across the entire SQF file, thanks for clearing that up

boreal parcel
#

hey how would I go about disabling the RHS ZSUs either targeting or maybe disabling the radar?

#

could I just throw this into a trigger?
"rhs_zsu234_aa" enableVehicleSensor ["PassiveRadarSensorComponent",false];

#

nope, it wants an object as a parameter

acoustic abyss
#

Can FSM files be compiled and referred to as regular .sqf script files? Or do they need to be packed in a PBO?

drifting ocean
# boreal parcel hey how would I go about disabling the RHS ZSUs either targeting or maybe disabl...

You could go about this a few ways, I'm new to scripting but I would place all the ZSUs in an array, and use forEach to apply the desired code/command to each ZSU in the array.

If you already have every ZSU in your mission that will be spawned, this is pretty simple to do. Just use EDEN to give each ZSU a variable name, and place those variable names in an array in your script (Instead of variable names, you could also just place the code into each units init field if you don't wanna set up files)

This won't apply the code to any ZSUs added to the mission (I.E triggers or zeus spawning) so for newly added ones mid-mission you will need a way to dynamically update your array (I.E scheduled script)

boreal parcel
#

the original example code had vehicle player enableVehicleSensor provided as the method, though looking at the vehicle documentation I dont exactly understand how it works

#

if I just apply the code to the init of each unit, perhaps I could just use this keyword?

drifting ocean
#

pretty much, you can just go in the units init field in eden and say

this enableVehicleSensor ["PassiveRadarSensorComponent",false];```
agile breach
#

Hi all, I'm new to Scripts in Aram, how do I start? I've been searching here and there for the code/scripts when I try to make a mission, so the knowledge of it are pieces here and there, but I really like to learn and enjoy what I'm doing when the missions came out working properly, so ultimately I wanna make missions like the Campaign missions with my own story or make Scenarios with my preferences, please, help me~

agile breach
#

@acoustic abyss thanks for the page , this is a useful page,been copy and paste the scripts from here a lot

boreal parcel
# drifting ocean pretty much, you can just go in the units init field in eden and say ```sqf this...

yeah I modified another script I use for something similar and im pretty sure it works however I think the ai just turns the radar back on shortly after, though im not sure how this method is supposed to work if its supposed to stay off or not. Any Ideas?

params [
  ["_onoff", false, [false, 1]],
  ["_distance", 500, [0]],
  ["_marker", getMarkerPos "zsu-marker", ["",[],objNull]]
];

_types = ["rhs_zsu234_aa"];

_dmg = [0.97, 0] select _onoff;
_lamps = nearestObjects [_marker, _types, _distance, true];
{
  for "_i" from 0 to count getAllHitPointsDamage _x -1 do
  {
    _x enableVehicleSensor   ["PassiveRadarSensorComponent",false];
  };
} forEach _lamps;
#

maybe disableAI "AUTOTARGET"; will work

vapid drift
#

Am I missing something simple here? I keep getting an error saying I'm missing "]"

_wp setWaypointStatements [
    "true",
    format["['updateUAVPos', [%1, %2]] call STY_RVG_fnc_exterminate;", _player, _uav]
];
little raptor
vapid drift
#

Hmm... is there an easy workaround or do I need to define these globally?

little raptor
vapid drift
#

Hah, yeah, I guess it would be

hollow thistle
#

Depends on what you're doing, but if there's only one of these scripts running per group I would store the needed objects on the group.

little raptor
#

But there are other alternatives that need more work, such as using setVariable on the leader and fetch them again in the code
If you have multiple waypoints, you can make that an array and pop the arguments array for the code that is executed

vapid drift
#

Re-thinking the issue... I think global vars would be the best option.

#

Still not sure why the original didn't work though... is it because of quotes in the strings themselves?

little raptor
#

No

#

When you stringize an object name it contains a space

#

Such as objblala blabla#123

#

Which obviously is not a valid sqf syntax, and even if it was, there's no "object literal" in sqf

vapid drift
#

Ah gotcha. Thanks

sacred slate
little raptor
sacred slate
#

oh yeah its more top in the script

#

but its _mjkpos_randhq = [getpos mjkdmp_core, 1000, 3000, 33, 0, 0.01, 0] call BIS_fnc_findSafePos;

dawn knoll
#

@warm hedge Was just looking at your formation flying script. Looks good, but is there any way to get a bit of deviation in the AI flight to make it more natural? Also, when they hit combat, do the AI break formation, or do I need to do some stuff with modules to get them to do that?

modern moon
# little raptor then use hidden characters

Hmm, but then i would have a bigger white space before the icon as expected. I thought there is any way to do it without Tricks like hidden characters. But if there isnt any other Method, then i need to do it like that ^^

fluid wolf
#

Does anyone know if there is a way to add rotational velocity instead of movement velocity? In order to, for instance, cause a plane to start flatspinning

little raptor
#

addTorque is one way

#

but for better control you have to rotate the object yourself
using setVelocityTransformation, for example

fluid wolf
#

Setvelocitytransformation sounds like what I want actually

#

is it instant or

little raptor
#

yes

#

it has to be applied in a loop

fluid wolf
#

oh really? Oof.

little raptor
#

like I said:

you have to rotate the object yourself

fluid wolf
#

...wait wait is it like

#

uhh... playmove and capturemove?

#

wher eyou just set yourself a beginning and end velocity? and it runs between them?

little raptor
#

no, it's a bit more complicated

#

you can just rotate the object

#

using setVectorDirAndUp

fluid wolf
#

ah shit, why must this be the complicated thing. Alright, I'll look into it and see what I can do

little raptor
#

well I don't think objects have a rotational velocity in Arma (except for PhysX objects)

fluid wolf
#

I mean, they kinda... have to?

#

planes especially can roll, pitch and yaw

#

so can helicopters

#

even tanks and cars can spin

little raptor
fluid wolf
#

oh

#

well, then that answers that!

upper siren
#

quick question:
the variable you can set on units placed down in the editor are globally defined, correct?

e.g. I have two units with variable player1 and player2 on a MP mission. Both are occupied by players.

if (isNull player2) then {true} else {false} executed locally on player1 should return true.

hollow thistle
#

it can be simplified to isNull player2

#

but... if player2 never the joins the game this variable can be nil IIRC.

so use isNull (missionNamespace getVariable ["player2", objNull]).

I do not remember what happens when somebody disconnects, will the variable be null or will it point to the body of disconneted player thomp

tough abyss
#

anyone know how i make my dialog whitelisted

upper siren
#

What I'm trying to do is

{
    if(isNull _x) then {
        player addItemToBackpack "UK3CB_BAF_Soflam_Laserdesignator";
        };    
} forEach fst_list;

I luckily noticed that isNull won't work there.... it'll still execute for every client

hollow thistle
#

I'm almost sure that doing forEach on fst_list makes no sense.

#

As you're propably defining the array early in the mission.

#

[player1, player2]

#

if it's done at the start of the mission when player2 is not in the game

#

when it won't magically appear in the array.

#

you will have an array of [player1, nil]

#

and it wont change.

#

also why you're adding the item to the backpack of the local player for every element of the array player addItemToBackpack "UK3CB_BAF_Soflam_Laserdesignator";

upper siren
#
fst_list = [ 
 "fst1", 
 "fst2", 
 "fst3", 
 "fst4" 
];

{
    if(isNull _x) then {
        player addItemToBackpack "UK3CB_BAF_Soflam_Laserdesignator";
        };    
} forEach fst_list;
hollow thistle
#

string can't be null

upper siren
hollow thistle
#

isNull "string"

#

this won't work

upper siren
hollow thistle
#

what's fstN

#

variable name of the player units?

upper siren
#

yes

hollow thistle
#

what do you want to achieve

#

add item to every player that's present?

upper siren
#

add item to players who connected to these slots

#

if their variable name is in the above list

hollow thistle
#

and you're executing that where? On the server?

upper siren
#

initplayerlocal.sqf

hollow thistle
#

then that loop has no sense

#
// initPlayerLocal.sqf
fst_list = [ 
    "fst1",
    "fst2",
    "fst3",
    "fst4"
];

if (vehicleVarName player in fst_list) then {
    player addItemToBackpack "UK3CB_BAF_Soflam_Laserdesignator";
};
#

assuming you set the variable name of the player in editor name field.

upper siren
#

aaaaah, vehicleVarName was the missing piece ๐Ÿ˜…

#

I only remembered about isNil and local, so i thought I had to iterate through them and check one by one

hollow thistle
#

personally for things like this I prefer to set some variable on the player via init field.

eg:

// init box
this setVariable ["isJTAC", true];

// initPlayerLocal.sqf
if (player getVariable ["isJTAC", false]) then {
    // do something
};
upper siren
#

Hmm, might switch to that, thanks!

#

your way seems cleaner if I wanted to enable multiple things for one unit...

hollow thistle
#

yeah, and can be easily reused for other mission logic.

little raptor
tough abyss
#

i want to make it so only the person whos steam id i have included in the file can open a menu i made

little raptor
patent lava
#

what's up with this: i set the name in the units identity tab and when i launch the mission on my dedicated server the name gets reset

#

is there a fix for this?

#

using sog and ace, in the editor the name shows up correctly

willow hound
patent lava
#

hm, problem is i relied on the identity tab for my teleporter script

#

i sync two units with eachother and give unit a the name "unitA" and unit b "unitB", then when i ace interact on unit a it says "teleport to unitB"

#

that worked in the eden editor because im guessing it sets the name before running the init field

#

but if i now use setName in the init it only works one way

#

any ideas to do it differently? goal of the script is to be as easy to use as possible

willow hound
#

What does it currently look like?

patent lava
#

you set the name in the units identity and call that script in the init field

#

then synchronize that unit with other units you want to enable teleporting to, also doing the same thing in the init field and identity for those

#

i also understand that there is something else wrong with the script but that is something i haven't sparred with

willow hound
#

What does the init field currently look like?

patent lava
#

[this] call BD_fnc_teleporter;

#
this setName "Altis Airfield";
[this] call BD_fnc_teleporter;
#

first one is how it works as expected in eden editor but not on dedicated, second one is only one way since it then shows the randomized name

#

unita's init field runs, gets the randomized name from unitb, then unitbs init field runs which then only sets the expected name

flat eagle
#

_this refers to the object it self

#

unit, tank what ever

patent lava
#

let me check if i actually use this or _this

#

okay i did use this, i changed it to _this and testing now

#

_this actually doesn't work

willow hound
#

Try inserting waitUntil {sleep 1; time > 0}; at the beginning of BD_fnc_teleporter and changing the init field:

this setName "Altis Airfield"; //This is not Syntax 2 of setName
[this] spawn BD_fnc_teleporter;
```I hope this will also work in MP; the goal is to delay the execution of `BD_fnc_teleporter` until after Editor-placed objects have been initialized.
patent lava
#

ill try that

#

wow it works

#

thanks so much

#

this might also fix some other script i have hah

willow hound
#

Doesn't the call to ace_common_fnc_claim remove all ACE interactions with _target though?

patent lava
#

it does

#

if i dont do that i also have access to its medical menu

willow hound
#

So it has no impact on the interaction you add right after?

patent lava
#

apparently not

dusk knot
#

Back with another question, how can i get the Vehicle Class from an object? Can't really seem any way to find any get it?
Vehicle returns the PBO name, aswell as some other information so its not really helpful..

_veh = vehicle cursortarget;
hint format ["Target Vehicle: %1", _veh];
deletevehicle cursortarget;
digital hollow
#

typeOf is the command you want

willow hound
willow hound
patent lava
#

why is that?

dusk knot
keen turret
#

Hi

#

how can I enable interior lights on a vehicle via script?

#

or even in init

willow hound
# patent lava why is that?

The removeAllWeapons command has global effect and requires local arguments.
Every client that joins the mission executes init fields, hence why having commands with global effect in init fields is usually a bad idea.
I suppose in this case, since the object is not local to the client when it joins the mission, there is no harm done because the command presumably has no effect when all those clients to which the object is not local execute it.
But imagine it were setDamage (global effect, global arguments): Every time a client joins the mission, the damage is applied again, regardless if the object has healed / repaired in the meantime.

patent lava
#

got it, thanks, i didn't actually notice that

#

i was more referring to the synchronizedObjects since that also wasn't behaving as expected, adding the sleep also fixed that issue and now the script fully works as intended

drifting sky
#

A2OA. Is it possible somehow to apply the same lowpass filter to sounds played with "say3d", as the lowpass filter applied to bullet and shell impact explosion sounds?

sacred slate
#

how can i evoke the unit command: "watch direction / observe position via script?

#

where are the script files for the vanilla unit command menu in th arma 3 folder?

hollow thistle
#

There's no script files for that. It's handled in-engine.

sacred slate
#

@hollow thistledowatch and commandwatch makes the unit swing around endless, its hard to look at

#

glanceAt works, but very unreliable

hollow thistle
#

setFormDir

#

but that's group level.

#

There's no command that replicates command menu "watch direction" command iiirc.

sacred slate
#

funfact, lookAt makes them rotate more lol

#

it has to be user level. c2 command and control might can do it.

noble zealot
#

The command switchCamera does not show the green screen of the night vision goggles?

little raptor
half monolith
#

i have a question about which would be better for this function?
the speed of using call with no suspension or would the suspension be better for the client?

Mad_ifnc_Vd ={
params['_dist','_currFrameNo'];
private['_dist','_currFrameNo'];
setViewDistance _dist; 
waitUntil { viewDistance== _dist}; 
setObjectViewDistance (_dist*.80);
waitUntil { getObjectViewDistance select 0 == (_dist*.80)}; 
_currFrameNo = (diag_frameNo-_currFrameNo); 
systemchat  format['View distance: %1 %2', ViewDistance, _currFrameNo];
};

_currFrameNo = diag_frameNo;
[3000,_currFrameNo] spawn Mad_ifnc_Vd
//////


 Mad_ifnc_Vd ={
params['_dist','_currFrameNo'];
private['_dist','_currFrameNo'];
setViewDistance _dist; 
setObjectViewDistance (_dist*.80);
_currFrameNo = (diag_frameNo-_currFrameNo); 
systemchat  format['View distance: %1 %2', ViewDistance, _currFrameNo];
};
_currFrameNo = diag_frameNo;
[3000,_currFrameNo] call Mad_ifnc_Vd

these are the two ideas i have. used once from initplayer and also in players getin and getout eh

little raptor
#

setViewDistance and setObjectViewDistance take effect immediately

little raptor
little raptor
half monolith
half monolith
little raptor
half monolith
#

it is just an idea. seems to happen on people that dont have faster setups the most, if i could break it up, then i thought it may help.
ill try how you say ๐Ÿ™‚
ty

little raptor
#

maybe the problem is somewhere else?

#

also when does it happen? at init or when they get in/out of vehicles?

half monolith
#

it is so hard to get straight answers i remote exec the things i really wonder about to log on the server...
its possible it could be something else, there are several things going on at once depending if its respawning into a veh, or just getting in.
for me i notice it the most (and i get it the least) when im respawn into a vehicle, i can tell something is happening, tab out tab back in and save it sometimes.

cold linden
little raptor
cold linden
tough parrot
#

are there static function variables in sqf?

little raptor
#

I guess QEGVAR(medical,bodyPartDamage) becomes: "ace_medical_bodyPartDamage"

little raptor
half monolith
# little raptor maybe the problem is somewhere else?

i tried three missions one as you said one with my idea and one with spawn no wait.
reason i thought it maybe suspending is maybe because i used spawn instead, the difference in call and spawn, is upto 3 frames, while when using spawn with waituntil it was upto 4 and 5 frames. i think, its really hard to say, its so fast i cant even log it with time in a way i know. just returns 0.

#

still going to use call just wanted to see

tough parrot
#

what is returned when a config path is null? I tried if {!isNil "_path"} and it passes regardless.

noble zealot
shrewd hedge
#

may I ask how can I make AI charging at moving tanks and explode himself when he gets close enough

#

like certain Ai can get position of tanks and move accordingly

cold linden
little raptor
# shrewd hedge may I ask how can I make AI charging at moving tanks and explode himself when he...

you can try something like this:

if (isNil "my_bombers") then {my_bombers = []};
if (!canSuspend) exitWith {};
while {true} do {
    private _remove = [];
    {
        private _unit = _x;
        if (!alive _unit) then {_remove pushBack _unit; continue;};
        private _tanks = _unit nearEntities ["tank", 100];
        if (count _tanks != 0) then {
            private _minDist = 1e10;
            private _tank = objNull;
            {
                if ([side _x, side _unit] call BIS_fnc_sideIsEnemy) then {
                    _dist = _unit distance _x;
                    if (_dist < _minDist) then {
                        _minDist = _dist;
                        _tank = _x;
                    };
                };
            } forEach _tanks;
            
            if (!alive _tank) then {continue;};
            
            _unit doMove ASLToAGL getPosASL _tank;
            
            if (_unit distance _tank < sizeOf typeOf _tank * 0.6) then {
                isNil {
                    _bomb = createVehicle ["SatchelCharge_Remote_Ammo_Scripted", [0,0,0]];
                    _bomb setPosASL aimPos _unit;
                    _bomb setDamage 1;
                    triggerAmmo _bomb;
                };
            } 
        };
    } forEach my_bombers;
    my_bombers = my_bombers - _remove;
    sleep 3;
};

this code must run scheduled (you can just put it into a file and execVM it from init.sqf)
then just add the units to the my_bombers array.

#

e.g.:

my_bombers = units east; //all east units will be suicide bombers and will hunt the nearest tank (within 100 m)
shrewd hedge
#

cool , thanks , I will try that

#

@little raptor thanks

hollow lantern
#

since the wiki is down for maintenance, can someone give me a hint regarding a vehicle following another? I think it was possible to with doFollow

little raptor
hollow lantern
little raptor
#

it's not offline rn

hollow lantern
#

hmm yeah works now, thanks

little raptor
#

or maybe there's a built in waypoint. idk

hollow lantern
#

I want a scripted approach, but yeah I need a loop for sure. Gonna fiddle around

autumn sun
#

How i do to put a black screen and remove a black screen on my intro

tidal ferry
#

Hey, I need help with something of an emergency for our unit mod

#

So basically, our unit maintains a "public" auxiliary mod with a bunch of assets that members of the OPTRE/Halosim community are free to use

#

In response to a bug report by a member of a unit that uses it, we removed one of the required addons in CfgPatches for one of our mod PBOs

#

It worked fine on our unit's modpack, however it seems that it's broken the server and mission of another unit who uses it

#

We're trying to scramble to push a hotfix so they don't have to cancel their operation for this weekend

#

If someone if available, I could really use some help trying to get it fixed

#

Trying to save a lot of people's weekends here, and it's pretty time sensitive on our end

little raptor
little raptor
tidal ferry
little raptor
tidal ferry
quaint ivy
#

Could someone explain to me what is the point of 0 = null or 0 = some code or null = something ?

little raptor
#

basically to silence return value

#

it was a problem in old Arma versions I guess when you returned a value in init fields

#

but it's not needed anymore

quaint ivy
#

ah, alright. I was just curious as I haven't seen it in anything recent, yet it used to be common practice in the past.

plush belfry
#

How can I force a ZSU-39 Tigris, ( The Default CSAT AA Vehicle ) to only use its lock on missiles and not the gun?

blissful wave
#

Hi Scripting group - is there a resource that I can use to make all entities visible to virtual observers?

tough parrot
#

does SeatSwitchedMan get called separately on both units in a swap?

#

if it is added to both

tough parrot
#

i'm guessing if all crew have the EH _unit2 can be ignored.

half moon
#

Guys, I've got a CTF mission with "currentScoreE = 0;" in init and a trigger that activates when the flag is brought there. It has "currentScoreW = currentScoreW + 1;hint format["BLUFOR just scored a point. Score total = %1",currentScoreW]; " on Act.

It seemed to work just fine, but for some reason the scores didn't seem to log at times, and they were different for me and my friend on dedi. He brought the flag there, the flag disappeared from his back as it should, but he didn't get the hint shown. Later he got the hint, but his score for W showed 1 as it showed 2 for me.

#

Could running the trigger only on server help? I'm not exactly sure about that though.

plush belfry
little raptor
#

for freezing the player you can just do:

onEachFrame {
  player setVelocityTransformation [
     getPosASL player,
     getPosASL player,
     [0,0,0],
     [0,0,0],
     vectorDir player,
     vectorDir player,
     vectorUp player,
     vectorUp player,
     1
  ];
};
dusky pier
#

Good evening!
I got problem with sending object variable from client to server.

On client side is defined, but server can't find it and return null

I got this message in log:

Object id 9a48deed (1773) not found in slot 283,210
19:12:05 Link cannot be resolved
19:12:05 ["_house",<NULL-object>]

Could you help me, please?

little raptor
#

is that a terrain object?

dusky pier
#

ye, is building

little raptor
#

I mean built into the terrain itself?

dusky pier
#

some buildings have the same problem, but i can't get why :\

little raptor
#

terrain objects are local

#

you can't get them on other PCs

#

(afaik)

plush belfry
dusky pier
#

ye, but in default altis is worked fine :
i though houses have something like special state, cuz i can use some scripting commands on them ( intended to mission objects )

little raptor
#

you can check that using typeOf obj

#

if it's empty it's a super simple object

dusky pier
little raptor
#

Then idk

dusky pier
#

maybe problem with map then ๐Ÿ˜ฆ

#

@little raptor anyway, thank you for answers!

plush belfry
#

I want a trigger to be activated when I "spot" an object, I know cursorobject is supposed to be used but other than that I am stuck, can anyone kindly help?

sacred slate
#

how can i get all classes like weapons and ammo inside a container? allMissionObjects reads only objects and not containers

tough parrot
#

Hm... according to boundingBoxReal a man is very fat.

digital hollow
still knoll
#

either case you dont need to cycle through allMissionObjects to get the container object

#

then just, getItemCargo box

tough parrot
dusky pier
tough parrot
#

the object type is essentially in getModelInfo

dusky pier
#

ye, but before - this script worked, and i didn't get when is broken :\

half moon
# little raptor yes

It didn't help - I don't get any points anymore with server only -trigger. The valuable returns as 0 even if I bring 10 flags to the trigger.

dusk knot
#

Is there any way of getting the health of the player?

still knoll
#

0 dead
1 healthy

sacred slate
#

@still knoll i will fiddle with getItemCargo. thx

tough parrot
tough parrot
half moon
# tough parrot You must be adding to or reading score on wrong machine.

Well, what I've done is have currentScoreE = 0 in the init. Then adding happens by a trigger "currentScoreE = currentScoreE + 1". I tried putting publicVariable "currentScoreE" on it as well.

Now I tried it like that ^ without ticking "server only". What's weird is that I didn't get the hints, but it did count it as I did a manual hint format with the score to check it.

#

But when I reached 3 points, the End -trigger with isEqualTo didn't trigger. I'm puzzled.

ruby bronze
#

Is there a way, with scripting, to change how long one of those notifications for tasks will be on screen?

tough parrot
plush belfry
#

Trying to make a cas unit be synced with a subordinate module once a trigger gets activated, this is what I have, seems to not be working

hcmnd synchronizeObjectsAdd [cas1];

noble zealot
#

How to see night vision effect when watching another player with switchCamera command?

still knoll
#

or for thermals
setCamUseTI

noble zealot
# still knoll camUseNVG true;

@still knoll I appreciate your answer, however these commands don't work when using switchCamera in a player (switchCamera _friendlyPlayer for example). They only work with cameras created with camCreate ๐Ÿ™

potent depot
#

Hello all, Got a question relating to extensions. Namely, how battleye interacts with them. What I want to know is in what scenarios battleye would flag them if they are not whitelisted.
The error it outputs when this occurs is supposedly:
Call extension 'My_Extension' could not be loaded: Insufficient system resources exist to complete the requested service.
This occurs for me in the editor when I am just trying to test it. I am thus wondering if it would work if the server is using it on the server side only? Ofc, one cannot use it clientside and join a server using battleye. But I had though that it would still be usable in editor and on the server side only without whitelisting?

I may have missed this info somewhere but I have only seen reference to the interaction of joining a battleye server with a non-whitelisted extension. Not the other scenarios.

tidal ferry
#

Hey question

#

Is the function setLightnings global or local?

maiden garnet
#

hello, i am trying to run BIS_fnc_cinemaBorder without it disabling player input. is there anyway i can work around this?

#

nvm figured it out

fair drum
calm yarrow
#

Trying to create bullets and give them velocity in a certaint radius. Just having problems calling out the bullet(instance)

#
[]spawn {
    while {alive D} do {
sleep 1;
shazam = "B_127x108_Ball"
things = nearestobject [D,[],2];{_x createvehicle shazam} foreach things
};
};```
little raptor
#

what does it have to do with creating bullets?

wet berry
#

Does anyone have a good understanding of databases? I'm trying to figure out how Jeroen's Limited Arsenal generates, saves, and loads its data. I'm trying to use iniDBI2 to handle the database aspect, and understand the original scripts will need rewriting, but I kind of need to figure it out before I can modify it.

So far, from what I can gather, under JeroenArsenal/JNA the fn_arsenal.sqf loads the custom arsenal and may also load the datalist from somewhere. I think fn_arsenal_arraytoArsenal.sqf makes an array of the arsenal's contents which can be saved. Finally, fn_arsenal_loadInventory.sqf could also load the arsenal's inventory from a specific location (ie a database).

I'm hoping to use this to save contents over multiple missions without having to note down every item manually.

https://github.com/Jeroen-Notenbomer/Limited-Arsenal

calm yarrow
#

And the bullet needs velocity to damage

little raptor
#

I mean why nearestObject

#

use event handlers

calm yarrow
#

Couldnโ€™t get anything else to work and I code in LUA so I get very confused at times

calm yarrow
little raptor
#

FiredMan

calm yarrow
# little raptor FiredMan

Specifically trying to make AI that do damage if your in its radius. Or spawn a bullet that goes up into you to damage

#

Without a gun involved

little raptor
#

well your code just makes no sense

stark bone
#

is it possible to spawn a composition using scripts that follows edens terrain following?

#

trying to make a vehicle that can be "sacrificed" into a small composition

wet berry
stark bone
#

will that allow it to be built wherever the vehicle is sacrificed?

#

its part of a dynamic system

wet berry
#

I'm not sure what you mean by sacrificed

stark bone
#

the idea is that its a outpost in a box a couple hesco's and stuff

#

you drive the vic there then deploy it

#

vic is removed and hesco's etc place down

tough parrot
#

there are problem with placing objects like that. they will end up inside other objects

wet berry
# stark bone vic is removed and hesco's etc place down

So i'd probably do something like addAction on the vic, have the addAction run the SQF, but I'd modify the SQF by putting something like:
deleteVehicle car; sleep 3;
At the beginning of the file. This will delete the vehicle, give it a couple seconds to clear the space, and then spawn the SQF. This is assuming you aren't moving the vehicle to a location, or allowing the vehicle to deploy this outpost anywhere.

stark bone
#

the last two conditions are exactly what im doing with the vic lmao

#

drive the vic somewhere and deploy the composition at vics pos on map

#

and despawn the vic

#

i wonder if i can find a way to parse what the eden editor exports for custom comps

#

to where i can change the center value to where the vic is when the action is made

little raptor
#

just use relative model coords.
pick an object in the composition as the "main" object
then transform all positions /directions relative to this object:

{
  _relPos = _mainObj worldToModel ASLtoAGL getPosWorld _x;
  _relDirAndUp = [_mainObj vectorWorldToModel vectorDir _x, _mainObj vectorWorldToModel vectorUp _x];
  _composition pushBack [typeOf _x, _relPos, _relDirAndUp];
} forEach _compositionObjs;
#

then do the inverse of those operations to convert them back to world space and recreate the composition

stark bone
#

so this is using what eden puts in my arma 3 profile as a composition

little raptor
#

idk

#

but it's probably something similar

stark bone
#

yeah i dont understand what you've done lmao

#

I was going to do a createVehicle loop

#

that takes the vics pos

#

and adds the pos of the composition

little raptor
#

that code just "saves" the composition

stark bone
#

oh how do i execute it?

little raptor
#

you have to create it yourself:

then do the inverse of those operations to convert them back to world space and recreate the composition

stark bone
#

all g

stark bone
#

create vehicle doesnt allow for rotation does it

#

would have to do something else to do that after its made

little raptor
#

and its position is not suitable either

stark bone
#

wdym its position is not suitable either?

little raptor
#

I mean if you want accurate placement you have to use a better position format

stark bone
#

uhhhh

#

like one that provides a finer increment?

#

im currently using getPosATL

#

createVehicle accepts that as a format

little raptor
stark bone
#

strange thats not what the documentation says

#

also am i wanting to do worldspace transforms so that it follows the contour of the terrain

#

where placed?

#

after all the transforms etc

little raptor
#

or maybe

#

but only the terrain surface normal

#

not its position.

#

otherwise the composition parts will be misaligned

stark bone
#

if you call createVehicle with no heigh value

#

it will spawn it at terrain level correct

#

at the x and y

little raptor
#

yes

stark bone
#

cool thats all i want

#

all my items are at terrain height

steel fox
#

Keep in mind that if you want to spawn it onto a pier or other object that isn't part of the terrain, e.g. editor placed or zeus, it will not be placed on top of those. but on the terain beneath them. idk what your use case fully is, but just keep that in mind before it comes back to haunt you.

stark bone
#

thank you yes i do not intend for any of those concerns to be valid in my use case

#

the only issue i can see rn is i only have rotational information for the x axis

#

so every object will spawn perfectly vertical

#

regardless of slope

#

it will just have to be one of those things I will have to tell people find a suitable location

steel fox
#

you can simple set the vectorUp to surfaceNormal?

stark bone
#

those are two things I'm not aware of

#

maybe

#

atm though i just want to get it working without that

#

might consider it another time

steel fox
#

something like that would set every object to point away from terrain.

stark bone
#

mm I will consider it

#

atm i'll get it to minimum functionality

#

then i will look to polish up some of that to make it less restrictive

#

it would be pretty dumb to have this comp on the side of a hill tho

#

and i would have to find a way to have some of the objects not have their vector set to terrain

#

yknow stuff like bunkers and cargo posts

stark bone
#

now for a smooth brain question

#

is it easy to just add the values of two arrays together?

#

or will i have to spit the values and add them then stitch them back together

distant oyster
stark bone
#

cheers ill take a look

#

not exactly what i was looking for but took me to something i can use

stark bone
#

i have 2 arrays

#

i want to add the 0 of each array to each other

#

and the 1 of each to each other

#

so if i have [1,3] and [2,4] i want to get [3,7]

little raptor
stark bone
#

cheers

stark bone
#

ever wonder why something doesnt work dispite it not throwing an error

little raptor
stark bone
#

knowing me probably both

distant oyster
#

or the worst of all: a logical error

little raptor
#

semantic error = logical error

distant oyster
#

oh that's fancy people talk, ic ๐Ÿ˜„

stark bone
#

welp the foreach loop has failed me

#

maybe i convert the lot into a hashmap

little raptor
stark bone
#

you assume i know the answer

#

i assure you i do not

#

im literally just going to rewrite the thing based around a hashmap now

#

instead of an array with 20 or so arrays that contain another array

slate knot
#

Is there a way to play a song only when a vehicle starts moving?

winter rose
#

yes

slate knot
#

How?

little raptor
#
waitUntil {sleep 1; speed _vehicle > 1};
playMusic "blabla";
umbral oyster
#

there is a problem that the function bis_fnc_initVehicle does not work in MP, while the function itself returns a positive response, that it worked, what could be the problem?

umbral oyster
umbral oyster
#

after the appearance of the car? yes, did

little raptor
#

add a small delay (1 second should be enough) before using initVehicle

umbral oyster
#

Yes, I did that, it doesn't help.

little raptor
#

then idk

potent depot
high horizon
#

Does anyone know if is there object oriented programming as Java?

winter rose
high horizon
winter rose
#

depends on something there

copper raven
high horizon
winter rose
#

dim the lights and use a deeper voice

queen cargo
tough parrot
#

this supposed new syntax does not work: vehicle lockCameraTo [target, turretPath, temporary]

tough parrot
#

hmm no. I thought it updated auto.

queen cargo
little raptor
#

Not stable

still forum
#

2.07 is dev :u

ruby bronze
#

So, you guys know how you can see the name of a friendly unit by looking directly at them from a short distance? Is that possible to do on a crate? So you can label crates and not have to look inside each one?

tough abyss
#

Cypher,
here is a name tag script by MosesUK I use.

//Code by MosesUK
//Modified by Blackheart_Six

waitUntil {!(isNull player)};
waitUntil {player == player};
sleep 1;
tag = addMissionEventHandler 
[
    "Draw3D", 
    {
        private ["_group"]; 
        {
            if (side _x == playerSide && (player distance _x <=25) && !(player == _x))  then 
            {
                _dist = (player distance _x) / 15.0;
                //_color = getArray (configFile/'CfgInGameUI'/'SideColors'/'colorBlufor');
                _color = [0,0.3,0.6,1] ;
                _groupName = groupId (group _x);
                _id = player call getUnitPositionId;

getUnitPositionId = {
    private ["_vvn", "_str"];
    _vvn = vehicleVarName _x;
    _x setVehicleVarName "";
    _str = str _x;
    _x setVehicleVarName _vvn;
    parseNumber (_str select [(_str find ":") + 1])
};
//player joinAs [createGroup west, 5];
_id = player call getUnitPositionId;
//hint str _id; //5

                if (cursorTarget != _x) then 
                {
                            _color set [3, 1 - _dist]
                };

                drawIcon3D 
                [
                    format ["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa", rank _x],
                    _color,                
                    [
                        visiblePosition _x select 0,
                        visiblePosition _x select 1,
                        (visiblePosition _x select 2) +
                        ((_x modelToWorld (
                                _x selectionPosition "spine"
                        )) select 2) + .2 + _dist / 3.0
                    ],
                    1,
                    1,
                    0,
//                  format ["%1 | %2",rank _x,name _x],0,.02,"PuristaLight","center"]
                    format ["%1-%2 | %3",_groupName,_id,name _x],0,.035,"PuristaMedium","center"]
            };
        } count allUnits - [player];
    }
];
ruby bronze
#

Wow thanks, I'm going to try it out!

queen cargo
ruby bronze
#

Trying to figure out Draw3D right now lol

#

I'm not finding any solutions for limiting the text to a short distance. The wiki page is helpful but includes no distance parameter.

What I have right now for testing is:
addMissionEventHandler ["Draw3D", { drawIcon3D ["", [1,0,0,1], crate1, 0, 0, 0, "Medical", 1, 0.02, "PuristaMedium"]; }];

But it shows at all ranges, and at all angles instead of only when the player looks directly at it.

copper raven
#

you need to adjust it's width and height in relation to the distance between the crate and the player

#

you can also just reduce the alpha as the player goes further away

#

text size actually, as you don't use an icon, so width and height are irrelevant

ruby bronze
#

I have no idea how to go about changing the alpha based on distance, but that's a good lead thank you

copper raven
#

the color is in format of [r,g,b,a] in your case it's [1,0,0,1], so the last element would be the alpha, that's the value you'd want to change based on distance

ruby bronze
#

Right I knew that was the alpha value, but I don't know how to change it based on distance nor do I even know where to go to teach myself that

copper raven
#

instead of putting constant 1 as alpha, put some math in there

#

something like this [1,0,0,(20 - (player distance crate1) max 0) / 20]

#

this would basically make it so the text appears when you're atleast within 20meters, and fading in as you get closer

ruby bronze
#

Genius, that should probably do it. Testing now

#

Nice that works like a charm!

#

Thank you, and I'm going to have to study up on this distance wiki you provided

opal zephyr
#

The contents of this:
if !(mCache isEqualTo mList) then {
is running despite the fact I have checked and both mCache and mList are identical. They are both arrays.

Any help is appreciated

copper raven
#

print the arrays, like systemChat str [mCache, mList]

opal zephyr
#

I have

copper raven
#

what data do they hold?

opal zephyr
#

well I did it like this, but same difference.

   systemChat (format ["Cache:%1", mCache]);```
#

They both hold a string, an identical string

copper raven
#

identical in case sensitivity too?

opal zephyr
#

ya, it contains some underscores, text, and numbers and I think a hashtag. But the order and capitalization is the same, with no spaces or anything inbetween

graceful kelp
#

try
"isNotEqualTo"

copper raven
#

that's literally the same thing

graceful kelp
#

yh

#

different format

opal zephyr
#

ill give that a try, but ive used this in the exact same way before and not had a problem. Not sure what the issue is now. If it makes any difference im doing that if statement inside a function that im calling somewhere else in the code

little raptor
#

You can post the full code here and someone might take a look

drifting sky
#

Is there any possible way that in the following scenario, that the unit created could die before the "mpkilled" event handler is attached to it successfully? isNil { _new_unit = _group createUnit [_unit_array select INDEX_GROUP_CONFIG_UNIT_TYPE, _group_start_position, [], 0, "form"]; _killed_event_handler_index = _new_unit addMPEventHandler ["MPkilled",{ _this call func_UNIT_Killed_Event; }]; _new_unit setVariable ["KILL_EV_CONSTANTS", [_group_casualty_array,_killed_event_handler_index,_group_side], true]; };

#

Thus causing the code called in that event handler to fail to run?

little raptor
drifting sky
#

I've been double checking that the expected number of units are actually created, and there seems to be no issue there.

#

But the number created minus the number killed is not what should be expected

little raptor
#

Maybe your counter is wrong blobdoggoshruggoogly

drifting sky
#

By process of elimination, I suspect the fault is in the killed event handler somehow

little raptor
drifting sky
#

I'm testing all this on the server

#

the numbers aren't correct on the server itself.

little raptor
#

So just a self hosted MP then?

drifting sky
#

yep

little raptor
#

If you use killed EH does it work properly?

drifting sky
#

Ill check in a moment.

drifting sky
#

Hmm... it's looking like it might have been an illusion issue. Unless, it's not possible for a "spawned" script to sleep for a finite amount of time and then totally fail to wake up again, is it?

little raptor
drifting sky
#

but apart from that, it's not possible for the script to never wake up, right?

little raptor
#

Also if you use too many spawns the scheduler won't be able to queue your scripts properly

#

Especially if you use while without sleep, which is a total disaster

drifting sky
#

is there a point at which a spawned script wont be scheduled at all?

little raptor
#

If you have so many that the time it takes for the scheduler to sort the queue is longer than 3 ms
But that would be like several thousands/ millions I guess

The more likely problem is what I mentioned above

#

Try to reduce the number of scheduled scripts as much as possible

#

e.g. instead of spawning an infinite loop for every unit in the game, make a single infinite loop and iterate over the list of units instead

drifting sky
#

the number of spawned scripts I'm triggering is not very great. I'd say at most a few 10's per second.

#

but usually many fewer

little raptor
#

That is a lot tho meowsweats
Especially if they take a long time to finish

drifting sky
#

most finish in a couple of seconds

#

at most

#

and when I say sometimes 10's are triggered in a second, most of the time it's probably more around 1 or 2.

#

I don't suppose there's a command to see how many things are currently scheduled?

little raptor
#

Well in any case you better check to make sure
Not sure if A2 has a diag_activeScripts command

#

Also you can run something like this in debug console to measure how busy the scheduler is (i.e execution delay)

timer = diag_tickTime;
0 spawn {systemChat str (diag_tickTime - timer)}
#

if it's longer than 1s you might want to optimize your scripts to use fewer spawns

little raptor
#

You can write a wrapper for your spawns

#

Instead of doing spawn directly, use an intermediate function:

params ["_params", "_func"];
counter = counter + 1;
_params call _func;
counter = counter - 1;

And do;

[_params, my_fnc] spawn fnc_spawn_wrapper

That way you can know the number of spawned scripts at any time, using that counter variable
You can also measure how long they take
Doing it like that is a lot cleaner than messing up the scripts themselves

drifting sky
#
0 spawn {systemChat str (diag_tickTime - timer)}```  In the midst of the action, I never saw it read a value above .4 seconds, and usually it was hovering around 0.04.
little raptor
#

Okay

#

Then your script might be failing entirely

drifting sky
#

But, if it goes past 3s, it will just totally fail to schedule a spawned script, without showing any error?

little raptor
#

No I never said that meowsweats

#

It does work

drifting sky
#

show an error?

little raptor
#

But every script will be processed every 3s which is slow

little raptor
#

It still runs fine

#

I said 3ms, not 3s

#

And that was for scheduler sorting

drifting sky
#

3ms???

#

Wait what happens at 3ms?

little raptor
#

3 ms is the scheduler execution limit in every frame

drifting sky
#

you mean the maximum time it will be processed each frame?

little raptor
#

What I meant is that if the sorting process takes longer than 3ms then the scheduler won't have time to execute anything
And like I said it's a very unlikely scenario

little raptor
drifting sky
#

And there would have to be thousands of scripts in the queue for it to take that long, right?

little raptor
#

Yes

drifting sky
#

for sorting to take that long, that is.

#

Ok, good info. I suspect my original problem was an illusion caused by delays between ordering a group to be created, and the actual creation of the group.

#

because turning off the delay makes the discrepency disappear.

tough parrot
#

is there a better way to allocate grid arrays than typing gazillions of zeros and commas?

little raptor
tough parrot
#

loop pushback gobbles cpu. loop resize is closest i can imagine to "new float[a][b][c]"

little raptor
#
_row = [];
_row resize _b;
_row = _row apply {_value};
_array = [];
for "_i" from 1 to _a do {
  _array pushBack +_row;
};
//or 
_array = [];
_array resize _a;
_array = _array apply {+_row};

if you don't care about initialization it's a lot easier:

_array = [];
_array resize _a;
_array = _array apply {_row = []; _row resize _b; _row};
vague geode
#

Is there a way to detect e.g. SAMs (the missiles not the launcher) in a certain area?

I have tried nearEntities and nearestObjects but neither seems to be able to detect the missiles...

vapid drift
#

Is it possible to view all CBA functions added by a mod since they don't populate in the functions viewer?

willow hound
little raptor
vapid drift
little raptor
vapid drift
#

what do you mean "variables that are codes"? I'll go searching but how would I distinguish?

little raptor
#
_var isEqualType {}
vapid drift
#

ah, ok... never considered that

#

Thanks!

little raptor
vapid drift
#

...I was not aware this even existed

#

that is quite impressive... thank you for THAT also!

vague geode
#

Is there a way to spawn a group including the units from the CfgGroups by using its CfgGroups class name?

vague geode
vague geode
little raptor
#

no

vague geode
tough abyss
#

In my init.sqf I try to spawn an helicopter, teleport all players in it and then let the helicopter fly to an point, where they will get dropped. But the helicopter wont fly to the point.

init.sqf

_missionStartPos =  [4145.36,15927.3];
_dropPointPos = [4973.71,12526.9,0];
_dropPointHigh = [(_dropPointPos select 0), (_dropPointPos select 1), 4100];

_veh = createVehicle["RHS_Mi8t_vv", [0,0,0], [], 2, "FLY"];
sleep 0.1;
_veh setPosASL [4145.36,15927.3, 4000];
_veh setDir 180;
_veh flyInHeight 4000;
createVehicleCrew _veh;
_vehGroup = (group _veh);

_driver = driver _veh;
_vehGroup setBehaviour "careless";
_driver disableAI "FSM";
_driver disableAI "Target";
_driver disableAI "AutoTarget";

while {(count (waypoints _vehGroup)) > 0} do {
    deleteWaypoint ((waypoints _vehGroup) select 0);
};    

[allplayers, {player moveInCargo _veh}] remoteExec ["call", 0];

_wp0 = _vehGroup addWaypoint [_missionStartPos, 0];    
_wp0 setWaypointSpeed "FULL";
_wp0 setWaypointType "MOVE";    
_wp0 setWaypointBehaviour "COMBAT";
    
_wp1 = _vehGroup addWaypoint [_dropPointPos, 0];    
_wp1 setWaypointSpeed "FULL";
_wp1 setWaypointType "MOVE";    
    
_trgEject = createTrigger ["EmptyDetector", _dropPointHigh];
_trgEject setTriggerArea [800, 50, 180, false];
_trgEject setTriggerActivation ["ANY", "PRESENT", false];
_trgEject setTriggerStatements ["(thisTrigger getVariable 'veh') in thisList","{_x execVM 'scripts/halo.sqf';} forEach allPlayers;", ""];
_trgEject setVariable ["veh", _veh];
drifting ocean
#

Theoretically, just hook whatever is spawning/is going to spawn the AI unit up to a condition which will either allow the spawn to take place or not depending on if the condition is met or not

vague geode
drifting ocean
#

Or if that doesn't work, you'd likely need to check the radius around a marker that you place in the sector

vague geode
drifting ocean
#

Do you already have the function to spawn them set up?

vague geode
drifting ocean
vague geode
# drifting ocean So it seems like the logic here sounds like: while no enemy players are within a...

That wouldn't be that hard, but I want to replace individual dead units in the group so basically as soon as the unit is killed a new unit of the same type with all the same properties spawns and takes over the position of the unit that was killed in the group (e.g. if the leader dies a new Team leader unit is spawned, joins the group on the dead leaders position and takes command of the group).

vague geode
drifting ocean
#

Or, you could consider adding a "Killed" eventhandler to each unit in the array

vague geode
drifting ocean
#

You donโ€™t have to copy paste, run a for loop that only loops while a condition is true

#

Or a while loop, whichever you find best suits your situation

little raptor
vapid drift
#

@little raptor thanks for the earlier suggestions man... they're not helping in this particular case but those advanced developer tools you put together... very nice

little raptor
#

if the function is defined at all

vapid drift
#

Yeah, I'm thinking that's the issue... I think they're a couple of actions added to the player that call a script

little raptor
#

what mod are you talking about anyway?

vapid drift
#

SPS BlackHornet PRS

little raptor
#

and what kind of "function" are you looking for?

vapid drift
#

I was trying to find the "function" it calls when it spawns the uav

#

I've spent more time trying to find this than just recreating myself so I'm just gonna go that route to get some functionality I want

little raptor
#

all vehicle related actions and scripts are defined there

vapid drift
#

Yeah... only actions present there are to re-add it to your inventory

#

I think some actions are added to the players with conditions based on whether or not the uav is in your inventory

little raptor
#

the "function" it calls when it spawns the uav
I don't know what you mean here, but it sounds like you're talking about the init EH

vague geode
# drifting ocean You donโ€™t have to copy paste, run a for loop that only loops while a condition i...

No, you misunderstand me. If I want to create a new unit via the code in the killed event handler of the old one I obviously have to add a killed event handler to the newly created unit as well which in turn needs to contain the code to create a new unit and add a killed event handler to that one and so on and so forth but with your array idea it's a lot easier and I don't even need a killed event handler.

_unit addEventhandler ["Killed", {
  _newUnit = /* create new unit */;
  _newUnit addEventhandler ["Killed", {
    _newNewUnit = /* create new unit */;
    _newNewUnit addEventhandler ["Killed", {
      /* and so on and so forth */
    }];
  }];
}];
little raptor
little raptor
#

you make a function

vapid drift
#

I'm not conveying the situation properly but I've come up with a suitable workaround I suppose

little raptor
#
//fn_blabla.sqf
params ["_unit"];
_unit addEventhandler ["Killed", {
  _this call my_fnc_blabla;
}];
vague geode
fast pond
#
_unit addEventhandler ["Killed", {
  _unit = /* create new unit */;
}];

wouldn't this work?

fast pond
#

I mean, the new unit should still have the event handler

#

you'd have to test it to be sure but if you already have a work around ig it doesn't matter

vague geode
vague geode
vapid drift
#

I think replied to* the wrong person

vague geode
vapid drift
#

Nope

vague geode
vapid drift
#

lol no sweat bro... just letting you know you may have pinged the wrong person

tough parrot
#

how is this error possible when vectorDir returns array
Error in expression < matrixMdlSpc matrixMultiply (vectorDir matrixMan);
Error position: <matrixMultiply (vectorDir matrixMan);
Error Type Number, expected Array

little raptor
vapid drift
#

So I guess my solution wasn't as suitable as I thought... since I'm unable to access the actions that are added to the BlackHornet when it's spawned... is there anyway to listen for it's creation? I'm not seeing anything in the eventHandlers that looks to fit

#

Well... I suppose I could just create a unique config for it and add an additional action that way?

distant oyster
#

CBA has functions that run on vehicle creation

vapid drift
vapid drift
#

I'm trying to add an action to the SPS BlackHornet PRS

#

it's prohibitively copy protected and it deploys from an action added to the player

#

It's really frustrating me

#

All that to say I can't really add an event handler to the object itself because I'm not creating it...

#

Might just have to accept that there's no real attractive way to accomplish my goal... I'll just have to continue lowering my standards until I find something that works

distant oyster
#

why shouldnt that cba function not be able to do that?

vapid drift
#

I think I misread... so I could use an "init" event handler for that class and accomplish what I need couldn't I?

distant oyster
#

yes?

vapid drift
hasty current
#

Question, how do I remove binoculars from a unit? Tried unlinkItem, but it doesn't seem to work

pulsar whale
#

How would I prevent all vehicles from getting destroyed? I still want them to take damage but would like to prevent them from blowing up. This includes planes, helicopters, vehicles and boats?

#

This would include all vehicles on the map. Friendly, enemy and civilian?

distant oyster
hasty current
#

Oh, are they? Let me try remove weapon then

#

Bingo, thank you

distant oyster
vapid drift
#

I need to read better my gosh

fringe pier
#

i need help with the fired eventhandler
since it doesnt include the listener as a variable, how do i make a group of enemy ai within 300 meters go to the firers location?
this is my first script ever and its difficult

stone coral
#

What is the best command to tell if you are on a road or a trail ?

stone coral
young current
stone coral
young current
#

probably by checking the texture

cunning oriole
stone coral
#

So i have made a test script. And I just need to sort out the trail from the rest.

#

if _dir isEqualTo ("TRACK") or ("ROAD") or ("MAIN ROAD") then

#

But the above is not working. I am doing something wrong with isEqualTo ?

stone coral
#

Nevermind I figured it out ๐Ÿ™‚

flat eagle
#

Iv got a question guys. I have a script and it spawns groups of AI. Does anyone know how to add them to a curator?

flat eagle
#

i did try that keeps telling me the AI come back as a group and not a object

#

i used it like this
zuse1 addCuratorEditableObjects [_x];

distant oyster
flat eagle
#

alright but do i really need the true? the AI are just that AI, they arnt in any vehicles

distant oyster
#

yes you need it as it is required by the syntax

flat eagle
#

ok thank you

flat eagle
distant oyster
#

yw

vapid drift
#

@distant oyster Thanks again for pointing out the CBA class event handlers... I've managed to accomplish exactly what I was hoping to with it

distant oyster
#

yw too ;)

balmy onyx
#

hello i am having issues making a variable be displayed via the format command

#

format["%3: %1%2",(player getVariable ["KSS_thirst",0]),"%", localize "DRG_thirst"]

#

right now it calls the var3 and var2 so it displays Hunger:0%

#

however i cannot get var1 to display. it is calling a variable from the KSS hunger mod and i can getvariable kss_thirst from the debug menu in editor

#

nevermind i am an idiot i needed to use "missionnamespace" instead of "player" as the varspace

boreal parcel
#

Heyo, hate to ask for help here but whenever I ask in the lib discord I cant seem to get any help, does anyone have any idea what this error might be about? it only happens on this map and im not certain why

Tbh im not even sure where or how the recycle_manager script is called, I was thinking maybe a marker or building or something wasnt placed but I cant seem to figure it out

22:32:13 Error in expression <&
_x distance2d startbase > 1000 &&
(_x distance2d ([] call KPLIB_fnc_getNearest>
22:32:13   Error position: <distance2d ([] call KPLIB_fnc_getNearest>
22:32:13   Error 0 elements provided, 3 expected
22:32:13 File C:\Users\Administrator\Documents\Arma 3 - Other Profiles\Damien%2eB\mpmissions\kp_liberation.fallujah\scripts\client\actions\recycle_manager.sqf..., line 37
#

I have to assume that it is something not being placed in the mission because all of the other maps use the exact same framework files and dont have this issue

copper raven
#

it sounds like you're passing an empty array to distance2d

boreal parcel
#

it makes sense its empty, there are no fobs at mission start

#

im pretty sure this is that function btw

params [
    ["_pos", getPos player, [[]], [2, 3]]
];

if !(GRLIB_all_fobs isEqualTo []) then {
    private _fobs = GRLIB_all_fobs apply {[_pos distance2d _x, _x]};
    _fobs sort true;
    (_fobs select 0) select 1
} else {
    []
};
copper raven
#

well yeah, that makes sense

boreal parcel
#

thing is, I havent changed anything regarding any of these scripts, so I dont understand why its acting up and putting the mission into a infinite starting loop on this one mission

#

this is part of the script thats throwing the error btw

private _detected_vehicles = (getPos player) nearObjects veh_action_detect_distance select {
            (((toLower (typeof _x)) in _recycleable_classnames && (({alive _x} count (crew _x)) == 0 || unitIsUAV _x) && (locked _x == 0 || locked _x == 1)) ||
            (toLower (typeOf _x)) in KPLIB_b_buildings_classes ||
            (((toLower (typeOf _x)) in KPLIB_storageBuildings) && ((_x getVariable ["KP_liberation_storage_type",-1]) == 0)) ||
            (toLower (typeOf _x)) in KPLIB_upgradeBuildings ||
            (typeOf _x) in KP_liberation_ace_crates) &&
            alive _x &&
            (
                // ignore null objects left by Advanced Towing
                // see https://github.com/sethduda/AdvancedTowing/pull/46
                (((attachedObjects _x) select {!isNull _X}) isEqualTo [])
                || ((typeOf _x) == "rhsusf_mkvsoc")
            ) &&
            _x distance2d startbase > 1000 &&
            (_x distance2d ([] call KPLIB_fnc_getNearestFob)) < GRLIB_fob_range && // Line 37
            (getObjectType _x) >= 8
        };
copper raven
#

thats... eh

#

well, that's not the issue, the issue is here:

else {
    []
};

empty array being returned thus distance2d error

#

add some fobs? idk ๐Ÿ˜„

boreal parcel
#

I cant even start the mission lol

#

maybe this isnt the error that is making the mission start infinitely? I dont know anymore, im really confused

balmy onyx
#

i am trying to reverse engineer some old scripts to use with my personal play group and this script is missing a function.

        [[player, _loot] call ARMST_fnc_giveLootToPlayer, localize "str_remain_complete"];
    };```
#

now _loot is an array that is comprised of 3 different items that are randomly selected

#

i am not good enough to create my own functions so I tried to work around it by using additem but that does not work with arrays so I tried using "str" to convert _loot but i think i messed up somewhere in the code

#

am i on the right track in attempting to covert _loot to a string so I can use it with additem?

tough parrot
#

I chose dev build to use a command added in 2.08, but the version is now 2.07

pulsar whale
little raptor
#

odd versions are dev

little raptor
# fringe pier i need help with the fired eventhandler since it doesnt include the listener as ...

it doesnt include the listener as a variable
there's no "listener". it just triggers when the vehicle fires and reports parameters related to the firer.

go to the firers location
you can either use FiredNear EH instead, or just loop through the list of enemy units and find those within 300 m.
e.g.

{
  if ([side _x, side _firer] call BIS_fnc_sideIsEnemy && {leader _x distance _firer < 300}) then {
    _x move ASLtoAGL getPosASL _firer;
  };
} forEach allGroups;
little raptor
distant oyster
stone coral
#

Hi gain ๐Ÿ™‚
I need to filter out trails from an array of roads. "nearRoads" returns an array of roads.
I can use getRoadInfo to get info about a given road but I cannot get it to handle an array?
Could I use "forEach" to make getRoadInfo handle each object in the array ?

willow hound
#

Yes, loops would be used for that.
In this case however, https://community.bistudio.com/wiki/select#Syntax_6 might be shorter and faster (of course, it uses a loop internally):

private _resultArray = [];
{
  if (/*condition*/) then {
    _resultArray pushBack _x;
  };
} forEach _inputArray;
```... is equivalent to ...
```sqf
private _resultArray = _inputArray select {/*condition*/};
distant oyster
#

Is something wrong with my regex?

"Function: BIKI_fnc_parseFunctionHeader
Description:
        Extracts information from the header of a CBA like function.
Parameters:
        _fnc - The name of the function to parse <STRING>
Returns:
        _info - __DESCRIPTION___ <__TYPE__>
Examples:
        (begin example)
                __RETURN__ = __ARGS__ call BIKI_fnc_parseFunctionHeader;
        (end)
Author:
        Terra
---------------------------------------------------------------------------- */"
regexFind ["(?<=Description:\n).*?^(?!\t)/i", 0]
// Returns: [[["",52]]]
little raptor
#

arma regex is multiline

#

^ is detecting the start of the string for you

#

not start of line

distant oyster
#

ah

little raptor
distant oyster
#

that captures till the end of the string

little raptor
#

I edited it again

#

did you use the new one?

distant oyster
#

yep no change

#

(?<=Description:\n).*?\n(?!\t) this would work but includes the linebreak in the capture

little raptor
distant oyster
#

but $ is end of string again, isnt it?

little raptor
#

I don't think so thonk

#

there was some weirdness with this regex stuff back when I was working with it
I don't remember what it was meowsweats

distant oyster
#

huh you are right

#

oh wait that wont work with multi line descriptions

#
/* ----------------------------------------------------------------------------
Function: BIKI_fnc_parseFunctionHeader
Description:
        Extracts information from the header of a CBA like function.
        This is a test.
Parameters:
        _fnc - The name of the function to parse <STRING>
Returns:
        _info - __DESCRIPTION___ <__TYPE__>
Examples:
        (begin example)
                __RETURN__ = __ARGS__ call BIKI_fnc_parseFunctionHeader;
        (end)
Author:
        Terra
---------------------------------------------------------------------------- */
little raptor
#

(?<=Description:\n).*?(?<=$)\w
what about that?

distant oyster
#

nope

little raptor
distant oyster
#

first line only again

little raptor
#

or more generally:

(?<=Description:\n).*?$(?!\s)
little raptor
distant oyster
#

thats quite possible

little raptor
#

actually now that I think about it I didn't account for the \n and \r after $

distant oyster
#

(?<=Description:\n).*?\n(?!\s) would work but includes the last new line again

willow hound
#

Can always trim it afterwards.

little raptor
#

unless that is not a possiblity/concern

distant oyster
#

what do you mean?

little raptor
distant oyster
#

yeah that's not possible. there will always be a newline as you have to close the function header with a comment string

stone coral
distant oyster
distant oyster
willow hound
# stone coral So this is my small testcode ```sqf _pos = getPos player; _road = _pos ...

The condition needs to be an expression that returns true if the examined element (i.e. the examined road) should be added to _resultArray. If the condition returns false, the element is not added.
I don't know what exactly you are trying to achieve, so I can't tell you what condition you need.
One example:

(getRoadInfo _x) # 0 == "TRAIL"
```This will return `true` if the current element (`_x`) has *mapType* `"TRAIL"`.
distant oyster
winter rose
#

\r\n * actually Oo

distant oyster
#

uuh sure

winter rose
#

\n for Linux,
\r for Mac,
\r\n for Windows iirc ๐Ÿ˜„

distant oyster
#

git commits with \n right?

winter rose
#

it depends on the repo setup

stone coral
willow hound
#

No, this would not work for syntax reasons, but you are lucky, there is a very simple way to express your condition:

(getRoadInfo _x) # 0 != "TRAIL"
```This will return `true` if the current element has any *mapType* that is not `"TRAIL"`.
stone coral
craggy lagoon
#

I couldn't find anything in the Ace 3 Cargo Framework Wiki about how to set the name of cargo item via script. Anyone happen to know how to do this?

craggy lagoon
fair drum
#

so that function is called when renaming something while the cargo menu is probably open or something

craggy lagoon
little raptor
warm moss
#

is it alright if i just copy and past my message in one of the channels?

#

paste*

little raptor
warm moss
#

alright

#

appreciate the help

graceful kelp
#

this is giving me a generic error in expresion im not sure what is wrong with it i feel blind

waitUntil {(_projectile distance _targ < 2500);};
little raptor
graceful kelp
#

๐Ÿคฆโ€โ™‚๏ธ

opal zephyr
#

Is there a quick way to remove everything but one thing from an array?
array = ["dog#1","cat#2","parrot#3","cat#9"]
I want to only keep the ones that contain the word cat, and delete everything else

#

Im thinking maybe regex could handle it, but im not sure. Im not finding what im looking for on Wiki's

distant oyster
opal zephyr
#

And its ok if there is other words or numbers following "cat"?

distant oyster
#

yeah. in checks if the string is in another string, wherever that is

opal zephyr
#

Awesome ill give this a shot, thankyou so much!

stone coral
#

I want to align the vehicle according to the road direction. But itยดs like 50/50 on tanoa.
Anyone have a better solution ?

_pos = getPos player;          
_road = _pos nearRoads 100;    
_array = _road select {(getRoadInfo _x) # 0 != "TRAIL"};  
_availRoads = selectRandom _array;       
_nextRoads = roadsConnectedTo _availRoads;
_selectedroad = selectRandom _nextroads;
_spawnpos = getPos _selectedroad;
_car = "B_Quadbike_01_F" createVehicle _spawnpos;
_direction = _car getDir _selectedroad;
_car setDir _direction;
hint format ["vehicle at %1", _direction];```
finite schooner
#

Hey guys. I need some help scripting live feed helmet cameras, and an orbital UAV. My mission is set up so you play as an officer who chill in a command center, while you use high command to order around 3 assault groups, but Iโ€™ve tried everything and canโ€™t get live feed to broadcast to the screens in my command post. Help pls ๐Ÿ˜›

winter rose
finite schooner
#

Got it

hoary torrent
#

I'm trying to spawn a wrecked Xian transport, with this command createsimpleobject; a3\air_fexp\vtol_02\vtol_02_vehicle_f.p3d;
I keep getting "Invalid number in expression" there's no extra spaces and there's no special characters. What have I done wrong?

copper raven
brazen lagoon
#

is there a way to make AI automatically use ACE revive?

#

or is it just built into ACE?

fair drum
brazen lagoon
#

@fair drum is that also going to revive downed units

stone coral
little raptor
# stone coral Thx for answering:-). Can you specify what part is wrong ?

well first of all you're doing _car getDir _selectedroad. that gives the dir relative to the car, but you need the absolute dir. tho in this case that's not a problem because the initial dir of the car is probably 0, so the rel dir will become absolute

but the real problem is that you're measuring the direction between the centers of the road segments. that's not the same as the road dir.
Imagine these are two connected road segments, and the x marks are the road centers:
___x___
|
x
|
the dir between the two x's is not the same as either road dir.
you should get the beginning and end pos of each road segment instead. getRoadInfo already provides that info

sharp grotto
#

https://community.bistudio.com/wiki/onPlayerDisconnected

"Use playerDisconnected or HandleDisconnect instead in Arma 3."
playerDisconnected -> "Executes assigned code when client leaves the mission in MP. Stackable version of onPlayerDisconnected. "

What means Stackable in that content ? If you have multiple mods using the same EH ?

sharp grotto
dreamy kestrel
#

Q: trying to find the docs on if CONDITION ... the CONDITION part, specifically in how code blocks are evaluated. Are they lazily evaluated? i.e. after all other conditions have been determined? I have a use case something like this, for instance:

if (_condA && !(_condB || _condC) && { [] call MY_condD; }) then {
  // ...
};

Or similarly:

if (...) exitWith {
  true;
};
winter rose
hoary torrent
drifting ocean
#

inj1BV = "Blood Volume = 5.5L";
inj1HR = "Heart Rate = 48";
inj1BP = "Blood Pressure = 86/74";
inj1Skin = "Skin is pale, cool, and sweaty";
inj1Vitals = [inj1BV, inj1HR, inj1BP, inj1Skin];
//Base values
op1 = false;
op2 = false;

call {
    if (op1) exitwith {
        inj1BV = "Blood Volume = 4.9L";
        inj1HR = "Heart Rate = 56";
        inj1BP = "Blood Pressure = 81/77";
        inj1Skin = "Skin is pale, cool, and sweaty";
        inj1Vitals = [inj1BV, inj1HR, inj1BP, inj1Skin];
    };
    if (op2) exitwith {
        inj1BV = "Blood Volume = 5.4L";
        inj1HR = "Heart Rate = 42";
        inj1BP = "Blood Pressure = 67/58";
        inj1Skin = "Skin is pale, cool, and sweaty";
        inj1Vitals = [inj1BV, inj1HR, inj1BP, inj1Skin];

Is there a more optimised way of updating these variables?

distant oyster
drifting ocean
#

Thanks Terra!! Iโ€™ll definitely do this ๐Ÿ˜

stone coral
stone coral
little raptor
#
_dir = _dir + selectRandom [0, 180];
stone coral
pulsar whale
distant oyster
quasi sedge
#
_randomElement = selectRandom [1,2,3];
        if (_randomElement == 0) then
        {
            playSound3D [getMissionPath "1.ogg",vehicle player,false,vehicle player,1,1,10,0,true];
        };
        if (_randomElement == 1) then
        {
            playSound3D [getMissionPath "2.ogg",vehicle player,false,vehicle player,1,1,10,0,true];
        };
        if (_randomElement == 2) then
        {
            playSound3D [getMissionPath "3.ogg",vehicle player,false,vehicle player,1,1,10,0,true];
        };
#

what errors here? .rpt no erros

winter rose
#

selectRandom [1, 2, 3] but "if 0 1 2" ๐Ÿ˜‰

open fractal
#

it's absurd how much i learn just by watching what goes through this channel

#

my brain expands ๐Ÿง 

drifting ocean
#

Same. This channel is an amazing resource. I'm very appreciative of the people here who actively help

open fractal
#

arma 3 unironically teaching me coding techniques

quasi sedge
#

Not sure why sound is not played,
whole script basically adds sounds of tank gun reloading,
hint and reloading works great
https://community.bistudio.com/wiki/playSound3D

vehicle player addEventHandler ["Fired",{ 
_this spawn {
if (
_this select 5 == "rhs_mag_M829A3" or 
_this select 5 == "mkk_125mm_SABOT_MAG" or 
_this select 5 == "mkk_1Rnd_KE_shells" or 
_this select 5 == "mkk_mag_bm25_2_1" or 
_this select 5 == "mkk_1Rnd_85mmHEAT_D5" or 
_this select 5 == "mkk_1Rnd_105mm_HEAT_MP_T_Green")
then { 
        hint "ะŸะตั€ะตะทะฐั€ัะดะบะฐ 6 ัะตะบ"; 
        private _sound = selectRandom ["1.ogg", "2.ogg", "3.ogg"];
        playSound3D [getMissionPath _sound, vehicle player, false, vehicle player, 1, 1, 10, 0, true];
        sleep 6;  
        vehicle player addMagazineTurret ["rhs_mag_M829A3",[0]];
        vehicle player addMagazineTurret ["mkk_125mm_SABOT_MAG",[0]];
        vehicle player addMagazineTurret ["mkk_1Rnd_KE_shells",[0]];
        vehicle player addMagazineTurret ["mkk_mag_bm25_2_1",[0]];
        vehicle player addMagazineTurret ["mkk_1Rnd_85mmHEAT_D5",[0]];
        vehicle player addMagazineTurret ["mkk_1Rnd_105mm_HEAT_MP_T_Green",[0]];
  }; };}];
winter rose
cosmic lichen
#

That condition notlikemeow

distant oyster
#

how do i get "<STRING>" to be displayed in structured text? i know that a non-breaking-space can be displayed as &#160; but what is the code for < and >?

#

welp it was &lt; and &gt;

#

thanks @distant oyster !

cosmic lichen
#

You're welcome @distant oyster

winter rose
#

don't mention it @distant oyster

distant oyster
winter rose
quasi sedge
#
private _sound = selectRandom ["1.ogg", "2.ogg", "3.ogg"];
        playSound3D [getMissionPath _sound, vehicle player, false, vehicle player, 1, 1, 10, 0, false];

dunno why sound isn't played, same - no .rpt erros
no sould if i get out from vehicle

pulsar whale
drifting ocean
#

And the distance as well, that also affects the volume it seems

open fractal
drifting ocean
#

Because the target is the vehicle you're in, the sound is played from the center of the vehicle, so if youre too far away from the center it might just be too quiet for you to hear. But if you increase the distance so you can hear it, people outside of the vehicle would easily be able to hear it. playSound locally for the crew is probably a better option, as artistan recommended

quasi sedge
#

player addAction ["<t color='#FF0000'>This Useless Action Is RED</t>", {playSound3D [getMissionPath "1.ogg", vehicle player, false, vehicle player, 5, 1, 10, 0, false];}];

#

not working even, seems like issue with arma 3 compatibility with audio file/codec.
I mean vehicle player should work while player is on own foots, isn't?

drifting ocean
quasi sedge
#

playSound3D [getMissionPath _sound, vehicle player, false, vehicle player, 5, 1, 10, 0, false];

playSound3D [getMissionPath _sound, vehicle player, false, getPosASL vehicle player, 5, 1, 10, 0, false];
๐Ÿคฆ๐Ÿผโ€โ™‚๏ธ

distant oyster
finite sail
#

@little raptor thanks for continuing supports and updates for advances dev tools

#

i don't load other tools now, yours does everything i need

open fractal
quasi sedge
#

everything works ok now, just wrong parameter - position of sound "vehicle player" vs "getPosASL vehicle player"

open fractal
#

may I ask why you are playing a 3D sound for armor interior?

open fractal
quasi sedge
#

no, but its okay, i could make sound 1km+ and local only, so no issue here

open fractal
#

it quite literally just plays the sound in the player's ears

tight cloak
#

anyone got the syntax for hold action, condition:
checking distance between two objects

#

so if x is close to y then its visible, otherwise the action is hidden

#

trying to get a truck to be able to load an object when close

steady rose
#

Hey so i'm trying to make a CUP cdf vehicle service point function the same way it did in arma 2 with you just simply driving up to the object and you'd be refueled and rearmed.

#

I know the script exists but as to where to find it i'm kind of lost

neon dragon
#

How do i let my friend into my private server?

hoary torrent
# little raptor what's the code?

The code on the page: createSimpleObject a3\armor_f_beta\apc_tracked_01\apc_tracked_01_rcws_f.p3d This returns "Missing ;"

my code: createsimpleobject; a3\air_fexp\vtol_02\vtol_02_vehicle_f.p3d; This returns "Invalid number in expression"

winter rose
quasi sedge
tough abyss
#

Is there a way to spawn helicopters in a height, without using setPos or setPosASL?

winter rose
winter rose
#

createVehicle

tough abyss
#

Because when I set the position with setPos the helicopter has some weird behavior

The create vehicle does not have a way to set an height?
Yeah sorry i am just not sure whicht thread is the right one for questions like that

winter rose
#

!quote 5

lyric schoonerBOT
winter rose
#

use setPosASL or setPosATL
this does not change helicopter's behaviour

#

The create vehicle does not have a way to set an height?
it has, the position array's 3rd value

tough abyss
#

When I set the Pos via setPos the helicopter just wont fly to an waypoint and make weird circles for some weird reason
I sit on this problem for like 3 days and if I am not using setPos the helicopter is flying normally
I also tried using setPosASL, that was the way I tried it the longest time

createVehicle = position: Object, Array format Position2D or PositionAGL - desired placement position

winter rose
#

that's not setPos or anything, the issue is most likely the waypoint's altitude
create it at the wanted altitude, use flyInHeight or flyInHeightASL, and set the waypoint's altitude around that flight altitude (it is +/- 200m distance completion iirc)

tough abyss
#

Okay weird, I will try that but i am sure i have done that last time

tough abyss
#

Okay so I have tried to set the 3rd value in create vehicle and it just spawned 50 meters above ground

#

And also with setPos asl and the waypoint in the height of flyheight the helicopter begins to circle around. He does not do that when I am not using setPosASL but then it takes ages to get to the height I want it to be

#

Okay, is there a way to set the engine of the helicopter immediatly to on? Because if I am not using the FLY in

 _veh = createVehicle["O_Heli_Light_02_dynamicLoadout_F", getMarkerPos ["marker1", true] , [], 0, "FLY"]; 

the helicopter gets spawned in the height but with engine off. When I am using engineOn

_veh engineOn true;

He has to slowly start the engine and tumble down to the ground

naive vapor
#

I am having lots of issues with my model.cfg. When I use pboProject all it says is "model.cfgs for this pbo have errors". This is for a mask I am making. I am using a slightly edited model.cfg from the character template just like how Sokolonko used in his video tutorial. Only hint as what may be wrong is when I try and view the mask in Object Builder after making the model.cfg I get a error that says " File P:a3+MGR+\Cyborg\Cyborg Mask\model.cfg, line 161:/CfgModels/: 'W' encountered instead of '{' ". After I go back and check my model.cfg and check there is nothing for line 161. I tried simply putting a "{" in the line and it did nothing. Confusing thing is it worked fine in the video I am following along with. I am able to bring up the model in Object Builder if I delete the model.cfg and the model.cfg.bak. Does this sound familiar to anyone? I feel I should mention it is in the same folder as the model.

boreal parcel
#

heyo, how would I go abouts creating a script to play an audio file on loop until the player is out of trigger?

I was assuming maybe something like

params [
  ['_play', false]
]

while {
_play
} do {
  playSound 'cfgSounds_Class';
}

then call it with something like this?
true call 'file.sqf'

But is this feasible for multiplayer?
It should also stop playing once the player leaves the trigger right?
And finally the loop wont start again until after the sound file from playSound has finished playing right?

fair drum
#

@boreal parcel

"then call it with something like this?"
-no

"But is this feasible for multiplayer?"
-no

"It should also stop playing once the player leaves the trigger right?"
-no

"And finally the loop wont start again until after the sound file from playSound has finished playing right?"
-no

#

lots to unpack in your question, but we are very far off from where you need to go currently

#

so you need to read up on multiplayer locality, while loops (specifically how fast they run, which is why you need to have a sleep in there somewhere), the return of playSound and how we can get around it so it doesn't double play

#

cause currently, you have:

a while loop with no sleep which will attempt to run every frame, which will create a new sound every attempt, that will stack

boreal parcel
#

gotcha, yeah I dont have much experience scripting with arma/sqf, I guess I was used to the language handling the majority of that. Well thanks, ill take a look into that in a few and probably come back here once ive made some progress and get stuck on something else

fair drum
#

playSound returns an object, so it can be checked for its existence using isNull

#

there's your work around

boreal parcel
fair drum
boreal parcel
#

thats a good idea, could I script the ai to simply fire at a certain target? I tried this doTarget target1; this doFire target1 in the units init field however they didnt care to shoot at the targets lol

fair drum
#

take a look in the function viewer for the tracer module to see how to do that. its complicated, but you can do an easier version

boreal parcel
#

right, I seen the tracer module as well but I dont think I was able to get it to fire, however ill look into that as well. Im sure some googling will get me an answer there

fair drum
wary hill
#

Hi, I want to playSound while BIS_fnc_blackOut, however blackout is suppressing the sound volume, playMusic is not an option. Any suggestions around this?

pliant stream
#

sounds aren't layered so there is no way to e.g. mute the environment and play a sound on top

wary hill
#

I've already found a bypass. I used cutText with "BLACK OUT" and "BLACK IN" options as well as empty text field. This works pretty much the same as fnc_blackOut but didn't suppress any sounds at all.

warm hedge
winter rose
#

ah yeah, true ๐Ÿ˜„

stone coral
pale glacier
#

Hello! Question
I'm trying to randomize unit (bob) location within a specific marker, but he always spawns in the middle of the "marker1". So I guess my use of BIS_fnc_randomPos is wrong...

This is what I tried to do

[bob SetPos getMarkerPos "marker1"] call BIS_fnc_randomPos
#

What is wrong?

winter rose
#

!quote 5

lyric schoonerBOT
winter rose
#

you send setPos result to the function, this is why @pale glacier

pale glacier
#

stop using 'setPos' for the love of god ๐Ÿคฃ
So what is recommended to use?

winter rose
#

setPosATL, setPosASL, setPosWorld depending on your needs ๐Ÿ™‚

pale glacier
#

I just need them to spawn randomly within a marker area.
I guess I also should use findSafePos?

winter rose
pale glacier
#

Don't worry about the marker name, I changed it to "mark1"

warm hedge
#

getMarkerPos "mark1" instead "mark1"

winter rose
#

nonono

#
bob setPosATL ([["marker1"]] call BIS_fnc_randomPos);
```my bad, it's an array of arrays
warm hedge
#

Argh

#

so it's tie now, you lied once I lied once

winter rose
#

though a lie implies an intention to deceive ๐Ÿ˜› one can tell a wrong info without meaning to harm!

pale glacier
#

Works! Thanks a lot guys, now I can rebuild my brain again after I melt it down

๐Ÿป

grim ravine
#

Q about BIS_fnc_traceBullets, will it trace submunitions?

#

I am trying to see if my submunitions are working as intended and it would be nice to see visually ๐Ÿ™‚

tough abyss
grim ravine
little raptor
tough abyss
#

@little raptor LouMontana said yesterday that it has to be on the height of the flyheight, but it does not matter, same behaivor in both cases. The helicopter flys 50 meters forward and then starts circeling. It does that everytime I use setPos in different forms (ASL ATL)

little raptor
tough abyss
#

It is like 2km away

little raptor
#

what is your code?

tough abyss
#
_flyHeight = 1000;
_missionStartPos =  [3400,8000,_flyHeight];
_dropPointPos = [3436.58,3779.73,_flyHeight];
_dropPointHigh = [(_dropPointPos select 0), (_dropPointPos select 1), (_flyHeight + 100)];
_marker1 = createMarker ["marker1", _missionStartPos];
"marker1" setMarkerPos _missionStartPos;
_veh = createVehicle["O_Heli_Light_02_dynamicLoadout_F", _missionStartPos , [], 0, "FLY"];
createVehicleCrew _veh;
_vehGroup = (group _veh);
sleep 0.1;
_veh flyInHeight _flyHeight;
_veh enableCopilot false;
_veh lockDriver true;

_driver = driver _veh;
_driver disableAI "FSM";
_driver disableAI "Target";
_driver disableAI "AutoTarget";

while {(count (waypoints _vehGroup)) > 0} do {
    deleteWaypoint ((waypoints _vehGroup) select 0);
};    

_vehGroup setBehaviour "CARELESS";
_vehGroup setSpeedMode "NORMAL";
_vehGroup setCombatMode "GREEN";

_veh setPosASL _missionStartPos;

[allplayers, {player moveInCargo _veh}] remoteExec ["call", 0];

_wp0 = _vehGroup addWaypoint [_missionStartPos, 0];    
_wp0 setWaypointSpeed "NORMAL";
_wp0 setWaypointType "MOVE";    
_wp0 setWaypointBehaviour "CARELESS";
    
_wp1 = _vehGroup addWaypoint [_dropPointPos, 0];    
_wp1 setWaypointSpeed "NORMAL";
_wp1 setWaypointType "MOVE";
_wp1 setWaypointBehaviour "CARELESS";

_wp2 = _vehGroup addwaypoint [_missionStartPos, 0];
_wp2 setWaypointSpeed "NORMAL";
_wp2 setWaypointType "MOVE";
_wp2 setwaypointbehaviour "CARELESS";
    
_trgEject = createTrigger ["EmptyDetector", _dropPointHigh];
_trgEject setTriggerArea [800, 50, 180, false];
_trgEject setTriggerActivation ["ANY", "PRESENT", false];
_trgEject setTriggerStatements ["(thisTrigger getVariable 'veh') in thisList","{_x execVM 'scripts\halo.sqf';} forEach allPlayers;", ""];
_trgEject setVariable ["veh", _veh];
little raptor
# tough abyss ```sqf _flyHeight = 1000; _missionStartPos = [3400,8000,_flyHeight]; _dropPoint...

[allplayers, {player moveInCargo _veh}] remoteExec ["call", 0];
this is wrong
createVehicleCrew _veh;
_vehGroup = (group _veh);
you can combine these:

_vehGroup = createVehicleCrew _veh
_trgEject setTriggerArea [800, 50, 180, false];
_trgEject setTriggerActivation ["ANY", "PRESENT", false];
_trgEject setTriggerStatements ["(thisTrigger getVariable 'veh') in thisList","{_x execVM 'scripts\halo.sqf';} forEach allPlayers;", ""];
_trgEject setVariable ["veh", _veh];```

this trigger is pointless. waypoints have completion statements

_dropPointPos = [3436.58,3779.73,_flyHeight];
again you should try this at height 0. not sure if it matters for helicopters, but it sure matters for infantry

#

_veh setPosASL _missionStartPos;
also this is wrong too. flyInHeight is AGL, not ASL

#
_veh setPosASL AGLtoASL _missionStartPos;
#

that's the correct version

#

_flyHeight = 1000;

#

also this is too high for helicopters afaik

tough abyss
#

Thank you for the tipps, I am pretty new to sqf and it can be quite frustrating

little raptor
supple cove
#

Is there any way/addon to make server side http requests?

patent lava
#

im not sure where to start searching, but i know a respawn point can appear when synced to a trigger and the trigger activates without having to write any script

#

is it possible to accomplish this when i for example sync a unit to a trigger?

#

so maybe like run a script in the init of the unit which waits until the trigger its synced to is activated

winter rose
little raptor
supple cove
#

Thanks, I want to put an API between the server and the database so I can integrate with other apps, this is a start

still forum
#

If you have many result handlers. I recommend a hashmap<string, code>
don't do the if mess that I did ๐Ÿ˜„

patent lava
#

but now that i thought about it it might be kind of a flawed idea

dreamy kestrel
little raptor
#

the key here is the BOOL && CODE operator overload (as opposed to BOOL && BOOL)

#

it has nothing to do with if/select/etc.

steel fox