#arma3_scripting

1 messages Β· Page 126 of 1

neon plaza
#

wait the foot notes.

#

I got It.

#

Its fixed. Thanks again!

granite sky
#

Needs a timeout, otherwise you'll have N-1 scripts permanently running every frame for each player.

#

A job for initPlayerLocal really.

daring zinc
#

or you just man up and use the command line

clever hinge
#

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!

tough abyss
#

Nice thanks 4 the info

neon plaza
#

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;
            };
        };
    };
};

hallow mortar
#

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.

inland valve
#

Hi is there any info on respawning vehicles with custom inventories?

neon plaza
#

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.

meager granite
granite sky
#

Nah, the script is perpetual on machines where the unit isn't local.

meager granite
#

so its gonna stop once player loads it

granite sky
#

If it's in an init box, it runs for every player, right

#

Only one of them will ever be local.

hallow mortar
#

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

drifting sky
#

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?

meager granite
granite sky
#

oh right, you have the player == _this check afterwards

meager granite
#

Objects are probably net id interally

drifting sky
#

Is there anything at all distinct about calling a function from a server addon versus calling one defined in a mission?

meager granite
#

no difference, they all get defined into mission namespace during gameplay (or other namespace)

hallow mortar
#

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

icy sorrel
#

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!

meager granite
drifting sky
#

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.

icy sorrel
# meager granite Open Config viewer, find your building\object class in CfgVehicles, check its `A...

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?

meager granite
#

I think you need animateSource

#

Check code for BIS_fnc_Door its the script that vanilla buildings call when you open a door

icy sorrel
#

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. 😦

meager granite
#

no idea, you gotta dig the configs to find they way these doors work to open them with scripts

sage marsh
#

How do i make an ally marker like Riker here? I just can't seem to find the keyword

sage marsh
#

Finally thank youu

#

Been scratching my head finding it

wind hedge
#

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...
fleet sand
wind hedge
cosmic lichen
#

I wouldn't rely on BI configs in this regard.

cold glacier
#

Does anyone know if "Suppressed" event handler should trigger for grenade explosions?

little raptor
#

it only triggers for shots with ShotBullet simulation

dusk shadow
#

@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.

empty rivet
#

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.

dusk shadow
#

There double fixed it...

hallow mortar
#

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

empty rivet
#

thats the main concern I have πŸ˜…

dusk shadow
empty rivet
#

ye just read

#

thanks you two πŸ‘

dusk shadow
rich bramble
#

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.

left iron
#

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?

junior wind
#

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.

grizzled cliff
#

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

lone glade
#

That was pre 1.7 tho

grizzled cliff
#

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

lone glade
#

gawd

grizzled cliff
#

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

hallow mortar
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
dreamy kestrel
#

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?

upbeat valve
#

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;
winter rose
#
_aafTank1_vehicle = _aafTank1 select 0;
_aafTank1_group = _aafTank1 select 2;
_aafTank1 params ["_vehicle", "_crew", "_group"];
```this is redundant
winter rose
upbeat valve
hallow mortar
#

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)

winter rose
upbeat valve
mighty halo
hallow mortar
upbeat valve
#

It's now fixed, thanks :)

drifting sky
#

functions defined in cfgFunctions can't be assigned new script by any means, can they?

warm hedge
#

Do you mean you can overwrite in any ways? In-game, no, config, yes

drifting sky
#

in mission. Hoping there's no way a hacker can change the value of a a function variable in cfgfunctions

warm hedge
#

Not going to say there is 0 chance. But basically it is not possible

drifting sky
#

are trigger expression fields run in scheduled or unscheduled environment?

warm hedge
drifting sky
#

including the condition?

warm hedge
#

Yes

drifting sky
#

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?

warm hedge
#

No

tribal lark
#

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.

warm hedge
#
selectRandom ["Sentence A","Sentence B","Sentence C"]```
tribal lark
scarlet quarry
#

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).

real tartan
#

can I access admins[] = { "<UID>" }; from Server Config File via SQF ?

tough parrot
#

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.

ivory lake
#

use the AI firemodes

#
    modes[] = {"manual","close","short","medium","far"};
tough parrot
ivory lake
#

strange it should work

#

maybne the disableAI is messing with it but its honestly been awhile since I tried it

fleet sand
real tartan
proven charm
fleet sand
proven charm
fleet sand
#

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";
proven charm
#

I thought it would be possible to read the admins directly from config but I guess I was wrong

burnt grove
#

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

fleet sand
burnt grove
little raptor
warm hedge
#

A #define does not care if the name is reserved. It will be replaced anyways

warm hedge
#

That's why

little raptor
warm hedge
#

Well, if you put the code into Debug Console directly, it is

barren surge
#

Anyone in here familiar with ace3 handcuffed functions?

fleet sand
burnt grove
little raptor
fleet sand
# burnt grove That's what I 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.

barren surge
barren surge
barren surge
little raptor
#

right now it's just an array

barren surge
little raptor
#
["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;

barren surge
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
barren surge
little raptor
#

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

barren surge
little raptor
#

tho if you intend to make a SP mission you should also prevent the EH from duplicating

barren surge
#

its for a small private mp game

little raptor
#
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;
};
barren surge
tame bison
#

everything seems to be ready, but one check stops everything (

hallow mortar
#

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

hallow mortar
#

Possibly findIf or count, but it depends on how the logic is supposed to work

meager granite
#

Can you just explain what are you trying to do?

little raptor
#

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 };
neon plaza
#

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;

hallow mortar
#

Do you mean you want the addAction to both initialise spectator and set the view distance?

tame bison
hallow mortar
#

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

meager granite
hallow mortar
# neon plaza Yes
this addAction ["Spectator", {["Initialize", [player, [], true, true, true, false, true, true, true, true]] call BIS_fnc_EGSpectator; setViewDistance 10000}];```
neon plaza
#

I will give this a try.

neon plaza
terse tinsel
#

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??

neon plaza
#

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]; 


hallow mortar
fleet sand
meager granite
terse tinsel
terse tinsel
terse tinsel
little raptor
#

then change the condition to

waitUntil { sleep 1; (allPlayers + allDeadMen) findIf {(_x getVariable ["MyVariable1", false])} < 0 };
hallow mortar
terse tinsel
#

topic with flag closed, thanks for trying to help

tame bison
#

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

tough abyss
#

anyone else feel like this SQF is hard to work with or maybe its a steep learning curve, or maybe Im an idoit

granite sky
#

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.

tough abyss
#

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

granite sky
#

cutRsc uses data defined in config, not code.

tough abyss
#

oh well, i might be down the wrong road then

granite sky
#

If you're working on a mission then you'd put RscTitles data in description.ext.

tough abyss
#

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";
            };
        };
    };
};

granite sky
#

What's the error?

tough abyss
#

let me get it to error one sec

#

RifleLevelText.size? in RifleLevelDisplay > Controls.

granite sky
#

Yeah you have sizeEx but not size.

tough abyss
#

-.-

#

one sec

granite sky
#

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.

tough abyss
#

chatgtp is helping me

granite sky
#

Ah, there's your problem.

tough abyss
#

so clearly it isn't the way

granite sky
#

ChatGPT is terrible at SQF (and config, I assume)

tough abyss
#

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

granite sky
#

You need to change quite a lot of things :P

tough abyss
#

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?

granite sky
#

No it doesn't.

#

Did you follow the link I gave you?

tough abyss
#

I looked into it

granite sky
#

Scroll to the bottom. There are examples.

tough abyss
#

wait i think i see

#

size = GUI_TEXT_SIZE_MEDIUM;

granite sky
#

That's probably defined in #include "\a3\ui_f\hpp\definecommongrids.inc" but that doesn't seem to be documented.

tough abyss
#

ah

granite sky
#

You're missing the whole attributes subclass for structured text anyway.

tough abyss
#

isnt rifleleveltext a subclass?

granite sky
#

It looks like ChatGPT just pasted some example for CT_STATIC instead.

tough abyss
#

okay so basically ill restart

granite sky
#

shrugs

#

it's not massively far off :P

tough abyss
#

I mean clearly i am struggleing to pin point and understand the compects.

granite sky
#

You should probably start with CT_STATIC rather then CT_STRUCTURED_TEXT anyway.

#

like major hurdle is getting it to display anything at all.

tough abyss
#

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?

inner swallow
#

Hey all, which are the currently recommended SQF extensions for VSCode?

tough abyss
#

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.

granite sky
#

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.

tough abyss
#

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?

granite sky
#

The specific error you had was caused by ChatGPT missing the size parameter.

tough abyss
granite sky
#

Now CT_STATIC uses sizeEx instead of size :P

tough abyss
#

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

astral tendon
#

So waypointAttachObject just does not work? I cant attach it to a unit.

winter rose
#

code pls

astral tendon
#
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

astral tendon
winter rose
astral tendon
#

same problem

winter rose
#

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?
hallow mortar
#

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

winter rose
#

what is _target, a unit?

winter rose
#

@astral tendon good enough?

winter rose
hallow mortar
#

ah, you're right, that's what I was thinking of. That explains a few things...

astral tendon
winter rose
astral tendon
#

so only the player waypoint work?

tough parrot
scarlet quarry
winter rose
astral tendon
#

The target is a AI unit and the group is a AI

winter rose
astral tendon
#

...by letting they move and the waypoint still in the same place?

winter rose
#

did you try reveal the target?

astral tendon
#

No? is it required?

winter rose
#

maybe, unsure

#

I think I want to take a step back and ask "what do you want to do?"

astral tendon
#

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.

fleet sand
tough abyss
#

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.

scarlet quarry
tough abyss
#

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;```
tough abyss
#

I have that, thanks

hallow mortar
#

@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.

tough abyss
#

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

granite sky
#

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.

tough abyss
#

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

sullen marsh
#

@grizzled cliff isn't Intercept guarneteed to trigger BE?

grizzled cliff
#

i duh know

#

but fuck BE

#

its worthless anyways unless you are a pubby server

still forum
#

BE is not checking on script function calls...

sullen marsh
#

Heh

still forum
#

its checking on the script parser side but you are not parsing any scripts.

grizzled cliff
#

yah i mean unless BE is looking for Arma patching itself

#

this is all done via callExtension to load the DLL into the process

sullen marsh
#

I was more thinking about it checking memory modifications

grizzled cliff
#

yah, i dont know if it does sig checking on sqf functions

still forum
#

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

grizzled cliff
#

no i am hooking

still forum
#

why?

sullen marsh
#

It is though, it hooks directly into the SQF engine from what I can see

grizzled cliff
#

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

still forum
#

do you really need those?...

grizzled cliff
#

because it potentially can change

#

i also do type inference deduction from hooked functions

#

so i dont have to know offsets

still forum
#

you can get gamestate pointer from memory by pattern searching

grizzled cliff
#

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

still forum
#

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...

grizzled cliff
#

hmm maybe

vital silo
# tough abyss ``` authorized_weapons_dictionary = { "B_Soldier_F": Rifle_level_group, ...
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]
];
grizzled cliff
#

i still need to hook though, to do type deductions at least once

#

and to get pointers to global sqf variables

novel tinsel
#

Has anyone managed to make a flag initialization sqf file about a vehicle for Arma Gold?

grizzled cliff
#

though i guess i could technically use getVariable

#

to do that

#

from my side

still forum
#

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

grizzled cliff
#

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

still forum
#

it does. Its a global variable so address is set compile time

grizzled cliff
#

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?

still forum
#

no

sullen marsh
#

I thought that was the point of the game loading through the BE launcher now...

lone glade
#

Isn't be just getting updated when the game start ?

still forum
#

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.

grizzled cliff
#

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

still forum
#

but be blocks dll injection.. you know that right? ^^

grizzled cliff
#

yah, this is all done via callExtension

#

and im sure i can get BE to approve my DLL one way or the other ;)

still forum
#

how do you callExtension before the menu? ... yeah i can show you how

grizzled cliff
#

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

still forum
#

oh yeah... ace with less than 1% performance impact... awesome ^^

grizzled cliff
#
			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)...

still forum
#

^^ thats exactly what im using.. but thats only launchin a tiny touch before main screen

grizzled cliff
#
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

still forum
#

but i think you could use __EVAL in a config... it just creates a scriptVM and lets it run through..

grizzled cliff
#

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

tranquil monolith
#

nice

astral saddle
#

Hey there is there any way I can make a trigger delete an object?

still forum
#

Lets not let that become a discussion about evading battleye :X

astral saddle
#

Legend

grizzled cliff
#

seriously, fuck BE. I could do it better.

#

besides no need to evade it when most proper communities and players dont use it

still forum
#

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?!"

grizzled cliff
#

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

covert hearth
#

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"?

cosmic lichen
#

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".

covert hearth
#

Okay, gotcha

#

Ty

little raptor
cosmic lichen
mystic scarab
#

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?

proven charm
cosmic lichen
#

You can spawn it and wait until time > 0

wooden dove
#

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.

sullen sigil
#

its a #arma3_config question but ask in the ace discord as it has the specifics

proven charm
#

can you hide/remove building doors?

mystic scarab
# proven charm your running that on your PC only or multiple PCs?

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;
cosmic lichen
#

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.

winter rose
mystic scarab
neon plaza
#

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];  


proven charm
proven charm
#

well if you want to stuff all the code in there

#

id use script files πŸ™‚

stable dune
#

create file

initPlayerLocal.sqf

so it will be executed locally on client

neon plaza
neon plaza
stable dune
#

you need use player.

stable dune
# neon plaza I also seems to have gotten an error code.

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 {};
};
neon plaza
stable dune
#

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

neon plaza
stable dune
#

Yeh, Change c_tele to b_tele

neon plaza
stable dune
neon plaza
#

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 {};
};

neon plaza
stable dune
#

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 ?

neon plaza
#

Here let me post everything In the file.

stable dune
#

in same? or where you have

#

that

neon plaza
#

[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 {};
};

stable dune
#
player addaction [
    "Server Information and Discord", 
    {
        0 spawn MRTM_fnc_MRTM_welcome;
    },
    nil,
    1.5,
    false
neon plaza
stable dune
#

There is you missing.

neon plaza
#

Could not do this crap for a living.

neon plaza
# stable dune There is you missing.

[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 {};
};

agile pumice
#

can someone help me with some trig vectoring for spawning objects around my player?

hallow mortar
#

East addAction has an extra ] after the action title string

neon plaza
agile pumice
#

_pos1 = [(getPosASL _static select 0) + 1 * (sin _dir), (getPosASL _static select 1) + 1 * (cos _dir), getposASL _static select 2]; works for placing it infront

fleet sand
#

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 ?

little raptor
#

or getNumber/getArray/getText

fleet sand
# little raptor `BIS_fnc_getCfgData`

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");
tough abyss
little raptor
#

use getMissionParam iirc

#

getMissionConfigValue meowsweats

winter rose
little raptor
#

he said not getParamValue? meowsweats

fleet sand
winter rose
#

but then yes mission config texts select _id

#

mb, didn't scroll up enough

pliant stream
#

@agile pumice what do you want to do

hallow mortar
#

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

cosmic lichen
#

BIS_fnc_storeParamsValues_data

#

Only integers are allowed.

fleet sand
hallow mortar
#

It returns numbers because params values should only be numbers (whole numbers, no decimals) in the first place

cosmic lichen
#

You can get it differently but why would you

#

What exactly is the issue?

hallow mortar
#

They're trying to use a string as the param value

cosmic lichen
#

But why

#

Just map the integer value to a string value in a script

#

["string1", "string2"...] select _myParamInteger

fleet sand
#

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

cosmic lichen
#
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.

fleet sand
cosmic lichen
#

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.

fleet sand
cosmic lichen
#
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)

fleet sand
cosmic lichen
#

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.

agile pumice
#

spawn an object left, front and right of an object

still forum
#

_dir is the direction...

pliant stream
#

so you want it them at 90 degree angles

still forum
#

take the direction the player is facing.. and one -90Β° and one +90Β°

pliant stream
#

i would just modelToWorld

mystic scarab
#

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;```
proven charm
tough abyss
#

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?

tough abyss
mystic scarab
tough abyss
#

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.

granite sky
#

Anything in quotes is just a string.

vital silo
#

I think you wanted to do this

tough abyss
#

is this incorrect? soldierclass = soldierclassArry [["B_Soldier_F",1], ["B_soilder_AR_F",2] ];

vital silo
#

Yes

tough abyss
#

okay ty

vital silo
#

Working with SQF is very different from any other language

tough abyss
#

ya its been blowing my mind the ppast few days.

vital silo
tough abyss
#

sure once I solve this error I'll move on to the next error,

vital silo
#

Send me the entire script written in your initPlayerLocal.sqf

tough abyss
#

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.

vital silo
#

You must create a new array to determine the levels of each weapon.

tough abyss
#

devstar_var_riflesLevels = createHashMapFromArray [
// Case sensitive!
["arifle_MX_F",1],
["arifle_MX_GL_F",2]
]; like so?

little raptor
# mystic scarab I'm trying to add an action to Recruit an AI to init.sqf. It works to add the AI...

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]);
tough abyss
#

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

vital silo
#

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];
granite sky
#

Hash maps are much better here :/

vital silo
#

They can also be used

tough abyss
#

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

granite sky
#

Roberio's code is flat arrays with lookup functions.

little raptor
tough abyss
#

how in the double heck you write that off the top of your head man, wild

granite sky
#

ok "flat" is not really true :P

tough abyss
#

right right

little raptor
#

to make a hashmap you can use the createHashmapFromArray command, which takes an array of array of pairs

tough abyss
#

im confused as hell.

#

so do I still need this file?

little raptor
#
createHashmapFromArray [
  [key1, val1], //pair1
  [key2, val2], //pair2
  ...
]
tough abyss
#

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"];

little raptor
#

that's just wrong

tough abyss
#

I need the hasharry to have multiple vaules

little raptor
#

it should be

("devstar_riflesLevelsLayer" call BIS_fnc_rscLayer) cutRsc ["devstar_rifledisplay","PLAIN"];
tough abyss
#

πŸ˜΅β€πŸ’«
πŸ₯²

vital silo
#

They wrote this code for it, but with HUD elements. I think that confused him a little.

tough abyss
#

okay. so.

hallow mortar
#

I really want to respond to this since it's my code being criticised but I'm in the middle of a mission :U

little raptor
#

no offense but you won't get anywhere as long as you use ChatGPT

tough abyss
#

my stuff is so bit and peice of bolt on stuff i think ill restart again.

hallow mortar
#

my code worked. as a demo, to read and figure out how it worked, on its own

tough abyss
#

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

vital silo
#

@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;
    };
};
grave hare
#

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

tulip ridge
tough abyss
# vital silo If you want to use HashMaps: ```sqf Weapons_Levels = createHashMapFromArray [ ...
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

vital silo
#

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...

tough abyss
#

can I sqf Soilder_class_arry = createHashMapFromArry [[["B_Soilder_F",1],["B_soilder_AR_F", 2]]?

vital silo
#

You can simply select the authorized weapons using the "typeOf player" as a parameter.

tough abyss
#

oh oh okay

vital silo
#
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;

tough abyss
#

shit i had class_type = player typeOf unit

vital silo
#

I think this is written wrong

granite sky
#

Yeah, the lower case s is actually correct but it's "B_soldier_AR_F"

grave hare
tough abyss
#

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;
};

};

tulip ridge
vital silo
tulip ridge
grave hare
tough abyss
#

wait isn't _authorizedWeapons already defined?

grave hare
#

Makes you wonder why the option to preserve elevation on a marker position is even a thing

vital silo
tulip ridge
hallow mortar
grave hare
#

Ahhh ok

tulip ridge
#

So yeah, you can either create the markers via script or you can use an object

vital silo
#

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.

grave hare
#

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

vital silo
#

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.

tough abyss
vital silo
#

@tough abyss

grave hare
tough abyss
#

player not unit

#

okay ty ty

#

trying to not copy and paste

vital silo
tough abyss
#

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.

tulip ridge
#

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

grave hare
mystic scarab
granite sky
#

The actionId won't necessarily be the same on all machines.

grave hare
#

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?

sharp grotto
grave hare
#

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

grave hare
#
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

sharp grotto
#

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"
    ];```
tough abyss
#
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?
grave hare
#

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 []

vital silo
#

Hello

#

@grave hare How did you run the scripts?

vital silo
grave hare
vital silo
#

Ok

sharp grotto
vital silo
#

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.

tough abyss
#

i still need to check if its authorized?

vital silo
#

Put this right after populating the variables.

publicVariable "varName";
#

This will propagate it to all clients

sharp grotto
#

If you change these again, you need to publicVariable again to update them for all clients

tough abyss
#
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]
    }
  };
};```??
vital silo
#

Yep

sharp grotto
#

Hashmaps meowheart

tough abyss
#

eh, still no joy

vital silo
#

I also recommend using "getOrDefault", to avoid problems such as the lack of the player's class in the hashMap.

tough abyss
#

doesnt eject the player from the other vehicels

sharp grotto
vital silo
#
private _authorizedVehicle = Vehicle_Levels getOrDefault [(typeOf player), []];

if (_authorizedVehicle != [] && !(_currentVehicle in _authorizedVehicle)) then {

};
grave hare
#

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

sharp grotto
#

Then check if this reports any valid position via diag_log

private _markerPos = getMarkerPos "citadel";
grave hare
#

It does return a Pos

sharp grotto
#

That's the standard procedure for debugging, check all your variable first

#

Isolate the problem and then try to fix it step by step

tough abyss
#

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;
}

};
};

vital silo
# grave hare It does return a Pos

Try running this close to the location you set up.

private _objs = nearestObjects [player, ["Land_HelipadEmpty_F"], 200];
hint format["%1", _objs];
grave hare
#

And that snippet does display a list of all the helipad game objects' variable names

tough abyss
#

ty for the helps guys

grave hare
#

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

sharp grotto
grave hare
#

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

sharp grotto
#

Use this then

grave hare
#

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

vital silo
#

@grave hare If it doesn't work, try this

_spawnPos = selectRandom lightenemyspawn;
_unit = _grp createUnit
[
    "WBK_B1_standart",
    _spawnPos,
    [],
    0,
    "NONE"
];

_unit setPosATL _spawnPos;
tough abyss
#

is there lists of classes in the docs like of the soldiers and weapon classe?

grave hare
hallow mortar
#

getPosATL or getPosASL, depending on which format you need

grave hare
#

I tried that and it said it expected an object and not a string

hallow mortar
#

Then you need to give it the object's variable name as a variable name, not as a "string"

grave hare
#

so get rid of the ""?

hallow mortar
#

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

grave hare
#

I got it finally

#

Thanks for all your help guys

astral tendon
# winter rose `BIS_fnc_stalk`?

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";
scarlet quarry
#

Howdy all. Super short summary: Trying to get respawned vehicles to have unlimited ammo.

https://forums.bohemia.net/forums/topic/280836-respawn-expressions-issues/

steep verge
#

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!

manic kettle
#

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

grave hare
#

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

ivory lake
#

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

#

although your error doesnt make sense as you're using _unit in setcombatmode not _grp so I dont know where that is or what

grave hare
#

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

granite sky
#

Is enemyGroupList a list of enemy units or a list of enemy groups?

grave hare
#

Groups

#

Although that whole line may be redundant now that I game them actual variable names

grave hare
#

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

granite sky
#

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.

grave hare
#

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

granite sky
#

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.

formal stirrup
#

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

grave hare
formal stirrup
#

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?

#

AmeStare 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

agile pumice
#

thanks

proven charm
#

can building doors be removed?

winter rose
#

no

#

maaaybe animated to be inside the wall, but I don't even think so

proven charm
#

too bad , would be nice feature to be able to blow up the doors

round scroll
sullen sigil
#

unless you can set the door angle i dont think so

#

i.e if animationsource for door is just 360

proven charm
#

no change texture command for doors?

hallow mortar
#

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.

winter rose
#

so yeah, no door destruction for you (many before you have tried)

proven charm
hallow mortar
#

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.

proven charm
#

yep

vocal mantle
#

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.

agile pumice
#

I've been using modelToWorld with mixed success

#

the objects I'm trying to spawn are just a little bit too high up

vocal mantle
#

I'm not sure how many arma players out there own one.

hollow hare
#

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.

round scroll
#

@agile pumice try to use a setVelocity on them to drop them to the ground

agile pumice
fleet sand
hollow hare
agile pumice
#

I'd like to make sure I'm using the right commands before I try any janky fixes like that,TETET

turbid marsh
#

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

grave hare
#

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

hallow mortar
#

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

grave hare
#

So simply adding publicVariable "unitsToSpawn";?

hallow mortar
#

probably. I'd suggest giving it a more unique name to avoid conflicts with other mods and scripts, e.g. greg_var_unitsToSpawn

grave hare
pliant stream
#

@agile pumice _pos = _myObject modelToWorld [x, y, 0]; _pos set [2,0];

grave hare
#

No dice, still says its an undefined variable

granite sky
#

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.

grave hare
#

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;
};```
granite sky
#

That addAction code doesn't call anything?

grave hare
#

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

astral tendon
#

is there a commamd that order a group to take over a building?

kindred zephyr
#

yes, there is a couple bis functions to create garrisoned buildings

granite sky
#

Moving to the upper floor of buildings is buggy though, so you'd probably need to teleport them for that.

kindred zephyr
#

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

agile pumice
#

sorry foxy, not really seeing how thats helping my z pos issue

#

i understand what your code does, but its already 0?

round scroll
#

@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 ?

agile pumice
#

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

round scroll
#

can't you simply select 0 and 1 from _pos and set the 3rd parameter to 0?

agile pumice
#

thought of doing that, just looking for the best way

#

least amount of cocd

#

code*

astral tendon
little raptor
astral tendon
little raptor
#
_list = triggerArea myTrigger nearEntities [["Man", "Air", "Car", "Motorcycle", "Tank"], 200];
#

either like that or you define it manually

#

see inArea

astral tendon
#

I saw it, did not helped.

[Player, 2000,2000,0,false,100] nearEntities [["UK3CB_ADE_O_TL"], true, true, false];
little raptor
#

are you using dev branch?

astral tendon
#

No

little raptor
#

meowsweats
it's not released to stable yet

astral tendon
#

Beautiful.

little raptor
#

current stable is v2.14

astral tendon
#

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.

fleet sand
# astral tendon 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];
astral tendon
# fleet sand Here is how you can filter by distance all units in area: ```sqf private _unitsC...

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
fleet sand
#

You could also do it like so:

private _unitsCheck = allUnits select {alive _x and _x iskindOf "UK3CB_ADE_O_TL"};
agile pumice
astral tendon
agile pumice
#

thanks for the assist

#

is there an easy to sink an object under the ground without disabling its simulation?

agile pumice
#

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

little raptor
#

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)

low remnant
#

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.
ivory lake
#

replace the () with {} on the while statement

low remnant
#

after a severe facepalm, thad did indeed fix it

winter rose
#

severeFacepalm: Boolean - (Optional) can be used to force "while" to work

proven charm
#

why not alt syntax for while that takes boolean, maybe faster?

winter rose
#

because it would be evaluated only once

proven charm
#

ic

meager granite
#
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?

open hollow
#

how is compared to getOrDefault?

meager granite
#

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?

open hollow
#

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

nocturne cobalt
#

how can i fix that addon builder

#

binarize

fleet sand
#

Quick question dose anybody here knows how to setup .ext for description in arma to open in notepad++ with a cpp syntax highlight ?

proven charm
#

it should auto save the setting unless Im wrong

kindred zephyr
#

it does

proven charm
#

also there probably is user defined language for arma configs somewhere. I use one

kindred zephyr
#

i have my own flavor too, n++ has 2 sqf highlighters but one of them is tremendously outdated

#

but for cpp best use c++

proven charm
#

he has .ext , which is very similar to c++

kindred zephyr
#

isnt ext a cpp but wrapped?

proven charm
#

i think its arma's own format

hallow mortar
#

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.

fleet sand
#

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.

hallow mortar
#

Go into the language settings for C++ and add .ext to the list of associated filetypes

fleet sand
hallow mortar
#

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

little raptor
little raptor
#

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++

fleet sand
tulip ridge
little raptor
#

nope meowsweats

#

it's nothing special tho

#

config only has a handful of keywords so making one manually is easy

tulip ridge
#

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)

still forum
still forum
still forum
little raptor
little raptor
still forum
#

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

meager granite
tough abyss
#

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)?

hallow mortar
tough abyss
#

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"]]];

hallow mortar
#

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

tough abyss
#

awesome, thank you for the advice

hallow mortar
#

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"
            ]
        ]
    ];```
tough abyss
#

that look great, I was just about to ask what best practice was for embedding multiple arrays

hallow mortar
#

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

tough abyss
#

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.

tepid talon
#

does anyone know how to fix cup_building2_data

little raptor
#

what's wrong with it?

tepid talon
#

sry

real tartan
#

is there a SQF way to check if extension is loaded ?

winter rose
#

make a valid call, if it returns empty string then not

tough abyss
#

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

tough abyss
hallow mortar
tough abyss
#

oh sorry, ignore

meager granite
#

I wonder if there is reliable way to tell if entity in EntityCreated is a respawning entity and not a new one?

tough abyss
#

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

meager granite
granite sky
#

EntityCreated fires before Respawn?

meager granite
granite sky
#

yeah not seeing a way then.

meager granite
#

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

meager granite
meager granite
grave hare
#

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

meager granite
#

--- 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\

meager granite
#

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"]
granite sky
#

..huh

meager granite
#

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?

meager granite
# granite sky ..huh

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

neon plaza
#

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];


neon plaza
#

after 30 seconds the script will not work. I use this In the "On repsawn" file.

proven charm
#
actId = player addAction ...
sleep 30;
player removeAction actId;
meager granite
neon plaza
#

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

neon plaza
meager granite
#

I assume this is player's init field?

neon plaza
meager granite
#

which file exactly?

neon plaza
#

one moment

proven charm
meager granite
#

this is init field local variable

neon plaza
#

onPlayerRespawn.sqf

meager granite
#

There is no this there, isn't it?

neon plaza
neon plaza
# neon plaza 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 {};
};

neon plaza
meager granite
#
}, 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
neon plaza
meager granite
#

But otherwise do what @proven charm suggested

meager granite
neon plaza
#

let me give this a try.

neon plaza
meager granite
#

Change single addAction into this contruct

neon plaza
meager granite
#

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

neon plaza
# meager granite Dots in this exactly are your addAction arguments

    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?

meager granite
#

Yes, you're doing it right

#

now you need that sleep and removeAction

neon plaza
#

At the end?

meager granite
#

if this is the only thing you have in your script file then it will work at the end

neon plaza
#

I am uncertain where this needs to be placed In the code.