#arma3_scripting

1 messages · Page 171 of 1

glass nest
#

he just needs to hide the fences, no code expects this result, except for the visual one

tulip ridge
pallid palm
#

nice nice i see awsome m8

tough abyss
#

So no real way to influence it with scripting.

pallid palm
#

see i told you guys Dart is a super pro dam Dart your awsome m8

tough abyss
#

Sadly

pallid palm
#

insteresting to say the least

queen cargo
#

just play it smart ^^ then you can edit everything you want

#

#

and i would love to see a bed after 32 hours ...

#

fucking 32c3 ....

tough abyss
#

Huh, is some one marathon streaming or what?

little raptor
#

Well yes. That's also what I said. Terrain objects without a type aren't included. But there are also houses and other terrain objects which do have types

pallid palm
#

your a good guy also @little raptor

#

you helped me also alot

#

oh btw my PC is running like fast as hell WooHoo Arma3

queen cargo
fiery gull
#

Is there any way to find out why my extension is crashing arma 3?
the moment callextension gets called for the first time arma just crashes with no logs and no crash dumps

little raptor
#

Did you attach a debugger to see where it crashes?
Or do you mean the game crashes before reaching your extension?

proven charm
#

In which language is the extension written?

fiery gull
fiery gull
#

seem to have gotten it working, no clue what I changed KEK
Now we just hope it doesn't break

thorny osprey
#

Can't figure this one out: how to clear the "STOP" state from AI units, by script, after giving them a STOP order from the UI. I'm working on a custom "Rush" command that I want to override cases where the AI units are stopped.

hot sapphire
#

HEllo Arma3 coders 🙂 Anyone coding SQF with VSCode and plugin SQF Language By Armitex and SQFLint for parse erros and debug rpt files? I want talk with someone using this setup in Visual Studio Code and find the right parse error parameter Plugins setup. Thanks in advanced for who will answer and wish happy coding to everyone!

round hazel
#

I have a spaceship that is animated to 'fly' across the map. I want units on the ground within 1-2km to hear the Engine Noise effect in 3D. Unfortunately, I cannot seem to change the settings to hear the noise past 40-50m. Any ideas? All relevant details are above/below! (Spaceship object, Sound init script, Trigger script)

hallow mortar
#

Also playSound3D doesn't attach to and follow the source object, it just stays at the initial position. You're probably looking for say3D.

round hazel
#

My implementation of 'playSound3D' was my last attempt based on documentation and my own devices 😦

hallow mortar
#

Did you try specifying the max distance in the say3D call itself, rather than just using the CfgSounds definition?

#
_object say3D ["soundName", 2000, 1, false, 0, true];```
round hazel
#

Thank you! Is the 2000 value the volume or maxDistance? Also, being multiplayer, do I not require remoteExec?

hallow mortar
#

Whether you need remoteExec depends on the trigger. I can't see the rest of it so I don't know for sure.
If it's a Server Only trigger then you do need remoteExec. If it's not a Server Only trigger then you might need remoteExec, depending on the condition, but it's likely you don't.

#

Be careful with non-Server Only triggers, because they exist separately on every machine. Anything that's Global Effect in the trigger will be duplicated by the number of machines where the condition is satisfied. e.g. if it's a BLUFOR Present, that's a condition that will be satisfied on every machine at once, and every machine will activate their own local copy of the trigger. This is OK for local-only stuff, but anything that gets broadcast will be broadcast by every machine.
Also, JIP machines have their own copy of the trigger too, fresh and ready to go when they connect, which will cause another activation even if other machines have already activated theirs.

round hazel
#

I've tested it and it worked, so thank you very much! The trigger is evaluated on Server, thus do I need to include the remoteExec? And if so, would you possibly point me in the right direction? I'm new to scripting, making my first mission, so I'm sorry for my uselessness in the matter

hallow mortar
#

If the trigger is set to Server Only, you do need the remoteExec, because say3D is Local Effect - without it, only the server would hear the sound. remoteExec will make the server tell all the other machines to do the say3D as well.
remoteExec is formatted like this:

_leftArg command _rightArg;
[_leftArg, _rightArg] remoteExec ["command", _targets, _jip];```
Now we don't need to worry about the targets and JIP arguments. They're optional, and the defaults (all machines, no JIP handling) are exactly what we need. So:
```sqf
_object say3D ["sound", 2000, ... ];
[_object, ["sound", 2000, ... ]] remoteExec ["say3D"];```
round hazel
#

Ah, okay, so to format remote exec, target object comes first, then the parameters of the function, then remote Exec command. Thank you!

tulip ridge
#

It's [_leftArgs, _rightArgs] remoteExec ["functionOrCommand", _target]

hallow mortar
#

(say3D's a command, not a function - sounds pedantic but the difference matters)
In this case it's "target first, then other arguments" but that's because say3D is laid out like that already. It's left, right regardless of what left and right actually are; position is what matters.

steel geode
#

Can anyone help me with UnitPlay? I'm using the code below in an sqf, and it attempting to activate it via execVM "go.sqf";

_Unit1fire = [];

_Unit1replay = [Unit1, _Unit1move] spawn BIS_fnc_UnitPlay;
[Unit1, _Unit1fire] spawn BIS_fnc_UnitPlayFiring;```
Upon calling any trigger for execution, nothing happens. Can anyone tell me what I'm doing wrong?
little raptor
#

To make sure your script is running at all, put a hint or systemChat at the top.
If it does run, I guess the issue is related to unitPlayFiring. Remove it

grim cliff
#

any ideas on how i could get the Init code of a 3den editor object into a hashmap?

warm hedge
#

Why? Is my first question

grim cliff
# warm hedge Why? Is my first question

because i am NAIVE and BARBARIC.

but this may clue you in:

i have this:

keysarray = []; 
objectdetails = []; 
 
{ 
private ["_pos","_dir","_object"]; 
_object = typeOf _x; 
_pos = getposatl _x; 
_dir = getdir _x;
_hascode = tostring ((get3DENSelected "object" select 0) get3DENAttribute "init");
objectdetails pushback [_object,_pos,_dir,_hascode]; 
keysarray pushback _foreachindex; 
} foreach get3DENSelected "object"; 
myhashmap = keysarray createHashMapFromArray objectdetails;

but all i get in return is this:

warm hedge
#

I am asking why you need, not how you are naive you say

#

And you already done it

grim cliff
#

right.... it would appear that way... but:
on one object i get what i need...

warm hedge
#

What are you even trying, is my next question

grim cliff
#

to make POI prefabs for my server

warm hedge
#

Okay, let me rephrase. What do these codes supposed to behave/achieve

grim cliff
#

[classname, position, direction, event handler code]

warm hedge
#

Okay, let me rephrase once again. What am I supposed to understand from your last picture

steel geode
grim cliff
#

well it works for one object but for many every value in the [key,[value]] pairs comes out as ""

warm hedge
#

What one object, what part of the picture confirms something is not working

grim cliff
# grim cliff right.... it would appear that way... but: on one object i get what i need...

in the picture at the bottom hascode returns the code from the init field of the object
but when done on large scale, everything is just""

[[1,[""]],[128,[""]],[136,[""]],[148,[""]],[156,[""]],[160,[""]],[172,[""]],[180,[""]],[184,[""]],[32,[""]],[34,[""]],[37,[""]],[39,[""]],[40,[""]],[43,[""]],[45,[""]],[46,[""]],[47,[""]],[49,[""]],[51,[""]],[52,[""]],[54,[""]],[57,[""]],[58,[""]],[60,[""]],[64,[""]],[68,[""]],[74,[""]],[78,[""]],[80,[""]],[86,[""]],[90,[""]],[92,[""]],[94,[""]],[98,[""]],[102,[""]],[104,[""]],[108,[""]],[114,[""]],[116,[""]],[120,[""]],[131,[""]],[143,[""]],[151,[""]],[159,[""]],[167,[""]],[175,[""]],[179,[""]],[183,[""]],[0,[""]],[142,[""]],[150,[""]],[154,[""]],[166,[""]],[174,[""]],[178,[""]],[71,[""]],[75,[""]],[77,[""]],[83,[""]],[87,[""]],[89,[""]],[93,[""]],[97,[""]],[99,[""]],[101,[""]],[105,[""]],[111,[""]],[113,[""]],[117,[""]],[123,[""]],[127,[""]],[9,[""]],[11,[""]],[12,[""]],[14,[""]],[18,[""]],[19,[""]],[21,[""]],[22,[""]],[24,[""]],[25,[""]],[28,[""]],[31,[""]],[129,[""]],[137,[""]],[157,[""]],[161,[""]],[181,[""]],[3,[""]],[6,[""]],[7,[""]],[132,[""]],[140,[""]],[144,[""]],[152,[""]],[164,[""]],[168,[""]],[176,[""]],[33,[""]],[35,[""]],[36,[""]],[38,[""]],[41,[""]],[42,[""]],[44,[""]],[48,[""]],[50,[""]],[53,[""]],[55,[""]],[56,[""]],[59,[""]],[61,[""]],[62,[""]],[63,[""]],[66,[""]],[70,[""]],[72,[""]],[76,[""]],[82,[""]],[84,[""]],[88,[""]],[96,[""]],[100,[""]],[106,[""]],[110,[""]],[112,[""]],[118,[""]],[122,[""]],[124,[""]],[126,[""]],[135,[""]],[139,[""]],[147,[""]],[155,[""]],[163,[""]],[171,[""]],[130,[""]],[134,[""]],[138,[""]],[146,[""]],[158,[""]],[162,[""]],[170,[""]],[182,[""]],[65,[""]],[67,[""]],[69,[""]],[73,[""]],[79,[""]],[81,[""]],[85,[""]],[91,[""]],[95,[""]],[103,[""]],[107,[""]],[109,[""]],[115,[""]],[119,[""]],[121,[""]],[125,[""]],[8,[""]],[10,[""]],
etcetera 
#

on a single object it actually returns the code though.

[[0,["this addEventHandler [""handledamage"",{
params [""_unit"", ""_selection"", ""_damage"", ""_source"", ""_projectile"", ""_hitIndex"", ""_instigator"", ""_hitPoint"", ""_directHit"", ""_context""];
_olddamage = _damage;
switch (_projectile) do
{
case ""DemoCharge_Remote_Ammo"": {_damage = _damage+0.5};
case ""SatchelCharge_Remote_Ammo"": {_damage = _damage+1};
default {_damage = getDammage _obj};
};
hint format [""%1,\n%2,\n%3,\n%4"",_projectile,_olddamage,_damage,getDammage _unit];

_damage;
}];"]]]```
warm hedge
#
_hascode = tostring ((get3DENSelected "object" select 0) get3DENAttribute "init");```Because it is not referencing to `_x`?
grim cliff
#

im pushing it into _y?

warm hedge
#

I see no _y reference there even

grim cliff
#

this is to create the hasmap. im not using foreach alternate syntax
i want to pack all the relevant information into the hashmap so i can put it into an array in a different mission and run a loop that will iterate through and create the POI without having to do this:

stable dune
#

it works with

_hascode = ((get3DENSelected "object" select 0) get3DENAttribute "init");
#

its string already.

warm hedge
grim cliff
#
keysarray = []; 
objectdetails = []; 
 
{ 
private ["_pos","_dir","_object"]; 
_object = typeOf _x; 
_pos = getposatl _x; 
_dir = getdir _x;
hascode = (_x get3DENAttribute "init");
objectdetails pushback [_object,_pos,_dir,hascode]; 
keysarray pushback _foreachindex; 
} foreach get3DENSelected "object"; 
myhashmap = keysarray createHashMapFromArray objectdetails; 
myhashmap;```

there it is. im sorry.
stable dune
#
keysarray = []; 
objectdetails = []; 
 
{ 
private ["_pos","_dir","_object"]; 
_object = typeOf _x; 
_pos = getposatl _x; 
_dir = getdir _x;
_hascode = _x get3DENAttribute "init" select 0; //return array
objectdetails pushback [_object,_pos,_dir,_hascode]; 
keysarray pushback _foreachindex; 
} foreach get3DENSelected "object"; 
myhashmap = keysarray createHashMapFromArray objectdetails;
myhashmap
[[0,["C_Offroad_01_repair_F",[6766.78,4493.62,-0.000293255],0,"systemChat ""hello"";
hint ""test"";"]]]

if you want string of init

grim cliff
#

sorry if i frustrated you @warm hedge

warm hedge
#

I'm not even asked you to say sorry even

grim cliff
#

?

#

so im stuck again. i was trying to get this to work earlier so i took out the if statement and the nilstring var, and now i get nothing where the init string should be.

keysarray = []; 
objectdetails = []; 
nilstring == "";
{ 
private ["_pos","_dir","_object"]; 
_object = typeOf _x; 
_pos = getposatl _x; 
_dir = getdir _x;
objectdetails pushback [_object,_pos,_dir]; 
_hascode = (_x get3DENAttribute "init" select 0);
if (!(_hascode == nilsting)) then 
{objectdetails pushback _hascode;},{}; 
keysarray pushback _foreachindex; 
} foreach get3DENSelected "object"; 
myhashmap = keysarray createHashMapFromArray objectdetails; 
myhashmap;
warm hedge
#

nilstring is undefined

grim cliff
#

shouldnt the foreach loop inherit from the scope it was executed from? so line 3?

warm hedge
#

== is not declare

little raptor
#

Also can you show the first few elements of your capture data?

stable dune
warm hedge
#
if (!(_hascode == nilsting)) then 
{objectdetails pushback _hascode;},{}; 
keysarray pushback _foreachindex; ```Prisoner asked about this chunk of your code
little raptor
grim cliff
#

that would be the else code block.

grim cliff
stable dune
#
If (true) then {
 // To true stuff 
} else {
 //Do false stuff
};
little raptor
grim cliff
grim cliff
little raptor
grim cliff
grim cliff
little raptor
#

ok

grim cliff
#

my pc after running code full of bugs i unknowingly put in there:

#

so if i run this the values of the hashmap that should have a 4th element are instead replaced with the contents of _hascode why?

keysarray = []; 
objectdetails = []; 
nilstring = "";
{ 
private ["_pos","_dir","_object"]; 
_object = typeOf _x; 
_pos = getposatl _x; 
_dir = getdir _x;
objectdetails pushback [_object,_pos,_dir]; 
_hascode = (_x get3DENAttribute "init" select 0);
if (!(_hascode == nilstring)) then 
{objectdetails pushback _hascode;} else {}; 
keysarray pushback _foreachindex; 
} foreach get3DENSelected "object"; 
myhashmap = keysarray createHashMapFromArray objectdetails; 
myhashmap;
#

29 is good, 30 is just the string:

[29,["Land_Mil_WallBig_4m_lxWS",[23234.6,18699,2.38419e-07],179.946]],[30,"this addEventHandler [""handledamage"",{
params [""_unit"", ""_selection"", ""_damage"", ""_source"", ""_projectile"", ""_hitIndex"", ""_instigator"", ""_hitPoint"", ""_directHit"", ""_context""];
_olddamage = _damage;
switch (_projectile) do
{
case ""DemoCharge_Remote_Ammo"": {_damage = _damage+0.5};
case ""SatchelCharge_Remote_Ammo"": {_damage = _damage+1};
default {_damage = getDammage _obj};
};
hint format [""%1,\n%2,\n%3,\n%4"",_projectile,_olddamage,_damage,getDammage _unit];

_damage;
}];"]```
#

this works though:

keysarray = []; 
objectdetails = []; 
nilstring = "";
{ 
private ["_pos","_dir","_object"]; 
_object = typeOf _x; 
_pos = getposatl _x; 
_dir = getdir _x;
 
_hascode = (_x get3DENAttribute "init" select 0);
if (!(_hascode == nilstring)) then 
{objectdetails pushback [_object,_pos,_dir,_hascode];} else {objectdetails pushback [_object,_pos,_dir];}; 
keysarray pushback _foreachindex; 
} foreach get3DENSelected "object"; 
myhashmap = keysarray createHashMapFromArray objectdetails; 
myhashmap;
#

can pushback not be used with a single element?

stable dune
# grim cliff this works though: ```sqf keysarray = []; objectdetails = []; nilstring = ""; ...

You could do that easier.

myHashMap = createHashmap;
{ 
    private ["_pos","_dir","_object"]; 
    _object = typeOf _x; 
    _pos = getposatl _x; 
    _dir = getdir _x;
    _hascode = (_x get3DENAttribute "init" select 0);
    private _content = [_object,_pos,_dir];
    if (_hascode != "") then 
    {
        _content pushback _hascode;
    };
    myHashMap set [_foreachindex,_content]; 
} foreach get3DENSelected "object"; 
myHashMap
frank lynx
stable dune
frank lynx
hallow mortar
#

It's hard to make an SQF script that's actually dangerous, since they can't control anything outside the game without an extension (you should be very careful installing extensions for this reason). Doesn't guarantee the scripts are good though.

foggy stratus
#

I just discovered that my SOG AI mod initialization code never runs if the workshop mission includes an Intro mission. When I look at the .RPT file I see my mod initialization script is ran for the Intro mission (where it is not needed), and never runs for the actual mission that starts after Intro concludes. This is the config.cpp entry that runs my initialization script for my mod:

#

class CfgFunctions { class JBOY { class JBOY_sogAI { class sogAI_init { file = "\SOG_AI\JBOY\init_sogai.sqf"; postInit = 1; }; }; }; };

#

How do I ensure that my mod init code runs for main mission when the mission includes an Intro?

vocal chasm
#

“VillageThree” SetMarkerAlpha 0;
It gives me the error that there is an invalid number. dunno why, anybody in here knows?

#

its code within a trigger

faint burrow
#

Send the error message from RPT-file.

hallow mortar
#

Incorrect quote characters

#

You have to use ", not the fancy start/end ones

vocal chasm
faint burrow
#

Most likely yes, unless this line is typed manually.

hallow mortar
faint burrow
#

The same for me, but "there is an invalid number" message asked me to request the full error message.

drifting portal
#

is it still not possible to make a player look (aim) at a certain position?

hallow mortar
faint burrow
#

Anyway, the line could have been typed manually, but everything in the code could have been correct.

drifting portal
#

Trying to make a Dead Eye script for singleplayer

past pollen
hallow mortar
#

Make sure you've accepted the #rules . Some Discord privileges are locked behind that for spam prevention.

past pollen
#

I thought I did, as I thought you had to previous to posting

hallow mortar
#

Well, double-check; you don't have the acknowledged-rules role.

fair drum
#

Add some draw3D to simulate some accuracy circles on enemies on the screen, etc.

hallow mortar
#

Just automatically kill the player after they activate Deadeye, before they can shoot. It's accurate to the source material and you don't have to deal with the aiming hmmyes

split oxide
#

remoteExec questions if anyone knows:

  • Does targeting just the server only send a packet to the server?
  • Does targeting a client from the server only broadcast to the one client?
  • Does targeting a client from a client only go to the client (even if it has to pass through the server)?
  • Does targeting an object broadcast to broadcast everywhere and then is evaluated where it's local, or some other method to ensure something happens where an object is local?
fair drum
#

Also, if say you remote exec something that already meets the local requirements, nothing is broadcast and it runs it locally.

split oxide
#

Thanks

steel geode
# little raptor What is unit1?

Unit1 is a UH-60 from the RHSUSAF mod.

_Unit1move = [[[5,[2348.07,1420.19,5.08734],[-0.969117,-0.246602,-0.000264401],[-0.000256384,-6.46148e-05,1],[-0.000202733,-9.72703e-05,-0.000468135]]...

grim cliff
#

how can i tel if a player has their inventory open via displayctrl

dusk gust
sharp grotto
#

For helis with turrets this will report "" back if you use the "manual fire" action as driver/pilot.

currentMuzzle driver vehicle player```

It works for the Pawnee but not for the Blackfoot. 
Any alternative to get the muzzle?
warm hedge
drifting portal
#

because it will look weird when the fire towards the second enemy but it kills the first enemy (because I only edited the bullet trajectory) or fire on a wall but the enemy is on the building

south swan
steel geode
spring escarp
#

i need a script for a trigger that changes a players side to independent

#

ive been trying all kinds of things but i cant seem to get it to change my side

warm hedge
#

You can't

spring escarp
#

i was able to with another script but it was changing every player

warm hedge
#

?

spring escarp
#
0 = [] spawn {
  while {true} do {
    {
      call {
        if (_x inArea trigWEST) exitWith {
          if (side (_x getVariable ["actualGrp",grpNull]) != WEST) then {_x setVariable ["actualGrp", createGroup WEST]};
        };
        if (_x inArea trigEAST) exitWith {
          if (side (_x getVariable ["actualGrp",grpNull]) != EAST) then {_x setVariable ["actualGrp", createGroup EAST]};
        };
        if (side (_x getVariable ["actualGrp",grpNull]) != CIVILIAN) exitWith {
          _x setVariable ["actualGrp", createGroup CIVILIAN];
        };
      };
      if (side _x != side (_x getVariable "actualGrp")) then {
        _oldGrp = group _x;
        [_x] joinSilent (_x getVariable "actualGrp");
        if (count units _oldgrp == 0) then {deleteGroup _oldGrp};
      };
    } forEach allPlayers;
    sleep 2;
  };
};
warm hedge
#

Well join or joinSilent etc can be a workaround indeed

spring escarp
#

would setSide not work?

south swan
warm hedge
#

setSide is not even a command for that

spring escarp
#

im playing around with the command but its not really working idk how to use it properly XD

south swan
#

player is not a location

warm hedge
#

Even BIKi clearly states it

spring escarp
#

would this work then?

[this] joinSilent createGroup EAST;
warm hedge
#

Maybe

spring escarp
#

just tried it it didnt work

warm hedge
#

Maybe because the context is wrong

spring escarp
#

how would i change it?

warm hedge
#

Don't know

#

I am not sure how you're running it

spring escarp
#

im placing it in the activation part of the trigger im also as a extra test putting in the execute section on myself in eden

warm hedge
#

Then this is pointing not an unit

spring escarp
#

wa

warm hedge
#

?

spring escarp
warm hedge
#

Do you mean this, literally, as a word, or this, in script context

spring escarp
#

this as in im new to scripting and idk what you were trying to say

warm hedge
#

What you need to know in this context is, this is not pointing a unit (eg player unit) in that context (On Activation)

south swan
spring escarp
#

ok i think im understanding this is refering to a unit like a random ai you can place but doesnt refer to the unit that players control or somethign like that

#

IVE GOT IT I FINALLY FIGURED IT OUT

#

[player] joinSilent createGroup EAST

#

that changed my side

#

and it works in the trigger

manic sigil
#

@tough sapphire description.ext is not autogenerated, you need to make it yourself.

cyan dust
#

Good day. I'm trying to create empty ammo object and attach it to vehicle

  • Are there any other options besides createSimpleObject with ammo's '*.p3d' ?
  • If I go with simple object, I see attaching it works fine in the editor, but will it work in MP? I always though simple objects support static placement only
oblique arrow
#

👋 Hi peeps, I need some help
I'm working on scripting the big NATO AA SAM launcher ( MIM-145 Defender) at a targeet object, however I cant get the launcher(s) to look at the object correctly
I'm trying to use doWatch to have the launcher look at the targets, however they flip right back to looking straight ahead before the missile can even fire

Pie_Radar_AntiShipLauncher_Right reveal [Pie_Convoy_Target_2, 4];
Pie_Radar_AntiShipLauncher_Right doWatch Pie_Convoy_Target_2;
sleep 2;
Pie_Radar_AntiShipLauncher_Right fireAtTarget [Pie_Convoy_Target_2];
oblique arrow
#

Tried
Pie_Radar_AntiShipLauncher_Right lockCameraTo [Pie_Convoy_Target_2, [0,0]];
and
Pie_Radar_AntiShipLauncher_Right lockCameraTo [Pie_Convoy_Target_2, Pie_Radar_AntiShipLauncher_Right unitTurret (gunner Pie_Radar_AntiShipLauncher_Right) ];

#

Ooh ok just tried teleporting myself into the vehicle to be the gunner and then the command works

thorny osprey
#

Does anyone know what script is involved in setting up the commanding menu (shown when the `~ key is pressed). Config item is RscGroupRootMenu, which I can add items to just fine, but I also want to control where in the menu the new items show up.

oblique arrow
#

Thanku <3

manic sigil
#

Fah.

Trying to make a half-assed patch for Ace Medical in low pop servers because my groups always insist on running full ACE and playing Mike Force (Why yes, we do burn out instantly when one casualty brings the game to a halt, how did you know).

#

I'm getting somewhere, but I keep getting weird behaviour. Like I use the ACE_medical_treatment_fnc_fullHeallocal command, but the player remains unconscious.

tulip ridge
#

Are you running the function local to that player?

manic sigil
#

I've done just about every variant I can think of; even ran the non-local version (ACE_medical_treatment_fnc_fullHeal) remoteexec'd to every machine.

#

It heals the player just fine, but they're locked in an INCAPACIATED state, not even the Zeus heal module will fix them.

tulip ridge
#

even ran the non-local version (ACE_medical_treatment_fnc_fullHeal) remoteexec'd to every machine.
fullHeal handles the networking for you, do not remoteExec it

tulip ridge
manic sigil
#

Aye, hold on, lemme clean it up a bit.

#

Hrr. Thought I had a typo to clean up, tested a bit, finally got some diagnostic feedback from the fullheal module, 'failed to wake up patient'. Not that that helps :/

#

Also error: unit not local or null.

#

Alright, lemme post what I'm working with.

tulip ridge
#

So you're either running it on a remote unit (other players will always be remote), or a unit that doesn't exist (or was deleted)

manic sigil
#

I'm on a loopbacked server, using a second Arma instance to test on.

#

The module, outside of my scripting, works on reviving the unit when downed.

#

Not positive that sent, Discord sent an error message. Huh.

tulip ridge
#

It didn't

manic sigil
#
[] SPAWN 
{
while {true} do {
    Sleep 3;

    private _players = allPlayers - entities "HeadlessClient_F";

    _unconPlayers = _players select {_x getvariable "ACE_isUnconscious" AND {!(_x getvariable "SRD_TEST")} };

    [_x] spawn srd_fnc_HAM_Start} foreach _unconPlayers;
};



srd_fnc_HAM_Start = 
    {
        params ["_player"];
        systemchat format ["HAM active on %1",name _player];
        _player setVariable ["SRD_TEST",true,true];

        [
            _player,                                                
            "Heal",                                                
            "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",    
            "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
            "_this distance _target < 3 && lifestate _target == 'INCAPACITATED'",    
            "_caller distance _target < 3",                                    
            {_caller playMoveNow "acts_treatingWounded_in"; _caller playmove "acts_treatingwounded02"},    
            {},                                                                
            {
            _caller playMoveNow "acts_treatingWounded_out"; 
            [_target] call ACE_medical_treatment_fnc_fullHealLocal;
            _target setVariable ["SRD_TEST",false,true];
            },                                                                
            {},                                                                
            [],                                                                
            6,                                                                
            0,                                                                
            true,                                                            
            false                                                            
        ] remoteExec ["BIS_fnc_holdActionAdd", 0, _player];                

            
    };
#

There we go.

tulip ridge
#

You're missing a brace at your forEach

manic sigil
#

Blah, spawn had an extra }

#

However, that just applies the action.

#

When I add the action manually, it still doesn't work. Still, good to know why it wasn't adding the action the last few tests.

tulip ridge
#

You're missing two, one before the [_x] in the forEach and the closing brace for the spawn

manic sigil
#

Yup, caught that just now.

#

I stg I had the timer set up properly just a bit ago... mustve messed with something and didn't think about it.

#

Anyways; even with the timer functioning, and the action being applied automatically, it still heals the player but fails to wake them up.

tulip ridge
#

Because you're not running it on a local unit

#

A player is only ever local to their own machine

#

Why even do this whole loop over all players thing anyway.
Just add the action to all players, and only check if they're awake in the condition.

manic sigil
#

For JIP and respawns. This is going to be executed on top of an existing scenario, I won't have access to initplayer files. Still, I could change it to check and apply action as you suggest, stretch out the sleep timer a good bit.

#

Hrr. My test dummy woke up now. Granted, its taking like 10-15 seconds, but that's better than permanent naptime.

tulip ridge
manic sigil
#

That might be an option, but I just had a breakthrough by remoteexec-ing the heal action directly aimed at the _target of the action.

tulip ridge
#

You don't need to remoteExec it, period

#

Just use ace_medical_treatment_fnc_fullHeal.

manic sigil
#

I know, you said as such and I believe you. But in this use case, apparently it doesn't, and remoteexecing the local version does work.

tulip ridge
#

It does

manic sigil
#

Ah, I see

#

The non-local version has two parameters needed

#

Lemme check that.

tulip ridge
#

Yes, the medic and the patient

#

Optionally a third parameter to disable the message added to the patient's log, but that's not in the release build

manic sigil
#

There we go, that did it. I was not passing the medic info to the non-local version.

tulip ridge
#

You were only passing the medic, it's the first parameter

#

Meaning that there wasn't any value for _patient, hence: "Not local or null unit"

manic sigil
#

Yeah, I've been operating with the local version for too much.

#

But that particular error (undefined variable) wasn't showing up in my log because I was using the local version.

#

Bluh. Whatever, it seems to be working much more fluidly now. Thank you!

frank lynx
#

Is there anyway to script so after a specific amount of time a marker will show up

tulip ridge
#

Yeah, just use a sleep / CBA_fnc_waitAndExecute

frank lynx
tulip ridge
#

The same way you'd create a marker normally

#

When making markers, always use the local versions of each command and only sync it at the end to save network traffic

#

E.g.

_marker = createMarkerLocal ["markername",[_Xpos,_Ypos]];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerType "DOT"; // This updates the entire marker
frank lynx
#

and the _

tulip ridge
#

Read the page for createMarkerLocal

frank lynx
frank lynx
tulip ridge
#

It does

frank lynx
#

Thats because its an .txt

stable dune
tulip ridge
#

Just saying "doesn't work" doesn't tell anyone anything

frank lynx
#

not a .sqf

#

It was named .sqf not .txt

#

Still doesnt work here is my code

_markerstr = createMarkerLocal ["Bandits reported",[9344.78_Xpos,8605.91_Ypos]];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerType "Unknown";

tulip ridge
#

9344.78_Xpos is not a number

stable dune
stable dune
#

Good

frank lynx
tulip ridge
#

Your format is correct, but you kept the _Xpos and _Ypos

#

Those are variables in the example code on the wiki, just use the numbers themselves

frank lynx
#

Oh i need to delete that

#

Ok let me try

#

Nope

tulip ridge
#

Just saying "doesn't work" doesn't tell anyone anything

frank lynx
#

_markerstr = createMarkerLocal ["Bandits reported",[9344.78,8605.91]];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerType "Unknown";

tulip ridge
#

You're saving the marker as _markerstr, but then trying to set the shape and type of a marker called _marker

tulip ridge
#

What do you think it means?

faint burrow
frank lynx
tulip ridge
#

You're creating a variable called _markerstr

tulip ridge
#

That's irrelevant to the command being used

frank lynx
#

Do i need the _

faint burrow
#

Yes if you're using local vars.

tulip ridge
#

It's already local

tulip ridge
#

Your next line is _marker setMarkerShapeLocal "ICON";. Which uses a variable called _marker.

frank lynx
#

Still doesnt work

_Bandits Reported = createMarkerLocal ["Bandits reported",[9344.78,8605.91]];
_Bandits Reported setMarkerShapeLocal "ICON";
_Bandits Reported setMarkerType "Unknown";

tulip ridge
#

Do you see the issue?

tulip ridge
frank lynx
#

ok

faint burrow
frank lynx
#

_Mark = createMarkerLocal ["Mark",[9344.78,8605.91]];
_Mark setMarkerShapeLocal "ICON";
_Mark setMarkerType "Unknown";

tulip ridge
#

What "doesn't work"

frank lynx
#

The maker

tulip ridge
#

Does it not create a marker at all, does it not set the shape, does it not set the type?

frank lynx
#

marker

frank lynx
#

Oh wait

#

sec

tulip ridge
#

Are you sure?
createMarkerLocal returns an empty string ("") if no marker was created

#

You need to test stuff to try and figure out what doesn't work

frank lynx
#

nothing pops up

#

Wait a minute

tulip ridge
frank lynx
#

I found out why

#

it wasnt in an initserver 💀

#

Works now

#

Is there anyway to hide a marker

hallow mortar
#

setMarkerAlpha/Local

tough sapphire
#

I want to add music to a mission, but for some reason, the mission files don't have the description.ext file. What should I do?

hallow mortar
#

Create the description.ext file.

tulip ridge
tough sapphire
stable dune
#

and if you want use them in mission, there is many ways to use those sounds.
you need just tell how and where

tough sapphire
tulip ridge
stable dune
frank lynx
#

Is there any way to add action in a .sqf

frank lynx
#

Found out how

frank lynx
#

Its fun to script in arma 3

#

it allows you to do alot of stuff with missions

sharp rune
#

is there any event handler for weaponAccessories?

tulip ridge
sharp rune
#

yea

sharp rune
#

oh nice thank you

tulip ridge
#

2.18 added extra parameter for the weapon that had its attachment changed (if it was an attachment, obviously)

sharp rune
#

is there anything more specific to only weapon slots changed?

tulip ridge
#

No

#

Just exit if _weapon is empty

sharp rune
#

yea, ok thanks

meager granite
#

Is there a way to get 3DEN's layer parent layer? 🤔

cosmic lichen
#

get3DENParent

south swan
#

layers aren't objects though?

#

hey, it really works with layer IDs get3DENParent 2 returns 0 when layers are parented that way blobcloseenjoy

cosmic lichen
#

Or does it return entity id always.

south swan
#

get3DEParent <number> returned <number> when numbers are Layer IDs

cosmic lichen
#

So this whole page is wrong.

#

Can you test waypoints?

south swan
#

nah, game is down already and i need to go

cosmic lichen
#

Ok.

meager granite
#

I was looking at wiki and though it was for objects only too

regal kraken
#

I just realised what i did

#

for anybody that seen that

warm hedge
#

Yes you've deleted your post, indeed

regal kraken
#

sorry i'll post what i did for anybody else lol

#

had a script spawning AI and was wanting it to sync to the support module, but i was syncing the player to the module instead of the AI

[_vehiclespawn, SUPPORT, SUPPORT_CAS] call BIS_fnc_addSupportLink;
            [_vehiclespawn, SUPPORT, SUPPORT_TRANS] call BIS_fnc_addSupportLink;````
#

thats the corrected code

tough abyss
#

so after playing with enfusions layers. i recently realised we can use layers in A3, for years I've made dynamic aos by spawning markers and generating ai and entities around areas.

is it possible just to create and hide layers? eg on a mission init get it to just pick and load a random layer / or select a layer with its enities and tasks modules. if i wanted to create a somewhat dynamic mission? how would that affect performance? if they are hidden and simulation is turned off. and only one layer is loaded? compared to me having scripts randomly generate everything?

winter rose
#

yes

hallow mortar
#

Yes, you can do that. Not so much choosing a layer to load, but you can hide and disable simulation for everything on every layer and then pick one to re-enable.
I would say it definitely depends how complex you're going to get, though. Stuff does still exist in the mission.sqm when it's hidden and sim-disabled, which can dramatically increase the file size when there's a lot of it. Also, hidden objects can still be picked up by script commands. So there's a balance of "Editor convenience" vs. "it's more efficient to procedurally generate this". A script to spawn enemies is a lot more compact than specific information about 300 existing enemy units.

tough abyss
#

So let's say I make my objective entities and tasks in a layer. But I could just reuse my ai spawn script. To just spawn units in selected area/layer.. rather than load everything in a layer and hide it.

That would be better practice?

hallow mortar
#

I'd say so

modern osprey
#

Hi!

Is there a way to get a list of files in my PRO using sqf?

winter rose
#

in your PRO…

tulip ridge
#

Project?

flint topaz
#

I assume PBO, to my knowledge you can’t do it easily with just SQF, but you can do it with an extension that’s what I’ve done before

tulip ridge
#

There's a command to get files

flint topaz
#

Didn’t know about that one, only knew about the fileExists one

modern osprey
modern osprey
proven charm
#

i guess profileNamespace getvariable is reading variables from memory and not from harddrive?

manic kettle
#

is there a way to store a number with higher precision?
If i try to store UIDs with something like 123456789 i'll get 1.2345e10 for example

little raptor
#

keep them as string?

manic kettle
#

Yeah i guess

little raptor
#

aren't UIDs string already anyway?

manic kettle
#

They are yeah

proven charm
little raptor
#

the number is a float beyond its "integer precision". toFixed can't do anything here

proven charm
#

humm, in that case nvm

manic kettle
#

I mostly wanted it for visual/readability/stupid-proofing reasons, to avoid needeeding to surround uids with quote strings; since im making something people are copy/pasting UIDs into an editor module for

#

when it gets read by the parsesimplearray if it isnt a string it'll get turned into floating 1.234e10

pallid palm
#

hello, friends: how do i stop a script from being exec until its done running

#

is there a way to do this

proven charm
#

scotty i dont understand the question, to exec script is same as to run script

pallid palm
#

well yes thats what i mean if the script is running i want not to be able to run it until its done

proven charm
#

like not allow re-run until its done?

pallid palm
#

yes roger

proven charm
#

waituntil { scriptdone _scriptHandle };

pallid palm
#

ahhh nice awsome m8

proven charm
#

you get _scriptHandle from return of either execvm or spawn

pallid palm
#

so that line would go at that start of the script

proven charm
#

it goes after execvm or spawn

pallid palm
#

ok roger got it

#

awsome m8 thx alot

#

i love you guys so much lol

#

so this is what iv come up with is this correct

#
_scriptHandle = ["Scripts\NEKY_PickUp\NEKY_Init.sqf"] execVM "scriptname.sqf";
waitUntil { scriptDone _scriptHandle };
proven charm
#

looks good to me

pallid palm
#

coool awsome m8

high vigil
#

hello all,
trying to figure out if this engine bug

I am creating "Land_ClutterCutter_small_F" via createVehicleLocal, then creating createSimpleObject with local atribute and attaching it to Land_ClutterCutter_small_F, and when i try to move the Land_ClutterCutter_small_F i get colission with my self and the simpleobject.

_preview = "someclassname";
_helper_item = "Land_ClutterCutter_small_F" createVehicleLocal (screenToWorld [0.5,0.5]);
_preview_item = createSimpleObject [_preview, (screenToWorld [0.5,0.5]), true];
_preview_item allowDamage false;
_center = boundingCenter  _preview_item; 
_preview_item attachTo [_helper_item,[0,0,_center select 2]];
CTI_COIN_CAMCONSTRUCT camSetTarget _helper_item;
CTI_COIN_CAMCONSTRUCT camCommit 0;
hallow mortar
#

I'd suggest using setPhysicsCollisionFlag now that it exists, it's much more flexible than disableCollisionWith

stable dune
#

Aa, nice. Didn't know that exists 👍

modern osprey
high vigil
modern osprey
hallow mortar
# high vigil simpleobjectlocal doesnt support physics per wiki

It doesn't support physics in the sense that the object itself won't fall over, even if it's a movable object in normal life. But it still has collision bounding boxes, like a static building - other things will bounce off it.
Unless you do setPhysicsCollisionFlag on it, of course.

past pollen
foggy stratus
foggy stratus
past pollen
#

FWIW, search intro in intro in this discord and find Dedmen post which is what I was kinda going off of (since I still cannot post the link)

warm hedge
graceful kelp
#

there is a function called

inputController -1

is there an equivilent function to reliably check for the presence or use of hotas/joystick

oblique arrow
#

Hey peeps is there a reasonable way to show the drone feed using the custom info panels to all players in a mission, or should I just use bis fnc livefeed?

grim cliff
#

wierd question... if i were to make a variable that i only wanted to be different on a particular units machine(Ex: p10), would ```sqf
owner p10 publicvariableclient "myvariable";

make the variable available on whomever connects and assigns themselves to that unit?
warm hedge
#

Should do

grim cliff
#

ok secondary question. if there were no player assigned to the unit at the time the variable was made public, would the server technically own the unit and thus only make the variable public to the server machine? essentially i just want to know if the variable follows the owner of the unit, or is it sent to the machine only ance and forgotten?

i want to know if i am reading it right.

what i understand is that publicvariable is a JIP command that will hold the contents of the variable and the argument of the machine that it was supposed to be sent to, at the time of the commands execution, and upon a player joining, if the player will now own the unit p10, the variable will be sent?

#

NVM i read the notes and it will not do that. publicvariable will though. thats sad

grim cliff
#

can i use format to create a dynamic variablename?

warm hedge
#

Well you can. But for what?

grim cliff
#

im writing a script that will dynamically create an array in the communication menu that will create an entry for each of the units in the players group, and upon selecting one of the units in said menu will either add or remove the referenced unit from an array..... if that makes any sense

warm hedge
#

Ah so, 0-8

grim cliff
#
fnc_squadMenu = {
squadHud = [["SquadHud",false]]; {squadHud pushback [format ["Toggle %1",name _x],[_forEachIndex +2],"",-5,[["expression","if (_x in escapeGroupMarkers) then {escapeGroupMarkers deleteAt (escapeGroupMarkers find _x);} else {escapeGroupMarkers pushback _x;};"]],"1","1"]} foreach ((units group player)-[player]); 0 spawn {sleep 0.05; showCommandingMenu "#USER:squadHud"};
};

this is what i have so far and i can get the menu to show the units names, but selecting them does nothing, i presume because the quoted text "CODE" will be run in a seperate scope which will not receive the _x variable of the foreach loop.

#

so i wanted to set _x to a dynamic varible that i could create with format to make the reference work

warm hedge
#

Kinda tricky, but I'd not to use _x but store the unit somewhere else

#

Well that's your point, but... let me think, store the unit into an array and reference it?

dusk gust
#

Could format the netID of the object you want to reference into the script and just use objectFromNetID. NetID's will never duplicate and are constant across network too.
ex.

format ["_obj = objectFromNetID '%1'; if (_obj in escapeGroupMarkers) then {escapeGroupMarkers deleteAt (escapeGroupMarkers find _obj);} else {escapeGroupMarkers pushback _obj;};", netID _x]
regal kraken
#

how do you call a case using remoteexec

hallow mortar
#

Call a case?

regal kraken
#

like i got a switch script for the player choosing a vehicle which is usually _shopper = [4, player] execVM "scripts\blabla.sqf"

#

[ 4, player, "scripts\blabla.sqf"] remoteExec ["execVM", 0, true];

#

would it be like that?

hallow mortar
#

No, the [4, player] needs to remain an array of its own. Remember:

_left command _right;
[_left, _right] remoteExec ["command"];
[4, player] execVM "script";
[[4, player], "script"] remoteExec ["execVM"];```
regal kraken
#

well i'm trying to figure out why i cant get certain things to work on multiplayer

#

support requester so far has been about a week of trying to get it to sync and work to anybody but the admin, and I have a chinook thats supposed to trigger a script but on multiplayer it just fails

grim cliff
dusk gust
grim cliff
#

how can i close a hashmap?

dusk gust
#

What do you mean "close" a hash map? Like delete it?

grim cliff
#

yes

dusk gust
#

DeleteAt - https://community.bistudio.com/wiki/deleteAt
Will still work for deleting key value pairs in the hash map. As far as deleting it, I believe as long as its not referenced anywhere (the scope it was defined in no longer exists, or you just re-define the variable = nil), it will get cleaned up by the engine.

grim cliff
manic sigil
#

A technical challenge, because I want to see if theres a better method than what I have in mind and Im endlessly fascinated by Best Practices.

Last night on Reddit, there was a post about respawn mechanics; specifically, they wanted respawn on a vehicle with a single seat (cryopod, for lore reasons). However, if multiple people attempted to respawn at the same time, the second onwards would instead be placed nearby as expected - but unfortunately, 'nearby' is empty space 10km in the sky.

My initial suggestion was to just forget the cryopod idea (K.I.S.S. and all), but that it would be possible through some not terribly difficult scripting.

If presented with that kind of goal, how would you propose resolving it such that there is only one selectable respawn point, but even if its occupied you would still spawn in an adjacent vehicle that is not tagged as the respawn point?

dusk gust
manic sigil
hallow mortar
# manic sigil A technical challenge, because I want to see if theres a better method than what...

The respawn point is a nearby dummy object or 3D position, not actually the cryopod itself. As part of the respawn handling (onPlayerRespawn.sqf, respawn template, respawn EH etc) the player checks for nearby cryopods and is instantly moved into one if it's available. I'd suggest having a couple of cryopods. If none are available then you either have a fallback vehicle to move them into, or just leave them on the dummy position, which could be sensibly located on the floor next to the cryopod.

hallow spear
#

Hey thanks for the info. I had said so earlier but i didn't post. I will dig into this on the next work session.

manic sigil
#

Now this is what I wanted to see - I wasnt even thinking about decoupling the respawn point and starting from there, and overlooked the OnPlayerRespawn option in favor of the EH (and associated headache trying to sort out how to re/apply it)

hallow mortar
#

EHs on a respawning unit persist across respawn, so you don't need to worry about reapplying it

bitter palm
#

hello for the faction of republic of korea in the vietnam dlc i would like to change the class voice from kor to dlc chinese

#

the pbo config

#

#include "BIS_AddonInfo.hpp"
class CfgPatches
{
class ChinaKorVoice
{
units[]={};
weapons[]={};
requiredVersion=1.0;
requiredAddons[]=
{
"Extended_EventHandlers"
};

};

};

class Extended_PreInit_EventHandlers {
ChinaKor_Init = "ChinaKor_Var = [] execVM ""\ChinaKorVoice\preinit.sqf""";
};

#

the preinit

#

{if (speaker _x == "kor") then {_x setspeaker (selectRandom ["male01chi","male02chi","male03chi"]);};} foreach allunits;

#

but it dont work in game

#

kor is the faction voice in game

#

but they are on mute from the dlc and that i will change

frank lynx
#

Why isnt this working when i load in no error pops up the script just doesnt work (its in a initserver

tulip ridge
little raptor
#

T1 this etc. is invalid

frank lynx
#

Thats 100% why let me fix

little raptor
tulip ridge
#

Also for your requiredAddons, just use "cba_main".

class Extended_Init_EventHanlders {
    class CAManBase {
        class ChinaKorVoice {
            init = "..."; // then just do your check and set your speaker here
        };
    };
};
little raptor
# frank lynx Why isnt this working when i load in no error pops up the script just doesnt wor...

for example:

{
  _x disableAI "MOVE";
  _x addAction ["Recruit", "recruit.sqf"];
} forEach [t1,t2,t3,t4];

in "recruit.sqf":

params ["_unit", "_caller"];
[_unit] join group _caller;

or you could ditch the recruit.sqf because it's so small it's not even worth using a separate file for it:

{
  _x disableAI "MOVE";
  _x addAction ["Recruit", {
    params ["_unit", "_caller"];
    [_unit] join group _caller;
  }];
} forEach [t1,t2,t3,t4];
jade acorn
#

since player cannot look around in the intro phase, can I somehow script his unit to look somewhere? Looking for an alternative to using separate camera

bitter palm
little raptor
jade acorn
#

oh because switchPlayer did not move the camera to the new unit right?

little raptor
#

yeah it shouldn't, but even if it does you can use switchCamera

junior moat
#

hey, anyone know why this doesnt seem to do anything?

[civ1, "ApanPknlMstpSnonWnonDnon_G01"] remoteExec ["switchMove"];

its being called in initServer.sqf and civ1 is the variable name of a civilian unit placed using the Eden editor.

#

Huh, strange, it "worked" but only after the civ ran like 300m away from where i placed him lol

proven charm
#

try using 2 as the remoteExec target because now you are executing it everywhere

little raptor
#

use the alternative syntax. it's better

#
[civ1, ["ApanPknlMstpSnonWnonDnon_G01"]] remoteExec ["switchMove", 2];
junior moat
#

appreciate it. my code seems to work but with like, 10 seconds of delay which is strange but ill use the new code

proven charm
#

though you dont really need remoteExec if its run at server anyways

frank lynx
#

How do i make my soldiers join my squad when i add an action

winter rose
#

as he showed you
see his recruit.sqf

frank lynx
#

Ohh

frank lynx
frank lynx
#

so i can actually choose what i want to recruit

tulip ridge
#

They are separate
That script takes two parameters, the unit that should join, and the unit whose group should be joined

frank lynx
#

and if i recruit one it would enable all movement

#

if i understand it correctly

tulip ridge
#

No?

frank lynx
tulip ridge
#

All that script does is disable movement for t1, t2, t3, and t4. Then it adds an action to each unit to make them join the player's group

{
    _x disableAI "MOVE";
    _x addAction ["Recruit", {
        params ["_unit", "_caller"];
        [_unit] join group _caller;
  }];
} forEach [t1, t2, t3, t4];
little raptor
#
{
    _x disableAI "MOVE";
    _x addAction ["Recruit", {
        params ["_unit", "_caller"];
        [_unit] join group _caller;
        _unit enableAI "MOVE";
  }];
} forEach [t1, t2, t3, t4];
#

as Dart explained, the script disables movement for each unit, and adds an action to each one that makes that specific unit join group/enable movement

little raptor
plush jolt
#

is there a sorta best practice accepted way to get a list of units that knowAbout a given target, or even just a list of all west units that are currently tracked by any east unit trying to make something otherwise basic but requires switching on when they opfor can see any of the player units

iron flax
#

I'm looking for information on how to create the little popup on the screen where you press the "H" key to get more information on something. Does anyone know what this is called, and where I can find info on how to add it to a mission?

hallow mortar
iron flax
plush jolt
# proven charm look for targets in the wiki. like https://community.bistudio.com/wiki/nearTarge...

Yeah saw that, but it's all verymuch a which targets does this individual group or unit have

No way to go the other way and ask given a unit/group which enemies can see it/have it as a target

Obviously I can loop all red AI groups within range and check them and build it manually, but mostly curious if there is a best practices way to do it as I have no clue which of the various ways to get targets are more performant etc

proven charm
frank lynx
tulip ridge
frank lynx
#

but how do i set it in to the code

#

already made

#

(btw it works)

tulip ridge
#

Look at the parameters it takes and the example of how its used

little raptor
frank lynx
faint burrow
little raptor
#

yeah correct. I forgot how it went

pallid palm
#

darnit you cant remove default Actions ah man

tulip ridge
#

You can remove some from CfgActions, but that's config

pallid palm
#

oh ok isee its not that pressing that i do just wanted to know thx Dart

tulip ridge
#

The best you can do with scripting is just disable some, but they're still visible

pallid palm
#

i see ok

#

thx you Dart as always you da man

dire island
#

I'm looking to replace an element in an array within an array. You could probably do something like

_a = array1 select 1;
_a set [0,5];
array1 set [1, _a];```
but there's gotta be an easier way, right?
warm hedge
#

array1 # 1 set [0, 5]

grim cliff
#

how can i check to see if my mod ran its code? i have the mod compiled but the code either hasnt done anything, or it didnt load right

tulip ridge
grim cliff
#

i have diag_log at the first line of the functions that are supposed to run postinit. but there is nothing in the RPT file

#

im trying to find the cfgfunctions biki page but i cant find it all i can find is the config.cpp description page, and there is nothing there that is useful

tulip ridge
#

Could you show what you have?

grim cliff
tulip ridge
#

If you look in-game, are they defined in CfgFunctions?

grim cliff
#

i will okk there

#

can i get there from the main menu?

tulip ridge
#

Actually, your category path is wrong
It should start with a pbo path

#

I.e. like file = "\APSSupport\functions";

#

Also that's not how you use exitWith

It's just:

if (_condition) exitWith {};
grim cliff
#

better?

tulip ridge
#

Yeah

#

File path is probably your main issue though

grim cliff
#

should the functions show in the functions viewer or cfg viewer?

tulip ridge
#

Both

grim cliff
tulip ridge
#

Yeah that'd also do it

grim cliff
#

YAY time to debug my error vomit

#

one of the scripts is running without errors for once though... interesting

tulip ridge
#

Well you still have spots where you're using exitWith incorrectly

grim cliff
#

that is literally the ONLY spot

tulip ridge
#

Then the file wasn't saved, or some kind of similar issue

grim cliff
#

i forgot to save.....

#

im dumb.

tulip ridge
#

If you use VS Code, just make it save files on focus change

#

Other editors should have similar settings

grim cliff
#

sublime text

tulip ridge
#

I'd poke around or do some googling

grim cliff
#

i like sublime for its regex stuff

#

is there a way i can check to see if an array is empty?

#

i used isnil and its throwing an error

tulip ridge
#

If you want to check if a variable is nil (i.e. undefined), you'd put the variable name in a string.

An empty array isn't undefined though, so just check if the variable is equal to an empty array

if (_someArray isEqualTo []) then {
    // ...
};
#

Also, local variables require an underscore at the start of their name.

A variable without a leading underscore will be saved to the current namespace (like missionNamespace, uiNamespace, etc.)

grim cliff
#

i thought the underscore made it private to the script it was created in, but i have two scripts running in paralell

tulip ridge
#

Private =/= local

#

SQF is also entirely synchronous, your scripts aren't running in parallel

#

You should always make variables local and private unless otherwise needed.

private _someVar = 0;
grim cliff
#

so i have this section of script running on the server via a server mod. it doesn't work at the beggining of the mission, but it does work if the player quits to role selection,and then click ok again in role selection, to "rejoin the mission"

tulip ridge
#

You should probably just wait until the game display is ready

tulip ridge
# grim cliff so i have this section of script running on the server via a server mod. it does...

Also:

  1. Just use CfgFunctions, there's no reason to just define your function as a global variable.
  • Your function is also missing a prefix, this is handled for you by using CfgFunctions; but all global variables should have a prefix or "tag".
  1. done is a global variable in your script, which is likely unintentional.
  2. If your goal is to run this code on each player that joins, why run it on the server at all? Just run it in something like an initPlayerLocal.sqf file from the missio
grim cliff
#

1: i had so many issues getting the mod to even load that i havn't gotten around to that yet.

i also have not figued out how exactly to call the functions from inside the init script. so i thats another hurdle

2: the done variable is a remnant that i wanted to keep global to be able to kill the while loop later on when a certain mission event happened. this is still very much a WIP

3: two reasons

the mission is MASSIVE and finding the right place to put these little bits of code has never worked for me, for some reason or another. whover made this mission left a boatload of errors that took me close to a month to iron out.

after i had debugged the mission, since it is shared among clients somehow, someone connected to my server, stole the mission and started poaching our player base. they were removed from the community shortly after.

tulip ridge
#

The entire mission is downloaded to clients, this code is still available to anyone who downloads the mission

grim cliff
#

right, which is why i wanted the code i want to keep "mine" to be run from a server only mod via the command line option -servermod=

tulip ridge
#

But that code is still available to clients

grim cliff
#

how? the server is still sending the mod to the clients?

#

or do you mean by the server making the code chunks global variables?

tulip ridge
#

In order for you to remoteExec your function, the client has to have the function defined

#

You can't (shouldn't) send code over the network, you need to define the function on all machines and then use the name of the function as a string for the remoteExec.

[/*function arguments*/] remoteExecCall ["myTag_fnc_myFunction"];
tulip ridge
grim cliff
#

https://community.bistudio.com/wiki/remoteExec
in my case im useing example 5.

im just using the examples on the biki to my advantage. i understand there are issues with running code over the network, and my community is fine with the 1 second that it adds to their client load times.

my #1 goal is to protect this mod from the people that plagiarize my teams work, and remove any credit associated to the original authors and myself, to instead take it all for themselves.

grim cliff
tulip ridge
#

my #1 goal is to protect this mod from the people that plagiarize my teams work, and remove any credit associated to the original authors and myself, to instead take it all for themselves.

Then don't play Arma.
It is very easy for someone who knows what they are doing to rip stuff, you cannot prevent it entirely.

tulip ridge
grim cliff
tulip ridge
#

"As hard as you can" can be solved by googling how to open a pbo file

grim cliff
tulip ridge
#

No the mod itself is not downloaded to clients, but in you trying to protect it, you force yourself to send the entire function over the network. Anyone could add some mod to view the value of the function and see all of its code

grim cliff
#

if someone is going to hack it out of their client, there isnt any thing i can do about that. however its hard to steal the other half of the code that isnt broadcast over the network, not for this peice in particular, but for other functions, that dont transmit, they can rmain relatively safe.

vapid scarab
#

Im looking to track (edit:) all buildings and add some event handlers to them. Im looking to mainly add them to actual buildings, but some extra objects is fine too.
Im looking at using XEH event handlers with one of these classes Static Building NonStrategic HouseBase
Any tips?
Which of those classes would be the best catch for buildings?

proven charm
vapid scarab
#

definitely not that for the whole map. It lags out.

proven charm
#

well if you use it only once it shouldnt be too bad

vapid scarab
#

Any other functions that get terrain objects?

winter rose
#

if it takes time, it's because the terrain is big

#

disable sorting for faster results

vapid scarab
#

right

#

Thanks!

faint burrow
#

Another tip -- use markers within which terrain objects should be hidden.

vapid scarab
#

So some objects cant be found?

fiery gull
#

what are your filters in nearestTerrainObjects?

vapid scarab
#

right now nothing, pos is center of base, radius 500

fiery gull
#

and what cant be found?

vapid scarab
#

the dome and the office/barracks building

proven charm
#

are you running the code in the editor?

warm hedge
#

What code you really run

fiery gull
#

yeah the dome and barracks are definitely returned

vapid scarab
#

Watching demon hunter, but i came back and was looking through it. I figured it out. It does return, but those buildings dont destroy when disabling damage effects using setDamage

upbeat hill
#

Would it be possible to use setTerrainGrid so i can have no grass on a certain area but the rest of the map has it?

faint burrow
#

No, but you can try creating and moving grass-cutter object.

upbeat hill
#

ok thank you

proven charm
#

I believe you must leave the grass cutter there. example: sqf createSimpleObject ["Land_ClutterCutter_large_F", _pos, false];

little raptor
#

Maybe your radius is too small

little raptor
#

Ah didn't see that

vapid scarab
#

Thanks tho!

proud dome
#

Anyone familar with ace_interact_menu_fnc_createAction that could sense check some code for me? Everything appears to work fine but im getting a undefined variable error for some reason

#


private _droneName = getText(configOf _drone >> "displayName");

if (local (_drone)) then {
   [_drone, "", [], false] call bis_fnc_initVehicle;
};

if (isClass(configFile >> "CfgPatches" >> "ace_main")) then { //ACE Interaction if the addon is loaded..

   private _action = ["gx_drone_pickup", format["Pickup %1", _droneName], "a3\ui_f\data\igui\rscingameui\rscunitinfoairrtdfull\ico_insp_hand_ca.paa", 
      {[_this#0, _this#1] call GX_fnc_drone40_pickup;}, {[_this#0, _this#1] call GX_fnc_drone40_canPickup;}, {}, [], [0,0,0], 2] call ace_interact_menu_fnc_createAction;
   [_drone, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;

} else { //Add vanilla option to pick up.

   private _actionID = _drone addAction [
      format["Pickup %1", _droneName], {[_this#0, _this#1] call GX_fnc_drone40_pickup;}, [], 1, true, false, "", format ["[_target, _this] call GX_fnc_drone40_canPickup;"], 2, false, "", ""
   ];
   
};
vapid scarab
#

looks right to me.
Do you have an ace mod that comes with ace interaction?
That if statement should have ace_interact_menu instead of ace_main.

proud dome
#

I suppose its worth mentioning this error only shows when i load a scenario in editor with my drones placed down. This initialization code is called on postinit

stable dune
#

And your own GX functions ?
Maybe you could debug that your functions exist (condition and statement)
And you can call in statement and condition just

{
    call GX_fnc_drone40_canPickUp
},
proud dome
#

My functions exist when i load into the game, as in the pickup action and conditions behave as intended, i suppose they may just not exist immediately when i load into editor or something?

proud dome
vapid scarab
proud dome
#
            postinit = "[_this#0] spawn GX_fnc_drone40_init;";
        };```
vapid scarab
#

Okay... so remove that
Thats in the vehicle definition, right?

proud dome
#

Aye.

vapid scarab
pallid palm
#

hello friends how To remoteExec a funtion from a addAction ?

proud dome
pallid palm
#

cool thx ill check it out

stable dune
#

So

[ARGS] remoteExec ["your_fnc_superevent", _targets, _isJip];
pallid palm
#

nice thx man @stable dune

vapid scarab
# proud dome Ah, this is useful thank you! 🙂

If you are making a mod that uses CBA, you probably should not add eventHandlers through the vanilla vehicle EH config. It causes an issue with CBA and when ran alongside any CBA stuff, the run order is not what you would expect. One example is that vanilla cfgFunctions preinit does not run in 3den iirc, but CBA XEH preinit does.

From PabstMirror over in the ACE discord helping me with a similar issue:
if you write out the full inheritance, you can use vanilla EHs with no conflicts with CBA (not tested but I think this is right)

clas CfgVehicles {
    class All {
        class EventHandlers {}; // CBA adds XEH to this
    };
    class Thing: All {};
    class ThingX: Thing {};
    class ReammoBox_F: ThingX {
        class EventHandlers: EventHandlers {
            class myThing {}:
        };
    };
};
south swan
#

(or maybe even add ACE interaction from the config to skip this chicanery) blobcloseenjoy

proud dome
#

Maybe I'll go that path, was mainly wanting to ensure this mod works without ace loaded and just wont run any of the ace compatability stuff

#

Assume doing it through config on vanilla will just ignore all the interaction bits included/won't error right

south swan
#

having ACE things in config when ACE isn't loaded doesn't break anything

#

(as long as it's not "actively calling ACE functions" things)

frank lynx
#

I get this error for this code gimme a sec

vapid scarab
# proud dome Maybe I'll go that path, was mainly wanting to ensure this mod works without ace...

Something I did with one of my recent mods for that ace/no-ace compatibility:

#if __has_include("\z\ace\addons\interaction\script_component.hpp")
class ReammoBox_F {
  class ACE_Actions {
    class ACE_MainActions;
  };
};
#else
class ReammoBox_F;
#endif

class Bax_DuffelBags_Duffel_Base: ReammoBox_F {
  //config stuff

  #if __has_include("\z\ace\addons\interaction\script_component.hpp")
  class ACE_Actions: ACE_Actions {
    class ACE_MainActions: ACE_MainActions {
      class BAX_CheckOwner {
        // ace action config
      };
    };
  };
  #else
  class UserActions {
    class BAX_CheckOwner {
      // User Action config
    };
  };
  #endif
};
south swan
vapid scarab
#

Hey shining!

south swan
manic sigil
#

You can name it whatever you want, but the fourth param slot will always be the action ID.

frank lynx
#

do i just move it?

manic sigil
south swan
tulip ridge
oblique arrow
#

Oki I could use some help again
I'm working on a script to let players shoot missiles at ships and have it mostly working, however I'm using bis fnc livefeed to have a live feed pop up of the ship thats being shot at, since its a good bit away (around 2-2.5km) both the effects of the missiles hitting and custom emitters place by me arent rendering in the live feed camera, is there a way to fix that by extending the render distance via script or making the effects load in some other way?

bis fnc livefeed view:

#

actual view when nearby:

manic sigil
oblique arrow
vapid scarab
#

I already tried using the regular ViV command and saving. Unless there is an additional special step after using setVehicleCargo, it does not work for 3den

#

doing this but with script instead of cursor:

oblique arrow
vapid scarab
#

yeah

#

Let me rephrase though. there isnt a 3den command.
But how would I add a vehicle to a vehicles cargo in 3den via script?

#

I tried setVehicleCargo and then doing save3denInventory on them, but that doesnt work. (unless there is some other step i need to do)

frank lynx
#

How do i make a respawn mechanic for the player

faint burrow
frank lynx
vapid scarab
#

What you are asking is rather complicated, or at the very least is very tedious.
That wiki page has everrything you need to interface a new respawn system into a mission.
Biggest thing is respawn templates and onKilled and onRespawn functions

vapid scarab
#

Use base or instant

willow hound
frank lynx
#

But what is an id

vapid scarab
#

Idk what you are talking about.
Is it this?

frank lynx
#

what is an id

vapid scarab
#

It tells you in the 3rd column

frank lynx
#

so what exactly am i supposed to do

#

I put the code in the description.ext

south swan
#

notlikemeow maybe start with setting the respawn up in 3DEN's multiplayer attributes menu

vapid scarab
#

Its fine since you are confused, but you are essentially asking us to write you the respawn system. You are going to have to trial and error this.

vapid scarab
#

And yeah, if you cant figure it out, it took me a while too. Start with using 3den stuff

frank lynx
#

Good idea

south swan
#

only works in multiplayer (duh)

frank lynx
opal zephyr
vapid scarab
#

oh right, i forgot about that. You dont 🙃 Singleplayer does not have respawn. It automatically ends when you die.

opal zephyr
#

singleplayer does have respawn

vapid scarab
#

Oh? ill have to look into that more then.

frank lynx
#

When i alt tab out of the game sometimes i cant go into the game again and i lose all my progress

misty rain
#

hey im a bit new to arma scripting but could use some help.

first of all something really simple ive done before but since ive been on a new pc cant find it for the life of me.

i like to have local only markers for the zeus and cozeus (they have a defined variable name) OR a marker that is inviisble for everyone except the zeus and co-zeus.

second of all i have a trigger condition that is fully working except when the zeus crashes and theres only a cozeus, then he can only use the backup triggers, yes i can prob do another else, but im wondering if i can write it better (not a big priority atm)
(see picture for current code)
(And yes im aware its cursed to use the variable name ZEUSUWU)

#

(if this is the wrong channel for this dont be afraid to bonk me and point me in the right direction btw)

real tartan
#

this does not work with mines, it is a common issue
does anybody have workaround ? don't want to re-invent a wheel

_zeusModule addCuratorEditableObjects [allMines, true];
misty rain
vapid scarab
#

an armed mine is a projectile right? and we cant have projectiles added to curator display, right?

real tartan
#

my next question was that if it work with UXOs

#

was thinking to replace mines with *_script_ammo suffix, that zeus can interact with

real tartan
real tartan
misty rain
# misty rain hey im a bit new to arma scripting but could use some help. first of all someth...

found an answer to my first question,
doing this

_marker = createMarker ["markername", [4368.18,7044.96,0.00256538]];
_marker setMarkerType "hd_dot";
"markername" setMarkerText "You are here.";

works if put in init of the people i want to see the marker (this is painfully slow to do though but its fine)

if theres anyone able to help with the second question that would be lovely or have a faster way then this.

#

(the co-ordinates i can link with getpos varname of trigger so theres no issues there)

stable dune
#

Yes.
Make array of units.
Use for each loop.
Create marker for every unit (_x) position.

misty rain
#

well thats the only way i could find, again new to coding not smart, having to constantly change i think 4 variables as i need 50 of these markers

(making a 8 mission campaign and ill constantly grab and use what i need) so if theres a faster way i want it XD

fair drum
#

in the most basic sense, use apply or forEach. Remember that markers need a unique name, so we make a name using the unit object.

private _myArrayOfUnits = [/* something */];
_myArrayOfUnits apply {
    private _unit = _x;
    private _markerName = format["BAR_UnitMarker_%1", _unit];
    private _marker = createMarker [_markerName, getPosATL _unit];
    _marker setMarkerType "hd_dot";
    _marker setMarkerText format["%1", name _unit];    
};

you can then expand it to add/remove markers if the unit is alive, or changes position or dead on a loop, etc

misty rain
#

so this is the stuff i wanted to learn, i still dont know exactly how it works with that alone, could u explain it a little more?

#

(yes im that new to coding i was already proud of the trigger condition)

fair drum
#

an array is like a list (or rather in other languages, a list is like an array lol)

what apply or forEach do is take all the things inside of that list, and "apply" the same code to everything in that list. in Arma, the specific thing it is currently doing work on in the list is represented by _x

misty rain
#

then what does the private in that code entail and what needs to be done with the /* something*/

i think i get tge gist of the rest

fair drum
#

C# example

string[] cars = {"Volvo", "BMW", "Ford"};

foreach (string car in cars)
{
    // do the same thing to each of the cars, each car is placed in the variable "car"
};
misty rain
#

also the text on each marker will be different and the location but the rest can stay the same (i can even make the name of the marker and the location the same using get pos)

fair drum
#

private deals with variable scope. where the variable actually exists

misty rain
#

hmm that i dont fully get ill be honest

fair drum
#

ok... say we have a book with a bunch of chapters. a global variable would be one that exists in the entire book. a local variable in each chapter, a private local variable in each paragraph

misty rain
#

honestly act like youre explaining this to a very dumb person

i like know what strings and booleans are and stuff like that but not much more

#

okay that i can get but how to manipulate it and how that works in that script is where im a little lost

fair drum
misty rain
#

i will do that, thanks for all the help so far!

glass ice
#

Hi all.

I wonder if there's a script I could use for this...

I'd like a MP script for use in a coop event where the script would look for any OPFOR/EAST units and swap their headgear from an array of headgear classnames?
I tried ChatGPT, and it made something, but it just spams errors in mission and I have zero clue what's wrong. I have no scripting knowlage. :S

What ChatGPT spat out.

 // Define the array of Christmas hats
private _christmasHats = [
    "Christmas_Hat_Stars_Wearable",
    "Christmas_Hat_Plain_Wearable",
    "Christmas_Hat_Reindeer_Wearable",
    "Christmas_Hat_Mistake_Wearable",
    "Santa_Beard_GE","Santa01_BeardHair_GE",
    "Gold_Beard_GE","Grey_Beard_GE",
    "Christmas_Hat_Side_Wearable",
    "Snowman_Hat_Wearable",
    "Snowman_Bucket_Wearable",
    "Snowman_Enemy_Wearable",
    "Snowman_Hat_Wearable_M",
    "Snowman_Bucket_Wearable_M",
    "Snowman_Enemy_Wearable_M",
    "Turkey_Helmet_GE",
    "GreenHead_GE"
];

// Function to replace headgear for OPFOR units
private _replaceHeadgear = {
    params ["_unit"];

    // Check if the unit belongs to the OPFOR side
    if (side _unit == east) then {
        // Remove the current headgear
        removeHeadgear _unit;

        // Select a random hat from the array
        private _randomHat = selectRandom _christmasHats;

        // Add the new headgear to the unit
        _unit addHeadgear _randomHat;
    };
};

// Add an event handler to process each unit upon spawn
// Works with multiplayer-compatible spawning events
"remoteExec" addEventHandler ["EntityCreated", {
    params ["_entity"];

    // Check if the entity is a unit (man class)
    if ((typeOf _entity) in ["Man"] && {isPlayer _entity == false}) then {
        // Delay for script execution to ensure unit is fully initialized
        [_entity, _replaceHeadgear] remoteExec ["call", 0, _entity];
    };
}];```
sharp grotto
#

Is there any difference between some vehicle turrets ?
Test with "Armed blackfish": I can manipulate the turret [1] but not [2]. blobdoggoshruggoogly

TestEFEH = addMissionEventHandler ["EachFrame",
{
    _allCurrentMuzzles = (vehicle player weaponsTurret [1]);
    {(vehicle player) setWeaponReloadingTime [player, _x, 0.01]} forEach _allCurrentMuzzles;
}];
tulip ridge
tulip ridge
#

Also

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
glass ice
tulip ridge
#

You could use something like this in an initServer.sqf script.

addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    if (_entity isKindOf "CAManBase" && side group _entity == east) then {
        _entity addHeadgear (selectRandom _christmasHats);
    };
}];
tulip ridge
glass ice
#

THANKS!! I'll give it a try as soon as I get to my PC

tulip ridge
#

Just define _christmasHats in the event handler as well, I wasn't going to write out that huge list on my phone

glass ice
#

OK. Thank you a lot man. If you ever have any 3d modeling/texturing questions I can help you, but with coding...I'm useless.

jade acorn
#

how can I make a Zeus' "camera" trigger dynamic simulation? Is it even possible?

autumn lantern
#

Anyone here familiar with the Support Provider: Supply Drop module?

junior moat
#

random question but is there any reason not to use remoteExec assuming theres nothing you want done locally?

tulip ridge
#

Wastes time checking if the target is local if what you're doing is already local to what you want

#

Why write out a remoteExec(Call) if it's not necessary

#

Also not every command needs to be run locally to whatever object, if the object can be remote, then you waste time sending it over the network

junior moat
#

alright so just performance?

tulip ridge
#

Performance and remoteExec spam looks bad

dusk gust
#

Anyone happen to know if theres a local version of createAgent?
https://community.bistudio.com/wiki/createAgent

Looking to reduce as much possible network as I can, and I know environment like rabbits/snakes etc are all local agents, but cant find a way to manually do something similar. createVehicleLocal won't work for what I want due to it requiring the use of setDestination or similar.

junior moat
dusk gust
junior moat
#

is it possible to check if a player is an admin/host of a session? im trying to make an addAction only show up for admins/hosts

fair drum
junior moat
#

i tried call BIS_fnc_admin == 2 but that doesnt seem to work

junior moat
fair drum
#

nope you can't do it that way with the engine command because the command only works on the server, and actions are local client

#

what is BIS_fnc_admin returning for you (this one is local for clients)

junior moat
#

lemme check rq

#

0

#

that was done in the debug console on a locally hosted server where i am the host

fair drum
#

BIS_fnc_admin uses serverCommandAvailable, specifically #logout and #exec which is not available for listen servers.

junior moat
#

ah i see

sullen sigil
fair drum
# junior moat ah i see

so instead, make your own function that uses something that is available to Server Hosts, like #kick or something

hallow mortar
merry shard
#

If I put !alive ["a", ... "f"]; into the "Condition" section of a Trigger, will it trigger if any variables a through f are dead? Or will it only check when ALL of them are dead?

tulip ridge
#

Especially not an array of strings

merry shard
#

Oh okay, thanks

tulip ridge
#

It you want to filter a list of objects by checking if they're alive, then you'd do something like:

private _aliveObjects = _objects select { alive _x };
pallid palm
#

why the hell would you use ChatGPT when we have guys like Mr Dart around, hes my ChatGPT all day long WooHoo Arma 3 Yeah

#

thx you again Mr Drat love you man

#

my game works so good because of you

#

and some others too

#

or should i say my missions

jade acorn
jade acorn
#

I don't think camera has any side and it is not a player unit, so it won't trigger anything but I'll try

sharp grotto
cyan dust
#

Is there a way to set ui control idc via script?

proven charm
#

i dont think so , only if you create the control via script

little raptor
cedar bay
#

Hey guys. Is there a way to have a vehicle driving down the road and when it reaches a certain marker you teleport it via setpos to another location while its direction and speed remains the same?

still forum
#
_oldDirection = [vectorDir _veh, vectorUp _veh];
_oldVelocity = velocityModelSpace _veh;
_veh setPosASL _newPosition;
_veh setVectorDirAndUp _oldDirection;
_veh setVelocityModelSpace _oldVelocity;

That should do it.

The script should run on the owner (driver) of the vehicle's machine, for best results.

jade acorn
little raptor
#

I guess onEachFrame it is then:

onEachFrame {cmdr setPosWorld getPosWorld curatorCamera;}

(Using the EachFrame mission EH is better tho)

warm hedge
#

Indeed attachTo is slightly slow so you really need to do it manually/each frame

jade acorn
little raptor
#

Did you check if the unit is actually there?

jade acorn
#

what do you mean? I can see unit's shoes right on my camera object

#

enemy AI is definitely shooting at "me" so the unit should be where the camera is. It does not trigger the simulation anymore though

little raptor
#

No clue why it doesn't work anymore then meowsweats
What if you try another command? Try attachTo again

jade acorn
#
addMissionEventHandler ["EachFrame", {
    private _zeus = curatorCamera;
    cmdr attachTo [_zeus, [0, 0, 1]]
}];``` this loop works
little raptor
#

Well try the code in the EH in debug console to see how fast it is

#

If it's fast enough you can keep it

#

If not try other commands too. Such as setVelocityTransformation and setVehiclePosition

oblique arrow
little raptor
#

Or do you mean how to do that?

oblique arrow
#

Just shoots in a straight line, should be within turret depression range I think

little raptor
#

Last I checked it was working properly.
Which turret are you using?

oblique arrow
#

Him defender, the big chonky NATO SAM

little raptor
#

Also you use alt syntax right?

#

I mean this syntax:
vehicle lockCameraTo [target, turretPath, temporary]

oblique arrow
#

Yeah should be
_pie_launcherLeft lockCameraTo [_pie_destroyerTarget1, _pie_launcherLeft unitTurret (gunner _pie_launcherLeft), false];

#

Target entity is an invisible target added by CBA
CBA_O_InvisibleTargetVehicle (Pie_Destroyer_Target_1)

little raptor
#

Dunno. It should work. Try supplying its position instead to see if it makes any difference

#
A_pie_launcherLeft lockCameraTo [aimPos _pie_destroyerTarget1, _pie_launcherLeft unitTurret (gunner _pie_launcherLeft), false];
oblique arrow
#

Oh wait

#

the HIM defender actually just has much less depression than I thought I remembered

#

like practically none at all

#

Thats on me then 😅 , thanku still though <3

#

I guess I could try EH'ing it and deleting the real rocket and replacing it with an angled one in some form or shape, but I'm props just gonna try to raise the ships and hide it 😄

modern osprey
#

Can I find out the ID of the event being called inside BIS_fnc_addScriptedEventHandler?

#

_thisEventHandler is an undefined variable

#

I find _thisScriptedEventHandler in chat history

south swan
velvet knoll
#

Anyone have any clue why these actions are not showing up on a dedicated server?

    skipTime (5 - daytime);}]; 

this addAction ["Sleep until Midnight", { 
    skipTime (24 - daytime);}]; 

```
vapid scarab
#

Im setting up a zeus module that needs to be ran on an entity.
I know I set this in config: curatorCanAttach = 1;
how do I get the unit I placed the module on? is the unit synchronized to the logic? The config says attach so would I use attachedTo instead of the syncObjs command?
https://community.bistudio.com/wiki/Modules

tulip ridge
velvet knoll
#

is there something im not doing in the first that i should bed oing?

vapid scarab
#

is that in the object init?

velvet knoll
vapid scarab
#

A dedicated server also isnt a player and cant see/use an action, so do you mean self hosted?

velvet knoll
#

It's driving me nuts lol

hallow mortar
#

Is this object being placed in the Editor or as a Zeus saved composition?

#

The difference is important.
For Editor-placed objects, the init field runs on every machine, so the action will be added on every machine.
For Zeus-placed objects, the init field only runs on the machine that did the placing, so the action will only be added for the Zeus who placed it.

velvet knoll
#

i knew that

hallow mortar
#

Try a little dash of if (local this) then { and remoteExec

velvet knoll
#

I split the commands across 2 seperate items to see if it would help andhad no change

hallow mortar
#

https://community.bistudio.com/wiki/skipTime
skipTime requires server execution. If you execute it on a client (i.e. the client that activates the action) their time will change locally, then immediately be overwritten by a sync message from the server.
The action should remoteExec skipTime with target 2.

velvet knoll
#

God bless

vapid scarab
#

How do I make a module show up in zeus?

oblique arrow
hallow mortar
#

Like in the spawn menu? Its scopeCurator config attribute, I think.
In the world after script-spawning it? addCuratorEditableObjects, probably

#

* some modules auto-delete themselves rather than persisting, so the second one might not always be possible

vapid scarab
#

thanks

velvet knoll
#

this addAction "Sleep until Dawn"; remoteExec [skipTime (5 - daytime), 2, true];

#

im doing something wrong here i know it

hallow mortar
#

Yes, several things

vapid scarab
#

I want to smack my head looking at that

#

Yeah.... i was live editing that as i was looking for code errors....

hallow mortar
#
if (local this) then {
  [this, ["Sleep until dawn", { [5 - dayTime] remoteExec ["skipTime",2] }]] remoteExec ["addAction", 0, true];
};```
velvet knoll
#

thanks @hallow mortar

hallow mortar
#
_leftArgument command _rightArgument;
[_leftArgument, _rightArgument] remoteExec ["command"];```
junior moat
#

hey im trying to make certain slots in my multiplayer mission have different loadouts, is there a good way of doing this? i tried this but it doesnt seem to work for the trainer (works fine for the trainees though):

trainer = objNull;

{
    [_x, "loadoutTrainee"] call BIS_fnc_addRespawnInventory;
} forEach units trainees;

if (alive trainer) then {
    [trainer, "loadoutTrainer"] call BIS_fnc_addRespawnInventory;
};

trainer is the variable name for a unit placed in the eden editor.

fair drum
#

Well... You are making trainer now reference a null object

#

So it's always going to be not alive

misty rain
# fair drum start here and give it a good read, then let me know if you have any questions: ...

thanks for all the help, and with a bunch of reading, trying failing, and just a tiny bit of chat gpt (i put the for each before the code not after for example cuz im very smart)

i ended up using this, as i always use the same name formatting for my triggers and all i needed now where personalised markers for the zeus only on the debug triggers (these are always trigger one or trigger 0 for me) this makes me only have to put in the names once for each marker.

very glad i went here earlier to ask help!

{
    _name = _x;
    _markerName = format ["%1marker", _name];
    _triggerName = format ["%1trigger1", _name];
    
    _trigger = missionNamespace getVariable [_triggerName, objNull];
    if (!isNull _trigger) then {
        _marker = createMarker [_markerName, getPos _trigger];
        _marker setMarkerType "hd_dot";
        _marker setMarkerText _name;
    };
} forEach ["Ditolak", "Hijausub"];
wise frigate
#

Hey guys, I am trying to setPosATL of an object on a memory point located within the players weapon.
Is there any way to have it reference a memory point on the weapon and attach it to the memory point or only on memory points of the unit itself,
For example attaching a helper item to the rifles muzzle.

warm hedge
#

No direct way.

  1. fetch the weapon P3D
  2. create simple object
  3. check simple object's memory
  4. use it
wise frigate
#

so theoretically I could make an invisible simple object, with said memory point, then use that for setting position?

warm hedge
#

That literally is what I suggested, yes

wise frigate
#

But wouldn't that simple object also need to be attached to the player anyway

warm hedge
#

You can offset it and just attachTo

placid spear
#

I'm using this script to make an ACE "missile" follow the correct ballistic path of a shell when fired out of artillery. Works fine In local testing, but in use on a MP server, its causing the round to explode immediately. Any ideas as to why? I've doubled checkd most of it, nothing looks like its falling into the issue of local/remote issues

                    _ammo = _this select 4;
                    _gun = _this select 0;

                    _laserCode = [_gun] call ace_laser_fnc_getLaserCode;
                    if ( _ammo == "habfuze_155mm_m712") then {
                    _mode = _this select 3;
                    _projectile = _this select 6;
                    _carrier = "Sh_155mm_AMOS" createVehicle (getPos _projectile);
                    _projDir = vectorDir _projectile;
                    _carrier setVectorDir _projDir;
                    _carrier setPosWorld getPosWorld _carrier;
                    _initialVel = velocity _projectile;
                    switch (_mode) do {
                        case "Single1": {
                            _carrier setVelocity (_initialVel vectorMultiply .19);
                            _projectile setVelocity (_initialVel vectorMultiply .19);
                            _projectile attachTo [_carrier];

                        };
                        case "Single2": {
                            _projectile setVelocity (_initialVel vectorMultiply .3);
                            _carrier setVelocity (_initialVel vectorMultiply .3);
                            _projectile attachTo [_carrier];
                        };
                        case "Single3": {
                            _projectile setVelocity (_initialVel vectorMultiply .48);
                            _carrier setVelocity (_initialVel vectorMultiply .48);
                            _projectile attachTo [_carrier];
                        };
                        case "Single4": {
                            _projectile setVelocity (_initialVel vectorMultiply .8);
                            _carrier setVelocity (_initialVel vectorMultiply .8);
                            _projectile attachTo [_carrier];
                        };
                        case "Single5": {
                            _projectile setVelocity (_initialVel vectorMultiply 1);
                            _carrier setVelocity (_initialVel vectorMultiply 1);
                            _projectile attachTo [_carrier];
                        };
                    };
                    [_gun, _projectile, _carrier, _laserCode] spawn {
                        _projectile = _this select 1;
                        _carrier = _this select 2;
                        _laserCode = _this select 3;
                        waitUntil {
                        _spot = [getPosASL _projectile, velocity _projectile, 70, 2000, [1500, 1550], _laserCode] call ace_laser_fnc_seekerFindLaserSpot;
                        !isNil{_spot select 0}
                        };
                        _newVel = velocity _carrier;
                        detach _projectile;
                        deleteVehicle _carrier;
                        _projectile setVelocity _newVel;
                        };
                    };
                }];```
fair drum
placid spear
#

And SQF is cursed in of itself

misty rain
#

wich in this case was only the for each needing to be at the end of thee script and me missing a bracket

autumn terrace
#

anyone got a sample code for a simple 3D Hint? It's been used in a few Reaction Forces missions (Air Control FOB - recruitment terminal, arsenal ect.). I've been beating my head against the wall trying to recreate it. There appears to be no documentation on functions required for it on BIS wiki.

proven charm
autumn terrace
#

still far from the end goal but at least it's on the right track.

tulip ridge
west grove
#

is the 2nd example on vectorAdd wrong? if not, can someone explain to me why there is an additional 0 in the array?

#

especially when further down:

misty rain
#

aka im using it becouse im not knowledgable yet

#

aka im dumb

#

thats why im learning

tulip ridge
#

Just use something that's going to actually check for basic syntax mistakes like missing brackets or quotes

winter rose
misty rain
#

notepad ++ does that but when i misplace one (so it still exists) i sometimes fail to spot that, or know ehre to start and end

if you have good suggestion on what i can use besides notepadd++ i would love to hear it

tulip ridge
#

I personally just use VS Code

misty rain
#

ill take a look at that

winter rose
#

VSCode + SQF plugin = wonders

tulip ridge
#

It has a lot of nice extentions, including a couple arma specific ones like HEMTT's VS Code extention and some SQF languages as well

winter rose
#

hummm
thanks!

west grove
#

looks like the example is wrong

winter rose
tulip ridge
#

First provides some information on SQF commands when hovering over them and lets you view PAA files in VS Code
Second gives you an SQF "language" in VS Code for stuff like syntax highlighting.
Third adds a keybind (Ctrl+Alt+R) to open your last RPT file

misty rain
misty rain
#

and when theyre on a trigger it takes less resources then me zeusing 3 areas ahead so i cna place things where i want them to be or have them invisible and make them visible later

#

but again thanks for the help, ill take a look at vs studio, its prob gonna work a lot better then doing things on the notepad and then asking an ai to print it out to see if i missed something

tulip ridge
misty rain
#

aaaah makes sense

misty rain
tulip ridge
#

Correct, I'm saying that VS Code and Visual Studio are very different programs from each other

misty rain
#

oh sorry i didnt got that

#

ill jsut have to make sure i get the right one then

tulip ridge
#

VS Code is a text editor that has plugins for many languages/

Visual Studio is full IDE meant for more "traditional" programming languages (and also one that I can't stand personally).

tulip ridge
misty rain
#

i love how it just pops up the wrong one immediately even though i google for vscode

hallow mortar
# winter rose hummm thanks!

Originally meant for working with positions, so would convert 2D to 3D for safety. Changed in 2.14 when the vector commands gained the ability to work with any array size.

astral bone
#

Can I do "" if I don't need a parameter? Or is it better to do select?
_curTime params ["","","","_hour","_min","_sec"];
(I know dayTime is a thing, but I wanna get irl time for something xP)

astral bone
#

then I remember selectRandom is a thing

#

oh- hmm- I wonder if this is gonna run too late and it'll just blow up xP

#

I wanna have a game logic and I sync items to it. Selects random items to make be present, the rest are not. Current thinking, have them all synced and then it just removes all be 1-

#

Maybe I could use eden presence thing? idk how tho-

proven charm
#

Maybe synchronizedObjects with selectRandom

hallow mortar
#

Start with simulation disabled so nothing explodes, then you have all the time you need

kindred zephyr
winter rose
vapid scarab
#

Is there any way to retrieve a returned value from a spawned command?

hallow mortar
proven charm
#

or make the spawned code set a global variable 🙂

vapid scarab
#

Specifically talking about a returned value, Ill take that as a no. I was just asking because there was a comment about returning a value in a spawned function on the modules wiki page.

#

Why would it be good practice?

proven charm
#

spawn returns the script handle

proven charm
#

ugh idk to have your functions return something , looks good 😉

hallow mortar
vapid scarab
#

Fair. As personal practice, any function I need spawned, I always add

if (!canSuspend) exitWith {
  _this spawn bax_fnc_function;
};

Could cause some confusion, but this is usually for my own internal functions.

vocal chasm
#
null=[]spawn {

Jack sideChat "Hi there";
sleep 1;
Jack sideChat "Thanks for finding me";
sleep 3;
Jack sideChat "Santa crashed just North-West of here, but I'm guessing you guys already found that crashsite";
sleep 5;
Jack sideChat "I got captured trying to stop that bastard";
sleep 2;
Jack sideChat "He is trying to indoctrinate those little children with those communist ideas of him";
sleep 5;
Jack sideChat "He and his little goons placed some presents in the villages around here";
sleep 6;
Jack sideChat "We have to destroy those presents before those children open them";
sleep 5;
"VillageOne" setMarkerAlpha 1;
"VillageTwo" setMarkerAlpha 1;
"VillageThree" setMarkerAlpha 1;
Jack sideChat "I'll come with you and help fight those commies off";
sleep 1;
ATLAS sideChat "Your maps are updated with your new tasks, help Jack Frost to the best of your abilities";

};

So I ran this code in an operation. I didn't run it due to planning interferance, but the running zeus told me the dialogue would only get triggered for one person only?
This code was put into a trigger, one activated with radio and the other with player activation.
This is only one of the codes but it follows the same principle
Does anybody know what went wrong?

winter rose
vocal chasm
#

Ah, do you happen to know the global one?

winter rose
#

(also, what if Jack dies, the markers will still appear 😜)

vocal chasm
winter rose
#

I would do a quick'n'dirty

{
  if (not alive Jack) exitWith {};
  _x params ["_text", "_delay"];
  [Jack, _text] remoteExec ["sideChat"];
  sleep _delay;
}
forEach
[
  ["Hi there", 1],
  ["Thanks for finding me", 3],
  ["Santa crashed just North-West of here, but I'm guessing you guys already found that crashsite", 5],
  ["I got captured trying to stop that bastard", 2],
  ["He is trying to indoctrinate those little children with those communist ideas of him", 5],
  ["He and his little goons placed some presents in the villages around here", 6],
  ["We have to destroy those presents before those children open them", 5]
];

if (not alive Jack) exitWith {};
{ _x setMarkerAlpha 1 } forEach ["VillageOne", "VillageTwo", "VillageThree"];

[Jack, "I'll come with you and help fight those commies off"] remoteExec ["sideChat"];
sleep 1;
[ATLAS, "Your maps are updated with your new tasks, help Jack Frost to the best of your abilities"] remoteExec ["sideChat"];

improvable on the network side, but this will definitely work

vocal chasm
#

That looks a lot more advanced than I did it xD, but thanks a lot. Ill analyse the code and put it to good use

tropic nimbus
#

question, is there any way to directly add a magazine to a launcher?

tulip ridge
tropic nimbus
tulip ridge
#

It's fine, I just posted it in both

remote cobalt
#

Hey folks, I have a question about the "namespace getVariable / setVariable" functions. I have a mission template with a rather large amount of public variables and I was hoping to reduce the network traffic in a way that, the variables are known on the server and the players only get the variables they need when they need them, and not all of them.

So, this is setting and getting a Variable that is limited to the namespace. Depending on the locality of the namespace it differs where the variable is known. For example

player setVariable ["test",true];

is only known on the Players machine. If the code would be executed on another players machine, it would be in this players namespace.

So far, so good. But what is with global namespaces like missionnamespace.

When using a setVariable on missionnamespace I would think that when I use getVariable on missionnamespace on another machine, I should get the valua from setVariable.

Example:

//in initServer.sqf
missionnamespace setVariable ["test","This is a test"];

//in script on a players machine
missionnamespace setVariable ["test","Haha, no test"];

//in script on another machine
private _result = missionnamespace getVariable "test";
hint _result // Should show "Haha, no test"

Is that how it works? And if so, why is there a public parameter for the setVariable command?

Is that for the case when you use the namespace of an object that is on all machines and would promote the parameter to all other machines where this object exists?

Sorry if this is somewhat of a noob question but I really would like all your input on this.

sharp grotto
remote cobalt
sharp grotto
#

If you want to reduce network traffic you can use this for example in certain cases.

player setVariable ["VarName",_object, 2];

This will only set the var on the server and not on all other clients.

south swan
#

you can object setVariable ["name", value, true]; which isn't possible with publicVariable. You have way more convenient granular control for when you don't want to make stuff public to everyone.

remote cobalt
#

@sharp grotto Okay, thanks, I didn't think about that.

@south swan
Yeah, okay, so that is the real advantage of using setVariable / getVariable.

Okay, then next question (I'm sorry 😬 ):

Could I optimise the sheer amount of publicVariables in another way. Would ther ebe someway to create Variables on the server and then let the players get only the variables over network when they need them?

I know there are Mission Config Values that I could get via getMissionConfigValue but I always feared that this would be more performence heavy.

warm hedge
#

I always feared that this would be more performence heavy
It really shouldn't. At least ingame. Because config cannot be updated ingame but only in its initialization stage (even before init.sqf etc)

sharp grotto
#

You could also make a network function and send the data via remoteExec, but i doubt it has an advantage.
Only if you really hit the "JIP queue threshold" were it starts to affect the server, then you would probably profit from that.
#perf_prof_branch message

warm hedge
#

Even if there is an advantage, you cannot really see how better it is

remote cobalt
#

Okay, so you also would recommend trying this with missionConfigValues instead of publicVariables? To clarify, we are talking about some 600 to 800 values.

dusk gust
#

At that amount, I would suggwst to use config.

little raptor
remote cobalt
warm hedge
#

What exactly do you need it for? Why you want to have a var preinit, over a network?

little raptor
remote cobalt
warm hedge
#

Well, next question is, do you need it dynamically (aka does it really needed to be synced over network)

remote cobalt
warm hedge
#

Then you can maybe use config or even init.sqf etc

remote cobalt
warm hedge
#

"Just" declaring a variable won't lag anything, too

remote cobalt
# warm hedge "Just" declaring a variable won't lag anything, too

I thought so as well but I had a few missions on different dedicated servers where a variable, even though I used "publicVariable" was not changed on the server. I was thinking that might be because of the large use of publicVariables in my loadout system and wanted to explore other possibilities

little raptor
astral bone
#

Not sure where to ask this but uh- Why are my screenshots like this? The sky isn't right 😅

#

wait-

#

oh- right- ignore me, I forgot the command does transparency

warm hedge
#

screenshot? It shouldn't though

astral bone
#

?

astral bone
#

screenshot (_picName + "_1.png"); gives a transparent image. And that'd be fine, except I just realized if it's a night shot- well it isn't fine xP

#

err

#

what it's supposed to be

#

same thing on stratis

hallow mortar
#

Is it actually transparent?
There's a longstanding issue with screenshot where it uses incorrect gamma values, resulting in the image being much brighter than it should be.

astral bone
#

wait-

hallow mortar
astral bone
#

PPAA

#

Disabled gives it a transparent background. Otherwise, it actually renders the haze (Or whatever xP) on the sky

warm hedge
#

Well that sounds like an issue

astral bone
#

indeed

hallow mortar
astral bone
#

No, the sky

#

It's generating the image with the sky as transparent

#

Unless a cloud is blocking

#

these are the same image, but one, in paint dot net, I made a background layer that's full white, and the other full black.

#

So I'd need to do some color corrections to make up for the fact PPAA makes it a little brighter.

#

same image, but with one having disabled (and white background to see transparency) and the other having PPAA not disabled.