#arma3_scripting

1 messages · Page 641 of 1

umbral nimbus
#

anyone recalls what Im talking about?

#

cant find it on google

winter rose
#

playMission?

umbral nimbus
#

Yes thats part of it

#

Can we force players to empty slots? or was that VBS3?

oblique arrow
#

do you mean force them out of slots or into empty slots? @umbral nimbus

umbral nimbus
#

I think I found it

oblique arrow
#

Mmh you could use autoassign in the mission attributes, but that forces people into random slots

umbral nimbus
#

yeah

#

although that wouldnt be a big issue for my case.

#

But being able to put them in specific slots would be great

#

unless someone has an idea how. Ill go for the random slots

#

then forcing the mission to start when all connected players are assigned would be the last step..

obtuse quiver
#

if you are an admin you can switch players roles

#

dunno if that helps

umbral nimbus
#

skipLobby

When enabled, joining player will join the mission bypassing role selection screen. The joinUnassigned param will be set to 1 automatically, so that player receives first available role from mission template. When leaving such mission, player will go straight back to server browser.

#

Thats what I need 😎

#

So on a trigger, I exectute saveloadout of the players to their profile namespace.

Execute "playmission".

Have fhe next missionnset to skiplobby and skip briefing.

And beng mission starts on Altis. Asif they travelled there

#

😎 👍

#

Thanks my Discord Rubber Ducks

obtuse quiver
#

sweet, you actually gave me an idea

umbral nimbus
#

You're welcome

quasi sedge
#

How to get path to this bad boy

#

DisplayName of gunner selected ammunition

#

here is my shitty non working code again

(configfile >> "CfgWeapons" >> vehicle player currentWeaponTurret  >> "displayName");
winter rose
#

vehicle player currentWeaponTurret…

#

have you heard about our Lord and Saviour the biki?

robust hollow
#

you may be unaware of this lou, but writing random stuff hoping it'll work is superior in all of the ways 😉

robust hollow
# quasi sedge How to get path to this bad boy
private _vehicle = vehicle player;
private _magazine = _vehicle currentMagazineTurret (_vehicle unitTurret player);
getText(configFile >> "CfgMagazines" >> _magazine >> "displayNameShort");
oblique arrow
#

Hm, how can I activate a trigger, if a certain type of vehicle is in it?
I already tried
"UK3CB_TKC_C_V3S_Closed" in thisList;
But that didnt do the trick

robust hollow
#

"UK3CB_TKC_C_V3S_Closed" in (thisList apply {typeOf _x}); maybe 🤷

#
thisList findIf {typeOf _x == "UK3CB_TKC_C_V3S_Closed"} != -1``` a slightly better version of that, but isnt really good either way because its a frequently repeating loop.
oblique arrow
#

Hmm nop

obtuse quiver
#

I made script that plays a sound from a radio, it works really well but when im in range i have sudden lag spikes and stutters, is this happened to anyone?

robust hollow
oblique arrow
#

Huh

lofty lily
#

how does one add multiple sound files to a mission or is that not possible?

robust hollow
#

uhmmm.... you add one, then you do it again.

lofty lily
#

it keeps saying that file isnt found

robust hollow
#

if it is in the mission then the filepath you're using is incorrect

lofty lily
#

ok

oblique arrow
#

got the latest code in the condition field, and a (working) hint in the on activation field, but it no worky

oblique arrow
robust hollow
#

wrong class name?

oblique arrow
robust hollow
#

my last guess would be to try with typeOf vehicle _x, but i didnt need to

oblique arrow
#

typeOf vehicle player

"UK3CB_TKC_C_V3S_Closed"

#

so that isnt the problem

winter rose
#

shooow the whole thiiing

robust hollow
#

no in the condition

winter rose
#

also is your trigger set to repeatable, any, etc?

robust hollow
#

^ + also make sure your trigger activation type is set correctly

winter rose
#

I'm sure he wants to get spanky

oblique arrow
#

didnt have the activation type set up correctly

winter rose
oblique arrow
#

Now I can continue working on my bridge building simulator heh

lofty lily
#

class CfgSounds {
sounds[] = {};

class Playlist
{
name = "Playlist";
sound[] = {"music\Playlist.ogg",1,1,.01,1,1,1,0}; //The 18 indicates the distance at which the sound will be heard;
titles[] = {};
};
};
class Speaker
{
name = "Speaker";
sound[] = {"music\Speaker.ogg",1,1,.01,1,1,1,0}; //The 18 indicates the distance at which the sound will be heard;
titles[] = {};
};
};

#

anyone see anything wrong with this code

#

that is saying the second sound file cant be found

oblique arrow
#

or am I missing an open bracket?

lofty lily
#

im not sure

#

does the second sound file have to be in its own folder?

robust hollow
#

yea, class Speaker should be inside class CfgSounds

class CfgSounds {
    sounds[] = {};

    class Playlist
    {
        name = "Playlist";
        sound[] = {"music\Playlist.ogg",1,1,.01,1,1,1,0};    //The 18 indicates the distance at which the sound will be heard;
        titles[] = {};
    };
    class Speaker
    {
        name = "Speaker";
        sound[] = {"music\Speaker.ogg",1,1,.01,1,1,1,0};    //The 18 indicates the distance at which the sound will be heard;
        titles[] = {};
    };
};
oblique arrow
#

Okay I have another question about the truck in trigger thing bongocat
Whats the best/right way to then get that truck as a variable?

robust hollow
#

how do you mean?

oblique arrow
#

being able to assign that truck a variable like _truck

#

so that I can do stuff with it like deleting it

robust hollow
#
private _index = thisList findIf {typeOf _x == "UK3CB_TKC_C_V3S_Closed"};
private _truck = thisList param [_index,objNull];```
oblique arrow
#

bongocat thank you

narrow pollen
#

Is it possible to add new fields to a music class? Basically, if I add a new field, do the other fields like music-path, name etc still exist? Even if I do not declare them again?

little raptor
narrow pollen
#

Alright, I'll move the convo to there, you're right

umbral nimbus
#

Doesnt seem that playMission works from the 3D world

warm hedge
umbral nimbus
#

excatly

#

any alternatives?

warm hedge
#

Most unlikely

umbral nimbus
#

hmm

#

#mission <mission name> does give this capability. Would be nice to have it as a scripting command

umbral nimbus
#

Not in the normal list then?

winter rose
#

serverCommand

umbral nimbus
#

ooh

#

oooh nice

hollow lantern
#
        switch (_x in (_vehicle weaponsTurret [-1])) do
        {
            case "rhsusf_weap_CMDispenser_M130":
            {
                for "_fire" from 1 to 4 {
                _pilot forceWeaponFire ["rhsusf_weap_CMDispenser_M130", "AIBurst"];
                sleep 1;
                };
            };

            case "rhsusf_weap_CMDispenser_ANALE39":
            {
                for "_fire" from 1 to 4 {
                _pilot forceWeaponFire ["rhsusf_weap_CMDispenser_ANALE39", "AIBurst"];
                sleep 1;
                };
            };
        };``` Can one help me in optimize and fix that switch? 
1.) I think I should use a ``forEach`` to execute that  forceWeaponFire line probably?
2.) My switch statement seems not working, not 100% sure why
copper raven
hollow lantern
#

ah yeah thanks for that

umbral nimbus
#

https://youtu.be/hlmgw_dyELw

This is what I can get out of it with switching mission through a trigger.
usering the serverCommand with #mission

but I cant get rid of that endmission screen. debriefing = 0 in description.ext

winter rose
#

maybe switchMove

#

setDamage 1 then 😄

#

idk really
what is that unstoppable action?

#

I can only speak for vanilla, sorry

quasi rover
#

Is there a way to inverse selection of nearObjects ? i.e. I want to find objects only except the given range.

winter rose
#

you mean outside of given range?

quasi rover
#

yeap

winter rose
#

grab all objects in a big radius, then remove those from the small one 🤷‍♂️ I think this is the only way

#

for performance issue, store the "all objects" somewhere

quasi rover
#

how to remove from all objects? deleting elements from all objects array?

austere granite
#

i mean if there's specific things you're looking for theres probably better things you could do than huge radisu nearObjects

dusty badger
#

Could having too many groups cause performance issues?

#

I have noticed that count allGroups seems to go up the longer my missions run and im wondering why. I create and delete AI units dynamically, but groups ought to be accounted for in that.

#

It almost seems like when all of the units in a group are killed the group is not being deleted

robust hollow
#

the groups are likely not set to delete when empty. empty groups probably wont cause too big a performance issue, but there is a limit per side (255 i think).

dusty badger
#

is there a way to set them to do that automatically or would it need to be some sort of garbage collection script?

robust hollow
#

when you create groups you can use the createGroup alt syntax or use deleteGroupWhenEmpty any time after creation.

cosmic lichen
#

re is a limit per side (255 i think).
288 is the new limit

robust hollow
#

that..... is a weird number to stop at 🤔

cosmic lichen
#

nope

#

before it was 144

#

it was just doubled.

#

So the initial 144 is weird 😄

exotic flax
#

It's not a hard engine limit thought, just a limit in the config which generates the group names

cosmic lichen
#

oh is it?

exotic flax
#

Yup

#

It's a single class which needs to be modified, it's just not possible without modifying this .bin file (can't remember the exact name)

little raptor
hollow lantern
#

I need some advice if my approach is right or if I shouldn't use switch in that case. My current not working code is the following:

switch (_dispenser) do
        {
            case "rhsusf_weap_CMDispenser_M130":
            {
                for "_fire" from 1 to 4 do {
                _pilot forceWeaponFire ["rhsusf_weap_CMDispenser_M130", "AIBurst"];
                sleep 1;
                };
            };

            case "rhsusf_weap_CMDispenser_ANALE39":
            {
                for "_fire" from 1 to 4 do {
                _pilot forceWeaponFire ["rhsusf_weap_CMDispenser_ANALE39", "AIBurst"];
                sleep 1;
                };
            };
        };``` 

my goal is that based on the cm launcher the vehicle has, the specific ``forceWeaponFire`` will be executed. 
I can get the weapons of said vehicle via ``_guns = _vehicle weaponsTurret [-1];`` as array. However I'm currently not quite sure how to write that switch condition in a way the output it gets is indeed the string of said launcher. 
The problem with _x in _array is that the return value is a boolean. Find returns an integer and well I'm currently not sure if select could be of use here
winter rose
hollow lantern
#

yeah but the script only knows the vehicle

#

and has no knowledge what the cm launcher is unless there is a dynamic way to return it

winter rose
#

1/ get the weapons
2/ if CMdispenser somewhere, grab it
3/ fire it

hollow lantern
#

yeah that will work.

winter rose
#

isn't [-1] for the driver, and aren't Chaff on commander's turret?

hollow lantern
#

not for helicopters

winter rose
#

oh okay - yeah true

hollow lantern
#

the only thing on your list I need to figure out is if I can do a regex regarding CMDispenser

#

because the class changes but has still CMDispenser in it

winter rose
#
private _weapons = weaponsTurret [-1];
{
  if ("cmdispenser" in toLowerANSI _x) exitWith
  {
    for "_fire" from 1 to 4 do {
      _pilot forceWeaponFire [_x, "AIBurst"];
      sleep 1;
    };
  };
} forEach _weapons;
#

ta-daaa
free of charge!

hollow lantern
#

oh wow

#

well, add yourself some imaginary cup of coffee to your desk

dim owl
#

Hi guys,
I'm creating a simple object from a .p3d file.
Now I want to hide a selection but it won't work.
I've checked with selectionNames that the selection exists.
The script I'm using is the following:

private _pos = player getRelPos [10, 0];
private _obj = createSimpleObject [(str missionConfigFile select [0, count str missionConfigFile - 15]) + "models\testing\test_obj.p3d", _pos];
_obj attachTo [cursorObject,[-0.45, -0.45, 0.3]];
_obj hideSelection ["test_sel", true];

The model is inside the missionfolder if that is important to know.
Any help is appreciated :D

waxen tendon
#

fsm instructions/tutorials/documentation?

cosmic lichen
waxen tendon
#

nice

#

i have a function that i'd like on all cars. how can i filter Car_F class from allMissionObjects

robust hollow
#

i have a function that i'd like on all cars.
wot 🤔

waxen tendon
#

i'd like to run on all cars*

robust hollow
#

ah

waxen tendon
#

isKindOf is what i was looking for

robust hollow
#

i think you may find vehicles or entities to be faster than allMissionObjects

#

entities wiki even has an example for cars

_allcars = entities "Car";

not sure if that works for a3 but worth a go

waxen tendon
#

thanks!

past tiger
#

How do i set the ammo of the minigun, for example, of the Blackfoot and Wipeout? Those miniguns have no magazines, and i believe they also aren't pylons.

cosmic lichen
past tiger
#

@cosmic lichen it worked, thanks. I noticed those miniguns have magazines, they just don't show the the number of magazines because by default they have only one magazine. This seens not to work with pylons.

#

I tried this:

#
_ammo = [
    ["1000Rnd_Gatling_30mm_Plane_CAS_01_F",[-1],1000],
    ["Laserbatteries",[-1],1],
    ["120Rnd_CMFlare_Chaff_Magazine",[-1],120],
    ["PylonRack_1Rnd_Missile_AA_04_F",[-1],1],
    ["PylonRack_7Rnd_Rocket_04_HE_F",[-1],7],
    ["PylonRack_3Rnd_Missile_AGM_02_F",[-1],3],
    ["PylonMissile_1Rnd_Bomb_04_F",[-1],1],
    ["PylonMissile_1Rnd_Bomb_04_F",[-1],1],
    ["PylonMissile_1Rnd_Bomb_04_F",[-1],1],
    ["PylonMissile_1Rnd_Bomb_04_F",[-1],1],
    ["PylonRack_3Rnd_Missile_AGM_02_F",[-1],3],
    ["PylonRack_7Rnd_Rocket_04_AP_F",[-1],7],
    ["PylonRack_1Rnd_Missile_AA_04_F",[-1],1]
];
{_wipeout addMagazineTurret [_x select 0,_x select 1];} forEach _ammo;```
#

i run that on a Wipeout witout any missile/bomb on the pylons.

#

After the code the pylons stay empty.

#

I'm trying to save vehicles ammo on a database.

cosmic lichen
#

have you tried one of the pylons commands?

past tiger
#

@cosmic lichen the pylons commands should work. But i'm trying to do a universal and simple save and load that works with all vehicles like that:
1 - Save vehicle ammo on database:sqf _ammo = magazinesAllTurrets _vehicle; //save _ammo on database(...)
2 - Load ammo from database:```sqf
//get _ammo from database(...)
_vehicle setVehicleAmmo 0;
{_vehicle addMagazineTurret (_x select [0,3]);} forEach _ammo;

cosmic lichen
#

Dunno if that is possible. Maybe someone else knows more.

winter rose
#

addMagazine

pliant stream
#

Isn't it still impossible to serialise vehicle inventories correctly

queen cargo
#

Imagine a World, in which a "weapon" object would exist

pliant stream
#

Inconceivable

past tiger
#

The Cheetah AA vehicles have two smoke walls the commander can release. If you use weapons _cheetah; it show the vehicle weapons but don't show any smoke weapon. I put ammo loaded in weapons with setAmmo but i can't do that with those smoke because setAmmo needs a weapon classname (_cheetah setAmmo ["Smoke_weapon??",2];). With _cheetah addMagazineTurret ["SmokeLauncherMag",[0,0],2]; i can add 2 smokes, but they will not be loaded, player need to reload it. Any way to add the smokes loaded?

whole light
#

Is there any way to capture a submunition from a projectile captured with a fired eventhandler?

little raptor
hollow lantern
#

what's the best approach to get all enemy units from point X with a radius of lets say 1 click in all directions?
My thought is to create a trigger via https://community.bistudio.com/wiki/createTrigger and play around with this, or is there another way?

little raptor
#

@hollow lantern depends on what you want to do
normally you don't need a trigger

_enemies = allUnits select {side group _x getFriend side group player < 0.6 && {_x distance _pos < 1000}}
hollow lantern
#

I just need an array of "enemies" around a given point. Nothing more. I will check out your code, thanks

little raptor
hollow lantern
#

does that really matter? I mean getFriend side group unitName works as well.

#

or in other terms, I can change the person/group who is the friendly one without hassle

#

your code works, thank you very much

quasi sedge
#
vehicle player addEventHandler ["Fired", { if (_this select 5 == "rhs_mag_M829A3")  
then {
        sleep 5; 
        hint "reloading 5 сек";
        vehicle player addMagazineTurret ["rhs_mag_M829A3",[0]];
  }; 
} 
];```

16:45:24 Error position: <sleep 5;
hint "Перезарядко
16:45:24 Error Generic error in expression
16:45:24 Suspending not allowed in this context
16:45:24 Error in expression <ect 5 == "rhs_mag_M829A3")
then {
sleep 5;
hint "reloading

#

How to add 5 second waiting before executing addMagazineTurret here?

umbral nimbus
#

where are you executing this script?

#

oh wait eventhandler.

quasi sedge
#

spawnvehicle.sqf, which executing from onPlayerRespawn.sqf

umbral nimbus
#

🤔 try using spawn

hollow lantern
#
vehicleName addEventHandler ["Fired",{
spawn {if (_this select 5 == "rhs_mag_M829A3")  
then {
        sleep 5; 
        hint "reloading 5 сек";
        vehicle player addMagazineTurret ["rhs_mag_M829A3",[0]];
  }; }];
#

here you go @quasi sedge

still forum
umbral nimbus
#

in MP

quasi sedge
copper raven
#

@umbral nimbus you can maybe ctrlActivate the button control in the end to skip it, that setting does nothing in mp

little raptor
#

i.e you should write:
_this spawn ...

quasi sedge
#
vehicle player addEventHandler ["Fired",{ 
_this spawn {if (_this select 5 == "rhs_mag_M829A3")   
then { 
    hint "reloading 5 сек"; 
        sleep 5;  
        vehicle player addMagazineTurret ["rhs_mag_M829A3",[0]]; 
  }; };}];``` freaking works ![meowthis](https://cdn.discordapp.com/emojis/700765422726807613.webp?size=128 "meowthis") Thank's everyone
copper raven
#

should put the spawn inside the if after the hint, it's better to stay in unscheduled for aslong as you can

scenic ivy
#

Anyone have an updated guide on pre-scripted vehicle paths and is it possible in other vehicles like ifrits and not just helicopters?
End purpose is to make an ifrit ripping arena where you have ifrits driving pre-recorded paths to practice ripping on, if there is a more efficient way please do let me know.

noble snow
#

Does anyone have a guide on how to make doors?

umbral nimbus
austere granite
#

displayCtrl combined with IDCs

pliant stream
#

That doesn't give the name

austere granite
#

If he wants to ctrlActivate he doesn't need the "name". 🙂

pliant stream
#

He asked for the name

#

ctrlClassName

austere granite
#

Please read. The suggestion is on ctrlActivate, and he's not sure how to use that.

#

You don't need ctrlClassname to ctrlActivate. I know plenty of people who consider getting some pointer to something the "name" of it

pliant stream
#

Oh i need to go back like 3 hours in the chat history? I didn't realise. I was only going off his last question about control name.

#

He was asking for the control name which could only mean the class name so that's what i gave...

#

🤷

austere granite
#

I guess it doesn't show you what he replied to? Anyway moving on, ctrlClassname to get the classname for it in the config, Generally most commands you need the ctrl which is done with findDisplay (Or getting something from uiNamespace) and then displayCtrl

pliant stream
#

I'm on mobile, maybe i just don't see it

austere granite
#

You could use a lot of UI commands directly with an IDC without display, but generally that's bad and you should feel bad for doing it 😄

umbral nimbus
#

I feel bad for not understanding the whole UI scripting at all

past tiger
austere granite
#

The main problem is that there are a lot of engine-sided UIs and its tricky to do things with those. Especially in what you're trying to do

umbral nimbus
#

ok

#

now I found a script from @unique sundial to omit a briefing screen. through a script. Someone basically asked the same question on his site, what I'm asking now. But unfortunately he didnt respond to it

#

wait I have a link

pliant stream
#

Briefing screen? Is that the one with map and mission objectives?

umbral nimbus
#

well yes

#

but I'm talking about the debriefing

#

as is this guy asking the question in the post

austere granite
#

That whole debriefing system is scripted I believe

#

I don't have the code available but I think it's some the biki somewhere

pliant stream
#

A2 has some native "waiting for respawn" crap

austere granite
#

There's some sort of template system. I have you look for the expected config entries on your pdrive you should find ways to bypass it

umbral nimbus
#

this?

austere granite
#

Yeah. It's a starting point to look on pdrive for those config entries

umbral nimbus
#

right

tough abyss
#

is missionNameSpace or other variables stored in objects saved when using the save button?

winter rose
tough abyss
winter rose
#

a lot of scripts would break otherwise :D
careful of UI variables though 🙂

tough abyss
winter rose
#

a display/dialog/overlay is not saved

tough abyss
#

ok so all ui related variables need to re-init upon mission start then

winter rose
#

there is a "loaded" mission EH yep

tough abyss
#

got it

#

thanks

oblique arrow
#

Hey peeps I have another questions, how do I get a variable into a remoteExec heh ?

I have this code:

_index = thisList findIf {typeOf _x == "UK3CB_TKC_C_V3S_Closed"}; 
_truck = thisList param [_index,objNull];
_truckstr = str _truck;
hint _truckstr;
[truck_1_spawm_holder,"Load Concrete Pieces","\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa","\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa","_this distance _target < 3","_caller distance _target < 3",{},{},{ truck_pile_1 setPos (getPos truck_1_spawm); deleteVehicle _truckstr; deleteVehicle truck_1_spawm_holder; hideObjectGlobal concrpile_1_1; hideObjectGlobal concrpile_1_2; hideObjectGlobal concrpile_1_3; hideObjectGlobal concrpile_1_4; hideObjectGlobal concrpile_1_5; },{},[],12,0,true,false] remoteExec ["BIS_fnc_holdActionAdd", 0, truck_1_spawm_holder];

Which gets a truck in a trigger, and also adds a holdAction to an item.
Now I want the truck to be deleted when the holdAction is executed, but it always gives me an undefined variable error for _truckstr, I presume since its a remoteExec.
Now I need to somehow get the variable into the remoteExec so it can do the thingy, anyone got an idea?

winter rose
#

yep, _truckstr does not exist in the action code, even if it were not remoteExec'd

#

you could e.g setVariable _truckstr on truck_1_spawm_holder eventually @oblique arrow

#

(also, spawn, no?)

oblique arrow
#

yeah just a typo

#

setVariable _truckstr on truck_1_spawm_holder eventually
what does that do?

winter rose
#

save _truckstr's reference?

#

then getVariable in your code

oblique arrow
#

ah

oblique arrow
#

blobdoggoshruggoogly no worky

_index = thisList findIf {typeOf _x == "UK3CB_TKC_C_V3S_Closed"}; 
_truck = thisList param [_index,objNull];
_truckstr = str _truck;
truck_1_spawm_holder setVariable ["_truckstr", _truckstr, true];
hint _truckstr;
[truck_1_spawm_holder,"Load Concrete Pieces","\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa","\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa","_this distance _target < 3","_caller distance _target < 3",{},{},{ truck_pile_1 setPos (getPos truck_1_spawm); deleteVehicle (truck_1_spawm_holder getVariable _truckstr); deleteVehicle truck_1_spawm_holder; hideObjectGlobal concrpile_1_1; hideObjectGlobal concrpile_1_2; hideObjectGlobal concrpile_1_3; hideObjectGlobal concrpile_1_4; hideObjectGlobal concrpile_1_5; },{},[],12,0,true,false] remoteExec ["BIS_fnc_holdActionAdd", 0, truck_1_spawm_holder];
#

Still the same error

copper raven
#

_truckstr is undefined in hold action code

oblique arrow
#

Which Lou recommended

copper raven
#

It still is undefined

#

In the code above

oblique arrow
#

How do I fix that?

copper raven
#

Actually now that i looked at it again, you forgot to quote it

oblique arrow
#

in getVariable or?

copper raven
#

Yes

#

But then, deleteVehicle STRING doesn't exist

oblique arrow
#

Ye ablobderpy

#

yayautism fixed that and it works

#

Thank you a lot Lou and sharp roohappy

timid niche
#

Sooo, I am trying to create a cargo/container area.
I have an array and I am attempting to create x amount of container depending on the amount of arrays, so something like this:

private _containers = [["someInfo"],["someInfo"],["someInfo"]];
{
  _container = createVehicle ["someContainerClass", getMarkerPos "someMarker", [], 20, "CAN_COLLIDE"];
} forEach (_containers)

But I want to create the container within a rectangle marker but also want them to, well not collide with each other/hit each other.
So want to create them on a line but keep them within the rectangle. Or just make them look like a port/cargo/container area would look like. I have tried making a position check, to check if the position is within the area and then keep changing the pos until the container is x amount away from the last container so they don't collide. But it just didn't seem to work as I wanted.
If anyone could help me, that would be greatly appreciated.

little raptor
#

@timid niche

have tried making a position check, to check if the position is within the area and then keep changing the pos until the container is x amount away from the last container so they don't collide
why?
if you simply want them to be in the area in an orderly fashion, just use a pattern.

little raptor
#

rows and columns?!

#

that's one example of a pattern

slate cypress
#

What function can I use which will tell me how much ammo they have in each mag as well as the currently loaded mag?

#

I want it so that the player will respawn with the same mags and the same amount of ammo instead them

#

Currently, I am just copying the inventory at death and giving it to them upon respawn

slate cypress
#

It doesn’t seem to store information about how much ammo there is in each of the mags so it ends up giving them fully replenished mags

slate cypress
#

thanks

#

I am already using get/setUnitLoadout but it isn't holding any information about how much ammo is in each of the mags

#

here is my code for saving the loadout

#
(_this select 1) setVariable ["loadout", getUnitLoadout (_this select 1)];
#

This seems to treat every magazine as if they're all full

slate cypress
#

onPlayerKilled.sqf

#

here is my respawning code

#
_loadout = player getVariable ["loadout", nil];
if !(isNil "_loadout") then {player setUnitLoadout [_loadout, true]};
#

this code is in onPlayerRespawn.sqf

little raptor
#

@slate cypress

onPlayerKilled.sqf

Executed when player is killed in singleplayer or in multiplayer mission.

params ["_oldUnit", "_killer", "_respawn", "_respawnDelay"];

oldUnit: Object
killer: Object
respawn: String?
respawnDelay: Number
#

_this select 1 is the killer

slate cypress
#

aghhhhhhhhhhhhhhhhhhhhh

#

I see now thanks

#

small brain moment

#

😄

little raptor
#

_loadout = player getVariable ["loadout", nil];
is the same as
_loadout = player getVariable "loadout";

slate cypress
#

ah ok thank you

tiny wadi
#

Is there a built in function or one that someone has made that coverts a date from systemTimeUTC to time since epoch?

#

I want to compare the difference between two dates

robust hollow
#

numbers dont go that high in arma properly. they become inaccurate

#

i do have an fnc for comparing dates, just not access to it at this moment

tiny wadi
#

Oof, my bad. Maybe I should have started there lol, thanks for the link

winter rose
#

with pleasure! ^^

#

PS: dates are a b**** (and that in every language!)

#

well, I know what I mean with time, time difference, UTC, durations etc in a professional environment 😄

past tiger
#

Thanks.

#

The Gorgon have a weapon "autocannon_30mm_CTWS", this weapon have 2 muzzles muzzles[] = {"HE","AP"}. If i do a _gorgon setAmmo ["autocannon_30mm_CTWS",140]; nothing happens, may be because i not specified the muzzle. How can i make setAmmo work with the Gorgon auto cannon? PS: in ammo function (setAmmo getter) you can specify the muzzle, so i believe this also can be done with setAmmo, i just don't know wath string to use as the muzzle.

#

Sorry for the long text.

past tiger
#

I found, i need to use _gorgon setAmmo ["HE",140] or _gorgon setAmmo ["AP",60].

deft dock
#

good morning...
is it possible to have the following functions only output mod content (CUP) and exclude vanilla?
https://community.bistudio.com/wiki/BIS_fnc_exportCfgMagazines
https://community.bistudio.com/wiki/BIS_fnc_exportCfgWeapons
https://community.bistudio.com/wiki/BIS_fnc_exportCfgVehicles
https://community.bistudio.com/wiki/BIS_fnc_exportCfgVehiclesAssetDB

i have never done scripting, so consider me a noob in that sense. please ping me if somebody has an idea / solution, i have this channel muted.

many thanks in advance

winter rose
#

are you trying to setup your own wiki with bl***j*** and h****** ?

deft dock
#

i already have a wiki, but the manual rework of the export is just... well... _annoying _

hollow ibex
#

Hello i need help iv been trying to fix an error that shows in the RPT file but can not figure this out any input?

Error in expression <forEachIndex + 1, _x, true, _pylonPaths select _forEachIndex] } forEach _pylons;>

Error position: <select _forEachIndex] } forEach _pylons;>

winter rose
hollow ibex
#

sorry i posted in the wrong place then posted here forgot to delete the other post

winter rose
#

(```sqf to colorcode it plz)

hollow ibex
#

im new to all this so i dont know how to do the color coding....

#

one sec i see your pin on it

narrow temple
#

When I play with "Master Zeus", the Maximum field of view is too low in server

#

Even I set up 14000m in game it doesn't work

#

I heard that There's a commend which extend maximum field of view...

narrow temple
#

oh thanks

hollow ibex
#

nvm ill figure it out tm im tired as hell working on a map for hours

narrow temple
#

Do I type it like this? setViewDistance 5000m

winter rose
narrow temple
#

thanks alot

little raptor
little raptor
#

@deft dock
basically, all you have to do is add another condition where it does: getnumber (_x >> "scope") > 0
for example:

getnumber (_x >> "scope") > 0 && getText (_x >> "author") == "CUP Team" //I don't recall what you guys use as the author so I'm just using "CUP Team"

or

getnumber (_x >> "scope") > 0 && configSourceAddonList _x findIf {_x select [0,3] == "cup"} != -1

I recommend the first one, especially if you guys don't use localization for the author's name (but even if you do, you can localize the string and use that instead)

hollow ibex
#

So i am getting an error in RPT file and still cant figure this out i am very new to it all here is the error and the code below any ideas would be great.
Error in expression <forEachIndex + 1, _x, true, _pylonPaths select _forEachIndex] } forEach _pylons;>
2:49:39
Error position: <select _forEachIndex] } forEach _pylons;>
Error Zero divisor
File C:\Users\Hayden\Documents\Arma 3\mpmissions\BMR_InsurgencyTEST.Altis\INSfncs\server\server_fncs.sqf..., line 147

INS_replace_pylons = {
    params ["_veh","_pylons"];
    private _pylonPaths = (configProperties [configFile >> "CfgVehicles" >> typeOf _veh >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"]) apply {getArray (_x >> "turret")};
    private _nonPylonWeapons = [];
    { _nonPylonWeapons append getArray (_x >> "weapons") } forEach ([_veh, configNull] call BIS_fnc_getTurrets);
    { _veh removeWeaponGlobal _x } forEach ((weapons _veh) - _nonPylonWeapons);
    { _veh setPylonLoadOut [_forEachIndex + 1, _x, true, _pylonPaths select _forEachIndex] } forEach _pylons;
};
rough heart
#

You sure you're not missing a };?

hollow ibex
#

yea sorry im not lol just was not in my copy and paste

little raptor
#

I suggest that you systemChat/diag_log both of the arrays to see what the problem is

slate cypress
#

leopard I changed my code in onPlayerKilled.sqf however it has the same behaviour

#

this is onPlayerKilled.sqf

#
(_this select 0) setVariable ["loadout", getUnitLoadout (_this select 0)];
#

this is onPlayerRespawn.sqf

#
_loadout = player getVariable ["loadout", nil];
if !(isNil "_loadout") then {player setUnitLoadout [_loadout, true]};
#

All mags still get refilled

winter rose
#

you are still getting the variable from player

#

which is the living unit.

#

also, you are still using getVariable + nil, which will make Leopard20 angry at you now 👀

slate cypress
#

ah yeah I forgot to change that part

slate cypress
winter rose
#

depends if the old unit gets deleted in the meantime

#

if you could confirm to me the data type of _respawn, that would be great so I can fix the wiki 🙂

slate cypress
#

scalar

winter rose
#

thankie!

slate cypress
#

np 😄

winter rose
#

for both
onPlayerKilled.sqf &
onPlayerRespawn.sqf I assume?

#

pushing my luck here :p

slate cypress
#

for onPlayerRespawn.sqf

#

I'll check onPlayerKilled.sqf for you

winter rose
#

rawr

slate cypress
#

yes, both are scalar 😄

winter rose
#

yay! lotsa thanks

#

and I steal one of your Christmas chocolates, because I can

slate cypress
#

can't taste them anyway 🤢

winter rose
#

erf! sorry to hear =\

slate cypress
#

oh you're kidding me

#

all this time, i've had fullMagazines set to true...

#

aghhhhhhhhhhhhh

winter rose
#

self-spank 🤣

slate cypress
#

🤣

#

ok so that's now working

#

how can I fix the fact that the gun gets removed from the loadout if the player dies in a blast such as a grenade explosion?

slate cypress
#

do you know why it happened?

winter rose
slate cypress
#

yh seems to be working from now on

#

thanks anyway

slate cypress
#

when creating a waypoint, is it sufficient to use addWaypoint and then just use setWaypointType with the waypoint class name

#

I am using lambs for reference

#

the AI seem to be moving but I'm not sure they have the move waypoint or specifically the custom waypoint that I intend for them to have

#

the class name for the waypoint is lambs_danger_Rush

#
_wp1 setWaypointType "lambs_danger_Rush";
oblique arrow
#

Hey peeps I have another question, I'm playing around with using a camera, but when I use
_camera camPreparePos (getPos cam_1);
the camera just spawns on the ground, rather than the correct height, any chance anyone has an idea what I'm doing wrong?

oblique arrow
#

Yee I'm doing that

#

and the camera does move to the position, but it stays on the ground ConfusedDog

winter rose
#

AGL/ATL/ASL issue?

oblique arrow
winter rose
#

because getPos to a man on top of the building will return a Z of 0, therefore ground

oblique arrow
#

The object I'm using as a camera is at [3784.05,9244.57,1.09397]

#

so Z isnt 0

little raptor
oblique arrow
#

you're providing AGLS. see:
Thats just the position logged through 3den, but I'll take a look at that anyways

finite sail
#

guys... with setSkill, is the "general" subskill still in use?

#

I have a memory of Suma or somone similar saying, maybe on reddit, that it is redundant

#

but can't find it now

little raptor
#

who knows?! but more importantly, does it matter?!

finite sail
#

*cross Leo off next years christmas card list

#

says Some information on this page were not confirmed by BIS!

#

and about 'general'

#

general

Raw "Skill", value is distributed to sub-skills unless defined otherwise. Affects the AI's decision making
little raptor
#

I don't think it is used. It was probably used in older Arma games. It doesn't do what it's supposed to do either.

finite sail
#

that does seem to tally with my tests

little raptor
#

yeah, I'm saying that according to a quick test scenario I just made.

finite sail
#

yes, thanks, glad its not just me getting those results

winter rose
#

you might both be crazy, just sayin'

finite sail
#

hehe

#

problem is all my work with setskill is undone when someone puts the mission on a server with different difficulty presets

#

and yes, im aware I don't understand skillfinal and related stuff

cerulean cloak
#

So, I've got a helicopter that's being flown with unit capture that's supposed to land but after it's landed with unit capture the pilot takes back off and hovers.
What can I do to make the AI just stay still?

little raptor
#

@cerulean cloak Follow the rules. No profanity.
You can try the land command. Create an invisible helipad and tell the AI to land there.
Another approach would be to use an eachFrame EH loop and applying a (small) negative velocity to the helicopter.

cerulean cloak
#

I tried the land command and no luck.
I'll try and work something for the negative velocity. How much would you suggest?

little raptor
#

About 1-2 is enough ([0,0,-1])

cerulean cloak
#

Ok

cerulean cloak
#
while {bhl} do
    {
        {
        _vel = velocity _x;
        _velx = _vel select 0;
        _vely = _vel select 1;
        _x setvelocity [_velx, _vely, -1];
        } foreach [bh_1, bh_2, bh_3];
    };```
That did the trick. Thanks for the help and sorry for the rule violation. I was just getting quite annoyed with the AI being stupid.
west grove
#

question. is it possible to detect if the player is on a slope and which directon of that slope is "down"?

ornate fern
#

evening everyone. is there a way to place a trigger and use it to change the side of a groupe of ai soldiers? so i can change the side of them in just a second. i searched the bohemia i command website but i cant find a command or how to put it in the trigger. thanks and merry x mas by the way

winter rose
worn forge
devout obsidian
#

Hello guys, does anyone of you tried football script that actually works? And if so would you be so kind and send me link there? Thank you very much and Merry Christmas

surreal peak
#

@devout obsidian what you looking for?

devout obsidian
austere hawk
#

Question about hashmap - if i use objects as keys, if they are dead i lose key, right? So i guess i should create random key name and save object in array. Is there a "fastest datatype" to use for random keys?
E.g. 5 digit number faster than 3 digit string?

still forum
#

"if I use objects as keys"
Read the wiki page before you use the Hashmap, object as key is not a thing

still forum
winter rose
#

just mind the precision right?

austere hawk
#

if i only use "integers" i wont, right?

winter rose
#

4-5 digits should be no pb

#

0xDEAD

austere hawk
#

i was thinking if i should use key with some identifier letters + random tail, just so its more debuggable later. But only if its not too costly. Thats why i was asking

still forum
#

String is only more expensive by one pointer indirection, basically.

#

It's nothing you could measure or notice.
But string is slower than number

winter rose
#

= go for it @austere hawk

austere hawk
#

i see, thanks

winter rose
#

now if you have a 9999999999 elements hashmap…

austere hawk
#

also, hasmap arrived with perfect timing 😄 Thanks Dedmen. Dont know how else i could do the thing i want otherwise without losing sanity from having to reshuffle / constantly redo index accounting arrays all the time and stuff

winter rose
#

talking about that, no word on a max limit?

still forum
#

It still won't make a difference because of how Hashmaps work

#

Jup. No word.

winter rose
still forum
#

No

winter rose
#

hah! you just did

austere hawk
winter rose
#

and each sheep has four legs… etc

winter rose
#

neverending hashmap? :3

#

RAM overflow? :3

little raptor
little raptor
cerulean cloak
#

I only want it to go after they've landed and only for a limited time thougj

little raptor
#

still, don't use it

cerulean cloak
#

So how would you do it then?

little raptor
#

you're eating the scheduler cycles with that

#

I told you, the eachFrame EH

spark turret
little raptor
#

unless you want the actual slope

spark turret
#

hm yeah that works to.

#

still stuck in my spacegame mindwise where its a bit more complicated.
your method is better.

little raptor
winter rose
#

hence the quotes

little raptor
#

Speaking of hashmaps, what happens if I set the hashmap itself as the value?! Error?! _hashMap set [_key, _hashMap]
that would be a recursive error for arrays. but I wonder what would happen if I did it with hashmaps. I don't see it as an error.

winter rose
#

you create a black hole. are you happy with the destruction of our planet now??

#

(iirc Dedmen said it throws an error?)

little raptor
#

that would be with an array 😅

oblique arrow
#

btw what does having a true at the bottom of a script do? Seen it in a lot of BI's scripts

winter rose
#

"just" returning true, usually as a default return value / saying the end has been reached

little raptor
#

returns it

oblique arrow
#

ah oki, thanks Hap

dusty badger
#

Can triggers be dynamically simulated?

winter rose
dusty badger
#

After they are created can they by dynamically simulated so that only ones that meet the criteria for it are running checks for their activation condition?

winter rose
#

ah, disabled/enabled yes

#

it works

little raptor
dusty badger
#

I use triggers to create enemy units for players so that the composition of these units can be changed on the fly via scripts if need be

winter rose
#

yep ↑ (what Leopard20 said)
you can do it manually, it doesn't work for non-object entities I believe

dusty badger
#

as opposed to just spawning everything in and then dynamically simulating only ones that players might have contact with

little raptor
#

use loops
I don't think what you want needs triggers
plus triggers are loops too

dusty badger
#

Right now every trigger on the map is evaluating its activation condition when the interval ticks over, would be nice to have only the ones near players doing that

#

Triggers have just been a convenient vehicle for controlling the conditions in which enemy units are created

#

There are just a lot of requirements that the mission needs to meet when it comes to that, and with a minimum of manual work required to make it

#

Since with the current system all we need to do is place down markers for areas in which we want an enemy presence, configure some className lists and the script takes care of the rest

proud carbon
#

Hey, I'm looking to make a script that gets all the weapons classnames in my mission's modpack and placed into my clipboard.

#

But I need it to be in a particular format. How do I go about doing this?

winter rose
#

config access 🙂

proud carbon
#

so now that I have the class names, How do i use that to get a display name?

winter rose
#

"CfgWeapons" >> class >> "displayName" iirc

proud carbon
#

is there a way use the script to save to text doc?

austere hawk
#

yeah, thats how the allinone config extraction works

#

(or at least it did, i think now someone did a dll that does it (?))

queen cargo
proud carbon
#

Dam

#

back to using clipboard

#

is there a limit to how much can be stored?

forest fable
still forum
# winter rose RAM overflow? :3

That. Probably.
I don't remember what exact number it is.
But it's atleast 4GB*16 ram usage.
In the usual case atleast 4GB * 32
Ur not gonna have that much ram.

still forum
forest fable
#

I'd like the helicopter to only be a spawnable point between points A and B, wheres Point C is a flight outside of map boundaries. and Point D is a loop setup phase. any help or suggestions would be appreciated as i have zero knowledge of how to script in this game yet 🙂

proud carbon
#

I am still having problems with getting the display name of a class

_DisplayNameX = str getText (configfile >> "CfgWeapons" >> "displayName" >> _CLassBoi);

What am I doing wrong?

queen cargo
#

For starters, str is not Needed as you get a string

proud carbon
#

yeah I know that

#

I need it be a string when referenced

queen cargo
#

Then, you the class Name nav belongs in Front of displayname, assuming that it is clasboi

queen cargo
#

That is why str is not Needed there

proud carbon
#

oh double strings

#

SO i am getting some weird shit
displayName = ОЦ-14-4 Гроза;

queen cargo
#

Guess you used copy paste?

proud carbon
#

correct

queen cargo
#

And eg. Notepad++ as target?

proud carbon
#

Yep

queen cargo
#

Check the file encoding

proud carbon
#

utf-8?

queen cargo
#

And switch it around without reencoding

#

As those seem to not match

proud carbon
#

turns out it was because one of my mods is in russian.

#

as other entries have turned out great

queen cargo
#

Should still not give scrambled results

#

What are you trying to Archive anyways?

proud carbon
#

You know grad-listBuymenu?

#

im trying to print out on mass this

class RHS_Weap_AKM_gp25 {
                displayName = "AKM 7.62 mm (gp25)";
                description = "The AKM is a Soviet assault rifle designed by Mikhail Kalashnikov during the 1950s. This ones comes with the gp25 grenade launcher";
                price = 1100;
                stock = 40;
            };
#

for every weapon.

queen cargo
#

Ahh
Okay

proud carbon
#

Now I need a way to delete double ups

#

I don't need every AK known to man, let alone twice.

proud carbon
#

So say if I have a srifle_DMR_01_MRCO_F and a srifle_DMR_01_F within the same array.
How do I find the one with the least amount of attachments and purge it from the array?

little raptor
#

@still forum

_hm = createHashMap;
_hm set ["1", _hm]; //no error shown here
_hm set ["2", 1];

_hm get "1" //now you get an error

it only throws error when I use the get
this is what I was asking. whether it shows an error
the error is only a warning. it doesn't prevent you from using that

finite sail
#

hashmaps... another thing to learn

#

ok, so the wikipedia page appears to be aimed at someone who already understands this stuff

#

ah, biki page is much better

#

thanks to dedmen and revo for a nice piece of writing on that page - making it understandable for noobs

#

oh, and Lou 🙂

still forum
#

You can do it, doesn't mean you should.
And I might randomly in some game update just add a check for it and force crash everyone's game when it happens

leaden mason
#

How to add a custom event for an object and then call it? Does this need to use BIS_fnc_addScriptedEventHandler?

still forum
#

You could use scriptedEventHandler yes

#

There should be something like fnc_fireScriptedEventHandler to trigger it

leaden mason
#

Thanks for the answer.

little raptor
queen cargo
still forum
#

Sure, yet another thing to learn.
Surely a great idea

queen cargo
#

Always 😏

little raptor
still forum
#

It's compiled down to SQF code currently.
But it will be able to use optimized SQF bytecode once that becomes a thing.
Which will yield a performance improvement

austere granite
#

Soon job adverts will mention requiring 5 years of SQC experience

austere hawk
# queen cargo Want to do custom sqf objects?

i dont even know whats meant by that, so propably not :P
I just need arrays with a fixed index, so that whenever i remove or add an element, the index for the other elements never changes - which is exactly what hashmap offers

winter rose
queen cargo
little raptor
winter rose
#

no, objNull set [3, nil] would throw an error 😏🤣

sonic linden
#

Can someone help me fetching all door objects on the map ?
im trying something with numberOfDoors

private _object = []; 
{
    private ["_numberOfDoors"];
    _numberOfDoors = getNumber (configFile >> "CfgVehicles" >> typeOf _x >> "numberOfDoors");
    if (_numberOfDoors > 0) then {
        _object pushBack _x;
    };
} forEach nearestTerrainObjects [[0,0,0], ["House"], ( worldName call BIS_fnc_mapSize ), true];
little raptor
sonic linden
#

good idea thanks

#

but i still cant get the list of door objets to work

little raptor
#

what do you mean "to work"?

#

the code looks fine to me
apart from that unnecessary private

private _object = nearestTerrainObjects [[worldSize/2,worldSize/2,0], ["House"], worldSize/sqrt(2), true] select {
    getNumber (configFile >> "CfgVehicles" >> typeOf _x >> "numberOfDoors") > 0
}
winter rose
#

your data is then in the _object variable

sonic linden
#
private _object = []; 
{
    private ["_numberOfDoors"];
    _numberOfDoors = getNumber (configFile >> "CfgVehicles" >> typeOf _x >> "numberOfDoors");
    if (_numberOfDoors > 0) then {
        _object pushBack _x;
    };
} forEach nearestTerrainObjects [[worldSize/2,worldSize/2,0], ["House"], worldSize/sqrt(2), true];

systemChat str count(_object);
``` prints 0
winter rose
#

oh

little raptor
#

maybe your objects don't have a type/config

#

where are you trying this?

sonic linden
#

*** i tested it on Altis and it works, apparently i did setup my doors wrong

little raptor
sonic linden
#

yes thanks i changed it

#

i am confused:
if i look at my door and check

getNumber (configFile >> "CfgVehicles" >> typeOf cursorObject >> "numberOfDoors") > 0
```  I get a True
But if i runn
```sqf
private _object = nearestTerrainObjects [[worldSize/2,worldSize/2,0], ["House"], worldSize/sqrt(2), true] select {
    getNumber (configFile >> "CfgVehicles" >> typeOf _x >> "numberOfDoors") > 0
}
systemChat str count(_object);
``` i get 0

I checked :
```sqf
count nearestTerrainObjects [[worldSize/2,worldSize/2,0], ["House"], worldSize/sqrt(2), true] 
``` = 76
:/
winter rose
#

( ) maybe?

#
private _terrainObjects = nearestTerrainObjects [[worldSize/2,worldSize/2,0], ["House"], worldSize/sqrt(2), true];
private _doorObjects = _terrainObjects select {
    getNumber (configFile >> "CfgVehicles" >> typeOf _x >> "numberOfDoors") > 0
};
count _doorObjects;
sonic linden
#

systemChat format["found : %1 doors",count _object];
found : 0 doors

winter rose
#

use temp vars

sonic linden
#

still 0 with your changes :/

little raptor
little raptor
#

you didn't terminate the statement with ;
and I'm not sure how you say it returns 0 because it shouldn't run at all

sonic linden
#

yes wrongly coppyed to dc but tested with

little raptor
sonic linden
#

current version:

private _doorObjects = nearestTerrainObjects [[worldSize/2,worldSize/2,0], ["House"], worldSize/sqrt(2), true] select {
    getNumber (configFile >> "CfgVehicles" >> typeOf _x >> "numberOfDoors") > 0
};
systemChat format["found : %1 doors",count (_doorObjects)];

found : 0 doors

little raptor
#

try this while looking at the door object:

systemChat str (cursorObject in nearestTerrainObjects [[worldSize/2,worldSize/2,0], ["House"], worldSize/sqrt(2), true])

I bet it returns false

sonic linden
#

yes returns false

little raptor
#

so it's not even in the list of nearestTerrainObjects

sonic linden
#

hm

little raptor
#

did you place it yourself (via editor or sth)?

sonic linden
#

baked in the map

#

and cursorObject iskindOf "house" returns true

little raptor
#

that's not the same thing

#

nearestTerrainObjects doesn't use iskindOf

#

try "Building" instead

sonic linden
#

found 59 doors 😄

#

thanks

#

can you explain me quicly why this was not working ? i used class house as BAse class in the cpp thats why i thought i need house

little raptor
sonic linden
#

okay thanks alot

narrow pollen
#

is there a way to overwrite server addon settings through code?

queen cargo
#

Server addon setting? What?

narrow pollen
#

missionNameSpace setVariable ["ace_common_allowFadeMusic",false,true]; this doesn't seem to be working unless the player sets it themselves (or the server forces it)

willow hound
#

Likely because ACE settings are saved in the profile namespace.

queen cargo
#

You May be better off asking at the ace slacks Chat that

#

As it is more likely you get an answer there then here

narrow pollen
#

Yeah I did that already, thanks 😄

queen cargo
#

Npnp

tender fossil
winter rose
#

I believe "any member of the linked group"

copper raven
#

was thinking the same

#

call{this} 🤔

#

just this instead

winter rose
#

CBA thing afaik

#

made to fix the 0 = ugly fix

copper raven
#

ah yeah, true

hollow lantern
#

fundamental question:
when I have a while loop in a script, and that script only once get to the point where the while loop will be "called" (and therefore the condition will be checked), does it then on every iteration, check condition or would another call of the script be needed to check the condition once again?
I have an array that at one point is empty. The while condition states that the code block in the loop should be executed as long as the array is not empty.

#

However said while loop seems to be looping forever

queen cargo
#

The condition is checked everytime the code leaves its scope and until it yields false

hollow lantern
#
        _enemies = allUnits select {side group _x getFriend side _group < 0.6 && {_x distance _target < 1000}};
        _visTargets = _enemies select {([objNull, "VIEW"] checkVisibility [eyePos (gunner _aircraft), eyePos _x] > 0.3)};

        while {(_group getVariable ["KI_airSupport_cfSwitch", objNull]) == "IAO" && !(count _enemies == 0) } do {
            
            _bulletMagnet = _visTargets call BIS_fnc_selectRandom;

            if (alive _bulletMagnet) then
            {
                (gunner _aircraft) reveal [_bulletMagnet, 4];
                (gunner _aircraft) doWatch _bulletMagnet;
                (gunner _aircraft) doTarget _bulletMagnet;
            }
        };``` 

Here is the code of said ``while loop`` In my opinion it never leaves the scope.
#

maybe my question should also ask if when the while is no longer active (condition false) if code below it will be still executed

#

after the };

winter rose
#

yes, the variable is never updated and the while loop will run forever

#

you could update the _enemies variable e.g in the while loop, or in the while code

hollow lantern
#

ah yeah that would make sense

winter rose
#
private _array = getAllEnemies; // empty because no enemies
while { count _array == 0 } do
{

  // update here
  _array = getAllEnemies;
};
#

that or count getAllEnemies directly in the while

hollow lantern
#

now that you mentioned it, it all makes sense, thanks you two

hollow lantern
#

what's the best way to run a while loop for x seconds? Currently I do

diag_log format ["%1, %2", groupId _group, "arrived at the AO." ];
while {_gametime != 0} do 
{
  // code things
  _gametime = _gametime -1;
};
diag_log format ["%1, %2", groupId _group, "is RTB, good luck soldiers, out." ];

And _gametime in this case is 120. However it seems that this method is in-accurate as my while loop is over in less then a minute according to the RPT:

23:39:53 "Vulture 2-1, arrived at the AO."
23:39:59 unable to get word:'laserdesignator' in protocol:'radioprotocoleng'
23:40:04 "Vulture 2-1, is RTB, good luck soldiers, out."```
robust hollow
#

that would work if you had a sleep in the loop. or a for loop would do the same thing with a sleep, no need to do the math with _gametime.

#

or for the sake of covering all options, another is to define the end tick and use that as the condition

private _end = diag_tickTime + 120;
while {diag_tickTime < _end} do {
/// code things
};```
#

though again, you'd want a sleep in that otherwise itl spam and has the potential to crash your game

hollow lantern
#

you mean like a execution delay in the loop?

#

aka sleep 1; ro run it only every second

robust hollow
#

yea, so 120 becomes 120 seconds rather than 120 iterations

#

though... it would stll be 120 iterations, but spaced one second apart

hollow lantern
#

hmm ok

#

Thanks!

drifting sky
#

do event handlers fire only on the machine where the unit (it is attached to) is local?

robust hollow
#

depends on the event. as a general rule they fire on the machine where the event was added, but there are some exceptions.

winter rose
short fossil
#

Good evening everyone

So I am to make a training map for a Unit and I wanted to make the targets moving (like the Shoot tagerts, yellow practice idk how to call it) from left to right or from the back to the front. I followed this guide, the tutorial is from a German Scripter https://www.gruppe-w.de/forum/viewthread.php?thread_id=2235

I followed it and yet still dident understand it(not because its german) is there an easier guide or is this the only one(I spend many min about 45 or so trying to see if there is an answer to my question on the Internet, I couldent find one so I would try it here) ?

Thanks in advance.

worn forge
#

Your question is too general. What don't you understand?

exotic flax
#

The scripts from that link are working when you make a few modifications (at least that's what I remember from using it myself).
So as Ryko said; if we know what you don't understand we can help you better 🙂

dapper path
#

Hello friends! I am looking to make a script that turns on and off reflectors by using a UserAction rather then pressing L

#

I am looking to do this so that I am able to make police lights that actually flash reflective lights rather then just an animation

#

Thanks for any and all help!

muted wraith
#

Hello! I am looking for a mod or a script that make interaction ( the scroll wheel lotting easier) is there someone who could tell me the script or mod name if there is one? Thanks!

robust hollow
dapper path
#

No

#

Reflectors as in two very specific reflector classes

robust hollow
#

i thought pressing L toggled headlights 🤔

dapper path
#

It does

dapper path
fair drum
#

when would I want to use task ID and parent task ID? Right now I just make all tasks parents.

winter rose
fair drum
#

just the modules at the moment

#

but i usually keep both IDs blank for default

#

is it for doing something like...

parent task - destroy all vehicles

subtask 1 - vehicle 1
subtask 2 - vehicle 2
subtask 3 - vehicle 3

and then each time you kill a vehicle it completes that subtask? cause normally i just have the 3 vehicles tied to a trigger to set the overall task as complete

winter rose
#

it is for organisational/visual purpose
e.g taskA will be at the top, then taskA1, A2 and A3 will always be set/added under taskA

winter rose
#

also, if you complete the parent task all sub-tasks will get completed @fair drum
the other way around is not true (completing all sub-tasks will not complete the main task)

waxen tendon
#

how can i have a publicVariable array be appended via multiple functions executing at different times and still make sure all appends are there

#

or is everything executed sequentially in which case this is a non-concern

winter rose
waxen tendon
#

i have some functions in init fields of eden objects

#

that is the only time this public array will be modified at all

winter rose
#

ugh, init fields…

waxen tendon
#

yeah, i know, sorry

winter rose
#

so it is going to be executed by everyone, even JIP, and publicVariable'd as well? that's…

waxen tendon
#

right, so i have to give variables to these eden objs and have the script run at initServer

winter rose
#

ideally yes. or wrap everything in a if isServer

#

that's adding to the ugliness, but it would solve it

waxen tendon
#

if i do that, i wont have to worry about continuity in the array, right? every append will be there and none will get overwritten

winter rose
#

yep
one init field after another

waxen tendon
#

thanks!

fair drum
#

strategic map is local correct? if I do some remote shenanigans, will it work for MP too?

winter rose
#

I think it should?

fair drum
#

welp... hold my MXC, I'm going in

copper raven
#

what do you mean with "remote shenanigans"?

winter rose
#

we don't want to know 😄

fair drum
#

just remote exec stuff

finite sail
#

i can't find the biki page for remote shenanigans

past tiger
#

What is the chance of zombies without a mod?

finite sail
#

vague question is vague

past tiger
#

i'm searching for zombies without mod, can't find any.

#

Don't want to add zombies mods to my mission.

finite sail
#

what sort of zombies do you want? What aspect of a zombie to you want? If you want the total zombie experience without mods, then I think you're stuck

#

you cant make civs look like z without a mod

past tiger
#

ok, i will try

finite sail
#

you might be able to script zombie like behaviour, but unless you're well versed in scripting, this is going to be very hard

warm hedge
#

Any way to get all files from a mission folder?

finite sail
#

dePBO it

warm hedge
#

Yeah, well... I think if there's a way to do it in-game

finite sail
#

in game? don't think so

warm hedge
#

addonFiles is the closest thing I've ever thought but well, it's not what I need. It's not even hard to do it manually so I'll forget the idea

velvet merlin
#

too blind to see the issue 😐

#
// If respawn tickets were disabled, remove the initial ticket for each of the players
if (missionNamespace getVariable "BIS_respawnTickets" == 0) then {[(_this select 0),-1] call BIS_fnc_respawnTickets};

_unit = _this select 0;

_class = _unit getVariable ["BIS_UnitClass",""];```
#

rpt:

#
Error in expression <respawnTickets};

_unit = _this select 0;

_class = _unit getVariable ["BIS_U>
  Error position: <;

  Error Missing ;
File \WW2\MissionsWW2_p\WW2_GameModesBI_p\WW2_Escape\respawn\fn_BIS_onPlayerRespawn.sqf [A3_WW2_Escape_fnc_OnPlayerRespawn]..., line 6
 ➥ Context:     [] L1 ()
    [] L291 (A3\functions_f\initFunctions.sqf)
    [] L299 (A3\functions_f\initFunctions.sqf)
    [] L304 (A3\functions_f\initFunctions.sqf)
    [] L314 (A3\functions_f\initFunctions.sqf)
    [] L323 (A3\functions_f\initFunctions.sqf)
    [] L328 (A3\functions_f\initFunctions.sqf)
    [] L333 (A3\functions_f\initFunctions.sqf)
    [] L338 (A3\functions_f\initFunctions.sqf)
    [] L374 (A3\functions_f\initFunctions.sqf)
    [] L375 (A3\functions_f\initFunctions.sqf)
    [] L102 (A3\functions_f\initFunctions.sqf)
    [] L129 (A3\functions_f\initFunctions.sqf)
    [] L130 (A3\functions_f\initFunctions.sqf)```
#

definition:

#
class CfgFunctions {
    class A3_WW2_Escape {
        class functions {
            class OnPlayerRespawn {file = "\WW2\MissionsWW2_p\WW2_GameModesBI_p\WW2_Escape\respawn\fn_BIS_onPlayerRespawn.sqf"; preInit = 1; recompile = 1;};```
little raptor
finite sail
#

if (missionNamespace getVariable "BIS_respawnTickets" == 0) then {[(_this select 0),-1] call BIS_fnc_respawnTickets;};

#

semicolon before the closing curly?

little raptor
#

no need

finite sail
#

my sqf checkers find no error in that line

little raptor
velvet merlin
#

the code worked directly in mission - moving to cfgFunctions in config bugged it

little raptor
#

also, just for safety, use:

missionNamespace getVariable ["BIS_respawnTickets", 0]
velvet merlin
#

_unit = _this select 0;

#

it doesnt like this

still forum
#

Invis character?

little raptor
little raptor
velvet merlin
#

in first line but it crashes the game startup with preStart = 1 and preInit already errors on parsing the file

#

rewrote the code section to make sure no special chars slipped in there

finite sail
#

O or zero ?

#

^^^^ we've all done it, be honest

velvet merlin
#

its a 0 - compared vs the line above just to be sure

finite sail
#

🙂

little raptor
finite sail
#

tell me you've never done the O vs 0 thing?

little raptor
#

nope. I mean I make the typo sometimes, but I correct it immediately thanks to syntax highlighting

finite sail
#

yes, thats wht i mean 🙂

#

what language is your keyboard Leo? on my UK English keyboard, those two keys are very close and easy to miss press with fat, drunken fingers

little raptor
#

it's QWERTY, so pretty much the same

finite sail
#

k

#

your twitter handle 🙂

#

mixes the two

#

intentionally, im sure

little raptor
#

yeah, Leopard20 was taken! 😄

finite sail
#

🙂

velvet merlin
#

seems like some special char slipped in indeed. rewriting the code line and newlines worked

#

ty

brave lotus
#

Is there a faster way to locate all (baked) objects in the world with a known name than using nearestObjects in the centre of the map with a 20km radius - which takes forever? Are the named objects available as-is in a world array? I need to grab the array once only at map startup, I'm using it to script traffic lights across a map.

finite sail
#

nearestterrainobjects

brave lotus
#

Tankbuster, is that faster? I'm not bothered about nearest at all, I just need all objects of a name in a nice handy array so I can forEach around them

finite sail
#

tbh, in your application, you should gather the array before the mission starts

brave lotus
#

yes yes, indeed I am gathering at start once only, but it still locks up for 30 secs or so

finite sail
#

really?

#

i do similar stuff.. i get all the big buildings for example and it takes 700 ms

#

you cant do that during the mission, but during setup, it's nothing

brave lotus
#

I am very happy for you 😄 It may be because I has custom map? And it locks up completely the world - animations, everything. Definitely the nearestObject doing this as if I comment it out, everything else works great. Once it has all the values, it's quick too, becuase I'm storing it in a persistent array. It would just be nice if there was an array table I could query by name rather than by distance to just grab the objects I need.

finite sail
#

ah, a custom map... yeah, thatmight be tricky

brave lotus
#

So, definitely nothing I could use to just iterate the terrain objects and forget distance?

finite sail
#

I'd try nearestterrainobjects in place of nearestobjects

brave lotus
#

Okay - I'll give it a whirl now and report back, thx 🙂

finite sail
#

np

#

bear in mind the it uses its own slightly odd search hierachy

#

if the map has been made correctly, the traffic lights will probably be "hide" or "house"

#

also, turn it's search off, it will speed it up a lot if the array is big

brave lotus
#

yes, just reading the wiki now 😮 it's just strange there's no function to get to the world objects array directly, I don't need any 3D distance calcs doing at all, it's all a waste really

finite sail
#

yeah if you're grabbing everything in the map during setup for array use later in the mission, dont need sort

#

and yes, it is strange as you say

brave lotus
#

glad it's not just me not finding the func 😄

finite sail
#

nope 🙂

solar shore
finite sail
#

effectslocal

#

the effect of that command is local so is only locked where the vehicle is local to the client that ran the command

solar shore
#

Yeah but the command is ran on the vehicle

#

Like it gets remoteExecCalled on the vehicle

finite sail
#

it needs to be remoteexeccalled everywhere, all clients

#

i suspect you're locking it only on the server where it was created?

solar shore
#

Well, I did _vehicle lockInventory true on the server first

#

But that didn't work, so I remoteExecCalled that on the vehicle through the server

#

But both didn't work

#

And the players can (un)lock the inventory through the keyhandler

finite sail
#

the effects of that command are local, you need to run it on the players too

solar shore
#

Ah right

little raptor
finite sail
#

arguments are global, yes

little raptor
#

as Tankbuster said, remoteExec for all players

finite sail
#

effects are local

solar shore
#

So I remoteExecCall on -2 right?

finite sail
#

in the remoteexeccall, for the targets, use -2 instead of 0

#

that should work

little raptor
finite sail
#

yes, use zero, thx leo

#

yes

#

good catch

#

[0,-2] select isdedicated

#

will work nicely for both dedi and localhost

little raptor
#

just one extra machine doesn't really matter you know! 😄

solar shore
#

Yeah idk that's not working

#
[cursorObject,false] remoteExecCall ["life_fnc_lockInventory",0];

I do this right?

#
/*
    File: fn_lockInventory.sqf
    Author: Edward

    Description:
    (Un)locks the vehicle inventory.
*/
params [
    ["_vehicle",objNull,[objNull]],
    ["_state",true,[0,false]]
];

if (isNull _vehicle) exitWith {};

_vehicle lockInventory _state;
#

This is the function it calls

#

Oh it worked now

#

When I didn't use the debug menu

#

I did cursorObject lockInventory true; and executed it on global

#

I suppose the command is not JIP compatible as well then right?

finite sail
#

there's a jip flag you can set to true

solar shore
#

Ah right I see

#
[_veh,true] remoteExecCall ["life_fnc_lockInventory",0];

This doesn't work :(

#

Still the issue where someone has to enter the vehicle once

finite sail
#

have you rerun the mission from the start of the editor, or recompiled the functions?

past tiger
#

I had problems some times. Highlight can help because it don't reconize the "broken" function.

oblique arrow
past tiger
#

@oblique arrow ok, i will. I can't remember now wich copy and paste caused the problem, but if i find it again i will report.

oblique arrow
#

Thank you bongocat

ionic orchid
#

is it safe to assume profileName is okay to use as a filename? I don't know if the engine does anything special with character encoding to make ProfileName.Arma3Profile safe

little raptor
ionic orchid
#

I'm saving savegames on the server, currently with

params ["_id", "_uid", "_name", "_jip", "_owner"];
private _accountID = _uid + "_" + _name;
//Send _accountID to a DLL to load a file with that name
#

just wanting to make sure that _name wont have any characters in it that will cause me problems

queen cargo
#

Always sanitize your input

#

Always

#

Not even if you think you can trust one side

#

But always

#

Depending on your language used for extension developmentment, you have numerous options to fix that

ionic orchid
#

yeah, I have a big //TODO in there for exactly that - just doing some checking first and saw there's not a lot of info about profileNames

slim spire
#

I'm making a script that respawns players in a created Taru transport pod when someone in the squad throws a certain color smoke down. I have it mostly working, except when I try to move the respawned player into the pod, it grabs their old dead body. I've tried using BIS_fnc_updatePlayerArray to try to update the array to the respawned unit, but it doesn't work to my intentions. Any ideas?

...
_playerGroup = group _thrower;
_deadPlayers = [];
_smokePos = getPos _smokeNade;
_smokePos = [_smokePos select 0, _smokePos select 1, (_smokePos select 2) + 500];
_pod = createVehicle ["Land_Pod_Heli_Transport_04_covered_F", _smokePos, [], 0, "NONE"];
{if (!alive _x) then {_deadPlayers pushBack _x}} forEach (units _playerGroup);
{[0] remoteExec ["setPlayerRespawnTime", _x]} forEach _deadPlayers;
sleep 0.1;
{[_x, _pod] remoteExec ["moveInAny", _x]; [_x, false] remoteExec ["allowDamage", _x;} forEach _deadPlayers;
...
little raptor
#

and don't use getPos

ionic orchid
# still forum Not safe

I've gone with an md5 hash of the profile name for now, so the filename will be (_uid + "_" + md5(_name) + ".ext")

hollow lantern
#

how can I get the config entry of a weapon? I don't seem to find it in the Config Viewer. Class name is rhs_weap_M230 (gun of an Apache). Basically what I'm looking for is what parents it references

hollow lantern
#

thanks!

#

worked flawless x)

winter rose
#

I am like that 😎

sometimes

once a year?

😭

hollow lantern
#

doesn't matter, I'll take two

austere hawk
#

Say i have a big data array, where each element has ["Land_someBuildingClass", < other data>].
To access a <other data> i use a known class and search for it in index 0 of the elements. Would hashmap be faster (using the classname as key) to access the data?

winter rose
#

no more searching through the array hoping to find the element

serene quiver
#

I have this sqf radar animateSource ["radar_rotation", 5000, 1];
to animate a rotating radar ( Land_MobileRadar_01_radar_F (tower) ).Works...BUT, how do I stop it now? LOL

winter rose
#

0, maybe?

finite sail
#

not quite your question, but it will stop when it's derstroyed

serene quiver
winter rose
#

animateSource "radar" 1, 1 then 1, 0

#

(or 0, 1, dunno)

#

wait, true as the last param

serene quiver
#

radar animateSource ["radar_rotation", 0, true]; works..thank you @winter rose

winter rose
robust hollow
#

you could use it with animationPhase to stop it the way it is facing (if it doesnt always stop on 0/1)

serene quiver
winter rose
#

then, with 5000 it will only do 5000 rotations

serene quiver
winter rose
#

that's weird, I would have thought they had implemented it as 0 = stopped and 1 = turning, not "number of rotations"

serene quiver
#

I need the radar to rotate until player deactivate it as a mission task

finite sail
#

turn off its simulation?

serene quiver
winter rose
#

the "infinite rotation" is the issue here

serene quiver
serene quiver
austere hawk
#

since the looping animation will propably use time as source, you just need to stop the time 😛

thorn saffron
#

I'm trying to add a variable to all units spywned by my function, but for some odd reason it does not seem to get set.

The spawning works fine and dandy, tested multiple times. The issue is setting the variable. The function is run via module placed on the map, I set isGlobal in the module config to 1. Testing it in singleplayer in editor. When I use getVariable it returns as <NULL>

private _soldier =_group createUnit [_x, _safePos, [], 0, "FORM"];
_soldier setVariable ["taro_srf_unit_faction", "TEST NAME", true];
austere hawk
little raptor
#

another issue might be the module running in preInit (so maybe the unit's var space isn't even created yet)

thorn saffron
#

no I think it doesnot, it even has delay set

#

there is more to the code, but that's how the spawning and variable setting is set up (for now)

#
// if any foot solders are definded create them as well
if (count _compSoldiers !=0) then {
    {
        _safePos = [_pos, 0, 30, 5, 0, 30, 0,[],[_pos,_pos]] call BIS_fnc_findSafePos;
        private _soldier =_group createUnit [_x, _safePos, [], 0, "FORM"];
        //if there is any code run it on the newly spawned vehicle
        if !(_code isEqualTo "") then {_soldier call compile _code;};
        _soldier setVariable ["taro_srf_unit_faction", "TEST NAME", true];
        sleep 0.3;
    } forEach _compSoldiers;
};```
#

I moved setVariable bellow compiling code, but no luck

#

I tried the spawning and setting variable via debug and it worked fine

willow hound
#

And ASoldier getVariable "taro_srf_unit_faction" returns <NULL>?

#

Is <NULL> the string representation of nil / Nothing?

thorn saffron
#

yes

#

if I set it via debug console it gets set fine

#

the call compile code works fine, tested via setdamage, so it's not like the newly created unit is somehow wrongly defined or something

hollow lantern
#

is there actually a efficient method available to force a helicopter to land at a specific dir? I'm currently doing a workaround like this:


        _heliPad = getPos(_aircraft getVariable ["KI_airSupport_heliPad", objNull]); // some coords from a helipad ;) 
        _originalHeading = (_aircraft getVariable ["KI_airSupport_heliHeading", objNull]); // 89.034

        _aircraft land "LAND";
        waitUntil {_aircraft distance _heliPad < 5};
        
        _aircraftRight = true;

        if (_originalHeading < 180) then {
            _aircraftRight = false;
        };
        _aircraftAdjust = true;
        while {_aircraftAdjust} do {
            if (_aircraftRight) then {
                _aircraft setDir ((getDir _aircraft) + 1.2);
            } else {
                _aircraft setDir ((getDir _aircraft) - 1.2);
            };
            sleep 0.01;
            if ((round (getDir _aircraft)) == (round _originalHeading)) then {_aircraftAdjust = false};
        
        };``` however that rotation is not seamless and looks scripted. ALso the helo drops literally to the floor once the while finishes.
thorn saffron
#

_muhHelo land "land";
It will land on the nearest available helipad

#

ah sorry, you want the helo to rotate/yaw to match a direction

hollow lantern
#

yes

#

landing is not the issue, the rotating part works as well with my code above but is not smooth and rather hacky

willow hound
copper raven
#

try adding small sleep before setting the variable, or use execNextFrame if you have CBA, just to test

#

i think there was some issues with owner of a freshly created unit being different next frame, maybe something similar is happening here

little raptor
#

I doubt it can happen in SP tho

thorn saffron
#

I don't think so either

_unit = group player createUnit ["B_RangeMaster_F", position player, [], 0, "FORM"];
_unit setVariable ["taro_srf_unit_faction", "TEST NAME", true];

This run in debug creates unit and sets the variable without any issues

#

Oh hey, this time it worked for some reason

#

¯_(ツ)_/¯

willow hound
#

How did you use getVariable?

little raptor
#

if (count _compSoldiers !=0) then {
no need for this

thorn saffron
#

yes there is a need for this

#

anyway, I think I done really dum and was packing wrong folder

copper raven
#

in the exact code above, it's useless

#

forEach won't run anyway

little raptor
thorn saffron
#

lets just say there is more to that whole thing

#

yeah, I done dum and was packing the wrong PBO

austere hawk
#

if a bool parameter inside config is entered as
someparameter = 1 instead of someparameter=true
will "[ bla ] call BIS_fnc_GetCfgData " or "[bla] call BIS_fnc_returnConfigEntry" return the number instead? and how do i check type correctness properly the easiest way then?

queen cargo
queen cargo
austere hawk
#

hm it might actually always just be a number - looking at configviewer, i dont see a true or false anywhere

winter rose
austere hawk
#

phew ok, that makes it easier

brazen lagoon
#

alright I have no fucking idea why this isn't working anymore

#

just gonna post it in here now

#

I'm modifying a limited arsenal script to pull its data from the server always, bc otherwise shit breaks in fascinating and infuriating ways in multiplayer. Anyone have any idea on this error message? Sample little bit of script has this:

    case "CreateListAll":{
        params["_display"];
        
        private _object = uiNamespace getVariable "jn_object";
        ["tt_jna_datalist", owner player, "MISSION"] remoteExec ["sg_fnc_getdata_server", 2];
        private _datalist = missionNamespace getVariable "tt_jna_datalist";
        missionNamespace setVariable ["tt_jna_datalist", []];
        {
            private _inventory_box = _x;
            private _index = _foreachindex;
            if(_index in [IDCS_LEFT])then{
                _ctrlList = _display displayctrl (IDC_RSCDISPLAYARSENAL_LIST + _index);
                lbclear _ctrlList;
                //create list with avalable items
                ["CreateList",[_display,_index,_inventory_box]] call jn_fnc_arsenal;
            };
        } forEach _datalist;```
#

sg_fnc_getdata_server looks like this:```sqf
if (!isServer) exitWith {};

private _variable = _this select 0;
private _client_ID = _this select 1;
private _namespace = _this select 2;

[(profileNamespace getVariable _variable), _namespace, _variable] remoteExec ["sg_fnc_getdata_client", _client_ID];```

#

sg_fnc_getdata_client looks like this:```sqf
private _data = _this select 0;
private _namespace = _this select 1;
private _variable_name = _this select 2;

if (_namespace == "UI") then {
uiNamespace setVariable [_variable_name, _data];
};
if (_namespace == "MISSION") then {
missionNamespace setVariable [_variable_name, _data];
};
if (_namespace == "PROFILE") then {
profileNamespace setVariable [_variable_name, _data];
};```

#

(the function naming here isnt the best)

robust hollow
#

owner player owner only works on server, so this needs to be clientOwner

brazen lagoon
#

The error I get is incomprehensible. It says _datalist is undefined

#

OK THANK YOU

robust hollow
#

you need to wait for the variable to be defined before setting it to _datalist

#

remoteexec isnt instant, it doesnt wait for the remote execution to finish, just for the message to send (/be added to the queue to send?)

brazen lagoon
#

oh you're right! cuz it's running async

#

does CBA have any functions for making passing data from client/server easier?

#

I feel like this is something CBA would have for sure

robust hollow
#

idk, never used cba. does the variable ever change on the server?

brazen lagoon
#

what do you mean?

robust hollow
#

does the data you get from sg_fnc_getdata_server change during a game.

brazen lagoon
#

potentially, yes

robust hollow
#

is it a big array?

brazen lagoon
#

yes

#

is this not the best way of doing it?

#

it's the contents of an arsenal so theoretically could be very very large

robust hollow
#

i just wonder if this would be better off as a public variable. sure it makes sense to limit sending the data to only those who need it, when they need it, but after a certain point this would surely use the network more than publicvariable.

#

especially because it requests the data every time the list is created

brazen lagoon
#

I'm not opposed to using publicVariable, I just didn't see a way to make it a read only variable for clients

robust hollow
#

the only way to make an array read only is to string it but thats ugly. is a client overwriting it a concern? if global updates only come from the server when it changes then it shouldnt be an issue?

brazen lagoon
#

I was just thinking about malicious scripts on the client but this is a co-op mission so who really cares if the person playing wants to ruin their fun fair enough i guess

#

I will probably just rewrite this to use publicVariable, though I do wonder about the network performance of that

#

because honestly, I don't really want to write a complex data synchronization algorithm I graduated already lmao

robust hollow
#

how many players can the mission have?

brazen lagoon
#

I think 12 total

#

but realistically I rarely play with more than 4 or 5 people

robust hollow
#

ehh, i'd say a few big public variables wont be a huge deal.

brazen lagoon
#

I'm less worried about it being a bandwidth problem for the server cuz it has gigabit and more with individual clients having fps problems because they have slow network

#

is setting publicVariable async on the client? Does it block?

robust hollow
#

itl take that little bit longer to load in and to receive the variable again if it updates, but the data size wouldnt be big by any stretch.

#

little bit longer to load
as in a second or so maybe, depending on the size.

brazen lagoon
#

I assume it doesn't do partial updates?

robust hollow
#

not unless you deliver the array in parts i dont think.

brazen lagoon
#

ugh jesus that sounds awful

robust hollow
#

you can always update the first function to wait for the variable to be delivered and stick with the setup you have, but i think a bit of sub-optimal code isnt the end of the world in this case.

brazen lagoon
#

most likely not, just gonna see if publicvariable works well enough and if it doesn't just rework my existing code

hollow thistle
brazen lagoon
#

is this like pub/sub basically?

hollow thistle
#

You register event handlers and send the events... so kinda

#

Not very much different from bis scripted events but more robust.

drifting sky
#

when you put a function name in an array or variable, it puts only an index to that function, and not all the function text, correct?

robust hollow
#

uhmm... depends what you mean. [BIS_fnc_inString] would be [{/* code of BIS_fnc_inString */}]

#

(as an example ^)

drifting sky
#

if I have a function like: func_A = { blah blah blah }; B = func_A;

#

B = index to func_A, right, and not {blah blah blah};

robust hollow
#

b would be the code of func_A, not a reference to func_A

drifting sky
#

can I get the index to a function?

#

so I don't have to use a bit switch statement?

#

or let me put the original question a different way

robust hollow
#

b = "func_A"; and then use getvariable if you need the code later

drifting sky
#

is the text in func_A actually coppied, or just referenced?

robust hollow
#

copied. only arrays are referenced

#
a = {1};
b = a;
a = {2};
a; // {2}
b; // {1}
cerulean cloak
#
{
    [
        _x
    ]  call mts_markers_fnc_deleteMarker;
} foreach 
[
prefix_1,
prefix_2,
prefix_3,
prefix_4,
prefix_5];

Is there a shorter way to do that where prefix_1-5 are variables with a string as there content?

robust hollow
#

if it is always those 5 then that is probably the best way. you could do the same thing with a for loop to look a bit neater, but it does more work to achieve the same thing

for "_i" from 1 to 5 do {
    [missionNamespace getVariable ["prefix_" + str _i,""]]  call mts_markers_fnc_deleteMarker;
};
cerulean cloak
#

Thanks, I'll go for what you did since there's actually 16 of them but didn't want to type them all out.

drifting sky
#

RESOLVED can anybody spot why the radio trigger statement is not working in this example? radio_triggers = []; for "_i" from 0 to 7 step 1 do { _new_trigger = createTrigger [ "EmptyDetector", [0,0]]; _name = ["ALPHA","BRAVO","CHARLIE","DELTA","ECHO","FOXTROT","GOLF","HOTEL"] select _i; _new_trigger setTriggerActivation [ _name, "PRESENT", true ]; _statement = str(_i+1) + " call func_process_command"; _new_trigger setTriggerStatements ["this",_statement,""]; radio_triggers = radio_triggers + [_new_trigger]; };

#

My bad. It was actually a logical error. _i+1 should have just been _i

robust hollow
#

you could optimize that a little bit if you want ^
has some minor unnecessary things going on.

waxen tendon
#
for "_i" from 1 to 4 do {
    //spawn plane
    _bluforPlaneN = createVehicle [...]
}```
is it possible to have a self modifying N here?
robust hollow
#

technically yes i think so but it isnt clean to do with local variables

#

you'd be better off inserting the vehicles into an array if they are only used in that one script

#

this is the logic behind it for local variables but its very 🤢 🤮

_vars = []; 
for "_i" from 1 to 4 do {_vars pushBack ("_bluforPlane" + str _i)}; 
private _vars; 
 
for "_i" from 1 to 4 do { 
    _i call compile format["_bluforPlane%1 = _this",_i]; 
}; 

_bluforPlane2 // 2 (or in your case the object from createVehicle)
drifting sky
#

Does isPlayer return whether a unit is controlled by a player, or whether it is playable?

robust hollow
#

if the unit is controlled by a player

dusty badger
#

Is it possible to change difficulty parameters for individual players?

#

For example could an individual player have mapContentFriendly set to 1, while everyone else has it set to 0, so that they can see friendly positions on the map but everyone else cant?

robust hollow
#

i dont believe so because difficulty settings in mp are defined by the server. you could script your own replacement for it though, then allow for toggling that.

dusty badger
#

shame, I imagine having the game do it would be the most efficient way

craggy lagoon
#

Can setVariable be set to a weapon like a mortar "B_T_Mortar_01_F", if so how? Would like to be able to set triggers that would enable and disable the ability for players to use them. The triggers would simply change the setVariable status between true and false.

cerulean cloak
#

If you want the mortar to be unusable then you can just do something like this.

while {variable} do
    {
        {
            _x moveout;
        }foreach [crew mortar_1];
    };
#

@craggy lagoon

#

That'll do it for one specific mortar

queen cargo
# robust hollow copied. only arrays are referenced

That actually is not correct. Everything in sqf is passed by reference
Variables hold references only
And Arrays are the only datatype pretty much that can be modified, thus appearing to be the only references with everything else copied

cerulean cloak
#
while {variable} do
    {
        if (typeOf vehicle player ==  "B_T_Mortar_01_F") then 
            {
                {
                    _x moveout;
                }foreach [crew vehicle player];
            };
    };

And that'll do it for all mortars of classname "B_T_Mortar_01_F"

craggy lagoon
#

Thank you. Where do I put this code? Sorry I'm just starting to learn this stuff and it's not going well. HAHA

cerulean cloak
#

If you want it could go in the init.sqf or if you want it in a trigger make the condition variable and the stuff after do the activation

#

Make sure the trigger is repeatable though

craggy lagoon
#

@cerulean cloak Thanks, I'll give it a shot.

little raptor
#

@cerulean cloak @craggy lagoon why do you use a loop?

#

use an event handler instead:

#

example:

this addEventHandler ["GetIn", {
    params ["_vehicle", "_role", "_unit", "_turret"];
    moveOut _unit;
}];
cerulean cloak
#

Because I'm not familiar with event handlers

little raptor
#

you should be

#

otherwise you're going to make really slow missions/mods with those loops

cerulean cloak
#

How big of a performance hit is one loop really?

little raptor
#

depends. but the main problem is that a loop stays in the scheduler queue. an event handler only executes when that event happens

#

plus it happens EXACTLY when that event happens

#

loops in the scheduler have delay

craggy lagoon
#

@little raptor Thank you, I will look into that as well.

cerulean cloak
#

Pick leopards thing over mine and it looks like it should go in the vehicle init

little raptor
#

the code executes when that event triggers

cerulean cloak
#

Next time I'm going to use a loop I'll think twice and look for an appropriate EH

little raptor
#

also, I'd recommend that you always consider the event handler approach whenever you can