#arma3_scripting

1 messages Β· Page 482 of 1

minor lance
#

i want to die

#

if i set my file to ```sqf
#include "

             [Error] 

"

#

It works, when the game loads i get the error

#

So the function is working

still forum
#

then the file path for your file is wrong

austere granite
#

your function probably doesnt exist, did you actually confirm the uiNamespace vs missionNamespace thing

#

with (uiNamespace) do { wtf?
no missionNamespace in 3den, unless you have already previewed a mission

minor lance
#

In my main menu there is a mission being loaded

#

and it exist i can check the contente in debug console

austere granite
#

then you might have it, but if you load with -world=Empty you wont

#

missionNamespace recreation in eden is a little weird

minor lance
#

I'm loading with mission path

#

my file contains this [] call compile preprocessFile "\pop_codigo\x.sqf";

#

And its not executing in game loading or mission loading

#

even in debug console it does nothing

#

only if I put it on variable watcher or whatever name it have it closes my game

still forum
#

no missionNamespace in 3den wut?

#

missionNamespace always exists

#

you can't just delete it

austere granite
#

if you load into 3den with what was before -world=Empty you won't have functions available in missionNamespace

#

it'll exist, but functions won't exist in it

still forum
#

@minor lance
isNil {call compile preprocessFile "\pop_codigo\x.sqf";}

#

maybe?

minor lance
#

Im gonna try some more or i'll just delete the whole 3den dialogs functions and EVERYTHING KFHNWUJIAEGEFDEAofd

#

Its working o variable watcher

#

@still forum

minor lance
#

Im executing this shit ```diag_log time;

#

Its only being called when I press Play

#

uh

unborn ether
#

Isn't time existent only in active mission? 3DEN is not a mission AFAIK.

polar folio
#

is copyToClipboard limited to a certain amount of characters? trying to generate a config from ingame sqf but it cuts off at line 561

#

nvm. format was limiting it i think. got rid of that and all good now

still forum
#

yes it is

#

But I think it might only be string limit

minor lance
#

@unborn ether It was just a test, The script does only execute when the mission is started

#

I need to execute When 2den is loaded

#

3den

mortal yoke
#

i'm struggling to ctrlcreate CT_OBJECT_CONTAINER in displays... doesn't work for me. other ctrl types are no problem.

i dont want to predefine dialogs, its not dynamic enough.

velvet merlin
#

what can lead to getIn EH only have one parameter (the unit)

#

like first time launch in 2d editor
["FLAK - getIn",[B Alpha 1-1:1 (test),"driver",B Alpha 1-1:3,[]]]
["FLAK - getIn",[B Alpha 1-1:1 (test),"commander",B Alpha 1-1:1 (test),[0]]]
["FLAK - getIn",[B Alpha 1-1:1 (test),"gunner",B Alpha 1-1:2,[1]]]

restart mission (back to editor and start again)
["FLAK - getIn",[B Alpha 1-1:1 (test)]]

#

i think this is from/started with 1.84 as we should not have changed anything with the config EH definition

sick sorrel
#
if isServer then {[group this, getPos this, 200] call bis_fnc_taskPatrol;};

I copied this from a mission where it works just fine, and added it on a number of Group Leaders or Move-waypoints. now I'm getting errors that it's expecting an object, not a group ... why?

indigo snow
#

If you put it in the group init instead of the group leaders init, this is the group.

sick sorrel
#

Thanks. It had indeed crept into a single group init

tough abyss
#

@velvet merlin 2D editor? Does it work ok in 3Den?

velvet merlin
#

seems not limited to 2d editor as others reported that too and pretty sure they didnt use 2d editor

tough abyss
#

So the unit starts in vehicle?

velvet merlin
#

yes

#

as commannder with AI crew

tough abyss
#

I know that PlayerViewChanged was also not firing when unit was in vehicle in editor, perhaps a bug, worth notifying @lavish ocean ?

sullen willow
#

Probably just doing a dumb, but what have a I done wrong here? Trying to make it so that a player can only access this action at a specific distance

this addAction ["Exec the file", "scriptFile.sqf","_this distance _target < 1"];

ruby breach
#

You don't have a condition

high marsh
#

Plus, you have your parameter order all messed up. the condition does not come after code or script.

winter rose
#

right* after, at least

high marsh
#

^ My english without coffee >:)

sullen willow
#

Thanks

wary vine
high marsh
#

@wary vine That's pretty cool, what do you plan on doing with it further? Or is it pretty much finalized?

#

Weren't you working on that phone as well?

wary vine
#

pretty much finalized

#

the phone is done πŸ˜„

#

just finished the tfar calling module for it

#

will be making a vanilla arma one soon too

high marsh
#

Suhweeet. I like this though, you might want to stylize it in some areas and make it colorful or at least cool to look at

#

Oh wow, okay. How does it work with TFAR?

wary vine
#

prettying up the dialog will be the last thing i do

#

I want to try and make the chat system standalone the only problem is the database side

high marsh
#

Woah 0-0

#

It's so smooth, and buttery.

wary vine
#

πŸ˜„

high marsh
#

Yeah, functionality should always come firstm

wary vine
#

its just a single dialog with ctrlCreate and delete

high marsh
#

0______0

wary vine
#

the only way I could really do it, was with a standalone db structure

#

i.e its own connection to extdb

meager heart
#

that phone is the only one "life" thing that I actually like πŸ˜ƒ

#

gj

wary vine
#

ty

#

took like 2 months to finish, and still finding little bugs here and there, but its expected

haughty scarab
#

can anyone tell me why the LRR & Lynx aren't showing in the shop with this config?

class black {
        name = "Black Market Weapon Shop";
        side = "civ";
        conditions = "";
        items[] = {
            { "NVGoggles_OPFOR", "", 5000, 75, ""},//Black NightVision
            { "Binocular", "", 150, 75, "" }, //Binocular
            { "Rangefinder", "", 50000, 50, "" },//Rangefinders
            { "ItemGPS", "", 100, 50, "" },//GPS
            { "MMG_01_tan_F", "", 2250000, 50, "mav_ttm_var_rebel >= 5" },  //Navid
            { "MMG_02_sand_F", "", 2500000, 50, "mav_ttm_var_rebel >= 5" }, //SPMG
            { "srifle_LRR_F", "", 3500000, 50, "mav_ttm_var_rebel >= 5" },  //LRR
            { "srifle_GM6_F", "", 15000000, 50, "mav_ttm_var_rebel >= 5" }, //Lynx
            { "launch_RPG7_F", "", 1500000, 50, "mav_ttm_var_rebel >= 5" }, //RPG-7
            { "muzzle_snds_H", "", 3500, 375, "" }, //Suppressor
            { "muzzle_snds_L", "", 3500, 375, "" }, //Suppressor
            { "muzzle_snds_M", "", 3500, 375, "" }, //Suppressor
            { "muzzle_snds_B", "", 3500, 375, "" }, //Suppressor
            { "muzzle_snds_H_MG", "", 3500, 375, "" }, //Suppressor
            { "muzzle_snds_338_sand", "", 3500, 375, "" }, //Suppressor
            { "muzzle_snds_58_blk_F", "", 3500, 375, "" }, //Suppressor
            { "muzzle_snds_65_TI_blk_F", "", 3500, 375, "" }, //Suppressor
            { "muzzle_snds_93mmg_tan", "", 3500, 375, "" } //Suppressor
        };
ruby breach
#

Doesn't look like there's any reason they shouldn't if the LMGs are

haughty scarab
#

yeh the LMGs are but the 2 i mentioned dont

ruby breach
#

Not much we can tell you without knowing how the shop is pulling the items. But the elements are the same data types and the same format as the other weapons in there

haughty scarab
#

its the default altis life shop, but the 2 new weapons wont show in the shop

wary vine
#

have you checked for errors ?

#

if there was a script error during a loop it might have broke the loop

haughty scarab
#

no errors

wary vine
#

try to put debug messages in the script

haughty scarab
#

what do you mean mate?

wary vine
#

it doesn't show up in the shop right ?

#

so find out why it doesn't

#

yourmissionpbo/core/shops/fn_weaponShopFilter.sqf is the file you want to look at

#

line 85 - 106

haughty scarab
#

oh right ok

#

will check that now

wary vine
#
        case 0: {
            _config = M_CONFIG(getArray,"WeaponShops",_shop,"items");
            diag_log _config;
            {
                _bool = [_x] call life_fnc_levelCheck;
                diag_log _bool;

                if (_bool) then {
                    _itemInfo = [_x select 0] call life_fnc_fetchCfgDetails;
                    diag_log _itemInfo;
                    _itemList lbAdd format ["%1",if (!((_x select 1) isEqualTo "")) then {_x select 1} else {_itemInfo select 1}];
                    _itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
                    _itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
                    _itemList lbSetValue[(lbSize _itemList)-1,_x select 2];
                };
                true
            } count _config;

            ((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
            ((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Mags";
            ((findDisplay 38400) displayCtrl 38407) ctrlSetText localize "STR_Global_Accs";
            
            ctrlShow [38402,true];
            ctrlShow [38406,true];
            ctrlShow [38407,true];
        };
``` if you change that to what i just sent, then restart and open the shop in question , then check client logs there should be 3 outputs per weapon if they meet conditions
haughty scarab
#

righty ok

wary vine
#

have you tried debugging this yourself first ?

haughty scarab
#

yeh

#

have been for 6 hours

#

oops, thats the wrong script

#
    case (_item isEqualTo "blastingcharge"): {
        if (cursorObject == fed_armory) then {
            player reveal fed_armory;
            (group player) reveal fed_armory;
            [cursorObject] spawn life_fnc_blastingChargeArmory;
            closeDialog 0;
    };
};
wary vine
#

what steps have you taken to debug this ?

haughty scarab
#

checked all the files it calls, read it over like 50 times, ran arma with show script errors

wary vine
#

cursorObject == fed_armory put that in your watch list and look at the object

haughty scarab
#

ok

wary vine
#

it should return true / false

#

if it returns any , there is no object with the name fed_armory

haughty scarab
#

ok

#

will check that now

#

returned true

wary vine
#

well then diag_log the _item at the beginning of the script

#

to see if it isEqualTo blastingcharge

haughty scarab
#

ok will try that

velvet merlin
#

@tough abyss for now i added a parameter count check
getIn EH to trigger when starting in a vehicle sounds fishy to me in the first place (but might have been the case since always)

limber sinew
#

how do i make the csat forces become RHS Russian forces without using zues?

wary vine
#
params [
  "_pos"
];

_pos params ["_xPos", "_yPos", ""];

//--is the position inside the map
if (_xPos < 0 || _xPos > worldSize || _yPos < 0 || _yPos > worldSize) then {
  _pos = [];
};

//--Check if our pos is in one of the blacklisted areas.
if !(_pos isEqualTo []) then {
  {
    if (_pos inArea _x) exitWith {
      _pos = [];
    };
  } forEach (getArray (missionconfigfile >> "Lega_RandomDealers_Config" >> "BlacklistedAreas"));
};

//--or within the minimum distance of another dealer
if !(_pos isEqualTo []) then {
  if ((count Lega_dealerPositions) > 0) then {
    {
      if ((_pos distance _x) < Lega_DistanceBetween) exitWith {
        _pos = [];
      }
    } forEach Lega_dealerPositions;
  };
};

_pos;
``` anyone have any ideas of a better way ?
meager granite
#

I'd optimize it even outside of this function and instead of empty array returned a nil, I assume you then do count _pos == 0 check.

#
    params ["_pos"];
    _pos params ["_xPos", "_yPos"];

    if(_xPos < 0) exitWith {nil};
    if(_yPos < 0) exitWith {nil};
    if(_xPos > worldSize) exitWith {nil};
    if(_yPos > worldSize) exitWith {nil};

    if({
        if(_pos inArea _x) exitWith {1};
    } count getArray(missionconfigfile >> "Lega_RandomDealers_Config" >> "BlacklistedAreas") > 0) exitWith {nil};

    if({
        if(_pos distance2d _x < Lega_DistanceBetween) exitWith {1};
    } count Lega_dealerPositions) exitWith {nil};

    _pos;
#

@wary vine

#

Change nil to [] if you need empty array specifically

wary vine
#

ill take a look thanks

#
Lega_fnc_getDealerMarkers = {
    private _maxDealers = 5;

    for "_i" from 0 to _maxDealers do {
        
        while {true} do {
            private _postoCheck = [[(worldSize / 2), (worldSize / 2)], 0, (worldSize / 2), 10, 0, 0, 0] call BIS_fnc_findSafePos;
            private _pos = [_postoCheck] call Lega_fnc_checkPosition;
            if !(isNil _pos) exitWith {};
        };
        Lega_dealerPositions pushBack _pos;
    };
};

Lega_fnc_checkPosition = {
    params ["_pos"];
    _pos params ["_xPos", "_yPos"];

    if(_xPos < 0) exitWith {nil};
    if(_yPos < 0) exitWith {nil};
    if(_xPos > worldSize) exitWith {nil};
    if(_yPos > worldSize) exitWith {nil};

    if({
        if(_pos inArea _x) exitWith {1};
    } count getArray(missionconfigfile >> "Lega_RandomDealers_Config" >> "BlacklistedAreas") > 0) exitWith {nil};

    if({
        if(_pos distance2d _x < Lega_DistanceBetween) exitWith {1};
    } count Lega_dealerPositions) exitWith {nil};

    _pos;
};
``` is what i have so far with what you gave me
meager granite
#

Should be !(isNil"_pos")

#

Also why [_posotCheck] and not just send the position itself? Needless array layer.

wary vine
meager granite
#

Do you need this on each frame or something?

wary vine
#

its just a once per set period of time

#

is there a way to get the perf for one run ?

meager granite
#

Also wasn't BIS_fnc_findSafePos returning empty arrays?

wary vine
#

that why i check for empty arrays

meager granite
#

Sometimes if no position was found

#

Check it before sending to checkPosition

wary vine
#

oh wait

#

is there a way to check perf for one run ?

meager granite
#

diag_codePerformance has number of cycles param in it

#

Its what this benchmark button does but I guess it always tries to do 10k cycles

wary vine
#

45ms

#

for 1 run

meager granite
#

BIS_fnc_findSafePos is heaviest part of your script, it does 3000 random position checks

#

How long is server run time, I assume its some persistent mission? What is this period you mentioned?

wary vine
#

every x minutes , then a pause for x minutes on a loopp

#

it should be ok

#

Lega_dealerPositions will be reset on each loop

meager granite
#

Well if you'll run it in scheduled environment it should be okay (might take some time depending on how clogged your scheduled is)

wary vine
#
[] spawn {
    for "_i" from 0 to 1 step 0 do {
        
        [] call Lega_fnc_getDealerPositions;

        private _timeSpawned = diag_tickTime;

        systemChat "spawning dealers";
        
        waitUntil {
            uiSleep 1;
            ((diag_tickTime - _timeSpawned) >= StayTimer);
        };

        private _timeRemoved = diag_tickTime;
        systemChat "dealers removed";

        waitUntil {
            uiSleep 1;
            ((diag_tickTime - _timeRemoved) >= SpawnTimer);
        };
    };
};
``` something like that is what it will be
meager granite
#

What are these stay\spawn timers? Seconds, minutes, hours?

wary vine
#

it will be in seconds

meager granite
#

Hm

#

Well if you want to improve script performance more, learn what findSafePos does and have your own implementation that does exactly what you want with less overhead.

wary vine
#

ill take a look now

meager granite
#

If you want extreme performance improvement, I suggest to parse entire map on server start and then simply select positions from pre-parsed array. You may even cache these parsed values in server's profileNamespace or through extension to avoid re-calculating same thing each restart, only do that on worldName change.

wary vine
#

i could litteraly just do [(worldSize /2), (worldSize / 2] with some object checks

meager granite
#

Try and see if your check is suitable for you and quicker than BI function.

wary vine
#

my friend tinkered with it

fossil yew
#

Did they change createVehicle? It seems it just creates a shallow object instead of AI. Example:

private _driver = _driverClassName createVehicle _startingPosition;

AI is created but it's frozen.

obsidian kiln
#

i don't think so... if they had changed it then 99% of scripts and missions would be broken by now...

fossil yew
#

Maybe createVehicle was never to be used to spawn AI

#

I'll try with createUnit

meager granite
#

You never could create proper units with createVehicle

fossil yew
#

How to disable collision for a vehicle (scripting wise)?

meager heart
#

like that > disableCollisionWith

fossil yew
#

thanks

#

is there a version disabling collision with everything?

digital jacinth
#

Nope

#

unless you want it to be invisble

fossil yew
#

Thanks.

still forum
peak plover
#

Caching stuff to profile sounds nice

haughty scarab
#

so i fixed the rest of my script last night but now it spawns the vehicle after i rob the area but doesnt give me keys to it and when i check the registration it says the name of the server owns it heres the script, i've been looking for ages but cant find anything wrong with it

    _spawnVehicle = (_vehicleArray call BIS_fnc_selectRandom) createVehicle _vehicleSpawn;
    _spawnVehicle setDir _vehicleDir;
    _spawnVehicle setPos _vehicleSpawn;
    _spawnVehicle setVectorUp (surfaceNormal _vehicleSpawn);
    life_vehicles pushBack _spawnVehicle;

    [_spawnVehicle,"trunk_in_use",false,true] remoteExecCall ["TON_fnc_setObjVar",2];
    [_spawnVehicle,"vehicle_info_owners",[[getPlayerUID player,profileName]],true] remoteExecCall ["TON_fnc_setObjVar",2];
    life_vehicles pushBack _spawnVehicle;
    [getPlayerUID player,playerSide,_spawnVehicle ,1] remoteExecCall ["TON_fnc_keyManagement",2];
    [(getPlayerUID player),playerSide,_spawnVehicle ,0] remoteExecCall ["TON_fnc_vehicleCreate",0];
spring vigil
#

Does anyone know how the vanilla IR pointers work ?

still forum
#

One of your variables is undefined..

#

@spring vigil yes. why?

drowsy axle
#

@still forum I JUST found that out. NVM disregard my silliness. zD

spring vigil
#

What does it use

#

@still forum Basically I do not like Drawline and want to uses what vanilla uses.

still forum
#

Afaik it's just part of the model

#

The engine renders the line internally.

#

it doesn't use any script

spring vigil
#

@still forum thanks , do you think I could post this into the modeling section and get a better response?

still forum
#

well if you are willing to make a model for it then sure

#

I think the Arma 3 Samples also have a laser pointer example

spring vigil
#

thanks , I’ll go check it out

haughty scarab
#

@still forum all variables are defined in the script

still forum
#

what?

#

I didn't talk to you

drowsy axle
#
{if ((typeOf _x == 'b_g_survivor_F') && (!isPlayer _x)) then {deleteVehicle _x}} forEach allUnits;``` This script only deletes alive units. How would I allow it to include dead peeps?
still forum
#

(allUnits + allDead)

drowsy axle
#

sweet

#

Can I do that with forEach? (thing1 + thing2)??

still forum
#

How else would you want to do that?

drowsy axle
#

What do you mean?

tough abyss
#

Is there any way to optimize the following? It's extemely slow...

    params ["_unit"];

    private _curator = createGroup sideLogic createUnit ["ModuleCurator_F", [0, 0, 0], [], 0, "CAN_COLLIDE"];

    _curator setVariable ["Addons", 3, true];
    _curator addCuratorEditableObjects [allMissionObjects "", true];
    _curator setCuratorWaypointCost 0;

    {
        _curator setCuratorCoef [_x, 0];
    } forEach ["Place", "Edit", "Delete", "Destroy", "Group", "Synchronize"];

    _unit assignCurator _curator;

    "[Debug Menu] Registered as Curator." remoteExec ["systemChat", _unit];
#

Line 3 and 6 take ~700ms each to complete...

drowsy axle
#
{ 
  if ( (typeOf _x == 'b_survivor_F' || typeOf _x == 'b_g_survivor_F') && (!isPlayer _x) && !(alive (typeOf _x == 'b_survivor_F' || typeOf _x == 'b_g_survivor_F') )) then { 
   deleteVehicle _x; hint 'Patient has DIED and been deleted from the Medical Tent.';
  }; 
 } forEach (allUnits + allDead);``` How is `!(alive (typeOf _x == 'b_survivor_F' || typeOf _x == 'b_g_survivor_F') )` wrong?
#

@tough abyss Do you have anything else scheduled while testing this script?

still forum
#

alive BOOL doesn't exist

drowsy axle
#

oh shit yeah..

still forum
#

@tough abyss no. Can't optimize that

drowsy axle
#

I think i'm going to assign the patient(s) a variable and check to see if it's !alive

#
private ["_group","_pat","_damPart","_damType","_damAmount"];

//{if ((typeOf _x == 'b_g_survivor_F') && (!isPlayer _x)) then {deleteVehicle _x}} forEach (allUnits + allDead);

if !(alive Patient1) then {
    deleteVehicle Patient1;
    hint "Patient has Died! We've cleaned up from the Medical Tent.";
} else {
   {
      if ((typeOf _x == 'b_g_survivor_F') && (!isPlayer _x)) then {deleteVehicle _x}
   } forEach (allUnits + allDead);
};

[deviceMedical1,3] call BIS_fnc_dataTerminalAnimate;
sleep 5;

_group = createGroup west;
Patient1 = 'b_g_survivor_F' createUnit [getmarkerPos 'Patient1Spawn', _group];

//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "leg_r", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "leg_l", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "body", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "head", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "hand_r", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "hand_l", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;

_pat = Patient1;
_damPart = [
    "leg_r",
    "leg_l",
    "hand_r",
    "hand_l",
    "head",
    "body"
];
_damType = [
    "stab",
    "bullet",
    "falling"
];
_damAmount = [0.3,0.5,0.7,0.9];

{
    [_pat, selectRandom _damAmount, _x, selectRandom _damType] call ace_medical_fnc_addDamageToUnit;
}forEach _damPart;

[Patient1] call ace_medical_fnc_handleDamage_advancedSetDamage;

[deviceMedical1,0] call BIS_fnc_dataTerminalAnimate;
hint 'Your patient is ready';```
still forum
#

"condition for variables" uhhh what?

drowsy axle
#

nvm

#

Is the if statement a good replacement for the commented?

#

@still forum What do you think about the above improved script?

still forum
#

use private keyword instead of private ARRAY

drowsy axle
#

at each of the points I define the _'s?

still forum
#

yes

tough abyss
#

@drowsy axle - nope.
@still forum - alright, thanks anyway.

meager heart
#

Is there any way to optimize the following? It's extemely slow...
probably the slowest part there is allMissionObjects ""πŸ€”

#

(Neviothr's curator thingy ^)

forest ore
#

Is there a way to use the command faction (https://community.bistudio.com/wiki/faction) to check a vehicle's faction and then kick out players that don't belong to that faction?
Got this at the moment and getting only error missing )
if (_vehicle = faction east) then {moveOut _unit;};

meager heart
#
Returns object side as defined in config (i.e. not affected by dynamic changing like rating) 
still forum
#

probably the slowest part there is yes it is.. And that's why I said you can't optimize it

forest ore
#

thanks for pointing me towards BIS_fnc_objectSide @meager heart
Additional search brought me to this https://forums.bohemia.net/forums/topic/192179-need-help-with-side-select-in-event-handler/?tab=comments#comment-3055293 and then eventually to this


_vehSide = [getNumber (configfile >> "CfgVehicles" >> typeOf _vehicle >> "side")] call BIS_fnc_sideType;
_diffSide = side _unit isEqualTo _vehSide;

if !(_diffSide) then {moveOut _unit;};}];```
Which translates to "if the unit entering a vehicle is not of the side the vehicle is, the unit will get thrown out of the vehicle"
jaunty zephyr
#

quick question: any shorter way I can ensure a variable type than using param ? as in _var = _var param [0, "default value", ""];

meager heart
#

isEqualType isEqualTypeAll isEqualTypeAny...etc ? πŸ€”

#
_something isEqualType objNull
jaunty zephyr
#

nah. i dont want to check for it, i want to type cast.

#

param it is. or I convince Golias to give us type hinting in sqflint πŸ€”

still forum
#

There is no type casting in SQF

nocturne bluff
#

You can't typecast so there, you can check for it and abort like they said.

#

if(! (_x isEqualType objNull) exitWith {}

austere hawk
#

i just dont get what i'm doing wrong. RPT tells me "missing ;" but i cant find it nor any bracket issue or whatever else can cause that in that code section

https://pastebin.com/5FrbxTd0
last line is what spits out the error

#

lol... call... wow

jaunty zephyr
#

^^

polar folio
#

dude. this happened to me twice the other day. but never happened before

meager heart
#

typeName _g_armor != "SCALAR" > !(_g_armor isEqualType 0) πŸ€”

still forum
#

you are missing the ! part

meager heart
#

fixed* πŸ˜ƒ

austere hawk
#

is there a benefit to that?

still forum
#

Faster

austere hawk
#

ok cool

#

for a string would that be also faster ? e.g. (_mystring isEqualType "a") than typeName?

still forum
#

yes

austere hawk
#

guess i have some mass replacement to do then

still forum
#

You can write whatever you want into the string. But I think empty string would require one less memory allocation

austere hawk
#

ok even better

austere hawk
#

mass change completed in 30min ... not sure if the execution time safed in total over its lifetime by this will ever amount to the time i spent on it but...

still forum
#

now clean up private ARRAY to private keyword πŸ˜„

austere hawk
#

do you maybe also want to tell me that writing a=_this select 0 is faster than params["a"] ... ?

meager heart
#

afaik Lou did the tests...

#

but for your question probably params and param will be better option

#
params ["_a", "_b"];
//--- vs
private _a = _this select 0;
private _b = _this select 1;
```if you mean this ^
loud spruce
#

If I save a unit in a variable like so:

currentUnit = player;

in the event that the player dies, how long does it take for currentUnit to become null? It's definitely not immediately null, and sometimes it takes longer than other times

#

anyone?

meager granite
#

The variable stores the unit, player or not. It becomes null when that body gets deleted.

#

Instead of null check do isPlayer currentUnit

wary vine
#

and they are all pretty random

#

it will also create upto a set amount of markers, if it cant find a safe position for the rest of them

still forum
#

@austere hawk for a single param... yes it is.

quasi rover
#

Why my _spawnSAM has the same value of center position of findEmptyPosition?, not always but roughly 1~2 of 5.

 _spawnSAM = (getPosAtl _veh) findEmptyPosition[30,60,"O_SAM_SYSTEM_04_F"]; 
//where  (getPosAtl _veh):[27226.4,22957,0.000459671],  _spawnSAM:[27226.4,22957,0]
still forum
#

it tries to find a empty position

#

it tries the position you give it first

#

and if it's empty... It returns that

quasi rover
#

but I think the search starts at min dist.=30, not center. right? and there's a vehicle at center, getPosAtl _veh.

tough abyss
quasi rover
#

the search starts at min distance and stop at max distance, center is not searching range. am I right?

wary vine
#

any ideas if i could make the text on this verticle ?

tough abyss
#

Looks pretty vertical to me already

wary vine
#

the text X D

meager heart
#

just "structured text" with tiny width and huge height will looks like that (if that was the question) πŸ˜ƒ

wary vine
#

was hoping for sideways text, but had to do an alterative

meager heart
#

ctrlSetAngle maybe

#

but it will be challenge to align it

hollow thistle
#

https://i.imgur.com/pTgj8Vf.png
If i want to profile my own CBA pfh is there any easy way to identify which one of those is mine or should I use brofiler and create my own profling scopes?

wary vine
#

ctrlSetAngle didnt work

#

xD

meager heart
#

with brofiler you can right click > show source, @hollow thistle

wary vine
meager heart
#

add some sounds there... bip boop... boop bip πŸ˜ƒ

wary vine
#

xD

#

got bored the other day

#
Lega_fnc_fadeDisplay = {
    params [
        ["_displayIdent", "", ["", 0]],
        ["_fadeTime", 0.5, [0]]
    ];

    private _display = displayNull;
    if (_displayIdent isEqualType "") then {
        waitUntil {!(isNull uiNamespace getVariable [_displayIdent, displayNull])};
        _display = uiNamespace getVariable [_displayIdent, displayNull]
    } else {
        waitUntil {!(isNull (findDisplay _displayIdent))};
        _display = findDisplay _displayIdent;
    };

    private _allControls = allControls _display;
    {
        _x setVariable ["originalposition", (ctrlPosition _x)];
        _x ctrlSetPosition [safezoneX + (safeZoneW / 2),safeZoneY + (safeZoneH / 2),0,0];
        _x ctrlCommit 0;
        _x ctrlSetFade 1; 
        _x ctrlCommit 0;
        _x ctrlSetFade 0;
        _x ctrlSetPosition (_x getVariable ["originalposition", []]);
        _x ctrlCommit _fadeTime;
    } forEach _allControls;
};

player addEventHandler ["InventoryOpened", {
    [602,0.5] spawn Lega_fnc_fadeDisplay;
}];
tough abyss
#

ummmm

#

Classes are defined in bin\Config.bin\CfgLocationTypes

#

where can i find the bin

#

directory?

still forum
#

nowhere

#

it's inside a config

#

there is no config directory

tough abyss
#

ctrlSetAngle works with pictures only, thought it was quite clear from the description on wiki @meager heart

#

Should I use extDB3 or iniDB?

#

for persistent saving of data?

meager heart
winter rose
#

@tough abyss @meager heart setBehaviour tests have been done, and it taks either unit or group, but all units in the group will have their behaviour changed

wary vine
#

#define GETSTR(STRING) ([STRING, (localize STRING)] select (isLocalized STRING)) cuz lazy

still forum
#

localize STRING will always be executed.. Does that throw an error if you try to localize a non localized string?

wary vine
#

will try now

#

rip

#

will have to go back to the old method then #define GETSTR(STRING) (if (isLocalized STRING) then {localize STRING} else {STRING})

winter rose
#

doesn't localize aString already return aString if it is not localised? πŸ€”

wary vine
#

""

#

afaik

still forum
#

not according to biki

winter rose
#

checking

#

Biki doesn't state anything?

#

yup, empty string

#

updating the Biki

meager heart
still forum
#
/*
    Author: Karel Moricky, optimised by Killzone_Kid

    Description:
    Checks if text is localization key and if so, return the localized text.

    Parameter(s):
    _this: STRING

    Returns:
    STRING
*/

/// --- validate general input
#include "..\paramsCheck.inc"
paramsCheck(_this,isEqualType,"")

if (isLocalized _this) then {localize _this} else {_this};
#

#define paramsCheck(input,method,template) if !(input method template) exitWith {[input, #method, template] call (missionNamespace getVariable "BIS_fnc_errorParamsType")};
πŸ€”

meager heart
#

k

meager heart
#

that paramsCheck magic probably was in b4 params...

lean estuary
#

Anyway to remove smoke particles locally?
Hiding the smoke grenade before it pops still shows particles unfortunetely.

tough abyss
#

enableSimulation false on smoke grenade?

unborn ether
#

@still forum you've been reviewing Tonic Framework pull requests? 0_o

round scroll
#

Hi, @tough abyss was so friendly to send me some targeting code for a guided missile/bomb. I want to adjust it for the Unsung GBU-8 glidebomb, but run into problem with moving from CBA per frame eventhandler to OnEachFrame of BI. With the OnEachFrame handler I get script errors as some stuff doesn't seem to be properly initialized. With CBA per frame this didn't happen and the bomb homed in on the target. The calling code is at https://pastebin.ubuntu.com/p/kGM7jv4xyQ/ and the OnEachFrame handler is at https://pastebin.ubuntu.com/p/NQQ8GwT3cV/ Any ideas what breaks it are welcome!

digital jacinth
#

I am having problem with particle sources to staying in air. I do want to show a particle effect in the sky and it keeps emitting them on the ground instead. The weird thing it, it sometimes works just fine and the particles are visible when looking up.

I am attaching the particlesource to an object in the sky which has no physics.

private _pos = getPosATL device;
_pos set [2, _pos#2 + 500];
private _stupidObjectInSky = "Land_HelipadEmpty_F" createVehicleLocal _pos;
_stupidObjectInSky setposatl _pos;
private _skyEffect = "#particlesource" createVehicleLocal _pos;
_skyEffect setParticleParams [["\A3\data_f\VolumeLight", 1, 0, 1], "", "SpaceObject", 1,90,[0,0,0],[0,0,0],0,9.996,7.84,0,[20,30,20],[[0,0,0,0],[1,1,0.25,1],[0.5,1,0.5,0]],[0.08],1,0,"","", _stupidObjectInSky];
#

anyone has an idea why the particle source just gives up and is on the surface?

meager heart
#

maybe you can try attach it

digital jacinth
#

nah using attachTo with a particle source does not work. If you do that no particles will even show up, you have to attach it through setParticleParams

drowsy axle
#

How different is a mod from a script inside a mission?

tough abyss
#

How different is a sandwich from a cat inside a fridge?

meager heart
#
player spawn {
    private _smoke = "#particlesource" createVehicleLocal [0, 0, 0]; 
    _smoke setParticleClass "VehExpSmoke"; 
    _smoke attachTo [_this, [0, 10, 0]];
};
#

@digital jacinth

digital jacinth
#

maybe it is because of the setParticleClass, tho i do not use a class.

#

Β―_(ツ)_/Β―

meager heart
#

idk man

digital jacinth
#

particles are weird

meager heart
#

iirc there was topic on bif about particles weirdness

digital jacinth
#

probably recreatee the effect and just use drop

round scroll
#

problem has been solved, the lastFrameTime needed to be set in the parameter list directly: _this set [2, time];

haughty scarab
#

could anyone tell me why this is erroring?

    life_vehicles pushBack _spawnVehicle;

this is the error:

Error in expression <VectorUp (surfaceNormal _vehicleSpawn);
life_vehicles pushBack _spawnVehicle;
 
[>
  Error position: <life_vehicles pushBack _spawnVehicle;
 
[>
  Error Undefined variable in expression: life_vehicles
File \life_server\Functions\Systems\fn_handleBlastingChargeArmory.sqf [TON_fnc_handleBlastingChargeArmory], line 50
#

i dont understand how the variable is undefined.

high marsh
#

because it's literally undefined

#

it has no idea what life_vehicles is

#

post your entire script

#

we're missing context

haughty scarab
#

life_vehicles is a global variable i thought, ok one sec

high marsh
#

global != public

#

and why do you need it to bem
?

haughty scarab
high marsh
#

it's a waste

haughty scarab
#

im new to scripting, but the script is susposed to add keys when the player robs the vault but it only spawns vehicle and doesnt give keys

#

it has worked on my previous server and i cant figure out why it wont work now

high marsh
#

first, use the new private syntax.
instead of private ARRAY
use private var = var declaration

#
private _blah = "BlahBlah";
haughty scarab
#

oh ok

meager heart
#

that script there... so much script...

unborn ether
#

bulli

meager heart
#

πŸ™„ hides

obsidian kiln
#

which has a bigger performance impact

#

nearentities tank at 1000 meters

#

or neartargets at 1000 meters and then checking if it's a tank...

#

assuming same sleep in loop

tough abyss
#

I'm working on CCRP for ITC Air, but I'm horrible at physics can't really get the accuracy I want out of the current code I'm using(example https://gfycat.com/UnfitInformalGraywolf )

Can anyone help out with this? Does anyone already have an accurate script for this, or does anyone have any good resources on how shotMissile physics work in arma, or alternatively, if it's possible to somehow access the ccip solution that's used for the vanilla HUD?

obsidian kiln
#

i just realized that forcespeed and limitspeed absolutely wrecks performance...

tough abyss
#

Any command can wreck performance

obsidian kiln
#

nevermind

#

i was running a forcespeed on all tanks in a map and my fps went very low everytime a tank moved

#

but it was related to physx and the grid cell of the map i think, not to forcespeed...

tough abyss
#

I've got a question about using worldToScreen together with modelToWorldVisual.
https://gfycat.com/AncientRealisticBaboon
In the example here, the green X in the top left of the HUD is drawn with drawIcon3D on the HUD pos, the white + next to it is drawn on a control, on the worldToScreen of the exact same position

#

somehow once I get worldToScreen involved, the velocity of the aircraft completely throws off the position, does anyone know how to fix this?

wary vine
compact maple
#

aaah... that safezone system, solution is : kick the player if they didnt chose the right res scale

wary vine
#

i wanna hang myself right now

#

its the only thing that wont play nice right now

#

everything else works fine on all res scales,

#

i thought it was the issue of creating a ctrlGroup inside another, it seems to have calmed the issue down, but not fixed it

meager heart
#

you are using safezones with absolutes ?

wary vine
#

nah

#

it was all built with just safezone

#

with the positions preset for the first one

#

which took me fecking ages

#

moving them around till they were in the right place

compact maple
#

you're working with UI arma's editor ?

wary vine
#

yup

compact maple
#

you got my respect

wary vine
#

it was all made in ui editor

#

all my dialogs are

meager heart
#

maybe just safeZoneWAbs safeZoneXAbs will helps πŸ€”

compact maple
#

you must have spent infinity hours on it lol

wary vine
#

ill give it a quick shot search and replace and report back

#

same thing unfortunatly

meager heart
#

and troubles with interface size or screen resolution ?

#

@wary vine maybe getResolution then

wary vine
#

the weird thing is it doesnt happen on the other dialog which is created basically the same

meager heart
#

controls groups weirdness

wary vine
#

each of those messages are 3 images

meager heart
#

they are structured texts with pictures ?

wary vine
#

just pictures

wary vine
#

right, I might be able to do a work around

#
[
position , uiscale,
position, uiscale 
]``` sorta thing
meager heart
#

getResolution last param is the ui scale

wary vine
#
_position = [
    [[x,y,w,h], 0.55]
] select {_x select 1 isEqualTo (getResolution select 5)};
#

Dirty, but should work

#

as a temp solution until i find a fix

meager heart
#

gl πŸ˜ƒ

wary vine
#

just means i have to find all the positions manually -.-

#

before i do this are all uiscales the same on all pcs ?

#

i.e small being 0.55

queen cargo
#

What exactly is the problem?

wary vine
#

ill show

#

this is normal res scale

#

but this is the only menu in my phone that does this.

queen cargo
#

And probably the only one where you played around with

#

Cannot remember the right fiel, but what you see there is the shadow of the Button

#

Gimme few Minutes till I am at home or search for yourself πŸ˜‰

#

After disabling shadow, you should be fine

wary vine
#

o.O

#

they are normal buttons

#

they are not in the position they should be

queen cargo
#

Wait... Are you using Text above Buttons?

wary vine
#

?

#

i have changed the invisible buttons to normal buttons whilst im trying to fix it

#

the buttons should like up with the buttons on the image underneath

#

on small resoultion they line up perfect

#

but when the uiscale is changed they go haywire

#
_position = [
    [
        [x,y,w,h]// ctrl1
        [x,y,w,h]// ctrl2
        [x,y,w,h]// ctrl3
        [x,y,w,h]// ctrl4
        [x,y,w,h]// ctrl5
        [x,y,w,h]// ctrl6
        [x,y,w,h]// ctrl7
    , 0.55],
    [
        [x,y,w,h]// ctrl1
        [x,y,w,h]// ctrl2
        [x,y,w,h]// ctrl3
        [x,y,w,h]// ctrl4
        [x,y,w,h]// ctrl5
        [x,y,w,h]// ctrl6
        [x,y,w,h]// ctrl7
    , 0.7]
] select {_x select 1 isEqualTo (getResolution select 5)};
``` so my idea for now is to do something like this with hardcoded positions for each uiscale
queen cargo
#

how are you hiding those buttons?

wary vine
#

invisibuttons

#

in the define

queen cargo
#

how are you hiding those buttons? did not answerred my question

wary vine
#
  text = "";
  w = 0.02475 * safezoneW;
  h = 0.044 * safezoneH;
  animTextureNormal = "#(argb,8,8,3)color(0,0,0,0)";
  animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0)";
  animTextureOver = "#(argb,8,8,3)color(0,0,0,0)";
  animTextureFocused = "#(argb,8,8,3)color(0,0,0,0)";
  animTexturePressed = "#(argb,8,8,3)color(0,0,0,0)";
  animTextureDefault = "#(argb,8,8,3)color(0,0,0,0)";
  colorBackground[] = {0,0,0,0};
  colorBackgroundFocused[] = {0,0,0,0};
  colorBackground2[] = {0,0,0,0};
  color[] = {0,0,0,0};
  colorFocused[] = {0,0,0,0};
  color2[] = {0,0,0,0};
  colorText[] = {0,0,0,0};
  colorDisabled[] = {0,0,0,0};
queen cargo
#

add this: colorShadow[] = {0, 0, 0, 0}; or alt. add offsetX = 0; offsetY = 0;
should fix that problem

wary vine
#

i don't think you are 100% understanding the issue, the buttons are perfect when on small resolution scale

#

and its not just the buttons that are moving

queen cargo
#

i do understand
and either you fucked up your button positioning, or .. not

#

the scrolling happening with SQF? or is it all config based?

wary vine
queen cargo
#

chances are that you fucked up there then

wary vine
#
{
    _x params ["_to", "_from", "_name", "_message", "_pos", "_timeSent"];

    //Creating The Controls.
    private _0 = XPHONEUI ctrlCreate ["EmerMessage_Background", _baseIDC,    _controlsGroup];_baseIDC = _baseIDC + 1;
    private _1 = XPHONEUI ctrlCreate ["EmerMessage_TitleText", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
    private _2 = XPHONEUI ctrlCreate ["EmerMessage_MessageText", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
    private _3 = XPHONEUI ctrlCreate ["EmerMessage_SentText", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
    private _4 = XPHONEUI ctrlCreate ["EmerMessage_ReplyBtn", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
    private _5 = XPHONEUI ctrlCreate ["EmerMessage_ShowPosBtn", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
    private _6 = XPHONEUI ctrlCreate ["EmerMessage_DeleteBtn", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
} forEach Lega_EMS_MESSAGE_controls;```
#
    if ((count Lega_EMS_MESSAGE_controls) > 0) then {

        private _lastArr = (Lega_EMS_MESSAGE_controls select (count Lega_EMS_MESSAGE_controls - 1));
        (ctrlPosition (_lastArr select 0)) params ["","","","_backgroundHeight"];
        {
            private _lastPos = (ctrlPosition (_lastArr select _forEachIndex));
            _lastPos set [1, ((_lastPos select 1) + _backgroundHeight)];
            _x ctrlSetPosition _lastPos;
            _x ctrlCommit 0;
        } forEach [_0, _1, _2, _3, _4, _5, _6];
    };
#

i only ever touch the Y position, there is no need to touch the x

queen cargo
#

weird

#

should be fine
unless you made some mistake somewhere else 🀷

#

the only thing that possibly could be that is .. as said: the shadows

wary vine
#

but that would only affect the buttons

#

someone said it could be to do with using safezones inside a controlsGroup

#
class EmerMessage_Background: Life_RscPicture
{
    text = "Lega\Lega_xPhone\Images\dialogImages\emermessagebackground.paa";
    x = (-0.019606 * (safezoneW + safezoneX)); // 0.428656
    y = 0;
    w = 0.179811 * safezoneW;
    h = 0.1568 * safezoneH;
};
class EmerMessage_TitleText: Life_RscStructuredText
{
    x = (0.001782 * (safezoneW + safezoneX)); // 0.423874
    y = (0.00313 * (safezoneH + safezoneY));
    w = 0.148309 * safezoneW;
    h = 0.0168 * safezoneH;
};
class EmerMessage_MessageText: Life_RscStructuredText
{
    x = (0.001782 * (safezoneW + safezoneX)); // 0.423874
    y = (0.0285 * (safezoneH + safezoneY));
    w = 0.090558 * safezoneW;
    h = 0.126 * safezoneH;
};
class EmerMessage_SentText: Life_RscStructuredText
{
    x = (0.132 * (safezoneW + safezoneX));
    y = (0.0285 * (safezoneH + safezoneY));
    w = 0.056433 * safezoneW;
    h = 0.0336 * safezoneH;
};
class EmerMessage_ReplyBtn: Life_RscButtonMenu
{
    x = (0.132 * (safezoneW + safezoneX));
    y = (0.07525 * (safezoneH + safezoneY));
    w = 0.056433 * safezoneW;
    h = 0.0252 * safezoneH;
};
class EmerMessage_ShowPosBtn: Life_RscButtonMenu
{
    x = (0.132 * (safezoneW + safezoneX));
    y = (0.1175 * (safezoneH + safezoneY));
    w = 0.056433 * safezoneW;
    h = 0.0252 * safezoneH;
};
class EmerMessage_DeleteBtn: Life_RscButtonMenu
{
    x = (0.132 * (safezoneW + safezoneX));
    y = (0.1575 * (safezoneH + safezoneY));
    w = 0.056433 * safezoneW;
    h = 0.0252 * safezoneH;
};
#

there are the controls

compact maple
#

have you tried to add some decimals to theses controls ?
like x = 0.012 --> x = 0.01200

#

it probably wont change anything ..

wary vine
#

i havent, but i don't think that would change it, can always give it a go

wary vine
#

nothing xD

wary vine
#

welp,

#

im gunna put in the dirty temp fix for now until i work out a solution xD

formal vigil
#

Is it possible to set custom variables via setVariable ?

#

i.e. sectorModule1 setVariable ["was_already_captured", true]; ?

quartz coyote
#

Hello All, I would like to count the number of magazines depending on a specific type inside a box

_countOfMagsGlobal = getMagazineCargo AmmoBox_TeamBlue;
_countOfMags = {typeOf _x == "7Rnd_408_Mag"} count _countOfMagsGlobal;
still forum
#

The answer is in there

#

You handle it like it would return an array of objects.. it doesn't though

quartz coyote
#

I see. this is what I get :

[["SmokeShell","7Rnd_408_Mag","1Rnd_HE_Grenade_shell","30Rnd_65x39_caseless_mag","RPG32_HE_F"],[10,50,10,70,1]]
#
_countOfMagsGlobal = getMagazineCargo AmmoBox_TeamBlue;
_countOfMags = {typeOf _x == "7Rnd_408_Mag"} count _countOfMagsGlobal select 0;```
 maybe ?
still forum
#

Still

#

that's an array of strings

#

not objects

#

your typeOf doesn't make sense

quartz coyote
#

I have no clue

#
Syntax:
condition count array```
#

it does say I can put an Array ...

still forum
#

I never said your count is wrong

quartz coyote
#

oh .

still forum
#

that's an array of strings I even said it's an array

#

typeOf is used to get the classname of an object

#

And "get the classname" and "an object" both don't make sense

#

for one you already have the classnames there. Second you don't have objects there.. because they are the classnames

#

You'll need find or findIf to find the index of the magazine type you want

#

and then use select on the second array to get the number at that index

quartz coyote
#

holy fuck

#

I might as well throw myself through the window.

#

if that's the simple way, what's the difficult way ... pfff

still forum
#

difficult way would be to iterate through the classnames randomly using a custom SQF random number generator using a case-sensitive comparison and also use random upper/lowercase variants of the classname to search for till you find it someday

quartz coyote
#

sorry I got blood dripping from my nose when I read you, brb

austere granite
#

is there a good way of determing which sorta road type a segment is?

#

Basically i want to get nearby asphalt roads, as opposed to dirt paths or so

#

white/yellow lines on the map

quartz coyote
#

Okay so no I find 1

_countOfMagsGlobal = getMagazineCargo AmmoBox_TeamBlue;
(_countOfMagsGlobal select 0) find "7Rnd_408_Mag"
#

but thats not what I'm trying to find so ...

#

I don't think i'm thinking this right ...

#

how do I
"and then use select on the second array to get the number at that index" ???

#

I don't get it

still forum
#

You are thinking this right

#

Do you know what a index is?

quartz coyote
#

yes

still forum
#

So??

quartz coyote
#

the position in the Array

still forum
#

You used (_countOfMagsGlobal select 0) right there

#

what's the problem with using it again?

quartz coyote
#

None, that what i'm trying to do, but can't figure out the correct way

wary vine
#

@formal vigil what type of variable ?

#

if you want a global you can setvariable on missionNamespace

quartz coyote
#

I can't understand how to select the equal position of two values in two different indexes without knowing it's original positon

still forum
#

you know it's original position

#

that's what find returns

quartz coyote
#

isn't it returning 1 because it found it ?

still forum
#

yes

#

You'll need find or findIf to find the index of the magazine type you want

#

That's what I wrote

#

you just used find to find the index

#

just as I said.

quartz coyote
#

what I meant is : isn't 1 a boolean ?

still forum
#

Can you please just read the wiki pages yourself? Quite annoying to always have to link them to you

#

No?

#

1 is a number

#

I mean.. look at it

#

That's like.. Primary school first grade

quartz coyote
#

don't talk like I'm a fool

#

please

still forum
#

Well...

quartz coyote
#

Well fuck you πŸ˜ƒ

#

now.

still forum
#

okey brb

quartz coyote
#

I thought it was returning 1 is if it said "YES I FOUND IT"

#

but you're right it should return true then it that was the case

#

so 1 is the index .....

#

then ....

#
_arrayOfMagsInBox = getMagazineCargo AmmoBox_TeamBlue;
_magsIndex = (_arrayOfMagsInBox select 0) find "7Rnd_408_Mag";
_magsCount = (_arrayOfMagsInBox select 1) select _magsIndex ;```
tough abyss
#

1 is not boolean, it's a number

#

boolean values are true or false

#

what are you trying to do here

quartz coyote
#

that's what I just understood here.

tough abyss
#

right, but what are you trying to do here

quartz coyote
#

get the amount of mag of a specific type of mag

#

inside a ammobox

#

okay it is working

#

don't bother

#

I managed

tough abyss
#

mk

quartz coyote
#
_arrayOfMagsInBox = getMagazineCargo AmmoBox_TeamBlue;
_magsIndex = (_arrayOfMagsInBox select 0) find "7Rnd_408_Mag";
_magsCount = (_arrayOfMagsInBox select 1) select _magsIndex ;```
tough abyss
#

you forgot a close parenthesis

quartz coyote
#

ah !

#

thx

#

heu

#

you sure ?

tough abyss
#

oh

#

maybe you didn't

quartz coyote
#

no thats not working ...

tough abyss
#

re-post it

#

let me look at it

quartz coyote
#

no i'll go with my frist try

#
_arrayOfMagsInBox = getMagazineCargo AmmoBox_TeamBlue;
_magsIndex = (_arrayOfMagsInBox select 0) find "7Rnd_408_Mag";
_magsCount = (_arrayOfMagsInBox select 1) select _magsIndex ;```
tough abyss
#

@cobalt pine what do you mean?

#

could just spawn an explosion on top of an object if you're lookng to be basic

cobalt pine
#

basically to get a custom model to act as C4 or sachel

tough abyss
#

oh, you're looking to make an addon then

#

yeah that's the config.cpp of a mod

still forum
cobalt pine
#

thank you

still forum
#

Delete here then. Otherwise it would be cross-posting which is not allowed per #rules

tough abyss
#

Why would you want to explode a sixpack? πŸ˜‚

#

maybe he shook it too much πŸ€”

austere granite
#

why the fuck are logics included in allUnits?

#

REEEEEEEEEEEEEEE

meager heart
#

probably because of hq entity... which is logic and hidden ai lol

austere granite
#

ambientAnim (which is absolutely attrocious code also uses logics) and thats where i had it from

quartz coyote
#

@still forum I remember you've already explained this to my but I can't remember :
_magsCount = 0;
Why is that not possible ?

still forum
#

what?

#

It is possible

#

That's just setting a variable

tough abyss
#

why wouldn't t hat be possible

quartz coyote
#

well when I do that, the next step error's and it tells me Undefined Variable _magsCount

tough abyss
#

likely something else

#

post the entire code

quartz coyote
#

mmh

tough abyss
#

along with error message

quartz coyote
#
            _arrayOfMagsInBox = getMagazineCargo _box;
            _magsIndex = (_arrayOfMagsInBox select 0) find "RPG32_HE_F";
            if (_magsIndex == -1) then
            {
                _magsCount = 0;
            }
            else
            {
                _magsCount = (_arrayOfMagsInBox select 1) select _magsIndex;
            };
            _missingMags = 1 - _magsCount;
            _box AddMagazineCargoGlobal ["RPG32_HE_F",_missingMags];
            _box AddWeaponcargoGlobal ["launch_RPG32_F",1];
#

Thats probably not working

if (_magsIndex == -1) then
still forum
#

you are setting a local variable

tough abyss
#

what do you think _magsIndex returns

still forum
#

local variables are set in their own scope or below

#

you leave that scope right at the } where the variable disappears

#

what you are trying to do can be done nicely with param

#

Just
_magsCount = (_arrayOfMagsInBox select 1) param [_magsIndex, 0];

quartz coyote
#

Oh

still forum
#

param [index, defaultValue]

#

as -1 index is invalid it will just return defaultValue

tough abyss
#

indices start at 0

quartz coyote
#

This way ???

            _arrayOfMagsInBox = getMagazineCargo _box;
            _magsIndex = (_arrayOfMagsInBox select 0) find "RPG32_HE_F";
            _magsCount = (_arrayOfMagsInBox select 1) param [_magsIndex, 0];
            _missingMags = 1 - _magsCount;
            _box AddMagazineCargoGlobal ["RPG32_HE_F",_missingMags];
            _box AddWeaponcargoGlobal ["launch_RPG32_F",1];
tough abyss
#

what exactly are you trying to accomplish with this script

quartz coyote
#

too long to re-explain man... is this going to work or not ?

#

I don't understand how param works

tough abyss
#

i don't know, i don't know what you're trying to do

still forum
#

param works exactly like select just with a defaultValue in case anything goes wrong

#

param passes variables and the values they represent into a different scope wat?

#

no it doesn't

tough abyss
quartz coyote
#

@still forum is this going to work the way I wrote it above ?

still forum
#

I don't see anything wrong with it

#

@tough abyss param != params

#

and no params also doesn't put "stuff into a different scope"

tough abyss
#

i know

#

i mis spoke

dusky pier
#

hello, do you use headless client to use server functions like database sync, old objects cleanup.. ?

#

i try'ed, but HC working wrong, code just like on server... no errors in log, but is getting wrong data

tough abyss
tough abyss
#

Hey, kind of an extention of another question I asked. In the MFD config reference there's the impactPoint source you can use for HUDs, is it somehow possible to read out the value of that impactPoint?

woven oak
#

how would you monitor a corpse to check if a action has been executed on it by a player?

tough abyss
#

@woven oak depends on action

#

eventhandler, probably

#

unless you're looking to do something weird

#

i'm going to wager a guess and assume you want to prevent people from looting bodies?

unborn ether
#

@dusky pier From the scripting point I would tell you that HC is a client, not a server. He can't perform SE commands, such as owner. Otherwise #headless_client

#

@still forum wanted to ask how TFAR handles the push-to-talk keys. Does it respect inputAction or just plain DIK? Thanks.

dusky pier
#

@unborn ether thank you!

still forum
#

@unborn ether CBA keybinding

#

KeyDown/KeyUp eventhandlers on displays

fossil yew
#

I have a script with one local function assigned to _someFunction without private keyword. However that private variable is not available in the [something] spawn { code goes here } started within the same script and it's a bit confusing. Isn't _someFunction available throughout the entire script or does spawn create it's own context?

still forum
#

spawn is a new script with it's own context

#

as it runs asynchronously it has to be

#

That's also the reason why you can pass parameters into it

#

in case you want to pass anything

fossil yew
#

Ok thanks

#

I kinda of thought spawn and call behave the same except the scheduler

covert inlet
#

Im trying to setup the ASOR VS for spawning vics on carriers, but something im doing is causing certain "car" vehicles engines to break (HUD icon turns on for half a second) example being the engines for the Apex jeep, LoW Van and the RHS MRZR dont work, but the quadbike, SUV, and BAF Coyote work fine, and all armoured/air vics work fine. Carrier script > https://pastebin.com/NR20kH04 . Normal Land scrip (works fine) > https://pastebin.com/PZXEiNNZ
PS: seems to be a dedi issue. Got another client on, they could turn on the vics i spawned, they could turn on vics they spawned and i could turn on vics they spawned but only after they had turned it on and off. πŸ˜•

elder basin
#

what is the code for showing uavs on a screen πŸ˜ƒ

meager heart
#

πŸ€” x2

elder basin
#

?

compact maple
elder basin
#

cheers

unborn ether
#

@fossil yew Some tip with spawn to ease what you want.

// Some function begin
params ['_blah','_blah2','_blah3'];
_this spawn {
    params ['_blah','_blah2','_blah3'];
};
austere granite
#

Is it at all possible to have "virtual" inventory items, using vanilla UI? Just wondering if someone tried lbAdd and so to the UI elements and have things still work

unborn ether
#

@austere granite No, vanilla LB are not exactly LB.

#

@austere granite You can add them to that LB, but they will react with errors, depending they are scripted for real inventory items, so its not the best idea.

lusty canyon
#

is there a way to identify if a magazine class is pylon compatible?
BIS mags all seem to start with PylonRack_ PylonMissile_ but i need to get mods too
like parse configFile >> "CfgMagazines" >> ?? into array of classnames?

unborn ether
#

Create your own LB and switch them as a tabs or smthn.

austere granite
#

Guess i'll just add a little subsection to the inventry UI instead then, with the virtual stuff.

#

merci

queen cargo
#

the vanilla inv should be LNbox btw.

#

at least they should be πŸ€”

#

but normal inv is also, iirc, highly modified in the actual code backend and not scripted

#

not really have the inventory in front of me ... so could be wrong entirely

austere granite
#

I know how i into UI, it was more a case if someone tried it and you get stuck at random points due to hardcoded backend behavior like the usual BIS UI things

queen cargo
#

yup

#

wanted to write that
most likely some non-sqf code will update your virtual stuff away

#

though, adding a separate list ontop should be fairly simple

#

replacing the inventory could also be an option for some
though ... fairly tuff task

austere granite
#

eh, some inventory stuff is messed up

queen cargo
#

i know

austere granite
#

even the ability to handle specific magazines will be missing

queen cargo
#

never said it would have been a 1:1 replacement πŸ˜„

unborn ether
#

@queen cargo

        class GroundContainer: RscListBox
        {
            class DLCTemplate: RscDisplayInventory_DLCTemplate
            {
                class Controls;
            };
            idc=632;
            sizeEx="0.8 *             (            (            ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
            sizeEx2="0.8 *             (            (            ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
            rowHeight="2 *             (            (            ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
            canDrag=1;
            colorText[]={1,1,1,1};
            colorBackground[]={0,0,0,0};
            itemBackground[]={1,1,1,0.1};
            itemSpacing=0.001;
            x="1.5 *                     (            ((safezoneW / safezoneH) min 1.2) / 40) +         (safezoneX + (safezoneW -                     ((safezoneW / safezoneH) min 1.2))/2)";
            y="3.7 *                     (            (            ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) +         (safezoneY + (safezoneH -                     (            ((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
            w="11 *                     (            ((safezoneW / safezoneH) min 1.2) / 40)";
            h="18.4 *                     (            (            ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
        };

GroundContainer is inherited by any other lists in Display 602.

#

So is a RscListBox but it's different from default one. It's handled by engine internally and has some additional data to it, like itemBackground[]={1,1,1,0.1}; which is not a listbox family attribute.

#

That listbox is actually acting like an Active Text over listbox entries.

zealous dragon
#

{ _x createUnit [getMarkerPos "spawnunit", _groupS, 1]} forEach _soldiers; why not working?

still forum
#

Because not detail

zealous dragon
#

ok thank

still forum
zealous dragon
#

I am read english so slow)

still forum
#

Yes I expect

high marsh
#

Does _soldiers contain a array of types or groups? The parameter required after position is an array, not a number.

#

markers:Β Array- Placement markers

#

do we need a translator or something?

zealous dragon
#

I can translate english and I no have any problems when using bohemia's wiki

#

I just didn't finish the syntax)

wary vine
#

@austere granite I hve already made something like that xD

high marsh
#

google translate?

zealous dragon
#

yandex translator) Yandex is russian google analog)

meager heart
neon snow
#

@meager heart dont mind the "Map_scale" name , it is just the name of section in model. I have a config with defined few AnimationSources and all of them when used with animationSourcePhase return 0

meager heart
#

well.. that's not really #arma3_scripting, but to get the animation sources phases values, probably you will need define those "phases values" in the config like minValue/maxValue or angle0/angle1...etc

neon snow
#

I defined them aswell

#

Sorry for wrong place

meager heart
neon snow
#

ok will do

still forum
#

Did you animate it to anything?

#

or are you confused about the default vlaue being 0

tough abyss
#

What would be the easiest method to figure out what's causing a load screen hang for people not on local during a mission start up?

meager granite
#

Preloading assets in the mission

peak plover
#

sounds like a script in your mission

obsidian kiln
#

not on local?

still forum
#

It's a postInit script not finishing

#

easiest method is to use my debugger to dump all currently running scheduled scripts.. Although my debugger can't do that. But it makes it easy to write the code to do it πŸ˜„

#

Next easiest.. Use that script command to dump all running scheduled scripts. But it will probably not give you a correct name if you didn't use scriptName properly

#

Next easiest.. Go through all your postInit scripts and check each of them for a sleep or waitUntil

peak plover
#

I'd start by removing/commenting scripts

compact maple
#

lol just saw a thread on reddit about you @still forum

still forum
#

:u

#

Ahhh.. Witten?

compact maple
#

yep

#

this is him

still forum
#

πŸ˜„

#

Hope he dies a horrible death

compact maple
#

thats rude xD, his thread name almost killed me "Threatened by a BI community manager", a netflix serie

tough abyss
#

And how is this scripting related?

still forum
#

I guess Β―_(ツ)_/Β―

digital jacinth
#

shoulda rename to Scriptmen then, smh

still forum
#

ok

meager heart
#

or just rename the channel to > Dedming

#

Scriptmen in Dedming πŸ‘€

queen cargo
#

@tough abyss #arma3_scripting is drama + scripting + everythingrelatedtomoddingsomehow + drama

meager heart
#

drama + scripting = dripting πŸ‘Œ

digital hollow
#

multi-editor dripting

snow cipher
#

Im tryna make an intro script but dont know how to start

#

I only want that when the host starts the map a text saying a location and an hour is shown

#

Or something like that

ruby breach
queen cargo
#

thinking right now if i should ask here for command suggestions for sqf-vm or if this would end up in a horrible sheet πŸ€” (sqf-vm is a custom standalone SQF implementation, suggestion would be commands to port)

tough abyss
#

What is the end goal? I can see I might get some use out of it if I could utilise it for unit test purposes but that would require at least some amount of simulation of the game and the side effects of the various methods. I might get some use out of it if it did better syntactical and semantic checking than my current vscode plugin stack. These are the two use cases I can see for it as a user of dev tools

queen cargo
#

@tough abyss you can already try it nowadays: https://discord.gg/vpdwJtG
there is a bot and a standalone variant
the reason is either to unit test or to just run SQF while not having arma available

#

or without the need to test it ongoing all the time in arma itself

snow cipher
#

@ruby breach thanks mate

inner swallow
#

when run inside if (isServer) then {} or if (local this) then {}, then it doesn't work on dedicated

#

but it does work on local host

#

i'm running this from the init field of an empty vehicle

tough abyss
#

When you say it doesn’t work on dedicated, how do you expect it should work on dedicated?

meager heart
#

also maybe you entered that vehicle before you tried the commands on dedicated ? πŸ€”
(aka vehicle locality changed and on the local host you are always server so it works there...)

inner swallow
#

When you say it doesn’t work on dedicated, how do you expect it should work on dedicated?
Expected outcome: radar should be disabled on the kajman
Observed on local: radar is disabled
observed on dedicated: radar is not disabled

#

also maybe you entered that vehicle before you tried the commands on dedicated ?
I start outside the vehicle in both cases

snow cipher
#

can someone give me an infoText script?

inner swallow
#

and it gets run from the init box, so it should execute way before i get in

#

i didn't try running it from console after I've gotten in, though

snow cipher
#

i cant get one to blackin when the map is started, with text appearing and disappearing

tough abyss
#

There is no UI on dedicated, I don’t understand how can you observe it there, hence the question

inner swallow
#

what?

#

i mean when i join the dedicated server

#

and slot in

#

and then get in the vehicle

#

and check the radar

tough abyss
#

I see, great misunderstanding in terminology πŸ˜‰

inner swallow
#

funnily enough i may not be the only one misunderstanding things...

meager heart
#

try it with cursorTarget from the console and local exec πŸ€”

#

on dedicated ^

#

i mean... if will works then use it on the clients/players

#

also maybe just RE it with jip's true flag

inner swallow
#

yeah

#

it's funny because even on local, i still get the "radar on" option

#

it just doesn't do anything

#

so that makes me feel like it's something that all clients need to have run

#

but yeah i'll test a bit more

#

right now i'm dealing with waypoints inexplicably breaking on DS

meager heart
#

editor placed ?

inner swallow
#

yeah...

#

in a mission that was working before..

#

oh joy, it's even broken on local now, because i moved a waypoint by 20m

#

sigh

#

the truck just stands in front of the waypoint without completing it πŸ˜„

#

and i moved it in zeus, so it moved again, but didn't complete it

#

actually i think i know why, could be with the way i synced it

meager heart
#

🀷

lusty canyon
#

or is there a more efficient way to identify if a mag is pylonable?

inner swallow
#

@meager heart huh it's global arg, local effect.
When i'm on the server, It's false on the server, true on local, true on global.
If i execute it locally then it works.

hollow thistle
#

I have an array of sectors (markers), I want to check single random sector every frame for enemy presence.
For now it does not affect server FPS in any way but maybe there is something worth optimization.

// Init function, executed every time whole list of sectors was iterated
private _initFunction = {
    // Get inactive sectors
    _sectors = (KPLIB_sectors_all - KPLIB_sectors_blufor - KPLIB_sectors_active); // Array of Marker names
    _startTime = time; // DEBUG

    {_x setMarkerColor KPLIB_preset_colorEnemy;} forEach _sectors; // DEBUG

};

// Create PFH for sectors activation check
private _pfhID = [
    {
        // If we checked whole list, reinitialize the list
        if (_sectors isEqualTo []) then {
            systemChat format["Exec time: %1", (time - _startTime)]; // DEBUG
            [] call (_this getVariable "start");
        };

        // Extract current sector from array
        private _currentSector = _sectors deleteAt (random count _sectors);

        _currentSector setMarkerColor "ColorYellow"; // DEBUG
        
        // CHECK SECTOR ACTIVATION CONDITONS HERE

    },      // Handler
    0,      // Delay
    [],     // Args
    _initFunction,      // Start func
    {},     // End func
    {KPLIB_campaignRunning}, // Run condition
    {},     // End condition
    ["_sectors", "_startTime"]      // Privates to serialize between calls
] call CBA_fnc_createPerFrameHandlerObject;
#

Do you see anything worth optimization here?

still forum
#

not sure... I'm thinking about pushing selectRandom in there but that'll make deleting harder and will probably be slower in the end

hollow thistle
#

Did not know about selectRandom. Looks nice but I would have to keep track of already checked elements.

#

deleteAtRandom when? πŸ‘€

still forum
#

yeah that's the problem.. I think this is already optimal

hollow thistle
#

Learning SQF like a boss. :D
Thanks for the input!

tough abyss
#

Make markers triggers and make them trigger on enemy presence maybe

hollow thistle
#

I don't think ~150 triggers are an good idea.

tough abyss
#

You can freeze them and unfreeze random trigger to check for enemies

inner swallow
#

how can i find the client ID of headless client?
i'm doing owner F3_HC but that seems to be returning 2, which is the server πŸ€”

#

where F3_HC is the name of the client logic

tough abyss
#

Missioneh playerconnected

#

HC is just like another player will have all the data including owner

austere granite
#

deleteAtRandom pls yes

#

using find there is stupid

inner swallow
#

hmm thanks will see

meager heart
#

also filter __SERVER__ with meh πŸ˜ƒ (meh aka mission eh)

inner swallow
#

huh nevermind owner F3_HC, is working now πŸ€” πŸ€”

meager heart
inner swallow
#

haha it seems waypoints etc still don't get transfered

#

welp that was a useless bit of effort...

meager heart
#

what was the task ?

drowsy oak
#

If I create an agent on the server and attachto a local only object, can I transfer that agent to a headless client and it stay attached to the object?

inner swallow
#

well, i had an old mission that i was updating

#

i decided to add HC

#

and move all AAF units to HC

#

eariler i was trying to verify that

#

but now i know

#

because i read that upon transfering to HC, waypoints don't get transfered, and now the units aren't moving πŸ˜„

drowsy oak
#

I transfer troops to my headless client and the waypoints go with them

inner swallow
#

i was hoping that the waypoints would transfer too with setGroupOwner

#

editor placed waypoints?

drowsy oak
#

Mine are script created. I rarely use the editor for anything.

inner swallow
#

hmm

#

although on second thoughts... i think some of the vehicles moved πŸ€”

#

let me....not be lazy and actually check ownership πŸ˜„

meager heart
#

also better remove those editor placed wp's

inner swallow
#

too much effort, i'd rather not use HC πŸ˜›

#

okay, they're not being transfered, so time to do other stuff..

meager heart
#

πŸ˜ƒ

inner swallow
#

groan

#

adding a sleep 1 seems to have worked

#

but... now the waypoint activations are broken

#

that said, waypoints do work

#

although one vehicle dismounted its troops (or simply didn't wait for them to get in) (troops were in the same group as vehicle)

#

boo

#

no HC for me

#

please stop this voice inside my head suggesting i script the waypoints...

short vine
inner swallow
#

what about distance?

short vine
#

As far as im aware distance is just for well distance. Not tell me its heading

inner swallow
#

yeah, but if it's coming towards you, the distance will decrease...

short vine
#

True however this doesnt tell me from what direction

ruby breach
short vine
#

..im an idiot, thank you

tough abyss
#

You could use getRelDir on the other object instead then you get 0 if it is headed straight for you

meager heart
#

vectorFromTo πŸ€”

tough abyss
#

How’s this better then just getting azimuth with direction

meager heart
#

πŸ™„

solar coyote
#

Guys, does moveTo can be used only in FSMs? Seems to do nothing in refular script

formal vigil
solar coyote
#

I'm asking specificly about moveTo. And actualy would like to know whats the diference between the two

halcyon crypt
#

the BIKI says that moveTo can/should only be used in FSMs

#

doMove is for SQF

#

they both do the same thing

solar coyote
#

I would like AI just to move to given position. With doMove it seems to return fire and maybe oher AI soecific things. Thats not what i desire. I assumed moveTo would just find a path fron a to b and make AI walk there

formal vigil
tough abyss
#

Wiki doesn’t say it should be used in FSM only, some user comment says so =/= wiki

meager heart
#

moveTo low level command

still forum
#

@tough abyss wiki has also been written by users.

#

So user comment == wiki

solar coyote
#

And what wxactly means low level?

#

I mean, in arma context

queen cargo
#

low level is bullshit probably in that context

late gull
#

guys! πŸ˜„

#

is there a way to open and check target(other player) inventory?

#

not only backpack, all inventory

still forum
#

yes

#

vestContainer/uniformContainer/backpackContainer

meager heart
late gull
#

thx @still forum

#

will check what those does and how to work with them

polar folio
#

..

#

...

#

uhm

#

i got lagged. nvm

solar coyote
#

@meager heart tjx, seems like a good read

meager heart
#

np, better just use move/doMove...

still forum
#

you can delete messages instead of editing them out

late gull
#

hhhm,mmm

#

i'm using that

#
_items = backpackItems player;
{
  if (_x isKindOf ["Rifle", configFile >> "CfgWeapons"]) then {
    hintSilent str getText (configFile >> "CfgWeapons" >> _x >> "DisplayName")
  };
} forEach _items;
#

and it shows the MX perfectly

#

but what about pistol + magazines + grenades?

compact maple
#

you want to hint them too ?

late gull
#

i want to detect them all

#

weapons, magazines, grenades

meager heart
#
(backpackItems player) apply {_x call BIS_fnc_itemType select 1 == "Handgun"}
```something in that direction, maybe ^ πŸ€”
late gull
#
_items = backpackItems player;
{
    _type = _x call BIS_fnc_itemType;
    hint str _type;
} forEach _items;
#

i think it will work like that

#

now i want to force drop all the weapons to the floor

formal vigil
#

Mission w/ weapon restrictions?

late gull
#

nope, an action for a cop

#

for a life mode

formal vigil
#

ah, nice, good luck

late gull
#

hmm

#

a hand here pls

ruby breach
#

private _type; is wasted there

queen cargo
#

anybody can enlighten me what they mean?

ruby breach
#

Not sure if either of these would be faster or not ```sqf
private _weapons = _playerItems select {(_x call BIS_fnc_itemType select 0) isEqualTo "Weapon"};
private _magazines = _playerItems select {(_x call BIS_fnc_itemType select 0) isEqualTo "Magazine"};

late gull
#

well at the moment i wont make them faster

#

i want to make them work

ruby breach
#

Well for starters, _playerItems is an array of arrays

#

not an array of classnames

#

Well, it's actually a mixed array. But it's still not correct for what you're trying to do.

still forum
#

private _type; is wasted there not wasted. Error. private keyword is a keyword for the = operator

#

there is no equals there

ruby breach
#

If you have script errors on, this should definitely be popping a few

late gull
#

i have no erros

#

just the weapons/magazines are not getting removed xD

ruby breach
#

private _type; should error, you should be getting errors in BIS_fnc_itemType for Type Array, expected String

still forum
#

Why do you even try to put the private thing up there? You never use it outside of the forEach.
if (count(_magazines) > 0) that and if (count(_weapons) > 0) are completely useless. forEach does nothing if you pass an empty array

late gull
#

reworked

#
[] spawn {
    private _playerItems = [];
    _playerItems pushBack (backpackItems player);
    _playerItems pushBack (vestItems player);
    _playerItems pushBack (uniformItems player);
    _playerItems pushBack (primaryWeapon player);
    _playerItems pushBack (secondaryWeapon player);
    _playerItems pushBack (handgunWeapon player);

    private _magazines = [];
    private _weapons = [];

    {
        _type = _x call BIS_fnc_itemType;
        _type = _type select 0;
        switch (_type) do { 
            case "Magazine" : { _magazines pushBack _x }; 
            case "Weapon" : {  _weapons pushBack _x }; 
        };
    } forEach (_playerItems select 0);

    {
      player removeMagazineGlobal _x;
    } forEach _magazines;    

    {
      player removeWeaponGlobal _x;
    } forEach _weapons;
};
#

magazines are gone, but weapons stay

still forum
#

@queen cargo that note is from 2006. I'd say it probably doesn't apply anymore

#

@late gull debug the contents of _weapons and see if it's what you expect

ruby breach
#

You still haven't fixed your issue with _playerItems not being exclusively classnames

still forum
#

One thing that comes to mind is that BIS_fnc_itemType doesn't rezurn Weapon at all.. ever.

#

So that can't work at all

late gull
#

it's working, i'm doing hint before the last foreach with hintSilent str _weapons

#

and it show the 2 weapons that i have

#

but the remove part it's not working

still forum
#

It shouldn't work though

late gull
#

also i did hint the _x in the last foreach, has the class of the weapon

still forum
#

or does itemType return two entries?

#

Only took a quick look at the wiki

late gull
#

type return 2 entries

ruby breach
#

You'll also probably need to make use of removeItemFromUniform, removeItemFromVest, and removeItemFromBackpack to get rid of weapons and magazines from within containers. I think (but am not sure) that removeWeaponGlobal only removes equipped weapons.

late gull
#

an array of 2

#

iex: with a magazine returns ["Magazine", "Bullet"]

#

ok worked with remove item from backpack

#

that's only for weapons huh?

ruby breach
#

_playerItems should currently be returning in the format [[],[],[],"","",""], which doesn't work with the rest of your script

late gull
#

i did take the 0 (_playerItems select 0)

ruby breach
#

_playerItems select 0 is just an array of items in the unit's backpack

late gull
#

hmm ok

#

so bacpack,. uniform and vest?

#

nope, backpack, vest,. uniform, primary, secondary, handgun

#

i can split them all in it's own var

#

check each var and push into magazines or weapons

unborn ether
#

Just found an 99% accurate arma mass penguins to real kg formula coeff, who's interested in that:

(loadAbs player) * 0.04545  // Full unit loadout mass -> kg
(getNumber (configFile >> "CfgVehicles" >> backpack player >> "mass")) * 0.04545 // Your backpack mass
(getContainerMaxLoad (backpack player)) * 0.04545 // Your backpack maximum carry weight.
((getContainerMaxLoad (backpack player)) * 0.04545) * (loadBackpack player) // Your backpack current items weight

Use this along with toFixed 2 to get 0.00 format

#

Oh, and @still forum dear scriptman, getContainerMaxLoad seems to be missing in Discord syntax πŸ˜ƒ

queen cargo
#

btw. what is getContainerMaxLoad checking exactly in the config?

unborn ether
#

Im not sure. Since backpack has exactly maxLoad parameter, while vest and uniform doesn't

errant jasper
#

Arma weight is just decipounds

unborn ether
#

So that's not actually a penguins πŸ˜„

#

So it should be something like 0.04535 AFAIR.

errant jasper
#

Might as well have been :). Yeah, I use 0.04536.

unborn ether
#

Is that wikied somewhere, like that mass is actually 0.1 pound

still forum
#

@unborn ether I already made a PR for everything missing in discord syntax. But the highlighting library isn't maintained anymore

unborn ether
#

@still forum sad trombone

late gull
#

a way to make the player drop the weapons?

#

or a way to move weapons from inventory to the floor

queen cargo
#

can somebody else please test that this configNull select 10 really is not throwing any errors and returning nil?

#

because i cannot believe that this is expected behavior 😱

#

but started with show script errors ..

tough abyss
#

It returns configNull

#

Why is it unexpected?

still forum
#

CONFIG select NUMBER checks if config exists and if it's a class. If not it returns configNull yes.

queen cargo
#

because there is no error message

#

for me that is unexpected simply because i personally did not expected no error

tough abyss
#

With Arma always expect the unexpected

queen cargo
#

anyways ... added a warning to sqf-vm now

unborn ether
#

@late gull Had something similar for containers:

private _wh = "groundweaponholder" createVehicle position player;
_wh setPosASL (getPosASL player);
_wh addBackpackCargoGlobal [(backpack player),1];
_wh = everyBackpack _wh select 0;
{_wh addItemCargoGlobal [_x,1]} forEach (backpackItems player);
removeBackpack player; 

You can use action tho, but it's interruptible AFAIK.

#

and addItemCargoGlobal is not a perfect way of storing items, since it doesn't count ammo etc. So in your opportunity to script it better.

inner swallow
#

@meager heart i realised today that i could transfer BLUFOR groups to headless, since only one of them had waypoints that were synced to anything. So i excluded that group and transferred the rest to hc. Saved all that effort in the laziest way possible lol

meager heart
#

lol

late gull
#

i done like that

frigid raven
#

Does ACE3 has a discord channel?

still forum
#

no

frigid raven
#

that was quick, straighforward and disappointing !

#

thanks

#

πŸ˜‰

tame lion
#

quick config question: what value determines if an entry in Cfgweapons is a weapon or headgear or uniform, etc?

still forum
#

type

tame lion
still forum
#

BIS_fnc_itemType

tame lion
#

thankyou again. Long story short, im working on a custom shop system, and instead of going through each individual uniform/vest/etc and picking a price, I wanna auto sort them all at mission Init and im sure that will help

unborn ether
#

@late gull Looks hilarious, like an old games lootdrop πŸ˜„

late gull
#

haha

frigid raven
#

@tame lion lol I was just asking if there is a mod that kinda allows unit purchasing in a customizable way

runic seal
#

If there a way to get the first 3 characters of a function name? I just want to check the tag

tough abyss
#

You have to be more specific

formal vigil
#

I think he wants to check whether the function has BIS_ part (?)

tough abyss
#

Yes I understood that but this is pretty vague

still forum
#

absolutely no idea what he means... So I'd say "no" ?

tough abyss
#

Some concrete example would do

cerulean locust
#

string select [start, length]

meager heart
#

hint "y wot m8";

high marsh
#

Hey Sldt1ck, you're russian man. Don't do anything that doesn't feed stereotypes. Including using the tea drinker slang.

runic seal
#

Sorry got in the 🚿

#

That’s what I meant thank you

meager heart
#

btw russians kinda "tea drinkers" too...

high marsh
#

Well, everyone drinks a little tea. But you can tell by the stains on their teeth that it's more of an extreme :^)

meager heart
#

k... thanks for the info πŸ˜„

high marsh
#

Yw :)

unborn ether
#

I speak from the bottom of my heart: I drink vodka with tea.

high marsh
#

So you start your mornings pretty sober then yes? /s

unborn ether
#

who knows

high marsh
#

The fact that you don't know yourself is concerning, but we're all here for a good time not a long time right? Kidneys are for suckers.

meager heart
#

sounds good, m8

#

(btw we are offtopic πŸ˜ƒ)

high marsh
frigid raven
#

Hope I am allowed for this question here. I would like to have ACE Arsenal Loadout in the respawn menu. Is this possible somehow by ACE3 ?

meager heart
#

vanilla respawn menu ?

#

aka respawn templates inventory ?

high marsh
#

You'd need to find someway to extract the data and make it readable for the respawn configuration. I don't think you can change respawn inventories on the fly though.

frigid raven
#

nah that doesnt show my saved arsenal loadouts

#

alright - thx so far

high marsh
#

The vanilla respawn menu isn't designed to load your saved arsenal loarouts. It either shows the loadout used with that unit in configuration or a custom respawn loadout config defined in description.ext

frigid raven
#

When using addAction I can add a condition script. Since I was able to have the action handling script referencing to a .sqf file - it seems it is not possible for the condition parameter. Am I right here or just bad luck kinda?

tough abyss
#

You can but this will be huge overkill and impact on performance, the idea is to keep condition as simple and as light as possible, besides many checks that usually used in condition like distance check were moved to optional params already.

frigid raven
#

ah ok that makes sense

#

but can I still have more than one statement ?

ruby breach
#

Are you wondering if you can specify more than one condition for an addAction?

frigid raven
#

nah I want to add a commandChat msg after before the condition returns true/false

#

after -> before*

#

_target commandChat 'Gonna check first'; 'ACE_key_west' in items _this;

#

Since the condition is evaled within aprox 50m the player is in range of the action holder I thought that might work

solar coyote
#

Its still hard to wrap my head around "after -> before"

frigid raven
#

was a typo

solar coyote
#

What you want end result to be?

frigid raven
#

well before every condition check expression want to have a chat msg appear

#

therefore I need two statements

#

Meh tried it - but it is not nice. The radius is too large and the msg does not makes sense the way how often it appears