#arma3_scripting

1 messages Β· Page 699 of 1

radiant yacht
#

call{this playMove "Acts_welcomeOnHUB04_AIWalk_2" ; this disableAI "anim" ;}

for some reason this doesn't want to work...

crude vigil
copper raven
#

it is defined, if called from initbox

crude vigil
#

is it passing properly? Since it is special variable, Im not sure of it

copper raven
#

its a local variable

#

nothing special about it, apart it not having the usual _ prefix

crude vigil
#

well yeah, when someone says "it doesnt want to work" I for some reason instantly assume they receive an error πŸ˜”

gusty bone
#

Where do i save a custom .sqf file?

willow hound
gusty bone
#

ok so my coding isnt doing what i want it to prject an image on a tv but my coding isnt working and just showing the camera as half way in the ocean

#

my sqf file

#

/* create render surface */
tv setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];

uav lockCameraTo [tgt, [0]];

/* create camera and stream to render surface */
cam = "camera" camCreate [0,0,0];
cam cameraEffect ["External", "Back", "uavrtt"];

/* attach cam to gunner cam position */
cam attachTo [uav, [0,0,0], "PiP0_pos"];

/* make it zoom in a little */
cam camSetFov 0.1;

/* switch cam to NVG */
"uavrtt" setPiPEffect [0];

/* adjust cam orientation */
addMissionEventHandler ["Draw3D", {
_dir =
(uav selectionPosition "laserstart")
vectorFromTo
(uav selectionPosition "commanderview");
cam setVectorDirAndUp [
_dir,
_dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
];
}];

drifting sky
#

Are event handlers added with addEventHandler fired on the machine on which the object it is attached to is local, or are they fired on the server?

#

or only on the machine on which the event handler was added?

somber radish
#

If its not MPeventhandler

#

Then it is local

#

(afaik EH is local to the machine that created it)

drifting sky
#

to the machine that created the event handler? Or to the machine on with the object it's attached to is local?

somber radish
#

(However I havent tested having one machine create an Object, then attach a EH using another machine)

low sierra
#

Good night.

magic sundial
#

Anyone know how to make an expression where all alive players must be in an area for a trigger to activate

#

this is what i currently have

#

{alive _x} count players == {_x inArea ThisTrigger && {alive _x}} count players;

crude vigil
magic sundial
#

Thank you!!

torpid quartz
#

need some help with GetPos and SetPos

 player setPos (getPos TP1) +0,+0,+10] 

Trying to TP a player into a tunnel that's floating above the ground off map, they're teleporting to an item inside the tunnel but on the ground not inside the tunnel, So i want to increase their Z position when they teleport

how would I add the Z offset to the GetPos i'm using? Adding +0,+0,+10] doesn't work.

#

player setPos (TP1 modelToWorld [0,0,0]);  

works well if anyone finds this message later

warm hedge
#
(getPos TP1 vectorAdd [0,0,10]);```^this is how to do that @torpid quartz
dusty depot
#
params ["_player", "_data", "_var"];
_id = owner _player;
_uid = getPlayerUID _player;
compile _var = ["read", [_uid, _data, nil]] call inidbi;
_id publicVariableClient _var;
#

i wanna make a function that receive some values and a string then store the result in a new variable whose name is the string received by params

#

will this work?

cosmic lichen
#

Test it Β―_(ツ)_/Β―

elder sail
#

If I'm trying to trigger a script or make a vehicle delete itself upon reaching a waypoint, should I be using setWaypointScript or setWaypointStatements?

cosmic lichen
#

Is the waypoint placed in the Editor?

elder sail
#

It's spawned by the script

cosmic lichen
#

setWaypointStatements

final trench
#

Hello guys I am making a WW2 mission where a lot of planes go and people static line drop out like operation market garden. Thing is I can do it the reinforcement module but it will take time is there a way to do it using scripts. Than you in advance if I don't reply please dm.

#

I have knowledge of scripting just to be clear

sharp grotto
#

Is there a command like player addMagazine ["30Rnd_556x45_STANAG", 15];
but usable for adding magazines with a specific amount of bullets to containers/groundholders ? πŸ€”

sharp grotto
#

Uff thank you, i must be blind. I thought i checked all these commands πŸ˜… πŸ‘

south notch
#

Does anyone have a good method of ensuring task state, creation etc is synchronized between clients and server I would much appreciate if you'd let me know. I have found so far that some people got it working but don't know how they did really.

winter rose
frosty cairn
#

Anyone here knowledgeable in CBA and ACE3 scripting?

warm hedge
#

Better to put your exact question beforehand

frosty cairn
#

Alright.

#

Me and my friend are adding a ace drug mod.

winter rose
#

again

#

ACE has a Slack, available in #channel_invites_list πŸ™‚ (if the question is still related to your earlier question)

frosty cairn
#
class ACE_Medical_Treatment_Actions
{
    class Morphine;
    class compat_Pervitin: Morphine
    {
        displayName = "Pop a Pervitin Tablet";
        displayNameProgress = "Time to have the time of your life!";
        allowedSelections[] = {"Head"};
        items[] = {"compat_Pervitin"};
        treatmentTime = 4;
        callbackSuccess = QUOTE("I work you retard!" remoteExec ["hint"]);
        animationPatient = "";
        animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
        animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon"};
    };
};
#

Main thing to pay attention to is the callbackSuccess.

#

Now me any my friend at first tried to create a function and then put

QUOTE(call FUNC(pervitinEffect))
#

(The function is called pervitinEffect)

#

and within the function I have simply written:

"I work you retard!" remoteExec ["hint"]
#

(To test if it's able to call it)

#

but then I get an error about a "=" somewhere

#

and that's basically where me and him are at.

winter rose
#

try
callbackSuccess = "call pervitinEffect";

#

no CfgFunctions thing?

frosty cairn
#

I'll give it a shot.

winter rose
#

it's not e.g TAG_fnc_pervitinEffect?

frosty cairn
#
class CfgFunctions
{
    class pervitin
    {
        class myCategory
        {
            class pervitinEffect {file = "ThePharmacy\pervitinEffect.sqf";};
        };
    };
};
#

This is what I have rn.

#

Do I have to #include the .sqf in the config.cpp as well?

real tartan
#

want to find nearest object from array, any ideas and suggestions welcome

TAG_fnc_findNearestObject = {
    params ["_unit", ["_objects", []]];

    private _object = objNull;
    private _distance = 99999999999999999;
    {
        if ( _x distance2D _unit < _distance ) then 
        {
            _distance = _x distance2D _unit;
            _object = _x;
        };
    }
    forEach _objects;

    _object
};
copper raven
#
private _mapped = _objects apply {[_x distance2D _unit, _x]};
_mapped sort true;
_mapped select 0 select 1
vernal sedge
#

Trying to setup a way to re-spawn with the same load out as you die with specifically for MP missions though can't get it working (I've been away from scripting for some time now, out of touch) Here's what I've got so far: (Also please tag me if you've got an answer, I do try to read through the messages but after a couple days there's so many to filter through)

**onPlayerKilled.sqf:**
savedLoadout = getUnitLoadout[player, true];
**onPlayerREspawn.sqf:**
player setUnitLoadout[savedLoadout, true];
winter rose
winter rose
vernal sedge
cosmic lichen
#

This definitely works.

vernal sedge
#

Works like a charm. Many thanks revo

winter rose
#

it has been made for a very specific reason… basically, many unspecific requests πŸ˜„
a lifesaver indeed πŸ™‚

frosty cairn
#

So incase we use it, would I need to write callbackSuccess = "call pervitin_fnc_pervitinEffect"

#

I am gonna change it, just wonderin.

winter rose
#

yep

frosty cairn
#

Ah, oki.

winter rose
#

are they "close enough" already?

#

other than that, the syntax seems right

#

try setting a bigger refresh value

#

e.g 20 (10 can be a bit short for long distance AI calculation)

little raptor
#

I just looked at the function and it is really bad. just do your own thing

#

it doesn't do anything special anyway

#

running into most buildings will stop them from chasing
they just can't. buildings have special path LODs, which are just lines. unless the position you give them falls on those lines, no path can be generated to that building

#

also waypoints are inaccurate by nature

#

_stalkerGroup addWaypoint [(leader _stalkedGroup),_radius];
the default radius is zero, so the waypoint is no accurate

#

buildingPos is the only way

#

also only 1 AI can occupy a buildingPos

#

also not possible to make them go there via waypoints afaik (maybe they can if you set the radius to -1)

past gazelle
#

@little raptor Are you the same guy who is working on Super AI?

little raptor
#

yes. notlikemeow

past gazelle
#

Cool, I just watched the youtube video for it. Next time you make one, turn the music down so I can hear what you have to say. πŸ˜‰

#

Any release date yet?

little raptor
#

Β―_(ツ)_/Β―

past gazelle
#

Awesome.

slate cypress
#

Are the code . . . parameters of BIS_fnc_holdActionAdd global or local?

copper raven
#

local

meager epoch
#

Is there any way for a trigger to get activated once the Virtual Arsenal has been closed?

little raptor
meager epoch
#

xd

little raptor
#

triggers are loops

#

better avoid them

#

unless necessary

meager epoch
#

I need a task to be set to completed after the player closes the VA.

little raptor
#

anyway, what you want are Event Scripts

little raptor
#

no need for triggers

#

wait

#

not Event scripts

#

Scripted Event Handlers meowsweats

meager epoch
#

Right

#

Which one tho

#

Ive read somewhere that containerclosed or whatever its called isnt working with the VA

little raptor
#

"arsenalClosed"

meager epoch
#

Oh

#

Neat

#

Salute

little raptor
#

not Scripted Event Handlers

meager epoch
#

Oh

little raptor
meager epoch
#

thank :)

#

@little raptor do i need to write smth instead of the missionNamespace or just leave it like that?

little raptor
#

like that

meager epoch
#

Ok thanks

little raptor
#

just change "myTask"

meager epoch
#

Yeye

vernal mural
#

hey there, I have some strange problems while trying to use filepatching :
my sources have a systemchat "hey"; when starting a game
I have an unpacked file properly named and placed which replace with systemchat "yo";

Let's say I start the game, then go in editor :

  • function viewer says "yo"
  • systemchat says "yo"
    All work well.

Then I go back to my unpacked file and change it from "yo" to "bonk". Back to the game (no restart) :

  • function viewer says "bonk"
  • systemchat says "yo"
    What is happening here ?

Then I restart mission, or go back to editor then reload mission :

  • function viewer says "bonk"
  • systemchat still says "yo"
frosty cairn
#

@winter rose Are you knowledgeable in Post Process stuff?

vernal mural
#

Online doc says :

#

Ability to modify unpacked data during runtime. Readable; always possible
to modify a file's content (except configs); modifications available live
or via mission restart.

#

that does not seems to work properly πŸ€”

#

woops, sorry for crosstopics

#

I didn't pay attention while typing my stuff, my bad

still forum
vernal mural
#

{ROOT}\fr\gsri\skydiving\functions\newton\fn_skydivingInit.sqf when {ROOT} is my game's main directory

#

and fr\gsri\skydiving is my addon prefix

still forum
#

if you do loadFile "fr\gsri\skydiving\functions\newton\fn_skydivingInit.sqf" ingame, do you see the contents of your new file?

#

did you enable allow functions recompile in CfgFunctions?
I assume you're using CfgFunctions?

vernal mural
#

I do

#

I saw there is some fiddling to do when using CBA but I'm not

#

did you enable allow functions recompile in CfgFunctions?

#

I can't find anything about that in doc

vernal mural
#

I only saw something about allowFunctionsRecompile = 1; in description.ext

still forum
#

yes

#

that

vernal mural
#

doesn't this only apply to description.ext's CfgFunctions ?

still forum
#

no

vernal mural
#

lemme try that

#

I think I tried at some point

#

but not sure of what I did so safe to say I didn't

#

As a security measure, functions are by default protected against rewriting during the mission.

#

doesn't this mean that restarting the mission should recompile even without having the allowFunctionsRecompile flag ?

#

erhm, game crashes with access violation code

still forum
#

oof

little raptor
#

if you want my advice just don't use filePatching

#

there are better ways to do what you want

still forum
#

make FT ticket with the crashdump (.mdmp file) or send me via DM

vernal mural
#

steps :

  • have the unpacked file to systemchat "value A";
  • start game, load mission with allowFunctionsRecompile=1 in editor
  • preview mission, displays "Value A"
  • change unpacked file to systemchat "Value B";
  • open function viewer, can see Value B, click on "recompile selected", nothing happens but game is responding.
  • close function viewer, restart mission ==> game crash
still forum
#

Ticket/Crashdump please, otherwise can't fix bug

vernal mural
#

yep I'm retrieving it πŸ™‚

#

having a look at it

vernal mural
#

for now I develop stuff in a dev mission, which allow for some freedom

still forum
#

Never had issues with filePatching, I always use it

vernal mural
#

but I then need to sync sources with the addon folder for git and build pipeline

#

filepatching would be much better

little raptor
torpid pewter
#

I'm trying to run the command player selectWeapon primaryweapon player;
but instead of running it on the player I'm running it on a script on a different player so it'll look like _target selectWeapon primaryweapon _target;

It doesn't work if I do it like that and I think I have to use remoteExec but I'm not sure how. How do I do this?

little raptor
past gazelle
#

Is there a way to reset the script error dialog box (the black box) once it's been activated? it seems on my waituntil error it just never goes away...

#

I'm 'in mission'

copper raven
#

it never goes away because waitUntil keeps on executing its code

#

so to prevent the box from permanently staying there, you have to fix the script error

past gazelle
#

Oh and restart the mission, there's no way to trigger the _handle by rerunning the code to get it to stop?

#
_handle = [] call PIZZA_fnc_revealToLocalUnits;
waitUntil { sleep 1; scriptDone _handle };
#

This is what I'm using. I copied it from another script that works but it seems like 1 out of 5-10 uses causes this error...

past gazelle
#

oh...

little raptor
#

and you don't need waitUntil anyway

copper raven
#

does PIZZA_fnc_revealToLocalUnits return a script handle even?

past gazelle
#

well it works most of the time πŸ˜›

copper raven
#

i mean it depends on what that function does πŸ˜„

past gazelle
#

When running, it calls a function like BIS_fnc_typetext which spawns itself...

copper raven
#

you might not even need to waitUntil like Leopard said

past gazelle
#

but I want to wait until the typetext is absolutely done before letting the script continue...

little raptor
#

I think you're misunderstanding the concept of scheduled environment
call from scheduled environment is scheduled

past gazelle
#

sure but what if inside the call is ] spawn FRED_fnc_typeText; ?

little raptor
#

why would you want to spawn it?

#

just call the function

past gazelle
#

Um, because calling it gave a HUGE number of errors πŸ™‚

little raptor
#

and no need to wait for it

still forum
#

async text typing, like you see in Arma campaigns

#

You want to slowly write text letter by letter. But also wait for it to be done, thus scheduled

little raptor
#

if the environment is scheduled, it'll also be scheduled

#

Β―_(ツ)_/Β―

#

why spawn?

copper raven
#

im some very rare case when you don't want to block the spawned script πŸ˜„ (just what came to my head)

little raptor
past gazelle
little raptor
#

which means you shouldn't be able to use sleep/waitUntil either

#

I'm pretty sure you're just doing it wrong

#

there's just no need for spawn/waitUntil here

little raptor
past gazelle
#

Which one? the text script?

#

or just all-o-em?

little raptor
#

any part that's relevant

past gazelle
#

hmm, let me upload em somewhere

little raptor
#

you can just dm them to me

torpid pewter
#

Turns out I didn't have to do remote exec I was putting it in the wrong place and got it to work, however that brings me to my next issue.
Right now I'm using ```sqf
player selectweapon currentweapon player;

And that's not quite what I want.  I want to select *no* weapon but there doesn't seem to be a built in command for that.
I've tried ```sqf
player selectweapon "";

but that doesn't work unfortunately. What I'm trying to do is run this command for a revive script so that if a player has a launcher out it'll switch weapons for them in the downed state so when they get revived it doesn't force them to stand up and pull out their launcher like it does now (the vanilla revive has the same issue might make a ticket about it). The currentweapon method does work, but not for the edge case of the player not having a primary weapon. I want it to simply bring out no weapon instead so it'll work even if the player only has a launcher. It's not super common, but if I can fix it I'd like to.

copper raven
#

use action switch weapon maybe

little raptor
torpid pewter
#

I think it's because the new place I put it in was a different script file with the proper locality which I'm not sure if is the right way to describe. I still struggle with that stuff.

Which action? I found https://community.bistudio.com/wiki/Arma_3:_Actions#SwitchWeapon but there doesn't seem to be an option for no weapon.

little raptor
#

iirc it goes:

_unit action ["SwitchWeapon", _unit, _unit, 100];
#

test it on player first

#

if it works then use it

#

I think you may need to remoteExec this

torpid pewter
#

It does seem to work in local hosted multiplayer so hopefully it work on a dedicated server too. Thanks for the help.

little raptor
#

if so, no guarantee. self-hosted MP = SP

brazen lagoon
#

think about how player will resolve

#

on local hosted mp calling player on the server will resolve to you

#

on a dedi player resolves to the server, not you

#

the same is true for script locality

real tartan
torpid pewter
#

Yeah works on a dedicated server just fine. I'm guessing the script file is in the right context where I don't have to use remote exec for these particular commands. In this case _unit seems to be defined as the remote player so it's not necessary, at least to my understanding.

little raptor
#

_unit is not defined unless you defined it

torpid pewter
#

Yeah it looks like it was. Sorry if I'm confusing some of the terminology I'm just editing and testing to see what works.

past wagon
#

is there a way to "shuffle" an array?

little raptor
past wagon
#

nice

#

thanks

fair drum
#

can I unpack .ebo files with pbo manager?

still forum
#

no

fair drum
#

which tool will allow it? need to dig deep into the tacops addons files to reverse engineer an idea

still forum
#

None

fair drum
#

dang. I just want access to
A3\Modules_F_Tacops\Ambient\CivilianPresence\FSM\behavior.fsm"

#

just wondering how they ended up creating waypoints for agent civilians since an agent doesn't have a group/leader

normal abyss
#

Is it possible to check if a player can have an array of items added to their inventory. Since canAdd is only limited to a single item?

still forum
still forum
fair drum
still forum
#

You can accumulate the "mass" of all your items, and then find some object and count that accumulates to the same mass and pass that to canAdd

normal abyss
#

So read a units inventory and find the config mass? Then just use canAdd with another item that has something like 1 mass?

still forum
#

yeah

#

that will still not be perfect, but better than nothing πŸ˜„

normal abyss
#

I'll give it a go, thanks.

fair drum
#

ok, so they use setDestination for agent units. good to know

astral dawn
#

oh I am a bit late

#

But do you know how to stop them???

fair drum
#

nah feed me more info! lol

astral dawn
#
_hO setDestination [ getPos _hO,"LEADER DIRECT",true]; // Doesn't want to stop otherwise sometimes
doStop _hO;
#

well _hO is the agent of course

still forum
fair drum
astral dawn
past wagon
#

you can do a forEach loop inside another forEach loop, right?

warm hedge
#

Yes

#

If you wanted to use the outer _x inside the inner forEach, define outer _x as a variable

past wagon
#

yeah

#

otherwise, they would be separate, right?

warm hedge
#

Separate as what context?

#

The _x will be overwritten inside, so you cannot access the outer one via _x

elder sail
#

Is there a forceAdd option/equivalent for anything besides Uniforms? ie: helmets/vests ?

warm hedge
#

Just addHeadgear, addVest

elder sail
#

So if I want a blufor unit to have a specific helmet/vest from opfor would I use setUnitLoadout instead?

warm hedge
#

What?

#

There's no restrictions other than uniforms

brazen lagoon
#

oh hey on this note

#

is there an add-on that disables those restrictions

#

I don't actually know how it works internally

warm hedge
#

Uniform restrictions?

brazen lagoon
#

like how opfor can't wear blufor uniforms

warm hedge
#

It's defined in config

silk ravine
#

[true] call ace_spectator_fnc_setSpectator executing this in the init section of one of my kurator slots forced all sofar connected player clients to move into spectator upon player being initialized at spawn. Is that behaviour intended, am I misusing this the command?

#

0: Spectator state of local client <BOOL> (default: true) for what I see in the framework docs the argument is local to the slot from whichs initfield the fnc is executed.

fair drum
silk ravine
fair drum
#

you can add a:

if (local this && isPlayer this) then {
    [true] call ACE_spectator_fnc_setSpectator;
};
#

which will make it only fire where that unit is local

silk ravine
fair drum
void delta
#

Is there a command to check if an object or unit is synced to a module from the eden editor?

void delta
#

Thank you

elder sail
#

I'm trying to get a script to repeat a section until an object is touching the ground. So far I have this as my test and I know I've done something wrong, I'm just not sure what. (_object is the object's variable name):

OnGround = false;
while {_OnGround = false} do {
    hint format ["Not on ground."];
    sleep 30;
};

if (isTouchingGround _Object) then {_OnGround = true; hint format ["On ground."];};
copper raven
#

you aren't returning anything to the while condition, and just permanently assigning false to some variable, = is assignment, == is comparison, but even then comparing a boolean to boolean is non sense

#

but then also the rest of your code is wrong, if errors are fixed, that while loop will just loop forever

elder sail
#

Ohh okay I understand

#

If I'm understanding correctly - presuming I have _Object set to the object's variable name, something like this would make more sense then right?
while {(isTouchingGround _Object) == false} do {*Stuff goes here*};

#

Or am I completely fubar

#

Success! @copper raven thank you ❀️

copper raven
#

don't compare a boolean to boolean

elder sail
#

Oh okay yeah I see what you mean now

sharp grotto
#

Is there any way to spawn the static guns with createvehicle without them getting destroyed or tipping over ?
I tried everything, even spawning it a bit above the surface and they still fall over or get destroyed notlikemeow

warm hedge
#

Then I think it is a static-side issue, aka Mod issue

sharp grotto
#

iam testing with vanilla static guns and mod guns, both same behaviour

warm hedge
#

What exactly is the situation then?

sharp grotto
#

I assemble them with the normal function, send a command to server then getposATL, delete the "old gun" and spawn it again at [0,0,1] and then setposATL to the final position

warm hedge
#

Normal function?

sharp grotto
#

vanilla assemble function

warm hedge
#

Define it

#

AKA elaborate it

sharp grotto
#

I put one of the backpacks on the ground, take the other one, aim on the one on the ground and use the action menu to assemble it

warm hedge
#

Ah that feature?

sharp grotto
#
_OldStaticGunObject = objectfromNetID _StaticGunNetID;
_OldGunType = typeOf _OldStaticGunObject;
_OldGunPos = [getposATL _OldStaticGunObject select 0, getposATL _OldStaticGunObject select 1,(getposATL _OldStaticGunObject select 2) + 0.25];
_OldGunDir = getdir _OldStaticGunObject;
deleteVehicle _OldStaticGunObject;

_StaticGunObject = createVehicle [_OldGunType, [0,0,1], [], 0, "CAN_COLLIDE"];
_StaticGunObject setdir _OldGunDir;
_StaticGunObject setPosATL _OldGunPos;
little raptor
sharp grotto
#

Even on a flat surface it doesn't work 95 % of the time and it either breaks or falls over notlikemeow

little raptor
#

use setVehiclePosition instead of setPosXXX

sharp grotto
#

weirdly enough this seems to work

_OldGunPos = getposATL _OldStaticGunObject;
_StaticGunObject setVehiclePosition [_OldGunPos, [], 0, "CAN_COLLIDE"];

If you feed it with a position array it doesn't arma3

#

nvm, just a few times lucky.....

little raptor
#

you're spawning it at [0,0,1]

#

that could be water

#

wrap it in isNil

sharp grotto
#

We spawn 300 + vehicles (every server restart) that way and it never caused problems ^^

little raptor
#

the way I see it from that gif, the vehicle is already destroyed

#

it has nothing to do with the setPos stuff

little raptor
#

UAVs and Turrets get destroyed immediately upon contact with water

sharp grotto
#

Gonna try this then

_OldGunPos = getposATL _OldStaticGunObject;
_StaticGunObject = createVehicle [_OldGunType, [0,0,300], [], 0, "CAN_COLLIDE"];
_StaticGunObject setdir _OldGunDir;
_StaticGunObject setVehiclePosition [_OldGunPos, [], 0, "CAN_COLLIDE"];
little raptor
#
isNil {
_StaticGunObject = createVehicle [_OldGunType, [0,0,1], [], 0, "CAN_COLLIDE"];
_StaticGunObject setdir _OldGunDir;
_StaticGunObject setPosATL _OldGunPos;
};
sharp grotto
#

no difference, breaks 95 % of my attempts

little raptor
#

use "NONE"

sharp grotto
little raptor
sharp grotto
#

Thanks for the help, i will try some more. Might work now this way (It did 10 times now, even on buildings etc)

_OldGunPos = [getposATL _OldStaticGunObject select 0, getposATL _OldStaticGunObject select 1,(getposATL _OldStaticGunObject select 2) + 0.25];
deleteVehicle _OldStaticGunObject;

isNil {
_StaticGunObject = createVehicle [_OldGunType, [0,0,500], [], 0, "NONE"];
_StaticGunObject setdir _OldGunDir;
_StaticGunObject setPosATL _OldGunPos;
};
elder sail
#

If I'm using createVehicle to spawn a smoke grenade, is there any way to apply timeToLive to make it last longer?

#

Maybe making a separate variable/class for the smoke?

ornate sky
#

@elder sail Since timeToLive is a config option, you would have to essentially make a mod to do so.

Alternatively, you could use a loop to respawn the grenade every 60 or 55 seconds.

elder sail
ornate sky
#

np, short of making a mod, I think a loop is the best solution

copper raven
past gazelle
# little raptor

Thanks for the help yesterday. I think everything is working smooth now...no script errors from my stuff anyway...

modern jackal
#

pls help, need respawn AI tripulate vehicles ,but idk how,only respawn empty vehicles heeeeeeeeeeelp 😫 😫 😫 😫

sharp grotto
modern jackal
void delta
#

or is there another solution I'm not thinking of?

fair drum
void delta
#

I forgot to delete the second part of that message. The solution to my question was staring me right in the face so I deleted the post.

#

my bad

worn elm
#

Trying the very simple below spawn & lambs rush scripts, I get the following error, has worked before but a bit unsure what I'm missing. Anyone have any quick suggestions what I need to change.

"Local Variable in Global Space"

`_grp1 = [getMarkerPos "spawn1", east, ["UK3CB_CHD_W_O_SL", "UK3CB_CHD_W_O_TL","UK3CB_CHD_W_O_MK","UK3CB_CHD_W_O_LAT","UK3CB_CHD_W_O_RIF_1","UK3CB_CHD_W_O_AT"],0] call BIS_fnc_spawnGroup;

[_grp1, 1000, nil, nil, getmarkerPos "rush1"] spawn lambs_wp_fnc_taskRush;`

fair drum
#

you put this in a init box in the editor?

#

if so, local variable in global space is an old bug

worn elm
#

sorry yes, slot in trigger bit on activation.

#

spawn marker & target marker

#

Only other bit is this so Zeus doesnt trigger triggers this && (thisList findIf { isPlayer _x } != -1)

fair drum
#

that error won't go away. its a bug. take the script external from the trigger

worn elm
#

ah fine, seems like an old bug but has worked before

#

annoying

#

Weird its only the rush piece that cause the error, spawning is fine.

torpid pewter
#

I have a script with what I think is a global variable with an array full of classnames that looks like this.

classlist = [class1,class2,class3,etc]

What I'd like to do is add more arrays to that class list so it'd look something like this classlist = [ [array1] [array2] [array3] ]

Then I want to script it so it picks one of the arrays and only use classes from that array. So something like a switch case, but I'm not sure how to apply a switch case in this context.

torpid pewter
#

I was overthinking it, got it to work with a simple switch floor random command.

torpid pewter
#

doesn't that only search within an array not between arrays?

warm hedge
#

What your array look like?

torpid pewter
#

It's 3 separate arrays technically, but my current method looks like this

switch floor random 3 do {
    case 0: {
    a3e_arr_Escape_InfantryTypes = [
    //Rifleman
    "CUP_B_BAF_Soldier_Rifleman_DPM"];
    };
    case 1: {
        a3e_arr_Escape_InfantryTypes = [
        "CUP_B_BAF_Soldier_AA_DPM"];
    };
    case 2: {
        a3e_arr_Escape_InfantryTypes = [
        "CUP_B_BAF_Sniper_AS50_TWS_DPM"];
    };
};
#

works well enough

warm hedge
#

Why you put a string into an array?

torpid pewter
#

it's an array full of classnames, in this case infantry units. There will be a lot more but it's just a few to demonstrate.

warm hedge
#

So those a3e_ things had a LOT of classes not only one?

torpid pewter
#

yeah each one has dozens and sometimes hundreds

#

basically trying to select between n different sets in this case 3

warm hedge
#

Well got the situation. Still this can be simplified by selectRandom like a3e_something = selectRandom [[classesA],[classesB],[classesC]]

torpid pewter
#

that's what i mean though would select random only pick classes from one array or would it pick classes from all 3. I haven't used that command and the wiki's description and examples aren't clear for my use case.

warm hedge
#

One array. Even if the picked element is an array, it will return the array not a random element of it

torpid pewter
#

Yeah looks like the example on the old "BIS_fnc_selectRandom" page shows that too. That is a bit neater, I think I might have an idea to expand my current switch case so I'll keep it like that for now but the simpler way is good too.

warm hedge
#

BIS_fnc_selectRandom is the same (exists only for backward compat) thing

torpid pewter
#

Yeah, more meant that the example on the page showed that it'll pick one of the arrays and not the elements themselves.

warm hedge
#

You mean that, gotcha. I probably add an example there

winter rose
#
selectRandom selectRandom [["Hello", "there"], ["General", "Kenobi"]]
```this? @torpid pewter
snow pumice
#

Hey i am currently working on an Loading-screen and ran into to problem that you cannot open 2 Dialogs and keep one as background.
Is there any work around for this?
I would need the loading-screen to be opened and an new dialog (lets say the spawn screen) to show up above it.

I think the only way is to merge them and to ctrlshow false the ones i dont wanna see right?

winter rose
dreamy kestrel
#

Q: is BIS_fnc_bitflagsCheck analog to saying x & y in a C/C++? i.e. does not matter which side, left or right, the operands occupy?

#

for instance, as it is written in the docs, I would expect flagset to be a super set of the flag, however, both of these return true:

   [2+4+8,2] call BIS_fnc_bitflagsCheck; // true
//  ^^^^^ flagset
   [2,2+4+8] call BIS_fnc_bitflagsCheck; // true
//    ^^^^^ flagset

Now, if flag is asking for a bit that is not in the flagset, that much does return false, which is otherwise expected.
https://community.bistudio.com/wiki/BIS_fnc_bitflagsCheck#Syntax

winter rose
dreamy kestrel
#

was not my question, to be clear, but I appreciate the effort. I really just need the check as it were, clarifying along those lines.

winter rose
dreamy kestrel
#

I'm not sure that clarifies the question.

winter rose
#

testing would (and a tiger as well)

little raptor
#

also, since it's a function, you can just open it and see for yourself:

#

it simply does: flags & flagset > 0

dreamy kestrel
dreamy kestrel
#

wow, analyzing BIS_fnc_bitwiseAND, that's certainly taking the long way round the & operator isn't it. wow...

little raptor
#

it seems ok

#

but I would personally use an array algorithm

#
_fnc_flags = {
    _max = floor (log(_this)/log 2);
    _flags = [];
    for "_i" from _max to 0 step -1 do {
        if (_this == 0) exitWith {};
        if (_this >= 2^_i) then {
            _flags pushBack _i;
            _this = _this - 2^_i;
        };
    };
    _flags;
};

_f1 = _num1 call _fnc_flags;
_f2 = _num2 call _fnc_flags;
count _f1 != count (_f1 - _f2)

Edit: looks like this is 25% slower (because it has 2 loops) meowsweats
Edit 2: no it's not! πŸ˜„

dreamy kestrel
#

tend to agree. I was curious so I cooked this comparison up:

_a = 1+2;
_b = 2+4+8;
_t0 = diag_ticktime;
_abits = _a call bis_fnc_bitflagsToArray;
_bbits = _b call bis_fnc_bitflagsToArray;
_abarrint = !(_abits arrayintersect _bbits isequalto []);
_t1 = diag_ticktime - _t0;
_t0 = diag_ticktime;
_aband = ([_a, _b] call bis_fnc_bitwiseAND) > 0;
_t2 = diag_ticktime - _t0;
[_t1, _t2, _abarrint, _aband]

Result: [0,0.000976563,true,true], however, on the average, without a high perf measurement, not sure there is an appreciable diff.

little raptor
dreamy kestrel
#

over 1000 attempts each:

_count = 1000;
_a = 1+2;
_b = 2+4+8;
_t0 = diag_ticktime;
for '_i' from 0 to (_count - 1) do {
  _abits = _a call bis_fnc_bitflagsToArray;
  _bbits = _b call bis_fnc_bitflagsToArray;
  _abarrint = !(_abits arrayintersect _bbits isequalto []);
};
_t1 = (diag_ticktime - _t0) / _count;
_t0 = diag_ticktime;
for '_j' from 0 to (_count - 1) do {
  _aband = ([_a, _b] call bis_fnc_bitwiseAND) > 0;
};
_t2 = (diag_ticktime - _t0) / _count;
[_t1, _t2]

Result: [0.000148926,2.00195e-005], bis_fnc_bitwiseAND is performing better by a factor of 10x.

little raptor
little raptor
#

it's even faster if the number of flags is too many (e.g. : [255, 255] call BIS_fnc_bitflagsCheck)

undone quiver
#

So I'm attempting to make something that takes anything Zeus spawns and sets the owner to the HC... but I think I might be slightly stupid

player addEventHander ["CuratorObjectPlaced", { call KPLIB_fnc_whateverthefuckwewanttocallthefunction]};
whateverthefuckthefunctioniscalled

private _HCs = entities "HeadlessClient_F";
if (_HCs isEqualTo []) exitWith {[]};

private _HC = owner (_HCs select 0);
curatorEditableObjects apply {
  _x setGroupOwner _HC;
};
dreamy kestrel
#

Not sure what this is telling me.

_count = 10;
_a = 1+2;
_b = 2+4+8;
_t1 = diag_codePerformance [{
  _abits = _a call bis_fnc_bitflagsToArray;
  _bbits = _b call bis_fnc_bitflagsToArray;
  !(_abits arrayintersect _bbits isequalto []);
}, [], _count];
_t2 = diag_codePerformance [{
  ([_a, _b] call bis_fnc_bitwiseAND) > 0;
}, [], _count];
[_t1, _t2]

Result: [[0,1],[0,1]], seems a bit hamstrung by the documented caveats

little raptor
#

at least 10000 is needed

dreamy kestrel
#

I get the same result, which to me seems consistent with the MP security reasons caveats.

little raptor
dreamy kestrel
#

_a and _b are fine. 'scope' defines them in this instance. same as saying.

_a = ...;
[] call _callback; // can see _a

for giggles, though, I used 1+2 and 2+4+8 literals. same result.

little raptor
#

it's not the same

#

it's not a call

dreamy kestrel
#

it is invoking code, which is the callback.

#

but like I said, I replaced with literals for giggles. same result.

little raptor
dreamy kestrel
#

no, sir, no it's not. an event handler is deferred. obviously the scope will have vanished by that point.

little raptor
dreamy kestrel
#

not the case with an immediate invocation using diag_codePerformance.

little raptor
#

if you want proof, just go ahead and test this:

_a = 1;
diag_codePerformance[{_a = _a + 1}];
_a
dreamy kestrel
# little raptor it has nothing to do with being "deferred". it just doesn't execute here, like a...

I am using the variable scope trick with my LINQ functions, so I know it works as I described. this is the secret sauce for _x and _foreachindex, for instance. for example:

// LINQ_fnc_aggregate
private _onAggregateSum = { _g + _x; };
params [
    ["_start", 0]
    , ["_values", [], [[]]]
    , ["_callback", _onAggregateSum, [{}]]
];
private ["_i"];
private _count = count _values;
private _retval = _start;
for [{_i = 0}, {_i < _count}, {_i = _i + 1}] do {
    private _x = _values select _i;
//          ^^
    private _g = _retval;
//          ^^
    _retval = [_g, _x, _i] call _callback;
};
_retval;

Works just fine: [[0, 0, 0], _someVectorValues, { _g vectorAdd _x; }] call LINQ_fnc_aggregate
The callback did not define _g or _x, the scope had them readily available.
Don't tell me that does not work, I know it does, I have proven it to be the case.

#

Now if you separate the concern with an event handler, all bets are off; you cannot rely on the wiring scope.

dreamy kestrel
willow hound
#

Why are you doing [_g, _x, _i] call _callback? You seem to be after [_i] call _callback yellowchain

#

_g and _x are already defined, they don't need to go through _this.

dreamy kestrel
#

however, indeed, the parent scope _a was the original value.

_a = 1;
diag_codePerformance[{_a = _a + 1}];
//           parent scope: ^^
_a
dreamy kestrel
willow hound
#

The way I understand it you are going for that magic variable feature, so I was just wondering why you were also passing them to _this πŸ™‚

dreamy kestrel
#

no worries; as a courtesy.

#

thank ye gents, fascinating discussion. I think I have what I need re: bitwise.

still forum
still forum
undone quiver
still forum
#

not _x

#

its passed as parameter in _this

#

you grab it outta there

undone quiver
#

AHHH, okay.

#

Thanks Ded

still forum
#

also using apply there is pretty inefficient

#

apply allocates a new array, and collects all your return values inorder to return you the array of that

#

which you don't need or use at all, waste of performance

undone quiver
#

Gotcha

valid abyss
still forum
#

error is not in the code you posted

#

its in the hpp

#

potential fix

class RscTitles{
    class Default {
        idd = -1;
        fadein = 0;
        fadeout = 0;
        duration = 0;
    };

    import RscText;

    #include "LARs\LARs_searchLoot\LARs_lootUI.hpp"
};
#

but there will probably be many other issues

valid abyss
#

Thanks, this is the LARs_lootUI.hpp file:

class LARs_searchLootUI {

    idd = 20000;
    duration = 1e10;
    fadein = 0;
    fadeout = 0;
    onLoad = "uiNamespace setVariable [ 'LARs_searchLootUI', _this select 0 ];";

    class controls {

        class SearchText: RscText
        {
            idc = 1000;
            text ="Searching..."; //--- ToDo: Localize;
            x = 0.44326 * safezoneW + safezoneX;
            y = 0.555005 * safezoneH + safezoneY;
            w = 0.0980062 * safezoneW;
            h = 0.0220019 * safezoneH;
        };
        class ProgressBar: RscProgress
        {
            idc = 1001;
            colorFrame[] = {1,1,1,1};
            colorBar[] = {0.93,0.72,0.08,1};
            x = 0.44326 * safezoneW + safezoneX;
            y = 0.577007 * safezoneH + safezoneY;
            w = 0.0980062 * safezoneW;
            h = 0.011001 * safezoneH;
        };
    };
};

still forum
#

Yeah so import RscProgress too

#

and I see no reason for your class Default

#

You don't use that

valid abyss
rustic kiln
#

I noticed sometimes player uniform textures applied with setObjectTextureGlobal don't show for players logging in after this was executed on a certain player. It seems to be inconsistent but working most of the time. My current fix is a eachframe loop on the player that loops through all other players, and applies needed textures with setObjectTexture. Wondering how this will impact things performance wise, im guessing with a bigger amount of players online its not a good idea to loop through them each frame?

still forum
#

its probably sufficient to do a scheduled loop that checks once every 5 or 10 seconds

#

and if it only happens for new players, you can use playerConnected eventhandler to start it. Let it run for a few minutes and then exit it again

#

im guessing with a bigger amount of players online its not a good idea to loop through them each frame?
definitely. Generally it just doesn't seem needed to waste fps on that

rustic kiln
#

Alright thanks that makes sense

unkempt bay
#

Hello guys,
I have a syntax question if anyone has the answer i'm looking for:

I'm trying to use
https://community.bistudio.com/wiki/BIS_fnc_VRTimer

I can start a timer as the example tells with
[] spawn BIS_fnc_VRTimer;

But to stop it i'm trying to do:
[true] call BIS_stopTimer;

Is it not the good syntax ? Should i use a variable or something ? Thanks in advance

winter rose
unkempt bay
#

so BIS_stopTimer is a parameter of the function ?

#

i don't care the colour here

#

i think BIS_stopTimer is another function right ?

#

BIS_stopTimer: set to true to stop the timer. Once stopped, the function must be executed again to restart the timer
I don't get how to set what to true

brazen lagoon
still forum
#

more memory usage, more network usage, bigger JIP queue

winter rose
brazen lagoon
#

network and jip queue make sense to me

#

but memory usage?

#

how so?

still forum
#

remoteExec is bigger, short term

brazen lagoon
#

oh huh

#

good to know

unkempt bay
winter rose
unkempt bay
#

but how is it related to the timer ?

#

BIS_fnc_VRTimer

fair drum
#

The timer throws out a global variable that gets updated. You can use that variable to stop it's "loop" etc

unkempt bay
#

mmh okay thanks

#

gonna try that

real anvil
#

Hey everyone, quick question, does anyone have a "Loadout Box" script lying around that they wouldn't mind sharing?

Basically looking to interact with an object and get a prompt to "Get Loadout X" then when they hit space bar it gives them the loadout.

Full disclosure, I'm crap at scripting.

drifting sky
#

Arma2OA. Is it possible to get the current position of the camera? And is it possible to get a vector that points in the direction from the camera to the gun cursor?

still forum
#

last one, screentoworld

drifting sky
#

Do you know if there's a way to get the position of the weapon crosshair as it appears on the screen?

still forum
#

I just answered that...

#

I think?

winter rose
still forum
#

I understand the question as "where the player is looking"

winter rose
#

we don't have (yet? Dedmen *winkwink*) access to the cursor \|/ thingy

drifting sky
#

no just want to know the position of the crosshair on the screen

#

so the player can set a position on the landscape based on where the crosshair is overlapping terrain

still forum
#

I won't add script commands to Arma 2 :u

still forum
drifting sky
#

I'll use center of screen if i have to. But ideally exact crosshair position would be best

#

i guess I could use the weapon's direction to project the position of the crosshair onto the screen

#

if the crosshair is drawn at infinite or near infinite distance that is

#

i don't suppose there's a function to draw an icon on the screen, so as to make it easier to test the accuracy of this sort of thing

#

Looks like worldToScreen will help me out here

winter rose
still forum
#

I don't know if in Arma 2 the crosshair center matches up with weapon direction? does it?

drifting sky
#

I hope it does πŸ™‚

drifting sky
#

you guys know off the top of your head how to get the current world position of the gun?

still forum
#

Even in A3 though we only just (next update) added script commands to get exact weapon position and direction.

drifting sky
#

😦 you can't get weapon position in arma2?

still forum
#

afaik no

#

maybe body center is sufficient enough

drifting sky
#

what about position of head?

winter rose
#

time to update to A3!

still forum
#

eyePos

drifting sky
#

is that camera position or position of character's eye?

still forum
drifting sky
#

that'll probably be good enough

#

ok, i think i have all the pieces i need. Tha nks

#

What is the difference between position ATL and position AGL?

winter rose
#

gniii sensitive and crazy topic πŸ˜„

#

getPos will return AGL - aka 0 if the unit is standing on top of a building
ATL will ignore the building and say "you are 12m above terrain"

#

@drifting sky ↑

#

for the setPos though… ask @little raptor 🀣

drifting sky
#

god damn, why does worldtoscreen take position argument in AGL????

still forum
#

why do you need worldToScreen?

drifting sky
#

projecting cursor position onto the screen first, then that position onto the world

#

but

#

i guess i'll have to just do a collision from eye pos, in the direction of weapondirection

#

using i guess a binary search

#

since there's no function to return position of line intersection

still forum
#

ah

#

uff

drifting sky
#

boolean return

#

it's okay, a binary search will work

still forum
#

how do you now find the cursor position on screen?
You want to do that by finding where the weapon points to, and then worldToScreen it back to screen?
But then it wouldn't make sense to do another "then that position onto the world" because you would've already had that before

drifting sky
#

i'm scratching my original plan

#

now i'm doing a line intersection between eyepos and eyepos + weapondirection * some distance

#

and wherever that line terminates will be my final position

still forum
#

for your binary search approach

#

you can just screenToWorld, then you get where the aiming position is in screen center

#

thats most likely very close to where the weapon aims

drifting sky
#

i'd like it to be more accurate than that

#

since there's no actual indication where the center of the screen is if the weapon crosshair isn't at it

winter rose
#

weaponDirection + 50m is the "sphere" of the cursor iirc

drifting sky
#

can anyone figure out why this is causing a local variable in global space error? func_set_artillery_view = { private [ "_p", "_s", "_d", "_e", "_t", "_int", "ch" ]; };

surreal peak
#

"ch" does that not cause an issue?

drifting sky
#

the inclusion of this function is causing the error

#

ohhhh

#

oops

#

The projection seems to be really accurate. Thanks guys.

drifting sky
#

can you add an item to the start of an array like this: _array = [_item] + _array?

winter rose
#

wait, no 🀣

#

insert only πŸ™‚

drifting sky
#

for arma2

winter rose
#

[element0] + [rest of array] then πŸ™‚

drifting sky
#

ARMA2OA. anyone know how to get weapons and magazines currently in a backpack?

winter rose
#

seeeeeems not

drifting sky
#

guess it's getmagazinecargo and getweaponcargo

winter rose
#

yeah but… how to get the backpack itself? backpackContainer seems A3 1.04

#

HAH
unitBackpack of course

#

but I am not sure whether it will provide the "ammocrate" backpack or not

drifting sky
#

getmagazinecargo and getweaponcargo get the items in the backpack

#

from unitbackpack

winter rose
#

then I wonder what is the difference between the two

somber radish
#

Anyone know where I can find materials
ex:

"A3\Structures_F\Data\Windows\window_set.rvmat"

I am trying to make a vehicle see-trough but I have no idea of how to get it back to normal

somber radish
#

Nobody?

#

I am just looking for the file-directory

#

Tried googling for hours

upper gazelle
somber radish
#

Because it only returns custom material not the original one

upper gazelle
#

well then run it on an unmodified vehicle lol

#

or if you need to dynamically change the material of any given vehicle, get the material first, save it as a variable, then change the material

#

@somber radish

somber radish
#

This is the return value when run on a unmodified vehicle (Which is what I want to do)

["",""]
upper gazelle
#

what vehicle are you trying this on?

#

@somber radish

somber radish
#

Car and AA battery

upper gazelle
#

what car lol

#

dang getObjectMaterial does behave that way

#

I would look up the hiddenSelectionsMaterials in the config viewer then for whataver object you want the original material for

somber radish
#

aah

#

yeah

#

nice

#

Didnt think of that

#

That is the clue I was looking for!

rustic kiln
rustic kiln
#

Ah sorry

winter rose
somber radish
#

No worries

patent lava
#

i want to get a number between 0 and 0.4 based on a percentage. example: 50(%) = 0.2, 75(%) = 0.3 etc, how can i do that?

#

pretty much like the map() function from p5.js

copper raven
#

just random 0.4?

winter rose
#

(at worst, 0.4 * random 1 but you get the idea)

patent lava
#

i dont want it to be random though

copper raven
#

0.4 * (percentage / 100)?

winter rose
#

50% chance of being exactly 0.2,
25% chance of being exactly 0.3, etc?

patent lava
#

its not a chance, it's like remapping min and max values

#
function map(value, minA, maxA, minB, maxB) {
    return (1 - ((value - minA) / (maxA - minA))) * minB + ((value - minA) / (maxA - minA)) * maxB;
}
#

i found this online which is the answer im looking for, but in js

winter rose
#

I, huh, don't read that
but you can have the same in sqf, just adapt the code

patent lava
#

which i found after asking for help here lol

copper raven
#

i want to get a number between 0 and 0.4 based on a percentage. example: 50(%) = 0.2, 75(%) = 0.3 etc, how can i do that? #arma3_scripting message should do

patent lava
#

i think i wasn't very clear on my initial message

patent lava
copper raven
#

unnecessary in their case

hushed tendon
#

Nvm read that wrong

winter rose
#

yep that's what I had in mind when I asked for 50% chance of being exactly 0.2 πŸ˜‰

hushed tendon
#

Wait no I was right

#

I question myself too much

winter rose
#

it is not what they wanted, but we went through the same process

hushed tendon
#

If I’m having trouble pulling stuff out of config into my code do I ask here or in config?

winter rose
#

here

#

config is for config making, scripting is for config obtaining in that case ^_^

hushed tendon
#

I'm new to using config and I'm trying to select a random "position" from the list in the spawnPositions[] and this is my best attempt. Any pointers?
ConfigPath : missionConfigFile >> "CfgLootTables" >> "positions" >> "spawnPositions"

class CfgLootTables
{
  class Loot 
  {  
    ...
  };

  class positions 
  {
    spawnPositions[] = 
    {
      "lootSpawn_1", 
      "lootSpawn_2", 
      "lootSpawn_3", ...
    };
  };
};

In script

try
{
    if (!isServer) exitWith {};

    _cfgLootSettings = missionConfigFile >> "CfgLootSettings";
    if (isNil "_cfgLootSettings") then {throw "invalid settings";};
    if !(isClass _cfgLootSettings) then {throw "invalid settings";};
    
    _maxSpawnedItems = getNumber (_cfgLootSettings >> "maxSpawnedItems");
    if (_maxSpawnedItems isEqualTo 0) then {throw "invalid settings";};
    
    _lootPositions = getArray (missionConfigFile >> "CfgLootTables" >> "positions" >> "spawnPositions");
    
    _random = selectRandom _lootPositions;
    hint format ["RandomPos <%1>", _random];
    //Using this to see if it works 
    
} 
catch
{
    _exception;
};
winter rose
#

also, your try catch is "okayish" but useless if you don't use _exception πŸ™‚

winter rose
hushed tendon
#

I didn't include it but it's like this

class CfgLootSettings
{
  ...
};

class CfgLootTables
{
  ...
};
winter rose
#

and it doesn't work?

hushed tendon
#

nope

#

This might be a thing under config now but this might possibly be the issue cause I can't think of anything else. Aka the arrays

class CfgLootTables
{
  class Loot 
  {
    ratio[] = 
    {
      "weapons",3,
      "backpacks",1,
      "vests", 1,
      "items",2
    };
      weapons[] =
      {
        common[] =
    {
      ["Crossbow","KA_crossbow_wood",[["KA_arrow_mag",6,12]]],
      ["Glock17","rhsusf_weap_glock17g4",[["rhsusf_mag_17Rnd_9x19_FMJ",3,4]]],
      ["ISH-18 12Gauge","rhs_weap_izh18",[["rhsgref_1Rnd_00Buck",11,22],["rhsgref_1Rnd_Slug",13,22]]]
          //aka ["weaponName","weaponClassname",[["ammoClassname",minAmmo,MaxAmmo],["ammoClassname",minAmmo,MaxAmmo]]]
    };
        ...
      };
    };
  };
};
winter rose
#

… that's not how you write a config array indeed

#
common[] =
{
  ["Crossbow","KA_crossbow_wood",[["KA_arrow_mag",6,12]]] // BIG NO
};
``````cpp
common[] =
{
  { "Crossbow","KA_crossbow_wood",{{"KA_arrow_mag",6,12}}} // more like it
};
```**PS:** KA mods are illegal as their content is **ripped**.
hushed tendon
#

oh

#

The more you know huh

hushed tendon
#

Thanks for the help

hushed tendon
#

I'm having trouble getting a value from the config. Even when debug = 0; it still returns as 1 when I hintSilent the _debug value.
FPS Counter

private["_debug","_cfgLootSettings"];
try
{
    _cfgLootSettings = getMissionConfig "CfgLootSettings";
    if (isNil "_cfgLootSettings") then {throw "invalid settings";};
    if !(isClass _cfgLootSettings) then {throw "invalid settings";};

    _debug = getMissionConfigValue "debug";
    hintSilent formatText ["Debug = %1", _debug];
    /*
    if (_debug isEqualTo 1) then
    {
        [] spawn
        {
            while {true} do 
            {
                hintSilent formatText ["FPS: %1", str round diag_fps];
                sleep 0.16;
            };
        };
    };
    */
}
catch
{};

Config

class CfgLootSettings
{
    maxSpawnedItems = 50;

    debug = 0; //if 1 will create marker and helpers on the map
};
winter rose
#

also: getMissionConfigValue is not looking into CfgLootSettings but at the root here

#

@hushed tendon ↑

hushed tendon
winter rose
#
_debug = getMissionConfigValue "debug"; // no
// private _debug = getMissionConfigValue [_cfgLootSettings >> "debug", 0]; // WRONG - fixed below
private _debug = getNumber ((getMissionConfig "CfgLootSettings") >> "debug");
hushed tendon
#

Ok that makes sense

#

Got it

winter rose
#

don't use private [], it's slow

#
private _var = value; // fast & cute
past gazelle
#

@winter rose @little raptor

#include "\x\alive\addons\sys_adminactions\script_component.hpp"
SCRIPT(markUnits);

private ["_m","_markers","_delay"];

[] spawn {

    _markers = [];
    _delay = 290; //Show for this length of time, then delete
    _colorWEST = "ColorBLUFOR";
    _colorEAST = "ColorOPFOR";
    _colorGUER = "ColorIndependent";

    {
        _m = createMarkerLocal [format["mapcoloring_%1",str _x], position _x];
        _m setMarkerSizeLocal [15,15];
    _m setMarkerAlphaLocal 0.02;
        _markers pushback _m;

        switch (side group _x) do {
            case west: {
                _m setMarkerTypeLocal "mil_dot_noShadow";
        _m setMarkerColorLocal _colorWEST;
            };
            case east: {
                _m setMarkerTypeLocal "mil_dot_noShadow";
        _m setMarkerColorLocal _colorEAST;
            };
            case resistance: {
                _m setMarkerTypeLocal "mil_dot_noShadow";
        _m setMarkerColorLocal _colorGUER;
            };
        };

        if (isPlayer _x) then {
            _m setMarkerColorLocal "ColorBlack";
        };
    } forEach allUnits;

    // Sleep for the # of seconds listed in _delay and then delete the markers.
    sleep _delay;
    
    {
    deleteMarkerLocal _x;
    } forEach _markers; 
};

Just as a thank you, this is some code I adapted from ALiVE to make an absolutely wicked heat-map of unit positions that disappears the more you zoom in. I will probably never use it in a non-alive situation but I thought you might like it.

little raptor
#

not sure why you spawn that but ok...

past gazelle
#

Well it's run in the background and updated every few minutes...

winter rose
#

thanks for the attention and intention nonetheless! πŸ™‚

winter rose
#

it's always cool to see the end result on which we may have helped πŸ™‚

copper raven
#

you passed config

past gazelle
#

I can DM lou a few pics of it, holdon

little raptor
winter rose
copper raven
winter rose
#

yeah yeah, true ^^

#

fixeded I hope

copper raven
past gazelle
#

the sleep and the delete markers you mean?

copper raven
copper raven
past gazelle
#

Cause for a second I was like "if I just spawn the sleep then won't it just delete the markers right away...cause...I spawned sleep...only..."

hushed tendon
#

@winter rose
I don't know why but the hint keeps showing up as "Debug = Scalar".

private _debug = getNumber ((getMissionConfigValue "CfgLootSettings") >> "debug");
hintSilent formatText ["Debug = %1", _debug];
winter rose
#

try```sqf
getNumber (missionConfigFile >> "CfgLootSettings" >> "debug");

winter rose
hushed tendon
winter rose
#

nothing runs in the config 😬

hushed tendon
#

should have been "Debug FPS runs but when debug = 0; in the config, it still runs the if statement."

full otter
#

R u sure you are setting _debug = 0;

hushed tendon
# full otter R u sure you are setting _debug = 0;

The script

private _debug = getNumber ((getMissionConfig "CfgLootSettings") >> "debug");
    hintSilent formatText ["Debug = %1", _debug];
    
    if (_debug isEqualTo 1) then
    {
        [] spawn
        {
            while {true} do 
            {
                hintSilent formatText ["FPS: %1", str round diag_fps];
                sleep 0.16;
            };
        };
    };
little raptor
#

look at what Lou wrote

full otter
#

Ok, did you get "Debug = 0" in the hint?

little raptor
#

hintSilent formatText
why?!

hushed tendon
#

Not my code so I can't tell you

little raptor
#

well the point is, it's stupid

#

use format

#

not formatText

#
private _debug = getNumber (getMissionConfig >> "CfgLootSettings" >> "debug");
    hintSilent format ["Debug = %1", _debug];
    
    if (_debug isEqualTo 1) then
    {
        [] spawn
        {
            while {true} do 
            {
                hintSilent format ["FPS: %1", round diag_fps];
                sleep 0.16;
            };
        };
    };

#

try that now

full otter
#

Btw is there any different between == and isEqualTo ?

hushed tendon
#

what the heck how did it get back to that

#

I'm dumb

hushed tendon
#

Well now it's saying "Debug = 0" even when it's 1

#

This is frustrating

winter rose
#

do you reload or save the mission between checks? because config is not loaded on the fly

hushed tendon
#

Yeah I'm restarting and backing out

proven charm
#

everytime you enter the editor the description.ext file is loaded

hushed tendon
#

Welp

#

It works but it sucks having to back out to the editor instead of just restarting the scenario like I'm used to

winter rose
#

you can just reload the mission

#

(actually, saving should do it too)

hushed tendon
#

for some reason I have to go back to the editor

#

nothing I do during the scenario works

#

oh well

#

at least it is working

winter rose
#

exit, save, restart

hushed tendon
#

I thought you meant saving or restarting the scenario not in eden

#

makes more sense now

winter rose
#

ah yep, "ofc" from my pov ^^

full otter
tame axle
#

Trying to activate a trigger when a all units in a specific group are dead using { alive _x } count units grp1 == 0
Where do i set the name of the group to be grp1 ?

digital pulsar
tame axle
#

@digital pulsar Cool. Cheers worked

tardy sand
#

I have a trigger that contains ```sqf
supply1 in thisList

but when the vehicle with the name supply1 enters the trigger area nothing happens (Its supposed to set an objective to complete)
I also have another trigger this one containing
```sqf
!(alive supply1)

Which is meant to fail the mission if the truck is destroyed. I have a feeling i'm missing something obvious, any help?

winter rose
tardy sand
winter rose
#

type: none

#

and in the "supply1 in thislist" trigger?

tardy sand
#

Same thing but has a radius of 20:

Type: None
Activation: None

Repeatable: ❎
Server Only: βœ…

Condition: supply1 in thisList

#

the description of None for the Activation says it will activate if a custom condition is set

#

imma switch it to game logic mabye?

winter rose
#

you are detecting "nothing" so of course, it won't work

thislist is referring to the trigger's sensor rules

#

what you can do is sync the trigger to the object itself

little raptor
tardy sand
tardy sand
#

after switching to anybody present it worked

amber lantern
#

Hi

#

I'm trying to shoehorn some code into an already existing mission

#

I'd like to force the players to wear another uniform and not be able to change it out

#

How should I best approach this?

#

I could make a script that checks the uniform the player has every n seconds and force adds a new uniform if needed

#

but that sounds tacky: is there a way to prevent removing the uniform after it has been given, and if not, can I get some uniform change event to react to if needed?

#

And finally, is there a way to force this to happen on only some missions?

wet shadow
#

For maximum reactivity you could do a CBA_stateMachine for whenever the uniform is changed for eventhandler-esque functionality.

smoky verge
#

does

    {
        _x enableSimulation false;
    } forEach (getMissionLayerEntities "Layername" select 0);

affect sublayers aswell?

winter rose
smoky verge
#

huh just tried

#

it does

#

I'll admit it took less time to try than to ask lmao

winter rose
#

@cinder atlas here πŸ™‚

cosmic lichen
#

updated the biki

smoky verge
#

nice

winter rose
#

(getMissionLayerEntities at least)

cinder atlas
#

Hey, I've problem with understanding issue that I have with setObjectScale command.
Command works fine in EDEN Editor and while hosted locally, but it doesn't work on dedicated server.
I read page about command on A3 Wiki but it didn't helped me.
I also tired to google the issue and checked if anyone else had same issue on scripting channel.
But no luck, so I thought I'm gonna ask someone knowledgeable people to help me resolve the issue.
I've tried both

this setObjectScale 3;

and```sqf
if (isServer) then
{
this setObjectScale 3;
};

Thank You in Advance
winter rose
#

what is this?

smoky verge
#

the object has to either be simple or attached to something

cinder atlas
winter rose
cinder atlas
winter rose
cosmic lichen
#

@winter rose πŸ˜„

reef walrus
#

Hola guys,
something has been bothering me for two years and I figured I might just ask now.
I did a horror mission two years ago and sunk more hours into it than I'd like to admit. However, after a while a huge wave of desyncs started.
Given that I'm not exactly new to sqf/scripting in A3, I could not really figure out what it was. Not really anything critical in the code. But now I have a hunch.

There is an event in which a "chosen" player gets jumpscared. All teammembers around him get hidden and replaced with obscure versions of themselves with a custom animation and sound.
Those versions are created via createVehicleLocal in order to make them visible for the "chosen" player only. I didn't use createUnit because createUnit is obviously global and I'd have to hide the unit on the other machines, which would have resulted in them popping up for a second. createUnit also is signficantly slower.

I have the feeling that creating a character that is actually supposed to be a "unit" via createVehicleLocal causes something in the network to go boom. Anyone has had a similar experience or has an idea about my hunch? πŸ˜„

winged relic
#

Hello, I am the new owner of a server and when I connect I have this message (after going to the lobby) Here is the translation of the message because I am French: sending the request to the server to obtain UID reader information

winter rose
winged relic
#

Idk it's new serveur

distant oyster
winter rose
winter rose
reef walrus
winter rose
#

should not, as in "just an animated object" but devs may know more

brazen lagoon
#

can you spawn a Logic type object with a script?

#

I mean I'm sure you can

#

I just didn't see an obvious script for it

winter rose
#

…?

brazen lagoon
#

basically, I want to place a "Logic" object

#

via script

#

if its not possible it's not that big a deal

copper raven
#

i mean, it depends on the context

winter rose
brazen lagoon
#

in initServer

copper raven
#

you can do this via multiple ways

brazen lagoon
#

I'm using a Logic type object as a mission object of sorts to pass data between clients/server

#

actually I can probably just change that to missionNamespace?

winter rose
#

…yes

brazen lagoon
#

that'd make more sense anyway

winter rose
#

or createVehicle "Static" too

#

a logic is "expensive" (AI, etc)

brazen lagoon
#

are there any weird things I should watch for with using missionNamespace?

winter rose
#

e.g SPGT_myVar = 1;

brazen lagoon
#

yeah that's why I was using just a random logic var

#

but now I wanna make my mission as easy to port as possible

#

anyway thanks for the sanity check

astral dawn
#

You can also use remoteExecCall to update data between clients

#

Then you can notify them when data is updated and you can make them run some code when it happens

#

Well, it's just a remote call

#

but plain public setVariable is OK for the case when new data write and read don't need to be synchronized in time (like when you set a value now but the read will happen not now but some time later or may not happen at all)

fast bone
#

How do you set a player as a respawn point? Like having a squadleader be able to have others spawn on him. I know it has something to do with addRespawnPosition or something, but idk how to expand on that.

frail vault
#

hello, i been trying to make a safezone that holsters the weapons and not allow the usage of grenades

I got to

vehicle allowDamage false;
player action ["SwitchWeapon", player, player, 100];```
but i am not too sure about grenades, any hints?
little raptor
#

holsters the weapons
the player can easily undo that

frail vault
#

yeah i figured that out, so i made it so that it switches to no weapon state

little raptor
#

use addAction for that too

#

make the weapon not fire

frail vault
#

i am not too sure about how to addAction works, but i will check it out

little raptor
#

he's overriding the "DefaultAction". you'll want to override the throwing action (not sure what it's called, check the wiki)

frail vault
#

thanks, i will check it out

cold mica
winter rose
#

weapon pool

#

Set weapons available to players during the briefing.

cold mica
#

Thanks for the clarification. The terms "Starting Gear" seemed so distant from the terms "weapon pool system" that I thought they were different.

dapper cairn
#

Is there a script for having a AI crewed blackfish fly to and fire on a marked area? Like how you can tell AI mortars with the command keys to fire on a spot can you do something similar with the blashfish

acoustic seal
#

Im having a weird time trying to get vehicles to respawn with empty vehicles using the respawn module. Ive tried using "this;", naming the vehicle "h1" and using "h1;", I've tried using "vehicle;" but everytime it gives me "undefined variable"
eg
clearMagazineCargoGlobal this; clearWeaponCargoGlobal this; clearItemCargoGlobal this; clearBackpackCargoGlobal this;

spice vapor
#

Does anyone know how to make an arsenal that allows players to move boxes into it that they collect, like the one in antistasi?

barren pewter
#

Simple question (I think). How do I make it so if the player isnt in a group it hides all the units in the group. I figure you would have something like

While (group this != group player) [hideObject this]

Then you put this in the init of the possible ai squadmates of the player

I realize that "code" sucks but that is why im asking. Thanks ahead of time.

#

I want to have a long lasting sp alive scenario where i can become a new sl if I die. But i dont want a bunch of empty squads sitting around

tough abyss
#

Anyone know why ACE interaction menu actions attached to a spawned object would only be visible to the player who spawned said object?

#

can give more details if need be

grave thistle
fair drum
fair drum
grave thistle
#

Ye, makes perfect sense with basic questions like this. But more specific the question, the less likely it's gonna get answered, imo. ACE being one degree more specific πŸ˜„

tough abyss
fair drum
tough abyss
#

I guess the follow up is, is it worth it to run it on all machines? if its too much overhead then I won't bother thing still works

grave thistle
drifting sky
#

Arma2OA: When a player goes to open a crate, is it possible to open a different crate other than the one they're interacting with??

barren pewter
tough abyss
tough abyss
fair drum
barren pewter
fair drum
#

ah okay. i'm assuming all single player correct?

barren pewter
fair drum
# tough abyss https://sqfbin.com/ahogamirudududobunos

so this code seems like you are running it on the player's machine that is placing the object.

ace_interact_menu_fnc_createAction - Local Execution
ace_interact_menu_fnc_addActionToObject - Local Execution

so if you want all players to see the actions, you want to remoteExec these functions to other player machines. since these are functions defined, they will already be present on the other machines making its overhead very small in comparison to sending the code over the network.

tough abyss
#

ahhh

fair drum
fair drum
barren pewter
fair drum
smoky rune
#

will function declared in functions.hpp with provided .sqfc file use it's sqfc automatically?

smoky verge
#
private _item243 = objNull;
if (_layer239) then {
    _item243 = _item242 createUnit ["LM_OPCAN_FRI_Rifleman_DES",[2484.02,1595.97,0],[],0,"CAN_COLLIDE"];
    _item242 selectLeader _item243;
    _this = _item243;
    _objects pushback _this;
    _objectIDs pushback 243;
    _this setPosWorld [2484.02,1596.02,50.0014];
    _this setVectorDirAndUp [[-0.0329105,-0.999458,0],[0,0,1]];
    if !(0 == ([0, 1] select (_this getUnitTrait 'engineer')) || {0 == -1}) then {_this setVariable ['s', 0, true]};
    _this setVariable ["ace_advanced_fatigue_performanceFactor", 1, true];
    _this setVariable ['ACE_isEOD', false, true];
    if (0 >= 0.1) then {_this setVariable ["ace_medical_damageThreshold", 0, true]};
    if (0 != -1 && {0 != (parseNumber (_this getUnitTrait 'medic'))}) then {_this setVariable ["ace_medical_medicClass", 0, true]};
    _this setUnitPos "DOWN";
    0 remoteExec ['setFeatureType', _this];
    _this setname "Ismail Hakimi";;
    _this setface "WhiteHead_14";;
    _this setspeaker "Male04ENG";;
    _this setpitch 0.99;;
    parseSimpleArray "[[""hitface"",""hitneck"",""hithead"",""hitpelvis"",""hitabdomen"",""hitdiaphragm"",""hitchest"",""hitbody"",""hitarms"",""hithands"",""hitlegs"",""incapacitated"",""hitleftarm"",""hitrightarm"",""hitleftleg"",""hitrightleg"",""ace_hdbracket""],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]" params ['_hitpoints', '_damage']; {_this setHitPointDamage [_x, _damage # _forEachIndex, false]} forEach _hitpoints;
    if (true) then {_this disableAI 'PATH'};
    _this setUnitTrait ['Medic', false];
    _this setUnitTrait ['Engineer', false];
    _this setUnitTrait ['ExplosiveSpecialist', false];
    _this setUnitTrait ['UAVHacker', false];
_this addHeadGear "Mezara_Mask_White";
    if (true) then { _this setVariable ['s', true, true]; };
};

Been trying to spawn units through sqf export but I need to give them a custom helmet
if I try this their default helmet disappears but the new one doesn't
am I doing something wrong?

#

everything is created through sqf export
_this addHeadGear "Mezara_Mask_White";
is my addition

past wagon
#

can I add an event handler for when a player closes a virtual arsenal?

#

there doesnt seem to be an event handler for that. is there another way I could do something like that?

little raptor
past wagon
#

will the event handlers for arsenal opened and arsenal closed only work for arsenals added with BIS_fnc_arsenal? or will they also work for virtual arsenals added in the editor?

past wagon
#

ok

#

just checking, thanks

little raptor
#

But it won't work with ACE arsenal

winter rose
devout obsidian
#

Hi guys, I have problems trying to figure out how to properly use "hideBody". Basically only problem is that I can use addAction for a unit and the action is hideBody of that unit but I can't figure out, how to show the action only when the particular unit is dead.
The action is basically available even when the unit is alive. Rest of the command works without problems. Thanks for help.

little raptor
#

or better yet, only add the action when the unit dies

#

using killed/MPKilled event handlers

devout obsidian
sage dawn
#

because that syntax is not correct at all

little raptor
devout obsidian
#

I did read it, but guessing from your reactions, its not even close to being right πŸ˜„

little raptor
#

you're providing the arguments, not condition

devout obsidian
#

I think I have the correct syntax (if not, i do not know what is wrong), however it tells me, that there is incorrect string and boolean is expected (i suppose its for the Condition) I checked the syntax and added default values for everything except Title, Script and Condition. I can't really figure out what to do.
this addAction ["Bury corpse", "hideBody player1", "nil", "1.5", "true", "true", "", "!alive _target", "50", "false", "", ""];

little raptor
#

"" = string

devout obsidian
winter rose
#

first time is always a b… hard. hard it is
but you are in the learning process, don't ever apologise for it πŸ˜‰

idle jungle
#

wondering if someone can help me
I have a script on a hold action that makes a few VLS missile pads fire at some vehicles.
it works fine on LAN but on a dedicated server the missiles just head straight into the sky.

west reportRemoteTarget [target1, 300]; 
target1 confirmSensorTarget [west, true];
west reportRemoteTarget [target2, 300]; 
target2 confirmSensorTarget [west, true]; 
vls fireAtTarget [target1, "weapon_vls_01"];
vls3 fireAtTarget [target2, "weapon_vls_01"];

any ideas?

little raptor
#

afaik

idle jungle
#

ohh

#

can you give me an example lol

little raptor
#

example of what?

idle jungle
#

whats a local argument?

#

_vls3 sorta thing?

little raptor
#

....
that's a local variable

idle jungle
#

oh

little raptor
#

what I said is related to multiplayer scripting

idle jungle
#

thanks leopard

little raptor
idle jungle
#

2bh im gonna say i have no clue lol

winter rose
#

this command should happen where the vehicle is "local"
e.g who "owns" the vehicle, MP-wise

little raptor
#

when a command takes local argument, you have to execute the command on the machine where the argument is local

idle jungle
#

ohhh

little raptor
#

to do that you use remoteExec

idle jungle
#

right so execute on a server

little raptor
#

no

idle jungle
#

yup got it

#

oh

little raptor
#

where it belongs

#

it may not belong to the server

idle jungle
#

AI is on server as its placed in the editor not via zeus?

little raptor
#

you don't need to know where it is

#

just use remoteExec

#

it'll figure it out for you

idle jungle
#

oh okay

little raptor
#

read the wiki for more

#

there are also some examples pinned in this channel

idle jungle
#

[_target1, 300] remoteExec ["reportRemoteTarget", _object];
?

little raptor
#

no

idle jungle
#

i wish there was a remoteexec generator lol

winter rose
#

[_object, [_target1, 300]]

#

[leftArg, rightArg] remoteExec πŸ™‚

little raptor
#

I think for reportRemoteTarget you have to execute it where the AI is local

#

it makes no sense executing it where _target is local

winter rose
idle jungle
#

im assuming there is no other way to make a VLS fire at something it has to receive data link etc?

little raptor
#
This command must be executed locally to the vehicle/turret you want to tell the target about.
idle jungle
#

I apologise if i am coming across really thick gentleman

#

I know its frustrating lol

little raptor
#

@idle jungle for your case you have to report it twice

#

you have two VLS it seems

idle jungle
#
west reportRemoteTarget [target1, 300]; 
target1 confirmSensorTarget [west, true];
west reportRemoteTarget [target2, 300]; 
target2 confirmSensorTarget [west, true]; 
vls fireAtTarget [target1, "weapon_vls_01"];
vls3 fireAtTarget [target2, "weapon_vls_01"];
playSound3D [getMissionPath "Sounds\zeus_sound_AlarmOpenAir.ogg", speakers11, false, getPosASL speakers11, 5, 1, 0];
playSound3D [getMissionPath "Sounds\zeus_sound_AlarmOpenAir.ogg", speakers12, false, getPosASL speakers12, 5, 1, 0];
playSound3D [getMissionPath "Sounds\zeus_sound_AlarmOpenAir.ogg", speakers13, false, getPosASL speakers13, 5, 1, 0];
bobhope setDamage 1;
sleep 33;
bomb3 setdamage 1;
west reportRemoteTarget [aa1, 300]; 
aa1 confirmSensorTarget [west, true]; 
vls fireAtTarget [aa1, "weapon_vls_01"];
sleep 3;
west reportRemoteTarget [aa2, 300]; 
aa2 confirmSensorTarget [west, true]; 
vls2 fireAtTarget [aa2, "weapon_vls_01"];
sleep 3; 
west reportRemoteTarget [aa3, 300]; 
aa3 confirmSensorTarget [west, true]; 
vls3 fireAtTarget [aa3, "weapon_vls_01"];
sleep 13;
west reportRemoteTarget [aa4, 300]; 
aa4 confirmSensorTarget [west, true]; 
vls fireAtTarget [aa4, "weapon_vls_01"];``` thats the entire holdAction script
little raptor
#

so:

[west, [_target, 300]] remoteExec ["reportRemoteTarget", [_vls1, _vls2]]; //report _target to west on _vls1 and _vls2's machines
idle jungle
#

that makes it a little clearer

#

confirmSensorTarget doesnt need the same thing?

little raptor
#

actually I think remoteExec can take an array for its targets
just pass it into one array

winter rose
idle jungle
little raptor
austere hawk
#

yes, shirty people that are totally pants

idle jungle
#

ah crap i used sql by accident lol fixed

winter rose
#

muscle memory ^^

little raptor
winter rose
#

(I know that's deeper than expected, but that's what she said)

little raptor
winter rose
#

"curiousity killed the cat, but satisfaction brought it back!"

#

Dunning-Kruger effect, etc ^^

when you know you don't know, fix it
until then, you can't fix the problem if you don't know there is one πŸ™‚

idle jungle
#

hahaha

proven charm
#

what would be the best way to check if user presses a key, considering that key maybe already mapped to some action by the user?

little raptor
proven charm
little raptor
hollow thistle
#

or add keydown EH to mission display.

proven charm
#

im surprised that there isnt any existing commands to help?

hollow thistle
#

or use CBA keybindings if you use CBA.

little raptor
proven charm
#

ok thx I'll see what I can come up with

idle jungle
#

when using doArtilleryFire
can i choose another magazine or does it HAVE to be a magazine in the artillery piece?

example using a MLRS to fire a VLS rocket lol

hollow thistle
#

it just tells the AI to fire the arty.

#

It can't fire something that's not available.

#

I guess you could add the mag via script to the vehicle gun and then tell the AI to shot it.

idle jungle
#

thats true

amber lantern
#
0 = player spawn
{
    _this forceAddUniform "FDF_sf_fat_maasto_sin_1";
    _this addHeadgear "ffp_m05w_helmet_peltor";
    _unif = uniform _this;
    _hgear = headgear _this;
    while {alive _this} do
    {
        sleep 0.1;
        if !(uniform _this isEqualTo _unif) then
        {
            _inv = uniformItems _this;
            _this forceAddUniform _unif;
            {_this addItemToUniform _x} forEach _inv;
        };
        if !(headgear _this isEqualTo _hgear) then
        {
            _this addHeadgear "ffp_m05w_helmet_peltor";
        };
    };
};
#

This is what I came up with

winter rose
#

(0 = unneeded)

amber lantern
#

Any thoughts on how to make it better?

amber lantern
winter rose
#

it was that init fields and trigger fields said "I don't want return value"
so doing an = attribution tricked it
it has now (recently) been fixed

amber lantern
#

Thanks

#

But other than that, any thoughts on how to make it better? I suppose I could also waituntil to have it execute every frame

tough abyss
amber lantern
#

Hmm that would be much better, yeah

amber lantern
#

Though perhaps I could also just simply for each put even check if the player has their uniform and execute code, that does work, too

#
player addEventHandler ["Put", {
    params ["_unit", "_container", "_item"];
    _unif = "FDF_sf_fat_maasto_sin_1";
    _hgear = "ffp_m05w_helmet_peltor";
    if (alive _unit) then
    {
        if !(uniform _unit isEqualTo _unif) then
        {
            _inv = uniformItems _unit;
            _unitforceAddUniform _unif;
            {_unit addItemToUniform _x} forEach _inv;
        };
        if !(headgear _unit isEqualTo _hgear) then
        {
            _unit addHeadgear "ffp_m05w_helmet_peltor";
        };
    };
}];
#

Would this work?

#

hmm also with the alive test, too

#

Like so

true frigate
#

How can I make a teleport between two things when one is not at ground level? I'm using markers and a script from a video online, but it spawns me at ground or sea level.

(_this select 1) setPos (getMarkerPos "Exit1");
{ _x setPos (getPos (_this select 1)); } forEach units group (_this select 1);
}];```
Would I have to use setPosASL instead?
amber lantern
#

Yeah you have to use the setPos that takes into account height

little raptor
amber lantern
#

It doesn't prevent one from changing uniforms by dragging from your own inventory to it

#

Surely there's another event I could check?

#

Hmm, take is another one, but that still doesn't preven one from forcechanging it without a trigger

#

So I suppose the only way is to keep checking all the time

#

How would I add code that executes when player joins and has a unit?

wet shadow
#

Has unit?

amber lantern
#

it doesn't mention anything about the unit the player controls

#

how would I know which player to execute code on without that?

little raptor
amber lantern
#

I want to force different uniforms for us, but I don't want to edit the co10 mission files

little raptor
amber lantern
#

thanks!

little raptor
#

this is a serverside event handler

amber lantern
#

oh?

#

ah : /

#

I suppose I could, on the server, manage a list of players

#

and if it changes execute code on them

little raptor
#

just not the way I said

amber lantern
#

how should I use it?

little raptor
#
addMissionEventHandler ["PlayerConnected", {
    params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
    [] remoteExec ["some_fnc", _owner];
}];