#arma3_scripting

1 messages Β· Page 153 of 1

faint burrow
#

Can you place a trigger in Eden and sync your terrorists with it?

#

That's not a good idea. When you have everything in code, it's not clear how the mission works.

manic sigil
#

Its tricky but doable, my entire Viper Blue scenario is a handful of placed objects, one unit with a waypoint, everything else handled by scripted function.

Sometimes its easier to work in a single medium; I know which file this or that objective is in and where the trigger I spawn for it is written in, I dont recall where I placed that trigger in Eden :p

faint burrow
#

Yes, when you open Eden, you will immediately see the trigger and the units synchronized with it. When you open the trigger settings, you will see its statements, which will make it clear how it works.

#

Of course, not everything should be placed in Eden, otherwise your mission will be static, but something that, for example, rarely changes, can be placed in Eden.

hallow mortar
#

No

#

This part:

_x addEventHandler ["Killed", {
        params ["aliveTerrorists1", "", "", ""];

does not work because:
a) in an event handler, the _this special variable, which is what params is interpreting, contains only the special information generated by the EH (in this case, the killed unit, the killer, etc). You can't pass custom arguments to an EH like this, it only receives the auto-generated arguments.
b) params generates local variables. A local variable is prefixed with _. A variable name without a _ at the start is a global variable. You are trying to get params to create a global variable - this doesn't work.

#

aliveTerrorists1 is a global variable, so it's already available in the EH scope, without any need for params. In another piece of code, one where you can pass custom arguments, you might pass a global variable and use params to assign it to a local variable within that scope - but you don't have to. That's what a global variable is, a variable that's available in any scope.

south swan
#

Maybe just send the introduction to scripting already? blobcloseenjoy

faint burrow
#

OK, my possible trigger based solution:

_trigger = createTrigger ["EmptyDetector", [0, 0], false];

_trigger synchronizeObjectsAdd [
    terrorist1,
    terrorist2,
    terrorist3,
    terrorist4,
    terrorist5,
    terrorist6,
    terrorist7,
    terrorist8,
    terrorist9
];

_trigger setTriggerActivation ["NONE", "PRESENT", true];
_trigger setTriggerStatements ([
    {
        _aliveTerrorists = (synchronizedObjects thisTrigger) select { alive _x };
        _aliveTerroristsPrev = thisTrigger getVariable ["aliveTerrorists", []];

        _aliveTerroristsChanged = _aliveTerrorists isNotEqualTo _aliveTerroristsPrev;

        if (_aliveTerroristsChanged) then {
            thisTrigger setVariable ["aliveTerrorists", _aliveTerrorists];
        };

        _aliveTerroristsChanged
    },
    {
        _aliveTerrorists = thisTrigger getVariable "aliveTerrorists";

        if ((count _aliveTerrorists) > 0) then {
            ["eliminate1", [_aliveTerrorists select 0, true]] call BIS_fnc_taskSetDestination;
        } else {
            ["eliminate1", "SUCCEEDED"] call BIS_fnc_taskSetState;
        };
    },
    { }
] apply { toString _x });
tulip ridge
#

aliveTerrorists needs a tag

faint burrow
tulip ridge
#

An identifier unique to you, the mod, or the mission.
So ace's tag is ace. All of their global variables, class names, and variables saved to objects start with ace. It's to prevent conflicts with other scripts and mods

faint burrow
#

I think the tag will be redundant (although it can be used), because the trigger is local, and aliveTerrorists is also local.

tulip ridge
faint burrow
faint burrow
#

No, @hallow mortar , it's local var.

tulip ridge
hallow mortar
tulip ridge
#

setVariable is also not private. Only the private keyword (and param(s)) makes private variables

hallow mortar
faint burrow
hallow mortar
#

setVariable doesn't make local (scope) variables. It does make local (network) variables, but that's not what tag-based conflict protection is about. setVariable variables are object-namespace-specific but still global scope.

faint burrow
hallow mortar
faint burrow
hallow mortar
#

The default value is the value that getVariable will assume, if the variable you told it to get hasn't been defined. In this case the default value is [], an empty array.

tulip ridge
faint burrow
#

It's the trigger that executes the code.

tulip ridge
#

Whether it is synced or not

faint burrow
#

OK, I don't mind.

hallow mortar
#

When the trigger activates, it executes an instance of its activation code. thisTrigger refers to whichever trigger was activated and created the instance currently being executed. It's a way of referring to the activated trigger without needing to give it a specific variable name.

#

To be absolutely clear, thisTrigger is only available in the activation code of a trigger.
* well the condition and deactivation code too, but you get the point - only in contexts belonging to a specific trigger.

faint burrow
#

And to reuse it in the condition on the next iteration.

#

Correct.

faint burrow
#

Learn and practice, then you will be able to write code without checking in the game, as I wrote mine, which worked on the first try.

placid root
#

findemptyposition is already in there. it finds a empty pos the problem is that it sticks to it in every cylcle and ignores new spawned obsticles. bis fnc_findsafepos does not work for small areas ... haha yeah params.... i usuali use them if i want to make something optional but yes u r right. looks better

#

if i delete the lines with the dummy vehicle all groups spawn in one another although the script should find a empty position

#

And I didn't use params because I was to lazy to look up the syntax :P

jade acorn
#

can I apply a wreckage texture to a vehicle without having to write a separate config and making it a different vehicle? To my understanding all the damaged textures exist only as rvmats

meager granite
#

Yes, through setObjectTexture/setObjectMaterial if they are there and cover the whole vehicle

#

Just material might be enough, not sure, I remember playing around with it

jade acorn
#

ah I'll look into it then, thanks

meager granite
#

Damage -> mat

#

Just setObjectMaterial here

#

You can make it look even more damaged with setObjectTexture if needed

placid root
#

and does anyone have a working solution for a condition in an EH killed? i want it only to fire if all units of a group are dead. the EH got attached to all units of the group

#

i hat if({!alive _x] foreach units my_group) then { do stuff}

#

the problem with this is it sometimes fired prematurely ^^

neon plaza
#

Is there a way to make this line of code apply only to player controlled AI?

#

//Self revive EXAMPLE
player addAction ["All units self-revive", {
    (allUnits select {lifeState _x == "INCAPACITATED"}) apply {
        _x remoteExec ["DREAD_fnc_unitSelfRevive", _x];
    };
}, nil, 10, false, true];

cyan dust
#

Good day.
I've noticed that when using addBackpackCargo command not only the backpack itself is added, but also some items may be put in it along the way.
Example:

cursorObject addItemCargo ["B_AssaultPack_mcamo_AA",1];

Expectation: Just an empty backpack added
Reality: Backpack added with two Titan missles in it

Is there any way to prevent this from happening?

faint burrow
cyan dust
neon plaza
south swan
#

replace with the list of units you want to revive blobdoggoshruggoogly

neon plaza
#

Issue Is that the units are units that are spawned In game. I am not sure how you would give It a var name once a player buys a unit In warlords.

faint burrow
#
params ["", "_caller"];

((units _caller) select { (lifeState _x) == "INCAPACITATED" }) apply {
    _x remoteExec ["DREAD_fnc_unitSelfRevive", _x];
};
granite sky
#

Depends how you identify "player controlled AI", really.

#

Is that everyone in a squad with a player in it? Everyone on a specific side? Everyone in a squad linked to high command?

delicate hedge
#

how do i use macros with 2 arguments?
I write in comfig:
#define MSG(TEXT, TYPE) [TEXT, TYPE] call EMM_fnc_message;
And then try to use it in code:
MSG("test", 0);
But it shows error that ";" missing

opal zephyr
#

#define shouldnt have a semicolon at the end

proven charm
little raptor
#

Actually since it's in config you can't have 2 ;s yeah

little raptor
proven charm
#

ok

little raptor
#

Either that or the config is not correct at all

proven charm
#

not sure how call's work in config...

#

it should have __EVAL

tulip ridge
#

What?

#define MSG(text,type) "[##text##, ##type##] call EMM_fnc_message"

class something {
    someCode = MSG(something,something);
};
neon plaza
faint burrow
#

Unfortunately no.

flint topaz
#

If I wanted to get a list of all the possible options that can be put in a units identityTypes[] array in SQF where are these stored? Example:

identityTypes[] = {"Head_Euro","LanguagePER_F","G_IRAN_default"};
proven charm
flint topaz
#

I want to use SQF to get an array

#

of all the possible options

proven charm
#

yeah, getArray for that

#

getArray (missionConfigFile >> "identityTypes")

flint topaz
#

example what is LanguagePER_F and where is it stored by default?

proven charm
#

in the array

flint topaz
#

...

proven charm
#

oh nvm i thought you were defining that array

flint topaz
#

Let me reword this

#

I want to provide a utility that can provide all the possible options that could be defined in identityTypes[], this is for a faction creator mod. So I want to create an array of all the possible options, so the players can pick ones they want, what I provided was just an example of the output of my mod

#

Lets say I want to know all the possible options that are valid for what you CAN put in the array identityTypes. How would I get this list of potential options?

neon plaza
delicate hedge
tulip ridge
#

Just an example of using it
The macro I sent on it's own won't work (typed it kinda quick). There's probably a way to "one-line" it, but a better way would be to use multiple macros:

#define QUOTE(var1) #var1
#define ARR_2(var1,var2) var1, var2
#define MSG(text,type) QUOTE([ARR_2(text,type)] call EMM_fnc_message)

Which probably looks like a bunch of macro nonsense though

#

Oh nevermind, you didn't need it quoted in your original message, so you could make that simpler

proven charm
#

are you putting the macro in one file and use it in another file?

neon plaza
#

I am trying to make this line of code so that rather forcing the script on the listed men In the array, It will target all player controlled AI (Non high commander view).

#

[me, man, man_1, man_2, man_3] apply {
    _x call DREAD_fnc_addRevive;
};
//sleep 0.5;
[man, man_1, man_2] apply { _x setDamage 0.99; [_x,[0,0,-8]] remoteExec ["setVelocityModelSpace", _x]; };

stable dune
#

{
    _x  call DREAD_fnc_addRevive;
} forEach [me, man, man_1, man_2, man_3]

sleep 0.5;

{
    _x setDamage 0.99;
    [_x,[0,0,-8]] remoteExec ["setVelocityModelSpace", _x];
} forEach [me, man, man_1, man_2, man_3]

Or all in one forEach if you don want sleep

south swan
#

8 hours since units player was mentioned

neon plaza
#

units player apply {
    _x call DREAD_fnc_addRevive;
};
//sleep 0.5;
[man, man_1, man_2] apply { _x setDamage 0.99; [_x,[0,0,-8]] remoteExec ["setVelocityModelSpace", _x]; };

tulip ridge
#

Also why are you using apply, you're not modifying the array, which is what apply is for.

Use forEach if you just want to do X thing with each element

neon plaza
tulip ridge
#

What are the "player's AI", are they in the same group as the player?

neon plaza
#

Yes sir

tulip ridge
#

Save units player to a variable, loop over that array

neon plaza
#

In warlords game match, the players are allowed to buy AI that will follow them.

neon plaza
neon plaza
#

Is there a way to get the script to check for new units In the players group and make the code work?

#

[] spawn {
    while {true} do {
        if (lifeState player == "INCAPACITATED") then {
            //sleep 0.01;
            [man_3, player] call DREAD_fnc_unitReviveBody;
            man_3 removeAction (man_3 getVariable (str player));
        };
        sleep 1;
    };
};

delicate hedge
#

is there any other way to get result from spawned function except global variables?

faint burrow
#

Passing variable by reference.

delicate hedge
faint burrow
#
_array = [0];

_scriptHandle = _array spawn {
    sleep 5;

    _this set [0, 1];
};

waitUntil { scriptDone _scriptHandle };

hint (str (_array select 0));
ornate whale
#

Is there an easy way how to check if an animation move exists, before executing the animation?

warm hedge
#

isClass

ornate whale
# warm hedge `isClass`

Thanks. I guess this is not practicall, if I want to allow all available animations, given that the paths are different.

warm hedge
#

Hm, paths as in? What's your goal then?

ornate whale
#

I am writing a function for ambient animations, and I wanted to find a way how to revert all previous actions if the animation does not exist or is not played correctly.

warm hedge
#

Maybe you want to wait until 2.18 and use updated switchMove

south zenith
#

I'm just learning how to use hashmapObject, it is very useful, I found out how to get data from "Methods", but is there any way to send data into these "Methods"? As arguments of course

south swan
south zenith
#

Sorry I missed that entirely...

#

πŸ€¦β€β™‚οΈ

#

Thanks a lot

tribal crane
fair drum
candid scroll
#

Hey everyone! I've been doing a lot of research into this and haven't found any solutions outside of the "screenshot" command.

#

Is there any way for a mod or scripting to access the image data of in-game cameras? Or even player perspective?

tough abyss
tough abyss
tough abyss
# tough abyss

How do I apply it in a way where my in game map looks like this

candid scroll
#

I was reading into pip and rtt but couldn't see a way to actually store the raw image data anywhere? Or access it?

warm hedge
#

No, that's the screenshot command does

candid scroll
#

But there's no way to run "screenshot" on an RTT output right?

#

Without taking over the players perspective

warm hedge
#

I'd like to hear your actual goal before proceed my answer

candid scroll
#

Ingame "head cams" displayed through a website

warm hedge
#

Website?!

candid scroll
#

Yeah

warm hedge
#

You may want to write a DLL. This is not even a scope of SQF

candid scroll
#

Yeah that's the plan

#

I just haven't found anything remotely close to allowing me to access image data in any documentation I've read

#

Doesn't seem that pip or rtt exposes the texture data in a way that would be useful

#

My only workaround which isn't ideal is limiting the "head cams" to real players by running the screenshot command on an interval with the DLL mod uploading it to the backend

warm hedge
#

The channel right here, is about SQF, not DLL, which is not something I can provide any info. Try your luck in #arma3_tools

candid scroll
#

Ahhhh okay

#

Thank you!

warm hedge
tough abyss
warm hedge
#

...Why you ask that when you have a proof of concept already

tough abyss
#

In game map I mean

#

In-game when I press the M button

warm hedge
#

I'm not following

#

Yes it literally does some marker and draw on map

tough abyss
#

Alright thanks

cyan dust
#

Good day. I noticed that for dead units getUnitLoadout ,getWeaponCargo or primaryWeapon won't get its primary weapon (accessible when looting the corpse). Is there any way to get it with code?

warm hedge
#

2.18 is not so far away AFAIK

cyan dust
#

<annoying kid voice>
But I donwanna 2.18, I wanit noooow
</annoying kid voice>

#

Seriously though? Any known workaround?

warm hedge
#

Maybe checking nearObjects to detect near weapon holders?

cyan dust
placid root
#

haha yeah i now the cheat sheet.

still forum
#

@grizzled cliff well you could just have used your own Detour function and memory search function... Then you would have had linux compat right in the beginning ^^

south zenith
pure hawk
#

Hi guys, a quick question pls.
If I wanna let an Ai group respawn after another group got eliminated. How will the scrip be?

manic sigil
# pure hawk Hi guys, a quick question pls. If I wanna let an Ai group respawn after another ...

To break it down;

Youre looking for a setup that will 1) check for any remaining living units in an existing group, then 2) create a group of units once 1. has been triggered.

For the first part, you have some options. The most simple would be interrogating the list of units in the group to find if any are alive.

units groupNameHere findIf {alive _x} == -1

This structure returns the value in the array of units in the group that first return true for 'alive unit'. If none of the units are alive, it returns -1; this is what we want as the condition, since it means none are alive.

For creating a group, I recommend https://community.bistudio.com/wiki/BIS_fnc_spawnGroup . Its a fairly straightforward and flexible function, just needs the relevant inputs for whatever faction, side, location, and optionally types of units you want.

If youre using the editor, the findIf function goes in the Conditions for a Trigger, and the spawnGroup code in the onAct section. If youre using a called function, youll need to create the trigger yourself. If youre using a spawned section of code, you can use a waitUntil to keep checking until all the units are dead in the first group.

south swan
dim kelp
#

Server: Object 0:0 not found (message Type_185) How can I read the log file?

still forum
#

0:0 is invalid. Probably sent some local-only object to the server

#

A fireplace? Probably have a local-only fireplace, and someone turned it on

dim kelp
#

@still forum This is not the only error. Where can I see these errors in detail?

still forum
#

nowhere

dim kelp
still forum
#

Its all the same error though

dim kelp
#

Is the problem with the fireplace?

kindred zephyr
#

the problem is the locality transference for certain objects, unless you are manually sending them there is not a whole lot you can do for those errors

#

atleast for the object x:x not found issues

stable dune
# dim kelp Is the problem with the fireplace?

If you mean your error of an object not found, maybe.
But you should start 1st from your script errors that you have alot in your log file.
I bet object not found is your littlest issue there.

kindred zephyr
#

everything else is script based

#

yep

still forum
# dim kelp Is the problem with the fireplace?

Yes. You have a local-only fireplace.
And someone is trying to turn it on. Which tells everyone else in the server to also turn it on. But its local-only, the others don't even know that it exists

#

You shouldn't local-only objects, that are being interacted with and need to be synced

dim kelp
#

So, what is the error that causes the altis map to be corrupted because it cannot enter the server?

still forum
#

🀷

unborn field
#

o7 folks, here with another issue with sqf. I'm trying to make a HEMTT work with MIM-145 Defender. Here's the code:

this addAction ['Deploy SAM', {  
    if (isNil {_this select 0 getVariable 'defenderDeployed'}) then {  
        _defender = createVehicle ['B_SAM_System_03_F', getPos (_this select 0), [], 0, 'CAN_COLLIDE'];  
        _defender attachTo [_this select 0, [0.03, -7.3, 2]];  
        _this select 0 setVariable ['defenderDeployed', _defender, true];  
        _this select 0 lockCargo true;  
        _this select 0 lockDriver true;  
    };  
}, nil, 1.5, true, true, "", "_target distance _this < 5 && isNull objectParent player"]; 
 
this addAction ['Undeploy SAM', {  
    if (!isNil {_this select 0 getVariable 'defenderDeployed'}) then {  
        _defender = _this select 0 getVariable ['defenderDeployed', objNull];  
        if (!isNull _defender) then {  
            detach _defender;  
            deleteVehicle _defender;  
            _this select 0 setVariable ['defenderDeployed', nil, true];  
            _this select 0 lockCargo false;  
            _this select 0 lockDriver false;  
        };  
    };  
}, nil, 1.5, true, true, "", "_target distance _this < 5 && isNull objectParent player"]; 

"Deploy SAM" - Creates the Defender, attaches it behind HEMTT at given coordinates and disables all seats in HEMTT.
"Undeploy SAM" - Deletes/removes the Defender and unlocks HEMTT seats.

The code works like this flawlessly, but there's an issue. You deploy it, shoot 2 out of 4 missiles and undeploy it. Drive off to a different location, deploy it again, voila 4 rockets. This is a problem and not the behavior I'm looking for.

I understand that deleting a vehicle that fired rockets and creating a new one is one of the issues here. Creating a new vehicle resets the ammo count, simply put. But what if there was a way to save the ammo count and use it for when I create a new vehicle and alter the magazine count?

delicate hedge
#

when i spawn (scheduled env.) code and call (unscheduled env.) some func in it and then call there next funcs and next.... will all this calls be as a part of spawned block? so all they will be halted by engine if they dont complete under 3 ms on frame?

south swan
south swan
granite sky
#

call isn't unscheduled. It just runs the code in the current context, whatever it is.

#

If you actually wanted to run unscheduled code from within scheduled code then there is isNil { your code here }

#

sometimes useful

candid narwhal
#

Question:
Does this Switch behave as I want it to?:

switch (bool) do {
  case true   :{}; //True
  case false  :{}; //False
};

since:

switch (playerSide) do
{
    case west: { hint "You are BLUFOR"; };
    case east: { hint "You are OPFOR"; };
        case guer: { hint "added for completion"; };
};

Works fine.

I want it as a way to avoid an "if statement".

[true, (...)] call fnc_someFunction So that the true case does something and the false case does something else.

stable dune
#

You can add default to switch.
and in if has

if (true) then {
  //do stuff if tru
} else {
 //do stuff if false
}
candid narwhal
#

I want to know if I can use a True / False switch and if it does what I think it does

pure hawk
#

thanks @manic sigil

tulip ridge
#
switch (true) do {
    case (1 + 1 == 2): {...};
};
candid narwhal
#

okay thx!

edgy dune
#

I have a PIP script I want to toggle on and off, would the best course be have a model cfg animation that hides the selection, have an animationSource config, then use animateSource to toggle it?

hallow mortar
fair drum
#

There is also the ternary select syntax

tulip ridge
hallow mortar
#

Their original question seemed pretty clear that they just wanted to pass a plain bool to a function and have different results based on whether it's true or not, which is pretty much the textbook use case for an if/else.

tulip ridge
#

Didn't even see that last part of their message

indigo snow
#

What does your requiredAddons look like?

icy sand
#

How to make the hint only for one player?

warm hedge
#

hint will be executed only on the computer where it is executed. AKA, it is not executed globally

icy sand
#

but on the server I want only one player to see the message, not everyone. Is there another option?

warm hedge
#

As I said, hint can happen only on one player. If you want to troubleshoot your code, post it

icy sand
#

in 3den Enhanced, in the hold down button action tab, I want to give the player information about the cause of death.

proven charm
icy sand
proven charm
icy sand
#

thanks

ruby turtle
#

Is there a solution to check If Players stay in direct sunlight? I want to simulate sun radiation as deadly enviroment by time If a Player stays too Long in direct sunlight.

warm hedge
ruby turtle
#

the Shadow of the Player itself is excluded from this?

warm hedge
#

Dunno, try it

sharp grotto
#

It's just a getter for light settings. Won't account for player being inside a building, below a tree, inside a car etc.
Need to combine it with other checks then it could work ^^

ruby turtle
#

so then its Not what i searching for, badly

warm hedge
#

As I said, check my comment below

ruby turtle
#

My plan is let Check every second if player stays in sunlight, as Long as he stays there, he will get the ACE chromatic abberation effect and get smooth damage by time until he gets into a shadow

#

``sqf
// Position of the player
_playerPos = getPosATL player;

// Direction to the sun
_sunDir = sunOrMoon; // returns the direction to the sun
_sunPos = _playerPos vectorAdd (_sunDir vectorMultiply 10000);

// Check if the sun directly illuminates the player's position
_isInShadow = lineIntersectsSurfaces [_playerPos, _sunPos, player, objNull, true, 1, "VIEW", "NONE"];

// Output the result
if (_isInShadow) then {
hint "You are in the shade.";
} else {
hint "You are in the sunlight.";
};
`

does this make sense?

sharp grotto
warm hedge
#

lineIntersectsSurfaces cannot detect a line between two points that more than 1000m away too

sharp grotto
jade acorn
#

whatever you're writing it looks like a cool piece of code

onyx gust
#

does anyone know how the elevator script works in cytech?

jade acorn
#

is it a module you can place or baked into an object

rich frost
#

If have seen this an rpt recently - i would like to use that myself - anyone know if this is like an inbuilt feature or is this some custom script using BIS_fnc_log?
specifically, the [postInit], fnc, (exec time?) is really curious to me.

2024/08/14, 11:06:53 "armahosts/BIS_fnc_log: [postInit] CBA_fnc_postInit (1037.11 ms)"
2024/08/14, 11:06:53 "armahosts/BIS_fnc_log: [postInit] storm_fnc_postInit (0 ms)"
2024/08/14, 11:06:53 "armahosts/BIS_fnc_log: [postInit] storm_fnc_cba_settings_initialized (0 ms)"
2024/08/14, 11:06:53 "armahosts/BIS_fnc_log: [postInit] tsp_animate_fnc_init (4.88281 ms)"
ruby turtle
granite sky
#

_sunDir = sunOrMoon; // returns the direction to the sun
ChatGPT? :P

oblique bolt
#

can anyone tell me what is wrong with: vehicle setConvoySeparation 20;

It keeps telling me: Init: Missing ;

ornate whale
oblique bolt
#

oh

#

Thank you very much

cobalt path
#

Question, maybe like a week ago there was a mod/composition on the workshop called Vehicle Markings smth smth. Anyway, I think it was removed because I cant find it.
However what it had was a Text display object where you can type in text and display it like a graffiti. U could select front and size and text by editing the script. Because it was a composition, I assume it was scripted and base game. Composition was on an object called Test Display or smth.
Anyone got any idea how to do it?

hallow mortar
#

Sounds like UI-to-texture

opal zephyr
#

Does anyone know a way to convert from dik code to standard key names?

jade acorn
#

I think it's in the base game

jade acorn
opal zephyr
#

script

#

Using this include #include "\a3\ui_f\hpp\definedikcodes.inc" I can check for a keys usage in keydown instead of its dik code. But I'm trying to populate an rscText with a key to press based on the users control scheme, so I need it to do it by itself without an eh

opal zephyr
#

Thanks, looks like actionKeysNames also does it. I looked at the wiki for it awhile ago but misunderstood it

cobalt path
hallow mortar
#

Compositions must contain an object, you can't have script-only compositions. So that composition would contain one object (it must be a vanilla object since compositions can't add new object types, but you can name the composition anything) acting as a carrier for code, in its init field.

#

And that code would use procedural textures, either directly on the vehicle or on script-created user texture objects, to create the markings.

silent comet
#

I've been messing with the task framework for some MP missions, but sometimes the tasks that are set as completed reset to unassigned (Most often after about 30 minutes). I was creating them using call BIS_fnc_taskCreate through an init.sqf

hallow mortar
#

init.sqf runs on all machines when they start the mission - including JIP machines when they arrive. So a new player connecting...after about 30 minutes, let's say...would create the task again.

#

BIS_fnc_taskCreate is global argument/global effect, so it only needs to be run on one machine. I'd suggest moving it to initServer.sqf, or using an if isServer check in init.sqf.

cobalt path
formal grail
#

There seems to be an issue where if (on a dedicated server) a SAM site switches locality to a client player, the locality change is not immediately fully propagated. If the player attempts to fire out of the SAM site while it is propagating, no missile comes out of it.
Is this a known bug?

haughty sand
#

does anyone know how to fix this. it wont let me connect to my server anymore it happend as of yesterday. it wasnt always an issue but only effects a few players like 1 out of 10

#

BattlEye Client: Server computed GUID: ba97b5bb157d83376eGfd7f915baa7e4

#

looks like this

hallow mortar
#

That's an information message, not an error message. It's just telling you the server knows about you and has generated a unique ID for you. It will also happen on successful connections.

haughty sand
#

why is it not letting me connect then?

hallow mortar
#

I don't know, there's a huge number of possible reasons why connections can fail.

quiet gazelle
#

is there a way to broadcast a variable in an objects namespace over network?

hallow mortar
#

Yes, the public flag of setVariable works exactly the same in any namespace (unless it's the namespace of a local-only object, of course)

quiet gazelle
#

thank you

quiet gazelle
#

so to broadcast the value of a variable from the server to all clients i'd basically do this, right?

_object setVariable ["myVariableName", _object getVariable "myVariableName", true];
faint burrow
naive needle
#

does someone know a good solution to not let an object slide a bit of his position when using setpos commands ?

naive needle
#

maybe it has something to do that the object might not have an landcontact memory point ?

naive needle
#
_object setPos (getpos _object);  
_object setVectorUp (surfacenormal (getPosASL _object));
#

alrdy doing it

granite sky
#

_object setPosWorld (getPosWorld _object); is the only one that's close to maintaining position, IIRC

naive needle
#

omg thank you

#

you are the best

granite sky
#

I don't use it with units though. Wouldn't know what it does there.

fair drum
#

!quote 5

lyric schoonerBOT
granite sky
#

setPosATL and setPosASL also don't work for this.

naive needle
#

yea exactly

#

I used setposatl and the beartrap ended up being under the ground after 3 days xd

granite sky
#

nods

oblique bolt
#

how do can I make a unit's side change?

I've tried using: gunh(name of the unit I want to change) joinSilent createGroup EAST;
but it's giving me errors

oblique bolt
#

I believe I fixed it, it required more than one unit

#

[unit1,unit2]

#

instead of just one unit

warm hedge
#

No. join commands work for one unit too. It just requires an array

neon plaza
#

Trying to get this line of code running.

#

Ran Into some type of Issue./

#


this addAction ["Set Tactical Nuke Coordinates!", 
{
    params ["_target", "_caller", "_actionId", "_arguments"];  
    [true] remoteExec ["openMap", _caller];
    
    _caller onMapSingleClick {
        blast setPosASL (AGLToASL [_pos #0, _pos #1, 0]);
        _str = (format["%1%2%3%4%5%6%7", "<t color='#ffffff' size='3'>", "RED ALERT!!! We detected actors setting tactical nuclear bomb coordinates to: [",round (_pos #0), ",", round (_pos #1), "]", "</t>"]);
        titleText [_str, "PLAIN DOWN", 0.25, true, true];
        [false] remoteExec ["openMap", _this];

{[getPos blast, 500, true, true, 2,160000] execVM "freestyleNuke\iniNuke.sqf";NukeActivated = false;}, [], 0, true, true,"","NukeActivated",3.1600]; 

    }; 
}, nil, 1, true, true, "", "(str(side _this) == 'WEST')", 5];

warm hedge
#

What issue

neon plaza
#

Have an error code with It.

#

;

#

Missing

warm hedge
#

In where

granite sky
#

The line starting with {[getPos blast, I guess. Not sure what the intention was there.

hallow mortar
# neon plaza ```sqf this addAction ["Set Tactical Nuke Coordinates!", { params ["_targ...
  • You don't need to remoteExec openMap in any of these cases. It's already being executed where the caller is local, because that's where action code is executed.
  • It's strongly recommended to use the mission event handler "MapSingleClick" instead of onMapSingleClick, because onMapSingleClick is not stackable - whenever you use it, it wipes out whatever it was previously set to. Not very cross-compatible.
  • That format seems excessively complicated. You don't need to make every single piece of it a separate argument. Simplified (more readable) version below.
  • As John said, the line starting with {[getPos blast is almost certainly wrong. The execVM part is probably OK, as long as those are valid arguments for iniNuke.sqf, but then it's wrapped in a random set of {} and there's the back end of another array stuck to it (minus an opening [). It just doesn't make any sense, grammatically or logically.
format ["<t color='#ffffff' size='3'>RED ALERT!!! We detected actors setting tactical nuclear bomb coordinates to: [%1, %2]</t>", round (_pos#0), round (_pos#1)];```
#

oh, and you should probably remove your onMapSingleClick or "mapSingleClick" EH after they've clicked, otherwise they can just keep doing it. That might be bad for the environment.

candid narwhal
#

greeting, following issue:

params [
    ["_player", objNull, [objNull]],
    ["_endType", objNull,[objNull]]
];

End3 = _endType;

_uid = getPlayerUID _player;

if !(_uid in ADALIB_whitelisted_opfor) then {
    //disableUserInput true; //lets NOT do this
    hint "this Side is restricted";
    sleep 1;
    ["End3"] remoteExec ["endMission", _player];
//    failMission "End3";
} else {
    hint Format ["Welcome Comrade %1", name player];
};

Does not display the correct End3 defined in the description.ext

class CfgDebriefing
{
    class End3
    {
        title = "You are not whitelisted";
        subtitle = "Please choose a slot on Greenfor";
        description = "";
        pictureBackground = "";
        picture = "";
        pictureColor[] = {0.6,0.1,0.2,1};
    };
};
#

the function is called the following way:

params [
    ["_player", objNull, [objNull]],
    ["_jip", false, [false]]                      
];
//switch for LOCAL Player stuff and function calls
switch (playerSide) do
{
    case west: { hint "You are BLUFOR"; [_player,"End3"] remoteExec ["ADALIB_fnc_whitelistBlue", _player];}; //maybe remove the hint
    case east: { hint "You are OPFOR"; [_player,"End3"] remoteExec ["ADALIB_fnc_whitelistOpfor", _player];};
};
#

How would I go about it using the correct "End3" ?

#

I got to leave for sleep here soon, so feel free to @ ping me so I can look at the answers later. Thx in Advance!
(If i miss the answers i might repost this question)

lone glade
#

@quicksilver says the guys who uses while {true} do loops everywhere

grizzled cliff
#

@still forum thats what im doing now, Detours was just the fastest way to do it at the start for hooking. Also I had my own memory searcher, but really the only way to do memory searching is with OS specific functions. I don't even need a memory searcher now.

#

I just need to do three pointer arithmetic operations and im good to go.

lone glade
#

@grizzled cliff when are you planning to get intercept whitelisted by BE? or is it already done ?

grizzled cliff
#

plan to yes, but the dll is changing so often right now that whitelisting it would be pointless

neon plaza
neon plaza
#

Trying to get the sleep mode to work for one time use. Saying I have the bracket messed up.

#

this addAction ["Activate Nuke!", 
{
    params ["_target", "_caller", "_actionId", "_arguments"];  
    [true] remoteExec ["openMap", _caller];
    
    _caller onMapSingleClick {
[(AGLToASL [_pos #0, _pos #1, 0]), 500, true, true, 2,160000] execVM "freestyleNuke\iniNuke.sqf";
        _str = (format["%1%2%3%4%5%6%7", "<t color='#ffffff' size='3'>", "Tactical Nuke Has been called In on: [",round (_pos #0), ",", round (_pos #1), "]", "</t>"]);
        titleText [_str, "PLAIN DOWN", 0.25, true, true];
        [false] remoteExec ["openMap", _this];
    };
}, nil, 1, true, true NukeActivated = false;}, [], 0, true, true,"","[NukeActivated",3.1600];


#

somewhere at the bottom

tulip ridge
neon plaza
# tulip ridge

Trying to figure out how to get the script to be used only once so that the player cannot call for It again.

tulip ridge
#
this addAction ["Title", {
    params ["_target", "_caller", "_actionID", "_arguments"];
    _target removeAction _actionID;
}];
neon plaza
#

And thank you for the pointers by the way.

tulip ridge
#

Well, look at it

#

You want to remove the action after it's used, removeAction does exactly that. So then you run that in your action's statement.

still forum
#

Are you memory searching from an external application O.o i dont use any OS function for mem search... char* data = 0x1234556; memcmp(data,"\0x54");

neon plaza
#



 
this addAction ["Activate Nuke!",  
{ 
    params ["_target", "_caller", "_actionId", "_arguments"];   
    [true] remoteExec ["openMap", _caller]; 
     
    _caller onMapSingleClick { 
[(AGLToASL [_pos #0, _pos #1, 0]), 500, true, true, 2,160000] execVM "freestyleNuke\iniNuke.sqf"; 
        _str = (format["%1%2%3%4%5%6%7", "<t color='#ffffff' size='3'>", "Tactical Nuke Has been called In on: [",round (_pos #0), ",", round (_pos #1), "]", "</t>"]); 
        titleText [_str, "PLAIN DOWN", 0.25, true, true]; 
        [false] remoteExec ["openMap", _this]; _target removeAction _actionID;
    }; 
}, nil, 1, true, true ]; 

marsh zodiac
#

sorry to intrude but anyone reckon they could help with a basic effect script? trying to get the effect to occur mid air but it will always spawn the vehicle on the ground and occur there.

if`` (!isServer) exitWith {};

_orb = "Sign_Sphere10cm_F" createVehicle getPosASL b1;

_exp = "#particlesource" createVehicleLocal getPosASL _orb;
_exp setParticleCircle [0,[0,0,0]];
_exp setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal.p3d",16,0,16,1], "", "Billboard", 1, 0.3, [0,0,0], [0,0,0],5,10,7,0.1, [100,80], [[1,1,1,1],[1,1,1,0]], [1], 1, 0, "", "",_orb, 0, false];
_exp setDropInterval 0.1;


_exp2 = "#particlesource" createVehicleLocal getPosASL _orb;
_exp2 setParticleCircle [0, [0, 0, 0]];
_exp2 setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_exp2 setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1,0.5,[0,0,0],[0,0,3],0,10,7.9, 0, [10,200], [[1, 1, 1, 1], [1, 1, 1, 1]], [0.08], 0, 0, "", "", _orb, 0, false];
_exp2 setDropInterval 500;

sleep 0.3;
deleteVehicle _orb;'
hallow mortar
#

You're using getPosASL but createVehicle type commands require ATL/AGL positions. Using two different height formats causes problems.
Try using ASLtoAGL on the position before creating the object, or using setPosASL on the object after creating it.

warm hedge
#

Use setPosASL to orb and effects

#

To make it sure and not to confuse position format, I always take this way

gusty walrus
#

why can CfgSFX and CfgEnvSounds only be played by triggers? which genius came up with this idea? anyone know of a workaround?

marsh zodiac
#

ah thanks ill give it a shot

gusty walrus
#

arma has like 7 different functions for playing sounds and they're all shit

gleaming rivet
#

Create a local trigger on the player and activate it to play the sound.

gusty walrus
#

i'm already doing that, it's just annoying

#

i just wish we had a decent set of audio functions...pause, rewind, fast forward, EQ, filtering, compression, reverb, etc

marsh zodiac
#

I apologize. i understand what you both are saying but i am having trouble turning it into script as i am pretty new to this.

It sounds like it should be as simple changing getpos to

_orb = "Sign_Sphere10cm_F" createVehicle setPosASL b1;

_exp = "#particlesource" createVehicleLocal setPosASL _orb;
_exp setParticleCircle [0,[0,0,0]];
_exp setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal.p3d",16,0,16,1], "", "Billboard", 1, 0.3, [0,0,0], [0,0,0],5,10,7,0.1, [100,80], [[1,1,1,1],[1,1,1,0]], [1], 1, 0, "", "",_orb, 0, false];
_exp setDropInterval 0.1;


_exp2 = "#particlesource" createVehicleLocal setPosASL _orb;
_exp2 setParticleCircle [0, [0, 0, 0]];
_exp2 setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_exp2 setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1,0.5,[0,0,0],[0,0,3],0,10,7.9, 0, [10,200], [[1, 1, 1, 1], [1, 1, 1, 1]], [0.08], 0, 0, "", "", _orb, 0, false];
_exp2 setDropInterval 500;

sleep 0.3;
deleteVehicle _orb;'
#

or adding something like

if`` (!isServer) exitWith {};

_pos1 = ASLToAGL getPosASL b1;
_orb = "Sign_Sphere10cm_F" createVehicle getPos _pos1;

_exp = "#particlesource" createVehicleLocal getPos _orb;
_exp setParticleCircle [0,[0,0,0]];
_exp setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal.p3d",16,0,16,1], "", "Billboard", 1, 0.3, [0,0,0], [0,0,0],5,10,7,0.1, [100,80], [[1,1,1,1],[1,1,1,0]], [1], 1, 0, "", "",_orb, 0, false];
_exp setDropInterval 0.1;


_exp2 = "#particlesource" createVehicleLocal getPosASL _orb;
_exp2 setParticleCircle [0, [0, 0, 0]];
_exp2 setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_exp2 setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1,0.5,[0,0,0],[0,0,3],0,10,7.9, 0, [10,200], [[1, 1, 1, 1], [1, 1, 1, 1]], [0.08], 0, 0, "", "", _orb, 0, false];
_exp2 setDropInterval 500;

sleep 0.3;
deleteVehicle _orb;'

but neither seem to work for me.

proven charm
#

change setPosASL to getPosASL for the createVehicle

#

or getPosATL would probably be the best

hallow mortar
marsh zodiac
#

that is bloody perfect mate, thank you for cracking the code

#

_orb setPosASL getPosASL b1; is what fixed it

modern agate
#

Idk if this belongs in here or #arma3_ai , but im trying to get units from another faction to have the Vietcong ambient voices coming from them, the sort of echoey sounding ones u can hear in the distance and in combat

candid scroll
#

is there a simple field that can be accessed to determine whether or not a unit is currently firing a weapon?

candid scroll
#

Ty! I was hoping there was a state variable that I could check against a unit, but that will have to suffice!

ruby turtle
#

Is there a way to temporarily change the time (or time of day) for each player individually in an MP mission? I would like to make it very dark for players who enter a cave via the trigger area, for example, so that flashlights are needed there. But for all players outside the cave it should remain light.

opal zephyr
ruby turtle
fierce veldt
#

Anyone happen to have an example Survivable helo crash script? Want it so when any vehicle or really ariel vehicle goes past a trigger it will destory their engine and force them to crash but everyone survives... Anyone got an example script that does this? I saw one in a search, but the example isn't available for download... so yeah... help?

opal zephyr
ruby turtle
#

so there is no solution for my plans currently.

opal zephyr
#

No

winter rose
ruby turtle
#

and would lead into performance issues

winter rose
#

well, it's not gonna be fine, or clean

proven charm
ruby turtle
#

i tested the setaperture in eden. looks good enough for my mission. Now i have a problem, where is my logic and thinking problem?

Trigger:
Repeatable: yes

Condition:
this && {player in thisList}

onAct:
[player] execVM "dark.sqf";

onDeact:
[player] execVM "light.sqf";

dark.sqf:
player setAperture 15;

light.sqf:
player setAperture -1;

I got a scripterror when the trigger triggers there is missing ;

Im not the best scripter, Thanks for helping

tulip ridge
#

setAperature doesn't take a unit parameter

#

Just a number

ruby turtle
#

how I have to rewrite it?

winter rose
#

rather see setApertureNew

ruby turtle
#

setApertureNew seems looks similar with that. just more fine tuning options.

#

if (hasInterface) then {
setAperture 15;
};

jade acorn
#

curious, why can't I iterate through commands when using forEach?

#

{ 0 _x 0 } forEach [fadeEnvironment, fadeSound, fadeMusic, fadeRadio, fadeSpeech]; am I stupid or does the game block it due to trying to be stupid-proof

#

I made myself a macro to write them line after line but was wondering if I can just do anything else

faint burrow
#

Iterate through functions.

jade acorn
#

elaborate please

faint burrow
#
{
    [0, 0] call _x;
} forEach [
    { (_this select 0) fadeEnvironment (_this select 1); },
    { (_this select 0) fadeSound (_this select 1); },
    { (_this select 0) fadeMusic (_this select 1); },
    { (_this select 0) fadeRadio (_this select 1); },
    { (_this select 0) fadeSpeech (_this select 1); }
];
#

Another option:

{
    call (compile (format ["0 %1 0;", _x]));
} forEach ["fadeEnvironment", "fadeSound", "fadeMusic", "fadeRadio", "fadeSpeech"];

But, AFAIK, this option clutters up memory.

jade acorn
#

ok I couldn't really visualise it myself, thanks

vapid scarab
# jade acorn `{ 0 _x 0 } forEach [fadeEnvironment, fadeSound, fadeMusic, fadeRadio, fadeSpeec...

IMO:
You shouldn't use a macro to write this code, as it abstracts what the code is when you or someone else goes to debug

And trying to use a forEach to call each function with the same parameters is a terrible way of calling all those commands.

The simplest option is best. Just write out each line. If you are only using that block of code 2 or 3 times, then you don't need a function or macro, just copy paste it. If you are using it more than that, then consider writing it as a function. Macro is a valid option too, but I am of the opinion that macros are only for constant numbers and variable strings (for set/get variable).

jade acorn
#

by macro I meant a VSC macro to insert those commands one by one

vapid scarab
#

Are you really writing those so much that you need a key macro to save time?

jade acorn
#

yup

vapid scarab
#

Wow. Cools!

fair drum
#

sounds like its time for you to create a framework for yourself and make it a function

undone flower
jade acorn
#

I am happy, in singleplayer environment, in my lane, flourishing

winter rose
warm hedge
modern agate
opal zephyr
#

Does anyone know why this isnt setting the ctrl's text?

_bottomText = format["<t color='#ffffff' size='3'> 'Ctrl C/V' to copy paste objects. 'L' to activate light, '-/+' to decrease or increase brightness. '%1' to activate night vision.</t>", _key];
((findDisplay 1900) displayCtrl 1951) ctrlSetStructuredText parseText _bottomText;

I can use ctrlSetText to update it, but then it includes the <t color stuff which I obviously dont want

#

ah, the control isnt a structured text control, its just a standard rscText one

marsh zodiac
#

gday. Got a question regarding the drawlaser function.

I am trying to create a laser for a laser gun.

addMissionEventHandler ["Draw3D", { 
 drawLaser [ 
  getPosASL object_1, 
  getPosASLVisual object_1 vectorFromTo [getPosASLVisual object_2 select 0, (getPosASLVisual object_2 select 1), (getPosASLVisual object_2 select 2) + 1], // This only to get the laser beam to hit the object in the middle, not on ground level
  [1000000, 30000, 0],
  [], 
  400, 
  400, 
  5000, 
  false 
 ]; 
}];

This creates a real nice orange laser between 2 pre defined objects but thre problems are that i dont know how to delete the laser after and that the laser only goes for 1, maybe 2 km, even with -1 as the range. how would i increase how far it draws for a multiplayer mission?

hallow mortar
#

About the length: as the wiki says, there is a maximum length and it's controlled by CfgIRLaserSettings. -1 length is "maximum allowed", not "infinite". I don't know what the config maximum is off the top of my head, but you should be able to find out fairly easily.
Also, I'm not 100% certain whether it'll render if the source is outside view distance.

hybrid sail
#

hey whats up guys, i have no experience in coding arma but im trying to figure out a way to force helicopters to deploy countermeasures when they enter a trigger but there's very few resources online on how to do this

#

i understand the variable names and stuff like that but im using RHS UH60 helicopters so the classnames might be different

hallow mortar
#

Countermeasures are a weapon; you need to force them to fire it. See forceWeaponFire and related commands.
Classnames are the easy part, you can just look up the vehicle's config in the Editor config viewer (e.g. place vehicle -> right-click -> find in config viewer) and see exactly what weapons it comes with, including the name of its countermeasures launcher.

hybrid sail
#

and i notice it also says "weaponslots=0"

hallow mortar
hybrid sail
#

just to clear it up heres a pic of the config piece in question

hallow mortar
hybrid sail
#

Alright

hallow mortar
#

If that is the case, then you can simply add the vanilla flare launcher and a magazine for it, then force fire that.

hybrid sail
#

Alright I was about to ask

#

Because I didn't even check if this thing had flares to begin with 😭

#

Yeah looks like it has invisible countermeasures with this infrared system

#

How would I go about adding the vanilla flare launcher?

hallow mortar
#

addWeapon and addMagazine
The vanilla flare launcher is CMFlareLauncher and its magazines are 60rnd_CMFlareMagazine or 60rnd_CMFlare_Chaff_Magazine (+ 120rnd, 240rnd).
Add the magazine first so it gets instantly loaded into the weapon when the weapon is loaded

hybrid sail
#

forgive my ignorance but is this what my init section in the heli would look like?

#

actually i will switch the places of magazine and weapon like you said

hallow mortar
#

You need quotes around the "classnames", not around the whole thing

#

You also need to specify which vehicle you want to add the things to - addWeapon and addMagazine take both left and right arguments, e.g.

this addWeapon "CMFlareLauncher";```
hybrid sail
#

How's this?

hallow mortar
hybrid sail
#

Yep, just did

#

Now do we work on the trigger's commands?

hallow mortar
#

Sorry, I was doing some science. It doesn't seem to be possible to get the AI to use the weapon's burst-fire modes - they'll only fire single flares even if you specify the burst mode in forceWeaponFire πŸ€”

hybrid sail
#

Alright thats fine, how do I get them to fire single flares?

hallow mortar
#

Well, the other thing I found is that - even though it should work for this and I've previously used it just fine - addWeapon isn't exactly what you need for this.

this addMagazineTurret ["60rnd_CMFlareMagazine",[-1]];
this addWeaponTurret ["CMFlareLauncher",[-1]];```
Now to actually fire is pretty simple:
```sqf
driver heli8 forceWeaponFire ["CMFlareLauncher","Single"];```
candid scroll
#

allMapMarkers - is there a way to identify which icon the marker is using?

hybrid sail
#

@hallow mortar the flares seem to work just fine but i get this error message, any idea what this could mean?

hallow mortar
#

heli6 is the variable name of an AI group. You should use the variable name of the helicopter object itself.

hybrid sail
#

also another question, since the AI can't fire them in burst mode, is it possible for them to simply repeat the command 2 or 3 times to achieve a similar effect?

candid scroll
hallow mortar
hybrid sail
#

Thank you

#

Works like a charm thanks bro

dark echo
#

the code in question:

if (!alive _patienta) then {
    if (isNull _patients) then {
        _patients = createGroup [west, false];
    };
    
    _selectedUnit = selectRandom _soldierClasses;
    hint _selectedUnit;
    _patienta = _patients createUnit [_selectedUnit, [2608.584,2823.699,0.970], [], 0, "CAN_COLLIDE"];
        
    if (_patienta isEqualTo objNull) then {
        hint "Failed to create Patient A!";
    } else {
        [_patienta] call _fnc_randomizeDamage;
    };
} else {

How can I work around this? I've tried numerous things to be able to check if a unit is created or existant before firing the partof the script that creates the unit if they dont exist already, but i just keep getting floored by "undefined variable in expression"

faint burrow
#

Next time send error message as text, not as image.

dark echo
#

okay so just

if (isNil _patienta) then { ...code... };

should do?

and ill do so, sorry about that

faint burrow
#

Have you read the article?

dark echo
#

Im reading it now and asking questions to confirm comprehension

faint burrow
#

OK, according to the 1st syntax, you should provide variable name.

dark echo
#

i see, in quotes

faint burrow
#

Secondly, it's up to you to decide where to use negation or not:

if (isNil "_patienta") then {
    // _patienta is not defined
} else {
    // _patienta is defined
};

if (!(isNil "_patienta")) then {
    // _patienta is defined
} else {
    // _patienta is not defined
};
dark echo
#

sure, is pretty apparent - i was asking mainly about the syntax format being correct

#

does it have to be encapsulated in parentheses to do accurate negation?

#

(!(isNil "patienta")) vs (!isNil "patienta")

faint burrow
#

No, I added extra parentheses just for readability.

dark echo
#

ah okay, thanks - i wouldnt have doubted it, given the arma 3 scripting language experiences ive had so far lol

dark echo
#

Struggling now with the group of the createUnit portion of the code... I had placed _patients = createGroup [west, false]; in init.sqf for the mission. this code that is running is an addAction that adds another separate script file as the code to run for the action - am i having problems with scope? I would've thought that something like groups would be global

#

But I keep getting told that _patients is again an undefined variable

_patienta = _patients createUnit [_selectedUnit, [2608.584,2823.699,0.970], [], 0, "CAN_COLLIDE"];
faint burrow
#

Groups are global, variables can be local, as in your case.

dark echo
#

Okay so maybe I am not understanding something about referencing the group properly?

faint burrow
#

Maybe.

dark echo
#

init.sqf:

_patients = createGroup [west, false];

if (!isNil "_patients") then {
    hint "Created _patients group!"; 
};

This hint fires on startup

spawnpatient.sqf snippet:

_selectedUnit = selectRandom _soldierClasses;
    hint _selectedUnit;
    _patienta = _patients createUnit [_selectedUnit, [2608.584,2823.699,0.970], [], 0, "CAN_COLLIDE"];
    

It is throwing an error about an undefined variable in expression, referring to _patients

faint burrow
#

Yes, _patients is undefined in spawnpatient.sqf.

dark echo
#

yeah i see where im going wrong, from misunderstanding something rather basic

#

I thought _ was for global scope, not for local

#

i feel stupid

dark echo
#

way ahead fo you

#

ty

candid scroll
#

in an addon, is there a reason initServer.sqf is running on the main menu and on mission load?

proven charm
proven charm
#

does anyone know how to get man head position that works even if he is in vehicle? cant use eyePos because it becomes turret position or something in vehicle

faint burrow
#

Selection "head"?

marsh zodiac
#

why would a light source produce this

#

while other lightsoruces set up the same way produce a normal orb

#

is it just a case of too bright for the colour or something else?

#
_light4 = "#lightpoint" createVehicleLocal getPosATL object_1;
_light4 setLightIntensity 2;
_light4 setLightBrightness 5;
_light4 setLightDayLight true;    
_light4 setLightFlareSize 10;
_light4 setLightFlareMaxDistance 2000;    
_light4 setLightAmbient [1,0.3,0];
_light4 setLightColor[1,0.3,0];
proven charm
marsh zodiac
proven charm
wind basin
#

Anybody know how I can find the addon that a weapon class belongs to for my config.cpp's required addons?

#

Looking for the SPE_LMG_303_Mk2, but wondering if there is a usual way to figure this out.

tulip ridge
south swan
wind basin
#

Thanks guys πŸ™‚

sage trout
#

is it possible to get full config tree from group classname? like this
getConfigTree "BUS_InfSquad" -> (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")

candid scroll
#

is it possible to render a camera view or r2t on the players HUD / screenspace?

pallid palm
#

wow awsome ArmA 3 WooHoo

quiet gazelle
#

is there a way to calculate what would be the results of screenToWorldDirection in 2.16? nevermind i'm switching to dev branch

#

using screentoworld and taking the vector from the camera to that position only works below the horizon

faint burrow
sage trout
#

i only have group classname as parameter

#

is it possible to get other elements of tree with command?

faint burrow
#

By recursive search.

pallid palm
#

btw would this work ? _light4 = "#lightpoint" createVehicleLocal getPosATL object_1;

#

ooop

#

_light4 = "#lightpoint" createVehicleLocal getPosASL object_1;

#

there lol

#

ASL,<-------- ?

faint burrow
#

Are you really waiting for someone to run the game and check if it works?

pallid palm
#

no im checking now

#

its for my Deep Diver mission

#

Waiting is the hardest part he he

#

WooHoo ArmA 3

tulip ridge
#

What is your use case that you need the config path?

ornate whale
#

Is it possible that diffing two arrays of positions can fail?
[ [1,2,3.0050], [0,0,0] ] - [ [0,0,0] ] (like this)

faint burrow
#

What do you mean?

south swan
#

i wonder how reliable == on two floats is in general tanking

ornate whale
south swan
#

is it a question in general or have you encountered it? Or have some bug that you suspect is caused by it?

ornate whale
#

I have encountered it.

proven charm
#

nvm

faint burrow
south swan
#

wiki example:

#

floating point is fun

#

so yeah, getting the example of your code would be nice

ornate whale
# south swan so yeah, getting the example of your code would be nice
(tower call BIS_fnc_buildingPositions) - [[12191,12597.2,9.66031],[12195.9,12600.1,9.64397],[12193.8,12599.2,9.65215],[12191.8,12599.6,9.64397],[12197.7,12597.5,9.64397],[12195.8,12592.4,9.649],[12199.4,12601.8,9.65215],[12190.2,12605.7,9.64397],[12195.4,12596.4,13.2141],[12189.6,12597.6,13.2186],[12191.4,12602.3,13.2141],[12196.6,12600.1,13.2141]]
hallow mortar
#

That's definitely going to be rounding errors

ornate whale
hallow mortar
#

Yes, rounding errors. The function is not returning precisely the same positions (because they're dynamically calculated every time). It could be off by 0.0001 and that would be enough to not count as a match.

proven charm
#

make a function that counts distance to the positions, to check if its the "same" position. then do whatever you want with that info

granite sky
#

If you're gonna write that much out then better to make a whitelist tbh. Not like building positions change.

proven charm
#

doesnt building rotation effect, or are those relative positions?

granite sky
#

The buildingPos command outputs AGL

#

you can imagine the horror.

serene sentinel
#

Can anyone give me a hint. Trying to turn off vehicles insignia in CSLA this way:

CSLA_fnc_tacNum = {};
CSLA_fnc_randomNumbers = {};
CSLA_fnc_texturaVehiculi = {};

Numbers successfully turned off, but national emblem - not. As I understand 'CSLA_fnc_texturaVehiculi' is responsible for this. Is there a way to shut down this function?

little raptor
#

The only way is overriding it with a config patch

wintry yoke
#

What causes jitter when using unitCapture? I'm recording it at 100 FPS with the trigger, but sometimes the unit is really stuttery on playback

jade acorn
#

might be because you're playing the data far from thhe 0,0 point of the map and calculations have bigger error.

#

lowering the framerate or choosing an area closer to the lower left corner of the map might help

#

seen Kydoimos on the forums writing that playing the data on game logic with attached vehicle helps, but you won't get any animations.

wintry yoke
pallid palm
#

btw _light4 = "#lightpoint" createVehicleLocal getPosATL object_1; Works Awsome WooHoo ArmA 3

#

or btw _light4 = "#lightpoint" createVehicleLocal getPosASL object_1; Works Awsome WooHoo ArmA 3

#

hell yeah

#

freekin Awsome

versed trail
#

Anyone know what I might do to reproduce a somewhat passable smoke trail for a missile? I noticed the vanilla SAM LR sites, and most other missiles for that matter, don't really leave behind any sort of trail besides a barely visible area where the air has been heated. The first obvious solution was attaching a SmokeShell_Infinite to the missile, which doesn't dispense often enough. not sure what other options I have, I don't normally do effects stuff

#

for science, I did try attaching 15 smoke shells instead of 1; no real improvement, but I might play with it more

warm hedge
#

It's possible to create particle effects using scripts. ParticleArray, it maybe is confusing at first anyways

versed trail
#

ah nice, this looks to be exactly what im looking for. create a particle source, attach it to the missile and move on with your day. To confirm, all of the actual effects are stored in "\A3\data_f\ParticleEffects\Universal\Universal", and you can select individual frames of the "image" to cycle through?

upbeat valve
#

~~I'm trying to make a ticket system by detecting AI vehicles, and adding killed event handlers so if a player kills an enemy vehicle, tickets are gained. The problem is the killed event handler is weird if a vehicle is the killer. The wiki mentions this but it doesn't say how to get around that. So i'm trying to detect if a player is in the vehicle that killed the enemy, but it's not working.

if (((isPlayer _killer)||(player in _killer))&&(side group _unit == resistance)) then {
foobar
};```~~

Fixed this
upbeat valve
tulip ridge
#

All that check does is return true if player is in a vehicle

#

You can also probably just use _instigator, which is the unit who "pulled the trigger"

opal zephyr
tulip ridge
#

You'd have to do some extra checks as well for that, since most times it's the effectiveCommander of the vehicle

covert oak
#

So I'm playing around with ALiVE, trying to set up a QRF.
I've got a combat support helicopter (chinook) That calls an sqf file in it's init:

// loadTroopsToHeli.sqf

// Parameters
_helicopter = _this select 0;
_troopGroup = createGroup west;
_units = [
    "B_Soldier_SL_F",
    "B_Soldier_F",
    "B_soldier_LAT_F",
    "B_soldier_M_F",
    "B_Soldier_TL_F",
    "B_soldier_AR_F",
    "B_Soldier_A_F",
    "B_medic_F"
];

{
    _unit = _troopGroup createUnit [_x, getPos _helicopter, [], 0, "FORM"];
    _unit moveInCargo _helicopter;
} forEach _units;```
That loads infantry into the helicopter at spawn.
The problem is, when I select "INSERT" or "LAND" from the alive menu, the QRF doesn't get out.
tulip ridge
covert oak
#

Ideally, I can search through any waypoints the helicopter has, and once I figure out the waypoint type ALiVE is using for the insertion, add AR_Rappel_All_Cargo to it.

tulip ridge
#

If you use ace they have a fastrope waypoint

#

Unless alive dynamically makes them
Never used it

covert oak
#

ALiVE doesn't use a fast rope wp, no, it just makes the helo hover. ALiVE seems to assume there will be a human on board since that's what it's meant for, but I want to have an on-call AI QRF.

#

πŸ€” The other problem is, that init runs at unit spawn, not when I call for them, so that method won't really work anyway.

formal grail
#

Anyone know how to get the player/unit that fires a lasertarget from the target object?

#

shotParent or any kind of shot/weaponn state info don't seem to work

modern agate
hallow mortar
# formal grail Anyone know how to get the player/unit that fires a lasertarget from the target ...

You could try objectParent. That's just a guess though, no idea if it'll actually work.
Another way would be to check every player and see if their laserTarget is extremely close to the one you're looking at. Technically it would be possible for 2 people to put theirs right on top of each other, but it's pretty unlikely.
If objectParent doesn't work, it might be worth putting in a FT ticket for a laserTargetOwner command; it's a bit of an oversight that there isn't one (if objectParent doesn't work)

hallow mortar
meager granite
#

It doesn't trigger Fired or FiredMan so you'll need to do OEF check with laserTarget command on units and vehicles

formal grail
#

On a loop:

{
    private _laserTarget = laserTarget _x;
    private _ownerPlayer = (_x getVariable ["BIS_WL_ownerAsset", "123"]) call BIS_fnc_getUnitByUID;
    _laserTarget setVariable ["BIS_WL_laserPlayer", _ownerPlayer, true];
} forEach allPlayers;
{
    private _vehicle = _x;
    private _ownerPlayer = (_vehicle getVariable ["BIS_WL_ownerAsset", "123"]) call BIS_fnc_getUnitByUID;
    {
        private _laserTarget = _vehicle laserTarget _x;
        _laserTarget setVariable ["BIS_WL_laserPlayer", _ownerPlayer, true];
    } forEach (allTurrets _vehicle);
} forEach vehicles;
#

I also found a feedback request for them to add hit/fire EHs on laser, but not much movement on those for a couple years so I'm not gonna hold my breath for that.

velvet merlin
#

is there any native a3 function to dump a cfg class with all its contents (aka including subclasses of any level) recreated as the original config definition?

#

there a custom functions like this. just wondering if a3 itself has that or not

proven charm
south swan
#

except i don't think that would fill inherited properties πŸ€”

modern agate
#

it may be a lost cause πŸ₯²

meager granite
formal grail
meager granite
#

But you'll have laser target, not whoever fired it

formal grail
#

Let me test it multiplayer

proven charm
formal grail
modern agate
proven charm
modern agate
#

yes

proven charm
#

well maybe you should try one of the vanilla voices like "Male01GRE" - greek . to see if those work

warm hedge
#

VIE is the only available additional voices. And no, it does not have any voice lines actually

modern agate
#

yeah but im looking for the ambient voices that the Vietcong/PAVN factions have and how to apply them to other units in mission

formal grail
#

Okay, fixed the laser code and tested to work in MP.

// server event handler
addMissionEventHandler ["EntityCreated", {
    params ["_entity"];
    scopeName "MainEntityCreated";
    if (_entity isKindOf "LaserTarget") then {
        {
            private _laserTarget = laserTarget _x;
            if (_laserTarget isEqualTo _entity) then {
                private _ownerPlayer = (_x getVariable ["BIS_WL_ownerAsset", "123"]) call BIS_fnc_getUnitByUID;
                _laserTarget setVariable ["BIS_WL_laserPlayer", _ownerPlayer, true];
                breakTo "MainEntityCreated";
            };
        } forEach allPlayers;
        {
            private _vehicle = _x;
            {
                private _laserTarget = _vehicle laserTarget _x;
                if (_laserTarget isEqualTo _entity) then {
                    private _ownerPlayer = (_x getVariable ["BIS_WL_ownerAsset", "123"]) call BIS_fnc_getUnitByUID;
                    _laserTarget setVariable ["BIS_WL_laserPlayer", _ownerPlayer, true];
                    breakTo "MainEntityCreated";
                };
            } forEach (allTurrets _vehicle);
        } forEach vehicles;
    };
}];

And then on the client side, on each frame, get all entities of LaserTarget type, draw icon 3d, draw icon on map etc. Seems to work for me.
I'm just setting the variable for each laser target as it's created on the server. My guess is since you can't easily run laserTarget for a remote player, this is the approach that generally uses the least amount of server network traffic possible.

south swan
#

mandatory "you can use ``if !(_entity isKindOf "LaserTarget") exitWith {};` to have one fewer indentation level through the rest of the function"

hallow mortar
velvet merlin
modern agate
#

yeah, did some looking in functions and config and didnt find much but im a bit of a novice with this stuff so i might have missed obvious stuff in it

hushed tendon
#

Is there a way to apply a rotational velocity to a vehicle? Like for example applying a rotation to the side and causing the vehicle to do a barrel roll

#

Or is the only way to just launch a heavy object at it and hope it doesn’t arma itself?

delicate hedge
#

can i somehow rewrite/replace addon function by declaring same function missionconfig?

faint burrow
#

Very unlikely, since it's compileFinal'ized.

south swan
south swan
#

no. Final is, well, final

hushed tendon
#

oh thx @faint burrow @south swan I was thinking velocity so I was only typing that when searching

proven charm
#

is there a command that allows you to execute code string that has comments in it? right now I think we just have file compile commands

delicate hedge
#

how to disable players ability to control drone, not disconnecting but when player press buttons they wont do anything?

ornate whale
#

Is it possible to keep music playing after the death of a player in SP when he can still switch units?

proven charm
faint burrow
#

Provide a string.

proven charm
faint burrow
proven charm
faint burrow
#

Don't know.

proven charm
faint burrow
proven charm
#

i wonder how debug console handles comments

ornate whale
ornate whale
# proven charm yeah trying to avoid files..

The example I provided above works for me:

0 spawn {
private _compilableString = toString {
hint "it works!";
//My comment here...
}; 
hint _compilableString; // hints ' hint "it works!" ' 
sleep 2; 
call compile _compilableString; // hints ' it works! '
}
proven charm
#

oh nice..

ornate whale
#

But I am not sure why you need it as a string with comments inside.

#

That seems like an unusual case to me.

proven charm
#

I know sounds weird, im actually working on some code debug stuff

#

ok i think I see whats happening in that sample.. the arma compiler processes the code block {} leaving comments out

#

but I already have a string so dont know if that helps me

ornate whale
proven charm
#

yah, too lazy

#

I found the code how debug console deals with comments . its in RscDebugConsole.sqf not sure if its ok to post code that isnt mine in here?

still forum
#

The preprocessor strips away comments.
Anything that is preprocessed (which is every .sqf file, in general) will not contain comments.
But you cannot run that from a non-file.

I didn't know that Debug Console handles comments? If it does then it does badly, everytime I paste something with comments its not working right.

cobalt path
#

Is it possible to do Transparency with #RRGGBBAA?

#

I am trying to do procedural texture, and I want to have floating text apparently

#
#(rgb,512,256,3)text(1,1,"TahomaB",0.1,#00000000,#ffffff,"Test Hello World")
#

That doesnt work

south swan
#

or with litrally your version

cobalt path
#

wait, what was your # ?

#

for transparent

delicate hedge
#

pls help how can i block player or ai ability to control vehicle (drone) so it will move by intertia

#

or just make the ai drone not to autohover

cobalt path
ornate whale
#

When I send one variable via publicVariable into the JIP queue multiple times with different values, will it send the latest one to the JIP client or all its versions in the exact order, resulting in multiple changes? Thx.

cobalt path
#

NVM

#

found it

#

Thx

candid scroll
#

is there an event that could be used reliably on units / entities for when their position / state changes?

proven charm
cosmic lichen
granite sky
ruby turtle
#

when I want transform this:
15 fadeMusic 0;

into this, whats the issue?
["sgmusic_1"] remoteExec [15, "fadeMusic", 0]

faint burrow
#

Wrong syntax, read BIKI.

little raptor
#

We also have pinned messages here that explain how remoteExec works

ruby turtle
#

for playmusic this here works:
["sgmusic_1"] remoteExec ["playMusic", 0]

But how I transform fademusic?

faint burrow
#

Have you read docs?

ruby turtle
little raptor
#

You just put the parameters in the left hand side array

opal zephyr
#

[5, 0] remoteExec ["fadeMusic"] is 5 fadeMusic 0

little raptor
#

See this

opal zephyr
#

fadeMusic doesnt take a string, so "sgmusic_1" isnt relevent

ruby turtle
#

so fadeMusic stops all music at once? not a specific one?

opal zephyr
little raptor
#

There's only 1 music at any given time

flint topaz
#

In the description.ext would it be possible to add preprocessing commands or access a variable from any scope.
I want it, so depending on a specific variable joinUnassigned will be 0 or 1

flint topaz
#

thanks I'll see what I can do

#

okay that worked perfectly, but before I go about this approach. Is there any way to have a mod modify all description.ext's that get loaded with similar ideas of preprocessing?

#

like I expect you to say no, but worth investigating before I proceed

#

Basically I have a mod that I want to control this variable (joinUnassigned) for all missions as it's required for the tech to work of the mod

little raptor
#

You can't modify a mission config from a mod config

flint topaz
#

sadge the way I've got it will work well enough

#

I just wanted roles to be autoassigned in certain situations

sharp grotto
ornate whale
#

Does anybody know why task completion notifications are delayed in multiplayer when invoked via a trigger?

pure hawk
#

how can I upload my mission in steam to let people try it

warm hedge
#

Press Steam Workshop icon in Eden

lone glade
#

...... seriously? no seriously?

#

-_- impossible to end loops clogging the scheduler aren't 0.0000th of a second but fucking seconds after 30 mins

#

are you fucking serious

#

we're missing a facepalm emote here.

#

well, for example triggers stopping to work completely because the scheduler cannot handle them in a timely fashion ?

#

let's not forget that you also fuck everyone else's exec time because you don't and can't end those loops without ending them all.

zealous solstice
#

@tough abyss i think the problem in your scripts is that you write a lot of crap in it that is not needed that they run so long

lone glade
#

I got that issue with around 60 sqf/s scripts running at once

zealous solstice
#

Your Soilder Tracker

little raptor
#

Or use a combination of both

#

Like if mission config has something set then apply the mod config. Or make a mod function that's called by the mission function.
There are many ideas for this. It depends what you want to do

#

I don't know why you're using a misison config for this tho

#

If you're trying to make a read only var you can use compileFinal

rich falcon
#

Is there any good way to make it so that I trigger end1 if the player dies? Tried a trigger like this but can't seem to get it to work

#

Reason being, I've got a campaign and I need end1 to trigger the next mission and move ahead and this mission only ends when you die

proven charm
jade acorn
proven charm
#

doesnt work for me

lone glade
#

well, BI vehicle respawn module is broken as fuck πŸ˜„

jade acorn
#

with the end #1 type?

proven charm
#

yeah

jade acorn
#

what if type's None and you put endmission in the activation field?

proven charm
#

oh that works

#

weird things meowhuh

lone glade
#

the vehicles will respawn but if there's wrecks above the spawn point it'll be a loop of exploding vehicles.

#

meh, I could just use a PFH or use EHs.

zealous solstice
#

everything run in one Thread guys

#

arma dont support more than this

frozen seal
#

hi all!
Is there a way to store the mission source file in a way that is digestible for GIT so that we could meaningfully resolve merge conflicts? By default the mission save file format is not human readable.

proven charm
lone glade
#

a PFH that evaluates every minute isn't a big perf hog

zealous solstice
#

PFH?

lone glade
#

PerFrameHandler

zealous solstice
#

BI call this onEachFrame

lone glade
#

CBA PFH runs inside a stacked onEachFrame EH

zealous solstice
#

or on a DrawEH

south swan
#

except i don't think even unbinarized mission.sqm is very git-merge-friendly

zealous solstice
#

if stacked onEachFrame EH not exist

south swan
#

with its lists explicitly stating their length, list members being explicitly namednumbered, etc.

faint burrow
#

Let's add mission.sqm to .gitignore!

south swan
#

whoo needs it anyways blobcloseenjoy

lone glade
#

I hope BI finally expand on stacked EHs, they started in 1.54

#

Now if I could add nested events in my description.ext that would be noice

slim trout
#

Hi guys. Im trying to createa new module for the editor/zeus which will add addAction to synced/selected object. Any ideas how could i achieve that?

#

addAction is suppose to launch a GUI

lone glade
#

check the mod called ares, it already has that feature

#

source code should be on github

still forum
#

I'm quite sure someone made a merge-able mission.sqm format

#

I wanted to do it once, but then didn't because someone else did it.

Basically converts mission.sqm, into a different file that has the same data but in a merge-friendly way.
And then a thing that converts it back. But that was years ago

cosmic lichen
#

Well it would be merge friendly if we hadn't have the issues with number precision.

candid scroll
#

is there a simple way to access all tasks currently active in a mission?

cosmic lichen
#

Nope

candid scroll
#

damn

#

i couldnt spot an event to listen for task creation either

cosmic lichen
#

Afaik there is no "allTasks" function

candid scroll
#

oh, really?

#

oh

#

haha

cosmic lichen
candid scroll
#

hahaha, all good

cosmic lichen
#

Do you create the tasks yourself?

candid scroll
#

No, unfortunately. Hoping to synchronise active tasks to another interface

cosmic lichen
#

I guess you need to loop through all namespaces and look for task ids

hallow mortar
candid scroll
#

Oh, awesome

#

I absolutely did not spot that when scanning the docs

vapid scarab
candid scroll
#

Hahaha, yeah

#

Thank you @hallow mortar !

#

FYI - A3A has "A3A_activeTasks" var

#

Handy

candid scroll
#

Is there something more reliable than "roleDescription" to determine if team leader, rifleman, etc?

ornate whale
#

Is it possible to prevent vehicle's wheels clipping through terrain on sloped surfaces when using setDir? I also tried setVectorUp, setPos, setPosATL, it still gets under the surface sometimes.

thin fox
candid scroll
#

@thin fox thank you! If I have to go down this way, I will. Unfortunate! I was hoping something was exposed to do this without the manual mapping 😦

tulip ridge
#

Why would you make those all global variables

#

Unless it's being used for something else as well

thin fox
meager granite
tulip ridge
candid scroll
#

@tulip ridge thats exactly what im trying to pull based on role

#

is there a function that returns that for a unit?

tulip ridge
#

No, just do a config lookup. getText (configOf _unit >> "icon")

candid scroll
#

Ahhhh, right

#

Thank you!

#

I completely forgot config lookups were a thing

#

its been awhile

candid scroll
#

That was exactly what I was chasing Dart, thank you

vapid scarab
# candid scroll is there a function that returns that for a unit?

No. But I have written my own.

#define ICON_MAN '\a3\ui_f\data\map\vehicleicons\iconMan_ca.paa'
#define ICON_MAN_AT '\A3\ui_f\data\map\vehicleicons\iconManAT_ca.paa'
#define ICON_MAN_ENG '\A3\ui_f\data\map\vehicleicons\iconManEngineer_ca.paa'
#define ICON_MAN_MG '\A3\ui_f\data\map\vehicleicons\iconManMG_ca.paa'
#define ICON_MAN_DEMO '\A3\ui_f\data\map\vehicleicons\iconManExplosive_ca.paa'
#define ICON_MAN_MED '\A3\ui_f\data\map\vehicleicons\iconManMedic_ca.paa'
#define ICON_MAN_LEAD '\A3\ui_f\data\map\vehicleicons\iconManLeader_ca.paa'
#define ICON_MAN_DEAD '\a3\ui_f\data\igui\cfg\revive\overlayicons\f100_ca.paa'
#define ICON_MAN_UNCON '\a3\ui_f\data\igui\cfg\revive\overlayicons\u75_ca.paa'

params ["_unit"];

if ((leader _unit) isEqualTo _unit) exitWith {
    // return
    ICON_MAN_LEAD;
};

if ((_unit getVariable ["ace_medical_medicclass",0]) > 0) exitWith {
    // return
    ICON_MAN_MED;
};

if ((_unit getVariable ["ACE_isEngineer",0]) > 0) exitWith {
    // return
    ICON_MAN_ENG;
};

_loadout = getUnitLoadout _unit;

_primaryWeaponClass = _loadout select 0 select 0; // might be nil if no primary
if !(isNil "_primaryWeaponClass") then {
    if (([_primaryWeaponClass] call BIS_fnc_itemType) isEqualTo ["Weapon","MachineGun"]) exitWith {
        // return
        ICON_MAN_MG;
    };
};

_launcherWeaponClass = _loadout select 0 select 0; // might be nil if no primary
if !(isNil "_launcherWeaponClass") then {
    if (([_launcherWeaponClass] call BIS_fnc_itemType) in [["Weapon","MissileLauncher"],["Weapon","RocketLauncher"]]) exitWith {
        // return
        ICON_MAN_AT;
    };
};

// Default return
ICON_MAN;
tulip ridge
#

If you're using ace, there's ace_common_fnc_getVehicleIcon which will always return the file path

candid scroll
#

If i'm just fetching the units role / icon that is found on the ingame map, what youve provided me will be consistently accurate, i would assume?

tulip ridge
#

Yes

candid scroll
#

Perfect, thank you

#

Sorry @tulip ridge , last question re: this for a bit hopefully. Is there a way to fetch the iconPath as well? I assume theres another function like getText ?

tulip ridge
#
// fnc_getVehicleIcon
// ["SomeClassName"] call ...fnc_getVehicleIcon;
// [_someObject] call ...fnc_getVehicleIcon;
params [
    ["_vehicle", "", [objNull, ""]]
];

// If object is passed, get class name
if (_vehicle isEqualType objNull) then {
    _vehicle = typeOf _vehicle;
};

private _icon = getText (configFile >> "CfgVehicles" >> _vehicle >> "icon");
if !("\" in _icon) then {
    // If icon is not file path, check CfgVehicleIcons
    _icon = getText (configFile >> "CfgVehicleIcons" >> _icon);
};
_icon;
tulip ridge
candid scroll
#

Amazing! Thank you @tulip ridge !

getText (configFile >> "CfgVehicleIcons" >> (getText (configOf _unit >> "icon")))
#

Does the trick

#

Is there a performance concern with a call like that?

tulip ridge
#

How often will you be doing it?

tulip ridge
candid scroll
#

for all units present in a mission

tulip ridge
naive needle
#

just use _Unit setVariable ["Icon",getText (configFile >> "CfgVehicleIcons" >> (getText (configOf _unit >> "icon")))];

tulip ridge
#

That's still running once for each unit, not class

candid scroll
#

@tulip ridge awesome, thank you, I'll definitely do that

tulip ridge
#

Just make a function that does this, and create a hashmap called YOURTAG_vehicleIcons on mission start (for all machines, so something like init.sqf is fine)

params [
    ["_vehicle", "", [objNull, ""]]
];

if (_vehicle isEqualType objNull) then {
    _vehicle = typeOf _vehicle;
};

private _icon = YOURTAG_vehicleIcons getOrDefault [_vehicle, ""];

if (_icon == "") then {
    _icon = getText (configFile >> "CfgVehicles" >> _vehicle >> "icon");
    if !("\" in _icon) then {
        _icon = getText (configFile >> "CfgVehicleIcons" >> _icon);
    };
    YOURTAG_vehicleIcons set [_vehicle, _icon];
};

_icon;
#

This is what ace_common_fnc_getVehicleIcon does

candid scroll
#

Ahhh, cool, that's awesome, thank you

naive needle
#

ah its based on vehicle class , yea hashmap is the way

tulip ridge
#

You use vehicle class so that there's only one config lookup for x of the same unit.
If there's 100 units of the same class, you're only looking at the config once.

candid scroll
#

@tulip ridge thank you for your help!

tulip ridge
#

πŸ‘

serene sentinel
#
if (_x isKindOf "CSLA_Tank_F") then {

[_x, "CSLA_misc\signs\empty_ca.paa", 5, 6] spawn CSLA_fnc_texturaVehiculi;
};

How can I make it work every time new vehicle spawns on map? Check every new vehicle

tulip ridge
#

Or if there is a more specific class, you can use that instead of AllVehicles

serene sentinel
#

@tulip ridge Thanks

slim trout
#

Okay. I tried to write smth, based on the information i gathered. Thanks for the Ares mention - really helpful.

primal trench
#

Is there a way to script random assignment of role slots? I'm creating a 6v6 TDM style game and would like to make it so players are randomly assigned a slot. Using the built-in "auto assign" seems to assign every player to the same slot always

proven charm
primal trench
#

I just don't want the players to end up on the same side every match

#

Ideally I'd like to set up a system where the first round they get randomly assigned across the two teams, then the second round they switch sides, but I suspect that's asking too much from a game like Arma

slim trout
#

Do you think, if this function will work?

#

// Argument 0 is module logic.
_logic = param [0,objNull,[objNull]];
// Argument 1 is list of affected units (affected by value selected in the 'class Units' argument))
_units = param [1,[],[[]]];
// True when the module was activated, false when it's deactivated (i.e., synced triggers are no longer active)
_activated = param [2,true,[true]];

// Module specific behavior. Function can extract arguments from logic and use them.
if (_activated) then
{
_x addAction ["<t color='#d58200'>BWI: Armory</t>", "createDialog 'BWIArmory';"];
} forEach _units;
};

fair drum
primal trench
#

OH that might work

fair drum
#

not might, will work πŸ˜‰

timber bough
#

Does arma support text to speech through sideradio or other commands? Natively ideally?
I've usually used the usual sounds through sideradio that goes something like "Requesting airstrike at designated location".
But I wanted to implement a 9-liner, for example:

Reaper 6, Stalker 2-1, as fragged, 270 offset north, 11, 100 feet, tank, grid 0109234, target marked with laser code 123, 700 meters southwest, pilot discretion

Does arma allow that?

little raptor
#

No

timber bough
primal trench
tulip ridge
#

If so, yes, and arma modding is better because of it

stable dune
#

He meant ai command menu.
"All-In-One Command Menu" - mod ,
Yes.
He did that too

granite sky
#

Waypoints are for groups, not units, so I'm not sure exactly what you're asking.

proven charm
faint burrow
#

You can also remove existing waypoints and add new ones.

subtle sail
#

Hello, im doing a script for a heli that take off when a person is in a trigger and then it goes to a holding position and waits for a laser marker to appear and shoots in the laser, but there is a problem with the line that detects the laser that i cant correct

#
while { triggerActivated _operationAreaTrigger } do {
    private _laserTargets = (_helicopter targetsVisual) select { _x isKindOf "LaserTargetW" };
    
    // If there is a laser-marked target, fire a missile
    if (count _laserTargets > 0) then {
        private _laserTarget = _laserTargets select 0;
        _helicopter doTarget _laserTarget;
        _helicopter fireAtTarget [_laserTarget, "missiles_DAR"];
        hint "Missile fired at the laser-marked target.";
        sleep 10; // Wait before looking for another target
    };
    
    sleep 1; // Check every second
};

// When the player leaves the operation area, return to base
hint "Player has left the operation area. Returning to base.";
_helicopter flyInHeight 100;
_helicopter doMove _basePoint;
faint burrow
subtle sail
#
    private _laserTargets = _helicopter nearTargets ["LaserTargetW", 1000]; 
    hint format ["Detected %1 laser targets.", count _laserTargets]; 

    // If there is a laser-marked target, fire a missile

    if (count _laserTargets > 0) then {
        private _laserTarget = _laserTargets select 0;
        _helicopter doTarget _laserTarget;
        _helicopter fireAtTarget [_laserTarget, "missiles_DAR"];
        hint "Missile fired at the laser-marked target.";
        sleep 10; // Wait before looking for another target
    } else {
        hint "No laser targets detected."; // Debug hint when no targets are detected
    };
    
    sleep 1; // Check every second
};
#

Im using this and nothing happens, no laser detection

stable dune
#

So you need

_helicopter neartargets 1000 select {typeOf _x == "LaserTargetW"};

Or isKindOf

subtle sail
#

okay let me work with that and let me see, thank you

wintry yoke
#

Are there any methods outside of flyinheight for making an aircraft fly at its assigned altitude no matter what?

wintry yoke
#

Thank you, though I can't get it to work with this one either. The aircraft always bobs pretty violently to avoid terrain

faint burrow
#

Try using it with flyInHeight.

wintry yoke
#

leader panther11 limitSpeed 150; panther11 setvelocity [-50,50,0]; panther11 flyinheightASL [199, 199, 199]; panther11 flyinheight [200, true] Something like this?

exotic gyro
#

I remember doing that once to do the Halo Reach "designate an artillery" gun for an optre unit

faint burrow
exotic gyro
wintry yoke
#

Hmm, that does dampen the oscillations, but it still seems to be responding to terrain

#

Even if I set it to something wild, like 5 meters, it won't ever hit anything

exotic gyro
#

I don't know if you can make AI override their instinct to not slam into things

faint burrow
exotic gyro
#

asl is constant anyway

faint burrow
#

I guess to make a helicopter fly at a constant height, the height ASL should be calculated as follows:

_heightAsl = ATLToASL _worldHeightAtlMax;

_heightAsl set [2, (_heightAsl select 2) + 100];
wintry yoke
faint burrow
#

Yes.

wintry yoke
#

Does this need to be part of a larger script? It's not working in my init

faint burrow
#

Yes, my code snippet is just a part of a larger script.

wintry yoke
#

I greatly appreciate ya'lls help, I'll see if I can get away with combining both flyinheights before I burn my last two braincells out on scripting lmao

faint burrow
#

Good luck!
A little hint: for the first version you can not write the code to determine _worldHeightAtlMax, but determine it yourself by finding the highest point on a map.

late drum
#

Anyone knows a way to download all the Mikero's Tools? Or I have to download them one by one?

naive needle
#

There is a installer, but I think you have to pay for it

candid narwhal
#

Greetings:
Since

_Number = blufor countSide allPlayers;

Is a number, I am wondering if there is a command that would instead give me all Players from Blufor in an Array.
Similar to the inAreaArray command.
Like the following syntax I am using for a safezone:

_safePlayers = allPlayers inAreaArray _safe;

As this sadly is not transferable to allPlayers inAreaArray blufor.

kindred zephyr
#

not in command form, iterate through your list and check which side is each player

hallow mortar
#
private _bluPlayers = allPlayers select {(side group _x == west) && alive _x};```
candid narwhal
candid narwhal
#

Oh wait..... it checks for the side of the group the Player (_X) is in......

hallow mortar
#

units' side becomes Civilian when they are unconscious or dead, but their Group's side remains correct

candid narwhal
#

thx! I kinda always forget that that happens!

granite sky
#

It depends what you want, but yeah. Another weirdness is that if you create blufor units in a redfor group they'll shoot at each other, because they compare their (unit) side to the group side of their targets. I'm not sure whether there's any practical use for this or why it exists.

candid narwhal
#

I want a list of all Players in a given team "not in the safezone".

_notSafePlayers = ((allPlayers select {(side group _x == west) && alive _x}) - (allPlayers inAreaArray _safe));

Seems to work fine for now

hallow mortar
#

You can condense that a little more:

private _notSafePlayers = allPlayers select {!(_x inArea _safe) && {(side group _x == west) && alive _x}};```
#

While it doesn't look too much shorter as such, it should be faster because you're not running allPlayers twice

granite sky
#

sadly there's no direct not-in-area array command but select is much faster on perf/profile and hopefully will be on stable eventually.

#

On stable, the inAreaArray subtraction might well be quicker.

candid narwhal
#

understood and ty guys alot!

raw jasper
#

is there a way to send a message or hint to a specific player? I tried hints but I need to run the script globally so I cannot do this

proven charm
raw jasper
proven charm
#

_x should work

raw jasper
#

thank you ❀️

faint burrow
#

I wouldn't invoke remoteExec from loops.

granite sky
#

You could build an array of targets and use that with a single remoteExec, although I'm not sure there's much difference in performance.

hallow mortar
# faint burrow I wouldn't invoke `remoteExec` from loops.

Unless you're using it on an array with like 5 billion elements (so not an all-players array), forEach is a loop with a definite exit condition and a relatively small number of iterations. Using remoteExec in that loop is perfectly valid.

#

Using remoteExec in a loop that runs very frequently would be bad because of network spam, but there's nothing inherently wrong using using remoteExec in all loops

faint burrow
#

Despite this, I would avoid that.

hallow mortar
#

For any actual reason or just because you like telling people they're wrong?

exotic gyro
#

You can just use a cba target event instead

granite sky
#

uh

#

What's better about that?

exotic gyro
#

less network traffic, easily targeted with a single event

granite sky
#

You mean if you figure out the message on the client side?

exotic gyro
#

Register your hint event on mission start in an init.sqf, then just do a target event with the hint string and an array of guys go target

#

Events >>>> remoteexec in pretty much all cases

granite sky
#

Uh, you know CBA events use remoteExec, right

hallow mortar
raw jasper
exotic gyro
#

Also cba uses publicVariable

raw jasper
candid narwhal
#

Are switches or ifΒ΄s faster btw ?

#

sorry i am a bit off topic here

exotic gyro
#

Test and see

I doubt they're meaningfully different unless you're in a use case where lazy eval saves you time

hallow mortar
# faint burrow https://community.bistudio.com/wiki/Mission_Optimisation#High-frequency_network_...

If you want to target specific people like this, you are going to have to send a number of remoteExecs at once. It doesn't really matter if it's inside or outside the forEach.
Again, this is about a forEach loop, not an uncontrolled while true or eachFrame. It's going to run once, checking each of the array elements once. That's a brief, one-time spike in network messages, and really shouldn't be any worse than one remoteExec with target 0 (which is something that happens all the time).

candid narwhal
faint burrow
raw jasper
exotic gyro
raw jasper
hallow mortar
#

The thing to watch out for is what the actual (and most importantly, sustained) frequency is, not blindly going "LOOP BAD"

faint burrow
#

Anyway,

_args remoteExec ["func", _receivers];

is better than

{
    _args remoteExec ["func", _x];
} forEach _receivers;
exotic gyro
#

For just showing a hint, it probably won't cause problems if you don't do best practices

We shouldn't just ignore them when teaching people though

hallow mortar
#

"Target collection could be optimised" is a different message to "never put remoteExec in a loop"

exotic gyro
#

I mean you should also never put it in a loop if you can possibly avoid it

hallow mortar
#

I would like to excuse myself from this conversation so I can go and stare at a wall for several hours

granite sky
#

yeah it convinced me to go rewrite the artillery support instead.

still forum
exotic gyro
sullen sigil
#

sorry ill save you from her

still forum
#

One might even say, your return is integral to the function

#

(C joke)

exotic gyro
#

party don't stop til Jenna leaves because Jenna leaves well before the party has even started

exotic gyro
pallid palm
#

you like Calculus omg i don,t omg

#

i like Calculator lol

#

he he

#

but as a machinst i used the other funny one

stiff kiln
#

From a client, is there a way to delete a local vehicle (as in deleteVehicle) without the command being broadcast to server and all other clients? What I'm looking for is something that would act like a deleteVehicleLocal.

faint burrow
#

deleteVehicle already accepts global arg, so you don't need to broadcast anything.

exotic gyro
#

There isn't a way to delete a non local vehicle only locally, iirc

#

... Which is incredibly niche and making me curious about what your plan is

faint burrow
exotic gyro
#

Wait I read again and realize I cannot fucking read

#

Yes, just use deleteVehicle

stiff kiln
# faint burrow `deleteVehicle` already accepts global arg, so you don't need to broadcast anyth...

That's the problem though, I'm creating and deleting a bunch of tracers ect with createVehicleLocal to create a "virtual firefight". Like ambiance. I've got this running clientside, to save on performance I thought. But it seems that each client essentially DDOS'es the server with the deleteVehicle causing it to spam server-RPT with about 50 Error: Object(15 : 597) not found per second. Server frames completely dying, player FPS dropping to single digits.

granite sky
#

That would be an Arma bug.

exotic gyro
#

local objects be like that sometimes

stiff kiln
#

Alright, thanks. Back to the drawing board I guess...

#

Maybe try a serverside version? Seems like an awful amount of traffic though... Might not be much better.

stiff kiln
exotic gyro
#

we should get dedmen to fix it in prof

stiff kiln
neon plaza
#

Trying to get this line of code to work but found that when It runs on a dedicated server It will not. Any pointers.

#

if (isNil "ROS_AllUnitsArray") then {ROS_AllUnitsArray = []};

addMissionEventHandler ["EntityKilled",{
      params ["_unit"];
      if !(_unit isKindOf "CAManBase") exitWith {};
      if (!(isPlayer _unit) && !(_unit in ROS_AllUnitsArray)) then {
          [_unit] spawn {
              params ["_unit"];
              sleep 3;
              deletevehicle _unit;
          };
      };
}];

timber bough
# little raptor Yep

Love that mod, massive quality of life improvement. I was looking at some of the code for clearing buildings actually, I compared it a bit to the code in the platoon commander mod, but they work very differently.
I still struggle to have AI effectively clear buildings though.

For example, if a building was previously pre-populated with enemy units, and then I use the clear building command on your mod, sometimes the units refuse to move in.

BUT, if I delete all those enemy units, and use the clear building command, the units will clear the building.

This happens even if my units are not aware of the enemy. Have you encountered this issue before?

flint geyser
#

I have a script that spawns enemy convois and jet patrols, but i a want to add a live marker on them so people can see their live posiotion on the map. Any ideas?

tulip ridge
little raptor
#

AI can't move to a house position that is already occupied by another AI (and they don't care if it's enemy either)

#

AI can only move to predefined points, while walking along predefined paths. So it's obvious why the devs added that limitation

spare vector
#

Anyone have experiance getting sound to work with the BIS_fnc_fireSupportVirtual

#

i can get the rounds to drop and everything works there but the sound doesnt play thats defined

#
["TAG_artilleryCenter", "Sh_105mm_HEAT_MP", 100, 1, nil, {false}, nil, 250, 100, ["arty"]] spawn BIS_fnc_fireSupportVirtual;
#

and yes the "arty" sound is setup in description.ext

errant jay
#

Anyone have knowledge/idea how to possibly make a single AI have increased health with ACE enabled?

stable dune
fleet sand
# flint geyser I have a script that spawns enemy convois and jet patrols, but i a want to add a...

basicly you would have to do something like this to add live marker and track their position.
This code is not tested its a proof of concept how would you go about it.

myUnitsToTrack = [unit1,unit2,unit3];

0 spawn {
    //create a dot marker on each of the tracked units
    {
        private _markerName = "Unit" + (str (_forEachIndex + 1));
        private _marker = createMarker [_markerName, getposASL _x];
        _marker setMarkerType "hd_dot";
        private _markerText = format ["%1",name _x];
        _marker setMarkerText _markerText;
    }foreach myUnitsToTrack;
    
    //a loop that will work until everytracked unit is dead
    //and update marker depended on the position.
    while {{alive _x} count myUnitsToTrack != 0} do {
        {
            private _markerName = "Unit" + (str (_forEachIndex + 1));
            private _pos = getPosASL _x;
            _markerName setMarkerPos _pos;
        }foreach myUnitsToTrack;
        sleep 2;
    };
};
meager granite
#

I wonder how quicker createHashMapFromArray was if it allowed flat arrays with keys and values instead of two dimentional one?

#

createHashMapFromArray [key1, val1, key2, val2, ..., keyN, valN]
vs current
createHashMapFromArray [[key1, val1], [key2, val2], ..., [keyN, valN]]

faint burrow
still forum
#

But not flat array

#

the command itself probably wouldn't be any faster.
Just your own array creation, before you call the command, might be faster

meager granite
meager granite
still forum
#

Well you can easily benchmark that

meager granite
#

binary version vs unary?

still forum
#

Just no version

#

just benchmark
[key1, val1, key2, val2, ..., keyN, valN]
and the same in two arrays

faint burrow
#

Understood, you want something like hash set.
Did you try this:

[key1, key2, ..., keyN] createHashMapFromArray [];

?
Missed values will be nils.

meager granite
#

Oh, without the command itself, makes sense

faint burrow
#

OK.

meager granite
#
[
     diag_codePerformance [{[1,2,3,4,5,6,7,8,9,10]}]
    ,diag_codePerformance [{[[1,2],[3,4],[5,6],[7,8],[9,10]]}]
]
```=>`[[0.000607438,100000],[0.000957758,100000]]`
#

So, the difference is noticeable

#

Do I really need another way to create hashmaps? No. But its interesting to think about it.

still forum
#

0.0003ms
noticable.
Yeah noticable when looking at the numbers maybe

meager granite
#

Yeah, I realized its a drop in an ocean really compared to the rest of the script

tulip ridge
stable dune
tulip ridge
#

You can look at your ai damage threshold setting to see what value it'd already be.

Alternatively you could also just grab the setting directly and add whatever value to it

errant jay
#

awesome, thanks!

stable dune
timber bough
#

Now I'm trying to figure out ways to have AI clear houses effectively, should I make it such that not all positions are occupied then?
If a house has 10 positions only have less than half occupied?
How do you usually detect if a house position is occupied? I could make it such that we get an array of house positions then filter out occupied positions and have the units go through the unoccupied ones, hoping they'll come across the enemy units enough to shoot them

fleet sand
# timber bough Now I'm trying to figure out ways to have AI clear houses effectively, should I ...

There is a lot of scripts for room/building clearing with AI you could always take them apart and learn how they are made here is one from johnnyboy https://forums.bohemia.net/forums/topic/222844-jboy-ai-cqb-movement-scripts/

Also Lambs has its custom room clearing if you are using Lambs

exotic gyro
tulip ridge
#

It's just more total health essentially

exotic gyro
#

Yeah

raw vapor
#

I don't know if anyone could help me out. As usual I hardly know where to start.

In multiplayer, I want to do an area denial trigger, such that if you enter the area, and you stay for too long, the player in the area (excluding aircraft) eventually blows up, Battlefield style. This is intended to force players to stay in the area of the map I want them in because "land mines" or whatever.

But while I could put an actual minefield, 1) performance 2) the little gremlins will try to remove the mines and bypass the location anyway

#

I know I need a trigger to detect players.

tulip ridge
#

You could make a trigger that when activated starts a timer (you could use CBA_fnc_waitAndExecute) for X seconds, and then if the player is in the area, blow them up (createVehicle an explosive and detonate it)

raw vapor
#

Ooh, that'd work.