#arma3_scripting
1 messages ยท Page 692 of 1
@dusky pier If you want some script to be executed for players individually, why not to use SeatSwitchedMan and GetInMan?
does arma support any kind of shaders?
i just didn't think about that ๐
Thank you!
@dusky pier
BTW, SeatSwitched can be ran only on server, that is recommended for any time-consuming scripts.
About GetIn:
It can be assigned to a remote vehicle but will only fire on the PC where the actual addEventHandler command was executed
So it is ok for server script. Depends on what you want to do with players.
You can also use combinations, like GetInMan for player --> adding GetOut EH for vehicle the player enters --> ...
_azimuth = player getDir _posPlayer;
_roundedAzimuth = [_azimuth, 0] call BIS_fnc_cutDecimals;```
Is there any way to make this cleaner ? ^^'
@gaunt mortar But getDir returns already rounded value, isn't it? And you can use round instead of call BIS_fnc_cutDecimals
Well,
_azimuth = player getDir _posPlayer;
_roundedAzimuth = [_azimuth, 0] call BIS_fnc_cutDecimals;
openMap false;
hint format ["Vos alliรฉs son azimut %1", (_roundedAzimuth), "%1"];```
gave me something looking like 170.850 ^^'
But that round thing ? just a plain "round (_azimuth)" ?
Yup,
round _azimuth
Mk. So might as well round it in the hint format part
I have forgotten, does a Killed EH fire if the EH is added somewhere the target is not local to at the time of its death? i.e. if the Killed EH is added on the server only, and the target is local to a client when it dies, will the server's Killed EH fire?
I once knew this but apparently not any more
you can also use toFixed
Mh.. when it comes to a bearing, doesnโt make a huge difference right?
toFixed will simply remove the decimals where as round will .. well round it, the precision level here is minimal
tofixed will round too
Then is there a better optimization on one of them, or It's tomato tomato
ez, give us decimal ๐
what is decimal?
a C# type for high precision calculation, I don't know much more ๐
twice the size of a double though
When you need arty strike that 1 by 1 meter large target in China but you are on Altis.
is there limitation how many parallel code can run ? trying to do 10-20 spawns
and game is stuck on loading mission
Is indeed in Newtons. See the linked Nvidia physX documentation on that page
128 bits of pure freedom. physics engine with that would allow simulating a whole stellar system without chunk loading
you might be waiting for something that is not coming, blocking loading
instead i get f*cking floats that loose precision at 6km
Not that I doubt, makes sense (N or J), but I fail to spot any mention on Newtons there. Could you point the exact place in this document?
Given the units of measure used in physX, that equates to Newtons for the force
Thanks!
trying to optimize this line
{ [_x] execVM format ["script\run_%1.sqf", faction _x]; } forEach allUnits;
to
TAG_fnc_run_BLU_F = compile preprocessFileLineNumbers "script\run_BLU_F.sqf";
TAG_fnc_run_OPF_F = compile preprocessFileLineNumbers "script\run_OPF_F.sqf";
TAG_fnc_run_IND_F = compile preprocessFileLineNumbers "script\run_IND_F.sqf";
TAG_fnc_run_CIV_F = compile preprocessFileLineNumbers "script\run_CIV_F.sqf";
{ [_x] spawn format ["TAG_fnc_run_%1", faction _x]; } forEach allUnits;
but spawn is expecting code, not string
[_x] spawn (missionNamespace getVariable [format ["TAG_fnc_run_%1", faction _x], {}]);
you have a string, but you want the value of the variable of the same name as your string.
getVariable retrieves variable value by name
TAG_fnc_run_BLU_F = compile preprocessFileLineNumbers "script\run_BLU_F.sqf";
TAG_fnc_run_OPF_F = compile preprocessFileLineNumbers "script\run_OPF_F.sqf";
TAG_fnc_run_IND_F = compile preprocessFileLineNumbers "script\run_IND_F.sqf";
TAG_fnc_run_CIV_F = compile preprocessFileLineNumbers "script\run_CIV_F.sqf";
{ [_x] spawn (missionNamespace getVariable [format ["TAG_fnc_run_%1", faction _x], {}]); } forEach allUnits;
does anyone know if there is some getter for https://community.bistudio.com/wiki/setWeaponReloadingTime ?
https://community.bistudio.com/wiki/Arma_3:_Actions#Eject
this command shouldnt care about something like altitude or speed of the vehicle the unit is in, right?
Are you trying to do a plane's ejection seat like thing?
nope just trying to eject guys out of a helicopter
Ah, okay
having issues with having them eject anywhere further up than about 0.5 meters. but i think its because i used the wrong getPos
I believe there is none
hm nope. changed to getPosATL but same thing. the trigger seems to trigger properly at the correct altitude but the eject wont happen until im at a maximum of 1m indicated altitude
//diag_log format["ejectSquad called, _this: %1", _this];
private _lz = _this select 0;
private _vehicle = _this select 1;
private _squad = _this select 2;
private _fromTaskId = _this select 3;
private _pilot = driver _vehicle;
private _side = side _squad;
private _squadCmdr = (units _squad) select 0;
deleteWaypoint [_squad,1];
{_x action["eject", vehicle _x]} forEach units _squad;
{unAssignVehicle _x} forEach units _squad;
{_x enableAI "TARGET"; _x enableAI "AUTOTARGET";} foreach units _squad;
private _wp = _squad addwaypoint [_lz,5,1];
_wp setwaypointType "MOVE";
[_squadCmdr, format["%1, please standby as we're getting off.", name _pilot]] remoteExec ['sideChat', _side];
scopeName "main";
while {true} do
{
scopeName "ejectloop";
// diag_log format["ejectSquad: ticking %1", _this];
if (({(_x in _vehicle) && (alive _x)} count units _squad) == 0) then
{
// No squad units left alive inside
[_fromTaskId, "SUCCEEDED" ,true] spawn BIS_fnc_taskSetState;
breakOut "ejectloop";
};
sleep 2;
};
[_squadCmdr, format["%1, everyone is out, you're clear to lift off", name _pilot]] remoteExec ['sideChat', _side];
//diag_log format["ejectSquad done, _this: %1", _this];
Is there anything here that somehow limits the altitude of when to eject?
the sidechat part runs so the script must be running but I do not get why it wont eject unless im at a maximum of 1meter altitude
uh, so I guess I will have to use resolve to some hacks unless KK or Dedmen wants to solve that ๐
both @unique sundial and @still forum are happy to help, you know! ๐
Never understood a use for that function either... I mean it only affects the reload after firing the weapon (from Demellion's note) unless you script around that, in which case I guess you can store what it has been changed to???
well, I need some easy method to check if tank canon is ready to fire. I'm using animationSourcePhase for it right now and it works there
but there is no method to check state of infantry held weapon so I cannot do similar trick there
So you are not worried about the default value for a weapon being changed, just want the reload time in general
Hey! I have a question. I want to do a little killhouse training where there's actual Ai being spawned after an addaction (with if possible it being repeatable/random pos) so it can be used multiple times.
Is there something like this? I obviously can't look at armaholic anymore..
Who is that Dedman person?
mystical person they say!
Bohemia Interactive created AI system... subsystem of Dwarden 2.0
together, we areโฆ the Dadmen ๐
Are you issued DADPAT?
i guess you can try fired EH and calculating delta, but it's tricky, should be reliable though
without a getter you could use proxies like reading the weapon HUD ui (it changes color when ready to fire)
maybe figure out what the HUD is using to get โready to fireโ state
using moveOut instead of eject solved it
i mean in that case you would just look at the progress bar, iirc its in RscInGameUI, but if the player doesn't have the wanted weapon selected, it won't work
i guess you can run selectweapon, read the value of the progress bar, and switch back
if ((_this select 0) == 1) then
{ // Run on the HC only
if !(isServer or hasInterface) then
{
execVM "init_HC.sqf";
};
} else {
// Run on the server only
if (isServer) then
{
execVM "init_HC.sqf";
};
};
Why doesn't this work?
I took it from: https://community.bistudio.com/wiki/Arma_3:_Headless_Client
The error: "(" encountered instead of "="
it's running in description.ext after following the instructions for "Execute the script via a mission parameter"
sqflint seems to have a red underline at the ) == 1) but i don't see any issue
โฆwhere did you put that?
I put it inside a function within cfgFunctions
did you put that in description.ext?
yes
that's why
?? it says to add the code to the function in description.ext
To read a time from that you need to monitor the progress vs time
You're not supposed to put that in config 
where do you put it?
It's a script
If you read that properly it has a step before it 
First define a function to be used to run the headless client script file. Here's what it should look like in description.ext:
yeeeah?
Click on function to understand what it means 
is it possible to have an and (&&) within another and?
Within?
&&&&, duh
wdym?
yup
Yes
thanks
so yep, rather check the CfgFunctions page; this HC tutorial is not super crystal clear
Isn't the tutorial saying to add the following code to the function defined in cfgFunctions in description.ext?
what do you mean? by reload time, i meant value 0-1, just like you set it with setWeaponReloadingTime
it should be 1:1 progress bar no?
I thought you meant actual time 
I see now 
yes; the cfg defines the file to look up, and SQF goes into said file
sorry, was afk ๐
Is there a BI wiki link I'm not seeing or maybe someone can explain this too me.
custom composition A is a truck with items mounted to it. I want to have the ability to "unpack" the truck and it turns into a small camp which would be composition B
I may want to complicate it by having it be a mobile spawn, or medical camp
ideas?
scripting, yeah
Ok, so basically building a script that allows A to turn to B to turn back to A. Time to dig
createVehicle, getPos (alt syntax), etc ๐
making more sense to me now. I was looking through a mission pbo someone had this in, and need to focus on his scripts and not his compositions. I was to lazer focused on mimicking what he built when i can just build my own.
i have a really good idea for a mod thats script based, with attaching and detaching a player to an object through self interactions but i have no idea where to even start. if someone is experienced in making mods please dm me
you can recruit scripters (for free or not) in #creators_recruiting
im just looking for guidance on where to start
then no DMs, it can happen here ๐
see attachTo and addAction to begin with
Hello
I'm very new to scripting, but I'm trying to use the BIS_fnc_moduleLightning module in a "Killed" event handler.
Current issue is that the object the lightning hits just gets deleted afterwards
I saw that someone else was having the same issue so I guess that's just the way it works, but is there any way around that?
that might be because you are using it wrongly
create an empty object, don't pass the target as first argument
@red rune โ
so attach the object to the target and make the lightning hit that object?
just create something on the target's position yes
that works, thanks
I'm updating the wiki at the same time
is there a way to search for vehicle/helicopter objects within say 2 metres and then attach the player to it
idea would be
scrollwheel>search 2m for nearest vehicle> attach to vehicle
yes, see e.g nearestObjects
How can you disable user movement/rotation when in an animation without disabling all simulation/input?
override WASD and setDir, or set a locking anim, orโฆ
With Armaholic being down, can someone send me GF Holster Script version 2.0 and GF Earplugs Script version 2.2?
When a mpmission is loading whats the first file name to load the scripts?
init.sqf?
(the main script file)
If you are trying to attach the player to a specific vehicle then maybe add the action to the vehicle so that it's easier to reference it, or use cursortarget and check if it is a vehicle
Earplugs code. Put this in initPlayerLocal.sqf
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 207: {
if (soundVolume == 1) then {
2 fadeSound 0.1;
titletext ["Earplugs in.", "PLAIN DOWN"];
} else {
2 fadeSound 1;
titletext ["Earplugs out.", "PLAIN DOWN"];
}
};
};
_handled;
};
Press End for Earplugs.
weaponReloadingTime Revision: 147785 + weaponState extended
is there a way to make ai gunners a bit more aggressive and willing to fire? having issues with door gunners in a helicopter not opening fire unless im loitering for quite some time within moderately close range of enemy infantry, even if those infantry have opened fire at the helicopter way before the doorgunners fire back
What is their skill level set to?
If they're not firing whilst moving, it's probably because one of the variables (forgot which one) of skill level is too low?
Do you have any mods running?
If I spawn in a heli, my gunners will shoot just fine.
I don't know if sog pf changes AI behaviour but I wouldn't think so.
Have you tried use createVehicleCrew to spawn a vanilla asset in order to see if its something to do with setting AI awareness?
i can try it on a vanilla asset but i reckon its just that the default behavior isnt quite as aggressive as id like. i just think itd make sense if they at least would open fire against infantry actively firing against the helicopter
I don't have sog pf but with vanilla only, that's what happens for me. If infantry on the ground shoot at the helicopter, the gunners always seem to know where they are and open fire.
Have you changed game difficulty to recruit by any chance?
I have mine on regular
ill see if i might have changed it
while im at it, having minor issues with this:
//diag_log format["spawnCrewAction called, _this: %1", _this];
private _vehicle = _this select 0;
private _caller = _this select 1;
private _returnValue = [];
private _group = group _caller;
private _tmpGroup = createGroup civilian;
_returnValue = [ _vehicle, _tmpGroup, false, typeof _vehicle]; createVehicleCrew _vehicle; _vehicle deleteVehicleCrew driver _vehicle;
// a bit of twiddling to get the units to the correct side
_returnValue joinSilent grpNull;
_returnValue joinSilent _group;
deleteGroup _tmpGroup;
//diag_log format["spawnCrewAction returning: %1", _returnValue];
_returnValue
units spawn in properly but for some reason the only spawned in unit that appears to be added to the players group is the copilot. if done in a heli with 2 door gunners for example they will spawn in but they do not appear to be added to the players group, at least they do not show up in the group bar at the bottom of the screen. any ideas?
_returnValue joinSilent grpNull;
wat?
private _vehicle = _this select 0;
private _caller = _this select 1;
// replace by
params ["_vehicle", "_caller"];
_returnValue = [ _vehicle, _tmpGroup, false, typeof _vehicle];
again, wat?
its an addaction tied to a vehicle
where is there an addAction? can't see any
in another sqf :p
_vehicle = _this select 0;
_vehicle setDamage 0;
_vehicle remoteExec ["removeAllActions", 0, "rmall" + (_vehicle call BIS_fnc_netId)];
[_vehicle, ["Spawn crew", { _this remoteExec ["spawnCrewAction", _this select 0]; },nil,1.5,true,true,"","true",5,false,"",""]] remoteExec ["addAction", 0, "addcrew" + (_vehicle call BIS_fnc_netId)];
[_vehicle, ["Remove crew", { _this remoteExec ["deleteCrewAction", _this select 0]; },nil,1.5,true,true,"","true",5,false,"",""]] remoteExec ["addAction", 0, "removecrew" + (_vehicle call BIS_fnc_netId)];
โฆ I am going to be sick
first of all:
params ["_vehicle", "_caller"];
_group = group _caller;
_newGroup = createVehicleCrew _vehicle;
_vehicle deleteVehicleCrew driver _vehicle;
units _newGroup joinSilent _group;
deleteGroup _newGroup;
I have no idea what on earth the rest of it is 
shouldnt i at least do deleteGroup _newGroup; there? or is it deleted by moving them to the group of the caller?
second of all, what on earth is that JIP id? 
just use vehicle
it should delete automatically
but it won't hurt
added
okay. just used to doing stuff in wc3 editor and if you dont delete basically everything you ever create it ends up with massive memoryleaks
that worked fine btw thanks
does a players/servers difficulty settings override a scenarios or does a scenarios setting override the servers/players?
latter
if you spawn in an AI with max skill but the players difficulty option has skill on lowest which one ends up being used?
ah thanks
Was it recruit?
nope. im gonna just set the skill on the units in editor and see if that helps
@little raptor is this correct when it comes to setSkill on the ai units created in the previous thing you helped me with?
{_x setSkill 1} forEach units _group;
sorry for the 
yes
thanks
ah that helps, thanks again
so i have set up a target range and i want to reset targets at a greater range what input would i change to increase target range reset?
sorry i am noob at scripting
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
without syntax highlighting no one will bother to look at the code.
if that's confusing, use sqfbin.com
Having some issues with onPlayerRespawn.sqf
It runs correctly first time player spawns (on mission start).
On first player respawn after being killed it does not run correctly.
If player is killed again it does run correctly.
so for some reason on the first player death it doesnt seem to run onPlayerRespawn.sqf after respawning
thats almost impossible
yeah i have no idea why its happening
yeah
i really dont understand this. i changed respawnOnStart to 1 just to see what would happen and then you spawn without the stuff in onPlayerRespawn.sqf working (addAction for example) but if you kill yourself and respawn again it works
its just the first respawn that doesnt work correctly for whatever reason
is there something wrong with my onPlayerRespawn.sqf? Seems unlikely since it works fine on any respawn except the first one.
player addAction ["<t color='#FFFF00'>Request mission</t>", { {[player] call spawnPlayerTask;} remoteExecCall ["bis_fnc_call", 2] },nil,10 ];
don't use player. try using the onPlayerRespawn parameters
so _newUnit instead?
yes
should i just swap "player" to _newUnit? that gives me a undefined variable in expression _newunit
I'm trying to play a certain animation when a player has certain weapons equipped and i got it working for primary, secondary, and launcher, however I'm having trouble figuring out a way to do it with no weapon.
Here's my current code:
//Crouched
if ((currentweapon player == (primaryweapon player)) and (stance player != "PRONE")) then {
player playMove "AinvPknlMstpSlayWrflDnon_medicOther";
};
if ((currentweapon player == (secondaryweapon player)) and (stance player != "PRONE")) then {
player playMove "AinvPknlMstpSlayWlnrDnon_medicOther";
};
if ((currentweapon player == (handgunweapon player)) and (stance player != "PRONE")) then {
player playMove "AinvPknlMstpSlayWpstDnon_medicOther";
};
//Prone
if ((currentweapon player == (primaryweapon player)) and (stance player == "PRONE")) then {
player playMove "AinvPpneMstpSlayWrflDnon_medicOther";
};
if ((currentweapon player == (handgunweapon player)) and (stance player == "PRONE")) then {
player playMove "AinvPpneMstpSlayWpstDnon_medicOther";
};
There doesn't seem to be a command for no weapon equipped and if I try to do something like
if ((currentweapon player == "") and (stance player != "PRONE")) then {
player playMove "AinvPknlMstpSlayWnonDnon_medicOther";
};
It loops the animation multiple times when I try to run it with no weapon. It works fine in all other cases.
i tried a few things but I cant make it work, could you maybe help out a bit?
trying to add an ace interaction to a deployed rappeling rope so you could technically rappel from outside the vehicle, any idea on how to do this?
@hasty trout This ...
{[player] call spawnPlayerTask;} remoteExecCall ["bis_fnc_call", 2]
```... should be ...```sqf
[player] remoteExecCall ["spawnPlayerTask", 2]
```... not just for readability but also because the argument `player` is resolved on the server in the first version of the expression (see https://community.bistudio.com/wiki/remoteExecCall#Example_5).
Hello everyone, is there any way to stop ctrlCommit?
does the nearestObject function retrieve objects that have been hidden via a hideTerrainObjects marker?
getting tasks from mission, wtf BIS
private _maybeTasks = (allVariables missionNamespace) select {(_x find "@") == 0 && {_x find ".0" == (count _x) - 2}};
Question
Is it possible for me to define a global variable from config?
Like, a truly accessible global variable, not just something I'd need to retrieve from getVariable
You can register a preInit Eventhandler that sets the variable. But without CBA you can only run script files there
What's your usecase? Maybe there's a better way?
Oh, you mean like a CfgFunctions function with preinit enabled?
Yeah that actually would work just fine tbh
And nah, just looking to define some variables in mod config for mission-specific arsenal setup
Yes CfgFunctions.
But that's not config only as it needs a script file too. Don't know what your constraints are
Can somebody recommend a task and briefing framework that works on dedicated server and JIP?
So 'joinSilent' is working ๐ค Is there any limit there of something? I'm trying to merge two groups 8 units each and no luck so far
i have a unit called "posMan" and i am creating a unit at the position of posMan:
private _newPos = getPos posMan;
"vn_b_men_sog_13" createUnit [_newPos, _groupTaxi,"",0.6, "CORPORAL"];
However posMan is standing on the roof of a building but the created unit ends up at the bottom floor of said building. Any help would be appreciated
using position posMan instead of _newPos had same result
create unit at [0,0,0], then setpos after
would I need to turn each created unit into some sort of named variable in that case in order to setPos on it?
Yeah that's fine, should work
I dont see under the first Syntax part in that wiki how that would work. been scratching my head over this for a bit.
I mean I understand that under Example 1 i could then setpos on _unit but wouldnt that mean I am creating a variable for each unit i create before I can move it?
_groupTaxi createUnit ["vn_b_men_sog_13", [0, 0, 0], [], 0, "NONE"] setPosASL getPosASL posMan;
edited, mb on the grp
Not if you use a local variable (just like _newPos).
that works!
thanks sharp! you're the best
if i wanted to also make this unit a colonel would it look like this:
_groupTaxi createUnit ["vn_b_men_sog_13", [0, 0, 0], [], 0, "NONE"] setPosASL getPosASL posMan; setUnitRank Colonel;
or does the ; after posMan screw that up?
maybe it also needs to define the unit? _this setUnitRank Colonel;?
private _unit = _groupTaxi createUnit ["vn_b_men_sog_13", [0, 0, 0], [], 0, "NONE"];
_unit setPosASL getPosASL posMan;
_unit setUnitRank "COLONEL";
ah yeah makes sense
the reason i told you to use the main syntax of the createUnit is because that particular syntax returns the actual unit handle, while the one you were using, doesn't. you can use it and pass the init "code" string, but it'll be slower, + you gotta use format for that
how would i calculate the distance from the player to a specific object class
i want to do this player distance "UK3CB_BAF_Merlin_HC3_18" but i cant**
Are you interested in the distance to a single specific object of that class or are you interested in the distance to the nearest object of that class?
if i were to spawn another unit and wanted it close to that one without being literally on top of it, more like a spread out squad, would this work?
private _sog16 = _groupTaxi createUnit ["vn_b_men_sog_16", [0, 0, 0], [], 0, "NONE"];
_sog16 setPosASL [(getPosASL sog13 select 0)+random [1,2,3], (getPosASL sog13 select 1)+random [1,2,3], (getPosASL sog13 select 2)];
_sog16 setUnitRank "PRIVATE";
with the previous one being private _sog13
that should put it within 1-3 meters on x and y from sog13?
use https://community.bistudio.com/wiki/vectorAdd instead
oh wow thats a lot cleaner
would it look like this?
_sog16 setPosASL (getPosASL sog13 vectorAdd [random[1,2,3],random[1,2,3],0]);
nearest
then again i dont think that returns the distance just which is closest. maybe you can check the distance to the first thing in the array? not sure
ive looked at that, but i have no idea how to put a class on that
here comes the tricky part though. i spawn a bunch of riflemen based on the amount of free seats in the vehicle.
for "_i" from 1 to (_cargoSeats - 2) do
{
"vn_b_men_sog_05" createUnit [_newPos, _groupTaxi,"",0.5, "PRIVATE"];
};
i cant just change this to something like
for "_i" from 1 to (_cargoSeats - 2) do
{
private _sog05 = _groupTaxi createUnit ["vn_b_men_sog_05", [0, 0, 0], [], 0, "NONE"];
_sog05 setPosASL (getPosASL sog13 vectorAdd [random[1,2,3],random[1,2,3],0])
_sog05 setUnitRank "PRIVATE";
};
because i reckon each spawned units need its own "private _name" ?
ideally the getPosASL would use sog13 on the first one and for each run of the loop the next one has its position based on the previous.
You can get something going like so:
private _nearMerlins = nearestObjects [player, ["UK3CB_BAF_Merlin_HC3_18"], 1000];
private _nearestMerlin = _nearMerlins # 0;
private _distance = player distance _nearestMerlin;
```Warning: Because I am lazy, this code can't handle it when there is no object of the class within 1000 meters.
because i reckon each spawned units need its own "private _name" ?
no
ah so i can just run the loop with no problem then?
yes
I'm trying to have different ACE Arsenals for different roles. I found an example online of how to do this, but I can't seem to get it to work. It shows no errors in the rpt, but it's also not adding the ace arsenal to the object. I have an object in the mission named arsenal_1 and then in initplayerlocal I have [arsenal_1] execVM "scripts\Arsenal.sqf"; . Arsenal.sqf is as follows: https://www.sqfbin.com/porawiyomuqulazaxaqi
is arsenal_1 defined?
check it just to make sure, i don't see any errors in the code, also might be worth checking if initBox usage is correct
also you should omit the switch or that if chain, because you're basically checking against same values
_sog05 setPosASL (getPosASL |#|sog16 vectorAdd [random[1,2,3],random[1,...
Error Undefined variable in expression: sog16
if (_cargoSeats > 1) then
{
private _sog16 = _groupTaxi createUnit ["vn_b_men_sog_16", [0, 0, 0], [], 0, "NONE"];
_sog16 setPosASL (getPosASL sog13 vectorAdd [random[1,2,3],random[1,2,3],0]);
_sog16 setUnitRank "PRIVATE";
_sog16 setSkill 0.5;
};
for "_i" from 1 to (_cargoSeats - 2) do
{
private _sog05 = _groupTaxi createUnit ["vn_b_men_sog_05", [0, 0, 0], [], 0, "NONE"];
_sog05 setPosASL (getPosASL sog16 vectorAdd [random[1,2,3],random[1,2,3],0]);
_sog05 setUnitRank "PRIVATE";
_sog05 setSkill 0.6;
};
it is.
well it's pretty clear, the variable sog16 is undefined
i dont see how it looks any different than how sog13 looks and theres no error regarding that
where do you define sog16?
and also, sog13 is probably undefined too, the popup error message is probably hidden by the later-error
this is at the top of the sqf file
private _spawnPos = _this select 0;
private _sog13 = "";
private _sog16 = "";
private _sog05 = "";
isnt this defining them?
_sog16 is different from sog16
one is a local variable, the other is a global variable
try print _playerRole, to make sure it matches one of the values
I'm trying to get some screenshots for editor preview, but I get no classes with this call: ```sqf
[nil, "all", [],[],[], ["uns_nva_m56"]] spawn BIS_fnc_exportEditorPreviews;
config viewer shows configfile >> "CfgVehicles" >> "uns_nva_m56"
oh there we go, thanks!
now i bumped into this.
_sog05 setPosASL (|#|getPosASL _sog16 vectorAdd [random[1,2,3...
Error getposasl: Type String, expected Object.
is this:
_sog05 setPosASL (getPosASL _sog16 vectorAdd [random[1,2,3],random[1,2,3],0]);
supposed to be
_sog05 setPosASL [getPosASL _sog16 vectorAdd [random[1,2,3],random[1,2,3],0]];
?
you're trying to get position of a string, that's not how it works
i dont see how im doing it differently from the example
player setPos (getPos player vectorAdd [0,0,10]);
//--- Get the list of affected objects
_cfgVehicles = "
getnumber (_x >> 'scope') == 2
&&
{
getnumber (_x >> 'side') in _sides
&&
{
_class = configname _x;
_isAllVehicles = _class iskindof 'allvehicles';
(_allVehicles == 0 || (_allVehicles == 1 && _isAllVehicles) || (_allVehicles == -1 && !_isAllVehicles))
&&
{
(_allMods || {(tolower _x) in _mods} count (configsourcemodlist _x) > 0)
&&
{
(_allPatches || {(tolower _x) in _patches} count (configsourceaddonlist _x) > 0)
&&
{
(_allClasses || {(tolower _class) in _classes})
&&
{
!(gettext (_x >> 'model') in _restrictedModels)
&&
{
inheritsfrom _x != _cfgAll
&&
{
{_class iskindof _x} count _blacklist == 0
}
}
}
}
};
}
}
}
" configclasses (configfile >> "cfgVehicles");
_cfgVehiclesCount = count _cfgVehicles;
that's basically the selector for the cfgVehicles
should look more into that function yourself, i'm sure you can find the cause for it not working
you're running getPosASL "", aka getPosASL <STRING> which clearly doesn't exist here: https://community.bistudio.com/wiki/getPosASL
i dont get it. ive been trying to find similar code to see what i should do and find this in ace3 github:
_helper setPosASL (getPosASL _x vectorAdd [0, 0, 1.25]);
and i still dont see how thats different than mine
_sog16 setPosASL (getPosASL _sog13 vectorAdd [random[1,2,3],random[1,2,3],0]);
a variable is a reference to some value
you assign a string there
then you run getPosASL on it
ah so if i update private _sog16 for example within an if/for etc it wont be visible outside of that statement?
i thought that was just for if its defined or not
it will be, unless you do a private assignment again
private _a = 5;
call {
private _a = _a + 1;
systemChat str _a; // 6
};
systemChat str _a; // 5
if you omit private inside call, the second systemChat would print 6 aswell
print _playerRole; just gives me an error saying missing ;.
I'm trying to use sunday revive, but when a player is revived they get stuck in 3rd person + die seemingly randomly after some time. I thought this was because the bleedout function was still running but I had it hint when it calls setDamage 1 and it doesn't seem to get to that part of the script, so I don't really know what the issue is. Anyone got any ideas for debugging?
I see there is a curatorGroupPlaced EH, is there a curatorGroupDeleted EH? Wiki says no but want to ensure its non-existent. Is it delt under another EH instead?
use curatorObjectDeleted
and check the count of the units
but then it only makes sense if group is marked https://community.bistudio.com/wiki/deleteGroupWhenEmpty you can check that with https://community.bistudio.com/wiki/isGroupDeletedWhenEmpty
and if that's not the case, there is no other way for the curator to delete groups(unless there is some other script, i.e module being used, but then it doesn't make sense in this context)
what script can i use to disable player collision with a helicopter
i have player disableCollisionWith
but then what other param do i use?
can i put a object class at the end?
you put the helicopter object ๐
player disableCollisionWith _ghosthawk ?
i can just call its class name?
no
so whats that _ghosthawk?
the helicopter object
so i would have to make the var for the heli "ghosthawk"?
im so confused
i have a question, how would you make the AI respawn after they die. it could work when a "Killed" event handler goes off the game would recreate the same unit and delete the old one. you see I am try to make a firing range and I want for there to be some ai's as some targets so the players can see how there gun would act like in the field. making them not move and not doing friendly fire would be helpful too. also I not very good at coding.
In the editor (i am presuming you have the ghost hawk placed down in the editor) you can double click the ghost hawk to open the attributes. From here you can type player disableCollisionWith this; into the init field to disable collision
ill try that, but i will probably need it to change at a specific time
([OT_allTowns,[],{random 100},"DESCEND"] call BIS_fnc_sortBy); can somebody tell me what {random 100}does to the sort? I cant figure it out
its actually just an array being shuffled here
ok that is very helpful, but I have very little idea of how to code.
So the random number turns the sort into a shuffle?
it just generates a random number from 0 to 100 for every value in the array, and sorts using that value
could you explain what these lines of code do and how they work, then I have something to start with
_unit = group player createUnit ["B_RangeMaster_F", position player, [], 0, "FORM"];
"B_RangeMaster_F" createUnit [position player, group player];
it creates a unit in player's group, of class "B_RangeMaster_F", at player's position, and puts it in formation
then stores the unit into variable _unit
thanks
don't use this one
im trying to define a variable as what the player it looking at
so when this is executed
cursorTarget = var its not working?
forgive me if im being stupid
_var = cursorTarget
its still spitting out errors
do you have a semicolon at the end like so _var = cursorTarget;
how else would you separate statements?
what about statements that are long?
they should be shorter!
fat basta-
im just very annoyed ive sat here for 27 minutes trying to fix the fact i didnt have semi colons
your expression was backwards too
You would have loved SQSโฆ and the mess it was
๐คซ
DON'T REVEAL THE CURSED WAY

why cant coding just be like,,, code does what i think it should do
yeah the whole game is 1 semicolon
if you think a programmer's biggest worry is semicolons, it's a good thing you didn't become one 
and semicolons are used in almost all programming languages
well i dont like them!
:(
Semicolon is not an end of line separator, it is an end of statement separator ๐
๐ค
its gotten to the point where im just swapping around vars in my code hoping that it will work
just give us the code
its really weird
this is mine right
focus on the attach/detach stuff
and this is from a mod called ZEN
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
yeah wait
so this is mine
is the important bit
the problem is the detach and attach
still missing sqf
myaction = ['Attach','Stand Ready','',{player attachTo [cursorTarget];standing = True ;},{private _intersects = lineIntersectsSurfaces [getPosASL ACE_player, getPosASL ACE_player vectorAdd [0, 0, 2], ACE_player];
(_intersects select {_x#2 isKindOf "UK3CB_BAF_Merlin_Base"}) isNotEqualTo []}] call ace_interact_menu_fnc_createAction;
[player, 1, ["ACE_SelfActions"], myaction] call ace_interact_menu_fnc_addActionToObject;
myaction = ['Detach','Get Up','',{detach player; standing = False;},{standing}] call ace_interact_menu_fnc_createAction;
[player, 1, ["ACE_SelfActions"], myaction] call ace_interact_menu_fnc_addActionToObject;```
sorry just wanted to get it right
so its pretty simple, it just attaches and detaches a player to a heli
when i tested this i used a zen module to test the idea of it and it worked flawlessly everytime
but with my one, when i detach my head bumps up into the celing of the heli and it goes boom
this is the one from ZEN
#include "script_component.hpp"
/*
* Author: mharis001
* Zeus module function to attach an object to another.
*
* Arguments:
* 0: Logic <OBJECT>
*
* Return Value:
* None
*
* Example:
* [LOGIC] call zen_modules_fnc_moduleAttachTo
*
* Public: No
*/
params ["_logic"];
private _object = attachedTo _logic;
deleteVehicle _logic;
if (isNull _object) exitWith {
[LSTRING(NoObjectSelected)] call EFUNC(common,showMessage);
};
// Detach object if currently attached
if (!isNull attachedTo _object) exitWith {
detach _object;
[LSTRING(ObjectDetached)] call EFUNC(common,showMessage);
};
// Get object to attach to
[_object, {
params ["_successful", "_object"];
if (!_successful) exitWith {};
curatorMouseOver params ["_type", "_entity"];
if (_type != "OBJECT") exitWith {};
if (_object == _entity) exitWith {
[LSTRING(CannotAttachToSelf)] call EFUNC(common,showMessage);
};
private _direction = getDir _object - getDir _entity;
_object attachTo [_entity];
[QEGVAR(common,setDir), [_object, _direction], _object] call CBA_fnc_targetEvent;
[LSTRING(ObjectAttached)] call EFUNC(common,showMessage);
}, [], LSTRING(ModuleAttachTo)] call EFUNC(common,selectPosition);
im just trying to work out what zen did differently
its something to do with the detach
the only thing it does differently is set the object direction after attaching
Hello friends! I've got a super basic script that fully ACE heals somebody when they enter a trigger. Its set to TYPE: none, ACTIVATION: BLUFOR, ACTIVATION TYPE: Present. Its also set to repeatable. It doesn't seem to always work though. Is there a way to make it simply check for players inside the trigger, and if they are, run the script every 5 seconds until there's nobody left in the trigger? Alternatively, would it be easier to just give a scroll option to "activate" the heal script?
If you respond, please @ me. Thanks!
which has nothing to do with your issue
use a loop instead
because when i was testing that was the one difference, i would be put in the direction the heli is facing with mine, but with ZENs it didnt
is that the only difference?
yes
how would i implement a object direction thingy into mine?
Is it known that the turretOwner command doesn't seem to work on the driver's turret ([-1])? In my hasty debugging that seems to be it but I am not sure
private _direction = getDir _object - getDir _entity;
_object attachTo [_entity]; [QEGVAR(common,setDir), [_object, _direction], _object] call CBA_fnc_targetEvent;
_object would be player
_entity would be what you want to attach to (cursorObject)
use setDir
can i check it with you in a sec
myaction = ['Attach','Stand Ready','',{private _direction = getDir player - getDir cursorTarget;[QEGVAR(common,setDir), [player, _direction], cursorTarget] call CBA_fnc_targetEvent; ace_hearing_disableVolumeUpdate = true; 0 fadeSound 0.05; player attachTo [cursorTarget];standing = True ;},{private _intersects = lineIntersectsSurfaces [getPosASL ACE_player, getPosASL ACE_player vectorAdd [0, 0, 2], ACE_player];
(_intersects select {_x#2 isKindOf "UK3CB_BAF_Merlin_Base"}) isNotEqualTo []}] call ace_interact_menu_fnc_createAction;
[player, 1, ["ACE_SelfActions"], myaction] call ace_interact_menu_fnc_addActionToObject;```
so this?
oh
how?
myaction = ['Attach','Stand Ready','',{private _direction = getDir player - getDir cursorTarget;[setDir [player, _direction], cursorTarget] call CBA_fnc_targetEvent; ace_hearing_disableVolumeUpdate = true; 0 fadeSound 0.05; player attachTo [cursorTarget];standing = True ;},{private _intersects = lineIntersectsSurfaces [getPosASL ACE_player, getPosASL ACE_player vectorAdd [0, 0, 2], ACE_player];
(_intersects select {_x#2 isKindOf "UK3CB_BAF_Merlin_Base"}) isNotEqualTo []}] call ace_interact_menu_fnc_createAction;
[player, 1, ["ACE_SelfActions"], myaction] call ace_interact_menu_fnc_addActionToObject;```
that?

sorry
no need for CBA_fnc_targetEvent at all
myaction = ['Attach','Stand Ready','',{private _direction = getDir player - getDir cursorTarget;[setDir [player, _direction], cursorTarget]; ace_hearing_disableVolumeUpdate = true; 0 fadeSound 0.05; player attachTo [cursorTarget];standing = True ;},{private _intersects = lineIntersectsSurfaces [getPosASL ACE_player, getPosASL ACE_player vectorAdd [0, 0, 2], ACE_player];
(_intersects select {_x#2 isKindOf "UK3CB_BAF_Merlin_Base"}) isNotEqualTo []}] call ace_interact_menu_fnc_createAction;
[player, 1, ["ACE_SelfActions"], myaction] call ace_interact_menu_fnc_addActionToObject;```
and don't spam the code in every message
just edit it
Hey guys, quick question. How would I stop a player on MP from sprinting and force Walking in a certain area?
this is not working in a trigger..
wat? it can work anywhere
i can still run etc in the trigger when i have this in it
what do you use?
nvm fixed it. Being a tard. dw ๐ sorry n thanks ๐
I have two objects in game called armoryGuy, armoryGuy2
Im trying to addAction both without making two lists of addactions in my Init.sqf file, However its not working. What am i doing wrong?
private arsenal = [armoryGuy, armoryGuy2];
arsenal addAction ["this is a test",""];
private global assignment is invalid
also it doesn't take an array for left argument
so how would I do it? like im confused xD
{
_x addAction ["this is a test",""];
} forEach [armoryGuy, armoryGuy2];
Q: I am trying to load a prisoner into a transport cargo position. He is animated in an atease (cuffed) position. _unit moveInCargo _vehicle loads him, then he hops back out... ๐ค
do I need to perhaps switch their animation first?
working out the bits of the commanding menu. I don't know what this is...
20:59:23 Item description - list of shortcuts expected as an item #2: ["Stop Unloading",9,"",-3,[["expression","[player, false] call KPLIB_fnc_captives_showUnloadTransportMenu"]],"1","1"].
20:59:23 - in user menu description 'KPLIB_captives_unloadTransportMenu', item #9: [["Unload...",false],["Unload Karim Zakhilwal",[2],"",-5,[["expression","[player, '35e96748ecf6b61858e726cadb283bc5'] call KPLIB_fnc_captives_onUnitUnloadOne"]],"1","1"],["Unload Akbar Ghafurzai",[3],"",-5,[["expression","[player, 'e988c18a1f1bfb297e282f3847c4a7a8'] call KPLIB_fnc_captives_onUnitUnloadOne"]],"1","1"],["Unload Hasan Khalili",[4],"",-5,[["expression","[player, 'ba27b4d877675b66c6c8b6983f0cc3e3'] call KPLIB_fnc_captives_onUnitUnloadOne"]],"1","1"],["Unload Haikal Noori",[5],"",-5,[["expression","[player, 'dee8f8f798ba114715a89ed39fb6ba69'] call KPLIB_fnc_captives_onUnitUnloadOne"]],"1","1"],["Unload Basharat Amin",[6],"",-5,[["expression","[player, 'dea8f74b11b58728a5a85ba99e09d357'] call KPLIB_fnc_captives_onUnitUnloadOne"]],"1","1"],["Unload Abdul-Qadir Siddiqi",[7],"",-5,[["expression","[player, '428443778f668aba8e72ee84b2d927d6'] call KPLIB_fnc_captives_onUnitUnloadOne"]],"1","1"],["Unload Akbar Anwari",[8],"",-5,[["
also, it kinda works... but it is there a way to refresh the commanding menu without it going away on an "executed cmd" (?)
setobjectscale works sort of on dedicated server, but it spawned full size objects as well as the proper tiny ones. I was running the code locally? How do I fix this? Thanks.
Item description - list of shortcuts expected as an item #2: fixed this one, it should have been ..., [9], ...
How exactly would I do that? I'm still pretty new at scripting, and the wiki entry for diag_log seems to be broken.
because then anybody could do it.
MRH Milsim Tools has an ACE Heal zone module that can be sync'd with objects (or AI).
Wiki 502 Bad Gateway (โฏยฐโกยฐ)โฏ๏ธต โปโโป
same ๐
i should download the whole wiki for offline
thor addEventHandler ["Killed",
{
_batt = "Land_Battery_F" createVehicle position thor;
[thor,nil,true] spawn BIS_fnc_moduleLightning;
}];
Is my usage of position thor here correct? It doesn't create the object at the exact position
*sometimes it does
_batt = createVehicle ["Land_Battery_F", position thor, [], 0, "CAN_COLLIDE"];
that spawns it about 20m in the air before it falls to the ground
create the vehicle at something like [0,0,0], then set its position to where you want it the line after
and you should also be using getPosASL or getPosATL if its height sensitive
what is thor?
just a codename for an overcharged zombie that is now basically evil thor
thats not what I asked. is thor an object? is its position off the terrain? etc etc
and you want to spawn this "battery" at its feet in front of him?
yes
ill write something after this warthunder match
okay thank you
is this MP or SP
no, just changing the way i write it
ah ok
how is it broken?
I think the biki was down tonight
how comes even with hotLZChance being 0 sometimes the createEnemySquads is called?
private _enemies = [];
private _lzhot = false;
if ((random 1) < hotLZChance) then
{
_lzhot = true
};
private _lzAA = false;
if ((random 1) < AAChance) then
{
_lzhot = true;
_lzAA = true;
};
private _taskType = "meet";
if (_lzhot) then
{
_taskType = "defend";
_enemies = _enemies + ([_lzLocation, _lzAA] call createEnemySquads);
};
well if AAChance is not zero....
it sets lzhot to true
oh
yeah i see that now
thanks ded
would this solve it?
if (_lzhot = true) then
{
if ((random 1) < AAChance) then
{
_lzhot = true;
_lzAA = true;
};
};
no
if (_lzhot = true) then
// becomes
if (_lzhot == true) then
// or
if (_lzhot) then
ah
so would this solve it?
if (_lzhot) then
{
if ((random 1) < AAChance) then
{
_lzAA = true;
};
};
no need to set _lzhot to true again
true
so ive finished my script, but i now want to put it into modformat. rn i just have a script designed to run on init.sqf, how do i go about putting this into a mod
Its there a easy way to copy the lists of a listbox to another listbox?
loop
Is there a way to update or refresh a commanding menu without having to reinitialize it from ground zero every time?
IOW, I'd like the menu to stick around as long as there are captives to unload, shaving off options when they are unloaded.
no. you can only reopen it
very good then, it is easy enough to contain that in its own function and spawn a subsequent invocation.
works famously
why would I ever want to use the GVAR macro?
GVAR(frog) = 12;
// In SPON_FrogDancing component, equivalent to SPON_FrogDancing_frog = 12
like why not just use the normal variable system?
just trying to understand more about CBA macros and why they exist
you having a whole bunch of modules made by different authors and making sure you're not using overlapping variable names
that works fantastically when you are talking about intra-module variables. not so much when you have inter-module dependencies.
or 'text as script' scenarios for that matter, conditions, callbacks and such
another rub is that, you are talking about source level #include "..." access. unless you have access to those modules' source code, probably a non-starter as well.
there is a lot more than just the GVAR macro in cba, in the end its super worth it, gives you a lot of flexibility
it's about trade offs. I think it can be a useful technique. however, you trade off readability traceability for flexibility, especially translating between logs and the source. are the gains better than the losses? I'd say 'it depends'.
if you spend a lot of time intra-module, then yes, it is probably worth it. if you spend time inter-module, meh, debatable. exercise discretion.
i'd say that the code is more readable with the GVAR macros IMO, ofc if you understand the concept of CBA components/the structure of them
yep, bit of a learning curve, that too. macros do not behave sometimes quite as 'expected', in languages with similar concepts.
I do happen to use that approach more frequently today, but like I said, the intra-versus-inter-module caveats all depend.
Q: trying to understand, when I _unit moveInCargo _vehicle, that unit loads, then gets punted back out again. seems consistent for each unit in question, happens one time, it seems, one time only. I seem to be able to load them again without difficulty. also, it is curious that the vehicle 'remembers' the position in which a unit was loaded.
the hypothesis I currently have is whether it is a playMove or switchMove thing. they are loading from an 'atease' position, i.e. captured or zip tied. they punt back out in a weapon ready stance, no weapon of course, captives module having stripped them of backpacks, weapons, etc.
I tried I think setting the animation prior to loading, but does not seem to help at all.
i have this in my config.cpp but its spitting out errors
class CfgFunctions {
class HelicopterRappel {
class AlexxCategory {
class init {
file = "\WHR\init.sqf";
postInit = 1;
};
};
};
};
path is addons>WHR>init.sqf
can anyone help?
Currently trying this, but obviously not working, first time the unit loads. Curious, though, why does this work on subsequent attempts.
_unit switchMove "AmovPlieMstpSnonWnonDnon";
_unit moveInCargo _vehicle;
What I really want to know is what 'works' every time.
would it be better perhaps if I identified an open index at which to load the _unit in 'cargo'? i.e. using the syntax:
https://community.bistudio.com/wiki/moveInCargo#Alternative_Syntax
that does not help either. unit still gets punted out.
Any ideas please? anyone...
another data point if it helps...
moveInCargo rejection does not seem to route events through any 'GetIn', 'GetInMan' or 'GetOut', 'GetOutMan' event channels either.
how do I know that, because I have a 'GetOutMan' event wired to the vehicle which re-animates player into the captured or zip tied position when that is correct.
no
the best way to avoid this bug is to move the unit a second time (moveOut first, then move in)
hrm, so, 1. confirmed bug, then? no worries... 2. workaround? so, moveIn, moveOut, moveIn?
any recommendation for editor with updated autocomplete/syntax for SQF ? I am using vscode + sqf language 2.0.3, but it seems not updated so considering to switch to something up to date
I think your choices are the SQL Language 2.0.3; however, not sure what the road map looks like, and it is lagging behind current A3 features.
I am currently using this one (as I stated) and looking for alternatives, even switch editor
I don't know of any. for most things it works pretty well, for core stuff it is okay, but there are a few oddities, and some recent niceties are not well supported if at all. it is OS, so fork it, perhaps?
do I need to spawn/sleep at all to give the request 'time' to complete then?
from the log, Getting out while IsMoveOutInProgress ...
or perhaps a waitUntil { isNull objectParent _unit; } prior to the next one?
phew, seems awkward, but 'better'...
// _this: [_unit, _vehicle], provided by action menu event handler
_this spawn {
params [
["_unit", objNull, [objNull]]
, ["_vehicle", objNull, [objNull]]
];
private _cargo = [_vehicle, "cargo", true] call KPLIB_fnc_core_getVehiclePositions;
// include empty: ^^^^
private _cargoIndex = _cargo findIf { isNull (_x#0); };
if (_cargoIndex >= 0) then {
_unit moveInCargo _vehicle;
waitUntil { sleep 0.1; !isNull objectParent _unit; };
moveOut _unit;
waitUntil { sleep 0.1; isNull objectParent _unit; };
_unit moveInCargo [_vehicle, _cargoIndex];
};
};
are there better ways to handle that without the blinking or stuttering? disable sim on the unit perhaps?
have you tried to work with assignAsCargo stuff, before doing the moveIn?
hmm I have not. I'll look into that, thank you...
I see... so it assumes unit control, correct? which is also a question on the table, probably one reason why the legacy stuff had captive units join player group, for this very reason.
No role assignment -> group commander defaults to ordering unit to getout immediately.
assignVehicle (or something i forgot) may also help - registering the vehicle in the group for usage
this might be the reason why the moveIn is being rejected. the units are effectively 'free standing', one unit per each 'group', i.e. is a group commander?
the goal here being a reasonable facsimile loading and unloading captive units. they should not be operating autonomously by any stretch.
hmm, also, at least the reference code I have does not invoke assignVehicle, so the issue cannot be 'that', per se. or there is another workaround in store.
quick question about a door opening condition:
condition = "((this animationSourcePhase 'Door_1_sound_source') == 0) && ((this getVariable ['bis_disabled_Door_1', 0]) != 1) && (cameraOn isKindOf 'CAManBase')";```
i am not sure about the last part `(cameraOn isKindOf 'CAManBase')`
can AI open the door with this condition on it ?
okay, so i am better off without it
Okay so I have a bunch of backpacks from S&S modpack that are being treated by TFAR as long range radios, which shouldn't be. how does one go about fixing that?
Hey guys ๐ Simple question. I want to trigger the "hide/show" module if players walk into several zones. Mainly as a safety net so no players can see certain vehicles spawning.
I've placed down a hide module to hide the objects at mission start, which is working fine and as intended.
I've placed a few triggers around the general area with the intention, if someone enters the trigger zone, the objects get "shown" and activate their simulation.
What I've placed into the triggers is this:
Condition:
this
On Activation:
this setVariable ["convoy",true,false];
I've then placed another trigger (non-area) and synced it to the "show" module which un-hides the objects. Into the "show" trigger I've put this
Condition:
convoy;
But, alas, its not working. Probably a pretty simple mistake. Anyone know what it is? Thank you lots ๐
you're assigning a variable into trigger's namespace, then trying to get it off of missionNameSpace
Okay, sorry, I don't understand what you are getting at. I'm not used to scripting (as you can probably tell). Can you explain this for Dummies? Thank you ๐
Anyone know a simple script that attaches (sling loads) cargo to a AI helicopter from the gecko? The Sling Loading module is broken.
gecko? boneappletea! Its "get go" lol.
if you got multiple "convoys" setup like that, you need to name your trigger, and use trigger getVariable "convoy", if its only a single convoy, you can just do convoy = true instead of this setVariable ["convoy",true,false];
you can also give indices, i.e neis_convoy1...n and use them accordingly
ahhhhhhh. okay, now I got it.
Its just a single convoy, and should spawn once a certain amount of players are inside a certain zone. So I can just place down, lets say, 4 triggers and just define each of them with convoy=true; and put into the activation trigger getVaraible "convoy"? I.e. the trigger that actually activates the show module
Or should the condition then just be "convoy;"
no in that case, you just use convoy
Alrighty! Thank you very much
the trigger scope is missionNameSpace, what convoy=true; does is just missionNameSpace setVariable ["convoy", true], and statement convoy; gets the value, just like missionNameSpace getVariable "convoy", what you're doing right now with this setVariable ["convoy",true,false]; is setting convoy to true in trigger's namespace, then you run convoy;, but that variable is undefined in that namespace(because its missionNameSpace, not said trigger's)
Alright. Got it. Thank you! ๐
Anyone know of a way to get the classname of a group via script? Usual methods for units and vehicles dont appear to support groups.
classname? you mean from cfgGroups?
A group once created has no relation to the class of the group config that it belonged to, it's now just a collection of units.
You could perhaps get an array of the units in the group then iterate over the entire groups config trying to match the arrays but that'd be sloooow
you can create your own spawngroup function, and save a variable into group's namespace
the other method is what Sebster said
Ok, yeah that pretty much aligns with what I assumed. Thank you both.
Did you ever find an answer for this?
Negative.
damn, thanks for responding
All good mate. If you ever find a solution let us know!
will do
is calculatePath event handler still having the known double-execution bug?
For some unknown reason, the "PathCalculated" Event Handler is fired twice, first with calculated path and second with array consisting of 2 elements, which are identical and are equal to the end point. See Example 3 & 4 for a workaround.
yes
spawn an agent manually
with agent spawned manually we cannot adjust the behaviour profile
safe/aware/combat/stealth etc
an AI can work too 
except give it a move order
:\
Hi!!, I have a doubt.
If I am going to use an onEachFrame EH forcing it to execute only every X time. I shouldn't be using an on each frame but a while loop with a sleep, right?
onEachFrame means what it says indeed
yep, but my question is more about what I should be using. I understand that the OnEachFrame does not make sense if then I am going to force it not to execute always, right?
Correct
if the exact precise timer does not matter, loop + sleep
ok, thx
on the other hand, if you run a scheduled script with a loop which sleeps, just any scheduled script then scheduler can rip the execution of your spawned script
I'd prefer to do it with onEachFrame
Also i would assume it causes less isssues when the game lags, if you use a framecall event dependent code instead of a constant loop
every frame check
vs
loop + sleep?
hmm
per frame evaluation has higher cpu burden than less frequent eval (scheduled loop + sleep)
general principle is to evaluate/execute code as infrequently as possible while still getting the job done
per frame eval should just be another tool in the toolbox , right beside scheduled loops.
i think we got rid of the PFH religion here a few years ago
Okay so I am trying to make a song loop until all hostiles in the trigger area have been killed however im trying to ensure it won't reenable the loop when they are all dead as currently im testing with just a while {true } loop
you can do it like so
while {_units findIf {alive _x} > -1} do {
//play song
sleep _songDuration;
}
there will be units in other areas of the map
so i'd prefer to check the triggerLoop section (As well i presume it's more efficent)
but yeah that was the idea
I didn't say all units
_units is an array of units of your choosing
it's not
ohh sorry
Still learning this syntax used
can a findIf statement have 2 checks
alive & opfor for example
yes
Yea, using &&
just like java good to see
Is there any good documentation on this or is it mostly just learnt through others?
ahh thank you that top one if very useful
Hi, can someone please tell me how to add a simple text overlay to an item that appears when the player approaches it? Just to be clear, I want the player to stand near something and the text to show.
thanks
you can use drawIcon3D
use a loop to detect when the player is close
is there no way to attach the text to the object?
or maybe add a scrollwheel action that doesn't do anything?
using that you can do it
didn't you say you want a "text overlay"?
if you want an action, just use an action
I want an action that doesn't do anything (if that makes sense)
it doesn't
I just want the player to be able to read the info about the object: look at object, scroll down, read the text
what's the simplest way to do that?
(thanks for your help, btw)
@graceful pewter Here's an example of what you can do with drawIcon3D
I guess this is not what you meant?
add an action to the object that does nothing?
change the text styling so it looks different from the other scroll wheel items
Thanks, that would work
Can I add a scroll wheel item to any object?
as long as it's not invisible
but some objects are still not possible
(iirc)
no, it's a physical object (ie. a box)
do you know the script for adding the scroll option?
addAction is the scripting command
https://community.bistudio.com/wiki/addAction
you may want to give it some style:
https://community.bistudio.com/wiki/Structured_Text
.. a very dumb question perhaps, but I'm trying to spawn an Ai in a mp enviroment, and I'm using this which is in a script
"B_RangeMaster_F" createUnit [setPos [26878.9,24296.8,0.780428], _groupAlpha];
But it keeps telling me missing ] although I would think its closed correctly..?
it's because of setPos
I'm taking my way with setpos ain't working?
_unit = _groupAlpha createUnit ["B_RangeMaster_F", [26878.9,24296.8,0.780428], [], 0, "FORM"];
Thanks. And sorry for bothering
np
it's ok. that's what this channels is for
Heyo, wondering if anyone has a simple script going for pop-up targets, where they staydown (nonpop=false, already in init.sqf) where I can attach an action to an object to re-pop up the targets
Is there a way to more easily see the hierarchy of item classes? Especially when other mods are included? Lets say I want to remove the radio from a unit. I can do
_unit unassignItem "ItemRadio";
_unit removeItems "ItemRadio";
However TFAR specific radios like "TFAR_anprc152_6" has to use their own name as they seemingly don't fall into the overall "ItemRadio" category. This seems to be the same with other items like laser designator and nightvision.
I am trying to see if there is a way to get the majority of the different variations without having to add the string of each single variation. I thought they would have some base-game class they were inheriting from I could target, but I can't seem to find if that is the case?
I am trying to see if there is a way to get the majority of the different variations without having to add the string of each single variation.
not really
if you just want to unassign items you can use the getUnitLoadout command
its probably easier to just check what items the player has, and then check if they inherit from the class you want
otherwise, look at the item's slot info in config
if it's radio, remove/unassign
Pretty sure TFAR radios inherit from ItemRadio
Yeah, what I feared Dedmen.
Yeah, might be the better way around to get unit loadout and check the items that way.
Dedmen, hmm, just tested it by doing _this unassignItem "ItemRadio"; on a unit with the TFAR 152 SR radio. Its still in the slot.
TFAR also iterates through all your items in your inventory
that's not what dedmen meant
Cheers for the quick answer though! Helped me get ideas how to deal with it.
Dedmen, hmm, just tested it by doing _this unassignItem "ItemRadio";
unassignItem takes a classname
oh
not a parent class of some item.
only one specific classnames that has to be an exact match
Thanks for the quick help btw! ๐
Is findEmptyPosition broken?
I've preloaded the area with findEmptyPositionReady [0, 200] and trying to find an empty position:
_pos findEmptyPosition [50,200,_vehtype];
And it returns nothing for any area. If I decrease the radius to 25 and below, it works.
Dedmen, question about TFAR. Do you remember of the top of your head if its possible to set a LR backpack to not work anymore? I know I can set variable on a unit to make it unable to use the radios, but I was interested in simulating disabling the current LR backpack worn by the unit. While still making it possible to find a new LR backpack and equipping which would then work.
Been looking through the TFAR functions, and I don't really see a way of "disabling" a LR on a per-radio basis. I thought about changing the LR radio-code to random value, so there would be no comms or simply replacing the LR backpack with a non-LR backpack as alternatives.
How can I delete a projectile a few seconds after it's been shot? (grenade out of a GL in this case)
I've been trying for a while, this doesn't seem to work (I'm pretty new to scripting)
{
_x addEventHandler ["Fired",
{
private _projectile = (_this select 6);
if (_projectile isEqualTo "F_HuntIR") then
{
_this spawn {
sleep 2;
deleteVehicle _projectile;
};
};
}];
} forEach allPlayers;
I don't think it even goes into the if statement
Not sure if you can pass the _projectile as _this and have it inside the spawned execution like so. I would probably make sure to pass it.
[_projectile] spawn {
params ["_projectile"];
sleep 2;
deleteVehicle _projectile;
};
If you are unsure if it gets into the if sentence, add a systemChat "inside if" or diag_log and check your .rpt file. Can be handy to see how far it comes. ๐
I checked using hint inside the if statement, it did not print out anything
so the current issue is that the if statement isnt working :c
double checked for spelling, tested another projectile
checked it fires the eventhandler correctly? So it prints out your hint if you put it before the "if"? You could try to print out the _projectile before the if, to see if the event handler fires correctly and if the projectile is correctly given.
huh projectile name is different
"ace_m1070_armed.p3d"
I don't really get it. I used if (_projectile == ... in a HandleDamage EH and it worked fine.
The _projectile parameter is the object that gets shot it seems. So the 3D object I guess. Have you checked if you get what you want if you use _ammo parameter? thats number 4. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired
testing in a bit
_ammo does return F_HuntIR
{
_x addEventHandler ["Fired",
{
private _ammo = (_this select 4);
private _projectile = (_this select 6);
if (_ammo == "F_HuntIR") then
{
[_projectile] spawn {
params ["_projectile"];
sleep 2;
deleteVehicle _projectile;
};
};
}];
} forEach allPlayers;
this works
so in HandleDamage, _projectile is a string, in Fired, it's an object
and here I was trying to compare an object to a string, which obviously doesn't work :P
thanks for the help
anyone know of a standalone script like the antistasi vehicle spawner?
like, that will spawn a vehicle in and then let you move it around by having it attachto'd the player, and then spawn it for real once the player has selected a good location?
bit of an odd question,
is there any way to turn a UAV turret into a enterable vehicle?
wdym?
as in making a player actually get in the turret seat?
huh?
Added: setServerEventHandler and getServerEventHandler script commands, as well as a serverNamespace script command
set a LR backpack to not work anymore
In beta you can turn radios "off"
TFAR_fnc_radioOn I think
what r these?
#arma3_scripting message
KK's, haven't looked into what they do
I think they are for the server.cfg eventhandlers like onHackedData
oh. ok thanks
ohh. Cheers, will try it out.
I'm currently looking at implementing a system for aircraft crew (pilot/co-pilot only at this stage) whereby I'd like the pilot to be running a drawIcon3D command in a Draw3D Event Handler, drawing an icon based on where the co-pilot is looking, and continually updating until the co-pilot performs an action. I'm good for most of the script, but being the good little SysAdmin I am, I'm seeking advice on the best method to communicate that pos between co-pilot & pilot. Should the co-pilot just set a variable and the pilot client retrieves that variable? I don't particularly want to flood client bandwidth so looking for suggestions from those more learned than I. TIA.
I would check if arma already natively synchronizes where everyone is looking at first of all ๐ค
although I guess you need not direction but the position on the ground, right?
I think in that case it's fine to set variable on copilot periodically with a global flag, and use remoteExec to send 'events' from copilot to pilot when the copilot pushes the button or does something
Yeah, will need pos on ground (probably using worldToScreen on the co-pilot side).
although it would be quite a waste to setVariable publically on the copilot if only the pilot needs that data, in that case you can remoteExec something on pilot's machine directly I think
That's what I was thinking, and doing it say every 0.1 or 0.2sec or something like that. I don't particularly want to flood anyone's (or everyone's) connection. Am wondering what would be an acceptable rate.
just start with sending it every frame
Though it's just a pos array I'd transmit. Not like huge amounts of data. The pilot client would process the pos from there.
I don't remember how remoteExec works exactly, I think it sends data to server first, and then to the target machine?
you can also calculate the position on the pilot's machine
that way there's no need for remoteExec
You can get the pos where another player is looking?
no but you can calculate it:
https://community.bistudio.com/wiki/getCameraViewDirection
https://community.bistudio.com/wiki/terrainIntersectAtASL
you can also use lineIntersectsSurfaces, but that one's slower and you probably don't care about the little diff anyway (since you're in the air)
ofc, if you don't scale the icon, you don't even need the intersect (drawIcon3D shows the icon the same size no matter how far it is from you, unless you manually scale the size)
Brilliant info, thanks so much @little raptor. Yeah not needing to draw the icon at scale, so reduces the calc slightly.
yep
_p1 = eyePos _copilot;
_p2 = _p1 vectorAdd (getCameraViewDirection _copilot vectorMultiply 1000);
//drawIcon3D @ ASLtoAGL _p2
camera to world 0.5, 0.5?
the copilot is not local. we're doing this on the pilot's machine
aG
it is synced because you see where their heads are looking
(at least it should be)
eyeDirection maybe?
I think it had some problem (I don't remember what it was)
but yeah, I would kinda be wary about this player-controlled camera thing, test to be sure
(and btw if you get more knowledge, please share for the #community_wiki ofc ๐)
@bitter stone Not many people know but you can launch two armas through launcher with different profiles, then use one as server and another one as client. Also make sure you use -nopause option which is also available through launcher. Then you can easily test how good everything works.
@winter rose oh right I think it was the head's actual direction
As you know your head doesn't rotate after some point but you can still see behind you
That's why eyeDirection is not a suitable option
(that's just what I remember tho. I'll test when I launch the game)
@astral dawn thanks for the hint! I usually just use my laptop but was putting that off as I'd need to do a full Workshop download before I could start. Ugh!
If you decide to go with remote execution of code, a good optimization is to send update only when data has changed. Previous remoteExecs are guaranteed to arrive by the game.
I'm hoping it won't come to that, but we'll see what works best. @little raptor has given me a good way forward, will get that sorted first.
Since recent steam update you can go into game properties in steam and disable certain workshop entries without unsubscribing from them.
cool! I didn't know that!
It's quite new.
Yeah, that's the point.
I thought you could disable updating!
oh nice. it shows the size!
but it's wrong! ๐
it looks to be the download size; or maybe the one reported on the workshop
You legend. That's brilliant news. I've got the 2nd client running on my main PC (gotta use up 32GB RAM somehow), but knowing I can do a reduced workshop list on the laptop is really helpful.
Before that feature was introduced when I wanted to run arma on my ultrabook I've been manually downloading arma via steamkit/steamcmd :D
And mods too. That was annoying.
You do this through properties -> workshop entries which has a list of which items are subscribed with a checkbox, name and size or am I looking in wrong place?
yeah, here
It synchronizes across pcs when you unsubscribe ?
no, it should not.
You do not unsubscribe here, you disable that certain item on that PC.
Define disabling here, you mean unticking right?
When I untick here, it syncs on my 2nd pc as well?
go test. ๐
The moment I disable an entry, my 2nd pc is updating the workshop items.
hmm, that sucks then. It was not doing that when I've been testing it for the first time on my notebook. Maybe it was too slow to send it ;d
I've not opened steam on it ever since.
I knew it was too good to be true. But still it is good to temporarily disable entries without forgetting which ones are there.
One day, hopefully we will have it too
is there a way to increase the radioChannelCreate limit?
no
You answered the question yourself. It's a limit
there are also limits that you can change ^^
but I'm wondering. why is it so small? ๐ค
I'd assume reasons
but all joke aside, maybe a #arma3_feedback_tracker ticket could happen, IDK
yo bros what commands do you use to succesfully create AI convoy that moves in formation like the mission "Moral FIber" of the east wind campaign?
how to check if class has no properties (empty class) in description.ext ?
note: I can't check for specific property, they can be different for each class
I would answer "but why?"
so I can ignore it my search procedure
what are you trying to search for? ๐
my answer remains yes ๐
empty class
no; that's not what you want.
What do you want to do with the other classes?
count (configProperties [_root, "true", true]) == 0 probably, but still its unlikely this is what you actually should be doing ๐
will try this. yes, I am already at that point where there is no strait way to do it, so I am going "the other way around" to tackle my problem
ยฏ_(ใ)_/ยฏ
Hey guys, super newb here!
I would like to know if there's a log where I can see the events and triggers that happens during gameplay or after playing... is that possible? thanks for reading!
not really!
OK, thanks!
Hey all, I have a mobile respawn point, but I would like for it to have a different respawn timer, is there any documentation/examples you can point me towards?
PS. I am noob at scripting, so a direct example would be nice, looked at this https://community.bistudio.com/wiki/setPlayerRespawnTime, but I have no clue how to actually implement it for a single respawn point.
Does anyone know if removeItems is EG or EL? Wiki doesn't tell, and I am currently having issues trying to get remote units in my dev setup to test it. https://community.bistudio.com/wiki/removeItems
the best you can do is keep an eye on the rpt which contains events that are either logged by the engine or logged via diag_log command: https://community.bistudio.com/wiki/Crash_Files
Also for missions, add the following to your description.ext:
allowFunctionsLog = 1; // 0: disabled - 1: enabled. Default: ?
``` this will add some more logging info for certain functions.
Fair R3vo. I'll work with that assumption and when I do later tests on dedicated server I'll see if it holds up. Thanks for the reply ๐
If you test it, make sure to post the results in #community_wiki
ah, will do.
Any idea on why this creates the light but not the fire:
0 = this spawn {
private _pos = _this modelToWorld [0,0,0];
private _light = "#lightpoint" createVehicleLocal _pos;
_light setLightDayLight true;
_light setLightColor [5, 2.5, 0];
_light setLightBrightness 0.05;
_light setLightAmbient [5, 2.5, 0];
_light setLightAttenuation [3, 0, 0, 0.6]; private _fire = "#particlesource" createVehicleLocal _pos; _fire setParticleParams [
["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 10, 32], "", "Billboard",
0, 1, [0, 0, 0.25], [0, 0, 0.5], 1, 1, 0.9, 0.3, [1.5],
[[1,1,1, 0.0], [1,1,1, 0.3], [1,1,1, 0.0]],
[0.75], 0, 0, "", "", _fire, rad -45];
}; _fire setParticleRandom [0.2, [1, 1, 0], [0.5, 0.5, 0], 0, 0.5, [0, 0, 0, 0], 0, 0];
_fire setDropInterval 0.03; ```
why are the last two commands outside the spawn? 
Ohh shit, copy paste bollocks ๐
Thank you very much! I will check this out as soon as I can!
so did it work?
started learning c#, now I know again what it was like to be a newbie to sqf ๐
Yes! #screenshots_arma message Thank you very much! Now I just need to find a way to have the wind not affect the fire as much!
Next you will know what it is like to program in God's Finest Programming Language
Problem I had with c# was not the language itself but the thousands of frameworks and packages and stuff 
The "Smoke" module on EDEN has a "wind effect" param, how do I access that for any other particle?
isn't it a particle parameter?
lol, I'm learning JS and I feel my head is exploding! Can't imagine about C# or C++
Perhaps but I can't find it anywhere
Thanks! I wouldn't have figured it out in a thousand years
The biki knows...
I wish Arma 3 had a menu for customizing airplane loadout in-game. GOM script is outdated and does not work. We really need an updated one.
Hi all,
Situation:
trying to get some vehicles to withstand more dmg e.g. taking less dmg from a missile.
Issue:
However when using the HandleDamage, if the vehicle gets hit by an ammo doing >1 (>100 %) dmg the vehicle is already destroyed before the event handler can be executed.
Is there any other way to set this up or increment the hit point on those certain vehicles?
if the vehicle gets hit by an ammo doing >1 (>100 %) dmg the vehicle is already destroyed
no. that's just the damage before being applied
you're probably running some other mod that's interfering with your EH
that was my understanding too... will investigate if i find something interfering
yo bros what program do you need to open fsm?
Arma 3 Tools, FSM Editor
thank you pol
is there a download of all scripting commands for offline times?
For when BIKI's down?
web archive maybe
supportInfo might helps you
or that yeah
Use Visual Studio Code, it has contextual info about scripting commands when you hover over it when editing code. That will also help.
most plugins are outdated though
There's the COMREF Lou created (which is a bit outdated) or you can use the Wayback Machine or Google Cache.
COMREF: https://forums.bohemia.net/forums/topic/229631-beta-arma-comref-offline-wiki/
@little raptor in your debug console's config viewer, is there a way to if I say, filter by "fire", to scroll through all config names containing "fire"? Instead of it just homing on the first one it finds?
you mean the class names?
yeah
did you type it into the top left search bar?
yes, but it only goes to the first one it finds and I can't move to the next class name that contains fire such as "Land_Fire_%"
oh right. I've fixed it. It's just not released yet
you can try the Config Search option instead. It's slower, but if you search in a specific class it'll be faster
what do you want to search? and where?
thats just an example. just looking for a fast way to cycle through all the class names of what I would "think" a specific building would have in it without looking through all of the CUP documentation.
well for example, if you want to search in CfgVehicles:
first select CfgVehicles class in the tree
then open Config Search (Ctrl+F)
then type what you want to search, and check "Start from current config" (so that it searches in CfgVehicles)
if you want to search in class names, don't check the other two options
didn't realize there was the config search option, thats my bad for not looking through all the menus
it's ok.
I think I explained in more detail in the PDF manual
hi, how can i open the Debug console in the main menu ?
you can't 
you can open it in editor tho
Why would you need to?
i wanted to find out how i can change the intro mission of the background in the main menu
there are some profNamespaceVars like tanoa_intro1_reloads_false 0
Just look at CfgMissions
And/or CfgWorlds
There's no point to open in the main menu whatever
i want to change the preview of the editor button background image
@sonic linden This is what you wanna read then https://community.bistudio.com/wiki/Arma_3:_Main_Menu
i already set this up and when ever i was first playing the map and go back to main menu it shows up but my goal would be that it shows up at the first game start
is change -world= launch param the only way ?
Or maybe modify the script whatever doing main menu controlling things
Thank you very much!!!
I'm working on a single player(no squad) ALiVE mission which takes place at the same time as Game Over does in the story plot. I was thinking it'd be cool to have a mission where you can go anywhere on the map, pulling maps off dead solders for intel, and collecting chemlights as a proof-of-kill token. Thus I'd need a script to remove chemlights from bodies that aren't killed by the player and one that 'takes maps placed in box and counts them...'
Are there any scripts like this already made?
Also, looting objects from NATO dead NATO forces gets you shot, as does wearing CSAT uniforms, etc...keeping the player from abusing equipment...
addAction, removeMagazine, etc ๐
I'd have to enter that per every soldier though?
you could, but you can script that for existing/created units
you can use loops to apply the same code to each soldier
Can you URL an example? I've done C coding, I'm just not sure how to do a check on...bodies I guess...
Also I kinda wanna do it right and not run something that's gonna kill Arma's state engine...
units east apply
{
_x addAction
[
"title",
{
params ["_target", "_caller", "_actionId", "_arguments"];
},
nil,
1.5,
true,
true,
"",
"true", // _target, _this, _originalTarget
50,
false,
"",
""
];
};
in here you said:
remove chemlights from bodies that aren't killed by the player
how else can they be killed?
This one gets me every time
Have you ever seen AI drive ๐คฃ
I mean there isn't any "pre-dead" bodies right?
if there isn't, you can just use a killed event handler
one that 'takes maps placed in box and counts them...'
so you "collect" maps and put them into a box?
Are there any scripts like this already made?
I don't crawl the internet for scripts so idk, but what you asked is pretty easy to make if you know any sqf
Yeah, good thing to get started with sqf.
Well, with ALiVE I'd imagine the AI is killing each other so...
Maybe it'd be easier to remove all chemlights/maps and add them back on player-kill?
Actually..yeah ok, I'll just look for a friendly-fire end mission script and start with that...
Maybe rather than chemlights I could change it to dogtags/military IDs...I'm not military but I'm guessing that would have value to intelligence ops...
that's not what I meant
oh, "don't bury the survivors?" ๐
Ahh I see, yeah it would be a killed event handler...
I wanna play a sound and attach it to an infantry unit. Which sound command do I use?
I tried playSound3D but the sound stays at the initial position, can't seem to make it follow the unit
Did you try say3D?
Trying it right now, sound isn't playing
Do file directories not work?
_this say3D "RAS\environment\RAS_ancients.ogg";
how do you script a waypoint of "join" / "getin" type properly - sure you can setWaypointType, but how do you set the join/getin target to a group/vehicle?
no you need to define a class in CfgSounds first and use that, see https://community.bistudio.com/wiki/say3D and https://community.bistudio.com/wiki/Description.ext#CfgSounds
Can I not do it during the mission by executing a code with Zeus Enhanced?
https://community.bistudio.com/wiki/playSound3D takes a file so maybe that could work
ah I should read all messages
:P
I could use the zeus play sound module and attach that to the object, but unfortunately the sound file itself is low volume.
and description.ext is out of question completely? because that seems like the only less complicated option
Not the owner of the server :P
then how do you have access to the sound file?
I unpacked the mod folder and found the directory
there could be a sound class defined in the global sounds config. try the config viewer and look in CfgSounds for the filename
configFile >> "CfgSounds"
anyway gotta go for a few hours. good luck and maybe someone else can help you further :)
Thanks ๐
Can someone tell me why this works?
Tally_Fnc_CheckDir = {
/* this function checks the relation of direction between an object (_Attached_OBJ) that is attached to another (_Anker_OBJ)*/
Params ["_Attached_OBJ", "_Anker_OBJ", "_TargetDir"];
_Attached_OBJ setDir _TargetDir;
Private _ReturnValue = false;
Private _CurrentDir = ((floor GetDir _Attached_OBJ) - (floor GetDir _Anker_OBJ));
private _DirLow = (_TargetDir -5);
private _DirHigh = (_TargetDir +5);
if (_CurrentDir < -1) then {_CurrentDir = ((_CurrentDir - _CurrentDir) - _CurrentDir)}; // why on earth this works I have no idea, but it inverts the number in sqf?????
if ((_CurrentDir == _TargetDir) or
((_CurrentDir > _DirLow) && (_CurrentDir < _DirHigh)))
then {_ReturnValue = true};
_ReturnValue};
I am particularly refering to the algorythm that inverts the number
_CurrentDir = ((_CurrentDir - _CurrentDir) - _CurrentDir)
((-180) - 180) - 180 = -540
but in SQF I get 180
WHYYYY?
because ((_CurrentDir - _CurrentDir) - _CurrentDir)
-180 - -180 - -180
also in case you didn't notice:
(_CurrentDir - _CurrentDir) = 0
so all you're doing is -_CurrentDir
((-90) - (-90)) - 90 = 90?
also I have no idea what you're trying to do.
but I think you're doing it wrong 
So when u attach an object in mp
it doesnt always fire
so to check that it actually has done what it was told to
and set the dir
I wanted
I use this to check if the dir is the wanted dir
however
why?
just check attachedTo
No, I mean it will attach but not set the dir
no what you need is:
(_dir + 360) % 360
remainder of division
why not use setDir manually
also the wiki does say that
the wiki already says what to do:
https://community.bistudio.com/wiki/attachTo
Multiplayer:
use _attachedObj setPosASL getPosASL _attachedObj after setDir to synchronise set direction over the network
{
params ["_Object", "_Elevation"];
_Object setpos [(getpos _Object select 0),
(getpos _Object select 1),
_Elevation]}
that's wrong
I mean not "wrong wrong".
it'll work.
but it's slow
you can do it faster:
_pos = getPosASL _object;
_pos set [2, _elevation];
_object setPos _pos;
(I don't recommend using setPos/getPos tho; unless you actually know why you're using them)
oh ok
I'm trying to wrap my head around remoteExec.
So, let's say this is the normal command
[side _buyer, "Base"] sideChat _msgString;
what would that command look like with remoteExec?
see the pinned messages, see if you get it.
(2nd message from the top)
how to determine who used a radio trigger?
Thnx btw!
does thisList return anything?
it does not, empty array
technically only a player can use the radio trigger, so just use player?
dunno. if the code executes locally, yes
otherwise if thislist is empty, the answer is "NO"? ๐
the answer is 
can you test it in MP?
[[side _buyer, "Base"], _msgString] remoteExec ["sideChat", [0, -2] select isDedicated]; //remote exec for everyone; if server is dedicated, don't execute on server (-2)
Yeah thanks, I got it to work based on that sticky ๐
So you added at the end additional condition to have it not execute on server, if dedicated.
Is this to reduce network load? Like, cause if dedicated it would be called once on ever player, and on the server which again would call it a second time on every player?
Is this to reduce network load?
well in this case the code doesn't have much of an impact.
the server is dedicated so it can't display the message to anyone. so there's no point in executing the code on the server too.
if dedicated it would be called once on ever player, and on the server which again would call it a second time on every player?
no, it would execute for everyone once. (including the server)
Ah okay. Yeah no need to display the message to the server, since a dedicated server ain't a player.
I haven't delved into headless clients since I thus far didn't have need for them. But I wonder using this example, would this still technically display the message to headless clients?
yeah, it would
I don't know of a good way to avoid running on the headless clients.
but you can just make a function and remote exec that. the function should start like:
if (!hasInterface) exitWith {}; //dedicated; or headless
how do you start a keyframe animation when a condition is met?
I don't think it's possible
you could probably recreate the keyframe modules using a script when the "condition is met"
Id be inclined to agree with you, if not for the fact that the module itself has a "play from start" option, which seems a bit redundant if you cant start it mid mission
Is it possible to get the AI to seek cover using scripts? Like easily, rather than scripting it from ground up. The danger combat mode is not all that good for that
"Is it possible to get the AI to seek cover using scripts?"
If it is all about cover where an AI can fire back - depends on your find cover algorithm. If you have a good one, then use it to move AI units to needed positions. Otherwise it is better not to touch AI, and only to help it - like using smoke.
If it is about just finding a cover, like when artillery incoming, then it is easy enough to move units to building position. Or, if you have a good algorithm from the very first case - use it ๐
I don't know such algorithms, and even it is, it should be very resource hungry and buggy.
From my own large experience in making sp/coop modes, with very limited AI options: you don't really need a very complex AI to create good interesting missions. The player experience is very subjective, he almost never examine an AI behaviour for a long time.
For example, if you need enemy units to react adequately on shelling their base, let them to get to cover, to smoke their position, and fire back at you. Even the AI can't actually spot you, you can always be reveal by script - this is what I use. Then make them to attack you position under cover of artillery. Yes, it is not so easy to implement such behaviour tree, but for complex missions it is the only way for you to be sure it works as intended.
I wish we could trigger orders via scripts. The "Take Cover" order is pretty much exactly what I'm looking for, but for some odd reason we cannot call whatever function that order triggers.
maybe worth a FT ticket ๐
@thorn saffron
Actually modders can do it.
For example, I took ACE script and reworked it for my garrison units:
https://youtu.be/RztmiJ7dPbU
Like easily, rather than scripting it from ground up.
It is always better to script it "from ground up" ๐
Like, authors don't even know, how it should work for you.
As for me, key questions was:
- For which units it should be used? How about units that are far away from you? I'm using radio control for AI, so they need to be in range.
- In what conditions they need to move to cover? It is not the best idea to move them during the intensive firefight.
- Where to look for cover exactly? If those are buildings - of which type it should be? It is not good to "take cover" in tents or on watch towers ๐
- When they should leave it, with what conditions?
And so.
I've found out how to do it, you need to use: [timeline_module] call BIS_fnc_timeline_play;
Heyho ๐
I'm trying to implement a trigger in my mission that fires only if a certain amount of players are inside the trigger field. Because I can only test it myself, I dont know if the trigger works.
My Condition inside the trigger is
count allPlayers > 15;
Does this work? Just a heads up, cannot test it myself
count allplayers will give the total number of players on the server
I think this might work
count (allplayers in this) > 15;
does this just return all players on the server and if > 15 (on server), the trigger will fire? after the first person enters it?
it will activate the trigger once 15 players are inside the triggers area
My version or your version?
my version
your version will activate the moment there are more than 15 players on the server
ah, nice.

