#arma3_scripting

1 messages · Page 547 of 1

astral dawn
#

but we also want a memory point here

still forum
#

Also.. reading the attachTo wiki page might be helpful

The offset is applied to the object center unless a memory point is provided
The offset is ignored

#

memory point on _obj1 right?

astral dawn
#

looks like, on obj2?

still forum
#

_obj1 attachTo [_obj2, _obj1 selectionPosition ["attach", "Memory"]]; like so?

#

well the attachTo code above tried to use attach point from _obj1

mild pumice
#

i want to attach obj1 , to obj2 , on a memory called "attach" which is on obj2

#

without touching the pos of obj1

astral dawn
#

Did my recent suggestion not work? 😦 (the one with ASLTOAGL magic)

mild pumice
#

it's better but still a little bit in the ground

tough abyss
#

I'm having 90 lines like that in my mission/mod RPT:Unsupported language Portuguese in stringtable

mild pumice
#
20:15:30 ["_memPos",[-2.64375,0.136325,-0.59973]]
20:15:30 ["_objRelPos",[-0.324707,0.511719,-0.773102]]
20:15:30 ["_finalPos",[2.31904,0.375394,-0.173372]]
#
_memPos = _obj2 selectionPosition ["attach", "Memory"];
diag_log ["_memPos",_memPos];
_objRelPos = _obj2 worldToModel (ASLToAGL (getPosASL _obj1));
diag_log ["_objRelPos",_objRelPos];
_finalPos = _objRelPos vectorDiff _memPos;
diag_log ["_finalPos",_finalPos];

_obj1 attachTo [_obj2, _finalPos, "attach"]; 
plain current
#

Ya'll thought about trying the shit and seeing what works?

mild pumice
still forum
#

k just ignore what I recommended then ^^

astral dawn
#

_obj1 attachTo [_obj2, _obj1 selectionPosition ["attach", "Memory"]]; like so?
But if the animation plays and selection position changes, the car will stay at the same place relative to obj2 model center

still forum
#

sure?

#

yes

#

tru

#

how about just hardcoding a offset that works?

astral dawn
#

the Z offset you mean? While keeping the x, y calculated as before?

#

Well yes would work, unless Joker is about to rotate his bench in weird ways

#

I assume it will always stay horisontal so... should work?

still forum
#

yeah

#

just add a hardcoded + on the z

#

as long as the model doesn't change, and it's not a ASL/AGL thing that should just work

astral dawn
#

nah, wait, but what if there are different cars and they all have different model origin, so offset will be different?

#

or... idk where do cars actually have their origin?

still forum
#

mempoint offset will fix that

#

origin is model center

#

just try it out ¯_(ツ)_/¯

mild pumice
#

0.8 works with this car i'll try others

astral dawn
#

I guess that just for this case, you can take bounding box's Z coordinate

#

which will correspond to the floor wheels of the car

#

(boundingBoxReal _car)#1#2

#
_memPos = _obj2 selectionPosition ["attach", "Memory"];
diag_log ["_memPos",_memPos];
_objRelPos = _obj2 worldToModel (ASLToAGL (getPosASL _obj1));
diag_log ["_objRelPos",_objRelPos];
_finalPos = _objRelPos vectorDiff _memPos;
_zoffset = (boundingBoxReal _obj2)#1#2; // A positive number
_finalPos set [2, _zoffset];
diag_log ["_finalPos",_finalPos];

_obj1 attachTo [_obj2, _finalPos, "attach"]; 

smth like this?

mild pumice
#

boundingboxreal car : 20:56:05 [[-1.41541,-2.9383,-0.055301],[1.44496,2.27104,2.84549],4.46978]
log from previous attachTo : 20:47:09 ["_finalPos",[2.08515,-0.00937185,-0.184404]]
So i guess it would be (boundingBoxReal car)#0#2

astral dawn
#

Yes you are right I think 🤔 maybe - ((boundingBoxReal car)#0#2) ?

#

We need the Z offset from the bottom of the wheels to the center of model

tough abyss
#

How do i get view direction when controling a flying drone?

astral dawn
#

getDir _drone ?

tough abyss
#

I need 3D direction.

#

not of the drone, but of the view the controling player have

astral dawn
#

ah ok, where the camera is looking at 🤔

tough abyss
#

This don't work: getCameraViewDirection player

#

yes

#

This above keeps geting player view direction

#

not controled drone view direction

crisp cairn
#

Hello all, I have been working on my script now for a while using public variables. I am thinking of how to make this work with multiple players using public variables is this possible

astral dawn
#

@crisp cairn need more information if you want to get any feedback 🙄

tough abyss
#

@astral dawn when the player is using a drone it is remote controling an hiden AI unit in the drone, so i need to use getCameraViewDirection on the remote controled unit.

#

How can i get the unit remote controled by player?

astral dawn
#

I guess so, I'm sorry I can't help you, I guess the real question is - how do you get the drone to which player is connected

#

Yes you are right, IDK sorry 😦

still forum
#

CBA_fnc_currentUnit @tough abyss

tough abyss
#

@astral dawn @still forum thanks!

#

@still forum no way to do that without CBA?

astral dawn
#

You can just see what's in the cba code

#

missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", player]

tough abyss
#

about [object] remoteExec Unary vs object remoteExec Unary, both work

#

So I call bullshit on only [] working, just tested on dedi

obsidian violet
#

Right back with some simple questions.
I´m trying to save the group a player is in and save it into a variable.
Then Create and switch over the player to the civilian group.

When a function is running I want the player to return to the previous group he were before.

problem is.. if the player is in a group with only that player the group will get destroyed / deleted.
Main point of this is that when function 1 is running. the player switch side to Civilian.

Function 2 the player return to the previous group or if it does not exist return to the same side he was in before, west,east or resistance.

I tried doing it this way but it did not work...

//Function 1
_oldGroup = group player;
_newGroup = createGroup CIVILIAN;
[player] joinSilent _newGroup;

//Function 2 
[player] joinSilent _oldGroup;
#

@tough abyss Correct. It does work. was something else within the function.

tough abyss
#

so I wasted my time? great

obsidian violet
#

@tough abyss oh sorry. was talking about a earlier similar problem. go on 🙂

astral dawn
#

Yeah if everyone leaves a group then it becomes groupNull.... you have to recreate the group again I guess - is that the problem you're facing?
https://feedback.bistudio.com/T138990

However if you want all players in a group to become civilian, you can use setCaptive command (on each player)

tough abyss
#

@astral dawn i tested it, it is returning the player always.

#

i run the code in my mission, with no CBA

obsidian violet
#

Sparker. yeah basicly it =)
but I think a need a condition then like.

if (***the oldgroup exists) then {player join _oldgroup}
else
{blablabla create new group} ;

problem is how can I save what side the _oldgroup is so the player will join the same side again?

astral dawn
#

Store the side somewhere?
Also why don't you like the setCaptive command?

obsidian violet
#

Because the player will become captive =)

so to store it it would simply be something like this
_oldgroupside = side player;

astral dawn
#

setCaptive just prevents AIs from engaging player, they will treat him as a civilian, until you run setCaptive again
There many places where you can store variables... mission namespace, or you can store it in the new group you create

#

_newGroup setVariable ["prevSide", ...];

tough abyss
#

This CBA function is broken i believe: CBA_fnc_currentUnit @still forum always return the player, tested with CBA.

still forum
#

no it's not

#

that's what returns the remote controlled unit

#

unless your definition of remote control is different than mine

tough abyss
#

Remote Unit Controled by player: The AI unit inside a drone that the player connects and controls.

#

CBA_fnc_currentUnit
Description
Returns the controlled unit. (“player” or remote controlled unit via zeus)

#

doesnt say anything about AI in drone

#

So when i'm controling a drone, i'm remote controling an hidden AI unit inside the drone, how do i get this hidden AI unit object?

#

driver drone or gunner drone depends who you are controlling

obsidian violet
#

@astral dawn Thank you ❤ works perfectly.

//Function 1 
_oldGroup = group player;
_oldgroupSide = side player;
_newGroup = createGroup CIVILIAN;
[player] joinSilent _newGroup;

//Function 2
if (isnull _oldgroup) then {
    _newOldgroup = createGroup _oldgroupSide;
    [player] joinSilent _newOldgroup;
} else {
    [player] joinSilent _oldGroup;
};
minor lance
#

Hello!

#

is thhere any way to hide the tabs from a ToolBox

tough abyss
#

@tough abyss thanks, this is ok, but how do i know if a player is using the drone driver position or the drone gunner position?

#

I can't get the right unit if i don't know wich position player is ocuping.

#

Solved. Thanks!

#

Can 2 persons control a drone? One in Driver and other in Gunner, at the same time?

#

since UAVControl returns only one controling unit, i guess the answer is no.

#

I think yes but the command designed wrong

tender fossil
#
_points = switch (true) do {
                    case (_killed_type isKindOf "Infantry"): {
                        if(ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100) < 1) then {
                            1;
                        } else {
                            ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);
                        }
                    };
                    case (_killed_type isKindOf "Car"): {round((_get select QUERYUNITPRICE) *0.45* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
                    case (_killed_type isKindOf "Ship"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
                    case (_killed_type isKindOf "Motorcycle"): {round((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
                    case (_killed_type isKindOf "Tank"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
                    case (_killed_type isKindOf "Helicopter"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
                    case (_killed_type isKindOf "Plane"): {round((_get select QUERYUNITPRICE) *0.35* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
                    case (_killed_type isKindOf "StaticWeapon"): {round((_get select QUERYUNITPRICE) *0.5* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
                    case (_killed_type isKindOf "Building"): {round((_get select QUERYUNITPRICE) *0.55* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100 * (missionNamespace getVariable "WFBE_C_BUILDINGS_SCORE_COEF"));};
                    default {63};
                };
#

!! Arma 2 !!

Why does the script/variable fall back to default value when infantry is chosen/killed?

#

If I kill units of other types, the values work like they are supposed to

west venture
#

There's a '< 1' and 'then {1;} in the infantry part that is absent from the rest, which are set under an 'else'?
(but I don't really know what I'm looking at)

tender fossil
#

Actually, I think I'll just use ceil to fix it

#

This is a script snippet from Benny's Warfare that I modified

west venture
#

All I can say is that the Infantry part looks weird compared to the rest. Figure out why, maybe?

#

I'm having problems figuring out why, in main init, this isn't really working out. _EnemyCount = ["EnemyCount",100] call BIS_fnc_getParamValue; (where EnemyCount is the classname of a param in description.ext)

#

Related test Game Logic init: marker_6 set3DENAttribute ["markerText",_EnemyCount];
What I'm actually trying to use it for: this set3DENAttribute ["presence",_EnemyCount];

tender fossil
#
_points = switch (true) do {
    case (_killed_type isKindOf "Infantry"): {ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100)};
    case (_killed_type isKindOf "Car"): {round((_get select QUERYUNITPRICE) *0.45* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Ship"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Motorcycle"): {round((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Tank"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Helicopter"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Plane"): {round((_get select QUERYUNITPRICE) *0.35* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "StaticWeapon"): {round((_get select QUERYUNITPRICE) *0.5* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Building"): {round((_get select QUERYUNITPRICE) *0.55* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100 * (missionNamespace getVariable "WFBE_C_BUILDINGS_SCORE_COEF"));};
    default {63};
};
#

When _killed_type isKindOf "Infantry", default value (63) is chosen. With every other type of unit the script works. What's wrong? (Note: Arma 2!!)

#

For example, a farmer is worth of $100. Bounty coef is 1, so the final calculation is ceil((100 * 0.7 * 1) / 100) = 1.

#

Oh wait, I think there's a missing ;...

#
    case (_killed_type isKindOf "Infantry"): {ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100)};

to --->

    case (_killed_type isKindOf "Infantry"): {ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};

😄

west venture
#

Figured out that set3DENAttribute is actually not what I want (even though it'd be really convenient).

tender fossil
#

Still doesn't work. Now the code is:

_points = switch (true) do {
    case (_killed_type isKindOf "Infantry"): {ceil((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Car"): {round((_get select QUERYUNITPRICE) *0.45* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Ship"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Motorcycle"): {round((_get select QUERYUNITPRICE) *0.7* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Tank"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Helicopter"): {round((_get select QUERYUNITPRICE) *0.4* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Plane"): {round((_get select QUERYUNITPRICE) *0.35* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "StaticWeapon"): {round((_get select QUERYUNITPRICE) *0.5* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100);};
    case (_killed_type isKindOf "Building"): {round((_get select QUERYUNITPRICE) *0.55* (missionNamespace getVariable "WFBE_C_UNITS_BOUNTY_COEF") / 100 * (missionNamespace getVariable "WFBE_C_BUILDINGS_SCORE_COEF"));};
    default {63};
};
#

The function still falls back to default value (63) when I kill infantry

west venture
#

Well, Infantry is the only type with a ceil instead of a round? Why is that?

tender fossil
#

Should it be Man instead of Infantry?

west venture
#

Try it out

tender fossil
#

Ceil only because infantry values are so low that the score might drop to 0 in some cases

#

So ceil ensures that player gets at least 1 point

west venture
#

I'd probably call an if 0 then 1 in that case just to simplify/deobfuscate

tender fossil
#

I'm pretty sure this will fix it

#

The original script has been in use for like a decade, but the error has gone unnoticed because the default value in original script was the same than score for killing an infantry unit

#

Yes, it fixed it! Yay

#

😄

west venture
#

Hmm
Am I actually trying to find an operator that doesn't exist? Looking for a means to set Probability of Presence at mission start via Param.

winter rose
#

random and deleteVehicle 🙂

west venture
#

Oh yay, forgot random was a thing
(but still, absent operator is agh)

#

TY

tender fossil
#

Part of FSM running on dedicated server:

    {
        if ((isPlayer _x) && !(isNull (missionNamespace getVariable format["WFBE_SCORE_UID_%1", getPlayerUID _x]))) then {
            _playerNewScore = score _x;
            _scoreDiff = _playerNewScore - (missionNamespace getVariable format["WFBE_SCORE_UID_%1", getPlayerUID _x]);
            missionNamespace setVariable [format["WFBE_SCORE_UID_%1", getPlayerUID _x], _playerNewScore];
            ["StorePlayerSkill", "Store", getPlayerUID _x, _scoreDiff] call persistent_fnc_storeToDatabase;
        } else {
            _playerNewScore = score _x;
            _scoreDiff = _playerNewScore;
            missionNamespace setVariable [format["WFBE_SCORE_UID_%1", getPlayerUID _x], _playerNewScore];
            ["StorePlayerSkill", "Store", getPlayerUID _x, _scoreDiff] call persistent_fnc_storeToDatabase;

        };
    } forEach (playableUnits + switchableUnits);
#

persistent_fnc_storeToDatabase = (also running on server)

// Call to database
private ["_className","_procedureName","_response","_uid","_scoreDiff"];

_className = _this select 0;
_procedureName = _this select 1;
_uid = _this select 2;
_scoreDiff = this select 3;

    [_uid, "DatabaseDebug", [_className, _procedureName, _uid, "TEST", _scoreDiff]] Call WFBE_CO_FNC_SendToClients;
    _response = "Arma2Net.Unmanaged" callExtension format ["%1 [%2,%3,%4]",_classname,_procedureName,_uid,_scoreDiff];
    _response = call compile _response;


if (count _response > 0) then {
    _response = _response select 0;
};

[_uid, "DatabaseDebug", [_className, _procedureName, _uid, _response, _scoreDiff]] Call WFBE_CO_FNC_SendToClients;

_response
#

Why am I not seeing the debug messages?

#

WFBE_CO_FNC_SendToClients works with other functions normally, also I got the message to show once somehow but then it disappeared again

#

DatabaseDebug PV function:

private ["_className","_procedureName","_response","_uid","_scoreDiff"];

_className = _this select 0;
_procedureName = _this select 1;
_uid = _this select 2;
_response = _this select 3;
_hasScoreDiff = false;
_scoreDiff = 0;

if (count _this > 4) then {
    _hasScoreDiff = true;
};

if (_hasScoreDiff) then {
    _scoreDiff = this select 3;
};

sleep (random 3);

if (_hasScoreDiff) then {
    Format["Database was called with parameters: className = %1, _procedureName = %2, GUID = %3, _scoreDiff = %4", _className, _procedureName, _uid, _scoreDiff] Call GroupChatMessage;
    Format["Response from database (player skill (earned points per minute): %1", _response] Call GroupChatMessage;
} else {
    Format["Database was called with parameters: className = %1, _procedureName = %2, GUID = %3", _className, _procedureName, _uid] Call GroupChatMessage;
    Format["Response from database (player skill (earned points per minute): %1", _response] Call GroupChatMessage;
};
mortal wigeon
#

Is there a way to dynamically create variable names for spawned objects?

something like e.g.

format ["truck_%1", _someValue] = createVehicle bla bla bla

copper raven
#

setVariable on mission namespace

mortal wigeon
#

Can you give me a code example? I'm sorry to ask, it's late and my brain's struggling

copper raven
tender fossil
#

@mortal wigeon Check my code above:

missionNamespace setVariable [format["WFBE_SCORE_UID_%1", getPlayerUID _x], _playerNewScore];

so eg.

missionNamespace setVariable [format["truck_%1", _somevalue], createVehicle ...];
sturdy sage
#
FNC_createTarget = 
{
params ["_position","_direction","_type","_side","_marker"];
    _object = ([_position,_direction,_type,_side] call bis_fnc_spawnvehicle) select 0;
    _object addEventHandler ["killed", "deleteMarker _marker"];
    _object disableAI "MOVE";
    _object //return
};
{
    private _position = getMarkerPos _x;
    systemchat format ["_forEachIndex has a value of %1",_forEachIndex];                            //invalid number in expression
    private _direction = 0;
    private _type = sab_boat_freighter_o;
    private _side = WEST;
    missionNamespace setVariable [format["%1", _index], [_position, _direction, _type, _side , _x] call FNC_createTarget];
} forEach _eastMarker;

The systemchat message i added for debugging, because it didn't work and i wanted to check if "_forEachIndex" actually does what i think it does.
When launching the script i get a "invalid number in expression" script error in the systemchat line.
What am i doing wrong with "_forEachIndex"? Does it not work that way?

copper raven
#

bom chars at line 11 and 15

sturdy sage
#

Thank you very much, i actually didn't know that is a thing. Had to google, but fixed it now.

The event handler is still not working though so i have some figuring things out to do now.

sick gazelle
#

Does anyone know of any issues with this: https://community.bistudio.com/wiki/serverCommand
Trying to use it with the kick function, and the RPT is posting that it is successfully executing the kick (using the alternate syntax with the serverCommandPassword) however the player it alleges kicking, is not actually removed from the game. (Same result produced using Client Name, and UID).

mortal wigeon
#

Thanks @tender fossil

tough abyss
#

serverCommand logs in .rpt?

sick gazelle
#

Apparently so.

silent latch
#

what button can you apply textures to?

winter rose
#

Question: how are Arma rain drops done (I suppose some "water bullets"?), and can we "detect" them by any mean?

tough abyss
silent latch
#

ok

silent latch
#

@tough abyss im having no luck with it

silent latch
#

nvm

#

is there a script that makes it so there can only be one instance of a dialog

#

?

winter rose
#

using createDialog only once 😅

#
if (not dialog) then { createDialog "RscMyDialog"; };```
#

@silent latch

silent latch
#

yea

#

i already found something like this

winter rose
#

so you're good?

silent latch
#

yes

winter rose
#

you're welcome 👍

silent latch
#

if (!(isNull(findDisplay 9997))) exitwith {closeDialog 2;};

#

then below it was createDialog

silent latch
#

case 44 is not working for me

silent latch
#

Nvm

harsh sphinx
#

Is there any way to suppress the zero divisor error when accessing an element of an array which doesn't exist, without I guess filling a bunch of empties. I don't particularly care if it doesn't since I'm handling it, but I'd also rather not have this error bark at me because of it.

cosmic lichen
#

The question is, why are you trying to access an non existing array entry?

tough abyss
#

Use param with default value @harsh sphinx

harsh sphinx
#

Thanks. I'm not able to use param in this context but I realized I can just check the count of the array before going ahead with selecting something, which can mitigate it.

tough abyss
#

param and select are interchangeable, if you don’t want to use default value, don’t use, it will give you nil and no error

#

[] select 123; nil and error
[] param [123]; nil and no error

half inlet
#

I know most people won't care much about this, but there's this bug that's been bothering me since day one:

everytime you open/close a dialog, your mouse cursor moves a little further away from the center of the screen.

this is one of the oldest remaining bugs, to my knowledge - minor one, sure, but a bug nonetheless. After thousands of hours of playtime I eventually got used to it and started adapting my playstyle to it, e.g. by centering (very roughly) my mouse before closing a dialog. Obviously this is far from being the ideal solution, and is generally just too much effort to be worth it, so today I reached my tipping point and decided to investigate this properly

#

https://cdn.discordapp.com/attachments/530670910475337728/615111439124004864/arma_cursor.png

surprisingly, it didn't take very long to figure out what's happening: everytime a dialog is opened, there is a delay of approximately 2 to 5 frames, after which the cursor is snapped to a different position. The offset between the new position and the old one revealed a pattern that is very consistent; the game seems to interpretate the cursor's position as being inside the safezone (the light grey area) and consequently remaps that position relative to the full UI area. This means if I leave the cursor at the absolute UI position of [0,0], it will systematically end up in the top left corner of the screen - everytime, without fail. The same can be achieved with any other coordinate - it essentially just projects the old position onto a different scale

now, I've no clue what the code behind this looks like, but it seems to be a more-or-less intentional "feature", seeing as the cursor originally shows in the correct location for a very brief moment, before being moved to a new (and incorrect) position. This leads me to believe that it's likely not a difficult thing to fix, which only adds to my frustration. But since I can't be bothered to wait for an official fix from BI, I came up with my own dirty (but working) solution:

#
dev_canSaveMousePos = false;
dev_lastMousePos = getMousePosition;

if (!isNil "dev_mouseCursorEH") then {
    removeMissionEventHandler ["EachFrame", dev_mouseCursorEH];
};
dev_mouseCursorEH = addMissionEventHandler ["EachFrame", {

    // Only work if there are any dialogs (or displays) open
    if (!dialog and {count allDisplays == 4}) then {        // 0, 313, 46 and 12 are always open
        dev_canSaveMousePos = false;
    } else {
        private _curMousePos = getMousePosition;

        // A dialog is open; check if the cursor has moved yet
        if !(dev_canSaveMousePos) then {

            private _offsetX = (((dev_lastMousePos select 0) max 0) min 1) - 0.5;
            private _offsetY = (((dev_lastMousePos select 1) max 0) min 1) - 0.5;
            private _calcPos = [
                0.5 + _offsetX * safeZoneW,
                0.5 + _offsetY * safeZoneH
            ];

            // If the cursor has jumped to the predicted position... (this takes a couple frames)
            if (_curMousePos distanceSqr _calcPos < 0.00001) then {        // pixelW ~= pixelH ~= 0.001 (-> 1 pixel radius)

                // ...snap it back to where it should be
                setMousePosition dev_lastMousePos;
                dev_canSaveMousePos = true;

            // Otherwise, check if the user has manually moved the cursor before it could jump
            } else {
                if (_curMousePos distanceSqr dev_lastMousePos > 0.00001) then {
                    dev_lastMousePos = _curMousePos;
                    dev_canSaveMousePos = true;
                };
            };

        // Update the cursor position
        } else {
            dev_lastMousePos = _curMousePos;
        };
    };
}];
#

(apologies for the wall of text)

fleet hazel
#

Hi guys. How do I remove UI systemChat ?

winter rose
#

what do you mean…?

fleet hazel
#

@winter rose system Chat. How to disable?

winter rose
#

you simply don't put it in your code

#

@fleet hazel

fleet hazel
#

@winter rose I need to disable the RSC display itself

winter rose
#

so all the radio, right?

#

maybe try showHUD

fleet hazel
#

Yes

#

Delete RscDisplay for system Chat

winter rose
#
showChat false``` it will affect _all_ radio channels, not just `systemChat` @fleet hazel
hollow lantern
#

is there a easy way for limiting the range of the MIM-145 Defender? I have them setup to guard an Island but they shoot everything across tanoa. My idea was to maybe limit the radar they are attached to so it doesn't spot across the map

#

hmm maybe I just create a trigger and turn off the MIM-145 AI and enable them once an airplane passes the trigger

winter rose
#

@hollow lantern that's the best solution I think

hollow lantern
#

yeah, paired it with sqf count (thisList unitsBelowHeight 2) < 0; to include only air units

tough abyss
#

count can never be < 0 so your condition will always be false

hollow lantern
#

ah yeah

tired delta
#

hello im not sure if im right in this section but i hope so. My problem is that i want to add sirens to the D3S cars and i dont know where to begin with becaus i cant find nothing in the internet that can help me. i hope sombody can help me.

winter rose
#

@tired delta siren such as airhorn siren, or car alarm?

uncut narwhal
#

is it posible to get zeus via the debug console?

still forum
#

yes

#

you can spawn the curator module manually, and assign yourself to it

#

but I think you need to create it on serverside

#

so it's quite a bit of code

uncut narwhal
#

ok i will try

tired delta
#

@winter rose sirens such as airhorns that is an "Useraction" in the config of the vehicle. I tride my self on it and used one of the A3L cars as tamplate but o had no success

winter rose
tired delta
#

allright but it must be conected with a script that plays the sound

#

and i dont know how to bind them together

#

class sirenon { displayName = "<t color='#ff0000'>Sirene An</t>"; position = "drivewheel"; radius = 10; condition = "driver this == player && (this animationPhase 'ani_siren' == 0)"; statement = "this animate ['ani_siren', 0.2]"; onlyForplayer = 1; };

winter rose
#
this say "mySound";```
tired delta
#

but it should be a loop

#

ther is also a script and i dont know how to call it

#

i have set the config like the one from a3l but i dont know how to link these things

hollow lantern
#
comment "Get Zeus instantly without Modules and with all entities as editable";
curGrp =  createGroup EAST; theCurator  = curGrp createUnit ["ModuleCurator_F", player, [], 0, "NONE"];
theCurator setCuratorEditingAreaType true; theCurator addCuratorEditableObjects [entities "all",true];``` @uncut narwhal
tough abyss
#

@hollow lantern but does this work?

hollow lantern
#

ofc it does

#

I use it myself all the time

tough abyss
#

I can’t see where you assign player as curator

hollow lantern
#

well if on a server then the assign command need to be executed, on local the player is used as default

tough abyss
#

And where is your code supposed to run

hollow lantern
#

debug console

still forum
#

on local the player is used as default
setCuratorEditingAreaType is a serverside only command
addCuratorEditableObjects is server only too
How do you execute server only commands locally on the player?

astral dawn
#

How can I draw lines on the map? I know there is a drawLine but it runs inside "Draw" event handler. How are player-made lines drawn actually? Or is it done by engine and has no scripting support?

tough abyss
#

debug console
Thought you were gonna say Arma 3

hollow lantern
still forum
#

Or is it done by engine and has no scripting support?
engine

#

you can spawn markers I guess?

astral dawn
#

yeah I can draw a rectangle and rotate it, etc...

tough abyss
#

POLYLINE

astral dawn
#

what?

tough abyss
#

Those line markers have type

astral dawn
#

Hmm? okay, I know they are registered in the allMapMarkers, but can I create them manually? As I understand I can't?

tough abyss
#

No

#

But can delete

#

Maybe even move

#

You can rotate rectangle though

astral dawn
#

Yes yes I know

#

Width will scale according to map scale

#

It will not be static

tough abyss
#

What you want to do?

astral dawn
#

Just draw a line with fixed width (not in meters but in pixels)

#

In the High Command thing, IIRC, they rescale the rectangle's width according to map scale to make it stay the same width in pixels... I thought there is a better way

tough abyss
#

So when you zoom out it is still the same with?

astral dawn
#

Yeah

hollow lantern
#

is there an easy way to translate a setDir heading into a vector for camSetDir ?

still forum
#

yes math

astral dawn
#

cos and sin and stuff

still forum
#

north is vector 0,1,0 and direction 0

astral dawn
#

[sin _angle, cos _angle, 0] I think?

hollow lantern
#
params ["_screen", "_feed","_pos", "_target", "_direction", "_effect"];

    _dirworld = [sin _direction, cos _direction, 0];

    _screen setObjectTexture [ 0, format ["#(argb,512,512,1)r2t(%1,1)", _feed]];

/* create camera and stream to render surface */
    _cam = "camera" camCreate _pos;  
    _cam camSetDir  [_dirworld];
    _cam camSetTarget _target;

    _cam camCommit 0;
    _cam cameraEffect ["INTERNAL", "BACK", _feed];
    
/* switch cam to thermal */

_feed setPiPEffect [6, 0, 0, 9, 0, 0, 0, false];
_feed setPiPEffect [_effect];``` that's my current code. However the cam is not rotated as it should be.  I execute that script the following way: ```sqf
[A_wallUS, "dscreenfeed", [2166.64,13100,350.0], USBASE_MIDDLE_POS, 54.105, 2] execVM "itsAebian\uavops.sqf";```
still forum
#

as it should be
what's the difference?

#

doesn't setTarget make it aim at target?

hollow lantern
still forum
#

that's the z parameter then

hollow lantern
#

hmmm yeah but from the rotation, I mean the Z parameter in _pos is the height of the camera

#

that's why I thought camSetDir would help

tough abyss
#

You asked how to convert azimuth to vector. Azimuth is strictly x,y

hollow lantern
#

now you confuse me. Isn't that exactly what the rotation Z is ?

tough abyss
#

Along z axis yes but your picture shows different rotation

hollow lantern
#

well instead of ----- the picture shows| isn't that the Z rotation axis? I mean yes the camera looks from above but I thought that is Z rotation in this case

tough abyss
#

Z axis rotation is left/right

#

In Arma anyway

hollow lantern
#

yes, and this is exactly what I want to change. Like if you would rotate a map on a table

#

where you look from above onto the map

tough abyss
#

But your picture shows camera tilt

hollow lantern
#

sorry man I don't get 'ya then. In my eyes this is just a 90 degrees rotate without anything tilt

still forum
#

look up 3D vectors on google or smth.

winter rose
#

@hollow lantern move a bit your camera the opposite way of the desired angle (with sin/cos calculation or getPos alternative syntax); this will make the camera look from it towards the object in the wanted direction

#

you can't and provide a camera position and setDir the camera and set camera target

hollow lantern
#

I never had sin cos at school back in the day so probably need to watch some videos about it. The alternative syntax of getPos doesn't seem to fit. The camera will be created on the ground as the Z level will be below 10 sqf [2166.64,13100,350.0] getPos [0, 54.105]; returns [2166.64,13100,9.53674e-007]

winter rose
#
([2166.64,13100,350.0] getPos [0, 54.105]) vectorAdd [0,0,500]; // altitude in meters```
#

also, getPos [1, (…) in order to have it a teeny tiny bit back

spice axle
#

is it possible to move the position from a orbat module on the map?

finite jackal
#

Is there a known limitation to either attachTo or test_EmptyObjectForSmoke using createVehicle? I tried to use both on the new Contact DLC SIŁA smoke towers and the smoke just dissipates, while it works fine with smaller objects.

hollow lantern
#

@winter rose Thanks, after restarting the mission your code seemed to work just fine. Thank you

winter rose
#

That's one less issue in the way! Good to hear :+1:

rough heart
#

@half inlet legend

surreal peak
#

Does anyone know if you can use the Ace add interaction to object on simple objects?

#

I've been trying to use it on the blood drops generated by ace and I cant seem to get it to work

#

if someone knows how could you @ me cause im gonna be off for an hour or few

astral dawn
#

Uhm is arma not showing full file path any more on errors? (the path us truncated)

 2:26:30 Error in expression <ationScore;
private _scorePriority = (([_strategy] +   [_worldNow , _tgtLoc , _s>
 2:26:30   Error position: <_strategy] +   [_worldNow , _tgtLoc , _s>
 2:26:30   Error Undefined variable in expression: _strategy
 2:26:30 File C:\Users\s-tron\Documents\Arma 3 - Other Profiles\Sparker\missio..., line 150

Does anyone else have paths to file truncated?

austere silo
#

hi, i need a script were u can move (teleport) an item (box1) to me, infrontofme, ingame.

young current
#

Use modelToWorld to get the position and setPos to set it.

tough abyss
rough heart
#

@surreal peak can't do that with simple objects

winter rose
austere silo
#

would this work? ammoBox setPos (getMarkerPos "markerName");

hollow thistle
#

if ammoBox global variable holds some object that can be "setPosed" and there is marker named "markerName" then it should work just fine.

#

also no need for parentheses.

austere silo
#

ok cool. thx for the quick responce

slow isle
#

Can someone please give me a script for rearming,refueling,repairing and safezone for the .sqf please? I dont understand anything of scripts that's why im asking here, i didnt find it in a combination in the interwebs. Also i would like the original pylons of the plane to be rearmed, i dont want it giving me the default loadout. My pylons are 2 short range AA missiles on the furthest side on the wings, 500 cannon and 1 MR AA rocket. The plane is a blackwasp non stealth. that's the image of it https://ibb.co/bdxfxCZ
the planes dont have variable names

#

i tried this tutorial for the rearm,refuel,repair and edited it by deleting "sleep" because i want it to be instantly done mid air

#

also made the max speed 2000km/h and min to 0

#

but it doesnt work

#

and also i've ran into a new problem, when the vehicle(jet) respawns, it get's rid of the custom pylons i've set

#

how can i make it so it keeps the pylons

#

and about the safezone i can use the "invisible protection zone"

waxen tendon
#

damage only wheels of vehicle?

#

something along lines of this setDamage [wheels,1]

winter rose
slow isle
#

okay i have figured out the stuff with the ammo repair ect, only problem i have for now is the pylons

slow isle
#

i figured out both

#

all good now

winter rose
#

Good to hear 👍

thorn saffron
#

Is there away to detect if high command mode is toggled on for a player (ie. he is in high command ordering mode)?

winter rose
thorn saffron
#

hmm, I would still need some EH that would detect hcShownBar. I want to display some stuff only if HC mode is active

winter rose
#

nothing related in event handlers?

thorn saffron
#

alternativly, I could try adding a button to the map screen that runs a script

thorn saffron
#

yup

surreal peak
#

@winter rose thanks for showing me that, is it possible to convert a simple object into a normal one? I assume not but if it is possible it would help alot!

winter rose
#

not easily

slow isle
#

How can i make it so i can inform the player that he is in a safe zone via hint or big text on the screen ? Do i do it via hint ? If so how can i make it local only for him?

#

is this local? ```if (isPlayer playername) then {hint "message";};

#

where can i paste this?

#

in game logic or ?

crude needle
#

Simplest way is to make a trigger and put player in thisList in the condition and in the onactivation field, hint "message to player";.

There are, however, a multitude of other ways to accomplish this depending on your use case.

#

Also adjust the trigger area to that of the zone.

grave stratus
#

is anyone here using bdc's SCFramework script? i want to ask a question, since bdc is not active in the forum anymore

crisp cairn
#

Hello All, I am trying to make a Multiplayer script which will manipulate global variables. I want to have it so when Man A does something it will effect the Variables of Man B. Does anyone know how to do this?

winter rose
#

yes, you can use setVariable or publicVariableClient, depending on your usage

#

@crisp cairn

slow isle
#

How can I increase the ammo of a vehicle (blackwasp) above the limmit. In this case increase cannon ammo above 450 to around 850

#

and make it so when you resupply/respawn you get your 850 ammo back

winter rose
#

you can add magazines, but not overload one

slow isle
#

yea that works

waxen tendon
#

init.sqf

{_handle = execVM "script.sqf"} forEach units group player```
script.sqf
```sqf
this setDamage 1```
"this" right here: `###this### setDamage 1` in script.sqf does not work
how do i put in the caller as "this"; so `[whoever called the script] setDamage 1`
still forum
#

_handle = why? you never use that variable ever, and you make the forEach return nothing, that's a bad idea

#

n script.sqf does not work correct, why would it?

#

Function parameters are passed in _this

#

and you aren't passing any parameters to that script at all

#

also don't use execVM in a loop it will re load/preprocess/compile the script at every execution

#

use CfgFunctions in description.ext

waxen tendon
#

script.sqf

params ["_unit"]
_unit setDamage 1```?
still forum
#

yes

waxen tendon
#

and so [this] execVM "script.sqf"?

#

(i will get rid of the execVM)

still forum
#

this is wrong, wiki will tell you what's right

waxen tendon
#

i actually would like to pass on $(this); how do i do that?

#

whatever this is i am calling you from, take that as a param

still forum
#

why run a forEach if you pass none of it's values along?

waxen tendon
#

i dont understand

#

sorry, can you rephrase that

still forum
#

Why are you running a forEach if you don't want to use the values you are iterating over?

#

I thought you wanted to run the script for every unit in your forEach

waxen tendon
#

yes

still forum
#

for that this is wrong, you need to use what the forEach wiki page tells you

waxen tendon
#

ah fuck, is it _x?

finite dirge
#

Yep

waxen tendon
#

didnt see that

#

thanks guys!

lofty rain
#

Hi guys! I'm using this simple addAction in my mission... Is there a way to limit the distance for createVehicle?

#
"Place marker", 
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
"true", 
"true", 
{}, 
{}, 
{ 
"FlagMarker_01_F" createVehicle screenToWorld [0.5,0.5]; 
}, 
{}, 
[], 
2, 
-10, 
false, 
false] call BIS_fnc_holdActionAdd;
}];```
winter rose
#

yes.

#

grab the pos in a (private) variable first, check the distance, and if it is less than what you want, create the flag there

#

With this pseudocode, you should manage 😉

#

(that or set a condition for the action to work)

#

@lofty rain

lofty rain
#

Maybe distance between cursorTarget and caller? Does it make any sense?

dreamy kestrel
#

hello, I am trying to place an asset during a base initialization script, literally the B_Ship_MRLS_01_F, VLS object. I have a grass cutter placeholder that I am placing on the VLS position of the Liberty deck, no matter how I place it, snapped to surface, a tiny bit elevated, etc, I am either finding the asset bounces off the deck, or is detonating.

#

in terms of asset placement, this is the first one in the queue, before artillery pieces, SAM sites, etc.

#

any ideas how I can place that via script and it not explode on me or bounce off the deck and into ocean?

#

I am using the grass cutter object position and orientation in order to inform the placed object(s) as to their position and orientation.

finite dirge
#

Disable Simulation?

dreamy kestrel
#

already doing that, _asset_obj enableSimulationGlobal false;

#

literally next line after creating, _asset_obj = createVehicle [_asset_class_names select _j, [_asset_proxy_pos_atl select 0, _asset_proxy_pos_atl select 1, _asset_proxy_pos_atl select 2], [], 0, "NONE"];

finite dirge
#

Create it somewhere safe, disable sim, move it.

dreamy kestrel
#

so, not create it on the deck initially? it's an idea, thanks.

finite dirge
#

Yeah, like 0,0,100 it or whatnot, then setPos it to the other object you are using. See if that helps.

dreamy kestrel
#

okay, will try that, thank you.

young current
#

could also setvelocity to 0 as backup

dreamy kestrel
#

sweet victory. the asset factory proxy approach worked. better yet, I can provide the actual proxy as a default when the factory proxy does not exist.

young current
#

proxy?

dreamy kestrel
#

i.e. placeholder, literally, a grass cutter. just something to hold the position, orientation, etc.

#

i.e. proxy, meaning in place of.

young current
#

ah

#

in arma the term proxy is used in some other stuff so it was confusing

dreamy kestrel
#

oh, okay, I see. not familiar with those other contexts.

#

apart from network configurations, routers, proxies, etc.

radiant needle
#

What happens if I set a public variable on two different objects? Like car1 setVariable ["varMain",5,true]; and car2 setVariable ["varMain",15,true];

#

It wont overwrite right?

finite dirge
#

Correct.

#

car1 would be 5 and car2 would be 15 for that var.

radiant needle
#

Now what happens if in another code i do varMain = 10

#

Is that the equivalent of missionNameSpace?

finite dirge
#

Yes.

runic quest
#

What I want to ask is how to write a log script to bind some keys in keyhandle so that players can record some operations in SQL. Thank you. I don't know how to write in life_server

tough abyss
#

Why not ask on Life forums?

runic quest
#

@tough abyss I asked several times before, but no one answered me. I was desperate.

real mango
#

Hello community! 👋
Anyone here has experience with Pseudo Random Number Generators in ArmA3? I tried to implement a LCG one but I feel I was kind of unsuccessful, probably because how arma handles precision of larger numbers 😦 Any tips?

winter rose
#

…I know random 😄

real mango
#

well the problem is that I want to be able to provide a seed to the random generating function

#

so that I can get the same pseudo random sequences

#

the random command is meant to be the least pseudo random as possible as it doesn't expose its seed nor it allows you to change it afaik

winter rose
#

seed random x exists yeah?

real mango
#

n-n-ani?

#

kill me 😦

winter rose
real mango
#

🙏

winter rose
#

😉

real mango
#

well they are definitely making our lives easier

#

without me knowing it 😦

winter rose
#

since Arma 3 v1.67 yeah

real mango
#

oh god

#

I'm checking how many unique random numbers before the sequence loops

winter rose
#

and?

real mango
#

got up to a max of 33 so far

#

which is really really bad

#

my own implementation was having 2k+

#

but maybe i'm using it wrong? 😦

#
calc_max_unique = {
  params ["_seed"];
  private _res = [];
  private _size = count _res;
  private _prev = -1;
  while {_size > _prev} do {
    _prev = _size;
    _res pushBackUnique _seed;
    _seed = _seed random 1000;
    _size = count _res;
  };
  count _res
}
#

depends on the seed and sometimes you get a 72 but that's still a really short period

winter rose
#

maybe a stupid suggestion, but why not having an array of seeds and parse/random through it?

#

also, it might be "only" a first collision, idk
try

params ["_seed"];
private _result = [];
for "_i" from 0 to 999 do {
    _result pushbackUnique _seed;
    _seed = _seed random 1000;
};
count _result;```
real mango
#

well technically the first "collision" causes the loop

#

and it should be guaranteed that once you loop you should never get out of it again

#

but in arma realm I guess it's possible (?)

#

nah it's still a two digits number for me even with the loop 😛

#

weirdly enough, sqf obeying math laws

winter rose
#

hehe

real mango
#
#define MULTIPLIER 7793
#define INCR 1234
#define MODULO 999999

private _next_in_seq = {
  params ["_x", "_a", "_c", "_m"];
  ((_a * _x) + _c) % _m
};

private _calc_max_unique = {
  params ["_seed"];
  private _res = [];
  private _size = count _res;
  private _prev = -1;
  while {_size > _prev} do {
    _prev = _size;
    _res pushBackUnique _seed;
    _seed = [_seed, MULTIPLIER, INCR, MODULO] call _next_in_seq;
    _size = count _res;
  };
  count _res
}
#

from this I was able to produce a 2K+ unique sequences

#

sorry, *some sequences that were longer than 2K elements 😛

#

but I still have to tweak the modulo as it should be a power of 2 ideally

errant jasper
#

The problem with this approach is your values have 6 significant digits, but the multiplication _a * _x needs twice as much.

real mango
#

I'm aware 😦 Less digits will also produce shorter sequences though 😒

#
[0] call _calc_max_unique_mod
``` produces 6872 unique results before looping
#

but at this point it may just be as you hint that it's a flawed solution that just happens to match any two equal number but it doesn't necessarily mean the sequence is going to loop

tough abyss
#

Can i set by code the map view to a specific position?

tough abyss
#

@real mango thanks man!

real mango
#
private _mapCtrl = (findDisplay 313 displayCtrl 51);
private _pos = [worldSize/2, worldSize/2];
private _zoom = 0.1;
private _transitionTime = 1; // in seconds
_mapCtrl ctrlMapAnimAdd [_transitionTime,_zoom, _pos];
ctrlMapAnimCommit _mapCtrl;
``` 😉
#

(if you want to try it out in 3den)

tough abyss
#

This helped a lot, thanks.

#

Indeed, i want to put the vision in the center of the map, like you did.

finite dirge
#

@runic quest You'd have to look at how the existing queries are sent. Then remoteExec to the server to run your new func and pass what you are logging. Use that func on the server to query the DB to insert /update what you need to.

@tough abyss He's using some hacked up mission from Russia and doesn't really know much English.

runic quest
#

@finite dirge thanks,i use the altis 5.0 now, i want to learn more..

austere silo
#

who can give explanation what this is: IDC_DEFAULT

#

please

finite dirge
#

Probably a macro that was defined somewhere or was supposed to be.

austere silo
#

all rights

#

thx

minor lance
#

Hello!

#

anyone has any clue why this script makes the player sometimes be like forever in unconcious animation?

player setUnconscious true; 
sleep 5;
player setUnconscious false;

finite dirge
#

Can't think of a reason why that would happen. You could always manually check the lifeState if it happens to you (debug console) and see what it says ("INCAPACITATED" would be unconscious).

winter rose
#

@minor lance it happens if you don't have a primary weapon.

yeah.
I know.

finite dirge
#

Haha. That's amazing. At all or just equipped?

winter rose
#

I think equipped, but I don't remember well
same if you fall to the bottom of the ocean iirc; you're screwed

finite dirge
#

That's hilarious. Thanks for the info!

outer fjord
#

What is the most base way to determine what kind of unit I hit, with a specific weapon, and if true to fire off some script?

winter rose
#

add the event handler to the target

outer fjord
#

Is there a specific one though that I can say "was killed by this weapon"? Or would it just have to be unit level only?

astral dawn
outer fjord
#

Sweet.

#

Will that work on dead bodies?

astral dawn
#

Yeah object's class name remains the same when it's destroyed as I know

outer fjord
#

Thanks. I'm making the ED-1E collect "samples" from zombies

errant jasper
real mango
#

Thanks a lot! 🙂 Surely looks interesting

gaunt ermine
#

So, I want to get into scripting. The first thing I would like to try is animation for a deck crew like they have it in the Jets Showcase. However, I don't have as much experience with scripting. Anyone got any insight?

young current
#

perhaps you need to first get into how scripts are written and used. Then look into the different commands that are used to run animations on characters

#

the scene you want to replicate is rather complex and definitely more so if you want to make it dynamic

wispy cave
#

How can I check if TFAR is running on the server that a mission is running on?

queen cargo
#

@still forum

hollow thistle
#

Check class in CfgPatches

still forum
#

isClass (configFile >> "CfgPatches" >> "task_force_radio")

#

or if TFAR 1.0
!isNil "TFAR_core"

wispy cave
#

thanks

wet shadow
#

Hello people, would anyone have tips on how to get an array of players inside a specific vehicle without including the AI passengers of said vehicle in the array?

finite dirge
#

You could always loop through and not add the ones that are AI to the array.

wet shadow
#

@finite dirge Cheers, I think I'll settle on this

_passengers = [];
{if (isPlayer _x) then {_passengers append [_x]}} forEach (crew vehicle this - [gunner vehicle this] - [driver vehicle this])
tough abyss
#

crew myVehicle select { isPlayer _x }

faint oasis
#

i have a question ? how to create extension.dll in arma ?

astral dawn
#

huh?

#

could you clarify what you want to achieve please?

faint oasis
#

@finite dirge yes but it's in c# and when put the c# code and i compile it doesn't work so i don't know

#

and older tutorial doesn't work

finite dirge
#

What do you mean it doesn't work?

faint oasis
#

when i write only the code in MyExtension.cs it doesn't work when i compile he say error

finite dirge
#

What's the error?

faint oasis
finite dirge
faint oasis
#

ok

#

and i recreate a new project ?

#

@finite dirge ok it work but i don't understand the _64.dll because i have that but i don't have x64

finite dirge
#

Install those tools, restart VS (maybe the PC) and try again on the compile.

faint oasis
#

i have added "WIN64" but he don't add x64 on end of the filename

faint oasis
finite dirge
#

I'm sorry, this is something I have little experience in other than dabbling a while back in making a 32bit extension.

faint oasis
#

oh ok don't worry and i have an other question where is place my .dll ?

faint oasis
#

yes i have read this but in .pbo or only in @mod ?

finite dirge
#

in the @folder for your mod.

#

Or in the root next to arma3server.exe

faint oasis
#

ok

#

and when i add the post build script it doesn't work so i test an extension build in 32bit

#

it doesn't work too

finite dirge
#

It just renames it, so you could manually do that too... lol

faint oasis
#

yes and all doesn't work

faint oasis
#

i have a question who know how to create module in c# ?

untold barn
#

Im making a admin extras menu for my server. Im trying to check the players UID from a list of UIDs. My friend was helping me but this didnt work, but does give the Not Authorized system chat message.

private ["_uid","_Access"];
_uid = getPlayerUID player;
_Access = ['76561198769124974','UID2','UID3'];

if (_uid isEqualTo _Access) then {
    [] spawn aft_fnc_AdminExtra;
} else {
    systemChat "Not Authorized!"; //For debug
};

I tryed to use the community.bistudio.com/wiki but I cant figure out whats wrong

winter rose
#

@untold barn you are trying to check that a uid is equal to an array…

#

in is what you are after

#

Yup (and ninja'd)

faint oasis
#

@untold barn it's _uid in _Access

untold barn
#

ok thank you

dim kernel
#

is it possible to put a background on a ControlsGroup?

tough abyss
#

Good Night!

dull drum
#

Hi, guys! Does anyone have a hint for me on how to move the drawIcon3D icon screen-wise? It draws at world position, so just changing x,y shifts icon in 3d space not in the screen space. While worldToScreen binds the icon to the static position 😦

winter rose
#

give it coordinates like [0..1 , 0..1]

dull drum
#

Without Z?

#

In this case last time it was stuck at one place on the screen.

winter rose
#

oh wait, drawIcon3D. why drawIcon3D if you don't want 3D icons?

dull drum
#

Oh, that's a loooong long story. I used to stick to the rscCut stuff. But I just generate too many rsc layers and the whole thing becomes glitchy (imagine 50 zombies running around each with a hp bar above his head)

winter rose
#

and…?

dull drum
#

You are ended with glitched hpbars all over your screen even cleaning the layers after zombie death

winter rose
#

something you must do wrong then?

dull drum
#

Well, frankly speaking I don't know how to delete a reserved layer, only how to clean it. But it does not help much.

#

From the standpoint of the code quality - I did some hotseat check ups with a person who is a real programmer 🙂 and it was ok-ish.

young current
#

Draw icon 3d is supposed to draw it in world coordinatea

dull drum
#

To place - yes, but it actually extrapolates itself to the screen point

young current
#

Its not meant to draw 2d ui though

dull drum
#

Depends on what exactly UI you are talking about. Markers and tasks markers are both di3d things

#

And they are operated in a 2d screen space hence placed in a 3d world

young current
#

Yes but they point coordinates in 3d world

#

They don't move around the screen space

#

What is it you're trying to do with them

dull drum
#

Actually they do, if you will turn from the marker it will go offscreen, while the icon will be on screen moving up or down depending on the object vs camera position

#

What am I trying to do is to move my hpbar icon to the left camera (or screen) wise

young current
#

It's still trying to point to the 3d location

dull drum
#

Yup

#

You see, the hpbar is scaling when you are damaged or being healed. And it scales from center to the edges. I want it to behave as a progress bar, so I need to move it left a bit each frame if it grows.

young current
#

I don't thing there's reliable way of doing that with drawicon3d

#

It's not meant for that

dull drum
#

I picked it from a couple of other hpbar scripts.

#

rscCut doesn't really help either when it comes to dozens of hpbars 😦

winter rose
#

have fun with screenToWorld and distance

dull drum
#

Yup, I'm thinking about that @winter rose , thanks.

young current
#

Maybe I'm not understanding what you're trying to do but if you have work g example then that's the way to do it

dull drum
#

Or I can just leave it be scaled from center for Arma Gods' sake! 🙂

winter rose
#

I don't know how to delete a reserved layer, only how to clean it
if you keep using layers, you should really get how to delete them

dull drum
#

I don't know how, though I lurked every damn google page.

#

Everything is around layerId cutRsc ("", Plain) which is to clean, not to delete. You can have layers array, of course, but it's just a copy, I can't modify it. Probably it's just locked for people not to kill their basic HUD elements involuntarily 🙂

tough abyss
#

why do you think it is the rsc that caused problem and not 50 AI units

dull drum
#

Because they work ok with drawIcon3d

tough abyss
#

how were you drawing the rsc layers?

dull drum
#

on Draw3d foreach allunits create a layer with ID == object netId place a dialog control with current hpbar. If there is a layer with this object id, don't draw a new one, use the old one. Then clean all dead units layers.

#

And show them only if distance and camera position is in range.

tough abyss
#

and you were moving them with ctrlsetposition?

dull drum
#

yup

tough abyss
#

oh dear dear

dull drum
#

Ha

tough abyss
#

so someone told you this was ok?

dull drum
#

I stole it 🤦

tough abyss
#

no surprise drawicon3d works miles better

dull drum
#

And of course I've read a KK's tutors

tough abyss
#

you should stick to icon

dull drum
#

Yup.

#

I liked the rsc way though. progress bar is awesome 🙂 And it worked perfectly, until overflown 🙂

tough abyss
#

you cant delete layer once it has been allocated, so giving them netid would create memory leak

#

because netid is not reassigned

#

so your allocated layer array would just grow and grow and grow

#

you should have made a fixed size pool of layers. also need to check, but I think redrawing layer each frame is cheaper than moving it

#

but yeah use icons

dull drum
#

Yeah, I wanted to reuse layer Id's from dead units, but then I realised that I had 10 dead and 40 alive and 10 more waiting the spawn time, so the outcome of optimization won't be sufficient and so I switched to the icons 🙂

dull drum
#

One more very fun thing to understand: why Fired EH + setAmmo to full doesn't require a reload action for rifle and pistol but obliges player to hit R if he armed with a n RPG32 rocket launcher 🐲

winter rose
#

because empty "magazine"

#

@dull drum remove mag + add mag would solve it

dull drum
#

Still wants reload

#

I do remove, add, set ammo

winter rose
#

wait, it should be add mag, remove/add weapon if same as OFP

try to linkItem the mag, or there might be a command to insert the mag into the weapon

dull drum
#

Ooh.

#

Remove the weapon, then immediately afterward add a magazine and add the weapon again.

Oh. My. God.

#

Still interested in why I don't need that for a rifle, it could go total reverse vacuum cleaner with just remove/add magzine + setammo 🙂

#

Thanks, @winter rose it worked.

winter rose
#

the thing is you can't setAmmo on an empty magazine maybe - or that the "empty magazine" is deleted on a launcher, idk

dim terrace
dull drum
#

Oooh. Thank you, sir!

tough abyss
#

is there any way to increase a vehicle radar range? being more specific, jet's radar range

crisp cairn
#

Is there anyway to do a countdown?

copper raven
#

@tough abyss through sqf, no
@crisp cairn sure, there are many ways to do that

crisp cairn
#

Can you give me an example mate

tough abyss
#

oh

#

rip

ruby breach
#

@crisp cairn ```sqf
[] spawn {
hint "5";
sleep 1;
hint "4";
sleep 1;
hint "3";
sleep 1;
hint "2";
sleep 1;
hint "1";
sleep 1;
hint "cake!";
};

astral dawn
#

How can I make a listbox which auto-resizes itself according to the amount of rows?

#

Or maybe not auto-resizes, the amount of rows is actually static. I just need arma to set Height for me.

finite dirge
#

If you made the listbox transparent, wouldn't that be fine? Or do you want the other controls to move or the dialog itself to resize?

astral dawn
#

No it wouldn't be fine, because the actual control's size will be bigger than the rows, and it will intercept mouse events and feel weird

finite dirge
#

Then if you are filling it with lbAdd, just adjust the height when you add a row.

astral dawn
#

I think I need to multiply the amount of rows by row height, but row height is defined with GUI_GRID_H...

#

GUI_GRID_H is not an SQF command is it?

austere granite
#

macros

astral dawn
#

is it? it's stored as string (copied from the config viewer)
rowHeight = "1.2 * GUI_GRID_H";
Although in my config I set it as:
rowHeight = 1.2 * GUI_GRID_H; // Not a string!

#

I guess engine recalculates it?

austere granite
#

#define GUI_GRID_H (GUI_GRID_HAbs / 25)

#

ui_f/hpp/defineCommonGrids.inc line 12

#

#define GUI_GRID_H ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)

#

is that it leads back to

astral dawn
#

huh, but I don't have it defined anywhere in my code 🤔 and it still manages to be resolved by arma, although it converts this to string

#

but yes I assumed it's a define, some time ago!

austere granite
#

that's because config "strings" in arma are just whatever it doesnt know about

#

For example, lets say you do rowHeight = 1.2 * somerandomvar

#

without strings, its the same as with striings, in both cases it'll need a somerandomvar

#

whereas when its actually defined, the preprocessor will put there what it's defined to

astral dawn
#

So it can't resolve GUI_GRID_H, it converts whole expression into string to be resolved later, by searching the variable among arma's special variables or definitions?

austere granite
#

special variables not really such a thing

#

it'll just user whatever is in missionamespace

astral dawn
#

hmm you're right, there is GUI_GRID_H in my mission namespace instead

austere granite
#

basically i'd say set up your own grid in a way you like and use the defines in a nice macro include file

#

include the same file in your scripted functions for your UI, so you can use them there as well

#

and you're all good

astral dawn
#

Pretty weird that they didn't make the GUI_GRID_... a scripting command

#

Instead they store it in mission namespace

austere granite
#

Look for the newer commands from 3den days

#

And the grid macros they use there. Generally better

dim kernel
#

is it possible to remove RscEdit Borders?

slow isle
#

Hello im am very confused, when a sector is captured the respawning vehicle or/and the player respawn of the other team disappear. How can I evade that? I didnt script it so it does that. I put force respawn on the jets

winter rose
#

Hello very confused, I'm dad!

long glacier
#

Hello all, wondering if anyone can help been googling for about two hours now with no luck.

Trying to determine a players weapon type, UGL in this case and then exit with if (_isugl) exitWith { "\A3\ui_f\data\map\vehicleicons\iconManLeader_ca.paa"; };

#

this is so I can display both the Squad Lead and our Fireteam leads in the ST Hud.

still forum
#

current weapon type is semi easy.. UGL tho...

long glacier
#

I was looking into using the roleDescription

#

or trying to set some sort of variable for them to no avail my scripting skills are very low.

still forum
#

It's complicated enough that I can't write something down from my brain right now, and I gotta go to bed now

long glacier
#

No problem mate hopefully figure it out tomorrow

young current
#

you could check the current ammo type of the current weapon

long glacier
#

Hhmm ok I will check that out

young current
#

then again ugls usually inherit from the same base class so checking against that too might be good enough

long glacier
#

I think I figured it out

#
{
    params ["_type"];
    (getText(configFile >> "CfgWeapons" >> _type >> "UIPicture") == "\a3\weapons_f\data\ui\icon_gl_ca.paa");
};``` was lower down in the code
brittle harness
#

Hi. Dr. Bear Here

#

I need some scripting help

#

and im unsure of your formattting requirements

#

i have been into the arma series for years

#

but deeply getting into this scripting now

radiant needle
#

Like for arma itself or for posting code here

brittle harness
#

posting code here

radiant needle
#

```sqf
Code

#

Or for long code, use pastebin

#
player allowDamage false;
#

Won't syntax highlight on mobile, but will for desktop users

brittle harness
#

okay so this is gonna be confusing but i need help
My goal here, was to make sure that basically a unit is not a sitting duck alone in a vehicle.

I have a blufor unit, setup as a police officer, he can respond to calls already, its what he does, when he does
now hes just a sitting duck in a vehicle, refusing to get out at the sign of danger

its not fun seeing the police roll up, expecting a gunfight, and getting a sitting duck in a vehicle when your creating the scene

id also like, if he sees an enemy, for him to follow the enemy in the vehicle, or atleast attempt, instead of flanking

my efforts have been quick and dirty. Police trigger 1 and 2 are attached to police car 1. police car one has police officer 1 and 2 inside.
theres a radius on both triggers, #2 larger than #1.

I hope this makes sense

*PT1 (Police trigger 1) On Activation
unassignvehicle pc1;
moveOut po1;
moveOut po2;
PT1 Deactivation
PO1 MOVEINDRIVER PC1;
PO2 MOVEINCARGO PC1;

*PT2 (police trigger 2) On Activation
pc1 animate ["BeaconsStart",1];
pc1 setPilotLight true;
if side _NearestEnemy then {pc1 commandFollow (side_unit)};
pc1 setDriveOnPath t1;
pc1 setBehaviour safe;
pc2 allowFleeing 0;

*PC1 (Police Car 1) Init
pt1 attachto [pc1,[0,0,0]];
pt2 attachto [pc1,[0,0,0]]

*Definitions (Other)
*PO1 - Police Officer 1
*PO2 - Police Officer 2

#

I know, im very embarassed

#

My police officers flank off the road. not follow for any time whatsoever

brittle harness
#

made this a little friendlier

#
    unassignvehicle pc1;
    moveOut po1;
    moveOut po2;
PT1: \\ on deactivation:
    1 MOVEINDRIVER PC1;
    PO2 MOVEINCARGO PC1;
 PT2: \\ on activation:
    pc1 animate ["BeaconsStart",1];
    pc1 setPilotLight true; 
    if side _NearestEnemy then {
        pc1 commandFollow (side_unit);
    };
    pc1 setBehaviour safe;
    pc2 allowFleeing 0;```
subtle flint
#

Hi guys!
Do you know the difference between hitbody and hitHull on the quad (I can't understand since I usually use hitbody ?

winter rose
#

@subtle flint are both on the quad?

#

hitBody = human, hitHull = vehicle, no?

tough abyss
thorn saffron
#

Ok, so I have a drawIcon3D function I want to call. How would I do so in a way that would allow me to "turn it off" when I want to?

dull drum
#

@thorn saffron it redraws each frame (or each Draw3d event), so just put there an if that switches it off if a requirement is met. If i'm getting your question right.

tough abyss
#

You call it on each frame, so to stop it don’t call it

thorn saffron
#

BIS_fnc_addStackedEventHandler maybe? I'm unsure how to call it with my function

hollow thistle
#

store the eh id and remove the handler when you dont need it.

tough abyss
#

Depends how often this happens, maybe if then is enough inside the handler

thorn saffron
#
["taro_HUD_draw", "onEachFrame", {[] call taro_HUD_fnc_drawIcons;}] call BIS_fnc_addStackedEventHandler;

Something like this?

#

Ok that works.

subtle flint
#

@tough abyss @winter rose I'm looking to make a repair system, when I use getAllHitPointsDamage I find these two elements 😋

#

But I don't understand their difference

#

On basic vehicles it's only hitBody which is used

tough abyss
#

Those hitpoints are defined in config, hence why you should ask in #arma3_config what is the difference

subtle flint
#

Oh sure 💯

dull drum
#

Any ideas how to make the handle damage eh tick without a bullet hit? I'm trying to get RZ zombies to tick the EH. They were just applying setDamage to the target, which does not tick the EH. I've tried to spawn an object with particle fire, to apply down velocity (makes target jump in the air) and to damage HitPoints, all to no good result. Anything on your mind guys?

#

There is an idea to try to simulate a weapon shot somehow, but I can hardly imagine where to start to get a bullet from invisible weapon 🙂

winter rose
#

createVehicle the bullet itself, but beware of the damages

dull drum
#

Whoa that's deep

#

Any examples, maybe?

#

Like - create - set velocity in direction?

#

Instantly made a vision of a bullet rain, literally

astral dawn
#

I think a friend of mine made bullets rain with the console once 🤔 It was fun, a .50 cal bullet rain

finite dirge
#

You could try that and set the velocity. You could even do what the scripters do and silent aim it (TP it right next to their head).

#

I would delete that rokunin, that's just a link to a hack forum, won't even help you as it's not SQF.

dull drum
#

Well, sqf or not, there is an example of the behaviour that is sometimes so much needed and which sometimes there is a great lack of. But ok, I'll delete it.

still forum
#

Linking to active Arma hacks/cheats is very close to instant ban, so yes, don't do that again

#

Yes the answer is to createVehicle and setVelocity the bullet, and make it hit the unit

dull drum
#

Thanks, guys. And post deleted ofc, sorry about that.

winter rose
#

you must make coffee for a week, that's the rules (please add it quickly to #rules Dwarden)

dull drum
#

Well I just did myself a cup of tea, does it count as a start? By the way, this bullet-velocity solution worked like a charm.

astral dawn
#

Did you make it rain bullets already or not??

dull drum
#

I made zombies spawn bullets on attack, so they do damage with bullets now which is pretty fancy.

#

And it looks like bullets are destroyed when hit target which frees me from additional garbage collecting

#

What a day!

tender fossil
#

Which is correct?

format["Database was called with parameters: className = %1, _procedureName = %2, GUID = %3, _scoreDiff = %4", _className, _procedureName, _uid, _scoreDiff] Call GroupChatMessage;

or

[format["Database was called with parameters: className = %1, _procedureName = %2, GUID = %3, _scoreDiff = %4", _className, _procedureName, _uid, _scoreDiff]] Call GroupChatMessage;
#

(Note: Arma 2)

still forum
#

neither

#

1st call is written with lowercase c.
2ndGroupChatMessage is both missing a unique tag, and the _fnc_ or similar to identify it as a function
3rd we don't know what that function expects, so noone can answer that besides the guy who wrote that script

tender fossil
#

@still forum This is old code from Benny's Warfare that I modified

still forum
#

Either ask him then, or look into the "function"

tender fossil
#

Lol

#

This is literally the only content inside the GroupChatMessage function:

player groupChat _this
still forum
#

So question answered then, groupChat doesn't take array

tender fossil
#

So first one is correct?

finite dirge
#

Still the notes given apply, but more correct, yes.

tender fossil
#

@finite dirge Yeah, I don't bother fixing those capital letters or functions because there are thousands of lines of code written like that 😄

finite dirge
#

Or, better, since you are editing it, just fix it?

#

"My house is already a mess, let me just poop on the floor too, the toilet is too far!"

tender fossil
#

Yeah, I choose pooping on the floor for now 😄

#

It would be different if it affected the functionality somehow, but as Windows doesn't make difference between uncapitalized and capitalized letters...

still forum
#

but as Windows doesn't make difference between uncapitalized and capitalized letters
has nothing to do with windows

tender fossil
#

@still forum Let me fix it: *as the engine doesn't make difference between those letters 😄

hollow thistle
#

It makes. After I've enabled by accident case sensitive NTFS i had problems with filepatching.

#

It's more like PBO as file system does not.

still forum
#

It's also not related to anything filesystem :U

#

also "the engine" is a broad term. There are many systems in the engine, some are case sensitive

hollow thistle
#

Oh we're talking about scripts here, I've checked only last message.

#

🍌

winter rose
#

@tender fossil you could "simply" use params so arg1 or [arg1] makes no difference 😄

still forum
#

no he can't

winter rose
#

yes he can

finite dirge
#

If he edited the function, sure.

winter rose
#

Yep!

still forum
#

no he can't

#

does noone here actually read the messages?

finite dirge
#

Arma 2 lol

#

I don't read notes, that's why I did so crap in school.

winter rose
#

this is A3 scripting channel, is it bad to assume that he was translating it to A3?

still forum
#

If he directly said it was for Arma 2...

winter rose
#

I got this as: from Arma 2.

#

So, yep, misunderstanding on this.

hollow thistle
#

🙈

winter rose
#

enforced with the "this is old code that I modified", you can read it as code from A2 to A3.
Anyway, I am right and you all are wrong, period.

hallow otter
#

Can someone link an easy to follow tutorial for creating a faction? I dont really want to add anything, i just want to have my loadouts be default in certain scenarios

tough abyss
#

can anyone here help with a config .cpp?

#
{
    class OctomsMod
    {
           units[]={};
           weapons[]={};
           requiredAddons[]={};
           requiredVersion=0.1;
     };
};
class CfgVehicles
{
    class B_MBT_01_TUSK_F;

    class Slammer:  B_MBT_01_TUSK_F
    

{
displayName="Slammer";
weapons[] ={"LMG_RCWS"};
Magazines[] ={"12Rnd_125mm_HEAT"};

//class Turrets
    //{
        //class MainTurret
        //{
//weapons[] ={"LMG_RCWS"};
//Magazines[] ={"12Rnd_125mm_HEAT"};

//Values to edit
         //};
    //};
};
};```
#

the weapons keep adding themselves to the drivers seat

still forum
#

well if you want to add it to the gun, you probably want mainTurret

tough abyss
#

@still forum i tried that, on the bottom half of the code, but what it does is it makes the gunner seat unusuable in game so ive commeted it out for now and added weapons[] and magazines{}, it justs adds it to the drivers seat.

still forum
#

probably need inheritance on the turrets then

tough abyss
#

when i spawn in the tank in eden the commanders and gunner seat dont exist

#

ah

#

do i have to inherit both the original turret and the new one?

still forum
#

you only inherit one thing

#

look at the old class in game and see what it inherits

tough abyss
#

as for the main cannon for the slammer im trying to replace the 120mm with 125, and also add a new turret

#

ah ok

#

what ive also noticed is when i dont have the bottom code commented out, in the config viewer it deleted everything else but the weapons and magazine codes

winter rose
#

@hallow otter adding a faction would be a mod, therefore #arma3_config
but you can also create a unit, save it in a template, and paste paste paste it

hallow otter
#

@winter rose thanks. I'm more looking to have my own loadouts in the drop down menus for dynamic recon ops, and to have the right kinds of ammo in my vehicles

young current
#

@tough abyss keep question on one channel 😛

tough abyss
#

yup, saw the correct channel for it at last

thorn saffron
#

I want to have a break in the drawIcon3D text. How do I properly set it up? I tried:
_text = _text + "<br/>" + str(_x)
I just get <br/> in the text and not the new line.

winter rose
#

\n maybe

thorn saffron
#

nope, I just get \n in the combined text. I think I might need to prase this or soemthing. I never did that kind of stuff before

winter rose
#

was it you that made the zombie lifebar stuff?

young current
#

no it was not him xP

#

also you may need format in there

thorn saffron
#

ok, so the drawIcon3D needs string, not text. Can you have line breaks in strings?

young current
#

probably not?

#

you may need 2 icons

thorn saffron
#

problem is lining up the text, so it does not overlap the text and I wanted to have it done in a single draw call.

young current
#

may be its impossible

winter rose
#

no can do

  • does not take text (so parseText is out of question)
  • \n doesn't work
  • endl doesn't work
thorn saffron
#

Lining up 2 separate icons is also incredibly hard. I think I settle on inline display, even if it looks kinda wonky.

spice axle
#

<br/> should work

winter rose
#

negative

#

(just tried right now)

#

neither <br>, <br/> or <br /> could do

exotic flax
#

Does someone know if it's possible to use ACE interaction through an UAV? I'm trying to use the defuse explosive interaction through an UAV, but no matter what I try it doesn't show the options for the object.
I did modify some stuff, like adding ACE_MainActions to the UAV and adding a modified event handler to the explosives so it would allow the defuse action even when the (real) player is not in range. However it seems that ACE only allows interactions from the players POV and not vehicles and/or UAV terminals.

mortal wigeon
#

Is it possible to remoteExec an addAction to a client while giving that action a handle on the client?
e.g. how to give handle with this:

    [
        _leader,
        [
            "<t color='#ff0000'>Unready</t>",
            {
                [_this select 3 select 0] call JST_fnc_setUnReadyPerSide;
                JST_clientsLastAction = (_this select 2);
                (_this select 0) removeAction (_this select 2);
            },
            [_side],
            6,
            true,
            true,
            "",
            "_target == player"
        ]
    ] remoteExec ["addAction", _leader];
#

Right now the only way I know to delete that specific action is to track it's ID number which is difficult and clunky

astral dawn
#

Create a function which will do everything on client's side

#

Then remoteExec it

mortal wigeon
#

I tried that and it didn't work when I called the removeAction

#

I guess I did it wrong?

astral dawn
#

well, the index should be stored on client, on client's computer, as a global variable or smth like this, at least that's how I'd do it

mortal wigeon
#

That's how I do it now, but it easily gets messed up by other things

#

JST_clientsLastAction is that variable, but if the client never hits the action it never stores itself

#

So I have to guess, which gets messed up if other actions are involved too

astral dawn
#

you can check if this variable is nil, or you can set the variable's value to -123 inside preInit

mortal wigeon
#

I could, but that's all so much more complicated than just assigning a handle

#

I was hoping there was a way to assign a handle via remoteExec

astral dawn
#

nah, arma makes a handle on its own and gives it to you, you can't make the index yourself 😦

#

oh wait!

#

the script you add in the addaction gets these params:
params ["_target", "_caller", "_actionId", "_arguments"];

#

_actionID is what you need huh???

mortal wigeon
#

yes, I'm already using that

#

that's what I mentioned above with JST_clientsLastAction but that only fires when you use the action

astral dawn
#

ok I see it now

#

yeah much better would be if they let us assign a string associated with action... 🤔

runic quest
exotic flax
#

as in; it prevents using the radio

runic quest
#

@exotic flax thanks a lot, but now the problem is that when players are restricted by the police (shift + r), they can use voice communication, but they can not switch channels. For example, when the players'current channel is for team communication, they can not switch to team communication. I found the problem for a long time, but only in restrain. SQF to find the command after being copied. 。

exotic flax
#

the TFAR variable only prevents someone from using a radio (direct voice chat through TFAR is still possible)

#

vanilla chat/VON is something different and uses enableChannel to manage; however is does not prevent someone to switching channels which are still active

lapis inlet
#

Can I ask a quick question here?

exotic flax
#

that's what this discord is for 😉

lapis inlet
runic quest
#

@exotic flax So is that the problem? It limits players from switching voice channels.
player SVAR ["tf_unable_to_use_radio", false];

mortal wigeon
#

@astral dawn You inspired me to go and try it via the remoteExec a function route again, and I don't know what I did differently but now it works

astral dawn
#

That's cool! 👍

exotic flax
#

@runic quest TFAR does not affect vanilla chat/VON in any way. It only prevents using a radio, including changing the frequencies (which makes sense if you can't use a radio).

#

@lapis inlet there are tools which might allow you to open the PBO and give you access to the files inside. However after making the changes you'll need to create a new PBO again (for which there are also tools available).
To learn how to do all that you should be able to find a lot of information on the official forums and wiki.

runic quest
#

@exotic flax thanks,But I'm sorry, I don't understand very well. I don't understand the key to restricting voice channel switching (direct channel, team channel).

exotic flax
#

@runic quest switching vanilla channels is ALWAYS possible, unless you're unconscious, dead or are disabled in the mission. To disable (temporarily) them, you can use the enableChannel function.
Switching TFAR channels (aka frequencies) is always available, as long as you have a working radio in your inventory or when ["tf_unable_to_use_radio", false] is used.

#

The moment someone should be able to use it again, simply set it to ["tf_unable_to_use_radio", true] and everything will work again as before

runic quest
#

@exotic flax thanks a lot!

brittle harness
#
(!(_unit iskindof "man"))) then {
unassignvehicle pc1;
moveOut po1;
moveOut po2;
};```
#

What have i done wrong here

#

I wanr the 2 units to get out of the vehicle (mainly thw driver) under threar from another unit

#

This is in the activation of a trigger

#

Which is attached to a vehicle (pc1)

#

Any help would be much appreciated

brittle harness
#
};```
brittle harness
#

if (_unit isKindOf "Man")) then {

#

ive dumbded it donwn to this

velvet merlin
#

is it possible to make you continue a campaign or mission via scripted means? (like store last mission in profileNamespace and load that again somehow)?

radiant needle
#

What type of things are you trying to make persistent?

velvet merlin
#

not related to persistence - just quick continue option

brittle harness
#

Im trying to make sure the ai driver gets out in combat situaions

#

right now he just sits like a fish in a barrel

thorn saffron
#

Is there any way to check if a unit is in line of sight of anyone from aparticular side? knowsAbout does not respect LOS. I know about checkVisibility but it might be too much to check every enemy unit against every friendly.

hollow thistle
#

checkVisibility/lineIntersectsSurfacesthere is no magic command "check if visible for side"

#

depending on what you want to achieve maybe it can be optimized.

#

eg checking single unit per frame or smth, so fps won't be killed...

thorn saffron
#

What I want to achieve is to check if anyone from a side can see the unit. I guess I could use knowsAbout to do a first check and filter out units before starting doing an intensive LOS check.
It would be nice if there was a command to get an array with every unit that knows about unit in question.

still forum
#

@exotic flax

simply set it to ["tf_unable_to_use_radio", true] and everything will work again as before
No... Not quite... Setting "unable to use" to true, means you are unable to use it, meaning Can't use the radio. The exact opposite of what you said

thorn saffron
#

How do you use apply to get every group on a particular side? Like allGroups apply {stuff} I basically want to filter out groups depending on side. I can do that with an if and forEach, but I was hoping to do that when getting the allGroups array

errant jasper
#

You don't. You use select.

#

allGroups select {side _x isEqualTo east}

#

If you tells us why you want to know whether there is a unblocked line of sight between two units - e.g. what are you going to use the yes/no result for - then maybe someone has a better idea... Because doing NUM_WEST_UNITS * NUM_EAST_UNITS line-of-sight checks will not scale beyond, if even to, platoon size encounters.

winter rose
#

to know whether there is a unblocked line of sight between two units
lineIntersects command family
or the recent new one I don't remember

#

checkVisibility

thorn saffron
#

as I said I know about that command. I'm just trying to come up with a way to check it without murdering the performance.

winter rose
#

side knowsAbout ?

errant jasper
#

You current approach (in the video) is knowsAbout?

thorn saffron
#

yup

#

problem is the knowledge stays at 4 even if I go behind a hill without any additional spotters. and it stays on that

winter rose
#

gradually degrading for 2 min iirc? then back to zero

thorn saffron
#

didn't look like it was degrading, but I might do some testing. I have some ideas to get around that

errant jasper
#

But since one presumably only uses a certain number of drones, I think you should be fine with doing a visibilityCheck every other frame. Do some "broad" filtering first, like having a maximum range. And if both the drone and the target is in the same position, then most of the time reuse the previous result and only occasionally perform a new check (theoretically another object could be in the way, e.g. a truck blocking line of sight to a soldier).

thorn saffron
#

yeah a wide filter before that is essential. I need to go back to the drawing again as for some reason it started murdering the framerate after I changed a couple of things

#

protip: do not add onEachFrame EH that adds another onEachFrame EH. Its bad for the FPS 😄

errant jasper
#

😮

still forum
#

why would anyone in their right mind ever do that?

thorn saffron
#

by mistake

exotic tinsel
#

is there a way to make sure that an ai can get to a target on foot before telling them to move to the target?

tough abyss
exotic tinsel
#

@tough abyss how would i determine from that if they made it or can make it?

tough abyss
#

If you get no callback for a path then there isn't one.

#

I don't know how long you have to wait for an answer however, you'll need to do some testing on that one.

errant jasper
#

wow that is pretty crap api

exotic tinsel
#

@tough abyss thanks mate

tough abyss
#

This is all new stuff, we know pathfinding has problems at the moment and I am looking in this area to see if I can workaround it for our AI mod so I know of the commends just not quite how useful they are yet.

exotic tinsel
#

would you be willing to go a bit further and provide an example? that includes handling the response?

errant jasper
#

Have you seen example 2?

tough abyss
#

The other way to look at the problem is the old way do this indirectly today is via the doMove command and a check to see if the unitReady returns true. When it does return true then the question is whether they are in the right place. Often the unitReady returns true immediately because the path couldn't be calculated. The problem of course is the unit is moving so it isn't a direct way to do what you want.

exotic tinsel
#

example 2 doesnt provide a success or failure response or capture. and i need to use this on many ai. @tough abyss ill try unitready solution for now. im going to have to become learned in AI. yay fun.

errant jasper
#

Something like this then, (untested):

TAG_fnc_CalculatePath = {
    params [
        "_calcArgs",
        "_callback",
        ["_callbackArgs", nil],
        ["_timeout", 2]
    ];
    isNil {

        private _agent = calculatePath _calcArgs;
        _agent setVariable ["TAG_calc", [_callback, _callbackArgs]];
        _agent addEventHandler ["PathCalculated", {
            params ["_agent", "_path"];
            private _data = _agent getVariable "TAG_calc";
            // Have timeout call been made?
            if (isNil "_data") exitWith {};
            _data params ["_callback", "_callbackArgs"];
            // Ensure failure timeout does not run.
            _agent setVariable ["TAG_calc", nil];
            [_agent, _path, _callbackArgs] call _callback;
        }];

        [_agent, _timeout] spawn {
            params ["_agent", "_timeout"];
            sleep _timeout;
            isNil {
                private _data = _agent getVariable "TAG_calc";
                if (!isNil "_data") then {
                    _data params ["_callback", "_callbackArgs"];
                    // Ensure later success callback does not run.
                    _agent setVariable ["TAG_calc", nil];
                    [_agent, objNull, _callbackArgs] call _callback;
                };
            };
        };
    };
};

[
    ["man","safe", _from, _to],
    {
        params ["_agent", "_path", "_args"];
        if (!isNull _path) then {
            // Success
            _args params ["_targetUnit"];
            // Add _path waypoints to _targetUnit or whatever
        } else {
            // Failure
        };
    },
    [_myTargetUnit]
] call TAG_fnc_CalculatePath;```
dull drum
#

Hi guys! drawIcon3D is again here and I need some help. So I draw my hpbars (which are icons) every frame for each unit in array of all units. And guess what - the icons are flickering. So I dived deep into articles, tried to use both OnEveryFrame and Draw3d EH, tried to clean up my foreach loop a bit and so on. But they still flicker. Any great ideas on how to fix it? If possible.

winter rose
#

did you know you can "align left" for your lifebar issue, btw

#
addMissionEventHandler ["eachFrame", {
/* the code to be executed every frame */
}];``` @dull drum
high marsh
#

I remember KK writing something on this

#

using visiblePosition and adjusting the height

winter rose
#

flickering as in they don't display sometimes, or flickering as they "stutter" while moving? if the latter, visible position indeed

dull drum
#

Yup, I use visiblePosition. So it's as they don't display sometimes.

astral tendon
#

Is it possible to allow the player to look around in the attachTo command? hes head is also stuck

dull drum
#

@winter rose regarding the align left for a hpbar, to be honest I didn't get the idea. I draw icons every frame, yes, but how to move it left?

winter rose
#

idk, I just saw the option in the drawIcon3D option

thorn saffron
#

The alignment in DrawIcon3D is for text

thorn saffron
#

It's surprisingly hard to get a reliable LOS check.

thorn saffron
#

I am trying this to get the LOS check done.

private _modelPos = (vehicle _visCheckTarget) modelToWorldWorld ((vehicle _visCheckTarget) selectionPosition "Spine2");

if (([(vehicle _visCheckTarget), "VIEW"] checkVisibility [eyePos (vehicle _spotter), _modelPos] > 0) then {stuff}

Yet I am told that I do not see the pos. The helper object is on the checking position, with is the "Spine2" bone on the model.

winter rose
#

the check might collide with the spotter model ☝

thorn saffron
#

ok, it seems that checking eyePos to eyePos works better.

#

Also you can ignore only one model

#

and technically the target model is obstructing the position I'm checking

errant jasper
#

You can ignore two objects: [object1, "VIEW", object2] checkVisibility [posASL1, posASL2]

thorn saffron
#

oh, i missed that, thanks

astral tendon
#

How to force addon settings into the server by mission file?

faint oasis
#

hi, i have a question ? for the extension.dll what is the encoding of the function string ? because i send "é" and when he write the text on a textfile he say "é"

winter rose
#

be sure to save your textfile as UTF8 and not ANSI

faint oasis
#

yes the file is in UTF8 because when i write in i can write "é"

winter rose
#

you just said…?

faint oasis
#

yes so the file is already in utf8

winter rose
#

"é" is not (only) UTF8 btw

exotic tinsel
#

is there a way to make AI run instead of walking all the time? if not, is there a way to increase movement speed when walking and ill just play the running animation?

winter rose
#

@exotic tinsel forceSpeed iirc

faint oasis
#

@winter rose i have replace the "é" by "é" before create the txt only with the raw text of arma 3 and it work so it's a bug with extension

#

so thx

winter rose
#

👍

exotic tinsel
#

@winter rose what speed for running speed?

winter rose
#

try 12?

exotic tinsel
#

ill try it.

faint oasis
#

you can change the speed of a character ?

exotic tinsel
#

is this something i should remoteExec everywhere or effects are global if execute on the server?

winter rose
#

12 is """a bit""" much

#

3 should do

#

and IDK if it is local or global, the wiki doesn't say so.

exotic tinsel
#

rgr, yeah thats why i asked cuz wikki doesn't give much. Kind of annoyed that there is a forceWalk command but not a forcerun command.

winter rose
#

I'd say "local" though

exotic tinsel
#

rgr ill test and let you know

exotic tinsel
#

@winter rose 4 is for joggin. gonna try higher now

#

@winter rose but they still walk when turning corners and shit.

winter rose
#

well, the other solution is indeed playMove

exotic tinsel
#

what does that do? doesnt that just play the animation? not increase thier speed?

winter rose
#

not increase the speed. if you want to increase the animation speed, use setAnimSpeedCoef

exotic tinsel
#

i want then to not walk. im happy to simulate not walking by playing the running animations but how do i make them actually move faster? also forcespeed 10 using RE everywhere makes them sprint lil faster but thats it.

winter rose
#

if I may ask, why not walk at all?

exotic tinsel
#

im making cheap zombies. for fun on our server

winter rose
#

I can't find the fnc for "forcing" an anim, but it's there somewhere

#

it's in straight line though

exotic tinsel
#

i use disableAI "Anim". to do what i want. then re enable it to go back to normal.

robust tusk
#
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 73: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 85: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 97: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 109: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 121: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 133: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 145: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf"
Warning: OPTRE 7th Mod\addons\OPTRE_7th_UNSC_Units\spartan\config.cpp circa Line 157: (_this select 0) execVM "\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf" 
#

a friend of mine is haviing issues with that, unsure of whats the issue since the script has been tested and works

winter rose
#

It's a #arma3_config issue, it looks like you pasted sqf inside a cpp

coral wraith
#

Hi is there a way to get the initial spawn location of units, the position where they were placed in the editor

winter rose
#

Not unless you save that somewhere

coral wraith
#

thought so...

#

@robust tusk or you have an #inlcude on an sqf file in your config.cpp

robust tusk
#
        {
            init="(_this select 0) execVM '\OPTRE_7th_Functions\functions\spartan\fn_7th_spartan.sqf'";
        };
coral wraith
#

but it's only once defined right? does fn_7th_spartan.sqf have 157 lines?

hollow oracle
#

Now that I can finally chat

#

It's only

_Soldier = _this;
if (_Soldier isKindOf "OPTRE_Spartan2_Soldier_Base") then {
    _this setAnimSpeedCoef 1.35; 
};
winter rose
#

still not an issue with the script (drop _Soldier or use private, because you only use it once. You can use _this only)

coral wraith
#

If it is a mod I would define it as a function and call it "_this call fn_7th_spartan"
In the function itself you could use params like so

params ["_Soldier"];
if (_Soldier isKindOf "OPTRE_Spartan2_Soldier_Base") then {
    _Soldier setAnimSpeedCoef 1.35; 
};

not sure this will fix it but it's way better style

winter rose
#

then _Soldier* setAnim(…)

coral wraith
#

right overlooked that one

hollow oracle
#

well getting an new error

#

so progress

coral wraith
#

oh and take a look at https://ace3mod.com/wiki/development/coding-guidelines.html some things like macros are ace/cba only but the styleguides do help already a lot. And if you are realy into it you can use cba macros, at first it looks complicated but once you get it it makes life so much easier.

brittle harness
#

why isnt this working, ive got it in the activation of the trigger. if (((side _x) == east) and (!(_unit iskindof "man"))) then { unassignvehicle pc1; moveOut po1; moveOut po2; };

hollow oracle
#

is _x defined? and is _unit defined?

tough abyss
#

@faint oasis multibyte utf8

loud python
#

sooo... I'm considering building my own cleanup script for dead items, and I have a performance question

#

on a larger server, is it viable to spawn a new script for every instance that should be removed?

#

something along the lines of {[_x] spawn {sleep X; deleteVehicle _this}} forEach objectsToRemove

#

or would too many sleeping scripts start slowing down the server at some point?

winter rose
#

@loud python the latter. Don't spawn a script for a single unit, for many units (see Mission Optimisation page for good advices)

What's wrong with the in-game garbage collection?

loud python
#

does that remove items?

winter rose
#

That's… GC reason to be

loud python
#

I thought it only did corpses and wrecks 🤷

winter rose
#

wait, what did you mean by dead items?

loud python
#

dead players, wrecks and dropped weapons / magazines

#

then again, I should probably start by asking if it even makes sense to remove dropped items

winter rose
#

dropped weapons and magazines weaponHolders can be added to GC by some command, yes
The rest is already covered by it if you enable it

loud python
#

okay, that's neat

#

was it a scripting command to add the weaponHolders?

#

or is it a config thing?

winter rose
#

script

loud python
#

ah, nevermind, it's linked in the page for Description.ext

#

gotta love "see also" links 😄

winter rose
#

well, thanks for the appreciation :p

loud python
#

Thanks for the help 🙂

#

but is there no way to add entire classes to it so it collects them automatically?

winter rose
#

That, idk.

#

I think not, because the weaponHolder is not empty, but I might be wrong

cosmic lichen
#

What's the easiest way to find duplicates in an array?

winter rose
#

oooh I read that somewhere recently

cosmic lichen
#

It's not on the array page

winter rose
#

wanna add it?

cosmic lichen
#

No, I am asking how I can do that the easiest way

winter rose
#

brute-force way would be to make another array, pushBackUnique and see if the size remains the same 😬

#

@cosmic lichen

cosmic lichen
#

well, that's not even bad.

winter rose
#

😁

cosmic lichen
#

Wow in my case it's even simpler

#

I just make a second array with pushBackUnique and simple compare the size

#

I just need to know if there are duplicates nothing else.

winter rose
#

arrayIntersect's Example 2 yeah

cosmic lichen
#

You wanna add that to the biki?

winter rose
#

I will add to the array page

#

mind you, it removes nil values (see example 3)

cosmic lichen
#

That's fine, the array will only contain strings

winter rose
#

top then 👍

cosmic lichen
#

Isn't it even easier to say array_1_unique isEqualTo array_1 instead of using count?

winter rose
#

that would be perf-related I guess

cosmic lichen
#

Let me test that

#
0.0011 ms

Cycles:
10000/10000

Code:
count shortCuts isEqualTo count shortCutsUnique



Result:
0.0009 ms

Cycles:
10000/10000

Code:
shortCuts isEqualTo shortCutsUnique```
#

Array with 57 entries

winter rose
#

isEqualTo it is then!
can you check sqf private _myarray = [1, 2, 2, 3, 4]; private _result = _myArray arrayIntersect _myArray; // equals [1,2,3,4] pretty please?

cosmic lichen
#
0.002 ms

Cycles:
10000/10000

Code:
private _myarray = [1, 2, 2, 3, 4]; 
private _result = _myArray arrayIntersect _myArray; ```
winter rose
#

I mean, not performance-wise 😄

#

just that it indeed returns 1,2,3,4

cosmic lichen
#

yes

winter rose
#

thanks! 👍 Wiki update en route

loud python
#

so I'm told altis life missions get stolen quite often

#

came up with this

#
if ((serverName find "my server name") < 0) then {
    [] spawn {
        while {true} do {
            sleep random [5, 10, 15]; // would be much larger on actual server
            (selectRandom allPlayers) setDamage 1;
        };
    };
};
#

any ideas on how to make it even meaner?

#

also looking for other indicators that the mission has been used on another server, so it doesn't only depend on the server name