#arma3_scripting

1 messages ยท Page 277 of 1

little eagle
#

he should just use more variables

#

it's all hashes internally anyway. not like you slow down anything with more of them

tough abyss
#

But my solution would be slow?

#

And expensive?

little eagle
#

it would be faster if he didn't store nested arrays

finite mica
#

Is there a way to get the x and y coordinates from somethign when teh map is open without UI handlers?

tough abyss
#

What would be better for example?

little eagle
#

no need to walk them. can let that be handled with hashmaps

tough abyss
#

getVariable set variable?

#

It worked Quiksilver

#

Only problem it wouldn't work in Unscheduled

#
tripleNested = [  
    [  
        [01,02,03],  
        [04,05,06],  
        [07,08,09],  
        [10,11,12]  
    ],  
    [  
        [13,14,15],  
        [16,17,18],  
        [19,20,21],  
        [22,23,24]  
    ]  
];
fn_iterativeDeepSearch = {   
params [   
["_toFind",0],  
["_finalRet",0],  
["_i",0],  
["_j",0]];
hint format ["%1",_toFind];        
for [{_i=0}, {_i<count(tripleNested)}, {_i=_i+1}] do  { 
  ret = (tripleNested select _i);   
   for [{_j=0}, {_j<count(ret)}, {_j=_j+1}] do  { 
    subRet = (ret select _j);   
    finalRet = subRet find _toFind;     
     };   
  };  
 finalRet;     
}; 
 [05] call fn_iterativeDeepSearch;
#

Well you could do a recursive solution.

little eagle
#

could probably use forEach instead of for

tough abyss
#

fn_name = { [_x] call fnc_name };

#

I knew what the inner most data was.

#

It was able to match and find it

#

only issue was after the code finished the variables become undefined

#

unlikely in a "real" programming language

#

what I posted would have been completely valid.

#

I know was testing the possibility it was related to that.

#

but no it wasn't.

#

Yeah I did that.

little eagle
#

step 1

tough abyss
#

I still complained at this

little eagle
#

some things can be assumed...

#

also

#

why not just forEach

#

?

tough abyss
#

Would forEach not be more expensive?

little eagle
#

no

#

why?

tough abyss
#

Thats why I always avoided forEach

#

because I thought it would be more expensive?

#

Yeah I also read on the wiki

#

you can re-assign the innermost _x = _newX

#

So they don't conflict.

#

Nah I just give it a boolean

little eagle
#

count is playing with fire though. I remember when they added a return value to pushBack when it had none before...

dusk sage
#

just stick a boolean there

little eagle
#

forEach should still be faster than for. especially since you don't need the _x = _a select _i; line

dusk sage
#

Whenever you use count, just stick a boolean there, no need to think about it

little eagle
#

while that does look ugly, it's probably faster than droping a true or nil

dusk sage
#

need all those nano seconds

little eagle
#

the assignment I mean

#

well

dusk sage
#

๐Ÿ˜„

little eagle
#

SQF

#

I think it only does with that JIP parameter

dusk sage
#

remoteExec in a count loop

#

D:

little eagle
#

yeah. why

dusk sage
#
{
    [] remoteExec ["xxx", _x];
} count [player1, player2, player3];
#

kappa

little eagle
#

great variable names though

#

yeah. tag your globals

#

and don't number them

#

grr

dusk sage
#

did you miss the kappa?

#

kappa

little eagle
#

at least it's tagged ยฏ_(ใƒ„)_/ยฏ

#

well, except for the underscore. gotta save those bytes

tough abyss
#

@MrSanchez#5319 just a important note, deleteAt also works like pushBack and set.

dusk sage
#

๐Ÿค” ?

tough abyss
#
tripleNested = [  
    [  
        [01,02,03],  
        [04,05,06],  
        [07,08,09],  
        [10,11,12]  
    ],  
    [  
        [13,14,15],  
        [16,17,18],  
        [19,20,21],  
        [22,23,24]  
    ]  
];
fn_iterativeDeepSearch = { 
params ["_ret"];  
 {  
 _outerX = _x;  
  {   
   innerX = _x; 
   _ret = innerX find toFind;
  } count _outerX;   
  true 
 } count tripleNested;
_ret;  
}; 
ret = [5] call fn_iterativeDeepSearch;
#

Refuses to work in non-scheduled

little eagle
#

error message?

tough abyss
#

Nope

#

None

#

When I set ret to a global variable

#

It rets the index

#

and value

#
tripleNested = [  
    [  
        [01,02,03],  
        [04,05,06],  
        [07,08,09],  
        [10,11,12]  
    ],  
    [  
        [13,14,15],  
        [16,17,18],  
        [19,20,21],  
        [22,23,24]  
    ]  
];
fn_iterativeDeepSearch = {  
params ["_toFind","_innerX","_outerX"];   
 {   
 private _outerX = _x;   
  {    
   private _innerX = _x;  
   private _ret = _innerX find _toFind; 
   true 
  } count _outerX;    
  true  
 } count tripleNested; 
_ret;   
};  
 ret = [12] call fn_iterativeDeepSearch;
#

Nope just doesn't return _ret at all

#

yet when changed to global variables it works

little eagle
#

I don't understand how that function works though

#

seems to me like it constantly overwrites _ret

#

and at the end just returns -1

#

most likely scenario

tough abyss
#

Okay to ensure _x is not over written

#

I assign _x to unique variable

#

On the innermost scope

#

it simply returns the nested array

little eagle
#

no, _ret is constantly overwritten

tough abyss
#

?

little eagle
#

it's just set the the latest result of find

tough abyss
#

What should I do instead?

little eagle
#

exit when _ret happens to not be -1

#

also

#

private _ret = _innerX find _toFind;

#

means _ret is only defined in that inner scope

tough abyss
#

Thanks commy

#

I see now.

#
tripleNested = [  
    [  
        [01,02,03],  
        [04,05,06],  
        [07,08,09],  
        [10,11,12]  
    ],  
    [  
        [13,14,15],  
        [16,17,18],  
        [19,20,21],  
        [22,23,24]  
    ]  
];
fn_iterativeDeepSearch = {   
params ["_toFind",["_innerX",0],["_outerX",0],["_ret",0]];    
 {    
 private _outerX = _x;    
  {     
   private _innerX = _x;   
   _ret = _innerX find _toFind;  
   true  
  } count _outerX;     
  true   
 } count tripleNested;  
_ret;    
};   
 ret = [18] call fn_iterativeDeepSearch;
#

Only problem now is _ret is defined

#

but find isn't returning the index.

little eagle
#
tripleNested = [
    [
        [01,02,03],
        [04,05,06],
        [07,08,09],
        [10,11,12]
    ],
    [
        [13,14,15],
        [16,17,18],
        [19,20,21],
        [22,23,24]
    ]
];

fn_iterativeDeepSearch = {
    params ["_haystack", "_needle"];

    scopeName "search_main";

    {
        private _index0 = _forEachIndex;

        {
            private _index1 = _forEachIndex;
            private _index2 = _x find _needle;

            if (_index2 != -1) then {
                [_index0, _index1, _index2] breakOut "search_main";
            };
        } forEach _x;
    } forEach _haystack;

    [] // default
};

ret = [tripleNested, 12] call fn_iterativeDeepSearch;
#

this would report [0,3,2]

#

or it should, untested

#

forgot a number, fixed

tough abyss
#

@tough abyss thanks a lot but i don't understand what is this code for. Everything is working at the best now, may be you is going further in the question and i sadlly can't go along, to complicated for me.

#

ProfileNameSpace is saved when you close the game or the server?

tough abyss
#

gg I crashed arma 3 with a recursive function

#

derp

deft zealot
#

Are there commands to set the font size and/or style of a control in SQF? e.g. ctrlSetSizeEx and/or ctrlSetStyle...
I guess there is no command for the style cause its defined in the config of the contols class which leads me to the question: is there a predefined class for right aligned text? e.g. RscTextRight?

#

Workaround would be a RscStructuredText but i am looking for other possibilities

tough abyss
#

Yes

#

They're an ID number

#

#define ST_RIGHT 0x01

#

@deft zealot

meager granite
#

@deft zealot You can write simple script which will scan config for classes with needed parameters to be used with ctrlCreate

meager granite
#

@little eagle @tough abyss Here's my attempt at recursive search, supports any depth:

tripleNested = [
    [
        [01,02,03],
        [04,05,06],
        [07,08,09],
        [10,11,12]
    ],
    [
        [13,14,15],
        [16,17,18],
        [19,20,21],
        [22,23,24]
    ]
];


deepSearch = {
    private _needle = _this select 1;
    private _path = [];

    (_this select 0) call deepSearchRecursive;

    reverse _path;

    _path
};

deepSearchRecursive = {
    {
        if(
            _x isEqualTo _needle ||
            _x isEqualType _path && {_x call deepSearchRecursive}
        ) exitWith {
            _path pushBack _forEachIndex;

            true;
        };

        false;
    } forEach _this;
};

[tripleNested, 12] call deepSearch;
meager granite
#

3 times slower though, [0.07,10000] vs [0.0268,10000]

#

but universal with any depth and data type

tough abyss
#

@meager granite Yeah iterative solutions are often faster.

#

Even in the real programming world

halcyon crypt
#

This is a very big project I am undertaking lots of sponsors involved.
Now when I get a sponsor
Sounds like the typical "Hey, want to get rich?" kind of idiot... ๐Ÿค”

#

@open vigil / @graceful pewter

open vigil
#

@tough abyss that's not how it works around here.

#

Marcel, I've DM'd him.

halcyon crypt
#

ok just thought it's kind of not done ๐Ÿ˜›

open vigil
#

It's not

rotund cypress
#

@deft zealot you could use something with structured text. Then just do ctrlsetstructuredtext and then do the styles in t element

#

Or whatever

thin pine
#

@tough abyss saveProfileNamespace

graceful pewter
#

@marceldev89#4565 best bet if u need me is to pm me if you can

finite mica
#

So, about dialogs

#

Where can I find an up to date defines.hpp with all the controls in it?

#

When I use th gui editor and put a combo box, ingame it never appears.

finite mica
#

Thanks but both commands dont work.

#

When I try ctrl p it throws an error saying gui_styles.hpp not found

polar folio
#

hm. are you on dev branch? maybe they broke it

finite mica
#

No, I am on stable

polar folio
#

i don't know, i haven't tested it but those posts are very recent and there are no complaints or disclaimers there

finite mica
#

[] call BIS_fnc_exportGUIBaseClasses;

#

this appears to work, it created a clip paste of 4000+ lines

polar folio
#

well there you go then

young current
#

Excellent! just what I needed too! Thanks guys

finite mica
#

Thanks for the hint

#

ARMA3 dialogue coding, for when you are bored with triggers and scripts!

#

Or when your day is not frustrating enough!

#

I find dialogue code very frustrating but teh rewards are amazing when it works out.

#

When using the GUI editor, and creating a new control from the list, it directly reads from available and defined classes and therefore should match up with my exported defiens?

#

I am confused with this page:

#

the second half of the page has an "example".

#

Is that example something I put into the defines? or use directly as is in my dialog?

jade abyss
#

Dialogs are pretty simple, just time consuming as hell

polar folio
#

it's an example of how your combo class could look like. probably taken from moricky's templates with a bunch of debug for the EHs which is nice if you are new to this.

#

so, afaik, this one has all the entries to be able to work as a base class that you can inherit all your actual combo boxes from.

finite mica
#

How would I use the example? Paste it into a dialog?

polar folio
#

if you lack basic knowledge of it, then it'S always good to get a working example and start by modifying it, unless you find an uptodate step by step tutorial

#

moricky ftw

finite mica
#

I have used the basic dialogs but shyed away from the complicated oens so far, this template looks amazing.

finite mica
#

If I want to split up my description.ext, can I use any file ending I want or does it have to be .hpp?

meager granite
#

anything

jade abyss
#

.*pp is just affiliated with Config Files

tough abyss
#

When using the Killed event handler, how would you check if the killer is in a vehicle and get the gunner that killed them?

#

Currently checking it in the editor, but figured I would ask here as well.

#

I'm sure there are easier ways, but you can track getIn and out of vehicles

#

instigator: Object - Person who pulled the trigger```
#

May be helpful...

#

Checking returned values now

jade abyss
#

Yep

tough abyss
#

Works nicely, makes my job easier.

jade abyss
#

Yep

tough abyss
#

The new addition to the killed EH works perfectly. Tested in lots of different conditions. Thanks!

#

@MrSanchez#5319 but you know if it is saved when you close the server process?

tough abyss
#

@everyone Would anyone be willing to be my Dev for my Life server, we doing Tanoa Life which means you must have Apex. Please DM me, I really need the help.

jade abyss
#

... ... ...

tough abyss
#

@tough abyss How about no?

#

life servers are a cancer that need to be removed before it metastasizes like a maliginent growth to stop it spreading to all systemetlc parts

#

Thats you opinion, but im trying to make a server for my people ,

#

Thats nice. Keep playing the get rich quick off other peoples work. How about instead you go get a job?

dusk sage
#

Stop generalising!

tough abyss
#

It's TRUE!

#

Altis Life is cancer

dusk sage
#

No, some people may be, but you can't generalise, we went through this. You have people that let the team down everywhere

tough abyss
#

@jade abyss You ever dealt with the ORBAT module?

#

Can all cfg Class types?

#

be included?

#
class cfgRespawnInventory { 
#include "Mission Framework\shared\CfgRespawnInventory.hpp"
}; 
dusk sage
#

You can include like that yeah

tough abyss
#
class CfgORBAT
{
    class 1stPlatoon 
    {
        id = 1;
        idType = 0; 
        side = "west";
        size = "Platoon";
        type = "HQ";
        insignia = "\ca\missions_f\data\orbat\7thInfantry_ca.paa";
        commander = " Mr Cmdr";
        commanderRank = "General";
        text = "%1 %2 %3";
        textShort = "%1 PC %3";
        tags[] = {BIS,USArmy,Kerry,Hutchison,Larkin};
        color[] = {1,0,0,1};
        description = "All of your text would go here.";
        assets[] = {{B_Heli_Transport_03_F,5},{B_Heli_Light_01_F,3},{B_Heli_Light_01_armed_F,4},B_Heli_Transport_01_camo_F};
         
               // When 'subordinates' are missing, child classes will be used. They can have their own subs - number of tiers is not limited.
        class 1stBCT
        {
            id = 1;
            type = "Armored";
            size = "BCT";
            side = "West";
            commander = "Cmdr";
            tags[] = {"BLUFOR", "USArmy","Kerry"};
         };
    };
};
#

Any reason it's not showing up?

#

Even when directly included

#

in the description.ext

#

Wonder if the strat map needs to be open first.

#

Hmmm.

#

Looks at BI config

tough abyss
#

Grrr

#

Why are you being a pain cfgORBAT.hpp

#

It's the exact same SYNTAX as the BI one...

#

WHY....

#

facedesk

#

You know @dusk sage ArmA 3 is more frustrating than it needs to be...

#

Not even a useful error to say whats wrong

#

I believe I've identified the problem

#

the function being used to retrive the config file is broken

thin pine
#

Sometimes ArmA gives you free candy. Other times it screws you right in the ass. It's a love-hate relationship

tough abyss
#

Yes...

#

The ORBAT module is broken by the way.

#

It attempts to use BIS_fnc_retriveMissionClass or whatever it is

#

It attempts to use BIS_fnc_retriveMissionClass or whatever it is

#

and fails

tough abyss
#

sign SQF is an aweful language.

#

i wish it was lua

#

kek

#

hell i would settle for C#

#

i wish SQF allowed the usage of dlls like in C# using Windows;

#

(it does but i mean like system dll's bnuilt in whatever)

rancid ruin
#

that would be a terrible idea

#

think of security

#

someone would write a mission that formats your hard drives before anyone wrote a "proper" mission

tough abyss
#

proper sandboxing. I've seen it done. Sure theres ways to get around it but is it really worth the time

#

i mean i guess it depends on your intentions but for the most part a sandbox properly made would be fine

tough abyss
#

dlls actually isn't stupid @rancid ruin

#

SpaceEngineers did it.

#

They use a sandboxed version of C#

#

Have most of the features of C#

#

And the code is performance capped

#

So bad code == bad consequences

#

worse than SQF

#

@tough abyss That what you meant?

#

By Sandboxing what SE does?

#

SQF would be a less aweful language IF everything WAS DOCUMENTED

#

Sandboxing meaning closed enviroment so you can't execute certain OS functions

#

or run anything malcious

#

Exactly what SE does

#

yep

#

Has a "NameSpace"

#

restriction they use to the inGame objects

#

exactly

#

ModAPI has less restricts but is still restricted to VRage .dlls

#

that don't interact with certain things such as the DX11 draw call system.

#

i would love sqf if it allowed it. easier to do lots of things then

#

Interesting question

#

if Intercept allowed direct access to SQF functions internally

#

Why not just build a native library that is within in game

#

and BI made it?

#

Making default into arma 3?

#

This would allow direct interface with C++

young current
#

theres key for it. might there be some sort of action for that

#

or find out what the key actually does

leaden summit
#

Is there a simple solution for allowing a player to destroy disabled friendly vehicles out in the field in order to let them respawn, without them getting lit up by the base guards when they return?

willow pike
#

If the vehicle has no persons in it the base defense should not be angry

tough abyss
#

Ugh.

#

This orbat is a repeatitive headach

willow basin
#

Is there anything that would speak against a Client WebAPI? I know the most common way is to have the client contact the server, which then gets stuff via .dll from the database.. and I still go over the server (via private WebAPI, encrypted, but not via htmlLoad) for a bit more sensible data. For things that "may" are not even needed during the entire mission however, I decided to dynamically load the content only if needed via htmlLoad over my public WebAPI. I.e. for general stuff like job descriptions, mission data, etc. Works pretty well and the server is being left alone but is there anything I should take into consideration or is there any reason why this isn't common practice?

#

That way I can also work with caching more easily ^^

willow pike
#

@willow basin well I would love to do in that way my Community is against it. So the mission developers post to a mysql database I get it via php to my node.js application into a mongodb.

willow basin
#

@willow pike ah, great so nothing would speak against it. Thanks for the links but I made my own .dlls for that ^^

#

Can you tell me why your community is against it o.O? I only can see everyone profit from it.

willow pike
#

Well there is no real reason. I just gave up. They are happy that they can use extDb3 and I import the data for the WebApp and do over the webapp some changes to the mysql db (whitelisting)

harsh niche
#

@leaden summit Couldn't you add an Add Action to the vehicle? Something like a "Recycle" action to just delete the vehicle instead of destroying it? Not positive if that would trigger respawn though...

delicate lotus
#

Is looping a script to apply to all objects a add action useful?

young current
#

What would be best way to get ammo total from a specific turret on a vehicle?

little eagle
#

define "ammo total"

#

Is looping a script to apply to all objects a add action useful?
maybe

tough abyss
#

Anyone know what this means and why it is getting spammed in my RPT?
Unexpected context inside house

little eagle
#

No, but it sounds funny

young current
#

@little eagle aim is to show ammo/magazine count of given turrets on the gunner HUD, but I think I can manage now that I spotted magazinesTurret and couple of other commands I had not noticed. :9

leaden summit
#

Probably could I guess, but was hoping more for a "set a charge on the hunter before we abandon it" type of thing

thin pine
#

continues to scroll up to find what @leaden summit is on about

#

ah

leaden summit
#

Haha woops

thin pine
#

i am blind my bad

leaden summit
#

Nah man I had not scrolled through the new posts myself

thin pine
#

A really easy solution would be to completely disable the baseguards from >ever< shooting you. Would that work for you?

#

e.g. use player addrating 500000 at the beginning of the mission (e.g. init.sqf) and friendly AI will never start shooting you. That however also means you can shoot 20 friendly AI and they won't retaliate on you. (not sure why anyone would ever do this though)

jade abyss
thin pine
jade abyss
#

iirc it does
erm, not sure anymore

leaden summit
#

I did find a suggestion that I set the rating of all vehicles spawned at base to 0, but I couldn't seem to get that to work

thin pine
#

Looping through those vehicles to do that seems kinda useless if you can just addRating in init.sqf

#

@jade abyss Just tested, cos why not. Turns out you can't. Even after setting west setFriend [sideEnemy,1]; sideEnemy setfriend [west,1] the getFriend command still returns almost-0 and the AIs still attack ya

jade abyss
#

lol

#
*
west setFriend [east ,1];
east setfriend [west,1];

@thin pine ;D

thin pine
#

uhhm xD

#

Wang goes out and about and blows up a disabled friendly vehicle. This lowers his rating and his side is switched to the renegade side. that renegade side is sideEnemy......I don't think making west friendly to east will work but I can try it xD

jade abyss
#

It does

#

Intended to be used on mission start

thin pine
#

Naw that trick doesn't work ๐Ÿ˜› Even when that code is placed in init.sqf

jade abyss
#

You must be doing something pretty wrong oO

#

I used that while i was playing around with the AI for 2017mod

#

try it with an init.sqf

meager granite
#

Is there any reason for modelToWorld (and associated) commands to return Z above surface and not ground\water?

#

I mean does anything ever really use it

#

It feels like a bug/cluelessly added feature, eons ago

#

Maybe we can request this command to stop taking walkable surface into account and return proper AGL coordinate?

little eagle
#

modelToWorld uses AGL, so it is ground level

#

the only command that reports surface (highest pathway LOD) I know of is getPos and position

#

position, visiblePosition, getPos, getPosVisual

#

these four apparently

meager granite
#

modelToWorld does it as well

little eagle
#

no

#

it uses AGL

loud python
#

Quick question: is there any way to store a value locally to a unit?

#

a variable, on other words

loud python
#

exactly what I was looking for, thanks a lot ๐Ÿ˜ƒ

#

okay, here's another question

#

if I want to add an action to an object

#

on all clients that are playing and that join later on (JIP)

#

What's the best way of removing the action?

#

I'd have to 1) remove the addAction from the JIP queue and 2) remove the action on all clients, right?

little eagle
#

don't remove it, but use a public global variable boolean in the condition field of addAction

#

in my opinion

loud python
#

good idea

#

thanks again ๐Ÿ˜ƒ

#

by "public variable" do you just mean not local, or something else related to multiplayer?

little eagle
#

a global variable that exists on all machines and is set by the JIP quene

#

missionNamespace setVariable ["myTag_canUseAction", false, true];

#

then you can use myTag_canUseAction as condition in the condition field of addAction

loud python
#

missionNamespace tells the server to keep them synced?

little eagle
#

no, it just means it's a global variable

#

same as

#

myTag_canUseAction = false

loud python
#

aren't variables global by default?

little eagle
#

but synched on all machines

#

the third param of setVariable makes it synched on all machines including JIP ones

#

Variables are global if they don't start with an underscore

#

but don't confuse global variables with global effects

loud python
#

okay

#

so missionNamespace + setVariable allows me to keep variables synced

little eagle
#

yes

#

global variable just means that it exists in every scope of the local machine

loud python
#

then, do I need to run missionNamespace setVariable ... on the server only?

jade abyss
#
missionNamespace setVariable
[
     "VarName",
     DataInsideVarName,
     Bool(SyncedOverNetOrNotToAllClientsIncl.JIP (True/False)
];```
loud python
#

does it explode if it accidentally runs everywhere?

little eagle
#

but the global variable can take different values or be undefined on other machines

#

You should ideally only change it on the server

#

to avoid race conditions

loud python
#

but the global variable can take different values or be undefined on other machines only if I tell it to, right?

#

"Ideally" he... he... he...

little eagle
#

well imagine this

#

MyTag_variable = random 10;

#

in init.sqf

#

the global variable will exist on every machine

#

but it's different everywhere

loud python
#

okay I see

meager granite
#

I'm pretty sure modelToWorld does take surface height into z, I've experienced it a lot of times, trying to repro it

little eagle
#

please do

jade abyss
#

erm, don't think so @meager granite

#

Array - translated world position, format PositionAGL

little eagle
#
if (isServer) then {
    missionNamespace setVariable ["MyTag_variable", random 10, true];
};
loud python
#

Thanks for the help guys, this would have taken me at least 3 hours of reading to find out myself ๐Ÿ˜ƒ

little eagle
#

this would make the variable be defined everywherre and the same everywhere

jade abyss
#

@meager granite
Mtw take the center of the model, then add stuff to it

#

like: Center of Player = [0,0,0]

meager granite
#

I have icon displaying over dead player and I sometimes see it appear at ground level when body is inside high cargo tower

jade abyss
#

oO

meager granite
#
                _pos =     _body modelToWorld (_body selectionPosition "head")
                _pos set [2, (_pos select 2) + 0.5];

                _screen = worldToScreen _pos;
jade abyss
#

since it takes the center of the corpse (that might have fallen through the tower on the server or whatever arma does)

meager granite
#

This is how positions is determined, through modelToWorld and then UI element is displayed at worldToScreen position

jade abyss
#

Yeah, did it the same. Never had that Problem

little eagle
#

is the head selection still accurate after ragdoll though?

meager granite
#

it is, its fine everywhere except sometimes inside cargo tower

jade abyss
#

Wait Matra, i used the whole body, not the "head"

meager granite
#

x and y of position are clearly fine as icon is directly below body at ground level

jade abyss
#

What commy mentioned, prolly something wrong with the memPointSelection

meager granite
#

My only guess is that modelToWorld does take surface into z under some circumstances

little eagle
#

or worldToScreen I guess

jade abyss
#

hm

rotund cypress
#

Hey guys, I've done this _text ctrlSetStructuredText parseText "<t style='text-align: center; font: PuristaMedium; font-size: 14pt; color: #FFFFFF;'>Press</t> <t style='font: PuristaMedium; font-size: 14pt; color: #006196; text-align: center;'>[SPACE]</t> <t style='font: PuristaMedium; font-size: 14pt; text-align: center; color: #FFFFFF;'>to continue</t>"; to get blue in the middle [Space] but everything is just white. Do anyone see what im doing wrong?

meager granite
#

arma structured text is not html\css

little eagle
#

hmm. try composeText

#

I'm not sure you separate them with ;

meager granite
#

<t align="center" font="PuristaMedium" color="#ffffff">

#

You're trying to use html tags with css styles in arma

jade abyss
#

What i used for the Corpses:

        {
            if(_x isKindOf "Man")then
            {
                _Dist = (player distance _x);
                if(_Dist < 150)then
                {
                    _SideCheck = _x getVariable ["D41D_CorpseSide",Civilian];
                    if(_SideCheck == (side player))then
                    {
                        if( (_x getVariable ["D41D_DeadAndWaiting",[false,"12345"]]) select 0 )then
                        {
                            if(_Dist < 0.5)then{_Dist = 0.5};
                            _PosX = 2.25 + (_Dist/100);
                            _FontSize = 0.05 - ((_Dist/1000)*0.5);
                            _Transp = 0.8 - ((_Dist/1000)*1.5);
                            _Name = "";
                            if( (CVD41D_UI_ShowNames > diag_TickTime) && {_Dist < 50} )then{ _Name = (_x getVariable ["D41D_CorpseName",""]); };
                            drawIcon3D ["\a3\ui_f\data\Revive\revive_ca.paa", [0.8,0.2,0.2,_Transp], (_x modelToWorld [0, 0, 1.25]), 1, 1, 0, _Name, 2, _FontSize, "RobotoCondensed", "center", false];
                        };
                    };
                };
            };
        }forEach allDead;```
meager granite
#

body is on top of tower, icon is under it

jade abyss
#

Okay, interesting.

meager granite
#

Wish I had this myself so I can run modelToWorld against such problematic body to see what happens

jade abyss
#

My guess is still (agreeing with Commy on that):

(_body selectionPosition "head") <- that part screws it up

meager granite
#

What can it even return to screw it up?

#

[0,0,0] would result in just body position

jade abyss
#

Its Arma.

little eagle
#

ragdolls

jade abyss
#

Ragdolls different on every client.

meager granite
#

So you're assuming that head memory point could bug out to ground level?

jade abyss
#

No clue without further testing, but i never had that problem with the whole body itself.

#

Thats what i can tell from my side.

#

Couldn't image what else it could be

meager granite
#

Makes sense though in such cases that I remember body was always fine

smoky crane
#

Maybe modelToWorldVisual would work as intended.

tough abyss
#

How to make a agent shot a turret?

#

Like a fire command.

round scroll
tough abyss
#

@round scroll thanks!

young current
#

So could not figure out after all how to get ammocount on my turret weapons, magazineTurretAmmo command is broken with multiple same name magazines in different turrets. I could make different named magazines for the turret weapons but would like to avoid that.

young current
#

Ho!! Got magazineTurretAmmo working! ๐Ÿ˜„๐ŸŽ‰

vague harness
digital pulsar
#

Leader group player == player

#

That will work in sp and locally in mp

manic sigil
#

Trying to make a script for assigning High Command units, trying to figure out a way to phrase "If (in the array of High Command groups) "Team One" DOESN'T exist, then..."

#

I've got a variable for hcAllGroups Player, so the array list should be available, I'm just not sure how to bend it around an If Then statement.

#

if !{"Team One" in _Groups} returns the expected 'got code instead of bool' complaint.

#

if !("Team One" in _Groups) actually works, but skips straight to the else result.

tough abyss
#

Wrong syntax

#

if ( ) is valid

#

if { } is not

#

Okay so your groups variable doesn't contain "Team One" variable

#

@manic sigil

#

To test this.

#

Assign the _groups variable

#

to a global variable

#

and put the variable in the watchfield of your debug console

#

_Groups = globalGrps;

manic sigil
#

@tough abyss Yeah, got the syntax fixed in the second run. I'm trying >> if !("Team One" in hcAllGroups player) now, skipping the array to variable step I hope.

#

Or should I put it into a variable first?

#

Bluh, I'll just post code as a whole.

#

_Select = [];
if !("Team One" in hcAllGroups player) exitwith {hint "Team One Already Exists"};

_Select = groupSelectedUnits player;

_newGroup = createGroup WEST;
_Select join _newGroup;
player hcSetGroup [_newGroup,"Team One"];

tough abyss
#

Sounds like you haven't decomposed the script specifications enough.

manic sigil
#

Quite likely, I need to stop scripting at 2am.

manic sigil
#

Cleared up the errors, the function creates a group and reliably names it Team One... but I can't get the 'If Team One already exists, exit script" part working. To what I can tell, that group isn't registering in hcAllGroups array, which just returns blank after the first time, then starts listing off groups the more I run the script (B Alpha 1-3, etc)

#

And when I do get 'B Team One' to appear in the array, "B Team One" in _Groups doesn't return true apparently.

meager granite
#

Anyone has insight into how particle model preloading works? Say I need to guarantee that my drop command created spaceObject particle appears properly. Can I say spawn several particles with needed model outside of map on mission start to make sure game preloads the model and use it half hour later with drop command?

#

Can having outside of map particle source with huge\no interval outside of map help with preloading?

#

Anyone has experience?

jade abyss
#

What are you trying to achieve?

meager granite
#

I need to make sure that my single particle spawns through drop command when I need it

#

At the moment you have to call drop several times to make sure model preloads and then next drop commands will finally start creating the particle

#

basically drop command does nothing if spaceObject model is not preloaded yet

little eagle
#

createSimpleObject the particles model? I don't think there is any other way to preload objects without config changes.

meager granite
#

createSimpleObject might do for single particle

#

Gonna try and see if particle source that doesn't spawn anything will help with preloading

#

So yeah, apparently having particle source with setDropInterval 0 preloads needed particle model and keeps it preloaded

#

and I kinda solved my own problem while asking it

jade abyss
#

Erm, is simpleObject evern usable for particles? oO I would wonder if

meager granite
#

Well you kinda can simulate needed particle-like behavior

jade abyss
#

hm, meh. doesnt sound right

meager granite
#

Not a proper solution indeed

jade abyss
#

yeah

meager granite
#

Anyway, looks like #particlesource that doesn't spawn anything is the answer for preloading particles

little eagle
#

I just meant that you can use it to preload the particles model

#

not as a replacement

#

Don't know any other way to load / preload models without CfgVehicles config.

jade abyss
#

(still can't imagine a situation where its rly needed)

meager granite
#

I think entity models are preloaded separately from particles

#

For instance having full entity with some model and then trying to "drop" same model will work with preloading behavior that I explained above

jade abyss
#

I meant for the Particles.

little eagle
#

I think entity models are preloaded separately from particles
It's the same model though. If it works or not - no idea.

tough abyss
#

@meager granite If only there was a diag_activeParticleSources ๐Ÿ˜›

native hemlock
tough abyss
#

@native hemlock Do you know where you set the cfgAISkill.hpp

#

?

#

Goes or works?

native hemlock
#

Are you trying to ask if it can be defined in a description.ext or if it has to be in a config?

tough abyss
#

Wanting to know where it's defined?

#

It says it's in cfgAISkills

#

Which is in ArmA3Profiles

#

but not quite sure.

dim owl
#

hey how can i attach a object on projectile with fired EVH ? i tried to just create the object and attach it but that doesnt work

#

nvm found it ^^

tough abyss
#

i wonder, can you attach a parachute to a bullet?

meager granite
#

@tough abyss allMissionObjects "#particlesource"

dusk sage
#

can you please use paste/hastebin @dark shadow

#

Put the link in your first message / remove the code ๐Ÿ˜ƒ

dark shadow
#

Hello guys, i am trying to use Simple_Earplugs Script and it shoud be very easy to install. it states to copy the .sqf file into the scripts folder and to type in ""player execVM "scripts\simpleEP.sqf"; " into the init file.

When i try to execute the earplug in the game (left side mousewheel action), i get this error:
""Error undefined variable in expression: _C""

The simpleEP.sqf file code:
https://hastebin.com/ponumivizi.cpp

any idea?

tough abyss
#

Who loves obscure variables

#

in scripts.

#

-,....,-

#

I'll fix it so it's easy to use.

#

2 seconds just refactoring variables

dark shadow
#

Hello GeekyGuy, thanks BoGuu just came back with an answer ๐Ÿ˜„

tough abyss
#

It works?

dark shadow
#

yes, what he has done was taking the _c variable out entirely

tough abyss
#

Me personally I'd get rid of the obscure variables, and rename them something more sensible.

dark shadow
#

and it seems to work now

#

YES, you see i have spent HOURS yeasterday trying to figure this out (and as you can tell, i dont know anything about coding) hahah so, a simpler way might have made it easier for me to understand

tough abyss
#

What did boguu give you?

dark shadow
tough abyss
#

Still obscure ๐Ÿ˜›

dark shadow
#

hahah yes it is

tough abyss
#

maybe I should change it.

#

make it less obscure.

#

release it.

#

probably save people a lot of headache

#

And document it ๐Ÿ˜ƒ

#
interactEarplugsAction = ["<t color='#ffff33'>Put on ear plugs</t>",{
    _actionAssignedTo = _this select 1;
    _whoCalledAction = _this select 2;
        if (soundVolume == 1) then {
            1 fadeSound 0.5;
            _actionAssignedTo setUserActionText [_whoCalledAction,
                        "<t color='#ffff33'>Take off ear plugs</t>"]
        } else {
            1 fadeSound 1;
            _actionAssignedTo setUserActionText [_whoCalledAction,
                        "<t color='#ffff33'>Put on ear plugs</t>"]
    }
},[],-90,false,true,"",
"_target == vehicle player"];


_this addAction interactEarplugsAction;

_this addEventHandler ["Respawn",{
    params ["_playerUnit"];
        1 fadeSound 1;
        _playerUnit addAction interactEarplugsAction;
}];

@dark shadow

#

checks it works

dark shadow
thin pine
#

_whoCalledAction hehehe

tough abyss
#

Most people don't script for re-usability
that isn't bad is it @thin pine ? is it?

thin pine
#

For tutorial purposes it's a nice var name. For more common usage I'd go for _caller

#

But var names are preference anyway

tough abyss
#

And put a comment yeah.

#

_caller _player etc.

#

Then //comment explaining what is what //

thin pine
#

As long as it isn't a single letter or in a foreign language that isnt english it tends to be good

dusk sage
#

params!

tough abyss
#

๐Ÿ˜ƒ

#

I'd improve it further with.

#

Yay!

#

Variable obscurity gone

#

@dark shadow

#

self-documenting variable strings

dusk sage
#

== -> isEqualTo

tough abyss
#

๐Ÿ˜›

#

Is it actually faster?

#

vs == ?

dusk sage
#

yep

tough abyss
#

And more readable.

#

Hmmm might need to re-do all my scripts

dusk sage
#

its a drop in replacement for everything except string comparison

#

as it is case sensitive

#

_target == vehicle player

tough abyss
#

Can do that too?

dusk sage
#

ofc

tough abyss
#
_passedPlayerObj = _this; 
interactEarplugsAction = ["<t color='#ffff33'>Put on ear plugs</t>",{
    params ["_actionAssignedTo","_whoCalledAction"];
        if (soundVolume isEqualTo 1) then {
            1 fadeSound 0.5;
            _actionAssignedTo setUserActionText [_whoCalledAction,
                        "<t color='#ffff33'>Take off ear plugs</t>"]
        } else {
            1 fadeSound 1;
            _actionAssignedTo setUserActionText [_whoCalledAction,
                        "<t color='#ffff33'>Put on ear plugs</t>"]
    }
},[],-90,false,true,"",
"_target isEqualTo vehicle player"];


_passedPlayerObj addAction interactEarplugsAction;

_passedPlayerObj addEventHandler ["Respawn",{
    params ["_playerUnit"];
        1 fadeSound 1;
        _playerUnit addAction interactEarplugsAction;
}];
#

@dark shadow fully cleaned up and readable

#

for your enjoyment

dark shadow
#

now this i can understand ๐Ÿ˜‰

tough abyss
#

double checks for errors

#

Bad programming == obscure variables with no explanation

dusk sage
#

bad programming == broken code

tough abyss
#

^

#

All my stuffs highly modular.

#

Functions galore

#

I mean

#

You can take a massive test expression

#

and put it in a if ([] call myTag_fnc_myConditionalChk) then { };

#

instead of stringing together a giant if ( _cond1 || _cond2 && _cond3 || _cond4) then {};

#

and put those conditional checks inside their own function

#

Is it faster @dusk sage

#

?

dusk sage
#
if (true) then {
    if (true) then {
    };
};```
is faster than
```sqf
if (true && {true}) then {};

which is faster than

if (true && true) then {};
tough abyss
#

yeah but what if you wrapped it into a function?

#

Put the conditionals into like a function file

#

and return the condition?

dusk sage
#

sure, then you don't have to evaluate them all

#

but it would be cleaner to evaluate them step by step and exit if one fails

tough abyss
#

Thats actually cool

#
fnc_conditionalCheck =  { params ["_cond1","_cond2","_cond3"]; 
    _return = _cond1 || _cond2 && _cond3;
    _return;
};

if ([true,true,false] call fnc_conditionalCheck) then {
     hint "conidtional check was true"; 
} else {
     hint "conidtional check was false"; 
};
#
0.0067 ms for the [true,true,false] call fnc_conditionalCheck

and

#

compiling

#
0.0025 ms [true,false,true] call fnc_conditionalCheck;
#

Interesting

#

There is a difference between on-demand compiled code

#

Thats very wierd.

#

The first evaluation is slower than the next.

#

wth....

#

If you introduce a falsity

#

it takes near 0.0040ms longer

#

than with a true true true

#

Nope there is a definite difference between compiled code and non-compiled

dusk sage
#

use lazy eval. No bytecode in SQF, no

#

All code in ARMA is compiled

#

If you call the same file twice, compiling it twice will take longer

tough abyss
#

Okay so

#

This

#
newFunc = compile "{ params ['_cond1','_cond2','_cond3'];  
_return = _cond1 || _cond2 && _cond3; 
_return; 
};"

#

Executes faster

#

than this

#
fnc_conditionalCheck =  { params ["_cond1","_cond2","_cond3"]; 
_return = _cond1 || _cond2 && _cond3;
_return;
};

#

Why?

dusk sage
#

I would imagine you're including the compile in your checks

#

The compile will add time

#

Like asking

#

Why is

tough abyss
#

But there is a definite difference between the 2

dusk sage
#
test = compile "hint _this";
["test"] call test;
#

Slower than not compiling

#

It's because you have an extra step there

tough abyss
#

Nope it's the variable length

#

wow.

dusk sage
#

hm?

tough abyss
#

fnc_conditionalCheck is slower

#

than

#

newFunc

#

because of the length of the variable itself.

dusk sage
#

yes, because one is compiling

#

it's compiling during your time checks

#

which will make it slower

tough abyss
#

Ohhh so it compiles line by line?

#

where as

#

compiled

#

Compiles ALL the code?

#

So there is no line by line compiling overhead?

#

That right @dusk sage

#

?

dusk sage
#

Your two functions are inevitably the same, except you go through the step of compiling one of them

#

You're converting it to code, from string, during your time test, which will slow it down

tough abyss
#

But... the the compiled

#

is faster.

#

Not slower...

#

O_O

dusk sage
#

Oh right

#

What are your exact tests

tough abyss
#
fnc_conditionalCheck =  { params ["_cond1","_cond2","_cond3"]; 
_return = _cond1 || _cond2 && _cond3;
_return;
};
#

initial function called and executed

#

to register it

#

then register

#
newFunc = compile "{ params ['_cond1','_cond2','_cond3'];  
_return = _cond1 || _cond2 && _cond3; 
_return; 
};"
#

call the newFnc

#

new func is faster

#

than fnc_conditionalCheck

dusk sage
#

So in both you are placing one of those functions, then calling it?

tough abyss
#

By an entire 0.0040 ms

#

Using the code performance button

#

after executing it yes

#

So these 2 tests

#
[true,false,true] call fnc_conditionalCheck;

vs

[true,false,true] call newFnc;

NewFunc is faster by an entire 0.0040ms

dusk sage
#

and how many tests have you done for this?

tough abyss
#

Several now.

#

Changed the variable size

#

changed the input parameters

#

Results keep coming back the same.

#

scratches head

#

I'm going to purist test this now.

#

I'll make the funcs the exact same length

#

in text

#

and exact same instructions

dusk sage
#

And if you stuck newFnc & fnc_conditionalCheck in watch fields

#

Are they equal?

tough abyss
#

testing now

#

2 functions same variable length

#

This is also MP

#

and executing it local does not change the time difference

#

clean restart

#

2 functions

#

fnc_condA

#

fnc_condB

#

same variable length

#

same inputs

#

[true,false,true]

#

Results.

#
0.0058 ms fnc_condA 
fnc_condA =  { params ["_cond1","_cond2","_cond3"]; 
_return = _cond1 || _cond2 && _cond3;
_return;
};
[true,false,true] call fnc_condB;
0.0057 ms
fnc_condB = compile " 
params ['_cond1','_cond2','_cond3']; 
_return = _cond1 || _cond2 && _cond3;
_return;
"
#

Lets change the input parameters

#

see what happens

#

0.0057 ms fnc_condA

dusk sage
#

wait

#

why are you calling one

#

but not the other

tough abyss
#

Sorry I did call

dusk sage
#

Oh right

#

So the same result then

tough abyss
#

pretty close.

#

There is still a slight discrepency

dusk sage
#

100 nanoseconds means nothing in ARMA

tough abyss
#

With the compiled one.

dusk sage
#

There is many factors to consider

tough abyss
#

Yeah.

#

Oh well wishful thinking of bytecode ๐Ÿ˜ฆ

dusk sage
#

I don't know the specifics on how SQF is handled, a dev would need to answer that

#

But it's not bytecode

tough abyss
#

Not sure why they wouldn't implement a bytecode to be honest.

#

it would be a lot faster.

jade abyss
#

Magic.

digital pulsar
#

Some vector calculations done by engine

#

Myeah its looping

#

I would imagine there is some lazy evaluation to get decent performance

#

Add like a 1000 of them and see what framerate u get

little eagle
#

The actions do a 15 meter check anyway

#

The distance parameter probably just modifies that number

floral geyser
#

Can anyone help me with setting up file patching on my server so I can load unpacked serverside code into the server.

polar folio
#

there's a channel called server_admins. probably better to ask there

tough abyss
#

it's literally one of the first results

floral geyser
#

@tough abyss I know how to enable it, but it doesn't load the code.

jade abyss
#

a3Server/@MyAddonFolder/Addons/FolderXYZ/init.qsf

Now you just load it with -mod=@MyAddonFolder

floral geyser
#

ok will try, thanks

leaden knoll
#

Hi everyone. I have a script which passes global variables between clients. What is best:
publicVariable PV_1;
or
missionNamespace setVariable ["PV_1", _PV_Local];
What is the difference between them? I also later whant to recall them. Can I just use PV_1 in my script or do I now first need to:
missionNamespace getVariable "PV_1";

jade abyss
#

To make it global (incl. JIP)
missionNamespace setVariable ["PV_1", true,TRUE];

On Client
hint str (missionNamespace getVariable "PV_1"); (Result: "true" in hintbox)

(added: Can't remember if a simple hint str PV_1; would also work on Clientside, you might have to test it out)

rotund cypress
#

If I wanted to use getText from CfgVehicles to get the Classname of the vehicle, what would that be called?

#

I.e. _vehicleName = getText ( _x >> "classname" );

indigo snow
#

... you'd already have the classname in order to access its config, do you maybe mean the displayName?

dusk sage
#

yeh it will @jade abyss

rotund cypress
#

This is what I mean @indigo snow ```// -- Load vehicles into variable
private _mcfVehicles = missionConfigFile >> "CfgVehicles";

// -- Purge Listbox
lbClear _listbox;

{

// -- Get vehicle class name
private _vehicleName = getText ( _x >> "classname" );

// -- Get vehicle picture
private _vehiclePicture = getText ( _x >> "picture")

// -- Add all vehicles
_listBox lbAdd _x;

// -- Set Picutre
_listBox lbSetPicture _vehiclePicture;

_listbox lbSetData [ ( lbSize _listbox )-1, _vehicleName ];

} forEach _mcfVehicles;```

indigo snow
#

so you want an array containing all child classes of cfgVehicles? what you have right now will plain not work.

rotund cypress
#

I want to get all vehicles in CfgVehicles

indigo snow
#

private _mcfVehicles = "getNumber (_x >> 'scope') == 2" configClasses (configFile >> "CfgVehicles"); would return an array with all the config classes in cfgVehicles with a scope of 2

#

then configName <CONFIG ENTRY> would return the config name of a specific config entry

#

which you then cann access through configFile >> "cfgVehicles" >> vehicleConfigName

rotund cypress
#

What does the 'scope' do?

indigo snow
#

only config entries with a scope of >= 1 can actually be created

#

else youd try to add stuff like the base classes

rotund cypress
#

Ah alright

indigo snow
#

youd still have to filter out a lot of stuff, best to filter by the simulation type

#

all units, backpacks, etc also have entries in cfgVehicles

#

buildings and objects too

rotund cypress
#

What do you mean by this configFile >> "cfgVehicles" >> vehicleConfigName?

indigo snow
#

vehicleConfigName is just a random variable name I used

#

it would contain the configName of the current entry

rotund cypress
#

So you mean something like this ? ```// -- Load vehicles into variable
private _mcfVehicles = "getNumber (_x >> 'scope') isEqualTo 2" configClasses ( configFile >> "CfgVehicles" );

// -- Purge Listbox
lbClear _listbox;

{

// -- Get vehicle class name
private _vehicleName = ( configFile >> "cfgVehicles" >> _vehicleClassName );

// -- Add all vehicles
_listBox lbAdd _x;

_listbox lbSetData [ ( lbSize _listbox )-1, _vehicleName ];

} forEach _mcfVehicles;

indigo snow
#

private _vehicleName = ( configFile >> "cfgVehicles" >> _vehicleClassName ); no

#

you need to define _vehicleClassName there first

rotund cypress
#

so then basically i could use _x then?

#

Since _x is defined by the foreach loop

indigo snow
#

yes, but you can't just plonk _x in there

#

since _x is already the config path to the vehicle

rotund cypress
#

So how would I use _x then?

indigo snow
#

You'd use configName to get the classname of the vehicle as a string I'd imagine

rotund cypress
#

So basically like this then ```// -- Load vehicles into variable
private _mcfVehicles = "getNumber ( _x >> 'scope' ) isEqualTo 2" configClasses ( configFile >> "CfgVehicles" );

// -- Purge Listbox
lbClear _listbox;

{

// -- Get vehicle class name
private _vehicleName = configName _x;

// -- Add all vehicles
_listBox lbAdd _x;

_listbox lbSetData [ ( lbSize _listbox )-1, _vehicleName ];

} forEach _mcfVehicles;```

indigo snow
#

now your _vehicleName is correct, but it will break at this

_listBox lbAdd _x;
#

look at what types lbAdd accepts on the wiki

rotund cypress
#

Ok so that wont be a string

#

So I need to get the displayName

#

which is displayName I assume?

indigo snow
#

its the displayName property of the vehicle class in cfgVehicles, yes

rotund cypress
#

So ```// -- Load vehicles into variable
private _mcfVehicles = "getNumber ( _x >> 'scope' ) isEqualTo 2" configClasses ( configFile >> "CfgVehicles" );

// -- Purge Listbox
lbClear _listbox;

{

// -- Get vehicle class name
private _vehicleClassName = configName _x;

private _vehicleDisplayName = ( missionConfigFile >> "CfgVehicles" >> _x );

// -- Add all vehicles
_listBox lbAdd _vehicleDisplayName;

_listbox lbSetData [ ( lbSize _listbox )-1, _vehicleClassName ];

} forEach _mcfVehicles;```

indigo snow
#

private _vehicleDisplayName = ( missionConfigFile >> "CfgVehicles" >> _x ); no

what is _x here?

rotund cypress
#

loop of _mcfVehicles

#

so ye that wont work

#

but then I dont know

meager granite
#

getText(_x >> "displayName") ?

rotund cypress
#

I'll try that

indigo snow
#

also wait one sec I see you use missionConfigFile vs configFile, is this intentional? do you have a defined cfgVehicles in your description.ext?

rotund cypress
#

naaah

#

Ye

#

So it needs to be from default arma vehicles

#

Not my own

#

So I changed _mcfVehicles ```// -- Load vehicles into variable
private _mcfVehicles = "getNumber ( _x >> 'scope' ) isEqualTo 2" configClasses ( missionConfigFile >> "CfgVehicles" );

// -- Purge Listbox
lbClear _listbox;

{

// -- Get vehicle class name
private _vehicleClassName = configName _x;

private _vehicleDisplayName = getText ( _x >> "displayName" );

// -- Add all vehicles
_listBox lbAdd _vehicleDisplayName;

_listbox lbSetData [ ( lbSize _listbox )-1, _vehicleClassName ];

} forEach _mcfVehicles;

// -- Define Button to Spawn Vehicle
private _buttonSpawn = _display displayCtrl IDC_RscDisplayVehicles_ButtonSpawn;

// -- Add action on button click for spawn button
_buttonSpawn ctrlAddEventHandler [ "onButtonClick", {

// -- Get Selected Vehicle
private _selectedVehicle = lbData [ IDC_RscDisplayVehicles_ListVehicles, lbCurSel ( IDC_RscDisplayVehicles_ListVehicles ) ];

// -- Create Vehicle at Position of Player
private _vehicle = _selectedVehicle createVehicle position player;

} ];```

#

from configFile to missionConfigFile instead

#

Maybe that will do it

indigo snow
#

no please you need to use configFile please look up the commands on the wiki

#

you need to understand configs more

rotund cypress
#

So it doesn't matter? It will still load vehicles from default ArmA configs and not defined ones in description.ext?

indigo snow
#

you can't define vehicles mission side, you need to use configFile

rotund cypress
#

Got a bit confused by your comment also wait one sec I see you use missionConfigFile vs configFile, is this intentional? do you have a defined cfgVehicles in your description.ext?

indigo snow
#

And I was confused by you using missionConfigFile consistently so I was trying to make sure there wasnt any wierdness going on

#

it's fine tho, just use configFile consistently

rotund cypress
#

Alright

#

Yeah missionConfigFile would be description.ext ๐Ÿคฃ

#

not configClasses lulz

loud python
#

Any idea how I can convince AI to jump out of a flying helicopter?

meager granite
#

moveOut

loud python
#

nothing that works with waypoints?

little eagle
#

moveOut works with waypoints, mate

#

they have a script field for a reason

loud python
#

correction: nothing that works with JUST waypoints?

little eagle
#

it's really not that complicated

#

{ if (_x != driver _x) then {moveOut _x}; } forEach thisList;

#

on Act.

rotund cypress
#

@little eagle why not !(_x isEqualTo driver _x) ?

little eagle
#

Because it doesn't matter

rotund cypress
#

isEqualTo is faster, no?

little eagle
#

So? It doesn't matter if you save a millisecond once in a mission

rotund cypress
#

No, but why not if it's faster

little eagle
#

It isn't. They are about the same, because the difference is too small to matter.

#

I mean.

#

Sure.

#

But if you wanted to save performance

#

You wouldn't use waypoints or triggers in the first place

#

So

rotund cypress
#

I guess

little eagle
#

It's not like this is a loop that runs every second

#

fire and forget code

indigo snow
#

why foreach and not count

#

my milliseconds

rotund cypress
#

I didn't think of that but I'll change to count

indigo snow
#

๐Ÿ™ƒ

rotund cypress
#

Does forEach and count work basically the same?

#

So you can use the exact same stuff in there?

indigo snow
#

Just use forEach

rotund cypress
#

So it's not the same?

little eagle
#

If they were the same, then there would be no point in having them both

rotund cypress
#

I know they're not exactly the same

little eagle
#

Then ask: "How are they different"

rotund cypress
#

But if I made a forEach that worked, would I be able to change it to count and it still being compatible?

little eagle
#

Not necessarily

rotund cypress
#

And how are they different?

little eagle
#

Good question

#

I could answer this, but then I get sniped again.

rotund cypress
#

Sniped? From what I read they're used to count i.e. a string which cant be done with foreach?

little eagle
#

Sniped

#

I would make the perfect answer pointing out all differences, but 3 other people throw in their ideas and the chat becomes a mess

#

As usual

#

lol

rotund cypress
#

So?

little eagle
#

forEach has _forEachIndex

#

CODE count doesn't

#

CODE count expects a nil or boolean return value of the code block

#

otherwise it errors

#

CODE count reports the number of times the code block reported true

#

forEach reports the return value of the last iteration through the code block

#

that's basically it

rotund cypress
#

Oh ok

little eagle
#

CODE count is also different from count, which does not iterate through a code block like a loop and has therefore nothing to do with this at all

#

CODE count is marginally faster, because it does not increment the _forEachIndex thing

#

Still waiting for the day they add _countIndex and this discussion dies once and for all

indigo snow
#

theyll also add a _currentCount and suddenly everyone uses forEach to count stuff

little eagle
#

I'd laugh

#

Oh, really annoying fact.

#

CODE count errors when the code block reports that null pointer type of nil

#

It has to be GameValueNil and not a GameValue with null pointer

#

{
nil animate ["", 0];
} count [0];

#

^ this errors

rotund cypress
#

Btw, to get an icon from config file, would that be icon or picture?

#

I.e. private _vehicleDisplayIcon = getText ( _x >> "icon" );

#

I couldn't find what it was when looking at the config

little eagle
#

check the ingame config viewer, Sim

rotund cypress
#

I did

little eagle
#

Uhm, and?

rotund cypress
#

Oh yeah its picture

#

Didnt find it before

#

Do I need to do str like here _listbox lbSetData [ ( lbSize _listbox )-1, str ( _vehicleClassName ) ]; or no because it should already be a string when doing this private _vehicleClassName = configName _x; right?

little eagle
#

all you do by adding the str to a string is adding more quote marks

rotund cypress
#

ah ye ok

little eagle
#

also get rid of these useless parenthesis

#

ffs

#

(ignore me)

rotund cypress
#

wait what?

#

Also, when doing lbSetPicture, it would be _control lbSetPicture [_x, _picture] right?

#

Cause when I did 0 only the first one got a picture

little eagle
#

_listbox lbSetData [lbSize _listbox - 1, str _vehicleClassName];

rotund cypress
#

Alright

little eagle
#

idk tbh

#

SQF already has so many brackets

#

But people love their parenthesis

#

I'll never understand that mindset

#

All they do is make things more complicated

rotund cypress
#

Well in this case, they did nothing but in some cases they are pretty good for readability

little eagle
#

No

rotund cypress
#

Well I think that at least

#

for example if ( !( player isEqualTo player ) )

#

and not just if ( !player isequalto player )

little eagle
#

well, the second one is wrong

#

also

#

player isEqualTo player

#

:S

rotund cypress
#

Its only an example ๐Ÿ˜„

little eagle
#

It's a bad one

#

:Q___

rotund cypress
#

But you see what I mean atleast?

little eagle
#

You don't like:

#

if !(player isEqualTo player)

rotund cypress
#

That is okay

little eagle
#

Then use it, because that is how I'd do it

rotund cypress
#
private _listbox = _display displayCtrl IDC_RscDisplayVehicles_ListVehicles;

// -- Load vehicles into variable
private _mcfVehicles = "getNumber ( _x >> 'scope' ) isEqualTo 2" configClasses ( configFile >> "CfgVehicles" );

// -- Purge Listbox
lbClear _listbox;

{

    // -- Get vehicle class name
    private _vehicleClassName = configName _x;

    private _vehicleDisplayName = getText ( _x >> "displayName" );

    private _vehicleDisplayPicture = getText ( _x >> "picture" );

    // -- Add all vehicles
    _listbox lbAdd _vehicleDisplayName;

    // -- Set picture for each vehicle
    _listbox lbSetPicture [ lbSize _listbox -1, _vehicleDisplayPicture ];

    // -- Set listbox data to be used later
    _listbox lbSetData [ lbSize _listbox -1, _vehicleClassName ];

} forEach _mcfVehicles;

// -- Define Button to Spawn Vehicle
private _buttonSpawn = _display displayCtrl IDC_RscDisplayVehicles_ButtonSpawn;

// -- Add action on button click for spawn button
_buttonSpawn ctrlAddEventHandler [ "onButtonClick", {

    // -- Get Selected Vehicle
    private _selectedVehicle = lbData [ IDC_RscDisplayVehicles_ListVehicles, lbCurSel ( IDC_RscDisplayVehicles_ListVehicles ) ];

    // -- Create Vehicle at Position of Player
    private _vehicle = _selectedVehicle createVehicle position player;

} ];```
#

It shows everything alright

#

Only thing is, it doesnt spawn and it when opening the menu it says picturelogic not found

#

When I had _listbox lbSetPicture [ 0, _vehicleDisplayPicture ]; it looped through all images to the top list item

#

I tried putting -1 or _x but didnt work

little eagle
#

Not every line needs a comment, mate. Especially when the comment for lbSetPicture is "Set picture ...".

#

Or are programmers paid per line?

rotund cypress
#

It's just how I write my code

#

Do I need to call compile on the string?

#

so call compile _selectedVehicle?

little eagle
#

no

#

string is string

rotund cypress
#

What do you think im doing wrong for it not to spawn?

little eagle
#

idk, add diag_logs and systemchats to debug that bitch

rotund cypress
#

Alright ill do that

#

And you have no idea of why this wouldnt work? _listbox lbSetPicture [ lbSize _listbox -1, _vehicleDisplayPicture ];

#

Oh shit it actually works lol

#

It was just some stuff didnt have pictures lol

little eagle
#

should add a default picture for that case then

rotund cypress
#

How would I do that?

little eagle
#

just check if the picture is ""

#

and oerwrite the variable with a default picture path

rotund cypress
#

oh yeah

#

and also

#

this is quite weird

#

It spawns some stuff

rotund cypress
#

If I wanted to list only a certain types of vehicles, what would be the best way to do that?

#

Actually found a way

tough abyss
#

Certain classes?

#

or certain types?

#

Better description, certain catagories?

#

isKindOf will give you the ability to filter

#

vehicles of Air,Sea,land etc.

#

@rotund cypress

#

Hey @meager granite explain to me why the reverse works in this?

#

deepSearch = {
    private _needle = _this select 1;
    private _path = [];

    (_this select 0) call deepSearchRecursive;

    reverse _path; <---- This line ?

    _path
};

deepSearchRecursive = {
    {
        if(
            _x isEqualTo _needle ||
            _x isEqualType _path && {_x call deepSearchRecursive}
        ) exitWith {
            _path pushBack _forEachIndex;

            true;
        };

        false;
    } forEach _this;
};

[tripleNested, 12] call deepSearch;
(edited)
rotund cypress
#

Ok I found a way to do it

#

Only problem I have now is that I can't spawn vehicles because it says can not spawn Non AI vehicles

#

I guess it's because im trying to spawn weapons using createvehicle but hmm

tough abyss
#

Requires a weapon holder

rotund cypress
#

Is it the same with clothes and stuff?

tough abyss
#

Likely

#

Why do you look on the forum?

#

To double check your problem wasn't already solved?

#

weapon1 = "groundweaponHolder" createVehicle position gunrack1; weapon1 addweaponcargo ["srifle_EBR_F", 10];

#

exactly what I said

#

it's s screwy hack.

rotund cypress
#

I checked but didn't find what I was looking for

#

But ill try that

tough abyss
#

GroundWeaponHolder is basically an invisible container

#

Which makes a lot of sense.

rotund cypress
#

I know it is

tough abyss
#

Because most of the interaction, with stuff on the ground is just like interacting with a container'

willow pike
#

What is currently the nicest way of finding strings in an array and remove them ?

#

I have two arrays and I want to have all the elements that are not in one of them.

tough abyss
#

find?

#

@willow pike

willow pike
#

well sometimes bi methods are not the best. ๐Ÿ˜„

tough abyss
#

?

#

What do you mean?

willow pike
#

sometimes there is room for improvement

#

using cba functions for example.

#

_neededaddons = [
"a3_ui_f", "a3_structures_f_mil_helipads", "a3_modules_f", "a3_characters_f", "a3_data_f_exp_a_virtual", "a3_modules_f_curator_curator", "ace_advanced_ballistics", "ace_hearing", "ace_interaction", "ace_map", "ace_microdagr", "ace_finger", "ace_respawn", "ace_explosives", "ace_advanced_throwing", "ace_advanced_fatigue", "ace_cargo", "ace_repair", "ace_refuel", "ace_rearm", "task_force_radio_items", "ace_medical", "ace_medical_menu", "a3_structures_f_mil_fortification", "ace_logistics_wirecutter", "ace_concertina_wire", "cup_cabuildings_misc", "a3_signs_f", "a3_structures_f_mil_bagfence", "a3_boat_f_boat_transport_01", "cup_camisc", "rhs_us_a2_airimport", "ace_compat_rhs_usf3", "rhsusf_vehicles", "a3_soft_f_exp_lsv_01", "rhsusf_c_statics", "a3_structures_f_mil_cargo", "rhsusf_c_melb", "rhsusf_c_m1a2", "rhsusf_c_ch53", "a3_structures_f_system", "cup_misc_e_config", "a3_structures_f_mil_shelters", "a3_weapons_f_ammoboxes", "a3_structures_f_mil_flags", "a3_structures_f_walls", "rhsusf_c_hemtt_a4", "rhsusf_c_troops", "a3_soft_f_quadbike_01", "cup_cwa_misc", "a3_structures_f_heli_items_airport", "rhs_c_weapons", "rhsusf_c_f22", "rhs_us_a2port_armor", "cup_castructuresland_nav_boathouse", "rhsusf_c_markvsoc", "a3_boat_f_exp_boat_transport_02", "a3_structures_f_naval_buoys", "a3_structures_f_naval_piers", "rhsusf_c_fmtv", "a3_armor_f_beta_apc_tracked_01", "ace_realisticnames", "ace_weather"
];
_missingaddons = [];
{
if (activatedAddons find _x == -1) then {
_missingaddons pushBack _x;
};
} forEach _neededaddons;

tough abyss
#

You could do a binary search.

#

sort the array then do a binary search.

#

using find

willow pike
#

I am building my own missing addons system right now so people can join in and can get an explenation what is going on

tough abyss
#

then exiting with.

#

Why do this anyway?

#

Thats a lot of elements in an array to iterate over.

willow pike
#

it is but I want them to see what addons they are missing when joining our server.

#

Get teamspeak info

#

we have like 20 - 30 connects each hour that go missing because they do not have any info.

#

So we remove the required addons from mission sqm

#

but it in sqf and work from there

tough abyss
#

As I said binary search

#

You could also use a pseduo-hashtable

#

BIS_fnc_addPairs

#

Basically a dictionary.

#

forEach is a linear search.

peak plover
#

Any new tricks to running missions with higher frame rates like enableEnvironment false; ?

tough abyss
#

The impact of the environment from what I noticed is minimal

peak plover
#

I got the gold edition, it comes with a constant loop of {deleteVehicle _x} count alldead;

tough abyss
#

@tough abyss One thing I like about Python

#

I can compare "C" > "F"

#

Binary search very easy.

#

Whoa

#

It might work

#

isEqualTo can compare strings

#

Can it compare 2 different strings hmm

meager granite
#

I wish we had case-insensitive find to cut on toLower'ing everything beforehand

meager granite
#

yes i do

#

show me your code

#

I'd call it findCI

#
shared_func_unflipVehicle = {
    _z = getPosATL _this select 2;
    _this setVectorUp surfaceNormal getPosWorld _this;
    if(local _this) then {
        _pos = getPosATL _this;
        _pos set [2, _z - (boundingCenter _this select 2)];
        _this setPosATL _pos;
    };
};
#

here is my code if you want to use it

#

execute on all clients & server

#

everywhere, yes

#

as you can see it does setPosATL only on local while just fliping it everywhere as setVectorUp is local

#

No, it works 100% of the time

#

On any height or sloped ground

#

boundingCenter manipulations are needed to prevent vehicle from jumping up\down during flipping

#

you probably can execute it only where vehicle is local too

#

center differs from vehicle to vehicle a lot

#

will cause issues at some point

polar folio
#

is it possible to terminate the threads shown in diag_activeSQFScripts somehow?

meager granite
#

no, I think it doesn't give you script handles on purpose

#

for security reasons

polar folio
#

k thx for swift answer

little eagle
#

I nominate this for the worst variable name ever used:
_onoff

#

It's a number between 0 and 0.95

little eagle
#

Just think about it though

#

Imagine if that was a boolean. I mean it basically is since it's either 0 or 0.95

#

It's basically named _truefalse

loud python
#

Has anybody else ever dealt with (nato) helicopters simply refusing to land?

#

I've had this happen a lot, but I never found a way to fix it

#

this time the mission depends on it though

digital pulsar
#

do u use helipads?

tough abyss
#

I'm trying to make the Light Wood Smoke Small but the model "\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d" is missing.

#

Anyone can help?

polar folio
#

both path and screenshot next to the example suggest that it's from arma 1 ๐Ÿ˜‰

little eagle
#

It's a wiki. You or anyone else can fix it.

tough abyss
#

@polar folio @little eagle thanks!

little eagle
#

I was searching for something similar, but there isn't anything in A3. Sorry

bleak schooner
#

does anyone knows a WORKING taser script (non altis life) and a restarin script which works in MP?

polar folio
#

random stuff from the config as an example "\A3\data_f\ParticleEffects\Universal\Universal", 16, 7, 48, 1

#

above page will tell you what the numbers are

tough abyss
polar folio
#

"the parameter seens to be the same from Arma 1"

almost. if you look closely you see that arma 3 has one more behind the model path. not sure if i'm mixing something up here but i mean by comparing both wiki pages. the page i linked you defo works. i used it several times before

little eagle
#

I was searching the AllInOne config for 1.66

#

But the only "smoke.p3d" there is cloudletMissile="A3\data_f\missileSmoke.p3d";

tough abyss
#

@polar folio thanks. It's not worked, will try to add the missing number.

polar folio
#

arma uses a single atlas texture/model for most particles

tough abyss
#

its the loop or not to loop parameter

polar folio
#

it's all explained on that link i provided

#

it's like a sprite sheet, if that explains it better

tough abyss
#

i'm reading it all

polar folio
#

the numbers define which of the parts of it are used and how many and stuff

#

so that way you can have a single billboard that has an animated texture on it using those squares as frames. you'll see when you experiment wtih some settings

tough abyss
#

Thanks!

tough abyss
#

@meager granite Is it worth implementing a binary search algorithm in arma 3?

#

Or is it more costly computationally than simplely array find x ?

tough abyss
#

what is the selection name of a turret barrel?

#
    "otochlaven",
    "bolt",
    "magazine",
    "bullet008",
    "bullet001",
    "bullet002",
    "bullet003",
    "bullet004",
    "bullet005",
    "bullet006",
    "bullet007",
    "zasleh",
    "proxy:\a3\data_f\proxies\muzzle_flash\mf_machinegun_mk30.001",
    "recoil",
    "otochlaven_shake",
    "proxy:\a3\data_f\proxies\gunner_standup01\gunner.001",
    "camo1",
    "camo2",
    "zbytek"```
earnest coral
#

Anyone knows how to server side you missions file

tough abyss
#

Yes and no.

#

Look at how Altis Life does it.

#

You have to resort to message passing if you do.

#

Which means server-side data has to be remoteExec'd

#

to get to a client

#

which generates more traffic overhead, from the actual remoteExec of the functions / data

earnest coral
#

Okay, but how do i actualy make it server sided then

tough abyss
#

cfgPatches

earnest coral
#

You know any side with like a tutorial on that?