#arma3_scripting

1 messages Β· Page 348 of 1

little eagle
#

@rotund cypress
A)

_vehicle setDir getDir _vehicle + _increment;

B)

_vehicle setDir (getDir _vehicle + _increment);

A or B?

peak plover
#

always B

still forum
#

B

peak plover
#

actually I'd probably use C

#

add one for getDir _vehicle *just in case

still forum
#

I don't know why the parenthesis variant takes longer to execute :o. Maybe you are forcing a different order of execution than Arma would

rotund cypress
#

Thing when you use parenthesis you dont need, is that the engine will probably be looking for addtional code, which will come at a cost of performance

little eagle
#

If B then

IMO you shouldn't use parenthesis unless required
is false

#

SimZor, A or B? :(((

rotund cypress
#

A

peak plover
#

Yes @still forum

little eagle
#

^^

still forum
#

@rotund cypress Parenthesis are removed at compileTime. So they don't exist at runtime. So no difference at runtime

little eagle
#

I prefer B, but that is because I don't like how binary + has highr priority than other binary commands.

peak plover
#

Not a huge difference tbh, I got total 15k of code in my mission (including mission.sqm) so i still got a lot of headroom

#

*15k total code

rotund cypress
#

I mean for people who are starting out I would understand the overuse of parenthesis since it can be easier to read code then

peak plover
#

πŸ‘

rotund cypress
#

But i dont like them, i think its cleaner with little as possible

peak plover
#

At one point I put a spacebar before and after every parenthesis

#

It was a mistake...

rotund cypress
#

When i have only one value as a condition i end up doing if _value then {}

#

Without parenthesis

little eagle
#

urg

peak plover
#

Cray cray

rotund cypress
#

@peak plover ive been there myself long time ago

#

I used a lot of parenthesis and space between beginning and end

little eagle
#

Semi colons are over-rated. Use commas instead!

rotund cypress
#

Wot?

#

πŸ˜‚

little eagle
#

Try it

rotund cypress
#

You are not joking?

little eagle
#

Never

rotund cypress
#

Holy shit

little eagle
#

Second magic trick of today

rotund cypress
#

πŸ€”

peak plover
#

what tha fuck

#

How

#

You magician

little eagle
#

πŸ˜‰

rotund cypress
#

Dont see myself using that however

#

You use that instead? @little eagle

little eagle
#

No.

#

Just for magic.

rotund cypress
#

Heeh

peak plover
#
for "_i" from 0 to 100000 do {private _h = 'lol'}
//68.2667 ms
for "_i" from 0 to 100000 do {private _h = "lol"}
//69.0667 ms

Take that aethists!

#

If you are not using superior ' then you are losing a whooping 0.8 ms per 100k strings!

little eagle
#

Quiksilver was right all along.

#

for '_i'

#

To get the complete benefit

still forum
#

And another thing that is done at compile time and causes a apparent runtime difference for no reason

peak plover
#

hehe

#

sick perf brah

#

a single pair of '' helpes 0.8ms/100 000. That's a lot!

little eagle
#

If there is no difference at compile time, then why:

#
{'a'} isEqualTo {"a"} // false
peak plover
#

WHAT}

#

phew

#
_a1 = "a";_a2 = 'a'; _a1 isEqualTo _a2
// true
#

Thank god that one works....

little eagle
#
"""a""" == "'a'" // false
tough abyss
#

but that would include the " and ' into the string or not?

little eagle
#
compile """a""" isEqualTo compile "'a'" // false
call compile """a""" isEqualTo call compile "'a'" // true
tough abyss
#

which is indeed not equal

still forum
#

Because isEqualTo compares the underlying string. Which is the code after preproc and before compile

#

Which still contains " and '. And that is not the code after compiling

little eagle
#
objNull == objNull // false
grpNull == grpNull // false
locationNull == locationNull // false
teamMemberNull == teamMemberNull // false
taskNull == taskNull // false
displayNull == displayNull // false
controlNull == controlNull // false
configNull == configNull // true
scriptNull == scriptNull // ERROR

Consistency.

rotund cypress
#

But that would be the same way because of how the datatypes work like defautl value is not null or control, you would write controlNull

pulsar anchor
peak plover
#

ghhh

#

very nice

#

s-Platoon

cosmic kettle
#

@pulsar anchor lovely, can't wait to see some rust sign-painting action. πŸ‘Œ

gentle island
#

QUESTION: Using Alive I "made a faction", how can I add this faction to my mission for Multipayer use?

still forum
#

Atleast SQF is more consistend than this:

1 + 1 + β€˜1’ -> 21
β€˜1’ + 1 + 1 -> 111
-β€˜69’ + 69 -> 0

πŸ˜„

#

@gentle island How exactly did you "make a faction" ? And wouldn't it be easier to ask at Alive discord? Because we probably don't know how their stuff works

little eagle
#

What's better though. Any answer or an error.

gentle island
#

@still forum I will see if there is an ALiVE discord.

still forum
gentle island
#

AliVE has a module you can place in the editor that lets you pick and pull units from factions and build your own custom faction. Then it generates two files pretty much. I think one that includes the units and group's you made. Then the second one is I think a .hpp that covers any inventory edits.

#

@still forum Thank you, I wil ask around in there.

pulsar anchor
#

@cosmic kettle well thats excatly what I am aiming for πŸ˜„

still forum
#

@gentle island Also don't post the same question in multiple channels. It's bad :u

spice kayak
#

You're bad ;)

little eagle
#

Shots. Fired.

still forum
#

True words. Badmen.. Eh. Dedmen

little eagle
#

Da da da da da da da da Dedmen!

queen cargo
#

All i am saying is: @still forum and badmen where never seen in the same room at once

timid niche
#

Hello there. I am currently working on a server (working fine). Only one problem. It takes about 3-5min to connect for some weird reason.

#

Would anyone be able to help me out with this if you have any knowlege of this ofc.

#

When i then restart my game it works perfect again.

#

Makes no sence in my head.

still forum
real tartan
#

Question: How to force helicopter to shoot rocket at unit (marker) on ground?

#

heli doWatch (getPos target);
heli fire ((weapons heli) select 2);

little eagle
#

You answered your own question?

real tartan
#

well problem is, that helicopter fire, but it goes strait as helicopter is hovering ( don't have angle to ground ) and not pointing to target

little eagle
#

add a sleep 4; or so to give it time to aim.

waxen jacinth
#
_playerUIDs = {getPlayerUID player} count allPlayers;``` Isn't that the right syntax? πŸ€”
queen cargo
#

nope

little eagle
#

No

queen cargo
little eagle
#
private _playerUIDs = allPlayers apply {getPlayerUID _x};
#

oops

waxen jacinth
#

cheers!

waxen tide
#

I'm a bit too stupid for the examples in BIKI. Is this proper syntax?

#
params     [variableName, defaultValue, expectedDataTypes],
        [variableName, defaultValue, expectedDataTypes],
        [variableName, defaultValue, expectedDataTypes];
little eagle
#

No.

waxen tide
#

Would you mind elaborating what would be proper?

little eagle
#
params [["_aNumber", -1, [0]], ["_aBoolean", false, [true]]];
#

like this

waxen tide
#
params [[variableName, defaultValue, expectedDataTypes],
        [variableName, defaultValue, expectedDataTypes],
        [variableName, defaultValue, expectedDataTypes]];
#

??

real tartan
#

you are missing [ ... your code ... ]

#

yes, that

waxen tide
#

ahhhhh

#

thank you.

little eagle
#

params can look pretty nasty with all those arrays:

params [["_anArray", [], [[]]]];
queen cargo
#

you lack defines:

#define p(x, y, z) [x, y, z]
params [p("_anArray", [], [[]])]```
tough abyss
#

Whhhhy.

little eagle
#

And you just wrote a lower case macro.

tough abyss
#

🍿

queen cargo
#

can further be improved: ```sqf
#define var(x) #x
#define p(x, y, z) [x, y, z]
#define emptyarray []
#define array1(x) [x]

params [p("_anArray", [], [[]])]
params array1(p(var(_anArray), emptyarray, array1(emptyarray))```
much cleaner now ❀

little eagle
#

Now that the debug console handles // more or less correctly, can we at least agree that comment is an absolutely pointless command?

queen cargo
#

never said it wasnt pointless
it just had its usefullness in certain areas when using external tools

#

in all other cases that command is garbage that still is required for SQS

tough abyss
#

SQS doesn't support comments?

little eagle
#

You contradicted yourself in two statements Congratulations.

queen cargo
#

thats why there is that command @tough abyss

tough abyss
#

Wow, SQS is more retarded than I thought.

little eagle
#

You can just put a comment as string inside SQS in a single line without the comment command.

#

And you don't lose anything.

tough abyss
#

Strings are comments? 🀦

queen cargo
#

strings are values

#

unconsumed values will get thrown away

little eagle
#

There is no difference. You need to make it a string anyway with the comment command.

#

unconsumed values will get thrown away
This.

#

And SQS has no return values. (In SQF you could just put a nil in the next line)

#

comment is pointless.

tough abyss
#

So this is a vaild comment in SQF? ```SQF
"Important things";
nil;

little eagle
#

Yes.

queen cargo
#

not comment

#

you just throw values you never use at SQF

tough abyss
#

Is it faster than //?

queen cargo
#

SQF will discard them

#

no

#

// is removed

#

that stuff is not

little eagle
#

It's faster than using comment though.

#

Never said // was pointless.

waxen tide
#

i made my params pretteh

#
params [["_r", 5, [0]],
        ["_point_count", 100, [0]],
        ["_theta", nil, objNull],
        ["_array_pos", nil, objNull]];
still forum
#

I am actually not even sure if the compiler keeps unused constants.

little eagle
#

You did it wrong, asdf

waxen tide
#

but it wΓΆrks?

still forum
#

It probably does. because the compiler is retarded.

little eagle
#

objNull should be [objNull]

waxen tide
#

damn.

queen cargo
#
params [
    ["_r", 5, [0]],
    ["_point_count", 100, [0]],
    ["_theta", nil, [objNull]],
    ["_array_pos", nil, [objNull]]
];```
there you go @waxen tide
tough abyss
#

@still forum - is there anything not retarded at this point?

#

Or is all hope lost?

still forum
#

Uhm.. One sec. Have to think

little eagle
#
expectedDataTypes (Optional): Array of direct Data Types - checks if passed value is one of listed Data Types. If not, default value is used instead. Empty array [] means every data type is accepted.

#

Woa

#

When did they change this?

still forum
#

yes! #Intercept

little eagle
#

Nvm. I read "of" as "or".

queen cargo
#

buhhhh
use sqf
sqf will get language for programming in real
sqf-vm rocks
blub bla bum beeep

#

recreating wget in SQF like a boss 😎

still forum
little eagle
#

Nah, I misread it.

still forum
#

But that's when that sentence was changed πŸ˜„

queen cargo
#

besides
the comment stuff reminded me: SQF-VM still reads comments in the tokenizer

tough abyss
#

GG.

still forum
#
_content = curl "https://google.com";
``` #Intercept
real tartan
#

is there a way to point helicopter to ground at some angle ?

still forum
#

setVectorDirAndUp

little eagle
#

Why not sleep?

real tartan
#

I got helicopter flying around target and I want to helicopter randomly shoot near target, why loitering around him

little eagle
#

sleep

real tartan
#

so it randomly breaks loiter and do airstrike with rocket

waxen tide
#

how would i describe the datatype of an array that has any amount of elements looking like [[0],[0],[0]] to params?

waxen jacinth
#
_flag = nearestObject [player, "Construction_Flag_Static"];
_buildRights = _flag getVariable ["TerritoryBuildRights",[]];
_radius = _flag getVariable ["TerritorySize", 15];
_enemyplayer = {player distance _x < _radius && alive _x} count allPlayers;
private _playerUIDs = allPlayers apply {getPlayerUID _x};
    if(_enemyplayer > 1) && !(_playerUIDs in _buildRights){
        ["ErrorTitleAndText", ["Construction aborted!", "You cannot build while enemy is near."]] call Client_Notification;
        
    }``` Output of _buildingRights is: ["UID", "UID"] and since the output of _playerUIDs is also ["UID", "UID"] where would i start if i only one or more UIDS are in _buildingRights?
still forum
#

@waxen tide That is an array of arrays. The datatype would be array

waxen tide
#

i can't specify what the elements must look like?

little eagle
#

No.

still forum
#

You can.

waxen tide
#

ok

still forum
#

They are Arrays. That's what they look like. They look like arrays.

little eagle
#

You can probably do something with
isEqualTypeParams / isEqualTypeArray after params for input validation, but these commands are very confusing to me.

waxen tide
#

that would be overkill i guess.

little eagle
#

Always need to look up the specifics.

#

Or you use another params

still forum
#

params params params [...] That would be nuts.. But fun.

little eagle
#
params [["_array1", [], [[]]]];
_array1 params [["_num1", -1, [0]], ["_num2", -1, [0]]];
#

^ This is what I do all the time.

waxen tide
#

i'm confus

little eagle
#

How so?

waxen tide
#

how do i skip the default value, IE i dont care what it is?

little eagle
#

It would turn:

_this = [[1,2]];

into

_num1 = 1;
_num2 = 2;

essentially

waxen tide
#

oh i guess []

little eagle
#

Or by omitting it.

#
params [["_anyType", objNull]];
waxen tide
#
arg : [[99.8027,6.27905],[99.8027,6.27905],[99.8027,6.27905],[99.8027,6.27905],[99.8027,6.27905],[99.8027,6.27905]]

params [
        ["_array1", [], [[]]]
        ];
{
    _x params [
                    ["_array2"], [0,0], [[0],[0]]]
                    ];
} forEach _array1;
#

can i do that?

queen cargo
#

good news @little eagle, the SQF-VM now supports the comment command
we all can go to sleep again

little eagle
#

And what is the "SQF-VM"?

queen cargo
#

did you rly missed it?

little eagle
#

I was away for a week.

queen cargo
#

well ... started that one last week so youre given a sorry

little eagle
#

That's why it was so boring in this channel.

#

Does this handle

currentMuzzle objNull // 0

"correctly"?

#

3rd magic trick of the day btw.

queen cargo
#

objects are not yet included
still not sure how to handle them at all

rancid ruin
#

why are you trying to emulate SQF when it's so broken and weird in the first place?

frank ruin
#

Been looking in the pbo's but can't seem to find the location of the icons they use for the dlc's. in for example eden or virtual arsenal to mark that these items are from a dlc.

#

Anybody does know in what pbo these are located?

queen cargo
#

@rancid ruin SQF is not broken actually

#

it is the commands at max

#

the language itself is fairly simple

little eagle
#

Ui_F_Curator

#

Data_F_Kart

#

Data_F_Heli

#

Data_F_Mark

#

Data_F_Exp

#

@frank ruin ^

frank ruin
#

mmm in logos

#

Just noticed

#

The Air Dlc one is an ebo

#

Guess I need to download something for that then ...

#

Can't open that shit with the pbo opener

little eagle
#

Why can't you draw your own? Those are not that pretty anyway.

frank ruin
#

They don't need to be pretty

#

I just want to put them next to the equipement related to that dlc

#

Withouth the need of custom images

little eagle
#

Then it being in EPBO shouldn't matter. Just copy paste the path.

frank ruin
#

yeh but I can't open the path

#

As I don't have an ebo opener atm

#

As you can see for the others it's: E:\Steam\steamapps\common\Arma 3\Heli\Addons\Addons\data_f_heli\Logos\arma3_heli_icon_ca.paa

#

But can't open the freaking ebo of course

little eagle
#

There is no need to open them.

#

Just use the config browser to get the path.

#

CfgMods

waxen jacinth
#
_flag = nearestObject [player, "Construction_Flag_Static"];
_buildRights = _flag getVariable ["TerritoryBuildRights",[]];
_radius = _flag getVariable ["TerritorySize", 15];
_enemyplayer = {player distance _x < _radius && alive _x} count allPlayers;
private _playerUIDs = allPlayers apply {getPlayerUID _x};
    if(_enemyplayer > 1) && !(_playerUIDs in _buildRights){
        ["ErrorTitleAndText", ["Construction aborted!", "You cannot build while enemy is near."]] call Client_Notification;
        
    }``` Output of _buildingRights is: ["UID", "UID"] and since the output of _playerUIDs is also ["UID", "UID"] where would i start if i only want one or more UIDS found out of _playerUIDS   in _buildingRights?
little eagle
#
count (_playerUIDs arrayIntersect _buildRights) > 0
waxen tide
#

KillzoneKids example

#
KK_fnc_inHouse = {
    lineIntersectsSurfaces [
        getPosWorld _this, 
        getPosWorld _this vectorAdd [0, 0, 50], 
        _this, objNull, true, 1, "GEOM", "NONE"
    ] select 0 params ["","","","_house"];
    if (_house isKindOf "House") exitWith {true};
    false
};
onEachFrame {hintSilent str (player call KK_fnc_inHouse)};
#

he selects the 4th return argument

#

Return Value:
Array of intersections in format [[intersectPosASL, surfaceNormal, intersectObj, parentObject],...]

#

parentObject? that should be the player

#

_house contains bis_o1 for me

#

so i think either the function was changed, KK made an error, or i'm stupid

#

the latter seems quite likely

little eagle
#

Make sure to put the player as ignored object.

#

Line 5 in the posted example. The _this

#

Also

    if (_house isKindOf "House") exitWith {true};
    false

🀒

waxen tide
#

hands a paper bag to commy2

little eagle
#

LIS can report an empty array, so after select 0, params would be fed with nil. I don't think this works in that case.

#
([] select 0) params [["_a", 1]];
isNil "_a" // true

yup

waxen tide
#

I don't follow

little eagle
#

The function is erroneous.

waxen tide
#

well

#

yes

#

i got so far πŸ˜„

atomic epoch
#

Hey all

#

nvm

rancid ruin
#

i made a script for checking if a unit is inside a building, but i did it a bit different to KK i think

#

if you just check above the unit's head like he does then you get inaccurate results a lot of the time

#

what i did was to check if there's a house above the unit's head, then raycast in 8 directions (n,e,s,w,ne,nw,se,sw) and return true if >=5 of those intersect a building

#

found it

#

i wrote this years ago when i was even more noob

waxen tide
#

so, turns out my circle script doesn't actually create points on a circle, but creates the same point on the circle a lot because i'm too stupid for loops

#

so, turns out ASL and ATL coordinates are different

#

so, turns out KK's example in BIKI is fault

#

my day sucked.

#

protip: if you want to mess with lots of points in space spawn some god damn 3d objects in the air so you see where your points are.

#

@rancid ruin thanks

#

i've written a similar function

#

i'm passing a number to it, and it returns how many checks of the requested checks were true

#

@rancid ruin yours returns [bis_o1] as well

rancid ruin
#

it does? what does that mean?

#

it worked perfectly when i last tested it about....3 years ago

waxen tide
#

i am quite sure bis_o1 is the parent object

#

so the player in this case

#

i think likely the function was changed.

rancid ruin
#

.....and this is why i can't be fucked writing SQF these days

#

call me when they release arma 4 and thus stop breaking things in arma 3

waxen tide
#

i'm not sure

#

i just suspect it

#

because 2 examples not working

#

maybe i'm stupid tho

rancid ruin
#

@waxen tide my script literally returns bis_o1 ? cos it should just return a bool

waxen tide
#

to be precise, it returns [bis_o1]

#

i used the command you added in the script comments to call it

rancid ruin
#

and you made sure the function was fnc_insideBuilding?

waxen tide
#

yes.

#

@rancid ruin i'm a retard tho, so don't take anything i say for granted unless someone confirms it.

rancid ruin
#

@waxen tide i just tested my function in the editor, works as well as it did 3 years ago

waxen tide
#

okay.

#

i asked for a display method like the one used in the example and nobody told me 😒

jade abyss
#

Get the BoundingBoxReal of House -> Check if player inArea -> +Maybe check if 5m above is something with LIS (if LIS Target == house checked with BBR) -> Done

little eagle
#

The parent object of a house is not the player.

#

Unless you attachTo the house to the player or something like that.

jade abyss
#

No clue why you mention that, but okay

ivory vector
#

Not sure if this is the right place to ask, ive been working on fading in dialog for a player menu, I have tried, cutRsc, but its not letting me move my mouse , any ideas

little eagle
#

Dscha, asdfghj keeps saying that the parent object of the building is the player... That cannot be. They should finally post their script, so the error can be pointed out.

#

ItsLeigham, if the dialog doesn't allow moving your mouse, then you can't make it allow it while it fades out.

ivory vector
#

does fade = 1 work in dialog ?

little eagle
#

I think you mean cursor by "moving your mouse"?

ivory vector
#

yeah

#

but i can move my mouse, just the cursor doesnt move xD

little eagle
#

But there is a cursor?

ivory vector
#

nope

little eagle
#

So you want a cursor in your dialog and cutRsc does't give your one.

#

?

ivory vector
#

nope

#

does fade = 0 work for dialogs ?

#

or fade = 1 ?

little eagle
#

It makes them fade immediately or after 1 second.

ivory vector
#

hmm, thats enough time xD does it work the same for fade out

little eagle
#

I have no idea what you're talking about. Is this still about cutRsc?

ivory vector
#

createDialog, i cant get mouse to work in cutRsc

little eagle
#

cutRsc doesn't give you a cursor. That is correct. createDialog and createDisplay give you one.

#

As for fading them

ivory vector
#
_display = _this select 0;
if(isNil "ADT_CurrentDialog")then{
  _allControls = allControls ADT_CurrentDialog;
  {
    _x ctrlSetFade 0;
    _x ctrlCommit  1;
  }forEach _allControls;
}else{
  _OldControls = allControls ADT_CurrentDialog;
  _newControls = allControls _display;
  {
    _x ctrlSetFade 1;
    _x ctrlCommit  1;
  }forEach _OldControls;
  {
    _x ctrlSetFade 0;
    _x ctrlCommit  1;
  }forEach _newControls;
  ADT_CurrentDialog = _display;
};
``` so something like that ? hopefully I can use this as a global for all my tablets displays
tranquil nymph
#

Should there not be a ! in front of your condition

#

Otherwise the top piece of code will always run

#

Unless you're setting the GVAR in another script I suppose

#

but then no matter which way your condition is, a piece of code is using a nil value immediately after checking it πŸ˜›

#

Plus, you might as well set the initial fade in the display config rather than via sqf

ivory vector
#

I have changed it all completly since hten

#

// fn_DeleteandCreate.sqf


params ["_displaytoOpen"];


FindControls = {
    params ["_displayName"];

    _controls = switch (_displayName) do {
            case "Lega_CustomTablet_Gang_Create": {
                [9000, 9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009, 9010, 9011, 9012, 9013, 9014, 9015, 9016];
            };

            case "Lega_CustomTablet_Admin": {
                [8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025];
            };

            case "Lega_CustomTablet_Gang_Management": {
                [7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021];
            };
        };
    _controls;
};
_displays = ["Lega_CustomTablet_Gang_Create", "Lega_CustomTablet_Admin", "Lega_CustomTablet_Gang_Management"];

_currentDisplay = displayNull;
{
    if (!isnull(uiNamespace getVariable [_x, displayNull])) exitWith {
            _currentDisplay = _x;
        };
} forEach _displays;


if (isNull _currentDisplay) then {
        _oldCtrls = [_currentDisplay] call FindControls;

        {
            // Slow Fade out :D
            _x ctrlSetFade 1;
            _x ctrlCommit  1;
        } forEach _oldCtrls;
        closeDialog      0;
    };

_NewCtrls = [_displaytoOpen] call FindControls;


{
    // Insta Hide.
    _x ctrlSetFade 1;
    _x ctrlCommit  0;
    // Fade in ?
    _x ctrlSetFade 0;
    _x ctrlCommit  1;
} forEach _NewCtrls;

createDialog _displaytoOpen;

``` Still have to add a few displays, but getting there
little eagle
#

FindControls has no OFPEC tag

ivory vector
#

?

little eagle
#

ACE_fnc_addAction
^
ACE is the OFPEC tag

ivory vector
#

ahh

#

I just made it a local .

tranquil nymph
#

This code still doesn't make sense:

if (isNull _currentDisplay) then {
        _oldCtrls = [_currentDisplay] call FindControls;
#

If the display is null, there are no controls to be found

ivory vector
#

was meant to be !isnull

tranquil nymph
#

The other issue is you're setting the fade of controls on new display before it has been created

#

Also only supplying their idc which won't work

ivory vector
#

Already changed tha , ill edit.

little eagle
#

Could put all the controls you want to fade in into a controls group and fade in that instead. Less ugly.

ivory vector
#

most of my dialogs are complete xD

#

if i had thought of this when i started it I would have

#
// fn_DeleteandCreate.sqf


params ["_displaytoOpen"];


_FindControls = {
    params ["_displayName"];

    _controls = switch (_displayName) do {
            case "Lega_CustomTablet_Gang_Create": {
                [9000, 9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009, 9010, 9011, 9012, 9013, 9014, 9015, 9016];
            };

            case "Lega_CustomTablet_Admin": {
                [8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, 8020, 8021, 8022, 8023, 8024, 8025];
            };

            case "Lega_CustomTablet_Gang_Management": {
                [7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013, 7014, 7015, 7016, 7017, 7018, 7019, 7020, 7021];
            };
        };
    _controls;
};
_displays = ["Lega_CustomTablet_Gang_Create", "Lega_CustomTablet_Admin", "Lega_CustomTablet_Gang_Management"];

_currentDisplay = displayNull;
{
    if (!isnull(uiNamespace getVariable [_x, displayNull])) exitWith {
            _currentDisplay = _x;
        };
} forEach _displays;

if (!(isNull _currentDisplay)) then {
        _oldCtrls = [_currentDisplay] call _FindControls;
        {
            // Slow Fade out :D
            (uiNamespace getVariable [_currentDisplay,displayNull] displayctrl _x) ctrlSetFade 1;
            (uiNamespace getVariable [_currentDisplay,displayNull] displayctrl _x) ctrlCommit  1;
        } forEach _oldCtrls;
        closeDialog 0;
};


createDialog _displaytoOpen;
_NewCtrls = [_displaytoOpen] call _FindControls;
{
    // Insta Hide.
    (uiNamespace getVariable [_displaytoOpen,displayNull] displayctrl _x) ctrlSetFade 1;
    (uiNamespace getVariable [_displaytoOpen,displayNull] displayctrl _x) ctrlCommit  0;
    // Fade in ?
    (uiNamespace getVariable [_displaytoOpen,displayNull] displayctrl _x) ctrlSetFade 0;
    (uiNamespace getVariable [_displaytoOpen,displayNull] displayctrl _x) ctrlCommit  1;
} forEach _NewCtrls;

#

Wouldnt let me update XD

little eagle
#

The closeDialog will close it before the fade out effect finished.

ivory vector
#

how would I change that ?

little eagle
#

spawn, sleep I guess. And cross fingers the scheduler doesn't fuck you over when one clicks very fast.

ivory vector
#

ill see how it looks without for now πŸ˜„

#

got a cleaner way of finding controls.

little eagle
#

Could put (uiNamespace getVariable [_displaytoOpen,displayNull] displayctrl _x) into a variable, unless you're paid per file size ofc.

ivory vector
#

.good point

#
    _displayCtrlConfig = "true" configClasses(missionconfigfile >> _displaytoOpen >> "Controls");
    {_controls pushback (getNumber(_x >> "IDC"))}forEach _displayCtrlConfig;
``` this should work right ?
#

an im making this for myself πŸ˜„

little eagle
#

At that point you might as well use allControls.

ivory vector
#

i tried, it included background controls.

little eagle
#

I see,

ivory vector
#

the background is the same on all and didnt want to include the background in the fade

little eagle
#

Well this way it won't work on controls with idc=-1

ivory vector
#

why they would include background in allcontrols idk, it also includes -1

little eagle
#

Because the command is named ALL controls I guess.

ivory vector
#

i havent got any -1, I have gone through and made one display 5000 + the next 6000 + etc

#

So i dont get any issues with that.

little eagle
#

configClasses doesn't include classes that are inherited. Which could be a problem if you do that.

ivory vector
#

hmm

#

(getNumber(_x >> "IDC"))

#

its not liking that.

little eagle
#
class RscDisplay1 {
    class controls {
        control1{...};
    };
};

class RscDisplay2: RscDisplay1 {
    class controls: controls {
        control2 {...};
    };
};
private _class = missionConfigFile >> "RscDisplay2" >> "controls";
"true" configClasses _class // [control2]
configProperties [_class, "isClass _x"] // [control1, control2]
ivory vector
#

hmm Ill take a look in a sec πŸ˜„

little eagle
#

its not liking that.
What does it complain about?

ivory vector
#

generic error

spice kayak
#

Hey, I'm not crazy, am I? 3rdPersonView was an attribute at one point, wasn't it? One of my missions from 2015 used it, but nowhere online I can find that it exists.

little eagle
#

Replace

#
{_controls pushback (getNumber(_x >> "IDC"))}forEach _displayCtrlConfig;

with

#
_controls append (_displayCtrlConfig apply {getNumber (_x >> "idc")});
ivory vector
#

testing now πŸ˜ƒ

little eagle
#

You mean in the editor, Luro?

#

Because it's a difficulty setting of the client / server.

spice kayak
#

Yeah, I realized that now. I had it in a description.ext from a while back, for some reason.

ivory vector
#

❀ commy

spice kayak
#

I was thinking about whether or not it would be possible, or easy enough to allow one team to have access to thirdpersonview, overriding the server's settings.

ivory vector
spice kayak
#

Maybe not so much the last part, but the one-team only thing would be great.

ivory vector
#

@little eagle do you has pp ?

little eagle
#

There are scripts that change to first person view when you're switching to thrid person view.

#

What is pp?

ivory vector
#

paypal ?

little eagle
#

I used to. yw, need no donations.

ivory vector
#

dude , im not asking xD the Arma Community, is toxic these days, so Its cool when someone isnt πŸ˜„

little eagle
#

Life community*

ivory vector
#

yeah

#

Im starting a community, its gunna be a nofucksgiven community, any bullshit, and people are out πŸ˜„

#
    animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
    animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)";
    animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
    animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
    animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
    animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
``` Am i right in saying, these can be replaced with images ?
#

im looking at getting the buttons, as controls.

spice kayak
#

Too bad it wasn't an action that EVH uses. Saves me having to use sleep timers.

ivory vector
#

umm. dafuq. closedialog isnt working xD

spice kayak
#

Unless you might know a way, Commy. Disabling it ourright would be great, to avoid that split-second of third person someone gets if they keep spamming it. Anyway, be back in a second!

little eagle
#

You can't disable it for certain people only afaik.

#

If you change back each frame, then it should be good enough, even when the key is spammed.

atomic epoch
#

Is there a way to grey out certain controls until a player has met a certain condition?

little eagle
#
addMissionEventHandler ["EachFrame", {
    if (cameraView isEqualTo "EXTERNAL") then {
        cameraOn switchCamera "INTERNAL";
    };
}];
atomic epoch
#

Controls as in buttons and stuff

little eagle
atomic epoch
#

@little eagle thanks!

spice kayak
#

Ooh, didn't know about each frame! Thank you, @little eagle! Will give that a try in a second.

ivory vector
#

hmm, fading out doesnt wanna work xD

little eagle
#

@atomic epoch

private _fnc_update = {
    params ["_diplay"];
    private _control = _display displayCtrl IDC_CONTROL;

    _control ctrlEnable (CONDITION);
};

_display displayAddEventHandler ["MouseMoving", _fnc_update];
_display displayAddEventHandler ["MouseHolding", _fnc_update];
#

Maybe that helps. Updates the control every frame the display is active.

ivory vector
#
waituntil{
    {
        (ctrlFade (uiNamespace getVariable [_currentDisplay,displayNull])displayCtrl _x) == 1
    }forEach _oldCtrls
};
``` can i do something like that commy ?
little eagle
#

It looks confusing without line breaks,.

spice kayak
#

Hey @little eagle, would addMissionEventHandler be a global function, or local? I did actually check the page! Though there wasn't anything there to say otherwise. Also, sorry for interrupting!

little eagle
#

No, Leigham.

#

The code has wrong parenthesis and forEach doesn't work like this. Also ctrlFade reports the targeted fade, not the current one.

#

ctrlCommited would work though.

#

You only need to check one control, not all of them.

ivory vector
#

i cant find comitted on the wiki

little eagle
#
waitUntil {ctrlCommitted _control};

And let _control be any one of the foreground ones.

#

two m and two t ^^

ivory vector
#

ahh xD

#
waituntil{ctrlCommitted ([_oldCtrls]call BIS_fnc_selectRandom)};
little eagle
#

@spice kayak addMissionEventHandler has local effects (and no arguments that could be considered local or global).

#

You don't need an actually random one. Just pick the first one,.

spice kayak
#

Ah, thanks man!

ivory vector
#

doesnt like something xD

#

i think schedular doesnt like it xD

#

also seems to be instantly fading out

spice kayak
ivory vector
#

@little eagle I tried putting them into a controlsgroup cant get it to work.

waxen tide
#

is there an issue with

#
_var = 5;
_math = (10 / _var);
spice kayak
#

Hmm, can someone explain the different between 0 setOvercast 1; and [1] call BIS_fnc_setOvercast; ?

#

Ah, don't worry, I think I've pretty much gotten it. Thanks anyway. Was hoping there was a BIS_fnc_setRain, but I don't think there is.

little eagle
#

_math is 2

waxen tide
#

I tried to divide a string commy2

#

I'm ready for my idiot hat

little eagle
#

^^
The / command only accepts NUMBER's.

#

Actually, I think there is a CONFIG / CLASSNAME syntax too.

spice kayak
#

Aw, so my weather settings wouldn't work at all? :(

#

Ah, sorry, rain works, but overcast doesn't.

#

Damn.

waxen tide
#
params [
            ["_centerpos", [], [[0],[0],[0]]],
            ["_r", 10, [0]],
            ["_precision", "20",[0]],
            ["_lazy", true, [true,false]]
        ];
#

"accept only numbers, but default is a string"

#

totally makes sense.

little eagle
#

It's tricky and stupid and broken. It kinda works., which is the worst kind of, because your players think you're just too stupid / lazy.

spice kayak
#

And also kind of ruins the mission if it doesn't work.

#

:(

little eagle
#

Yop

#

Weather is almost as broken as PhysX.

spice kayak
#

Hmm, what about the mission parameters, \a3\functions_f\Params\paramWeather.hpp thing?

#

actually, yeah, ignore that.

little eagle
#

🀷

spice kayak
#

Was reading it wrong.

#

Damn it. I got all these parameters \o/

#

I mean, these changes take place before the clients load in. Would that work, because it's not technically 'syncing' if it's there when they join / load?

little eagle
#

I don't know. In my experience, it helps if you disable auto weather.

spice kayak
#

autoweather?

little eagle
#

This is done by clicking "manual overwrite" for all the weather things in Eden (and removig the entries from the description.ext).

spice kayak
#

What entries in description.ext? The parameter ones that I put there myself?

#

But yeah, manual override was already selected where it could be. The only weather-based entries I have in description.ext are my parameter ones, which allows the host to change the values pre-mission launch.

little eagle
#

Sounds good to me.

spice kayak
#

Shweet.

little eagle
#

Now you have to convince Arma.

spice kayak
#

pls arma pls.

#

\[--]/

#

Okay, so, after reading that post, I'm certain most of my weather settings should sync. Hopefully.

ivory vector
#

Arma is seriously fucking with me today

#

@little eagle If send you a mission, could you take a look, im basically starting from scratch,(missionwise ) trying to get this fading to work.

spice kayak
#

Good luck, man. Arma screws us all!

waxen tide
#

+1

ivory vector
#

so yeah once i open the admin menu, all the other buttons disable them selves xD

#

and the licenses dont open whatsoever.

little eagle
#

Do you really want that fade effect? It's something that would annoy me.

waxen tide
#

turns out i placed my markers to visually check what i was doing in ATL coordinates and then checked ATL coordinates with a function expecting ASL

little eagle
#

I always convert everything* to ASL immediately.

#

And only back to AGL if it's one of those commands that need it.

waxen tide
#

i renamed all my vars containing positions to varASL or varATL

#

i see

ivory vector
#

Yeah i did xD

#

its starting to trigger me ngl

#

ive litteraly started from scratch, and commented out most in the license dialog.

#

and nothing

waxen tide
#

well now i know why my intersection check was returning unexpected results

rancid ruin
#

did you figure out why mine was returning unexpected results?

ivory vector
waxen tide
#

@rancid ruin no

#

progress

real tartan
#

Loiter waypoint is not working. Helicopter go there and just hover. After I kill civilian, it fly away and delete it self.

#

0 = [] spawn
{
_spawnPos = [player, 1000, (random 360)] call BIS_fnc_relPos;
_vehicleArray = [_spawnPoS, random 360, "I_Heli_light_03_F", east] call BIS_fnc_spawnVehicle;
_vehicleArray params ["_helicopter", "_crew", "_group"];
_helicopter flyInHeight 100;

_wp1 = _group addWaypoint [position player, 50];
_wp1 setWaypointType "Loiter";
_wp1 setWaypointCombatMode "red";
_wp1 setWaypointLoiterRadius 100;
_wp1 setWaypointStatements ["{ alive _x && side _x in [civilian] } count (allUnits - allPlayers) == 0", "systemChat 'done loitering';"];

_wp2 = _group addWaypoint [_spawnPos, 0];
_wp2 setWaypointBehaviour "Careless";
_wp2 setWaypointType "Move";
_wp2 setWaypointSpeed "Full";
_wp2 setWaypointStatements ["true", "systemChat 'delete'; deleteVehicle (vehicle this); {deleteVehicle _x} forEach (units (group this)); deleteGroup (group this);"];

};

halcyon crypt
#

if I recall correctly the condition needs to be true before the waypoint is executed

#

so when you kill the civilian it executes the loiter waypoint but also immediately jumps to the second waypoint

#

the civilian check thingy probably needs to be done in the 2nd waypoint's condition

real tartan
#

with that logic, helicopter should hover on spawn point, not do "MOVE" waypoint to player position

ivory vector
#

So I Have my dialogs fading now, but i cant interact with any of the controls now -_-

halcyon crypt
#

you're probably drawing something over them

ivory vector
#

Nothing that I know of.

#

I have one background, and thats on controlsbackground.

waxen tide
#

function checks a position for a ceiling above (return true/false) and returns a percentage of cover in the X,Y plane. this garage has 3 positions with 61%, 85% and 93% cover

atomic epoch
#

Anyone here with ideas of how to return the AI who opened a door? I'm stumped

little eagle
#

I don't think that is possible.

sour saffron
#

nearest unit to the door thats open ?

#

animationphase check on building

little eagle
#

You'd have to do that in a loop though.

sour saffron
#

well you will always have a trigger somewher to satrt a sequence

#

im sure Ai wont be checking all doors everywhere

#

even the most dynamic mission have event checks somewhere

tame portal
#

@waxen tide How does it determine that?

little eagle
#

I guess it depends on how many doors we're talking about.

tame portal
#

I assume it does so by checking for each dot around the given position where LOS is there?

spice kayak
#

Before I know it, the whole mission is going to be a variable.

tame portal
#

So, I'm trying to position a groundweaponholder as close on the surface of an object as possible

little eagle
#

"surface of an object" ?

tame portal
#

Because the given building positions of said building are floating in the air and rather than fixing every building manually I want to write a function to input a position and find the next point it would intersect with the floor which then is the lowest position

#

I tried something like this

#
_pos = param[0,[0,0,0],[[]]];
_pos = AGLToASL _pos;

// Exceptions
if (_pos isEqualTo [0,0,0]) exitWith {[0,0,0]};

// Code
_intersectsAt = lineIntersectsSurfaces [_pos, _pos vectorAdd [0, 0, -50], player, objNull, true, 1, "GEOM", "NONE"];

if (count _intersectsAt > 0) then {
    ASLToAGL (((_intersectsAt select 0) select 0))
} else {
    [0,0,0]
};
#

But it doesn't really appear to work correct :/ The positions occasionally on some buildings still float in the air and I'm out of ideas πŸ˜›

little eagle
#

Ground weapon holders inside buildings?

tame portal
#

Yep

little eagle
#

Wouldn't the item appear in the same position for each building of the same type?

tame portal
#

Yep, it's baked into the buildingpositions of that building

sour saffron
#

yeah write an array for each building then use the array for building type ?

tame portal
#

I could fix it manually for each building and define new offsets myself

#

but thats sooo much work

#

Because a lot of buildings have weird offsets for their buildingpositions

sour saffron
#

get the model pos of some memory points and use a known offset

little eagle
#

And then modelToWorld

#

To account for rotation etc.

sour saffron
#

typeof building = _x then offset = _y

#

maybe use doorhandle positions or something ?

tame portal
#

The distance between nearest point to the ground and the buildingposition is not the same for every buildingposition within one building

#

So I can't use a fixed "correction" offset ontop of the offsets buildingsposition gives me

sour saffron
#

there wont be many you need though and they will always be the same for that building type

tame portal
#

I'm talking about hundreds of building types

sour saffron
#

plus roadways set ASL to 0 so it can be a nightmare doing it dynamically

tame portal
#

Whats more of an nightmare, correct positions manually or write a function to fix them in realtime? πŸ˜„

little eagle
#

No, ASL is always the same height.

sour saffron
#

i used to do it witrh furniture on altis

little eagle
#

You're thinking of AGLS

sour saffron
#

yeah probably i am been 2 years since iscripted

little eagle
#

Is fixing the positions only like +/- one meter?

sour saffron
#

i think even ASL was disrupted by stormy seas too lol ?

little eagle
#

No, that is ASLW (wave)

#

Which is equivalent to AGL over water.

#

ASL is the best system.

sour saffron
#

ill remember that

tame portal
#

@little eagle Mostly, yes

#

I'd say the majority of positions is wrong by lets say max +1 z

little eagle
#

Is it only plus?

tame portal
#

Yes

little eagle
#

So floating?

tame portal
#

Yep

little eagle
#

ok

#

Use getPos _gwh select 2 to get the height above the first pathway lod below the weapon holder.

tame portal
#

OHHH

#

Jesus

#

Thats a smart solution

little eagle
#

And then _gwh setPosASL (getPosASL _gwh vectorAdd [0,0,-_offset]);

tame portal
#

Yeah thats good

#

I dont think of something like this because I dont reaaaally look into ASL, AGL, bliblablubb much

#

πŸ˜„

#

Lets hope the buildings have correct pathways lods defined then πŸ˜„

little eagle
#

Thinking about this is still more relaxing than calculating anti-derivats by hand.

tame portal
#

I'll stick to the problems I am having lol

little eagle
#

That's because they haven't gotten bad enough already.

tame portal
#

Quick question, the difference between AGL and AGLS

#

What counts as a surface in AGLS?

little eagle
#

AGL is over land the same as ATL. z=0 being the terrain surface.

tame portal
#

Yes

little eagle
#

AGLS (s for surface) has z=0 as the first pathway LOD below the lowest road contact poit of the object in question.

#

So the same as AGL and ATL in the wild, but different in/on buildings and stones etc.

#

There are multiple surfaces in a building (1nd story, 2nd story, roof) as well as the terrain below the building.

#

So there are multiple z=0 for every X,Y position in the AGLS system.

#

Which is why getPos sucks and you should use ASLToAGL getPosASL obj if you need the AGL position of something.

tame portal
#

I was about to ask

#

why there isn't a getPosAGL

little eagle
#

It's worse than that

#

setPos ... AGL
getPos ... AGLS

tame portal
#

Are you serious

little eagle
#

So
player setPos getPos player

tame portal
#

Oh my god

little eagle
#

moves you on the terrain inside the building when you were standing on the roof

#

Try it.

tame portal
#

Just checked the wiki yeah

#

Well that's a bunch of consistency again there

#

Very consistent

little eagle
#

It's one of those pitfalls I keep talking about.

#

First magic trick of the day I guess.

tame portal
#

I'll try the offset thing and hope the buildings have their paths defined correctly

little eagle
#

There can't be a setPosAGLS, because there are multiple z=0 for every X,Y

tame portal
#

Yeah

little eagle
#

Would have to be: obj setPosAGLS [x,y,z,layer];

tame portal
#

I don't know, I think this system is just making it more complicated

#

Yeah was about to suggest that

#

The naming of these commands is just not on point

waxen tide
#

@tame portal i do a lineintersectsSurface check. well not one.

tough abyss
#

Using AI positions for loot positions to spawn isn't great
Better off to just define building loot positions.

Plenty of sqf snippets out there to help you create them.
Its really not that much work

tame portal
#

@tough abyss It's no problem to write such snippet myself, it's just that I like looking for the easier solution first before I do repetitive work

waxen tide
#

my policy is to strictly avoid scripting anything that relies on fixed input if i can help it. i'm detecting everything by script instead of fetching manually compiled lists.

#

so far my script doesn't even care about the map it runs on.

little eagle
#

Yeah, I hate lookup tables too.

tough abyss
#

Really only takes like a hour or 2 todo all the building types on map.
Otherwise just fallback to building position.
Building AI positions is a lookup table πŸ˜‰

waxen tide
#

currently i have zero pre-placed objects on the map.

atomic epoch
#

Anyone here with ideas of how to return the position of a door from a building?

waxen tide
#

i don't compile a lookup table, i merely do a check for suitable positions when i want to spawn and then do spawn.

little eagle
#

Building AI positions is a lookup table
It's one that's already there. So you're not making another one.

waxen tide
#

^

brazen sparrow
#

well the ai position dont make very good loot position for a start

waxen tide
#

why not?

brazen sparrow
#

cos there just randomly placed on the floor, instead of like on tables/shelfs etc

waxen tide
#

also, i'm actually spawning AI. idk about OPTIX

brazen sparrow
#

fine for ai lol

waxen tide
#

makes sense, but then arma doesn't really have tables/shelves preplaced too much?

still forum
#

@atomic epoch AI don't Open doors. They just walk through the wall right next to it

little eagle
#

🍿 dedmen typing

tough abyss
#

No real difference in overhead / performance from using another table
Adding a script to attempt to offset loot piles correctly is extra work for arma aswell

tame portal
#

@brazen sparrow Was sufficient for my things but guess Ill take the time anyway for those new open buildings on chernarus

#

Back in my day everything was closed!1

brazen sparrow
#

what 6 months ago? πŸ˜›

tame portal
#

Too much time has passed, yes

tough abyss
#

@atomic epoch You might be able to override the configs for when AI opens a door to run an extra piece for sqf code. But that would mean overriding each building class. Abit overkill though

little eagle
#

Don't think you can do that.

atomic epoch
#

Is that even possible without mods @tough abyss

little eagle
#

Definitely not without mod.

tough abyss
#

There is a config entry that ai runs to animate the door. Should be able to run sqf code via it
But would require an addon

waxen tide
#

if you can easily detect by script if a door is opened, you could check which AI is closest.

tough abyss
#

Only really viable if you only want to check on a certain building type

little eagle
#

I wonder if AI actually use these actions or if they just animate the door they walk through.

atomic epoch
#

Well, at least there's a solution. Thanks for answering

#

That's what I've been wondering to @little eagle

tough abyss
#

Yeah they do, was recently messing with it. Otherwise they just walk through it

little eagle
#

BIS_fnc_DoorNoHandleOpen
BIS_fnc_DoorOpen

#

Maybe overwrite these?

#

You can overwrite BIS functions with CfgFunctions in missions, no?

atomic epoch
#

@waxen tide that would require returning the position of the door from the building. The only way I know how is to do lineintersect from the AI's eyepoa, which is not full proof

waxen tide
#

i see

atomic epoch
#

You can overwrite, yes. That's a good suggestion !

little eagle
#

yay

atomic epoch
#

Is it possible to overwrite the BI function through description? Idk how to do it without sqf.

little eagle
#

You can't do it with script, because they're protected, but if CfgFunction handles it...

tough abyss
#

You want to look at Overriding BIS_fnc_Door, that is the function used by most of a3 buildings

little eagle
#

DoorOpen and DoorNoHandleOpen

tough abyss
#

I just checked the a3 configs ;P
The useractions which ai use call BIS_fnc_door
DoorOpen is only used on a heli

little eagle
#

My all in one config is from 1.72, so maybe it changed.

tough abyss
#

screw override them all ;P

atomic epoch
#

You guys have been really helpful. If its not too much trouble, could you guys give me an example of overwriting? I only know how to make new functions, but not replacing existing ones

little eagle
#

I don't know if you can. I never do missions.

tame portal
#

I dont think you can in missions

#

I am fairly sure

atomic epoch
#

And BTW, you can recompile through sqf if you use allowFunctionsRecompile = 1 in description. So all is not lost :)

#

Thanks guys, I really appreciate it.

waxen tide
#

i would be in the nuthouse without allowFunctionsRecompile

atomic epoch
#

What do you use it for?

waxen tide
#

well i implemented generic things as functions

#

to re-use them for mutiple tasks

#

one function handles NPC dialogues and is called ~60 times when that mission pops up

#

other one generates points on a circle around a position for various checks

#

stuff like that

#

?

#

i figured implementing as much as possible as a function can't be a horrible idea

atomic epoch
#

I don't see how that requires allowFunctionsRecompile. Creating functions inside CfgFunctions would work just as well

waxen tide
#

i'm doing that but if i don't want to reload the mission i have to allow recompile to recompile them while testing?

atomic epoch
#

Ah I get it. It allows you to recompile without restarting the mission. Never thought of that.

#

Thanks for the tip

#

:)

waxen tide
#

exactly.

little eagle
#

I tried, but didn't manage to overwrite it with CfgFunctions.

atomic epoch
#

BIS_fnc_Door failed?

#

NOOOOOOO

#

I'll try myself tomorrow.
BIS_fnc_moduleCurator worked for me. It says "HI" now

sand pivot
#

i want to attach a marker to an object/unit that is in motion while a dialog is open. Is there a way of doing this outside of setMarkerPos?

compact maple
#

Hello, everyone, i wanted to display a dialog when the player open his map so i made this : addMissionEventHandler ["Map",{createDialog "markers"}];
But i got a problem, when my dialog is opened, any other input is disable, so i cannot type on the map or move it for example. Is there a solution to that, can we manage the priority between different dialogs ?

sand pivot
#

main issue here is i have multiple markers whose names are stored in an array so referencing their names would be difficult

#

@compact maple do you need to interact with the dialog? or could you use a HUD?

compact maple
#

I need to interact with it, is it possible ?

rancid ruin
#

what you could do is create your dialog controls within the map dialog itself

#

i've used that technique to add buttons to the map and stuff

sand pivot
#

or put a map in your dialog?

rancid ruin
#

indeed, but then you miss out on the vanilla map dialog stuff like marker placement etc

#

he might want that

sand pivot
#

good point

compact maple
#

hum interesting, and where can I found the map dialog ?

#

btw i need the basic map with all the markers

rancid ruin
#

(findDisplay 12)

#

(findDisplay 12 displayCtrl 51)

#

think display 12 is the map display, and 51 is the actual rscMap control within the display

#

ancient noobscript incoming

#
add_map_button_at_player = {
    disableSerialization;
    _xy = ((findDisplay 12 displayCtrl 51) ctrlMapWorldToScreen position player);
    _map = (findDisplay 12);
    map_button_player = _map ctrlCreate ["RscButton",6558];
    map_button_player ctrlSetPosition [
        _xy select 0,
        _xy select 1,
        (2 / 1920) * SafeZoneW,
        (2 / 1080) * SafeZoneH
    ];
    map_button_player ctrlCommit 0;
    map_button_player ctrlSetText "a";
    
    
    (findDisplay 12 displayCtrl 51) ctrlAddEventHandler ["draw",{
        _xy = (findDisplay 12 displayCtrl 51) ctrlMapWorldToScreen position player;
        map_button_player ctrlSetPosition [
            _xy select 0,
            _xy select 1,
            (184 / 1920) * SafeZoneW,
            (34.75 / 1080) * SafeZoneH
        ];
        map_button_player ctrlCommit 0;
    }];
    
};
compact maple
#

OK, that already helped a lot

#

oh god

#

ok

#

Thx dude πŸ˜‰

rancid ruin
#

can't remember what that script does but it's the first result i got in a search on my ssd

#

np, glhf

little eagle
#

@atomic epoch

// init.sqf
{
    missionNamespace setVariable [_x, compile format ["call %1; call %2", missionNamespace getVariable _x, {
        systemChat str _this; 
    }]];
} forEach ["BIS_fnc_Door", "BIS_fnc_doorOpen", "BIS_fnc_DoorNoHandleOpen"];
#
// description.ext
allowFunctionsRecompile = 1;
#

This worked for me.

atomic epoch
#

YES

#

@little eagle you sir have washed away hours of pain

little eagle
#

You still have to do tricky stuff to get the unit, but at least you now have some sort of "eventhandler".

atomic epoch
#

πŸ‘

little eagle
#

Also, apparently these door actions check cameraOn, so if AI actually use these actions, then server owned AI should never use doors...

atomic epoch
#

I'm very happy right now, dont ruin this for me.
One problem at the time!!!

little eagle
#

Idk. I always see BIS_fnc_DoorOpen, not BIS_fnc_Door. What do I know.

sand pivot
#

sorry to circle back, but... I want to attach a marker to an object/unit that is in motion while a dialog is open. Is there a way of doing this outside of setMarkerPos?

rancid ruin
#

use a draw event handler

sand pivot
#

using drawicon3D?

#

this would also require position updating right?

little eagle
#

Markers cannot be attached. The only thing you can do is to update the markers position in a loop.

sand pivot
#

bummer, that's doable but annoying, thanks

rancid ruin
#

markers don't really have any benefit over a draw EH though

#

in fact they're less versatile

#

only good thing about them is that the player can make them easily on the vanilla map

sand pivot
#

do draw3D icons apear in 3d space for the curator? that might be worth trying for me.

rancid ruin
#

i don't see why not, you just draw them on to the main mission display right

sand pivot
#

i like it, that will make the next 3 scripts i was going to right useless. many thanks @merry turtle

waxen tide
#

I would like to implement a global debug switch that i can set in one central place to trigger additional debug output. I've seen #define debug and #ifdef #endif being used to do that with preprocessor? instructions, but i saw odd behaviour with this and i've read that it can only be used once per file?

rancid ruin
#

why not use a mission parameter, or just blah_debug = true in init.sqf?

waxen tide
#

well i have considered that, but i suspect someone has a genius magic trick

coarse atlas
#

Is there a good script for dynamic loadout for jets?

waxen tide
#

@coarse atlas Firewill has some plane mods, like F-15, F-16 etc will very nicely done scripts for that. Maybe he made them public somewhere for you to use.

coarse atlas
#

well, I'd prefer they make use of the scripts from the jets DLC XD

waxen tide
#

oh, right. there was a thread in the bohemia forum about that and people did some proof of concept in there. maybe it advanced into something proper.

grand berry
#

Does anyone know of a BIS Fnc that spawns units in random building positions?

waxen tide
#

this returns positions suitable for unit placement inside buildings

#

you basically just need to attach a createvehicle line to that

grand berry
#

Yea thats what im doing now, was just wondering if the was an exsiting function with it rolled into one. Thanks anyway.

waxen tide
#

i'm very glad i got those functions already

grand berry
#

This seems to work really well:

_buildings = [cqb_0,cqb_1,...];
{
        _positions = [_x] call BIS_fnc_buildingPositions;
        _noOfPos = count _positions;
        _noOfUnits = random [0,3,5];

        for "_i" from 0 to _noOfUnits do {_unit = "C_man_1_1_F" createVehicle (_positions select (random [0, (_noOfPos /2), _noOfPos]))};

      } forEach _buildings;
waxen tide
#

some houses have less than 5 tho

grand berry
#

yea its not clean at all - doesnt seems to error with small buildings. It's only a small script for a very specific purpose. Works well enough.

waxen tide
#

_noOfUnits = floor random _noOfPos;

grand berry
#

Cheers

waxen tide
#

:J

tame portal
#

@little eagle What would be the fastest way to get a unique array of classnames of objects inherting from the class House on an entire map

#

Are there any other objects rather than fetching all objects, and making an array of classnames out of it?

waxen tide
#

is there a way to get the size of a house out of the cfg or from the model?

#

must not be terribly precise

waxen tide
#

ohhhhhh thanks

#

i already made plans for way too complex scripts

waxen tide
#

i've read the wiki page for exitWith a few times, and i've played around with it. yet i am not 100% sure what i should expect of it. No matter how deep i nest it into loops and whatnot, if i use it to exit i always exit the entire script?

rancid ruin
#

exitWith just exits the current scope

winter rose
#

I think (or thought) it exits for and foreach yes

#

if you exitWith at the root scope it exits without problem the whole script

waxen tide
#

so does it exit for and foreach?

winter rose
#

from the wiki Β« Often used for exiting do, for, count or forEach. Β»

rancid ruin
#

i've read the wiki page for exitWith a few times

#

😲

waxen tide
#

i'm not very bright.

#

And to my defense, i've probably read 100 wiki pages in the last 3 days

#

i fiddled with exitwith 2 days ago and gave up after a few hours. and i never bothered to ask here. but probably exitwith wasn't the issue but some other errors i had.

#

i'm not very bright.

winter rose
#

get some rest, sqf does make you pay any lack of energy πŸ˜‰

waxen tide
#

i'm well rested currently.

cosmic kettle
waxen tide
#

thanks for the link, i've read and understood that

cosmic kettle
#

Just thought it might give you an insight in some way. What's the deal with 'em then?

waxen tide
#

Nothing now, i've figured out my other errors that made me believe i wasn't exiting the proper scope and ending up in the next one.

#

also i started breaking down my scripts into smaller functions

#

i was writing way too large abominations

cosmic kettle
#

At first they can seem tricky, but knowing how to deal with scopes helps a lot.

waxen tide
#

indeed

cosmic kettle
waxen tide
#

yeah thats the 4th bookmark in my bookmark bar right now.

cosmic kettle
#

Smaller functions are the way to go indeed. If you wrote it twice it should be a function.

waxen tide
#

I'm wondering, you guys wrote about doors earlier

#

i found the BIS_fn_door in the functions viewer

#

but i have no idea how to check if an object has a door

#

and how to access it?

cosmic kettle
#

iirc it's defined in the config.

waxen tide
#

i couldn't find the config for any house. do you know from the top of your head where i need to look?

cosmic kettle
blissful wind
#

"programmers doing things because they want to show how clever they are rather than getting the job done"

#

i chuckled

cosmic kettle
#

Yeah that's from the wiki I believe, Like it πŸ˜ƒ

waxen tide
#

thanks stickie

cosmic kettle
#

No problem

waxen tide
#

i had the idea to ambush players with pre-placed units. so i thought locking all doors in a house and spawning enemies only where they can't be immediately seen would be a nice touch

#

has keept me busy 2 days now

cosmic kettle
#

Well there are very fancy ways of doing that. Hope u get it working!

blissful wind
#

one of them is using Tanoa

#

kek

waxen tide
#

well it isn't looking entirely hopeless

#

this function does 3 circle checks around buildingPOS for intersections and returns a % value of success

#

so when its 100 i know its ideal

#

i'm re-writing it a bit to do more iterative checks to be able to abort early on fail to keep the total intersect check amounts down

#

no point to check for walls if there isn't a ceiling, no point in checking for window or door gaps if there aren't any walls in north, south, east, west

#

the cyan arrow is the only suitable pos the script found

#

doesn't care about doors yet.

cosmic kettle
#

Well it seems you're gonna be able to do that then πŸ˜ƒ

waxen tide
#

i was wondering, what happens if i throw a script that needs several seconds to execute into the scheduler? like whats the performance impact?

cosmic kettle
#

how does it take into account the MP aspect of it?

waxen tide
#

MP aspect?

cosmic kettle
#

like one player can see that position, another one can't

waxen tide
#

oh it doesn't care about players. it checks if an AI soldier i place on that position can be seen from the outside, basically

#

and i only spawn a soldier if he can't be seen

cosmic kettle
#

if you call the script I believe image will freeze until execution? not sure really.

waxen tide
#

in scheduled? no

cosmic kettle
#

oh

waxen tide
#

i made a mistake once and the script took 13s to execute, game ran fine

#

i'm just wondering what happens on a busy server

#

(if i don't spawn thousands of markers for visualising the checks i do for debug reasons the script runs in like 100ms)

cosmic kettle
#

seems fine to me. It's hard to tell, if you're only running that I don't see how it should affect performance.

waxen tide
#

well i plan to run a whole lot more in parallel. but i don'T care how long it takes to execute this script since spawning a new mission can take minutes before it affects my mission flow

#

well premature optimisation is the bane of all evil or something like that.

cosmic kettle
#

Yeah get it working first is a good thing πŸ˜„

waxen tide
#

its just a bit concerning to see a script running for 13s.

north vortex
#

How would you add an item (optic_nightstalker) to a weapon(srifle_llr_f) through the inet of a player

spice kayak
#

You mean init?

#

player addPrimaryWeaponItem "muzzle_snds_H";

#

You'd change the "muzzle_snds_H" to the optic_nightstalker, whatever that item is called.

#

Actually, if the weapon doesn't support the attachment by default (you can check in arsenal, it won't be added to the weapon.

#

The srifle_LRR_SOS_F supports the optic_SOS, and the srifle_LRR_LRPS_F supports optic_LRPS, but the base srifle_LRR_F doesn't seem to support any attachments.

still forum
#

There is no reason you can't.

#

That's a dumb question.

spice kayak
#

Yeah, I wasn't 100% certain. Sorry.

still forum
#

What made you think it might not work?

spice kayak
#

Not entirely sure. I mean, I had a feeling it would, but I wasn't sure how looped actions would work inside an if statement which doesn't loop. That was my only real concern, but it was a minor one.

#

I'd also have to rewrite an entire script for what I'm trying to do, so if there was the chance it wasn't going to work, I didn't really want to waste the time.

still forum
#

How would looped actions work in any script that doesn't loop?

[] spawn {
while...
}

spawn spawns a script that doesn't loop

spice kayak
#

Yeah, good point. I didn't really understand the point of [] spawn outside of it's initialization usages.

little eagle
#

?

#

It's just an argument you pass, which becomes the _this variable inside the code block. Just like call, except mandatory for no reason.

#

[] or 0 is just what you put there to satisfy the game when you don't want to pass anything.

digital pulsar
#

execVM has alternative syntax without arguments array whereas spawn doesn't

#

i wonder why they made that decision

ivory vector
#

@little eagle Thanks for the help yesterday, didnt manage to get it perfect, but its looking clean πŸ˜„

rotund cypress
#

First semi-nice life tablet ive seen @ivory vector

#

Gj

north vortex
#

@spice kayak for me it did support the night stalker and i am playing argo so the llr it self cant be selected in the arsenal so i had to script it and i was asking because there is a thermal scope in the game

waxen tide
#
    {
        systemChat format ["%1", _x]; // [18827.1,16357,30.3428]
        _check1 = [_x,10,100,true] call Ivan_fnc_eval_position_cover;
        _check2 = [(_x vectorAdd [0,0,0.75]),10,100,true] call Ivan_fnc_eval_position_cover;
        _check3 = [(_x vectorAdd [0,0,1.5]),10,100,true] call Ivan_fnc_eval_position_cover;
        systemChat format ["%1", (_check1 + _check2 + _check3)];
        if ((_check1 + _check2 + _check3) isEqualTo [true,100,true,100,true,100]) then {_spawnPosASL pushBackUnique _x};
    } forEach _buildingPosASL;

Script Error:

_check1 |#|= [_x,10,100,true] call Ivan_fnc_eval_position_cover...'
Error Generic error in expression
ivory vector
#

@rotund cypress when I get the hang of this fading malarky, im making another one xD

#

Dialogs arent my thing

little eagle
#

@waxen tide post Ivan_fnc_eval_position_cover

#

It probably reports the assignment operator.

waxen tide
#

so you're saying the syntax there looks alright?

#

@little eagle ```sqf
params [
["_centerposASL", [], [[0],[0],[0]]],
["_hprecision", false, [true, false]],
["_abort", true, [true,false]]
];

private ["_checkposASL","_object","_check1","_check2","_ceiling","_result"];

systemChat "eval_pos_cov";

little eagle
#

What is that?

waxen tide
#

Ivan_fnc_eval_position_cover

#

well

#

thinking about it, a return value might help

little eagle
#

If this is Ivan_fnc_eval_position_cover then

_check2 = [(_x vectorAdd [0,0,0.75]),10,100,true] call Ivan_fnc_eval_position_cover;

should not error.

#

Unless you took out something.

waxen tide
#

i commented everything else out

little eagle
#

Post it all.

waxen tide
little eagle
#

Hmm, idk.

#

but

#
_check1 |#|= [_x,10,100,true] call Ivan_fnc_eval_position_cover...'
Error Generic error in expression

Can easily reproduced:

#
_a = {
    _b = 1;
};

_c = call _a
#

So my guess is, that you had this function have an assignment as last operator at some point.

tame portal
#

@waxen tide Does your method return something correctly?

waxen tide
#

not yet

tame portal
#

I don't really know how it behaves in that case but if you do _check1 = [] call blubb; blubb would need to return atleast nil

#

I don't think it automatically assigns nil if nothing is returned

little eagle
#

You can end your function with systemChat or any other command that reports nil just fine.

#

Except an assignment.

#

=

tame portal
#

makes sense

little eagle
#

Not really. It's a bug in SQF.

waxen tide
#

okay i added "false" as last line in my function and now it works fine

little eagle
#

It's the only reason I know of to cause |#|= as error message.

waxen tide
#

i commented lots of code out to narrow down my issues and removed the return value

little eagle
#

Post what you had when it errored.

waxen tide
#

i did?

little eagle
#

Don't think it errors that way. Try again. Probably forgot to save a file.

#

If

_check2 = call Ivan_fnc_circle_check;

for example was the last line, then calling this function and assigning it's return value would error.

#

But not with:

systemChat "eval_pos_cov";
waxen tide
#

i can't replicate it

little eagle
#

Just add
_bah = 1;
as last line

#

That will reproduce the issue

waxen tide
#

it indeed does

little eagle
#

Yes. Never end a function with an assignment if you want it get approved by me.

waxen tide
#

uhm, what does arma do with sqf /* code

little eagle
#

?

waxen tide
#

well if you write code after a /* but forget the */

little eagle
#

The comment would go to the end of the file.

waxen tide
#

well i'm sorry i can't replace exactly what happened.

#

but i didn't forget to safe, i hammer STRG+S all the time even in the editor console because its a habit

little eagle
#

Then you maybe misremembered.

#

Memory is bad.

waxen tide
#

maybe!

#

thanks for the help, the |#|= stuff is useful to know

little eagle
#

The only way to make sure is to reproduce. I can reproduce it. You can't : )

waxen tide
#

?

little eagle
#

Reproduce the error.

#

It works with what I said. But not with ... systemChat.

#

Therefore you must've made a mistake or misremember.

waxen tide
#

well i chained 5 functions in a row and i've made some changes in 3 of them and i'm not always perfectly sure where to start.

little eagle
#

It would be easier if the game didn't give such vague directions.

waxen tide
#

possibly.

little eagle
#

Or this particular thing didn't error for no reason in the first place...

waxen tide
#

well obviously i changed something i forgot about

#

but you have to believe me, i would never hide something from you commy2.

little eagle
#

This is the work around btw, in case you need to execute and store the return value of a unknown function:

_func = {
    _b = 1;
};

//_a = call _func;                  errors! 
_a = [nil] apply _func select 0;
queen cargo
#

apply creates a new array right?

little eagle
#

Yes.

waxen tide
#

thanks!

little eagle
#
_a = [];
_b = [_a] apply {_x} select 0;
_b pushBack 1;
_a // [1]

But the array-element inside the array is still the same.

waxen tide
#

function calls are scheduled, right?

little eagle
#

What do you mean?

waxen tide
#

if i call the function it is executed in scheduled enviroment?

little eagle
#

If you call a function from scheduled environment, then the function will also be executed in scheduled environment. too
If you call a function from unscheduled environment, then the function will also be executed in unscheduled environment too.

waxen tide
#

i see, that makes a lot of sense

#

i was also wondering what happens when i call a script in scheduled environment that takes a long time to complete, say 10 seconds. From what i read i would expect the scheduler to allocate 3ms per frame to it until it is done, and also schedule other scripts on each frame in parallel. so basically it only delays other scripts slightly, but should not ruin performance?

little eagle
#

The more scripts you run the more performance it will cost. Scheduler only helps in theory.

waxen tide
#

i see

little eagle
#

Also I'd be worried if my script takes 10 seconds. That could easily be minutes on a slow machine and in MP.

waxen tide
#

well i was planning to run that script only on the server

#

also the 10 seconds were a result of combining too many checks (reduced them meanwhile) an error i made that lead to some unnecessary duplications, and spawning 1000+ 3d objects for debugging what i'm actually doing in 3d space.

#

i was just wondering what would happen if a script would be optimised and working fine and still running for 10s

little eagle
#

It would take forever to complete on my machine and take away time from all other scripts I guess.

tough abyss
#

you can move mountains in 10s

#

what kind of check could you do that take 10s

waxen tide
#
  • bugs
tough abyss
#

oh boy

#

what is that for?

waxen tide
#

structural integrity check.

little eagle
#

That looks very pretty

waxen tide
#

i want to spawn AI that certainly can't be spotted from outside by players

#

so i need to check for windows, doors,

#

i've made it multistage by now

little eagle
#

Is this a once at mission start function?

tough abyss
#

couldn't you precalculate all the buildings and save the objectSpace positions

waxen tide
#

first check for ceiling, then north,south,east,west, then take the bounding box of the first object found and use its size as new max check length, and then re-do on 3 different heights with 8 checks in a circle. abort if anything fails.

#

@tough abyss i was planning on implementing that

tough abyss
#

πŸ‘

little eagle
#

You could cache the results in the servers profile namespace...

waxen tide
#

that sounds like magic

#

the nicest thing would be to save lookup tables as a file automatically. if the detected map is unknown, run the checks, but else use a table

#

but i think i would need some kind of extension on the server for that

little eagle
#

If you cache it, you have the benefits of both and don't need to worry about updates if you discard the cache if the map version changed.

waxen tide
#

but i still need to run the script on mission start?

#

like, each time

little eagle
#

Once per map and server.

waxen tide
#

?

#

ohhhh

#

ohhhh

#

the server has a profile

#

i see

#

is that your magic trick for today already?

little eagle
#

Nah.

waxen tide
#

i've also written a script that greps cfg for all interesting map locations. i'll cache that too

waxen tide
#

disabling the debug markers was a horrible idea.

#

actually it wasn't.

waxen tide
#

now that seems highly acceptable to me

still forum
#

It's totally not :U 39ms is a decade...

waxen tide
#

for a script that runs once on server start?

still forum
#

205 :u suffocates

waxen tide
#

Do you play with enabled debug markers, Dedmen?

little eagle
#

dedmen, it's once per mission.

still forum
#

negative still suffocates

waxen tide
#

can i use script commands to restart the server?

little eagle
#

Post the code, so we can take it apart 🍿

still forum
#

you can use serverCommand to #restart

#

I guess that works

waxen tide
#

can i lock the server with a script to deny players joining?

still forum
#

you can use serverCommand to #lock

waxen tide
#

excellent. so if there is no lookup table for the map, i lock the server, create one, and restart.

#

@little eagle you want every file a single pastebin or all i none?

still forum
#

At best everything in a Github repository that allows Pullrequests

waxen tide
#

jeez you guys.

indigo snow
#

everything ISO standard commented as well

still forum
#

I was not joking actually...
There is an ISO standard for comments?

indigo snow
#

i always start off with the assumption there is one

little eagle
#

Whatever ISO says is stupid 90% of the time.

#

The other 10 are common sense.

indigo snow
#

but they have numbers for your resume

#

back on topic: i always like the debug orbs

#

makes debugging feel real fancy

little eagle
#

They also look pretty.

waxen tide
#

+1