#arma3_scripting

1 messages · Page 82 of 1

high tendon
#

😦

little raptor
#

did you fix your while?

#

this is the error not the correct version

high tendon
#

this is what i have currently

hint "In Safe Zone";
player allowDamage false;
while [true]
{
player action ["SwitchWeapon", player, player, 100];
sleep 1;
};

Not understanding what you mean by the wrong version. Could you be more specific? I apologize for my ignorance.

#

I changed the bracketing and I am still getting an error

#

it says

...
"player allow Damagefalse;
while {true}
|#|{
player action ["SwitchWapon" player, player,....'

#

awesome. thank you it worked. I really appreciate it

#

ill for sure give that a read

winter rose
#

Armagic

#

most likely something else than this code

#

ta-daaa

stark fjord
#

pushBack modifies original array

winter rose
#

no

stark fjord
#

if you wanna save index yes.

winter rose
#

pushBack, then setVar

stark fjord
#

_array pushBack _asset;
missionNamespace setVariable ["array", _array];
high tendon
#
restrictionTrigger1, this select 0;
if !(player in (List restrictionTrigger1)) exitWith{};

player groupChat "RESTRICTED AREA";
playSoundWarning = true;
cutText ["DEATH IS IMMINENT", "plain", 0];
titleFadeout 5;

sleep 7;
if (player in (List restrictionTrigger1)) then 
{
player setDamage 1;
player groupChat "YOU WERE WARNED";
}
else 
{

{side player == blufor , side player == independent} 

then 

{player groupChat "YOU HAVE LEFT THE RESTRICTED AREA";};

};

So the first warning, your player dying when you get into the zone, and the "YOU WERE WARNED" message is all working fine. However when I leave the area it doesn't show the last message and an error message pops up on the screen

stark fjord
#
restrictionTrigger1, this select 0;
if !(player in (List restrictionTrigger1)) exitWith{};

player groupChat "RESTRICTED AREA";
playSoundWarning = true;
cutText ["DEATH IS IMMINENT", "plain", 0];
titleFadeout 5;

sleep 7;
if (player in (List restrictionTrigger1)) then 
{
player setDammage 1;
player groupChat "YOU WERE WARNED";
}
else 
{

if ((side player) == blufor || (side player) == independent)

then 

{player groupChat "YOU HAVE LEFT THE RESTRICTED AREA";};

};```
#

You were missing an if

high tendon
#

thank you. I feel dumb now lol

stark fjord
#

Also use || or or instead of , if you wanna compare multiple conditions.

high tendon
#

Okay ill keep that in mind

stark fjord
#

Is this ran inside on activation of a trigger?

high tendon
#

yes

#
zoneH = [thisTrigger] execVM "zoneRestrictor.sqf";
#

is the activation

stark fjord
#

Ah okay. Just asking cause of sleep

high tendon
#

then i have a initPlayerLocal file defining a variable

playSoundWarning = false;

which is another trigger with the condition of

PlaySoundWarning

and the activation of

playSoundWarning = false
#

I am still getting an error tho and i am unsure as of why

stark fjord
#

Error says whats wrong

high tendon
#

undefined expression: this

stark fjord
#

The first line is wierd, but if you say it works, i believe you.

#

Ah, so it is the first line. If restrictionTrigger1 is triggers variable name, you can remove first line

high tendon
#

ooo okay that makes more sense

stark fjord
#

Since you are passing thisTrigger as a parameter to that function,
You could inside function retreive it by private _myTrigger = _this select 0;

#

this does not exist within function scope, _this however does, and it refers to array before execVM, where select 0 refers to first item in the array, in your case thisTrigger

#

But if you have global variable, set by variable name of the trigger, you dont need to bother with that

high tendon
#

took the first line out and replaced it as suggested. Now I have

private _myTrigger = _this select 0;
if !(player in (List restrictionTrigger1)) exitWith{};

player groupChat "RESTRICTED AREA";
playSoundWarning = true;
cutText ["DEATH IS IMMINENT", "plain", 0];
titleFadeout 5;

sleep 7;
if (player in (List restrictionTrigger1)) then 
{
player setDammage 1;
player groupChat "YOU WERE WARNED";
}
else 
{

if {(side player) == blufor || (side player) == independent} 

then 

{player groupChat "YOU HAVE LEFT THE RESTRICTED AREA";};

};

Now the new error is Type Code, expected Bool. Its refering to line 18

Also thank you for clarifying that.

#

i think it is refering to this line of code

{(side player) == blufor || (side player) == independent} 
stark fjord
#

Oh sorry, remove {}

#

And replace with ()

#

(Edited above)

high tendon
#

Works flawlessly now. Thank you my friend. Keeping up with what bracket goes where is killing me lmao

stark fjord
#

I really suggest reading thru that ^ and trying to understand it. Will clarify alot. Even if you dont get everything at first, it will make sense later.

high tendon
#

Will do. I looked through it today but I am going to study it indepth

boreal parcel
#

how would I go about formating parameter size? I mean so whether or not the provided parameter is 4 characters long or not, it adds enough whitespace to make up for the missing characters so it doesnt look zig zagged like so

format["S: %1 | A: %2 | F: %3"]
"S: 100 | A: 50 | F: 200"
"S: 10 | A: 500 | F: 200"
"S: 1000 | A: 50 | F: 20"
"S: 100 | A: 5 | F: 2000"
stark fjord
#

You mean something like %4u in c? Idk if format supports any of these, or it aint documented. You could make a function that takes value & number of digits, and sticks spaces infront of the number then returns it as string

boreal parcel
#

yeah though in my mind I referenced java's format function. Ill have to do that then

dusk gust
# boreal parcel how would I go about formating parameter size? I mean so whether or not the prov...

Theres nothing default in arma, but it's not hard to make a crude version of what you want;

_formatString = {
    // Max individual string size
    _strSize = 4;
    // Loop through each individual string
    _parameters = _this apply {
        // If the type isn't a string, make it one
        if !(_x isEqualType "") then {_x = str _x};
        _count = count _x;
        // If its bigger than the size, reduce it to size
        if (_count > _strSize) then {_x = _x select [0,4]};
        // If its smaller than the size, add space
        if (_count < _strSize) then {
            for "_i" from 0 to (_count - _strSize) do {
                _x = _x + " ";
            };
        };
        _x
    };
    // Add the parameters to the end string
    format(["A: %1 | B: %2 | C: %3"] + _parameters);
};
// Initial strings to add
_a = "1234   ";
_b = "1 23422   ";
_c = "  3341   ";
[_a, _b, _c]call _formatString
#

This was testing via SQFVM, so it may not be 100% accurate though I hope it would

#

Input should be able to be anything but nil

versed belfry
#

Hello once again :D

Got a question in regards to the Params command as I am working on a function.

Currently I have the params set up like this:

params [["_layer", "", ["asd"]]];

and was wondering if this is the correct way to set the expectedDataTypes to string, I've seen people do "asd" before and I've seen "" I think and I'm not sure which one one is correct.

dusk gust
versed belfry
#

ah, a'ighty cheers.

boreal parcel
# dusk gust Theres nothing default in arma, but it's not hard to make a crude version of wha...

thanks, I was thinking something like so below originally, but yours does seem smaller and more to the point. Ill test both and see what I come up with.

params["_string", "_size"];

private _strLen = count(_string);
private _newStr = "";

if (_strLen > _size) then {
    _newStr = [_string, _size] call TRA_trim;
} else {
    if (_strLen < _size) then {
        _newStr = [_string, _size] call TRA_extend;
    } else {
        if (true) exitWith {
            _string
        };
    };
};

TRA_trim = {
    params["_string", "_size"];
    private _str = [_string, 0, _size] call CBA_fnc_substr;
    _str
};

TRA_extend = {
    params["_string", "_size"];
    private _str = _string;

    private _charToAdd = _size - count(_string);
    for "_i" from 1 to _charToAdd do {
        _str = _str + " ";
    };
    _str
};

_newStr
#

also another question, about my nested if statements at the top, could I instead do something like this?

if (_strLen > _size) exitWith {
    _newStr = [_string, _size] call TRA_trim;
    _newStr
};
if (_strLen < _size) exitWith {
    _newStr = [_string, _size] call TRA_extend;
    _newStr
};
if (_strLen == _size) exitWith {
     _string
};
dusk gust
thorny osprey
#

Dear scripters, is a FiredMan event handler running on the player a performance hazard? I only care about Throw weapons, and quit the script first-thing if it's not.

stark fjord
#

Shouldnt be. If you dont make it a preformance hazard yourself.

little raptor
versed belfry
#

Question,
The getMissionLayerEntities command needs to be executed on the server.
I need the return value of the command in a local script.
Found out that this

private _allLayerTriggers = [_layer] remoteExec ["getMissionLayerEntities", 2];

won't work because the return value of remoteExec is different, is there a way to get the return value of getMissionLayerEntities while still executing it on the server through a local script?

twin oar
#

How do I attach a marker to a vehicle so it can constantly be shown on the map relative to the side who has it?

little raptor
#

@versed belfry you have to call a function on the server, which then sends the result back to the client.
see the message I replied to

versed belfry
#

Thanks

little raptor
# versed belfry Thanks

in that example:
my_fnc_remote can be something like:
"NMS_fnc_getLayerEntities":

params ["_layer"];
getMissionLayerEntities _layer;

"my_fnc_local" can be anything you want to do. e.g.:
"NMS_fnc_hideLayerObjs":

params ["_layerEntities"];
{
  _x hideObject true;
} forEach _layerEntities
[[_layer], "NMS_fnc_getLayerEntities", [], "NMS_fnc_hideLayerObjs"] remoteExec ["my_fnc_remoteExec", 2];
still forum
#

BE gets script post-preprocessor

#

We know how to improve it. And we keep getting ignored by the person that can change it
There is one bad filter that constantly triggers false positives. And we should just remove it

hallow mortar
#

🤷 last time I ran into it and reported it, it got fixed

#

Thanks Discord

digital hollow
twin oar
#

How do I set the loop?

hallow mortar
#

Create the marker, save the name, then (roughly)
while {alive _vehicle} do {_marker setMarkerPos (getPosATL _vehicle); sleep 1;}

stark fjord
#

You also wanna delete that marker right after loop

hallow mortar
#

Well, maybe. Sometimes leaving it on the last known position is fine. Depends on the mission design.

stark fjord
#

Also side check. And create marker local to only players on that side etc...

hallow mortar
#

The question I answered was about the loop. Someone else can answer all that.

twin oar
hallow mortar
#

The difference between deleting it/not deleting it after the loop exits, is whether the marker disappears when the vehicle is destroyed, or remains on the position it was destroyed at

#

Either way it is constantly updated as long as the vehicle is alive

twin oar
#

Ah I see

#

The vehicle would have its own respawn so it would just move then once it’s respawned?

#

And how do I keep that side specific?

stark fjord
#

As ive said, you need to create marker locally on client belonging to specific side

hallow mortar
#

If it's going to respawn, you can:

  • delete the marker after the loop exits, and start a new one for the new vehicle as part of the respawn
  • replace alive _vehicle with true and let the same marker persist at all times
stark fjord
velvet knoll
#

Hey guys, trying to script UAV terminal access through an addaction on a computer, anyone have any idea what action is called on uav terminal activation?

warm swallow
versed belfry
#

So if I understand this correctly, this is how I should implement it:

Define fn_remoteExec.sqf in the functions.hpp:

params ["_params", "_function", "_callbackParams", "_callback"];
_result = _params call (missionNamespace getVariable [_function, {}]);
(_callbackParams + [_result]) remoteExec [_callback, remoteExecutedOwner];

Then have fn_getLayerEntities:

params ["_layer"];
getMissionLayerEntities _layer;

and finally have A3A_someFunction.sqf:

//example code
params ["_layerEntities"];
{
  _x hideObject true;
} forEach _layerEntities

The line to start everything would be:

[[_layer], "A3A_getMissionLayerEntities", [], "A3A_someFunction.sqf"] remoteExec ["my_fnc_remoteExec", 2];
stark fjord
#

You can easily try it 😉

versed belfry
south swan
#

you can always run 2 game clients locally if you disable BattlEye (and probably enable windowed mode for convenience) blobdoggoshruggoogly

drifting sky
#

In danger.fsm, does anybody know what the danger cause DCexplosion is supposed to do? It doesn't seem to trigger with actual explosions. Instead it seems to trigger with some, but not all, nearby bullet impacts.

opal zephyr
#

Any consistent way to disable an objects collision in general? I saw in ace that they set the mass to almost zero to remove collision, but that doesnt work for me. I don't want to use disablecollisionwith either

manic kettle
#

Use attachTo?

opal zephyr
#

that doesnt disable collision for me, I can still walk into the object. Do I have to attach it to the object I want the collision to be disabled with?

manic kettle
#

Yeah

#

Hmm I don't know another way...let's see

opal zephyr
#

If I attach em together then they move with me lol, that might be ok though

#

mm not ideal, I happen to be already attaching it to another object

manic kettle
#

What about disabling simulation?

opal zephyr
#

nope

little raptor
opal zephyr
#

disablecollisionwith can only be done with one other object and has to be ran on both locality's, I need the collision to be disabled with whatever player is closest and id rather not have to run checks to see which ones closest

#

I know example 3 on the wiki for it talks about disabling with multiple objects, but that doesnt actually work in practice

granite sky
#

There's no absolute way. Maybe if you explained the exact problem you're trying to solve then someone can think of a workaround.

opal zephyr
#

Im carrying an object with ace carry, and attaching an object to it. It collides with the player and makes me fly, I need to avoid this

manic kettle
#

The second object collides with player?

opal zephyr
#

yup

manic kettle
#

Why not createVehicleLocal that way the 2nd obj is local to the player. Then disable collision

opal zephyr
opal zephyr
manic kettle
#

I think you probably just need to suck it up and use a remoteExec on the server to disable collision then lol

little raptor
opal zephyr
#

no i attach it to the object im carrying, with ace you can raise and lower said object so attaching the second object to me would mean it wouldnt follow said raising and lowering

#

oh you mean the one im carrying, idk how ace does it, it probably is attached to me

little raptor
#

if it's attached to you it shouldn't collide with you tho

manic kettle
#

No it's attached to the obj attached to him

opal zephyr
#

Object 1 im carrying, probably attached to me through ace, object 2 im attaching to object 1, object 2 is colliding with me

little raptor
#

attach obj2 to yourself too 😅

little raptor
#

aren't you carrying 1 obj at a time?

opal zephyr
#

Im carrying one object through ace at a time... yes

little raptor
#

then what's wrong with disabling collision between you and obj2?

#

afaik you don't need to run it on both localities as you said

manic kettle
#

Ok how about this...
Attach obj2 to yourself but use getposATL/setposATL in a while loop, while obj1 attached to move obj2 relative to obj 1

opal zephyr
opal zephyr
stark fjord
opal zephyr
#

Thanks for your input on the disable collision stuff, ill do some more testing and see which solution I like the best :)

twin oar
#

How do I create a sector defense group for both sides?

#

As of right now only INDFORs response team works but Bluefor and Opfor doesn’t spawn anything.

drifting sky
#

Does the "targets" command return only targets known to the unit or group?

little raptor
#

yes

granite sky
#

Fun thing about targets is that it's not MP-synced.

winter rose
cold mica
#

How does one do player respawn similar to the COOP missions in Arma 3, specifically the ones in S.O.G.

In other words, how do I enable respawn on one's group leader in multiplayer? I am familiar with setting it in description.ext but that only enables switching to AI units in a group, not respawning a new unit to that group.

pulsar bluff
#

easier to think of it as “respawn” and then “teleport to group leader”

winter rose
pulsar bluff
#

@meager granite do you know the difference in key binding between DIK and hexa?

#

i am encountering some issues where I set a key bind with DIK code and person with some exotic keyboard (chinese?) does not have the action

meager granite
#

Not sure what you meant by difference, DIK codes are just preprocessor defines to DIK key numbers.

pulsar bluff
#

hmm strange.. just exploring reasons why a chinese community isnt getting the key bind default

#

basically just (_key == 219) in keydown

warm hedge
#

Which key it is?

meager granite
#

#define DIK_LWIN 0xDB /* Left Windows key */

#

Probably they keyboard only has right windows or something?

pulsar bluff
#

left windows

warm hedge
#

Hm could be

meager granite
#
#define DIK_LWIN            0xDB    /* Left Windows key */
#define DIK_RWIN            0xDC    /* Right Windows key */
#define DIK_APPS            0xDD    /* AppMenu key */

I use a check for all 3 for my windows key functions

pulsar bluff
#

hmm

warm hedge
#

Hmm tried both Simplified and Traditional IME both detects 219

pulsar bluff
#

thanks for checking

little raptor
pulsar bluff
#

🙂

little raptor
#

see the DIK codes page

#

WINL is 220 and WINR is 219 meowsweats

nocturne bluff
#

" External Designer Killzone Kid"

#

So he got hired ey.

boreal parcel
#

in BIS_fnc_showNotification examples I see TaskSucceeded example notification, is there already a defined TaskFailed of some sort?

warm hedge
#

Defined in CfgNotifications

boreal parcel
#

ah so there is? good to know. Im loading up my arma now to check the configs

#

another question, I have my event handler ID, how would I go about checking whether or not the event handler has been removed?

warm hedge
#

IIRC they introduced one recently...

boreal parcel
#

display event handler*

warm hedge
boreal parcel
#

perfect, thank you

#

is there a way to check for both KeyDown and MouseButtonDown with the same event handler or am I going to need to check for one inside of the function called by the other?

hallow mortar
#

If you're looking for modifier keys (shift, ctrl, alt), the mousebutton EHs provide that information

boreal parcel
#

no sadly im getting the arrow keys and space bar. I think im going to just make a missionNamspace boolean variable that gets flicked true on mouse right click, and ill just look for this boolean var in the function called by my keydown event handler.

meager granite
#

Instead of flag you can do lastMouseClickFrame = diag_frameNo;, so you don't have to unflick it back to false

#

Then just do if(diag_frameno == lastMouseClickFrame) then { conditions

little raptor
#

that's too inaccurate

meager granite
#

Why? Due to float precision?

little raptor
#

yes

#

well not gonna be a problem unless you run Arma for ~70+ hours @60FPS meowsweats

meager granite
#

First they'll need to have game running for a long time, second even with some tiny threshold its probably not a big deal, its user input done by hands anyway, it won't be perfect.

#

Speaking of threshold, using diag_tickTime can be useful if you want to have threshold for clicks or key presses, something like if(diag_tickTime < lastMouseClickTime + 0.5) then { for 0.5s threshold.

little raptor
#

you mean >?

copper raven
#

use diag_deltaTime with various timers for different things

meager granite
#

Its 12am and I can't think anymore

quaint zephyr
#

Any reason for AI to stop suppressing after two bursts, even if suppressFor is set to three minutes? (Gunner of an IFV)

copper raven
#

unless by that condition you mean "do nothing"

meager granite
copper raven
#

oh i read the initial question now, i see

#

mouse up/down and a flag is the best anyway

meager granite
#

I remember having an issue with up event not firing if you remove focus from the game or something? So you ended up with a never removed flag.

little raptor
quaint zephyr
#

Could be. I am totally new in Arma scripting, so yeah

agile pumice
#

bout time

little raptor
#

I meant a game bug

quaint zephyr
#

Yes, but my incompetence does not help also

hallow mortar
#

If you have any AI mods running, they could potentially make the AI get distracted

nocturne bluff
#

Can i be External Super Swedish Person Head?

#

That be great.

quaint zephyr
#

Even trying to cycle through an array of targets, it seems to do fixed amount of bursts on single target and quit

granite sky
#

Most AI commands are treated as advisory at best

#

whether through bugs or intention. Rarely clear.

#

But you should definitely test vanilla.

civic latch
#

Hi guys, how are you ? I have a little problem with markers.
I'm on a server and when i double-click on the map to create a marker, i get the menu but the group is blocked and i can't click OK.
I've tried different difficulties but nothing solves this problem.
Do you have any idea ?
Thanks

civic latch
little raptor
#

dunno. could be locked by the server/mission you're playing?

#

also this channel is for scripting questions

boreal parcel
little raptor
#

tho I don't think it would help much in this case. based on what you've said the two events are not really related and won't happen in the same frame

sand anvil
#

I have a problem with say3D, I'm trying to make radio loop music that's about 15 minutes long, the problem is that if the player goes away for say like 5 minutes, then the loop would start 5 minutes too early because sleep doesn't pause while the player is away, but the song pauses, causing the radio play 2 songs at once.

Is there a better way to make long 3D audio loop?

I'm working with multiplayer btw.

boreal parcel
little raptor
#

check if its source still exists instead of using a timer

sand anvil
little raptor
#

the game returns a different object as source

#

read the wiki

sand anvil
#

I'm not sure how that would stop the desync issue though

little raptor
#

instead of using sleep 15*60 you check if source still exists. if not you play the song

sand anvil
little raptor
sand anvil
#

WaitUntil returned nil

#

💀 Is this what I'd put in the init of an object or

little raptor
#

no

sand anvil
#

Well I'm lost

boreal parcel
#

also I realize for the switch case 57 and 1000 I could probably turn that into another inline function instead of writing it twice. Might do that as well

little raptor
#

when you rclick it should cancel immediately not wait for another key down

#

missionNamespace setVariable ['TRA_buildCancel', true];
and instead of these just do TRA_buildCancel = true

#

well not that var since its useless. I mean others

boreal parcel
#

ah you know what, your completely right. Im not passing in any local variables for the cancel. Why didnt I think of that

boreal parcel
little raptor
#

missionNamespace setVariable ['TRA_buildDisplayID', _id];
and store display related IDs on displays themselves not missionNamespace

little raptor
boreal parcel
#

hmm? so like (findDisplay 46) setVariable [etc] ?

little raptor
#

yes

boreal parcel
#

oh neat, didnt know you could do that

little raptor
#

(findDisplay 46) displayRemoveEventHandler ["KeyDown", TRA_buildDisplayID];
and instead of these just write _display displayRemoveEventHandler ["KeyDown", _thisEventHandler]

#

well I mean in the EH code itself

#

not the ones in other places

#
/* While build KeyDown event handler exists, do: */
while {(findDisplay 46) getEventHandlerInfo ["KeyDown", TRA_buildDisplayID] select 0} do {
    sleep 1;
};
 
/* Return whether build was a success or failure after KeyDown eh is removed */
missionNamespace getVariable ['TRA_buildSuccess', false];

when you have an event handler system set up it's best not to use loops anymore

boreal parcel
little raptor
#

yeah

#

you have defined the _display var already in your params

#

_thisEventHandler is a magic var (current event handler ID)

boreal parcel
little raptor
#

yes. I'm not sure how your stuff are set up but ideally it should be like this:

  1. fnc1 calls that function
  2. that function adds the EHs
  3. the EHs call fnc2 (success) or fnc3 (fail)
#

in this case I'm assuming success is placing the object and failure is canceling the job

boreal parcel
#

yes, based on what you said I think I can rework my code a bit and get the desired output

boreal parcel
#

also, I have implemented the rest of the changes you suggested and everything works perfectly now and looks much better.

#

hmm actually since that is called so frequently I probably dont want that

little raptor
#

that call returns either true of false

#

and it's not useful to you as far as I see

little raptor
#

what I meant is, if you want to wait for the return of that function and process it in fnc1, instead, break fnc1 into 3 parts: fnc1 fnc2 fnc3

#

or just make a fnc2 and pass the result to it as a parameter

#

if you still don't understand, show me what calls that function to tell you what you should do

#

if you care about performance that is. otherwise just use what you have now blobdoggoshruggoogly

boreal parcel
#

I do care, its the main reason I am making this project which is a remake of another project lol. other reason is I think working with sqf is really neat.

This is the function im calling that function from, however the more I think about what you said and why I need to have the build function return a Boolean value. At my current stage in the project I cant really think of a reason I need it to.

I think originally I wanted it to because it just made sense to return a Boolean with the result when it finishes running in this scenario
https://pastebin.com/JzzrNwgt

little raptor
#

which one is the function?

#

this?

private _success = [_player, _parsedData select 0, _parsedData select 1, _fob] spawn TRA_fnc_build;

#

that's wrong

#

spawn returns a handle. not result

boreal parcel
#

it was call previously, I turned it to spawn in order to get the loop with a sleep 1 working

#

but yes that was my function

twin oar
#

Is there a way to script restricted zones in WL having an issue where people are able go into random OPFOR/BLUEFOR sectors that aren’t under attack and cap them.

#

The base WL restriction works for INDFOR positions in the beginning of the match.

little raptor
# boreal parcel I do care, its the main reason I am making this project which is a remake of ano...

well let's say it was a call and you wanted to do something with it, and this was the flow:

private _success = [_player, _parsedData select 0, _parsedData select 1, _fob] call TRA_fnc_build;
if (_success) then {
  // build success code
} else {
  // build failure code
};

(you might think that's wrong but you can use sleep in a called code, if it's called from scheduled evn. another important thing to learn if you didn't know already since it can save you a lot of performance)

instead you do:

[_player, _parsedData select 0, _parsedData select 1, _fob] call TRA_fnc_build;
// remove the rest of stuff here that need to wait for the result of the above code
// let's say you need this var to pass it to TRA_fnc_buildResult
findDisplay 46 setVariable ["someVariableIneedLaterInResult", _someVar];
TRA_rotateObject = {
  // ....
   case 57: {
    _someVar = findDisplay 46 getVariable "someVariableIneedLaterInResult";
    [_someVar, true] call TRA_fnc_buildResult;
  };
};
...
TRA_cancelRotation = {
  ...
  // define _someVar here too
  [_someVar, false] call TRA_fnc_buildResult;
}

TRA_fnc_buildResult:

params ["_someVar", "_result"];
if (_result) then {
  ["TaskSucceeded", ["", "Object Built!"]] call BIS_fnc_showNotification;
}  else {
  ["TaskFailed", ["", "Not enough resources to build object!"]] call BIS_fnc_showNotification;
};

as you can see you don't need any loops

#

you just move from one fnc to another

#

and you can pass any variable you need in the process as well (such as _someVar in that example)

boreal parcel
opal zephyr
#

Im trying to change the name of an ai with setName through a script, but it just doesnt work. If i do the same command in game with the console it works fine. Anyone have any ideas?

stark fjord
#

Try setIdentity

opal zephyr
#

setIdentity requires the identity to be pre-created in description or config, I need the name to be able to be changed to anything, so thats a no go

granite sky
#

Script and console do the same thing. Try to figure out the difference with where and when you're running it.

opal zephyr
#

It seems to not work when I use a local unit, this example here does not change the name:

_group = createGroup civilian;
_unit = _group createUnit ["B_Soldier_F", (getPosATL player) vectorAdd [0,5,0], [], 0, "NONE"];
_unit setName "tester";
granite sky
#

Well, setName is local effect?

opal zephyr
#

it is, this is being tried in singleplayer rn, ive tried it with and without a remoteexec

granite sky
#

Ok, other thing with setName is that forename-surname takes priority if they exist, IIRC

#

So you typically have to use the array form of setName to change visible names of AIs.

#

_unit setName ["tester", "", ""]

opal zephyr
#

unfortunately that does not work either

#

I can change the names after the fact with a command like this:

{
    _x setName ["tester","",""];
}forEach allUnits;
#

and it works no problem, I am clueless as to why it doesnt right after creation

granite sky
#

yeah ok, seems to be a timing thing.

opal zephyr
#

Ah that was it, it cant be done right after, sleep needed to be added

#

There must be some initialization faze for the unit being created that will overwrite my change of the name

#

Thanks for helping out John :)

granite sky
#

I wonder if that's true in MP or not.

#

We're setting AI names on creation but the code might be slow enough to skip into the next frame :P

#

Although I guess we're remoteExecing

opal zephyr
#

I was trying it with remoteExec with this command [_unit, "testName"] remoteExec ["setName", 0, true]; to no avail earlier

#

the mission is incredibly light though, maybe there just isnt enough going on

granite sky
#

Immediate remoteExec + long setName Works in MP but not SP:
[_unit, ["tester", "", ""]] remoteExec ["setName", 0, true];

opal zephyr
#

Thankyou for letting me know!

snow pumice
#

Hey I am trying to end an animation / move for a player but somehow it won't play.

The variables indicating if the player is surrendering are working correctly, I also verified that the code which should start another Animation (hands / arms down) does get executed

I use playMove to start the first animation and later playMoveNow

But even in a console it won't work, if I use switchMove it works just fine byside a little lag / camera adjustment

Any ideas why I can't change the animation with playMoveNow?

My code is pretty much the same / this code also did not work for me
https://github.com/AsYetUntitled/Framework/blob/v5.X.X/Altis_Life.Altis/core/actions/fn_surrender.sqf#L20

granite sky
#

playMove requires there to be a known transition between the current and target animation state.

dreamy kestrel
#

Q: where are loadouts stored? in profileNamespace? by which var(s)?

warm hedge
#

What loadout? Arsenal?

dreamy kestrel
#

yes, sorry. arsenal.

warm hedge
#

Indeed profileNamespace. I forgot which var

dreamy kestrel
#

I was just scanning the p/ns vars, for the obvious, loadout, etc, nothing pops out.

#

seems a bit odd allVariables profileNamespace should return empty though...

#

excepting for the note Using profileNamespace and uiNamespace with this command has been disabled in multiplayer, chagrined so how do I otherwise probe for which vars?

warm hedge
#

IIRC was not a straightforward name

dreamy kestrel
#

would not guess it was... hmm

warm hedge
#

I'm not on my PC rn so... yeah

dreamy kestrel
#

appreciate it... jumping out to SP...
ACE, seems like somewhat straightforward, "ace_arsenal_saved_loadouts"
gonna scan the other vars bit more intently though.

simple trout
#

"bis_fnc_saveInventory_data"

dreamy kestrel
#

yes I see that now... makes sense. thank you.

#

next stupid questions might be, the shape of the data... with ACE it seems obvious they are an array of NVP (name value pairs)...
with BIS, is it more like a flat the same, consume [_key, _loadout, ...]?

granite sky
dreamy kestrel
#

yeah I was wondering the same. which I gather the bits are interchangeable, just needing to validate them individually...

#

I'm not looking to validate (yet), but I do at least want to understand the level of NVP sorting...

#

which the above, whereas ACE appears to be a proper associative array, [[_key, _loadout], [_key, _loadout], ...]

granite sky
#

oh, that level.

#

I think it's a flattened version of that, so just [_key, _loadout, _key, _loadout, ...]

dreamy kestrel
#

cool, I second the nomination, was thinking it appears the same way... thanks.

boreal parcel
#

if I pass an empty hashmap to count() would it return 0?

high tendon
#
_maxPlayers = 10; // Maximum number of players allowed in the raid area

this addAction ["RAID", {
    _markerPos = [];
    {
        _markerPos pushBack getMarkerPos _x;
    } forEach ["Exit1", "Exit2", "Exit3"];

    _randomPos = _markerPos call BIS_fnc_selectRandom;

    // Check if the maximum player count is not reached
    if (count playableUnits < _maxPlayers) then {
        player setPos _randomPos;
        {
            _x setPos (getPos (_this select 1));
        } forEach units group (_this select 1);
        skipTime 5;
    } else {
        hint "Maximum player count reached. Raid area is full.";
    }
}, [], 1, true, true, "", ""];```

error: invalid number in expression

Ive looked on the forums I am probably over complicating it.
boreal parcel
#

what line does it say that for?

high tendon
#

i think it is the first one which is why i am confused

boreal parcel
#

ah

#

are you putting this in an init of a unit?

high tendon
#

its on a white board with a map

boreal parcel
#

cant have comments in the init's for objects and units

high tendon
#

omg really?

#

LOL

boreal parcel
#

remove them and you should be fine. I dont remember exactly why but iirc its because the init uses like loadFile or something which doesnt support comment lines

#

something along those lines

high tendon
#

yea it works now HAHA

boreal parcel
#

yeah I have had the error many times before

high tendon
#

thank you

boreal parcel
#

np

granite sky
#

_maxPlayers isn't defined inside the addAction function though.

boreal parcel
#

ah yeah I hadnt noticed that.

boreal parcel
# high tendon ```sqf _maxPlayers = 10; // Maximum number of players allowed in the raid area ...

if you wanna pass _maxplayers to the addAction without creating it inside the code for the addAction, look into passing it in where the nil parameter is is in example 5.

arguments: Anything - (Optional, default nil) arguments to pass to the script. Accessible with _this select 3 inside the script. If Array is used as an argument for example, its first element reference would be _this select 3 select 0``` 
https://community.bistudio.com/wiki/addAction
high tendon
#

I will for sure. It lets me put the code in the init but it's throwing me some errors still but I gotta get some sleep so it's tomorrow problem

brazen lagoon
#

how do you determine if a classname has a grenade launcher?

warm hedge
#

Underslung you mean?

brazen lagoon
#

ye like a 203 or something

#

what's the config for that

warm hedge
#

Check if the muzzle config has some name other than this

brazen lagoon
#

is it always gonna be an EGLM?

warm hedge
#

Nop

#

UGL_F or... the name doesn't matter after all

#

Checking the magazines or such may detect if is a 40mm GL

brazen lagoon
#

yeah

#

so look for it to have more than 1 muzzle, then use the second muzzle's value under the config to figure out the gl's magazine, then check the shot type

warm hedge
#

Pretty much

brazen lagoon
#

a bit annoying but oh well

granite sky
#

Slightly quicker method:

private _config = configfile >> "CfgWeapons" >> _className;
private _muzzles = getArray (_config >> "muzzles");
count _muzzles >= 2 && {"gl" == getText (_config >> (_muzzles select 1) >> "cursorAim")}
#

Worked across a bunch of different modsets in practice.

brazen lagoon
#

ah, should cursoraim always be "gl" for it to get that style of attacking

#

cool

#

for indirect fire I mean

granite sky
#

Note that there are single-muzzle grenade launchers too.

brazen lagoon
#

right

#

but that's gonna be like

#

a Mikor M32

brazen lagoon
#

any idea how to get a random backpack

warm hedge
#

A backpack is a CfgVehicles class, with isBackpack=1

sharp stag
#

What is the process for turning a script into a mod? I have some good ideas that haven't been done before, I just don't know how to take a script and turn it into a mod.

warm hedge
granite sky
#

With a mod, each PBO has a config.cpp in it with a CfgPatches class and whatever else you need after that (eg CfgFunctions as above if it has scripts).

snow pumice
little raptor
little raptor
tough abyss
#

do you know how to stop this animation script from changing the ais loadout?

if (local this) then {[this, "GUARD", "ASIS"] call BIS_fnc_ambientAnim;
0 = this spawn {
waitUntil { behaviour _this == "combat"};
_this call BIS_fnc_ambientAnim__terminate;
};}

dreamy kestrel
#

Q: about the BIS arsenal save data, aptly named "BIS_fnc_saveInventory_data", I suppose, but that is a topic for another time...
If I reshaped the data to proper KVP, i.e. [[_key, _val], [_key, _val], ...], would that be in basic agreement with the ACE save data?
Notwithstanding the composition of each of the _val bits, of course, I am aware there are differences there as well.
Thanks...

dreamy kestrel
wind flax
#

Does anyone know how to get the descent rate of an object? I've been attempting to use getPosATL, and getPosASL but simply moving forward and backwards is manipulating the data, and leading to inconsistant results

little raptor
#

what kind of object?

little raptor
#

only works if the object has a velocity, which is why I asked what kind of object 😒

wind flax
#

It's a player / vehicle

little raptor
#

then yeah use velocity

wind flax
#

Basically trying to determine the glide ratio for a parachute

dreamy kestrel
hallow mortar
#

Using velocity should get what you need quite easily, but I'm curious about what was going wrong with checking getPosASL 🤔 it's relative to a fixed altitude, so lateral movement shouldn't affect the Z component in itself. Checking ASL altitude over time should be a fine way to get average vertical speed.

dreamy kestrel
wind flax
dreamy kestrel
hallow mortar
granite sky
dreamy kestrel
twin oar
#

I'm still having issues understanding the setmarkerpos getmarkpos

#

the fourm i was sent doesn't make any sense

hallow mortar
#
  • what are you trying to do with it?
  • what were you sent?
twin oar
#

I'm trying to set a marker to an MHQ that players can teleport to.

hallow mortar
#

Ah, I remember this

twin oar
#

Yes, I’m still not figuring it out.

hallow mortar
#

I'm sure I advised you to do something like

_marker setMarkerPos (getPosATL _vehicle);```
twin oar
#

Do I put that in the vehicle's init?

hallow mortar
#

No. That will set the marker's position "once" (on mission start, then each time a new client connects, because inits are executed on every client at the moment they locally start the mission)

#

You need to make a loop like we were talking about previously. That loop will probably go in initPlayerLocal.sqf but there are a few ways to do it

twin oar
#

can you potentially explain this in a VC?

hallow mortar
#

Nope

twin oar
#

okay

hallow mortar
dreamy kestrel
twin oar
#

put what you said in there got this error message

hallow mortar
#

Because there are pieces missing

#
while {true} do {marker_MHQ1 ....};```
twin oar
#
while {true} do {marker_MHQ1 setMarkerPos (getPosATL MHQ1); sleep 1;}
#

that?

hallow mortar
#

Yep

twin oar
#

the sleep is how constent it update correct?

hallow mortar
#

Yes

twin oar
#

1 is 1 minute?

hallow mortar
#

No, 1 second

twin oar
#

Ah okay, and how do I make it to be set so only Bluefor sees that?

hallow mortar
#

You have to create the marker locally (createMarkerLocal, and use the local versions of other marker-related commands too) in combination with an if check, to determine if the local player is in fact on BLUFOR

#

"Local" is a network concept. When something is "local", that means it's primarily (or only) hosted on the current machine. A player's unit is local to that player's machine, for example. Doing things locally means you can have different things on different machines, and in this case you're going to exploit that to have the marker appear on some machines but not others.

versed belfry
# little raptor in that example: my_fnc_remote can be something like: "NMS_fnc_getLayerEntities...

Hello :D

I've just tested this on a dedicated server and can't seem to get it to work for some reason, if it may help those are the files (all defined in the functions.hpp):
A3A_fn_useRemoteReturn.sqf:

params ["_params", "_function", "_callbackParams", "_callback"];

_result = _params call (missionNamespace getVariable [_function, {}]);
(_callbackParams + [_result]) remoteExec [_callback, remoteExecutedOwner];

A3A_fn_getLayer.sqf:

params ["_layer"];

getMissionLayerEntities _layer;

A3A_fn_markTriggersInLayer.sqf [Confirmed it works on its own if given the correct layer/array]:

params ["_layer", [], [[]]];

private _counter = 1;
{
    // Get all the trigger info and prepare markaer names
    private _triggerPosition = getPosATL _x;
    private _triggerText = triggerText _x;
    private _triggerAreaMarkerName = "triggerArea_A3AScript_InLayer_" + str(_counter);
    private _triggerPointMarkerName = "triggerPoint_A3AScript_InLayer_" + str(_counter);
    private _triggerAreaInfo = triggerArea _x;

    // Creates the trigger area marker and sets its settings
    createMarkerLocal [_triggerAreaMarkerName, _triggerPosition];
    _triggerAreaMarkerName setMarkerSizeLocal [_triggerAreaInfo select 0, _triggerAreaInfo select 1];
    _triggerAreaMarkerName setMarkerDirLocal (_triggerAreaInfo select 2);
    _triggerAreaMarkerName setMarkerColorLocal "ColorCIV";
    _triggerAreaMarkerName setMarkerBrushLocal "DiagGrid";

    if (_triggerAreaInfo select 3) then {
        _triggerAreaMarkerName setMarkerShapeLocal "RECTANGLE";
    } else {
        _triggerAreaMarkerName setMarkerShapeLocal "ELLIPSE";
    };

    // Creates the trigger point marker and sets its settings
    createMarkerLocal [_triggerPointMarkerName, _triggerPosition];
    _triggerPointMarkerName setMarkerColorLocal "ColorBlack";
    _triggerPointMarkerName setMarkerTypeLocal "mil_dot";

    if (_triggerText != "") then {
        _triggerPointMarkerName setMarkerText _triggerText;
    } else {
        _triggerPointMarkerName setMarkerText ("Trigger_" + str(_counter) + "_InLayer");
    };

    _counter = _counter + 1;
} forEach (_layer select 0);

The line that I executed locally to test this:

[["TRIGGERS"], "A3A_fn_getLayer", [], "A3A_fn_markTriggersInLayer"] remoteExec ["A3A_fn_useRemoteReturn", 2];

Any idea what I could've done wrong? 😅

little raptor
#

have you actually defined the functions?

#

or is it just the random sqf files?

versed belfry
hallow mortar
# hallow mortar "Local" is a network concept. When something is "local", that means it's primari...

For example (should work but may need tweaking/optimising):

waitUntil {!isNull player}; // the player object might need a minute to initialise on start
if (side player == west) then { // check which side the player is
  [] spawn { // create a new scheduler thread so we don't get in the way of the main initPlayerLocal thread
    BLU_MHQ_marker = createMarkerLocal ["BLU_MHQ_marker",getPosATL MHQ1];
    BLU_MHQ_marker setMarkerTypeLocal "b_hq";
    BLU_MHQ_marker setMarkerColorLocal "ColorWest";

    while {true} do {
      BLU_MHQ_marker setMarkerPosLocal (getPosATL MHQ1);
      sleep 1;
    };
  };
};```
( @twin oar )
little raptor
#

needs a c

little raptor
hallow mortar
# little raptor needs a c

expansion: fn_functionName.sqf is used in the file names, tag_fnc_functionName (fnc) is used when you call it in code

versed belfry
hallow mortar
versed belfry
#

Thank you again for the help :D
🎉 I learned more about functions again

#

and thanks Nikko for explaining that part ^

twin oar
hallow mortar
#

Did it create the marker at all? (if you have an existing editor-placed marker make sure to get it out of the way to avoid confusion)

twin oar
#

Ohhh I should delete the marker existing?

#

That’s in the editor

hallow mortar
#

Well, we are creating a local-only marker on each machine. That has to be done through script. So the editor marker is not used. You don't have to delete it but it will make things clearer.

hard haven
#

anyone has a script handy that would fill an empty ammo with the gear of a given faction?

twin oar
#
while {true} do {BLU_MHQ_marker setMarkerPos (getPosATL MHQ1); sleep 1;};
waitUntil {!isNull player}; // the player object might need a minute to initialise on start
if (side player == west) then { // check which side the player is
  [] spawn { // create a new scheduler thread so we don't get in the way of the main initPlayerLocal thread
    BLU_MHQ_marker = createMarkerLocal ["BLU_MHQ_marker",getPosATL MHQ1];
    BLU_MHQ_marker setMarkerTypeLocal "b_hq";
    BLU_MHQ_marker setMarkerColorLocal "ColorWest";

    while {true} do {
      BLU_MHQ_marker setMarkerPosLocal (getPosATL MHQ1);
      sleep 1;
    };
  };
};```
#

this is what I've got

#

not creating a marker

hallow mortar
#

You have two while loops, you don't need the first

twin oar
#

okay took the first one out trying now

#

that worked, how do I add text next to the specific marker?

hallow mortar
#
BLU_MHQ_marker setMarkerTextLocal "your text here";```
directly after the other similar lines
twin oar
#

I appreciate all the help!

#

then to make one visible to Opfor I just replace BLU with OPF?

#

and the color with EAST?

hallow mortar
#

The BLU_ part of the marker name is not what controls who it's visible to - it's just a name. You should change it anyway to keep things clear, though.

#

Remember, we're creating a local copy of the marker on the machine of any player who is on BLUFOR. The part that detects this, and decides whether to create the marker, is the if check, which checks the side of the player unit.

twin oar
#

gothca!

#

Thanks for walking me through it!

boreal parcel
#

if I do if () exitWith {} inside a foreach loop, does it exit the loop entirely or does it just skip the rest of the current loop

open fractal
boreal parcel
#

oh didnt know sqf had continue, sick thank you.

high tendon
#

any recommendations for a program that will highlight syntac errors? i have the basics of how things flow but im still getting use to proper bracketing etc.

limpid lake
#

Is there a way to make a container contain a refreshing inventory? Dont wanna place 500 mags of something and dozens of different weapons each time for lag, just want one crate to refresh its inventory when something is taken

high tendon
#

probably set up a box with whatever you want. Give it a variable name and do a

createVehicle
sleep xxx
delete vehicle

then loop it somehow

little raptor
limpid lake
#

Ill google them handlers

#

new to scripting so kind of figuring out thanks

high tendon
#
_maxPlayers = 3;

this addAction ["RAID", { 
    _markerPos = []; 
    { 
        _markerPos pushBack getMarkerPos _x; 
    } forEach ["Exit1", "Exit2", "Exit3"]; 
 
    _randomPos = _markerPos call BIS_fnc_selectRandom; 
 
  
    if (count playableUnits < _maxPlayers) then { 
        player setPos _randomPos; 
        { 
            _x setPos (getPos (_this select 1)); 
        } forEach units group (_this select 1); 
        skipTime 5; 
    } else { 
        hint "Maximum player count reached. Raid area is full."; 
    } 
}, [], 1, true, true, "", ""];

I have this on a object (Map on a stand)

{alive _x && (side _x == west)} count thisList <= _maxPlayers

I have this in the condition field of a trigger in the raid area.

I need to teleport players and their team mates to 1 of the random marker positions within this designated raid area. But i want to limit the number of players that can teleport there due to the space being rather small.

I am currently getting an error that says my variable _maxPlayers is undefined.

Probably a simple fix if someone could show me what i am doing wrong and maybe give me a good source so i can educate myself on this mistake

little raptor
#

you can also pass variables to the addAction via its arguments

#

I have this on a object (Map on a stand)

{alive _x && (side _x == west)} count thisList <= _maxPlayers

I have this in the condition field of a trigger in the raid area.
that won't work because _maxPlayers is a local var

high tendon
#

okay that makes sense and moving the _maxPlayers worked with no issue

granite sky
manic kettle
manic kettle
high tendon
#

I am back with more dumb questions.

So like i stated previously I have a section of the map that is secluded and i only want a certain number of players to teleport to one of the 3 markers there randomly. I also need to limit the number of players in that area. For example if I only want 10 players in there then once a trigger detects 10 players then no more players will be allowed to teleport.

The thing I am having trouble with is getting the trigger in the "Raid Area" to count the players inside of it and make the variable "playerCount" = the number of players in the raid area.

How would I go about doing this?

little raptor
# high tendon I am back with more dumb questions. So like i stated previously I have a sectio...

you don't need any global variables for this.
all you need is get the list of triggers that still have spots left:

_allTriggers = [trigger1, trigger2, trigger3, ...]; // some array of triggers
_allPlayers = allPlayers;
_limit = 10;
_validTriggers = _allTriggers select {count (_allPlayers inAreaArray _x) < _limit};
if (count _validTriggers == 0) exitWith {systemChat "can't teleport"};
player setVehiclePosition [ASLtoAGL getPosWorld selectRandom _validTriggers, [], 30, "NONE"];
hexed forge
#

Would a completely non-reactive and immortal vehicle driver/gunner be the result of a misconfigured dynamic simulation setup?

stark fjord
#

It could be, or just disabled simulation in general

dreamy kestrel
#

so you can jam containers, uniforms, vest, backpacks, into crates, vehicles cargo inventories, and such. how do you tell that the backpack has contents after you've done that?

warm hedge
#

After BIS_fnc_saveInventory/BIS_fnc_loadInventory you mean?

dreamy kestrel
#

no, actually shifting gears after I got arsenal more or less stood up on its feet...
moving on to actual containers, vehicles, handing those inventories.

#

I figure how to more or less approach actual objects i.e. when I have a cursorobject, but how about containers on the ground?

#

for instance everyContainer requires an object. but objNull (ground?) no comprende.

brazen lagoon
#

anyone managed to select NIArms' weapons muzzles?

#

err. sorry

#

not muzzles. weapons slots

#

this is super weird to me, the config is laid out lilke this:

#

count ("true" configClasses (configfile >> "CfgWeapons" >> "hlc_rifle_g3a3vris" >> "WeaponSlotsInfo")) returns 1

#

I feel like I'm having a stroke

dreamy kestrel
#

everyContainer _vehicle works when I have a vehicle object. but how do I get the same for ground containers, uniforms, vests, backpacks, etc? you know how in player inventory there is sometimes the "Ground" tab, for instance.
https://community.bistudio.com/wiki/everyContainer
The docs suggest it is possible, but there does not appear to be any form where it is...
i.e. Used for accessing containers content stored in ammo box or ground holder
what is a "ground holder"?

granite sky
#

@brazen lagoon Probably because configClasses doesn't count inherited entries?

#

You want configProperties with isClass _x

#

@dreamy kestrel Probably means weaponHolder or weaponHolderSimulated

dreamy kestrel
#

still do not really know what that means, there is no primivite container Holder?

#

if it is only hard objects I can engage, not the worst thing.

brazen lagoon
#

yep thanks @granite sky that worked

granite sky
#

@dreamy kestrel Not really sure what you're asking.

#

If you drop a backpack, it creates a GroundWeaponHolder object and puts it in there.

#

You can't put a vest inside a backpack or anything like that, as far as I know?

#

The "Ground" tab in the inventory is often a composite of a body and the nearest weapon holder.

simple trout
fleet sand
#

Hi guys question i have made this script witch works but i wounder how i can make this to work with dinamicly spawned tanks eather with zeus or with a script?
Basicly how would i update _allTanks array with dinamicly spawend vehicles. I call this script in Init.

private _allTanks = entities "Tank";
{
    _x addEventHandler ["Killed",{
    params["_unit"];
        systemChat format ["Tank destroyed %1",_unit];
        private _pos = getPosASL _unit;
        private _helper = createVehicle ["Land_Tableware_01_napkin_F", [0,0,0], [], 0, "CAN_COLLIDE"];
        private _tankTurret = createVehicle ["Land_Wreck_T72_turret_F", [0,0,0], [], 0, "CAN_COLLIDE"];
        _tankTurret attachTo [_helper,[0,1,0.5]];
        _helper attachTo [_unit,[0,0,1]];
        detach _helper;
        [_helper, [random 100,random 100, random 100]] call BIS_fnc_setObjectRotation;
        _helper setVelocityModelSpace [0,2,20];
    }];
}foreach _allTanks;
tough abyss
#

i want to make my AT JAVELINE to have infinite ammo, but why this script not work "this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}];"

dreamy kestrel
#

thanks...

warm hedge
tough abyss
#

how to fix this - No entry 'bin\config.bin/CfgWeapons.vkbo_01'

warm hedge
#

Remove a bad Mod

tough abyss
#

how to fix wrong animation ?

#

on the left wrong animation but the turret work done, on the right is correct animation but missing mod, i just want to fix my left animation to be like right soldier

warm hedge
#

Use the right vehicle?

tough abyss
#

use left vehicle

#

but animation soldier error like the video

#

how to fix animation soldier on the left

warm hedge
#

It is not an error after all

#

You can try switchMove command to adjust animation tho

tough abyss
#

switchMove on what ?

simple trout
tough abyss
warm hedge
#

No need to make a video about it, we know what you meant

tough abyss
#

i try - this switchMove "RHS_Kornet_Gunner"; nothing happen

warm hedge
#

?

tough abyss
#

the soldier just at the wrong animation again

proper sigil
#

Hey everyone! Could someone advise me on some matter regarding MP scripting?

In editor for MP scenario I placed a trigger with below settings which is supposed to play music to group of players in trigger area when detected:

Type: None

Activation: Any Player

Activation Type: Detected by OPFOR

Repeatable: Yes

**Server Only: **Yes

Condition:

this && allUnits inAreaArray thisTrigger findIf {isPlayer _x} != -1

On Activation:


["AttackingComms"] remoteExec ["playMusic",group _unit];```

**Current behavior:** when player group enters trigger area and is detected by OPFOR music starts playing __to all groups inside trigger area__. When new group enters music starts from beginning for everyone inside trigger.

**Desired behavior:** when player group enters trigger area and is detected by OPFOR music starts playing __only for a group that enters__. Other groups that are inside trigger aren't affected.

So basically I want to avoid situation where one group enters, music starts playing for them but then other group enters and music starts from the beginning for everyone.
little raptor
#

you won't need remoteExec

proper sigil
#

@little raptor Oh boy, I'm so dumb xD, so I would just set "Server only" to "no" and then instead of remoteExec just use plain "playMusic"?

little raptor
#

yes. tho the condition should also be:

this && {player in thisList}
proper sigil
#

So in this case it will play music on every player machine separately?

little raptor
#

yes

proper sigil
#

Thanks good man

proven charm
#

why does the parachute popup when respawing to a ship? Arma seem to think the respawn is at air. is there a way to fix that?

versed belfry
#

Hello everyone :D

Question in regards to this script I am working on:
https://github.com/SkippieDippie/A3A-Event-Standard-Files/blob/Nomas_dev/A3AEventMissionBase/initScripts/initEquipment.sqf

I am running into an issue where lines 118-124 are executing before 73-75 it seems, at least that is what I think.

The uniform items will not be added if the uniform does not have enough space, so when I join the server with a slot that has a filled uniform, nothing gets added but the size does get increased.

This mainly happens the first time I load into the mission.

I've tried using WaitUntil but error said it's not possible to susspend this script.
initEquipment.sqf is being included in initPlayerOnRespawn.sqf

Any idea what could be going wrong?

little raptor
versed belfry
little raptor
#

you can use the same remoteExec callback thing

#

or add a waitUntil and check for maxLoad or something

proven charm
little raptor
#

yes but you should also detect if the unit is actually falling

#

if you do that you can't parachute anymore

proven charm
#

but then I just set that to default again

little raptor
#

you should do it when the unit is falling

#

in that case it's fine

proven charm
#

ok thx

#

hmm doesnt seem to be working for me when I do ```sqf
player setUnitFreefallHeight 100000;

#

the parachute always appears

little raptor
#

where do you put it?

proven charm
#

player addEventHandler ["Respawn"

little raptor
#

put it in object init

#

this set....

proven charm
#

you mean like all playable units init?

little raptor
#

yes. or just make a function with preInit. not sure if it works in MP

proven charm
#

is the point here to give it enough time to apply the effect?

little raptor
#

the point is not giving it any time

#

if you give it any time the unit goes into freefall pose

#

like you do now

#

which is why I just do a perframe EH

#

it's guaranteed to not give the unit any time

#

and its performance impact is minimal or just next to 0

proven charm
#

you mean like ```sqf
addMissionEventHandler ["EachFrame",
{
player setUnitFreefallHeight 100000;

}];```

#

that didnt work...

little raptor
#

where do you put the EH?

proven charm
#

tried in respawn EH and console

little raptor
#

put it in preInit

proven charm
#

same

#

maybe I just delete the parachute, because its only cosmetical problem

versed belfry
proven charm
#

btw is there a function to receive ground z if on ground and water z if on water?

proven charm
dreamy kestrel
#

wow, getting educated on the vocabulary for inventory manager... sure would be nice to know if a uniform, of vest, or backpack, object or class, is a uniform, or is a vest, or is a backpack ... i.e. _b iskindof 'backpack'. but it does not look like I'm gonna have that by its pedigree, i.e. [_b_cfg] call BIS_fnc_configPath, i.e. ["configFile","CfgVehicles","B_Carryall_cbr"].

little raptor
#

for vest and uniforms there are item types and inventory slots

dreamy kestrel
#

thanks. @proven charm no does not have that pedigree, at least not consistently, but I like the config based approach.
of course, besides what the primitives report are various containers, etc.

#

another dumb question, for vests, what do you use as a config displayName?
I have displayName for uniforms, it seems like, but not for vests, or at least not some vests

#

or perhaps just reject any configs that do not have display name? i.e. they are there for scenery only, not for player use?

dreamy kestrel
#

they should I agree, but config viewer showing not all do

little raptor
dreamy kestrel
#

gotcha ok

#

yep scope

little raptor
#

well what is their scope?

dreamy kestrel
#

the ones with display name, seems like 2, others 0 for instance

hallow mortar
#

Things with scope 0 cannot be created in any way, even by script, so they don't need display name and you can ignore them. They are classes used only for config inheritance logistics.

dreamy kestrel
#

ok, thanks... yeah i recall something like that.

#

what's the difference between unitBackpack and backpackContainer, they seem to be returning the same object instance.

warm coral
#

is it possible to globally change a players name through scripting?

warm hedge
#

What name?

warm coral
#

identity name

#

as in the name that will be visible to others and to zeuses

warm hedge
winter rose
#

if setIdentity or setName do not work, nothing will

hallow mortar
#

A player's name cannot be changed in multiplayer, it will always be their profile name. It can be changed in SP but not MP.

winter rose
boreal parcel
#

Im going to create zeus players like so below, but would I need to worry about when the player the curator is assigned to dies?

params["_player"];

private _grp = createGroup sideLogic;
private _module = _grp createUnit [
    "ModuleCurator_F",
    getPos _player,
    "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];",
    [],
    0,
    "NONE"
];
_player assignCurator _module;
_module addCuratorEditableObjects [allMissionObjects "all", true];
_module
little raptor
#

afaik no

#

allMissionObjects "all"
you might want to use a better filter

boreal parcel
ashen ridge
#

Heya armareforger_white
Can i know if an object is original from the map or created with createVehicle, createSimpleObject, etc?

little raptor
little raptor
#

map ones dunno

ashen ridge
#

Thanks

little raptor
#

actually there is a way

#

you can try to move it using setPosWorld. if it doesn't move it's a map obj

ashen ridge
#

I did it with allMissionObjects but this function freezes the game

ashen ridge
#

allMissionObjects return all objects created by scripts.

little raptor
#

well it's not ideal tho

#

why do you even need to know if it's a map obj?

ashen ridge
#

to run code only on original map objects.

little raptor
#

use nearestTerrainObjects then

ashen ridge
#

I will try, thanks.

#

Now i got how this function works, it returns only map objects, right?

little raptor
#

yes

#

use [worldSize/2, worldSize/2] as pos

#

worldSize/sqrt 2 as radius

#

types []

ashen ridge
dreamy kestrel
#

Q: how do you get things like headgear or goggles in terms of objects that may be dropped into respective inventory containers?

granite sky
#

This feels like some sort of basic misunderstanding.

#

_container addItemCargoGlobal [headgear player, 1] works, for example.

dreamy kestrel
#

so handling the STRING is sufficient then

#

also, yes, that is one use case, maybe... I'm thinking more from an arsenal, dropping some bits into a target container.

#

think inventory manager, I've got a list of headgear (or goggles, or whatever), I want to populate the target container, whatever that is, backpack, ammo box, vehicle, whatever.

hallow mortar
#

Yes, addItemCargoGlobal would be how you do that, using the item's classname

dreamy kestrel
#

great, thanks...

granite sky
#

Most items are just that. Strings.

#

They have no attached data.

#

This is why mods like TFAR define 1000 different radios of each type.

dreamy kestrel
#

why or because... 😉 I read you. thank you...

hasty current
#

Does vectorDotProduct normalise A and B before returning the result?

granite sky
#

No.

hasty current
#

Alright, thanks

granite sky
#

If you want a shortcut to the angle between two vectors then vectorCos is faster.

jagged mica
#

is there a way to get if the user is currently controlling his own unit (player) or remote-controlling another unit (specifically zeus remote control)?

proven charm
#

this one "a3\ui_f\data\igui\rscingameui\rscdisplayvoicechat\microphone_ca.paa" ?

#

everything I believe except icons in .ebos

boreal parcel
little raptor
boreal parcel
# little raptor `_module setVariable ["owner", ...]`

would that assign the owner property?
The post is from 2019 but I just found this on the forums

_module set3DENAttribute[ "ModuleCurator_F_Owner", "steam64etc" ];
_module set3DENAttribute[ "ModuleCurator_F_Addons", "All" ];
_module set3DENAttribute[ "ModuleCurator_F_Forced", "1" ];
#

I was thinking of doing this

{
    private _grp = createGroup sideLogic;
    private _module = _grp createUnit [
        "ModuleCurator_F",
        [0,0,0],
        "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];",
        [],
        0,
        "NONE"
    ];
    _module set3DENAttribute[ "ModuleCurator_F_Owner", _x ];
    _module set3DENAttribute[ "ModuleCurator_F_Addons", "All" ];
    _module set3DENAttribute[ "ModuleCurator_F_Forced", "1" ];
} forEach TRA_whitelist;
boreal parcel
#

oh, alrighty ill give your suggestion a shot in just a moment.

boreal parcel
# little raptor `_module setVariable ["owner", ...]`

this doesnt appear to work. I am putting a Steam64ID in the "owner" variable but no dice

{
    private _grp = createGroup sideLogic;
    private _module = _grp createUnit [
        "ModuleCurator_F",
        [0,0,0],
        [],
        0,
        "NONE"
    ];
    _module setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];
    _module addCuratorEditableObjects [allUnits, true];
    _module addCuratorEditableObjects [vehicles, true];
    systemChat _x;
    _module setVariable ["owner", _x];
} forEach TRA_whitelist;
little raptor
#

you mean _x is a string?
also you should probably use the other createUnit syntax

south swan
little raptor
#

yeah you haven't assigned it either

boreal parcel
#

you mean _x is a string?
yes
also you should probably use the other createUnit syntax
but that doesnt return the module object

little raptor
#

you can put everything in its init

#
createUnit [... toString {
  this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];
  this setVariable ["owner", _x];
}]
#

not sure if _x is passed think_turtle it should be tho

boreal parcel
little raptor
#

either way you have to assign it

boreal parcel
#

hmm, then there is no point setting the owner variable right?

little raptor
#

afaik owner must be defined too

#

otherwise it locks you out

south swan
#
[[player], {
  params ["_player"];
  _grp = createGroup sideLogic;
  _new = _grp createUnit ["ModuleCurator_F", [1,1,1], [], 0, "NONE"];
  _new addCuratorAddons activatedAddons;
  _player assignCurator _new;
}] remoteExec ["call", 2];``` is (and was) in production for quite some time for self-assigning zeus ![blobdoggoshruggoogly](https://cdn.discordapp.com/emojis/748124048025714758.webp?size=128 "blobdoggoshruggoogly")
#

although the edge cases may be not tested due to typical missions on that server

boreal parcel
#

hmm alright, doesnt look like owner variable is set there either though.

Any ways ill try it and just assigning in general. Is there an event handler I could use for when the player starts actually playing as a unit for this?

south swan
#

yeah, doesn't seem to survive player death even on listen server

boreal parcel
#

sad, alright ill just use respawn eh then

#

and ill probably respawn players after they join anyway

ruby spade
#

hiya wondering if anyone can help me with scripting and editing current missions by adding scripts to it

south swan
#

BIS_fnc_curatorRespawn function seems to be used for "vanilla" respawn handling. And it adds MPRespawn EH and reassigns curator blobdoggoshruggoogly

granite sky
#

remoteExec has fairly low network priority, I think.

#

remoteExecCall possibly higher?

#

shrugs

#

Might be you have too much guaranteed network traffic in general.

#

And then something's gotta be delayed.

boreal parcel
winter rose
boreal parcel
#

thank you

winter rose
#

recheck your code, the fact that it works well then gets delayed most likely means something is piling in your network queue @boreal parcel

boreal parcel
winter rose
#

(woops, mb)

jade acorn
#

having hard time thinking, how do I attach an object to player that would only follow his position, ignoring the direction?

#

or is there any body selection that does not turn with body, been blindly checking them for attachTo but they all seem to rotate

#

I have an object that has to be always exactly 600m from the player but with attachTo it will always be in front of the player, I want it to just "follow" the xyz coordinates

jade acorn
gaunt tendon
#
[] spawn{
  Fnc_changeNUMBER = {
    params ["_NUMBER"];
    _NUMBER = _NUMBER + 1;
  };
  
  private _NUMBER = 0;
  [] call Fnc_changeNUMBER;
  diag_log _NUMBER;
};

this should log 0 or is my understanding wrong?

winter rose
little raptor
#

yes

jade acorn
# winter rose each Frame setPosWorld?

alright, I have ```sqf
addMissionEventHandler ["EachFrame", {
_posX = ((getPosASL player) select 0) - 300;
_posY = ((getPosASL player) select 1) - 300;
_posZ = 250;

_redCircle setPosWorld [_posX,_posY,_posZ] }];``` and seems to be working

winter rose
jade acorn
#

I was the clueless one

#

now how do I convert the accidentaly achieved 600 meters of distance3d into XYZ coordinates for the setPosWorld command?

#

I really suck at maths

#

well I guess I could just substract

winter rose
#

you could use the alt syntax of getPos then set the Z value, or use sin, cos, angles etc

cobalt path
#

question, is there a way to give a vehicle a variable name after it was spawned in zeus?

hallow mortar
#

If you have a reference to the object then you just assign it like any other variable.
e.g.

_curator addEventHandler ["CuratorObjectPlaced", {
    params ["_curator", "_entity"];
        vehicleVariable = _entity;
        publicVariable "vehicleVariable";
}];```
#

(probably don't actually hardcode global variable assignments in a curatorObjectPlaced EH, that will result in overwriting the variable each time you place a new thing. That's just an example of one way you might get a reference to the object.)

cobalt path
#

Wait isnt
Publicvariable "variablename"; enough?

#

I need to name a specific object

stark fjord
#

do you have access to debug console?

cobalt path
#

Yup

#

Zeus enhanced

#

Well execute module

#

And unit init

stark fjord
#

double click the object, into init field enter MyNewVehicle = _this and make sure big letter on right hand side is set to G then execute

cobalt path
#

Ohh

stark fjord
#

MyNewVehicle will refer to that unit from that point on

cobalt path
#

That easy?

stark fjord
#

G means Global Execute, so this variable will be avalible on all clients, to save yourself some trouble later on

cobalt path
#

Copy

#

Will text it

#

Thx

stark fjord
#

text away

cobalt path
#

Test*

stark fjord
#

test* away

cobalt path
#

10-4

stark fjord
#

4-20

winter rose
#

6-9?

stark fjord
#

ni-ce

drifting copper
#

can someone direct me in direction on how to attach a working ACE_ChemlightEffect_UltraHiOrange to a crate?

Having a bit of a stuck on google

stark fjord
sullen sigil
viscid mauve
#

So, I am trying to figure out which player has the largest number of close players (to later find the center pos of the player squad). Does Anyone have a more efficient idea of how to accomplish this without using nested loops?

{
    private _index = _x;
    private _unitArray = [];
    {
        if (_x != _index) then {
            if (_index distance2D _x < _maxDistance) then{
                _unitArray append [_x];
            };
        };    
    } forEach _units;
    _unit2dArray append [[count _unitArray, _index, _unitArray]];
} forEach _units;```
little raptor
viscid mauve
#

that looks like a faster way to do it, cheers

coarse needle
#

Somebody know a class I could use to removeCuratorEditableObjects for all empty objects?

#

Apparently adding everything civilian adds all the empty objects on the map to the zeus interface, because oh well arma

#

And I wan't do delete that shit

tough nacelle
#

does anyone know what a GIF pre stack size violation is?

granite sky
#

SQF syntax error that it didn't pick up as a syntax error, usually.

#

probably a bracket screwup of some kind.

tough nacelle
#

ill send code

tough nacelle
# granite sky SQF syntax error that it didn't pick up as a syntax error, usually.

`waitUntil {sleep 1; _town = markerColor "ColorEAST"};

_trigger = createTrigger ["EmptyDetector", getMarkerPos _town, true];
_trigger setVariable ["AgiaMarinaTriggerBLU", _trigger];
_trigger setTriggerArea [150, 150, 0, false, 5];
_trigger setTriggerActivation ["WEST SEIZED", "PRESENT", true];
_trigger setTriggerStatements ["this", "(missionNamespace getVariable 'AgiaMarinaFlag') addaction ['Capture Area', {Trigger_Agia = true; publicVariable 'Trigger_Agia';}];", ""];`

#

i havent used waituntil before so could be a basic error

granite sky
#

Not sure what you were aiming for with the waitUntil condition but it doesn't look correct.

#

Maybe markerColor _town == "ColorEAST"

tough nacelle
#

ill give it a try

granite sky
#

what's it actually supposed to do?

tough nacelle
#

so i want a marker that flip flops between colors depending on who controls it

#

thats fixed it thx

granite sky
#

(missionNamespace getVariable 'AgiaMarinaFlag') is equivalent to AgiaMarinaFlag btw

tough nacelle
#

ah thank you

tough nacelle
#

another issue `_town = "AgiaMarina";
_flag = "AgiaMarinaFlag";

//initial town setup
_town setMarkerColor "ColorEAST";

// Add action to flag trigger
{waitUntil {sleep 1; markerColor _town == "ColorEAST"};
_trigger = createTrigger ["EmptyDetector", getMarkerPos _town, true];
_trigger setVariable ["AgiaMarinaTriggerBLU", _trigger];
_trigger setTriggerArea [150, 150, 0, false, 5];
_trigger setTriggerActivation ["WEST SEIZED", "PRESENT", true];
_trigger setTriggerStatements ["this", "(missionNamespace getVariable 'AgiaMarinaFlag')
addaction ['Capture Area',{Trigger_Agia = true; publicVariable 'Trigger_Agia';}];", ""];

// trigger applies changes to marker and flag
_triggerChanges = createTrigger ["EmptyDetector", getMarkerPos _town, true];
_triggerChanges setVariable ["AgiaMarinaFlagChange", _triggerChanges];
_triggerChanges setTriggerArea [0, 0, 0, false, 0];
_triggerChanges setTriggerActivation ["NONE", "NONE", true];
_triggerChanges setTriggerStatements ["Trigger_Agia", "'AgiaMarina' setMarkerColor 'ColorWEST'; ['TaskSucceeded', ['', 'Agia Marina Captured']] call BIS_fnc_showNotification; (missionNamespace getVariable 'AgiaMarinaFlag') setFlagTexture 'flags\west.jpg'", ""];};

{waitUntil {sleep 1; markerColor _town == "ColorWEST"};
deleteVehicle "AgiaMarinaTriggerBLU";
deleteVehicle "AgiaMarinaFlagChange";
_trigger = createTrigger ["EmptyDetector", getMarkerPos _town, true];
_trigger setVariable ["AgiaMarinaTriggerEAST", _trigger];
_trigger setTriggerArea [150, 150, 0, false, 5];
_trigger setTriggerActivation ["EAST SEIZED", "PRESENT", true];
_trigger setTriggerStatements ["this", "'AgiaMarina' setMarkerColor 'ColorEAST'; ", "['TaskFailed', ['', 'Agia Marina Seized']] call BIS_fnc_showNotification;"];};` the action added by addaction is no longer present

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
queen cargo
#

be more precise @coarse needle, what you mean with "empty objects"
because that term could be everything

coarse needle
#

The ones that show in zeus under "empty". So all the objects from the editor from under the "empty" tab.

queen cargo
#

and you want to add them? or to remove em?

#

removing em is fairly simple, just like adding them

high tendon
#
if (headgear player != rhs_altyn && headgear player != rhs_altyn_visordown) then {
    player addHeadgear rhs_altyn;
};

// Add an action to the player
player addAction ["Toggle Faceshield", {
    params ["_unit"];

    // Check the current headgear
    _currentHelmet = headgear _unit;

    // If the current helmet is the Altyn with faceshield up, replace it with the Altyn with faceshield down
    if (_currentHelmet == "rhs_altyn") then {
        removeHeadgear _unit;
        _unit addHeadgear "rhs_altyn_visordown";
    }
    // If the current helmet is the Altyn with faceshield down, replace it with the Altyn with faceshield up
   else if (_currentHelmet == "rhs_altyn_visordown") then {
    removeHeadgear _unit;
    _unit addHeadgear "rhs_altyn";
};

}, [], 0, false, true, "", "(headgear player == 'rhs_altyn') || (headgear player == 'rhs_altyn_visordown')"];

getting an error

Error else: Type if, expected code

not sure what is going on

queen cargo
#

removing those should work with this fancy code

_arr = [];

{
	if(_x isKindOf "CAManBase" || {count crew _x > 0}) then
	{
		_arr pushBack _x;
	};
	false
} curatorEditableObjects _zeusObject;
_zeusObject removeCuratorEditableObjects [_arr, false];```
granite sky
#

You're missing quotes on classnames in the first bit.

#

Also your else syntax is wrong.

#

There's no specific else if construct in SQF, so you have to write stuff like this:

if (condition) then {
  //code
} else {
  if (condition2) then {
    //other code
  };
};
jade acorn
cobalt path
#

I think I am having some sort of basic understanding issue.
I create a vehicle, and than change it name

_vehicle = "Sign_Sphere200cm_F" createVehicle position player;
_vehicle = big_baloon;

But than

big_baloon setObjectTextureGlobal [0, "\A3\Characters_F\Common\Data\basicbody_black_co.paa"];

Nothing happens, and I assume because "big_baloon" was not the name? I dunno

stable dune
#
private _vehicle = "Sign_Sphere200cm_F" createVehicle position player;
_vehicle setObjectTextureGlobal [0, "\A3\Characters_F\Common\Data\basicbody_black_co.paa"];

or if you want to use it local somewhere else

big_baloon = "Sign_Sphere200cm_F" createVehicle position player;

another code/trigger etc

big_baloon setObjectTextureGlobal [0, "\A3\Characters_F\Common\Data\basicbody_black_co.paa"];
cobalt path
#

my question would be, why _vehicle = big_baloon; didnt work?

stable dune
#
big_baloon = _vehicle;
cobalt path
#

it had to be anotherway around? Damn, well I feel stupid

#

[The more you know...⋆]

wary needle
#

player addEventHandler ["FiredMan", {    
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];    
 

  _rock = rocket;   
 _rock attachto [_projectile,[0,0,0]];   
   
}]; 
#

im tring to attach a object to the vls for a rocket script, but i cant seem to get it to work.

exotic flax
#

What are launcher and rocket? Since they are not defined, and _veh isn't even used

wary needle
#

rocket is the object i am attaching

wary needle
exotic flax
#

And does the variable (and object) exist the moment the EH is running?

It might be a good idea to just create a new object the moment the EH fires (inside the code)

wary needle
#

cant create one as firing as the rocket needs to be there sitting

wary needle
#

its an object with rocket in the top above init

exotic flax
#

But you create the object once, and can be attached multiple times (every time someone shoots), which means it only works correctly the first time.

Or never, because the object is not accessible when the EH is fired (it should be, but you never know with Arma)

#

So instead create a new rocket object within the EH and attach that to the projectile

wary needle
#

but i need the rocket to be sitting there aready

#

if i create a new one then there is no giant rocket that lauches

#

it will just spawn in

exotic flax
manic kettle
#

What really helps is that the function is already defined and called, rather than execvm

#

Also there's the 3ms max scheduled scripting per frame... if it goes past its just stopped iirc?
As for direct speed, idk? Never tested...be interested to know

coarse needle
#

Remove

#

I was just wondering what a class would be to remove all the empty objects.

#

tried "empty" and "land"

tough abyss
#

what kind of language is arma's scripting about?

hallow mortar
#

Unscheduled means the code runs right now and will delay the simulation until it's done (this is why suspension is not allowed). Scheduled means the scheduler is allowed to manage its resource usage and limit it to using 3ms per frame at most; the simulation will not be delayed any more than that for each thread.

Stacking up a lot of heavy scheduled scripts running at once can cause slowdown because all those 3ms add up. However, stacking up a lot of heavy unscheduled scripts (or even one particularly bad one) can cause a dramatic lag spike, because the entire game gets paused to wait for it.

molten yacht
#

Hmm. For BIS_fnc_playVideo, do I want to spawn it or call it? I'd like it to loop indefinitely - it's a short video, about 30 seconds. This is what I have sorta pseudocoded up so far:
(In Init of the object, a BriefingScreen or other large TV:)

_video = "images\dnaspin.ogv";
this setObjectTexture [0, _video];

(In Server-Only Trigger)

while {var1 && var2} do
{
  _video call BIS_fnc_playVideo;
// Wiki says that if called, script will wait for video to be over
// before moving on. so I guess we only want the  
// below line only if spawned instead of called?
  sleep video_length_in_ms;
}```
manic kettle
#
call bis_function
Sleep video_length
}```
Simple solution, you could write better using scriptDone  if you want lol
#

You can't suspend (sleep) inside call (in normal scheduled environment) so that's why you want to spawn.

jade acorn
#

I have sqf _ash_post = "#particlesource" createVehicleLocal (position vehicle player); _ash_post setParticleCircle [0, [0,0,0]]; _ash_post setParticleRandom [10, [5,5,0],[0.175,0.175,-0.5],1,0.25,[0,0,0,0.1],1,0.1]; _ash_post setParticleParams [["\A3\data_f\ParticleEffects\Hit_Leaves\Leaves_Green.p3d", 1, 0, 1], "", "SpaceObject", 1, 7, [0, 0,5], [0, 0, -0.5], 2, 10.2, 7.9, 0.1, [0.1,1,0.5], [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], [0.08], 1, 0.5, "", "", vehicle player]; _ash_post setDropInterval 0.02; for simulating a falling ash, my problem is that this effect looks good only when player is standing, once he starts to move the particles will show up behind him. I tried changing the particleCircle to something bigger but it makes the particles to fly around or go up instead of slowly dropping like it's now

#

do I have to assign multiple particlesources around him? Or how do I change the area without breaking the "negative" velocity?

hallow mortar
hallow mortar
jade acorn
#

yes it doesn't have to be just around a single unit necessarily, I'll try playing with bis_fnc_setRain then, thanks

jade acorn
#

uh there is an issue, there is no way to keep the "dry" footsteps sound meowsweats

candid sun
#

it's SQF

#

which translates to czech for "where's my frame rate"

jade acorn
snow pumice
#

Why can't i add an addaction to map / terrain objects?
Is there some kind of workaround maybe?

snow pumice
little raptor
#

then add the action to yourself

#

and use its condition to detect if player is looking at an ATM

snow pumice
#

thats the current solution, i wanted to see if there is any way to add this on an map object

little raptor
#

no you can't add actions to map objects

#

you can create an object on top of them and add the action to those but that's a worse workaround

snow pumice
little raptor
#

you can't delete map objs either

pulsar bluff
#

the catch is that adding action to player comes with a price. condition evaluates always, so adding too many impact performance

#

speaking of which, an addAction alt syntax with no condition evaluation would be handy

drifting copper
#

So I have Chem = "Chemlight_yellow" createVehicle [0, 0, 0]; and works as intended in creating the chemlight but can not seem to get a ACE Chemlight to work as I am looking for the HiOrange specifically.

Can someone please advise on how to create a "used and glowing" ACE chemlight with the above method?

winter rose
#

you will need ACE chemlight classes, most likely findable in their doc

little raptor
#

what is the problem?

#

you create them but they have no light?

drifting copper
little raptor
#

try triggerAmmo _chem

drifting copper
#

Also,, discord is on drugs, messages sending twice

proven charm
#

is it possible to detect if zeus is open?

little raptor
proven charm
#

ty

little raptor
#

findDisplay 312 I think

jade acorn
#

is rainbow something tied to map, engine or can it be hidden by a script?

#

it shows up with rain set to 1 and overcast to 0.51, I would rather not have it without doing overcast 1 (because I still need the sun)

little raptor
#

read the page on setRainbow

#

wait no that's not the page meowsweats

#

ah nvm it is 😅

#

It should be known that this command does not create a rainbow in all conditions. As in real life, the rainbow can only appear after rainfall and opposite of the sun when it is low on the horizon.

high tendon
#
// Function to toggle the faceshield
fn_toggleFaceshield = {
    params ["_unit"];

    // Check the current headgear
    _currentHelmet = headgear _unit;

    // If the current helmet is the Altyn with faceshield up, replace it with the Altyn with faceshield down
    if (_currentHelmet == "rhs_altyn") then {
        removeHeadgear _unit;
        _unit addHeadgear "rhs_altyn_visordown";
        _unit camSetDirection [0, 0, -1]; // Set camera direction to limit field of view
    } else {
        // If the current helmet is the Altyn with faceshield down, replace it with the Altyn with faceshield up
        if (_currentHelmet == "rhs_altyn_visordown") then {
            removeHeadgear _unit;
            _unit addHeadgear "rhs_altyn";
            _unit camSetDirection [0, 0, 0]; // Reset camera direction to default
        };
    };
};

// Function to apply the "Toggle Faceshield" addaction
fn_applyToggleFaceshieldAction = {
    params ["_unit"];

    // Add the "Toggle Faceshield" addaction to the player
    _unit addAction ["Toggle Faceshield", {
        [_this select 0] call fn_toggleFaceshield;
    }, [], 0, false, true, "", "(headgear player == 'rhs_altyn') || (headgear player == 'rhs_altyn_visordown')"];
};

// Apply the addaction to the player initially
[player] spawn fn_applyToggleFaceshieldAction;

// Create a respawn event handler to reapply the addaction after respawning
player addEventHandler ["Respawn", {
    [player] spawn fn_applyToggleFaceshieldAction;
}];

Ive been staring at this for too long and need another set of eyes

little raptor
#

what's the problem?

high tendon
#

im getting an error is says

error missing ; route/of/my/file line12

little raptor
#

no such command

hallow mortar
#

You're probably thinking of camSetDir but I'm highly dubious that it does anything for non-scripted cameras (i.e. the player's eyes)

high tendon
#

yea i am trying to limit the players view when the faceshield is toggled down

hallow mortar
#

I don't quite see how camSetDir would do that even if it did work on non-scripted cameras. It changes where the camera is pointing, not its FoV.

high tendon
#

it was a suggestion given by a friend but i see your point now. I think it would probably be easier to somehow route an image

cosmic lichen
#

Is there a way to define what kind of loading screen is shown?

#

I am asking because I got a weird issue.

#

If I run a script that shows a loading screen in Eden Editor in a fresh mission. It shows a loading screen without progressbar and with the Eden Editor logo.

#

I can do that as often as I want, I always get the same screen.

#

However, if I run

"item" spawn BIS_fnc_exportCfgWeapons
I suddenly get the mission loading screen with the small image in the center and a progress bar.

#

Once that function was executed, my function uses the same screen

#

I check the code and both function create the loading screen the same way (startLoadingScreen [""])

#

This is the screen that is intially shown

proven charm
cosmic lichen
#

It says description.ext only sadly.

#

Ah ok. Maybe I can plug in one of the other default loading screens.

snow pecan
#

^lol

manic flame
#

dumb question, where can i find the rpt file again?

stable dune
#

!rpt

wicked roostBOT
#
Arma RPT

Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.

To get to your RPT files press Windows+R and enter %localappdata%/Arma 3

Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files

To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.

manic flame
#

danke

boreal parcel
#

when opening the map via openMap is it possible to "customise" the map? like make it not full screen, change the gui a bit, remove the top left tabs?

granite sky
#

No. You can make your own control with a map in it though.

#

Not really a hard no because you can hack displays up a bit, but it sounds like you'd be better off working from a map control there.

boreal parcel
#

Most likely yeah, planning on making a halo jump GUI.

drifting sky
#

Can I use "unitPos" to get the last stance a unit was commanded to take? I presume "setUnitPosWeak" does not change the value of unitPos.

ashen ridge
#

On unscheduled code forEach is limited to the first 10000 elements of an array?

still forum
#

no

ashen ridge
#

👍

stark fjord
#

While has/had such limitation afaik

ashen ridge
#

Fixed by using one while inside a while, now the limit is 10000^2 😬

stark fjord
#

That could take a while

ashen ridge
#

lol

#

It's a code to pull stuff from a database.

#

15000 lines

#

If scheduled, it take ages.

#

At the begining of the server. So no problem if it has some freezes.

sullen sigil
#

is it possible to have more than just BLU/OP/INDFOR? i.e 4+ way conflicts? thonk

ashen ridge
#

One for each player? blobcloseenjoy

#

I believe no.

sullen sigil
#

i've seen it done somewhere before

ashen ridge
#

Arma 3 just can't do anything we want, this is one thing.

granite sky
#

Basically you get three and a half sides.

sullen sigil
#

i presume that's to do with civilian

granite sky
#

Yeah, there are limitations about what you can do with civilian.

sullen sigil
#

ya i'd guessed

#

is there no way to make a blufor squad attack another blufor squad then? thonk

granite sky
#

welll...

ashen ridge
#

They will attack even the ones in their own group.

granite sky
#

You can technically have a blufor squad with redfor in it. And then they'll all shoot each other.

#

Like they detemine target side with side group _unit and their own side with side _unit.

sullen sigil
#

mm, wanting to have multiple indfor factions not friendly to one another against blufor and opfor but looks like it's not possible?

sullen sigil
granite sky
#

Old Arma weirdness. If you create units in a group, their side remains default for the unit. If you move units into a group, their side changes to the group side.

#

Maybe you can scam something with sideEnemy.

#

but I think that's going to be mass FF

sullen sigil
#

don't sideEnemy also attack sideEnemy though?

granite sky
#

probably yes.

sullen sigil
#

yeah probably not a very useful indfor faction if they're all killing each other 😅

#

wonder how antistasi plus does the enemy guerilla faction then actually thonk

#

though idk if those are friendly to anybody

granite sky
#

They're probably occ sided with different gear.

sullen sigil
#

haven't played antistasi plus so don't know if they're occ friendly

#

sideLogic doesn't work either, not even with sideLogic setFriend [blufor,0]; 😦

little raptor
little raptor
#

they're "very strong"

little raptor
sullen sigil
#

even though i hate that workaround it seems to be the only one after googling around

granite sky
#

wait, what's the workaround?

sullen sigil
#

just not doing it and saying that theres other sides

#

so not really a workaround at all

#

just gaslighting people

granite sky
#

You got me :P

#

was imagining some magical config feature

sullen sigil
#

i damn wish

#

tried every side that i can assign with no dice

#

not even like you can just flip the side the unit is on either

tough abyss
#

SQF:

_a = []; _a pushBack _a;

Error in expression <_a = []; _a pushBack _a; _a>
   Error position: <pushBack _a;>
   Error 37943744 elements provided, 39311856 expected
violet prairie
#

The ace interact pip just doesn't show up on the object

boreal parcel
sullen sigil
#

my problem is maintaining some sort of squad cohesion while doing that though
course, i could always run a loop to make all renegade ai forget about "friendly" ai but they'd still be running around like headless chickens if you were lucky

boreal parcel
#

Didnt arma have a feature where if you shot too many friendly forces you would be considered an enemy? same for ai?

#

or was that arma 2

granite sky
#

@violet prairie This line needs a terminating semicolon:
publicVariable "(IDENTIFIER)triggered"

violet prairie
#

sorry for bothering yall with this

violet prairie
granite sky
#

You haven't posted the error or the actual code (only some two-file source text full of placeholders).

violet prairie
granite sky
#

You lost an opening bracket on line 27.

violet prairie
#

for _myAction?

granite sky
#

Computer1, 0, ["ACE_MainActions"], _myAction] call ace_interact_menu_fnc_addActionToObject;

#

should be [Computer1, 0, ["ACE_MainActions"], _myAction] call ace_interact_menu_fnc_addActionToObject;

violet prairie
#

OH

#

OHHHH

#

THANK YOU

#

You're a lifesaver

#

thank you so much

#

new to this

sullen sigil
candid sun
#

lolwut, is that real?

tough abyss
#

Try it

candid sun
#

brb trying it

ashen ridge
candid sun
#

Error in expression <_a = []; _a pushBack _a;>
Error position: <pushBack _a;>
Error 31979968 elements provided, 33348080 expected

#

wow

#

how do you do the code tags anyway?

tough abyss
#

triple ` at start and end

candid sun
#

thanks

tough abyss
sullen marsh
#

You can use inline with two backticks as well

tough abyss
#

inline<hw>

#

: /

sullen marsh
#

backticks

#

`

#

them

tough abyss
#

Oh, yes

#

test

#

test

#

test

sullen marsh
#

test

#

or one backtick apparently

boreal parcel
#

how would I go about getting clicks on the MapControl I am creating here:

/* Open Map for player */
private _ctrlMap = _display ctrlCreate ["RscMapControl", -1]; 
_ctrlMap ctrlMapSetPosition [0.276875 * safezoneW + safezoneX, 0.234 * safezoneH + safezoneY, 0.44625 * safezoneW, 0.476 * safezoneH];
candid sun
#

i love markdown

boreal parcel
#

I actually figured that out just now, next question is how do I translate _mouseX and _mouseY to actual world position? (Height isnt needed)

_ctrlMap ctrlAddEventHandler['MouseButtonClick', {
    systemChat (str _this);
    params[ "_map", "_button", "_mouseX", "_mouseY" ];
}]
tough abyss
#

quote

#

Hmm.

#

bb code must die. markdown for life

candid sun
#

markup pays my bills so i have no love for markdown

sullen marsh
#

Ok so it's kind of markdown

boreal parcel
#

solved that as well

_ctrlMap ctrlAddEventHandler['MouseButtonClick', {
    params[ "_map", "_button", "_mouseX", "_mouseY" ];
    private _worldCoords = _map ctrlMapScreenToWorld [_mouseX, _mouseY];
    private _worldX = _worldCoords select 0;
    private _worldY = _worldCoords select 1;

    player setPos [_worldX, _worldY, 1000];
}]
west portal
#

It's my first time making a mission and I'm trying to find out how I could detect if a trigger is activated or not that activates a different one. Ex: trigger if a vehicle is not alive and don't trigger if vehicle is alive. I know that I can use !alive to find if the vehicle is destroyed, but I only know triggerActivated to use if conditions are met. Is there anything else I could use to detect if the trigger isn't activated?

tough abyss
#

Yeah. This is a chat after all. So no point in having headers and tables and stuff

sullen marsh
#

Lists would have been cool

tough abyss
#
  • one
  • two
  • three
candid sun
#
  1. a
  2. b
#

lol yeah shift-enter

sullen marsh
#

Quotes as well would have been cool

#

wtb: quotes

tough abyss
#

There definitely is room for improvement in discord

rich bramble
#

Af fascinating as this discussion is, I'd like to ask a scripting question :P

tough abyss
#

go ahead

candid sun
#

does anyone know if there's a way to get chat content from arma? like tap in to what people are saying in global/direct/etc?