#arma3_scripting
1 messages ยท Page 740 of 1
sir I owe u a drink
been having this problem for a long time and you just helped me ton. i tred using remoteExec but I was using it wrong from what I see. TY so much!
np
there are remoteExec examples pinned in this channel
maybe you can understand them better than the wiki
will keep that in mind for the future
https://sqfbin.com/pegomalitohiyiwahazo
this is my code, and the result is in this pictures:
https://imgur.com/a/oKc51cT
I've succeeded in creating vehicles, but they keep blowing up as soon as they're created. How can I fix this problem?
#arma3_scripting message
this also applies to you
So.. I should use remoteExecCall?
as for how to call a code unscheduled, use isNil
isNil { //this block of code will always run unschd
_veh1 = createVehicle ["Blabla", [0,0,0], 0, [], "CAN_COLLID"];
_veh2 = createVehicle ["Blabla", [0,0,0], 0, [], "CAN_COLLID"]; //spawning two vehicles into each other?! wtf?!!!!
//but it's unschd, so don't worry
_veh1 setPosASL _newPos1; //no explosion
_veh2 setPosASL _newPos2; //no explosion
};
no
@past wagon that code is relevant to you too. ๐
wdym?
well you must declare your variables outside the isNil scope ofc (if you want to use them after the isNil)
ok
params ["_taskN", "_missionArea"];
_aaList = [
"min_rf_sa_22",
"min_rf_sa_22_desert",
"O_APC_Tracked_02_AA_F",
"O_T_APC_Tracked_02_AA_ghex_F"
];
_aaVehicle = _aaList call BIS_fnc_selectRandom;
_rdPosition = [_missionArea, _aaVehicle] call AS_fnc_getRandomPos;
_vehicleRaw = nil;
_vehicle = nil;
isNil {
_vehicleRaw = [[0,0,0], 0, _aaVehicle, EAST] call BIS_fnc_spawnVehicle;
_vehicle = _vehicleRaw select 0;
_vehicle setPos _rdPosition;
};
(allPlayers select 0) setPos (getPos _vehicle);
_taskName = format ["task%1", _taskN];
_vehicle setVariable ["task", _taskName];
_vehicleName = getText (configFile >> "CfgVehicles" >> _aaVehicle >> "displayName");
[
BLUFOR,
_taskName,
["asdf", format ["asdf %1", _vehicleName], "asdf"],
getPos _vehicle,
"CREATED",
_taskN,
true,
"destroy",
true
] call BIS_fnc_taskCreate;
// _MNtasks = missionNamespace getVariable "tasks";
// missionNamespace setVariable ["tasks", _MNtasks append [_taskName]];
_vehicle addEventHandler ["Killed", {
_vehicle = _this # 0;
_taskName = _vehicle getVariable "task";
[_taskName, "SUCCEEDED"] call BIS_fnc_taskSetState;
}]
it's my code now
and the same problem happens
_vehicleRaw = nil;
_vehicle = nil;
that's not how you declare variables.
private ["_vehicle", "_vehicleRaw"]; //you don't use _vehicleRaw after the isNil tho, so just remove it here
setPos
just forget about this broken command
private ["_vehicleRaw", "_vehicle"];
isNil {
_vehicleRaw = [[0,0,0], 0, _aaVehicle, EAST] call BIS_fnc_spawnVehicle;
_vehicle = _vehicleRaw select 0;
_vehicle setPos _rdPosition;
};```
the same thing happens..
are you sure your code even creates the vehicle?
i.e are you sure _vehicleRaw is not empty?
Best way to move an item from a container/inventory to ground?
there's no best way
sure. that's why I put (player) setPos blabla
So spawning then
there's only 1 way
remove the item, create a weapon holder, and add a new item to the weapon holder
you've written
(allPlayers select 0)
which is also...
either _vehicleRaw is empty, or the error is something else entirely
there's no other way that code could generate an error
there's no error
wat? then what's the problem?
it just blows up as soon as it's created
I told you not to use setPos
setPosASL is not working either
params ["_missionArea", "_vehicleName"];
_missionPos = getPosATL _missionArea;
_emptyPositions = _missionPos findEmptyPosition [0,150,_vehicleName];
_emptyPositions```
this is _rdPosition
that's an AGL pos
oh
did you mean ATL?
no
ASLW?
I meant AGL
just use createVehicle
I'm not sure what that function uses
that makes empty vehicle
you can just try with:
_vehicleRaw = [_rdPosition, 0, _aaVehicle, EAST] call BIS_fnc_spawnVehicle;
and no setPosXXX
you can create the crew yourself
_vehicleRaw = [_rdPosition, 0, _aaVehicle, EAST] call BIS_fnc_spawnVehicle;
that's what I did
but you didn't wrap it in isNil
private ["_vehicleRaw", "_vehicle"];
isNil {
_vehicleRaw = [_rdPosition, 0, _radarVehicle, EAST] call BIS_fnc_spawnVehicle;
_vehicle = _vehicleRaw select 0;
};```
not working
just use createVehicle then
like I said I don't know what that function uses
_vehicle = createVehicle [_radarVehicle, _rdPosition];
createVehicleCrew _vehicle;
use isNil?
It didn't make error, but the same problem is being repeated
13:52:53 [ACE] (repair) INFO: O_T_APC_Tracked_02_AA_ghex_F: hitcomturret no selection: using armorComponent hit_com_turret
13:52:53 [ACE] (repair) WARNING: [O_T_APC_Tracked_02_AA_ghex_F: hitcomturret: hit_com_turret] armorComponent does not exist?
13:52:53 [ACE] (repair) INFO: O_T_APC_Tracked_02_AA_ghex_F: hitcomgun no selection: using armorComponent hit_com_gun
13:52:53 [ACE] (repair) WARNING: [O_T_APC_Tracked_02_AA_ghex_F: hitcomgun: hit_com_gun] armorComponent does not exist?
13:52:53 soldier[rhs_msv_driver]:Some of magazines weren't stored in soldier Vest or Uniform?
13:52:54 [ACE] (repair) INFO: O_APC_Tracked_02_AA_F: hitcomturret no selection: using armorComponent hit_com_turret
13:52:54 [ACE] (repair) WARNING: [O_APC_Tracked_02_AA_F: hitcomturret: hit_com_turret] armorComponent does not exist?
13:52:54 [ACE] (repair) INFO: O_APC_Tracked_02_AA_F: hitcomgun no selection: using armorComponent hit_com_gun
13:52:54 [ACE] (repair) WARNING: [O_APC_Tracked_02_AA_F: hitcomgun: hit_com_gun] armorComponent does not exist?```
are you even sure your position is safe?
that's just ACE warning
hmmm
I don't know because I can't see it
draw an icon or something
or just use my mod:
https://steamcommunity.com/sharedfiles/filedetails/?id=2369477168
it allows you to draw icons very easily
then it's not surprising that it explodes
I think it's just giving you a generic position that can fit an object of that size.
but it's not accurate
because the object orientation and stuff are not accounted for
ยฏ_(ใ)_/ยฏ
you can try this:
isNil {
_vehicleRaw = [[0,0,0], 0, _aaVehicle, EAST] call BIS_fnc_spawnVehicle;
_vehicle = _vehicleRaw select 0;
_rdPosition = [_missionArea, _vehicle] call AS_fnc_getRandomPos;
_vehicle setVehiclePosition [_rdPosition, [], 0, "NONE"];
};
@quasi condor fixed the error in the code
actually nvm
uh
change that function to:
params ["_missionArea", "_vehicle"];
_missionPos = getPosATL _missionArea;
_emptyPositions = _missionPos findEmptyPosition [sizeof _vehicle * 0.6, 150, typeOf _vehicle];
_emptyPositions
and this is the spawn code:
isNil {
_vehicleRaw = [[0,0,0], 0, _aaVehicle, EAST] call BIS_fnc_spawnVehicle;
_vehicle = _vehicleRaw select 0;
_rdPosition = [_missionArea, _vehicle] call AS_fnc_getRandomPos;
_vehicle setVehiclePosition [_rdPosition, [], 0, "NONE"];
};
I edited this btw
nvm that's not what radius was anyway... ๐
radius: Number - Start searching no closer than radius from the center
I thought that's the safe distance
just use the old one
oh this was interesting:
switch (tolower _sim) do {
case "soldier": {
_veh = _grp createunit [_type,_pos,[],0,"none"];
};
case "airplanex";
case "helicopterrtd";
case "helicopterx": {
//Make sure aircraft start at a reasonable height.
if (count _pos == 2) then {_pos set [2,0];};
_pos set [2,(_pos select 2) max 50];
_veh = createVehicle [_type,_pos,[],0,"FLY"];
};
default {
_veh = createvehicle [_type,_pos,[],0,"none"];
};
};
didn't know you can have fallthrough in SQF
_rdPosition = [_missionArea, _aaVehicle] call AS_fnc_getRandomPos;
private ["_vehicleRaw", "_vehicle"];
isNil {
_vehicleRaw = [[0,0,0], 0, _aaVehicle, EAST] call BIS_fnc_spawnVehicle;
_vehicle = _vehicleRaw select 0;
_rdPosition = [_missionArea, _aaVehicle] call AS_fnc_getRandomPos;
_vehicle setVehiclePosition [_rdPosition, [], 0, "NONE"];
};```
it's my code now
why do you calculate _rdPosition twice? 
it's the same code
the only part that was different was this
which as I said was wrong
so I didn't change anything in getRandomPos
you can try this function:
https://community.bistudio.com/wiki/BIS_fnc_findSafePos
there's also:
https://community.bistudio.com/wiki/BIS_fnc_randomPos
It's FINALLY working now. ty so much
Good day. Can someone share, how do you check if object is indeed a building? I get lots of false-positive checks with
_obj isKindOf 'Building'
And I though it would work to additionally check
(count (_obj buildingPos -1)) > 0
But quickly found out that bag bunkers have zero buildingPos'es =_=
checking their simulation could work I guess
Like simulationEnabled ? It can be disabled
tho it only works if the object has a config
getText(configOf _obj >> "simulation") == "house"
Nope, sandbags and razor-wire barrier giving false positive
they're not buildings anyway 
afaik they're either thing or thingX
I can not send a screenshot here, but they are both 'Buildings' according to Arma (=
All -> Static -> Building -> NonStrategic -> Land_Razorwire_F
what are you trying to do with it anyway?
Sort objects by groups. Need that for my other scripts. And buildings are the only pain in the arse (=
well what kind of groups?
[_buildings,_decorations,_units,_vehicles,_turrets,_mines]
I don't see how you managed to get "decorations" working but have trouble with buildings 
but in any case, the only thing that separates different object types is their simulation
I didn't ๐ 'decorations' are just 'everything else'
another thing you can use is their editor category
it's still unreliable but at least it's mostly "correct" if it exists (since it involves UX, unlike classes and simulations)
๐ค Sounds promising, also I could combine both checks. So.. how do I get that?
is there a way i can add diffrent magazines to infantry? i was hoping to make a bolt action into a grenade launcher etc
add diffrent magazines to infantry
i was hoping to make a bolt action into a grenade launcher etc
what do these two have to do with each other?
anyway, you can do that using FiredMan EH
just remove the projectile and create your own instead
was thinking glg ammo from like a mx glg or something idk
do you by any chance know how? or point me the right direction, im really bad with this lmao (NVM im blind i see it now)
Hello, I'm very new at Mission making and trying to setup a shop for a Mission with some mates.
I found a very cool way of Showing the Price of the shop by using "Draw3D"
addMissionEventHandler ["Draw3D", {
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "Pistol Mag:5$", 1, 0.05, "PuristaMedium"];
}];
Is there anyway I can bind this to only show if Object found = Type of container? And or only run in Trigger Location.
So Once in "Shop" It checks to see if you're looking at a Shop Container then Pops the Text up?
you can run a process to check if the player is within the defined area and add or remove the draw3d missioneventhandler accordingly
If the shop area is a circle:
G_ShopCenter = [100,100];
G_ShopRadius = 50;
[] spawn{
private _ID = -1;
waitUntil{
waitUntil{((player distance2d G_ShopCenter) <= G_ShopRadius)};
_ID = addMissionEventHandler ["Draw3D", {
if(cursorObject isKindOf "WeaponHolder") then{
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "Pistol Mag:5$", 1, 0.05, "PuristaMedium"];
};
}];
waitUntil{((player distance2d G_ShopCenter) > G_ShopRadius)};
removeMissionEventHandler ["Draw3D", _ID];
FALSE
};
};
if it's a polygon:
G_ShopVertices = [
[100, 100, 0],
[100, 150, 0],
[150, 100, 0],
[150, 150, 0]
];
[] spawn{
private _ID = -1;
private _Pos = [];
waitUntil{
_Pos = getPosWorld player;
_Pos set [2, 0];
waitUntil{(_Pos inPolygon G_ShopVertices)};
_ID = addMissionEventHandler ["Draw3D", {
if(cursorObject isKindOf "WeaponHolder") then{
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "Pistol Mag:5$", 1, 0.05, "PuristaMedium"];
};
}];
waitUntil{not (_Pos inPolygon G_ShopVertices)};
removeMissionEventHandler ["Draw3D", _ID];
FALSE
};
};
to have the text only show up when pointing at a weapon holder, make use of the cursorobject and iskindof commands
Wow this amazing, how exactly do I plug this in? Do I need it in a file or?
well that code is client side, so just paste it in the initPlayerLocal.sqf
Sweet man thanks
this script should keep the ai on place, stance and watch dir, and makes the next unit after teamswitch the squad leader. while it does what it should, i am not able to get around the watch direction thing. those lines are commented https://pastebin.com/xJ8AfY3y
this disableAI "Move";
got an error
type group expected object?
Error disableai: Type group, expected object
what happens with the watch direction?
where are you running that?
@still knoll cause i like to keep the ai that i switch from to recive the stop command
so the only thing left i need is: keep the unit i switch from away in its watch direction.
they stand as they should but mostly they just watch random directions
ha. i need the direction from the last controlled unit and give it back to the last controlled unit, after team switch
i guess thats precise.
private _player = cameraOn;
waitUntil {
uiSleep 0.5;
cameraOn != _player;
};
[missionNamespace, "mn_PlayerChanged", [cameraOn]] call BIS_fnc_callScriptedEventHandler;
[] spawn mn_fnc_generic_handlePlayerChange;
is there any errors here?
so the _previousUnit just stays in that position?
can't look around?
you might want to use some disableAI then
since you only got a single simple condition in the waituntil, you can afford to run a check eachframe
waitUntil{ (cameraOn != _player) };
only if
- you run it in unscheduled
- != comparing with objNull is iffy
- no mn_PlayerChangec eh was added beforehand
mn_fnc_generic_handlePlayerChangeis undefined
How do I make the AI not have eagle vision?
hey @distant oyster how did you find that "ACE_isUnconscious" thing?
is there a list of ace stuffs somewhere?
I want to add blood to my player
i went through the ace functions
where
thanks
This is my first time meddling with anything like this
I'm trying to make custom pylons for a plane and I've managed to currently change one of the pylons I want but I do not know how to add multiple of them to be changed
_this setPylonLoadout ["pylons7" , "FIR_GBU12_P_2rnd_M" , true] <---- this works so far but I want to add
["pylons4" , "FIR_GBU12_P_2rnd_M" , true] ; as well and I am too stupid to understand how to do it
Just use setPylonLoadout again?
Is there a way to have a Trigger Constantly Running the Command whilst someone is inside.
I have it as Repeatable. But for someone to Repeat they must Leave the Trigger, and Re-enter.
Is there a Way to keep repeating it every second?
hi, this is my code: https://sqfbin.com/garejozijinoduyebeme
when I run this code, it makes error. the error content is "_tasks, _taskNames are undefined".
I spent 3 hours. but I couldn't fix this. how to fix this problem?
can someone help me i keep getting this error resource MyDialog.hpp not found
check description.ext
my description.ext is fine i think this is what i got in there
#include "MyDialog.hpp"
missionNamespace setVariable ["taskNames", _taskNames append [_missionName]];
```You don't have a proper value for `setVariable` here because the `append` command does not return anything, it just silently modifies the array.
https://community.bistudio.com/wiki/append
Trying to get Specific Text to show IF I target a Certain Item. I.e One Gun will show "100$" Another might show "25$"
addMissionEventHandler ["Draw3D",
{
if("Weapon_AM_VarmintRifleOld" == typeOf cursorObject } > -1) then{
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "Varmint 100$", 1, 0.05, "PuristaMedium"];
}
{
if("AM_M1911" == typeOf cursorObject } > -1) then{
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "M1911 25$", 1, 0.05, "PuristaMedium"];
}
Thats as close as I can get after hours
what do '_vehicle emptyPositions "driver"' and 'driver _vehicle' return if the driver is dead?
The if-statements are a little off. This is what they should look like:
if ("Weapon_AM_VarmintRifleOld" == typeOf cursorObject) then {
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "Varmint 100$", 1, 0.05, "PuristaMedium"];
};
```The code could also be simplified, just ask here if you want to try that.
Doesnt seem to work, no Error but not showing
ty
Also I'd love to Simplify it, I have Zero experience with coding.
Oh I see, theres no Loop, once I ran it while looking at the rifle it Showed. But only for a Split Second
while {true} do {
if ("Weapon_AM_VarmintRifleOld" == typeOf cursorObject) then {
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "Varmint 100$", 1, 0.05, "PuristaMedium"];
};
};
That works perfectly, How do I clean it up?
Do you know how to use the Debug Console?
Huh if what you mean is Type in the "Extended Debug Console" and then hit "Local Exec" and hope it works yes
Can you look at one of your weapons and run typeOf cursorObject in the Debug Console? I have a suspicion that the result will be "GroundWeaponHolder" instead of "Weapon_AM_VarmintRifleOld".
Says - "Weapon_AM_VarmintRifleOld"
I got it to work with the While statement. But I when I tried to add another IF for another weapon, it bugged out
while {true} do {
if ("Weapon_AM_VarmintRifleOld" == typeOf cursorObject) then {
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "Varmint 100$", 1, 0.05, "PuristaMedium"];
}
if ("FOW_WG_US_M1911" == typeOf cursorObject) then {
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "M1911 25$", 1, 0.05, "PuristaMedium"];
};
};
I assume theres a better method than running 10+ If statements but Im not sure what other there is
I am surprised (and now I don't have an explanation why it doesn't work without the while) 
It does and doesnt, It just doesnt Repeat.
If I run it Looking at it, it'll Flicker infront of me for a split second.
But never Re-checks if Im looking at it
The Draw3D EH executes its code (i.e. your if-statements) every time the game renders a frame. Thus, a loop is not necessary (in fact, it is bad).
huh, well it doesnt keep looping without it, so im confused
It loops fine without the If statement
But with it, it just stops
Which loop do you mean?
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "M1911 25$", 1, 0.05, "PuristaMedium"];
That alone keeps going in its own loop
But if I put an IF statement on it, It just goes once, And then stops
Can you post the whole code?
while {true} do {
if ("Weapon_AM_VarmintRifleOld" == typeOf cursorObject) then {
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "Varmint 100$", 1, 0.05, "PuristaMedium"];
}
};
Ahhhh
looks like a switch case
oooo Thats cool, So basically a bunch of IFs but instead a Switch nice
draw instructions should be in onEachFrame if not EH
What I meant was adjust the if-statements as shown in my example, not replace the whole code ๐ So it should be like this:
addMissionEventHandler ["Draw3D", {
if ("Weapon_AM_VarmintRifleOld" == typeOf cursorObject) then {
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, "Varmint 100$", 1, 0.05, "PuristaMedium"];
};
if ("AM_M1911" == typeOf cursorObject) then {
...
};
}];
Oh yes it works
Had to clean it up, but awesome. SO my concern is. How do I limit it to an Area. Like a Shop.
Also would running 10-20 Ifs be laggy?
probably should would be cleaner to use table of #define instead of all that repeated code.
or pull from config
Do you want to look into the area limit or the simplification first?
is there a way to list like [("Weapon_AM_VarmintRifleOld","100$"),("AM_M1911","25$")]
and if 1st matches then show the second?
Whatever is the correct workflow XD
if you are pulling from a particular config entry only one draw is needed, using variables with the data
e.g. _aspect1 = getText (configFile > ...); drawIcon3D[...,_aspect1,...]
Huh, that looks very confusing
So we are comparing the Active cursorObject with a Config and if it matches it pulls a String??
what is "Varmint 100$"
That is a Description of how much the "Weapon_AM_VarmintRifleOld" Rifle should cost
So when you look at it "Varmint 100$" Comes up as thats how much that Item is
where is it stored?
that value
init file
Indeed there is.
WeaponPrices = createHashMapFromArray [
["Weapon_AM_VarmintRifleOld", "100$"],
["AM_M1911", "25$"]
];
addMissionEventHandler ["Draw3D", {
private _targetClass = typeOf cursorObject;
private _price = WeaponPrices getOrDefault [_targetClass, ""];
drawIcon3D ["", [1,0,0,1], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, _price, 1, 0.05, "PuristaMedium"];
}];
yeah hashmap is good
oh yessssssss thats awesome
ahah1!! It works!! Yesss
Okay so how do we Limit its range near a "shop". Cause I ASSUME having this running all the time. Bad
Once the player enters the shop area, you add the Draw3D EH, and once the player leaves the shop area, you remove the EH again.
Yes.
So I make a Trigger zone and attach that to it? How exactly do I turn on EH and OFF?
Yes, that is one option: A repeatable trigger (not server-only) using player in thisList as its condition, with ShopPricesEH = addMissionEventHandler [...]; in its On Activation and removeMissionEventHandler ["Draw3D", ShopPricesEH]; in its On Deactivation (the createHashMapFromArray part can stay in the init file).
Or you can follow that suggestion and write an endless loop that does the same as the trigger I described. There's not much difference, triggers are also loops ๐
tbh i think it is easiest to use onEachFrame { if (_isPlayerInArea) then { call drawStuff } } instead of EH
So regarding to the InArea
the Example shows this
_playerIsInside = player inArea _myTrigger
what part is actually linked to the Init file? cause im confused how it gets back to the Config
From what I read '_example' is a Local variable
Easy yes, but not good. Using onEachFrame is not good practice and checking every frame is a huge waste, once a second is probably enough.
Im gonna up the trigger, I dont need 0.5 at all
so
Condition
player in thisList
On Activation
ShopPricesEH = addMissionEventHandler [...];
On Deactivation
removeMissionEventHandler ["Draw3D", ShopPricesEH];?
however you can also use a divisor in onEachFrame to do it manually
A2OA. Is there a way to get a driver to quickly switch to the gunner seat?
Looks familiar to me ๐
You'll find that coding in triggers (thinking of the On Activation expression where the bulk of your code is) is not comfortable at all, so if you want, you can make a separate addShopPricesEH.sqf file with the ShopPricesEH = addMissionEventHandler [...]; code and then run that file from the trigger's On Activation with execVM "addShopPricesEH.sqf";.
btw the trigger timer itself is still checked each frame
Okay I messed up somewhere
I made a new sheet called "AddShopPricesEH.SQF" Like you suggested it contains
addMissionEventHandler ["Draw3D", {
private _targetClass = typeOf cursorObject;
private _price = WeaponPrices getOrDefault [_targetClass, ""];
drawIcon3D ["", [1,0,1,5], ASLToAGL getPosASLVisual cursorObject, 0, 0, 0, _price, 1, 0.05, "PuristaMedium"];
}];```
the init.SQF Contains
```sqf
if _playerIsInside == true then {
WeaponPrices = createHashMapFromArray [
["Weapon_AM_VarmintRifleOld", "100$"],
["FOW_WG_US_M1911", "25$"]
];
}
Condition
player in thisList
On Activation
execVM "addShopPricesEH.sqf";
On Deactivation
removeMissionEventHandler ["Draw3D", ShopPricesEH];
The code in addShopPrices.sqf is missing the ShopPricesEH =.
The code in init.sqf is broken by the if-statement, all you need there is WeaponPrices = createHashMapFromArray [...];.
Fixed the Init file, What do you mean by its Missing ShopPricesEH=
It needs to be ShopPricesEH = addMissionEventHandler [...];.
ooooh
OOOH
Omg
It works
โค๏ธ
Ive been at this for over 8 hours
its 11 am and I havent slept
Thank you so much
Let me try to stump everyone. What lod does ai use for visibility in network play?
Objects have graphic replacements at greater distance, so either visibility always uses specific one for each object or there is a mystery.
In my test AI visibility is very close to the rendered model.
But the model changes at distance, so what happens then...
looks like im wrong about arma 3 lod looking at the wiki
it is in fact used for calculations
looks like which LOD is visible to the ai is configured by the model's author
im sure there are modders here who can share how ai spotting works
A2OA. Can anybody explain why the following only sometimes works? About half the time the unit gets in as gunner, but then immediately gets out again, and goes back to the driver's seat. dostop _vehicle; _vehicle forcespeed 0; player sideChat "wiating for vehicle to stop"; waituntil{ sleep 1; (!alive _vehicle) || { ((abs(velocity _vehicle select 0)) < 0.01) && {(abs(velocity _vehicle select 1)) < 0.01} } }; player sideChat "driver getting out"; _vehicle setVehicleLock "UNLOCKED"; doGetOut _unit; unassignVehicle _unit; _unit setVariable ["AM_BUSY", true]; _unit disableAI "AUTOTARGET"; sleep 3; player sideChat "getting back in as gunner"; _unit action ["getInTurret", _vehicle, _turret_path]; _unit assignasgunner _vehicle; sleep 5; _unit enableAI "AUTOTARGET"; _unit setVariable ["AM_BUSY", false]; _vehicle forcespeed -1; _vehicle stop false; };
VIEW LOD. everywhere and not just "network play"
no
So there is one model selected for that in config. Makes the most sense.
there are also 2 other things that affect AI visibility. particles, and grass (which is just factor of distance from the ground, depending on grass type)
I guess smoke is a particle.
yes
no
i tested that a few days ago
the visibility is non zero, but extremely low
0.0005 approx
the smoke works very accurately to the graphic
better do the unassigning part unscheduled
IS there a way to make the ai instantly switch seats?
moveOut/moveInXXX
if I do that pair inside of an unscheduled environment, will they function correctly?
also, is it necessary to assign as gunner?
in A3 it does at least
in A3 I don't think so
does the vehicle need to be stopped ?
no
I've switched to this code, but the same problem remains. About a second after entering the gunner seat, he is booted out, and tries to get back in as the driver. isNil { _vehicle setVehicleLock "UNLOCKED"; moveOut _unit; unassignVehicle _unit; _unit moveInTurret [_vehicle,_turret_path]; _vehicle setVehicleLock "LOCKED"; };
SL must be assigning him to that seat.
Is there a way to prevent that?
You tried assigning each crew to specific seat?
The scenario is the gunner is killed in combat, and the driver is to take his place.
so that a truck with a .50 call isn't uselessly driving around without a gunner
isNil {
_unit leaveVehicle _vehicle;
moveOut _unit;
_unit moveInTurret [_vehicle,_turret_path];
};
what about this?
I'll test, just a minute
maybe unassign the dead guy first
I should have said SL i ordering himto get in to the seat he is assigned, not assigning him
That does seem to do the trick. Thanks.
One other question though, about "leavevehicle", is the vehicle reassigned to the group when group members get back in it? And if not, will it still follow the leader if ordered to do so?
I mean if there were a driver in it.
is the vehicle reassigned to the group when group members get back in it
it should afaik
will it still follow the leader if ordered to do so?
not 100% sure. you should test it
It seems groups store orders for each unit, so e.g. leader barks at you to get in if you leave.
any way to get the players camera?
is it possible to run multiple countdowns at the same time?
i notice that the BIS_fnc_countdown function doesn't refer to the variable when calling for the leftover time
not the object, but you can use positionCameraToWorld and getCameraViewDirection
I don't know much about that function, but you can create your own
unfortunate, was hoping i could change the fov that way like the zoom in and out, but i guess thats why no one has made a mod for it yet ๐ฆ
I am trying to spawn a vehicle on an Editor placed object. When I spawn it in, it is inside the object and so it explodes. How would I make it so that the vehicle spawns above any objects
ah ok thanks anyway
depends
what kind of object is the bottom object?
im back again
how would i vector this from true bearing to realative bearing of the vehicle
fza_ah64_lwr_array = nearestObjects [vehicle player, ["lasertarget"], 20, false, true] apply {
_laserdir = vectorDir _x;
(((_laserDir#0 * -1) atan2 (_laserDir#1 * -1)) + 360) % 360;
};
i figured it would be laser true bearing - heli bearing
but im not sure
that + a similar modding like I did for the laser bearing
ill try it out @little raptor thanks
_laserTrueBearing = nearestObjects [vehicle player, ["lasertarget"], 20, false, true] apply {
_laserdir = vectorDir _x;
(((_laserDir#0 * -1) atan2 (_laserDir#1 * -1)) + 360) % 360;
};
fza_ah64_lwr_array = _laserTrueBearing apply {
_heliv = vectordir vehicle player;
_helib = (((_heliv#0 * -1) atan2 (_heliv#1 * -1)) + 360) % 360;
((_x - _helib) + 360) % 360;
};
hintSilent str fza_ah64_lwr_array;
im stuggling with the math a bit
wait
the -
isint meant to be there becuase i dont need it inverted
_laserTrueBearing = nearestObjects [vehicle player, ["lasertarget"], 20, false, true] apply {
_laserdir = vectorDir _x;
(((_laserDir#0 * -1) atan2 (_laserDir#1 * -1)) + 360) % 360;
};
fza_ah64_lwr_array = _laserTrueBearing apply {
_heliv = vectordir vehicle player;
_helib = (((_heliv#0 * 1) atan2 (_heliv#1 * 1)) + 360) % 360;
((_x - _helib) + 360) % 360;
};
hintSilent str fza_ah64_lwr_array;
so it works
but is there a simplified way of writing this
first of all, why do you loop twice? that's slow. do everything in one loop
fza_ah64_lwr_array = nearestObjects [vehicle player, ["lasertarget"], 15, false, true] apply {
_laserdir = vectorDir _x;
_laserB = (((_laserDir#0 * -1) atan2 (_laserDir#1 * -1)) + 360) % 360;
_heliv = vectordir vehicle player;
_helib = (((_heliv#0 * 1) atan2 (_heliv#1 * 1)) + 360) % 360;
((_laserB - _helib) + 360) % 360;
};
hintSilent str fza_ah64_lwr_array;
better?
When I use the "switchCamera _anotherPlayer" command and the _anotherPlayer player activates its night vision, do I see it too?
second of all, you said it yourself:
laser true bearing - heli bearing
I don't know what on earth is all that needless math for
_laserBearing = (((_laserDir#0 * -1) atan2 (_laserDir#1 * -1)) + 360) % 360;
_heliBearing = getDir _heli;
(_laserBearing - _heliBearing + 360) % 360
nvm it was correct
_heli = vehicle player;
_heliBearing = getDir _heli;
fza_ah64_lwr_array = nearestObjects [_heli, ["lasertarget"], 15, false, true] apply {
_laserdir = vectorDir _x;
_laserBearing = (((_laserDir#0 * -1) atan2 (_laserDir#1 * -1)) + 360) % 360;
(_laserBearing - _heliBearing + 360) % 360;
};
hintSilent str fza_ah64_lwr_array;
sorted
_heliBearing = getDir _heli;
you can put this outside the loop
hmm yes
So I'm working on map centered around ravage... the hordes I manually spawn in via script are being deleted once all players are roughly 500m away... is there anyway to stop this behavior? Units placed in 3den are not effected... only those spawned in via script
Is there a default distance that agents will be despawned?
Well I just confirmed it's an issue with agents... not sure how to prevent the default despawn behavior though
i like to add a action to a cargo hq created by BIS_fnc_ObjectsMapper and a composition.sqf. i miss the google syntax lol
the return of that function is an array of objects in the same order as it is in the input string. you have to find out the index of the cargo hq and then extract it like this:
private _objects = [...] call BIS_fnc_objectsMapper;
private _hq = _objects select *index*;
_hq addAction ...
or find the index via classname:
private _hq = _objects select (_mapperInput findIf {_x select 0 == "hq_classname"});
thx. the last i can understand, but what comes into [...]? the sqf file name?
How can I make a sort of kill count?
You kill a guy, it ticks a variable
I can figure out how to display it, but I'm not sure how to make the count part
with a missione EH EntityKilled
if you want to track a specific unit then a Killed EH should work
No I want to make it so when you kill a person or knock him unconscious through ace it will tick a number
is there a global count of units?
like total amount of AI
there is a list of allUnits which you can count with a condition:
{!isPlayer _x} count allUnits;
okay I'll just do an original count of how many units there are
then kills = original - (current alive and not unconscious)
yes?
technically yes but units may get deleted or otherwise removed from allUnits
there are events that you can subscribe to for Killed and Unconcious:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed
https://ace3mod.com/wiki/framework/events-framework.html#22-medical-ace_medical
https://cbateam.github.io/CBA_A3/docs/files/events/fnc_addEventHandler-sqf.html
In C#, you use .Where(filter) to filter down a list, what's the equivalent in bohemian?
{alive _x && !(_x getVariable ["ACE_isUnconscious", false])} is the filter
array select {alive _x && !(_x getVariable ["ACE_isUnconscious", false])}
oooh so like this
the filter goes before
weird language.
well two different commands but yeah
{!isPlayer _x && alive _x && !(_x getVariable ["ACE_isUnconscious", false])} count allUnits
this works for counting it
How do I constantly display a hint?
Also I'm not sure how to make one variable that evaluates once and another that evaluates ever second or something
for the original count, and the other for the updated one
while {true} do {
hint "hint";
sleep 30;
};
``` kind of meh. consider using cutRsc
you could create a global variable during init
okay
and for the other?
originalUnits = {!isPlayer _x && alive _x && !(_x getVariable ["ACE_isUnconscious", false])} count allUnits;
while {true} do {
hint str originalUnits;
sleep 30;
};``` this is causing a generic error in expression
that depends on what you want to do with it. but you could do another while true loop
this has to be executed in scheduled environment. where are you executing it?
the init of my player
in that case wrap it in a spawn block
@distant oyster can u maybe give me another hint? https://pastebin.com/u92KFLdF
private _mapperInput = call (compile (preprocessFileLineNumbers "compositions\base.sqf"));
private _objects = [_foundSafePos, 360, _mapperInput] call BIS_fnc_objectsMapper;
private _hq = _objects select (_mapperInput findIf {_x select 0 == "Land_Cargo_HQ_V4_F"});
_hq addAction ["skip time", {skipTime 8;}];
thx! i have managed it with that too https://pastebin.com/BD6HLyNk
how can i send another group into this arrary? _units = units _group; like _units = units group1, group2;
A2OA. Is there any way to make AI groups plot a more direct path? I have fighting between adjacent bases. And the AI tend to go way around each other in a big circle. And worse, they seem to always travel on opposite sides, so that they hardly engage each other.
i miss basic syntax, like: _units = units [Base + Heli];
ok i managed that now, but i guess thats wrong: _units1 = units Base; _units2 = units Heli; _units = _units1 + _units2;
I'm looking for a way to make ai take more direct paths between points, hopefully that doesn't involve creating a bunch of extra waypoints. Preferably a scripting solution. But I also wonder if there's a sub-skill that influences how much they try to go around.
it mostly depends on the group behavior
@drifting sky see:
https://community.bistudio.com/wiki/AI_Behaviour
I'm using "aware" to get them between objectives. However, they go as much as a km to the left or right of the center line between the objectives. They move in a clockwise fashion so that blue and opfor don't engage each other very much.
AI pathing depends on a lot of factors. behavior, terrain elevation, roads, buildings, etc. can affect it
does the "general" sub-skill influence the directness of their pathfinding?
afaik it affects how frequently the leader commands the units, and how it assigns targets
not sure about path finding
but it shouldn't affect it
While I'm talking about skills, has anybody explored what happens setting skills greater than one? I notice that doing that with aimingaccuracy seems to make AI reluctant to use certain weapons at all.
make AI reluctant to use certain weapons at all
it causes them to want to be "over-accurate"
AI only open fire when they "think" their shot will be accurate enough
Ah. That's unfortunate. I wonder if pairing that with a really high aimingshake skill would counteract that problem.
WeaponPrices = createHashMapFromArray [
["Weapon_AM_VarmintRifleOld", composeText ["Varmint Rifle 100$",lineBreak,"Mag 10$"]],
["5Rnd_556x45_Mag","10$"],
];
The sqf ["5Rnd_556x45_Mag","10$"],
Having problems with
composeText ["Varmint Rifle 100$",lineBreak,"Mag 10$"]
Any Ideas?
composeText needs structured text
not string
why do you even create a structured text anyway?
from what I can see you just need a normal string
Huh Extremely new to Coding saw on the Wiki that Linebreak is Linked to it
Just need something that allows me to Linebreak within DrawIcon3D
ah, so cant linebreak inside it?
no
Rip Cheers
you can try this:
createHashMapFromArray [
["Weapon_AM_VarmintRifleOld", format ["Varmint Rifle 100$%1Mag 10$", toString[10]]],
["5Rnd_556x45_Mag","10$"],
];
but like I said I don't think it'll work in drawIcon3D
you could also put endl instead of toString [10]
So Interesting no Error but shows all in one Line
yeah told you
if you just do copyToClipboard format ["Varmint Rifle 100$%1Mag 10$", toString[10]] in debug console
and paste it into a text editor you'll see it's correct
no it just doesn't work in drawIcon3D
Hmm. No matter what aimingaccuracy I choose, they universally aim too low by a meter or two past 600m, hitting pretty much only by ricochet. Is there any way to influence how ai compensate for bullet drop?
Hey, I am trying to make an AI look at a player with doWatch, & so it will get the position of the player (getPos), but it seems to be looking toward the player but at the ground. I remember there was something useful that allowed the ability for an ai look at the player's head, but I completely forget what it was. I was searching through the wiki and couldn't find anything so it left me in some confusion. Thought maybe it was "eyePos" but it rotates the ai head way too high (toward the sky a lil bit)
player selectionPosition "head";
this?
also eyePos returns position ASL, maybe that explains your offset?
hmm, I don't think it was that. I went ahead and tried it but it seems to rotate about 180 degrees away from the player
note that selectionPosition returns relative position
ahh gotcha
use modelToWorld to get it in AGL format
_pos = player selectionPosition "head";
_pos1 = altian_soldier1 modelToWorld _pos;
altian_soldier1 doWatch _pos1``` Like that?
_pos = player selectionPosition "head";
_pos = player modelToWorld _pos;
altian_soldier1 doWatch _pos;
like this
thanks! believe it works
How does one/can anyone send one the link for how to override a default keybind with a custom keybind, and transfer that overriden keybind to a new keybind please
Hello. I'm making a helicopter that can sling players with a rope. I tried to use ropeAttachTo, but it did not work properly. The rope was connected successfully, but when the helicopter raised the altitude, the player did not move and the rope was cut off. How can we make this feature?
https://sqfbin.com/omamidiboyupegeyafob
This is my code
Hello anyone here know how to disable ace medical damage for a certain unit while still allowing myself to detect it being hit (this is so I can make my own damage system for a certain unit)
does it work with objects
in its ability to move stuff
you can have something linked to a keybind like throw, but you cant stop the original command as far as im aware
i like to command a unit to watch a direction, like you could do it in the command menu. but if i use doWatch or commandWatch, the unit starts swinging around alot. looks stupid
Hey, can someone explain the difference between
(condition1 && { condition2 && { condition3 } }) and
(condition1 && { condition2 } && { condition3 } ), if there even is any?
i think there the same but the bottom one is the less confusing one
In the first one, there's a comparison with a nested scope, so in the end its comparing a condition with a code block thats checking if the condition compared with a nested code block returns true. The second one is comparing three conditions, 2 code blocks one command condition. Nothing nested.
iirc ๐
If I read correctly
check the ace wiki they have info on disabling it
They will always produce the same (correct) result.
The syntax is for lazy evaluation (https://community.bistudio.com/wiki/Code_Optimisation#Lazy_evaluation), but I don't know if there is a difference in terms of laziness and performance between the two expressions.
The performance is what I was wondering about though, and if one would be objectively better than the other. I guess it's got to be tested case by case :/
I'd say the first is better, otherwise the && is evaluated still
buuut it's not the big uber performance issue either
I tested it with Chinook and F/A-18. It works well.
switch (!IsNull objectparent player) do {
case (vehicle player iskindof 'wheeled') :{ hint "Is car"};
case (vehicle player iskindof 'Tank') :{ hint "Is Tank"};
case (vehicle player iskindof 'Air') :{ hint "Is Air"};
};
does anyone knows why switch command isnt working ? im not receiving any output
Aight, thanks.
nope. iskindof has no right hand argument
i would debug each variable. so:
systemchat str [!isNull objectParent player, vehicle player isKindOf "wheeled", ...]
So we can use lazy evaluation to change precedence in conditions?
a && {b || {c}} //a is false -> c is not looked at
a && {b} || {c} //a is false -> c can still make the expression true
```I have no Arma so I can't test it, but it seems like an interesting topic.
thanks it seems that i used wheeled instead of Car
well yeah I think so
1/ if a, then b or c
2/ if not a and b then c
SQF-VM confirms (if I got the input right...)
1 false && {false || {true}} // False
2 false && {false} || {true} // True
from left to right yep
If you can confirm this using A3 then I'll put it on the wiki (I don't want to base the documentation on the wiki on SQF-VM results).
I keep trying to sling people with helicopters using ropeAttachTo. However, when the helicopter takes off, the rope cuts off. Is there really no way to sling a person?
attach the rope to somehting small & invisible then use attachto to attach the person the the object
I'll send a pic of it to you in DM's
ais evaluated everytime,bis only evaluated ifais true,cis only evaluated ifais true andbis false.ais evaluated everytime,bis only evaluated ifais true,cis evaluated if eitheraorbis false(or both)
which makes the first one more efficient and second one being kinda used in a wrong way(imo)
anybody maybe have a script handy that will make an opfor blow up when they get into a certain range of a blufor?
Interesting question lads, are HashMaps serialized and meant to be saved/restored during the SP save/load process?
Yes.
Thx
can someone help me i keep getting this error resource MyDialog.hpp not found
A follow up to that.
If you have
someArray = [someInitalizedGroupVar];
and you save and load
someArray should still contain a non-null group after the load, correct?
And the same ought to be true for HashMaps as well?
Cause it isn't true for HashMaps... Please correct me if I'm wrong but this seems like a bug, yeah?
//init.sqf
TEST_D = [group player];
TEST_E = createHashMapFromArray [["test", TEST_D]];
//After running the mission in SP, saving and loading
str TEST_D == "[B Alpha 1-1]"
str TEST_E == "[[""test"",[<NULL-group>]]]"
Im quite new to SQF Scripting and the entire scripting language is quite confusing to me.. I've been looking around for if its possible to toggle an action, The Action is in "Infantry Movement" called "TactToggle"
you want to trigger a player action normaly done through keybind X right
You toggle it by pressing 2x C
:(
you cant script player input
i wish you could there is stuff i would do if i could
Rip, thanks anyways though!
how to i add a keybind to a dialog for example if i press F1 it opens a menu which i made
@Dedmen? 

I've put a ticket on the tracker for it, if it isn't just close T162726 plz ๐
https://forums.bohemia.net/forums/topic/202464-release-keyhandler-with-modificators/
then in put your code in there
case numbers can be found here https://www.altisliferpg.com/topic/968-arma-3-keybaord-case-number/
the idea is we are using an eh to check when a key is pressed and run a script, that script then checks what key was pressed and then runs an action if a certain key was pressed
in this case _myVar will be "Crazy". for other numbers it will be nil
I recommend reading this page: https://community.bistudio.com/wiki/Function#Return_Values_.28output.29
I'd like to disable thermals and of course there's the simple
addMissionEventHandler ["Draw3D",
{
if (currentVisionMode player isEqualTo 2) then
{
if (isNil "A3W_thermalOffline") then
{
"A3W_thermalOffline" cutText ["THERMAL IMAGING OFFLINE", "BLACK", 0.001, false];
A3W_thermalOffline = true;
};
}
else
{
if (!isNil "A3W_thermalOffline") then
{
"A3W_thermalOffline" cutText ["", "PLAIN", 0.001, false];
A3W_thermalOffline = nil;
};
};
}];
Does this need to be executed globally, or is it enough to execute on server only?
Ie how do addMissionEventHandlers scope and propagate (if they propagate)
you're using player so it should be executed on all players
addMissionEventHandler has local effect
Thanks
Is it possible to create a (server)mod purely on linux, or do I always need windows?
I suppose it comes down to being able to pack a .pbo?
Hey y'all, recently got a server up and running, I load into the server just fine, I get passed the database and spawn in. I shut down the server, go look in the database and my name or UID is not there. Anyone know a possible cause or issue for that?
Most likely something to do with my @life_server correct?
anyone knows a script that toggles on and off invisibillaty neeed it it for my admin menu
Is the test for nil of "A3W_thermalOffline" required here?
hmm, though I suppose it's more efficient
can someone help me i keep getting this message Resource MyDialog.hpp not found
this means that there is no class MyDialog in the description.ext
i did i put in description.ext #include "MyDialog.hpp"
player hideObjectGlobal !(isObjectHidden player)
and you reloaded the config correctly?
what do you mean reload the config my bad i am a bit new to this stuff
When is the magic variable "hasInterface" set?
Ie when I check the value, can I count on it not changing in the future?
it should be always there and should also be constant
Just to make sure, there's no else if?
nope
but there is switch do case
Thanks
call {
if (blabla) exitWith {};
if (blabla) exitWith {};
if (blabla) exitWith {};
}
If in a script I define some function like NAMESPACE_fnc_KillPlayer = { player setDamage 1; }; on the server, and I intend to transmit this function to players via remoteExec, there's no reason to compileFinal the variable as it's precompiled by the script engine?
Also, how are variables handled when remotexec'd?
I assume that any function referenced by client must also have been broadcasted to the client
it is bad practice; use CfgFunctions and save the network
Nah, I specifically don't want to create clientmods
That's wrong. If player is not in a vehicle it always says "is car"
That's not a magic variable. That's a command
That's true
I don't think the "final" property is broadcast with it
Compile expression and makes it final, preventing it from:
repeated compile or compileFinal
removal by nil
remote rewrite using publicVariable, publicVariableClient and publicVariableServer
I know
I'm saying if you broadcast it it won't be final for others (afaik)
it should be
Have you tried it?
i think i saw something somewhere on the wiki mentioning it
https://community.bistudio.com/wiki/compileFinal
When broadcasting a compileFinal'ed variable using publicVariable or its variants, the variable also becomes final on the other client(s) and/or the server. Also, compileFinal does not prevent event handlers from being removed or overwritten.
Ah well there it is
if player exists once, will it exist always?
If I'm executing code on a client that hasInterface, can I check once for the existence of player ?
Or do I need to keep continuously checking for it before executing code that requires player?
Hmm, I suppose I could wrap the code in a try catch
If I define a function like NAMESPACE_fnc_Stuff = { ... }; and then I
addMissionEventHandler [event, expression, arguments];
is NAMESPACE_fnc_Stuff here a variable that I can directly put into expression, like addMissionEventHandler [event, NAMESPACE_fnc_Stuff, arguments]; or do I need to wrap the name in quotation marks?
Like addMissionEventHandler [event, "NAMESPACE_fnc_Stuff", arguments];
What am I missing here? This doesn't generate an ellipse marker:
_hordeArea = createMarker [format["horde_%1_area", _hordeCount], _zone];
_hordeArea setMarkerShape "ELLIPSE";
_hordeArea setMarkerAlpha 1;
_hordeArea setMarkerColor "colorOPFOR";
_hordeArea setMarkerSize [500,500];
_hordeArea setMarkerBrush "FDiagonal";
But this generates the opfor infantry marker:
_hordeMarker = createMarker [format["horde_%1", _hordeCount], _zone];
_hordeMarker setMarkerType "o_inf";
_hordeMarker setMarkerAlpha 1;
_hordeMarker setMarkerColor "colorOPFOR";
_hordeMarker setMarkerSize [1,1];
welp, this one is driving me nuts... I have no doubt I'm missing something simple again
The marker will be visible only once at least markerType has been defined:
_marker = createMarker ["markername", player]; // Not visible yet.
_marker setMarkerType "hd_dot"; // Visible.
hmm, maybe not.
Yeah, pretty sure that doesn't apply when making an ellipse or rectangle
add a private? private _hordearea = createMarker [format["horde_%1_area", _hordeCount], _zone];
already defined as private
๐
private ["_hordeLogic", "_hordeMarker", "_hordeCount", "_zedTypes", "_zeds", "_hordeSize", "_hordeSpawns", "_hordeArea"];
that's old style though.
No change
It's just weird because the code for _hordeMarker is immeidately following and it works fine
wat? what does it have to do with that?
idk thought it could help...
I assumed I was missing some necessary line to make the marker work but even using the basic example is not working
must be something somewhere else in my code
yup, do systemChat str _zone and systemChat str _hordecount and see if they're defined properly.
well I mean like I said, I use them for _hordeMarker and it shows up just fine
hmm yes.
@vapid drift I don't see anything wrong with that code. but try changing the color and maybe brush
use colorRed for color
and if that still doesn't work use DiagGrid for brush
see if it makes any difference
Ok, I'll give it a shot... was taking this screenshot:
https://i.imgur.com/KdDBHHZ.png
The ellipse should be at the exact same spot
There's no conflict putting markers at exactly the same spot is there?
Also, no dice on the recommended changes
are you sure that marker name is unique?
That's exactly what's happening! lol. Not the spot but the name is the same
No, the name is not the same
you're just overwritting the 1st one.
you can't overwrite markers
yes it is, the variable is different, but the marker name is the same: [format["horde_%1_area", _hordeCount], _zone];
duplicate marker names will just fail
wat?
it's not the same
horde_%1_area and horde_%1 are the same?
createMarker [name, position, channel, creator]. Name is the same
As far as I can tell, the name is unique... if the naming scheme is working for the "o_inf" marker, it SHOULD be working for this? I mean _hordeCount increases everytime a horde is placed
second is overwriting 1st
just do systemChat str _hordeArea
ah horde_area shit, im blind.
if it's "" your marker was not created
ah yeah, good call
where did you see ""?
duplicate marker names will just fail
there's no marker type. markers are strings
and failed markers are ""
oh ok
Forgive my ignorance but do I have to load all the way in to see the systemChat?
It should show at the briefing screen right?
yes, but you must put a short sleep there
also why are you testing like that?
just use the debug console ๐
... yes I knew that I was just seeing if you did
All joking aside, how would I test that in the console if it's a private and, for all intents and purposes, temporary variable?
_hordeArea = createMarker [format["horde_%1_area", 1000], getPosASL player];
_hordeArea setMarkerShape "ELLIPSE";
_hordeArea setMarkerAlpha 1;
_hordeArea setMarkerColor "colorOPFOR";
_hordeArea setMarkerSize [500,500];
_hordeArea setMarkerBrush "FDiagonal";
you just have to confirm if it works
I don't have access to _hordeArea outside of that code... but that's ok, I can confirm it another way
the marker name is stored on the _zone
ye, he's saying Debug Console doesn't accept _underscore variables.
wat?
just copy paste this into the debug console and hit enter
i think...
it does
but only in its own scope
with spawn?
every code you execute has its own scope
Ah... I did discover an issue though, the variable the name is stored on returns null
doesn't matter if it's call or spawn or ...
what variable?
The code DOES work though
after I create the _hordeArea and _hordeMarker they're stored on the _zone itself:
_zone setVariable ["STY_RVG_zedNest_hordeArea", _hordeArea, true];
checking that after I spawn in returns null though
https://pastebin.com/ all code?
what's _zone?
a placed logic
runs this in it's init:
["initZone", [this, 500]] call STY_RVG_fnc_zedNest;
where are you executing this anyway?
Every placed zone runs this in it's init
do logics even have a var space?
create a temp logic
name it temp
check this in debug console:
temp setVariable ["blabla", 1];
temp getVariable ["blabla", -1];
if it returns -1 it doesn't have a var space
I can run that if you'd like but I can assure you they do... virtually my entire system depends on this
but check it anyway
ah crap... wrong part
post this whole code somewhere
wait
There we go
https://sqfbin.com/vegesobuhehovunujuxu
If I remoteExec with jip enabled
where's the rest of it?
You sure you want the whole thing?
yes
I don't need the server mission event handler for player connected if I were to do the same thing anyways?
like you've said before... rip the bandaid off
Ie I can just remoteExec with jip enabled, nice
there's no defined _zone there yet ๐
_arguments params
there
problem solved
lol
?
what do you mean?
nice
there's no variable _arguments defined anywhere
where did you even get it from?
argh yes standby
just remove it
params [
["_zone", objNull, []],
["_radius", 0, [0]],
["_zero", false, [true]]
];
lol dude, no
also why on earth do you pass nil as default value in params?
either pass an actual default value, or just don't give it a default value
[ "_arguments", nil
this is nonsense
like I said, either give it the correct default value
or nothing at all
i.e either:
params [["_args", [], ...]]
or
params ["_args"];
Relax, I've got to learn someway... rest assured I won't make that mistake again
I'm pretty sure I thought in order to define default values for the others, I had to define them for all
but that's a simple fix
in order to define default values for the others, I had to define them for all
no
Do I understand correctly: by default arma servers allow clients to remoteExec anything on the server?
Wait, if the wiki article says https://community.bistudio.com/wiki/Arma_3:_CfgRemoteExec that it only applies to clients
how do I disable clients being able to remotexec on server?
What's the preferred way to execute on all players?
looping through them?
Yes I have that open
i think they're blocked by default
remoteExec target can be an array
Host player can be server
0 then?
oh... my gosh
That would execute on server even if it was not a player
hmm... so both host and dedicated use?
[0, -2] select isDedicated
๐คฆโโ๏ธ
I changed the location of the function files on the description.ext... but was still editing a file in an old location
disregard the last 30 minutes but thank you for the criticism (seriously)
So how would that work, remoteExec ["fnc", [0, -2] select isDedicated]; ? isDedicated does not take arguments unless that's some undocumented feature?
I'm not giving it any arguments
sqf arguments always go on the right first (if unary/binary)
then on the left (if binary)
Is this relying on the default [] being interpreted as 0?
wat?
no
[0, -2] is array
select selects index
isDedicated is bool
false = 0
array select expression returns an array. isDedicated always returns either true or false
true = 1
returns the element
No, it doesn't.
not an array
Syntax 6
Syntax:
array select expression
Parameters:
array: Array
expression: Code - expression that is expected to return Boolean or Nothing. If true is returned, the original array value of currently tested element _x will be added to the output array
Return Value:
Array - a new array of all elements from the original array that satisfied expression condition
what expression?
it's a bool
expression: Code
gah
I'm a veteran. I know what I'm talking about
that code is correct
that's not the correct overload
look at syntax 2
Yeah I saw it
My distaste for sqf is always increasingly monotonic
heyo, im trying to use a script I found but it doesnt seem to be working out. Im getting an error Undefined variable in expression: _this
Could anyone explain why its doing that?
Im calling it like so: 0 = [] execVM "lights.sqf";
_onoff = [_this, 0, 0.95, [0]] call BIS_fnc_param;
_distance = [_this, 1, 1000, [0]] call BIS_fnc_param;
_marker = [_this, 2, getMarkerPos "lightsmarker", ["",[],objNull]] call BIS_fnc_param;
_types = ["Lamps_Base_F", "PowerLines_base_F","Land_LampDecor_F","Land_LampHalogen_F","Land_LampHarbour_F","Land_LampShabby_F","Land_NavigLight","Land_runway_edgelight","Land_PowerPoleWooden_L_F"];
for [{_i=0},{_i < (count _types)},{_i=_i+1}] do
{
_lamps = _marker nearObjects [_types select _i, _distance];
sleep 0.1;
{_x setDamage _onoff} forEach _lamps;
};
what century is that script from?! 
anyway, it expects you to pass arguments to the script
but as far as I can see you are ([] execVM "lights.sqf")
so that error makes no sense
I want to say 2014 lol, is there possibly an existing/working script for turning off all lights in a certain radius?
wasn't there an eden module for that already? 
really? I know of a flashlight module but lemme look
I'm not sure. I'm not a mission maker so I don't mess with Eden a lot
but I seem to recall there was one
anyway, if there's none, here's a slightly modified version of that script:
params [
["_onoff", false, [false, 1]],
["_distance", 1000, [0]],
["_marker", getMarkerPos "lightsmarker", ["",[],objNull]]
];
_types = ["Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F"];
_dmg = [0.97, 0] select _onoff;
_lamps = nearestObjects [_marker, _types, _distance, true];
{
for "_i" from 0 to count getAllHitPointsDamage _x -1 do
{
_x setHitIndex [_i, _dmg];
};
} forEach _lamps;
No 3DEN Module.
Might be in ZEN...
yeah im not seeing a module with that specific purpose in mind however ill try out this script real quick
just execute it like so:
[1, 1000, getMarkerPos "lightsmarker"] execVM "lights.sqf"
also you need a marker named lightsmarker
(you can also pass a position or object)
Could also use switchLight instead of setDamage if you dont want them falling over.
https://community.bistudio.com/wiki/switchLight
true. I was just looking at the wiki to find that command and replace it ๐
damage 1 destroys the entire pole, needs 0.95
Hello, how can I add a logo for my mod instead of the puzzle piece? ๐งฉ
btw, KK has posted another script right under it that does this
using mod.cpp
Ill check that out
https://community.bistudio.com/wiki/Mod.cpp/bin_File_Format
Might help you out.
@boreal parcel fixed this to use KK's code in that wiki page. execute it like this:
[false, 1000, getMarkerPos "lightsmarker"] execVM "lights.sqf"
If you didnt already have it
rog this works great, thanks. Now I have another question if you dont mind, some lights seem to survive, probably due to it not being in the array of lights, how would I go about getting the class name of buildings with built in lights?
Ah thank you very much
dunno. you probably have to do it visually
I don't think there's a config property that says "this object has a lightpoint" 
yeah I understand that lol, I mean where would I even go to find the needed class name? or would it just be fine to throw in the building class name the light is on?
btw changed this one more time
just in case
try it again with the changes
see if it fixes your problem
gotcha
PowerLines_base_F
Straight to the source, eh?
just put yourself in front of it, and execute typeOf cursorObject in debug console
that'll give you its classname
So
Could technically check for a config property like spotableNightLightsOn = 4;, though I'm not sure if it's ALWAYS going to be in the config of lights
didn't know that 
https://i.imgur.com/uRXDfSi.png
Still looking for anything else, but these are in the config of "Lamp_LampStreet_small_F"
It's a thermal imaging disable enable thingy
spotableNightLightsOn is configured to All though, right?
thanks for all the help so far but sadly it didnt, ill see if the debug command you mentioned gives the needed class
spotableNightLightsOn is if AI can see it or not, IMO
I'd like feedback on: what should I do better or differently
You could be right
and of course if there are issues about it not working
EMIL_fnc_ServerMissionEventHandlerForPlayerConnectedToManagePlayerThermals that seems big 
It is ๐
Might be able to check for the Reflectors class inside of the object is empty or not then, seems like it handles the actual light sources
does it also exist for buildings with lights?
I've been created it from almost scratch/ that code for the past 6 hours lol
Not entirely sure, I don't know many buildings with lights
Can check if you have a class
just try a few you know 
Lmao alright I'll poke around
like those Altis two story ones
Oh, interesting, s/stuff/etc/ works straight from the messageline
@little raptor could you give a quick feedback on the code? Anything that you think is bad or should be done differently I would really appreciate
ah I seem to have cut a line
ah works fine if I just shove in the class name of the building with lights not turning off
yes, just add it to the _types array in that code
Oh? Let me know what you find.
Sadly I've hit the "I can't run Arma without feeling depressed" stage... Again.
too messy. not in the mood to read
long variables are not good for net code (and memory?)
can you even read this variable?!
EMIL_fnc_ServerMissionEventHandlerForPlayerConnectedToManagePlayerThermals
Easily
I thought that was a joke variable? ๐คท
They are sent only once, cost of memory is not an issue, sqf is compiled by the engine
nah ๐
a good variable name is one where you can read it easily, fast, and descriptive
It's all that
Just a quick mockup, turns the lights off and returns a list of what it tried to turn off/on in a 2D radius
_position = getPos player;
_radius = 250;
(nearestObjects[_position,[],_radius,true]) select {
if (isClass (configFile >> "CfgVehicles" >> typeOf _x >> "Reflectors" >> "Light_1"))then{
_x switchLight "OFF";
true
} else {
false
}
};
what properties does Light_1 have?
Could be faster/more detailed if its needed, but the concept is there
Basically it's listed in "Reflectors". If it has spawned lights, "Light_1" will always exist
an alternative is count (configFile >> "CfgVehicles" >> typeOf _x >> "Reflectors") != 0
but again that has false positives
Oh does it?
"Reflectors" are used on vehicles too, no?
I thought he said all lights, my bad then lmao
also could be used for other stuff too maybe? or is it just light emitters?
It selects headlessclients, so it's not correct
wtf are you talking about? that was never the question
Thank you for that, proved me wrong in thinking that arma is consistent with the "Light_1" lmao.
It was, you just didn't read the question
Emil, add an hasInterface somewhere
Here, you also quoted that with "remoteexec can be an array"
But yeah now thinking about it, the state is probably not advertised from the getgo so it would have to be queried anyways
So in the end Leopard's answer is pretty good ; )
He means that the target array can be an array
Wot?
Yes? That's exactly the context?
Anycase, unless this info is exposed directly, perhaps via the BIS function to list all players (after mapping to netids), it has to be queried
Anycase anycase, thanks for helping out, I know we noobs are annoying ๐ฉ
Good night
gn
if you moveInCargo a bunch of units to a vehicle with simulation disabled, do the units also have their simulation disabled until vehicle simulation is enabled?
try it ๐
Anyone know how to change the voice/language of a faction or side in a mission?
you have to do it for every created unit.
https://community.bistudio.com/wiki/setSpeaker
hello. i am new to scripting, could someone help me with something?
Is there an easy way to collect all items in a weapon holder? (Including container items in the weaponholder & the items in them, such as vests and weapons)
Whaaaa? It's the phronk!
Anyway... Is nearSupplies any use?
If I remember right, the command also returns units, so some filtering will be required.
@untold copper nearSupplies returns the weaponholders but does not collect all items in it. Before I go through the asspain of writing a function to do all that, it'd be nice to know if there's a BIS_fnc or something that does it lol
i have this running after an IF statement:
(currentWeapon _unit) setObjectTextureGlobal [0, _rifleTexturePath];
i have verified that this is the only place that the issue occurs, and by all metrics it appears that the currentWeapon is simply not what i should be using here. what should i be doing instead? i have also tried primaryWeapon but that did not work either.
Ah.
I've been through the functions a lot but I don't recall seeing anything like that.
You may need to get typing I'm afraid. ๐ข
you can't retexture weapons
You can't use setObjectTexture on weapons.
oh, at all?
oof
time for plan b then lmao
Use getObjectTextures to test.
If [] or "" is returned then you're out of luck.
thank you very much
What is plan B?
item swap, copying magazine and capacity, scope, muzzle, and flashlight
it's for a modular camo system within the optre unit i run
Ah. Complete weapon swap... With smart magazine and attachment check?
yeah
thankfully i won't be the one writing that, as i have no idea how i would do it
this was just my attempt at lobotomising something we used for backpacks
am i allowed to post videos in here?
I've no idea. I've never seen videos here.
well i can't post them here so i would assume not lol

we've gotten the rest of the scripting sorted for helmet, backpack, vest, and uniform
rifles were a stretch goal, and we've already rolled the script out to the unit
Is this PVP? Or PVE?
The AI still sees all right? ๐
until i get the active camoflage script working on our stealth armour 
thankfully that's only accessible to special forces
or else it would be quite the overpowered tool
I can't seem to use setCombatBehavior, even with copy and pasted snippets from the wiki, it always complains about missing ;
try behaviour?
nope :/
code plz
well direct copy paste obviously wouldn't work as variables are generic on wiki
need the edit on the unit(s) too
yeah i did that
this setCombatBehaviour "SAFE"; will work on a units init for sure.
{
enemyU1 = enemyG1 createunit ["rhsgref_ins_specialist_aa",[2682.64,7306.46,0], [], 0, "NONE"];
}]```
trying to get respawning enemies but I notice they only respawn once
yes, because that created unit does not have the event handler
also, I see no setCombatBehaviour
โฆthank you
I meant in your code
oh yeah right
{
enemyU1 = enemyG1 createunit ["rhsgref_ins_specialist_aa",[2682.64,7306.46,0], [], 0, "NONE"];
enemyU1 setCombatBehavior "CARELESS";
}]```
if you delete/comment the line, does it still pop up?
does the enemyG1 group exist?
it should as that's the variable name of the group the guy is in
the unit wouldn't spawn otherwise
are you even on the right version of the game?
what's your game version?
_list = position player nearObjects ["missileBase", 2000];
hintsilent str _list;
returns this
[300: vorona_missile_he_fly.p3d,299: vorona_missile_he_fly.p3d]
im getting this as an output but im not sure how i would turn these into objects i can check stuff for
so im wanting to get an object or class name from this to check the cfg for manual control
you need to look in cfg ammo
https://community.bistudio.com/wiki/configOf might work, i'm not sure though
_list = position player nearObjects ["missileBase", 2000] apply {
_config = typeOf _x;
_config;
};
hintsilent str _list;
copyToClipboard str _list;
["ace_metis_HEAT","ace_metis_HEAT","ace_metis_HEAT"]```
evan better
well you said "check the cfg for manual control"
configOf gives you the config, you can then use stuff like getText getNumber etc, to differentiate
or you can use typeOf and check classnames instead
iv managed to get that far now but iv now run into the issuie of ace overriding the guidance
and i cant find it
do setMissileTarget objNull or something? https://community.bistudio.com/wiki/setMissileTarget
it dosent change the fact ace override the cfg
and manual control dont exist anymore
isClass (_cfgAmmo >> "ace_missileguidance")
getDir
I asked on the Slack chat for ACE Medical but not sure if that's going to be the price place... anyone know if you can identify when a player is carrying a wounded unit or when a unit is being carried?
get relative bearing of incoming bearm/laser riding weapons
still need to work the conditions and try optimise
_config = typeOf _x;
_manualControl = getText (configFile >> "CfgAmmo" >> _config
but just use configOf like i told you previously?
Heya, can anyone point me to a resource on how to script for the communication menu (https://community.bistudio.com/wiki/Arma_3:_Communication_Menu ) ?
Or even an existing script/mod that uses it extensively, so that I can learn by example.
Anyone got a method for accessing the Voice Over Net used in A3? What I would like to do is to get access to the audio somehow and send that to Discord
My AIO command menu mod uses them exclusively (and in a bit advanced way)
Checking their animations is one way
I was headed that route... turns out there are some variables buried in the functions that give exactly that information ace_dragging_isCarrying and ace_dragging_carriedObject
Why do you use near(est)Objects so much? It's slow and best avoided
vectorFromTo
what would you recomend
Event handlers
Thank you :). I'm trying to (re)create the CAS fire support system. Here's to nothing..
Any suggestions on how to remoteexec a function on a player after they've loaded in?
like, it creates displays and such, so it has to wait until after they've loaded
mission: initPlayerLocal.sqf
mod: playerConnected server EH and a simple waitUntil
@little raptor initPlayerLocal.sqf also fires too soon
- waitUntil
it fires before the mission starts, in the briefing screen
you can't make controls there, as far as I can tell
you can
nvm, figured out I can just create the controls in the map screen, that works. Is there a way to disable closing it by hitting escape?
keyDown EH? 
oh, probably use an eh for when its closed
could I do it with the onDestroy EH? just recreate the control again?
looks like onUnload is what I want
awesome. done!
i create a uav via BIS_fnc_spawnGroup. how can i reach the vehice of this group? the group name is the only variable i have.
units _group?
this returns also objects like vehicles?
