#arma3_scripting

1 messages Β· Page 657 of 1

agile flower
#

Sorry

#

But still, same result

winter rose
#

then idk

agile flower
#

Okay

crude needle
#

Are the sound files also on the dedicated server? Only other thing I would think could be Radio1 being undefined.

slate cypress
#

Is it possible to override a default action? Specifically "Get in <vehicle>" for a specific vehicle

winter rose
#

no afaik

#

(but mods maybe)

slate cypress
#

Can I at least remove a default action and then create it under the same name?

agile flower
crude needle
#

Have you just executed a playSound3D on the (dedicated) server with the debug console?

agile flower
#

I’ll try that

#

I’ll report back

fresh wyvern
#

Hi, I try to make the "B_Helipilot_F" spawn in as my subordinate when I spawn in the "B_Heli_Attack_01_F".
Anyone know where I go wrong?
I get an [Agent 0xf40820c0,<NULL-object>] error.

_veh = "B_Heli_Attack_01_F"createVehicle(player modelToWorld [8,0,0]); 
 
[_veh, ["B_Helipilot_F", "driver"], true, true, true] call BIS_fnc_initVehicleCrew
hallow mortar
crude needle
fresh wyvern
crude needle
#

Then do:

[_veh, ["B_Helipilot_F", "driver"], true, true, false] call BIS_fnc_initVehicleCrew

Agents don't have groups.

fresh wyvern
#

Hmm. ok, didn't know. So then what I do each time is creating a new group leader?

fresh wyvern
crude needle
#
private _crew = [_veh, ["B_Helipilot_F", "driver"], true, true, false] call BIS_fnc_initVehicleCrew;
[_crew select 0] joinSilent (group player);
fresh wyvern
surreal peak
#

Why does

systemChat format ["is bomb near: %1, %2",!isNull _dogNearestBomb,!isNil _dogNearestBomb];

ouput bool instead of true/false?

still forum
#

because your variable is probably nil

#

I guess you're not using isNil correctly

#

!wiki isNil

#

mh

surreal peak
#

well this is where the nearest bobm is calc:

_mines = [ nearestObject [ player, "MineBase" ], nearestObject [ player, "TimeBombCore" ] ];
_dogNearestBomb = [ +_mines, [], { _x distanceSqr player }, "ASCEND", { !isNull _x } ] call BIS_fnc_sortBy select 0;
surreal peak
#

glad to see you werent laughing at me D:

winter rose
still forum
#

ah, two objects

surreal peak
#

just realised isNil is not what I need, I did that because isNull wasnt working how I wanted

still forum
#

well if neither object was found they'll be null.
You told BIS_fnc_sortBy to remove all null elements. Thus you have empty array.
You grab first entry in empty array. That value is nil.
_dogNearestBomb is nil.

#

you need to check it using isNil I'd say

surreal peak
#

well that's what I get for copy and pasting code

still forum
#

which you attempted to do, but you didn't pay attention to the isNil syntax

surreal peak
#

ohhh string, WHY STRING?

tough abyss
#

Why does _removeAllWeapons remove everything in a units inventory? Binoculars, First Aid Kit, and so on? Isn't it supposed to remove weapons only? 😦

still forum
#

The command will be skipped and return nil

still forum
#

Just like how ammo boxes are vehicles

surreal peak
#

ohh, also for some reason

if (isNill "_dogNearestBomb") then {_boolVal = false};

fails. It shouldnt right?

still forum
#

you mean besides the typo?

surreal peak
#

oh ffs D:

tough abyss
#

will it work if I remove removeAllWeapons _unit; from this line of scriptcode;```sqf
private _weaponProbability = getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "randomWeaponProbability");

if (random 100 < _weaponProbability) then {
    removeAllWeapons _unit;
    {
        private _cat = format ["%1List",_x];
        if (count  (getArray(configFile >> "CfgVehicles" >> typeOf _unit >> _cat))>0) then {
            [_unit, _x] call FUNC(randomizeWeapon);
        };
    } foreach WEAPON_CATEGORIES;
};

};

#

and just add ```sqf
_this removeWeaponGlobal primaryWeapon _this; [_this] call CFP_main_fnc_randomizeUnit;

#

to the units init eventhandler in cfgvehicles? So it only removes the primary weapon and not touch anything else?

toxic dirge
#

trying to make the particle effect disappear like 3 meters from where it starts but no matter what I try it goes on for a long time

_ref = "#particlesource" createVehicleLocal (getpos bPos_01);
_ref setParticleCircle [1, [0, 0, 0]];
_ref setParticleRandom [8, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_ref setParticleParams [["\A3\data_f\cl_exp", 1, 0, 1], "", "Billboard", 1, 3, [0, 0, 0], [0, 0, -40], 0, 5, 5, 0, [5,5,7], [[0,0.1,1, 1], [0.01,0.02,1, 1], [0.01,0.02,1,0]],[0.02], 1, 0, "", "", bPos_01];
_ref setDropInterval 0.065;
winter rose
toxic dirge
winter rose
toxic dirge
#

velocity works but lifetime doesn't change

winter rose
#

lifetime is the "3" in "Billboard", 1, 3

toxic dirge
winter rose
#

seconds

#

you have an 8s random value in setParticleRandom…!

#

@toxic dirge ↑

toxic dirge
#

thank you lol

winter rose
#

happens πŸ˜„

dusky pier
#

Hi! Is possible to not allow take item from vehicle inventory to player's?

I try'd Take event handler, but is didn't work for me, maybe is possible to make it somehow else?

winter rose
#

iirc you can disable vehicle's inventory, see the wiki

dusky pier
#

i need vehicle inventory in my mission,

just - not allow player to take backpack\uniform\vest from vehicle - if vehicle inventory is full

winter rose
#

then yep, EH

dusky pier
#

this one

this addEventHandler ["Take", {
   params ["_unit", "_container", "_item"];
}];

or something else?

winter rose
#

I suppose so yes

dusky pier
#

kk, ty

queen junco
#

So, does anyone have an idea?

crude needle
#

For #2 use say3D if you want the sound to continue following the object's position.

Don't see how you could possibly be causing #1 with that action.

tough abyss
#

Can somebody please tell how I can make this line of script not remove any other inventory items but weapons? ```sqf
if (random 100 < _weaponProbability) then {
removeAllWeapons _unit;
{
private _cat = format ["%1List",_x];
if (count (getArray(configFile >> "CfgVehicles" >> typeOf _unit >> _cat))>0) then {
[_unit, _x] call FUNC(randomizeWeapon);
};
} foreach WEAPON_CATEGORIES;
};
};

still forum
#

manually remove primary/secondary/launcher weapon

#

instead of outright removing all

tough abyss
#

so remove and replace:```sqf
removeAllWeapons _unit;

#

So there is possibility to only remove primary weapon and make the script do what it is supposed to do? (Random Rifle)

still forum
#

yes

#

removeWeapon

#

primaryWeapon player

tough abyss
#

nvm I think I got ya. Cheers πŸ™‚

quasi sedge
#
//Bridge 1 destroyed
objective_1 = true;
target_1 addEventHandler ["killed", {
objective_1 = false;
sleep 60;
deleteMarker "marker_34";
}];
#

i want to delete marker_34 if target_1 (bridge) destroyed

#

how to use eventhander with sleep? Marker deletes correctly, but instantly, without sleep

crude needle
#
target_1 addEventHandler ["killed", {
  objective_1 = false;
  null = [] spawn {
    sleep 60;
    deleteMarker "marker_34";
  };
}];
quasi sedge
crude needle
#

Yes. No

quartz coyote
#

Help ...
Before the update, this returned the muzzle (or silencer) class name... Now it's empty...

((getArray (configFile >> "CfgWeapons" >> currentweapon player >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "CompatibleItems")) select 0)```
still forum
crude needle
#

Habit

still forum
#

And it will make the handle of the spawn stay in memory

#

so
automatically unloads from memory/cpu? no, the spawned handle is stored in the null variable.

#

By the way, the only place that "trick" was required was in editor scripts. And that will be fixed in 2.04 (already is fixed on #perf_prof_branch)

tough abyss
#

Now, nor the gear randomises, nor the weapons. The units just spawn in with their standard weapon. Am I on the right direction? Thank you very much.```sqf
private _weaponProbability = getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "randomWeaponProbability");

if (random 100 < _weaponProbability) then {
    removeWeapons _unit;
    {
        private _cat = format ["%1List",_x];
        if (count  (getArray(configFile >> "CfgVehicles" >> typeOf _unit >> _cat))>0) then {
            [_unit, _x] call FUNC(randomizeWeapon);
        };
    } foreach WEAPON_CATEGORIES;
};

};

still forum
#

White color indcates problem

#

where did you get removeWeapons from?

tough abyss
#

from you dear friend.

still forum
#

no definitely not

tough abyss
still forum
#

Read again

#

removeWeapon
primaryWeapon player

What you did:
removeWeapons _unit

tough abyss
#

But I need to attach those two commands, that's what I have problem with.

still forum
#

you need to order them correctly

#

right.

quasi sedge
still forum
#

try around there aren't many possibilities

tough abyss
#
removeWeapon primaryWeapon player _unit;
still forum
#

and the terminate too, also nonsense, and terminate also wouldn't clean up that variable

tough abyss
hollow thistle
quasi sedge
#
objective_1 = true;
target_1 addEventHandler ["killed", {
objective_1 = false;
[] spawn {
    sleep 60;
    deleteMarker "marker_34";
};];
``` that's all? Sorry for re-quoting
still forum
#

that has syntax error, missing };

#

that has syntax error, missing };

still forum
dusky pier
#

Hi, is possible somehow check if vehicle canAdd backpack with items?

still forum
tough abyss
still forum
#

For the string on the right, you need to get the name of the primary weapon

#

There is the primaryWeapon puzzle piece which takes an object on the right, and returns a String.
Again the object you already have, so just stick them together

tough abyss
#
removeWeapon "BAF_L85A2_RIS_SUSAT";  primaryWeapon _unit;
#

Isn't this better? ```sqf
player removePrimaryWeaponItem

still forum
#

removeWeapon "BAF_L85A2_RIS_SUSAT";
you are missing the left puzzle piece.

tough abyss
#

Cheers gonna dig in and come with it soon.

still forum
#

And you are not even using the weapon name that you got from primaryWeapon

tough abyss
#

Yes I know. Just wanted to get the "template" right.

#
player removeWeapon "CUP_arifle_G3A3_modern_ris_black"; primaryWeapon _unit;
#

Still can't manage to why we do need: ```sqf
primaryWeapon

winter rose
#

if you hard-code the weapon class, you don't

still forum
#

you need to give it the name of the weapon you want to remove

#

you don't know what weapon the unit has, or do you?

tough abyss
#

Yes I do.

#

CUP_arifle_G3A3_modern_ris_black

still forum
#

all units that your script runs on will always have that exact weapon?

#

then you can hardcode it yes.

tough abyss
#

Yes. They have that in the beginning. Before randomisation.

#

If you're talking about rifles.

still forum
#

Then you can hardcode the name, but you need to remember to always adjust it in case the starting rifle changes someday, or you want to reuse the script in a different mission

tough abyss
#

Cheers!

#

Jesus christ I am so stupid. I just realised this is an universal script and it runs on the other factions aswell.

still forum
#

Which is what I assumed πŸ˜„

winter rose
#

also, _unit removeWeapon

#

not player

tough abyss
#

so I need to include EVERY weapon of all factions? To make it work? That's like 50+.

winter rose
#

no

still forum
#

Yes. If you want to hardcode

winter rose
#
_unit removeWeapon primaryWeapon _unit
still forum
#

but you could also just use primaryWeapon like I told you to

winter rose
#

maybe this is clearer:```sqf
private _weaponClass = primaryWeapon _unit;
_unit removeWeapon _weaponClass;

tough abyss
#

so, the conclusion; ```sqf
// Check to see if we randomize Weapon
private _weaponProbability = getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "randomWeaponProbability");

if (random 100 < _weaponProbability) then {
    private _weaponClass = primaryWeapon _unit; _unit removeWeapon _weaponClass; 
    {
        private _cat = format ["%1List",_x];
        if (count  (getArray(configFile >> "CfgVehicles" >> typeOf _unit >> _cat))>0) then {
            [_unit, _x] call FUNC(randomizeWeapon);
        };
    } foreach WEAPON_CATEGORIES;
};

};

still forum
#

now you have one of 3 weapons

#

now repeat the same for the other 2 slots (secondary, launcher)

tough abyss
#

I only want to randomise rifles.

#

So also, If applied to an AT-men, his inventory RPG will remain even though his Rifle gets randomised?

still forum
#

But WEAPON_CATEGORIES is Rifle, Handgun, Launcher, Grenade, Explosive

#

And you are going through all the categories } forEach WEAPON_CATEGORIES;

still forum
tough abyss
#

So I MUST add the secondary, launcher, grenade.

#

even though I don't use randomisation of them?

#

To my understanding it will break the code if I do not do it yes?

still forum
#

Looks to me like you DO use randomization on them

#

You do } foreach WEAPON_CATEGORIES;

#

you randomize for each weapon category

tough abyss
#

This will maybe clarify; ```sqf
randomGearProbability = 80;

    headgearList[] = {"SP_M1Helmet_Iran",0.25,"SP_M1Helmet_Tan",0.45,"SP_M1Helmet_GrayDim",0.20,"SP_M1Helmet_Green",0.15,"iri_headgear_desert_camo_helmet", 0.30};
    vestList[] = {"V_TacVest_khk",0.3,"CFP_Tactical1_ACRDesert",0.2,"CFP_Tactical1_3ColorDesert",0.15,"SP_Tactical1_Tan",0.15};
    facewearList[] = {"CUP_Beard_Black",0.25,"CUP_FR_NeckScarf2",0.35,"CUP_FR_NeckScarf5",0.35,"CUP_G_White_Scarf_Shades",0.2,"CFP_Scarfbeardshades_tan",0.2,"CFP_Scarfbeardshades_green",0.2,"USP_ADVANCER_GU_SF2",0.15,"TRYK_SBeard_TK6",0.25,"TRYK_SBeard_BW6",0.3,"TRYK_SBeard_BW",0.25,"TRYK_SBeard_BW",0.3,"CFP_Scarfeard_white",0.25,"CFP_Scarfeard_white",0.25,"CFP_Neck_Plain2",0.25,"CFP_Neck_Plain3",0.25,"CFP_Neck_Plain4",0.25,"CFP_Neck_Plain1",0.25,"CUP_G_Scarf_Face_Tan",0.2,"CUP_G_Scarf_Face_Red",0.2,"CUP_G_Scarf_Face_White",0.2,"CUP_G_TK_RoundGlasses_gold",0.15,"CUP_G_TK_RoundGlasses_blk",0.15,"CUP_G_TK_RoundGlasses",0.05,"SP_Kneepads_Tan2",0.25};
    uniformList[] =           {"iri_u_desert_camo_1_uniform",0.6,"iri_u_desert_camo_2_uniform",0.4};
    
    randomWeaponProbability = 100;

    rifleList[] = {
    {"arifle_Katiba_GL_ARCO_pointer_F", {"30Rnd_65x39_caseless_green", 8} }, 0.35,{"arifle_Mk20_GL_F", {"30Rnd_556x45_Stanag", 8} }, 0.40,
    {"arifle_MXC_F", {"30Rnd_65x39_caseless_mag", 8} }, 0.35
                
    };
#

see, I do not have an ```sqf
grenadeList[] =

#

for example.

still forum
#

Ah so the count check will make it skip then

#

But then no sense in doing it forEach WEAPON_CATEGORIES if all but "Rifle" are being ignored anyway

tough abyss
#

You gotta ask the CFP devs of that (Community Faction Projects). I took it from github and clean the code+faction to meet modern standards, for private use.

#

They did not use the Weapon Randomisation in this faction. So I manually added it.

#

I may now have taken to much of your valuable developer time, because I know y'alls time is very valuable for you lol, my old man was a coder/progammer too. To round it up, I can just leave as it is? I can do the launcher, etc part later as I do not need it now.

still forum
#

yeah

tough abyss
#

Thank you very much for your help, gonna try it out now. Edit; It works like a charm. Thank you Dedmen and Lou Montana!

dusky pier
#

Hi, is possible to somehow prevent take item from container?
(i mean with take event handler)

toxic dirge
#

Hello can someone help? I have made a custom vehicle, sort of, here is the code for the camera

DropShipCamera = "Land_HandyCam_F" createVehicleLocal [0,0,0]; 
DropShipCameraVectorUp = [0,0.25,1]; 
DropShipCamera hideObject true; 
DropShipCamera attachTo [dropship_base, [0,-40,10]]; 
DropShipCamera setVectorUp DropShipCameraVectorUp; 
switchCamera DropShipCamera;
switchCamera player;

I'm trying to make it so when the player enters said vehicle their camera will switch to this and then when they leave it will switch back to their player view but I have no idea where to start

still forum
#

GetIn and GetOut eventhandlers

still forum
#

have you checked what getArray (configFile >> "CfgWeapons" >> currentweapon player >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "CompatibleItems") returns?
Have you looked in config viewer?

quartz coyote
#

It returns an empty array

#

It should not

still forum
#

checked whats in config viewer?

#

maybe that config entry changed

#

Actually

#

yes it changed

#

Look at config viewer.
They are entries in a class, not an array

unique sundial
#

what weapon is it?

still forum
#

check configProperties (with inheritance on) of configFile >> "CfgWeapons" >> currentweapon player >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "CompatibleItems" and you'll see

quartz coyote
#

But that's the kind of change that would break a lot of things ...

real dune
#

Where can I ask questions?

winter rose
real dune
#

Thanks

still forum
#

This has been a thing since atleast 2017/2018
Its nothing new

dusky pier
#

i try to prevent take item with that code```sqf
player addEventHandler ["Take",{
params ["_unit", "_container", "_item"];
_type = (_item call BIS_fnc_itemType) select 1;
if (_type in ["Backpack","Uniform","Vest"]) then {
if (_item in [backpack player,uniform player,vest player]) exitWith {
true
};
};
}];


but nothing is changed, i still can take this item

Could you help me with that, please?
quartz coyote
unique sundial
#

You mean any?

still forum
toxic dirge
#
player addEventHandler ["GetIn", {
    params ["_vehicle", "driver", "player", "_turret"];
}];

is it possible to make the role any of the vehicle seats?

still forum
still forum
toxic dirge
still forum
#

Still don't understand what you want

#

What role do you want to "make" and how

dusky pier
still forum
#

Does locking the inventory not work for you?

#

Disable all take/put and even opening the container?

toxic dirge
still forum
#

Are you missunderstanding how params works?

unique sundial
#

you cannot seat on all seats at once

still forum
#

Are you adding the eventhandler to a specific vehicle? Yes right?

dusky pier
still forum
#

Then you can probably just ignore all the parameters

#

Execute the script you want to execute when entering the vehicle on "GetIn" and execute the script when getting out on "GetOut"

#

and ignore the params line

toxic dirge
#

okay thank you

tough abyss
#

One major issue I have noticed is that it does not add mags to the inventory, only randomises chosen weapon but adds no mags at all. #arma3_scripting message Ofcourse this isn't Leo's fault. Just a misunderstanding πŸ™‚ ```sqf
rifleList[] = {
{"CUP_arifle_G3A3_modern_ris_black", {"CUP_20Rnd_762x51_G3", 8} }, 0.25, {"CUP_arifle_G3A3_ris_black", {"CUP_20Rnd_762x51_G3", 8} }, 0.3,
{"CUP_arifle_AKM_Early", {"CUP_30Rnd_762x39_AK47_bakelite_M", 8} }, 0.15,
{"CUP_arifle_AK47_Early", {"CUP_30Rnd_762x39_AK47_M", 8} }, 0.15,{"CUP_arifle_AKMS_Early", {"CUP_30Rnd_762x39_AK47_bakelite_M", 8} }, 0.15

};

little raptor
toxic dirge
#

@still forum

player addEventHandler ["GetIn", {null = [] execVM "DS_fnc_inShip"}];
player addEventHandler ["GetOut", {null = [] execVM "DS_fnc_outShip"}];

this is what I got, I am a little confused still

still forum
#

null = that's nonsense, remove that.

#

player addEventHandler
I specifically asked you:

still forum
#

but your code doesn't add to a vehicle

#

if you want it on a specific vehicle, you have to add it to the vehicle

#

not to player

little raptor
#

if you want to add it to player's vehicle, it's vehicle player of course

dusky pier
little raptor
#

for call not needed

#

for spawn needed

dusky pier
#

@little raptor understand, ty

toxic dirge
#
dropship_base addEventHandler ["GetIn", {[] call "DS_fnc_inShip"}];
dropship_base addEventHandler ["GetOut", {[] call "DS_fnc_outShip"}];

vehicle player work for specific vehicle?

dusky pier
#

@toxic dirge DS_fnc_inShip is function? or filename

little raptor
#

from "DS_fnc_inShip"

toxic dirge
#
DS_fnc_inShip = {switchCamera DropShipCamera;};
    DS_fnc_outShip = {switchCamera player;};
    
    dropship_base addEventHandler ["GetIn", {[] call DS_fnc_inShip}];
    dropship_base addEventHandler ["GetOut", {[] call DS_fnc_outShip}];

it still didn't wrk.. hmm

dusky pier
#

dropship_base is defined?

toxic dirge
quartz coyote
# still forum check configProperties (with inheritance on) of `configFile >> "CfgWeapons" >> c...

I don't understand how this can help me :

configProperties [configFile >> "CfgWeapons" >> currentweapon player >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "CompatibleItems", "true", true];

returns

[bin\config.bin/MuzzleSlot_65/compatibleItems/muzzle_snds_h,bin\config.bin/MuzzleSlot_65/compatibleItems/muzzle_snds_h_khk_F,bin\config.bin/MuzzleSlot_65/compatibleItems/muzzle_snds_h_snd_F,bin\config.bin/MuzzleSlot_65/compatibleItems/muzzle_snds_H_SW,bin\config.bin/MuzzleSlot_65/compatibleItems/muzzle_snds_65_TI_blk_F,bin\config.bin/MuzzleSlot_65/compatibleItems/muzzle_snds_65_TI_hex_F,bin\config.bin/MuzzleSlot_65/compatibleItems/muzzle_snds_65_TI_ghex_F]```
#

and why was the getArray working before the update 😦

little raptor
#

it still does

still forum
toxic dirge
# still forum where does _this come from
private _item475 = objNull;
if (true) then {
    _item475 = createVehicle ["OPTRE_Pelican_armed",[2298,5713,0.0530672],[],0,"CAN_COLLIDE"];
    _this = _item475;
    _crewVehicle = _this;
    _objectIDs pushback 475;
    _this setPosWorld [2298,5713,9.20281];
    _this setVectorDirAndUp [[-8.74228e-008,-1,0],[0,0,1]];
    [_this,15] call ace_cargo_fnc_setSpace;;
    dropship_base = _this;
    _this setVehicleVarName "dropship_base";
    _this setPylonLoadout [1,"OPAEX_M_ANVIL1_16Rnd"];
    _this setPylonLoadout [2,"OPAEX_M_ANVIL1_16Rnd"];
    _this setPylonLoadout [3,"OPAEX_M_Mk127_1Rnd"];
    _this allowdamage false;;
    [_this,"[[[[],[]],[[],[]],[[],[]],[[],[]]],false]"] call bis_fnc_initAmmoBox;;
    _this setVehicleReportRemoteTargets true;
    _this setVehicleReceiveRemoteTargets true;
    _this setVehicleReportOwnPosition true;
};
still forum
#

Since atleast 2018, CompatibleItems can be either array, or a class with entries set to =1.
That's nothing new.

#

The class way makes it easy to add inter-mod compatibility though, and is what CBA changes every vanilla weapon to to make it mod compatible.
Now vanilla items are by default mod compatible.

willow hound
#

https://dev.arma3.com/post/spotrep-00096

Tweaked: Changed slots configuration on all weapons from the array-based old method to the class-based one (this should also fix any issues with muzzle accessories)

quartz coyote
quartz coyote
true frigate
#

Question, in order to execute a script from a trigger. whats the difference between remotexec, execvm, etc

winter rose
#

to run a script (once) from a file, use execVM

#

if you intend to use it multiple times, declare it as a function in CfgFunctions and use call or spawn

true frigate
#

Alright πŸ™‚

willow hound
#

That's another thing, next to file creation, that should be part of the Introduction to Arma Scripting if you ask me.

winter rose
#

true

tough abyss
#

I'm trying to achieve blocking player's ability to open the inventory when they are inside a trigger zone. Would anyone has a recommended approach for this problem ?

winter rose
tough abyss
winter rose
#

and of course, the EH would have to be removed/re-added every time the person enters/leaves the trigger

willow hound
#

Different option would be to add the EH once and check whether the player is in the trigger area every time the EH fires.

tough abyss
#

and how would I trigger it so that the player can not opened ? since from the documentation I can see it can be used to overide the content of the inventory :/

willow hound
#

Apparently, closeDialog can be used to close the inventory, but I've never tried that.

little raptor
tough abyss
willow hound
#

I believe that is not possible.

little raptor
tough abyss
#

ahh I see

#

that's unfortunate

#

welp. Many thanks for your help πŸ˜„

winter rose
#
player addEventHandler ["InventoryOpened", {
    player inArea myTrigger; // <-- inventory override
}];
little raptor
winter rose
#

@tough abyss ↑?

little raptor
#

but the inventory does open and close

tough abyss
#

oh yeah indeed. I am trying to make it "not opened" in the first place

little raptor
#

so not

block the ability to open the inventory form the first place

tough abyss
#

if that makes any sense

little raptor
winter rose
little raptor
#

the player plays the opening anim

#

but the inventory won't appear
@tough abyss won't this just do ?

winter rose
#

aaah, well yeah
then overriding the inventory key would be the way to go

copper narwhal
#

Hello all, im wondering would anyone be willing to help me with a script modification that spans through a couple of files?

tough abyss
#

I assume

tough abyss
#

would also trigger Inventory closed EH ?

little raptor
#

Idk
it never opens in the first place
so it shouldn't

tough abyss
#

let me give it a try then πŸ˜„ ty so much for your help

little raptor
#

yeah it doesn't

#

I just tested

willow hound
tough abyss
copper narwhal
warm blaze
#

looking for EH that could be triggered once an unit has been stopped moving (f.e. has reached some way point). Does a3 has something similar ?

exotic tinsel
toxic dirge
#

@still forum I got it working thanks for the help

exotic tinsel
#

I suck at math, anyone willing to tell me how to use boundingboxreal and inarea to detect if ai is in object like a building?

#

nvm i figured it out

toxic dirge
#

@winter rose is the 1 in "Billboard", 1, 0.5, in minutes?

_ref setParticleParams [["\A3\data_f\cl_exp", 1, 0, 1], "", "Billboard", 1, 0.5, [0, 0, 0], [0, 0, -17], 0, 5, 5, 0, [4,4,4], [[0,0.1,1, 1], [0.01,0.02,1, 1], [0.01,0.02,1,0]],[0.02], 1, 0, "", "", bPos_04];
true frigate
#

Yep, i worked it out. starting from scratch

exotic flax
#

Would it be possible to have a HashMap with HashMaps? πŸ€”

// simplified, doesn't work
_myMap = [ // external map
   [
      "player1_uid",
      [ // internal map
         ["key1", "value"],
         ["key2", "value"],
         ["key3", "value"]
      ]
   ],
   [
      "player2_uid",
      [
         ["key1", "value"],
         ["key2", "value"],
         ["key3", "value"]
      ]
   ]
];

And would it be possible to link get/set with that?

// get data
_myValue = (_myHashMap get "player1_uid") get "key1";
// set data
_myHashMap set ["player1_uid", (_myHashMap get "player1_uid") set ["key2", "new_value"]];
exotic flax
#

those are KEY types, not values πŸ˜‰

little raptor
#

yeah you can

#

or at least you should be able to

#

I didn't test it

queen cargo
#

so ... values, why should it not work to have a hashmap as value?

#

regarding the "how"

#

_map get "property" set ["target", value]

#

you first get the actual map you want to change and set then

#

as alternative: start using SQC 😏 map.property = value (requires SQF-VM and/or the vscode extension)

little raptor
#

@exotic flax but this part doesn't make much sense:

_myHashMap set ["player1_uid", (_myHashMap get "player1_uid") set ["key2", "new_value"]];

(_myHashMap get "player1_uid") set ["key2", "new_value"]
set only returns true false (not sure if that was actually your intention)

exotic flax
#

Yeah, was reading the set wiki and noticed the same. Meaning it will need to get the (1st) hashmap, update it and than set it back. Unless some magic happens which updates it by reference πŸ€”
And I need a method to ensure the value of the 1st hashmap is an actual hashmap.

queen cargo
#

hashmaps obey the same rules as everything in SQF

#

all is passed by reference

#

set modifies the reference of the hashmap

#

aka: just like you would not have to set the array again, using set, you do not need to with hashmaps either πŸ˜‰

exotic flax
#

guess I need to test it properly (and return the results to the wiki)

queen cargo
#

test what?

exotic flax
#

if the outer hashmap will have the updated inner hashmap, without re-setting it

little raptor
#

it is modified by reference

#

as @queen cargo said

#

just like arrays

#

but what you wrote was wrong and will change the value

#

but this works:

(_myHashMap get "player1_uid") set ["key2", "new_value"]
exotic flax
#

I knew my examples wouldn't work out of the box

queen cargo
#

no need for the () btw 🀫

little raptor
exotic flax
#

I prefer to be on the safe side there, already spent too many hours debugging 🀣

little raptor
#

@queen cargo what about _array select _index+1 😬

queen cargo
#

depends

#

if the intend is to select the _index + 1 element

little raptor
#

the sum executes first

queen cargo
#

then yes, not needed

#

see precedence of SQF_Syntax in biki

exotic flax
#

my new (not tested) functions:

params ["_uid", "_key", "_value"];
(GVAR(Stat_HashMap) getOrDefault [_uid, createHashMap]) set [_key, _value];
params ["_uid", "_key"];
private _return = (GVAR(Stat_HashMap) getOrDefault [_uid, createHashMap]) get _key;
_return
little raptor
queen cargo
#

not really imo

#

you just need to read stuff from left to right

toxic dirge
#

the particle effects and camera work on my vehicle but not everyone can see them, I'm not really used to remote exec can someone help, heres what I got

[_pos] spawn 
    {
        _pos = _this select 0;
        playsound "hint";
        remoteExec[DS_fnc_Camera,0];
        remoteExec[DS_fnc_Effects,0];
        onMapSingleClick{};
    };
exotic flax
#

functionName: String - function or command name.

toxic dirge
#

?

exotic flax
#
remoteExec[DS_fnc_Camera, 0]; // functionName is variable
// vs
remoteExec["DS_fnc_Camera", 0]; // functionName is String
toxic dirge
#

I tried with quotation, I locally execute with debug in game and remote exec doesn't add for everyone

exotic flax
#

the code is executed on all clients and server, so the issue is probably in the functions you try to execute

#

what happens when you run:

"hello" remoteExec ["hint", 0];
``` *should show a hint with "hello" on all clients*
wind flax
#

Hey, does anyone know where I could find a detailed guide on how to go about packing a script into a mod? I've written something pretty small, but have had trouble finding good guides. I've looked at HEMTT, but even then, still haven't gotten far.

toxic dirge
#

this is the func

exotic flax
#

so it will attach an object to another object when executed, and nothing else.
DS_fnc_inShip and DS_fnc_outShip won't work, since the code is wrong

queen cargo
wind flax
wind flax
trail smelt
#

How to copy this message and paste to discord ? (same)

exotic flax
#

open pinned messages, select the text you want, right click on the selection, click 'copy', right click on the message field, click 'paste', modify to your needs

trail smelt
#

if i copy the message both codes is looks like second.. πŸ˜„

wind flax
#

Does anyone know how to check if a Custom Control is pressed? I've been looking all over, and can't seem to find anything. CBA won't work in this case :/

crude vigil
#

@trail smelt You need to use \ before whatever you wanna type in to prevent discord magic.
So in this case:
\```sqf
/* your code */
hint "good!";
\```

radiant herald
#

how can i disable the incapacitated state for particular units?

cosmic lichen
#

mdoing?

versed belfry
warm hedge
#

He asked about his mdoing for 4 or 5 times here πŸ™ƒ

versed belfry
#

This should be it, not sure if it is there in Vanlila game tho since I use 3den Enhaned

cosmic lichen
#

Vanilla

sharp grotto
#

Thank you dedmen, finally πŸ˜„

addMissionEventHandler ["HandleChatMessage", {
    params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"];
    
    _channel = _this select 0;
    _text = _this select 3;
    _ltxt = toLower _text;
    _doNotShow = ["connected","connecting","modified","disconnected","are not allowed"];
    
    if(_channel == 16) then 
    {
        {
            if(_ltxt find _x > -1)exitWith{true};
            
        } forEach _doNotShow;
    };
    
}];
still forum
#

keep in mind, the texts are translated to the users language. So what works in english might not work in german.
Though I think the Arma server decides the language for these messages?

winter rose
#

I believe KK did something about that?

sharp grotto
#

yea looks like it, only the popup clients get is localised (i think)

still forum
#

yes. some pass the translation key in (in 2.04). But don't know if these system messages do that too

winter rose
#

(oh, 2.04! mb)

still forum
#

I think, don't remember when that was πŸ˜„

winter rose
#

quite recently, so maybe did not make it into 2.02

sharp grotto
#

you were right, only works with english localisation πŸ˜†

still forum
#

Check translations of
STR_DS_PLAYER_CONNECTING
or
STR_MP_CONNECTING

I think its the second one

#

In current code for 2.04, it doesn't pass you the translation key for atleast the connecting message

#

The other is STR_MP_DISCONNECT and probably STR_MP_CONNECTED
and STR_MP_CONNECTION_LOOSING which you forgot above?

#

and probably STR_MP_VALIDERROR_1 or 2

toxic dirge
#

is a particle effects duration timerPeriod or lifeTime?

winter rose
#

lifetime

#

timerperiod is a "script execution cycle" @toxic dirge

toxic dirge
winter rose
#

ah yes, a distance check might also be done

toxic dirge
#

is there any way to remove that?

winter rose
#

no, no can change that ^^

#

that's engine-based

#

@toxic dirge how do you use smoke? a particle source, or drop?

toxic dirge
#

particle source

winter rose
#

well that's the best, so maybe 5km is a hardcoded distance

toxic dirge
#

@winter rose

winter rose
#

I don't see any issue in that video?

toxic dirge
#

no that was just showing the effect

#

but the effect just disappears then re-appears

#

when a certain range

winter rose
#

then no can do re-adding, that's it

distant oyster
toxic dirge
#

I attached the effect to the base and that seams to work for now

winter rose
#

yes, attach the particle source to the vehicle 😬

toxic dirge
#

yea haha

radiant herald
versed belfry
#

No idea.

radiant herald
#

Understandable

sharp grotto
#
addMissionEventHandler ["HandleChatMessage", {
    params ["_channel","_text"];
    
    _channel = _this select 0;
    _text = _this select 3;
    _ltxt = toLower _text;
    if(_channel == 16) then 
    {
        {
            if(_ltxt find _x > -1)exitWith{true};
            
        } forEach [
        
            [localize "str_mp_connecting", " %s"] call BIS_fnc_splitString select 1,
            [localize "str_mp_connect", " %s"] call BIS_fnc_splitString select 1,
            [localize "str_mp_disconnect", " %s"] call BIS_fnc_splitString select 1,
            [localize "STR_MP_VALIDERROR_2", " %s"] call BIS_fnc_splitString select 1,
            [localize "STR_MP_CONNECTION_LOOSING", " %s"] call BIS_fnc_splitString select 1,
            "modified"
        ];
    };
    
}];

That does the job so far (except for "uses modified file" that has no localisation)

still forum
#

now we just need regular expression matching and string replace so you can just

_ltxt matches (localize "STR_MP_CONNECTION_LOOSING" replace ["%s", "*."])

#

might be that modified data file is translated on server. And servers are almost always english

sharp grotto
#

whatever that means, iam happy that i got it working at all πŸ˜„

toxic dirge
#
comment "event handler";
    DS_fnc_EH =
    {
    dropship_base addEventHandler ["GetIn", {[] call DS_fnc_inShip; [] call DS_fnc_camExit; [] call DS_fnc_camEnter}];
        dropship_base addEventHandler ["GetOut", {[] call DS_fnc_outShip}];
    
    DS_fnc_camExit = {(findDisplay 46) displayAddEventHandler ["KeyDown", "if ((_this select 1) == 57) then {[] call DS_fnc_outShip};"];};
        DS_fnc_camEnter = {(findDisplay 46) displayAddEventHandler ["KeyDown", "if ((_this select 1) == 15) then {[] call DS_fnc_inShip};"];};
    
    DS_fnc_inShip = {switchCamera DropShipCamera; [] call DS_fnc_inShipMSG};
    DS_fnc_outShip = {switchCamera player; findDisplay 46 displayRemoveEventHandler ["keyDown"]; [] call DS_fnc_outShipMSG};
    
    DS_fnc_inShipMSG ={[]spawn {hint "Press SPACE to exit camera."; sleep 2.5; hintSilent "";}};
    DS_fnc_outShipMSG ={[]spawn {hint "When in the dropship, press TAB to enter camera."; sleep 2.5; hintSilent "";}};
    };

trying to add camera controls for the ship but in DS_fnc_outShip the displayRemoveEventHandler doesn't seem to remove it

dreamy kestrel
#

Q: I'm cooking up some units of measure, and I wonder if I can leverage macros to help with that a little bit. i.e.

#define KPLIB_DEFINE_UOM(PREFIX,X) KPLIB_uom_siPrefix_##PREFIX = (10 ^ X)
little raptor
#

you have to save the EH ID to remove it:

_id = findDisplay 46 displayAddEventHandler ["keyDown", {blabla}];
findDisplay 46 setVariable ["my_keydown_eh", _id];
```which you can fetch using getVariable:
```sqf
_id = findDisplay 46 getVariable ["my_keydown_eh", -1];
findDisplay 46 displayRemoveEventHandler ["keyDown", _id]; 
toxic dirge
little raptor
#

yeah that'll work too

#

use inShip1 and outShip1 to remove the EHs

toxic dirge
little raptor
#

no

toxic dirge
#

I need to do it twice?

little raptor
#

yeah

toxic dirge
#

oka

#

@little raptor it worked but now I can't go in the camera in the ship again

#

only the start

little raptor
#

@toxic dirge there's a logical error in your code
you shouldn't remove the EHs while you're still inside the ship (or whatever it is)
they should only be removed when you exit the ship (not camera)

toxic dirge
#

corrected it, works fine now

#

thanks

quasi sedge
#
objective_1 = true;
trg_1_1 addEventHandler ["killed", {
objective_1 = false;
[] spawn {
    sleep 60;
    deleteMarker "target_1";
};];
trg_1_2 addEventHandler ["killed", {
objective_1 = false;
[] spawn {
    sleep 60;
    deleteMarker "target_1";
};];
trg_1_3 addEventHandler ["killed", {
objective_1 = false;
[] spawn {
    sleep 60;
    deleteMarker "target_1";
};];
trg_1_4 addEventHandler ["killed", {
objective_1 = false;
[] spawn {
    sleep 60;
    deleteMarker "target_1";
};];
#

if one span of bridge is killed, marker won't delete after 60 sec

still forum
#

still syntax error

#

missing };
for each spawn

#

like I told you yesterday

quasi sedge
#

yep, ty

#
objective_1 = true;
trg_1_1 addEventHandler ["killed", {
objective_1 = false;
[] spawn {
    sleep 60;
    deleteMarker "target_1";
};};];```
little raptor
#

remove the ; before ]; meowsweats

quasi sedge
#

finally all working great xD

#

in one scenario

#

Not sure why this is not working in my other deathmatch mission, playercount was 26 and "respawn_east" doesn't change from Eden-set [1200, 1406]

if (isServer) then {
    while {true} do {
    sleep 10;
    _allPlayers = allPlayers;
    call {
        if ((count _allPlayers) <= 7) exitWith 
        {};    
        if ((count _allPlayers) <= 8) exitWith 
        {"respawn_east" setMarkerSize [1500, 1406]}; 
        if ((count _allPlayers) <= 25) exitWith 
        {"respawn_east" setMarkerSize [1700, 1406]};
        if ((count _allPlayers) <= 35) exitWith 
        {"respawn_east" setMarkerSize [1900, 1406]};   
        if ((count _allPlayers) <= 45) exitWith 
        {"respawn_east" setMarkerSize [2100, 1406]};
        if ((count _allPlayers) <= 55) exitWith 
        {"respawn_east" setMarkerSize [2300, 1406]};
        if ((count _allPlayers) <= 65) exitWith 
        {"respawn_east" setMarkerSize [2500, 1406]};
    };
};```
languid oyster
#

Let's say I got a sequence of random animations an AI character has to perform. I would like to have some kind of countdown, when the sequence will be over. Since the animations should be random, I would need a method to get the length of each animation. Is this possible?

little raptor
#
_animDuration = -1 * getNumber(configFile >> "CfgMovesMaleSdr" >> "states" >> _anim >> "speed");
if (_animDuration < 0) then {_animDuration = -1/_animDuration};
#

@languid oyster but you're better off using event handlers

quasi sedge
little raptor
#

and remove the condition

#

because it's true

#

@quasi sedge also you're code is missing }

#

again meowsweats

#

use a code editor with syntax highlighting to catch missing parantheses/brackets

languid oyster
#

@little raptor many thanks mate. I am fiddling with an AI healing the player script, and the AI performs animations during the treatment. While treating, the player is informed about how long the treatment will last. It is ment to be run on a server later.

#

In fact, it was you giving me the code for the animation sequence to work :9

#

πŸ™‚

#

Was this lot, if you can remember:

if (_medic getVariable ["TAG_AnimDone_EH", -1] == -1) then {
    _EH = _medic addEventHandler ["AnimDone", {
      params ["_unit"];
      _anims = _unit getVariable ["AnimSequence", []];
      _anims deleteAt 0;
      if (count _anims > 0) then {
        _unit switchMove _anims#0;
        _unit playMoveNow _anims#0;
      } else {
        _unit removeEventHandler ["AnimDone", _thisEventHandler];
        _unit setVariable ["TAG_AnimDone_EH", -1];
      };
    }];
    _medic setVariable ["TAG_AnimDone_EH", _EH];
};
_sequence = _medic getVariable ["AnimSequence", []];
_sequence append ["AinvPknlMstpSnonWnonDnon_medic_1", 
  "AinvPknlMstpSnonWnonDnon_medic_2",
  "AinvPknlMstpSnonWnonDnon_medic3",
  "AinvPknlMstpSnonWnonDnon_medic1",
  "AinvPknlMstpSnonWnonDnon_medicEnd"
];
_medic setVariable ["AnimSequence", _sequence];
_medic playMoveNow _sequence#0;

waitUntil {_medic getVariable "TAG_AnimDone_EH" == -1 || 
  (lifeState _medic != "HEALTHY" &&
  lifeState _medic != "INJURED") ||
  lifeState _victim != "INCAPACITATED"
};
little raptor
#

disclaimer: this wasn't by me:

waitUntil {_medic getVariable "TAG_AnimDone_EH" == -1 || 
  (lifeState _medic != "HEALTHY" &&
  lifeState _medic != "INJURED") ||
  lifeState _victim != "INCAPACITATED"
};```

meowsweats

kindred blaze
#

Hope this is the correct place for this
Is there anyone here that has used Ravage and knows it fairly well. Getting an error as I start the game with Loot pools

https://pasteboard.co/JQ13RQ9.png
Here's the error I'm getting. As far as I can see I've written it in the correct format.

This is my "Common Weapons" loot pool in the "Gear Pool" Module - ["rhs_weapon_rhs_weap_m14","rhs_weapon_rhs_weap_m14_rail","Weapon_hgun_Pistol_heavy_02_F","rhs_weapon_m24sws","Weapon_SMG_05_F","rhsusf_weapon_m9","rhsusf_weapon_m1911a1","rhs_weapon_pya","rhs_weapon_makarov_pmm","Weapon_hgun_Pistol_01_F","rhs_weapon_savz61","rhs_weapon_m38_rail","rhs_weapon_m16a4","rhs_weapon_ak74","rhs_weapon_akm","rhs_weapon_aks74u","rhs_weapon_kar98k","rhs_weapon_M590_8RD"]

little raptor
kindred blaze
#

Ahh, I see! Sorry

true frigate
#

is there a better way than this to make a turret point at an incoming missile, such as those fired from the TU-95?

 addToCIWS = {
  params["_turret","_range"];
  _null = [_turret,_range]spawn {
         private["_turret","_range","_incoming","_target"];
   _turret = _this select 0;
   _range = _this select 1;
   while{alive _turret}do{
    _incoming = _turret nearObjects["RocketBase",_range];
    _incoming = _incoming + (_turret nearObjects["MissileBase",_range]);
    _incoming = _incoming + (_turret nearObjects["ShellBase",_range]);
    if(count _incoming > 0)then{
     _target = _incoming select 0;
     _fromTarget = _target getDir _turret;
     _dirTarget = direction _target;
     _targetBoom = getText (configFile >> "CfgAmmo" >> typeOf _target >> "explosionEffects");
     while {(alive _target) && (_dirTarget <_fromTarget + 60) && (_dirTarget >_fromTarget - 60)} do {
      _turret doWatch _target;
      if ((_target distance _turret < 2000) && (_target distance _turret > 100)) then{
       _shots = floor random [1, 2, 3];
       while {_shots>=0} do {
        _turret fireAtTarget[_target,(currentWeapon _turret)];```
also, apologies if my code looks sloppy. I'm using this as a test more than an actual script for now
#

The remaining part of the script works fine. The gun fires, the missile blows up. But the issue is, the turret isnt pointing at the missile as of yet

little raptor
#

apologies if my code looks sloppy.
@true frigate at least add ```sqf to make it readable for us meowsweats

#

see the pinned messages

true frigate
#

I was only adding the 3 backticks. My bad

little raptor
#

@still forum Do nested hashmaps become slower like nested arrays and pushBack?
I think you said it doesn't
but checking to make sure

still forum
#

no

#

but be careful to not cause circular references

little raptor
#

yeah

#

not gonna notlikemeow

wind hedge
#

Guys, the SQF code posting on the forums is not working right? Can't find it on the list anymore

#

If any care to suggest something about it πŸ˜‰

#

Thank you

little raptor
#

there's an icon <> on top for code

#

select your code and press that button

distant oyster
#

but there is no sqf highlighting in the language list

little raptor
#

yeah

wind hedge
#

Actually @little raptor I meant that inside that <> icon there is no SQF in the list... like how do we post SQF code on the forums now?

toxic dirge
#

@little raptor

   [_pos] spawn 
{
_pos = _this select 0;
playsound "hint";
null = [dropship_base] remoteExec ["fnc_DS_Effects",0];
null = [dropship_base] remoteExec ["fnc_DS_EH",0];
null = [dropship_base] remoteExec ["fnc_DS_Camera",0];
onMapSingleClick{};
};    

I want to add particle effects event handler and camera fnc for all players (works locally already) would this work?

little raptor
#

@wind hedge replied on the forum

wind hedge
little raptor
#

I haven't seen any but it is possible using kbTell

winter rose
#

radioChannelCreate?

little raptor
#

or that notlikemeow

#

maybe?

winter rose
still forum
#

Uh Leopards mod was mentioned in Radio Arma :u

little raptor
#

which one?

still forum
#

The AoW one, the latest

little raptor
#

Gotta listen to it!

spark turret
#

since when can we post images here

little raptor
spark turret
winter rose
little raptor
clever radish
#

When mission editing, is there any difference between hosting a mission on server or running the server from my PC?

distant oyster
finite sail
#

am I a veteran?

#

no

#

😦

still forum
#

Link without description alert 🚨

spark turret
#

πŸ”¨

clever radish
#

Does it make any direct different in scripting?

finite sail
#

if i was a veteran, it wouldnt be a link, it'd be a pic

still forum
clever radish
#

So it would be best to always make your missions able to run on dedicated server? would hosted players still be able to play it as if it was started on dedicated server?

spark turret
#

yeah

#

if it runs on dedicated, it runs anywhere

finite sail
#

yes, if it runs on a dedi, provided theu host it as MP, it will work

spark turret
#

hah i was faster

finite sail
#

and less typos πŸ™‚

spark turret
#

i think most dedicated missions should run in SP as well

finite sail
#

mine wont πŸ™‚

spark turret
#

whys that?

finite sail
#

domination wont either

#

tbh, i dont know lol

#

its a 6 year old mission, i should have thought about it earlier

clever radish
#

Thanks, guys

dreamy kestrel
#

Q: how deep does isEqualTypeArray verify? Just the first level?

#

I guess this answers my question:

_array = [true, -1, [0, 0, ""]];
_array isEqualTypeArray [false, 0, [0, true, ""]] // true, i.e. shallow "equality"
still forum
#

according to wiki its one dimensional

queen cargo
# little raptor Gotta listen to it!

Be happy and proud about it
Stuff I do barely ever gets mentioned in channels like theese, even when I still had a popular mod going πŸ˜‚πŸ˜‚

astral tendon
gusty ivy
dreamy kestrel
#

tempting to implement a recursive, i.e. "deep", isEqualTypeArray ...

queen cargo
#

What for?

dreamy kestrel
#

because I need to verify the shape of an array beyond just the surface level.

distant oyster
dreamy kestrel
#

ah flatten? oh ok... nice.

#

it kinda sorta fits the bill...

#

but I really do need to preserve the array members and recurse through them if possible

#

recurse, or iterate (more likely) if A3 ain't so good at recursion

loud birch
#

is it possible to add a custom font to a mission?

little raptor
loud birch
#

aw thats a shame

true frigate
#

is there a way of testing if crew is inside of a vehicle with a script?
I want it so that artillery fires on a vehicle if it is populated.
I was planning on using something along the lines of this, but cant find the function to check if crew exists within a vehicle

if (insertCrewFind);
  gun1 doArtilleryFire[_tgt1,_ammo,1]; 
  sleep 1;
  gun2 doArtilleryFire[_tgt2,_ammo,1];
else
  gun1 doArtilleryFire[_tgt1,_ammo,1]; 
  sleep 1;
  gun2 doArtilleryFire[_tgt1,_ammo,1];
#

I thought the 'Crew' feature might do something, but it says it returns as an array, and really id just like a "yes there is crew" or "no there isnt crew"
Kinda like a true or false πŸ˜„

exotic flax
#

count crew _vehicle > 0

true frigate
#

thank you! πŸ™‚

agile pumice
#

How can I get the vector of my player relative to a position in a model?

#

right now I'm using player getRelDir _pos but I think its world space and changes for every instance of the same building class

toxic dirge
#

can someone help me remote exec a function? I execute in locally ingame with debug but no one else sees particle effect

agile pumice
#

can you successfully remote exec other functions?

agile pumice
little raptor
toxic dirge
toxic dirge
little raptor
#

no

agile pumice
#

what do you call a chunk of code defined as a variable?

#

that can be called or spawned?

toxic dirge
#

the only thing I found is

_source = createVehicle ["#particlesource",getPosATL _object,[],0,"CAN_COLLIDE"];
        [_source,"BombSmk3"] remoteExec ["setParticleClass",0,_source];
        _source attachTo [_object,[0,0,0]];
        _smokeGroup1 pushBack _source;

but I don't know how to get it to do what I want

agile pumice
#

Is it not an inline function?

#

it doesn't need to have parameters or return a value to be a function does it?

exotic flax
#

This should work: ```sqf
some_function = { hint "yup"; };
[] remoteExec ["some_function", -2, true];

little raptor
#

what is some_function on other machines?

toxic dirge
#

remoteexec makes my brain hurty

agile pumice
#
"yup" remoteExec ["hint", -2, true]; 
#
{hint "yup";} remoteExec ["bis_fnc_call", 0]; 
little raptor
#

"call"

exotic flax
agile pumice
#

you can't remote exec a function on another machine where it is not defined

#

but you can put the contents of your function in the code parameters of a bis_fnc_call remoteExec

exotic flax
#

which for me was the reason for that question, because I need to

#

client doesn't know the code

little raptor
#

always use CfgFunctions

agile pumice
#

Its an example from the wiki

little raptor
#

don't send large chunks of code over the network

rough heart
exotic flax
#

so... How would I have a client run code which is only available in a server-only mod?

rough heart
#

create piece of code, stick it to public var

crude stream
#

Does anyone have a script for reparing destroyed vehicles? Something similar to vdauphin's H&Ms one

rough heart
# exotic flax so... How would I have a client run code which is only available in a server-onl...
_configs = "true" configClasses (configFile >> "CfgFunctions" >> "PSF" >> "core");
_configs append ("true" configClasses (configFile >> "CfgFunctions" >> "PSF" >> "scripts"));
{
    private _varname = format["PSF_fnc_%1",configName _x];
    private _var = missionNameSpace getVariable _varname;
    if(!isNil "_var")then
    {
        publicVariable _varname;
    };
} forEach _configs;

_initScriptsOnClient = "
    waitUntil {!isNull findDisplay 46 && !isNil ""ExileClientLoadedIn"" && getPlayerUID player != """"};
    [] spawn PSF_fnc_rad_client;
";
fnc_initScriptsOnClient = compileFinal _initScriptsOnClient;
publicVariable "fnc_initScriptsOnClient";
"" remoteExec ["fnc_initScriptsOnClient",-2,"fnc__initScriptsOnClient_JIPID"];
agile pumice
#

@exotic flax you can send functions from server to client

#

Altis Life does it for example using publicVariable

little raptor
rough heart
exotic flax
#

interesting how people (who know scripting as well) in this case gave a wrong answer πŸ€·β€β™‚οΈ

#

but if publicVariable solves the issue I'm fine with it

rough heart
#

Don't really care, wanted to give you a example. What i've send is also being executed as soon as the player joins JIP.

#

Also not prolly what you wanted.

exotic flax
#

actually I do; it needs to run on all clients including JIP

rough heart
#

Oof

exotic flax
#

it's 14 lines of code (may become a bit more) to add local EH's on the client, nothing bad

#

I won't execute a full framework from the server πŸ˜‰

rough heart
#

I just JIP my whole mission file 🧐

#

(joke ofc)

exotic flax
#

technically correct πŸ˜‰

rough heart
#

Sort of πŸ˜‚

#

but not remoteexec

dawn walrus
#

Hello, hoping someone with a bit more experience with sqf could give a tip for me having to do with the tasks system.

I have 7 tasks set and working, and while im sure there is a better way to get the desired effect, I have them simply tied to 2 triggers per task area. 1 trigger for opfor seized, and 1 trigger for blufor seized. As this will be an MP scenario, the players will all be on blufor side. All the tasks start out as just created. When blufor controls the area, the tasks is set to complete. When/if opfor re-takes the area, the tasks is set to reset to "Created" state. Both triggers are set to be repeateable, and they work fine with my testing, correctly swapping back and forth (with color coded area marker).

My issue right now, is that I would prefer to set up a trigger that knows when all 7 tasks are completed, and to end scenario. I've tried a couple things, to no avail. This is the latest variation I tried in the condition field of this end scenario trigger

["hq","oil","s1","s2e","s2w","s3","sc"] call BIS_fnc_taskState == "SUCCEEDED"

the strings are the variable names of the task modules themselves. I would love to get this working, but honestly its just icing on the cake for me as there will be zeus (me) active for the mission who can just end it manually if needed. Any help is appreciated, i'm not a noob to the editor, but scripting is something I am still not too strong in aside from real basic stuff.

exotic flax
#
_done = false;
{
   _state = _x call BIS_fnc_taskState;
   if !(_state isEqualTo "SUCCEEDED") then {
      _done = true;
   };
} forEach ["hq","oil","s1","s2e","s2w","s3","sc"];
!_done

Should return true when all tasks are set to SUCCEEDED

dawn walrus
#

hm, so this goes in the condition field for the trigger, or no? simply plopped in there nothing happens. To me this looks more like a block that would go into the init?

exotic flax
#

condition field of trigger

dawn walrus
#

well nothing happens, that trigger is synched to the end scenario module, nothing happens. I'm sure its something whacky that i've done, but I don't want to force the issue. Its a small feature that in the end doesn't need to work. Thanks for the help though.

valid abyss
#

Hello,
Is there any way to save a variable to a person right before they exit to the main menu and then add that variable back when they load back in?

agile pumice
#

for those experienced with scripting ace interaction menus,

_action = ["Sit0", "Sit Down", "a3\ui_f\data\igui\rscingameui\rscunitinfo\role_cargo_ca.paa", {player moveInCargo [_this select 0, 0]}, {true}, {}, [], [-0.84668,-2.70801,-1.32691], 10] call ace_interact_menu_fnc_createAction;
[this, 0, [], _action] call ace_interact_menu_fnc_addActionToObject;
``` I can't see my action at the position specified, what have I done wrong?
loud birch
#

bit confused on arma supporting some unicode characters but not others

#

for example "←" shows up but other stuff from the same version of unicode doesn't?

#

its really tripping me up cus I need a character that forms a seamless line

#

I have a janky soultion with invisible characters and underlines but underlines dont seem to be resizeable

finite jackal
#

And for SP you could try a onGameInterrupt EH

tough abyss
#

whats the best linter to use for arma scripting?

atomic crow
languid oyster
grim coyote
#

Why not just use that one then?

crude stream
#

Ah cause it'd require me to spend a shitload of time trimming it from the original. It'd apparently be a huge PITA because the functions call from each other across a lot of different sqfs, just for the one feature

#

Even if I had the time for that, I certainly don't have the brains

young current
#

you can try using setdamage on it to reset the damage. or if its wreck and too far gone, then you need to delete the wreck and spawn a new vehicle

still forum
astral tendon
#

Anyone here knows how to make a sub category for my action in ACE? for example, this action is stuck on the plane but there is allot others in plane and it gets messy, I need to create a sub action to access this, like Plane>>Radio>> Request Bogey Dope
the page in ace has no example to create my own sub category, instead only to use one that already exist

private _action = ["RadioToAWACS", "Request Bogey Dope", "", {[] spawn RTG_fnc_RequestBogeyDope}, {_player in _target},{},[],[0,0,0],4,[false,true,false,false,false]] call ace_interact_menu_fnc_createAction;
["Plane", 1, ["ACE_SelfActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;
tough abyss
#

So after roughly digging around for some hours, I came up to a major problem. The weapon randomisation does not remove the standard weapons mags (G3A3), hence it will stay in the inventory even when a unit gets a randomised weapon. An easier explanation, if the unit gets an randomised weapon, lets say AKM, the unit spawns in with the AKM but still has the G3A3 mags in its inventory. So the question is, how do I remove the mags, I highly suspect it is something I add to; ```sqf
if (random 100 < _weaponProbability) then {
private _weaponClass = primaryWeapon _unit; _unit removeWeapon _weaponClass;
{

winter rose
#

yes, removeMagazines with the mag classname

tough abyss
#

But the script is universal.

#

It is applied to many factions.

#

So It cant be specificly tied to one sort of mag.

winter rose
#

Grab it from the config

#

Or remove all magazines from the guy, idk

tough abyss
#

Yes I tried removing ```sqf
magazines[] = {"CUP_20Rnd_762x51_G3","CUP_20Rnd_762x51_G3"};
respawnMagazines[] = {"CUP_20Rnd_762x51_G3","CUP_20Rnd_762x51_G3"};

#

including removing it from it's inventory in configs.

#

but the unit still spawns with the mags.

winter rose
tough abyss
winter rose
#

in the script, where you removeWeapon

tough abyss
winter rose
#

Grab it from the config

tough abyss
#
if (count  (getArray(configFile >> "CfgVehicles" >> typeOf _unit >> _cat))>0) then {
                removeMagazines;
}

winter rose
tough abyss
#

Yes. Thank you. Although will this not remove RPG ammo etc? ```sqf
{player removeMagazine _x} forEach magazines player

winter rose
#

this ^ will

little raptor
tough abyss
#

@little raptor sorry for @ you, but since you already have a bit knowledge regarding my script, do you know of anything? I know it's a easy fix. Thanks Lou too. #arma3_scripting message

little raptor
# crude stream Bumping this

You can't repair a destroyed vehicle. You'll have to create a new vehicle (delete the old one), set its damage to a relatively high value (say 0.75), and keep reducing that damage in a loop

winter rose
#

or use HandleDamage EH to prevent further damage

crude stream
#

Yeah I know, I was hoping there'd be a script out there that would let me do what happens in hearts in minds

wind hedge
#

You can add a Damage EH that any damage only damages specific parts like the engine and wheels and so the vehicle is never trully destroyed, only rendered unusable

crude stream
#

i.e you tow the wreck to the repair area, use an ace interact and it replaces the vehicle

#

But like I said vdauphins scripts are way too difficult for me to unravel

little raptor
# crude stream But like I said vdauphins scripts are way too difficult for me to unravel

Here's some pseudo script:

params ["_veh"];
_vdu = [vectorDir _veh, vectorUp _veh];
_pos = getPosASL _veh;
_type = typeOf _veh;

_newVeh = objNull;
isNil {
  deleteVehicle _veh;
  _newVeh = createVehicle [_type, _pos];
  _newVeh setPosASL _pos;
  _newVeh setVectorDirAndUp _vdu;
  _newVeh setDamage 0.75;
};

while {alive _newVeh && getDammage _newVeh > 0} do {
  _newVeh setDamage ((getDammage _newVeh - 0.1) max 0);
  sleep 2
};

hint "Repaired";
tough abyss
#
if (random 100 < _weaponProbability) then {
private _weaponClass = primaryWeapon _unit; _unit removeWeapon _weaponClass; removeMagazineGlobal;
#

Correct? ```sqf
removeMagazineGlobal;

little raptor
#

no

tough abyss
#

This will still remove RPG ammo...

winter rose
#

yes

#

because you don't get magazine classes from the config

tough abyss
#

I know my friend. But I don't know how. Is there any place in the wiki that can explain me how I bind/attach the command to get it from the config?

winter rose
#

really, to me you are way over your head in trying to reuse this randomisation script;
why not write one from scratch that fits your needs?

#

a simple, easier one that does not use a framework you don't know

little raptor
winter rose
little raptor
#

so?

winter rose
#

he wants to remove weapon's magazines

little raptor
#

wasn't that the objective?

tough abyss
#

Yes.

#

Rifle.

#

Since the script is also used on RPG units, AA units etc. Because I want them to also get randomised rifles.

little raptor
#

then use this

{_unit removeMagazines _x} forEach (magazines _unit arrayIntersect ([primaryWeapon _unit] call BIS_fnc_compatibleMagazines));
tough abyss
#

Sorry guys, but I think it would be alot easier for me to just use this script then create a whole new one. Since I already have going to deep into it and using some functions from it already.

little raptor
#

@tough abyss that script should be used before you remove the old rifle

tough abyss
#
if (random 100 < _weaponProbability) then {_unit removeMagazineGlobal _x} forEach (magazines _unit arrayIntersect ([primaryWeapon _unit] call BIS_fnc_compatibleMagazines)); private _weaponClass = primaryWeapon _unit; _unit removeWeapon _weaponClass; 
little raptor
#

no

#

also changed the code

tough abyss
#
    // Check to see if we randomize Weapon
    private _weaponProbability = getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "randomWeaponProbability");

    if (random 100 < _weaponProbability) then {
        {_unit removeMagazines _x} forEach (magazines _unit arrayIntersect ([primaryWeapon _unit] call BIS_fnc_compatibleMagazines));

        
        private _weaponClass = primaryWeapon _unit; _unit removeWeapon _weaponClass; 
        {
            private _cat = format ["%1List",_x];
            if (count  (getArray(configFile >> "CfgVehicles" >> typeOf _unit >> _cat))>0) then {
                [_unit, _x] call FUNC(randomizeWeapon);
            };
        } foreach ["rifle"];
    };
};
little raptor
tough abyss
little raptor
#

probably
since you don't need _weaponClass just make it one liner:

_unit removeWeapon primaryWeapon _unit;
tough abyss
#

Thanks. I highly suspect you roll up a spliff for a mood booster, prob the best natural remedy. Thanks again Leo!

tough abyss
#

Quoted;
Richard Smith, Writing C for 35 years
Answered 3 years ago
"this is how i use, and don’t use, pot as part of my programming.

i do not get high to code, ever. i tried once (or twice) and found i just sit and stare at code and literally nothing happens in my brain to advance to the next thought, logic is non-existent. not a good state of affairs, if you will…"

#

So yeah. Good choose. Wait, is this why I..-

#

Yeah it does not work unfortunatly. If you got a better mood and don't mind helping, I will be waiting happily for some help. You don't need to do it now. Cheers.

little raptor
tough abyss
#

So it's the scripts fault or BIS functions fault?

little raptor
#

BIS

tough abyss
#

I see.

little raptor
#

I'll change that

#

@tough abyss actually I don't want to risk it.
Do this:

{_unit removeMagazines _x} forEach ((magazines _unit apply {toLowerANSI _x}) arrayIntersect ([primaryWeapon _unit] call BIS_fnc_compatibleMagazines));
tough abyss
#

So this; (I still haven't edited _CATAGORIES since I later at some point want units to randomly get or not get grenades etc. ```sqf
// Check to see if we randomize Weapon
private _weaponProbability = getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "randomWeaponProbability");

if (random 100 < _weaponProbability) then { 
    {_unit removeMagazines _x} forEach ((magazines _unit apply {toLowerANSI _x}) arrayIntersect ([primaryWeapon _unit] call BIS_fnc_compatibleMagazines));

    
    private _weaponClass = primaryWeapon _unit; _unit removeWeapon _weaponClass; 
    {
        private _cat = format ["%1List",_x];
        if (count  (getArray(configFile >> "CfgVehicles" >> typeOf _unit >> _cat))>0) then {
            [_unit, _x] call FUNC(  randomizeWeapon);
        };
    } foreach WEAPON_CATEGORIES;
};

};

little raptor
#

you didn't make it one liner either

#

but whatever

languid oyster
tough abyss
#

Now it doesn't randomise the weapon at all and they spawn with standarded issues G3A3's.

little raptor
#

your own fault

blissful oyster
#

Hey, somebody know how to stop the VR Timer using BIS_stopTimer? Want to use it in my mission but when the Player reaches a trigger it should stop

tough abyss
#

Thanks Leo! Much appreciated as always!

blissful oyster
#

i mean the BIS_fnc_VRTimer function

#

its the function used in the time trials

little raptor
#

then just use BIS_stopTimer = true

#

and it'll stop

blissful oyster
#

thats the problem it does not work

willow hound
#

How are you using it?

blissful oyster
#

oh damn sorry i found the problem... i spelled BIS_stopTimre xD

little raptor
languid oyster
little raptor
#

@wind hedge
I said too many spawns.
As I mentioned already, use the sleep you use for the while. For example:

[]spawn {_contacts = allUnits;  
while {true} do {  
{  
 _pos = getPosWorld _x;  
 _marker = format ["markerblabla_%1", _forEachIndex]; 
 createMarkerLocal [_marker, _pos];  
 
 _marker setMarkerShapeLocal "ELLIPSE";  
 _marker setMarkerColorLocal "ColorBlack";  
 _marker setMarkerAlphaLocal 0.85;  
 _marker setMarkerPosLocal _pos;  
 _markerSize = ((getMarkerSize _marker select 0) + 0.1) mod 2; 
 systemChat str _markerSize;  
 _marker setMarkerSizeLocal [_markerSize, _markerSize];  
} forEach _contacts;  
sleep 0.1;  
}}
#

you can go ahead and test this in Debug Console

wind hedge
valid abyss
agile pumice
#

When converting player worle position to model position, I need to use getposasl right?

little raptor
#

which needs ASLtoAGL getPosASL

valid abyss
#

Thanks

agile pumice
#

Oh yeah right. If I just use player worldtomodel that should be fine right?

little raptor
#

What do you mean?

agile pumice
#

The syntax for worldtomodel takes object as a param

little raptor
#

yes

#

and the position must be AGL

#
obj worldToModel AGLPos
agile pumice
#

I'm trying to think of ways why my ace action I made wasn't showing at the location I specified using worldtomodel

#

I guess I have to tear apart the create action function and see what type of position in needs

#

Noted, I'm sitting in a vehicle seat before getting the worldtomodel position

valid abyss
little raptor
valid abyss
#

Yes but will it trigger if the host leaves?

little raptor
#

I don't know. I don't think so

slate cypress
#

How can I use playSound3D to play a sound with multiple sources in sync?

little raptor
#

and use isNil

#

to make it unscheduled

slate cypress
#

or is it not noticeable

little raptor
#

unscheduled code executes in exactly one frame (as if everything happened at the same time)

slate cypress
#

oh I see

#

I noticed a comment in 2014 saying it's not JIP compatible. is it now JIP compatible?

little raptor
#

Probably not

willow hound
#

How can something with local effect be JIP compatible krtecek

little raptor
#

Isn't it global?

slate cypress
#

it's global

little raptor
willow hound
#

Ah I looked at playSound

slate cypress
#

i'm going to use say3D ig because of local effect. what is the best way to synchronise an existing sound with JIP?

little raptor
#
sound_start_time = time;
//remoteExec the say3D for everyone
#
_offset = time - sound_start_time;
//remoteExec the say3D for JIP with offset

both must be executed by the server

slate cypress
little raptor
#

note that they still won't be perfectly synchronized

#

i.e. you can't dance to that say3D 🀣

slate cypress
#

🀣

#

where did you add the notes?

little raptor
slate cypress
#

oh notes to the code

astral tendon
# astral tendon Anyone here knows how to make a sub category for my action in ACE? for example, ...

Answering my own question, it has to be from config

class CfgVehicles
{
    class AllVehicles;
    class Air: AllVehicles
    {
        class ACE_SelfActions;
    };
    class Plane: Air
    {
        class ACE_SelfActions: ACE_SelfActions
        {
            class RadioToAWACS {
                displayName = "Radio AWACS";
                condition="true";
                statement="";
                icon="";
                class RadioToAWACS_Connect
                {
                    displayName="Connect to AWACS";
                    condition="True";
                    statement="[] spawn RTG_fnc_SelectAWACSDialog";
                };

            };
        };
    };
};
little raptor
astral tendon
dreamy kestrel
#

hello, Q: I have two 3D positions, how to I calculate the bearing between them? is that BIS_fnc_dirTo (https://community.bistudio.com/wiki/BIS_fnc_dirTo )? note this is saying use getDir, but I do not have objects, i have 3D positions and that is it. Thank you...

willow hound
dreamy kestrel
#

ah I see, second form. thanks...

west grove
#

hmm i'm trying to setup a time trial based on the wiki article, but on mission start i am getting a script error

#
_object setTriggerActivation ["None"...
Error undefined variable in expression: _object```
#

so i guess something is missing ... i just have no idea what. followed the guide 1:1

willow hound
#

Which guide?

little raptor
#

did you write it?

west grove
#

it's not wrong, it is what the script error shows me :p

#

no, i did not write any script

little raptor
#

call compile compile is wrong

willow hound
little raptor
#

you can't compile code

#

only string

west grove
#

ok, sure, but i don't compile anything

#

i literally followed the guide

#

now that makes me realize i probably should have asked this question in mission_makers

little raptor
#

@west grove can you tell me which function throws that error?

west grove
#

no, sorry. this is all i got

#

my guess is it is handled by the time trial module

still forum
#

You checked error in RPT?

#

And it gave you no filename?

#

Are you running Arma with -debug parameter to get better error logs?

real tartan
#

How can I check if I am in SP/MP scenario running from 3den (preview scenario) ?

still forum
#

and is3denPreview

west grove
#

@still forum

#

hm interesting

real tartan
#

is3DENPreview, thank you @still forum

west grove
#

ah jesus christ

#

found the error

still forum
#

There is no double compile in there tho.
Also what is that old man error there :D

west grove
#

wiki tutorial is wrong. it says "BIS_FD_quitSelector1" while it needs to be "BIS_TT_quitSelector1"

#

same with reset trigger

still forum
#

@ YorisYan fix plox

#

:D

west grove
#

just wanted to do the same :p

#

so sloppy :>

#

ok, it works now. only took me 30 mins to fix. \o/

willow hound
#

Not your fault if the guide is faulty meowtrash

still forum
#

Segfault

dawn walrus
west grove
#

no clue why there is some OM error in my log.

spark turret
#

i keep forgetting but:
init.sqf is executed for each player (+ server) once when they join.
if i join later, it wont run again for everyone else, correct?

still forum
spark turret
#

ah seems like i want initPlayerLocal

willow hound
#

Usually

spark turret
#

not to familiar with init order

willow hound
#

Our supply of wiki pages is endless

real tartan
spark turret
#

its not that i didnt know about the sources, its just very very low on my priority list usualls

#

if i get to the point where my script is flawless and i worry about initialization, i have usually already lost interest πŸ‘€

dawn walrus
toxic dirge
#
_ref01 = "#particlesource" createVehicleLocal (getpos bPos_01);
_ref01 setParticleCircle [0, [0, 0, 0]];
_ref01 setParticleRandom [0, [0, 0, 0], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 0];
_ref01 setParticleParams [["\A3\data_f\cl_exp", 1, 0, 1], "", "Billboard", 1, 0.5, [0, 0, 0], [0, 0, -17], 0, 5, 5, 0, [4,4,4], [[0,0.1,1, 1], [0.01,0.02,1, 1], [0.01,0.02,1,0]],[0.02], 1, 0, "", "", bPos_01];
_ref01 setDropInterval 0.06;

if I createVehicle non locally and then locally execute with debug or something will the effect still appear to all clients similar to props and what not?

willow hound
#

Say again?

toxic dirge
#
createVehicleLocal
createVehicle
willow hound
#

What about them?

#

If you run createVehicle on any machine, it has global effect and the object will exist everywhere.
If you run createVehicleLocal on one machine, the object will only exist on that machine.
If you run createVehicleLocal on all machines (using Remote Execution for example), a different object will exist on every machine.

toxic dirge
#

what I'm asking is if it still counts being a particle effect

#

and would the params work being executed locally aswell

willow hound
#

Particle Effects are strictly local.

toxic dirge
#

then my question is how can I get all clients to be able to see it while executing locall

#

y

little raptor
#

and I don't mean remoteExec

#

just locally

toxic dirge
#

remoteExec execVM?

little raptor
#

How do you show the particle effects?

toxic dirge
#

how do you mean?

little raptor
#

The code

willow hound
#

Put your particle effect creation code into a separate script file (better yet, make it a function) and then, yes, remote execute that file / function on every machine.

toxic dirge
#
null = [dropship_base] remoteExec ["fnc_DS_Effects",0];
null = [dropship_base] remoteExec ["fnc_DS_EH",0];
null = [dropship_base] remoteExec ["fnc_DS_Camera",0];

this is what I was doing but it only was working locally

little raptor
#

I mean the functions

toxic dirge
#

what I am creating, everything must be in one sqf file

willow hound
#

Why?

toxic dirge
#

it makes it more simple to use mission to mission and on the fly and I have no interest in making a mod or using in mission file

rough heart
#

Easier to create it inside a servermod

#

instead of making it single file

willow hound
#

It may make copy-pasting it easier, but it certainly doesn't make anything else easier.

rough heart
#

^

toxic dirge
#

I've even tried

{code_for_particle} remoteExec ["BIS_fnc_call",0];

to no avail

willow hound
#

That should have worked though.

toxic dirge
#

yes

#

although not efficient

willow hound
#

Provided getpos bPos_01 worked inside your remote executed code_for_particle.

toxic dirge
#

bPos_01 is a var name of an invisible helipad

#

that should work for everyone

willow hound
#

It should, yes.

#

Does the particle code work in local singleplayer testing?

toxic dirge
#

yes

#

in a variety of different test using remote ex too

#

but never in mp

#

the vehicle object spawn without being remote exec'd but the particle effect and camera do not carry over for anyone

#

no matter what i try

willow hound
#

Split it up into several files properly, get it working, then you can go back to a single file if you have to.

toxic dirge
#

I have seen it work in a single file before

                _source = createVehicle ["#particlesource",getPosATL _object,[],0,"CAN_COLLIDE"];
        [_source,"ExpSparks"] remoteExec ["setParticleClass",0,_source];
        _source attachTo [_object,[0,0,0]];
        _smokeGroup1 pushBack _source;

but I don't know how to get the particle params to work like this

willow hound
#

What params?

toxic dirge
#

setParticleParams
random
circle and interval

willow hound
#

Okay and in which code?

willow hound
#

Ah, because _ref01 is local there?

toxic dirge
#

yes

willow hound
#
{_ref01 = "#particlesource" createVehicleLocal (getPos bPos_01);
_ref01 setParticleCircle [0, [0, 0, 0]];
_ref01 setParticleRandom [0, [0, 0, 0], [0, 0, 0], 0, 0, [0, 0, 0, 0], 0, 0];
_ref01 setParticleParams [["\A3\data_f\cl_exp", 1, 0, 1], "", "Billboard", 1, 0.5, [0, 0, 0], [0, 0, -17], 0, 5, 5, 0, [4,4,4], [[0,0.1,1, 1], [0.01,0.02,1, 1], [0.01,0.02,1,0]],[0.02], 1, 0, "", "", bPos_01];
_ref01 setDropInterval 0.06;} remoteExec ["call", 0];
```Should work if you do it like this though.
winter rose
#

poor, poor network πŸ˜…

willow hound
#

Not my fault meowtrash

toxic dirge
#

I also should mention there are 6 separate effects that I will prob need to repeat this with

willow hound
#

Well, do it properly with functions or at least files then πŸ€·β€β™‚οΈ

toxic dirge
#

I will see what i can do thank you for the help

little raptor
#

@toxic dirge As I told you numerous times, just call the function locally

And if you're not gonna do that, at least define that as a function. Don't send the code over the network every time.

little raptor
toxic dirge
little raptor
# toxic dirge oh, it is done on mapSingleClick

Oh. Well that can't be done locally. I thought maybe it was some smoke or something that came out of that ship thing you showed me.
Anyway, define it as a function:

class CfgFunctions
{
    class DS
    {
        class particles
        {
            tag = "DS";
            file = "path\to\folder";
            class dropParticles {};
        };
    };
};

if it's a mod, put that in config.cpp. If it's a mission, put that in description.ext.

Next, create a file named fn_dropParticles.sqf in path\to\folder (which is path to the folder where you keep your functions) and put whatever you want in it.

that's it. you now have a function called DS_fnc_dropParticles (DS is the tag, as you see in cfgFunctions)
See this page for more info:
https://community.bistudio.com/wiki/Arma_3:_Functions_Library#Adding_a_Function

toxic dirge
velvet umbra
#

is there an eventhandler which is fired when player is talking?

willow hound
#

Don't think so, not for the vanilla VoN system at least.

crude stream
#

Can someone tell me why this isn't working for trying to apply random damage to a vehicle? Apparently I'm missing a ] but I can't see it for the life of me

_array = ["setHitPointDamage ["HitFuel", 1]", "setHitPointDamage ["HitEngine", 1]", "sethit ["wheel_1_1_steering", 1]", "sethit ["wheel_1_2_steering", 1]", "sethit ["wheel_2_1_steering", 1]", "sethit ["wheel_2_2_steering", 1]"];

_vehicle = selectRandom _array;```
little raptor
#

unless there's two

#
_array = ["setHitPointDamage ["HitFuel", 1]", "setHitPointDamage ["HitEngine", 1]", "sethit ["wheel_1_1_steering", 1]", "sethit ["wheel_1_2_steering", 1]", "sethit ["wheel_2_1_steering", 1]", "sethit ["wheel_2_2_steering", 1]"];

_vehicle = selectRandom _array;
#

see?

#

always use syntax highlighting

crude stream
#

I wasn't aware of that, what am I meant to do instead?

little raptor
#

or use ' (single quotes)

crude stream
#

Alright cheers Leopard, the script is running through now, but for some reason it isn't applying the damage to the vehicle

little raptor
#

use code

#
_array = [{_veh setDamage 1}, {_veh setDamage 0}];
call selectRandom _array;
crude stream
#

Ahhh that makes way more sense

#

Thought my way would work

crude stream
#

Alright, I got it. Thanks heaps Leopard. Great work as always

naive needle
#

what is the diffrence between LootWeaponHolder and GroundWeaponHolder

agile pumice
willow hound
#

#community_wiki but yes, using it with position can probably lead to incorrect results.

#

Adjusted.

languid oyster
#

I'm always reading here functions, functions, functions. Ok, because you guys tell, I made my mod with functions too. But what advantage has the function has over a normal script?

willow hound
spark turret
#

i have a particle source spawning dust clouds around the player, but i have a hardtime getting the particles velocity. i feed it [0,0,0] as movevelocity in setParticleParams, setParticleCricle and setParticleRandom. they still move with windspeed. any ideas how to stop that?

#

or is that just the way the cloud particle behaves?

young current
#

move velocity is their initial movement velocity and has nothing to do with wind

spark turret
#

yeah well thats my problem. they move even tho i set it to zero

young current
#

that particular parameter does not affect external forces

#

I believe there is something else that can be done about it but cant remember what the parameters are

spark turret
#

okay, im not able to manipulate the velocity, but thats fine. i can just offset it into the wind direction, so the particles is "fully mature" when it reaches the player.
can someone add to the setParticleParams wiki site that the position of the source is completely overwritten by:
this, /Object/
param. it will use the objects positon instead.

willow hound
#

@winter rose meowthis Judge this proposal, oh wise Particle Tutorial man

winter rose
#

I say -no-
I think there is a way to make it no wind-sensitive

hallow mortar
cosmic lichen
#

rubbing πŸ˜„

#

What a name

#

Fixed @hallow mortar

wind hedge
#

Why is this giving me a "generic error in expresion": _sortedContacts = [_nearObjects, [], {(player distance2d _x)}, "ASCEND"] call BIS_fnc_sortBy;

#

specifically at the player distance2d _x part

winter rose
spark turret
#

aha!

#

i did not. but it works now as intended. wind is actually what i want, i was just confused that it ignroed my input

winter rose
#

wind is actually what i want
it will still impact further during the particle's lifetime

spark turret
#

how?

winter rose
#

wind? by gusts, or wind change
your particle velocity is the initial velocity of the particle, that's it

little raptor
#

Also, if there are agents among them, you must use agent to get the agent unit

wind hedge
#
    
private _nearObjects = [];
    private _motionMarkersArray = [];
    private _maxMotionMarkers = 10;
    
    while { vMotionScannerRunning } do {
        if (visibleGPS) then {
            switch (true) do {
                case (_detectAllEnemies)    : { _nearObjects = (player nearEntities [["Man", "Air", "LandVehicle", "Ship"], _motionScannerDistance]) select {side group _x isNotEqualTo side group player && abs speed _x >= 3}; };
                case (_detectEnemyUnits)    : { _nearObjects = (player nearEntities [["Man"], _motionScannerDistance]) select {side group _x isNotEqualTo side group player && abs speed _x >= 3}; };
                case (_detectEnemyVehicles)    : { _nearObjects = (player nearEntities [["Air", "LandVehicle", "Ship"], _motionScannerDistance]) select {side group _x isNotEqualTo side group player && abs speed _x >= 3}; };
                case (_detectEnemyAgents)    : { _nearObjects = agents select {agent _x distance player < _motionScannerDistance}; };
            };        
            if (_nearObjects isNotEqualTo []) then {
                private _sortedContacts = [];
                _sortedContacts = [_nearObjects, [], {(player distance2d _x)}, "ASCEND"] call BIS_fnc_sortBy; ```
#

the true case I am using right now is _detectEnemyAgents

#

so, the answer to your question is: _nearObjects = agents select {agent _x distance player < _motionScannerDistance}

little raptor
#

agents returns teamMembers

#

which you'll have to convert to object using agent

wind hedge
#

how?

#

(because the aliens I am spawning are agents so I need the motion scanner to detect them!)

little raptor
#

@wind hedge you're already doing it:

agents select {agent _x distance player < _motionScannerDistance}
#

use that too for the sortBy

wind hedge
#
 
_sortedContacts = [(agents select {agent _x distance player < _motionScannerDistance}), [], {(player distance2d _x)}, "ASCEND"] call BIS_fnc_sortBy;
#

like so?

#

I thought that _nearObjects already catched that...

little raptor
#

@wind hedge player distance2D agent _x meowsweats

wind hedge
#

ohhhhhh, now I get it! meowsweats

glossy pine
#

if i remoteExec a BIS_fnc_addStackedEventHandler OnEachFrame on the server, the file called on the EH its handled by the remoteExecutedOwner or the Server?

winter rose
#

server

still forum
#

nothih

#

your question is weird and confused me

spark turret
#

can i add a "onWaypointcompletion" code to my waypoint through script?

#

cant find a command

winter rose
spark turret
#

oh cool thanks

winter rose
toxic dirge
#
comment "Dropship camera";
    fnc_DS_Camera =  {
    [dropship_base,{
    DropShipCamera = "Land_HandyCam_F" createVehicleLocal [0,0,0]; 
    DropShipCameraVectorUp = [0,0.25,1]; 
    DropShipCamera hideObject true; 
    DropShipCamera attachTo [this, [0,-40,10]]; 
    DropShipCamera setVectorUp DropShipCameraVectorUp;
    }] remoteExec ["BIS_fnc_call", 0];
    };

okay so when I remote exec my camera with onMapSingleClick it looks weird for example it will appear upside down in first person or too low in third, however it looks perfectly normal when locally executing

spark turret
#

cant find how to delete an unit?

winter rose
#

deleteVehicle

spark turret
#

... why

winter rose
#

as funny as it sounds πŸ˜„

spark turret
#

its createUnit and deleteVehicle. alright then

winter rose
#

and deleteVehicleCrew if the unit is in a vehicle 😬

cosmic lichen
#

Is there a reliable, fast way to get the height of an object? I tried with boundingBoxReal but had some inconsistencies

winter rose
#

BIS_fnc_objectHeight but I suspect it also uses the bounding box

cosmic lichen
#

Return object height defined by it is bounding box and ev. offset/fix.

winter rose
#

other than that a "hacky" way is to use some lineIntersects and make the difference with its base altitude I'm afraid

cosmic lichen
#

It has some fixes in it

#

Perhaps it works

winter rose
#

let's hope so!

cosmic lichen
#

lineIntersect with onEachFrame for 50 units, not good πŸ˜„

winter rose
#

yyyyyyyyyeah 😬

winter rose
cosmic lichen
#

Was about to add them to the biki

winter rose
#

u too quick 4 me

wind hedge
#
{
    if (_displayedMotionMarkers < _maxMotionMarkers) then {
        private _contactName = random 9999;
        _marker = objNull;
        if (_detectEnemyAgents) then {
            _contactName = name agent _x;
            _marker = createMarkerLocal [_contactName, getPosWorld agent _x];
        } else {
            playerSide reveal _x;
            _contactName = name _x;
            _marker = createMarkerLocal [_contactName, getPosWorld _x];
        };
        _marker setMarkerShapeLocal "ICON";
        _marker setMarkerTypeLocal "hd_dot";
        _marker setMarkerColorLocal "ColorGrey";
        _marker setMarkerAlphaLocal 0.85;
        _marker setMarkerSizeLocal [0.5, 0.5];
        [vAnimatedMarker_1_Fnc, _marker, 0.3] call CBA_fnc_waitAndExecute;
        [vAnimatedMarker_2_Fnc, _marker, 0.6] call CBA_fnc_waitAndExecute;
        [vdeleteMarkerLocalFnc, _marker, 0.9] call CBA_fnc_waitAndExecute;
        _displayedMotionMarkers = _displayedMotionMarkers + 1;
    };    
} forEach _sortedContacts;
    
winter rose
#

Question incoming, TAKE COVER!!

wind hedge
#

I am getting a _marker undefined at setMarkerShapeLocal "ICON";

cosmic lichen
#

private _marker = "";

little raptor
cosmic lichen
#

instead of objNull

little raptor
wind hedge
#

That is because we need a mrkNull!