#arma3_scripting
1 messages Β· Page 126 of 1
Needs a timeout, otherwise you'll have N-1 scripts permanently running every frame for each player.
A job for initPlayerLocal really.
or you just man up and use the command line
Hey guys having an issue with triggers on a dedicated server. I split my triggers between 3 different blufor groups by syncing the group leader to the trigger. The the triggers seem to work fine in the editor but once on the server which ever group reaches their respective trigger first are the only group to have their follow on triggers activate for the rest of the mission. Any ideas? Thanks for the help!
Nice thanks 4 the info
I am trying to get this line of code to read In In game hours rather then In game days. I have had a hard time doing so.
if (isServer) then {
FOG_ON = false;
};
0 spawn {
if (isServer) then {
0 spawn {
while {true} do {
if (!FOG_ON) then {
0 setFog 0;
};
sleep 1;
};
};
};
};
0 spawn {
if (isServer) then {
while {true} do {
_date = date;
_day = _date select 2;
waitUntil {sleep 3; _day != (date select 2)};
if ((random 1) < 0.2) then {
FOG_ON = true;
30 setFog (random 1);
} else {
60 setFog 0;
sleep 60;
FOG_ON = false;
};
};
};
};
https://community.bistudio.com/wiki/date
You are currently using date select 2 - the third element (zero-indexed) of the date array, which contains the current day. The current hour is stored in the fourth element (zero-indexed) of the date array, so you need date select 3.
Hi is there any info on respawning vehicles with custom inventories?
I think I found a solution to my spectate Issues. I just need help with making this line of code work with only one type of role If anyone can help add that to this line of code. Thank you.
["Initialize", [player, [], true, true, true, false, true, true, true, true]] call BIS_fnc_EGSpectator;
It has to be placed In the onPlayerKilled.sqf
Would this happen to work and make?
if (typeOf (_this select 0) isEqualTo "B_recon_JTAC_F") then {
["Initialize", [player, [], true, true, true, false, true, true, true, true]] call BIS_fnc_EGSpectator;
};
To any repsonse thanks ahead of time.
Only during loading though, is it a big deal?
Nah, the script is perpetual on machines where the unit isn't local.
But waituntil is only for local player (loading finished)
so its gonna stop once player loads it
If it's in an init box, it runs for every player, right
Only one of them will ever be local.
It's not waiting for the unit whose init field it is to be local, though, it's just waiting for player to be local
The waitUntil only references player and so is unit-agnostic. The subsequent if check cares about the specific unit, but that only happens once, it's not part of the waitUntil
is there any real advantage to broadcasting a number type variable instead of a short string, in terms of network congestion? Also, what is actually broadcast in the case of an "object" type? A string? A numeric id? Something else?
Yeah, but local checks for return of player command, not unit of the init box, so its just a "wait until loading is finished" not specific to any unit
oh right, you have the player == _this check afterwards
I think the difference is a drop in an ocean
Objects are probably net id interally
Is there anything at all distinct about calling a function from a server addon versus calling one defined in a mission?
no difference, they all get defined into mission namespace during gameplay (or other namespace)
Well, there is one difference, which is that if the function from the server addon is defined only in CfgFunctions (i.e. has not been publicVariable broadcast), then it will only exist on the server and can't be executed on clients
Hi all π
I'm trying to set up a "Start Hacking" prompt to open a locked door after 5 minutes. Ideally, it would display a timer indicating how much time is needed to finish the hack, but what I'm having the most trouble with is just trying to figure out how to open the door with SQF.
I have:
this addAction ["Start Hacking", "openDoor.sqf"];
setup to trigger the SQF script. But I was wondering if anyone would have any pointers on how to open the door? It's a modded door, explicitly, NT_Bunker_Doors from the Northern Takistan map.
None of the class names or other scripts I've looked at seem to work.
If you have any suggestions on where to start or examples it would be greatly appreciated!
Open Config viewer, find your building\object class in CfgVehicles, check its AnimationSources, doors should be there
I noticed that this:
[{ player sidechat "HI";}] remoteExec ["call"];
when called on the server, causes remote execution on the clients, but I don't see in CfgRemoteExec where I've allowed this to happen. Can anbody shed light on why this might be?
Oh never mind, I just realized the server doesn't have any remote exececution restrictions.
Cheers, I was able to identify the door names: Door_1_sound_source & Door_2_sound_source
I'm trying to execute the SQF from the addAction like so to open the doors, but I'm not having any luck.
_building = (nearestObject [player, "nt_bunker_doors"]);
hint parseText "Hacking has commenced. It will take a few minutes...";
_building animate ["Door_1_sound_source", 1];
_building animate ["Door_2_sound_source", 1];
Any ideas?
I think you need animateSource
Check code for BIS_fnc_Door its the script that vanilla buildings call when you open a door
Could it be how I'm referencing the doors nt_bunker_doors vs land_nt_bunker_doors? Just tried with both and animateSource and no dice unfortunately. π¦
no idea, you gotta dig the configs to find they way these doors work to open them with scripts
How do i make an ally marker like Riker here? I just can't seem to find the keyword
Hard to find as it's called IFF π
Any idea why I can't get the size of locations (MALDEN) with this script:
_center = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");
_radius = getNumber(configFile >> "CfgWorlds" >> worldName >> "MapSize") / 2;
private _showAreaMarkers = true;
private _showDebugMarkers = false;
{
private _locationText = text _x;
private _sizeX = 50;
private _sizeY = 50;
_sizeX = getNumber (configFile >> "CfgWorlds" >> worldName >> "Names" >> (text _x) >> "radiusA");
_sizeY = getNumber (configFile >> "CfgWorlds" >> worldName >> "Names" >> (text _x) >> "radiusB");
if (_sizeX < 100) then {_sizeX = 100;};
if (_sizeY < 100) then {_sizeY = 100;};
if (_showAreaMarkers) then {
private _mkrLabel = format["lbl_%1", _locationText];
private _areaMkr = createmarker [_mkrLabel, getPos _x];
_areaMkr setMarkerShape "Ellipse";
_areaMkr setMarkerType "hd_dot";
_areaMkr setMarkerBrush "SolidBorder";
_areaMkr setMarkerColor "ColorRED";
_areaMkr setMarkerText str((text _x));
_areaMkr setMarkerAlpha 0.5;
_areaMkr setMarkerSize [_sizeX, _sizeY];
};
if (_showDebugMarkers) then {
private _mkrName = format["mrk_%1", _locationText];
private _areaMkr_debug = createmarker [_mkrName, getPos _x];
_areaMkr_debug setMarkerShape "ICON";
_areaMkr_debug setMarkerType "selector_selectedMission";
_areaMkr_debug setMarkerColor "ColorBLACK";
_areaMkr_debug setMarkerText str((text _x));
_areaMkr_debug setMarkerAlpha 0.5;
};
} forEach nearestLocations [_center, ["NameCityCapital","NameCity","NameVillage","CityCenter"], _radius];
If I do ```sqf
_areaMkr setMarkerSize [100, 100];
It works just fine, so the _sizeX and sizeY are the issue...
Why not use worldSize to calculate center radius ?
https://community.bistudio.com/wiki/worldSize
and 2 why not use https://community.bistudio.com/wiki/locationPosition
for puting marker there ?
Good suggestions but when implemented the results are the same, since what I am not able to get is the size of each location... Can it be that the locations in Malden don't have that info?
Just print the values from the config and see for yourself,
I wouldn't rely on BI configs in this regard.
Does anyone know if "Suppressed" event handler should trigger for grenade explosions?
no
it only triggers for shots with ShotBullet simulation
@Any bored Biki-editor: https://community.bistudio.com/wiki/Number could need a small update to clarify this caveat:
typeName 3.4028235e38 = "SCALAR"
typeName 1e39 = "NaN"
The page states "In SQF, there are multiple accepted number formats. However, all of them will result in the same SCALAR (typeName) value type." but that is only true as long as the value remains finite.
Not a huge issue but it tripped me up in my testing so thought I'd share.
Hello, quick question. Im trying to have a turret with the name "UNSC_turret_1" be destroyed using a trigger. I cant get the turret to actually be destroyed with the code, however. This is what Im working with
["UNSC_turret_1", 0] remoteExec ["setHealth", 0, true];
the trigget itself should be the issue as it works for other commands.
Try:
UNSC_turret_1 setDamage 1;
There double fixed it...
Variable names are not "strings". Use UNSC_turret_1, not "UNSC_turret_1"
setDamage is Global Argument/Global Effect and does not need to be remoteExec'd
would that also be multiplayer compatible then?
thats the main concern I have π
See NikkoJT's message
Ah right, cheers leo
I don't get what people find so confusing about git. Working dir/stage/commit aren't exactly magic. Neither are merge conflicts or branches. What's supposed to be so confusing about git?
EDIT: Interactive history-rewriting rebases with lots of squashes are certainly confusing but they're not exactly what normal users tend to do.
im currently using triggers to detect when a player enters an area, but for trigger limitation issues this wont work anymore. Id like to be able to detect when a player enters a location (of varying sizes and locations) and use that detection to trigger additional scripts. my current idea is to drop area markers on all the locations in the mission and then try to use nearestLocation to monitor player distance (this will be for multiplayer so multiple players will need to be tracked) but before i dive into making that work somehow, is there a better way of going about this?
Hello, wondering if there is anyone who could let me know how to get this script to work in multiplayer.
_unit = _this select 0;
//Save Uniform Items
_uniformItems = uniformItems _unit;
//Add Random Uniform
_unit addUniform selectRandom [
"UK3CB_CHC_C_U_HIKER_04",
"UK3CB_CHC_C_U_ACTIVIST_01",
"UK3CB_CHC_C_U_COACH_04",
"UK3CB_TKM_O_U_06",
"UK3CB_TKM_O_U_06_B",
"UK3CB_TKM_O_U_06_C",
"UK3CB_ADC_C_Hunter_U_07",
"UK3CB_ADC_C_Hunter_U_09",
"UK3CB_ADC_C_Hunter_U_08",
"UK3CB_ADC_C_Hunter_U_10",
"UK3CB_CHC_C_U_WOOD_04",
"UK3CB_CHC_C_U_WOOD_01",
"UK3CB_CHC_C_U_WOOD_02",
"UK3CB_CHC_C_U_WOOD_03",
"UK3CB_MEI_B_U_CombatUniform_WDL_01_JEANS_WHITE",
"UK3CB_MEI_B_U_CombatUniform_WDL_03_BROWN_RED",
"UK3CB_TKM_I_U_06"];
//Restore Uniform Items
{_unit addItemToUniform _x} forEach _uniformItems;```
Items that were saved in _uniformItems array are not being transferred after new uniform item is added.
it took me a month or two before i wasn't getting horrible merge conflicts in ACE2
but once it was done i loved git
and couldn't imagine going back to SVN
That was pre 1.7 tho
yea and i was using gitext which was kinda confusing back then
it'd improperly label stash merges
so theirs would be yours, and yours would be theirs
gawd
it considered them to just be a normal merge
yah, thats fixed now so its way less confusing when you get a merge conflict from an auto-stash
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Q: when presenting text for a diary record, i.e.
_player createDiaryRecord [_subject, [_title, _text, _icon]];
I could have sworn there was a way to size an <img image='...'/> was there not? is it according to the power of 2s guidance?
https://community.bistudio.com/wiki/createDiaryRecord click "Show text"
perfect thank you
Spawning ai with headless client to attack a town, and when I give all the squads the waypoint to attack, the tank squad is the only one which doesn't get a waypoint? The tank does get a flag so _aafTank1_vehicle works, but not the group variable for some reason
_aafTank1 = [getMarkerPos "AAF_tankSpawn_1", 125, "UK3CB_AAF_I_T72BC", indep] call BIS_fnc_spawnVehicle;
_aafTank1_vehicle = _aafTank1 select 0;
_aafTank1_group = _aafTank1 select 2;
_aafTank1 params ["_vehicle", "_crew", "_group"];
_aafTank1_vehicle forceFlagTexture "\A3\Data_F\Flags\flag_AAF_CO.paa" ;
_aafsquad1 = ["AAF_spawn_1", resistance, (configfile >> "CfgGroups" >> "Indep" >> "UK3CB_AAF_I" >> "Infantry" >> "UK3CB_AAF_I_RIF_Squad")] call TG_fnc_squadSpawn;
_aafsquad2 = ["AAF_spawn_2", resistance, (configfile >> "CfgGroups" >> "Indep" >> "UK3CB_AAF_I" >> "Infantry" >> "UK3CB_AAF_I_RIF_Squad")] call TG_fnc_squadSpawn;
_aafsquad3 = ["AAF_spawn_3", resistance, (configfile >> "CfgGroups" >> "Indep" >> "UK3CB_AAF_I" >> "Infantry" >> "UK3CB_AAF_I_RIF_Squad")] call TG_fnc_squadSpawn;
_aafsquad4 = ["AAF_spawn_4", resistance, (configfile >> "CfgGroups" >> "Indep" >> "UK3CB_AAF_I" >> "Infantry" >> "UK3CB_AAF_I_RIF_Squad")] call TG_fnc_squadSpawn;
_aafSquadsAttackingAnthrakia = [_aafTank1_group, _aafsquad1, _aafsquad2, _aafsquad3, _aafsquad4];
{
_wp = _x addWaypoint [getMarkerPos "anthrakia_wp_1", 0];
_wp setWaypointType "SAD";
}forEach _aafSquadsAttackingAnthrakia;
_aafTank1_vehicle = _aafTank1 select 0;
_aafTank1_group = _aafTank1 select 2;
_aafTank1 params ["_vehicle", "_crew", "_group"];
```this is redundant
there may be a delay for HCs, but I cannot tell you why
try circumventing using group driver _tank or something
This wont work well sigma
ah yes
no peeps in there because indep ^^ https://community.bistudio.com/wiki/indep
So whats the proper way to get the stuff spawnVehicle returns
Either params or select, but you don't need both at the same time, they do the same thing
(well not literally the same thing but for this purpose)
not everyone is Zeusing their missions, so if you can't contribute, don't π
):
He's my friend he's just messing with me
huh
Expansion: side references, like independent, are actually commands that return a special Side data type, so they need to be written in full and correctly in order to work. You can find a list of valid side getter commands here: https://community.bistudio.com/wiki/Side
It's now fixed, thanks :)
functions defined in cfgFunctions can't be assigned new script by any means, can they?
Do you mean you can overwrite in any ways? In-game, no, config, yes
in mission. Hoping there's no way a hacker can change the value of a a function variable in cfgfunctions
Not going to say there is 0 chance. But basically it is not possible
are trigger expression fields run in scheduled or unscheduled environment?
https://community.bistudio.com/wiki/Scheduler#Unscheduled_Environment
Where code starts unscheduled
- Triggers
including the condition?
Yes
doc says while loops are limited to 10,000 iterations when in unscheduled environment. Is that true for any other kinds of loops as well?
No
I want to have a number of different options for an 'then' statement, with one being chosen at random. This isn't code it's just trying to get the idea across
if (_enemyDetected) then {civilian says "Yes I've seen them" or "Yes they're around" or "Yeah I saw them today"}
Ideally one of the responses would be chosen and that would be the one executed, just not sure how to do it.
selectRandom ["Sentence A","Sentence B","Sentence C"]```
Well that's awfully simple lol, ty friend
Hello all! I would love some input on this problem I am having: https://forums.bohemia.net/forums/topic/280458-help-with-respawn-asset-script-init/?tab=comments#comment-3520496
(Summary: I am trying to get aircraft to respawn with unlimited ammo and their prexisting pylon/dynamic loadout settings).
Hi everyone, this is my issue. Im trying to force the game to display a specific asset on respawn . This is the export code from the virtual garage : _veh = createVehicle [amf_pvp_01_mag_DA_f,position player,[],0,NONE]; [ _veh, [DA,1], [showeod,1,turretshieldhide,1,showCamonetHull,1] ] call BIS_f...
can I access admins[] = { "<UID>" }; from Server Config File via SQF ?
Is there a way to get a burst with Blackfoot 20mm gatling besides spamming forceWeaponFire each frame? I'm using disableAI "all" so the bastids can't fly around while the lead is going out. Because most of the specific disableAI enums don't seem to work on helis.
use the AI firemodes
modes[] = {"manual","close","short","medium","far"};
https://community.bistudio.com/wiki/forceWeaponFire the second example even suggests 'close'
They all fire only 1 bullet.
strange it should work
maybne the disableAI is messing with it but its honestly been awhile since I tried it
Only 1 admin can be active at 1 time:
see here:
https://community.bistudio.com/wiki/Arma_3:_Server_Config_File#Logged_In_Admin
And to access to see who is current active admin you could use admin command here:
https://community.bistudio.com/wiki/admin
You can define array of UIDs in the SQF and go from there.
I am not checking who is logged as admin, I need to get array from server config into SQF script
I believe it's ```sqf
_arrayOfAdmins = getArray (missionConfigFile >> "admins");
I dont think that will work missionConfigFile would Be description.exe and the admin [] is in the server.cfg
oh right if the admins is defined in server.cfg then you need something else
Yea that would work
Do it like this myb:
private _allServerVars = allVariables serverNamespace;
To check if the admin variable exits if it exits then just do:
private _adminArray = serverNamespace getvariable "name of a variable";
I thought it would be possible to read the admins directly from config but I guess I was wrong
Please tell me what's wrong here. In log : Error position: <#define ADDITEM(a,b) for "_i" from 1 to > Error Invalid number in expression
that is becouse additem is a command allready
https://community.bistudio.com/wiki/addItem
did you try G_additem as a macro ?
Yes as a macro. I thought it was convenient
are you running that from the debug console?
A #define does not care if the name is reserved. It will be replaced anyways
Yes
That's why
debug console doesn't have a preprocessor
Well, if you put the code into Debug Console directly, it is
Anyone in here familiar with ace3 handcuffed functions?
That's what I do
that's what you shouldn't do
You cant call macros from debug console it has to go trough preprocessor. like compileScript or execVM
If you execVM this file it should work.
im trying to script adding a bag to their head when they get cuffed im newer to scripting could you tell me if im close?
["ace_captiveStatusChanged",
{
params ["_unit", "_state", "_reason"];
if (_state && {
local _unit
})
then {
_unit addHeadgear "mgsr_headbag";
};
}];
I'll try this, thanks
not asking you to solve it for me im just not sure if im approaching it correctly.. also thank you for that link i just started using github literally yesterday.
kinda, but you need to add it as an event handler
right now it's just an array
ah i thought so but wasnt sure sqm still confuses me sometimes even without talking locality lol
["ace_captiveStatusChanged",
{
params ["_unit", "_state"];
if (_state && {
local _unit
})
then {
_unit addHeadgear "mgsr_headbag";
};
}] call CBA_fnc_addEventHandler;
I think
also from what I see there's no "reason" passed to this code
nvm I guess there is
["ace_captiveStatusChanged", [_unit, _state, "SetHandcuffed", _caller]] call CBA_fnc_globalEvent;
appreciate it and its an early wip for sure i just wanted to make sure i was heading the right direction with it before i waste too much time, thank you for being more help than i expected also how did you get your code in here color coordinated still?
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
thank you
you don't really need to use "waitUntil" or "while" all the time
use event handlers instead
e.g. you say you want to remove the vehicle when any unit gets killed
so you can do this:
OG_vehicleObject = createVehicle...;
I'm assuming you only have 1 vehicle
then add a Killed or MPKilled EH to all units that should be checked for being killed
_unit addMPEventHandler ["MPKilled", {
if (!isNil "OG_vehicleObject") then {deleteVehicle OG_vehicleObject};
}];
this code should only run once per unit
so now that the fucnion is wriitten to implement i would place the addbag.sqf to the mission folder and then run exec addbag(paraphrasing) in the missions init correct?
you can just drop that code in init.sqf
tho if you intend to make a SP mission you should also prevent the EH from duplicating
its for a small private mp game
if (isNil "SC_AceCaptiveEH") then {
SC_AceCaptiveEH = ["ace_captiveStatusChanged",
{
params ["_unit", "_state"];
if (_state && {
local _unit
})
then {
_unit addHeadgear "mgsr_headbag";
};
}] call CBA_fnc_addEventHandler;
};
thank you again for your help
everything seems to be ready, but one check stops everything (
I don't think you can use forEach like that. It's doing the check for every unit in those arrays, but it's only returning the value of the last check. So the waitUntil will only complete/not complete based on whether the last unit checked meets the condition; all others are ignored
what is better to use then?
Possibly findIf or count, but it depends on how the logic is supposed to work
Can you just explain what are you trying to do?
as NikkoJT said, use findIf (I assume you want it to happen as soon as any unit has the var)
waitUntil { sleep 1; (allPlayers + allDeadMen) findIf {!(_x getVariable ["MyVariable1", false])} >= 0 };
How would I add this Into one executable line?
this addAction ["Spectator", {["Initialize", [player, [], true, true, true, false, true, true, true, true]] call BIS_fnc_EGSpectator;}];
setViewDistance 10000;
Do you mean you want the addAction to both initialise spectator and set the view distance?
the effect is the same(
I got player setVariable["MyVariable1", true, true];
I spawn a car, it appears, I die and the car is already deleted
or, the car appears, I kill any ai, that is, a corpse appears on the map and the car is removed
I think you're using ! (invert boolean) when you need to not do that. So it's returning true when it finds a unit that doesn't have the variable
or maybe I'm confused about what's going on here. I dunno, the logic is confusing
Yes
waitUntil { sleep 1; (allPlayers + allDeadMen) findIf {!(_x getVariable ["MyVariable1", false])} < 0};
```Try this then?
this addAction ["Spectator", {["Initialize", [player, [], true, true, true, false, true, true, true, true]] call BIS_fnc_EGSpectator; setViewDistance 10000}];```
Thank you.
I will give this a try.
It did not seems to Increase the view distance while In spectate mode. Its not a big deal though. Thank you.
hey, is it possible to add a flag (for a vehicle) in a script to a vehicle that does not have a flag in cfg, i.e. something like attahto??
Trying to get this line of code to denied to Opfor. Seems Opfor can use this...
this addAction ["Teleport to Officer", {
params ["_target", "_caller", "_actionId", "_arguments"];
if (vehicle BlueForCommander != BlueForCommander) then{
_caller moveInAny (vehicle BlueForCommander);
}else{
_caller setPosASL (getPosASL BlueForCommander);
};
}, nil, 1, true, true, "", "true", 5];
https://community.bistudio.com/wiki/addAction
See the condition parameter.
The condition you want to use is probably something like (side group _this) != east
Just put this in init of a vehicle:
this forceFlagTexture "\A3\Data_F\Flags\Flag_red_CO.paa";
And here is the list of all flags:
https://community.bistudio.com/wiki/Arma_3:_Flag_Textures
Wish there was an entity that is just a flag with nothing else
ok, thank you, I'll check it in a moment and let you know π
unfortunately the flag does not appear :(. Is it possible to force it somehow and then add it using the attach to command??.
i dont understeand ;p
then change the condition to
waitUntil { sleep 1; (allPlayers + allDeadMen) findIf {(_x getVariable ["MyVariable1", false])} < 0 };
Vehicles don't automatically support flag textures, they have to be set up with the appropriate position for the flag (I think it's in the model somewhere, doesn't seem to be in config). All/almost all vanilla vehicles do, but mod vehicles may not (cough CSLA cough). If they don't, then this won't work.
topic with flag closed, thanks for trying to help
Thank you very much to all of you!!
my mistake was that I carried out the last tests in one session, which is where the problems came fromπ @little raptor@hallow mortar@meager granite
anyone else feel like this SQF is hard to work with or maybe its a steep learning curve, or maybe Im an idoit
Language is simple but a bit weird. Command list is epic and often poorly documented. Getting started is complicated by having a lot of different entry points.
well, maybe you can point me in the right direction I am trying to display a variable that exist on my file " initPlayerLocal.sqf", It is a "Rifle_level" variable. I have cutRsc ["RifleLevelDisplay", "PLAIN"] I get an error metioning the text size. but it is already defined with sizeEx = 0.03; in the class RifleLevelDisplay.
but i dont think its referencing the actual variable
cutRsc uses data defined in config, not code.
oh well, i might be down the wrong road then
If you're working on a mission then you'd put RscTitles data in description.ext.
correct i have that
idd = -1;
onLoad = "uiNamespace setVariable ['RifleLevelDisplay', _this select 0];";
duration = 10e10; // A very long duration
fadeIn = 0;
fadeOut = 0;
class controls {
class RifleLevelText {
idc = 1234; // Ensure this IDC is unique and used only here
type = 13; // Type for structured text
style = 0;
text = ""; // Initial text will be set via script
x = safeZoneX + safeZoneW - 0.2; // Adjust as necessary
y = safeZoneY + safeZoneH * 0.1; // Adjust as necessary
w = 0.2; // Text width
h = 0.05; // Text height
sizeEx = 0.03; // Text size
font = "PuristaMedium";
colorText[] = {1, 1, 1, 1}; // Text color
colorBackground[] = {0, 0, 0, 0}; // Transparent background
align = "right";
valign = "top";
};
};
};
};
What's the error?
let me get it to error one sec
RifleLevelText.size? in RifleLevelDisplay > Controls.
Yeah you have sizeEx but not size.
See the examples in https://community.bistudio.com/wiki/CT_STRUCTURED_TEXT
Also that looks generally off for structured text. A lot of those parameters go in the attributes class, not the parent.
font, align, shadow at least.
chatgtp is helping me
Ah, there's your problem.
so clearly it isn't the way
ChatGPT is terrible at SQF (and config, I assume)
Steep learning curve though. I have been doing this for about 5 days. and im so overwheled lol I miss Python lol
okay we still got that error with size = 1
wait
hold up i change the wrong thing
You need to change quite a lot of things :P
well no error but didn't work. I apologize, I am finding it difficult.
so the class RifleLevelDisplay { idd = -1; onLoad = "uiNamespace setVariable ['RifleLevelDisplay', _this select 0];"; duration = 10e10; // A very long duration fadeIn = 0; fadeOut = 0; class controls { class RifleLevelText { idc = 1234; // Ensure this IDC is unique and used only here type = 13; // Type for structured text style = 0; text = ""; // Initial text will be set via script x = safeZoneX + safeZoneW - 0.2; // Adjust as necessary y = safeZoneY + safeZoneH * 0.1; // Adjust as necessary w = 0.2; // Text width h = 0.05; // Text height size = 1; // Text size font = "PuristaMedium"; colorText[] = {1, 1, 1, 1}; // Text color colorBackground[] = {0, 0, 0, 0}; // Transparent background align = "right"; valign = "top"; }; }; }; everything here looks good?
I looked into it
Scroll to the bottom. There are examples.
That's probably defined in #include "\a3\ui_f\hpp\definecommongrids.inc" but that doesn't seem to be documented.
ah
You're missing the whole attributes subclass for structured text anyway.
isnt rifleleveltext a subclass?
It looks like ChatGPT just pasted some example for CT_STATIC instead.
okay so basically ill restart
I mean clearly i am struggleing to pin point and understand the compects.
You should probably start with CT_STATIC rather then CT_STRUCTURED_TEXT anyway.
like major hurdle is getting it to display anything at all.
sure, ill need a variable down the road but need a start.
okay... i copy and pasted the documentation in my example and still got an error?
waht the actual fuck. I think its time for a break and more coffee
How does the document example not work with out error? Its structured correctly?
Hey all, which are the currently recommended SQF extensions for VSCode?
even reading thought the pages and pages of docs still getting error after error, fuck man even creating a task or mission is convoluted as hell
okay fuck it im jut restarting, crazy even the basic documation thats full explain or work itself.
The documentation is assuming that you have some GUI defines included.
Like CT_STATIC, ST_LEFT, GUI_TEXT_SIZE_MEDIUM
No GUI examples in the wiki will actually work as written.
okay good info.
I decided to delete a large portion of the code to limit complexity and confuse . so we said that the sizeEx was a chatgpt mistake? but I have this error? like what?
The specific error you had was caused by ChatGPT missing the size parameter.
Now CT_STATIC uses sizeEx instead of size :P
well, no errors anymore. I dont understand how you guys do it. Still cant get anythign to peremently display on screen, though maybe work on the level system? okay so addxp {riflelevel = riflelevel + 1} nope
I dont even know where to start anymore.
my brain is mush after not even completing two task, all day. fucking hell
So waypointAttachObject just does not work? I cant attach it to a unit.
code pls
CallAssasinSquad ={
systemchat "started";
params ["_Target"];
systemchat str _Target;
private _group = selectRandom HouseDefendersGroupList;
CurrentAssasinSquad = _group;
{
_x enableAI 'Path';
} forEach units _group;
private _wp =(_Group) addWaypoint [ _Target, 1];
_wp waypointAttachObject _Target;
_wp setWaypointType "SAD";
};
the wapoint is craeted near the target but is not attached to the target
any ideas?
try -1 for precision placement
same problem
sucks to be you a'ight, lemme fire Arma 3 ^^
CallAssassinSquad ={
systemChat "started";
params ["_target"];
systemChat str _target;
private _group = selectRandom HouseDefendersGroupList;
ROQUE_CurrentAssassinSquad = _group;
{
_x enableAI "Path";
} forEach units _group;
private _wp = _group addWaypoint [_target, 1];
_wp setWaypointType "SAD";
_wp waypointAttachObject _target;
};
```and in this order?
waypointAttachObject is a bit dubious overall tbh, I'm not sure the documentation fully describes what it's for/how it works. It may only be for waypoints that can have specific objects, like slingloading and vehicle interactions
what is _target, a unit?
it works, but refresh rate is every ~2 or 3 5 seconds
@astral tendon good enough?
this would be (I believe) waypointAttachVehicle
ah, you're right, that's what I was thinking of. That explains a few things...
Not sure about that, did not see any update on the possition, and I can't test anymore.
I tested this way:
guy call {
systemChat "started";
params ["_target"];
systemChat str _target;
private _group = group player;
private _wp = _group addWaypoint [_target, 1];
_wp setWaypointType "SAD";
_wp waypointAttachObject _target;
};
so only the player waypoint work?
What is _speed.Size() in Vector3 accel=_speed*(_speed.Size()*_airFriction)?
https://community.bistudio.com/wiki/Weapons_settings
Hello all! I would love some input on this problem I am having: https://forums.bohemia.net/forums/topic/280458-help-with-respawn-asset-script-init/?do=findComment&comment=3520781
(Summary: I am trying to get aircraft to respawn with unlimited ammo and their preexisting pylon/dynamic loadout settings).
how are you trying that?
The target is a AI unit and the group is a AI
OK, and? how do you know their waypoint is not moving?
...by letting they move and the waypoint still in the same place?
did you try reveal the target?
No? is it required?
The squad to move toward the position of a group, in this case one single target
Originally was going to be in a while loop and call it a day but I tried to do something more elegant.
[missionNamespace,"respawn",{
params ["_newVeh", "_veh"];
_newVeh addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1}]; //Infinite Ammo
[_newVeh, [1, "PylonWeapon_300Rnd_20mm_shells", true]] remoteExec ["setPylonLoadout", _newVeh]; //SetPylons
_newVeh setObjectTextureGlobal [0,""];//set Texture / Skin
}] call BIS_fnc_callScriptedEventHandler;
Something like this might work not tested.
thak i read though that
why do you keep osting the dics? i have the docs, i havebeen looking though them all day.
with uiNamespace do
{
hint str rifle_level; //Β 46
};
``` hre is the only thing that seemingly half way works
but again ist is not permanent.
BIS_fnc_stalk?
Thanks for the input. I tried it: no joy however.
How do I make, and loop though, and arrry with multiple data types?
authorized_weapons_dictionary = {
"B_Soldier_F": Rifle_level_group,
"B_Soldier_AR_F": Auto_rifle_level_group
};
my_authorized_weapons = authorized_weapons_dictionary select soldier_type;```
I have that, thanks
@tough abyss There are a lot of tweaks and optimisations that can be made, but hopefully this will get you going in the right direction. Make sure to read the comments in the files, and look up any commands you don't understand on the wiki.
did you write this???
holy cow dude thats a huge help
that hash map is gold i think ill read though it and break it down and try to understand it
it's only day five, maybe im trying too advance stuff too soon
Often the thing people want to do first requires multiplayer addActions, which is one of the harder things to get right in SQF :P
Hash maps are just something that'll make sense if you wrote any other language before.
well, I have some python and I mean some as in super basic, python just seems much intuitive, so maybe thats why im harding a hard time understanding
@grizzled cliff isn't Intercept guarneteed to trigger BE?
BE is not checking on script function calls...
Heh
its checking on the script parser side but you are not parsing any scripts.
yah i mean unless BE is looking for Arma patching itself
this is all done via callExtension to load the DLL into the process
I was more thinking about it checking memory modifications
yah, i dont know if it does sig checking on sqf functions
if you modify arma code by hooking into it itll get detected... While your playing BE sends parts of the executable which is in memory to the BE server and compares it.. if it differs because you changed some bytes... BE got you. But your not hooking into arma as far as i see so it should be fine
theoretically.. i wouldnt risk it anyway
no i am hooking
why?
It is though, it hooks directly into the SQF engine from what I can see
i hook a few functions a couple times, and one consistently
i hook a function to call each frame to get a pointer to game state
do you really need those?...
because it potentially can change
i also do type inference deduction from hooked functions
so i dont have to know offsets
you can get gamestate pointer from memory by pattern searching
all of my code works by pattern matching structures
but i want it to be fast
and i dont wanna have to know any offsets besides structure offsets
you only have to detect it once on startup then you can cache the gamestate address
and that startup search only takes less than 10 ms
depending on cpu...
hmm maybe
authorized_weapons_dictionary = [
["B_Soldier_F", ["WeapClass_1", "WeapClass_2"]],
["B_Soldier_AR_F", ["WeapClass_3"]]
];
private _matchArrays = authorized_weapons_dictionary select {(_x select 0) isEqualTo soldier_type}; //This return an array (ex: [ ["B_Soldier_F", ["WeapClass_1", "WeapClass_2"]] ])
my_authorized_weapons = (_matchArrays select 0) select 1; //First we select the first array, then the list of authorized weapons.
I didn't test it.
You can organize it this way too
RiflesGroup = ["RifleClass_1", "RifleClass_2"];
SnipersGroup = ["SniperClass_1", "SniperClass_2", "SniperClass_3"];
authorized_weapons_dictionary = [
["B_Soldier_F", RiflesGroup],
["B_Soldier_AR_F", SnipersGroup]
];
i still need to hook though, to do type deductions at least once
and to get pointers to global sqf variables
Has anyone managed to make a flag initialization sqf file about a vehicle for Arma Gold?
Thats how i am doing it. I can execute all scripts and get namespace variables without hooking anything.. atleast if i were using your script calling method.. im using the script parser so i have to call in mainThread so i got a hook to event handlers
but thats the only hook i need
tbh im not worried about BE though, so that can change in the future, its designed so the memory addresses can come from anywhere, thats the point of my loader
as long as that pointer to gamestate exists at the same place the entire game process duration
then i can get it another way
it does. Its a global variable so address is set compile time
hmmm do you think BE cares about hooking at the start of the game? If I unhook everything before you get to the main screen, would it notice?
no
I thought that was the point of the game loading through the BE launcher now...
Isn't be just getting updated when the game start ?
be is only comparing small chunks of game memory with be server while your playing. So as long as everything is clean as your joining server your good
be is updating as you connect to a server.
cool, i can do that then, i can clean everything up before i get into the main menu
if someone wants to write a better loader once i open the project up though thats cool too
but be blocks dll injection.. you know that right? ^^
yah, this is all done via callExtension
and im sure i can get BE to approve my DLL one way or the other ;)
how do you callExtension before the menu? ... yeah i can show you how
since ACRE will require this in the future probably and ACE as well
popular pressure will make them do it ;D
um you can do it a couple ways
CfgFunctions has a way of calling SQF at game boot
or you can override a couple different config values that will parse and execute SQF
oh yeah... ace with less than 1% performance impact... awesome ^^
class boot_loader
{
preStart = 1;
file = "z\intercept\rv\addons\core\boot.sqf";
headerType = -1;
};
ooooooor, for ACRE i do this (and please no one else do this, this is only for ACRE)...
^^ thats exactly what im using.. but thats only launchin a tiny touch before main screen
tooltipDelay = "call compile preprocessFileLineNumbers ""idi\clients\acre\addons\sys_core\steam_boot.sqf""; 0;";
in the main config root
thats how i handle DLL copying for the eventual Steam Workshop release of ACRE2
but i think you could use __EVAL in a config... it just creates a scriptVM and lets it run through..
the nice thing is that i can pop up standard windows confirmation dialog before Arma goes full screen
by using a config entry
preStart doesn't let you do that
it'll already have gone full screen and glitch out
i think i tried __EVAL
but it doesn't work right
nice
Hey there is there any way I can make a trigger delete an object?
deleteVehicle
Lets not let that become a discussion about evading battleye :X
Legend
seriously, fuck BE. I could do it better.
besides no need to evade it when most proper communities and players dont use it
Well yeah thats right.. A few days ago a community told me "Ugh your launcher doesnt start battleye" and i said "What?! you are using battleye?!"
i fucking raged so hard when BE was sending global messages to every player about DayZ shit
i wanted to punch a donkey
back in A2
Hello, we have a bit of a dispute with a friend and we are curious about how important syntax is in SQF code, for example will "exitwith" differ from "exitWith"?
Sqf is not case sensitive. But it's a good habit to properly case keywords, commands and variables.
The only exception is the "class" keyword. This should always be lowercase
Some commands do case sensitive comparisons though. For example "in".
That's not a sqf command tho
I know but thought I would mention it anyway.
Hello, I'm trying to understand how init.sqf works. I read that it executes on all machines, both client and server. Can someone help me understand why an init.sqf file containing hint "test"; only produces output on the server and not the clients?
your running that on your PC only or multiple PCs?
Init.sqf might be too soon for hint.
You can spawn it and wait until time > 0
Not sure if this is the right section, but is it possible to add a sit down action to PLP objects? I'm using ACE and I only seem to get the sit down option on vanilla chairs.
its a #arma3_config question but ask in the ace discord as it has the specifics
ahh thank you!
can you hide/remove building doors?
I'm running it on multiple PCs, 1 server and 1 client. I tried to abstract my init.sqf with the hint example, the actual code is more stuff like below. The fadeout, screen text and music only run on the server and I don't understand why.
My assumption was that all of these would run on each connected machine.
`ion_insertion = {
mission_transport landAt 1;
["TAG_aVeryUniqueID", false, 5] call BIS_fnc_blackOut;
sleep 3;
playMusic "RadioAmbient2";
sleep 3;
["TAG_aVeryUniqueID", true, 8] call BIS_fnc_blackIn;
sleep 7;
[
[
["NORTHERN TAKISTAN", "<t align = 'center' shadow = '1.2' size = '0.7' font='PuristaBold'>%1</t><br/>", 10],
["ION TEAM IN TRANSIT", "<t align = 'center' shadow = '1.2' size = '0.7'>%1</t><br/>", 30]
]
] spawn BIS_fnc_typeText;
sleep 15;
playMusic "RadioAmbient1";
sleep 30;
playMusic "BackgroundTrack02_F_EPC";
};
[] call ion_insertion;
Try initPlayerLocal. Init.sqf runs probably too early.
On the other hand I have similar code in a mission of mine and I use init.sqf for everything.
Hmm
Don't have access to the code right now.
don't forget: init.sqf is run on every machine, including players joining the session
you can filter with if (time < 10) and such (for text and/or music), but definitely surround landAt with if (isServer) then {} otherwise the helicopter may re-land there again and again
Thank you! I still need to refactor a lot of it as this was my first script and I experimented with lots of things. I checked init.sqf separately now and it does indeed execute on all machines, which means I broke it somewhere and need to start taking parts out and see if I can isolate the issue.
Having Issues with line of code everytime a player dies. When a players first joins the server the teleport script which has been placed In the Role Init works. Its when the player dies the option no longer appears.
this addAction ["Teleport to Carrier", {
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState c_tele)== "UNCONSCIOUS") then{
_caller setPosASL (getPosASL c_tele);
};
}, nil, 1, true, true, "", "true", 5];
you can readd the action using Respawn EH: ```sqf
player addEventHandler ["Respawn",
{
// addAction code here
}];
Place this In the role Init?
create file
initPlayerLocal.sqf
so it will be executed locally on client
The code will have to be changed to for both blue for side and opfor.
I also seems to have gotten an error code.
Yeh
you need use player.
and you can use switch and check side of player
switch (side group player) do
{
case west: { // WEST SIDE CODE
player addAction ["Teleport to Carrier",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState c_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL c_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
case east: { // EAST SIDE CODE
player addAction ["Teleport to Carrier",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState c_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL c_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
default {};
};
Ah thank you. Let me try this.
It Is working. Thank you.
One Issue though. When blue for dies It spawns them at the line of code for opfor.
Now it will do same for all if you are using my example.
you need change code in //WEST SIDE CODE, that what you have in init of blufor
so replace the //WEST SIDE CODE with b_tele?
Yeh, Change c_tele to b_tele
ah I see. I will try this out. Thank you.
It was saying missing bracket
Well could you share your code what you are trying to add
Sure one moment.
switch (side group player) do
{
case west: { // WEST SIDE CODE
player addAction ["Teleport to Nato Carrier",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState b_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL b_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
case east: { // EAST SIDE CODE
player addAction ["Teleport CSAT Carrier",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState c_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL c_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
default {};
};
Missing "]" bracket.
Weird.
Works for me.
switch (side group player) do
{
case west: { // WEST SIDE CODE
player addAction ["Teleport to Nato Carrier",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState b_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL b_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
case east: { // EAST SIDE CODE
player addAction ["Teleport CSAT Carrier",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState c_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL c_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
default {};
};
You have something else ?
Here let me post everything In the file.
[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;
player addAction [
"Vehicle Camouflage",
{
cursorObject spawn MRTM_fnc_MRTM_vehicleRearm;
playSound3D ["A3\Sounds_F\sfx\UI\vehicles\Vehicle_Rearm.wss", cursorObject, FALSE, getPosASL cursorObject, 2, 1, 75];
},
[],
99,
true,
false,
"",
"(cursorObject isKindOf 'Car' || cursorObject isKindOf 'Tank' && {alive cursorObject})",
50,
false
];
player addaction [
"Server Information and Discord",
{
0 spawn MRTM_fnc_MRTM_welcome;
},
nil,
1.5,
false
switch (side group player) do
{
case west: { // WEST SIDE CODE
player addAction ["Teleport to Nato Carrier",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState b_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL b_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
case east: { // EAST SIDE CODE
player addAction ["Teleport CSAT Carrier"],
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState c_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL c_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
default {};
};
player addaction [
"Server Information and Discord",
{
0 spawn MRTM_fnc_MRTM_welcome;
},
nil,
1.5,
false
I just seen it as well.
There is you missing.
lol now I am missing a ";" on line 51.
Could not do this crap for a living.
[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;
player addAction [
"Vehicle Camouflage",
{
cursorObject spawn MRTM_fnc_MRTM_vehicleRearm;
playSound3D ["A3\Sounds_F\sfx\UI\vehicles\Vehicle_Rearm.wss", cursorObject, FALSE, getPosASL cursorObject, 2, 1, 75];
},
[],
99,
true,
false,
"",
"(cursorObject isKindOf 'Car' || cursorObject isKindOf 'Tank' && {alive cursorObject})",
50,
false
];
player addaction [
"Server Information and Discord",
{
0 spawn MRTM_fnc_MRTM_welcome;
},
nil,
1.5,
false
];
switch (side group player) do
{
case west: { // WEST SIDE CODE
player addAction ["Teleport to Nato Carrier",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState b_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL b_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
case east: { // EAST SIDE CODE
player addAction ["Teleport CSAT Carrier"],
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState c_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL c_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
default {};
};
can someone help me with some trig vectoring for spawning objects around my player?
East addAction has an extra ] after the action title string
It all works now. Thank you both for helping. If you can Imagine I have been up for 6 hours trying to resolve this. Thank you.
_pos1 = [(getPosASL _static select 0) + 1 * (sin _dir), (getPosASL _static select 1) + 1 * (cos _dir), getposASL _static select 2]; works for placing it infront
I have a quick question here :
class Params
{
class AIS_Revive_UNITS
{
title = "Auto-Init a group of units:";
texts[] = {"West", "Players"};
values[] = {"allUnitsBLUFOR","allPlayers"};
default = "allUnitsBLUFOR";
};
};
Does anybody know how i can get these values from here and that is not this fnc https://community.bistudio.com/wiki/BIS_fnc_getParamValue
becouse these only returns number and not the value that is in the config ?
BIS_fnc_getCfgData
or getNumber/getArray/getText
How would i apply this in this case:
This is something players can change in lobby screen in parameters section.
Do you have example of how to get the value ?
private _value = getText(missionConfigFile >> "Params" >> "AIS_Revive_UNITS");
this is the approach I believe i'll take, each weapon group will have it's own levels or inbedded arys
config values don't change
use getMissionParam iirc
getMissionConfigValue 
he said not getParamValue? 
Yea getParamValue only returns number but i need strings and arrays
@agile pumice what do you want to do
The selected value of a mission parameter is available as a global variable with the name of the parameter class
e: my bad, this is a default feature of the mission template I use and I never realised it. You'll need one of the mentioned BIS fncs
I'm not sure that param values are allowed to be strings at all though. I've never seen them be anything but whole integers
So that would mean i can only use this fnc https://community.bistudio.com/wiki/BIS_fnc_getParamValue
to get the value of parameter and that always returns number ?
It returns numbers because params values should only be numbers (whole numbers, no decimals) in the first place
They're trying to use a string as the param value
But why
Just map the integer value to a string value in a script
["string1", "string2"...] select _myParamInteger
Well i have a bunch of parameters witch are string bools arrays and numbers i was just thinking there is a eazy way to get the value witch is assinged from params and not just number
private _fog =
[
[0,0,0], // None
[0.1,0.001,0], // Light
[0.3,0.001,0], // Medium
[0.5,0.001,0], // Heavy
[0.8,0.001,0] // Infantry Only
] # _setting;
It's easy. Just have one script map all the parameters
I mean, you gotta define the strings somewhere. If you do it in config or sqf doesn't really matter.
Yea i think i might do that the mapping method π
You can also define those strings in config in the params class
and then use getMissionConfigValue to retrieve them. Then you got them all in one place.
Either way, you need to convert integer to string somewhere.
Yea i just didnt get what would be attribute parameter for this command [getMissionConfigValue] in Params:
Would it be: getMissionConfigValue "Params" or getMissionConfigValue "AIS_Revive_UNITS" when i tried this i didnt get anything ?
class Params
{
class ViewDistance
{
title = "View distance (in metres)";
values[] = { 500, 1000, 2000, 5000 };
stringValues[] = {"value1", "value2"};
default = 1000;
file = "setViewDistance.sqf";
isGlobal = 1;
};
};
_integerValue = ["ViewDistane", -1] call BIS_fnc_getParamValue;
if _integerValue > -1 then
{
_stringValue = (getArray (missionConfigFile >> "Params" >> "ViewDistance" >> "stringValues")) select _integerValue ;
};
Like this (untested)
No yea i get now getting values with getarray getNumber ect.. Big thanks.
But how would you get value with this command in params or is that just not possible ?
https://community.bistudio.com/wiki/getMissionConfigValue
Not possible.
As it only returns 1st tier.
A bit of an oversight on my end.
I think the only purpose for that command was compatibility for Eden Editor.
Ok again big thanks.
spawn an object left, front and right of an object
_dir is the direction...
so you want it them at 90 degree angles
take the direction the player is facing.. and one -90Β° and one +90Β°
i would just modelToWorld
I'm trying to add an action to Recruit an AI to init.sqf. It works to add the AI to the caller's group and remove the action for that particular player, but other players can still see and use the action, bringing the AI into their group. How can I get rid of this problem?
_unit addAction [
"Recruit: $" + (str _cost), //title
{
params ["_target", "_caller", "_actionId", "_arguments"];
_cost = _arguments select 0;
if (([_caller] call HALs_money_fnc_getFunds) < _cost) then {
hint "Insufficient funds."
} else {
[_caller, -_cost] call HALs_money_fnc_addFunds;
[_target] call BIS_fnc_ambientAnim__terminate;
[_target] joinSilent group _caller;
_target removeAction _actionId;
};
}, // script
[_cost], // Pass _cost as part of the arguments array
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"true", // condition
3, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];
};
// Add "Recruit" action to all units in specificGroup
{
[_x] call _addRecruitAction;
_ambientAnimation = ["STAND1", "WATCH", "GUARD", "LEAN", "SIT1"];
[_x, selectRandom _ambientAnimation, "FULL"] call BIS_fnc_ambientAnim;
} forEach units recruitmentPool;```
run the addAction code only on player's machine, where you want to see it
how would I expand on this code snippet? devstar_var_riflesLevels = createHashMapFromArray [ // Case sensitive! ["arifle_MX_F",1], ["arifle_MX_GL_F",2] ]; to include the Soilder type. or maybe that need to be an separte arry?
I need to define the soldier type first then check the type against the arry?
like, I need to make a key value pair for the soldier class, then get that to determent what weapson arry to loop? right?
this wasnt supposed to work via copy and paste, right?
I want it to be available to every player to recruit the AI, but not recruit an already recruited AI.
dude.... how is this wrong? ```
soldierclass = soldierclassArry [["B_Soldier_F",1],
["B_soilder_AR_F",2]
];
private _getSoldierClassValue = {
params ["_soldierClass", "_array"];
{
if (_x select 0 == _soldierClass) exitWith {
_x select 1;
};
} forEach _array;
nil
};
hint "_getSoldierClassValue"```
so wait, ```// This function automatically runs itself when the mission finishes initialising
// Define all the level information in classname/level pairs
devstar_var_riflesLevels = createHashMapFromArray [
// Case sensitive!
["arifle_MX_F",1],
["arifle_MX_GL_F",2]
];
// Safely initialise the HUD element
"devstar_riflesLevelsLayer" call BIS_fnc_rscLayer;
// If starting the HUD again later after closing it, you just need this line, not the previous one
"devstar_riflesLevelsLayer" cutRsc ["devstar_rifledisplay","PLAIN"];
the sqf scripting language seems to not be cohesive at all.
Anything in quotes is just a string.
soldierclass = [
["B_Soldier_F",1],
["B_soilder_AR_F",2]
];
private _getSoldierClassValue = {
params ["_soldierClass", "_array"];
{
if (_x select 0 == _soldierClass) exitWith {
_x select 1;
};
} forEach _array;
nil
};
hint format["%1", ["B_Soldier_F", soldierclass] call _getSoldierClassValue];
I think you wanted to do this
is this incorrect? soldierclass = soldierclassArry [["B_Soldier_F",1], ["B_soilder_AR_F",2] ];
Yes
okay ty
Working with SQF is very different from any other language
ya its been blowing my mind the ppast few days.
Try running this script and see if the result is what you want.
Send me the entire script written in your initPlayerLocal.sqf
wait dont we need typeof player
um its kinda messy cuz i have no idea what im doing.
i kmonw ill need to change some varialbes now form the rifle_level_group stuff.
im trying to make it dynamically get the class variable then get the level of the variable associated with the class... like "B-Soilder_F" has a rifle level of 1 which is equal to these weapon in this arry.
You must create a new array to determine the levels of each weapon.
devstar_var_riflesLevels = createHashMapFromArray [
// Case sensitive!
["arifle_MX_F",1],
["arifle_MX_GL_F",2]
]; like so?
you must remoteExec some code that removes the assigned action for all other players
_id = _unit addAction ["Recruit",
{
...
[_unit] remoteExecCall ["MY_fnc_removeRecruitActions", 0];
}];
_unit setVariable ["MyActionID", _id]; // save the action ID onto the unit
MY_fnc_removeRecruitActions:
params ["_unit"];
// remove the saved action ID
_unit removeAction (_unit getVariable ["MyActionID", -1]);
well really. weapson arry = createHaskMapArry = [["arifle_MX_F", "arifle_MX_black_F", 1][arifle_MXC_F", 2]]
okay remoteExec let me look at in the docs
oh wait not me
Ex:
Weapons_Levels = [
[1,[
"arifle_MX_F",
"arifle_MX_black_F"
]],
[2,[
"arifle_MXC_F"
]],
];
fnc_getWeaponsByLevel = {
params ["_level"];
private _list = Weapons_Levels select {(_x select 0) isEqualTo _level};
((_list select 0) select 1)
};
hint format["Level 1 weapons: %1", [1] call fnc_getWeaponsByLevel];
Hash maps are much better here :/
They can also be used
wait dont I want a hask map, isnt that a hash map?
I belive I have more learning to do
like sqf data structures or something
Roberio's code is flat arrays with lookup functions.
[] creates an array
how in the double heck you write that off the top of your head man, wild
ok "flat" is not really true :P
right right
to make a hashmap you can use the createHashmapFromArray command, which takes an array of array of pairs
createHashmapFromArray [
[key1, val1], //pair1
[key2, val2], //pair2
...
]
fn_initRifleDisplay.sqf```// This function automatically runs itself when the mission finishes initialising
// Define all the level information in classname/level pairs
devstar_var_riflesLevels = createHashMapFromArray [
// Case sensitive!
["arifle_MX_F",1],
["arifle_MX_GL_F",2]
];
// Safely initialise the HUD element
"devstar_riflesLevelsLayer" call BIS_fnc_rscLayer;
// If starting the HUD again later after closing it, you just need this line, not the previous one
"devstar_riflesLevelsLayer" cutRsc ["devstar_rifledisplay","PLAIN"];
that's just wrong
I need the hasharry to have multiple vaules
it should be
("devstar_riflesLevelsLayer" call BIS_fnc_rscLayer) cutRsc ["devstar_rifledisplay","PLAIN"];
π΅βπ«
π₯²
They wrote this code for it, but with HUD elements. I think that confused him a little.
okay. so.
I really want to respond to this since it's my code being criticised but I'm in the middle of a mission :U
no offense but you won't get anywhere as long as you use ChatGPT
my stuff is so bit and peice of bolt on stuff i think ill restart again.
my code worked. as a demo, to read and figure out how it worked, on its own
ya i didnt use it yeasterday or today.
it's no use, i dont under stand the syntax enugh to implament your code
i also have non-dynamic and dynamic code trying to check the class.
I have a rifle_level_player from a getvar thing thats not used anymore]
render my weapon enforce invaild ```enforceWeaponRestrictions = {
while {true} do {
private _unit = player;
private _rifleLevel = _unit getVariable ["Rifle_level_player", 0];
private _currentWeapon = currentWeapon _unit;
// Determine the array of authorized weapons based on the player's rifle level
private _authorizedWeapons = Rifle_level_group select _rifleLevel;
// Check if the unit is a Soldier and if they are carrying an unauthorized weapon
if ((typeOf _unit) isEqualTo "B_Soldier_F" && !(_currentWeapon in _authorizedWeapons)) then {
_unit removeWeapon _currentWeapon;
hint "You are not authorized to use this weapon!";
};
sleep 3; // Wait for 3 seconds before checking again to reduce performance impact
};
};
π΅βπ« i think maybe no arma today...
thanks guys
@tough abyss
I think this solves the problem in your code, using the array method.
Weapons_Levels = [
[1,[
"arifle_MX_F",
"arifle_MX_black_F"
]],
[2,[
"arifle_MXC_F"
]],
];
fnc_getWeaponsByLevel = {
params ["_level"];
private _list = Weapons_Levels select {(_x select 0) isEqualTo _level};
((_list select 0) select 1)
};
enforceWeaponRestrictions = {
while {true} do {
private _unit = player;
private _rifleLevel = _unit getVariable ["Rifle_level_player", 0];
private _currentWeapon = currentWeapon _unit;
private _authorizedWeapons = [_rifleLevel] call fnc_getWeaponsByLevel; //Edit
if ((typeOf _unit) isEqualTo "B_Soldier_F" && !(_currentWeapon in _authorizedWeapons)) then {
_unit removeWeapon _currentWeapon;
hint "You are not authorized to use this weapon!";
};
sleep 3;
};
};
If you want to use HashMaps:
Weapons_Levels = createHashMapFromArray [
[1,[
"arifle_MX_F",
"arifle_MX_black_F"
]],
[2,[
"arifle_MXC_F"
]]
];
enforceWeaponRestrictions = {
while {true} do {
private _unit = player;
private _rifleLevel = _unit getVariable ["Rifle_level_player", 0];
private _currentWeapon = currentWeapon _unit;
private _authorizedWeapons = Weapons_Levels get _rifleLevel; //Edit
if ((typeOf _unit) isEqualTo "B_Soldier_F" && !(_currentWeapon in _authorizedWeapons)) then {
_unit removeWeapon _currentWeapon;
hint "You are not authorized to use this weapon!";
};
sleep 3;
};
};
Hello, I'm relatively new to trying to script in Arma. I have a script that spawns AI on various markers, but it always spawns them at sea level. How would I go about making it so they spawn on top of whatever object the marker is on?
Basically I built a multilevel course, but with markers, the AI keep spawning on the ground level
Show your code, your issue is almost certainly because you're using the wrong getPosX / setPosX commands
weapons_Levels = createHashMapFromArray [
[1,[
"arifle_MX_F",
"arifle_MX_black_F"
]],
[2,[
"arifle_MXC_F"
]]
];
enforceWeaponRestrictions = {
while {true} do {
private _unit = player;
private _rifleLevel = _unit getVariable ["Rifle_level_player", 0]; //I have to change here too, right?
private _currentWeapon = currentWeapon _unit;
private _authorizedWeapons = Weapons_Levels get _rifleLevel; //Edit
if ((typeOf _unit) isEqualTo "B_Soldier_F" && !(_currentWeapon in _authorizedWeapons)) then {
_unit removeWeapon _currentWeapon;
hint "You are not authorized to use this weapon!";
};
sleep 3;
};
};```
wait, double confused, I need two arrys. one to get Soldier class and one to loop throught the avaible weapons based on the level in that weapons catagory.
okay one sec
let me write those up, and ill come back
You can change the hashMap key, placing it as the soldier's class.
Like this
Weapons_Levels = createHashMapFromArray [
["B_Soldier_F",[
"arifle_MX_F",
"arifle_MX_black_F"
]],
["B_soilder_AR_F",[
"arifle_MXC_F"
]]
];
This way, you won't need another array...
can I sqf Soilder_class_arry = createHashMapFromArry [[["B_Soilder_F",1],["B_soilder_AR_F", 2]]?
You can simply select the authorized weapons using the "typeOf player" as a parameter.
oh oh okay
Weapons_Levels = createHashMapFromArray [
["B_Soldier_F",[
"arifle_MX_F",
"arifle_MX_black_F"
]],
["B_soilder_AR_F",[
"arifle_MXC_F"
]]
];
private _soldierClass = typeOf player;
private _authorizedWeapons = Weapons_Levels get _soldierClass;
shit i had class_type = player typeOf unit
I think this is written wrong
Yeah, the lower case s is actually correct but it's "B_soldier_AR_F"
_unit = _grp createUnit
[
"O_G_Soldier_F",
getMarkerPos [_activemarker, true],
[],
0,
"NONE"
];```
do I still need ```sqf
enforceWeaponRestrictions = {
while {true} do {
private _unit = player;
private _rifleLevel = _unit getVariable ["Weapons_Levels", 0];
private _currentWeapon = currentWeapon _unit;
private _authorizedWeapons = Weapons_Levels get _rifleLevel; //Edit
if ((typeOf _unit) isEqualTo "B_Soldier_F" && !(_currentWeapon in _authorizedWeapons)) then {
_unit removeWeapon _currentWeapon;
hint "You are not authorized to use this weapon!";
};
sleep 3;
};
};
There's a specific sqf syntax highlighting for code blocks, and it should be placed after the backtick (`) characters
Try it like this
enforceWeaponRestrictions = {
while {true} do {
private _currentWeapon = currentWeapon player;
private _authorizedWeapons = Weapons_Levels get (typeOf player);
if !(_currentWeapon in _authorizedWeapons) then {
player removeWeapon _currentWeapon;
hint "You are not authorized to use this weapon!";
};
sleep 1;
};
};
But you are using the syntax for preserving the elevation, are your markers actually set above the ground?
Markers don't seem to have an elevation parameter. I would be fine with using helipads but I don't know how to search for them as opposed to markers
wait isn't _authorizedWeapons already defined?
Marker elevation is always 0
Makes you wonder why the option to preserve elevation on a marker position is even a thing
You can generate objects to use as references to spawn positions.
Alternate syntax for https://community.bistudio.com/wiki/getMarkerPos returns PositionAGL
Editor marker elevation is always 0, script-created markers can have a Z component
Ahhh ok
So yeah, you can either create the markers via script or you can use an object
I believe you place the markers through the editor because it is easier, generating them via script is not a good option because it is not necessary, since to generate them, you need positions X, Y and Z. If you already have these positions, you can create an array with them and select a random one to be the soldier's spawn point.
I think I'll just use grasscutters or invis helipad objects
It was more I didn't know how to make it search through objects as opposed to markers
Choose an object to use as a spawn point, we can use this as an example: "Sign_Sphere10cm_F"
//Run only 1 time
SpawnPoints = [];
private _markerPos = getMarkerPos "markerOne";
{
SpawnPoints pushBack (getPos _x);
deleteVehicle _x;
} forEach (nearestObjects [_markerPos, ["Sign_Sphere10cm_F"], 200]);
//Spawn soldiers
_unit = _grp createUnit
[
"O_G_Soldier_F",
(selectRandom SpawnPoints),
[],
0,
"NONE"
];
You may need to separate this code into 2 parts, one part to generate the "SpawnPoints" variable and another part to generate the soldiers.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@tough abyss
So that sets the spawn to the position of one of the random objects within 200m of the marker correct?
No, this will set the spawnpoint to the position of all objects with class "Sign_Sphere10cm_F".
You place this object in the locations where you want a spawnpoint to be, via the editor.
It worked?
fuck ya brother, thank you everyone
yall are, I believe what the kids these days would say, dope af at SQF
well, now I need to figure out how the levels are going to get implamented... but maybe thats another day.
Save them to the player's profileNameSpace: profileNamespace setVariable ["TAG_playerLevel", 99]
Although that's a bit dirty, since anyone could modify their own level
So would it be easier to just use two different objects for two different types of spawns, or is it possible to select only a specific object variable name range, like spawn_1 to spawn_10 helipads are one groups, and spawn_11 through spawn_20 are another. I know that's fairly simple with markers, but is it possible with objects?
Thank you so much! That solved it! I was trying to do
[_target, _actionId] remoteExec ["removeAction"];```
Still not sure why it didn't work like that.
The actionId won't necessarily be the same on all machines.
Anyone know why I'm getting an error here? I have this code sqf _unit = _grp createUnit [ "WBK_B1_standart", (getposASL selectRandom lightenemyspawn), [], 0, "NONE" ];
And the lightenemyspawn array is defined here ```sqf
private _markerPos = getMarkerPos "citadel";
{
lightenemyspawn pushBack (getPos _x);
deleteVehicle _x;
}
forEach (nearestObjects [_markerPos, ["Land_HelipadEmpty_F"], 200]);```
But when I attempt to run this I get an error saying Error 0 elements provided, Expected 3
For line 17, which corresponds with the createUnit. Is it not getting the Coordinates?
Did you define the array before ?
lightenemyspawn = [];
Yeah. The lower part is in initserver, teh upper part is a seperate script called at a specific time
I should note that the helipad objects aren't being deleted
So perhaps its not running the lower part correctly
lightenemyspawn = [];
heavyenemyspawn = [];
playerSpawnMarkerList = [];
private _markerPos = getMarkerPos "citadel";
{
lightenemyspawn pushBack (getPos _x);
deleteVehicle _x;
}
forEach (nearestObjects [_markerPos, ["Land_HelipadEmpty_F"], 200]);
{
heavyenemyspawn pushBack (getPos _x);
deleteVehicle _x;
}
forEach (nearestObjects [_markerPos, ["Land_ClutterCutter_small_F"], 200]);```
Thats the full script
in the server init
Check via debug console if the array is populated with coordinates
or diag_logs
diag_log format ["lightenemyspawn %1 / heavyenemyspawn %2", lightenemyspawn,heavyenemyspawn];```
And
_unit = _grp createUnit
[
"WBK_B1_standart",
(selectRandom lightenemyspawn),
[],
0,
"NONE"
];```
Vehicle_Levels = createHashMapFromArray [
["B_Soldier_F", [
"B_LSV_01_unarmed_F"
]]
];
enforceVehicleRestrictions = {
while {true} do {
private _currentVehicle = vehicle player;
private _authorizedVehicle = Vehicle_Levels get (typeOf player);
if !(_currentVehicle in _authorizedVehicle) then {
player action ["Eject", vehicle player]
}
};
};``` doesnt work?
I had it that way originally and it didn't work, forgot to undo my random attempts to fix it
So do I just type the array name in console and hit server exec to get the value or is there more? Because if I do that it just has []
private _currentVehicle = typeOf (vehicle player);
The one script that populates the arrays should be running on serverinit. The actual spawn script is called via AddAction
Ok
Then you need to make it a publicVariable ^^
In this case, as you generated the variable where you store the spawn points on the server, you need to do something for clients to have access to it.
i still need to check if its authorized?
Put this right after populating the variables.
publicVariable "varName";
This will propagate it to all clients
If you change these again, you need to publicVariable again to update them for all clients
Vehicle_Levels = createHashMapFromArray [
["B_Soldier_F", [
"B_LSV_01_unarmed_F"
]]
];
enforceVehicleRestrictions = {
while {true} do {
private _currentVehicle = vehicle player;
private _currentVehicle = typeOf (vehicle player);
if !(_currentVehicle in _authorizedVehicle) then {
player action ["Eject", vehicle player]
}
};
};```
wait shit
Vehicle_Levels = createHashMapFromArray [
["B_Soldier_F", [
"B_LSV_01_unarmed_F"
]]
];
enforceVehicleRestrictions = {
while {true} do {
private _currentVehicle = typeOf (vehicle player);
private _authorizedVehicle = Vehicle_Levels get (typeOf player);
if !(_currentVehicle in _authorizedVehicle) then {
player action ["Eject", vehicle player]
}
};
};```??
Yep
Hashmaps 
eh, still no joy
I also recommend using "getOrDefault", to avoid problems such as the lack of the player's class in the hashMap.
doesnt eject the player from the other vehicels
Try
unassignVehicle player;
moveOut player;
private _authorizedVehicle = Vehicle_Levels getOrDefault [(typeOf player), []];
if (_authorizedVehicle != [] && !(_currentVehicle in _authorizedVehicle)) then {
};
No Dice, the arrays are still empty. Its like its not running at all, as the helipads and grasscutter objects still exist
Unless of course, this is only run on a dedicated server and not the multiplayer local hosted stuff
Although if that were the case nothing else in the file would work
Then check if this reports any valid position via diag_log
private _markerPos = getMarkerPos "citadel";
It does return a Pos
That's the standard procedure for debugging, check all your variable first
Isolate the problem and then try to fix it step by step
should look like this? ```sqf
Vehicle_Levels = createHashMapFromArray [
["B_Soldier_F", [
"B_LSV_01_unarmed_F"
]]
];
enforceVehicleRestrictions = {
while {true} do {
private _currentVehicle = typeOf (vehicle player);
private _authorizedVehicle = Vehicle_Levels get (typeOf player);
if !(_currentVehicle in _authorizedVehicle) then {
player action ["Eject", vehicle player];
unassignVehicle player;
moveOut player;
}
};
};
Try running this close to the location you set up.
private _objs = nearestObjects [player, ["Land_HelipadEmpty_F"], 200];
hint format["%1", _objs];
Ok so I changed the _markerPos to a different name, and now they spawned, but all 35 of them spawned on one Helipad
And that snippet does display a list of all the helipad game objects' variable names
ty for the helps guys
So update, it just is not recognizing the helipads for some reason, when I set it to all objects, it was fine
π¦
It finally worked after I replaced all the helipads
But THEY ALL SPAWNED ON THE Ground
OH WAIT
I figured it out
Guess its part of terrain then ^^
Many people spawn these extra for such stuff, then nearestObjects works ^^
the marker is at 0 no
Z wise
All of this is elevated quite a ways up
I accidentally put the helipads on the ground, hence it working
Use this then
But I'm assuming at the correct altitude, the helipads are more than 200m abouve the marker
I just changed it to that
I'm gonna test now
fingers crossed
But even then if its the altitude above the marker making it not detect the helipad objects...
not sure what to do there, except use a gameobject instead of a marker
@grave hare If it doesn't work, try this
_spawnPos = selectRandom lightenemyspawn;
_unit = _grp createUnit
[
"WBK_B1_standart",
_spawnPos,
[],
0,
"NONE"
];
_unit setPosATL _spawnPos;
is there lists of classes in the docs like of the soldiers and weapon classe?
Ok I appear to be missing something. How would I go about getting the position of an Object based on its Variable name
getPosATL or getPosASL, depending on which format you need
I tried that and it said it expected an object and not a string
Then you need to give it the object's variable name as a variable name, not as a "string"
so get rid of the ""?
If you need to work with variable names as strings, perhaps because you're auto-generating them using text formatting, you can use getVariable and setVariable
Tested that but sadly I can't do anything with their waypoint when completed since the command does not return a waypoint or cant execute scripts after is done so they just sit there doing nothing.
code if helps
[CurrentAssasinSquad, _TargetGroup, 5, 0, { {alive _x} count (units _TargetGroup)}, 2] spawn BIS_fnc_stalk;
[CurrentAssasinSquad, 0] setWaypointScript "call AssasinSquadPatrolAreal";
Howdy all. Super short summary: Trying to get respawned vehicles to have unlimited ammo.
https://forums.bohemia.net/forums/topic/280836-respawn-expressions-issues/
Hello! First | The basic premise of what I am attempting to do is two-fold. A) respawn existing vehicles (of different types - i.e. some jets, some helicopters, some ground vehicles), with the same custom pylons - for the jets/helis - set by the pylon/dynamic loadout editor in 3den. This part wor...
Hello Gentleman, i am just at the beggining of my Arma 3 scripting journey and i would be grateful if someone could help me with this issue. I wanted to create a mission to play as a civilian paramedics team, which is called upon various incidents. I've already managed to create basic ace injuries via ace_medical_damage_fnc_woundsHandlerBase, but i don't have a clue how to initiate a cardiac arrest or ace uncounciusness. Further more i would like to implement various airway treatmens from the KAT medical extension but i don't have too much of a clue how to exactly use those functions... Thank's in advance for anyone who would be kind enough to share some advice or information!
This is better asked in the ace and kat discords but I can provide some answers...
You can use a vanilla function to set consciousness. I think that's exactly what is called
In addition, here is kat code from my notes to do what you're asking
KAT airway things application:
_unit setVariable ["KAT_breathing_airwayStatus", 50]; // Sets SPO2 value, between 0-100
_unit setVariable ["KAT_breathing_pneumothorax", 1, true]; // Set pneumo severity can be set 1-4
_unit setVariable ["KAT_breathing_tensionpneumothorax", true, true];
_unit setVariable ["KAT_breathing_hemopneumothorax", true, true];
_unit setVariable ["KAT_breathing_airwayStatus", 50]; // Sets SPO2 value, between 0-100
_unit setVariable ["KAT_airway_occluded", true, true];
_unit setVariable ["KAT_airway_obstruction", true, true];
Good luck
Oh boy, now I'm running into another issue
I want to spawn an additional two heavy units, so I copied the for statement and changed some variables. But now, only on the second loop, I get the error Error setcombatmode: Undefined variable in expression: _grp
Code is as follows, not sure what the issue could be ```sqf
for "_i" from 1 to 2 do
{
_grp = enemyGroupList select (opfor countSide allUnits);
heavy = _grp createUnit
[
"lsd_cis_b1_training",
(selectRandom heavyenemyspawn),
[],
0,
"NONE"
];
heavy setCombatMode "RED";
heavy setBehaviour "SAFE";
heavy setFormDir 180;
enemyUnitList pushBack heavy;
};
for "_i" from 1 to _unitsToSpawn do
{
_grp = enemyGroupList select (opfor countSide allUnits);
_unit = _grp createUnit
[
"lsd_cis_b1_training",
(selectRandom lightenemyspawn),
[],
0,
"NONE"
];
_unit setCombatMode "RED";
_unit setBehaviour "SAFE";
_unit setFormDir 180;
enemyUnitList pushBack _unit;
};```
I'm at a loss at this point. All I want to do is spawn two additional heavy units at their own spawns, but I get errors. The weird thing is they spawn, but then the error comes up and stops the rest of the script
And removing all the _unit statements besides the createunit one does not fix it, at that point the erro just doesnt point to anything specific
this is the problem
select starts at 0
so if you have 5 groups countSide will return 5
select 5 wouldn't exist, it'd need to be select 4
so just do something like
_grp = enemyGroupList select ((opfor countSide allUnits)-1)max 0;
think there's cleaner ways to do something like this now though
https://community.bistudio.com/wiki/select#Example_8 see this example, the last 3 lines
although your error doesnt make sense as you're using _unit in setcombatmode not _grp so I dont know where that is or what
I updated the code to what is shown there now. Now everything appears to be working, but it still throws an error that seems to have no effect
it just says Generic Error lol
Error Generic error in expression
Ok that is fixed, now it just says the same error as before. It appears to be working, so I'm not gonna worry about it, but I just hope it still works on a dedicated server
Thanks that tip though @ivory lake, fixed another issue with there being the wrong number of enemies
Is enemyGroupList a list of enemy units or a list of enemy groups?
Groups
Although that whole line may be redundant now that I game them actual variable names
Actually yeah that line might be pointless now that I've specifically named the groups
Or maybe not. I'm not sure
Also, I changed some other vars and the error went away, might've been related to too few spawn points for the number of enemies spawning
I mean, the line makes no sense unless the variable is incorrectly named.
Normally there are more units than groups so it'd be attempting to select outside the array.
Originally it _grp = in both loops , I changed it to actual variable names while trying to fix a wierd error
I'm pretty new to arma scripting, so I don't know exactly what its supposed to do. I've been jumping around looking at examples. That said, the script appears to be functioning as planned so Im going to go with the age old addage, "If it ain't broke, don't fix it", unless it has a serious impact on performance or something
The issue is that opfor countSide allUnits returns the number of opfor units, not groups.
Maybe that works for your mission because you have one unit per group, but I wouldn't know.
Whats the locality of profileNamespace? If I execute it in a spawn statement will effect everyone and if so there a way to execute it on specific people?
Hard to test if data conflicts with just 1 person
It doesnt matter to me where its stored, it matters if the variable becomes global for everyone, As im trying to save data per person
So how do i do that inside a spawned function
Oh I see. I'll mess with it to see what happens. On a related note, I had set a variable in AddAction, which worked before I'm assuming because it was a local multiplayer hosted game. However, on the dedicated server, the variable is undefined. My question is can I simply move the addAction acript to playerinitserver from playerinitlocal, or just put it in initserver?
And how about pulling it back out? is this client number something that doesnt change when connecting multiple times?
Shocker, what about the client ID, it change depending on what player count is there when joining?
Would that save if the player left and rejoined
Permanant but constantly changing
Would getting the profilenameSpace variable, adding whatever i need to add to it, Saving it to a random variable, then do player spawn then just return the random variable and then set the profilenameSpace in there? would that be considering local?
Its gonna be permenant until a manual wipe
like... KP?
Havent look at their code except to add factions
thanks
can building doors be removed?
too bad , would be nice feature to be able to blow up the doors
@agile pumice try https://community.bistudio.com/wiki/BIS_fnc_relPos -> [player, 1, dir player + 90] call BIS_fnc_relPos and [player, 1, dir player + 270] call BIS_fnc_relPos might do the trick
unless you can set the door angle i dont think so
i.e if animationsource for door is just 360
no change texture command for doors?
There's no command specifically for doors, but they could in theory be a selection that can be changed with setObjectTexture. In theory - as far as I know, most buildings don't have texture selections set up.
Changing the texture would not change shadows, collisions, or projectile hitboxes, so you would have doors that are invisible but still block movement and bullets.
so yeah, no door destruction for you (many before you have tried)
I was thinking how windows are penetrated by bullet before breaking up, and then there's no collision , I guess
The model maker could probably (unconfirmed) set up their doors to behave like breakable windows.
But that's a model-level change. If that sort of damage modelling doesn't exist in the model, you can't add it by script.
yep
Hey, is anyone interested in using one of the recent RGB gaming keyboards for arma scripting purposes. Examples being the Logitech G910, Corsair K70 and the Razer BlackWidow Chroma. I just recently bought the G910 and was playing around with the SDK and thought it would be cool to use it for arma.
I've been using modelToWorld with mixed success
the objects I'm trying to spawn are just a little bit too high up
I'm not sure how many arma players out there own one.
I downloaded a composition from Steam that has stuff attached to the turret that moves with it separately from the hull.
It uses "attachTo" and "setVectorDirAndUp" which if I understand correctly attaches an item based on numbers put in it and sets the item's position.
My question is how do I find or get the numbers of place I want to attach an item to and its position?
I'm sure I could do trial and error, type in random numbers see the results then correct, and eventually after a week attach some items but there's gotta be an easier way which I'm unaware of.
@agile pumice try to use a setVelocity on them to drop them to the ground
give variable names to 2 objects you want to attach in eden and disable simulation as well in eden.
And just load in game and in debug console just play with the numbers. It will change position witch is basicly what you are after.
I didn't even think doing it through console once I'm in game, that makes it so much easier. Thank you
I'd like to make sure I'm using the right commands before I try any janky fixes like that,TETET
Actually scratch that, doesnt allow for memory point...
Yea either legions answer or alternatively theres commands to get relative position, might work aswell atleast to get numbers
hmmm
So I have an addaction in initplayerlocal s follows
citadel_1 addAction
[
"Activate Simulation Basic",
{
params ["_whiteBoard", "_unit", "_actionID", "_arguments"];
[_unit] joinSilent activePlayerGroup; publicVariable "activePlayerGroup";
unitsToSpawn = 25;
if (!roundInProgress) then
{
if (!activateAO) then
{
activateAO = true; publicVariable "activateAO";
};
hint "Please wait while the Basic Simulation is Prepared...";
waitUntil {roundInProgress};
hintSilent "";
};
_unit allowDamage true;
}
];```
As seen there, it sets unitsToSpawn to 25. Which is fine for local games and local host servers
However, it doesn't work on Dedicated servers, I'm assuming because its in the initplayerlocal script
So how would I go about making that variable be set on the server by this addAction
I tried putting it in initplayerserver to no avail
Putting it in initPlayerLocal.sqf is correct because addAction is a Local Effect command, meaning the action is only added on the machine where the code is run. So you want it to run on all player machines, but the DS doesn't need it because it has no player.
You need publicVariable or setVariable to make your global (scope) variables into global (network) variables
So simply adding publicVariable "unitsToSpawn";?
probably. I'd suggest giving it a more unique name to avoid conflicts with other mods and scripts, e.g. greg_var_unitsToSpawn
Can I just throw that at the bottom or does it need to be above the addActions
@agile pumice _pos = _myObject modelToWorld [x, y, 0]; _pos set [2,0];
No dice, still says its an undefined variable
We can't really say what's correct because you haven't shown the server side code.
publicVariable will broadcast the variable to all machines.
It still won't exist anywhere else until that action is used.
So when that action is used it calls the script I posted before, which is this
enemyUnitList = [];
for "_i" from 0 to 1 do
{ //create the AI units for the mission
heavygrp = enemyGroupList select ((opfor countSide allUnits) - 1);
heavy = heavygrp createUnit
[
"3AS_CIS_B2_F",
(selectRandom heavyenemyspawn),
[],
0,
"NONE"
];
heavy disableAI "PATH";
heavy setCombatMode "RED";
heavy setBehaviour "SAFE";
heavy setFormDir 180;
heavy addEventHandler
[ //delete the AI the moment it is killed!
"Killed",
{
deleteVehicle (_this select 0);
}
];
enemyUnitList pushBack heavy;
};
for "_i" from 3 to unitsToSpawn do
{
lightgroup = enemyGroupList select ((opfor countSide allUnits) - 1);
light = lightgroup createUnit
[
"lsd_cis_b1_training",
(selectRandom lightenemyspawn),
[],
0,
"NONE"
];
light disableAI "PATH";
light setCombatMode "RED";
light setBehaviour "SAFE";
light setFormDir 180;
enemyUnitList pushBack light;
};```
That addAction code doesn't call anything?
oh hold up
Sorry, I was mixed up, working on 4 different things. The above code is called via a trigger in game that checks if activateAO is true, and when it is , it calls the second script
is there a commamd that order a group to take over a building?
yes, there is a couple bis functions to create garrisoned buildings
Moving to the upper floor of buildings is buggy though, so you'd probably need to teleport them for that.
names?
BIS_fnc_taskDefend
Comes to mind right now, I now there is atleast one more
If you want something more specific you can always do something like this too
_nearestBuildingPos = (nearestBuilding _somePositionInMap) buildingPos -1;
{
if (count _nearestBuildingPos > 0) then
{
_positionToGarrison = selectRandom _nearestBuildingPos;
_x setPos _positionToGarrison;
_nearestBuildingPos deleteAt (_nearestBuildingPos find _positionToGarrison);
};
}forEach _group;
Just as John said, tp the units instead of making them move otherwise some weird sutff can happen haha
sorry foxy, not really seeing how thats helping my z pos issue
i understand what your code does, but its already 0?
@agile pumice I don't really understand your call _sb1 setPosASL (AGLtoASL _pos1); Wouldn't you want to set it to height 0 with setPosATL ?
that was my intention, but I seemed to have gotten confused haha
AGLtoATL doesn't exist, so I guess I have to convert it to asl first, then to atl
can't you simply select 0 and 1 from _pos and set the 3rd parameter to 0?
any example for sytax 5?
https://community.bistudio.com/wiki/nearEntities
same as other examples except the you just use an area as the first argument?
and how do we use the area?
_list = triggerArea myTrigger nearEntities [["Man", "Air", "Car", "Motorcycle", "Tank"], 200];
either like that or you define it manually
see inArea
I saw it, did not helped.
[Player, 2000,2000,0,false,100] nearEntities [["UK3CB_ADE_O_TL"], true, true, false];
are you using dev branch?
No

it's not released to stable yet
Beautiful.
my second option is this, not verry elegant if I increase the range
(allUnits select {alive _x and typeOf _x == 'UK3CB_ADE_O_TL'}) inAreaArray [cursorObject, 200, 200, 200, false, 200];
and I also need to filter distance, I just want the nearest one.
Here is how you can filter by distance all units in area:
private _unitsCheck = allUnits select {alive _x and typeOf _x == 'UK3CB_ADE_O_TL'};
private _areaCenter = [0,0,0];
private _unitsINArea = _unitsCheck inAreaArray [_areaCenter, 200, 200, 200, false, 200];
private _unitsClosesToCenter = _unitsInArea apply {[_areaCenter distanceSqr _x,_x]};
_unitsClosesToCenter sort true;
private _closesUnit = (_unitsClosesToCenter select 0) param [1,objNull];
when swaping to player it return nothing.
private _unitsCheck = allUnits select {alive _x and typeOf _x == 'UK3CB_ADE_O_TL'};
private _areaCenter = getpos player;
private _unitsINArea = _unitsCheck inAreaArray [_areaCenter, 2000, 2000, 2000, false, 2000];
private _unitsClosesToCenter = _unitsInArea apply {[_areaCenter distanceSqr _x,_x]};
_unitsClosesToCenter sort true;
private _closesUnit = (_unitsClosesToCenter select 0) param [1,objNull];
_closesUnit
Make sure the Class name of the unit is correct.
You could also do it like so:
private _unitsCheck = allUnits select {alive _x and _x iskindOf "UK3CB_ADE_O_TL"};
turns out it does not return a empty array, I had to get closer, its a problem but I can make it work.
thanks for the assist
is there an easy to sink an object under the ground without disabling its simulation?
weird, didnt have an issue with: _sb1 setPos [_pos1 select 0, _pos1 select 1, -0.5]; where it would have popped out of the ground the last time I tried to put something underground
You can just use nearEntities with the radius of the area, then use inAreaArray
Radius of area is the bigger radius if ellipse, and diagonal if rectangle
I guess that's what the command does under the hood (except it doesn't rebuild the array)
hello coderfolk, I'm trying to keep a projectile at constant speed, using this code:
this addEventHandler ["Fired", {
_null = _this spawn {
_shell = _this select 6;
_shellpos = position _shell;
_vel = velocity _shell;
_tempvel = [
(_vel select 0) * 0.01,
(_vel select 1) * 0.01,
(_vel select 2) * 0.01
];
[_shell, _tempvel] spawn {
private _i = 0;
params ["_shell", "_tempvel"];
while (_i<30) do {
_this setVelocity _tempvel;
sleep 0.01;
_i=(i+0.01);
};
};
}];```
However, on the while loop, I'm getting "error while: Type Bool, expected code".
Would someone know what exactly the issue is here? I'm not understanding what it is evaluating as a bool here.
after a severe facepalm, thad did indeed fix it
severeFacepalm: Boolean - (Optional) can be used to force "while" to work
why not alt syntax for while that takes boolean, maybe faster?
because it would be evaluated only once
ic
hs = createHashMapFromArray [["test", true]];
[
diag_codePerformance [{"test" in hs}]
,diag_codePerformance [{hs get "test"}]
]
```=>`[[0.000434573,100000],[0.00037772,100000]]`
How come in is a bit slower than get?
how is compared to getOrDefault?
getOrDefault needs an array built so its totally slower than both of these
diag_codePerformance [{hs getOrDefault ["test", false]}] => [0.000579576,100000]
Its kinda counter-intuitive why in is slower because you don't even need to access the value when get also returns it
Is it because of command overload since there are lots of in versions?
yea, maybe is how the seach done in each case, or the diferent syntax checks it need to do
get only work with hasmaps, in has 5 diferent sintax
Quick question dose anybody here knows how to setup .ext for description in arma to open in notepad++ with a cpp syntax highlight ?
i think you can just select that when the .ext file is open from Language -> C -> C++
it should auto save the setting unless Im wrong
it does
also there probably is user defined language for arma configs somewhere. I use one
i have my own flavor too, n++ has 2 sqf highlighters but one of them is tremendously outdated
but for cpp best use c++
he has .ext , which is very similar to c++
isnt ext a cpp but wrapped?
i think its arma's own format
They're all text files and the extension just indicates to the IDE which syntax it should expect. .cpp is commonly used because C++ syntax is pretty similar to Arma config syntax, but any of the "just a text file" extensions can be used in cases where you're not relying on the game's file autodetection.
All i want is every time I open .ext document i have cpp syntax highlighting i dont need anything extra just so i dont have to click language - > c -> c++ everytime i open that file.
Go into the language settings for C++ and add .ext to the list of associated filetypes
I just found would this work?
<Language name="cpp" ext="cpp cxx cc h hh hpp hxx ino ext" commentLine="//" commentStart="/*" commentEnd="*/">
</Language>
If that was all already there and you just added ext to the list, then yes
That being said, I've got .ext treated as C++ and I did not have to manually modify a file to do it (and my langs.xml doesn't have it). So I'm pretty sure there's another way, I'm just trying to remember what it was
Found it. Language > Style Configurator > select C++ on the left > User ext. field at the bottom left
Hell yea thank you.
2 reasons:
inhas more syntaxesincreates a bool and returns it, butgetreturns what already exists by reference
I personally just created my own UDL for .ext, .sqm and A3 cpp
I don't recommend using C++ because C++ has keywords that do nothing in configs, and config has keywords that don't exist in C++
I have UDL for SQF but i didnt have for ext and honelsy i just needed syntax highlight for ext so i can see better when i am editing, and i dont have to do language - c - cpp when i open ext file with notepad++
Is it public?
I remember looking for one when I first started modding but never found one so I stuck with C++
nope 
it's nothing special tho
config only has a handful of keywords so making one manually is easy
Might mess with it then, have any links that'd help? Did some basic googling and it seems that you'd make a "grammar" for it (or at least that's what VS Code names it)
Very interesting. Ask me about it tomorrow
That could be it. The syntax select iterates over all syntaxes and does a type comparison with the argument.
That type check is faster on profiling branch I think. Should be
That does make a lot of sense indeed
this is my UDL. you can import it and check out how it works (under Define your own language)
that's the only thing that made sense to me when I looked at the code. otherwise they basically did the same thing (get did even more things)
That bool return is actually so stupid.
For every "bool" we allocate a whole new value. But there are only ever two possible bool states. Doesn't make sense to allocate at all for that.
Just pre-create two bool values, and use them for everything
considering how often bool is returned, can this be noticeable optimization?
Would I be able to change this sqf Weapons_Levels = createHashMapFromArray [ ["B_Soldier_F", [ // For the basic soldier class "arifle_MX_F", // MX Rifle "arifle_MX_Black_F", "arifle_MX_khk_F" ]] into this sqf Weapons_Levels = createHashMapFromArray [ ["B_Soldier_F", [1, [ // For the basic soldier class "arifle_MX_F", // MX Rifle "arifle_MX_Black_F", "arifle_MX_khk_F" ]][2, [" arifle_SPAR_01_snd_F", "arifle_SPAR_01_khk_F", "arifle_SPAR_01_blk_F"]] and index the array with the class for soldier and the integer (level)?
Probably yes
][
Array elements must be separated by commas, even if those elements are themselves arrays
Oh hey Nikko, thanks for all the help and response, so it need to look more like this; Weapons_Levels = createHashMapFromArray [ ["B_Soldier_F", [1, [ // For the basic soldier class "arifle_MX_F", // MX Rifle "arifle_MX_Black_F", "arifle_MX_khk_F" ]],[2, [" arifle_SPAR_01_snd_F", "arifle_SPAR_01_khk_F", "arifle_SPAR_01_blk_F"]]];
You should get rid of the whitespace inside the SPAR-16 sand string. Whitespace inside strings is important
I'm doing some maths on your [ ] pairs and I'm pretty sure something doesn't add up. Still checking though
awesome, thank you for the advice
Okay, so if we lay this out with slightly more readable indentation, we can see there is a ] missing:
Weapons_Levels = createHashMapFromArray [
["B_Soldier_F",
[1,
[ // For the basic soldier class
"arifle_MX_F", // MX Rifle
"arifle_MX_Black_F",
"arifle_MX_khk_F"
]
],
[2,
[
"arifle_SPAR_01_snd_F",
"arifle_SPAR_01_khk_F",
"arifle_SPAR_01_blk_F"
]
]
];```
that look great, I was just about to ask what best practice was for embedding multiple arrays
Note: I can tell you whether you have made a structurally valid array or hashmap, but I can't tell you whether it's the appropriate structure for what you want to do with it
well im trying to generate a hash array (I believe thats the name) to check an class, then the level of that class, and grab all the available rifles for the level and class.
does anyone know how to fix cup_building2_data
sry
is there a SQF way to check if extension is loaded ?
make a valid call, if it returns empty string then not
okay so am I thinking about this correctly? ```sqf
//Getting an element
//An array uses a zero-based index for its elements:
private _myArray = ["first item", "second item", "third item"];
_myArray select 0; // returns "first item"
_myArray # 2; // returns "third item" - Arma 3 only
systemChat "yourfile.sqf has been loaded and executed.";``` is the noob way i do it lol
Yes
Extensions aren't the same as SQF files. Extensions are DLL files that can do things outside of the game, like talking to external services. They aren't written in SQF and have their own special commands for working with them.
oh sorry, ignore
I wonder if there is reliable way to tell if entity in EntityCreated is a respawning entity and not a new one?
In order to try and not repeat my code, can I say Weapons_Levels = createHashMapFromArray [ ["B_Soldier_F", [ [ // Level 1 Weapons for B_Soldier_F "arifle_MX_F", "arifle_MX_Black_F", "arifle_MX_khk_F", ], [ // Level 2 Weapons for B_Soldier_F Weapons_Level select 1 <---- line in question "arifle_SPAR_01_snd_F", "arifle_SPAR_01_khk_F", "arifle_SPAR_01_blk_F" ] ]], //Rest of array
actually
I'm rarely using chatgpt so bare with me if I sound level -17
The issue I'm referring to:
Remote entities have no variables or events by the time EntityCreated is fired, BUT they get variables on the next frame (but not events). So I can't just setVariable something to tell if entity is respawning or not π€
EntityCreated fires before Respawn?
Yes
yeah not seeing a way then.
Wish there was a way to disable variables and events being re-added to entity after respawn
Guess the only way would be postponing initialization to the end of the frame after EntityRespawned already fired
Yet another command idea: ANY callLater CODE to execute at the end of the frame seamlessly
or STRING for function name instead
Speaking of which, why only local entities get their events re-added while its true for both localities for variables? Sounds like a bug and fixing it would break plenty of backwards compatibility
Wont help here as EntityRespawned seems to be triggered by entity owner and not the server so frame distance is different
Anyone know how t omake a light source that acts like a sun but cuts off at a specific distance. I think using lightattenuation would make this possible but I can't think how t odo it. Basically I want to light a really large open room, a hangar, and none of the light sources that are default will work
--- all wrong ---
There is no comma after binocular
Check error messages, it points exactly where problem is
Run with errors and logs enabled, check logs @ %localappdata%\Arma 3\
Nevermind, order is not guaranteed
Just had this
14:12:08 1573420 :: EntityRespawned :: ["B Alpha 1-3:1 (Sa-Matra (2)) REMOTE (B_Soldier_F) LOCAL=false","1b972acf700# 1780782: c_nikos.p3d REMOTE (B_Soldier_F) LOCAL=false"]
14:12:08 1573420 :: EntityCreated :: B_Soldier_F sim=soldier (B Alpha 1-3:1 (Sa-Matra (2)) REMOTE) local=false
...
14:14:56 1597262 :: EntityCreated :: B_Soldier_F sim=soldier (B Alpha 1-3:1 (Sa-Matra (2)) REMOTE) local=false
14:14:56 1597263 :: EntityRespawned :: ["B Alpha 1-3:1 (Sa-Matra (2)) REMOTE (B_Soldier_F) LOCAL=false","1b8095be800# 1780880: c_nikos.p3d REMOTE (B_Soldier_F) LOCAL=false"]
..huh
So much crap to deal with because game re-adds variables and event handlers to respawned entities
I'd love to have a way to stop this somehow
Can't think of a realiable way that wouldn't break existing vanilla and mod logic that rely on it
Get rid of engine-driven respawn and just create new units\vehicles manually perhaps?
I was also wrong about event handlers not being re-added for remote entities. I forgot that I removed them on EntityKilled.
EntityCreated/EntityRespawned order not being guaranteed is a thing for sure though
I am trying to add a timer to this script so that after 30 seconds It Is no longer avlb for the player to call on.
this addAction ["Teleport to Commander", {
params ["_target", "_caller", "_actionId", "_arguments"];
if (vehicle OpforCommander != OpforCommander) then{
_caller moveInAny (vehicle OpforCommander);
}else{
_caller setPosASL (getPosASL OpforCommander);
};
}, nil, 1, true, true, "", "true", 5];
30 seconds after what?
after 30 seconds the script will not work. I use this In the "On repsawn" file.
actId = player addAction ...
sleep 30;
player removeAction actId;
Sorry, mistyped it. Meant to ask 30 seconds after what moment.
The Issue we have been having Is that It stays on the left hand corner screen and players will click on It by accident using the space bar. We want this option to be avlb for 30 seconds after a player dies and respawns.
30 seconds after respawn
Where would I place this In the code Itself?
I assume this is player's init field?
on player respawn file
which file exactly?
one moment
in the player respawn code
this is init field local variable
onPlayerRespawn.sqf
There is no this there, isn't it?
One moment looking for where Its located
Sorry I found the correct line of code. Its very late for me. Code down below...
switch (side group player) do
{
case west: { // WEST SIDE CODE
player addAction ["Teleport to Nato Base",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState b_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL b_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
case east: { // EAST SIDE CODE
player addAction ["Teleport CSAT Base",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState c_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL c_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
default {};
};
That Is the line of code I am trying to add a 30 second expiration timer on respawn. Once 30 seconds has elapsed the player cannot see this option until they die again.
}, nil, 1, true, true, "", "true", 5];
```to
```sqf
}, nil, 1, false, true, "", "true", 5];
```to stop the action from floating and pressing it by accident
do I add this at the end of the code?
But otherwise do what @proven charm suggested
no, change in existing code in both places
ah I see
let me give this a try.
One last thing. How would I add this In the code?
actId = player addAction ...
sleep 30;
player removeAction actId;
Change single addAction into this contruct
I am sorry come again.
Dots in this exactly are your addAction arguments
Replace them with your stuff after your addAction
Actually, if you have other stuff after that switch block it might not work right away
switch (side group player) do
{
case west: { // WEST SIDE CODE
actId = player addAction ["Teleport to Nato Base",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState b_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL b_tele);
};
}, nil, 1, true, true, "", "true", 5];
};
case east: { // EAST SIDE CODE
actId = player addAction ["Teleport CSAT Base",
{
params ["_target", "_caller", "_actionId", "_arguments"];
if !((incapacitatedState c_tele)== "UNCONSCIOUS") then {
_caller setPosASL (getPosASL c_tele);
};
}, nil, 1, false, true, "", "true", 5];
};
default {};
};
Something like above?
Now where do I add the
sleep 30;
player removeAction actId;
At the end?
if this is the only thing you have in your script file then it will work at the end
I did not add the sleep 30;
player removeAction actId;
I am uncertain where this needs to be placed In the code.