#arma3_scripting

1 messages ยท Page 67 of 1

little raptor
#

lines 9 and 23

quiet gazelle
#

oh

#

thats indeed a missing ;

#

why did it not write about those in the rpt?

little raptor
#

๐Ÿคท

quiet gazelle
#

now it executes

#

thank you very much

little raptor
#

do you use CBA PREPs? meowsweats

quiet gazelle
#

yes

#

does that change anything about errors being logged?

willow hound
#

Artillery with EHs

trim tree
#

@willow hound i dont have permissions to write unless that was your goal ๐Ÿ˜„

quiet gazelle
#

maybe cause you havent acknowledged the server rules?

trim tree
#

then i couldnt write here as well though?

quiet gazelle
#

idk, i have rights to write in the thread. i recall that i accepted the rules because rights to upload images were tied to that

#

so maybe rights to write in threads are tied to that role aswell

round scroll
#

Question on a general approach for a modded plane. There are a bunch of buttons in the cockpit, like fire warning, fuel pumps on/off, or aileron and rudder neutral. I plan to add a per frame eh for animating them like this, but insecure if this approach is sound at all: ```sqf
params ["_plane"];

["uns_InsPerFrame_EH", "onEachFrame", 
    {
        params ["_plane"];

        if (isEngineOn _plane) then {
            if (_plane animationSourcePhase "rudder" == 0) then {
                _plane animateSource ["button_rud_neut_black_hide_source", 1, true];
            } else {
                _plane animateSource ["button_rud_neut_black_hide_source", 0, true];
            };
            if (_plane animationSourcePhase "aileron" == 0) then {
                _plane animateSource ["button_ail_neut_black_hide_source", 1, true];
            } else {
                _plane animateSource ["button_ail_neut_black_hide_source", 0, true];
            };
            // probably 10-15 conditions following
        };

    }, [_plane]] call BIS_fnc_addStackedEventHandler;````
#

or better tie it to that source in the model.cfg?

#

but not sure how to pull that off as rudder and aileron go from -1 to 0 to 1

sullen sigil
#

Sounds like it'd be better to do it model.cfg as that'd be engine driven -- you could do rudder and aileron to be animated if anything not 0 but I'm unsure if that's possible via model.cfg

round scroll
#

pretty sure the engineOn check is not possible

molten yacht
#

Hey, quick question: Where in the cfgRespawnInventories do I put the scope/flashlight/bipod? When I copy the loadout from the virtual arsenal, these items aren't kept.

#

do they go in items, linkeditems...

sullen sigil
wanton swallow
#

Hi all. Sorry if wrong branch.
How to realize lobby slots handling?
Maybe exists some Event or other ways?

sullen sigil
#

please rephrase the question it is difficult to understand

wanton swallow
#

When player choose a arma slot in the lobby i want to do some logic (check his SteamID)

#

Bind SteamID for special slots

sullen sigil
#

Don't think there's an event for it, may require a scripted lobby

wanton swallow
#

Where to read about scripted lobby?

sullen sigil
#

you'd have to make it yourself

#

alternatively you could add a scripted ui event handler

wanton swallow
sullen sigil
#

you would have to find them out

#

i've not got a clue how to add it before mission start as well

#

and yes it would need to be a mod most likely

willow hound
willow hound
molten yacht
digital hollow
#

Oh right. Just rpm then?

round scroll
#

not sure how to combine these?

#

rpm for jets seems to be weird as well

digital hollow
#

Oh, to show, hide depending on both sources? I think have dependent bones hidden by each source could work.

round scroll
#

ah, interesting idea

digital hollow
round scroll
digital hollow
#

Am offering to help, not that it's complicated, just happened to be working on it lately ๐Ÿ˜ like maybe turrets or something

round scroll
#

like the whole second floor of Nimitz is a vast empty space right now

#

the Bon Homme Richard has no interiour at all though

sullen sigil
digital hollow
#

Potentially! Side to side snap seem easiest for now. Working on shoot house walls :p

sullen sigil
#

would be minted for hallway props etc ๐Ÿ˜Ž

wind hedge
#

Guys, this works sqf [getPosWorld _leader,(getDir _leader),95,getPosWorld _targetUnit] call BIS_fnc_inAngleSector; but is unreliable because the Ai units are doing animations in which they turn visually but their getDir stays the same for some reason. So visually the Ai Unit is looking south but the getDir is north etc etc. I was thinking of using something like sqf [getPosWorld _leader,(eyeDirection _leader),95,getPosWorld _targetUnit] call BIS_fnc_inAngleSector; but of course (eyeDirection _leader) is not compatible. Any other way that I find the direction the unit's eyes are looking so it works in my case scenario?

still forum
#

Game froze for too long

#

uff, I should just not reply to anything when i have days of backlog

#

You already got the answer yesterday, and you're asking the same thing again today notlikemeow

willow hound
digital hollow
wind hedge
wind hedge
digital hollow
wind hedge
dreamy kestrel
#

Q: about network messages, do HASHMAP ship over the wire seamlessly? Or would we have to transliterate to raw ARRAY, assuming key/value data was itself also primitive or serialization friendly.

agile pumice
#

also, the cba function for adding keybindings doesnt seem to use the same dik code list that vanilla a3 does

dreamy kestrel
#

to elaborate a bit, as an arg to something like a remoteExec, or a CBA EH being raised, target EH or global, or client to server EH, let's say.

little raptor
#

but yes

dreamy kestrel
#

well... it's not infinitely deep, but, yes, I understand.

tepid vigil
#

If I disable respawn entirely, can I still "respawn" people manually by creating a new unit and using selectPlayer?

wanton swallow
#

Why radio channels are disappear aflter call ["Open"] spawn BIS_fnc_arsenal;
How to solve this issue?

granite sky
#

ACRE or TFAR?

wanton swallow
warm hedge
#

Radio channels as in?

agile pumice
#

do they effect hitpoints in models, like glass and rikochet?

warm hedge
#

By adding one using + button?

wanton swallow
sullen oar
#

how do i remove the blue crosshairs from map markers created with createMarker?

meager granite
#

Looks modded

manic kettle
kindred lichen
#

Is there anyway to make the Vanilla pop-up targets "hot" and become illuminated on thermal scopes?

sullen oar
cyan kayak
#

i think the heat signatures are defined in the config of an object, not sure if you can manipulate with scripting...what's your goal?

kindred lichen
#

I'm making a spotting / long range training drill. I have spotters on a hill and they need to comunicate target location to a rifleman in the town.

cyan kayak
#

any reason an AI unit with no animation wouldn't work?

kindred lichen
#

Basically, a lot of the times a sniper / overwatch will spot someone but they fumble the call out, and don't know how to articulate direction.

#

I already have a script from another mission that uses pop-ups, so I'm being lazy.

cyan kayak
#

ah

kindred lichen
#

I tried _selTarg setVehicleTiPars [1,1,1];

#

but I guess the target isn't really a vehicle.

cyan kayak
#

yea

#

is there setUnit or setObject?

kindred lichen
#

Was hoping for a one liner, piece of code I could use to highlight, if it doesn't exist, then I'll just swap them out.

cyan kayak
#

....could spawn a campfire right next to it :)

kindred lichen
#

Yeah I was thinking something cheezy like that.

cyan kayak
#

sadly i see no other *TiPars commands

kindred lichen
#

Lol, I did the fire place thing :). Seems to work O.k.

pulsar bluff
#

i think the great divide was the Eden editor ... there was life before 3D editor and life after 3D editor

cyan kayak
#

haha

#

quick and dirty

#

if you place an AI unit and then just put this disableAI "ANIM"; in the init, that should work too; could put a placement radius on it to make it a bit random

pulsar bluff
#

oh nice, had no idea ๐Ÿ˜‚

wooden magnet
#

anyone know a fix for the darter drone spinning in circles around a waypoint and not following commands? someone suggested removing the crew and adding it back in but that didnt work for me

winter rose
#

lower its altitude perhaps

pulsar bluff
#

@wind hedge

pulsar bluff
#

the drawLine3D method doesnt have this issue

still forum
#

wuht drawLine3D position and drawLaser at same position a re different?

pulsar bluff
#

I think the issue is that the laser needs to be offset so it doesn't reflect off the weapon

#

whereas drawLine3D can just start at origin

#

the "vectorAdd" Y axis causes issues

grim pasture
#

does anyone know how to replicate that vanilla feature that lets you carry flags on your back?
I wanted to use the flag mechanics for a mission but without the vanilla actions related to it but removing those seems to be impossible
having those visible flags would be a neat feature though

meager granite
#

You can script the rest yourself

grim pasture
#

that does seem useful, thanks

sharp light
#
this addAction ["<t color='#0FFFFF'>Consume</t>", "[side (_this select 1), 1] call BIS_fnc_respawnTickets; deleteVehicle (_this select 0); deleteMarker (_this select 3);", _marker, 6];
``` deleteMarker works fine when the host uses the action, but when a client does it, the marker is only deleted on their side, any way to negate this?
still forum
#

you can remoteExec deleteMarkerLocal

#

but.. deleteMarker should work globally

sharp light
#

I'll try the remoteExec

#
private _marker = "TICKET" + (str (position this));
_marker = createMarker [_marker, this];
_marker setMarkerText "TICKET";
_marker setMarkerColor "colorYellow";
_marker setMarkerType "hd_dot";

this addAction ["<t color='#0FFFFF'>Consume</t>", "[side (_this select 1), 1] call BIS_fnc_respawnTickets; deleteVehicle (_this select 0); deleteMarker (_this select 3);", _marker, 6];
``` Did I do something wrong in the rest of the code?
still forum
#

I don't think so, looks alright

meager granite
#

Differences in position might have produced different marker names between different clients?

kindred lichen
#

yeah, I'm torn on the random, cause I want the AI to be visible to the spotter team, so I need to pre-approve the locations. Right now I'm using 15 pop-up targets, enough to be "random" but I can choose to put them places where the spotters can see.

sharp light
#

sounds feasible, a better way to do it would probably be checking if the name already exists and then increment the number but not sure how to code that

still forum
#

The marker name will be the same, if its only one client that creates that code

#

If that code runs on every client, you'll have many markers instead of having one ๐Ÿค”

sharp light
#

the code runs in an object init so it should execute for every client

#

so maybe the position wasn't exactly synced so it created 2 markers on top of eachother and only deleted one

still forum
#

the position is just to make it unique right?

#

you could just make it unique to the object
private _marker = "TICKET" + (hashValue this);

cyan kayak
#

you can "pre-approve" positions also by placing markers and then grouping the unit to the markers

sharp light
#

oh that's perfect

#

I think I figured it out, on the clientside it tries to create the same marker already made by the server, so _marker becomes "" and deleting won't work

#

only creating the marker once should fix it

still forum
#

well easy
_marker = createMarker [_marker, this];
-> createMarker [_marker, this];

#

that will create if it doesn't exist yet, and if it already existed, _marker name will stay valid

#

actually no reason to ever do _x = createMarker

sharp light
#

or if {isserver} ?

still forum
#

because the return value is exactly the same as what you pass in

#

you could do isServer check yeah.

sharp light
#

it seems to work now, thanks for the help :P

cyan kayak
#

that's more about respawn

sharp light
#

why spend 15 minutes placing down markers when you can spend 2 hours automating it

cyan kayak
#

but might help

kindred lichen
#

I'll look into that. thanks

wintry plank
#

Good day. One question, I'm making a ww2 map, but when it comes to making the AI โ€‹โ€‹used by the AAs shoot the planes, they don't do anything. No flak, it's more I tried with NATO units with modern missiles, but none detects the planes. Does anyone know why it happens?
The plane passes at 150 meters and I have the detection of the soldiers at maximum.
Thank you.

kindred zephyr
#

action eventhandlers for the inputAction of

TactTemp
TactToggle
TactShort

is probably the easiest way?

digital hollow
#
animationState _unit
// amovpercm**wlk**sraswrfld... walk
// amovpercm**tac**sraswrfld... gun up
// amovpercm**run**sraswrfld... combat pace
// amovpercm**eva**sraswrfld... sprint
kindred zephyr
#

OR you can just detect the action being performed

#

yes

#

have a follower variable

#

the action is performed as long as you press C, so it is correct when you use it, as you are activating/deactivating, that doesnt matter to the handler as it's still being done

#

you are better just having it detect one type of activation and then checking internally in your system if it has been activated or not previously

#

of course you account for respawns and all that funny stuff

digital hollow
#

There's also TactTemp TactShort xD

kindred zephyr
#

^ yup

#

just do the same for those input actions, your code will just change from on/off and viceversa so no issue?

#

yeah, tactTemp is triggered when you shoot/press primary fire and tactShort is one of those weird actions that you get after running some time i believe

agile flower
#

Hi all,

can anyone tell me the correct syntax for a remoteExec profileNamespace setVariable?

#

["testPassToServer",clientTestPassToServer] remoteExec ['profileNamespace setVariable',2,TRUE];

[Local Variable, remote variable] remoteExec ['profileNamespace setVariable', server only, Jip];

meager granite
#

JIP server-only? notlikemeow

agile flower
#

yep

#

fuck me right

#

anyway

meager granite
#

Are you trying to send some variable to the server and have it saved into server's profile namespace?

agile flower
#

correct

meager granite
#
[clientTestPassToServer, {profileNamespace setVariable ["something", _this]}] remoteExecCall ["call", 2];
#

or some server-side function instead of "call"

stray flame
#

okay so, I these this script that respawns people with the things they died with

#

here is a previus explanation for that

#

But one of my mods

#

that put you in a revive state

#

removes all mags from the player when going over to it

#

with the intent of giving them back if revived

#

I tweaked this script earlier to make it check if the player has a radio, and then if not, add one

#

and I am curius if you can do the same thing for mags

#

basically I want it when run to:

1: Get the weapon classname that the player is currently carrying.
2: Get an array of all compatible magazines for that weapon.
3: add 3 mags of suitable type to player inventory.

agile flower
#

Getting a weird error I cant run down

#
format ["writebVariable value: %1", writebVariable] remoteExec [hint, 0];

remoteExec [hint|#|, 0];
Error Invalid number in expression

hallow mortar
#

RemoteExec takes string for the command name

agile flower
#

Script works fine

#

does exaxtly what i want it to do, just throws this error

hallow mortar
#

RemoteExec takes string for the command name

agile flower
#

gotcha

little raptor
little raptor
#
onEachFrame {
    _w = currentWeapon player;
    //update weapon info upon weapon switch
    if (_w != player getVariable ["last_weapon", "?"]) then {
        _cfg = configFile >> "CfgWeapons" >> _w;
        _m = getText(_cfg >> "model");
        //if (_m select [0,1] == "\") then {_m = _m select [1]};
        _o = createSimpleObject [_m, [0,0,0], true];
        _off = _o selectionPosition [getText(_cfg >> "muzzlePos"), "memory"]; 
        _off set [0, _off#0 - 0.01];
        _off = _off apply {[_x]};        
        deleteVehicle _o;
        player setVariable ["offset", _off];
        player setVariable ["last_weapon", _w];
        player setVariable ["proxy", 
            [
            "proxy:\a3\characters_f\proxies\pistol.001",
            "proxy:\a3\characters_f\proxies\weapon.001",
            "proxy:\a3\characters_f\proxies\launcher.001",
            "proxy:\a3\characters_f\proxies\binoculars.001"
            
            ] select (([1, 4, 4096] find getNumber(_cfg >> "type")) + 1)
        
        
        ];
    };
    _offset = player getVariable ["offset", []];
    _proxy = player getVariable ["proxy", ""];
    // using LOD resolution 1 (and lod index 0). This is not always reliable
    // you should manually check allLODs and find the most suitable LOD (smallest res LOD usually has the best accuracy, but it might be slow too)
    player selectionVectorDirAndUp [_proxy, 1] params ["_vy", "_vz"];
    _pos = selectionPosition [player, _proxy, 0];
    
    _vx = _vy vectorCrossProduct _vz;
    
    _mat = matrixTranspose [_vx, _vy, _vz];
    _pos = _pos vectorAdd flatten(_mat matrixMultiply _offset);
    _p1 = player modelToWorldVisualWorld _pos;
    //_p2 = _p1 vectorAdd (player vectorModelToWorldVisual (_vx vectorMultiply -1000));
    drawLaser [_p1, player vectorModelToWorldVisual (_vx vectorMultiply -1), [10,0,0,1], [1,0,0,1], 0.5, 0.5, -1, false];
}
cosmic lichen
#

What's the best way to verify if a text from an edit box can be parsed into a number? negative, 0 or positiv?

#

parseNumber returns 0 if only letters

#

Seems the only way is BIS_fnc_parseNumber

#

But that returns -1 notlikemeowcry

little raptor
#

well I might have an idea

cosmic lichen
#

Yeah me too. Request "isNumeric" as command ๐Ÿ˜„

little raptor
#
_num = parseNumber _text;
_num + 1 == parseNumber (_text + " + 1")

think_turtle

cosmic lichen
#

Interesting

#

try with "-5D"

little raptor
#

false

cosmic lichen
#

nice

south swan
little raptor
#

but so is -5 ๐Ÿคฃ

cosmic lichen
#

๐Ÿ˜„

little raptor
#

I thought it works like getNumber and can handle math

cosmic lichen
#

Regex would work, but seems overkill

little raptor
#

I might have another idea ๐Ÿ˜…

wind hedge
cosmic lichen
little raptor
#

wut:
parseNumber "5D" gives 5 meowsweats

little raptor
#
_word regexMatch "(?:\$|0x)[0-9a-f]+|(?:[0-9]+?\.[0-9]*|[0-9]*?\.[0-9]+|[0-9]+)(?:e[-+]?[0-9]+)?"
#

from ADT ๐Ÿ˜›

#

you should trim the whitespaces tho: trim _word regexMatch ...

digital hollow
#

There's shownCuratorCompass, is there command for the clock?

stray flame
#

Hello, I just tried my op, and I have as script that plays an audio thing when set off. But other people could not hear it, could the playsound3d be the issue? as it uses something that refers to my filepath?

playSound3D [getMissionPath "Sound\Commander_Intro_Radio.ogg", HoloTalbe, true, getPosASL Pelican_Holo, 20];

#

wait

#

I may be stupid

scenic shard
#

you can use say3D, and remote exec that to all clients. not sure why playsound3d did not work tho as effect is global

stray flame
#

for some reason I did not remotexec the script

#

I may try just remoteexec it

scenic shard
#

I am having a issue with setting the scale of a object on dedicated server. the object is just a static prop.

I use the following:

params["_obj", "_scale"];

private _dir = vectorDir _obj;
private _up = vectorUp _obj;
_obj attachTo [anchorPoint];
_obj setVectorDirAndUp[_dir, _up];
_obj setObjectScale _scale;

where anchorPoint is just another editor placed object without simulation.

the actual resizing seems to work, the actual issue is that my objects rotation gets reset to 0, which I attempt to fix above

tired wind
scenic shard
#

depends entirely on the problem, post it and if I can't help im sure someone else will be able to

tired wind
#

you'll see, it's a very stupid problem
you see how the chair is moving meter by meter ? I know why it does that but I don't know how to remove the ''magnet'' so I can move it freely

#

oh nvm

#

it was the translation grid

stray flame
#

grid yeah

tired wind
#

lmaoooo as a video editor I was looking for a magnet icon

hallow mortar
scenic shard
#

the anchor is 0,0,0. so should be the same then? or is there some offset

hallow mortar
# stray flame for some reason I did not remotexec the script

You should not need to remoteExec playSound3D as it is a Global Effect command. RemoteExecing it would cause duplicate sounds. Without seeing the rest of the script I can't say for sure, but one thing to look out for is whether HoloTalbe and Pelican_Holo are defined on all machines. They will be if they're Editor-placed objects, but if they were script-spawned they might not be.

hallow mortar
# scenic shard the anchor is 0,0,0. so should be the same then? or is there some offset

Is that [0,0,0] rotation or position? Both position and rotation are relative once attached, but one doesn't affect the other.
Keep in mind the note on the setObjectScale wiki page - changing rotation of a scaled object resets its size, so rotation should be done before scaling. So you have several resets at play here.
attachTo resets position and rotation, and changes their frame of reference
setVectorDirAndUp resets size
If and when you change the object's position, that may also reset its size

scenic shard
#

it is [0,0,0] rotation, but changing the order of the setObjectScale line and setVectorDirAndUp might have fixed it.

It works in editor at least, gonna boot it on the dedicated now and see

scenic shard
grand stratus
#

Anyone familiar with how to get a crewed vehicle to use smoke screen through sqf? I can get it to fire the other weapons, but having a hard time finding the smoke screen

grand stratus
hasty gate
#

Asking again: How does Arma 3 select weapon for vehicle ai crew member according to target type? Is there script or Fsm for it? I want to investigate how is it selected or is it random, in example what script is responsible for selecting mg for enemy infantry or heat vs enemy vehicle

hasty gate
little raptor
gentle fjord
#

hey homies I am looking for a way to create an action in the action menu when close to an object. I know this is probably simple but I am a beginner and can't get google to work with me. Does anyone have any documentation or snippets they could show me to explain how this may be done?

#

I figure it's some magic with doAction

#

but I cant seem to find an explanation of a way to make it happen when nearby the object

#

(as opposed to looking at it)

granite sky
#

Add the action to the player, not the object. Have a condition on the addAction that checks the object's proximity.

gentle fjord
#

oh very clever, thanks! I was focused on the object I want close. I will try that!!

#

thanks agaiN!

#

woops

#

is there a way to check if the cursor target is a vehicle? the final use case is to make a script that allows players to open the BIS garage (to add slat cages and the like) while near a repair container

#

not sure if that context helps but it may

granite sky
#

Nah, now you're into the stuff that everyone just fudges because they have no idea what the "proper" method is :P

#

object classification in Arma is tricky.

gentle fjord
#

yeah my fear is that you open the garage on a box and now can spawn any vehicle. this might be why the garage isnt in any missions since using it us painful HAHA

#

ugh pain lol

#

just want to give users a way to add cages

#

I know Vindicta manages to spawn vehicles with random components added which is awesome, maybe I should dig through their code

#

how about checking if a driver seat exists? is this a bad idea? if I just want to curb spawning any vehicle anywhere it seems like it would prevent people from opening the garage on a box, the garage erroring (or w/e) and showing all vehicles

#

I believe opening a garage on, say, a static just shows the static and nothing else

granite sky
#

Well, you can check crew capability in general, I guess.

#

fullCrew with showEmpty flag is handy.

gentle fjord
#

is this a good test of if it's a vehicle though?

#

is the idea to check if it has driver?

#

ie check if the array has driver in it?

granite sky
#

I don't know what the definition of a vehicle is in Arma.

#

wiki doesn't tell you these things.

gentle fjord
#

lmao I got you

#

non answers aside I guess it seems like it would work. a sort of 'if it smells, tastes, looks then it is the thing' type logic. If it has a driver then it is a vehicle

#

probably lmao I cant think of an exception

quaint oyster
#

Can someone help me remember how to pull the author name from a piece of clothing the player is currently wearing? In this case, the backpack? My googlefu skills are failing me.

winter rose
#

getText the author config value

granite sky
#

If it's a backpack it's in CfgVehicles.

winter rose
#

configOf ๐Ÿ‘€

#

cryptic assistance team, reporting in!

still forum
#

>> ๐Ÿ‘

granite sky
#

so getText (configFile >> "CfgVehicles" >> backpack player >> "author") or getText (configOf unitBackpack player >> "author") I guess.

still forum
#

(configOf backpack player) does that work? ๐Ÿค” not sure if the author woul.. yeah backpack is CfgVehicles only ๐Ÿค” bad, no worky

quaint oyster
#

thanks everyone

wind hedge
#

Here is the optimized version for you: ```sqf
VAL_fn_tileFog = {
_tileSize = 100;
private _tiles = worldSize / _tileSize;
_smallmks = [];

for "_x" from 1 to _tiles do {
    for "_y" from 1 to _tiles do {
        _pos = [_x*_tileSize - _tileSize/2, _y*_tileSize - _tileSize/2, 0];
        _mk = createMarker ["small_" + str _pos, _pos];
        _smallmks pushBack _mk;
        _mk setMarkerShape "RECTANGLE";
        _mk setMarkerColor "ColorBlack";
        _mk setMarkerBrush "SolidFull";
        _mk setMarkerSize [_tileSize / 2, _tileSize / 2];
    };
};

V_UPDATETILE = {
    {
        _mk = _x;
        _mkpos = getMarkerPos _mk;
        if (allPlayers findIf {
            _mkpos distance2D getPosWorld _x < 150
        } isNotEqualTo -1) then {
            deleteMarker _mk;
            continue
        };

        if (allPlayers findIf {
            _mkpos distance2D getPosWorld _x < 250
        } isNotEqualTo -1) then {
            _mk setMarkerAlpha .5;
            continue
        };
    } forEach _smallmks;
};

while { true } do {
    sleep 1;
    if (diag_fps > 15) then {
        call V_UPDATETILE;
    };
};

}; ```

open hollow
wind hedge
#

If you increase _tileSize = 100; to _tileSize = 200; it is ultra fast...

#

Maybe one of the gurus here can optimize it even further, but it is faster (due to no longer being creating markers all the time) and more readable than what it was before...

#

I guess another optimization could be to make the markers local so each player has to reveal their own maps... that would make it even faster and less straining on the server too..

#

I am thinking of variants of this script, were for example markers with enemies on them would go red instead of black or a "SAT SCAN" type of thing that reveals tiles with enemies etc... many applications could be cool...

wind hedge
# open hollow hey! ill try i out but the huge amount of markers might be a problem

here, made it even faster with exitWith ---> ```sqf
V_UPDATETILE = {
{
_mk = _x;
_mkpos = getMarkerPos _mk;
call {
if (allPlayers findIf {
_mkpos distance2D getPosWorld _x < 150
} isNotEqualTo -1) exitWith {
deleteMarker _mk;
continue
};

            if (allPlayers findIf {
                _mkpos distance2D getPosWorld _x < 250
            } isNotEqualTo -1) exitWith {
                _mk setMarkerAlpha .5;
                continue
            };
        };    
    } forEach _smallmks;
};```
open hollow
#

yea, but now i saw this, i wanto to make it in this way lol
https://forums.bohemia.net/forums/topic/232213-bearing/

wind hedge
#

If you are willing to mess with server DLL stuff....

open hollow
granite sky
#

That allPlayers findIf { _pos distance2d _x } stuff is much faster with allPlayers inAreaArray [_pos, dist, dist]

#

Also arrange it so that the <250 check can be used to rule out the <150 check.

wind hedge
granite sky
#
V_UPDATETILE = {
    {
        _mkpos = getMarkerPos _x;
    _near = allPlayers inAreaArray [_mkpos, 250, 250];
    if (_near isEqualTo []) then { continue };
    _near = _near inAreaArray [_mkpos, 150, 150];
    if (_near isEqualTo []) then { _x setMarkerAlpha .5 } else { deleteMarker _x };
    } forEach _smallmks;
};
#

Now if you make some assumptions about player movement versus update frequency then you can go fancier and only check the cells next to cells that have already flipped.

meager granite
#

Non-stackable EH replaces previous one

winter rose
#

add vs set yes

pulsar bluff
#

is there a quick check to see if player is able to fire from a FFV seat?

#

isTurnedOut and weaponLowered both not doing it

little raptor
#

but it's not a quick check think_turtle

#

I think there was another config value too

little raptor
pulsar bluff
#

i mean i dont want to run evals on someone in the back of a hunter

#

was hoping a quick command would do it, like "weaponlowered" or "isturnedout"

#

alas ..

little raptor
#

that's not FFV anyway

winter rose
pulsar bluff
#

would be nice if "weaponlowered" reported true for players in the cargo seat animation (unable to fire)

#

was hoping for a clean (isNull (objectParent _unit)) || (weaponLowered _unit) instead of checking fullcrew or whatever

little raptor
#

well you can check getNumber (_turretCfg >> "outGunnerMayFire") == 1

#

whether he actually can depends on the animation

pulsar bluff
#

hmm

little raptor
#

there's also _turretCfg >> "enabledByAnimationSource"
which is what @winter rose was referring to

pulsar bluff
#

i didnt think to check firing-capable anim

fleet sand
#

Hi guys question how can i detect only 1 click and not multiple per frame ?

countL = 0;
countR = 0;
addMissionEventHandler ["EachFrame",{    
    if(inputMouse "65536") then {
        countL = countL + 1;
    };
    if(inputMouse "65665") then {
        countR = countR + 1;
    };
    hintSilent format ["%1 has click \n Left Button: %2\n RightButton: %3 \n Aditional Info:\nLeft Mouse: %4\nRight Mouse: %5",
    name player,countL,countR,str inputMouse "65536",str inputMouse "65665"];
}];
little raptor
#

don't use eachFrame

fleet sand
# little raptor don't use eachFrame
0 spawn {
    countL = 0;
    countR = 0;
    while {true} do {
        if(inputMouse 0 isEqualTo 1) then {
            countL = countL + 1;
        };
        if(inputMouse 1 isEqualTo 1) then {
            countR = countR + 1;
        };
        hintSilent format ["%1 has click \n Left Button: %2\n RightButton: %3 \n Aditional Info:\nLeft Mouse: %4\nRight Mouse: %5",
        name player,countL,countR,str inputMouse "65536",str inputMouse "65665"];
        sleep 0.1;
    };
};
``` If i use this then is inconsistent.
little raptor
#

meowsweats
I mean don't use loops in general

#

use mouse event handlers

#

what are you trying to achieve?

fleet sand
# little raptor what are you trying to achieve?

I am just learning. How would i detect mouse left click and right click but when i press left click once my counter dosent go +3 +5 depending on frame. And for mouse Event Handlers do i have to create ctrl for beaing able to detect that ?

little raptor
#

no

#

you can use displays

#

e.g to detect clicks "during the mission" use findDisplay 46

#

How would i detect mouse left click and right click but when i press left click once my counter dosent go +3 +5 depending on frame
again you shouldn't do that using an eachFrame
but if you insist, you should do it like so:

LClickActive = false;
onEachFrame {
  _lclick = inputMouse "65536";
  if (_lclick && !LClickActive) then {
    countL = countL + 1;
  };
  LClickActive = _lclick;
};
#

in other words you should save the previous state

#

mouse EH version:

if (findDisplay 46 getVariable ["oldMouseEH", -1] >= 0) exitWith {}; // don't duplicate
_EH = findDisplay 46 displayAddEventHandler ["MouseButtonDown", {
  params ["_disp", "_key"];
  if (_key == 0) then {countL = countL + 1};
}];
findDisplay 46 setVariable ["oldMouseEH", _EH ]
#

if you're trying to detect events, such as firing, again that's not the way to do it

fleet sand
# little raptor you should use user action event handlers https://community.bistudio.com/wiki/ad...

Ty very much for this info. Also i am trying user action EH but for some reason right click is not updateing code myb the key is wrong.:

countL = 0;
countR = 0;
private _ehLMouse = addUserActionEventHandler ["defaultAction", "Activate", { countL = countL + 1;}];
private _ehRMouse = addUserActionEventHandler ["optics", "Activate", { countR = countR + 1;}];
onEachFrame {
  hintSilent format ["%1 has click \n Left Button: %2\n RightButton: %3 \n Aditional Info:\nLeft Mouse: %4\nRight Mouse: %5",
  name player,countL,countR,str inputMouse "65536",str inputMouse "65665"];
};
little raptor
#

if not you should

fleet sand
stray flame
#

Hey, I am wondering how I can make it so a script will stop what its doing if another one is activated?

#

in this case its for music scripts

#

usually they go something like:

5 fadeMusic 0;
sleep 5;
playMusic "";
sleep 1;
2 fadeMusic 0.6;


playMusic ["BeholdaPaleHorse", 190];


Sleep 36;


5 fadeMusic 0;
sleep 5;
playMusic "";
sleep 1;
5 fadeMusic 0.6;
#

if another similar music script activates before the 36 seconds have passed, this would most likely interfere with whatever that one is trying to do or clash in other ways

winter rose
ivory lake
#

in regards to using isNil to run something in an unscheduled environment, is it still beholden to the scheduler 'getting around to' running it?

to explain what I'm trying to do
I have an addAction, I need the code in it to run unscheduled as its time sensitive, but I don't want it being held up by script lag

winter rose
ivory lake
#

what I mean is like, because the addaction code is run scheduled, if I put my function in a isNil to run it unscheduled, wouldn't it still be affected by script lag as the scheduler might wait around to execute the isNil?

stray flame
# winter rose do you want to know that or do you want to know how to detect a music is playing...

I just want to know if I can put something in my script that makes the later part stop if it detects a specific other script has been activated.

So script one will activate, play music, and stuff but the last part,

Sleep 36;


5 fadeMusic 0;
sleep 5;
playMusic "";
sleep 1;
5 fadeMusic 0.6;

Will be canceled if its told to (id assume form the other script. Tho it could also just stop if it detects the trigger for that script itself.)

winter rose
#

how is your mission organisedโ€ฆ how do scripts decide to trigger?

winter rose
#

you cannot get the addAction instantly unscheduled I'm afraid

stray flame
# winter rose how is your mission organisedโ€ฆ how do scripts decide to trigger?

I have set triggers placed in spots where I want music to play when players are at. When they activate, it remoteexecs a script that plays music. Like the example I gave before.

If 2 of these script triggers are close enough together and i underestimate the speed the players move at, the next music trigger and script may activate while the first is still going. Causing issues.

This issue is the first saying stop after the first script has finished

ivory lake
winter rose
stray flame
#

Ah

winter rose
#

or use a function that does that for you, if it's just about music

stray flame
#

Hm

winter rose
#

Hm.

stray flame
#

I will tinker with it

#

If simple if (condition) {effect} things work fine in scripts then it could be solved relatively easily

#

Like the example you gave

#

Thats 100% not the right word to call it but im just learning programming

kindred zephyr
meager granite
#

Having some kind of key to run code in unscheduled could've been useful

astral bone
#

is there an easier way to add positions?

ivory lake
#

oof yeah I hate that thing

meager granite
#

Maybe something like:

player addAction ["Test", [{systemChat "Unscheduled!"}, true], ...];
agile pumice
#

is # a stand in for select?

meager granite
ivory lake
meager granite
#

Speaking of addAction, with so many arguments and many of the usually not needed, having something like ENTITY addAction HASHMAP could've been very useful

#

So you can specify only parameters you need and the rest fills by itself without having to type out long array

#

Could have a key to make sure action is run in unscheduled too

#
player addAction createHashMapFromArray [
     ["title", "Test"]
    ,["action", {systemChat "Unscheduled!"}]
    ,["unscheduled", true]
    ,["priority", 123]
    ,["hideOnUse", true]
];
astral bone
#

wait what does # do?

meager granite
#

Same as select

meager granite
#

[100,200,300] select 1 + 1 => 300
[100,200,300] # 1 + 1 => 201

fleet sand
agile pumice
#

someone should comment about the increased speed with # on that wiki page

astral bone
#

how should I add positions?

meager granite
astral bone
#

like, position at sea level. [1,0,0] added to [20,332,502] for example

meager granite
#

vectorAdd?

astral bone
#

vector what now

meager granite
#

[1,0,0] vectorAdd [20,332,502]

astral bone
#

th- that'll work xD

little raptor
#

it's the same

little raptor
south swan
#

as in "# operator description mentions that it functions like select but with higher precedence, so select wiki page should probably mention that if you need higher precedence you can use # "

south swan
copper flare
#

I am trying to make a hostage rescue scenario like a hundred other people.

I have 2 hostages and a trigger setup that checks the ENH_isHostage function condition on the hostage AI. I set the AI to be hostages using Eden Enhanced so freeing them is a hold-button action and a little spinny circle. When the AI are freed the trigger executes a join to move the hostage to the player group so the player can exfil them.

COND:
NOT (Hostage1 getVariable "ENH_isHostage")

ACTIVATION:
[Hostage1] join (PlayerGroup);

I changed up the scenario a bit to account for more players and now have 3 player groups. So instead of just PlayerGroup we now have Group1, Group2, and Group3. I could do this by making the "free hostage" something individually selectable using addAction but I'd rather not. What I want to do is make it so that the scenario smartly detects the group of the user who executes the action to free the hostage. Alternately I'd like to make a way to push or pull the freed units between groups once they are freed.

I feel this is necessary because nothing ever happens the way it's intended. Ideally I should be fine with always having the hostages merged to the assault team who should've rescued them but it's not out of the realm of possibility that for some reason it makes more sense to put them into the medic or the logistic support elements.

willow hound
copper flare
willow hound
#

@copper flare My mission editing is currently a bit rusty, but I'd say you have reached the limit of what is possible (or at least feasible) with the Editor.
I guess you could try using a trigger area around the hostage to detect which player is near it when the hold action that frees the hostage is completed. But then you run into trouble if multiple players are near the hostage because there is no way to determine which player completed the hold action.
You'd (probably) be better off scripting the hostage stuff yourself, because then you can just define some code to be executed when the hold action is completed. In that case it is very easy to determine which player completed the hold action.
What do you prefer?

weak obsidian
#

I've seen in several posts in the forum the hashtag # being used in scripts but have no clue what it is about. Searched for it in the biwiki and .. no joy. Can anyone point me to a doc or sth to read up on what that does?

weak obsidian
#

Ok .. I searched for # ... cheers ๐Ÿ™‚

willow hound
copper flare
little raptor
#

that's not the "simple solution"

#

I mean it may be simple for you, but for your mission it just confuses people

copper flare
#

Oh yes absolutely it's simple to code but awful to use.

willow hound
little raptor
#

well yeah

little raptor
#

I want to modify the code saved by 3den enhanced (iirc it just adds the code to object init?)

copper flare
#

The map used is South Asia from the TOH port.

little raptor
#

actually I don't need that now ๐Ÿ˜…

copper flare
#

Ok good because if you tried to load it I'd need to just make a new mission on Stratis with less mods loaded.

little raptor
#

I didn't want to load it

#

I wanted to edit it with a text editor

#

anyway:


if (isServer) then
{
    ENH_fnc_makeHostage =
    {
      if (_this getVariable ['ENH_isHostage', true]) then
      {
        _this switchMove 'Acts_AidlPsitMstpSsurWnonDnon04';
        [
        _this,
        localize 'STR_A3_OM_SYSTEM_QUEST_HOSTAGEHOLDACTION',
        'A3Ui_fdataIGUICfgHoldActionsholdAction_unbind_ca.paa',
        'A3Ui_fdataIGUICfgHoldActionsholdAction_unbind_ca.paa',
        '_target getVariable [''ENH_IsHostage'', true] && {_this distance _target < 2 && {alive _target && {_target != _this}}}',
        'true',
        {},
        {},
        {
          [_this # 0, 'AmovPercMstpSnonWnonDnon'] remoteExec ['playMoveNow', 0];
          [_this # 0, _this # 2] remoteExec ['BIS_fnc_holdActionRemove', 0];
          _this # 0 setVariable ['ENH_IsHostage', false, true];
          [_this#0] join group (_this#1)
        }
        ] call BIS_fnc_holdActionAdd;
      };
    };
    [this, ENH_fnc_makeHostage] remoteExec ['call', 0, true];
};
#

put that in the hostage unit's init field

south swan
little raptor
#

you can just uncheck binarize in mission settings in 3den blobdoggoshruggoogly

little raptor
#

but be sure to uncheck the Eden Enhanced option

copper flare
#

Tested and worked thanks

#

Knowing the way players act I an almost sure someone from the "wrong" group would free the hostages the first time out if I didn't add the contingency for it to work.

agile pumice
# south swan sounds like a fitting use of <https://community.bistudio.com/wiki/vectorLinearCo...
[] spawn {
    _posA = getPosASL a;
    _posB = getPosASL b;
    _dist = round(_posA distance _posB);

    _coords = [];
    for "_i" from 0 to _dist do {
        _newPos = vectorLinearConversion [0, _dist, _i, _posA, _posB];
        _zOffset = (getTerrainHeight _newPos) - 1;
        _newPos set [2, _zOffset];
        _coords pushBack _newPos;
    };
    
    setTerrainHeight [_coords];
};
``` well, it makes a jagged trench between the objects so that's a start
#

Is this a terrain resolution issue or?

south swan
#

terrain resolution is in 2m range at best iirc

quiet gazelle
#

lol no

#

4m at best

#

usually worse

#

on vanilla maps at least

#

tanoa may have 3.75m

#

malden has 12.5

little raptor
#

well any terrain that is too uneven uses a small cell size

little raptor
#

setTerrainHeight sets the height of the closest cell vertex

south swan
quiet gazelle
south swan
#

i also wonder if manually rounding to the nearest cell would help with later JIP shenanigans meowsweats

little raptor
#

but RHS one (don't remember its name) was 2m

quiet gazelle
quiet gazelle
#

thank you

little raptor
#

so you only need to make sure of that

fair drum
#

can I do anything with the number id return for playSound3D?

hallow mortar
fair drum
#

doh there goes that dev branch trickery again!!

#

no way to tell if the sound is complete in that dev branch though

little raptor
#

iirc getSoundInfo or something

#

soundParams

fair drum
cosmic lichen
#

Var name is in the description.

fair drum
#

It didn't register to me that he wanted to use the hold action that is built into ENH's makeHostage function

#

I think its worth in his case, for him to write his own holdaddaction that can get him the effect he wants of the hostage joining the correct group of the free'er as well as knowing exactly when the hostage becomes freed so he can skip using a loop.

little raptor
little raptor
cosmic lichen
#

thief ๐Ÿ‘€

#

Gonna add that with the next update then

lament fog
#

Hi, im trying to make some Screenshots and i run into some problem, i dont know how to make the AI Shoot their guns while they are in static, i tried to put the script that is in the POLPOX Guide, but when i put it in Init, the thing errors.

cosmic lichen
#

@lament fog We need more information. The thing errors is not exactly specific

lament fog
# cosmic lichen <@892028845534904342> We need more information. The thing errors is not exactly ...

so i put in "[this, 0, 0.3] call PLP_fnc_fireWeapon" in Init, and it supposed to make the weapons fires itself while the soldier is in static, but when i start the playing the editor, it simply saids taht he cannot fire its weapon, and i cnat find the solution for this, i change the RPM taht didnt do anything, i change the weapon still the same, i keep trying to make them fire their weapon, but they just wont.

cosmic lichen
#

Did you try on POLPOX's discord?

lament fog
hallow mortar
#

Not all animations allow the unit to fire its weapon

lament fog
hallow mortar
#

Well, in theory, you can make a mod that changes that animation to allow firing. That is probably beyond your level of competence though.
So, in practice, nothing.

lament fog
#

welp, guess ill scrapt it and make a new one.

hallow mortar
#

I mean you can always find muzzleflash.jpeg and add it in photoshop I guess

hallow mortar
#

Then use one of the many free alternatives

quiet gazelle
#

gimp then

lament fog
#

thanks for the help BTW

last rain
#

Is it possible to know the scaling of the player's map?

fair drum
#

can I remove a specific engine action with inGameUISetEventHandler?

agile cargo
#

Is there a EH to handle players spawning after briefing, serverside?
must handle JIPs and trigger once per mission

granite sky
#

mission event handler PlayerConnected, has a JIP flag.

#

It'll trigger multiple times per mission if players disconnect and rejoin but you can track that easily enough.

#

If you want to be very specific about when it triggers (like whether the player object exists) there are other options.

warm hedge
agile cargo
#

I'm only interested in players actually playing

#

I was thinking in creating a client side .pbo that uses CBA_loadingScreenDone, it will wait X seconds before sending a server event. On the server, I'll have a .pbo with the event, updating a hashmap with the player GUID as the key

granite sky
#

Doesn't seem like you'd need it. There's a lot of server side functionality for this now. OnUserSelectedPlayer + didJIPowner, maybe.

#

OnUserClientStateChanged also an option.

agile cargo
#

hmm, yeah I guess OnUserClientStateChanged is what I'm looking for

#

thanks

grand stratus
#

When using 'CfgDisabledCommands', will this prevent all client execution of these commands? Or just the commands executed in the execution path/scope from the missions init.sqf?

tough abyss
#

Is there anyway to make the Vanilla pop-up targets "hot" and become illuminated on thermal scopes?

molten yacht
#

Is there any way to get cfgRespawnInventories to handle weapon attachments?

jade acorn
#

you can create pre-defined weapons with attachments through cfgWeapons in config.cpp and then add them to respawninventories

tough abyss
#

No, because they have no color in the approriate channels of their TI texture for that.

molten yacht
#

...is that how you do it? Hell. Okay, thanks.

#

Do recommend where I could find any examples of this?

jade acorn
#

check official wiki

molten yacht
#

I did, it's a stub without like, a coherent example

jade acorn
#

weird

jade acorn
# molten yacht I did, it's a stub without like, a coherent example
CfgWeapons {
class InheritedWeaponClassname;
    class TAG_YourNewWeapon : InheritedWeaponClassname
    {
        class LinkedItems
        {
            class LinkedItemsOptic
            {
                slot = "CowsSlot";
                item = "optic_Arco";
            };
            class LinkedItemsAcc
            {
                slot = "PointerSlot";
                item = "acc_pointer_IR";
            };
            class LinkedItemsMuzzle
            {
                slot = "MuzzleSlot";
                item = "muzzle_snds_M";
            };
        };
    };
};```
make sure you're adding a compatible item with that weapon, some weapons have restrictions of what you can mount on them. and in case of future config stuff you can go to [#arma3_config](/guild/105462288051380224/channel/122121444703338496/)
fleet sand
#

addMissionEventHandler ["Map",{
    params ["_mapIsOpened", "_mapIsForced"];
    LEG_mapOpen = false;
    if(_mapIsOpened) then {
        LEG_mapOpen = true;
        systemChat "Map Open";
        [] spawn {
            ("RscMyHUD_layer" call BIS_fnc_rscLayer) cutRsc ["MapTimerDialog", "PLAIN",-1,true];
            disableSerialization;
            private _parent = uiNamespace getVariable "MapTimerDialog";
            private _text = _parent displayCtrl 1000;
            while {LEG_mapOpen} do {
            _text ctrlSetText format ["%1",[CBA_MissionTime, "H:MM:SS"] call CBA_fnc_formatElapsedTime];
            uiSleep 0.1;
            };
            waitUntil {not LEG_mapOpen;};
        };
    }else {
        LEG_mapOpen = false;
        systemChat "Map Closed";
        ("RscMyHUD_layer" call BIS_fnc_rscLayer) cutRsc ["", "PLAIN"];
    };
}];

Hi guys i made this code. All i want it to do is the HUD to show when i open the map and show missionTime and remove it when i am not in map anymore. But when i close the map hud still says on and i got the Resource Title not Found Error. I dont know is the best way to aproach this or how to get display to close when you close the map.

#

Ok i got it the Problem was in

LEG_mapOpen = false;
systemChat "Map Closed";
("RscMyHUD_layer" call BIS_fnc_rscLayer) cutRsc ["", "PLAIN"];
//Change to this:
("RscMyHUD_layer" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];  

Even though i got this to work is this optimal solution for something like this ?

meager granite
#

("RscMyHUD_layer" call BIS_fnc_rscLayer) is no longer needed, just use "RscMyHUD_layer"

#

Show:

"RscMyHUD_layer" cutRsc ["MapTimerDialog", "PLAIN", 1e-6];
```Hide:
```sqf
"RscMyHUD_layer" cutFadeOut 0;
meager granite
#

1e-6 == 0.000001

warm hedge
#

Will show the 1e-6 seconds of fade in

meager granite
#

Also you can get rid of your flag variable, just do:
while {!isNull _text}

warm hedge
#

Which the fade in is simply impossible to see so it means instant show

meager granite
#

Also ideally move your UI code into MapTimerDialog's onLoad

fleet sand
#

Also a question if i want to remove i can use eather or one of these right ?

"RscMyHUD_layer" cutFadeOut 0;
"RscMyHUD_layer" cutText ["", "PLAIN"];
meager granite
#

Yeah, both will work, second one will replace your display layer with generic text layer

#

but cutFadeOut is more proper layer closure

fleet sand
meager granite
#

This is too ugly, have it call a function

#

And onLoad is unscheduled, this won't work

#
onLoad = "_this select 0 call someFunctionName";
someFunctionName = {
    uiNamespace setVariable ["MapTimerDialog", _this];
    0 spawn {
        disableSerialization;
        private _text = uiNamespace getVariable ["MapTimerDialog", displayNull] displayCtrl 1000;
        while{!isNull _text} do {
            _text ctrlSetText ...;
            uiSleep 0.1;
        };
    };
};
fleet sand
meager granite
#

You probably have duration wrong

fleet sand
#
addMissionEventHandler ["Map",{
    params ["_mapIsOpened", "_mapIsForced"];
    LEG_mapOpen = false;
    if(_mapIsOpened) then {
        LEG_mapOpen = true;
        systemChat "Map Open";
        [] spawn {
            "RscMyHUD_layer" cutRsc ["MapTimerDialog", "PLAIN", 1e-6,true];
            waitUntil {not LEG_mapOpen;};
        };
    }else {
        LEG_mapOpen = false;
        systemChat "Map Closed";
        "RscMyHUD_layer" cutFadeOut 0;
    };
}];
class MapTimerDialog
{
    idd = -1;
    onLoad = "_this select 0 call LEG_fnc_timeToStringDialog";
    duration = 1e+6;
meager granite
#

Test run your "RscMyHUD_layer" cutRsc ["MapTimerDialog", "PLAIN", 1e-6,true]; and see if it stays

fleet sand
meager granite
#

getNumber(missionConfigFile >> "RscTitles" >> "MapTimerDialog" >> "duration")

fleet sand
#

Result : 1e+006

meager granite
#

Maybe you have some other code running closing your layer or display or something

#

Do "TotallyNewLayer" cutRsc ["MapTimerDialog", "PLAIN", 1e-6,true];

fleet sand
# meager granite <:thonk:700311400152825906>

I found the problem In here when I do it like this:

"RscMyHUD_layer" cutRsc ["MapTimerDialog", "PLAIN", 1e-6,true];

display shows for a few seconds and disapers
but when i do it like this:

"RscMyHUD_layer" cutRsc ["MapTimerDialog", "PLAIN", -1,true];

display stays

warm hedge
#

Why not just use 1e-6 then?

fleet sand
# warm hedge Why not just use 1e-6 then?

I dont know what is causing this but aperantly the speed of a fade in is causing my display to disapear after a few seconds. if i use 1e-6 it disapears but if i just a value like -1 1 or any other it stays.

meager granite
#

while 1e-6 does an instant appearance

#

both stay indefinitely

#
class KingOfHill_Hint {
    idd = -1;
    duration = 1e11;
    onLoad = "_this select 0 call client_func_hints_onLoad";
    class Controls {
        class HintBackground:RscText {
```Nothing special in the display itself
#

Maybe duration of 1e+6 is not enough and my 1e11 makes it behave differently/

fleet sand
meager granite
#

Huh, so if I do ```sqf
"KingOfHill_Hint" cutRsc ["KingOfHill_Hint", "PLAIN", 1e-11];

#

I guess that fade in time is also a multiplier for the duration

#
"KingOfHill_Hint" cutRsc ["KingOfHill_Hint", "PLAIN", 3e-11];
```makes it last 3 seconds
#

So yeah, title stays visible for duration * speed

#

No mention of it anywhere on wiki it seems

#

Might be worth adding

fleet sand
#

Yea this would be great addition just in case somebody runs in the same problem.

cedar cape
#

ive got a heli flying with unit capture but how do i kick out all the AI in the cargo once its landed

willow hound
#

@cedar cape Something like ...

{
  doGetOut _x;
  unassignVehicle _x;
} forEach _myUnits;
cedar cape
#

instead of each individual unit

#

that would kick out the gunners too

#

can "cargo" be used?

#

wdym

#

would that not kick out the gunner?

#

and drivers

#

im confused

#

how would that look in script

#

alr

keen stream
#

BIS made a funny again?

cedar cape
#

alr

#

where would i put that?

#

im using unit capture for the vehicle

#

so i put a trigger where the heli lands?

fleet sand
#
addMissionEventHandler ["EachFrame", {
    if((missionNamespace getVariable "isAcidRainActive")) then {
        if([player] call LEG_fnc_isInHouse) then {
            hintsilent "Safe";
        } else {
            hintSilent "Better run";
        }; 
    };
}];

What would be the best practice in here to dmg player every 5 to 10 seconds if player is not Safe ?

winter rose
still forum
#

more betterer missionNamespace getVariable ["LEG_isAcidRainActive", false])
get rid of that, and start the loop when you start acid rain, and kill the loop again when you end it.
No need to constantly check every 5-10 seconds, while its not active

winter rose
#
LEG_isAcidRainActive = true;
0 spawn {
  while { sleep (5 + random 5); missionNamespace getVariable ["LEG_isAcidRainActive", false] } do
  {
    if ([player] call LEG_fnc_isInHouse) then
    {
      hintSilent "Safe";
    }
    else
    {
      hintSilent "Find shelter!";
    };
  };
};

sleep 60;
LEG_isAcidRainActive = false;
fleet sand
still forum
#

Are you using any medical system mod?

fleet sand
#

No vanilla.

still forum
#

applying damage in vanilla is different than applying damage in ace medical

fleet sand
still forum
#

Based on Lou's example

LEG_isAcidRainActive = true;
private _damageScript = 0 spawn {
  private _warningCounter = 0;
  while { sleep (5 + random 5); true } do {
    if ([player] call LEG_fnc_isInHouse) then {
      hintSilent "Safe";
      _warningCounter = 0;
    } else {
      hintSilent "Find shelter!";
      _warningCounter = _warningCounter + 1;
      if (_warningCounter > 5) then {
        // Waited long enough, apply damage
        player setDamage (damage player + 0.05);
      }
    };
  };
};

sleep 60;
LEG_isAcidRainActive = false;
terminate _damageScript;
#

So you get like 25 seconds without cover, then it starts hurting you

fleet sand
still forum
#

terminate _damageScript; at the end, kills the spawned script

#

Its probably more unclear than checking the variable every iteration.
But if you know only one thing turns the variable to false, you can kill the script there without need to check constantly

#

Just giving you extra choice, you can also use Lou's variant

fleet sand
#

When i try to run this code i have error saying undefine variable in expresson _house in LEG_fnc_isInHouse
here is the code of the fnc:

params ["_unit"];
private _line = lineIntersectsSurfaces [getPosWorld _unit, getPosWorld _unit vectorAdd [0, 0, 50],_unit, objNull, true, 1, "GEOM", "NONE" ];
_line select 0 params ["","","","_house"];
if (_house isKindOf "House") exitWith { true; };
false;
fleet sand
little raptor
#

If there is no intersection it's empty

#

Use param or count check

still forum
#

if (isNil "_house") exitWith {true}; // Nothing found, is probably outside (or inside extremely tall house)
? before the isKindOf?

little raptor
#
private _house = _line param [0, []] param [3, objNull];
fleet sand
#

so fnc should look like this:

params ["_unit"];
private _line = lineIntersectsSurfaces [getPosWorld _unit, getPosWorld _unit vectorAdd [0, 0, 50],_unit, objNull, true, 1, "GEOM", "NONE" ];
private _house = _line param [0, []] param [3, objNull];
if(isNil _house) exitWith {false;};
if (_house isKindOf "House") exitWith { true; };
false;
little raptor
little raptor
#

And it's wrong anyway

fleet sand
#

ty very much it worked.

winter rose
#

same, saves the array creation

warm hedge
#
0.0006 ms

Cycles:
10000/10000

Code:
[]```
```Result:
0.0004 ms

Cycles:
10000/10000

Code:
0```
Apparently an array is unnecessary slow. But very small difference
winter rose
#

(perf++ โ†‘)

#

I will ask for spawn -code- unary command one day :p

winter rose
#

gib

kindred zephyr
#

push to main as alternate syntax ๐Ÿ˜

sage bridge
#

Does anyone know how to randomize a vehicles texture through orbat or the text editor? ex: Spawn in BTR-70, it has a random camo/skin.

kindred zephyr
#

there is already a BIS function for that iirc?

warm hedge
#

Debug Console, the meter icon

#

It is the button/command to get the performance of the code

copper raven
#

because array does a malloc, 0 is a constant, allocated at compile time and does not need an allocation at runtime (thus cheaper, as the benchmark shows)

meager granite
#

There are matrix commands now so its easier

grand stratus
#

Anyone know how to force a missile projectile to explode? deleteVehicle and setDamage 0 seem to just make it disappear. Having a hard time finding anthing in the wiki

grand stratus
#

Thank you so much

sage bridge
#

Can anyone please help me make a script that randomizes a vehicles texture/skin in either orbat or the text editor? Please, any help is greatly appreciated.

winter rose
#

which you did here

fair drum
fair drum
sage bridge
#

CUP

#

It sets it to a base skin

fair drum
#

give me a class name of the one you are using

sage bridge
#

b_afougf_btr70

#

textureList[]=
{
"ZSUCAMO1",
0.3,
"ZSUCAMO2",
0.3,
"ZSUCAMO3",
0.3,
"ZSUCAMO4",
0.3,
"ZSUCAMO5",
0.3,
"ZSUCAMO6",
0.3,
"ZSUCAMO7",
0.3,
"ZSUCAMO8",
0.3,
"ZSUCAMO10",
0.3,
"ZSUCAMO11",
0.3,
"ZSUCAMO15",
0.3,
"ZSUCAMO18",
0.3
};

#

using these predefined skins

quiet gazelle
#

is there a setting to include milliseconds in the timestamps in the rpt?

sage bridge
#

picked randomly on spawn

fair drum
sage bridge
#

Yes correct

kindred zephyr
# fair drum vehicles should already randomize their texture in the base game

if Vanilla, they should be configured properly to randomize, although there is a lot of mods that kinda only have a single skin defined which might be the case.

@sage bridge
read this:
https://community.bistudio.com/wiki/Arma_3:_Vehicle_Customization

its regarding vehicle classes configuration.

To modify CUSTOM textures via scripting you need to make the custom skin and use

setObjectTexture

https://community.bistudio.com/wiki/Retexturing_with_setObjectTexture

Maybe all the skins being used by that vehicle are the same?

sage bridge
#

Where do I put textureList[]=
{
"ZSUCAMO1",
0.3,
"ZSUCAMO2",
0.3,
"ZSUCAMO3",
0.3,
"ZSUCAMO4",
0.3,
"ZSUCAMO5",
0.3,
"ZSUCAMO6",
0.3,
"ZSUCAMO7",
0.3,
"ZSUCAMO8",
0.3,
"ZSUCAMO10",
0.3,
"ZSUCAMO11",
0.3,
"ZSUCAMO15",
0.3,
"ZSUCAMO18",
0.3
};

#

in this?

#

I dont mean to ask, but I do not know how to do that, can you please show me?

fair drum
#

is the import_01 something that orbat created? I don't use that system

sage bridge
#

its from a mod I believe

#

not from orbat

kindred zephyr
#

its from alive

fair drum
#

if you just want to modify B_UAArmy_Test_01, then you add the textureList[] to that class under line 104

kindred zephyr
#

he is using the alive orbat thing

sage bridge
#

Okay, nevermind

fair drum
#

oh wait

#

we are in cfgVehicles. we need to be in cfgVehicleTemplates

sage bridge
#

there is no templates lmao

#

CfgVehicleTemplates

fair drum
#

you know with what you posted, you are making a mod right? if you want a simple solution, get all the file paths of the textures you want and use setObjectTexture/setObjectTextureGlobal

#

if you just want to do it for a mission

sage bridge
#

Im not understanding im sorry. do I put the pre defined textures in "init = "if (local (_this select 0)) then {_onSpawn = {sleep 0.3; _unit = _this select 0;};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";?

fair drum
#

are you looking to make a mod that people will download and use? or are you just making a mission and want things randomized.

sage bridge
#

just making a mission and want things randomized.

fair drum
#

then toss all of that

sage bridge
#

alive spawns in a BTR-70, it has a randomized texture

fair drum
#

get a list of the texture file paths you want

sage bridge
#

which is the texturelist

fair drum
#

no, those are class names, you need a full file path for setObjectTexture

sage bridge
#

How can I find that?

#

example of another mod. : init = "if (local (_this select 0)) then {_onSpawn = {sleep 0.3; _unit = _this select 0;_unit setObjectTextureGlobal [0,'\ua_factions_rhs\data\vehicles\btr70\afou_btr70_1_newcamo_zviruka.paa'];_unit setObjectTextureGlobal [1,'\ua_factions_rhs\data\vehicles\btr70\afou_btr70_2_newcamo_04.paa'];_unit setObjectTextureGlobal [2,''];_unit setObjectTextureGlobal [3,'\ua_factions_rhs\data\vehicles\btr\afou_btr_gear_02_co.paa'];_unit setObjectTextureGlobal [4,'\ua_factions_rhs\data\vehicles\btr\afou_btr_gear_02_co.paa'];};_this spawn _onSpawn;(_this select 0) addMPEventHandler ['MPRespawn', _onSpawn];};";

fair drum
#

just standby...

sage bridge
#

would it be this?

winter rose
sage bridge
#

Right

#

Okay

fair drum
#
// Put in description.ext
class CfgVehicleTemplates
{
    class b_afougf_btr70_test
    {
        vehicles[] =
        {
            "b_afougf_btr70"
        };
        displayName = "My Test Variant";
        author = "Your Mom";
        factions[] = {
            "BLU_F", "BLU_G_F",
            "OPF_F", "OPF_G_F",
            "IND_F", "IND_G_F",
            "CIV_F"
        };
        textureList[]=
        {
            "ZSUCAMO1",0.3,
            "ZSUCAMO2",0.3,
            "ZSUCAMO3",0.3,
            "ZSUCAMO4",0.3,
            "ZSUCAMO5",0.3,
            "ZSUCAMO6",0.3,
            "ZSUCAMO7",0.3,
            "ZSUCAMO8",0.3,
            "ZSUCAMO10",0.3,
            "ZSUCAMO11",0.3,
            "ZSUCAMO15",0.3,
            "ZSUCAMO18",0.3
        };
    };
};

then when you want to spawn the vehicle, do so and run

[_myVehicle, "b_afougf_btr70_test"] call BIS_fnc_initVehicle
#

you may need to add more of the created vehicle class names to vehicles[] = {}; depending on what vehicles you want used

#

I don't see that vehicle class name in my CUP config so I'm not even going to attempt to search for the texture filepath list. But that is how you would use the new vehicle customization system

winter rose
#

all in all, this might be worth checking ALiVE configuration and documentation.

fair drum
#

It seems like it would be a great tool if you knew what you were doing and could speed things up. But if you don't, it looks like it just throws you in there

fair drum
#

@sage bridge

sage bridge
#

Yes?

fair drum
#

did it work?

sage bridge
#

Unfortunately not, I am just about to give up on it

#

Unless you can try helping me through VC or in dms then I am pretty much done

broken stirrup
#

Hi if anyone could help, I have a quick question.

I'm running a simple script that transitions players into a black screen with a splash of text and then transitions out after a few seconds. The issue is, with the "sleep" command, an error saying "suspending not allowed in this context" appears. Anyone know how to fix?

Here's the script for reference:

"_screenLayer" cutText ["2 Hours Later...", "BLACK FADED", 0, true, false];

sleep 5;

"_screenLayer" cutText ["", "BLACK IN", CRQ_SPAWN_FADEIN_TIME, true, false];

sage bridge
#

Run it through an sqf

fair drum
sage bridge
#

I have tried both methods and it doesn't work, im sorry, I really do appreciate your help a lot.

broken stirrup
frigid oracle
#

I have a certain item tied to a while script. How do I detect if the item is dropped, picked up, and spawned with? Only locally

frigid oracle
# winter rose an inventory event handler?

which one? they dont say what im looking for bluntly so it leaves me unsure what to use.
I was thinking it could be ContainerClosed and Open? Cause stuff on the ground is a fake container afaik
But InventoryOpened and InventoryClosed are the best options I assume? Am I just overthinking it?

fair drum
frigid oracle
#

ah right, take, put, I am just overthinking

broken stirrup
#

Hi, I have another question. If anyone is able, is there any script that forces a player to turn on the NVG in their inventory? I have a sequence that transitions from a daylight to night time setting and in the "cutscene" I would like for players to have their nod's equipped without any interaction. Any way to achieve this?

broken stirrup
#

Thanks so much once again! I feel like such a novice with all of this ๐Ÿ˜…

quiet gazelle
#

is it possible to lay alpha over a texture using UI on texture?

#

like to make a texture that is an already existing texture but with parts cut off?

little raptor
quiet gazelle
#

the idea is to have one texture per red square, with the texture displaying the ground texture and being transparent inside the trench

little raptor
#

nope you can't do that
but don't you already triangulate around the trench?
if so one idea might be making more triangles with different texture uvs and using them accordingly
it'll still be glitchy near the trench but far from it it should be ok think_turtle

#

tho I guess your triangle shapes are not so predictable from what I see meowsweats

quiet gazelle
#

thanks, i'll bake more uvs then

#

i thought if the ui was possible i would have less objects and less distortion

little raptor
#

actually no I think that won't move the uv ๐Ÿ˜“

#

but anyway I was gonna suggest animations

quiet gazelle
#

that's already how i get them in shape

#

that's what stretches the uv

little raptor
#

I thought you triangulate it then place triangles there blobdoggoshruggoogly

quiet gazelle
#

yes, that's what i do

#

the triangles themselves are animated to fit

scenic shard
#

how does compositions and init field work? are the only executed locally for zeus or something?

they seem to run fine when testing, but not on actual dedicated server

hallow mortar
#

When a composition is placed in the Editor, the init fields of its objects behave like any Editor init field - executed on all machines and JIP.
When placed with Zeus, the init fields are only executed on the machine that placed them.

kindred zephyr
#

just for confirmation sake, procedural textures can be set to deploy any color you config them to, right?

sage bridge
#

@fair drum

oblique anchor
#

Yo, is it possible to edit cfg variable for all vehicles in a script or description ext? I have a config field from a mod that i want to change it for all vehicles globally, is it possible via script?>

fair drum
oblique anchor
sullen sigil
#

read the wiki

quiet gazelle
tranquil nymph
#

init.sqf definitely shouldn't be removed

little raptor
quiet gazelle
#

i guess in that case i'll bake even more UVs

tranquil nymph
#

the event scripts are all handled by a scripted framework, they not anything magically handled by the engine :P

#

init.sqf however...that's some engine magic

wind hedge
#

guys, any idea why this is deleting only ~25% of the whole array on a while {true} loop on each pass? sqf if (time > V_INEXTDELCHECK) then { V_INEXTDELCHECK = time + 30; { private _inf_x = _x; private _near = allPlayers inAreaArray [getPosWorld _x, V_DELETEDIS, V_DELETEDIS]; if (_near isEqualTo []) then {0 = V_POPULATION deleteAt (V_POPULATION findIf {_inf_x == _x}); deletevehicle _x;}; } forEach V_POPULATION; };

#

I need to to delete all the units "not near" to players, and it does but takes several passes...

#

I guess the issue is here: sqf 0 = V_POPULATION deleteAt (V_POPULATION findIf {_inf_x == _x}); but I thought this would be the fastest solution

scenic shard
#

Deleting stuff from a list while iterating it is generally not a good idea. Havent looked closely but maybe try iterating from the last object to the first instead

#

If this is not what you are doing, disregard me. Just a quick glance

sullen sigil
#

is there a way to export all functions easily

wind hedge
# scenic shard Deleting stuff from a list while iterating it is generally not a good idea. Have...

Well, the stuff I am deleting are Agents that are listed in the V_POPULATION array. The loop is supposed to check every 30 seconds for agents that are too far from any players and delete them. But I believe that the "forEach" already iterates from the first to the last anyway. I could add a sleep in there and there is no performance degradation. The only issue is that if 100 Agents are far from the players, every 30 seconds this code only deletes ~25% of them on each loop... And I don't know why it doesn't delete all of them during that first iteration...

#

Of course, there should be a correct way of doing it... which I am not grasping yet...

kindred zephyr
#

i do something similar-ish and it works just fine for the specific stuff that I do and check. I do check closeness to players and remove them too, so maybe this can shed some light

#
//dynamic cleaner
if (count (_currentGrps) > (_maxgroups) then //Or any other condition to clean
{    
    private ["_newGroups", "_oldGroups"];
    
    _newGroups = [];
    _oldGroups = _currentGrps;
    
    {
        if !(isNull _x) then //Or other condition
        {
            private ["_currentGroup", "_iteratedGroup", "_canRemove"];
            
            _currentGroup = _x;
            _iteratedGroup = units _currentGroup;
            _canRemove = true;
            
            {
                private _currentPlayer = _x;
                
                {
                    if (_x distance _currentPlayer < _someDistance) exitWith 
                    {
                        _canRemove = false;
                    };
                }count _iteratedGroup;
                
                if !(_canRemove) exitWith {};
            }count allPlayers;
            
            if (_canRemove) then
            {
                {
                    deleteVehicle _x; 
                }forEach _iteratedGroup;
            }
            else
            {
                _newGroups pushBack _currentGroup;
            };
        };
    }forEach _oldGroups;
    
    _currentGrps = _newGroups;
};
scenic shard
#

I'm on mobile so its hard to follow the code exactly.

But to me it looks like you are iterating (looping) the vpop array, and deleting elements from the same array inside the loop.

This will mess with the indexes, so instead of a foreach loop, try using a standard for loop and start at the last index and and move to the first.

kindred zephyr
#

he is

#

that the real issue

#

its not that it deletes arbitrarily 25% units

#

but that he losses an unit to check per each one he deletes

#

he just need to hold a control array and a reference array, and not delete from the reference one

scenic shard
#

Yea, that also works if he really wants the foreach loop instead of a for

south swan
#

delete findIf inside the forEach loop looks crazy enough to break the backwards iteration too blobcloseenjoy

kindred zephyr
#

its also inneficient to search within yourself if you already know your _forEachIndex

south swan
#

Logic looks like array should end up empty anyways

#
{deleteVehicle _x} forEach _array;
_array resize 0;``` should be good enough for that ![blobdoggoshruggoogly](https://cdn.discordapp.com/emojis/748124048025714758.webp?size=128 "blobdoggoshruggoogly")
wind hedge
#

Ok, so I will do two different arrays, one the main array and the other the array of the units inside the main array that are outside the radius, and then, how do I delete all the units in the main array that are duplicated in the "to delete" array?

kindred zephyr
#

firt remove the units to delete and the deleteAt find in your reference

south swan
#

I wonder if scripting command to split an array into two based on predicate can be useful tanking Like sqf [1, 2, "a", objNull] selectSplit {_x isEqualType 0} // [["a", objNull], [1, 2]]

south swan
little raptor
tough abyss
#

BIS made a funny again?
Nah. They are not meant to heat up.

little raptor
#

using something like 0 instead of objnull is faster but be careful. if the array might still be iterated over again before the invalid stuff are removed you'll get a type error

wind hedge
little raptor
#

e.g. you delete something at index 2, the array shifts one back, now in the next iteration when forEach wants to use index 3. it actually uses the old item at index 4 (it got shifted to index 3). the one at index 3 was also shifted to where 2 was so it's safe

wind hedge
little raptor
#

findall is just select

wind hedge
#
_array deleteAt select {_nonMagicX == _x};``` ?
little raptor
#

select returns elements not indices

#

and deleteAt doesn't take array

#

also now that I read your code it's way too redundant

wind hedge
little raptor
#
{
                    private _inf_x = _x;
                    private _near = allPlayers inAreaArray [getPosWorld _x, V_DELETEDIS, V_DELETEDIS];
                    if (_near isEqualTo []) then {0 = V_POPULATION deleteAt (V_POPULATION findIf {_inf_x == _x}); deletevehicle _x;};
                } forEach V_POPULATION;

you're just removing the item at _forEachIndex

#

so you already have the index

#

and like I said just do that via select

#
V_POPULATION = V_POPULATION select {count (allPlayers inAreaArray [getPosWorld _x, V_DELETEDIS, V_DELETEDIS]) != 0 || {deleteVehicle _x; false}};
wind hedge
little raptor
#

even if you didn't know select you could still do it like so:

{
                    private _near = allPlayers inAreaArray [getPosWorld _x, V_DELETEDIS, V_DELETEDIS];
                    if (_near isEqualTo []) then {V_POPULATION set [_forEachIndex, objNull]; deletevehicle _x};
                } forEach V_POPULATION;
V_POPULATION = V_POPULATION  - [objNull]
wind hedge
#

Yeah but I was told this sqf V_POPULATION = V_POPULATION - [objNull] was slow...

#

Well, not that but V_POPULATION = V_POPULATION - [_x]

little raptor
wind hedge
little raptor
#

fixed an error

tough abyss
#
			if !(isDedicated) then {
				[player,didJIP] execvm "initPlayerLocal.sqf";
				[[[player,didJIP],"initPlayerServer.sqf"],"bis_fnc_execvm",false,false] call bis_fnc_mp;
				"initPlayerLocal.sqf" call bis_fnc_logFormat;
				"initPlayerServer.sqf" call bis_fnc_logFormat;
			};

looks like initPlayerLocal and initPlayerServer run for headless cients

frank cedar
#

Question regarding ExtDB2. Is ExtDB2 creates sqllite DB file automatically when I trying to get access to it first time?

#

Or I should create it myself?

weak obsidian
#

Regarding "SetIdentity" in MP. I've worked it out so that on player respawn a variable from the old character gets loaded and the respawned character gets a remotexec'd setidentity face, however I've noticed something curious - the OLD unit looses the face and it gets reverted to the player's profile face. What's up with that?

winter rose
#

it might be related

weak obsidian
#

Interesting - it's not a big deal because the old corpse gets deleted - but it's one of t hose Arma things ... ^^ TM

wind hedge
#

does the sqf _targets = _unit targets [true, 300]; command returns the array of targets from closest to furthest? Or is it necessary to use the BIS_fnc_sortBy fnc to order by distance?

fair drum
wanton swallow
#

Hi guys. How to make a plane attack a point?
I trying to do

_pilot doWatch _position;

Then this:

_pilot doSuppressiveFire _position;

or this one:

_pilot fire (currentWeapon _plane);

But get no effect. Plane comes to position and do not firing at the point.

meager granite
fair drum
#

actually it looks like its the opposite

meager granite
#

Can't target server client?

#

Question is, can I have non-server client fire a function with allowedTargets = 1; against server client?

fair drum
#

oh I see what you are getting at. I'm interpreting that as it is denied on dedicated, and not denied on listen. I'd have to test.

willow hound
#

What is a server client?
Server is server and client is client. If the server is player-hosted, then it has a player and an interface (but it is still the server, not a client); if it is dedicated, then it neither has a player nor an interface. Either way, it always remains the server: isServer always returns true and the machine network ID is always 2. The server is never a client.
It is of course possible that I made a mistake when I reworked the remote execution pages, but I would be very surprised if it was possible to remotely execute a function configured with allowedTargets = 1 on either type of server.

still forum
pliant cradle
#

Hi together, as a non programmer I get in struggle by writing a simple script:

What do I want to do:
Get all traits of the actual players in current mission (Dedi Envoirement) and print later the result on a Billboard or something else: Actual Medics: Player 1, Player 2, Player 3,.... ; Actual explosive Specialists: Player 1, Player 2,... and so on.

I started with getting allplayers, iterate the getunittrait over and then I am stuggling: How do I get the result of the Iteration to an Array? Or is this the complete wrong path?

private _allplayers = allPlayers - entities "HeadlessClient_F"; private _medic_trait = "Medic"; _playerswithtraits = []; {_x getUnitTrait _medic_trait } forEach _allplayers; //pushback to use ?

Thank you so much for your feedback and help.

willow hound
#

@pliant cradle Your idea is correct, you could indeed do it like so ...

private _medics = [];
{
  if (_x getUnitTrait "medic") then {
    _medics pushBack _x;
  };
} forEach _allPlayers;
```... but there is an easier way:
```sqf
private _medics = _allPlayers select {_x getUnitTrait "medic"};
```Under the hood (i.e. in the game engine), the `select`-statement does the same thing as the `forEach`-loop above (like I said, your idea is correct). The `select`-statement is just shorter and also faster (because a larger portion of the code is executed directly in the game engine, which is faster than running similar SQF code).
pliant cradle
#

Thanks a lot ansin11 for pushing to the right direction. And yes when I see now how you solved it makes "click" by my side. And that select-statment is faster was also new to me. Very smart idea. Thanks a lot for pushing me in the right direction.

modern meteor
#

Does anyone know the name of move which looks like the player is using a medikit?

little raptor
modern meteor
#

Thank you. I'll have a look

#

On a different note, how can I check if an array is empty within an IF condition?

modern meteor
#

Thanks very much!

winter rose
#

^ slower but more human readable

wispy topaz
#

Hello
I'm trying to use ChatGTP for scripting in Arma 3 (since I have very little knowledge on scripting) and I got this as a result.

this addAction ["Add to squad", {
   // Add the AI unit to the player's squad
   [_this, group player] joinSilent group player;
}];```

What I'm trying to do is to make AI join my squad using the action menu. Chat told me to put it in the unit's init field and I did, but even tho I can see the action pop up when I'm close to the unit, the unit doesn't actually join my squad when I select the action.
winter rose
wispy topaz
#

Yea I know :/ but I'm completely clueless

winter rose
#

hi completely clueless, I'm dad! ๐Ÿ˜„

#

so!
Goal: make AI join my squad using the action menu
when?

wispy topaz
#

When I get close to them and select the action from the action menu

winter rose
#

so an action on them to join your group, OK. is that multiplayer or singleplayer?

wispy topaz
#

singleplayer

winter rose
#

kewl! so:

this addAction
[
    "Recruit",        // title
    {
        params ["_target", "_caller", "_actionId"];
        units _target join group _caller;
          _target removeAction _actionId;
    },
    nil,             // arguments
    1.5,             // priority
    true,            // showWindow
    true,            // hideOnUse
    "",              // shortcut
    "alive _target", // condition
    8                // radius โ† you may want to set that
];

add this to the group leader's init field to join all of its unit to you
note that if the leader is killed, the action will disappear and won't transfer to other units

wispy topaz
#

Got it ๐Ÿ™‚ Thanks man

#

Hmmm, when I use it, it gives me an Error Missing [ ๐Ÿค”

little raptor
#

last , should be removed

winter rose
#

fixeded

wispy topaz
#

Nice

winter rose
wispy topaz
#

Thanks guys

hallow mortar
#

If you're doing this in an init field you may need to remove the comments

wispy topaz
winter rose
#

true that, too

frigid oracle
#

@wispy topaz
Do not rely on stuff like chatGPT or similar AI chat models for anything code related. There are dedicated AI models for things like C and Java but they are **aids **designed to basically be context predictive auto-fill like when texting on the phone.

#

There are very good A3 tutorials on youtube to ease you into the concepts of arma scripting. If you plan to make stuff on the regular start with those.

jade acorn
#

using AI for scripting is okay-ish as long as you have the junior level scripting knowledge because it can spit out ideas but it generates something more of a pseudocode and you need to know where it makes mistakes and be able to fix them. Otherwise you're just making it harder for yourself to understand what you are doing, reading the actual wiki and mass-spamming queries in Google would be much more helpful.

frigid oracle
#

Yeah thats a fair point. I would also consider using Bing and Yandex for deeper searches. Google screws with results so much now-a-days making it harder to find very obscure stuff deep in forum threads or something.

stable dune
#

Hello,
Is attributes avaible, which are defined in config, on Zeus (if it's can I disable this option) and does attributes only affects objects which are placed via editor? Or does objects spawn with defaultValues ? If I have init eh where I do call function with values from attributes , let's say in attributes I have set decals under object boolean (default false).
Not sure does my question have any clue. But i ask anyway

pulsar bluff
warm hedge
#

Definitely it is wrong to use to let them write it A to Z

#

Tweak? Maybe good to go

fleet sand
#

How would i make value go between 0 and 9.99 based on distance ?
Code:

private _distance = ((player distance _object) - _minDistance) max 0;
private _threat = ((1 - (_distance/_maxDistance)) max 0) min 1;
``` So this gives me value between 0 and 1 how would i make this to go between 0 and 9.99
warm hedge
#

linearConversion is enough

fleet sand
warm hedge
#

Well, it is not a wrong code but probably that's not what you want

#

I have no idea what _minDistance and _maxDistance in this context so can't say how wrong, but seems so

fleet sand
# warm hedge I have no idea what `_minDistance` and `_maxDistance` in this context so can't s...

This was the fnc i had:

if (!hasInterface) exitWith {};

params ["_object", "_maxDistance", ["_minDistance", 0], ["_condition", {true}]];

"ChemicalDetector" cutRsc ["RscWeaponChemicalDetector", "PLAIN", 1, false];

private _ui = uiNamespace getVariable "RscWeaponChemicalDetector";
private _ctrl = _ui displayCtrl 101;

_maxDistance = _maxDistance - _minDistance;

while _condition do {
    private _distance = ((player distance _object) - _minDistance) max 0;

    private _threat = ((1 - (_distance/_maxDistance)) max 0) min 1;

    _ctrl ctrlAnimateModel ["Threat_Level_Source", [_threat, 2] call BIS_fnc_cutDecimals, true];

    sleep 1;
};
warm hedge
#

Still have no clue

fleet sand
#

_maxDistance and _minDistance were set to 5000 and 10.

warm hedge
#
private _threat = linearConversion [10,5000,(player distance _object),0,9.99,true];``` then I guess
warm hedge
#

Ah well, but anyways

digital hollow
#

Need a biki page for "How to start scripting for Arma with ChatGPT" that says

Don't

winter rose
#

. . . don't tempt me

fair drum
winter rose
#

๐Ÿ˜„

unsure but let's see!

#

!addQuote 1096430025693200394

lyric schoonerBOT
winter rose
#

!quote 6

lyric schoonerBOT
winter rose
#

๐Ÿ˜‚

fair drum
#

nice, so 5 and 6 are my most used ones now

winter rose
#

5 = setPos, right?

sullen pulsar
#

@tough abyss It's because a headless client is what it is, a client. It's meant to run those.

fair drum
#

yup

little raptor
#

what are the rest? meowsweats

winter rose
#

!quote 0

lyric schoonerBOT
winter rose
#

obviously

#

!quote 1

lyric schoonerBOT
winter rose
#

!quote 2

lyric schoonerBOT
# winter rose !quote 2

_> whoever posts about "is ThIs tHe neXt arMa?" or "thEy aRE aBoUt to aNNoUnCe ArMa 4" will be rammed by @young current _
should do ๐Ÿ˜„
Lou Montana; Monday, 21 June 2021

winter rose
#

!quote 3

lyric schoonerBOT
winter rose
#

!quote 4

lyric schoonerBOT
winter rose
#

the 4 definitely has potential ๐Ÿ˜„

fair drum
#

can probably clean some of those up lol

sullen pulsar
#

If it is running initServer then there is a problem.

fleet sand
#
params ["_unit","_height","_velocity","_direction","_speed","_delay"];
_unit setVelocity [(_velocity select 0) + (sin _direction * _speed), (_velocity select 1) + (cos _direction * _speed), ((_velocity select 2) * _speed) + _height];
private _pause = time + _delay;
LEG_JumpingEnabled = false;
waitUntil {time > _pause};
LEG_JumpingEnabled = true;
``` Hi so i have code here for jumping but how would i applay here code when i execute this again it tells me you have to wait x amount of time before jumping again ?
little raptor
#

well remove the waitUntil

#

instead add a timer to the _unit

stray flame
#

is there anything u can imput to stop all animations on an object?

#

Simulation is not the solution

little raptor
fair drum
#

speaking of which, why can he inline images yet I can't? lol

little raptor
fair drum
fair drum
little raptor
#

so unless you stop time... meowsweats

#

but you can make a ticket for it

#

maybe it'll get fixed

#

I'll make one myself

fleet sand
# little raptor ```sqf private _nextJump = _unit getVariable ["next_jump", -1]; if (time < _next...
_EH = findDisplay 46 displayAddEventHandler ["KeyDown", {
  params ["_displayOrControl", "_key", "_shift", "_ctrl", "_alt"];
  if(_key == 57) then {
    //systemChat format ["%1",_key];
        if((player == vehicle player) && (isTouchingGround player) && (player getVariable ["next_jump", true]) && ((stance player == "STAND") || (stance player == "CROUCH"))) then {
            _height = 10 - (load player);
            _velocity = velocity player;
            _direction = direction player;
            _speed = 10;
            [player,_height,_velocity,_direction,_speed,30] spawn LEG_fnc_Jump;
        };
    };
}];
``` just a Question how would i ge the Next jump here then where i call the script ?
little raptor
#

I don't understand the question

#

why do you want to place it there at all?

#

place it in the function

#

and call it instead of spawn

fleet sand
little raptor
#

either use the modded keybindings or do it manually using a timer again

young current
winter rose
tough abyss
#

Should be named initClientLocal then instead of initPlayerLocal. Player implies a player.

#

well HC is a player

#

just not human

winter rose
#

try in SP

tough abyss
#

Thats a weird definition. I'd say a player is a person playing a game.

winter rose
#

answer: stop breaking things!

tough abyss
#

at least the old HC system (A2) there was no diffrence from a HC or a player from a tecnical standpoint

#

no a player is a client that is connectet to a server

#

a music player is not human ;)

#

Thats a different meaning of the word.

#

HC's don't play music

#

it plays the game without a renderer and runs scripts :)

#

player != human

#

lets say it is a virtual person playing arma 3 on your server ^^

tough abyss
#

can draw3d be used to get complex models in MP? i've seen servers with custom objects ingame and am confused to how this is done

quiet gazelle
#

no

tough abyss
#

There is a word for that. It's client

quiet gazelle
#

if i'm not mistaken you can just load p3ds from the mission folder

little raptor
#

yeah you can

cosmic lichen
tough abyss
#

any relevant documentation on p3d's

#

?

little raptor
little raptor
quiet gazelle
#

you can make p3ds with blender and the arma 3 toolbox. you can spawn them in as a super simple object, which means there is no config involved.

tough abyss
#

With your definition the sqf should also trigger for the server

tough abyss
#

time to horifically fail at modelling a 3d object because i code not modell

little raptor
#

it won't have any special functionalities (damage, gravity, etc.)

tough abyss
#

The actual game player (like music player)

quiet gazelle
little raptor
#

it can have animations and collisions tho

little raptor
#

they should blobdoggoshruggoogly

#

ofc not

#

they're not entities

#

you can use Fired event handler to get missiles

#

entities is what the game constantly needs to update I guess think_turtle

#

they're also stored in a "separate container" I think

#

so looking them up is faster than going over the whole quad tree (game stores objects in a quad tree)

pliant stream
#

this argument... :shootself:

still forum
tough abyss
#

Why?

pliant stream
#

there should really be an emoticon for that..

cosmic lichen
#

@little raptor

"-1d5" regexMatch "[-+]?(?:(?:\$|0x)[0-9a-f]+|(?:[0-9]+?\.[0-9]*|[0-9]*?\.[0-9]+|[0-9]+)(?:e[-+]?[0-9]+)?)" //false

#

๐Ÿ˜„

little raptor
#

well it's not a valid number tho blobdoggoshruggoogly

cosmic lichen
#

it is

little raptor
cosmic lichen
#

parseNumber "-1d5" // -10000

little raptor
#

wut ๐Ÿ˜“

cosmic lichen
#

yes ๐Ÿ˜„

tough abyss
#

not exactly the server is not a game client its a server client
but anyway

little raptor
cosmic lichen
#

parseNumber "-1d5" == parseNumber "-1e5" // true

#

There is no "normal" in sqf

little raptor
#

yeah

cosmic lichen
#

1d5 being the same as 1e5. I've never seen that before

tough abyss
#

well not client

#

Explain yourself

#

Foxy

pliant stream
#

just seems incredibly pointless that's all

manic sigil
#

Do player units record suppression?

pliant stream
#

you know.. arguing about semantics

granite sky
#

According to getSuppression:

Suppression is not calculated for player entities and is always 0, unless it is set with setSuppression.

manic sigil
#

Damn, just read the article, mustve missed that part :x thanks

tough abyss
#

How is it pointless? Someone could write a initPlayer script that fails on the headless client and causes errors

#

There is no arguing about semantics. Words have meanings and this game is confusing enough already

stray flame
#

How can i cancel or remove tasks trough script?

stray flame
#

like for example i got this task,

when this trigger is activated, I want to finish that task. This is just for testing. will use this in a script later

#

hmmm

#

I will look into that

#

in the example given

["BIS_task_01","CANCELED"] call BIS_fnc_taskSetState;

Do I need to replace "BIS_task_01" with the variable name of the create task module, or Task ID?

Or is it that I have to write
"BIS_task_(TaskID)"

jade acorn
#

task ID

#

BIS_task_01 is an example of task ID

stray flame
#

for example for this it would be
["Tk_1","CANCELED"] call BIS_fnc_taskSetState;

jade acorn
#

yes

pliant stream
#

initPlayer initializes a player object, initClient initializes the client itself

tough abyss
#

sure but a for the server all clients are players that are connectet to him self. it does not care if there is a human siting in front of a monitor or a programm simmulating a client like a HC does

#

@pliant stream Thats not true though initPlayerLocal triggers on the headless client

#

the HC is even there on the map as a goat or whatever you place them

#

or did that change in A3?

#

I think those can be virtual now.

#

But they still take up a slot

jade acorn
#

if in scheduled environment then yeah i guess

tough abyss
#

I think