#arma3_scripting
1 messages ยท Page 711 of 1
ok i am home. did you get your answer yet
nope
no sir
ok so you want to know how to do a random equipment script with stuff of your choosing?
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
i'll just grab some example class names
you know how to define functions in a config right?
i do not, @tough abyss might
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
I literally gave u the command for it 
https://community.bohemia.net/wiki/lockInventory
Witzy said that the command makes the contents inside thr box unviewable 
Even tho nothing stops me from trying 
Oh so you want to be able to show an empty inventory.
No
I want to be able to see what's inside the box, but to not be able to take stuff out of it.
mfw 3cb factions only has faction classnames and not weapon classnames on the 3cb website
It consists of **emptying **the box so that the player won't be able to **see **stuff
Am I missing something?
gimme a sec sry
No, i just gave up on what i wanted and went with another easier, but dumber solution
aaand that result is .... the same as lockInventory which comes to my point? :o
this
If nothing works, then ill go with lockInv
yeah I understood but what Im saying u didnt really need to empty the container
time to learn how to go through configs... or just use ace arsenal, select something, and hit ctl c
Ye ik lol
ok , we talking for no reason then, enjoy my 3 solutions if you ll go for em!
or another which u find :o
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
ok so put them into variables like my post making sure that each class is a string "classname"
shit my bad
will do
i just copied class names i forgot to make them strings
i guess work today made my brain die
would that go kinda like this?
class UK3CB_M16A2```
no "UK3CB_M16A2"
oh im dumb
private _weapons = [
"UK3CB_M16A2",
"weaponclass2"
];
alright that makes sense now
do i need to format as such [["rhs_weap_akm", "rhs_30Rnd_762x39mm"],["rhs_weap_ak74n", "rhs_30Rnd_545x39_7N6M_AK"]];
["UK3CB_M16A2", "rhs_mag_30Rnd_556x45_M855A1_Stanag"]
["rhs_weap_akm", "rhs_30Rnd_762x39mm"],
["rhs_weap_ak74n", "rhs_30Rnd_545x39_7N6M_AK"]
];
so either you can do just a array of weapons, or an array of arrays containing weapons and mags
correct
๐
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)
let me know when you have the rest of the variables created with your uniforms and stuff
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
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
oh, and be careful of ending commas!
some of your variables have an extra comma
oops thanks for catching that
would removeAll work?
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;```
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
im not sure then, sorry for being mega noob
just instead of this do _unit
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?
_unit forceAddUniform "";
_unit addVest "";
_unit addHeadgear"";
what did we just say...
im sorry i have no idea what im doing
i just looked at the add containers line from a loadout script
we just had a conversation about this
so how we gonna get a random class from the variable? selectRandom
alright, i am slightly familiar with selectRandom
private _gunInfo = selectRandom _gunArray;```
this was something a friend of mine tried but it did not work
sure it would work. it would just return an array with 3 indexes since thats what you gave
i should mention we tested it in VA and eden editor but didn't get it to work out
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
i see
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
ok
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
just a little yeah
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???
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
};
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
yeah ik no worries
and in your application, you want randomness, so no, you would make your own dedicated _handgun variable
so follow suit with what ive shown so far and lets see what you get in the end.
["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];
};```
ok so what else do we want to add? you do your helmets? face gear? inventory items?
you don't need to use apply for a single command such as addHeadgear
also its starting to get long, start using sqfbin.com
so i had
_unit addVest "";
_unit addHeadgear""``` earlier - what do i put in between the ""
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?
"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?
Give me a sec, family came home
no worries
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
incorrect order. notice you add helmets then remove them later currently
fixed
_unit forceAddUniform "";
_unit addVest "";
_unit addHeadgear""
this does nothing
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
unless server owns all the _units, you have plenty of locality issues in that code
the apply stuff is nonsense
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.
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?
_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)
How do I check if a param is null or set the default? Uh...asking for a friend.
Asking that if it is null, assign something?
It selects the element (index 0 (which is the first element) and 1 (second one)) of the array _weapon
Yeah...
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" ?
Anyone know how to check if a drone has its laser on?
isLaserOn darterDrone always returns false ๐ข
laserTarget?
a number cannot be null.
Maybe you meant isNil?
Nah laserTarget always returns objNull
Rly?
even when I aim the laser at an object
Fix it ๐
Does work for me
may depend on the drone model
#DedmenWhatDidYouJustBroke
Using a darter drone
wait


๐
ok, now onto lazors
but isLaserOn is arg local so I'll probably need to use laserTarget :wob:
๐ค
yes. gud
Target Acquired
Boom boom
52 lasers. My fps goes from 36 down to 34
So... working on a visible laser?
drawLaser๐

All
Makes sense
when even a bi dev cant get rid of the dlc watermark, this is truly arma 3
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...
What part do you need help with?
goal being, group should patrol waypoints A-B-C-A...
the waypoints are not working, I get that error. what does it even mean?
It means you have to place some move waypoints first
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
Arma 2.06 isn't even released yet and work on 2.08 has already begun.
Featuring Scripted Lasers pew pew.
Documentation:
https://t.co/bOTbaGgv0c
Images:
https://t.co/8nIlMkMZe0
Example:
https://t.co/elCkpbBqZW
Coming to Dev-Branch soon (maybe next week).
Don't forget your๐
hmm okay; where is the documentation on this?
ยฏ\_(ใ)_/ยฏ
not helpful; for waypoints? never mind each of the types.
very helpful: there is a search bar, use it.
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);
yeah err
do you mean have a reference to the object itself? you cannot
what i want to do is have the weapon the player drops on the ground be attached to the back instead
You can't get the weapon object
with all the attachments and stuff
ah then it's the ground weapon holder you want
so uh, whats that
a virtual crate
where can i get information about that
google 
right lol
"GroundWeaponHolder" is the class I think, try nearestObjects
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
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
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.
okay dokay, thanks
why does adding attachments (via the attributes) on a weapon put on the ground makes it invisible
cuz magic Arma ๐
any way around this
I've done it before. It doesn't disappear
you're probably doing it wrong
it always disappears for me 
i put a weapon on the ground from the props, right click > attributes > equipment >> add stuff from there
Oh by via the attributes you mean Eden?
yep
yeah never done that one 
welp
time for addWeaponWithAttachmentsCargo I guess
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
how can i put it on the ground lol? it literally says that its for putting the weapon inside a container and such
create a ground weapon holder by any means, assign a variable to it, then use addWeaponWithAttachmentsCargo like Lou said
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
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.
It does
AI can't snap out of doStop by themselves
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];
even with WP? waypoints are being set after doStop I think.
ah okay I think I see; so would need something like units _group doFollow leader _group
great that works, thanks!
yes, because the class you have is a CfgVehicles class
so how do i change the class
see CfgWeapons for most of them all you need to do is just remove the Weapon, Item, Vest prefixes etc.
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 [...];
hmm?
try backpackContainer player addWeapon...
i want to add a weapon with an attachment to the player's backpack, how can i?
alright
thanks
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
use syntax highlighting plz
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
anyway, the problem is that there is no default value for dist
the author is only checking a limited range of config classes
is it possible to make the player deaf by script
you can mute the game sounds
see:
fadeEnvironment
fadeMusic
fadeRadio
fadeSound
fadeSpeech
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 ... ?
ok thanks I'll try it now
thanks
is it possible to deny the player from editing their inventory, or even prevent them from opening it?
i suppose i would then immediately close the inventory?
oh i am to prevent the inventory from even opening with returning true
seams fixed @little raptor thanks for the quick help ๐
this works thanks
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?
however, what is the relevance of selectionsNamesArray?
which selection the hitpoint belongs to
so for purposes of damaging, we can probably ignore that element?
or can entire selections be damaged?
afaik entire selection will be damaged
if you mean setHit, yes
hmm okay, re: both questions, so we can specify selections? as well as specific hit points?
actually looks like I was wrong
the command takes selection names
so the hitPointNames thing is not needed
oh okay I see. difference between set/getHit and set/getHitPointDamage. okay, thanks...
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?
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?
Ideally the wreck would bounce off, but I can live without it
Should it work for every plane, even empty ones, or should only planes of a given side explode?
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
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
Q: re: waypoints, if I arranged a WP targeting a specific OBJECT, if the object is deleted, does that corrupt the WP?
How fast are you?
It dynamically tracks the position of an object which is like moving and sets the destination to that?
Hi, is there any way to programmatically enable/disable some MP mission slots based on the number of players connected?
Is there any event handler for changing firing mode (e.g. semi to auto)?
I think you can build one using waitUntil and fetching data with e.g. getArray (configFile >> "CfgWeapons" >> currentWeapon player >> "modes")
Alright, thank you!
You want to prevent jip or..?
no
you can use a loop. the problem with triggers is that once it's activated by one object, it won't be activated by the next object. you can use the loop inside the trigger too, but that's nonsense since the trigger is a loop itself
your condition was wrong
By testing it with a trigger at the center of a runway and taxing straight into the area, my plane did explode though
and your activation statement
It never fires even once though
Unless any object triggers it, but the effect only gets applied to specific groups
like I said just use a loop
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.
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
how do you spawn it?
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
what is your problem?
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.
rocket = "gm_rocket_luna_nuc_3r10" createVehicle ((getPos bruh) vectorAdd [0,0,10]);
rocket setDamage 1```
oh cool discord has sqf highlighting
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?
Does it even create the rocket as expected?
I believe you have to create the warhead for explosion:
gm_rocket_luna_nuc_3r10_warhead
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
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.
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
so the only way to possibly do it would be with the normal createvehicle but setting the pos to a random seed?
no, it would be to use createVehicleLocal
(or agent if the AI is not needed)
the only issue being that this unit may be temporarily visible by everyone for a glimpse
with createVehicleLocal, do animations even work btw?
I think so yes
this is not an issue, if it is an issue, spawn it somewhere else, waitUntil hidden, then teleport
tru tru
no
createVehicleLocal wont work with MP (unless you turn off the security)
that does not really answer that question? :o
not turning off security for something there is a work around for 
good idea, cheers ๐
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?
Yes
im looking at just the fired event atm
yeah so i'd get the projectile, and then somehow detect when it dies?
oh ok
can i put a EH on the projectile i get from that EH?
I got one script I use to make a mini nuke launcher
or is there a function for this or something
If u want Ill put it on here and u can extract what u need
yes pls
no
sadly projectiles don't support EHs
yes
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
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));
ooh
then u could use ```sqf
(player) Distance2d (_Impactpos)
To measure the distance
You would have to spawn this script as the Waituntil command does not work in a unscheduled enviroment
im just in editor using debug console, for context, im trying to fix the ranging on a GL scope
AH
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?

no 
dude sqf is so confusing
No need for that array o.O
private _firstPos = getPosASL _projectile;
private _lastPos = getPosASL _projectile;
while {alive _projectile} do { _lastPos = getPosASL _projectile; };
systemChat format ["Distance: %1", _firstPos distance _lastPos];

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
Still needs to be spawned though because of while ๐
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
spawn inside the EH
does spawn block?
or is that the whole reason for needing spawn
because you're not allowed to block
call waits for the called code to finish, spawn does not wait for the spawned code to finish.
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
You could, but not in an EH.
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];
};
}];
is param the same as array accessing _this?
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.
i see 
that saves having to write out all of them
"distance 188" yay!
many thanks ansin
https://community.bistudio.com/wiki/params
When used without argument, as shown in main syntax, internal variable _this, which is usually available inside functions and event handlers, is used as argument.
Sure, you could pass all the parameters from the EH into the spawn, but what for if you don't use them ๐
although waypoints _grp indicates there are 5 WP
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.
I ve never seen cycle waypoint being used with other than move waypoints. Cycle waypoint is not a waypoint to move on, it is a waypoint that connects ending waypoint to initial waypoint.
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?
debug waypoint positions, types, and ensure that they're setup the way you want
i don't know your exact implementation, never had issues with cycle waypoint 
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.
Anyone know of a method of getting the armor level of vests / helmets?
config
i don't think order matters, but how do you create them?
first 4, then a 5th one being the cycle one?
So how would I query that ingame?
([configFile >> "CfgWeapons" >> (HeadGear _Man)] call BIS_fnc_displayName);
```Something like this???
// 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.
why use the function?
@somber radish use getText, and navigate one more time, to displayName
getText (configFile >> "CfgVehicles" >> (HeadGear _Man))
?
honestly no idea, maybe you should try printing currentWaypoint on each frame, and see what you get there
you did the first part, but not the second
I can try it, but that's going to tell me what my eyes already see. CDCDCDC... in perpetuity. never cycling back to A or B.
do you have an example perhaps?
Could u show me?
pls
๐
https://community.bistudio.com/wiki/currentWaypoint and store the group into global variable, then https://community.bistudio.com/wiki/onEachFrame
"displayName"
again, that's going to tell me what I already know. tell me about how you setup a cycle.
ABCDCDCDCDCD...
unless like I said there is a way to set the next WP, i.e. when triggering on the current one.
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
I am watching the units march back and forth in Zeus, and I have a record of the target objects.
they are.
kindly how do you setup a circuit that visits ALL of the WPs?
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
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?
try creating the cycle waypoint at the position of the first one
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?
just the position/object of what the initial waypoint had
([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")
why did you readd the brackets? 
anyway, glad you got it working
it looks cooler
Yup, it looks cooler
I think that was it @copper raven , closed the circuit 'properly' and it looks like they are completing full circuits.
thnx btw
anyone know how to make a custom sound module
No crossposting #rules , pick one, stick one
my b just didn't know which one it fell under
as in, a module that just plays a sound when activated?
why would you want to though? its much easier to play a sound on command with a single line command
I figured out how to do it through zeus via the play sound module
pick one, stick one
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];```
yes why not?
im getting the hang of it lol
Does anyone know if its possible to assign respawn tickets per person rather than a pool of them? If yes any pointers
@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?
Yes you just change the target of the function
You can do sides, groups, units, etc.
Take a look at the syntax of
Thanks bud
keep in mind locality or you may accidentally add way more tickets than you want when people join
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.
look in the config of the vehicle, there may be a config entry named "animationSource" that the vanilla armors have. For example, hideTurret on vanilla vehicles make them into cool looking apcs. then you just animate that source
its iffy if modded people put them in though
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.
make a composition
and use the perf branch to be able to use it in Zeus
What's the difference between the animChanged and animStateChanged EHs?
animChanged only triggers when the target animation state changes
animStateChanged triggers every time the animation state changes
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
animStateChanged is
Cool, thanks
Will play with them
has anyone ever noticed the description of the chanel?
IF (script == true) THEN {chat here};

Yes ๐
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?
Disable his damage and enable it back a couple of seconds after? idk
Yea was thinking that too, but bit weird tho
afaik the vanilla eject function disables the damage while the pilot is still in the seat
{ _x action ['Eject', _startingPlane]; } forEach allPlayers;
This is what i use at
m
just use the eject function
I think it's this:
https://community.bistudio.com/wiki/BIS_fnc_planeEjection
the wiki description seems incomplete so just read the function yourself in function viewer
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;
};
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
what exactly do u mean by this, i dont quite understand (the select and addItemToBackpack part)
player addItemToBackpack (bArray select 0);
o ait
so what do you plan to do now?!
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;
};
afaik its all references to constant index?
how about now?

oh no
I'm afraid your brain has been overwhelmed by learning too much! ๐คฃ
i knew about it, i just didnt think of it 
then I was right! ๐
this one's better: 
yea im there as we speak, just a little lost
forEach already iterates thru the array
bArray = backpackItems player;
player addBackpack "B_AssaultPack_khk";
{ player addItemToBackpack (select _x); } forEach bArray;
D:
this is worse than my first attempt isnt it
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
so, just additemtobackpack _x?
yes
right
also why do you use a global variable?
add an "_" in front of bArray?
yes 
rest?! it's only 3 lines! ๐
doesnt that get the job done!? 
it does
oh great
so
final
_bArray = backpackItems player;
player addBackpack "B_AssaultPack_khk";
{ player addItemToBackpack _x; } forEach _bArray;
ye
also why is this bad
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?
ait, gotchu
also your global variable was named badly
global variables must always have tags. global variables without tags are typically those defined by the mission itself
TAG_myVar
does the number of letters in the tag matter?
usually the tag u define in cfgFunctions (or classname if not)
tag is typically a short name for the mod itself
but im not making a mod
I knew it, leo strikes again.
Who would want a code like that in a mod, leo!? Oddly specific!
well in that case it shouldn't have been global at all
but for your other variables I guess no
it's your call
alright
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
gimme its class name
right click on it, then select find in asset browser
it's not part of IFA3?
ok. well I don't have that one
I'm not gonna subscribe to it now. just rick click on it and select Edit Appearance. then tell me if it has components or camoflages
It has one camouflage (Standard) and no components
give it a name in editor like veh, then run this:
copyToClipboard str getObjectTextures veh
then paste here
["ww2\assets_t\vehicles\staticweapons_t\if_61k\shassi_co.paa","ww2\assets_t\vehicles\staticweapons_t\if_61k\orudie_co.paa"]
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;
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..
it turns it black
you wanted to remove the wheel right?
the chassis is the first texture
I'm not sure which material to use it with to make it invisible tho... 
maybe try:
veh setObjectMaterial [0, "\a3\data_f\default.rvmat"];
veh setObjectTexture [0, "\a3\data_f\default_co.paa"];
then use it together with the material:
veh setObjectMaterial [0, ""];
veh setObjectTexture [0, ""];
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?
As you can see in the original composition I reffered too, they kept strictly the turreted 25mm somehow
https://i.ibb.co/yNVC7GS/image.png
it's attached
as far as I can see
just use attachTo
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
he removed only the "legs" of the gun so that it still has some type of support and a shield
https://steamuserimages-a.akamaihd.net/ugc/1768205841127053001/7A09D63A1C2E56DB40AE4D9661A81720DB9A6BD5/?imw=5000&imh=5000&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false
are you sure that the wheels are even "removed"?
if you just attach the turret like that you probably won't see the wheels
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
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?
I don't yet
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.
Are the triggers set to server only?
No, so they should be firing for all players (right?)
maybe only the server should set tasks, no?
IDk how modules work on that aspect.
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)
@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?
Hi, are there any sample resources for adding lights to the script?
you mean the car script?
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
DISREGARD - FOUND SOLUTION
https://forums.bohemia.net/forums/topic/212567-randomized-mine-spawner/
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.
@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.
yes, a light system that the player can turn on and off at will
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];};```
camCreate has local effect, so cam only exists on the machine that executes this code.
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
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];
That is why one should always know what sort of mods they are using to the full extent.
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?
That's what the _targetPlayer variable is there for.
Thanks, so define the _targetPlayer in the original file where I spawned the camera on the player I want the feed from?
Yes, like I showed in the bottom code block: [player] remoteExec ["GS_fnc_createCamLocal", 0];.
It was weird. When I put it in our init.sqf, it still had the problem. Im not sure if it fired too soon or not. Might need to put it in a wait and exec, and have the one chunk of code that used the EH run after that
(Which will only return true when last player disconnects)
Is it possible to force quiet communication voice lines?
'move 100 meters front' but silent call out
maybe try NoVoice speaker
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.
next call out is loud again
I have no idea what you mean
@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
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?
ยฏ_(ใ)_/ยฏ
open the function in function viewer and read its contents
I just tested it (in singleplayer and hosted server multiplayer) and it worked.
My code above?
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
#headless_client @narrow oxide
Yes ๐
Sry
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
What does that code look like in initPlayerLocal.sqf?
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];```
That's a bit of a strange way to do it, but anyways: What does isNil "GS_fnc_createCamLocal" return in the Debug Console?
18:17:02 false
That's a bit of a strange way to do it
What way did you init the fnc on clients?
The only difference between remoteExec and remoteExecCall is that remoteExecCall executes the code in the unscheduled environment (suspension not allowed), while remoteExec is like spawn.
Then the issue is probably how i'm init'ing it on the clients?
Well the function exists, so that's probably not the problem.
The I-just-placed-down-a-single-unit-in-the-Editor-to-test-this-real-quick way: I executed GS_fnc_createCamLocal = {...}; in the Debug Console.
How are you init'ing the function on clients as that might be my issue?
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
Nm, seen, you just defined it with GS_fnc_createCamLocal = {codehere};
the backpack is inside a container. you have to find the container first
how can i find a container
_nearWeaponHolders = nearestObjects [_pos, ["WeaponHolder", "WeaponHolderSimulated"], 10];
{
_backpacks = everyBackpack _x;
} forEach _nearWeaponHolders;
Error: 0 elements provided, 3 expected
_pos
right
_pos = getPos player;
@little raptor how do i delete the backpack now 
tried some stuff, neither one of em worked
im stuck
need a hint
deleteVehicle doesn't work?
backpacks is an array
I already told you about select
just look at the old messages
this
how do you even know it's your backpack?!
a weapon holder can hold multiple backpacks
its gonna be the only one on the ground 
how do you know it's the right weapon holder?
its the nearest one and the only one with a backpack 
i hereby request a hint from ye ol mighty leopard20
just loop thru the backpacks and find the first one that matches the backpack type you want
what exactly does the array store? the class names of the backpacks?
objects
oh
ye ik
and deleting classnames makes no sense
right
and what exactly am i supposed to search for in the array
like, how do i search for an object
like I said:
find the first one that matches the backpack type you want
in other words, typeOf
and uh, can i backpacks find "B_AssaultPack_cbr";
but wait, that doesnt actually do shit
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
still tho, whenever i use that it returns -1. meaning that there is no such backpack in the array
and that's the backpack!
again, backpacks is an array of objects
you're searching for a string
i cant find that .sqf in any of my addons
it's clearly part of CBA
settings/fnc_init.sqf
but what is throwing the error
do you call addSetting anywhere?
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?
maybe yes 
it would be some sort of checkbox setting you have
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.
You also might wanna read https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
how can i get the index of an element in an array
do you mean in forEach?
uh, maybe ๐
the index of an element in array is already obvious 
anyway, in a forEach loop it's _forEachIndex
@little raptor 
cb = count backpacks;
for "i" from 0 to cb do {
if ((typeOf (backpacks select i)) == "B_AssautPack_cbr") then {
deleteVehicle (backpacks select i);
};
};
use forEach 
why is everything but forEach bad 
first of all, the loop you wrote moves past the end index by one
second of all, forEach is faster
third of all, forEach is shorter
right
does that at least get the job done? so i can try to rewrite it in forEach?
with, of course, the cb changed
I guess
ait, here goes nothing
also I told you to stop using global variables
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

I said using TAGs is optional when it's not a mod
you must always use local variables, unless you NEED global
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
apart from that code being wrong, how do you know? did you test?
yes
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?
u delete objects from an array
what does it have to do with arrays?
if it doesn't work then maybe that's not how u delete objects from containers
oh, i thought backpacks is an array
try the correct code:
{
{
deleteVehicle _x;
} forEach everyBackpack _x;
} forEach nearestObjects [player, ["WeaponHolder", "WeaponHolderSimulated"], 10];
backpacks is an array
you just said its a container 
wat? the backpack is in a containter
backpacks is an array of backpack objects in the container
array is not a "game object"
oh ok
this doesnt delete the backpack as well D:
oh wait nvm
the backpack's not on me
looks like there's no command to remove a single backpack from a container
you can only delete all of them
then readd
we'll delete all 
the chances of there being more than one backpack are very low anyway
more like non-exsistent
then just delete all
how do u delete all :p
Just replace deleteVehicle _x with clearBackpackCargoGlobal _x?
Cause if yes, then it doesn't work.
no
how
found a solution online and modified it a little. works!
{deleteVehicle _x} forEach nearestObjects [player, ["WeaponHolder", "WeaponHolderSimulated"], 5];
you're deleting the weapon holders
just use this like I said
but i dont need them, do i?
ยฏ_(ใ)_/ยฏ
it drops a backpack which i dont need, deletes the wep holder holding the backpack which i also dont need i guess
{clearBackpackCargoGlobal _x} forEach nearestObjects [player, ["WeaponHolder", "WeaponHolderSimulated"], 5];
that does it as well, thanks 
There a way to teleport someone onto a ladder?
now, i need the same done for a vest but i dont see a clearVestCargoGlobal. help 
yes, with action
nvm, this apparently removes vests as well. once again, thanks
nvm, it doesnt... i still need help 
it should remove vests, uniforms and backpacks
Ye i guess ill do that
@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
does it also remove the magazines?
and weapons?
will try now
what about backpacks?
nope
uniforms, vests, glasses and stuff like gps', maps
binoculars dont get removed
binoculars are weapons
oh
headgear as well
ok I think I got it. thanks
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?
yes it is possible
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?
you've over complicated things
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
if you want to throw in 100 variables be my guest
you can do what you want without any
How though?
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
with a for loop
see im like shit with scripting, so how would that work
cus the mine thing i found in a thread
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)
You can make your life easier by getting the list of targets from an area, like a marker or trigger.
Select all objects in it that are targets.
And then shuffle the array, delete half of it, make the remaining stand up with animateSource ["terc",1]
so i'd have the targets elsewhere or would i pre-set them in buildigns?
so i'd have them in the buildings, then i'd give them all variable names?
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
so the marker would be named playarea01
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.
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;};
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
Also look up inArea command
yeah the GK_ipsc_std is the class name
so in a config that just calls for those targets then
Thank u! good clue. However it does not differentiate between rifles with and without Grenade_Launchers
Strange in return item category I see GrenadeLauncher
you must check the muzzles
not the weapon itself
I checked this:
"arifle_AK12_GL_F"
It returned this
["Weapon","AssaultRifle"]
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?
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.
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
{ if ( isPlayer _x ) then { _x unassignItem (hmd _x) } } forEach allUnits;
thank you very much
forget the isPlayer _x and just use allPlayers
np
Errr, unassignItem moves item to inventory though.
I think you meant unlinkItem
yes

