#arma3_scripting

1 messages ยท Page 127 of 1

meager granite
#

This can be added inside each case after addAction statement or after switch block

#

But only if you don't have anything else in the script

#

because that stuff will also be delayed by your sleep 30

neon plaza
#

....even the basics.

#

    
    switch (side group player) do
{
    case west: { // WEST SIDE CODE
        actId = player addAction ["Teleport to Nato Base", 
        {   
            params ["_target", "_caller", "_actionId", "_arguments"];   
            if !((incapacitatedState b_tele)== "UNCONSCIOUS") then {   
                _caller setPosASL (getPosASL b_tele);   
            };   
        }, nil, 1, true, true, "", "true", 5];  sleep 30;
player removeAction actId;

    };
    case east: { // EAST SIDE CODE
        actId = player addAction ["Teleport CSAT Base", 
        {   
            params ["_target", "_caller", "_actionId", "_arguments"];   
            if !((incapacitatedState c_tele)== "UNCONSCIOUS") then {   
                _caller setPosASL (getPosASL c_tele);   
            };   
        }, nil, 1, false, true, "", "true", 5]; sleep 30;
player removeAction actId;
 
    };
    default {};
};

meager granite
#

Yes, this is correct

neon plaza
#

Would this be correct?

#

Alright I will give this a try

meager granite
#

but if you'll have anything more added later it wont run until that sleep 30 wait passes

neon plaza
meager granite
neon plaza
still forum
#

I would expect the alt syntax https://community.bistudio.com/wiki/callExtension to give a specific error code when the extension is not loaded/found.
But there is no error code for that listed on the wiki.
Seems like it would return a -1 returnCode. But that is both if the extension doesn't exist OR if it doesn't have callExtensionArgs defined. So probably not helping much

neon plaza
#

Having an Issue with a line of code. Not sure If this code only work as admin or In Eden editor but when a player trys to use it It does not work.


this addAction ["Its just a weather balloon agent Mulder", {
  0 setFog [0,0,0];
}]; 


neon plaza
# meager granite https://community.bistudio.com/wiki/setFog

So that Is why I was able to turn It off with that script In eden editor. I had two test done. One In the main server I host and the second In the eden editor local server. The script Is on a computer and when activated by a player It Is to turn off the fog.

#

Its a shame I was hoping to put this In the players hand In some role playing sort of way.

meager granite
#
{0 setFog [0,0,0]} remoteExecCall ["call", 2];
willow hound
# meager granite ```sqf {0 setFog [0,0,0]} remoteExecCall ["call", 2]; ```

Right to jail, right away! ๐Ÿ˜ 

[0, [0, 0, 0]] remoteExec ["setFog", 2];

And even if you really wanted to use call: It is a script command, and remote execution always executes those in the unscheduled environment, so there is no need to do excess typing to use remoteExecCall instead of remoteExec.

neon plaza
#

So I should go with that one?

willow hound
#

Both should produce the same result ๐Ÿ˜‰

neon plaza
#

Thank you to both of you.

keen rain
#

Where can we modify the stamina in the Addon settings ? My people is complaining their stamina drains way too fast and it's annoying us all ..

proven charm
keen rain
keen rain
stable dune
keen rain
#

OOOOH SO THATS WHAT IT ISSS

#

THANK YOUUUU!

proven charm
#

glad u got it figured ๐Ÿ™‚

keen rain
#

Thank you too gencoder! It sure is useful!

tranquil jacinth
#

Can someone explain the error?:

There is a CfgFunctions in config.cpp -

class CfgFunctions
{
    class MD
    {
        file = "\md\functions";
        class mdf {
            class initDrone {};
        };
    };
};

The structure of the md folder is:

md/
โ””โ”€โ”€ functions/
    โ”œโ”€โ”€ fn_initDrone.sqf

But I receive the error script \md\functions\fn_initDrone.sqf not found.

winter rose
proven charm
#

can you make player run faster via script?

fleet sand
#

Just put md

tranquil jacinth
proven charm
#

thx i'll try that

#

its bit funny as it plays the animations faster but I guess that's the only way?

fleet sand
proven charm
#

hmm well I noticed player also heals faster, so that's bit unwanted

fleet sand
#

You can change that with EH anim when you detect that animation put player animspeed coef down and when the anim is done just put the animcoef back.

proven charm
#

ok thx

#

i tried this but there are lot of walk/run animations to cover because of the stances player can take ```sqf
player addEventHandler ["AnimChanged",
{
params ["_unit", "_anim"];

// sprints
if(_anim in ["amovpercmevasraswrfldf","aadjpercmevasraswrfldf_up","aadjpercmevasraswrfldf_down"]) then
{
player setAnimSpeedCoef 10;
}
else
{
player setAnimSpeedCoef 1;
};

}];

cosmic lichen
#

When exactly is he supposed to be faster? When sprinting?

proven charm
#

i was thinking all the time but I may have to limit it to sprinting anims

#

well I covered the three main run anims, maybe that will do... code updated ^

fleet sand
proven charm
velvet merlin
#

origin getPos [distance, heading]

#

no other getPosXXX has this alt syntax, right? or just not documented on BIKI

meager granite
#

Unless its the same thing

split nest
#

Hey, what can i use to view/edit SQF files ?

fleet sand
velvet merlin
#
Result: 0.0279435 ms (slow)
Code:  getPos player
[3512.99,6689.22,0.00137329]

Result: 0.00170412 ms
Code: getPosATL player
[3512.99,6689.22,0.00140381]

Result: 0.00279068 ms
Code: player getPos [100,360]
[3512.99,6789.22,-3.05176e-005]

Result: 0.00216745 ms
Code: player getRelPos [100,360]
[3526.88,6590.19,0]
> Returns position that is given distance and relative direction away from original object.
#

slightly confused by the getRelPos returned position

split nest
fleet sand
split nest
split nest
#

still cant see anything to download as it says in the quote

split nest
#

thanks got it

little raptor
#

Z is always 0

#

Direction is relative to object direction

#

Enen tho you've set the direction to 360, it will move 100m along the direction that the object is facing

#

Unless your object is facing north, it will affect both X and Y

velvet merlin
#

x 3512 vs 3526 and y 6789 vs 6590

#

if one is just cardinal? offset and the other relative to the unit direction, then i can see the difference in outcome

little raptor
#

Yeah that's why it's called rel pos ๐Ÿ˜…

chrome hinge
#

How many stored variables start to affect performance in noticeable way? If AI soldier has variable set, will the variable being saved perish along the soldier when it dies?

little raptor
#

No

#

If the unit gets deleted yes

chrome hinge
#

does that include cleanup after death?

little raptor
#

Yes

chrome hinge
#

good enough

hallow mortar
#

The variables are attached to the unit object. The object remains the same even when the brain (be it AI or player) is no longer present.

chrome hinge
#

ah alright

#

what im trying to do is to change language of everyone on blufor side, and add variable for those with new language so they dont get randomised again. Is 100 ish at once max having variable like this have noticeable impact?

#

i know spamming variables isnt good but i have no idea when to start getting worried about performance

little raptor
#

No. 100 vars are probably not gonna consume more than a few KBs
Variables don't cause much performance impact by themselves

wind hedge
# chrome hinge what im trying to do is to change language of everyone on blufor side, and add v...

The Spearhead 1944 CDLC is very performance conscious since its map and other custom features are quite extensive yet if you look at their code they add an incredible number of variables to their player and Ai units, so what I am trying to say is that they wouldn't do that if it had any performance impact since their performance budget is already very thin, they just can't afford to hurt player FPS anymore than what they already do

proven charm
#

correct me if I'm wrong but the more global variables you have the more engine has to search thru when using them

still forum
#

you're wrong. Hashtable

proven charm
#

hmm isnt there search still?

still forum
#

It searches yes. But doesn't take longer (on average) when there are more elements

proven charm
#

oh ic, that's good

winter rose
still forum
#

yes

still forum
#

local vars depends on scope depth. Either distance to the variable, or if undefined the total depth
Which is why you always use private, otherwise it looks it up

tough abyss
#

is there a way I can get a terminal output for errors instead of loading arma eden editor and test playing

winter rose
winter rose
tough abyss
#

ah, thank you ill look into that

tough abyss
#

how to a generate new logs without start the game?

fleet sand
tough abyss
#

confusion

#

if the same file is updated, how do I have so many rpt files with dates in the name?

#

does it generate a new report daily?

winter rose
#

one run = one file iirc

fleet sand
#

No i beleave it generates new file everytime you open the game and i also beleve it keeps up to certian number of files and then deletes the oldest one.

winter rose
#

it keeps ~ last 10 logs

tough abyss
#

so... it updates from opening the file, and generates a new one everytime I open the game?

fleet sand
#

Yea

tough abyss
#

i opened the latest rpt files in the fold and the time logs are the time?

#

nothing new is added? although I have changed some of the code

still forum
tough abyss
#

im just confused as to why updating a file would serve any proupse rather then having to generate a new one everytime

#

it doesnt appear to update, when I open it. can its time stamped? with yesterday?

winter rose
#

with what do you open it?

tough abyss
#

note pad or vscode

hallow mortar
#

RPT log files are a log of what the game is doing (or failing to do) when it's running, so they won't be generated when the game isn't running. So you can't generate logs without opening the game.
A new RPT file is created for every game session, starting when the game launches and ending when it's closed. During each session, that session's RPT file is updated with any new logs as they happen. If nothing happens (for example, sitting at the main menu) there's nothing to update the file with.
Depending on what you open the RPT file with, you may need to close and reopen it in order to see new changes. Notepad++ will automatically detect new changes and offer to refresh the open file; I don't know about other programs.

tough abyss
#

Thanks Nikko for the explanation kodos

astral tendon
#

is there a script command to order a AI to repair a vehicle?

hallow mortar
#

Unfortunately we don't seem to have script access to some of the order types that can be given from the commanding menu, so there's no all-in-one "move to and repair". However, you can do it yourself by having the AI move to the vehicle using one of the various movement commands, and then using action to make them do the repair on it once they get there.

scarlet quarry
#

Hello all! My friends have been stuck on this issue for days... hopefully this will draw some more attention to it.

Summary: Trying to get unlimited ammo and the same pylons to respawn on an aircraft.

https://forums.bohemia.net/forums/topic/280836-respawn-expressions-issues/

celest mural
#

Hey lads,

I've got an odd question, I am trying to get the unit ID of all units within a group. I am able to do this with some regular expression but for some reason when I run the operation script in a hosted server (not eden editor multiplayer), it comes out as bis_o2_749 (749 seems to change).

This is the array of units from the command units player;:
[bis_o2_749,B Alpha 1-2:2,B Alpha 1-2:3,B Alpha 1-2:4,B Alpha 1-2:5]

But when I run it on singleplayer or eden editor multiplayer, it is this:
[B Alpha 1-2:1 (Coolsurf6), B Alpha 1-2:2, B Alpha 1-2:3, B Alpha 1-2:4, B Alpha 1-2:5]

Does anyone know what might be happening? This is the code for it:

_array = units player;
_name = name player;
{
    _text = str _x; 
    _number = _text splitString ":";
    _number = _number select 1;
    _number = _number splitString " ";
    _number = _number select 0;
    
    if (_text find _name != -1) then {
        remoteExec systemChat format["PLAYER IS: %1", _number];
        _teleportOffset = parseNumber _number;
    };

    systemChat format["%2 Ran Script: Number: %1, Text: %3, Tele: %4", _number, _name, _text, _teleportOffset];
} forEach _array;```
#

I really want to make sure this runs properly and are very close to just making a failsafe to check if the user is named "bis[...]" and use that as a teleport offset.

warm hedge
#

Also, what exactly is the goal to have number? What is the teleport offset you want/mean?

grave hare
#

Is there a way to keep the targets from dying, but still functioning? I tried to disable damage but that keeps them from working

celest mural
# warm hedge https://community.bistudio.com/wiki/groupId This is the command, if that's what ...

This is exactly what I needed. I am creating a setpos function that will take the groupID of a unit that enters a trigger and teleport them. This will have an offset based on where they are in the unitID so that they don't get teleported on top of eachother.

Pretty much want them teleported onto a pointer I put in eden editor and have them go in a line formation based on the offset I set (player 1 will be first, 2nd will be behind them X amount of meters etc)

#

This groupID function basically rips anything regex related, I should have figured where Arma would get the number after the : in the first place.

#

I've never coded or made an operation in arma 3 before, but I wanted to use this as an excuse to learn a bit about SQF and it has been going somewhat well so far

warm hedge
#

If you don't want them to overrap into each other upon a teleport, I would say that is one unreliable way to do, because the member's ID can be skipped, if the one is killed

celest mural
#

I realise that this could mean that spots in this line will be empty, but I am on a bit of a deadline for this operation and I think the players would naturally fall fully in line.

The trigger I have planned will actually prevent death during the time and thanks to PF Advanced Revive from the DLC, during a players death, there is a few frames they are immune to damage that i can take advantage of to prevent death all together to stop this from happening.

#

I am quite well relying on this function to work and not have the player die, but there will be zeus available so I have a few backups. I did have a look and see there is a dedicated teleport command. Should I use that teleport command over setPos?

#

Although this does concern me

#

This is from VN_fnc_revive_handledamage, I believe it is apart of the prairie fire or western sahara dlc

#

those are the only two that will be enabled for this operation

warm hedge
#

VN does mean SOG

celest mural
#

Had a feeling it was that one, I really like the revive system from these modules alot. I don't think it would work well with ACE but thankfully we are not using that for this operation.

warm hedge
celest mural
#

I currently have this command setup to run on each client, I was worried about server race conditions if they were checking the value the server has saved might be grabbed twice if a player enters a trigger at the same time.

#

I am trying to get the script somewhat working just to teleport me and I can quickly share it, I might see if I can use the way you did it for the teleport as it might be more robust.

celest mural
#
_teleportOffset = 0;
_array = units player;
_name = name player;
_groupID = groupID player;

_number = floor _groupID;
_teleportOffset = (_number - 1);
_incrementValue = 1.2 * _teleportOffset; 

systemChat format["%2 Ran Script: Number: %1, Tele: %3, Offset: %4", _number, _name, _teleportOffset, _incrementValue];
_markerPos = getPos playerSlota;
_teleportLocation = [
    (_markerPos select 0),
    (_markerPos select 1) + _incrementValue,
    (_markerPos select 2)
];

player setPos _teleportLocation;

This is my currently working local script for player teleports based on Unit ID. I realise how easy this might be to get working server sided just because relying on clients to properly run this might have issues.

I am getting "theGroup" in your context from units player. I don't know how I'd get the specific group I want (this being alpha 1-2) to run in your forEach loop.

still forum
#

I tested it on getEntityInfo, which returns lots of bools
the 2 version is with my optimization applied

0.00036369 ms getEntityInfo objNull
0.00025543 ms getEntityInfo2 objNull

yay, big mucho bettero...
Tbh I didn't expect a 15 element array to be that fast

#

0.00041743 ms getEntityInfo player
0.00034901 ms getEntityInfo2 player

#

With that kinda speed, I don't see the sense in adding the second syntax ๐Ÿ˜„

#

0.00021268 ms player getEntityInfo 2

only 50% of the time, to get one value, instead of getting all 15

meager granite
still forum
#

The number of allocations goes down, so it would have on average the same effect on every bool

meager granite
#

So 2nd syntax still makes good sense

still forum
#

_x = [];
_x resize 2000;

_x apply {true}; 0.0547725 ms

_x apply {true2}; 0.0205002 ms

#

Arma Script Compiler would already do this optimization of merging all true/false's together. But it only does that in one file. So each file would still have one allocation.
But also it would do the allocation at script load time, not runtime.

So you kinda already have this optimization if you use bytecode

meager granite
#

So within single compile? Or compileScript + sqfc only?

still forum
#

compileScript + sqfc built by ArmaScriptCompiler, because it has the optimizer

meager granite
#

Can we expect to see this being optimized everywhere somehow? Sounds like noticeable performance improvement

still forum
#

Its just 6 ish lines of code to make this be everywhere

#

There is also a few other places that might make sense.
-1, or pi
Always the same value, but always allocates a new value to store it in.

But at that point the check for "is this -1" might be more expensive than what we save in the cases that it actually is -1.
And if we don't solve it via a check on every value, we have to solve it manually in every script command, which won't happen

winter rose
#

you could perhaps allocate all floats into RAM? ๐Ÿ˜‚

still forum
#

Well that would just be 16 gigabytes. So probably yeah

#

Also ran that same test on latest compiler in C++20 land
0.0179434 ms

Code:
_x = [];
_x resize 2000;
_x apply {true};

still forum
#

Fun fact, "nil" command is actually relatively expensive. Because it actually allocates a "Void" value.
Whereas other commands that return nil, generally return a empty value and thus don't need to allocate

#

Though I couldn't find a alternative nular command that also does nothing and returns nil ๐Ÿ˜„

#

inline assembly in x64 visual studio is not a thing.
Also that wouldn't make anything better, the optimizer already generates perfect assembly

#

no

#

A empty value would be nothing.
As I said it allocates a Void type value

#

No it has a pool allocator

#

Yes new, which then goes via a pool allocator. That doesn't matter though?

#

no?

#

So after that true/false optimization.
true is now faster than nil

true: 0.00012076
nil: 0.000125111

Ofc you could turn that around
true: 0.000120502
nil: 0.000118242
But I don't know what implications it might have to change the type of nil

#

via 64bit? wat?

#

I'm talking about the void datatype in the script engine... You don't know what you're talking about.

#

That is irrelevant for this

#

Because its a pool allocator, it allocates full pages at once

winter rose
#

4096*?

still forum
#

It can use huge pages, but it likely won't so 4096.
And also, that is irrelevant because it won't need to allocate new pages in this benchmark

#

What are you talking about?
It allocates pages. A page is always at the page boundary. And has no padding

#

We aren't

#

Well atleast I have never seen windows change the page size at runtime
And even then, there would still not be padding and we would still hit the boundaries of that new page size

#

Well yes, so what?

#

Then the next script file executes, and it needs more values and fills up the 3KB that were remaining

winter rose
#

well yes, that's a whole different paradigm ๐Ÿ˜„

still forum
#

Well yeah don't compare moddable sandbox game with system requirement of 8GB of ram to a little microchip with kilobytes of memory

#

What do you mean OOP features?

#

its all OOP.
Every instruction is a baseclass with virtual method, every script value is a inherited class with virtual method messes

#

I have no idea what "class controls" are, and if by "type generics" you mean templates, it does use them if appropriate.

#

Well that is used

#

I don't get what you are trying to say

#

You're not making sense to me

#

Factory Method, Composite
But why does that matter?

#

Future maintenance on a 25-ish old codebase of a game in its end of life phase?

#

SQF is not bytecode no.
And I have no idea, someone else wrote that SQF compiler 20 years ago

#

Arma*
The plans were implemented. Tested. Decided not to do it and all the code for it was disabled

#

Don't know

#

Every instruction is a class with virtual "execute" method.
The compiler parses the string stuff, and creates arrays of instructions.

The execution just calls Execute() in order

#

Yes

#

SimpleVM is actually that. And its like factor 10 faster

#

no

#

Enfusion doesn't use SQF

winter rose
#

(sadly)

still forum
#

SimpleVM is a new SQF bytecode translator/interpreter implemented a couple months ago

#

Its similiar to Enfusion's VM. both run on bytecode instructions

#

SimpleVM doesn't support variable scopes. And probably not going to add that.
So it cannot be used everywhere

#

Its basically like binarized config.
Its a intermediary representation. So that gets rid of all the preprocessing and string parsing.
It is essentially bytecode. But the engine can't execute it, it translates it back into the existing represenation of instructions

#

When SQFC is loaded, its translated into normal code representation. And that you would then run

#

When you compile SQF. Yes.

#

Just like .cpp/.bin
.cpp needs to be preprocessed and string parsed.
.bin is a binary representation thats much easier to load

#

Mostly loading.

The benefit of it being mostly compiled outside of the game, when mods are packed, is that you can take much more time.
So my SQFC compiler also has a optimizer in it that can improve runtime performance by optimizing the assembly

#

Arma 3*
yes, improves game start/load time

winter rose
still forum
#

its in profiling branch, and will be enabled by default on 2.18

#

yes

#

Arma 3*
The game is not Armed Assault

meager granite
#

Is there a command to return explosive charge timer?

winter rose
#

no, AFAIK

mellow cobalt
#

I have a question.
really would appreciate every help to get what is needed to solve my problem.

I have already found a script that I can insert into the init line of a SECRET FILE/DOCUMENT object.
So that it shows up in the "Intel added" tab when I press M/MAP.

I know how to insert text and an image there so that it can also be seen under the Intel Added tab in the Map Screen.

However, I would like that this file/Intel...firstly: that it add a task.
Secondly, it should still appear as an object in the inventory of the soldier who picked it up.
And can also be picked up again by others.

dusk shadow
#

Anybody know off the top of their head what the behaviour is in this situation? I could setup a test but I'm lazy ๐Ÿ˜›

// On server
beforeRespawn = _clientPlayerObject call BIS_fnc_netID;
// On server after client respawns
afterRespawn = _clientPlayerObject call BIS_fnc_netID;
// Result of beforeRespawn == afterRespawn?
granite sky
#

I don't know what BIS_fnc_netID does in the SP case, but they'll be different otherwise.

#

wait

little raptor
#

iirc it just uses an array and assigns unique IDs to whatever you call

granite sky
#

what's _clientPlayeObject?

dusk shadow
#

The question really is if the player is considered the same object after respawn

granite sky
#

It's not.

little raptor
granite sky
#

The old object is still hanging around as a corpse with the old netID. Unless you deleted it.

dusk shadow
#

Cool suspected as much, thx for the confirm lads

granite sky
#

The surprising part to me about respawning is that it seems to be done player-local.

#

Server just gets told about it afterwards.

dusk shadow
#

Well the player object is local to the client

granite sky
#

Not on creation it isn't.

#

Except for respawns, when it is :P

dusk shadow
#

the way I see it is before the client is ready to "take over" it's handled by the server, after the handover it's all the clients responsibility

#

which makes sense for such a client-central object

#

anyway...

#

Any ideas for a hashable value that remains the same on the server per player but resets after the player leaves/rejoins?

granite sky
#

leave as in disconnects, or returns to the lobby?

dusk shadow
#

I'm composing the key for a hashMap based on a string and the object

#

both

#

fun criteria huh? ๐Ÿ™‚

granite sky
#

I think you'd have to do that manually.

dusk shadow
#

Ugh, but that takes work! And it's friday...

granite sky
#

map getPlayerUID or getPlayerID to a value that's set on client state changes.

#

getPlayerID if you want it to work on a loopback server :P

mellow cobalt
#

i used this script that adds the "Intel added" thingy.
Friend allready solved the problem...get the intel added/Task Created/ File still in Inventory .... i dont know how but he did it.

data = [this,"RscAttributeDiaryRecord",["Title","Text",""]] call
bis_fnc_setServerVariable; this setvariable
["RscAttributeDiaryRecord_texture","picture.jpg"];

would like to know if there is a way to add a second picture to that file.

jagged terrace
#

hi, i'm an intermediate zeus and beginning to learn the sqf scripting environment and i want to make sure that im doing this correctly. i have a carrier with an interior stored several thousand meters above it and i want the player to be teleported into it upon interacting with an object. the script works as expected in testing, but i want to make it work in multiplayer. am i missing something with remoteexec? thanks!

#
[exterior_door, "Enter Carrier Interior", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "_this distance _target < 7", "_caller distance _target < 7", {}, {}, {player setPos (getPos interior_door); player setPosASL (getPosASL interior_door);}, {}, [], 5, 6, false, false] remoteExec ["BIS_fnc_holdActionAdd", 0, exterior_door];
#

similar issue, this script with a hold action also doesnt show up in multiplayer, i think im missing something

#
[laptop, "Connect to Network", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",

"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{
hint "Net Connection Established";
},
{},
[],
12,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, laptop];
hallow mortar
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
jagged terrace
#

oh fancy

hallow mortar
#
player setPos (getPos interior_door); player setPosASL (getPosASL interior_door);```
You don't need both of these, just use `setPosASL` and drop `setPos`
granite sky
#

Where are laptop and exterior_door defined?

jagged terrace
granite sky
#

And you say this isn't working in some MP situation?

jagged terrace
#

Correct, the others I'm testing this with say they don't see it, but it works for me just fine

granite sky
#

You're localhost and the code is running in initServer?

jagged terrace
#

Let me double check

#

Oh, forgot to mention, I'm making this for a Zeus repository for a group I'm with. Sorry, still getting familiar with everything

solid ocean
#

so im trying to make a booby trap type script where when a person enters a radius of this object an apers mine that is underneath it will explode

its not designed to kill its designed to maim and freak people out mainly

is there a way i can have it that the trigger sets the health to all apers mines to 0 by using its class name?

Something like

in thisList APERSMine setHealth 0; ?

#

i want there to be multiple of these so i cant use "this" or give it a named variable as i want to be able to place these down as compositions if possible

jagged terrace
solid ocean
#

so i tried again with a new code i get no errors when making the code but i do in game

#

but also no explosion

#
_this = nearestObjects [player, ["APERSMine"], 3]; 
_this  setDamage [1, false];  
winter rose
tough abyss
#

can someone point me to the best docs for interacting with an object that doesn't normally have options available. A laptop in the instances.

vital silo
grand idol
#

Is there a command to add an HMD to a player such as addGoggles or addHeadgear?

tulip ridge
tulip ridge
#

Only thing is that the object has to be local

grand idol
formal stirrup
#

It possible to format text inside of or use in BIS_fnc_typeText?

proven charm
#

I dont know the arguments BIS_fnc_typeText takes because wiki is down

formal stirrup
#

Yeah, if i do that though, it returns an error saying it got text and expected string

proven charm
#

whats your code?

formal stirrup
#
_cooldown = _unit getVariable "HD2_Eagle_cooldown_Timer";
[ 
 [   
  ["Eagle Supports on cooldown", "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '1' font='PuristaSemibold'>%1</t><br/>"],   
  ["Support Item returned to caller", "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '0.7'>%1</t><br/>"],   
  [formatText ["Cooldown: %1", _cooldown], "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '0.7'>%1</t>", 15]    
 ]   
] spawn BIS_fnc_typeText;

Cooldown is currently 360 for testing

proven charm
#

probably the problem is formatText if my assumption is correct that it turns string to text

formal stirrup
#

I've also tried

_cooldown = _unit getVariable "HD2_Eagle_cooldown_Timer";
_cooldownText = (str _cooldown);
_text = "Cooldown: " + _cooldownText;
[ 
 [   
  ["Eagle Supports on cooldown", "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '1' font='PuristaSemibold'>%1</t><br/>"],   
  ["Support Item returned to caller", "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '0.7'>%1</t><br/>"],   
  [_text, "<t valign='bottom' shadow = '1' color = '#FF9E00' size = '0.7'>%1</t>", 15]    
 ]   
] spawn BIS_fnc_typeText;
``` Which instead of giving an error just hides the last line
proven charm
#

try formatText -> format

formal stirrup
#

Yep that worked

#

Thanks

real tartan
#
B_soldier_AR_F
O_Soldier_AR_F
I_Soldier_AR_F

this inconsistency in BIS naming classes is killing me

winter rose
#

boi

real tartan
#
B_Pilot_F
O_Pilot_F
I_pilot_F

oh boy

meager granite
#

HandGreande / GrenadeHand

#

have fun remembering which is which

real tartan
#

don't let me start on czech names in config "hlavni vrtule", ...

meager granite
#

"Turtle_F" isKindOf "Man" => true

#

There is generic animal class, "Turtle_F" isKindOf "Animal" is also true

winter rose
meager granite
#

No idea, been a thing since A2

#

Probably A1 too, but I can't check

winter rose
#

Combat Assault iirc?

#

A1 & A2/OA had this prefix, changed to a3 for A3

meager granite
winter rose
#

that period wasโ€ฆ chaotic, to say the least

#

'member "campaign DLC"?

meager granite
#

Muh sandbox campaign

winter rose
#

A4: the next Arma Series chapter

#

here, you have it

meager granite
#

Nobody knows, but its the same engine and toolset so should be relatively easy

#

So far everything is getting thouroughly documented

#

it seems so, at least

plush summit
#

Hey guys, im trying to set a variable for an object, im using : _entity setVariable ["sean_alpha","sean_alpha",true]; but when using this it seems its not actually assigning the Variable, I might not be explaining it right..

dusk shadow
#
_entity setVariable ["sean_alpha","sean_alpha",true]; 

Just gives you a variable inside _entity called "sean_alpha" filled with "sean_alpha"

#

If you want it to actually vary changed the second parameter in the array to whatever your variable you are reading from.

warm hedge
#

And how do you try to get is another question

plush summit
#

Ill briefly explain what im trying to do

["sss_requestSubmitted",{
params ["_player","_entity","_data"];
if (_entity getVariable ["sss_callsign",""] != "ARTILLERY") exitWith {} ;
[player, selectRandom ["arty1","arty2","arty3"]] call CBA_fnc_globalSay;
}] call cba_fnc_addEventHandler;

This is the script im trying to create - its using Simplex Support and ive just been trying to get the variable name so it can be called for just that one module

#

so it plays audio for firing

warm hedge
#

Where is "sean_alpha"?

#

Also

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
plush summit
#

Ahh sorry about that

#

Im trying to use setVariable so that _entity would be considered the item im calling

#

Im pretty new so Im not sure im using the right things or wording

dusk shadow
#
_entity setVariable ["sss_callsign","ARTILLERY",true];
#

Now just make sure _entity actually contains the same entity you receive in the eventhandler

warm hedge
#
_entity setVariable ["yourVariable",0]; // <- this sets the variable and store into _entity
_entity getVariable "yourVariable" // and call the variable, and the name should be the same in order to get the certain value```
plush summit
#

Okay I kind of get it, ill give apply this and see how it goes

#

No fckn way, so I get it now, so basically _entity will be binded to "variable name" using setVariable, and to call that variable i'd use _entity and the name to call it, am I getting that right?

warm hedge
#

Basically

plush summit
#

I've spent actual 3 hours trying to look this up and you guys told me in less than 5 minutes I can't believe this, thank you guys so much

#

And just to confirm _entity can only hold one variable name at a time right?

dusk shadow
#

no

#

Conceptually you can think of it as _entity having a "data"-backpack and with setVariable you tie "yourVariable" and the value together and put it in the backpack

#

So when you pull on "yourVariable" with getVariable the value plops out

winter rose
plush summit
#

I see, however using your example mrCurry

_entity setVariable ["sss_callsign","ARTILLERY",true];

sss_callsign can only be used once? but _entity is the data base

warm hedge
#

No limit until you break your RAM, but yeah

dusk shadow
#

Well, "sss_callsign" can only contain 1 value, you can read/write any number of times

#

but ofc you can reference arrays and hashmaps and build it as complex as you want

plush summit
#

This is making so much more sense to me okay, thank you all very much for the information

winter rose
#

you can also store an array with multiple values in it ๐Ÿ˜‰

plush summit
#

I am once again asking for help ๐Ÿ™ tried to figure it out myself but can't seem to get this one to work now
sss_requestCompleted works for artillery but doesnt for Aircraft, Variable is working just the sss_requestCompleted, not sure what im doing wrong here. hopefully this isnt a mod related question sorry if so

["sss_requestCompleted",{
    params ["_player","_entity","_data"];
    if (_entity getVariable ["sss_callsign",""] != "Iceman") exitWith {};
    [player, selectRandom ["icemancomp1","icemancomp2","icemancomp3"]] call CBA_fnc_globalSay;
}] call cba_fnc_addEventHandler;
wicked sparrow
#

Is there a way to unlocazise something? So basically if I have the input "Large Avulsion" I want to get the raw text retured "STR_ACE_Medical_Damage_Avulsion_Large".

wicked sparrow
#

Tried that already, did not get it to work.

winter rose
nocturne bluff
#

q

fleet sand
#

Quick question is there a way to detect witch respawn player selected in respawn menu ?

crude egret
#

what happened? ๐Ÿ˜ฎ

#

the whole biki is down?

winter rose
crude egret
#

why i cant open the website (also a friend cant open it when i sent him the link)

#

ah nvm it works now

#

weird

winter rose
#

maybe a temporary cache issue; there was an update this morning

grand idol
#

How can I get an array of map markers close to a player's position? I' tried various versions of this including nearObjects

_nearbyMarkers = nearestObjects [player, ["Marker"], 1000];
winter rose
#
allMapMarkers select { player distance getMarkerPos _x < 1000 };
```I assume
grand idol
#

Sorry, I meant to specify a specific type such as:

    dataType="Marker";
    position[]={5898.396,74.980003,20191.879};
    name="NonCon_Abandoned_Village";
    markerType="ELLIPSE";
    type="ExileNonConstructionZone";

Wanting to find all "ExileNonConstructionZone"

fleet sand
terse rover
#

Hello I'm trying to disable the arty computer but when I put the scprit in eden edtior in the unit it works for me but not others and running it through with zeus doesn't change it

dusk shadow
#

@terse rover

enableEngineArtillery false;

should work if executed in the mission or unit init

#

@Anyone: Is there a way to check (in script) if

compile _some_string
``` throws an error due to incorrect syntax?
The result seems to be the compiled code no matter if the game throws a syntax error or not...
winter rose
dusk shadow
steady minnow
#

Does anyone know how to check if there is a notepad in the player's inventory, for example.?

granite sky
#

"yourItemClassname" in items player

crude egret
#

why does it happen ๐Ÿ˜ฆ

#

seems like the classes array part doesnt work, but i dont get why

granite sky
#

Probably scope issues, depending on how you're calling it.

#

If you call that global function from other code, it can't necessarily see the _unitClasses as it's locally defined outside the function.

drifting sky
#

I notice that "name" of a unit sometimes gets cleared when a player unit dies, but othertimes it doesn't. Anyone know why?

#

Is there a killed event handler that I can attach to a remote unit and have the event handler run on the server?

hallow mortar
#

MPKilled MP EH? It will also fire on clients, but a quick isServer check will take care of that

drifting sky
#

looks like entitykilled mission event handler was what I was looking for.

However, I'm still looking for an explanation for why "name" for dead player units is sometimes cleared and sometimes not cleared.

meager granite
drifting sky
#

concerning the value returned by the "name" command.

Some time after a player has died, the corpse's "name" is sometimes cleared to "". But other times, it's name remains the name of the player that conrolled it.

meager granite
#

Hmm, no idea, sounds like typical MP mess. Just tested and local corpse seems to retain the name properly. Likely happens with remote units.

#

Unless you do something else that triggers name update

drifting sky
#

so far it seems to be only the host player's name that gets cleared when the unit he was controlling dies

meager granite
#

Testing as player server, doesn't get cleared so far

#

Tried on remote player, name reverts to bot name as soon as player respawns

#

Oh no, not as soon

#

Randomly it seems

#

In other words name is unreliable after unit's death

#

Hell, it is unreliable while unit lives, I used to display icons over players with name and sometimes it ended up Error: No unit

#

Right now I keep last player owner on units and broadcast a hashmap with owner history and their names

grave hare
#

No matter what I do I cannot get this addAction to close the doors on this building. Right now I'm trying to use the edit door module synced to a trigger, and have the action set a variable to true to trigger the trigger

#

But nothing happens

#

in terms of the door anyways

grave hare
#

Well originally I used it to call an sqf, but I couldn't get the door to open via animateDoor

#

This is the code on the object sqf call{this addaction ["Reset Markers",{{ deleteVehicle _x; }foreach (player getvariable ["hitMarkers",[]])},0,0,true,true,"","_target distance _this < 3"]; resetdoor = true;}

#

oh wait

#

I put it outside the addAction

#

Doesn't work anyway though

#

Basically all I'm trying to do is make it so when you hit a button, it closes all the doors of the building in addition to another action

meager granite
#

I see nothing related to closing here

grave hare
#

That just has it set resetdoor to true in an effort to trigger the trigger object which has the door module synced to it

grave hare
# meager granite I see nothing related to closing here
_cqc = nearestBuilding khmark;
_door = 1;
for "_i" from 1 to 7 do
{
    _cqc animateDoor ["open_door_1", 0];
    _door = _door + 1;
};```This was the script I was trying to have it call originally, but again the animateDoor doesn't seem to do anything with this specific building
meager granite
#

animateDoor doesn't work but module does?

#

Try animateSource, I just did on some random A3 building and it works

#

cursorTarget animateSource ["Door_1_sound_source", 1]

#

Also you need to find door animation name from config, it might not be the same as vanilla buildings

grave hare
#

under animation source in cfg it has that name of open_door_1

#

and subsequent doors

#

Oh that worked

#

how would I call the script? I had it in the addAction but that deosn't seem to work

meager granite
#
call compile preprocessFileLineNumbers "somescript.sqf"
#

Or lazy scheduled

0 execVM "somescript.sqf"
#

Or better define your script in CfgFunctions or somewhere in the script and just do call myfunction

grave hare
#

I got it, thanks for the help @meager granite

vapid scarab
#

Sa Matra. When will you release koth for reforger?

magic sundial
#

Noob question, i've disable ai target for a dude in it's init, but when i walk into a trigger with enable ai target, it doesnt seem to work. How come this is happening?

warm hedge
#

Post your code

magic sundial
#

this disableAI "TARGET" for init and Soldier1 enableAI "TARGET"; for trigger

warm hedge
#

Are you sure:

  1. the trigger is working for sure
  2. the Soldier1 is the correct variable
magic sundial
#

i have a hint that says working when i activatre the trigger

#

and the hint works

#

so the trigger is defs activating

warm hedge
#

Any Mods you have? Especially AI Mods

magic sundial
#

yes, lambs

warm hedge
#

Try without

magic sundial
#

I had the ai disabled in the editor for lambs but ill try with it not enabled in the launcher

#

still doesnt work

warm hedge
#

What about any other Mods

magic sundial
#

nothing that affects ai

#

this has worked in the past with lambs enabled

#

idk why its not working now

warm hedge
#

Try vanilla

magic sundial
#

gotta quickly remake it

#

in vanilla the ai doesnt even disable

#

trying enableFeature

#

doesnt work either

warm hedge
#

That does mean your way to script is not correct

magic sundial
#

this is literally it

#

copied straight out of the wiki

warm hedge
#

What about disableAI "ALL"

little raptor
#

did you use checkAIFeature?

magic sundial
#

Yes i've used both

little raptor
#

you mean you did systemChat str (soldier1 checkAIFeature "Target") and it returned false?

magic sundial
#

disable Ai all works

#

i did the above method

little raptor
#

I'm saying checkAIFeature not setAIFeature

tender fossil
#

BIKI mentions about issues when using TARGET as the parameter value. Maybe it could explain something?

magic sundial
#

i havent used setAIFeatures, will give a go

#

didnt even think that was a command

#

like theres enableaifeature?

#

if thats what you're refering too

warm hedge
magic sundial
#

It returned false

warm hedge
#

Dev-Branch or Stable Branch of Arma 3?

little raptor
#
this spawn {sleep 1; _this disableAI "Target"};
magic sundial
#

false on system chat too

magic sundial
little raptor
little raptor
#

it's already disabled which means it was working anyway...

#

in your trigger code:

soldier1 enableAI "Target";
systemChat str (soldier1 checkAIFeature "Target")
magic sundial
#

so before trigger its false, on trigger its true

#

before trigger the ai is shooting anyway

#

and ai continue to shoots after trigger

#

Bug?

warm hedge
#

Maybe ๐Ÿค”

drifting sky
#

For playable units.... it seems that eventhandlers and variables are shared between the same unit but across respawns. I.e, when the unit respanws, it still has the same event handlers and variables attached to it that the corpse had. Am I understanding this correctly?

meager granite
#

Its for all units I think

#

Engine-driven respawn re-adds all event handlers and variables to new unit (old unit\corpse also retains them)

drifting sky
#

is it that the corpse retains them, or that the corpse is a copy of the unit, and the unit retains them?

#

Is it possible to have configurable keybinds for use with cusome functionality defined in displayAddEventHandler "KeyDown" event handler?

meager granite
#

When respawn happens, new entity gets same EHs and variables that previous entity has at the moment of respawn.

velvet merlin
#

whats the most efficient way to get the closest unit from an array of units to a target unit?

drifting sky
#

Does findDisplay 46 not work if you have more than one client running on the same machine?

meager granite
meager granite
#
private _distances = _units apply {_x distance _target};
private _closest = _units select (_distances find selectMin _distances);
```comes to mind, not sure if its faster than `sort`
#

I don't like sort for performance because you need to build nested arrays

#

GIB selectMinIndex

#

or findMin whatever name is better

velvet merlin
meager granite
#

Measure against

private _sort = _units apply {[_x distance _target, _x]}
_sort sort true;
private _closest = _sort select 0 select 1;
#

Bet sort would be worse ๐Ÿค”

velvet merlin
#

yep it is

cobalt path
#

I am curious, if I wanted to make a helicopter for example, have a force constantly applied to it forward (like how scifi mods, them their definitely not helicopter model aircraft have addaction to "fly" forward) how would I go about it? I mean am not sure which code to use. Do I teleport them forward all the time by very small margins, or is there other way?

meager granite
#

Depends on what you want

#

setVelocity each frame could also do what you want

#

addForce will constantly increase the velocity compared to static and instant setVelocity

cobalt path
meager granite
#

Multiply your addition by diag_deltaTime so its more stable at different FPS

#

Got recommended a video recently, very much related to this: https://www.youtube.com/watch?v=yGhfUcPjXuE

DeltaTime. This video is all about that mysterious variable that oh so many game developers seem to struggle with. How to use DeltaTime correclty? I got the answers and hope this video will help to deepen your understanding about how to make frame rate independent video games.

0:00 - Intro
0:34 - Creating The Illusion of Motion
1:11 - Simple Li...

โ–ถ Play video
mystic scarab
#

Hello, I'm trying to understand how to get information out of cfg and I'm trying to run the following, expecting to get a list of the names and their attributes. What am I doing wrong?

getArray (configfile >> "CfgWorlds" >> "Stratis" >> "Names")
mystic scarab
proven charm
#

ok well make sure "Stratis" is correct and it has the "Names"

#

your code looks fine its not that

mystic scarab
#

cfgviewer is giving me the following path: configfile >> "CfgWorlds" >> "Stratis" >> "Names"

proven charm
#

"names" seems to be a class, not array

mystic scarab
#

Oh, I see. How can I access the attributes inside it? I want to get settlement positions and I see they look like this: configfile >> "CfgWorlds" >> "Stratis" >> "Names" >> "Girna" >> "position"

proven charm
mystic scarab
#

How can I get the other attributes that aren't arrays?

proven charm
#
private  _names = configfile >> "CfgWorlds" >> "Stratis" >> "Names";
for "_i" from 0 to (count _names - 1) do
{
 private _nameCfg = _names select _i;
 systemchat format [">> %1", getArray (_nameCfg >> "position") ];
};```
mystic scarab
steady minnow
#
player addEventHandler ["Put", { 
    params ["_unit", "_container", "_item"]; 
 
    if (_item == "lopatka_inventar") then {........}];

How to change this handler to the opposite condition so that the script works not on the presence, but on the absence of an item in the inventory.this method does not produce results.

player addEventHandler ["Put", { 
    params ["_unit", "_container", "_item"]; 
 
    if (!(_item == "lopatka_inventar")) then {deleteVehicle ddddd} 
}];
sullen sigil
#

_item != "..."

steady minnow
sullen sigil
#

show full code

steady minnow
#
player addEventHandler ["take", {  
    params ["_unit", "_container", "_item"];  
  
    if (_item == "lopatka_inventar") then {_lopata_spina = "Lopata_building" createVehicle position player;   
   
_lopata_spina setVectorDirAndUp [[0.9,-0,-1], [0,8,1]];   
    
_lopata_spina attachTo [player, [0.05,-0.25,0.3], "pelvis",true];   
   
_lopata_spina setVectorDirAndUp [[0.9,-0,-1], [0,8,1]];   
    
_lopata_spina attachTo [player, [0.05,-0.25,0.3], "pelvis",true]; 


if (_item != "lopatka_inventar") then {deleteVehicle _lopata_spina }  
 
}}];
sullen sigil
#

what in the name of syntax

steady minnow
#

sqf

sullen sigil
#

use advanced developer tools mod by leopard

little raptor
#

how can an item both not match and match a string?! meowsweats

#

this is what you have:

if (_item == "lopatka_inventar") then {
  ...
  if (_item != "lopatka_inventar") then {
...
sullen sigil
#

you can also just use else

little raptor
#

but anyway, I think you want to do something that can't be done like that

#

you want to attach an item to the player when he picks up an item, and detach/remove it when he drops the item

#
player addEventHandler ["take", {  
    params ["_unit", "_container", "_item"];  
  
    if (_item == "lopatka_inventar") then {
      _lopata_spina = "Lopata_building" createVehicle position player;   
      _lopata_spina setVectorDirAndUp [[0.9,-0,-1], [0,8,1]];   
      _lopata_spina attachTo [_unit, [0.05,-0.25,0.3], "pelvis",true];   
      _unit setVariable ["_lopata_spina", _lopata_spina];
    };
}];
player addEventHandler ["Put", {  
    params ["_unit", "_container", "_item"];  
  
    if (_item == "lopatka_inventar") then {
      deleteVehicle (_unit getVariable ["_lopata_spina", objNull]);
    };
}];
steady minnow
tough abyss
#

createDialog vs BIS_fnc_displayMission?

hallow mortar
#

One creates dialogs and the other just returns a display ID

#

They're not really comparable because they don't do the same thing at all

tough abyss
#

having a lot of trouble trying to display a few things

sleek galleon
#

Hello there, I have once again a question that could be quite easy to solve, but I can't seem to wrap my head around it.

I've used AliasCartoon's intro scripts to make a nice intro for a scenario. https://steamcommunity.com/sharedfiles/filedetails/?id=660221885

As per the video that introduced it to me, it looked like it could be used in multiplayer, as the mission the guy made to showcase it had enough slots for a whole squad.

I've exported it once it looked fine to multiplayer and put the PBO in our dedicated server.
But, on the server, it doesn't work, for some reason we're stuck on a camera facing a seagulls's cloaqua ๐Ÿ˜‚

Any idea why that doesn't work ?

Sorry, i'm quite a rookie in using scripts

tough abyss
#

like what am I doing wrong. and the other thing, I have yet to get a variable to permently be displayed on screen and its been like 2 weeks

sleek galleon
hallow mortar
sleek galleon
hallow mortar
# tough abyss idc number?

Neither of them return or use IDCs.
IDCs are used to identify Controls. They are of data type Number, and a control's IDC, if it has one, is defined in its config. Commands that can use IDCs will have that mentioned in their syntax documentation. For example, displayCtrl can use an IDC to return the Control (actual data type Control) which has that IDC.
IDDs are the same but for Displays. createDialog does not use or return IDDs; it returns the Display it created directly (data type Display), not an IDD (Number). BIS_fnc_displayMission uses IDDs inside itself to get the current main Display, depending on whether we're in the Intro/Outro/Mission/Editor, and then returns that Display.

tough abyss
#

alright.... well what function do I need to return a display for a objective

hallow mortar
#

You possibly need the command findDisplay, but you might need to expand more on what exactly you want to do.

tough abyss
hallow mortar
tough abyss
#

holy shit. three opition for displaying something. this code is a nightmare.

hallow mortar
#

There are three options because they all behave differently, and those differences can be useful depending on what you're trying to do.

tough abyss
#

this is incorrect? Weapons_Levels = createHashMapFromArray [ ["B_Soldier_F", [ // Level 1 Weapons ["arifle_MX_F", "arifle_MX_Black_F", "arifle_MX_khk_F", "Binocular", "hgun_Pistol_01_F"], // Level 2 Weapons ["Binocular", "arifle_SPAR_01_snd_F", "arifle_SPAR_01_khk_F", "arifle_SPAR_01_blk_F", "arifle_MX_F", "arifle_MX_Black_F", "arifle_MX_khk_F"] ]], ["B_soldier_AR_F",[ ["arifle_MX_SW_F",] ]] ];

winter rose
#
Weapons_Levels = createHashMapFromArray [
    [
        "B_Soldier_F", [
            // Level 1 Weapons
            ["arifle_MX_F", "arifle_MX_Black_F", "arifle_MX_khk_F", "Binocular", "hgun_Pistol_01_F"],
            // Level 2 Weapons
            ["Binocular", "arifle_SPAR_01_snd_F", "arifle_SPAR_01_khk_F", "arifle_SPAR_01_blk_F", "arifle_MX_F", "arifle_MX_Black_F", "arifle_MX_khk_F"]
        ]
    ],
    [
        "B_soldier_AR_F", [
            ["arifle_MX_SW_F",] // the comma has nothing to do here
        ]
    ]
];
tough abyss
#

that crashes the code? damn

#

also global friendly AI disable isnt AIdisable = 1;?

winter rose
#

no, where did you see that

hallow mortar
tough abyss
#

so i am looking at the docs and see sqf findDisplay 46 createDisplay "RscCredits";, so i understand it as ```sqf
private _laptop = missionNamespace getVariable ["laptop2", objNull];
if (!isNull _laptop) then {
_laptop addAction ["Hack Laptop", {

    createDialog "HackingProgress";
    
    findDisplay 1001 createDisplay "HackingProgress"
}];

};```

#

wait i need to delete createDialog

hallow mortar
# tough abyss so i am looking at the docs and see ```sqf findDisplay 46 createDisplay "RscCred...

The left argument for createDisplay, which in the example is provided as findDisplay 46, is the parent display, within which the created display will exist.
Display 46 is the main mission display, and is the most commonly used display for in-game dialogs and stuff.
I don't know what Display 1001 is and I'm not sure if there is one in the base game. If there isn't, this will fail because it doesn't exist; if there is, it still might not work because it may be a specific display that only exists at certain times.

tough abyss
#

so how would I get that to disable all friendly AI

winter rose
tough abyss
#

globally for a mutliplayer server

hallow mortar
#
{
  [_x,"AUTOTARGET"] remoteExec ["disableAI"];
} forEach units west; // resistance, east, civilian

(note: doesn't handle units created later, that's more complicated)

winter rose
tough abyss
hallow mortar
#

description.ext disabledAI is different to disableAI, btw.
The description.ext parameter controls whether AI units are created for playable units that don't have a player. disableAI is for controlling AI behaviour features for existing AI units.

tough abyss
#

hum. you know. this project might be too complexe for me.

proven charm
#

what's best setting for disabledAI (Description.ext)? in CTI mission

winter rose
#

1 or 0, your call

proven charm
#

well i dont want AI to takeover any player slots

winter rose
#

then 1 to disable any AI thing

proven charm
#

ok thx

#

the wiki is bit confusing. "disabledAI" is disabled? ๐Ÿ˜„

winter rose
#

true, phrasing is weird - will change

#

fixed ๐Ÿป

wicked sparrow
#

does anyone know on how to easily make a foreach selection random for a Hashmap? I know hashmap are already random, but when it is set initially from there the values are always in the same order if you let it run through a forEach. I basically want a random key to be selected every time it runs but I still want it to run through every entry in hashmap. To make it more easy to understand:

hashmap: ["key1","value1, "key2","value2, "key3","value3]

In forEach it might grab it like this: [ "key2","value2, "key3","value3,"key1","value1] and next time you call it, it will be grabed the exact same way. I want to make that random so that there is always a diffrent key getting grab first from foreach and not alway key2 and then 3,1 in this example.

hallow mortar
#
private _shuffledKeys = keys _hashMap call BIS_fnc_arrayShuffle;
{
  private _value = _hashmap get _x;
  // ...
} forEach _shuffledKeys;```
jagged terrace
#

Hey guys, this is the completion section of a holdAction in a composition I'm working on. The hint fires as expected, but the texture change has an error saying it is an Array rather than a String, Bool, Object, or Group. I do know what an array is but I'm confused as to why that's how it's being recognized and how I can fix it. Thanks!

{
"Net Connection Established" remoteExec ["hint"];
[_this, [0,"a3\structures_f\items\electronics\data\electronics_screens_laptop_co.paa"]] remoteExec ["setObjectTexture", 0, _this];
},
warm hedge
#

Is the code happen in holdAction and its completion?

jagged terrace
#

Yes, it worked before I added the texture change just fine. Here's the full code:

[laptop, "Connect to Network", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",

"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{
"Net Connection Established" remoteExec ["hint"];
[_this, [0,"a3\structures_f\items\electronics\data\electronics_screens_laptop_co.paa"]] remoteExec ["setObjectTexture", 0, _this];
},
{},
[],
3, //set to 3 for debug 
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, this];

warm hedge
#
params ["_target", "_caller", "_actionId", "_arguments"];```Completed's `_this` does have this
hallow mortar
#

In action code parameters, _this never refers to the object the action is attached to. In some action condition parameters, it refers to the unit who completed the action; in other action code parameters, it contains an array of various information, including the object the action is attached to.
In all holdAction code parameters, the _this array is already parsed into a set of named variables you can use. The object the action is attached to is available as _target.

See: https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd, https://community.bistudio.com/wiki/addAction

jagged terrace
manic sigil
#

Guh.

I've got two units in a helicopter, one in the pilot seat (named Copilot in the script for reasons), and one in the crew cabin. They are separate groups.

This script is supposed to scoot the copilot back to his seat, while leaving the engine running.

For some reason, though, the passenger gets out.

copilot moveout Dragonfly; 
group copilot leaveVehicle Dragonfly;   
copilot moveinturret [Dragonfly,[0]]; 
Dragonfly engineon true;
#

I can work around it by just forcing them back in, but I wanna know why.

#

Replacing the leaveVehicle with unassign/assignasturret worked once, then stopped working T_T

drifting sky
#

Is it possible to get which grenade the player currently has selected?

magic sundial
#

Are there any sources to verify that something is a bug? And a way to report it?

magic sundial
#

This is referring back to the TARGET ai feature thatโ€™s not working as intended @warm hedge

drifting sky
#

Is it possible to tell if a player is ready to throw a grenade. I.e., they have reloaded the mag since the last throw?

hallow mortar
warm hedge
drifting sky
#

is there a straightforward way to draw a picture next to a "RscProgress" progress bar?

hallow mortar
#

Using an RscPictureKeepAspect, probably

meager granite
drifting sky
#

I can't quite figure out how to put an image into a control. Is it set through the control's text?

#

never mind, figured it out

jagged terrace
#

I am so sorry for all the dumb questions but I've been really having trouble creating an object with an interaction using objectsMapper. The return value of objectsGrabber has a spot for init code, so I tried throwing my code (just an interaction that teleports the player) in there to no avail. My current solution is to create a variable with the action code in it and then call that in the init code field, and the game loads without an error, but the interaction just doesn't show up. Is this just not possible? For reference, the use case is to create a bunker that, upon entry, teleports to a separate, fully-fleshed out interior, and spawning it using a script to avoid certain types of pain. Here's the relevant parts of the code:

bunkInteriorParams = 
{
[bunkInterior, "Exit Bunker", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "_this distance _target < 4", "_caller distance _target < 4", {}, {}, {player setPos (getPos bunkEntrance);}, {}, [], 5, 6, false, false] remoteExec ["BIS_fnc_holdActionAdd", 0, this];
}; 
 
bunkEntranceParams = 
{
[bunkEntrance, "Enter Bunker", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "_this distance _target < 7", "_caller distance _target < 7", {}, {}, {player setPos (getPos bunkInterior);}, {}, [], 3, 6, false, false] remoteExec ["BIS_fnc_holdActionAdd", 0, this]; 
}; 

["Land_Drainage_01_F",[-6.06445,0.371094,0.0391998],230.883,1,0,[21.8998,-7.76198],"bunkEntrance",bunkEntranceParams,true,false],    //this is the object I am trying to put an interaction on

 ["Land_Wreck_Heli_02_Wreck_04_F",[1.10547,9.94531,1.27695],90,1,0,[2.50431e-006,-89.327],"bunkInterior",bunkInteriorParams,true,false],   //this is the other object

I've tried a lot, but nothing seems to work. The current implementation gave me in error in the objectsMapper function itself.

#

Also, how can I change Object Specific properties that you can see in the editor using a script? Like how do I refer to them?

warm hedge
#

I don't know objectsMapper you mean, but are you sure those codes are called in that way? What if you try to call an obvious script, like hint does it work?

jagged terrace
#

Okay, I figured it out. I'm infurated. It was totally fine not throwing the commands into a variable, but because they have quotes in them they have to be surrounded by apostrophes.

warm hedge
#

Hmm, are you sure this is a Magic Variable you can use in that context?

#

Ah hmm yeah, it was just String vs Code?

jagged terrace
daring phoenix
#
_cfg = loadConfig "mission.sqm";
_addons = getArray(_cfg >> "addons");
_cfgPatches = configFile >> "cfgPatches";
_addons append configSourceAddonList(configFile >> "CfgWorlds" >> worldName);

_dep = _addons;
while {count _dep > 0} do
{
  _newDep = [];
  {
    _newDep insert [-1, getArray (_cfgPatches >> _x >> "requiredAddons"), true];
  } forEach _dep;
  _dep = _newDep - _addons;
  _addons append _dep;
};

_mods = _addons apply { configSourceMod (_cfgPatches >> _x) };
(_mods arrayIntersect _mods) - [""];

Hello, i have this code which in results gives me mods needed to load a different mission with different mods everytime but i have one problem. I can fetch only mods for mission and terrain itself, but not dependencies for the mods. I have been hardcoding deps for some time but it's getting spaggetti really fast so it would be nice if someone can help me with this script to upgrade it to append dependencies for those mods as well. Thanks in advance

meager granite
daring phoenix
naive needle
#

Hey guys,
I would like to get the datetime via the sunangle as input , this function right here gives you the sunangle via the time but I would like to invert it , does someone have a idea ?

private _latitude = -1 * getNumber (configFile/"CfgWorlds"/worldName/"latitude");
private _day = 360 * (dateToNumber date);
private _hour = (daytime/24) * 360;
private _sunAngle = ((12 * (cos _day) - 78) * (cos _latitude) * (cos _hour)) - (24 * (sin _latitude) * (cos _day));
parseNumber ((round _sunAngle) toFixed 0)
daring phoenix
#

i only need to get the deps of required mods so it's complete for simple mission usage. So far if for example i use 3CB, i add it's deps either manually or by integrating it hardcode (which gets me to this point now)

meager granite
daring phoenix
# meager granite Sorry, couldn't understand what you're doing.

following code, when used in Arma 3 Debugger (ctrl+D in Editor) results in this:

["@AS Main","@Jbad","@CUP Terrains - Core","expansion","@ace","@3CB Factions","enoch","curator","@CUP Vehicles","@Global Ops Terrains","@CBA_A3","@Enhanced Movement Rework","@The Free World Armoury","@Task Force Arrowhead Radio (BETA!!!)","@S & S","@RHSGREF","@S & S- New Wave","@RHSUSAF","mark","@Niakala","@RHSAFRF","@CUP Units","@Enhanced Movement","tank","@CUP Weapons","aow","heli","tacops","jets","orange","kart","argo"]

For a given mission, this is end result of code. It's only missing dependencies for some of mods itself. I am trying to expand this list of mods by those mods that are missing.

meager granite
#

Shouldn't requiredAddons cover mods dependencies?

#

Unless you mean you want requiredAddons of requiredAddons

daring phoenix
meager granite
# daring phoenix Exacly this, i want requredAddons of requiredAddons ๐Ÿ˜„
    private _addons = (getArray(loadConfig "mission.sqm" >> "addons") + configSourceAddonList(configFile >> "CfgWorlds" >> worldName)) apply {toLower _x};
    private _cfgPatches = configFile >> "cfgPatches";
    private _getDeps = {
        {
            if(_addons pushBackUnique toLower _x >= 0) then {
                _x call _getDeps;
            };
        } forEach getArray(_cfgPatches >> _x >> "requiredAddons");
    };
    {_x call _getDeps} forEach _addons;

    private _mods = _addons apply { configSourceMod (_cfgPatches >> _x) };
    (_mods arrayIntersect _mods) - [""];
#

try this, didn't test

daring phoenix
chrome hinge
#

Im not sure if this is right place to ask, but is there any way to remove the render distance limit that dictates how far ai can engage enemies?

naive needle
#

anyone has a idea ?

open hollow
naive needle
#

you are correct

granite sky
#

You know the sun angle, the day and latitude and you want the hour?

#

Or are you asking for something impossible?

naive needle
#

yea sun angle,day and latitude

granite sky
#

Yeah it's just maths then :P

naive needle
#

do you know the formula ?

open hollow
#

just revert it

#

x = y +1
y = x - 1

#

its se same, but some extra leters lo l

granite sky
#
_hour = acos ((_sunAngle + (24 * sin _latitude * cos _day)) / ((12 * cos _day - 78) * cos _latitude));
naive needle
#

I got this out _day = ((((_sunAngle + (24 * (sin _latitude) * (cos _day))) / ((cos _latitude) * (cos _hour))) + 78) / 12) * cos _day; but thats probably wrong lol

naive needle
little raptor
#

you have 2 unknowns and 1 eq

granite sky
#

Apparently he knows the day

naive needle
#

yea

open hollow
#
_cosday = cos _day; 
_cosLat = cos _latitude;
_sinLat = sin _latitude; 
_hour = acos (_sunAngle + (24 * _sinLat  * _cosday) /  (12 *_cosday - 78) * _cosLat);

ive landed near too, so probabl jhon is right

little raptor
# naive needle yea

then why do you write I got this out _day =?! meowsweats
you need the hour not the day ๐Ÿ˜…

granite sky
#

You need more brackets :P

open hollow
#

((((yes))))

little raptor
little raptor
naive needle
#

sunangle goes from -24 to 90 and yea it is about the position of the sun

#

actually I found a easy way with linearconversion I think

little raptor
#

weird I have something different in my textbook think_turtle

#

where n = day of the year (with n = 1 for January 1).

naive needle
little raptor
drifting sky
#

Does anybody know if there are any configs specific to throwable projectiles (such as hand grenades, flares, smoke), that can be used to easily identify if a projectile is one of these types?

little raptor
#

e.g. simulation

drifting sky
#

what about simulation?

little raptor
drifting sky
#

Looks like shotsmokex and shotgrenade are the simulation values for grenades and smoke throwables.

molten yacht
#

Hey, will the following in a gamelogic's Init be executed for JIP?

[]spawn { 
 while {true} do {
 call VFX_fnc_sparks;
 sleep 5;
   }; 
};
#

ideally this just makes sparks every 5 seconds.

little raptor
#

should, yes

molten yacht
#

And I should NOT remoteexec the sparks because it's already "local", right?

drifting sky
#

Totally new question. I'm using eyepos to draw icons using draw3d mission event handler. However when units move, the position returned by eyepos seems to stutter a lot. Anyone know why this is and how to get around it?

little raptor
#

eyePos is not a visual pos

#

you need a position in render (visual) time

#

you can for example do this:

_eyePos = _unit modelToWorldVisual (_unit selectionPosition ["eyeleft", 1e15]);
drifting sky
#

what does 1e15 represent exactly?

little raptor
#

memory lod

#

tho it seems like it's not defined there

#

well you can just hack it meowsweats

_unit modelToWorldVisual (_unit worldToModel ASLtoAGL eyePos _unit);
drifting sky
#

About the grenade thing again. Do you think it is faster to look up a config value for a projectile, or just to check if the magazine it came from is "in" one of several in an array?

little raptor
#

neither. use a hashmap

#

well config one should be faster but still neither is fast enough

drifting sky
#

using "mag in hashmap" the best way to check if it's in there?

little raptor
#

didn't you mean reading some value for some projectile? e.g. checking if a projectile is a grenade?

drifting sky
#

from the event handler, it gives [ammo] and mag, figured I'd just check if the mag was one of several types.

little raptor
#

generally speaking, you should check the ammo.
but if all you're checking is if some projectile is a grenade/smoke, I guess using config is better than hashmap because I don't think it justifies the memory consumption

_sim = getText (configOf _ammo >> "simulation");
_sim == "shotGrenade"

vs

_mag in _grenades // or _ammo in _grenades, depending which one you prefer
#

the difference should be less than 0.001 ms

drifting sky
#

but checking the hash should be faster than checking an array, correct?

little raptor
drifting sky
#

I'm looking for the best way to attach an event handler to all playable units, on each client. Suggestions?

drifting sky
# winter rose `initPlayerLocal.sqf`*?

isn't initPlayerLocal.sqf executed only on the client that is connecting?

Actually let me restate my problem. I want to use unitSetAnimSpeedCoef, which only has local effect, but I need it to be global, so that any player sees all players animated at the same speed.

Also, I guess I should ask if changing animation speed is known to break any other aspects of the game, such as whether certain actions (such as healing) will still perform correctly.

hallow mortar
#

In initPlayerLocal.sqf:

waitUntil {!isNull player};
[player,_coef] remoteExec ["setAnimSpeedCoef",0,true];
// if necessary, add a Respawn EH that does the same thing for the new unit```
drifting sky
#

speaking of event handlers, on a player unit (where AI is disabled), if the player leaves the server and then reconnects and takes control of the same unit, or another player connects and takes control of that unit.... then (on other machines on the network), does the unit still have the same event handlers it had before the original player left?

winter rose
drifting sky
#

Do you guys know if changing the animation speed is known to break anything important in the game?

winter rose
#

so far, nothing
beware of too much speed though, ofc ๐Ÿ˜„

drifting sky
#

i was only going to increase by 15%

#

Are all mission and display event handlers removed when a player disconnects from a mission, or when the mission ends or restarts?

surreal valve
#

Hey guys is there any script to reduce turret rotation speed, i want to slow down turrets from ww2 vehicles because they are very unrealistic, some of them are but others are not

hallow mortar
drifting sky
#

is there a command to get the current magnification or fov of the camera?

warm hedge
#

No

drifting sky
#

is there a way to draw an icon using draw3D, in such a way that, the bottom of the icon is visually aligned with a position in the 3d world.

drifting sky
#

Is there a command to return if a unit (in this case the player) is currently spriting?

little raptor
#

no. you have to check the animation state

#

or animation state action

drifting sky
#

Is there a way to force the player unit to throw a grenade WHILE they are moving? These two cause the player to throw a grenade, but only if they are NOT moving. [player, _currentThrowable select 1] call BIS_fnc_fire; player forceWeaponFire [(_currentThrowable select 1), (_currentThrowable select 1)];

This doesn't seem to have any effect on the player:

```player fire (_currentThrowable select 1);````

little raptor
#
_state = animationState _unit;
_action = getText(configFile >> "CfgMovesMaleSdr" >> "states" >> _state >> "actions");
_cfg = configFile >> "CfgMovesMaleSdr" >> "actions" >> _action;
_state in [
  toLowerANSI getText(_cfg >> "FastF"),
  toLowerANSI getText(_cfg >> "FastFR"),
  toLowerANSI getText(_cfg >> "FastFL")
]
drifting sky
#

Is there any way through scripting to sort the order in which gear appears in an arsenal box?

steady minnow
#

Please tell me the command using the eventhandler "AnimChanged" so that the shovel becomes invisible behind your back.A shovel is a variable _lopata_spina.Previous codes :

player addEventHandler ["take", {  
    params ["_unit", "_container", "_item"];  
  
    if (_item == "lopatka_inventar") then {
      _lopata_spina = "Lopata_building" createVehicle position player;   
      _lopata_spina setVectorDirAndUp [[0.9,-0,-1], [0,8,1]];   
      _lopata_spina attachTo [_unit, [0.05,-0.25,0.3], "pelvis",true];   
      _unit setVariable ["_lopata_spina", _lopata_spina];
    };
}];
player addEventHandler ["Put", {  
    params ["_unit", "_container", "_item"];  
  
    if (_item == "lopatka_inventar") then {
      deleteVehicle (_unit getVariable ["_lopata_spina", objNull]);
    };
}];```
drifting sky
#

any way to tell if a unit either AI or player is talking (either using game's built in sounds, or VON)?

meager granite
#

getPlayerChannel for VON

#

As for AI, maybe HandleChatMessage?

#

Still a crutch

drifting sky
#

In the case of the direct channel for getplayerchannel, does it rightfully only detect the channel if the listening client is in range of the talker?

meager granite
#

so range, side, group, etc. whatever channel requires

#

So overcome that you can have each client script-broadcast their talking state yourself

#
if(getPlayerChannel player != oldchannel) then {
    oldchannel = getPlayerChannel player;
    player setVariable ["my_channel", oldchannel, true];
};
#

something like this

drifting sky
#

Wiki says it only detects the channel if the speaker is making a sound, but that doesn't seem to be the case. Or else it isn't the case when push-to-talk is used.

drifting sky
#

Is there a way to allow custom keybindings for scripted events in a mission?

grizzled cliff
#

yawns

fallow coyote
#

When using the unitCapture command, it works fine, but I somehow can't copy anything to the clipboard when it prompts me to copy the movement data by pressing F1 or F2, my clipboard stays empty

warm hedge
#

Just in case do you do in MP?

fallow coyote
#

No, Eden.

warm hedge
#

Are you sure no software else is using clipboard?

#

Well hard to tell though

#

What about Windows + V?

fallow coyote
#

Clipboard is empty

nocturne bluff
#

qq

agile flower
#

Quick, and daft one, as usual

#

I am in group with callsign "Raven 1-1"

_unit = group player;
hint fo0mat ["%1",_unit];

returns "B Raven 1-1"
Why is this?

proven charm
#

it just is , B for Blufor

willow hound
#
group player //"B Raven 1-1"
groupId group player //"Raven 1-1"
#

The engine programmers probably wanted to include the side of the group in Group::toString because multiple groups can have the same ID as long as these groups belong to different sides.

meager granite
#

Was trying to read ammo counts off memory with extension, good things cheaters already figured it and explained obfuscation that BIS did for it

lone glade
#

AKA no file patching and extension whitelisting ?

meager granite
#

Well I guess I'll have to ask for extension to get whitelisted

junior moat
#

hey, anyone know why this wont work?

this addAction ["Teleport To: Garages", {_caller setPos getPosATL garages}];
#

it works when i replace _caller with the variable name for the player, but i want to make it multiplayer compatible and according to the wiki page for addAction, i should just need to add _caller to the varible to set the position of, but this doesnt seem to work

meager granite
#

2015 >still no scripting command to get and set ammo counts for magazines

willow hound
#

You just need to use params first:

this addAction ["Teleport To: Garages", {
  params ["_target", "_caller", "_actionId", "_arguments"];
  _caller setPosASL getPosASL garages;
}];
lone glade
#

Engine limitation

meager granite
#

No its "BIS designers didn't need it yet" limitation

lusty prism
#

Note that if you want to include extra parameters, you can to use the 3rd argument of addAction (I'm thinking about the variable garages)

this addAction ["Teleport To: Garages", {
    params ["_target", "_caller", "_actionId", "_arguments"];
    private _garages = _arguments select 0;
    _caller setPosASL getPosASL _garages;
  },
  [ garages ]
];
#

I'm reading the docs about seats in vehicles and I see many FFV turrets, FFV cargo. What the heck is FFV?

winter rose
#

Firing From Vehicle

lusty prism
#

that's when you can shoot from a car window for an accuracy experience near zero?

#

thanks @winter rose

tough abyss
#

Sa-Matra, BE will auto whitelist extensions. Or you can send BE an email with filename for extension (you need client to block it beforehand)

Important you will need to code your SQF to work without the extension
BattlEye will block whitelist extensions (appears to be random, i swear the code is buggy), but its prob happens when BE is getting DDOS.

jade acorn
#

I have a certain compound full of agents that is supposed to be seen by player and as soon as he detects it, a code will fire. I thought of placing a 200cm helper sphere slightly above it and use checkVisibility, but no matter what I try, no matter what distance, it will return 0.09[...], or 0.11[...] if close enough but never higher than 0.12, so I think it isn't very reliable. I do not see a knowsAbout variant that would work with a group or a dozen of spawned agents, so idk what to do now

#

yeah no idea how one can reach 1 visibility unless wiki is wrong

winter rose
#

wiki is never wrong

#

||except when it is||

meager granite
#

Thanks for details. I'll use extension on server side only probably so it should be less of an issue.

little raptor
little raptor
#

e.g.:

_knownAgents = myAgents arrayIntersect (player targets [true]);
_knownAgents findIf {time - (player targetKnowledge _x select 2) < 1} >= 0
sullen marsh
#

Technology just isn't there yet to set ammo counts

candid sun
#

"read ammo counts off memory with extension" ffs BIS it's 2015

#

i've only ever used addMagazineAmmoCargo with crates, can you not set it for player inventories?

manic kettle
#

If i want to use an Entity killed event handler to do something when civilian death occurs, do you all think its more performance light to use a mission event handler "EntityKilled" and simply filter for civs or use a server-local "killed" event handler that is added to each civ when it spawns?

#

Wondering if its negliable but curious

meager granite
#

What do you mean by server-local Killed?

manic kettle
#

True, i actually recall reading that even snakes get counted for entity killed

meager granite
#

Wish we had global entity events to be honest, had a need for them many times already

#

Global Killed, Server Local, etc.

#

If your civilian check if very simple, it shouldn't be that big of a deal

#

Otherwise you can try using MPKilled and do isServer or local check there

#

but you'll need to reliably add it to entities that you care about

#

You can also cache expensive checks into hashmaps

lone glade
#

BE blocking whitelisted extensions is when the servers are down or under heavy load.

#

which also happen to be ridiculously often.

nocturne bluff
#

Realize BE is useless :D

hallow mortar
#

I do wish we had some pre-filtered alternatives for EntityCreated/Killed, so we didn't have to spend SQF commands on doing basic type checks. Like UnitCreated, VehicleCreated.

meager granite
#

Sometimes I wish entities were treated like class names for hashmaps

#

but then again somebody else will expect it to be entity instance hash

pliant stream
#

i guess using the arma server to relay the data would be too advanced

meager granite
#

when HASHMAP isNil STRING will be a thing it could be turned into

if(server_ehs_onEntityCreatedIgnore isNil typeOf _this) then {
#

maybe isNil is slightly faster than in and there is no ! anymore

#

Muh microseconds

lone glade
#

Which is already done, for the ID check at least.

pliant stream
#

k. also why not just allow servers to whitelist dlls :rolleyes:

lone glade
#

Because it would make sense, did you think before proposing the idea ? cmon

jade acorn
topaz lion
#

Would love a bit of help, unsure if there's a non scripted option, guessing not but I'm looking for a way to disable certain seats in the TF-373 MH-47, specifically the loadmaster and hoist operator seats

meager granite
#

You'll need to find turret path for it though

#

Might be [1] and [2] from the look of it

#
this lockTurret [[1], true];
this lockTurret [[2], true];
topaz lion
#

It was [1] and [3] but otherwise works perfectly thank you

grizzled cliff
#

boop

proven charm
#

is it possible to have group icon in player map where the group is friendly but not with enemy groups?

cosmic lichen
#

Only create the markers on the side that should see them.

kindred zephyr
#

when getting config entries, what's the property one has to look for to actually get the classname string itself?
Is it macro?

I need to separate some classnames according to a prefix criteria.

kindred zephyr
#

I was under the impression this was not what I would get from that command

#

LOL, thanks

proven charm
cosmic lichen
#

That system is local iirc so the same applies

proven charm
#

i'm not 100% sure but i think something is adding default group icons

modern ivy
#

So I'm looking for a script to jam ACRE radios for players once they get within a certain range of the object set as the Jammer and the jamming stops once they exit that range or the object the jammer is added to is destroyed or deleted.

Does someone know is this script exists somewhere? / Has it laying around?

valid lily
#

Total noob at scripting here. Im trying to have a marker that shows up when activated by trigger and i got it working by having "triggerActivated trigger_1" as the condition but how can i add more triggers that activate this condition?

hallow mortar
#

More triggers, all of which are required to activate the marker trigger:

triggerActivated trigger_1 && triggerActivated trigger_2 && ...```
More triggers, any of which can activate the marker trigger alone:
```sqf
triggerActivated trigger_1 or triggerActivated trigger_2 or ...```
(you can also do some stuff with `count` and/or `findIf` to make it more compact if you have a lot of triggers)
drowsy geyser
#

is there a way i can detect if mouse wheel was pressed?

junior moat
#

hey is it possible to have a static turret be able to be operated normally but also make it so it is completely static, e.g, if a vehicle were to hit it, it would stay still instead of falling over

hallow mortar
#

You could attach it to something

junior moat
hallow mortar
#

Technically yes, but it's a hassle, and the simulation rate of buildings is pretty slow so it would have unpleasant effects

#

attachTo doesn't require proximity in any way - it's not like glue, it's just magic. So just have a dummy invisible vehicle somewhere

junior moat
drowsy geyser
junior moat
#

@hallow mortar sorry for the extra ping but ive attached the turrets to a civvy quad bike in some other corner of the map and when in game, the turrets all turn towards a random location. is there any way to preserve the rotation?

hallow mortar
#

If you used BIS_fnc_attachToRelative, rotation should be preserved and if it's not then ๐Ÿค”
If you used plain attachTo, you can setDir or setVectorDir after attaching, but the direction is now relative to the parent object so it'll need a little maths to figure out the correct direction.

junior moat
proven charm
turbid marsh
drifting sky
#

There's no problem inherent with using stacked user interface "keyup" or "keydown" event handlers, is there?

#

also, user interface and mission event handlers can safely be added during a pre-init function, correct?

iron scaffold
#

How would I reference an action created by a mod? For context, I'm trying to create a script that records the names of heli passengers deploying cargo ropes. So far I have this for the event handler

player addEventHandler ["ASL_Deploy_Ropes_Action", {
    params ["_vehicle", "_player"];
    _pilot = currentPilot _vehicle;
    if (isPlayer _player) && (currentPilot _vehicle != _player) then {[_player, _pilot] execVM "deployedRopes.sqf"};
}];
little raptor
little raptor
drifting sky
#

which problems regarding mission EV are there?

little raptor
#

I mean user interface has problems, not mission

#

and it's obvious why. during pre init UI probably is not intiailized yet

warm hedge
iron scaffold
#

Reference an action created by the Advanced Sling Loading mod

warm hedge
#

Reference as in?

iron scaffold
#

Use the actionName of this specific action

#

In the mod's code, that action is called "ASL_Deploy_Ropes_Action", I'm trying to figure out how I can create an event handler to detect when someone triggers that action

warm hedge
#

Well if that is the goal using addEventHandler is still wrong and not going to work

#

I don't know that Mod or how it works so can't say if you can anyhow

tough abyss
#

is there a script to put a handheld weapon on a tripod?

wispy venture
#

Hi everyone, i'm looking for a dedicated, experienced and motivated arma-scripter for a longterm thing.
Feel free to message me in private for more information.

fair drum
agile pumice
#

I'm having a bit of difficulty with an eventhandler =/ its just not calling the function I want it to

#

not hinting, which leaves me to believe its not being called

indigo snow
#

Yea its because you call that local function

agile pumice
#

cant call a local function in an eventhandler?

indigo snow
#

afaik not

agile pumice
#

okay, well I made it global and still no hint

#

no error either

mystic scarab
#

Is there any way to execute a script locally when a player disconnects? I'm using profile namespaces to save items for each player for simplicity and would like to save their state also when they disconnect.

warm hedge
#

Locally here mean the player who is about to disconnect will do?

meager granite
#

Keep in mind player's game might crash

#

Might as well make it work for worst case scenario

warm hedge
meager granite
#

Get player unit items from there

warm hedge
#

And remoteExec, profileNamespace?

meager granite
#

Oh I thought he was saving player items into server's profile namespace ๐Ÿค”

#

If it is client's profile namespace then you might as well check when player clicks leave to the lobby confirmation button

#

Not sure how Ended works, maybe it could fit here

indigo snow
#

Then start diag_log-ing all the things :D

agile pumice
#

yeah, nothin

#

tried execVm with the code in a separate file, same result :(

tender fossil
#

How would I change this to run the WFBE_CL_FNC_OnKilled only when a player themselves dies? Now it executes every time any player dies or respawns

//--- Re-add the KEH to the client.
WFBE_PLAYERKEH = player addMPEventHandler ['MPKilled', {[_this select 0,_this select 1] Spawn WFBE_CL_FNC_OnKilled; [_this select 0,_this select 1, sideID] Spawn WFBE_CO_FNC_OnUnitKilled}];
#

(Note: Arma 2: OA)

meager granite
#

Why do you need MPKilled here?

#

Can player leave the game and become bot and change locality somehow?

tender fossil
meager granite
tender fossil
#

Hmm

meager granite
#

What this EH does it makes every client and server execute this code once this unit died (player at the time of EH addition)

#

Where do you want this code to run in the end?

tender fossil
meager granite
#

Only player's own player unit?

tender fossil
#

Yeah

meager granite
#

Then Killed is what you want

#

It will execute as long as that player unit is local when it dies

tender fossil
#

Alright, I'll try it out

modern ivy
#

Hey, guys. So I am currently aware, that if you put a soundfile in your mission folder and add a couple lines of code into the description.ext, that you can then add a this say3D ["SoundileABC",20,1]; in the 3den Editor and it plays the file locally as if I had put down a playsound module in the zeus interface.

My question now is, if it is possible to somehow execute the this say3D ["SoundileABC",20,1]; in the zeus menu without having to prepare everythigng in advance in 3den. (Because just pasting the command in the innit didn't work for me)

I know, that apparently it's possible to also just do it via making a mod and adding the soundfile to the playound option in zeus, but I'm feeling like it should be easier to just execute the say3D command on some object to achieve the same result without having to create a new mod.

tender fossil
meager granite
#

or local(_this select 0)

agile pumice
#

Okay, I fixed it haha

#

my object was never defined properly

indigo snow
#

Better that than discovering you were editing the wrong file :)

cyan dust
#

Hi. Is there a way to make AI pilot fly exactly at object?

#

Like kamikaze

granite sky
#

Well, not really the AI pilot.

cyan dust
#

No problem to dummify the pilots... but vector math meowsweats

kindred zephyr
#

you could also record the fligth path, althrough Idk if it get interrupted by dying/crashing?

wind hedge
#

Guys, I am having an issue of Ai units (not on player's group) running out of ammo, moving near vehicles/container and getting stuck in a "take" action loop indefinitely. They will continuously try to resupply? (every 4 seconds or so) from said container until fired upon but will never break out of the loop on their own without a player's intervention. I am pretty sure it must be a "known issue" by now because I've seen such behavior for ages.

#

I guess my question is if anyone has dealt with the issue somehow or if there is a ticket for it

winter rose
#

Q: vanilla?

wind hedge
wind hedge
#

Here is an ai stuck on said animation on his team mate's body 5 minutes into the match

#

They do the same on vehicles and as time goes own I've seen whole groups stuck trying to "pick up" things

hallow mortar
#

I don't think I've ever seen this happen tbh

granite sky
#

Vanilla? No mods or mission script?

split oxide
#

Looks like something about agents logging in systemchat, so maybe some custom FSMs

modern ivy
#

Well... New question:

So you know how you can see friendly units on the Ctab in game. I'm currently in a mission using bluefor vehicles but putting opfor guys in there. These vehicles now show up on the players CTabs even though they are enemy. If anyone knows if it's possible to disable specific vehicles or units from showing up on the CTab that would be a great help! Thanks

#

It would by the way also be fine if the CTab would not show any friendly units at all ^^ - If that helps make the solution easier

wind hedge
winter rose
#

but the scripts have nothing regarding that
famous last words ๐Ÿ˜„

#

but yes please, check & if possible provide repro :)

upbeat valve
#

{
_opforUnits = {getNumber (configOf _x >> "side") == 0 and _x inArea PROBLEM} count allUnits;
_indepUnits = {getNumber (configOf _x >> "side") == 2 and _x inArea PROBLEM} count allUnits;
if {(_opforUnits*6)<_indepUnits}then{_x setMarkerColor "ColorGUER"}
}forEach _areaMarkers;

I have code to turn markers for areas green when there's a lot of indfor forces in them, and i want to apply the code to multiple markers at once: but the problem (written where PROBLEM is) is i cant do _x twice because i cant specify that those _x's belong to the forEach since they're behind the counts

shut carbon
upbeat valve
#

Oh I should have seen that, thanks

shut carbon
#

๐Ÿ™‚ ๐Ÿ‘

wind hedge
#

I think if found a bug with the targets command

#

create a unit on side EAST

#

make it side ENEMY with setRating

#

stand in front of the said unit at the start of the match:

#
player in (cursorTarget targets [false, 200])
#

Returns "TRUE"

#

The if I move around and wait for a while, return to the same pos and do the same command it now returns FALSE

#

I have to increase the 200 to 874 for it to return TRUE... yet I am standing in front of the unit

#

Could that be that there is an issue at how targets measure distance the longer the match goes on? It no longer updates at some point?

#

No matter how far or how close I get to the unit, any value below 873 will return false... even if I am standing 5 meters in front of it...

agile pumice
#

indeed

#

That was the last time's reason for asking for help lmao

leaden ibex
# upbeat valve ```sqf { _opforUnits = {getNumber (configOf _x >> "side") == 0 and _x inArea PR...

Just something, you can easily check the side of a unit by using the side keyword.
Also this is how I do exactly that. (Edited a bit as I also have vertical height check in there)

{
  private _marker = _x;
  private _east = { alive _x && side _x == east && _x inArea _marker} count allUnits;
  private _res = { alive _x && side _x == resistance && _x inArea _marker} count allUnits;

  if ((_east * 6) < _res ) then {
    _x setMarkerColor "ColorGUER";
  };
} forEach _areaMarkers;

independent = resistance

fleet sand
#

Hey guys i have a quick question is there any reason to do this in a code ?

[var1,var2,var3] spawn {
    [_this] call {
        (_this select 0) params ["_var1","_var2","_var3"];
        
        //rest of the code.... 
    };
};

Is it just me or does this call seam unnecessary ?

proven charm
#

i dont see point with the "call"

fleet sand
#

right i mean if you call from scheduled environment. its still sceduled enviormente and at that point spawn is the same as call so why do it 2 times ?

cyan snow
#

Hey guys, do you know if there is anyway to enter zeus using the debug only - on a multiplayer server?

proven charm
#

you cant get out of scheduled with call

covert solstice
#

I have a question regarding the command menus for SLs more exactly the target menu. Is there a way to remove/block it without a loop?

hallow mortar
#

There's no particular reason to do call as you've shown it, with the called code fully typed out exactly where it's called. You're not getting anything from call that you couldn't have got by just...doing the code normally. However, for calling functions and otherwise pre-composed code, call is very useful, even in scheduled.

formal stirrup
#

It possible to make this code return an object instead of a string?
_spawnPos = "respawn_west"+(selectRandom ["1","2","3","4","5","6","7","8","9","10","11","12","13"]);

fleet sand
hallow mortar
#

That syntax of getVariable requires you to specify a default value, and it's pretty much for the purpose of avoiding needing that isNil check.

private _var = missionNamespace getVariable [_spawnPos,objNull];```
Note that if you're trying to work with markers, those _aren't_ objects, and they have their own commands for working with them, which use strings as references.
formal stirrup
thorny gull
#

So I am using a slightly modified script from a youtube video to do a paradrop, that your supposed to put in the activation of a move waypoint, It worked a week ago but now it has stopped working, could anyone help me determine what the problem is?

hercD sideChat "GREEN LIGHT, GO, GO, GO!";  
 null = [] spawn {   
{   
  if(((assignedVehicleRole _x)select 0) =="Cargo") then {       
 [_x] ordergetin false;   
 [_x] allowGetIn false;   
 unassignvehicle _x;   
 moveout _x; 
   sleep 0.3;   
};   
} forEach(crew herc);   
}; 

this is all the code in the waypoint, originally by OnlineCombatBN

#

the modifications whre removing the remove backpack and add parachute lines from the original script, this is because I want it to eject the players with their existing backpack (as the players will already have parachutes)

grizzled vapor
hallow mortar
# thorny gull So I am using a slightly modified script from a youtube video to do a paradrop, ...

You don't need the null = any more. That's not breaking it, it's just something that used to be needed but can now be removed.
If your server or client is using the Profiling branch of Arma 3, make sure it's up to date with the very latest version released yesterday. The previous version had a bug where the crew command would not work properly.
If Profiling branch is not involved, look for recent updates to any mods you're using; the stable version of the game hasn't been updated in the last week, so anything that worked before should still work.

grizzled vapor
#

(would just need to get canFloat for vehicles)

wind hedge
finite bone
#

I have a position coordinate where I want a plane to fly to (facing the given direction). However, I want to spawn that plane about ~2000m away from that position. How would I go on about it? (Its more aligned with Ambient Flyby).

Basically, I want to spawn couple of planes abount 2000m away from the position I give, facing the direction I give and despawn - all scripted.

I can use BIS_fnc_ambientFlyby but I'm having trouble figuring out the startPos and endPos with the 2k distance in mind.

#

If its a normal North/East/South/West direction, you can do [[x - 2000],0,0] but for more advanced angle of approach, how would you code this

still forum
grizzled vapor
#

ok thanks

willow hound
finite bone
granite sky
#

Syntax 3 of getPos can do it for you, but yeah.

royal bramble
#

Could a 147 KB missionNamespace variable cause problems in a multiplayer environment?

hallow mortar
#

If it's operating locally then it shouldn't be a big deal, but you'll definitely want to avoid sending it over the network too often

cobalt path
#

probably dumb question, got an error "error setposatl, type array expected object"

[]spawn {
sleep 5;
jposition = getPosATL jumpdes1;
jposition set [2, 1000];
_this setPosATL jposition;
sleep 0.1;
playSound3D ["A3\Sounds_F\ambient\thunder\thunder_03.wss", _this, false, getPosASL _this, 5, 1.5, 20000];
playSound3D ["A3\Sounds_F\ambient\thunder\thunder_04.wss", _this, false, getPosASL _this, 5, 1.5, 20000];
playSound3D ["A3\Sounds_F\ambient\thunder\thunder_01.wss", _this, false, getPosASL _this, 5, 1.5, 20000];
};

I have an object on the ground that is jumpdes1 = _this;

hallow mortar
#

_this is the arguments passed to spawn, which contains....[] (an empty array)

cobalt path
#

got it, so I give my _this a name and use that instead

hallow mortar
#

You don't have to give it a name, just pass the object you want to move into the spawn as an argument

cobalt path
#

copy

royal bramble
# hallow mortar If it's operating locally then it shouldn't be a big deal, but you'll definitely...

Essentially I fetch a github file

This is ran only on the server

 "https://raw.githubusercontent.com/XXX",
 "GET"
] call a3uf_common_fnc_request;


missionNamespace setVariable ["TFI_Arsenal_Items", _arsenalitems, true];```

Then anytime a player joins, I get the variable and compile it
```_res = missionNamespace getVariable "TFI_Arsenal_Items" select 0;

_code = compile _res;

call _code```

Our server have been dealing with random occurrences of desync that completely kill it. I was wondering if this could be the cause.
velvet knoll
#

Anyone know of a mod / script simialer to fire support + that will allow you to use a module to basicslly free fire an rpg warhead?

granite sky
#

@royal bramble That's broadcast, so yeah, it sends over the network on join and the size matters.

#

147KB isn't that bad though. ACRE can send 16MB+.

meager granite
#

compiling of a large file shouldn't hand server for more than a second, broadcasting it either

#

As for general problems, I know that Arma likes to randomly drop public variables, REs and setTerrainRight for JIP

#

More probably with large data

#

More probable when player is under VPN

manic kettle
#

isplaysound3D broken for custom sounds?

#

I've never gotten it to work

#

I'm trying to play a sound, ideally say3d with global effect, and determine if that sound is done playing

unreal wharf
#

Is there a way to adjust the intel item script- the BIS_fnc_initIntelObject one, to work off of doing a hold item action? IE as opposed to simply being a scroll wheel action, the activation of it is done with a hold action. IE you hold your interact on it, and the ring progress bar goes.

grizzled cliff
#

hmmm should i go for most backward compatibility with this library or as little developer overhead as possible?

#

eh fuck it, backward compat is easy enough

mystic scarab
#

Hello, I'm trying to make a script that saves information from players to a hashmap stored on the server as a public variable. My expectation is that the public hashmap is accessible and modifiable from every client and when a client uses the Save Gear action, I would be able to see their entry in the hashmap on the server, but it's not happening and I don't understand why. Can anyone tell me what I'm doing wrong?

//initServer.sqf
//server makes the database hashtable
// entry keys are player UIDs and one "newProfile" entry to be used if a player entry isn't found.
// the value for each key is as follows:
// select 0: gear
// select 1: funds

//initializing database
ionProfiles = profileNamespace getVariable ["ionProfiles", nil];
if (isNil "ionProfiles") then {
  hint "No ION Profiles Database detected... creating...";
  ionProfiles = createHashMap;
  _newProfileContents = [];
  // default loadout
  _newProfileContents set [0, [[],[],[],["U_I_G_Story_Protagonist_F",[]],[],[],"","",[],["ItemMap","","","","",""]]];
  _newProfileContents set [1, 10000];
  ionProfiles set ["newProfile", _newProfileContents];
} else {
  hint "ION Profiles Database detected. Checking profile.";
  ionProfiles = profileNamespace getVariable "ionProfiles";
};
publicVariable "ionProfiles";

//init.sqf
//persistence
sleep 5;
call HL_fnc_playerLoad;

player addAction [
    "Save Gear",
    {
        call HL_fnc_playerSave;
    }
];

//HL_fnc_playerSave.sqf
_UID = getPlayerUID player;
_ionProfile = [];
_gear = getUnitLoadout player;
_ionProfile set [0, _gear];
_funds = [player] call HALs_money_fnc_getFunds;
_ionProfile set [1, _funds];
ionProfiles set [_UID, _ionProfile];