#arma3_scripting

1 messages · Page 705 of 1

undone flower
#

it works for driver, gunner but not for the commander's gun

digital vine
#

It works! Thanks!

Just a side question to improve my knowledge and skills, why do we net have to state logic an units before the main script, but we have to define the activated?

little raptor
#

what?

#

oh

#

why do we net have to state logic an units before the main script,
because you didn't need them in that script (before the spawn)

#

but we have to define the activated?

#

because you did need it before the spawn (if (_activated) then)

digital vine
#

I think I get it.... Put stuff before which you need to activate the script _activated
Then once script is activated the params tells the script to find whatever is inside of it i.e. _units or _logic from the main game logic?

hexed crown
#

Does SQF support elseifs? If so what's the syntax?

little raptor
#

only

else {
  if ()
}
```![meowsweats](https://cdn.discordapp.com/emojis/707626030613135390.webp?size=128 "meowsweats")
little raptor
#
call {
  if (bla) exitWith {//if
    //do bla
  };
  if (blabla) exitWith {//else if
    //do blabla
  };
  //else
  //do blablabla
}
little raptor
#

params just maps elements of an array to variables

#
[1,2,3] params ["_var1", "_var2", "_var3"];
#

params with no left arg is equivalent to: _this params [...]

params ["_logic", "_units"];
//is the same as
_this params ["_logic", "_units"];

_this is just an array

same thing applies to param:

private _activated = _someArray param [2, true]; //select element 2 from _someArray; default to true if doesn't exist
hexed crown
#

Ahh. That should actually work for what I am looking at. Second thing, is there a check datatype function?

little raptor
#

yes

#

isEqualType

#

or typeName to get the type in string format

hexed crown
#

Thank you much

chilly bronze
#

question about standards when it comes to passing variables to a function in a script, say we have this:
`
fn_something = {
_someMath = 1 + _someVariable;
// do other things
};

// script execution
_someVariable = 1;
call fn_something;
is this acceptable? from my understanding, _someVariable is able to be directly edited by fn_something. should this be done instead for variable safety?
fn_something = {
params["_someVariable"];
_someMath = 1 + _someVariable;
// do other things
};

// script execution
_someVariable = 1;
[_someVariable] call fn_something;
`
now _someVariable inside fn_something is a copy and not a direct reference, correct?

little raptor
#

but you're not modifying it by reference

#

at least if all you're doing is summing numbers

#
_a = [];
[_a] call {
  params ["_b"];
  _b pushBack 1;
};
_a //_a is now [1]
#

but:

_a = [];
[_a] call {
  params ["_b"];
  _b = _b + [1];
};
_a //_a is still []
#

what matters here is what operator you use, and whether it can modify the original value by reference

#
_c = [];
_a = [_c];
[_a] call {
   params ["_b"];
   _b = _b + [1];
   _b#0 pushBack 0; //_b is [[0], 1]
};
_a; //_a is [[0]], and _c is [0]
hexed crown
#

This is giving me ERROR MISSING ; ```sqf
_dir = ((_source selectionPosition "PiP0_pos") vectorFromTo (_source selectionPosition "PiP0_dir"));

little raptor
#

what is _source?

hexed crown
#

param from script, it is set to a Darter.

little raptor
#

what you posted doesn't have any errors

#

¯_(ツ)_/¯

hexed crown
#

Yeah, I didn't think there was either. But the game is telling me there is an error in line 23, which is that line.
Got to love it.

little raptor
hexed crown
#

NVM found it

little raptor
#

no actually next one
no previous one 🤣

hexed crown
#

It was in the previous line. I forgot the ; at the end of the call statement.

undone flower
#

anyone has a clue on how to make the commander of a vehicle force reload?

undone flower
#

is there a way to see how the reload command works internally?

little raptor
#

no

undone flower
#

it only seems to work until turret path [0]. if the unit is in a turret with turret path above 0 it doesn't works

hushed tendon
#

_objectsArray = []; = https://www.sqfbin.com/unepekovoyikematijom
I'm trying to spawn a composition but on the first surface below it. I ran a hint to see the positions of _creationPos and (_mapperObjects select 0) (Is the object that is at the center bottom/spawn pos of comp) and the Z axis was different for each even though they should be the same. Anyone know a solution for this?

_unit = (_this select 0);

private _begPosASL = (_unit modelToWorldVisualWorld [0,1,1]);
private _endPosASL = +_begPosASL;
_endPosASL set [2, 0];

private _intersections = lineIntersectsSurfaces [_begPosASL, _endPosASL, objNull, objNull, true, 1];

private _newPos = (_intersections select 0 select 0);
private _creationPos = [(_newPos select 0),(_newPos select 1),((_newPos select 2) + 0.1)];;

_objectsArray = [];

_mapperObjects = [_creationPos, (random 360), _objectsArray, 0] call BIS_fnc_objectsMapper;

hint format ["%1\n%2",_creationPos, (getPos (_mapperObjects select 0))];

{
    _x enableSimulationGlobal false;
    _x allowDamage false;
}forEach _mapperObjects;
little raptor
hushed tendon
little raptor
#

I said never use setPos

hushed tendon
#

Ohhhhh

#

My bad

little raptor
#

if you simply read this carefully it'll answer all your questions:

#

even solves your current problem

#

no need for lineIntersectsSurfaces either

hushed tendon
#

Well the positions are the same now

hushed tendon
little raptor
#

in other words, getPos _obj select 2 is what you should use to go down to snap to surface

hushed tendon
#

So create a dummy object run that then use that position to create the comp

little raptor
#

first put it in front of yourself

#

then getPos

#

then subtract height

#

ezpz

hushed tendon
#

Just want to make sure cause I can be confusing sometimes

little raptor
#

(as long as it has a roadway LOD)

frigid oracle
#

how can I stop AI pilots from randomly flying straight up for no reason?

little raptor
#

in the air?

#

maybe flyInHeightASL

frigid oracle
#

like helicopters, my AI needs to land but just decides to fly up for like 500 meters then slowly back down.

little raptor
#

not fixable

frigid oracle
#

they arent moving fast, I set them to slow pace

#

which is why im confused

little raptor
#

try flyInHeightASL

frigid oracle
#

ill give it a go

little raptor
#

maybe it'll work

frigid oracle
#

should I set that on the helicopter or unit flying it?

hushed tendon
#

What I have so far ```sqf
_unit = player;

_dummyObject = "Sign_Sphere25cm_F" createVehicleLocal [0,0,0];
_dummyObject setPosASL (_unit modelToWorldVisualWorld [0,1,10]);
_baseHeight = getPos _dummyObject select 2;

hint format ["%1\n%2",getPos _dummyObject, _baseHeight];

undone flower
#
_allMags = [];
                
for "_c" from 0 to (count magazinesAllTurrets vehicle player) do {

_allMags append (((magazinesAllTurrets vehicle player) select _c) select 0);

}; ```

I'm trying to make an array with all the class names of all the turrets in a vehicle. is this the best way to do it? yes it might be throwing a "generic error". I'll take a look at it later. probably syntax. If you manage to fix it i'll be thankful, also
copper raven
#
private _allMags = magazinesAllTurrets vehicle player apply {_x select 0};
#

and anyway, the error was for append, it takes an array, not string

hexed crown
#

settPiPEffect is setting the effect for all of my r2t textures instead of just the one I want with the effect.
Am I doing something incorrectly, or is that just the way it works?

mortal forum
#
            _faction = gettext (_x >> "faction");
            _type = gettext (_x >> "type");
            _vehicle = gettext (_x >> "value");
            
            _ctrlValue lnbsetdata [[_lnbAdd,0],_vehicle];``` 

I'm a bit stuck on adding more values so I can call it in a function later on, I'm wanting to have _side _faction _type along with _vehicle but have no clue how to achieve it
#

can anyone give me some guidance on this?

hexed crown
#

Do you mean, like in a single variable?

mortal forum
#

Yeah I think so, not entirely sure with this 😅

#
                _ctrlValue lnbsetdata [[_lnbAdd,1],_side];
                _ctrlValue lnbsetdata [[_lnbAdd,2],_faction];
                _ctrlValue lnbsetdata [[_lnbAdd,3],_type];```
#

this seems to carry all my values over, I just need a way in getting all the values to spawn my units

hexed crown
#

I wouldn't do it like that myself.

#

Does _ctrlValue have anything but these values in it?

mortal forum
#

_ctrlValue = _display displayctrl DEGA_IDC_RSCATTRIBUTEUGV_VALUE;

#

its is that currently

hexed crown
#

So from what I'm understanding, you want to save all the values you just pulled into a single variable and then be able to reference them later in order to control things about units that you spawn?

mortal forum
#

It could probably be done better but I'm using this as a learning process as I'm not very good

little raptor
hexed crown
little raptor
little raptor
mortal forum
#

I think I've managed to get the value to translate over to the next part its just calling everything together to get it to spawn now

hexed crown
#

Most of my coding has been done in programs, rather than games, so a variable existing the whole time it's running doesn't mean much, and it's often the only way to go about it.

chilly bronze
#

is it possible to learn more information about a given weapon from cfgweapons? example, know if a weapon on a vehicle is countermeasure, gun, missile, laser designator, etc?

dreamy kestrel
#

hello, Q: is it possible to #define SOMETHING(...) ... in an .sqf file? or do I actually need an .hpp file to facilitate that?

#

early indications lead me think the latter; like, as though the function does not seem to be invoked whatsoever. I see none of the artifacts, global variables, etc, that the function defines, consequently. and the function does not even return anything, which it should.

mortal forum
#

I've managed to figure it out!

dreamy kestrel
mortal forum
#

_type_spawnCfg = configfile >> "CfgGroups" >> _type_spawnSide >> _type_spawnFaction >> _type_spawnType >> _type_spawnClass; was wondering if someone could tell me how I could add "" to the following _type_spawnSide _type_spawnFaction _type_spawnType

little raptor
#

A

little raptor
# dreamy kestrel yes `A || B`? 😉

but note that whether you define it in the sqf file, or in an external file and include it, the script itself must be preprocessed for it to work
this is done using preprocessFile(LineNumbers)
excVM does it too

mortal forum
#

side = "West"; should be side = ""West"";

#

but does that work

hexed crown
#

West is codename of blufor

dreamy kestrel
little raptor
#

no

#

not necessarily

cfgFunctions, execVM, compile preprocessFile(LineNumbers) and compileScript all preprocess the file

those are the only places you can use preprocessor macros. (e.g. doing that in Debug Console won't work)

mortal forum
#

I need West to be in quotes, it comes from a config value

hexed crown
#

Oh, that's what you meant, I didn't see the second pair of ""

#

I don't think there is a way to do that.

mortal forum
#

hmm

#

not good

dreamy kestrel
little raptor
#

or ```sqf
format ["%1", west]

hexed crown
#

I believe if you do "side" when you need it, that might work too.

little raptor
hexed crown
#

Better to do an "_side"

little raptor
#

no

hexed crown
#

Does that one not work?

little raptor
#

no

mortal forum
#
                    {
                        //name = "$STR_A3_CfgVehicles_B_Plane_CAS_01_F0";
                        side = "West";
                        faction = "BLU_F";
                        type = "Infantry";
                        value = "BUS_InfSquad"; //B_Plane_CAS_01_F    
                        //value = "configfile>>""CfgGroups"">>""West"">>""BLU_F"">>""Infantry"">>BUS_InfSquad";
                        default = 1;
                    };    ```
hexed crown
#

Couldn't remember my own code and if that's what I ended up doing.

mortal forum
#

I use setvar, getvar etc to get these values

little raptor
mortal forum
#

that is from my config

little raptor
#

it's already a string

mortal forum
#

if I added the extra "" in the config it won't show up on my ui

little raptor
#

I still have no idea what exactly it is that you want

hexed crown
little raptor
#

and if that's the question, then the answer is:

config values are always strings, numbers, or arrays of these
in your case, "west" is already a string (it is already in quotes)

mortal forum
#

ah okay

bright robin
#

How can do it,so only the player itself can see its onw drawings?

#

and markers

#

and etc

#

basicly a personal marker system

little raptor
bright robin
#

you mean?

little raptor
#

what? no

bright robin
#

ah

#

i mean,so mid game you can do anything

little raptor
#

so it won't be broadcast to other computers

#

and thus only whoever created it can see it

little raptor
bright robin
#

that would make all player made markers be only displayed to the player?

#

or even better yet

little raptor
#

you don't seem to know much about scripting

bright robin
#

esact

#

but i've not seen anything of that sort

little raptor
# bright robin esact

not sure what you meant there
anyway, I think you can create markers locally in the base game just fine

bright robin
#

what i mean is that player can only see either their onw markers,or the ones from their enemy

hexed crown
#

My question from earlier.

settPiPEffect is setting the effect for all of my r2t textures instead of just the one I want with the effect.
Am I doing something incorrectly, or is that just the way it works?

little raptor
#

two different r2ts

hexed crown
#

Hmm. I don't know how I'd fix it in my case.

little raptor
#

use unique r2t's

#

¯_(ツ)_/¯

hexed crown
#

I have. That's why I am confused.

little raptor
# hexed crown I have. That's why I am confused.

this is the (relevant parts of) the code I used:

_cam = "camera" camCreate [0,0,1e3];
        
_r2t = format ["dbug_r2t_%1", TAG(cams) pushBack _cam];
        
_cam cameraEffect ["terminate", "back", _r2t];
_cam cameraEffect ["Internal", "Back", _r2t];
_pic ctrlSetText format["#(argb,512,512,1)r2t(%1,1.0)", _r2t];

if (TAG(cfgObjs) pushBack _obj == 0) then {
  _r2t setPiPEffect [1];
};
#

take from it what you want

#

¯_(ツ)_/¯

hexed crown
#

1st one executed.sqf "uavrtt" setPiPEffect [0]; 2nd one executed.```sqf
"uavrtt_1" setPiPEffect [2];

winter rose
#

so the error is somewhere else

hexed crown
#

Indeed, but I have no idea what could be causing it.

winter rose
#

and we cannot know from there, unless…

hexed crown
#

Executed by script call in an init field.(Greyhawk)sqf /* create r2t */ tv setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"]; /* create cam, send to r2t */ uavcam = "camera" camCreate [0,0,0]; uavcam cameraEffect ["External", "Back", "uavrtt"]; /* attach cam gunner cam */ uavcam attachTo [uav, [0,0,0], "laserstart", true]; uav lockCameraTo [tgt, [0]]; /* make it zoom in a little */ uavcam camSetFov 0.01; /* set cam vision mode */ "uavrtt" setPiPEffect [2]; Then this one in a different init field.(Darter)```sqf
sleep 0.5;
/* create render surface /
tv_1 setObjectTexture [1, "#(argb,512,512,1)r2t(uavrtt_1,1)"];
/
create camera and stream to render surface /
cam_1 = "camera" camCreate [0,0,0];
cam_1 cameraEffect ["External", "Back", "uavrtt_1"];
/
attach cam to gunner cam position /
cam_1 attachTo [uav_1, [0,0,0], "PiP0_pos", true];
uav_1 lockCameraTo [tgt_1, [0]];
/
set cam zoom /
cam_1 camSetFov 0.05;
/
set cam vision mode */
"uavrtt_1" setPiPEffect [0];

little raptor
#

also use terminate like I did

hexed crown
#

I'll try now.

little raptor
#

also it's safer to just create a system which does this automatically
copy pasting code is not a good idea

#

what if you wanted more cameras?

hexed crown
#

I know. These 2 are tests to try to figure out what the issue was.

little raptor
#

with a code like the one I posted you can create virtually an infinite number of cameras

hexed crown
#

I have a moduler version.

#

Switching to Internal was the fix.

#

Thx for the extra set of eyes and knowledge.

little raptor
#

np

coral nest
#

looking at making a field manual for my unit to hand to recruits along, my idea is to make a book like item that can be opened through a keybind or ace, can anyone give me some pointers to start with

gleaming oriole
#

Heya, I created custom groups and loadout classes in the description.ext but when I try to spawn a group, it doesn't find the loadout classname (Cannot create non-ai vehicle A_O_G_Soldier_TL_F)

class AOI_Infantry {
    name = "Infantry squad";
    side = 0;
    faction = "OPF_G_F";
    icon = "\A3\ui_f\data\map\markers\nato\o_inf.paa";
    class Unit0 {
        side = 0;
        vehicle = "A_O_G_Soldier_TL_F";
        rank = "SERGEANT";
        position[] = {0,0,0};
    };

How do I tell it where to find the config for the classnames? (A_O_G_Soldier_TL_F, ...)

This is the class for the first loadout (I cut some parts to make it shorter in discord, but the loadout itself works when being called with getUnitLoadout)

class CfgVehicles
{
    class A_O_G_Soldier_TL_F
    {
    uniformClass = "U_BG_Guerilla1_2_F";
    backpack = "";
    weapons[] = {"arifle_AK12U_lush_F", "hgun_Rook40_F", "Throw", "Put"};
    magazines[] = {"30Rnd_762x39_AK12_Mag_Tracer_F", ...};
    items[] = {"ACE_fieldDressing", "ACE_fieldDressing", ...};
    linkedItems[] = {"V_CarrierRigKBT_01_light_Olive_F", ...};
    };
undone flower
#

the reload scripting command is driving me nuts. it doesn't works with countermeasures and some of the turrets in a vehicle.

low sierra
#

It's ok to run a 30 lines code inside a isNil {...30 lines code...}; or i need to keep the code to a minimum?

warm hedge
#

Possible so its okay if I define your ok “runnable”

crude vigil
#

30 lines of change weather and simulWeatherSync code intensifies

low sierra
#

@warm hedge@crude vigil most lines are simple calcs, but i also create a Static Weapon and put an AI inside it.

warm hedge
#

Still I don't know what is the question. If you wish to do that, just do that

frail vault
#

hello, i am trying to make it so that my players can chose their patch for their dynamic group
I am looking around but i can't seem to find any documentation surrounding dynamic group and patches (or how it randomly chooses one)

subtle sinew
#

hi guys. I'm making a custom module for a first time and it's kinda wrecked now... can you guys gives me advice?

#
    params ['_array', '_object'];
    [_object, !(captive _object)] remoteExec ["setCaptive", _object];
};```
so this is the module that my friend gives me.... and now I'm trying to make it to target the "all players"
#

and I failed. yeah.

winter rose
#

(are you dan yet?)

subtle sinew
#

(lol)

#

anyway, the goal I'm looking for = place the module on a zeus, make all players go captive

winter rose
#

on the wiki or in the data, there are module functions models you can use :)

#

see the input format, use forEach, profit

subtle sinew
#

welp, I still don't know how exactly put those and failed multiple times......

#
    params ['_array', '_object'];
    private _units = units (group _object);
    {
        [_x, !(captive _x)] remoteExec ["setCaptive", _x];
    } forEach _units;
};```
this one applies to group I select...yeah it worked. I tried to edit some words from here and..... failed :/
#

changed units to allplayers, but it didn't work as I thought....

winter rose
#

are you trying to do a module or are you trying to (simply) do a script?

#

@subtle sinew

subtle sinew
#

module. for zeus.

#

got a tool for apply, and those 2 I wrote worked as I thought

winter rose
#

1/ you are creating a code variable (toggleSetCaptiveGroup), which by itself does nothing
2/ a module uses such parameters: [logic, objects, isActivated]
3/ your forEach seems correct

subtle sinew
#
    params ['_array', '_object'];
    private _units = units (group _object);
    {
        [_x, !(captive _x)] remoteExec ["setCaptive", _x];
    } forEach _units;
};

["Custom Modules", "Toggle setCaptive Group", toggleSetCaptiveGroup] call zen_custom_modules_fnc_register;```

this was full script, it goes through zen addon :/
winter rose
#

1/ oh, a full script thanks for telling 😛
2/ IDK Zen, see their doc
3/ you can use a local variable (_toggleSetCaptiveGroup)

subtle sinew
#

time to go back a little, those 2 works as I thought, now I wanted to target the all players for setCaptive...and there's the problem started :/

still forum
somber radish
#

I got a issue when I am hosting my scenario (Both playerServer and dedicated), the issue is that every time a new player Joins in Progress the whole server freezes for like 2 seconds (Mega-Lag spike). Anyone got any Idea of where I should start to look in order to fix that issue?

winter rose
#

OnPlayerConnected and such?

#

also, all your remoteExec with JIP set to true

#

additionally, setUnitLoadout has been spotted for always adding something to the JIP queue

#

@somber radish ↑

somber radish
winter rose
#

well, do you use remoteExec

somber radish
#

Ooh, ok I thought it was the oposite (making the load-in process bigger)

#

Yeah

#

A lot

somber radish
#

So that is wrong?

winter rose
#

don't do it randomly 😄 check what you want to do

somber radish
#

Does JIP only fire on the conecting machine, or on all machines every time someone connects?

somber radish
winter rose
somber radish
#

I have, Can't remember it saying anything about a lag-spike. Afaik using 0 sends the command to all machines (however what I dont know is if ```sqf
[] remoteExec ["Function", 0, true];

#

will cause the fnc to repeat on all machines once someone new connects

winter rose
#

no

#

it will exec the function on the connecting machine, that's it

#

Can't remember it saying anything about a lag-spike
like scripting doesn't tell you that abusing it will tank perfs - it's just "don't JIP everything that is not needed"

somber radish
#

Thank you!

winter rose
# somber radish I have, Can't remember it saying anything about a lag-spike. Afaik using 0 sends...

let's say (I might breach open doors here too):

[unit, 1] remoteExec ["setDamage"];
```this is useless, as `setDamage` has a global effect

```sqf
[unit, "face1"] remoteExec ["setFace"];
```makes sense, it has a local effect - **but!** a player joining later will not have the info (everyone had a local change)```sqf
[unit, "face1"] remoteExec ["setFace", 0, true];
```makes sense

```sqf
[group unit, leader unit] remoteExec ["selectLeader", group unit];
```makes sense - then, the leader has been selected for everyone
```sqf
[group unit, leader unit] remoteExec ["selectLeader", group unit, true];
```**makes no sense** because when joining, the global information (who is the leader) is **already** transmitted with all the current info to the JIP machine
somber radish
winter rose
#

IDK, you tell me (MP sync, most likely?)
how is spawning objects related to JIP though 🤔

somber radish
#

I was thinking about the lag-spike (If the spike is related to a bunch of functions being executed when someone joins / the info of those new objects being transferred to the new client)

winter rose
#

well, creation of 100 network-synchronised objects may have some impact yes
1/ transferring all the remoteExec about creating objects (why not one function?)
2/ creating those and sending them to other machines

somber radish
#

hmmm, ok

#

Thank you again, I'll keep on digging / testing

winter rose
#

if you have doubts, shoot! (a question)
Disclaimer: this advice does not apply to a war zone

crude vigil
crude vigil
#

Yes I only wrote that to create an objection against you. meowtrash

winter rose
winter rose
#

I will mute you 😈

idle jungle
#

Is there a way to make respawn wave a set thing where it waits till x amount of people dead then respawns them
So it feels like more of a wave.. per say

#

In my experience wave respawn is just a random timer it doesn't necessarily feel like a wave respawn

winter rose
#

per se, it is a latin locution 🙂

you could set player respawn remotely to +5, +5, +5 until the "good" amount of dead peeps are reached, then remote them all to 0

#

@idle jungle

idle jungle
#

Ok can you explain it like I'm 5? 👶 lol is it via init.sqf or?

drifting portal
#
player switchMove "AmovPercMstpSnonWnonDnon_exercisePushup";

I want to force the player into the push up animation, playMove works but the problem is the player has to finish their animation to start the push up animation if I use playMove
so I'm using switchMove to force them into the animation whenever I want, problem is when I run the command the player just hostlers their gun then go back to their normal animation and point their gun forwards as if the animation played for half a second and stopped, any possible fix?

drifting portal
winter rose
urban tiger
#

Have i just over looked something.. Adding 'player addAction ["test", call fn_test];' in the init will add the action but not call fn_test at all. adding it into the debug console will work as intended but also call fn_test as soon as the addaction action is added to the player. wot.jpg

winter rose
urban tiger
little raptor
#

it's returning the result already

#

and uses it for the action code

winter rose
#

{ call myFunction }

urban tiger
#

wait nevermind, complete brainfart lol. Forgot arma's sleep is in seconds not milliseconds. working perfectly.

winter rose
#

lul ^^

undone flower
#
switch (_kind) do {

    case "Rifle": {
    
        _resupplyTime = 30;
        
        if (_weapon isKindOf "Rifle_Long_Base_F") then{
            _resupplyTime = 45;
        };
        
    };
    
    case "Pistol": { _resupplyTime = 15 };
    
    case "Launcher"; { _resupplyTime = 60 };
    
    case "GrenadeLauncher": { _resupplyTime = 45 };
    
    default { _resupplyTime = 30 };
    
};

so, what good options do I have here to define "_kind"? else ifs, checking isKindOf?

little raptor
undone flower
# little raptor > else ifs https://discord.com/channels/105462288051380224/105462984087728128/87...
call {

  if (_weapon isKindOf ["Rifle", configFile >> "CfgWeapons"]) exitWith { //if
  
    _resupplyTime = 30;
    
    if (_weapon isKindOf ["Rifle_Long_Base_F", configFile >> "CfgWeapons"]) then {
            _resupplyTime = 45; // lmg or sniper
    };
    
  };
  
  if (_weapon isKindOf ["GrenadeLauncher", configFile >> "CfgWeapons"]) exitWith {//else if
    _resupplyTime = 45;
  };
  
  if (_weapon isKindOf ["Launcher", configFile >> "CfgWeapons"]) exitWith {//else if
    _resupplyTime = 60;
  };
  
  if (_weapon isKindOf ["Pistol", configFile >> "CfgWeapons"]) exitWith {//else if
    _resupplyTime = 15;
  };
  
  else {
    _resupplyTime = 30;
  };
  
}

I done this right?

little raptor
#

I said the special version of isKindOf

undone flower
#

what's that special version? I'm not following thonk

little raptor
#

look at the wiki

undone flower
#

ah, the alternative syntax? got it

little raptor
undone flower
little raptor
#

¯_(ツ)_/¯

#

I didn't spot anything wrong

undone flower
#

I'll run it

little raptor
#

except for this

#

if (_weapon isKindOf ["Pistol", configFile >> "CfgWeapons"]) exitWith {//else if
_resupplyTime = 15;
};

else {
_resupplyTime = 30;
};

#

what on earth is that last else?

winter rose
#

magic

undone flower
#

I tried calling _resupplyTime outside of the call and it said undefined variable

#

nvm I just defined it before the call and apparently it is working

undone flower
#

how do I omit an optional parameter/ not specify it?? I'm trying to call playSound3D but soundPosition is overriding soundSource

idle jungle
winter rose
#

basically @idle jungle
when a player is dead, remoteExec setPlayerRespawnTime to e.g 10e10
when enough players are ready to respawn (and still connected), remoteExec them setPlayerRespawnTime to a value of e.g 1
https://community.bistudio.com/wiki/setPlayerRespawnTime

[10e10] remoteExec ["setPlayerRespawnTime", _guyThatJustDied];

private _respawnList = [];

waitUntil { count _respawnList > 9 };
[1] remoteExec ["setPlayerRespawnTime", _respawnList];
```_PSEUDO CODE_ but you see the idea
little raptor
#

10e10 is 1e11 😛

winter rose
#

shaddap

still forum
#

1*1*1*1*1*1*1*1*1*1*1 == 10*10*10*10*10*10*10*10*10*10 ? really? is it?

little raptor
still forum
#

are you joking?! I can't tell!

winter rose
#

it's not "power", it's "×10^n"

/ moodkiller

still forum
winter rose
#

5e3 = 5000

little raptor
#

plz tell me you're joking! 😄

winter rose
#

he's in charge of A3's engine!! notlikemeow

idle jungle
idle jungle
coral sky
#

Something like that I guess

#

I'm not at all familiar with the respawn system :p

hushed tendon
#

I'm using BIS_fnc_objectsGrabber and can someone tell me what each value is for?

["Land_Ammobox_rounds_F",[-0.0800781,-0.578125,0],20.2942,1,0,[0,0],"","",true,false],
gleaming oriole
robust tiger
# hushed tendon I'm using `BIS_fnc_objectsGrabber` and can someone tell me what each value is fo...

From the BIS_fnc_objectsMapper

_type = _x select 0;
_relPos = _x select 1;
_azimuth = _x select 2;    
//Optionally map certain features for backwards compatibility
if ((count _x) > 3) then {_fuel = _x select 3};
if ((count _x) > 4) then {_damage = _x select 4};
if ((count _x) > 5) then {_orientation = _x select 5};
if ((count _x) > 6) then {_varName = _x select 6};
if ((count _x) > 7) then {_init = _x select 7};
if ((count _x) > 8) then {_simulation = _x select 8};
if ((count _x) > 9) then {_ASL = _x select 9};
if (isNil "_ASL") then {_ASL = false;};
#

_x being an element from the object grabber array

undone flower
#
private _allMags = (magazinesAmmo [vehicle player, false] apply {_x select 0}) + ((magazinesAllTurrets (vehicle player) apply {_x select 0}) - (magazinesAmmo [vehicle player, true] apply {_x select 0}));
// all Mags = vehicle mags + ((all turret mags including empty) - (vehicle mags including empty))
// all Mags = vehicle mags + ( all turret mags - vehicle mags)
// all Mags = all turret mags (which include vehicle mags)[Empty mags removed!]

all this to remove empty mags from magazinesAllTurrets doesn't works. if only magazineAllTurrets didn't include empty mags...

willow hound
#

@undone flower Try something like this 🙂

private _noEmptyMags = magazinesAllTurrets MyVehicle select {_x # 2 > 0};
brazen lagoon
#

Not sure if this exactly goes in here, but anyone have any suggestions for existing addons that improve tank mechanics? There's that smarter tanks addon that makes the AI better, but I mean stuff that changes how armor pen works etc

undone flower
undone flower
gleaming oriole
# sharp grotto no

Would it work if only the server starts with the pbo or does every client need it too?

supple matrix
#

Is there no way to prevent a plane from exploding when damaged?
addEventHandler["Dammaged",{0}]; does nothing in this regard, the only way i found to stop it from exploding is to use allowDamage false, but that just prevents ALL damage.

I remember this being an issue years ago, but i would expect this to be addressed by now. So, still no change?

brazen lagoon
#

how would I disable vcom on all aircraft?

winter rose
supple matrix
# winter rose "HandleDamage" would be the EH

But it is not. Like i wrote, _plane addEventHandler["Dammaged",{0}]; does not prevent the plane from exploding.
....hmmm, unless i would be doing allowDamage false inside and then setting limited damage to particular hitpoints... worth a try

brave jungle
#

How do I get the parent path of a nested tvCurSel

little raptor
#
_parent = _curSel select [0, count _cursel - 1];
brave jungle
#

ah you do literally just - 1 it

supple matrix
brave jungle
#

okay ty!

versed widget
#

are there any difference between || and or and and && ?

copper raven
#

no

versed widget
#

lol then why having two identical operators ?
there must be something

cosmic lichen
#

shorter, easier to distinguish

#

There are tons of duplicated commands that do the same

copper raven
chilly bronze
#

whats the best way to debug? i usually just use systemChat format ["%1, %2...." _var1, var2]

cosmic lichen
#

Use the way that helps you best to debug ¯_(ツ)_/¯

#

as well as diag_log

digital rover
somber radish
#

Quick remoteExec question

#

if I put this : ```sqf
Payout = {
Cash = (Cash + 5000);

     };

While {true} do

            {
                            Sleep 300;
            {[] RemoteExecCall ["Payout", _x]} ForEach AllPlayers;
                            
            };
In the InitServer.sqf file and only there, will the clients be able to execute this function?
winter rose
#

no.

#

when you put a function name in it, it doesn't say "send the code and run it there" but "run this function on the client"

#

either have a function for that (also, "Cash" is quite… generic, don't forget to prefix it with a tag e.g TALLY_Cash) or awfully send the code itself over the network.```sqf
// OK
while { sleep 300; true } do
{
[5000] remoteExec ["TALLY_fnc_addMonies"];
};

// big meh
while { sleep 300; true } do
{
[{ Cash = Cash + 5000 }] remoteExec ["call"];
};

// biggest meh
[{ while { sleep 300; true } do { Cash = Cash + 5000 } }] remoteExec ["call", 0, true];

#

@little raptor it's ok, it was just a nightmare. close your eyes, it is gone already

versed widget
#

if (("hit_engine" in _selection) or ("motor" in _selection))
this may sound stupid but how can i avoid the repetition of the _selection expression when i have big conditional statements ?

i tried (("hit_engine" or "motor") in _selection) and got generic error in expression notlikemeowcry

hexed crown
#

Example: ```sqf
_condition = (("hit_engine" in _selection) or ("motor" in _selection));
if (_condition) do {
Blah
Blah
Blah
};

#

If it works, it will make the if statement shorter, but you'll still have to type it all out.

little raptor
#

but you can also use regex (after v2.06 update)

count (_selection regexFind ["hit_engine|motor|.../io", 0]) != 0

which will be faster if you have many words to search

undone flower
#

I'd be glad if devs took a look into the reload command. it works so funky. I've been trying to find a workaround for its wonkyness for a day or two now

little raptor
undone flower
little raptor
#

yes

undone flower
#

there's a ticket about it already. looks like a dev replied to it

#

I hope they work into it

hexed crown
supple matrix
#

_u action ["Eject", _v] doesn't work if the vehicle is too damaged?
It works at the mission start, but not few seconds later when the vehicle is damaged (the only difference i am aware of).
I can still exit using player action, but the scripting command does nothing.
Never mind, i am a moron.

barren pewter
#

When you say

round random 3

does that mean 1, 2, or 3

Or does it mean 0, 1, 2, or 3

Basicly does it inculde or exculde zero?

supple matrix
#

random 3 can be a number in range from 0 to 2.9999999
So after rounding the result of random 3 you can get 0, 1, 2, or 3.

barren pewter
supple matrix
barren pewter
#

@supple matrix ignore the last comment, i can just use 1 and 0 lmao im dumb

supple matrix
chilly bronze
#

is sqf like other languages where if you use an or condition and the first condition is true, it does not read the second condition?

#

for example,
i = 1; if (i == 1 or i select 4) then { do something };
i isnt an array but i == 1, does it skip the second condition?

drifting sky
#

"unit setSkill number" Does that set every sub skill to number? Or only certain sub skills? Or does it do something else?

hallow depot
#

I need some help, when I put this

taki1 say3D ["mosque_1", 500, 1];
sleep 75;
};```
in On Condition in my trigger the game crashes. My trigger is activated by blufor and is repeatable
I have this in my description.ext
```class CfgSounds
{
    sounds[] = {};
    class mosque_1
    {
        name = "mosque_1";
        sound[] = {"\sounds\soundfiles\mosquesound_1.ogg", 300, 1};
        titles[] = {0, ""};
    };
};```
velvet merlin
#

is there a way to detect "double tab" key input via actionKeys or otherwise? [and not block other input like when using inputAction]

#

say you have grenade throw bound to 2x T

winter rose
velvet merlin
crude vigil
#

oh I had read that as "double tap" meaning double clicking, buuut 2xT is confusing me now which one exactly 😅

ivory lake
#

double tapping a key

#

at least the DIK code is an offset of 256

#

so 2x T is 276

cosmic lichen
winter rose
#

that too

crude vigil
#

@ivory lake @velvet merlin If I had such issue, I would simply write like this, not sure if there is another way(that could be thought in 5 mins meowtrash ). You may wanna test it though.

#define KEY_DIK 20
#define MAX_DOUBLECLICK_TIME 0.5

finddisplay 46 displayaddeventhandler ["keyDown", {
    if (_this select 1 == KEY_DIK) then {
        hint "T clicked";
        private _lastTClickTime = uiNamespace getVariable ["fnc_LastTClickTime", 0];
        private _deltaTClickTime = time - _lastTClickTime;
        systemChat str _deltaTClickTime;
        if (_lastTClickTime > 0 && _deltaTClickTime > 0 && _deltaTClickTime < MAX_DOUBLECLICK_TIME) then {
            hint "T double clicked";
        } else {
            uiNamespace setVariable ["fnc_TClick", true]; 
        };
        uiNamespace setVariable ["fnc_LastTClickTime", 0];
    };
}];


finddisplay 46 displayaddeventhandler ["keyUp", {
    if (_this select 1 == KEY_DIK) then {
        if (uiNamespace getVariable ["fnc_TClick", false]) then { //This condition is to ensure T was not pressed in another dialog/display then released in this dialog.
            uiNamespace setVariable ["fnc_LastTClickTime", time];
        };
        uiNamespace setVariable ["fnc_TClick", false];
    };
}];```
crude vigil
winter rose
#

easy!
you just add selectRandom [0, 1, 2, 3, 4, 5, 6, 7, 8, (…), 98, 99, 100]

#

that's how you get a 500kb SQF 😄

cosmic lichen
#

[0, 100] call BIS_fnc_randomInt;

#

I still think we should have a randomInt command

digital rover
#
_i = 0.5;
while {"." in (str _i)} do {
    _i = random 100
};
_i

this is perfect code, you literally cant do it better

#

disclaimer: That is bad and dumb

copper raven
#
private _fnc_randomInt = {
  private _result = random _this;
  if ("." in str _result) exitWith _fnc_randomInt;
  _result
};
100 call _fnc_randomInt;

to avoid while unscheduled limit, even better

winter rose
#

🔨😄

crude vigil
#

We need more meow emotes.

winter rose
#

NO WE DON'T

crude vigil
winter rose
digital rover
#
_fnc_randomInt = {
     selectRandom (magazinesAmmo selectRandom (allUnits)) select 1
};
``` one liner baybee
winter rose
#

gniiiiiiiii!!

tender fossil
hushed tendon
#

Does BIS_fnc_objectsMapper always spawn on the ground? Because I know I'm passing in a Z axis but the composition keeps going to the surface

winter rose
#

editing the page so it's clearer

hushed tendon
#

I'm really good at missing the information I'm looking for. Literally read the page like 10 times

winter rose
#

page fixed
if you need to move them up, you have all the objects so you could setPosASL vectorAdd forEach of them

hushed tendon
#

Alright

#

Ty

undone flower
hallow depot
tender fossil
#

How to detect client disconnecting from (dedicated) server on the client itself? (Arma 2: OA!)

tender fossil
winter rose
#

onPlayerDisconnected, rings a bell? 🔔

tender fossil
#

I hope to finish my pet project some day so that I can move to Arma 3 completely... 😄

tender fossil
hushed tendon
winter rose
#

just don't disconnect

tender fossil
winter rose
#

Arma 3 still lacks that killer gamemode
you can port 👀

tender fossil
#

Tbh I've been considering even a standalone since I don't like SQF at all (looking forward to Enscript even with all its quirks), but it would increase workload on other areas significantly and I don't think I'd be able to handle such a large project in my current life situation

hushed tendon
# winter rose page fixed if you need to move them up, you have all the objects so you could se...

Is it my thought process that is messing this up or the code?
The objects are generally in the position they are supposed to be but the Z axis is a little off by like a meter or two

_mapperObjects = [_creationPos, (random 360), _objectsArray, 0] call BIS_fnc_objectsMapper;

{
    _x setPosASL ((getPosASL _x) vectorAdd [0,0,(((getPosASL _x) select 2) - _creationPosZ)]);
    _x allowDamage false;
}forEach _mapperObjects;
#

_creationPosZ is the Z axis of where the composition should have spawned so I'm getting the difference of the Z heights and adding that to the object right?

(((getPosASL _x) select 2) - _creationPosZ)
little raptor
#

(getPosASL _x) vectorAdd [0,0,(((getPosASL _x) select 2) - _creationPosZ)]
....wat?

little raptor
little raptor
#

...

copper raven
#

necessary*

hushed tendon
#

So

(getPosASL _x select 2) - _creationPosZ
little raptor
hushed tendon
#

Maybe I should take a brake and come back when my head can think straight

little raptor
bright robin
#

@fair drum i'm having a issue w/ the markers script,it seems to not be working

fair drum
bright robin
#

i'll redoit

#

(simply copypasting the code)

#

and redoing the markers

fair drum
#

pm me what you got so far again

bright robin
#

i'll check it that works

bright robin
#

so idk what happened

fair drum
#

you probably missed a string somewhere or something

bright robin
#

idk

#

i guess

#

either way,it works well

hushed tendon
fair drum
#

you can use set if you want

winter rose
#
_x setPosASL (getPosASL _x vectorAdd [0,0,_xHeightZ]);
little raptor
winter rose
#

fite mi

little raptor
#

z = 2*z - _creationPosZ

#

so you're taking the object higher

#

it should've been:

((getPosASL _x) vectorAdd [0,0,_creationPosZ - (getPosASL _x select 2)])
#

i.e

#

z = z + _creationPosZ - z

#

or z = _creationPosZ

#

so like I said, you don't need any vector ops at all

#
_p = getPosASL _x;
_p set [2, _creationPosZ];
_x setPosASL _p
fair drum
#

love me some set

hushed tendon
#

I swear I’m usually good at thinking and at math notlikemeowcry

#

Thanks for working with my stupidity

crude vigil
fair drum
#

even worse when its directed at you

bright robin
#

anyways

#

how could i make a ACE arsenal that only loads gear currently used from one side?

winter rose
#

see ACE doc

fair drum
#

that's the how, but for the gear to only be one side, you'll have to do some class filtering.

little raptor
# hushed tendon Thanks for working with my stupidity

it's ok don't beat yourself up over it. just try to think outside the box. and sometimes a little imagination can help too, which is what I tried to say here:

you can just picture a scenario if you have trouble figuring it out
what happens here if the object is above _creationPosZ, i.e. (getPosASL _x select 2) - _creationPosZ is positive?
obviously in that case dz > 0, so you'll be taking the object higher (but in this case you wanted to take it lower)

bright robin
#

reading it

#

but no idea on waht to di

#

*do

winter rose
#

stuff

bright robin
#

less obvious

winter rose
#

non-obvious stuff

undone flower
#

guys... given a vehicle, weapon, muzzle and magazine from EH "Reloaded", how can I find the crewmember that reloaded 'muzzle'?

#

I need this because currentMagazine returns "" if the crewmember is using the commander's turret gun, for example

little raptor
#

you can't think_turtle

undone flower
#

currentMagazine, currentWeapon only works for driver and gunner turrets I think 💀

frank mango
supple matrix
#

maybe this is a better place for this:
How do you get dead units out from a destroyed vehicle?

supple matrix
#

Are you trying to say that it is not possible?

little raptor
little raptor
#

you can probably delete them tho

supple matrix
#

well, i don't want to delete them, i want them to drop out of the vehicle.
still, i tried deleting them using deleteVehicle and it doesn't do anything either.
So, i guess there is just no way doing anything with those units.

little raptor
supple matrix
#

I just find it hard to believe, because i would expect this to be kinds common and often required feature, so it is hard to accept that there is no solution 🙂

little raptor
#

but will be added in v2.06

supple matrix
#

Aha, i see, deleteVehicleCrew does work.
Still, not what i need, i don't want them deleted, just outside 🙂

#

OK, thanks, at least i know i can stop trying to find a way.

little raptor
#

2.06 is done

#

will probably be out in less than a month

supple matrix
#

yeah, i know... its just "in the works" is completely useless to me NOW 🙂

urban tiger
#

Ive done something like this, although its not the most performance friendly. You have a event handler on all AI then if they're in a vehicle, and their health reaches below a variable they become immune eject themselves, force ragdoll and then 'kill themselves' But thats alot of effort.

Small edit, no idea if that even works still this was about 3 years ago.

little raptor
#

I've never tried it

supple matrix
little raptor
#
_unit switchMove "AmovPercMstpSrasWrlfDnon"
#

try that

supple matrix
little raptor
#

I mean it does force "AI" to eject

#

just wasn't sure about the dead

#

so now I know

urban tiger
#

if they're already dead, you can just 'replace them' and do the same process?

supple matrix
#

what do you mean "replace them"?

urban tiger
#

Delete them and spawn a alive unit back in the same place

#

do the thing it needs to do. and set them dead again

#

If it stupid but works 😂

supple matrix
#

That is too much work - i would need to copy their identities and looks, what they are wearing, their equipment, magazines and ammo in them, ...nope, i am NOT going to do that 🙂

little raptor
#

not really a lot of work...

supple matrix
#

I'll just wait and hope that this really does get addressed in the upcoming patch.

supple matrix
# little raptor not really a lot of work...

We can argue all day about what is or isn't a lot of work, so maybe its not a LOT of work, but it makes no sense to waste time on this IF the core issue is supposed to be solved in next patch (i just hope that it does).

little raptor
supple matrix
#

anyway, thanks

urban tiger
supple matrix
little raptor
urban tiger
#

wait a second current is 2.04 and dev is 2.06.. what happened to 2.05?!

little raptor
#

2.05 is DEV

supple matrix
little raptor
winter rose
#

it is doable, but anyway
you want to wait 😉

urban tiger
supple matrix
# winter rose it is doable, but anyway you want to wait 😉

what do you mean is doable? to delete the units and make clones? or to get them out of the vehicle?
If its about the clones, then nope, not interested, but if its about getting the actual units out of the vehicle, then please share, i am all ears.

fair drum
#

anyone know which addon file contains the location logic modules?

little raptor
fair drum
little raptor
#

are you sure they're even modules?

fair drum
supple matrix
#

Ok, so... you can actually get dead units out from a destroyed vehicle using unassignVehicle and setPos, or maybe other/similar command combinations.

BUT ONLY if the units were alive when the mission started!
If you set the unit health in editor to 0%, it won't work with that unit anymore.

Which makes me wonder what exactly is it that those units lack (group? center?).
Can it happen that even units that used to be alive, after enough time loose whatever it is those insta-dead units never had, causing it not to work anymore even on units that used to be alive?

little raptor
#

I found this in the function viewer:

#

but locationArea_F, locationBase_F are not modules

#

(they don't have module attributes at least)

#

¯_(ツ)_/¯

fair drum
#

yeah i was looking at that but not sure how using the editor locationBase_F or others contributes to that function as it looks like they somehow get registered to locations before this function

little raptor
#

well they have a special "systemLocation" class...not "Modules"

#

maybe they're handled by the engine

fair drum
#

just interesting that the game has been out this long and there is minimal documentation on the logic modules and what they truly do.

little raptor
supple matrix
little raptor
#

which problem?

#

editor units?

supple matrix
#

the problem that once unit dies, after some time it looses its group/center/AI/whatdoyoucallit and as a result of that it becomes impossible to move it out of a vehicle (like i desribed in my previous post)?

little raptor
#

yes

supple matrix
#

😄 by "yes" you mean this problem will persist even in the 2.0.5/6 update, or that the update solves this problem too?

little raptor
#

it's fixed. dead units can be moved out of vehicles (even if the vehicle itself is dead). it doesn't matter how long either have been dead.

urban tiger
#

Hopefully my brain isn't stuck in another language but I seem to be blank walling on this in SQF

Without using a bunch of count, is it possible to product a if/for that checks its an players has x amount of items in an array ie [["FirstAidKit",1],[ "ToolKit",1]]

little raptor
#

there's a new command coming in 2.06 called uniqueItems or something

#

which does

urban tiger
#

Leopard have you turned into the 2.06 salesman? pikachusurprised

little raptor
#

yes! 😄

#

but anyway, the fastest way is probably this:

_items = ...;
_uniqueItems = _items arrayIntersect _items;
_itemCounts = _uniqueItems apply {
  [_x, count _items - count (_items - [_x])]
};
undone flower
#

question about the mission event handler "Group created". does it includes groups already created, like in the editor?

little raptor
#

yeah. it's also faster than using {} count _array

winter rose
urban tiger
undone flower
undone flower
#

like ones spawned by scripts

winter rose
#

group eh + delay (as the EH fires on group creation, before unit creation)

undone flower
#

mhm, I was thinking on the delay too

#

anyone knows a tutorial to make and package a script mod? I pretty much got all the scripts done

urban tiger
#

How would you make a foreach only trigger if all elements are possible

_stuff = [["FirstAidKit",2],["ToolKit",2]]; 

{ 
    
 _nested = _x; 
 _Varitem = _nested select 0;
 _VarQty = _nested select 1;
 varKits = { _Varitem == _x} count (items player);
 { 
  systemchat format ["%1 %2", _Varitem ,_VarQty]; 
 } forEach _nested; 
     if(_varQty <= varKits) then {    
            for "_i" from 1 to (_varQty) do {
            player removeItem  _Varitem;
        };
    }; 
} forEach _stuff;

ps Leopard if you say 2.06.. MillerTarget . its getting late ok. 😂

little raptor
#

the syntax highlighting your should use is SQF btw

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
urban tiger
#

Fixed 😉

little raptor
#

isn't _VarQty already the number of _Varitem in items player?

urban tiger
#

So _VarQty is the amount of items to remove from the player inventory

little raptor
#

just do it the way I wrote then

#

make a foreach only trigger if all elements are possible

#

not possible without looping already

#

a few mistakes I spotted in your code:

  1. using items in every iteration of the loop( items player). this is slow-ish. save it into a variable outside the loop
  2. varKits is a global var
{ 
  systemchat format ["%1 %2", _Varitem ,_VarQty]; 
 } forEach _nested; 
```you need only 1 system chat
urban tiger
#

system chat is just there for testing

little raptor
#

yeah I know

#

just saying

#

¯_(ツ)_/¯

#

anyway, like I said {} count _array is slow

#

doing it the way I wrote is faster

urban tiger
#

im not on 2.06

little raptor
#

count _items - count (_items - [_x])

#

I mean this

little raptor
little raptor
urban tiger
#

I'm sure im going potato brained. Might be worth a break as im completely blank walling at this

#

(and its not even hard stuff. #LearningNewSyntaxWillBeFunTheySaid )

chilly bronze
#

does vectorDir also change object pitch at all?

chilly bronze
#

how would you calculate a vectorDir such that it doesn't affect the pitch, only orientation on the xy plane?

#

if possible

little raptor
little raptor
urban tiger
# little raptor `count _items - count (_items - [_x])`

surely

_varI=0;
_stuff = [["FirstAidKit",2],["ToolKit",2]]; 
_itemReq = count _stuff;
{ 
    
 _nested = _x; 
 _Varitem = _nested select 0;
 _VarQty = _nested select 1;
 varKits = { _Varitem == _x} count (items player);
     if(_varQty <= varKits) then {     _varI = _varI + 1;  };
} forEach _stuff;

if{_varI == _itemReq} then {...}else{...};

Would do the same and not much performance difference ?

little raptor
#

I don't know what you're referring to
but what you wrote is still slow (probably even slower than before)

urban tiger
#

0ms though

its needs to have a check to make sure if the player has 2 ToolKits before it even takes a single FirstAidKit

little raptor
#
_stuff = [["FirstAidKit",2],["ToolKit",2]];  
_items = items player;
_cntItems = count _items;
{
   _x params ["_item", "_cnt"];
   _cntItem = _cntItems - count (_items - [_item]);
   if (_cntItem  >= _cnt) then {
      for "_i" from 1 to _cnt do {
            player removeItem _item;
      }
   }
} forEach _stuff;
little raptor
#

your if is wrong

#

for the record, you can't have 0 ms

undone flower
#
{

    [_x] spawn |!!!|FABHH_fnc_infAmmoInfAttachEH;
    
} forEach (allUnits);

// FUNCTIONS

FABHH_fnc_infAmmoInfAttachEH = {

    _infantry = param[0, objNull, [objNull]];
        _infantry addEventHandler ["Fired", {
              [blahblah]
        };
};
 ``` on the |!!!|, it's throwing me an "undefined variable in expression". am I missing something ?
little raptor
#

yes

#

your function didn't compile

#

it's wrong

undone flower
#

strange, on code performance it says 0.00007 ms. it has been compiled, wasn't it?

#

no scripting errors whatsoever when it's just the function

little raptor
#

also:

0.00007
sounds impossible think_turtle

undone flower
# little raptor > on code performance it says 0.00007 ms what do you run?

just the function:

FABHH_fnc_infAmmoInfAttachEH = {

    _infantry = param[0, objNull, [objNull]];

    _infantry addEventHandler ["Fired", {

        params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
        
        if ((_unit ammo _muzzle) == 0) then {
                    
            if (not ((_magazine) in magazines _unit)) then { // only add if no more magazines of a kind found in unit's containers.
            
                [_weapon, _unit, _magazine] spawn FABHH_fnc_delayedAddMagazineInfantry;
                        
            } //end if
    
        }; //end if

    }]; //end EH

};
urban tiger
little raptor
#

but what you posted was wrong

undone flower
little raptor
urban tiger
versed widget
#

that ammo should be _ammo instead?

little raptor
#

if the case is correct it won't

urban tiger
#
_stuff = [["FirstAidKit",2],["ToolKit",2]];  
_items = items player; 
_cntItems = count _items; 
{ 
 
 _VarQty = _nested select 1;   
   _cntItem = _cntItems - count (_items - [_item]); 
   if (_cntItem  >= _cnt) then { 
      for "_i" from 1 to (_varQty) do { 
            player removeItem  _Varitem; 
      } 
   } 
} forEach _stuff;

the _cntItem returns 0

little raptor
#

you didn't define item

#

just copy paste the code I wrote

undone flower
#

I moved the functions above it and now it's recognizing

little raptor
#

that's not how you define functions in the first place

#

¯_(ツ)_/¯

undone flower
#

strange cus I defined functions like that before and it ran just fine

little raptor
#

no it won't

#

sqf is sequential

urban tiger
undone flower
#

oh they were all defined in description.ext

#

nevermind aviator

little raptor
#

should work correctly as it is

urban tiger
#

hence why i put the second count

little raptor
#

it already checks that...

#

remove 2 firstaidkits even if they have no toolkits
meowhuh

#

so you don't want anything to be removed unless all counts match?

urban tiger
#

Yeah, what ive said the whole time meowhuh

little raptor
#

meowsweats
well that requires two loops then

urban tiger
#

why i had the original 😂 loop doing the count

little raptor
#
_stuff = [["FirstAidKit",2],["ToolKit",2]];  
_items = items player;
_cntItems = count _items;
_allMatch = true;
{
   _x params ["_item", "_cnt"];
   _cntItem = _cntItems - count (_items - [_item]);
   if (_cntItem  < _cnt) exitWith { _allMatch  = false};
} forEach _stuff;
if (_allMatch) then {
  {
    _x params ["_item", "_cnt"];
    for "_i" from 1 to _cnt do {
        player removeItem _item;
    }
  } forEach _stuff;
}
#

you can also use findIf

urban tiger
#

wait you can just do _allmatch like that?!

#

just going to go to the shame corner

#

Its getting way to late, think its time for sleep. Cheers for the help Leopard. blobcloseenjoy

distant oyster
#

also cool:

_allMatch = {
   _x params ["_item", "_cnt"];
   _cntItem = _cntItems - count (_items - [_item]);
   if (_cntItem  < _cnt) exitWith { false };
   true
} forEach _stuff;
``` forEach returns the last evaluated expression of the loop
little raptor
#

yes but you're returning the value every time at the end of the loop notlikemeow

#

might as well use findIf

#
_allMatch = _stuff findIf {
   _x params ["_item", "_cnt"];
   _cntItem = _cntItems - count (_items - [_item]);
   (_cntItem < _cnt)
} == -1;
#

¯_(ツ)_/¯

undone flower
#

does too many functions performing sleep negatively impact performance in a significant way?

winter rose
#

too many functions is the issue, not sleep

undone flower
#

the functions i'm using are a couple of ifs and binary comparisons. should be fine

winter rose
#

that's commands

chilly bronze
#

what's a good way to terminate a script instantly when a condition is met? spawn another script that has the script handle, check the condition every second, then terminate using handler?

#

the main script cant always check since it's busy sometimes

supple matrix
#

Ahh, damn planes still explode when you ditch them in water.
Is this something hardcoded?

I am using "HandleDamage" event handler to prevent the plane from exploding when it crashlands on the land, but water still kills it.
Is it because i had to make some mistake in my EH, or do i need to look somewhere else for the reason why water+plane=explosion?

#

Hmm, when i add this allowDamage false into the plane's init field, it just peacefully submerges, no explosions.
But running this command inside the "HandleDamage" event handler after checking whether the surface is water, still has no desired effect (and it runs, logs verify the line was executed, so the water condition is fine, and i even tried it without it just to be sure).

warm hedge
#

Ain't understanding the context entirely but can you do plane setDamage [1,false]?

supple matrix
#

in theory yes, but where do you suggest i do that? in the "HandleDamage" EH?

#

...it can't hurt

#

wait what? no! i don't want to setDamage 1! 😄
Why would i do that, i want to prevent the destruction of the plane.
Or do you mean i should try to destroy the plane without accompanying effects (the "false" param), so when the game decides to destroy it later, it will be already destroyed so it won't do anything?
...that is an interesting idea 🙂 its one of those that sound so crazy it may just work 🙂

#

.
Well, using plane setDamage [1,false], be it inside the "HandleDamage" EH or a bit later but still on the dry land, makes the plane explode right in that moment.
Apparently, the "false" parameter is being ignored (or is misunderstood? but i don't know how else to interpret "false to skip destruction effects" than that if you use the "false" parmaeter, it will skip destruction effects like explosions, fire, brimstone, locusts, etc.)

#

.
I just want to prevent the plane from exploding when it goes underwater.
if i ditch it carefully enough, i can even see it float for a few seconds, then slowly sink, exactly as i would expect it to do, but after a while of it sinking, it usually explodes.
Or if i slam it into the water without even trying to slow it down, it explodes on impact (which wouldn't bother me so much, IF the careful ditching would also not result in explosion just a bit later).
But thats just the water, if i do the same thing on dry land, the "HandleDamage" event handler i use prevents any explosions (only if the damage seems to come from colliding with other objects. If it is the terrain itself, the explosion usually does happen, especially if the impact is hard and/or if the plane is flipped upside down).

#

Correction: it isn't working at all now.
Even with simple _this addEventHandler ["HandleDamage", {0}]; which afaik should prevent any non-scripted damage like due to collisions, the plane still explodes.

#

even if i do:
_this addEventHandler ["HandleDamage", {(_this select 0) setDamage 0; 0}];
...the plane still instantly explodes when i slam it into the ground.
Am i forgetting something? or is this normal???

#

If i start with the plane on one side of the runway and accelerate to ~120+kmh and slam headfirst into a concrete wall i placed on the other end of the runway, there is no problem.
In this case, the EH "HandleDamage" negates any damage the plane receives.
But if i take off and slam it into the ground - instant explosion no matter what.
This makes no sense and is driving me crazy, please save my sanity.

#

Something very weird is going on.
Speed is not a factor - even if i start with the plane in the air and fly it into that wall head first at ~300kmh, the plane does not explode (obviously thanks to the "HandleDamage" EH).
But if you substitute the concrete wall with a terrain, it results in an instant explosion (despite using the same "HandleDamage" EH).
This is bad, please tell me there is a way to fix this, that i am just doing it wrong.

EDIT: (in case it matters, this is all done with the Caesar BTT plane)
Even after setting the destrType to DestructNo in plane's config, the vehicle still gets destroyed on hard terrain impacts (starting with plane at 800m ATL, and slamming its nose into the terrain underneath).
And it is not just the visual effects (which would be still wrong of course), because damage MY_PLANE returns 1 after this happens.
And this is all while still using MY_PLANE addEventHandler ["HandleDamage", {0}];.

Water remains deadly as it ever used to be, but no explosion anymore, just the vehicle's associated damageEffect which in this case is AirDestructionEffects, and the player still gets ejected out of the plane which should only happen when it gets damaged enough (AI stays in though, which i find strange, but maybe its normal, i cannot say).

EDIT2: After setting vehicle config value of destrType to DestructNo, and damageEffect to empty string (mainly to make sure it isn't the damageType="fire", the fire effect has, that is destroying the plane), there are no more visual effects as expected, but the plane still gets destroyed in water, or on hard terrain impacts.
Still using MY_PLANE addEventHandler ["HandleDamage", {0}];
Still getting 1 from damage MY_PLANE
Still getting player ejected, but AI stays in.

My conclusion:
Even if the destrType set to DestructNo isn't supposed to prevent damage, it doesn't change that there is still something circumventing the "HandleDamage" EH.

supple matrix
#

A tiny bit of progress...
If i use the following EH code, the plane often does survive the crash into ground, except if i flip it upside down.
But crashing into the water is still a guaranteed explosion.

    private _v = _this select 0;
    _v setDamage 0;
    _v setFuel 0;
    _v setHitPointDamage ["HitEngine", 0];
    _v setHitPointDamage ["HitHull", 0];
    _v setHitPointDamage ["HitRotor", 0];
    _v setHitPointDamage ["HitFuel", 0];
    _v setHitPointDamage ["HitFuel2", 0];
    0
}];```
(not sure if setting all those hitpoints is needed, its just how i have it at this moment)
#

Isn't this ripe for a ticket?
If there is a feature that is supposed to prevent damage (returning value from the "HandleDamage" EH), and it is not preventing damage, then... that must be a bug, right?

little raptor
copper raven
#

yeah, damage of a collision with other vehicle/water etc usually always goes through, even though you got a handledamage with a 0 constant return

split oxide
#

Is there a scripting approach (without any config file creation) to increasing AI artillery dispersion or is the only answer essentially calling in each round as a doArtilleryFire with manual dispersion?

west grove
#

looks like BIS_fnc_AAN was changed at some point. does anyone still have the original function by chance? :/

#

i remember reading about a change there a long time ago. but i didn't expect the old one to be overwritten...

#

god damnit. looks like this is not a script, but some config change

#

i guess my day is ruined now

#

shoutout to polpox and his aan script on the workshop. seems this saved my day.

winter rose
past gazelle
#

Is it possible to put a tab character in systemchat() ?

pure socket
#

hello everyone can i have a question about ui,where can i ask?

past gazelle
copper raven
past gazelle
#

Thank you. I've been looking 20 minutes for this page 🙂

#

Wait, what do you mean via source code? in the sqf?

copper raven
past gazelle
#

Hmm, I don't think systemChat supports tabs...

cosmic lichen
#

What am I missing here? Using the following path with fileExists/loadFile doesn't work, pasting it into the File Explorer however, will open it up

"c:\users\XXXX\onedrive\dokumente\arma 3 - other profiles\r3vo\missions\testing\scriptlibrary.vr\functions\scriptLibrary\fn_exportFunctionsToWiki.sqf"

digital rover
#

Have you tried it without the .sqf extension?

#
"c:\users\XXXX\onedrive\dokumente\arma 3 - other profiles\r3vo\missions\testing\scriptlibrary.vr\functions\scriptLibrary\fn_exportFunctionsToWiki"
mental wren
#

The path looks like something that should be declared in CfgFunctions?

cosmic lichen
#

yeah, you are right. It should be functions\scriptLibrary\fn_exportFunctionsToWiki.sqf"

real epoch
#

Hello,
I want to call the specator mode via a function and immediately jump to a specific person in the 3PP view.

At the moment i have it like this:
["Initialize", [player, [], true]] call BIS_fnc_EGSpectator;
[_target] call BIS_fnc_EGSpectatorCameraPrepareTarget;
[_target] call BIS_fnc_EGSpectatorCameraSetTarget;

But there I only jump to the position of the target but don't track it auromatically like for example in the 3pp view.

Are there any other options?

copper raven
#

it changes the camera mode to 3pp aswell, because there is a free look option too, which doesn't make the camera follow, only track

foggy hedge
#

can someone double check my remoteExec? I can't get playMusic to work when specifying a start parameter (TAS_S14 is modded music, just replace with RadioAmbient3 if you try to run it)

["TAS_S14", 28] remoteExec ["playMusic"];```
little raptor
#

The one to last example

foggy hedge
#

Thank you! Forgot that it would need double brackets

undone flower
#

guys, do not make an event handler that calls itself without a stop condition, it's bad for your arma's health

uncut sphinx
#

Music event handlers do not seem to persist when game is loaded from save in singleplayer, anyone know if this is intentional behavior?

wet shadow
#

Does anyone know is its possible to control the curatorCameraArea ceiling via script commands. addCuratorCameraArea seems to set the ceiling to the default value of 2000m.

crude vigil
wet shadow
crude vigil
undone flower
#

where can I paste my .sqf script so someone can take a look at it?

crude vigil
wet shadow
crude vigil
wet shadow
#

But how else would I detect the curatorCamera if the player is not in curator view? 😅

crude vigil
wet shadow
#

I do not follow. curatorCamera is a local command that returns ObjNull if the player is not using the curator view.

undone flower
wet shadow
#

And I can't come up with any better ideas how to get the cameraObject that I need.

crude vigil
crude vigil
wet shadow
#

I guess that would explain it.😩

past gazelle
#
 3:57:20 Error: Error during SetFace - class CfgFaces.Man_A3.whiteface_11 not found```
#

Getting this error in the RPT yet the face appears to be setting properly...

#
this setFace "whiteface_11";```
crude vigil
# wet shadow I guess that would explain it.😩

It actually works but not for curatorCamera for ... reasons I guess 😅 (tried on a camCurator created manually). If you really want to achieve that, you can maybe create a new camera and give it to the player.

little raptor
#

¯_(ツ)_/¯

past gazelle
#

Yeah, I'm not sure why I had it in there to be honest...must've had a problem with something when I was testing multiplayer maybe?

#

Way too much arma this last week. But it was a good vacation. 🙂

ornate marsh
#

so trying to use this script to switch to a weapon after it's been added, however it won't work with underbarrel grenade launchers, because _muzzles select 0 is this , rather than the actual first muzzle. Is there an alternative?

_checkWeapon = primaryWeapon _caller
_muzzles = getArray (configFile / "cfgWeapons" >> _checkWeapon / "muzzles");

    if (count _muzzles > 1) then
    {
        _caller selectWeapon (_muzzles select 0);
    }
    else
    {
        _caller selectWeapon _checkWeapon;
    };

_caller is because it's from an addAction

undone flower
ornate marsh
#

i have, this is what happens on the SOG SKS ["this","vn_sks_22mm_gl_muzzle"]

crude vigil
#

You want to make caller select GL?

ornate marsh
#

add a weapon, and then automatically equip it with the first muzzle selected.

#

but just using _caller selectWeapon _checkWeapon doesn't work on weapons with 2 muzzles

crude vigil
ornate marsh
#

cause i'm removing a weapon earlier in the script and then adding a different one later, and wanting to automatically switch to it after adding it

crude vigil
#

You just took the code from selectWeapon's example I believe

ornate marsh
#

i altered it to fit into my script yes, but then noticed that the first muzzle was this so wouldnt work

#

and it says on the wiki: Rather than simply using selectWeapon to select your default weapon after adding them to your player, it is recommended you use a script instead similar to the following, which caters for multiple muzzles:

crude vigil
#

I dont know why there is such example (it is from 2008 so maybe due that) but considering the muzzles array of a weapon always returns "this", it is not useful for you at all. I dont see the point of that condition at all if you wont choose muzzle bigger than 1.

little raptor
#

if it's this you just have to use the current weapon class

crude vigil
#

You just need to use _checkWeapon itself

ornate marsh
#

right, so do I want to alter the if statement to check if _muzzles select 0 == this?

little raptor
#

if (count _muzzles > 1) then
{
_caller selectWeapon (_muzzles select 0);
}
else
{
_caller selectWeapon _checkWeapon;
};
both are doing the same thing

#

(after you correct it)

ornate marsh
#
if (count _muzzles > 1 and _muzzles != "this") then
    {
        _caller selectWeapon (_muzzles select 0);
    }
    else
    {
        _caller selectWeapon _checkWeapon;
    };
``` this should be right then?
little raptor
#

wat?

#

_muzzles is an array

ornate marsh
#

sorry, mispelled

crude vigil
#

1st index of muzzles should always be "this" afaik so it is redundant.

little raptor
#

which is why I said it's doing the same thing

ornate marsh
#

then what's the point of that example?

#

and why does it recommend it?

crude vigil
#

it is from 2008, so maybe back then...

#

when things were different?

#

The ancestors left us goods that are not true anymore

#

maybe?

ornate marsh
#

i guess so

#

select weapon still doesn't seem to work though

crude vigil
#

why dont you just do selectWeapon primaryWeapon of unit?

little raptor
#

afaik it never works that way anyway

#

there was a note by KK on the BIKI

#

for force switching weapons by the player

ornate marsh
ornate marsh
little raptor
#
   // Here is a neat workaround trick for firemode change from a script:
    _weapon = currentWeapon player;
    _ammo = player ammo _weapon;
    player setAmmo [_weapon, 0];
    player forceWeaponFire [_weapon, "FullAuto"];
    player setAmmo [_weapon, _ammo];
little raptor
#

it probably does work

#

I've never tried it on player

ornate marsh
#

it seems dodgy, it works on the SOG MC-10, but not the SOG SKS, even though both of their primary muzzles are the same as the weapon classname

little raptor
#

but anyway, your script is wrong. so it would never work the way you do it

little raptor
#

what are you trying to do anyway?

#

switch weapons between GL and main weapon?

ornate marsh
#

Basically, a weapon, be it primary or handgun gets removed, and then a different weapon gets added later (same slot as the one that was removed). I am then wanting the game automatically switch to the newly added weapon.

crude vigil
#

Why is your code then looking to primaryWeapon, that part I did not get.

ornate marsh
#

i was just trying to get it working with primaryWeapon first

little raptor
#
_unit addWeapon _blabla;
_unit selectWeapon _blabla;
ornate marsh
#

nope, like I said, works with the MC-10, but not the SKS

#

i have to hop off the game for now so can't test further but that's how it was last time I checked

undone flower
#

is there a way to know if a weapon is single-use or not?

little raptor
#

as in disposable launchers?

undone flower
#

yeah

wet shadow
#

You could try to detect eventhandlers.

RHS Launchers have their own eventhandler in configFile >> "CfgWeapons" >> "rhs_weap_rpg75" >> "Eventhandlers" >> "RHS_DisposableWeapon"

ACE version of NLAW uses CBA_fnc_firedDisposable in configFile >> "CfgWeapons" >> "ACE_launch_NLAW_ready_F" >> "EventHandlers" >> "fired"

jolly jewel
#

Does anyone know how to calculate freefall time for bombs accurately?

#

I'm trying to make a script that makes planes drop bombs on things

#

The simplest solution I can think of is to "throw" the bombs in the direction of the target underneath the plane, it looks convincing enough if you don't look too closely, but it's still a bit hard to accurately aim

dim topaz
#

So... how do I make a friend take control of an AI by using "setOwner"?

#

How can I know the ID of the connected players?

fair drum
#

UID is getPlayerUID
client number is clientOwner but has to be fired locally

fair drum
somber radish
#

Anyone know where I can find the translation for "message Type_96" in the rtp file?

still forum
#

nowhere

somber radish
#

uuh

still forum
#

these are intentionally listed as obscure names

#

useful for developers, useless for users

somber radish
#

Thing is I got about 400 of those

#

but meh

somber radish
#

So is there any way I can do some exception handling for theese?

Server: Object 5:64 not found (message Type_96)
Warning: no type entry inside class Hud_1/controls/Attributes 
dim topaz
fair drum
dim topaz
#

On this particular mission, I'll be playing as Zeus and some friends as soldiers.

I want to change the units they control after a certain point

#

@fair drum

#

It would be an existing AI

fair drum
dim topaz
fair drum
#

the simple answer is

[unitName] remoteExec ["selectPlayer", clientNumberHere]

but you won't know your client numbers without having those clients give it to the server, multiple ways to do that. THEN you need to sift through those numbers correctly.

you probably could do

[newUnitName] remoteExec ["selectPlayer", oldUnitNameControlledByPlayer]
#

but you need to make sure only the server is doing this

dim topaz
#

Hmm, I think I got it

somber radish
fair drum
#

that only changes locality

chilly bronze
#

anyone able to see why i'm getting "undefined variable _jet?" wasn't getting this error at all earlier

`fn_patrol = {
params["_origin","_jet"];
_cruiseAltitude = 1000; // patrol altitude

// Cruise at altitude
_jet flyInHeight _cruiseAltitude;
// rest of function here

};

// initialize variables
_jet = _this;

_mapRadius = worldSize / 2;
_center = [_mapRadius, _mapRadius, 0];
[_center, _jet] call fn_patrol;
`

#

script is execvm'd on the vehicle

#

error as at _jet flyInHeight _cruiseAltitude;

fair drum
#

whats your execVM line?

chilly bronze
#

this execVM "jet.sqf";

#

theres more to the script that happens before and theres no issues with referencing _jet

fair drum
#

don't post half stuff. use sqfbin.com and post all of it

dim topaz
fossil peak
#

oh

#

we can't just put images of errors in here

#

that's annoying

#

anyone know what this error means

little raptor
little raptor
dim topaz
little raptor
dim topaz
#

There is no way to make it work then?

fair drum
#

after you transfer the player over

fossil peak
#

@little raptor I'm just trying to fix a script so I didn't even know it was for gui oof, since I got you here though how would I define it? Or is there somewhere I can look to find it?

fossil peak
#

tanks my guy

fair drum
# fossil peak <@!360154905148653568> I'm just trying to fix a script so I didn't even know it ...

if a mission:

import RscObject;
import RscText;
import RscFrame;
import RscLine;
import RscProgress;
import RscPicture;
import RscPictureKeepAspect;
import RscVideo;
import RscHTML;
import RscButton;
import RscShortcutButton;
import RscEdit;
import RscCombo;
import RscListBox;
import RscListNBox;
import RscXListBox;
import RscTree;
import RscSlider;
import RscXSliderH;
import RscActiveText;
import RscActivePicture;
import RscActivePictureKeepAspect;
import RscStructuredText;
import RscToolbox;
import RscControlsGroup;
import RscControlsGroupNoScrollbars;
import RscControlsGroupNoHScrollbars;
import RscControlsGroupNoVScrollbars;
import RscButtonTextOnly;
import RscButtonMenu;
import RscButtonMenuOK;
import RscButtonMenuCancel;
import RscButtonMenuSteam;
import RscMapControl;
import RscMapControlEmpty;
import RscCheckBox;

add that to your .hpp file before you do your hud stuff

#

if making an addon, use class instead of import

fossil peak
#

is that literally all the stuff to import lol

#

I appreciate it my man

#

I'll test it in a couple minutes

fair drum
#

just make another file with all the imports and stuff and do a simple #include in your config file at the top

fossil peak
#

got it thanks

#

How did I manage to crash my game doing that lmao

#

oh im an idiot

dim topaz
fair drum
dim topaz
#

Oh, that's unfortunate

fossil peak
#

right @fair drum @little raptor I sorted my crashing issue out and fixed the script thanks boys

dim topaz
#

One last thing, would you know how to force a player to join spectate mode once he enters an area, and leave spectator mode once he is out if that area?

fair drum
dim topaz
#

I would teleport him as Zeus

#

I wanted to make a checkpoint that instantly revives all dead players (excluding AI playable units), but this second alternative seems to be easier to do

fair drum
#

why not just use the respawn system and add some respawn tickets at the checkpoint?

dim topaz
#

I wanted the dead players to spectate until the others reach the checkpoint.

And I didn't want to tell you this, but... well, I'm having a hard time trying to figure out how respawns work

#

Oh, another thing is that when a player respawns, they reset their loadouts for some reason

fair drum
old basin
#

hopefully this is the right channel, so currently the unit im in has a ACE interaction to change the camos on a set piece of armour which overwrites the texture on the armour when you switch it I was wondering if there was a way to instead of having it overwrite the current texture to change it back to its base texture if there was a way to have it reset the texture

bitter solstice
#

hi, im not sure what im doing wrong but i cant seem to get the setvectorup to actually change the direction of the vehicle im using it on (trying to make a tank sit upside down atm)

bitter solstice
#

tried both in zeus and eden

little raptor
#

I mean the code you use

bitter solstice
#

oh "this setVectorUp[0,1,0];" and the variatinos of - and 1s

#

no transform is done on any of them

#

im very new to scripting as a whole so might just be me not udnerstanding something basic here

little raptor
#

meowsweats
To make it upside down you should put [0,0,-1]

bitter solstice
#

tried that already

#

as i said, tried the variations of 0s, 1s and -1s

little raptor
bitter solstice
#

as far as i can tell yes

little raptor
#

maybe it's the crew

bitter solstice
#

no cvrew

#

*crew

little raptor
#

But sill there's no telling if it works at all in init

little raptor
bitter solstice
#

you can do that?

little raptor
#

Yes

bitter solstice
#

i knew you can in the compas directions

little raptor
#

iirc key 2 or 3

#

not sure which

#

opens the rotation tool

bitter solstice
#

thanks, this really isnt well documented online

little raptor
#

It was iirc

bitter solstice
#

thanks a bunch for this. il keep looking if i can get that into zeus. shame i was dug innto the wrong rabbit hole then

little raptor
old basin
little raptor
old basin
#

the current way we use the interaction it takes a texture and applies it to the pieces that the player is wearing (uniform helmet backpack). when you select another texture it overwrites the old texture and applies the new one. I was wondering if there was a way to instead of overwriting the old texture and applying the new one, you could reset the texture to what it original was when you equipped the uniform.

little raptor
#

You can just get the default texture from the config.
I'm currently on mobile so can't really show you how

#

also one thing I still don't understand is, do you mean you want a toggle system? (switch between camo and original)

old basin
#

yes

#

its a ace interaction that we use to change camos each has its own interaction that applies the texture

#

I was trying to see if would be possible to just have a reset interaction so things like custom helmets can be reset too instead of having to add 10 different interactions to the list

#

if im still being confusing (which I probably am) I have a video of the interaction working but I dont have the exact script

cosmic lichen
#

As Leo said. You can always get the default camo from the vehicles' config.

#

So one action sets custom texture, another one gets default camo from config and applies it

old basin
#

right but that would require a separate interaction for each custom helmet right?

cosmic lichen
#

Not really

#

No matter what helmet you just get the default camo from its config

old basin
#

so one interaction can be done to reset the texture of the armour even if its a different helmet for each player

cosmic lichen
#

In theory yes

old basin
#

and that would require no extra effort for the player once the script is set up except pressing one button which would work for all of the helmets

cosmic lichen
#

If done correctly, yes

old basin
#

cool

#

im sure ill be able to convey this perfectly

proud carbon
#

Hey

#

I have this MP issue where this works on my normal. but while testing on a server during an op it just doesn't go as it should.

winter rose
#

that's locality issue for you!

proud carbon
#
 if(isPlayer _x) then
{
    _passengers pushback _x;
    removeAllItems _x;
    removeAllAssignedItems _x;
     removeBackpack _x;
    _x addBackpack "B_Parachute";
};
#

so this works

#

while i play off of my rig

#

and the main server when I tested this like 10 mins ago was all yeah nah

full otter
#

Where did you enter that

proud carbon
#

in a Sov_fnc_PlaneLineDrop

proud carbon
#

so if I add this ```_OdinPlayer = _x
{
[_OdinPlayer] remoteExec [_x,_OdinPlayer,true];
[_OdinPlayer] remoteExec [_x,2,true];
} foreach ["removeBackpack","removeAllItems","removeAllAssignedItems"];

#

I could be good?

winter rose
#

[_OdinPlayer] remoteExec [_x,2,true];
why

#

don't set JIP to true here, it's useless and adds weight to the JIP queue

proud carbon
#

what does that last part mean?

winter rose
#

you are saying "if a JIP player connects, re execute these commands"

proud carbon
#

I do have a for each with each command so i can shorten the length of the script

#

oh god

#

ok

winter rose
#

the best thing would be to have one CfgFunctions function to do that, so you only removeExec the function's execution

#

so e.g addBackpack doesn't execute before removeAllItems

#

(as remoteExec order is not guaranteed…)

proud carbon
#

so how come a remoteExec isn't guaranteed?

crude vigil
winter rose
crude vigil
#

Why are you even doing it that way, just use Global versions of the commands?

proud carbon
#

or is the order not a thing that will happen all the time but will go through anyway?

crude vigil
#

All will go through, it is just a question which one will reach first and also which one will be executed first I believe.

#

But why are you doing it like that, that part I dont get it?

proud carbon
#

so a friend recommended I change my remoteExec to remoteExecCall

crude vigil
#

still doesnt guarantee

proud carbon
#

Yes or no?

#

does it improve anything?

winter rose
#

not in that case

#

don't listen to that friend 😄

crude vigil
#

it is the difference of [] call {} or [] spawn {} for remote , nothing else

proud carbon
#

so remoteExecCall is just call but over the net?

crude vigil
#

Yes

proud carbon
#

I didn't think there was

crude vigil
#

just use it , u dont need to bother with remoteExec at all

proud carbon
#

I thought those commands were the global in a sense