#arma3_scripting
1 messages ยท Page 741 of 1
i do not speak much code yet
ok
thx
_x = (vehicle mjkgrp_eye); hint str _x;
shoud be so simple lol
well i can't find the solution XD
can you post the output of units _group? wondering what units are in the group
ok
[B Eye:1,B Eye:2]
_x = units mjkgrp_eye; copyToClipboard str _x;
@brazen lagoon ๐
vehicle doesn't take groups
only units (objects)
can you do (units _group) apply {vehicle _x}?
Hi, can anyone help me abit with this code block, I am trying to make a launch bay with runway lights that slowly enable simulation using a script loop
this addAction ["<t color='#FF0000'>LAUNCH</t>",
{
params ["_target", "_caller", "_actionId", "_arguments"];
launchbay1LRL_1 enableSimulation true;
launchbay1RRL_1 enableSimulation true;
sleep 0.1;
sleep 5;
for "_i" from 1 to 30 do {
_target setvelocitymodelspace [0,(_i * 6),0];
sleep 0.3;
};
_target removeAction _actionId;
}
];
Does anyone know how to make it so that the launchbay1LRL_1 has a +1 after every loop for 30 times?
for "_i" from 1 to 30 do {
launchbay1LRL_(_i+1) enableSimulation true;
launchbay1RRL_(_i+1) enableSimulation true;
sleep 0.1;
};
I tried to do that but the syntax wont allow it. Sorry I am not very familiar with programming
how do i adress all units from a array of groups?
if nothing else cant you do a forEach loop inside a forEach loop like
{{_x enableSimulation true} forEach units _x} forEach _groups;
someone correct me if this isnt something you can do
alternatively my small brain method of getting all the units in to an array would probably be
_allGroupUnits = [];
{_allGroupUnits append units _x} forEach _groups;
The first script does not allow suspenstion (sleep, uisleep, waitUntil), so spawn it:
this addAction ["<t color='#FF0000'>LAUNCH</t>",
{
_this spawn {
params ["_target", "_caller", "_actionId", "_arguments"];
launchbay1LRL_1 enableSimulation true;
launchbay1RRL_1 enableSimulation true;
sleep 0.1;
sleep 5;
for "_i" from 1 to 30 do {
_target setVelocityModelSpace [0,(_i * 6),0];
sleep 0.3;
};
_target removeAction _actionId;
};
}];
All global variables are stored in missionnamespace from where you can get any variable with getVariable:
for "_i" from 1 to 30 do {
private _bay = missionNamespace getVariable [format ["launchbay1LRL_%1", _i], objNull];
_bay enableSimulation true;
_bay enableSimulation true;
sleep 0.1;
};
it does
addAction code is scheduled
Does anyone know where can I find the script that can trace my kill count in operations?
there is no such thing, it is engine-side only
you can just play your scenario in multiplayer, and you'll see the scoreboard by default
yeah i am just stupid
good. problem solved then
Is there an option to make a hint with an image without text?
I tried it with composeText, formatText and parseText. If there isnt any character, then it wont show the hint. If i add a character like H, then the hint shows up with H and the image
Here are some of my Code Examples:
hint parseText format ["<img image=""%1""/>",_icon]; //no hint at all
hint composeText ["Text",image "data\admission_tickets.paa"]; //works like this: Text|Icon
hint composeText ["",image "data\admission_tickets.paa"]; //no hint at all
hint composeText [image "data\admission_tickets.paa"]; //also no hint at all```
I also tried a lot of more variations, but i dont get it to work.
I am having a problem when i try to open my dialog it says reousre MyDialog.hpp not found
Here is my Dialog: https://pastebin.com/PArvYBSR
In my description .ext i have #include "MyDialog.hpp"
here is how my files are setup
the resource is MyDialog with no .hpp so make sure you're not trying to do createDialog "MyDialog.hpp"
and does it still say the same error?
yep
Look in config viewer to see if MyDialog actually made it into the game
Hi all!
I'm trying to make AI shoot at APC with small arms. To achieve that, I have spawned a bunch of invisible targets on top of APC.
Question: When I look at the invisible target, the green text "Invisible Target Soldier" appears. How do I make this green text go away? Or can I replace it with an empty string?
It's the kind of text that usually says "Rifleman", "Officer" etc
Ok I think I found a way to do this, though it's kinda sketchy. Basically the target has to be in a different team than the player, i.e. if the player is opfor, the target should be independent. Then blufor will still shoot at the target (given that they're hostile to independent) but green text won't appear
Hi, is there any way to convert a String to an Object? I have a few Objects with a certain naming Pattern like "Rock_0", "Rock_1", "Rock_2" and so on which im just putting in an Array with a for loop, now i want to get the Position (with getPosASL) of it and since the Array is full of Strings, it gives me a Type error because it expects a Object but gets a String (As Expected) is there any way to convert them?
A temporary solution would be to put all the Object Names into the Array without the quotes, but that would kinda be a pain and would require me to manually add and remove them when needed. For example when new Spawns get added/removed
Example code:
_ObjectNames = [];
_Spawns = [];
_TotalObjects = 10;
//Getting the
for "_i" from 0 to _TotalObjects do
{
_ObjectNames Set [_i, format["Object_%1", _i]]; //Adds all Object names to the Array. Returns the Object names as Strings to the Array
};
//Getting Spawns from Object
for "_i" from 0 to _TotalObjects do
{
_Spawns set [_i, getPosATL (_ObjectNames select _i)]; //ObjectNames returns a String, getPosATL Expect an Object.
};```
try using setVariable getVariable in the first for loop
_ObjectNames Set [_i, missionNamespace getVariable (format["Object_%1", _i])];
or something like that
that will turn your array _ObjectNames from an array of string to an array of objects so it would make sense to rename it to just _Objects
Yeah, thanks alot! That worked 
someone able to help me why does my dialog not come up in game when i press shift F1
waitUntil {!isNull(findDisplay 46)};
(findDisplay 46) displaySetEventHandler ["KeyDown","_this call keyspressed"];
keyspressed = {
_keyDik = _this select 1;
_shift =_this select 2;
_ctrl = _this select 3;
_alt = _this select 4;
_handled = false;
switch (_this select 1) do {
case 59: {//F1 key
if (_shift) then {
execVM "MyDialog";
};
if (_ctrl) then {
execVM "YOURSCRIPT";
};
};
case 22: {//U key
if (_shift) then {
execVM "YOURSCRIPT";
};
};
_handled;
};
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
has anyone an idea how i get the actual bodypart damage in ace3?
I hope this is what you meant/need
_crate1 = loadbox;
_autorifleman = [["arifle_MX_SW_pointer_F","","acc_pointer_IR","",["100Rnd_65x39_caseless_mag",100],[],"bipod_01_F_snd"],[],["hgun_P07_F","","","",["16Rnd_9x21_Mag",17],[],""],["U_B_CombatUniform_mcam_tshirt",[["FirstAidKit",1],["SmokeShell",1,1],["HandGrenade",1,1],["SmokeShellGreen",1,1],["Chemlight_green",1,1]]],["V_PlateCarrier2_rgr",[["100Rnd_65x39_caseless_mag",5,100],["16Rnd_9x21_Mag",2,17],["Chemlight_green",1,1]]],[],"H_HelmetB_grass","G_Combat",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]]; //loadout code (exported from arsenal)
_crate1 addAction
["Autorifleman",
{
_this select 1 setUnitLoadout
_autorifleman
}
];
"Error, undefined variable in expression: _autorifleman"
I'm trying to add an action to an object to load this loadout. What am I doing wrong? How do I get my variable properly defined? I tried putting quotations around the variable, I tried str(loadoutCode), no dice.
local variables don't carry over into new scripts
you need to pass it to the action, or just move the whole array instead(but i suppose it's just an example, so the first one)
https://community.bistudio.com/wiki/addAction see "arguments"
Rookie mistake. Thank you!
I thought that local variables were included across the entire SQF file, thanks for clearing that up
hey how would I go about disabling the RHS ZSUs either targeting or maybe disabling the radar?
could I just throw this into a trigger?
"rhs_zsu234_aa" enableVehicleSensor ["PassiveRadarSensorComponent",false];
nope, it wants an object as a parameter
Can FSM files be compiled and referred to as regular .sqf script files? Or do they need to be packed in a PBO?
You could go about this a few ways, I'm new to scripting but I would place all the ZSUs in an array, and use forEach to apply the desired code/command to each ZSU in the array.
If you already have every ZSU in your mission that will be spawned, this is pretty simple to do. Just use EDEN to give each ZSU a variable name, and place those variable names in an array in your script (Instead of variable names, you could also just place the code into each units init field if you don't wanna set up files)
This won't apply the code to any ZSUs added to the mission (I.E triggers or zeus spawning) so for newly added ones mid-mission you will need a way to dynamically update your array (I.E scheduled script)
gotcha that makes sense some sense, im new as well to sqf scripting. How would I actually make the vehicle class name part an object as the enableVehicleSensor method wants?
the original example code had vehicle player enableVehicleSensor provided as the method, though looking at the vehicle documentation I dont exactly understand how it works
if I just apply the code to the init of each unit, perhaps I could just use this keyword?
pretty much, you can just go in the units init field in eden and say
this enableVehicleSensor ["PassiveRadarSensorComponent",false];```
Hi all, I'm new to Scripts in Aram, how do I start? I've been searching here and there for the code/scripts when I try to make a mission, so the knowledge of it are pieces here and there, but I really like to learn and enjoy what I'm doing when the missions came out working properly, so ultimately I wanna make missions like the Campaign missions with my own story or make Scenarios with my preferences, please, help me~
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting ; https://forums.bohemia.net/forums/topic/229245-scripting-guides-tutorials-compilation-list/ This is a general overview. Have fun ๐
@acoustic abyss thanks for the page , this is a useful page,been copy and paste the scripts from here a lot
yeah I modified another script I use for something similar and im pretty sure it works however I think the ai just turns the radar back on shortly after, though im not sure how this method is supposed to work if its supposed to stay off or not. Any Ideas?
params [
["_onoff", false, [false, 1]],
["_distance", 500, [0]],
["_marker", getMarkerPos "zsu-marker", ["",[],objNull]]
];
_types = ["rhs_zsu234_aa"];
_dmg = [0.97, 0] select _onoff;
_lamps = nearestObjects [_marker, _types, _distance, true];
{
for "_i" from 0 to count getAllHitPointsDamage _x -1 do
{
_x enableVehicleSensor ["PassiveRadarSensorComponent",false];
};
} forEach _lamps;
maybe disableAI "AUTOTARGET"; will work
Am I missing something simple here? I keep getting an error saying I'm missing "]"
_wp setWaypointStatements [
"true",
format["['updateUAVPos', [%1, %2]] call STY_RVG_fnc_exterminate;", _player, _uav]
];
You're putting stringized object names in the string, which won't work
Hmm... is there an easy workaround or do I need to define these globally?
Using global vars is the easy way
Hah, yeah, I guess it would be
Depends on what you're doing, but if there's only one of these scripts running per group I would store the needed objects on the group.
But there are other alternatives that need more work, such as using setVariable on the leader and fetch them again in the code
If you have multiple waypoints, you can make that an array and pop the arguments array for the code that is executed
Re-thinking the issue... I think global vars would be the best option.
Still not sure why the original didn't work though... is it because of quotes in the strings themselves?
No
When you stringize an object name it contains a space
Such as objblala blabla#123
Which obviously is not a valid sqf syntax, and even if it was, there's no "object literal" in sqf
Ah gotcha. Thanks
i like to assign a waypoint to a array of groups, i am stranded with this: https://pastebin.com/YSM2Xv8c
_mjkpos_randhq is not defined
oh yeah its more top in the script
but its _mjkpos_randhq = [getpos mjkdmp_core, 1000, 3000, 33, 0, 0.01, 0] call BIS_fnc_findSafePos;
then use hidden characters
yes, ofc
@warm hedge Was just looking at your formation flying script. Looks good, but is there any way to get a bit of deviation in the AI flight to make it more natural? Also, when they hit combat, do the AI break formation, or do I need to do some stuff with modules to get them to do that?
Hmm, but then i would have a bigger white space before the icon as expected. I thought there is any way to do it without Tricks like hidden characters. But if there isnt any other Method, then i need to do it like that ^^
Does anyone know if there is a way to add rotational velocity instead of movement velocity? In order to, for instance, cause a plane to start flatspinning
addTorque is one way
but for better control you have to rotate the object yourself
using setVelocityTransformation, for example
oh really? Oof.
like I said:
you have to rotate the object yourself
...wait wait is it like
uhh... playmove and capturemove?
wher eyou just set yourself a beginning and end velocity? and it runs between them?
no, it's a bit more complicated
you can just rotate the object
using setVectorDirAndUp
ah shit, why must this be the complicated thing. Alright, I'll look into it and see what I can do
well I don't think objects have a rotational velocity in Arma (except for PhysX objects)
I mean, they kinda... have to?
planes especially can roll, pitch and yaw
so can helicopters
even tanks and cars can spin
all of those are PhysX objects
quick question:
the variable you can set on units placed down in the editor are globally defined, correct?
e.g. I have two units with variable player1 and player2 on a MP mission. Both are occupied by players.
if (isNull player2) then {true} else {false} executed locally on player1 should return true.
it can be simplified to isNull player2
but... if player2 never the joins the game this variable can be nil IIRC.
so use isNull (missionNamespace getVariable ["player2", objNull]).
I do not remember what happens when somebody disconnects, will the variable be null or will it point to the body of disconneted player 
anyone know how i make my dialog whitelisted
I used the else...{} because if it doesn't exist it just returns nothing in debug console.
And yeah, its undefined if no one is in that slot.
What I'm trying to do is
{
if(isNull _x) then {
player addItemToBackpack "UK3CB_BAF_Soflam_Laserdesignator";
};
} forEach fst_list;
I luckily noticed that isNull won't work there.... it'll still execute for every client
I'm almost sure that doing forEach on fst_list makes no sense.
As you're propably defining the array early in the mission.
[player1, player2]
if it's done at the start of the mission when player2 is not in the game
when it won't magically appear in the array.
you will have an array of [player1, nil]
and it wont change.
also why you're adding the item to the backpack of the local player for every element of the array player addItemToBackpack "UK3CB_BAF_Soflam_Laserdesignator";
fst_list = [
"fst1",
"fst2",
"fst3",
"fst4"
];
{
if(isNull _x) then {
player addItemToBackpack "UK3CB_BAF_Soflam_Laserdesignator";
};
} forEach fst_list;
string can't be null
sorry, I don't understand
and because only one of them should return true
yes
add item to players who connected to these slots
if their variable name is in the above list
and you're executing that where? On the server?
initplayerlocal.sqf
then that loop has no sense
// initPlayerLocal.sqf
fst_list = [
"fst1",
"fst2",
"fst3",
"fst4"
];
if (vehicleVarName player in fst_list) then {
player addItemToBackpack "UK3CB_BAF_Soflam_Laserdesignator";
};
assuming you set the variable name of the player in editor name field.
aaaaah, vehicleVarName was the missing piece ๐
I only remembered about isNil and local, so i thought I had to iterate through them and check one by one
personally for things like this I prefer to set some variable on the player via init field.
eg:
// init box
this setVariable ["isJTAC", true];
// initPlayerLocal.sqf
if (player getVariable ["isJTAC", false]) then {
// do something
};
Hmm, might switch to that, thanks!
your way seems cleaner if I wanted to enable multiple things for one unit...
yeah, and can be easily reused for other mission logic.
whitelisted where?
i want to make it so only the person whos steam id i have included in the file can open a menu i made
then just don't open it when their IDs don't match the one you want
what's up with this: i set the name in the units identity tab and when i launch the mission on my dedicated server the name gets reset
is there a fix for this?
using sog and ace, in the editor the name shows up correctly
Indeed, the identity tab is not the way, not even for SP. Try with https://community.bistudio.com/wiki/setName#Syntax_2 (and see the last note).
hm, problem is i relied on the identity tab for my teleporter script
i sync two units with eachother and give unit a the name "unitA" and unit b "unitB", then when i ace interact on unit a it says "teleport to unitB"
that worked in the eden editor because im guessing it sets the name before running the init field
but if i now use setName in the init it only works one way
any ideas to do it differently? goal of the script is to be as easy to use as possible
What does it currently look like?
you set the name in the units identity and call that script in the init field
then synchronize that unit with other units you want to enable teleporting to, also doing the same thing in the init field and identity for those
i also understand that there is something else wrong with the script but that is something i haven't sparred with
What does the init field currently look like?
[this] call BD_fnc_teleporter;
this setName "Altis Airfield";
[this] call BD_fnc_teleporter;
first one is how it works as expected in eden editor but not on dedicated, second one is only one way since it then shows the randomized name
unita's init field runs, gets the randomized name from unitb, then unitbs init field runs which then only sets the expected name
instead of using this try using _this
_this refers to the object it self
unit, tank what ever
let me check if i actually use this or _this
okay i did use this, i changed it to _this and testing now
_this actually doesn't work
Try inserting waitUntil {sleep 1; time > 0}; at the beginning of BD_fnc_teleporter and changing the init field:
this setName "Altis Airfield"; //This is not Syntax 2 of setName
[this] spawn BD_fnc_teleporter;
```I hope this will also work in MP; the goal is to delay the execution of `BD_fnc_teleporter` until after Editor-placed objects have been initialized.
ill try that
wow it works
thanks so much
this might also fix some other script i have hah
Doesn't the call to ace_common_fnc_claim remove all ACE interactions with _target though?
So it has no impact on the interaction you add right after?
apparently not
Back with another question, how can i get the Vehicle Class from an object? Can't really seem any way to find any get it?
Vehicle returns the PBO name, aswell as some other information so its not really helpful..
_veh = vehicle cursortarget;
hint format ["Target Vehicle: %1", _veh];
deletevehicle cursortarget;
typeOf is the command you want
Interesting, I was not aware of that.
Well I am basically obliged to inform you that executing removeAllWeapons from an init field is not ideal ๐
why is that?
Worked like a charm, thanks alot!
The removeAllWeapons command has global effect and requires local arguments.
Every client that joins the mission executes init fields, hence why having commands with global effect in init fields is usually a bad idea.
I suppose in this case, since the object is not local to the client when it joins the mission, there is no harm done because the command presumably has no effect when all those clients to which the object is not local execute it.
But imagine it were setDamage (global effect, global arguments): Every time a client joins the mission, the damage is applied again, regardless if the object has healed / repaired in the meantime.
got it, thanks, i didn't actually notice that
i was more referring to the synchronizedObjects since that also wasn't behaving as expected, adding the sleep also fixed that issue and now the script fully works as intended
A2OA. Is it possible somehow to apply the same lowpass filter to sounds played with "say3d", as the lowpass filter applied to bullet and shell impact explosion sounds?
how can i evoke the unit command: "watch direction / observe position via script?
where are the script files for the vanilla unit command menu in th arma 3 folder?
There's no script files for that. It's handled in-engine.
@hollow thistledowatch and commandwatch makes the unit swing around endless, its hard to look at
glanceAt works, but very unreliable
setFormDir
but that's group level.
There's no command that replicates command menu "watch direction" command iiirc.
funfact, lookAt makes them rotate more lol
it has to be user level. c2 command and control might can do it.
The command switchCamera does not show the green screen of the night vision goggles?
You can enable it manually for the camera
i have a question about which would be better for this function?
the speed of using call with no suspension or would the suspension be better for the client?
Mad_ifnc_Vd ={
params['_dist','_currFrameNo'];
private['_dist','_currFrameNo'];
setViewDistance _dist;
waitUntil { viewDistance== _dist};
setObjectViewDistance (_dist*.80);
waitUntil { getObjectViewDistance select 0 == (_dist*.80)};
_currFrameNo = (diag_frameNo-_currFrameNo);
systemchat format['View distance: %1 %2', ViewDistance, _currFrameNo];
};
_currFrameNo = diag_frameNo;
[3000,_currFrameNo] spawn Mad_ifnc_Vd
//////
Mad_ifnc_Vd ={
params['_dist','_currFrameNo'];
private['_dist','_currFrameNo'];
setViewDistance _dist;
setObjectViewDistance (_dist*.80);
_currFrameNo = (diag_frameNo-_currFrameNo);
systemchat format['View distance: %1 %2', ViewDistance, _currFrameNo];
};
_currFrameNo = diag_frameNo;
[3000,_currFrameNo] call Mad_ifnc_Vd
these are the two ideas i have. used once from initplayer and also in players getin and getout eh
I don't think your "suspensions" are doing anything anyway.
setViewDistance and setObjectViewDistance take effect immediately
no. all you can do is mess around with the pitch
depends what the vehicle uses for the interior lights. what you typically need is animateSource and animate afaik
my concern is that having them run on top of each other with no suspension of any sort is possibly harder on the client . getting some crashes this is the last thing logged often times, but not the last thing the player seems to see
it's not
so in your opinion call and not try to suspend?
yes. just because you suspend doesn't mean the commands are gonna be "lighter". commands have the same cost in both unschd and schd env
it is just an idea. seems to happen on people that dont have faster setups the most, if i could break it up, then i thought it may help.
ill try how you say ๐
ty
maybe the problem is somewhere else?
also when does it happen? at init or when they get in/out of vehicles?
it is so hard to get straight answers i remote exec the things i really wonder about to log on the server...
its possible it could be something else, there are several things going on at once depending if its respawning into a veh, or just getting in.
for me i notice it the most (and i get it the least) when im respawn into a vehicle, i can tell something is happening, tab out tab back in and save it sometimes.
I want GET the damage not SET the damage. Thx for your try
and what they showed there is GETting the damage
Sorry, it was an unclear question from me in a completely random channel.
New attempt. How do I get the BodypartDamage array of a player from Ace3 Medical?
are there static function variables in sqf?
wat? it's already in that link:
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
I guess QEGVAR(medical,bodyPartDamage) becomes: "ace_medical_bodyPartDamage"
no
i tried three missions one as you said one with my idea and one with spawn no wait.
reason i thought it maybe suspending is maybe because i used spawn instead, the difference in call and spawn, is upto 3 frames, while when using spawn with waituntil it was upto 4 and 5 frames. i think, its really hard to say, its so fast i cant even log it with time in a way i know. just returns 0.
still going to use call just wanted to see
what is returned when a config path is null? I tried if {!isNil "_path"} and it passes regardless.
configNull
I'm using switchCamera to look at another player's view, and in this situation the camUseNVG and setCamUseTI commands don't work.
may I ask how can I make AI charging at moving tanks and explode himself when he gets close enough
like certain Ai can get position of tanks and move accordingly
i found my mistake? "damage" as var was taken and reserved?! thank you ๐
Reminder for me, check the wiki xD
you can try something like this:
if (isNil "my_bombers") then {my_bombers = []};
if (!canSuspend) exitWith {};
while {true} do {
private _remove = [];
{
private _unit = _x;
if (!alive _unit) then {_remove pushBack _unit; continue;};
private _tanks = _unit nearEntities ["tank", 100];
if (count _tanks != 0) then {
private _minDist = 1e10;
private _tank = objNull;
{
if ([side _x, side _unit] call BIS_fnc_sideIsEnemy) then {
_dist = _unit distance _x;
if (_dist < _minDist) then {
_minDist = _dist;
_tank = _x;
};
};
} forEach _tanks;
if (!alive _tank) then {continue;};
_unit doMove ASLToAGL getPosASL _tank;
if (_unit distance _tank < sizeOf typeOf _tank * 0.6) then {
isNil {
_bomb = createVehicle ["SatchelCharge_Remote_Ammo_Scripted", [0,0,0]];
_bomb setPosASL aimPos _unit;
_bomb setDamage 1;
triggerAmmo _bomb;
};
}
};
} forEach my_bombers;
my_bombers = my_bombers - _remove;
sleep 3;
};
this code must run scheduled (you can just put it into a file and execVM it from init.sqf)
then just add the units to the my_bombers array.
e.g.:
my_bombers = units east; //all east units will be suicide bombers and will hunt the nearest tank (within 100 m)
since the wiki is down for maintenance, can someone give me a hint regarding a vehicle following another? I think it was possible to with doFollow
wiki's not down 
but no, you can't do it with doFollow
it redirected me to the website https://www.bohemia.net/blog/websites-offline-for-maintenance
it's not offline rn
hmm yeah works now, thanks
anyway, you have to loop it
or maybe there's a built in waypoint. idk
I want a scripted approach, but yeah I need a loop for sure. Gonna fiddle around
How i do to put a black screen and remove a black screen on my intro
Hey, I need help with something of an emergency for our unit mod
So basically, our unit maintains a "public" auxiliary mod with a bunch of assets that members of the OPTRE/Halosim community are free to use
In response to a bug report by a member of a unit that uses it, we removed one of the required addons in CfgPatches for one of our mod PBOs
It worked fine on our unit's modpack, however it seems that it's broken the server and mission of another unit who uses it
We're trying to scramble to push a hotfix so they don't have to cancel their operation for this weekend
If someone if available, I could really use some help trying to get it fixed
Trying to save a lot of people's weekends here, and it's pretty time sensitive on our end
BIS_fnc_fadeEffect is one way
you sure you're not violating the mod's licence?
Positive, it's our own mod and the requiredEntries[] string referred to something in our own mod
DM me the stuff necessary and I'll take a quick look
Sure, thanks
Could someone explain to me what is the point of 0 = null or 0 = some code or null = something ?
nothing
basically to silence return value
it was a problem in old Arma versions I guess when you returned a value in init fields
but it's not needed anymore
ah, alright. I was just curious as I haven't seen it in anything recent, yet it used to be common practice in the past.
How can I force a ZSU-39 Tigris, ( The Default CSAT AA Vehicle ) to only use its lock on missiles and not the gun?
Hi Scripting group - is there a resource that I can use to make all entities visible to virtual observers?
does SeatSwitchedMan get called separately on both units in a swap?
if it is added to both
remove the other mags 
i'm guessing if all crew have the EH _unit2 can be ignored.
Guys, I've got a CTF mission with "currentScoreE = 0;" in init and a trigger that activates when the flag is brought there. It has "currentScoreW = currentScoreW + 1;hint format["BLUFOR just scored a point. Score total = %1",currentScoreW]; " on Act.
It seemed to work just fine, but for some reason the scores didn't seem to log at times, and they were different for me and my friend on dedi. He brought the flag there, the flag disappeared from his back as it should, but he didn't get the hint shown. Later he got the hint, but his score for W showed 1 as it showed 2 for me.
Could running the trigger only on server help? I'm not exactly sure about that though.
yes
I just removed all the mags and did this setAmmo ["missiles_titan_AA", 4]; Then set a timer on a trigger which refilled the ammo after a few aa shots had been fired.
for freezing the player you can just do:
onEachFrame {
player setVelocityTransformation [
getPosASL player,
getPosASL player,
[0,0,0],
[0,0,0],
vectorDir player,
vectorDir player,
vectorUp player,
vectorUp player,
1
];
};
Good evening!
I got problem with sending object variable from client to server.
On client side is defined, but server can't find it and return null
I got this message in log:
Object id 9a48deed (1773) not found in slot 283,210
19:12:05 Link cannot be resolved
19:12:05 ["_house",<NULL-object>]
Could you help me, please?
is that a terrain object?
ye, is building
I mean built into the terrain itself?
yep, is placed on map with terrain builder
some buildings have the same problem, but i can't get why :\
ahh i went the lazy route and just chose an animation that still let you look around, thank you tho
ye, but in default altis is worked fine :
i though houses have something like special state, cuz i can use some scripting commands on them ( intended to mission objects )
some objects are super simple
you can check that using typeOf obj
if it's empty it's a super simple object
hm, this command returned to me classname of that building
Then idk
I want a trigger to be activated when I "spot" an object, I know cursorobject is supposed to be used but other than that I am stuck, can anyone kindly help?
how can i get all classes like weapons and ammo inside a container? allMissionObjects reads only objects and not containers
Hm... according to boundingBoxReal a man is very fat.
Here are the inventory commands https://community.bistudio.com/wiki/Category:Command_Group:_Vehicle_Inventory
You can try something like this as part of your trigger condition
cursorObject == Shadoe_spotObject
Shadoe_spotObject being the variable name you give to the target
How are the containers getting placed? via script or editor?
either case you dont need to cycle through allMissionObjects to get the container object
then just, getItemCargo box
What are you trying to do?
well, i wanted to send object to server and check conditions, then - use setVariable on this building
if you really need the server to do it then send the info about the object instead of the object.
the object type is essentially in getModelInfo
ye, but before - this script worked, and i didn't get when is broken :\
It didn't help - I don't get any points anymore with server only -trigger. The valuable returns as 0 even if I bring 10 flags to the trigger.
So this persists..
Ah okay, much thanks
Is there any way of getting the health of the player?
_Health = 1 - (damage player);
0 dead
1 healthy
@still knoll i will fiddle with getItemCargo. thx
i can't see how it ever worked. same object on 2 machines will have 2 different memory addresses.
You must be adding to or reading score on wrong machine.
Well, what I've done is have currentScoreE = 0 in the init. Then adding happens by a trigger "currentScoreE = currentScoreE + 1". I tried putting publicVariable "currentScoreE" on it as well.
Now I tried it like that ^ without ticking "server only". What's weird is that I didn't get the hints, but it did count it as I did a manual hint format with the score to check it.
But when I reached 3 points, the End -trigger with isEqualTo didn't trigger. I'm puzzled.
Is there a way, with scripting, to change how long one of those notifications for tasks will be on screen?
Writing code and triggers in editor is sketchy with complex mission. Put all code in server only block except display stuff like flag attachment to character and score text. publicVariable is only for clients to get the score so they can update display.
Trying to make a cas unit be synced with a subordinate module once a trigger gets activated, this is what I have, seems to not be working
hcmnd synchronizeObjectsAdd [cas1];
How to see night vision effect when watching another player with switchCamera command?
camUseNVG true;
or for thermals
setCamUseTI
@still knoll I appreciate your answer, however these commands don't work when using switchCamera in a player (switchCamera _friendlyPlayer for example). They only work with cameras created with camCreate ๐
Hello all, Got a question relating to extensions. Namely, how battleye interacts with them. What I want to know is in what scenarios battleye would flag them if they are not whitelisted.
The error it outputs when this occurs is supposedly:
Call extension 'My_Extension' could not be loaded: Insufficient system resources exist to complete the requested service.
This occurs for me in the editor when I am just trying to test it. I am thus wondering if it would work if the server is using it on the server side only? Ofc, one cannot use it clientside and join a server using battleye. But I had though that it would still be usable in editor and on the server side only without whitelisting?
I may have missed this info somewhere but I have only seen reference to the interaction of joining a battleye server with a non-whitelisted extension. Not the other scenarios.
hello, i am trying to run BIS_fnc_cinemaBorder without it disabling player input. is there anyway i can work around this?
nvm figured it out
use it locally
Trying to create bullets and give them velocity in a certaint radius. Just having problems calling out the bullet(instance)
[]spawn {
while {alive D} do {
sleep 1;
shazam = "B_127x108_Ball"
things = nearestobject [D,[],2];{_x createvehicle shazam} foreach things
};
};```
what does it have to do with creating bullets?
Does anyone have a good understanding of databases? I'm trying to figure out how Jeroen's Limited Arsenal generates, saves, and loads its data. I'm trying to use iniDBI2 to handle the database aspect, and understand the original scripts will need rewriting, but I kind of need to figure it out before I can modify it.
So far, from what I can gather, under JeroenArsenal/JNA the fn_arsenal.sqf loads the custom arsenal and may also load the datalist from somewhere. I think fn_arsenal_arraytoArsenal.sqf makes an array of the arsenal's contents which can be saved. Finally, fn_arsenal_loadInventory.sqf could also load the arsenal's inventory from a specific location (ie a database).
I'm hoping to use this to save contents over multiple missions without having to note down every item manually.
Trying to give it a name so I can give it velocity l
And the bullet needs velocity to damage
Couldnโt get anything else to work and I code in LUA so I get very confused at times
Which handler?
FiredMan
Specifically trying to make AI that do damage if your in its radius. Or spawn a bullet that goes up into you to damage
Without a gun involved
well your code just makes no sense
is it possible to spawn a composition using scripts that follows edens terrain following?
trying to make a vehicle that can be "sacrificed" into a small composition
Build whatever you want in the editor, export it as an SQF and then execute that SQF via a trigger or however you want to implement it.
will that allow it to be built wherever the vehicle is sacrificed?
its part of a dynamic system
I'm not sure what you mean by sacrificed
the idea is that its a outpost in a box a couple hesco's and stuff
you drive the vic there then deploy it
vic is removed and hesco's etc place down
there are problem with placing objects like that. they will end up inside other objects
So i'd probably do something like addAction on the vic, have the addAction run the SQF, but I'd modify the SQF by putting something like:
deleteVehicle car; sleep 3;
At the beginning of the file. This will delete the vehicle, give it a couple seconds to clear the space, and then spawn the SQF. This is assuming you aren't moving the vehicle to a location, or allowing the vehicle to deploy this outpost anywhere.
the last two conditions are exactly what im doing with the vic lmao
drive the vic somewhere and deploy the composition at vics pos on map
and despawn the vic
i wonder if i can find a way to parse what the eden editor exports for custom comps
to where i can change the center value to where the vic is when the action is made
you don't need to parse anything
just use relative model coords.
pick an object in the composition as the "main" object
then transform all positions /directions relative to this object:
{
_relPos = _mainObj worldToModel ASLtoAGL getPosWorld _x;
_relDirAndUp = [_mainObj vectorWorldToModel vectorDir _x, _mainObj vectorWorldToModel vectorUp _x];
_composition pushBack [typeOf _x, _relPos, _relDirAndUp];
} forEach _compositionObjs;
then do the inverse of those operations to convert them back to world space and recreate the composition
so this is using what eden puts in my arma 3 profile as a composition
yeah i dont understand what you've done lmao
I was going to do a createVehicle loop
that takes the vics pos
and adds the pos of the composition
that code just "saves" the composition
oh how do i execute it?
you have to create it yourself:
then do the inverse of those operations to convert them back to world space and recreate the composition
all g
create vehicle doesnt allow for rotation does it
would have to do something else to do that after its made
no
and its position is not suitable either
wdym its position is not suitable either?
uhhhh
like one that provides a finer increment?
im currently using getPosATL
createVehicle accepts that as a format
no. it uses AGL
strange thats not what the documentation says
also am i wanting to do worldspace transforms so that it follows the contour of the terrain
where placed?
after all the transforms etc
wat? no
or maybe
but only the terrain surface normal
not its position.
otherwise the composition parts will be misaligned
if you call createVehicle with no heigh value
it will spawn it at terrain level correct
at the x and y
yes
Keep in mind that if you want to spawn it onto a pier or other object that isn't part of the terrain, e.g. editor placed or zeus, it will not be placed on top of those. but on the terain beneath them. idk what your use case fully is, but just keep that in mind before it comes back to haunt you.
thank you yes i do not intend for any of those concerns to be valid in my use case
the only issue i can see rn is i only have rotational information for the x axis
so every object will spawn perfectly vertical
regardless of slope
it will just have to be one of those things I will have to tell people find a suitable location
you can simple set the vectorUp to surfaceNormal?
those are two things I'm not aware of
maybe
atm though i just want to get it working without that
might consider it another time
https://community.bistudio.com/wiki/surfaceNormal
https://community.bistudio.com/wiki/setVectorUp
private _vector = surfaceNormal (_objectPos);
_object setVectorUp _vector;
something like that would set every object to point away from terrain.
mm I will consider it
atm i'll get it to minimum functionality
then i will look to polish up some of that to make it less restrictive
it would be pretty dumb to have this comp on the side of a hill tho
and i would have to find a way to have some of the objects not have their vector set to terrain
yknow stuff like bunkers and cargo posts
now for a smooth brain question
is it easy to just add the values of two arrays together?
or will i have to spit the values and add them then stitch them back together
append to modify the array or + to create a new array
cheers ill take a look
not exactly what i was looking for but took me to something i can use
i have 2 arrays
i want to add the 0 of each array to each other
and the 1 of each to each other
so if i have [1,3] and [2,4] i want to get [3,7]
vectorAdd
cheers
ever wonder why something doesnt work dispite it not throwing an error
either semantic error
or the code doesn't compile at all
knowing me probably both
or the worst of all: a logical error
that's the semantic error I said
semantic error = logical error
oh that's fancy people talk, ic ๐
if forEach loop has "failed you" why would a hashmap help?
you assume i know the answer
i assure you i do not
im literally just going to rewrite the thing based around a hashmap now
instead of an array with 20 or so arrays that contain another array
Is there a way to play a song only when a vehicle starts moving?
yes
How?
you can just use a simple loop
waitUntil {sleep 1; speed _vehicle > 1};
playMusic "blabla";
there is a problem that the function bis_fnc_initVehicle does not work in MP, while the function itself returns a positive response, that it worked, what could be the problem?
what kind of problem?
Vehicle just ignores the changes that I try to apply, the only thing that changes is the color, but the elements on vehicle themselves are unchanged
do you add some delay?
after the appearance of the car? yes, did
add a small delay (1 second should be enough) before using initVehicle
Yes, I did that, it doesn't help.
then idk
Anyone able to provide me an answer to this extension related question?
Does anyone know if is there object oriented programming as Java?
not really in SQF in Arma 3
I have seen a mod/tool on bohemia forum, does anyone know if is it stable?
depends on something there
there are a few OOP sqf transpilers but nothing close to java really
would be useful for a roleplay?
dim the lights and use a deeper voice
I developed some
There is oos, which is dead as of now and will not be resurrected (but it works, wrote an insurgency style mission with it)
And sqc, which is on hiatus due to time, but not typed at all (more like plain JavaScript than Java)
https://github.com/SQFvm/runtime/blob/master/src/sqc/ReadMe.md sqc documentation regarding language features is here (also contains proper Syntax sample at the very bottom)
this supposed new syntax does not work: vehicle lockCameraTo [target, turretPath, temporary]
Are you on 2.08?
hmm no. I thought it updated auto.
https://github.com/X39/XInsurgency/tree/OOS_Insurgency/InsurgencyModule%2Fsrc oos code looks like this
2.08 is current dev branch
Not stable
2.07 is dev :u
So, you guys know how you can see the name of a friendly unit by looking directly at them from a short distance? Is that possible to do on a crate? So you can label crates and not have to look inside each one?
Cypher,
here is a name tag script by MosesUK I use.
//Code by MosesUK
//Modified by Blackheart_Six
waitUntil {!(isNull player)};
waitUntil {player == player};
sleep 1;
tag = addMissionEventHandler
[
"Draw3D",
{
private ["_group"];
{
if (side _x == playerSide && (player distance _x <=25) && !(player == _x)) then
{
_dist = (player distance _x) / 15.0;
//_color = getArray (configFile/'CfgInGameUI'/'SideColors'/'colorBlufor');
_color = [0,0.3,0.6,1] ;
_groupName = groupId (group _x);
_id = player call getUnitPositionId;
getUnitPositionId = {
private ["_vvn", "_str"];
_vvn = vehicleVarName _x;
_x setVehicleVarName "";
_str = str _x;
_x setVehicleVarName _vvn;
parseNumber (_str select [(_str find ":") + 1])
};
//player joinAs [createGroup west, 5];
_id = player call getUnitPositionId;
//hint str _id; //5
if (cursorTarget != _x) then
{
_color set [3, 1 - _dist]
};
drawIcon3D
[
format ["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa", rank _x],
_color,
[
visiblePosition _x select 0,
visiblePosition _x select 1,
(visiblePosition _x select 2) +
((_x modelToWorld (
_x selectionPosition "spine"
)) select 2) + .2 + _dist / 3.0
],
1,
1,
0,
// format ["%1 | %2",rank _x,name _x],0,.02,"PuristaLight","center"]
format ["%1-%2 | %3",_groupName,_id,name _x],0,.035,"PuristaMedium","center"]
};
} count allUnits - [player];
}
];
Wow thanks, I'm going to try it out!
Kinda, yes
Draw3d and a Lil bit of work
Trying to figure out Draw3D right now lol
I'm not finding any solutions for limiting the text to a short distance. The wiki page is helpful but includes no distance parameter.
What I have right now for testing is:
addMissionEventHandler ["Draw3D", { drawIcon3D ["", [1,0,0,1], crate1, 0, 0, 0, "Medical", 1, 0.02, "PuristaMedium"]; }];
But it shows at all ranges, and at all angles instead of only when the player looks directly at it.
you need to adjust it's width and height in relation to the distance between the crate and the player
you can also just reduce the alpha as the player goes further away
text size actually, as you don't use an icon, so width and height are irrelevant
I have no idea how to go about changing the alpha based on distance, but that's a good lead thank you
the color is in format of [r,g,b,a] in your case it's [1,0,0,1], so the last element would be the alpha, that's the value you'd want to change based on distance
Right I knew that was the alpha value, but I don't know how to change it based on distance nor do I even know where to go to teach myself that
you can get distance with https://community.bistudio.com/wiki/distance
instead of putting constant 1 as alpha, put some math in there
something like this [1,0,0,(20 - (player distance crate1) max 0) / 20]
this would basically make it so the text appears when you're atleast within 20meters, and fading in as you get closer
Genius, that should probably do it. Testing now
Nice that works like a charm!
Thank you, and I'm going to have to study up on this distance wiki you provided
The contents of this:
if !(mCache isEqualTo mList) then {
is running despite the fact I have checked and both mCache and mList are identical. They are both arrays.
Any help is appreciated
print the arrays, like systemChat str [mCache, mList]
I have
what data do they hold?
well I did it like this, but same difference.
systemChat (format ["Cache:%1", mCache]);```
They both hold a string, an identical string
identical in case sensitivity too?
ya, it contains some underscores, text, and numbers and I think a hashtag. But the order and capitalization is the same, with no spaces or anything inbetween
try
"isNotEqualTo"
that's literally the same thing
ill give that a try, but ive used this in the exact same way before and not had a problem. Not sure what the issue is now. If it makes any difference im doing that if statement inside a function that im calling somewhere else in the code
Well all I can guarantee you is that the command and that snippet are not the problem
You can post the full code here and someone might take a look
Is there any possible way that in the following scenario, that the unit created could die before the "mpkilled" event handler is attached to it successfully? isNil { _new_unit = _group createUnit [_unit_array select INDEX_GROUP_CONFIG_UNIT_TYPE, _group_start_position, [], 0, "form"]; _killed_event_handler_index = _new_unit addMPEventHandler ["MPkilled",{ _this call func_UNIT_Killed_Event; }]; _new_unit setVariable ["KILL_EV_CONSTANTS", [_group_casualty_array,_killed_event_handler_index,_group_side], true]; };
Thus causing the code called in that event handler to fail to run?
Could be. Maybe the unit has to be synced to the server for MPKilled to work ๐ค
Or maybe the unit was not created in the first place
I've been double checking that the expected number of units are actually created, and there seems to be no issue there.
But the number created minus the number killed is not what should be expected
Maybe your counter is wrong 
By process of elimination, I suspect the fault is in the killed event handler somehow
It could also be a race condition
You're broadcasting the variable for everyone. If you've attached the EH on all clients race conditions are possible
I'm testing all this on the server
the numbers aren't correct on the server itself.
So just a self hosted MP then?
yep
If you use killed EH does it work properly?
Ill check in a moment.
Hmm... it's looking like it might have been an illusion issue. Unless, it's not possible for a "spawned" script to sleep for a finite amount of time and then totally fail to wake up again, is it?
If it throws an error it could fail entirety
but apart from that, it's not possible for the script to never wake up, right?
Also if you use too many spawns the scheduler won't be able to queue your scripts properly
Especially if you use while without sleep, which is a total disaster
is there a point at which a spawned script wont be scheduled at all?
If you have so many that the time it takes for the scheduler to sort the queue is longer than 3 ms
But that would be like several thousands/ millions I guess
The more likely problem is what I mentioned above
Try to reduce the number of scheduled scripts as much as possible
e.g. instead of spawning an infinite loop for every unit in the game, make a single infinite loop and iterate over the list of units instead
the number of spawned scripts I'm triggering is not very great. I'd say at most a few 10's per second.
but usually many fewer
That is a lot tho 
Especially if they take a long time to finish
most finish in a couple of seconds
at most
and when I say sometimes 10's are triggered in a second, most of the time it's probably more around 1 or 2.
I don't suppose there's a command to see how many things are currently scheduled?
Well in any case you better check to make sure
Not sure if A2 has a diag_activeScripts command
Also you can run something like this in debug console to measure how busy the scheduler is (i.e execution delay)
timer = diag_tickTime;
0 spawn {systemChat str (diag_tickTime - timer)}
if it's longer than 1s you might want to optimize your scripts to use fewer spawns
Looks like it doesn't 
You can write a wrapper for your spawns
Instead of doing spawn directly, use an intermediate function:
params ["_params", "_func"];
counter = counter + 1;
_params call _func;
counter = counter - 1;
And do;
[_params, my_fnc] spawn fnc_spawn_wrapper
That way you can know the number of spawned scripts at any time, using that counter variable
You can also measure how long they take
Doing it like that is a lot cleaner than messing up the scripts themselves
0 spawn {systemChat str (diag_tickTime - timer)}``` In the midst of the action, I never saw it read a value above .4 seconds, and usually it was hovering around 0.04.
But, if it goes past 3s, it will just totally fail to schedule a spawned script, without showing any error?
show an error?
But every script will be processed every 3s which is slow
No
It still runs fine
I said 3ms, not 3s
And that was for scheduler sorting
3 ms is the scheduler execution limit in every frame
you mean the maximum time it will be processed each frame?
What I meant is that if the sorting process takes longer than 3ms then the scheduler won't have time to execute anything
And like I said it's a very unlikely scenario
Yes. After 3 ms the scheduler won't process anything for that frame
And there would have to be thousands of scripts in the queue for it to take that long, right?
Yes
for sorting to take that long, that is.
Ok, good info. I suspect my original problem was an illusion caused by delays between ordering a group to be created, and the actual creation of the group.
because turning off the delay makes the discrepency disappear.
is there a better way to allocate grid arrays than typing gazillions of zeros and commas?
resize, loop + pushBack, etc.
many options
loop pushback gobbles cpu. loop resize is closest i can imagine to "new float[a][b][c]"
resize doesn't initialize values.
also you don't have to constantly do pushBack. you just initialize one row and copy it in rest of the rows
_row = [];
_row resize _b;
_row = _row apply {_value};
_array = [];
for "_i" from 1 to _a do {
_array pushBack +_row;
};
//or
_array = [];
_array resize _a;
_array = _array apply {+_row};
if you don't care about initialization it's a lot easier:
_array = [];
_array resize _a;
_array = _array apply {_row = []; _row resize _b; _row};
Is there a way to detect e.g. SAMs (the missiles not the launcher) in a certain area?
I have tried nearEntities and nearestObjects but neither seems to be able to detect the missiles...
Is it possible to view all CBA functions added by a mod since they don't populate in the functions viewer?
Judging by the description and the comments on https://community.bistudio.com/wiki/nearestObjects and because I use nearestObject to detect CfgAmmo instances myself, I'd say you should try nearObjects and nearestObject ๐
CBA doesn't keep track of functions it's added
is there a more all encompassing option or are you just sort out of luck if the functions aren't listed in the function viewer (and the pbo is obfuscated)
you can search the missionNamespace and gather all variables that are codes
what do you mean "variables that are codes"? I'll go searching but how would I distinguish?
_var isEqualType {}
I do a similar thing in my mod's function viewer:
https://steamcommunity.com/sharedfiles/filedetails/?id=2369477168
...I was not aware this even existed
that is quite impressive... thank you for THAT also!
Is there a way to spawn a group including the units from the CfgGroups by using its CfgGroups class name?
BIS_fnc_spawnGroup I think
Oh, yeah, thanks. I was so focused on scripting commands that I forgot all about functions... ๐
Do you also happen to know a way to make an AI unit temporarily respawnable?
no
Ok.
In my init.sqf I try to spawn an helicopter, teleport all players in it and then let the helicopter fly to an point, where they will get dropped. But the helicopter wont fly to the point.
init.sqf
_missionStartPos = [4145.36,15927.3];
_dropPointPos = [4973.71,12526.9,0];
_dropPointHigh = [(_dropPointPos select 0), (_dropPointPos select 1), 4100];
_veh = createVehicle["RHS_Mi8t_vv", [0,0,0], [], 2, "FLY"];
sleep 0.1;
_veh setPosASL [4145.36,15927.3, 4000];
_veh setDir 180;
_veh flyInHeight 4000;
createVehicleCrew _veh;
_vehGroup = (group _veh);
_driver = driver _veh;
_vehGroup setBehaviour "careless";
_driver disableAI "FSM";
_driver disableAI "Target";
_driver disableAI "AutoTarget";
while {(count (waypoints _vehGroup)) > 0} do {
deleteWaypoint ((waypoints _vehGroup) select 0);
};
[allplayers, {player moveInCargo _veh}] remoteExec ["call", 0];
_wp0 = _vehGroup addWaypoint [_missionStartPos, 0];
_wp0 setWaypointSpeed "FULL";
_wp0 setWaypointType "MOVE";
_wp0 setWaypointBehaviour "COMBAT";
_wp1 = _vehGroup addWaypoint [_dropPointPos, 0];
_wp1 setWaypointSpeed "FULL";
_wp1 setWaypointType "MOVE";
_trgEject = createTrigger ["EmptyDetector", _dropPointHigh];
_trgEject setTriggerArea [800, 50, 180, false];
_trgEject setTriggerActivation ["ANY", "PRESENT", false];
_trgEject setTriggerStatements ["(thisTrigger getVariable 'veh') in thisList","{_x execVM 'scripts/halo.sqf';} forEach allPlayers;", ""];
_trgEject setVariable ["veh", _veh];
Define temporarily. For a certain amount of time? While a condition is true?
Theoretically, just hook whatever is spawning/is going to spawn the AI unit up to a condition which will either allow the spawn to take place or not depending on if the condition is met or not
While a condition is true. Basically I need a small group (from the CfgGroups) to patrol in a sector to be seen by the enemy so as long as the sector has not been discovered by the enemy they need to respawn whenever they die (e.g. due to friendly fire) but once the enemy has discovered them they should stop to do so.
Check out "knowsAbout" https://community.bistudio.com/wiki/knowsAbout
Or if that doesn't work, you'd likely need to check the radius around a marker that you place in the sector
Yeah, that's not the issue, I just need to know how I can keep them respawning until a condition is met but stop as soon as it has.
Do you already have the function to spawn them set up?
e.g.
[_sectorPos, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_T_F" >> "Support" >> "B_T_Support_CLS")] call BIS_fnc_spawnGroup;
So it seems like the logic here sounds like: while no enemy players are within a certain radius of sector pos, and (spawned group) is not alive, then spawn the group
otherwise, don't spawn the group
That wouldn't be that hard, but I want to replace individual dead units in the group so basically as soon as the unit is killed a new unit of the same type with all the same properties spawns and takes over the position of the unit that was killed in the group (e.g. if the leader dies a new Team leader unit is spawned, joins the group on the dead leaders position and takes command of the group).
But if that doesn't work I am just going to spawn a number of Rifleman or something and each time one dies a new one is spawned as part of the group.
The return value of the function is the group, so place that into an array and check if each element of the array is alive
Or, you could consider adding a "Killed" eventhandler to each unit in the array
Yeah, I thought of that as well but the issue is that it would only work once (or however often I am willing to copy paste the code that adds the event handler) because I would need to readd the event handler to the new unit within the event handler of the old.
But I think your idea with the array isn't that bad. I'll try that.
You donโt have to copy paste, run a for loop that only loops while a condition is true
Or a while loop, whichever you find best suits your situation
if the condition is in your hands there's no need for a while loop
@little raptor thanks for the earlier suggestions man... they're not helping in this particular case but those advanced developer tools you put together... very nice
they're not helping in this particular case
it should
if the function is defined at all
Yeah, I'm thinking that's the issue... I think they're a couple of actions added to the player that call a script
what mod are you talking about anyway?
SPS BlackHornet PRS
and what kind of "function" are you looking for?
I was trying to find the "function" it calls when it spawns the uav
I've spent more time trying to find this than just recreating myself so I'm just gonna go that route to get some functionality I want
you can check the vehicle config
all vehicle related actions and scripts are defined there
Yeah... only actions present there are to re-add it to your inventory
I think some actions are added to the players with conditions based on whether or not the uav is in your inventory
the "function" it calls when it spawns the uav
I don't know what you mean here, but it sounds like you're talking about the init EH
No, you misunderstand me. If I want to create a new unit via the code in the killed event handler of the old one I obviously have to add a killed event handler to the newly created unit as well which in turn needs to contain the code to create a new unit and add a killed event handler to that one and so on and so forth but with your array idea it's a lot easier and I don't even need a killed event handler.
_unit addEventhandler ["Killed", {
_newUnit = /* create new unit */;
_newUnit addEventhandler ["Killed", {
_newNewUnit = /* create new unit */;
_newNewUnit addEventhandler ["Killed", {
/* and so on and so forth */
}];
}];
}];
the EH is faster. also easier and less error prone if you ask me
wat? no.
you make a function
just reassign unit?
I'm not conveying the situation properly but I've come up with a suitable workaround I suppose
//fn_blabla.sqf
params ["_unit"];
_unit addEventhandler ["Killed", {
_this call my_fnc_blabla;
}];
Yeah, that would be the althernative.
_unit addEventhandler ["Killed", {
_unit = /* create new unit */;
}];
wouldn't this work?
Yes, once.
I mean, the new unit should still have the event handler
you'd have to test it to be sure but if you already have a work around ig it doesn't matter
Yeah, I just wanted to know whether there was an "easy" and simple way without a workaround but I understand that there isn't. I don't really need help with the workaround itself, but still thanks for trying to help.
(Also I am a bit tired to just disregard everything I wrote past 18:15 UTC. ๐คฃ)
Actually I just wanted to know if there was an easy way to let units respawn, like with player units without the need of a (relatively) complicated workaround.
I see now that there isn't so I'll have to deal with that.
I think everyone if now trying to help me with creating a workaround but that isn't really necessary (but the gesture still appreciated).
I think replied to* the wrong person
I thought your comment was in regards the whole unit respawn thing...
Nope
In that case I apologise for the misunderstanding.
lol no sweat bro... just letting you know you may have pinged the wrong person
how is this error possible when vectorDir returns array
Error in expression < matrixMdlSpc matrixMultiply (vectorDir matrixMan);
Error position: <matrixMultiply (vectorDir matrixMan);
Error Type Number, expected Array
because a vector is a 1D matrix
you need 2D matrices
So I guess my solution wasn't as suitable as I thought... since I'm unable to access the actions that are added to the BlackHornet when it's spawned... is there anyway to listen for it's creation? I'm not seeing anything in the eventHandlers that looks to fit
Well... I suppose I could just create a unique config for it and add an additional action that way?
CBA has functions that run on vehicle creation
Any idea what the function is called to narrow down the search?
I'm trying to add an action to the SPS BlackHornet PRS
it's prohibitively copy protected and it deploys from an action added to the player
It's really frustrating me
All that to say I can't really add an event handler to the object itself because I'm not creating it...
Might just have to accept that there's no real attractive way to accomplish my goal... I'll just have to continue lowering my standards until I find something that works
why shouldnt that cba function not be able to do that?
I think I misread... so I could use an "init" event handler for that class and accomplish what I need couldn't I?
yes?
lol thanks, think that's going to do the trick
Question, how do I remove binoculars from a unit? Tried unlinkItem, but it doesn't seem to work
How would I prevent all vehicles from getting destroyed? I still want them to take damage but would like to prevent them from blowing up. This includes planes, helicopters, vehicles and boats?
This would include all vehicles on the map. Friendly, enemy and civilian?
i think binoculars are weapons
maybe a handledamage EH and if the total damage of the unit exceeds the explosion threshhold (however much that is) return 0 in the eh code
I need to read better my gosh
i need help with the fired eventhandler
since it doesnt include the listener as a variable, how do i make a group of enemy ai within 300 meters go to the firers location?
this is my first script ever and its difficult
What is the best command to tell if you are on a road or a trail ?
isOnRoad reports trails as roads after 2.0 ..... sadly
Thx that is a new one. Any suggestions on how to use it to sort out trails from roads ? it is tanoa ๐
probably by checking the texture
mapType: String - road segment type, could be "ROAD", "MAIN ROAD", "TRACK", "TRAIL" (see nearestTerrainObjects)
So i have made a test script. And I just need to sort out the trail from the rest.
if _dir isEqualTo ("TRACK") or ("ROAD") or ("MAIN ROAD") then
But the above is not working. I am doing something wrong with isEqualTo ?
Nevermind I figured it out ๐
Iv got a question guys. I have a script and it spawns groups of AI. Does anyone know how to add them to a curator?
i did try that keeps telling me the AI come back as a group and not a object
i used it like this
zuse1 addCuratorEditableObjects [_x];
zuse1 addCuratorEditableObjects [[_x], true];
alright but do i really need the true? the AI are just that AI, they arnt in any vehicles
yes you need it as it is required by the syntax
ok thank you
worked on the first go. thanks again
yw
@distant oyster Thanks again for pointing out the CBA class event handlers... I've managed to accomplish exactly what I was hoping to with it
yw too ;)
hello i am having issues making a variable be displayed via the format command
format["%3: %1%2",(player getVariable ["KSS_thirst",0]),"%", localize "DRG_thirst"]
right now it calls the var3 and var2 so it displays Hunger:0%
however i cannot get var1 to display. it is calling a variable from the KSS hunger mod and i can getvariable kss_thirst from the debug menu in editor
nevermind i am an idiot i needed to use "missionnamespace" instead of "player" as the varspace
Heyo, hate to ask for help here but whenever I ask in the lib discord I cant seem to get any help, does anyone have any idea what this error might be about? it only happens on this map and im not certain why
Tbh im not even sure where or how the recycle_manager script is called, I was thinking maybe a marker or building or something wasnt placed but I cant seem to figure it out
22:32:13 Error in expression <&
_x distance2d startbase > 1000 &&
(_x distance2d ([] call KPLIB_fnc_getNearest>
22:32:13 Error position: <distance2d ([] call KPLIB_fnc_getNearest>
22:32:13 Error 0 elements provided, 3 expected
22:32:13 File C:\Users\Administrator\Documents\Arma 3 - Other Profiles\Damien%2eB\mpmissions\kp_liberation.fallujah\scripts\client\actions\recycle_manager.sqf..., line 37
I have to assume that it is something not being placed in the mission because all of the other maps use the exact same framework files and dont have this issue
it sounds like you're passing an empty array to distance2d
the array getting passed to distance2d is ([] call KPLIB_fnc_getNearestFob) right?
it makes sense its empty, there are no fobs at mission start
im pretty sure this is that function btw
params [
["_pos", getPos player, [[]], [2, 3]]
];
if !(GRLIB_all_fobs isEqualTo []) then {
private _fobs = GRLIB_all_fobs apply {[_pos distance2d _x, _x]};
_fobs sort true;
(_fobs select 0) select 1
} else {
[]
};
well yeah, that makes sense
thing is, I havent changed anything regarding any of these scripts, so I dont understand why its acting up and putting the mission into a infinite starting loop on this one mission
this is part of the script thats throwing the error btw
private _detected_vehicles = (getPos player) nearObjects veh_action_detect_distance select {
(((toLower (typeof _x)) in _recycleable_classnames && (({alive _x} count (crew _x)) == 0 || unitIsUAV _x) && (locked _x == 0 || locked _x == 1)) ||
(toLower (typeOf _x)) in KPLIB_b_buildings_classes ||
(((toLower (typeOf _x)) in KPLIB_storageBuildings) && ((_x getVariable ["KP_liberation_storage_type",-1]) == 0)) ||
(toLower (typeOf _x)) in KPLIB_upgradeBuildings ||
(typeOf _x) in KP_liberation_ace_crates) &&
alive _x &&
(
// ignore null objects left by Advanced Towing
// see https://github.com/sethduda/AdvancedTowing/pull/46
(((attachedObjects _x) select {!isNull _X}) isEqualTo [])
|| ((typeOf _x) == "rhsusf_mkvsoc")
) &&
_x distance2d startbase > 1000 &&
(_x distance2d ([] call KPLIB_fnc_getNearestFob)) < GRLIB_fob_range && // Line 37
(getObjectType _x) >= 8
};
thats... eh
well, that's not the issue, the issue is here:
else {
[]
};
empty array being returned thus distance2d error
add some fobs? idk ๐
I cant even start the mission lol
maybe this isnt the error that is making the mission start infinitely? I dont know anymore, im really confused
i am trying to reverse engineer some old scripts to use with my personal play group and this script is missing a function.
[[player, _loot] call ARMST_fnc_giveLootToPlayer, localize "str_remain_complete"];
};```
now _loot is an array that is comprised of 3 different items that are randomly selected
i am not good enough to create my own functions so I tried to work around it by using additem but that does not work with arrays so I tried using "str" to convert _loot but i think i messed up somewhere in the code
am i on the right track in attempting to covert _loot to a string so I can use it with additem?
I chose dev build to use a command added in 2.08, but the version is now 2.07
Sounds good but I might need some more pointing in the right direction, I have never done any scripting for Arma recently. Last time I touched arma was when it just came out and I was scripting missions nothing big
2.08 (stable) is what 2.07 (dev) will become
odd versions are dev
it doesnt include the listener as a variable
there's no "listener". it just triggers when the vehicle fires and reports parameters related to the firer.
go to the firers location
you can either use FiredNear EH instead, or just loop through the list of enemy units and find those within 300 m.
e.g.
{
if ([side _x, side _firer] call BIS_fnc_sideIsEnemy && {leader _x distance _firer < 300}) then {
_x move ASLtoAGL getPosASL _firer;
};
} forEach allGroups;
add a HandleDamage EH to the vehicle
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
if the resulting damage exceeds 1 just return 0 at the end of the EH to override the damage
simply returning 0 will prevent one shots as in they will not take any damage at all. i would go for something like
this addEventHandler ["HandleDamage", {
params ["_unit", "", "_damage"];
if (damage _unit + _damage >= 0.9) then {
0.9 - damage _unit
} else {
_damage
};
}];
Hi gain ๐
I need to filter out trails from an array of roads. "nearRoads" returns an array of roads.
I can use getRoadInfo to get info about a given road but I cannot get it to handle an array?
Could I use "forEach" to make getRoadInfo handle each object in the array ?
yes
Yes, loops would be used for that.
In this case however, https://community.bistudio.com/wiki/select#Syntax_6 might be shorter and faster (of course, it uses a loop internally):
private _resultArray = [];
{
if (/*condition*/) then {
_resultArray pushBack _x;
};
} forEach _inputArray;
```... is equivalent to ...
```sqf
private _resultArray = _inputArray select {/*condition*/};
Is something wrong with my regex?
"Function: BIKI_fnc_parseFunctionHeader
Description:
Extracts information from the header of a CBA like function.
Parameters:
_fnc - The name of the function to parse <STRING>
Returns:
_info - __DESCRIPTION___ <__TYPE__>
Examples:
(begin example)
__RETURN__ = __ARGS__ call BIKI_fnc_parseFunctionHeader;
(end)
Author:
Terra
---------------------------------------------------------------------------- */"
regexFind ["(?<=Description:\n).*?^(?!\t)/i", 0]
// Returns: [[["",52]]]
works on regex101: https://regex101.com/r/nHkq5r/1
yes
arma regex is multiline
^ is detecting the start of the string for you
not start of line
ah
you can write it as (?<=Description:\n).*?(?:\z|^)(?!\t) I guess
that captures till the end of the string
yep no change
(?<=Description:\n).*?\n(?!\t) this would work but includes the linebreak in the capture
use (?<=Description:\n).*?$ then
but $ is end of string again, isnt it?
I don't think so 
there was some weirdness with this regex stuff back when I was working with it
I don't remember what it was 
huh you are right
oh wait that wont work with multi line descriptions
/* ----------------------------------------------------------------------------
Function: BIKI_fnc_parseFunctionHeader
Description:
Extracts information from the header of a CBA like function.
This is a test.
Parameters:
_fnc - The name of the function to parse <STRING>
Returns:
_info - __DESCRIPTION___ <__TYPE__>
Examples:
(begin example)
__RETURN__ = __ARGS__ call BIKI_fnc_parseFunctionHeader;
(end)
Author:
Terra
---------------------------------------------------------------------------- */
(?<=Description:\n).*?(?<=$)\w
what about that?
nope
(?<=Description:\n).*?$(?!\t)?
first line only again
or more generally:
(?<=Description:\n).*?$(?!\s)
then those are not tabs I guess
thats quite possible
actually now that I think about it I didn't account for the \n and \r after $
(?<=Description:\n).*?\n(?!\s) would work but includes the last new line again
Can always trim it afterwards.
well if it's just the description it won't work tho
unless that is not a possiblity/concern
what do you mean?
Description:
Extracts information from the header of a CBA like function.
This is a test.
```?
yeah that's not possible. there will always be a newline as you have to close the function header with a comment string
So this is my small testcode
_pos = getPos player;
_road = _pos nearRoads 100;
_resultArray = _road select {/*condition*/};
And this is where im getting confused ๐ This is the command I normal use for the info : "getRoadInfo _road;"
What would go into the {/condition/}; ?
oh no it doesn't work with a string from loadFile and I have no idea why
huh \n doesnt work but \r does
The condition needs to be an expression that returns true if the examined element (i.e. the examined road) should be added to _resultArray. If the condition returns false, the element is not added.
I don't know what exactly you are trying to achieve, so I can't tell you what condition you need.
One example:
(getRoadInfo _x) # 0 == "TRAIL"
```This will return `true` if the current element (`_x`) has *mapType* `"TRAIL"`.
ah ofc windows has the \n\r combo
\r\n * actually Oo
uuh sure
\n for Linux,
\r for Mac,
\r\n for Windows iirc ๐
git commits with \n right?
it depends on the repo setup
Ahh Thx ๐ Well I am trying to get an array that does not contain TRAIL. It can be "TRACK" , "ROAD" or "MAIN ROAD"
would it work like this
_resultArray = _road select {(getRoadInfo _x) # 0 == ("TRAIL","TRACK","ROAD","MAIN ROAD")};
No, this would not work for syntax reasons, but you are lucky, there is a very simple way to express your condition:
(getRoadInfo _x) # 0 != "TRAIL"
```This will return `true` if the current element has any *mapType* that is not `"TRAIL"`.
Ahhaaaaa ๐ Thank you very much for your time ansin11 ๐
I couldn't find anything in the Ace 3 Cargo Framework Wiki about how to set the name of cargo item via script. Anyone happen to know how to do this?
that's all i found on the framework so far. digging deeper
Thank you, I didn't even think about looking on github! Looking at the functions this might be what I'm looking for but I don't understand the example.
https://github.com/acemod/ACE3/blob/master/addons/cargo/functions/fnc_renameObject.sqf
i think that works from within another menu.
so that function is called when renaming something while the cargo menu is probably open or something
Ok, perhaps it's just not something that can be done outside of the menu.
This is related to #arma3_config and #arma3_model
Appreciate it sorry it was in the wrong channel
is it alright if i just copy and past my message in one of the channels?
paste*
Yes. Just remove this one
this is giving me a generic error in expresion im not sure what is wrong with it i feel blind
waitUntil {(_projectile distance _targ < 2500);};
you're probably running it in unschd env
๐คฆโโ๏ธ
Is there a quick way to remove everything but one thing from an array?
array = ["dog#1","cat#2","parrot#3","cat#9"]
I want to only keep the ones that contain the word cat, and delete everything else
Im thinking maybe regex could handle it, but im not sure. Im not finding what im looking for on Wiki's
array = ["dog#1","cat#2","parrot#3","cat#9"];
array = array select {"cat" in _x};
And its ok if there is other words or numbers following "cat"?
yeah. in checks if the string is in another string, wherever that is
Awesome ill give this a shot, thankyou so much!
I want to align the vehicle according to the road direction. But itยดs like 50/50 on tanoa.
Anyone have a better solution ?
_pos = getPos player;
_road = _pos nearRoads 100;
_array = _road select {(getRoadInfo _x) # 0 != "TRAIL"};
_availRoads = selectRandom _array;
_nextRoads = roadsConnectedTo _availRoads;
_selectedroad = selectRandom _nextroads;
_spawnpos = getPos _selectedroad;
_car = "B_Quadbike_01_F" createVehicle _spawnpos;
_direction = _car getDir _selectedroad;
_car setDir _direction;
hint format ["vehicle at %1", _direction];```
Hey guys. I need some help scripting live feed helmet cameras, and an orbital UAV. My mission is set up so you play as an officer who chill in a command center, while you use high command to order around 3 assault groups, but Iโve tried everything and canโt get live feed to broadcast to the screens in my command post. Help pls ๐
don't crosspost please. I removed your message in #arma3_scenario, as it is more relevant in here #arma3_scripting.
Got it
I'm trying to spawn a wrecked Xian transport, with this command createsimpleobject; a3\air_fexp\vtol_02\vtol_02_vehicle_f.p3d;
I keep getting "Invalid number in expression" there's no extra spaces and there's no special characters. What have I done wrong?
is there a way to make AI automatically use ACE revive?
or is it just built into ACE?
https://ace3mod.com/wiki/feature/medical-ai.html seems to imply so
its already built in when they reach a safe state. you can force this safe state if you want
here is your related function
https://github.com/acemod/ACE3/blob/master/addons/medical_ai/functions/fnc_isSafe.sqf
@fair drum is that also going to revive downed units
your calculations are wrong
Thx for answering:-). Can you specify what part is wrong ?
well first of all you're doing _car getDir _selectedroad. that gives the dir relative to the car, but you need the absolute dir. tho in this case that's not a problem because the initial dir of the car is probably 0, so the rel dir will become absolute
but the real problem is that you're measuring the direction between the centers of the road segments. that's not the same as the road dir.
Imagine these are two connected road segments, and the x marks are the road centers:
___x___
|
x
|
the dir between the two x's is not the same as either road dir.
you should get the beginning and end pos of each road segment instead. getRoadInfo already provides that info
https://community.bistudio.com/wiki/onPlayerDisconnected
"Use playerDisconnected or HandleDisconnect instead in Arma 3."
playerDisconnected -> "Executes assigned code when client leaves the mission in MP. Stackable version of onPlayerDisconnected. "
What means Stackable in that content ? If you have multiple mods using the same EH ?
yes
thanks ๐
Q: trying to find the docs on if CONDITION ... the CONDITION part, specifically in how code blocks are evaluated. Are they lazily evaluated? i.e. after all other conditions have been determined? I have a use case something like this, for instance:
if (_condA && !(_condB || _condC) && { [] call MY_condD; }) then {
// ...
};
Or similarly:
if (...) exitWith {
true;
};
if (a && b && c && d) then {}; // all are evaluated, even if a is false
if (a && { b && { c } }) then {}; // b gets evaluated if a is true, c gets evaluated if a & b are true
The problem is that I โcopiedโ the code from that page, albeit with the file I was looking for and still it returned with the invalid number error
what's the code?
inj1BV = "Blood Volume = 5.5L";
inj1HR = "Heart Rate = 48";
inj1BP = "Blood Pressure = 86/74";
inj1Skin = "Skin is pale, cool, and sweaty";
inj1Vitals = [inj1BV, inj1HR, inj1BP, inj1Skin];
//Base values
op1 = false;
op2 = false;
call {
if (op1) exitwith {
inj1BV = "Blood Volume = 4.9L";
inj1HR = "Heart Rate = 56";
inj1BP = "Blood Pressure = 81/77";
inj1Skin = "Skin is pale, cool, and sweaty";
inj1Vitals = [inj1BV, inj1HR, inj1BP, inj1Skin];
};
if (op2) exitwith {
inj1BV = "Blood Volume = 5.4L";
inj1HR = "Heart Rate = 42";
inj1BP = "Blood Pressure = 67/58";
inj1Skin = "Skin is pale, cool, and sweaty";
inj1Vitals = [inj1BV, inj1HR, inj1BP, inj1Skin];
Is there a more optimised way of updating these variables?
you could save save the values as a variable instead:
inj1BV = 5.5;
inj1HR = 48;
inj1BP = [86, 74];
// ...
_txtInj1BV = format ["Blood Volume = %1 L", injBV];
//...
_txtInj1BP = format ["Blood Pressure = %1/%2", inj1BP select 0, inj1BP select 1];
Thanks Terra!! Iโll definitely do this ๐
This did the trick ```sqf
_info = getRoadInfo _selectedroad;
_dir = (_info select 6) getDir (_info select 7);
_car setdir _dir;
Thx for helping ๐ Now I just need to fugire out how to make the vehicle direction random
random 360 
Ahh I men facing either left or right on the _selectedroad I figure random swap between _dir = (_info select 6) getDir (_info select 7); and
_dir = (_info select 7) getDir (_info select 6); Is that possible in the same command ?
you can just randomly add the dir to 180
_dir = _dir + selectRandom [0, 180];
thx man. Im not very good at this but I like learning ๐
So I put this in the vehicle init or where? Sorry real noob here
yes. but I am unsure about locality
_randomElement = selectRandom [1,2,3];
if (_randomElement == 0) then
{
playSound3D [getMissionPath "1.ogg",vehicle player,false,vehicle player,1,1,10,0,true];
};
if (_randomElement == 1) then
{
playSound3D [getMissionPath "2.ogg",vehicle player,false,vehicle player,1,1,10,0,true];
};
if (_randomElement == 2) then
{
playSound3D [getMissionPath "3.ogg",vehicle player,false,vehicle player,1,1,10,0,true];
};
what errors here? .rpt no erros
factorise```sqf
private _sound = selectRandom ["1.ogg", "2.ogg", "3.ogg"];
playSound3D [getMissionPath _sound, vehicle player, false, vehicle player, 1, 1, 10, 0, true];
selectRandom [1, 2, 3] but "if 0 1 2" ๐
it's absurd how much i learn just by watching what goes through this channel
my brain expands ๐ง
Same. This channel is an amazing resource. I'm very appreciative of the people here who actively help
arma 3 unironically teaching me coding techniques
Not sure why sound is not played,
whole script basically adds sounds of tank gun reloading,
hint and reloading works great
https://community.bistudio.com/wiki/playSound3D
vehicle player addEventHandler ["Fired",{
_this spawn {
if (
_this select 5 == "rhs_mag_M829A3" or
_this select 5 == "mkk_125mm_SABOT_MAG" or
_this select 5 == "mkk_1Rnd_KE_shells" or
_this select 5 == "mkk_mag_bm25_2_1" or
_this select 5 == "mkk_1Rnd_85mmHEAT_D5" or
_this select 5 == "mkk_1Rnd_105mm_HEAT_MP_T_Green")
then {
hint "ะะตัะตะทะฐััะดะบะฐ 6 ัะตะบ";
private _sound = selectRandom ["1.ogg", "2.ogg", "3.ogg"];
playSound3D [getMissionPath _sound, vehicle player, false, vehicle player, 1, 1, 10, 0, true];
sleep 6;
vehicle player addMagazineTurret ["rhs_mag_M829A3",[0]];
vehicle player addMagazineTurret ["mkk_125mm_SABOT_MAG",[0]];
vehicle player addMagazineTurret ["mkk_1Rnd_KE_shells",[0]];
vehicle player addMagazineTurret ["mkk_mag_bm25_2_1",[0]];
vehicle player addMagazineTurret ["mkk_1Rnd_85mmHEAT_D5",[0]];
vehicle player addMagazineTurret ["mkk_1Rnd_105mm_HEAT_MP_T_Green",[0]];
}; };}];
That condition 
how do i get "<STRING>" to be displayed in structured text? i know that a non-breaking-space can be displayed as   but what is the code for < and >?
welp it was < and >
thanks @distant oyster !
You're welcome @distant oyster
don't mention it @distant oyster
is this the official site for html chars? https://dev.w3.org/html5/html-author/charref in that case I would add it to the Biki
private _sound = selectRandom ["1.ogg", "2.ogg", "3.ogg"];
playSound3D [getMissionPath _sound, vehicle player, false, vehicle player, 1, 1, 10, 0, false];
dunno why sound isn't played, same - no .rpt erros
no sould if i get out from vehicle
I don't understand?
Try to adjust the volume, maybe
private _sound = selectRandom ["1.ogg", "2.ogg", "3.ogg"];
playSound3D [getMissionPath _sound, vehicle player, false, vehicle player, 5, 1, 10, 0, false];
And the distance as well, that also affects the volume it seems
if it's just to be heard in the interior have you considered using playSound locally for the crew?
Because the target is the vehicle you're in, the sound is played from the center of the vehicle, so if youre too far away from the center it might just be too quiet for you to hear. But if you increase the distance so you can hear it, people outside of the vehicle would easily be able to hear it. playSound locally for the crew is probably a better option, as artistan recommended
player addAction ["<t color='#FF0000'>This Useless Action Is RED</t>", {playSound3D [getMissionPath "1.ogg", vehicle player, false, vehicle player, 5, 1, 10, 0, false];}];
not working even, seems like issue with arma 3 compatibility with audio file/codec.
I mean vehicle player should work while player is on own foots, isn't?
You need to define the sound in a config, for example description.ext. See the playSound wiki page, the syntax for playSound is different from playSound3D
playSound3D [getMissionPath _sound, vehicle player, false, vehicle player, 5, 1, 10, 0, false];
playSound3D [getMissionPath _sound, vehicle player, false, getPosASL vehicle player, 5, 1, 10, 0, false];
๐คฆ๐ผโโ๏ธ
https://community.bistudio.com/wiki/Multiplayer_Scripting if you are making an MP mission
@little raptor thanks for continuing supports and updates for advances dev tools
i don't load other tools now, yours does everything i need
where are the sound files located?
everything works ok now, just wrong parameter - position of sound "vehicle player" vs "getPosASL vehicle player"
may I ask why you are playing a 3D sound for armor interior?
wouldn't the sound continue to play at that location if you move the tank?
no, but its okay, i could make sound 1km+ and local only, so no issue here
at that point why not use playSound?
it quite literally just plays the sound in the player's ears
anyone got the syntax for hold action, condition:
checking distance between two objects
so if x is close to y then its visible, otherwise the action is hidden
trying to get a truck to be able to load an object when close
Hey so i'm trying to make a CUP cdf vehicle service point function the same way it did in arma 2 with you just simply driving up to the object and you'd be refueled and rearmed.
I know the script exists but as to where to find it i'm kind of lost
How do i let my friend into my private server?
The code on the page: createSimpleObject a3\armor_f_beta\apc_tracked_01\apc_tracked_01_rcws_f.p3d This returns "Missing ;"
my code: createsimpleobject; a3\air_fexp\vtol_02\vtol_02_vehicle_f.p3d; This returns "Invalid number in expression"
forgetting quotes, and no ; between createSimpleObject and the string
see https://community.bistudio.com/wiki/createSimpleObject for the proper syntax, it takes an array
ty everyone, made thru playSound, everything works great
(Abrams gunning very sexy)
https://www.youtube.com/watch?v=Kfr3AB5wxeo
Is there a way to spawn helicopters in a height, without using setPos or setPosASL?
note that the sounds only remains on the created spot if the tank isโฆ moving!
cRRRosspost ๐
createVehicle
Because when I set the position with setPos the helicopter has some weird behavior
The create vehicle does not have a way to set an height?
Yeah sorry i am just not sure whicht thread is the right one for questions like that
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
use setPosASL or setPosATL
this does not change helicopter's behaviour
The create vehicle does not have a way to set an height?
it has, the position array's 3rd value
When I set the Pos via setPos the helicopter just wont fly to an waypoint and make weird circles for some weird reason
I sit on this problem for like 3 days and if I am not using setPos the helicopter is flying normally
I also tried using setPosASL, that was the way I tried it the longest time
createVehicle = position: Object, Array format Position2D or PositionAGL - desired placement position
that's not setPos or anything, the issue is most likely the waypoint's altitude
create it at the wanted altitude, use flyInHeight or flyInHeightASL, and set the waypoint's altitude around that flight altitude (it is +/- 200m distance completion iirc)
Okay weird, I will try that but i am sure i have done that last time
Okay so I have tried to set the 3rd value in create vehicle and it just spawned 50 meters above ground
And also with setPos asl and the waypoint in the height of flyheight the helicopter begins to circle around. He does not do that when I am not using setPosASL but then it takes ages to get to the height I want it to be
Okay, is there a way to set the engine of the helicopter immediatly to on? Because if I am not using the FLY in
_veh = createVehicle["O_Heli_Light_02_dynamicLoadout_F", getMarkerPos ["marker1", true] , [], 0, "FLY"];
the helicopter gets spawned in the height but with engine off. When I am using engineOn
_veh engineOn true;
He has to slowly start the engine and tumble down to the ground
I am having lots of issues with my model.cfg. When I use pboProject all it says is "model.cfgs for this pbo have errors". This is for a mask I am making. I am using a slightly edited model.cfg from the character template just like how Sokolonko used in his video tutorial. Only hint as what may be wrong is when I try and view the mask in Object Builder after making the model.cfg I get a error that says " File P:a3+MGR+\Cyborg\Cyborg Mask\model.cfg, line 161:/CfgModels/: 'W' encountered instead of '{' ". After I go back and check my model.cfg and check there is nothing for line 161. I tried simply putting a "{" in the line and it did nothing. Confusing thing is it worked fine in the video I am following along with. I am able to bring up the model in Object Builder if I delete the model.cfg and the model.cfg.bak. Does this sound familiar to anyone? I feel I should mention it is in the same folder as the model.
heyo, how would I go abouts creating a script to play an audio file on loop until the player is out of trigger?
I was assuming maybe something like
params [
['_play', false]
]
while {
_play
} do {
playSound 'cfgSounds_Class';
}
then call it with something like this?
true call 'file.sqf'
But is this feasible for multiplayer?
It should also stop playing once the player leaves the trigger right?
And finally the loop wont start again until after the sound file from playSound has finished playing right?
@boreal parcel
"then call it with something like this?"
-no
"But is this feasible for multiplayer?"
-no
"It should also stop playing once the player leaves the trigger right?"
-no
"And finally the loop wont start again until after the sound file from playSound has finished playing right?"
-no
lots to unpack in your question, but we are very far off from where you need to go currently
so you need to read up on multiplayer locality, while loops (specifically how fast they run, which is why you need to have a sleep in there somewhere), the return of playSound and how we can get around it so it doesn't double play
cause currently, you have:
a while loop with no sleep which will attempt to run every frame, which will create a new sound every attempt, that will stack
gotcha, yeah I dont have much experience scripting with arma/sqf, I guess I was used to the language handling the majority of that. Well thanks, ill take a look into that in a few and probably come back here once ive made some progress and get stuck on something else
playSound returns an object, so it can be checked for its existence using isNull
there's your work around
heyo, I havent researched it yet I just finished some things up, but now that I think about it would a while loop even be the proper way to play what could be considered a music file? Its meant to be like ambient gunfire/explosions that play's until the user/s finish whatever task they have inside that trigger
you can also script the explosions yourself and prevent damage as seen here avoiding sound files all together:
https://youtu.be/DC5804EHqQQ?t=68
thats a good idea, could I script the ai to simply fire at a certain target? I tried this doTarget target1; this doFire target1 in the units init field however they didnt care to shoot at the targets lol
take a look in the function viewer for the tracer module to see how to do that. its complicated, but you can do an easier version
right, I seen the tracer module as well but I dont think I was able to get it to fire, however ill look into that as well. Im sure some googling will get me an answer there
i meant actually look at its function to see how it is written
use "FLY", it is the only way
Hi, I want to playSound while BIS_fnc_blackOut, however blackout is suppressing the sound volume, playMusic is not an option. Any suggestions around this?
sounds aren't layered so there is no way to e.g. mute the environment and play a sound on top
I've already found a bypass. I used cutText with "BLACK OUT" and "BLACK IN" options as well as empty text field. This works pretty much the same as fnc_blackOut but didn't suppress any sounds at all.
Lou's lying
. Use setVehiclePosition and setPos (ATL/ASL) commands to achieve I guess
ah yeah, true ๐
Is it possible to make it look for 1 more thing to filter out ? it already filters the maptype (0) but I would like to add isBridge (8) which returns either true or false ?
Hello! Question
I'm trying to randomize unit (bob) location within a specific marker, but he always spawns in the middle of the "marker1". So I guess my use of BIS_fnc_randomPos is wrong...
This is what I tried to do
[bob SetPos getMarkerPos "marker1"] call BIS_fnc_randomPos
What is wrong?
!quote 5
stop using 'setPos' for the love of god
Leopard20; Tuesday, 10 August 2021
you send setPos result to the function, this is why @pale glacier
stop using 'setPos' for the love of god ๐คฃ
So what is recommended to use?
setPosATL, setPosASL, setPosWorld depending on your needs ๐
I just need them to spawn randomly within a marker area.
I guess I also should use findSafePos?
bob setPosATL (["marker1"] call BIS_fnc_randomPos);
What is this? ๐ค
https://imgur.com/6P1eEI3
Don't worry about the marker name, I changed it to "mark1"
getMarkerPos "mark1" instead "mark1"
nonono
bob setPosATL ([["marker1"]] call BIS_fnc_randomPos);
```my bad, it's an array of arrays
though a lie implies an intention to deceive ๐ one can tell a wrong info without meaning to harm!
Works! Thanks a lot guys, now I can rebuild my brain again after I melt it down
๐ป
Q about BIS_fnc_traceBullets, will it trace submunitions?
I am trying to see if my submunitions are working as intended and it would be nice to see visually ๐
But when I use setPosASL the helicopter has some weird behaiveur, even when the waypoint is in the same height as setFlyHeight. It just begins to circle weirdly
Should I post a video of what I mean? Thanks anyway for trying to help me. I am stuck on this problem for like 3 days or so and its just really frustrating ._.
afaik no
Thanks
flyInHeight doesn't use the same format as ASL
waypoint is in the same height as setFlyHeight
waypoint should be on the ground afaik
@little raptor LouMontana said yesterday that it has to be on the height of the flyheight, but it does not matter, same behaivor in both cases. The helicopter flys 50 meters forward and then starts circeling. It does that everytime I use setPos in different forms (ASL ATL)
is the waypoint too close to the helicopter?
It is like 2km away
what is your code?
_flyHeight = 1000;
_missionStartPos = [3400,8000,_flyHeight];
_dropPointPos = [3436.58,3779.73,_flyHeight];
_dropPointHigh = [(_dropPointPos select 0), (_dropPointPos select 1), (_flyHeight + 100)];
_marker1 = createMarker ["marker1", _missionStartPos];
"marker1" setMarkerPos _missionStartPos;
_veh = createVehicle["O_Heli_Light_02_dynamicLoadout_F", _missionStartPos , [], 0, "FLY"];
createVehicleCrew _veh;
_vehGroup = (group _veh);
sleep 0.1;
_veh flyInHeight _flyHeight;
_veh enableCopilot false;
_veh lockDriver true;
_driver = driver _veh;
_driver disableAI "FSM";
_driver disableAI "Target";
_driver disableAI "AutoTarget";
while {(count (waypoints _vehGroup)) > 0} do {
deleteWaypoint ((waypoints _vehGroup) select 0);
};
_vehGroup setBehaviour "CARELESS";
_vehGroup setSpeedMode "NORMAL";
_vehGroup setCombatMode "GREEN";
_veh setPosASL _missionStartPos;
[allplayers, {player moveInCargo _veh}] remoteExec ["call", 0];
_wp0 = _vehGroup addWaypoint [_missionStartPos, 0];
_wp0 setWaypointSpeed "NORMAL";
_wp0 setWaypointType "MOVE";
_wp0 setWaypointBehaviour "CARELESS";
_wp1 = _vehGroup addWaypoint [_dropPointPos, 0];
_wp1 setWaypointSpeed "NORMAL";
_wp1 setWaypointType "MOVE";
_wp1 setWaypointBehaviour "CARELESS";
_wp2 = _vehGroup addwaypoint [_missionStartPos, 0];
_wp2 setWaypointSpeed "NORMAL";
_wp2 setWaypointType "MOVE";
_wp2 setwaypointbehaviour "CARELESS";
_trgEject = createTrigger ["EmptyDetector", _dropPointHigh];
_trgEject setTriggerArea [800, 50, 180, false];
_trgEject setTriggerActivation ["ANY", "PRESENT", false];
_trgEject setTriggerStatements ["(thisTrigger getVariable 'veh') in thisList","{_x execVM 'scripts\halo.sqf';} forEach allPlayers;", ""];
_trgEject setVariable ["veh", _veh];
[allplayers, {player moveInCargo _veh}] remoteExec ["call", 0];
this is wrong
createVehicleCrew _veh;
_vehGroup = (group _veh);
you can combine these:
_vehGroup = createVehicleCrew _veh
_trgEject setTriggerArea [800, 50, 180, false]; _trgEject setTriggerActivation ["ANY", "PRESENT", false]; _trgEject setTriggerStatements ["(thisTrigger getVariable 'veh') in thisList","{_x execVM 'scripts\halo.sqf';} forEach allPlayers;", ""]; _trgEject setVariable ["veh", _veh];```
this trigger is pointless. waypoints have completion statements
_dropPointPos = [3436.58,3779.73,_flyHeight];
again you should try this at height 0. not sure if it matters for helicopters, but it sure matters for infantry
_veh setPosASL _missionStartPos;
also this is wrong too. flyInHeight is AGL, not ASL
_veh setPosASL AGLtoASL _missionStartPos;
that's the correct version
_flyHeight = 1000;
also this is too high for helicopters afaik
The same problem exists on 200 or 500
The I put the _dropPointPos back on the ground but the helicopter also circles, it is really weird
Thank you for the tipps, I am pretty new to sqf and it can be quite frustrating
This is the behaiveur I am talking about, maybe someone knows that
https://youtu.be/tZ8VeBTNg8k?t=19
looks very similar to the drones bug. there was a workaround for this but I don't remember what it was
wrong channel, try #arma3_config
ty
Is there any way/addon to make server side http requests?
im not sure where to start searching, but i know a respawn point can appear when synced to a trigger and the trigger activates without having to write any script
is it possible to accomplish this when i for example sync a unit to a trigger?
so maybe like run a script in the init of the unit which waits until the trigger its synced to is activated
an extension (dll) could be a thing, see #arma3_tools perhaps ๐
And so what should happen when the trigger activates?
If windows is sufficient, and you only need basic GET/POST without auth or custom headers..
https://github.com/dedmen/DAA_Mod/blob/main/main/XEH_preStart.sqf#L6 request
https://github.com/dedmen/DAA_Mod/blob/main/main/fn_extensionCallback.sqf#L51 handle result
https://steamcommunity.com/sharedfiles/filedetails/?id=2622792308 workshop
Thanks, I want to put an API between the server and the database so I can integrate with other apps, this is a start
If you have many result handlers. I recommend a hashmap<string, code>
don't do the if mess that I did ๐
Done exactly the same, wrote a common extension component that gives you a way to map function names to handlers.
https://github.com/ArmaForces/Mods/blob/master/addons/extension/functions/fnc_setHandler.sqf
https://github.com/ArmaForces/Mods/blob/master/addons/extension/XEH_preInit.sqf#L10-L24
https://github.com/ArmaForces/Mods/blob/master/addons/extension_attendance/XEH_preInit.sqf#L12-L27
i was thinking like syncing a unit with an arsenal script to the trigger and the unit stays hidden until the trigger activates
but now that i thought about it it might be kind of a flawed idea
Does that also work in any context returning a BOOL evaluation? i.e. select? thanks...
yes
the key here is the BOOL && CODE operator overload (as opposed to BOOL && BOOL)
it has nothing to do with if/select/etc.
Don't know if you found this but using https://community.bistudio.com/wiki/Arma_3:_Diagnostics_Exe
and "Shots" diag_enable true;
you can have a massive amount of more info then traceBullets including submunitions.
