#arma3_scripting

1 messages ยท Page 711 of 1

meager epoch
#

I found a better solution. It consists of emptying the box so that the player won't be able to see stuff, let alone take it! aviator

fair drum
#

ok i am home. did you get your answer yet

tough abyss
#

nope

rose pike
#

no sir

fair drum
#

ok so you want to know how to do a random equipment script with stuff of your choosing?

rose pike
#

aye

#

ideally for both uniforms/gear as well as weapons

fair drum
#

so start gathering your class names for the helmets, uniforms, weapons etc

#

and when you are done let me know

#

and categorize them as well

rose pike
#

i'll just grab some example class names

fair drum
#

you know how to define functions in a config right?

rose pike
#

i do not, @tough abyss might

tough abyss
#

no, not really

#

we're both new to this sort of stuff

fair drum
#

okay well we are going to make a function. the reason why we make a function instead of a script is that when a script is run, the compiler has to read through it every time. a function is stored in memory and so its faster and since we are going to be using this function on potentially a ton of units, we want something that is fast and repeatable

#

so lets start off by creating our parameters:

params ["_unit"];

this essentially assigns _unit to this select 0. its just a nicer way of representing it.

#

we then want to make some checks so that our function can exit if there are any errors so that it doesn't mess up later in the line

#
//Checks
if !(isServer) exitWith {};
if (isNull _unit) exitWith {};

we are going to be using global commands in this so we want them run only on one machine, usually the server. the first line exits if the machine running it isn't a server. the next line exits if you accidentally give it a null unit which can happen if you are dealing with large arrays as things die.

#

now lets define our variables:

private _helmets = [
    "helmet1",
    "helmet2",
    "helmet3"
    //etc
];

private _uniforms = [
    "uniform1",
    "uniform2",
    "uniform3"
    //etc
];
//continue as needed
#

let me know when finished

meager epoch
#

Even tho nothing stops me from trying blobdoggoshruggoogly

crude vigil
#

Oh so you want to be able to show an empty inventory.

meager epoch
#

No

#

I want to be able to see what's inside the box, but to not be able to take stuff out of it.

rose pike
#

mfw 3cb factions only has faction classnames and not weapon classnames on the 3cb website

crude vigil
#

It consists of **emptying **the box so that the player won't be able to **see **stuff
Am I missing something? meowsweats

rose pike
#

gimme a sec sry

meager epoch
crude vigil
#

aaand that result is .... the same as lockInventory which comes to my point? :o

meager epoch
#

Pretty much yeah, but this comes as the last solution

#

What i want is

meager epoch
#

If nothing works, then ill go with lockInv

crude vigil
#

yeah I understood but what Im saying u didnt really need to empty the container

fair drum
meager epoch
#

Ye ik lol

crude vigil
#

ok , we talking for no reason then, enjoy my 3 solutions if you ll go for em!

#

or another which u find :o

meager epoch
#

Will play with it tomorrow

#

Cba thinking rn blobdoggoshruggoogly

rose pike
#

Primary weapons:
"rhs_weap_akm", "rhs_30Rnd_762x39mm"
"rhs_weap_ak74n", "rhs_30Rnd_545x39_7N6M_AK"
"UK3CB_M16A2", "rhs_mag_30Rnd_556x45_M855A1_Stanag"

Secondary weapons:
"rhs_weap_tt33", "rhs_mag_762x25_8"
"rhs_weap_makarov_pm", "rhs_mag_9x18_8_57N181S"

Helmets
"rhs_6b26_green", "rhs_ssh68_green", "UK3CB_H_Shemeg_red", "UK3CB_H_Shemeg_oli"

Uniforms
"UK3CB_TKM_B_U_03", "UK3CB_TKM_B_U_03_B", "UK3CB_TKM_B_U_03_C", "UK3CB_TKM_B_U_04"

Vests:
"rhsgref_chicom_m88", "rhsgref_chestrig"

#

@fair drum

fair drum
rose pike
#

shit my bad

#

will do

#

i just copied class names i forgot to make them strings

#

i guess work today made my brain die

tough abyss
fair drum
tough abyss
#

oh im dumb

fair drum
#
private _weapons = [
  "UK3CB_M16A2",
  "weaponclass2"
];
tough abyss
#

alright that makes sense now

rose pike
#

do i need to format as such [["rhs_weap_akm", "rhs_30Rnd_762x39mm"],["rhs_weap_ak74n", "rhs_30Rnd_545x39_7N6M_AK"]];

fair drum
#

you can actually!

#

and when we use it later, we can do something cool too

rose pike
#
["UK3CB_M16A2", "rhs_mag_30Rnd_556x45_M855A1_Stanag"]
["rhs_weap_akm", "rhs_30Rnd_762x39mm"],
["rhs_weap_ak74n", "rhs_30Rnd_545x39_7N6M_AK"]
];
fair drum
#

so either you can do just a array of weapons, or an array of arrays containing weapons and mags

rose pike
#

๐Ÿ‘

#

just want to make sure the appropriate magazine matches the weapon

#

i would ask about how to factor in attachments - but for the units that need them they won't have randomized weaponry, so we don't need that

#

(will most likely solely randomize uniforms for those specific units and leave their weapons as normal)

fair drum
#

let me know when you have the rest of the variables created with your uniforms and stuff

rose pike
#

done

#

just unsure how to do secondary weapons or potentially launchers

#
//Checks
if !(isServer) exitWith {};
if (isNull _unit) exitWith {};

private _helmets = [
    "rhs_6b26_green",
    "rhs_ssh68_green",
    "UK3CB_H_Shemeg_red",
    "UK3CB_H_Shemeg_oli"
];

private _vests = [
    "rhsgref_chicom_m88",
    "rhsgref_chestrig"
];
private _uniforms = [
    "UK3CB_TKM_B_U_03",
    "UK3CB_TKM_B_U_03_B", 
    "UK3CB_TKM_B_U_03_C", 
    "UK3CB_TKM_B_U_04"
];

private _weapons = [
["UK3CB_M16A2", "rhs_mag_30Rnd_556x45_M855A1_Stanag"],
["rhs_weap_akm", "rhs_30Rnd_762x39mm"],
["rhs_weap_ak74n", "rhs_30Rnd_545x39_7N6M_AK"]
];```
#

whoops wait i missed uniforms

#

maybe all the sledgehammer work i did today knocked a few of my brain cells loose

fair drum
#

besides readability, it looks good syntax wise. now what we want to do is start the execution process. we want to remove everything from a unit to start with baseline. give me what you come up with on how to do that

fair drum
#

some of your variables have an extra comma

rose pike
#

oops thanks for catching that

rose pike
#
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;```
fair drum
#

use _unit you already defined it in params that's the point

#

we are going to be calling this whole function externally over all the units you want. there is no need to use init boxes

rose pike
#

im not sure then, sorry for being mega noob

fair drum
#

just instead of this do _unit

rose pike
#

oooh

#

whoops i should have realized that lol

fair drum
#

ok so now you got your params, your checks, your variables, and now we removed everything. so lets start by adding the containers. this one is easy, how we gonna do it?

rose pike
#

_unit forceAddUniform "";
_unit addVest "";
_unit addHeadgear"";

fair drum
#

what did we just say...

rose pike
#

im sorry i have no idea what im doing

#

i just looked at the add containers line from a loadout script

fair drum
#

we just had a conversation about this

#

so how we gonna get a random class from the variable? selectRandom

rose pike
#

alright, i am slightly familiar with selectRandom

#
private _gunInfo = selectRandom _gunArray;```
this was something a friend of mine tried but it did not work
fair drum
#

sure it would work. it would just return an array with 3 indexes since thats what you gave

rose pike
#

i should mention we tested it in VA and eden editor but didn't get it to work out

fair drum
#

think about it. selectRandom chooses a random index of an array. you have an array with 2 indexes in that, and each index of those have 3 indexes

#

so its only working on the surface level

rose pike
#

i see

fair drum
#

so lets look at your weapons

#

you can start with how you did here:

private _weapon = selectRandom _weapons;

and we end up with an array in that

#

so we end up with [weapon, mag] stored in that variable which we can use

rose pike
#

ok

fair drum
#

do you see how this works? if not, start looking at the params command

#

or instead you can do:

_unit addWeapon (_weapon # 0);
_unit addItemCargoGlobal [(_weapon # 1), 5];
#

mainly the apply is when you start adding in magazine counts to the array or making the array more complex

#

like this:

private _weapons = [
    ["primaryWeaponClass", "magClass", "magCount"],
    ["secondaryWeaponClass", "magClass", "magCount"],
    ["handgunWeaponClass", "magClass", "magCount"]
];

_weapons apply {
    _x params ["_weapon", "_mag", "_count"];

    _unit addWeapon _weapon;
    _unit addItemCargoGlobal [_mag, _count];
};

so now this will add a primary, secondary, and handgun, their mags, and count you want. all in one block

#

am I overloading you? lol

rose pike
#

mainly not sure how to set up launchers and handguns as i only have primary weapons defined

#
["UK3CB_M16A2", "rhs_mag_30Rnd_556x45_M855A1_Stanag"],
["rhs_weap_akm", "rhs_30Rnd_762x39mm"],
["rhs_weap_ak74n", "rhs_30Rnd_545x39_7N6M_AK"]
];
private _weapon = selectRandom _weapons;

_weapon apply {
    _x params ["_weapon", "_mag"];

    _unit addWeapon _weapon;
    _unit addItemCargoGlobal [_mag, 5];
};```
so just putting everything together so far - is this ok???
fair drum
#

yes that is okay for now.

#

so for secondary weapons, say launchers, you don't want all the units to have launchers right?

#

so you can do a percent check:

if (random 1 <= 0.3) then {
    // 30% chance
};
rose pike
#

good to know about the percent check but i'll simply have a dedicated light and heavy at classes so that i have more control over when launchers appear

#

so under private _weapons do i also list handguns and secondaries? would
["primaryWeaponClass", "magClass", "magCount"],
["secondaryWeaponClass", "magClass", "magCount"],
["handgunWeaponClass", "magClass", "magCount"]

pick up on the weapon class

fair drum
#

secondaries are launchers

#

btw

rose pike
#

yeah ik no worries

fair drum
#

and in your application, you want randomness, so no, you would make your own dedicated _handgun variable

rose pike
#

ok i just wanted to clarify

#

ty

fair drum
#

so follow suit with what ive shown so far and lets see what you get in the end.

rose pike
#
["UK3CB_M16A2", "rhs_mag_30Rnd_556x45_M855A1_Stanag"],
["rhs_weap_akm", "rhs_30Rnd_762x39mm"],
["rhs_weap_ak74n", "rhs_30Rnd_545x39_7N6M_AK"]
];
private _handgun = [
["rhs_weap_tt33", "rhs_mag_762x25_8"],
["rhs_weap_makarov_pm", "rhs_mag_9x18_8_57N181S"],
];```

```private _weapon = selectRandom _weapons;
_weapon apply {
    _x params ["_weapon", "_mag"];

    _unit addWeapon _weapon;
    _unit addItemCargoGlobal [_mag, 5];
};

private _handgun = selectRandom _handgun;
_handgun apply {
    _x params ["_handgun", "_mag"];

    _unit addWeapon _handgun;
    _unit addItemCargoGlobal [_mag, 3];
};```
fair drum
#

ok so what else do we want to add? you do your helmets? face gear? inventory items?

rose pike
#

just to clarify do i apply the same code to other categories

#

(uniform helmet etc)

fair drum
#

you don't need to use apply for a single command such as addHeadgear

#

also its starting to get long, start using sqfbin.com

rose pike
#

so i had

_unit addVest "";
_unit addHeadgear""``` earlier - what do i put in between the ""
fair drum
#

how did you select a random class last time?

#

you've already done this before

rose pike
#

i'm confused now sorry

#

so was that code all set then?

fair drum
#

selectRandom and store it in a variable? like how you did with _weapon = selectRandom _weapons? remember?

#
private _headgear = [
    "helmet1",
    "helmet2",
    "helmet3"
];
private _helmet = selectRandom _headgear;
_unit addHeadgear _helmet;

look familiar?

rose pike
#
    "rhs_6b26_green",
    "rhs_ssh68_green",
    "UK3CB_H_Shemeg_red",
    "UK3CB_H_Shemeg_oli"
];
private _helmets = selectRandom _headgear;
_unit addHeadgear _helmets;

private _vests = [
    "rhsgref_chicom_m88",
    "rhsgref_chestrig"
];
private _vests = selectRandom _vests;
_unit addVest _vests;

private _uniforms = [
    "UK3CB_TKM_B_U_03",
    "UK3CB_TKM_B_U_03_B", 
    "UK3CB_TKM_B_U_03_C", 
    "UK3CB_TKM_B_U_04"
];
private _uniforms = selectRandom _uniforms;
_unit addUniform _uniforms```
#

@fair drum should be good? what's next after this?

fair drum
rose pike
#

no worries

rose pike
#
params ["_unit"];
//Checks
if !(isServer) exitWith {};
if (isNull _unit) exitWith {};

removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

private _helmets = [
    "rhs_6b26_green",
    "rhs_ssh68_green",
    "UK3CB_H_Shemeg_red",
    "UK3CB_H_Shemeg_oli"
];
private _helmet = selectRandom _headgear;
_unit addHeadgear _helmet;

private _vests = [
    "rhsgref_chicom_m88",
    "rhsgref_chestrig"
];
private _vests = selectRandom _vests;
_unit addVest _vests;

private _uniforms = [
    "UK3CB_TKM_B_U_03",
    "UK3CB_TKM_B_U_03_B", 
    "UK3CB_TKM_B_U_03_C", 
    "UK3CB_TKM_B_U_04"
];
private _uniforms = selectRandom _uniforms;
_unit addUniform _uniforms

private _weapons = [
["UK3CB_M16A2", "rhs_mag_30Rnd_556x45_M855A1_Stanag"],
["rhs_weap_akm", "rhs_30Rnd_762x39mm"],
["rhs_weap_ak74n", "rhs_30Rnd_545x39_7N6M_AK"]
];
private _handgun = [
["rhs_weap_tt33", "rhs_mag_762x25_8"],
["rhs_weap_makarov_pm", "rhs_mag_9x18_8_57N181S"],
];

_unit forceAddUniform "";
_unit addVest "";
_unit addHeadgear""

private _weapon = selectRandom _weapons;
_weapon apply {
    _x params ["_weapon", "_mag"];

    _unit addWeapon _weapon;
    _unit addItemCargoGlobal [_mag, 5];
};

private _handgun = selectRandom _handgun;
_handgun apply {
    _x params ["_handgun", "_mag"];

    _unit addWeapon _handgun;
    _unit addItemCargoGlobal [_mag, 3];
};```
#

getting ready to sleep soon for work in the morning - this is all i have so far

fair drum
rose pike
#

fixed

fair drum
rose pike
#

that's why i asked about it before

#

i wasn't sure what to add in there, was it just the _unit forceAddUniform "_uniform";?

#

or do i need to add containers differently

copper raven
#

unless server owns all the _units, you have plenty of locality issues in that code

#

the apply stuff is nonsense

fair drum
#

i showed him when it would be applicable #arma3_scripting message. he just chose to latch onto that instead of the simple select above it.

rose pike
#

hey this is my first time doing any of this so sorry for not fully understanding

#

can i have an example of the select being used then?

rose pike
#

_unit addWeapon (_weapon # 0);
_unit addItemCargoGlobal [(_weapon # 1), 5];

so i understand 5 is the item count, what's the 0 and 1?

#

(i guess it doesn't super matter i'll just stick with what i have)

past gazelle
#

How do I check if a param is null or set the default? Uh...asking for a friend.

warm hedge
#

Asking that if it is null, assign something?

warm hedge
past gazelle
#

I tried sqf params ["_delayInSeconds","_west","_east","_guer", "_interferenceBonus"]; systemChat format ["_delayInSeconds = %1, _west = %2, _interferenceBonus %3",_delayInSeconds, _west, _interferenceBonus]; if (isNull _delayInSeconds) then {_delay = 85;} else { _delay = _delayInSeconds};

#

but on syschat without setting the variable, it's set to "any" ?

still forum
#

Anyone know how to check if a drone has its laser on?
isLaserOn darterDrone always returns false ๐Ÿ˜ข

warm hedge
#

laserTarget?

still forum
past gazelle
#

OH!

#

Thanks!

still forum
#

Nah laserTarget always returns objNull

warm hedge
#

Rly?

still forum
#

even when I aim the laser at an object

winter rose
#

Fix it ๐Ÿ˜„

warm hedge
#

Does work for me

winter rose
#

may depend on the drone model

warm hedge
#

#DedmenWhatDidYouJustBroke

still forum
#

Using a darter drone

warm hedge
#

Yes

still forum
warm hedge
still forum
#

๐Ÿ˜

#

ok, now onto lazors

#

but isLaserOn is arg local so I'll probably need to use laserTarget :wob:

#

๐Ÿค”

#

yes. gud

still forum
#

Target Acquired

still forum
#

Ahh too bright

warm hedge
#

Boom boom

still forum
#

52 lasers. My fps goes from 36 down to 34

warm hedge
#

So... working on a visible laser?

still forum
warm hedge
#

drawLaser๐Ÿ‘€

still forum
warm hedge
#

Can I... ask?

#

What DLC you don't have in the shot?

still forum
#

All

warm hedge
#

Makes sense

tight cloak
#

when even a bi dev cant get rid of the dlc watermark, this is truly arma 3

dreamy kestrel
#

I need help sorting out how to arrange waypoints... i.e. Cycle as first waypoint has no sense

#

what I have is a group, may patrol some raided transport vehicles.
or may patrol a set of resource crates.
but in any event, I want a cycle (?) among those objects, _transports|_crates.
thanks...

little raptor
dreamy kestrel
#

goal being, group should patrol waypoints A-B-C-A...

#

the waypoints are not working, I get that error. what does it even mean?

little raptor
#

the last waypoint has to be cycle

#

e.g for ABCD cycle, ABC are move, D is cycle

#

cycle waypoint cannot be the first waypoint

still forum
dreamy kestrel
little raptor
#

ยฏ\_(ใƒ„)_/ยฏ

dreamy kestrel
winter rose
meager epoch
#

how can i get the object name/whatever/idk how its called for the primary weapon the player uses
ive tried this, but it doesnt seem to work:
prWep = missionNamespace getVariable (primaryWeapon player);

finite sundial
#

yeah err

winter rose
meager epoch
#

what i want to do is have the weapon the player drops on the ground be attached to the back instead

little raptor
finite sundial
#

you would have to create a weapon holder

#

if i'm correct

meager epoch
#

with all the attachments and stuff

winter rose
meager epoch
#

so uh, whats that

little raptor
#

a virtual crate

meager epoch
#

where can i get information about that

little raptor
#

google meowsweats

meager epoch
#

right lol

winter rose
#

"GroundWeaponHolder" is the class I think, try nearestObjects

dreamy kestrel
#

I think I found it, but this statement does not make a lot of sense, "This waypoint type will change the group's active waypoint to the nearest waypoint other than the group's previous waypoint"

#

especially in scenarios, when A is not necessarily the nearest other WP

winter rose
#

as in:

waypoint A โ†’ B โ†’ C โ†’ D (CYCLE, near C)
D will ignore C and will look for the closest to cycle

#

it could be better phrased but I think that's the meaning

dreamy kestrel
#

if I have ABCD, D is cycle. yes, I think so. could land on A|B depending on which was closest (?). the intention is for the WP to land on A.

#

or even AB for that matter, Amove Bcycle back to A?

#

maybe a tri-WP is the best scenario to consider, IDK. I'll tinker; open to suggestions otherwise how to manage it.

winter rose
#

starts from A again

#

A โ†’ B โ†’ C โ†’ D โ†’ A again โ†’ B โ†’ C โ†’ etc

dreamy kestrel
#

okay dokay, thanks

meager epoch
#

why does adding attachments (via the attributes) on a weapon put on the ground makes it invisible

meager epoch
#

any way around this

little raptor
#

you're probably doing it wrong

meager epoch
#

it always disappears for me blobdoggoshruggoogly

#

i put a weapon on the ground from the props, right click > attributes > equipment >> add stuff from there

little raptor
meager epoch
#

yep

little raptor
#

yeah never done that one notlikemeow

meager epoch
#

welp

winter rose
#

time for addWeaponWithAttachmentsCargo I guess

little raptor
#

Yeah that one works

#
  • Global
meager epoch
#

will check it out, thanks

#

i dont want this on me tho

#

i need it on the ground

#

so i can attachto it on the back whenever i drop the main weapon

#

and it has all the attachments

winter rose
#

yes

#

then you don't need to change anything in Eden

meager epoch
#

how can i put it on the ground lol? it literally says that its for putting the weapon inside a container and such

finite sundial
#

create a ground weapon holder by any means, assign a variable to it, then use addWeaponWithAttachmentsCargo like Lou said

meager epoch
#

oh, so i need the ground weapon holder

#

right

#

thanks

finite sundial
#

there's probably a better way to do it, this is off the top of my head

#

I vaguely remember how I did it with one of my mods

#

... bots

dreamy kestrel
#

yeah, pretty sure the WP circuit is not working... one sec.

#

at its most basic form,

// _obj is _crate|_transport object
// _radius is object 'safe' radius
// _grp is the group
private _wp = _grp addWaypoint [_obj, _radius];
// The last one in sequence is the CYCLE, array of objects to circuit, _objIndex current index
private _wpType = ["CYCLE", "MOVE"] select (_objIndex < _wpObjectsLastIndex);
_wp setWaypointType _wpType;
#

given group, iterating over the objects to design the WP circuit.

#

do I have to then tell the group to start the WP circuit?

#

when the units are created I also doStop _units, not sure if that is having a side WP effect.

little raptor
#

AI can't snap out of doStop by themselves

meager epoch
#

I get an error:
No entry in config.bin > weapons > Weapon_srifle_EBR_F

#

This is what I have:

wepHolder = "GroundWeaponHolder" createVehicle getPos this;
wepHolder addWeaponWithAttachmentsCargo [["Weapon_srifle_EBR_F", "Item_muzzle_snds_B", "", "Item_optic_LRPS", ["20Rnd_762x51_Mag", 20], ["", ""], "Item_bipod_01_F_snd"], 1];
dreamy kestrel
#

ah okay I think I see; so would need something like units _group doFollow leader _group

#

great that works, thanks!

copper raven
meager epoch
#

so how do i change the class

copper raven
#

see CfgWeapons for most of them all you need to do is just remove the Weapon, Item, Vest prefixes etc.

meager epoch
#

that worked, thanks

#

ok, question no. 2
how can i make an add a wep with attachment to the player's backpack?
tried this, didnt work:
player addWeaponWithAttachmentsCargo [...];

finite sundial
#

hmm?

copper raven
meager epoch
#

i want to add a weapon with an attachment to the player's backpack, how can i?

#

alright

meager epoch
runic edge
#

hello boys, I'm using the latest github version of Tonnilson Taw_vd and my rpt is getting spammed with this error in the rpt: 21:28:13 Error Undefined variable in expression: _dist 21:28:13 File mpmissions__cur_mp.Altis\taw_vd\fn_updateViewDistance.sqf..., line 33.
The fn_updateViewDistance.sqf is as follow :

#include "defines.h"
/*
    Author: Bryan "Tonic" Boardwine

    Description:
    Updates the view distance dependant on whether the player
    is on foot, a car or an aircraft.
*/
private "_dist";
switch (true) do {
    case (!(EQUAL(SEL(UAVControl getConnectedUAV player,1),""))): {
        setViewDistance tawvd_drone;
        _dist = tawvd_drone;
    };

    case ((vehicle player) isKindOf "Man"): {
        setViewDistance tawvd_foot;
        _dist = tawvd_foot;
    };

    case (((vehicle player) isKindOf "LandVehicle") || ((vehicle player) isKindOf "Ship")): {
        setViewDistance tawvd_car;
        _dist = tawvd_car;
    };

    case ((vehicle player) isKindOf "Air"): {
        setViewDistance tawvd_air;
        _dist = tawvd_air;
    };
};

if(tawvd_syncObject) then {
    setObjectViewDistance [_dist,100];
    tawvd_object = _dist;
}; ``` 

What's the problem and how can i fix it ? 
Thanks
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
little raptor
#

the author is only checking a limited range of config classes

bitter jewel
#

is it possible to make the player deaf by script

little raptor
#

you can mute the game sounds

#

see:

fadeEnvironment
fadeMusic
fadeRadio
fadeSound
fadeSpeech

runic edge
# little raptor anyway, the problem is that there is no default value for dist

so i could fix it by

#include "defines.h"
/*
    Author: Bryan "Tonic" Boardwine

    Description:
    Updates the view distance dependant on whether the player
    is on foot, a car or an aircraft.
*/
private "_dist" = 1600;
switch (true) do {
    case (!(EQUAL(SEL(UAVControl getConnectedUAV player,1),""))): {
        setViewDistance tawvd_drone;``` etc ... ?
little raptor
#

without the ""

#
private _dist = 1600;
runic edge
#

ok thanks I'll try it now

bitter jewel
#

is it possible to deny the player from editing their inventory, or even prevent them from opening it?

little raptor
#

there's an inventory opened event handler iirc

bitter jewel
#

i suppose i would then immediately close the inventory?

#

oh i am to prevent the inventory from even opening with returning true

runic edge
#

seams fixed @little raptor thanks for the quick help ๐Ÿ™‚

bitter jewel
dreamy kestrel
#

shifting gears a bit; when setting damage, which name(s) do we use for setHit? i.e. [hitpointsNamesArray, selectionsNamesArray, damageValuesArray]?

#

guessing hitpointsNamesArray, however, what is the relevance of selectionsNamesArray?

little raptor
dreamy kestrel
#

so for purposes of damaging, we can probably ignore that element?

#

or can entire selections be damaged?

little raptor
little raptor
dreamy kestrel
#

hmm okay, re: both questions, so we can specify selections? as well as specific hit points?

little raptor
#

the command takes selection names

#

so the hitPointNames thing is not needed

dreamy kestrel
#

oh okay I see. difference between set/getHit and set/getHitPointDamage. okay, thanks...

warm vapor
#

Question:

I want to fake collision with an object by making a player die when they enter a semi-transparent sphere. Essentially, if they fly into it, they should wonderfully explode (and if possible, their direction of travel should reverse like they bounced off of it)

#

What would the best way to do that?

modern kiln
#

To simply make someone explode if it is flying in a certain area, I think you could use a trigger. Should the wreck also bounce off or you're suggesting that the plane should reverse without exploding?

warm vapor
#

Ideally the wreck would bounce off, but I can live without it

modern kiln
#

Should it work for every plane, even empty ones, or should only planes of a given side explode?

warm vapor
#

Only vehicles of a given side.

The idea: It's a starsim unit, and I want to have the finale piece of the last mission of the campaign involve using 'anti-orbital missile platforms' (cruise missiles) to strike a capital ship. The problem is, the prop has no collision detection - so if they decide to take a starfighter against it, they pass right through it

#

So what I want to do is stop them from ever reaching ti to fly into it. I tried to make a trigger with

Activation: BLUFor Present

{if (_x == player) then {_x setDammage 1}} foreach thisList

But it doesn't work (and apparently setDammage is how it's spelled)

#

I also tried {if (_x == vehicle player) then {_x setDammage 1}} foreach thisList

modern kiln
#

Try with a trigger with Activation: BLUFOR and Activation type: Present
Condition:
this && {({_x isKindOf "Plane"} count thisList) > 0}
On Activation:
{_x setDamage 1} forEach thisList

dreamy kestrel
#

Q: re: waypoints, if I arranged a WP targeting a specific OBJECT, if the object is deleted, does that corrupt the WP?

warm vapor
#

No luck

#

My aircraft flies into the space and just keeps going

modern kiln
#

How fast are you?

modern kiln
peak pond
#

Hi, is there any way to programmatically enable/disable some MP mission slots based on the number of players connected?

jaunty ravine
#

Is there any event handler for changing firing mode (e.g. semi to auto)?

modern kiln
#

I think you can build one using waitUntil and fetching data with e.g. getArray (configFile >> "CfgWeapons" >> currentWeapon player >> "modes")

lavish coral
little raptor
little raptor
modern kiln
little raptor
#

and your activation statement

warm vapor
#

Unless any object triggers it, but the effect only gets applied to specific groups

little raptor
peak pond
# lavish coral You want to prevent jip or..?

Ideally no. If more people JIP, I'd like more slots to open up. I've seen scripts that kick players after they JIP if they chose a bad slot. But I'm wondering if there is a better solution like disabling/hiding the slots.

plush oriole
#

Anyone know how to detonate the explosion new global mobilization nuke without launching the missile? I've found the gm_rocket_luna_nuc_3r10_warhead cfgammo entry but spawning it then doing setdamage 1 doesnt seem to do anything

bitter jewel
#

does anyone know how arma decides the value of

netId foo

is it based on ip or steam id for example?

#

nevermind it doesn't even solve my problem

little raptor
bitter jewel
#

i am just trying to figure out how to test mp script, and got confused because the string that netId returned had different owner than i anticipated. but it seems netId will just contain the original owner.

plush oriole
#
rocket = "gm_rocket_luna_nuc_3r10" createVehicle ((getPos bruh) vectorAdd [0,0,10]);
rocket setDamage 1```
#

oh cool discord has sqf highlighting

keen ore
#

question, when building a pbo, I have a #define var in a .hpp, will the pre-processor honor those in sqm files? If not, how would I do that?

plush oriole
#

damn how did i not realise that command exists thanks

#

hmm doesnt seem to work

willow hound
#

Does it even create the rocket as expected?

little raptor
plush oriole
#

tried with warhead as well and doesnt seem to work either with setdamage or triggerammo

#

hmm

#

and yeah it makes a smoke trail and a missile model for 1 frame

#

*smoke trail persists

#

at the right position

#

has anyone got this working or just ammo detonating in general

#

my worry is that it might be that the launcher has some scripting attached which spawns the nuclear explosion effects

urban tiger
#

Bit of a random wall, with createvehiclelocal being bit of a security issue, is there anyway to spawn say "B_Soldier_F" only locally but still be able to use the animation commands without using createvehiclelocal.

winter rose
#

what's your question with createVehicleLocal again?

#

if you have to create a local vehicle, use it
the only other way is to create a local simple object, which is not really animatable as you wish it to be

urban tiger
#

so the only way to possibly do it would be with the normal createvehicle but setting the pos to a random seed?

winter rose
#

no, it would be to use createVehicleLocal

crude vigil
#

why do you want createVehicleLocal?

#

why not create for all, hide for rest?

winter rose
#

(or agent if the AI is not needed)
the only issue being that this unit may be temporarily visible by everyone for a glimpse

crude vigil
#

with createVehicleLocal, do animations even work btw?

winter rose
#

I think so yes

crude vigil
winter rose
#

tru tru

crude vigil
#

then it is not an issue anymore

#

There are bigger issues out there!

winter rose
#

no

urban tiger
crude vigil
#

that does not really answer that question? :o

urban tiger
crude vigil
#

anyways there is the work around.

#

create for all, hide for rest.

urban tiger
fair lava
#

im pretty novice when it comes to sqf, but would it be possible to make something that; when i fire a gl round, it puts a hint for how far away it landed?

#

i assume theres some kind of event i can listen to?

fair lava
#

im looking at just the fired event atm

fair lava
#

yeah so i'd get the projectile, and then somehow detect when it dies?

somber radish
#

oh ok

fair lava
#

can i put a EH on the projectile i get from that EH?

somber radish
#

I got one script I use to make a mini nuke launcher

fair lava
#

or is there a function for this or something

somber radish
#

If u want Ill put it on here and u can extract what u need

fair lava
#

yes pls

little raptor
#

sadly projectiles don't support EHs

fair lava
#

so i'd just have to check constantly?

#

while its in the air?

little raptor
#

yes

somber radish
#

If u want Ill dm it

fair lava
#

thats okay i think i can figure this out

#

i'll just loop until the projectile is no longer valid and hint the distance

#

so that the last hint is the last distance

#

that'll work for what im tryna do

somber radish
#

                        While {Alive _Projectile} do {
                                                        if !((GetPos _Projectile) IsEqualTo [0,0,0]) then {
                                                                                                            _PosARR PushbackUnique (GetPos _Projectile);
                                                                                                          }
                                                     };
                            
Waituntil {!(alive _Projectile)};

_PosARR deleteAt (_PosARR findIf {_x IsEqualTo [0,0,0]});

Private _Impactpos = (_PosARR select ((Count _PosARR)-1));
fair lava
#

ooh

somber radish
#

then u could use ```sqf
(player) Distance2d (_Impactpos)

To measure the distance
somber radish
fair lava
#

im just in editor using debug console, for context, im trying to fix the ranging on a GL scope

somber radish
#

AH

fair lava
#

yea

#
_handle = [] spawn {
    _PosARR = [];
    player addEventHandler ["Fired", {
        params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
        While {Alive _projectile} do {
            if !((GetPos _projectile) IsEqualTo [0,0,0]) then {
                _PosARR PushbackUnique (GetPos _projectile);
                };
            };
        };
    };
    Waituntil {!(alive _projectile)};
    _PosARR deleteAt (_PosARR findIf {_x IsEqualTo [0,0,0]});
    _Impactpos = (_PosARR select ((Count _PosARR)-1));
    hint ((player) Distance2D (_Impactpos));
}; 
#

so this?

fair lava
#

dude sqf is so confusing

willow hound
#

No need for that array o.O

fair lava
#

yeah you're right

#

i also dont think i should be adding the event handler in the spawn

willow hound
#
private _firstPos = getPosASL _projectile;
private _lastPos = getPosASL _projectile;
while {alive _projectile} do { _lastPos = getPosASL _projectile; };
systemChat format ["Distance: %1", _firstPos distance _lastPos];
fair lava
#
player addEventHandler ["Fired", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
    private _firstPos = getPosASL _projectile;
    private _lastPos = getPosASL _projectile;
    while {alive _projectile} do { _lastPos = getPosASL _projectile };
    systemChat format ["Distance: %1", _firstPos distance _lastPos];
}];
#

okay this looks way better

#

please excuse the fact that im dumb

willow hound
#

Still needs to be spawned though because of while ๐Ÿ™‚

fair lava
#

ah yea

#

can i put the addEH in the spawn (i.e the whole script) or do i need to call spawn inside the eh?

#

scope in sqf scares me

willow hound
#

spawn inside the EH

fair lava
#

does spawn block?

#

or is that the whole reason for needing spawn

#

because you're not allowed to block

willow hound
#

call waits for the called code to finish, spawn does not wait for the spawned code to finish.

fair lava
#

so i could use call around the while loop and then have systemchat outside the call

#

for example

#

i put just the while loop in and it printed distance: 0

#

which i assume is because spawn doesnt block so it didnt wait

willow hound
fair lava
#

ah hah

#

probably better to not block anyway lol

#

oh i have to pass the vars in right

willow hound
#
player addEventHandler ["Fired", {
  [_this # 6] spawn {
    params ["_projectile"];
    private _firstPos = getPosASL _projectile;
    private _lastPos = getPosASL _projectile;
    while {alive _projectile} do { _lastPos = getPosASL _projectile; };
    systemChat format ["Distance: %1", _firstPos distance _lastPos];
  };
}];
fair lava
#

is param the same as array accessing _this?

dreamy kestrel
#

yea, so I am watching these units, they sort of visited waypoint A, then are stuck bouncing between waypoints B and C. not sure there was ever a D.

fair lava
#

i see rooISee1

#

that saves having to write out all of them

#

"distance 188" yay!

#

many thanks ansin

willow hound
#

Sure, you could pass all the parameters from the EH into the spawn, but what for if you don't use them ๐Ÿ™‚

dreamy kestrel
#

help me out here someone, when setting up that 'CYCLE' waypoint, that should not use an object target to move to? seems like anyway 'that' WP is being ignored. and the 'first' transport WP is never revisited in the loop.

crude vigil
dreamy kestrel
#

okay, well, the behavior seems to be this, Am-Bm-Cm-Dm-(Ec)-Cm-Dm-Cm-Dm ... in perpetuity. A|B are never seen ever again.

#

how do I ensure that ABCD are visited?

copper raven
#

i don't know your exact implementation, never had issues with cycle waypoint blobdoggoshruggoogly

dreamy kestrel
#

not sure what you mean by 'debug'. there are only two types here AFAIK, 'move' and the last one 'cycle'.
the target objects are well defined, and I can verify ABCD are visited in that order once. thereafter I get CDCDCD...

#

so if there's a way to tell at D go to A, rinse and repeat, that's what I need.

somber radish
#

Anyone know of a method of getting the armor level of vests / helmets?

copper raven
#

config

copper raven
#

first 4, then a 5th one being the cycle one?

somber radish
# copper raven config

So how would I query that ingame?

([configFile >> "CfgWeapons" >> (HeadGear _Man)] call BIS_fnc_displayName);
```Something like this???
dreamy kestrel
#
// in a loop of the target objects for the group
_wp = _grp addWaypoint [_obj, _radius];
_wp setWaypointType "MOVE";

// Afterwards, actual position being the center position of the scenario
private _cycleWP = _grp addWaypoint [_actualPos, _maxRadius];
_cycleWP setWaypointType "CYCLE";

there's nothing especially mystical about that AFAIK.

copper raven
#

why use the function?

#

@somber radish use getText, and navigate one more time, to displayName

somber radish
#
getText (configFile >> "CfgVehicles" >> (HeadGear _Man))

?

copper raven
copper raven
dreamy kestrel
#

do you have an example perhaps?

somber radish
#

pls

#

๐Ÿ˜˜

copper raven
dreamy kestrel
#

ABCDCDCDCDCD...

#

unless like I said there is a way to set the next WP, i.e. when triggering on the current one.

copper raven
#

there is something wrong with your implementation, i sent you a way to make sure it is indeed CDCD, maybe your completion radius just makes skip the first two, i don't know

dreamy kestrel
#

kindly how do you setup a circuit that visits ALL of the WPs?

copper raven
#

the way i do it is adding my moves, then cycle as the last one

#

i don't know why it doesn't work in your case

dreamy kestrel
#

it sounds as I've done it, yes, as above illustrated.
the docs seem to indicate the closest one is chosen after the last one in cycle.
however, I think it is not quite that, and in fact, is worse than that.
not sure what dynamics are meant by the completion radius. that is used to select eligible next WPs?

copper raven
#

try creating the cycle waypoint at the position of the first one

dreamy kestrel
#

position of the first one? I can try that, okay. or object if it is an object? or all 'positions' if I can derive a position?

copper raven
#

just the position/object of what the initial waypoint had

somber radish
# copper raven >> "displayName"
 ([configFile >> "CfgWeapons" >> (HeadGear player) >> "descriptionShort"])

This is the dir of what I am looking for
However GetText produces an error.
Any way to extract the info I need?

#

Oooh

#

sorry

#

my bad

#

remove []

#

and we good

#
getText (configFile >> "CfgWeapons" >> (HeadGear player) >> "descriptionShort")
copper raven
#

anyway, glad you got it working

crude vigil
#

it looks cooler

somber radish
#

Yup, it looks cooler

dreamy kestrel
#

I think that was it @copper raven , closed the circuit 'properly' and it looks like they are completing full circuits.

somber radish
bronze panther
#

anyone know how to make a custom sound module

warm hedge
bronze panther
#

my b just didn't know which one it fell under

fair drum
bronze panther
#

yeah

#

i think i got it tho

fair drum
#

why would you want to though? its much easier to play a sound on command with a single line command

bronze panther
#

I figured out how to do it through zeus via the play sound module

little raptor
idle jungle
#

can i use a bis_fnc_showSubtitles in a remoteExec to target 0?
i.e.

["Broadway", "All callsigns this is Broadway, it might be wise shortly to start using your IR STROBES, You are starting to near eachothers locations and we want to avoid any potential blue on blue! Out."] remoteExec ["BIS_fnc_showSubtitle", 0];```
idle jungle
#

im getting the hang of it lol

idle jungle
#

Does anyone know if its possible to assign respawn tickets per person rather than a pool of them? If yes any pointers

copper raven
#

@still forum for the bytecode, u64 code content string, does the game actually look for the leftmost bit to determine whether its an offset or an index to the string?

fair drum
#

You can do sides, groups, units, etc.

idle jungle
#

Thanks bud

fair drum
spiral sundial
#

Does anyone know what commands were used to remove the base of the weapons in this composition?
https://steamcommunity.com/sharedfiles/filedetails/?id=2503445603&searchtext=
Like in image 6 or image 13. Those cannons usually have supports to hold them into the ground, and I dont know how the author managed to remove them for vehicle mounts. It's something I myself have been trying to figure out for a while.

fair drum
#

its iffy if modded people put them in though

knotty slate
#

Please don't answer if you don't know. No guesses.

I play Zeus on the official BIS servers.

I'll often join an empty one, go as Zeus and start setting up my world; spawning civilians, outposts, waypoints, etc..

Problem is every day I have to re-do that setup and it takes a few hours. Very tedious. Is there a way for me to select .. everything .. I spawned on Altis and then just save it somewhere and be able to paste it any time I'm Zeus on a public server?

If so, how? I remember a long long time ago I used a script or something, I forgot how.

little raptor
#

and use the perf branch to be able to use it in Zeus

meager epoch
#

What's the difference between the animChanged and animStateChanged EHs?

little raptor
#

animChanged only triggers when the target animation state changes

#

animStateChanged triggers every time the animation state changes

meager epoch
#

Is one of those a good option for something that I want to happen every time the player changes his stance or should I go with an if (or switch) in a loop or something?

#

Or is there a third way

meager epoch
#

Cool, thanks

little raptor
#

animChanged should also suffice afaik

#

it triggers less often

meager epoch
#

Will play with them

distant oyster
#

has anyone ever noticed the description of the chanel?

IF (script == true) THEN {chat here};
cosmic lichen
#

Yes ๐Ÿ˜„

heady quiver
#

Hi guys, i got a lil script where it forces players to eject out of a plane, but sometimes one of them gets hit by the plane and dies right in the air, does anyone know a fix for this?

meager epoch
#

Disable his damage and enable it back a couple of seconds after? idk

heady quiver
#

Yea was thinking that too, but bit weird tho

little raptor
heady quiver
#
{ _x action ['Eject', _startingPlane]; } forEach allPlayers;

This is what i use at

#

m

little raptor
#

the wiki description seems incomplete so just read the function yourself in function viewer

meager epoch
#

Is this the correct way of getting the items from an old backpack and putting them in the new one?

bArray = backpackItems player;
player addBackpack "B_AssaultPack_khk"; 

while {count bArray != 0} do {
ย ย ย  player addItemToBackpack bArray select 0;
};
little raptor
#

and how can count bArray become 0 exactly?!

#

what you wrote is an infinite loop

#

also it's wrong

#

player addItemToBackpack bArray select 0;

#

select has the same precedence as addItemToBackpack, and it executes second because it's on the right

meager epoch
little raptor
meager epoch
#

o ait

little raptor
#

so what do you plan to do now?!

meager epoch
#

1sec

#
bArray = backpackItems player;
player addBackpack "B_AssaultPack_khk"; 
counter = count bArray;

while {counter != 0} do {
    player addItemToBackpack (bArray select 0);
    bArray deleteAt 0;
    counter = count bArray;
};
still forum
meager epoch
#

how about now?

little raptor
meager epoch
#

oh no

little raptor
#

I'm afraid your brain has been overwhelmed by learning too much! ๐Ÿคฃ

meager epoch
#

I'm afraid so notlikemeow

#

i feel like im close tho

#

am i at least close

little raptor
#

I only say one word: forEach

#

or did you not know forEach?! meowsweats

meager epoch
#

i knew about it, i just didnt think of it blobdoggoshruggoogly

little raptor
meager epoch
#

yep :d

#

ive never used it tho, so get ur sweatymeow emoji ready

little raptor
#

this one's better: nootlikethis

meager epoch
#

@little raptor do i still need the while?

#

understandable

little raptor
meager epoch
#

yea im there as we speak, just a little lost

little raptor
#

forEach already iterates thru the array

meager epoch
#
bArray = backpackItems player;
player addBackpack "B_AssaultPack_khk"; 
{ player addItemToBackpack (select _x); } forEach bArray;
#

D:

#

this is worse than my first attempt isnt it

little raptor
#

first of all select is binary: _bla select _blabla. this (select _x) is unary

#

second of all, _x is the current element in the loop

#

so you don't need select at all

meager epoch
#

so, just additemtobackpack _x?

little raptor
#

yes

meager epoch
#

right

little raptor
#

also why do you use a global variable?

meager epoch
#

add an "_" in front of bArray?

little raptor
#

yes meowsweats

meager epoch
#

or is _ what makes it global

#

right

#

lol

#

and uh

#

is the rest of the code ok?

little raptor
#

rest?! it's only 3 lines! ๐Ÿ˜„

meager epoch
#

doesnt that get the job done!? notlikemeow

little raptor
#

it does

meager epoch
#

oh great

#

so

#

final

#
_bArray = backpackItems player;
player addBackpack "B_AssaultPack_khk"; 
{ player addItemToBackpack _x; } forEach _bArray;
little raptor
#

ye

meager epoch
#

nice

#

thanks

meager epoch
little raptor
#

because it's a global variable. it won't be destroyed until the end of the mission

#

you just needed a temp local variable

#

why waste memory and stuff?

meager epoch
#

ait, gotchu

little raptor
#

also your global variable was named badly

meager epoch
#

why

#

b(ackpack)Array blobdoggoshruggoogly

little raptor
#

global variables must always have tags. global variables without tags are typically those defined by the mission itself

meager epoch
#

oh

#

what kind of a tag

little raptor
#

TAG_myVar

meager epoch
#

does the number of letters in the tag matter?

crude vigil
#

usually the tag u define in cfgFunctions (or classname if not)

little raptor
#

tag is typically a short name for the mod itself

meager epoch
#

but im not making a mod

crude vigil
#

I knew it, leo strikes again.

#

Who would want a code like that in a mod, leo!? Oddly specific!

meager epoch
#

its a scenario im making and i needed that script within it

#

so...

#

no tag?

little raptor
#

well in that case it shouldn't have been global at all

#

but for your other variables I guess no

#

it's your call

meager epoch
#

alright

spiral sundial
#

Is there a way to remove the wheels / chassis of this IFA3 turreted 25mm so that I can put it on the back of the truck? I have seen others do it but I'm not sure how. I basically know little to nothing about scripting, aside from a few ones I use from time to time.
https://i.ibb.co/qjQFv4B/image.png

spiral sundial
#

uhhhh where do i find that

#

Is it the text underneath it?

#

Like LIB_61k

little raptor
spiral sundial
#

61-K, and underneath it it says LIB_61k

#

oh yea the class is the second one

little raptor
#

it's not part of IFA3?

spiral sundial
#

maybe it's GEIST-A3 then

#

extension to IFA3

little raptor
#

ok. well I don't have that one

little raptor
spiral sundial
#

It has one camouflage (Standard) and no components

little raptor
#

give it a name in editor like veh, then run this:

copyToClipboard str getObjectTextures veh
#

then paste here

spiral sundial
#

["ww2\assets_t\vehicles\staticweapons_t\if_61k\shassi_co.paa","ww2\assets_t\vehicles\staticweapons_t\if_61k\orudie_co.paa"]

little raptor
#

what happens if you do this?

{
    veh setObjectMaterial [_forEachIndex, "\a3\data_f\default.rvmat"];
} forEach getObjectMaterials veh;

{
    veh setObjectTexture [_forEachIndex, "#(rgb,8,8,3)color(0,0,0,0)"];
} forEach getObjectTextures veh;
kindred ocean
#

anyone know if it's possible to make a script that limits objects such as unlocking or locking in this case a gate. to UID/Unit as in restriction type of script..

little raptor
spiral sundial
#

the chassis

#

To only leave the turret on

little raptor
#

the chassis is the first texture

#

I'm not sure which material to use it with to make it invisible tho... thonk

#

maybe try:

veh setObjectMaterial [0, "\a3\data_f\default.rvmat"];
veh setObjectTexture [0, "\a3\data_f\default_co.paa"];
spiral sundial
#

Lol

#

It has a missing texture now

#

black and white squares

little raptor
#

oh right

#

to make it invisible you just remove it meowsweats

#
veh setObjectTexture [0, ""];
spiral sundial
#

This just brings back the original texture

#

that it usually has

little raptor
#

then use it together with the material:

veh setObjectMaterial [0, ""];
veh setObjectTexture [0, ""];
spiral sundial
#

It works

#

now I have a floating 25mm

#

There is just one slight issue

#

It's only the cannon

#

without the actual turret

#

I'm guessing that can't be changed unless I edit the mod itself?

little raptor
#

as far as I can see

#

just use attachTo

spiral sundial
#

No no

#

I meant that its missing only the wheels / chasiss

#

but it still has the seats and turret ring

#

which mine is only a floating cannon

#

Or for the Pak40

little raptor
#

if you just attach the turret like that you probably won't see the wheels

spiral sundial
#

I am very sure, because you can still see the wheels

#

they are very far apart and would go through the vehicle and show up outside

#

I tried mounting it before on a variety of trucks larger than the ones in the mod

#

and they still show

little raptor
#

well it's hard for me to tell what's going on without actually testing it in the game.

#

don't you have the composition?

spiral sundial
#

I don't yet

dawn walrus
#

I've got a little head scratcher that I hope that someone else a bit wiser with the editor/ sqf may shed some light on.

In my mission I ran last night for my group, I had several tasks set up using the task modules. These were tied with very simple triggers and task change state modules.

For example, one of the sub-tasks for the first objective was to rescue a hostage. This task had two outcomes, either the hostage is killed, and the task is set to fail, or he is rescued and once inside a trigger area at base, the task will succeed. The task itself was set to all playable units as the owner.

The failed state change trigger was:
Type none, activation none
condition: !alive hostage1

The success state change trigger was:
type none, activation Anybody present
condition: hostage1 in thisList

By all accounts, this should work fine, and did, sorta. When tested on our dedicated server, with only me on server, it worked fine. Killing the hostage would trigger the fail, and moving him into the area at base would trigger success. However, once in the live mission, with about 11 people total in server, neither worked. I had further triggers set up, that would look for trigger activation of the different tasks, and then assign further objectives after the first ones had been completed. Those also had the same issue, they worked with just me, but not with others.

I had several other tasks set up in this exact manner, all were working fine with just me on the server, but failed to fire when others were on. I have had mostly good track record with the task system on our server, so I am trying to figure out what went wrong with these so I can mitigate it happening again in the future. To me it sounds like ye old "locality" issue, but I am not really a coder and have had limited success with that in the past. After reading the BI wiki page on the tasks system, it makes it sound like the modules, when used are supposed to work fine mostly out of the box in either SP or MP.

willow hound
#

Are the triggers set to server only?

dawn walrus
#

No, so they should be firing for all players (right?)

winter rose
#

maybe only the server should set tasks, no?
IDk how modules work on that aspect.

foggy hedge
#

Can someone confirm that BIS_fnc_unitCaptureFiring works? getting no "starting recording" or "exported" hints when running it

#

Note, running just unitCapture and just using the firing data in unitPlayFiring works (i think i need to record at a higher fps, either that or its bugged with miniguns and stuff)

willow glade
#

@crude vigil We think my problem (the AI taking over when player DCs) is due to some dumb mod that returns true on that "handledisconnect" event handler

#

and I think our solution is to just clear all event handlers on our init. hasn't broken stuff so far

#

On another note, does anybody have advice on why we can't delete bodies via zeus? It seems our cleanup stuff isn't working at all.

My current thought is to do a CBA_fnc_waitAndExecute every X minutes and loop through all bodies and delete them via deleteVehicle (which seems to work)

#

and does that deleteVehicle only need to run on the server itself?

magic prairie
#

Hi, are there any sample resources for adding lights to the script?

young current
#

you mean the car script?

tough abyss
#

How would I got about having many objects on a map, and with an addaction it would only spawn a certain amount of random items

#

so if i have an EOD trianing area, i want to have an addaction that sets the range, which will grab like a few of the mines i placed down in editor and actually make them appear and the rest wouldnt show up

#

as in i've 30 mines, with trigger i want it to select 5/10 of them. and have it random every time.

#

i just dont know where to start with that

low sierra
#

I have an array with AI units objects pmiss2ActualAiUnits. I want to wait until less than 5 AI is left alive. What is the better code?

    waitUntil {
        {alive _x} count pmiss2ActualAiUnits < 5;
    };```or```sqf
    waitUntil {
        uiSleep 1;
        {alive _x} count pmiss2ActualAiUnits < 5;
    };```
#

In terms of not hurt performance. The array have 100 AI units objects.

willow hound
#

@low sierra Without sleep, waitUntil executes and evaluates the condition as often as it can, i.e. (usually) multiple times per second. That is not good in terms of performance. As such, it is a good idea to use sleep (if the use case allows it), and the longer the sleep duration, the better.

magic prairie
humble bough
#

Hi, i'm trying to create a camera on a specific player and stream it to the screen, if I do the following, the player can see their own camera feed on the screen but for other players it's blank

//spawn screen
pos = getPosATL player;
objectClassName = "Land_TripodScreen_01_large_black_F";
spawnPos = pos findEmptyPosition [2, 10, objectClassName];
bb = createVehicle [objectClassName, spawnPos, [], 0, "CAN_COLLIDE"];
bb setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(piprendertg,1)"];

//spawn cam on player
cam = "camera" camCreate [0,0,0];
cam cameraEffect ["external", "Back", "piprendertg"];
cam attachTo [player, [0,0,2]];
cam camSetFov 1;
private _nighttime = (sunOrMoon != 1);
if (_nighttime) then {"piprendertg" setPiPEffect [1];}else{"piprendertg" setPiPEffect [0];};```
I've tried the following and nothing happens at all, screen is blank
```sqf
//spawn screen
pos = getPosATL player;
objectClassName = "Land_TripodScreen_01_large_black_F";
spawnPos = pos findEmptyPosition [2, 10, objectClassName];
bb = createVehicle [objectClassName, spawnPos, [], 0, "CAN_COLLIDE"];
[bb,[0,"#(argb,512,512,1)r2t(piprendertg,1)"]] remoteExec ["setObjectTextureGlobal",0,true];

//spawn cam on player
cam = "camera" camCreate [0,0,0];
[cam,[0,"external", "Back", "piprendertg"]] remoteExec ["cameraEffect",0,true];
cam attachTo [player, [0,0,2]];
cam camSetFov 1;
private _nighttime = (sunOrMoon != 1);
if (_nighttime) then {"piprendertg" setPiPEffect [1];}else{"piprendertg" setPiPEffect [0];};```
willow hound
#

camCreate has local effect, so cam only exists on the machine that executes this code.

humble bough
#

That's correct, I only want the camera on 1 specific player but I want the feed from that camera to be streamed to the screen for all players to see

willow hound
#

For that you need to create and set up the camera on every client separately.
GS_fnc_createCamLocal:

params ["_targetPlayer"];
private _cam = "camera" camCreate [0, 0, 0];
_cam cameraEffect ["external", "Back", "piprendertg"];
_cam attachTo [_targetPlayer, [0, 0, 2]];
_cam camSetFov 1;
private _nighttime = sunOrMoon != 1;
if (_nighttime) then { "piprendertg" setPiPEffect [1]; } else { "piprendertg" setPiPEffect [0]; };
```Then you can do the rest:
```sqf
private _renderTarget = createVehicle [...];
_renderTarget setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(piprendertg,1)"];
[player] remoteExec ["GS_fnc_createCamLocal", 0];
crude vigil
humble bough
#

For that you need to create and set up the camera on every client separately.
Surely running it on all players would show each player their own feed only?

willow hound
#

That's what the _targetPlayer variable is there for.

humble bough
#

Thanks, so define the _targetPlayer in the original file where I spawned the camera on the player I want the feed from?

willow hound
#

Yes, like I showed in the bottom code block: [player] remoteExec ["GS_fnc_createCamLocal", 0];.

willow glade
#

(Which will only return true when last player disconnects)

heady quiver
#

Is it possible to force quiet communication voice lines?

#

'move 100 meters front' but silent call out

little raptor
heady quiver
#

I want him to talk but the quiet call outs

#

If you go to Stealth and then say move it will say it quietly but the next call out is loud again.

little raptor
humble bough
#

@willow hound
so, have compiled the fnc GS_fnc_createCamLocal in initPlayerLocal, then running this code ingame in console

pos = getPosATL player; 
objectClassName = "Land_TripodScreen_01_large_black_F"; 
spawnPos = pos findEmptyPosition [2, 10, objectClassName]; 
bb = createVehicle [objectClassName, spawnPos, [], 0, "CAN_COLLIDE"]; 
bb setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(piprendertg,1)"]; 
 
[player] remoteExec ["GS_fnc_createCamLocal", 0];

Screen spawns blank

cyan dust
#

Hello. We are using the command

_loaded = [player, [missionNamespace, "SavedInventory"]] call BIS_fnc_loadInventory;

And Biki says that it returns bool
https://community.bistudio.com/wiki/BIS_fnc_loadInventory
I guess it was supposed to be something like 'true if successful, false if not' when in reality it returns true on success and Nothing on failure (if said loadout was not saved beforehand, for example). My question is - will it ever return false? What's the condition for that?

little raptor
#

open the function in function viewer and read its contents

willow hound
humble bough
#

My code above?

narrow oxide
#

A general question if someone can help I m trying to get HC (headless client ) to work on my server with ravage but it just make the server lag a lot

humble bough
willow hound
narrow oxide
#

Sry

humble bough
#

Strange, it spawns the screen with the argb blank texture, then running the remoteExec command does nothing. I'm call compiling final the fnc in initPlayerLocal

willow hound
#

What does that code look like in initPlayerLocal.sqf?

humble bough
#
private["_code","_function","_file"];
{
    _code = "";
    _function = _x select 0;
    _file = _x select 1;
    _code = compileFinal (preprocessFileLineNumbers _file);
    missionNamespace setVariable [_function, _code];
}
forEach
[
    ["GS_fnc_createCamLocal","Custom\GS_fnc_createCamLocal.sqf"]
];```
#

Should the cmd when calling it be:-

[player] remoteExecCall ["GS_fnc_createCamLocal", 0];```
willow hound
humble bough
#

18:17:02 false

#

That's a bit of a strange way to do it
What way did you init the fnc on clients?

willow hound
humble bough
#

Then the issue is probably how i'm init'ing it on the clients?

willow hound
#

Well the function exists, so that's probably not the problem.

willow hound
humble bough
#

How are you init'ing the function on clients as that might be my issue?

meager epoch
#

how can i get the nearest backpack in front of the player and delete it afterwards?
tried this but it doesnt work:

bpack = nearestObject [player, "A3_Weapons_F_Ammoboxes"];
deleteVehicle bpack;
#

also tried without the a3_weps thingy, but it returns the player instead of whatever's near him

#

also tried putting the exact class name of the backpack instead of the a3_weps thingy, still nothing

humble bough
#

Nm, seen, you just defined it with GS_fnc_createCamLocal = {codehere};

little raptor
meager epoch
#

how can i find a container

little raptor
meager epoch
little raptor
meager epoch
#

right

humble bough
#

_pos = getPos player;

meager epoch
#

@little raptor how do i delete the backpack now meowsweats

#

tried some stuff, neither one of em worked

#

im stuck

#

need a hint

meager epoch
#

deleteVehicle backpacks?

#

yikes

little raptor
#

backpacks is an array

meager epoch
#

deleteVehicle backpacks select 0 :d

#

nearWeaponHolders? blobdoggoshruggoogly

little raptor
meager epoch
#

you're having fun, arent u

#

deleteVehicle backpacks (select 0);

little raptor
#

just look at the old messages

meager epoch
#

right, so uh

#

deleteVehicle (backpacks select 0);

little raptor
#

how do you even know it's your backpack?!

#

a weapon holder can hold multiple backpacks

meager epoch
#

its gonna be the only one on the ground blobdoggoshruggoogly

little raptor
#

how do you know it's the right weapon holder?

meager epoch
#

its the nearest one and the only one with a backpack blobdoggoshruggoogly

#

i hereby request a hint from ye ol mighty leopard20

little raptor
meager epoch
meager epoch
#

oh

little raptor
#

that's why I said use deleteVehicle

#

deleteVehicle can only delete objects

meager epoch
#

ye ik

little raptor
#

and deleting classnames makes no sense

meager epoch
#

right

#

and what exactly am i supposed to search for in the array

#

like, how do i search for an object

little raptor
#

in other words, typeOf

meager epoch
#

and uh, can i backpacks find "B_AssaultPack_cbr";

#

but wait, that doesnt actually do shit

noble tiger
#

so this error showed up today and i cant figure out what it is or where i came from. ..." { _defaultvalue = _valueInfo |#|param [0, false, [false]]; }; c...' file /x/cba/addons/settings/fnc_init.sqf..., line 94 error type string, expected Bool Any ideas, i cant find that .sqf in any of my addons

meager epoch
#

still tho, whenever i use that it returns -1. meaning that there is no such backpack in the array

#

and that's the backpack!

little raptor
#

you're searching for a string

meager epoch
#

how do i search for an object notlikemeowcry

#

typeOf returns B_AssaultPack_cbr

little raptor
#

settings/fnc_init.sqf

noble tiger
#

but what is throwing the error

copper raven
#

some setting that you are adding i assume

#

if not, then some addon that is

copper raven
noble tiger
#

i did not change any scripts or anything, just started today, only thing i can think of is maybe its something with my cba settings ive changed?

copper raven
#

maybe yes meowsweats

copper raven
steady matrix
#

Hey all - really trying to break into scripting, and I've been starting by observing some of Gemini's scripts from one of my favorite missions - OPEX - I'm currently looking at a script of his (fnc_sitOnChair.sqf) and ... I feel like I'm half-way there on understanding the context of it all - I think if I had someone walk me through it - it looks like the script passes variables to certain objects, but what I'm not sure about - where my disconnect is, is how the script determines what object is actually a chair, and what unit is actually trying to sit in said chair - I'm assuming this is a function called in a trigger some how - but I was wondering if someone would be interested in taking a look to help me understand what the code is doing, and how to call it on objects.

cosmic lichen
meager epoch
#

how can i get the index of an element in an array

little raptor
meager epoch
#

uh, maybe ๐Ÿ‘€

little raptor
#

the index of an element in array is already obvious meowsweats

little raptor
#

anyway, in a forEach loop it's _forEachIndex

meager epoch
#

@little raptor thonk

cb = count backpacks;
for "i" from 0 to cb do {
    if ((typeOf (backpacks select i)) == "B_AssautPack_cbr") then {
        deleteVehicle (backpacks select i);
    };
};
meager epoch
#

why is everything but forEach bad notlikemeow

little raptor
#

second of all, forEach is faster

#

third of all, forEach is shorter

meager epoch
#

right

#

does that at least get the job done? so i can try to rewrite it in forEach?

#

with, of course, the cb changed

meager epoch
#

ait, here goes nothing

little raptor
#

also I told you to stop using global variables

meager epoch
#

but im not working on a mod and u told me that i should use global in that case

#

at least thats how i understood it

little raptor
meager epoch
#

oh

#

ait

little raptor
#

you must always use local variables, unless you NEED global

meager epoch
#

alrighty

#

quick question tho:
why does this not delete the backpack?

nearWeaponHolders = nearestObjects [player, ["WeaponHolder", "WeaponHolderSimulated"], 10]; 
{ 
    backpacks = everyBackpack _x;
} forEach nearWeaponHolders;
deleteVehicle (backpacks select 0);
#

knowing that the backpack is at the first position in the array

little raptor
meager epoch
#

yes

little raptor
#

what did you test?

#

backpacks?

meager epoch
#

i slapped what i pasted above in the console thingy u get when u pres esc

#

so, i guess that's not how u delete objects from an array, yes?

little raptor
meager epoch
#

oh, i thought backpacks is an array

little raptor
#

try the correct code:

{
  {
    deleteVehicle _x;
  } forEach everyBackpack _x;
} forEach nearestObjects [player, ["WeaponHolder", "WeaponHolderSimulated"], 10]; 
little raptor
meager epoch
#

you just said its a container notlikemeowcry

little raptor
#

wat? the backpack is in a containter

#

backpacks is an array of backpack objects in the container

#

array is not a "game object"

meager epoch
#

oh ok

meager epoch
little raptor
#

oh wait nvm

meager epoch
#

the backpack's not on me

little raptor
#

looks like there's no command to remove a single backpack from a container

#

you can only delete all of them

#

then readd

meager epoch
#

we'll delete all blobdoggoshruggoogly

#

the chances of there being more than one backpack are very low anyway

#

more like non-exsistent

little raptor
meager epoch
#

how do u delete all :p

meager epoch
little raptor
#

no

meager epoch
#

how

meager epoch
# little raptor no

found a solution online and modified it a little. works!

{deleteVehicle _x} forEach nearestObjects [player, ["WeaponHolder", "WeaponHolderSimulated"], 5];
little raptor
meager epoch
#

but i dont need them, do i?

little raptor
#

ยฏ_(ใƒ„)_/ยฏ

meager epoch
#

it drops a backpack which i dont need, deletes the wep holder holding the backpack which i also dont need i guess

little raptor
meager epoch
#

that does it as well, thanks blobcloseenjoy

hushed tendon
#

There a way to teleport someone onto a ladder?

meager epoch
winter rose
meager epoch
meager epoch
little raptor
meager epoch
#

Yea, saw that as well but it doesnt work on vest

#

Just tried rn

little raptor
#

then just use your own deleteVehicle one

#

and delete the whole weapon holder

meager epoch
#

Ye i guess ill do that

meager epoch
#

@little raptor Just wanna let you know that clearItemCargo(Global) works with both uniforms and vests.

#

Might wanna edit the wiki if you have access or whatever

little raptor
#

and weapons?

meager epoch
#

will try now

meager epoch
#

clearmagazinecargo and clearweaponcargo removes them

little raptor
meager epoch
#

nope

#

uniforms, vests, glasses and stuff like gps', maps

#

binoculars dont get removed

little raptor
meager epoch
#

oh

meager epoch
little raptor
#

ok I think I got it. thanks

tough abyss
#

I'm designing a cqb area, and i want to have an addaction on an AI, which before entering the cqb town you can select the following, Spawn Targets, Clear Targets, Live Fire, Clear Hostiles. So I wanna have a lot of targets down, and when the spawn targets selection is chosen it will randomly choose half of the pre placed targets and only show them, i want it to be random on every click, then clearing it obviously would clear it. Then I want the same for live fire but with hostile AI

#

is that a thing that is possible, i did something similar with mines but is it possible with targets and AI?

tough abyss
#

How would I go about showing only half of what's down already

#

lets say i have 100 targets down, with variable names t1 through to t100, and on each selection of the addaction it will chose 50 from the t1-t100 and only show those, rest would be hidden. I'd want to do same with hostile AI.

#

im just not sure where to start

#

I have a set-up for mines, but it spawns them on markers, so would i do something similar with targets:

#

`fnc_spawnMines = {

private _markers = ["marker_0", "marker_1", "marker_2", "marker_3", "marker_4", "marker_5", "marker_6", "marker_7", "marker_8"];
private _mines = ["APERSMine_Range_Ammo", "APERSBoundingMine_Range_Ammo","ATMine_Range_Ammo","SLAMDirectionalMine_Wire_Ammo","APERSTripMine_Wire_Ammo"];
private _randomdistance = floor (random [2,4,6]);

{
minesarray pushback (createVehicle [

  selectRandom _mines,
  getMarkerPos _x,
  [],
  _randomdistance,
  "NONE"
]);

} foreach _markers;
};

fnc_removeMines = {

{if (!isNull _x) then {deleteVehicle _x}} forEach minesarray;

};`

#

that's what i have for mines.

#

so would i do something similar?

little raptor
tough abyss
#

ah the mines thing works that's all that i'd need anyway

#

but like idk where to start with objects that are pre-placed in the editor

little raptor
#

if you want to throw in 100 variables be my guest

tough abyss
#

well that was an example

#

probably would be around 30

little raptor
#

you can do what you want without any

tough abyss
#

How though?

cosmic lichen
#

!code @tough abyss

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
little raptor
tough abyss
#

see im like shit with scripting, so how would that work

#

cus the mine thing i found in a thread

somber radish
#

Sooo, I am trying to categorize the content of Config-file using script. It was quite easy with helmets and vests (Armor level).
But with weapons its a whole different story.
Anyone got a clue as to what would be a easy way to check wether or not a weapon has a GL attatchment?

#

(Automatic)

spark turret
#

And then shuffle the array, delete half of it, make the remaining stand up with animateSource ["terc",1]

tough abyss
#

so i'd have the targets elsewhere or would i pre-set them in buildigns?

spark turret
#

Preset in buildings is best

#

(Easiest)

tough abyss
#

so i'd have them in the buildings, then i'd give them all variable names?

spark turret
#

No. You place them and then add a marker area which overlaps the compelte playing field

#

Name the marker "playarea01".
Then in a script you can get all targets inside the marker

#
allObjects "target_base" select {_x inArea playarea01;};
#

Sth like that

tough abyss
#

so the marker would be named playarea01

spark turret
#

Baiscally:
-Get all targets on map
-sort out all that arent in the marker

#

Yes the marker is the area from where the targets are selected.

tough abyss
#

so my marker names are GK_ipsc_std.

So i'd be doing

allObjects "GK_ipsc_std" select {-

#

oop

#

but copy what u said at the end

#

allObjects "GK_ipsc_std" select {_x inArea playarea01;};

spark turret
#

Like "get me all goats in the town".
But instead its "get me all targets in this marker"

#

No, look up the allObjects command. It takes a class name/inheritance name

spark turret
#

Also look up inArea command

tough abyss
#

yeah the GK_ipsc_std is the class name

#

so in a config that just calls for those targets then

somber radish
spark sun
#

Strange in return item category I see GrenadeLauncher

little raptor
#

not the weapon itself

somber radish
#

theere we gooo!!!

#

Nice

somber radish
warm coral
#

alright real quick, do any of you smart cookies know how i can remove nvg's for all my players once a trigger is activated?

crude vigil
# warm coral alright real quick, do any of you smart cookies know how i can remove nvg's for ...
finddisplay 46 displayAddEventHandler ["KeyDown", {
  if (_this select 1 in actionKeys "nightVision") then {
    systemChat str "You cant use NVG, it is disabled!";
    true;
  };
}];

You asked for disabling first instead of removing in #arma3_scenario , this disables it, has to run by each player. NVG will still work if there is any other way such as ACE interaction etc (Not sure if there is at all tho). This just disables keyboard input.

warm coral
#

you got one for removing nvg? the thing im trying to do is a blackout/emp so they dont have a choice if they loose it or not

bitter jewel
#
{ if ( isPlayer _x ) then { _x unassignItem (hmd _x) } } forEach allUnits; 
warm coral
#

thank you very much

past wagon
bitter jewel
#

i didnt know that

#

ty

past wagon
#

np

crude vigil
#

I think you meant unlinkItem

bitter jewel
#

yes