#arma3_scripting

1 messages · Page 375 of 1

little eagle
#

playerSide reports what side you picked in the lobby and therefore works independently from you having an avatar or not.

subtle ore
#

condition (Optional): String - script code that must return true for the action to be shown. Special variables passed to the script code are _target (object to which action is attached to) and _this (caller/executing person). Default value: "true"

#

instead of those nasty if statements.

little eagle
#

I wish the wiki had an example with all the (default) parameters so you could copy paste them.

hollow bay
#

How do I produce a script that makes if (side player == west) then {car1 addAction ["Impound Vehicle", {deleteVehicle car1}];};

#

dynamic for all vehicles?

little eagle
#

It only has examples with like the first 3 parameters.

subtle ore
#

drops to floor in defeat

little eagle
#

Don't you have to be 16 to play this game or something like that?

subtle ore
#

Hey Commy, you like examples? Hop in on in ,we got candy too!

#

Maybe.

little eagle
#

playerSide defaults to west for JIP players early on during initialization regardless of their side.
I hate this game.

hollow bay
#

@little eagle Im learning how to script, I am actually 16 :p

lone glade
#

just use postInit.... oh wait

hollow bay
#

Sorry for facepalming you

little eagle
#

alganthe, one day

subtle ore
#
car1 addAction["Impound Vehicle",
{
    

},[],1.5,true,true,"","side _this isEqualTo west",15,false,""];
#

all default params

little eagle
#

lgtm, but maybe side group _this, because renegades.

subtle ore
#

🤔 Why? Just .... why.

little eagle
#

Renegades.

subtle ore
#

Yeah. Why, Commy.

little eagle
#

I said "maybe".

#

Better mention it than having people be confused later why it won't work.

subtle ore
#

Maybe BI should model the Enfusion AI to fit commy's overthinking layout.

lone glade
#

or the player side is just civ, since, you know, looks like it's for "life" stuff

subtle ore
#

no longer a state machine required

#

@lone glade Impound Vehicle 👀

little eagle
#

I hate FSM's ever since they taught me what they were.

subtle ore
#

I bet you tuck one under your pillow every night commy

#

admit it

lone glade
#

arma FSMs are stupid

tough abyss
#

FSM is a lie

little eagle
#

Are we still talking about the sqf thing or about the noodle monster?

subtle ore
#

the latter preferably.

#

But that's just me 🤷

tough abyss
#

i think we're onto the noodle monster

subtle ore
#

This is quite revealing Commy, I bet you use execVM when no one is looking.

#

Scheduled ✔

tough abyss
#

🍿

little eagle
#

scheduler

subtle ore
#

👀

#

@tough abyss pass the popcorn please

lone glade
#

scheduler can go die in a fire, same for scheduled loading screens

tough abyss
#

sure 🤝

little eagle
#

Might as well use sqs.

tough abyss
#

no plz

lone glade
#

they do for startup logos

subtle ore
#

Thanks Cloud, 🍿 🍹

lone glade
#

and the first loading screen

subtle ore
#

wow what a jem, SQS

lone glade
#

it chokes on itself and ruins fps

little eagle
#

It does a bad job at it.

#

I think that was the idea originally though.

lone glade
#

they fucked it up

tough abyss
#

arma and fps? is it 2035 yet?

subtle ore
#

Hey Cloud, watch your mouth young man

tough abyss
#

sorry

lone glade
#

now if they could add back empty groups to the garbage manager that'd be nice, flagging for deletion is getting old, contrary would be better.

subtle ore
#

Doesn't it? 🤔

lone glade
#

riiiiiight

#

try to code ace in scheduled

#

now cry because your game crashed

subtle ore
#

Sort of reminds me of Xeno's domination in a3 comparibly to a2.

lone glade
#

advanced ballistics or medical in scheduled would be a fun comparison

subtle ore
#

hey just because you like your swirly icons at a blistering 2,000 fps doesn't mean it's okay alganthe

little eagle
#

It wouldn't work. But having it converted to scheduled by someone who has no idea what he's doing wouldn't work out either for that mission.

#

The idea is to have as little SQF run at any time. If you just do all the loops in unscheduled, you achieve nothing. But Quiksilver already said that he's not interested in honesty and is just trolling so w/e.

#

He can't stop himself. The worst kind of triggered troll there is.

lone glade
#

he's been like this for years

#

can't help it

subtle ore
#

The politics channel is even worse, but we don't speak of that here.

little eagle
#

I value honesty over a feigned politeness, so someone had to say it, Quiksilver.

lone glade
#

I have all channels muted except dev announcements, general chat and scripting

subtle ore
#

😏

#

@lone glade for the better.

rancid ruin
#

#arma3_terrain is worth checking sometimes, for cool shots of maps and to see some confused people

subtle ore
#

Or just a deposit of Bulldozer/TB crashes and control issues

lone glade
#

of all the tools we have bulldozer is quite good

subtle ore
#

Both are fairly entertaining

hollow bay
#

Is there a way in a init.sqf to do a addAction for all vehicles present in the mission?

rancid ruin
#

yes but it will cost you

little eagle
#

I like TexView or whatever it's called these days.

lone glade
#

yep, same

subtle ore
#

@hollow bay vehicles

#

TexView2 Commy, get it right

little eagle
#

It's real quick to open. A no bs tool.

lone glade
#

object builder can go die in a fire, enforce tools next to it are godlike

hollow bay
#

@subtle ore so just vehicles addAction etc etc... ?

subtle ore
#

Enforce is still using Oxygen 2 iirc

hollow bay
#

in the init?

little eagle
#

Is there a way in a init.sqf to do a addAction for all vehicles present in the mission?
Not without CBA there isn't.

hollow bay
#

I have CBA

little eagle
#

Good. wait

subtle ore
rancid ruin
#

vehicles probably returns an array of vehicles, then you can loop over that

subtle ore
#

jesus christ, way to pull the cba card so quickly

lone glade
#

because it's so gud

#

CBA EHs are super nice to have

little eagle
#
// init.sqf
["Car", "init", {
    params ["_car"];

    _car addAction [...];
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
subtle ore
#

Ewwwww.

little eagle
#

Well, maybe he wants to spawn cars mid mission?

#

Why not use this instead of reinventing the wheel every time. He already said he has it.

lone glade
#

what eew? also, no tag in that EH?

hollow bay
#

@little eagle Thanks 😄

subtle ore
#

Commy is just jealous

little eagle
#

Of what? Sorry I may have missed some messages while typing the script.

subtle ore
#

/s

little eagle
#

OK. The day BI adds entityCreated, I'll never use this function. Happy?

subtle ore
#

Deadlines Commy, we need the sarcasm tag stat.

#

Very happy commy.

hollow bay
#

but if i do```["Car", "init", {
params ["_car"];

_car addAction ["Impound Vehicle", {deleteVehicle _car}];};

}, nil, nil, true] call CBA_fnc_addClassEventHandler;``` wouldnt it delete all vehicles?

#

Or not

subtle ore
#

No

#

action needs to be executed to execute the code inside

little eagle
#

Change
{deleteVehicle car1}
to
{deleteVehicle (_this select 0)}

little eagle
#

So it deletes the vehicle the action is attached to.

rancid ruin
#

you guys are helping to make a life mod here and you didn't even know it

#

i can see the bigger picture

little eagle
#

I never said I have a problem with that.

lone glade
#

get them to use CBA > they drop life stuff

#

taps forehead

hollow bay
#

@little eagle for the WEST side only btw

#

how do I put that in the code?

rancid ruin
#

vehicle impound script by commy™ yours for just $9.99/month

hollow bay
#

😄

#

little eagle
#

Shit I really should ask for money for this.

hollow bay
#

@little eagle I love you

subtle ore
#

No, don't give him any money. He'll just start a monopoly

little eagle
#

monopoly
Everyone would flock to me for my mad sqf skillz?

subtle ore
#

All those untaxed transactions. oof

#

Yep, your madz skillz would attract all from far and wide

hollow bay
subtle ore
#

Your sister country Austria called, they want your SQF skills.

lone glade
#

just make sure all the headers are
made by commy2

subtle ore
#

That's all part of the package plan 1 aglanthe, number two requires no header names.

hollow bay
#

@little eagle Help me figure this out Ill paypal 5$

#

😉

astral tendon
#

```hint "put a sound" and ["safe","assigned",true] call BIS_fnc_taskSetState````

little eagle
#

_car addAction ["Impound Vehicle", {deleteVehicle _car}];};

lone glade
#

you wouldn't get the reference midnight 😄

astral tendon
#

what is the generic error?

subtle ore
#

@lone glade Fill me in kool kid

little eagle
#

_car addAction ["Impound Vehicle", {deleteVehicle _car}];};
Delete the }; at the end. Doesn't belong there.

lone glade
#

well, the and

#

put a semicolon

subtle ore
#

Wtf is that Roque

lone glade
#

AND / && are for condition blocks

astral tendon
#

stuff

little eagle
#

and and &&

lone glade
#

remove it and put a semicolon, there fixed

little eagle
#

comma*

subtle ore
#

coma

astral tendon
#

some one remember the key to make the editor swich back the keyboard configuration? this is driving me nuts

hollow bay
#

@little eagle Whats the exact code should I put in?

lone glade
#

that's a windows thing, it's switching between installed keyboard layouts

hollow bay
#
    params ["_car"];

    _car addAction ["Impound Vehicle", {deleteVehicle _car}];};
}, nil, nil, true] call CBA_fnc_addClassEventHandler;``` I have that but its not working.
lone glade
#

I changed it myself, but it should be shift alt or shift + something

little eagle
#

Change this line:

_car addAction ["Impound Vehicle", {deleteVehicle _car}];};

to

_car addAction ["Impound Vehicle", {deleteVehicle (_this select 0)}];
#

The }; at the end is too much.

hollow bay
#

Aight

#

in the init.sqf @little eagle right?

little eagle
#

Yes.

astral tendon
#

@lone glade you right, shift + alt

#

is there a way to change it?

hollow bay
#

@little eagle That is using cursorTarget no?

lone glade
#

yes, can't remember where tho

little eagle
#

No, (_this select 0) is always the object the action belongs to.

#

So it will always delete whatever car it was without having to add any names to it.

astral tendon
#

if you remember plz pm me

hollow bay
#

@little eagle ```["Car", "init", {
params ["_car"];

if (PlayerSide == west) then {_car addAction ["Impound Vehicle", {deleteVehicle (_this select 0)}}];
}, nil, nil, true] call CBA_fnc_addClassEventHandler;``` Ive added a little bit of something to it, will it work?

little eagle
#

I think so.

#

But no, the brackets are wrong

hollow bay
#

how do I set the brackets?

little eagle
#
if (PlayerSide == west) then {
    _car addAction ["Impound Vehicle", {deleteVehicle (_this select 0)}];
};
#

The then block brackets have to encapsulate the whole line.

#

```sqf
player addWeapon blah
```
For colored code.

subtle ore
#

Ewwwwwww...wtf.

#

Like, literally I just posted all the default params above, copy and pasting is pretty easy

little eagle
#

¯_(ツ)_/¯

hollow bay
#

@little eagle read dm

little eagle
#

I don't have a paypal (anymore) and I don't need it. But thanks.

rancid ruin
#

i'll take it

#

but my price is 2x what commy charges

little eagle
#

I do rich old women for my income tbqh.

rancid ruin
#

pimpin'

lone glade
#

ah! I knew it!

hollow bay
#

@little eagle why do i have 2 actions?

#

Thats odd

rancid ruin
#

one for each hand

lone glade
#

because you added it twice

hollow bay
#

No i didnt

#
    params ["_car"];

if (PlayerSide == west) then {
    _car addAction ["Impound Vehicle", {deleteVehicle (_this select 0)}];
};
}, nil, nil, true] call CBA_fnc_addClassEventHandler;```
lone glade
#

that's the EH, where do you call it

little eagle
#

Change the name to "Impound Vehicle 2" to make sure.

hollow bay
#

Okay

little eagle
#

If there's another one, but with the old name, then you must've forgotten it somewhere.

hollow bay
#

@little eagle Okay thats odd, I am using the exact mission folder and putting it in to my dedi... and it i did change it to Impound Vehicle 2 and im still getting 2 actions.

#

when i put it in my local desktop it only shows one

little eagle
#

They're both named Impound Vehicle 2, right?

hollow bay
#

Yes

#

@little eagle

little eagle
#
["Car", "init", {
    params ["_car"];

    if (playerSide == west && isNil {_car getVariable "commy_hasAction"}) then {
        _car setVariable ["commy_hasAction", true];
        _car addAction ["Impound Vehicle", {deleteVehicle (_this select 0)}];
    };
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
hollow bay
#

?

#

put that in?

rancid ruin
#

why's it called a class event handler if you gotta check each time whether it's had the EH added or not

little eagle
#

Yes.

#

race conditions.

#

Blame pabst. He made that retroactive flag. I'd just put it into preInit, but why explain the long way.

hollow bay
#

Thanks

#

It is fixed :d

#

@little eagle Sorry for being greedy, is there a way to delete the action under the condition player is not in a vehicle?

#

Delete the action if player is in a vehicle

#

@tough abyss Yup

little eagle
#
addAction ["action name", {

}, nil, 1.5, true, true, "", "_this in _target"];
#

This essentially.

#

Yeah, that'd work, especially now that you have to be inside the vehicle.

#

No need for cursorTarget

#

Guess the bad thing is that it checks to condition every frame.

#

"classname" addAction
if I had any say in this.

#

¯_(ツ)_/¯

#

I saw a video.

lone glade
#

4 years building enfusion*

little eagle
#

Access was indeed early.

lone glade
#

also animation blending

#

fucking finally

little eagle
#

The animation blending doesn't look too impressive, but maybe it feels better controlling the guy now. Can't really tell that from a video.

lone glade
#

I was more excited that they finally ditched the shitty system we have now in arma

rancid ruin
#

dayz modding could be cool as fuck once all the systems are in place

#

would be more suited for certain missions than arma, and vice versa, but i'm interested

#

probably yes, the game isn't fun yet but the tech is coming along

lone glade
#

well, let's check steam stats shall we?

#

it's quite good tbh

#

arma 3 is about 16K average

#

then don't buy it, have you seen the "buy" page on steam?

#

there's warnings absolutely everywhere

little eagle
#

Arma 3 way of early release was fine.

#

But who will play DayZ once it's actually 1.0 "finished".

#

By then all interest is lost.

tough abyss
#

Depends how much modding support / stable it is when they release the modding tools & server files (apparently during the beta sometime).

timber ridge
#

@tough abyss yeh, if modding allows proper reskinning etc., I'm sure many will be interested in playing a seasonal or just winter Chernarus. I think I would.

#

another thing - I'd like to them to release a completely new map and maybe incentivize its exploration by never providing a full detailed map to the player, so the player can only find cop-outs and even by collecting them all the map image will never be completed and you'll have to memorize some parts by yourself.

rancid ruin
#

i like that idea but someone would just put a web map up eventually and everyone would use that

timber ridge
#

that's true, having a web map in this case would bring lots of traffic to the website, but I guess some would just prefer to play it hardcore mode. I have a group of 4 people and we've talked this through and we'd very interested in playing on a map which is not 100% known and may never will be, if you don't "cheat"

#

it'd be an interesting experience to connect the drawn parts inbetween with what you've memorized yourself

astral tendon
#

can some one put a note on this page saying that the enginner cannot defuse explosives and only the explosiveSpecialist?

subtle ore
#

explosiveSpecialist required iirc

#

scratch that, engineers can defuse too

#

I added a note on there in case of confusion I guess

astral tendon
#

explosives not mines

subtle ore
#

yep,

#

either case

astral tendon
#

enginner cannot remove explosives like C4

subtle ore
#

Just tested it like 3 times over

#

C4.?

astral tendon
#

i am using RHS charge packs

subtle ore
#

There may be a bug of some sorts

#

because all of the vanilla ones work in reciprical

astral tendon
#

im gonna test this with vanila assets

subtle ore
#

explosiveSpecialists and engineers can defuses IEDs and Explosive charges like satchel charges and boudning mines

#

However

#

IEDS don't seem to be able to be defused by anyone

astral tendon
#

i tested it now

#

vanila sachel charges cannot be defused by enginners

subtle ore
#

just defused one

#

not sure what's up with your client

astral tendon
#

did you check if you dont got the two traits on?

#

this is how i did it

subtle ore
#

positive man

#

Err..

#

wtf

#

so without setting traits..

#

i can defuse

#

but if I force it to false

#

then it doesn't do anything

#

wtf

astral tendon
#

i put more images

subtle ore
#

@astral tendon Alright, thanks for that. i'll change the note.

astral tendon
#

maybe that sohuld get a ticket too, i dont think it is supouse to work that way.

subtle ore
#

@astral tendon Maybe, maybe not. But as it stands right now, only explosive specialists can defuse mines then

#

this is freaking wacky though man

#

default unit without any traits set inherit the abilities to defuse mines

#

but once you go to set them, then it seems to go all hay wire

astral tendon
#

yes, thats strange to me to, i would like to give a medic or other icon to the unit with a set of traits

#

like the machine gunner with a MG unit icon

#

but he keeps geting called rifleman

subtle ore
#

look at the ui_f pbo

#

oh wait, what are you talking about?

#

icons or names?

astral tendon
#

both

subtle ore
#

icons, look at the ui_f pbo, names set them in the playable unit's role description in the editor

astral tendon
#

to make they be called something else i need to borrow a unit from other team

subtle ore
#

what do you mean?

#

like the name tag that appears near the unit when looking at them?

astral tendon
#

yes

subtle ore
#

like (rifleman) . That's all config based

#

"displayName"

astral tendon
#

and that icon?

subtle ore
#

what icon?

#

post a imgur of it

astral tendon
#

the unit icon on the map

subtle ore
#

config based as well iirc, not too sure on that one

#

never really worked with the insides of those classes, but I know the name is reliant on displayName

astral tendon
#

did not find about that "displayName" on wiki

#

but i already find another work around, dont need to mind it.

still forum
#

@little eagle I tested replacing all ; with , doesn't do anything.
The instruction is essentially a "end of statement" That clears the stack afer each statement. For example after a call there is the returned variable on the stack. So to clear it it add's that clear instruction.
CODE blocks are strings&compiled code. Not just string. I could theoretically go into them.. But on Instruction level they are constants. same as strings, numbers n stuff. And if I recurse into them.. I can create endless recursion.
@icy raft Everything in SQF is by reference.
I was the one that told you it was by reference. I @tribal crane was the one that started arguing. That was about 2 weeks ago.. And I answered @hasty violet and not you ^^
found it.. 3 months ago.. That was really "a while ago"

jovial nebula
#

Hi all, does somebody know a method to grab relative position of a vehicle's wheel?

still forum
#

You can probably get the position of the hitpoint

cunning nebula
#

selectionPosition

But if you want to take the rotation of the wheel into account youll have to attachTo some helper object and then get a relative position from that.

jovial nebula
#

That's what I was looking for

#

Thank you both

waxen cosmos
#

Hi Chaps, tryna switch off certain types of lights by setting hit damage in the init, unfortunately I'm not quite understanding how to make the getAllHitPointsDamage arrray functional:

{
for "_i" from 0 to count getAllHitPointsDamage _x - 1 do
{
_x setHitIndex [_i, 0.97];
};
}
forEach
[
"Land_PortableLight_single_F",
"Land_PortableLight_double_F",
"PowerLines_Ssmall_base_F"
];

little eagle
#

getAllHitPointsDamage is fine. But you use this on classnames. setHitIndex requires OBJECT. So you need a nearestTerrainObjects somewhere in this.

cedar kindle
#

pretty sure you can just do setDamage instead of hitpoints?

still forum
waxen cosmos
#

With lights if you do SetDamage they fall over :/
I would use specifically setindex but I couldn't fit the hitareas in the CFG

cedar kindle
#

0.95 should have them stand up, turned off

#

setting it to 0 again will turn it back on

#

at least that worked for me once

modern snow
cedar kindle
#

the else needs curly braces

#

before the if

modern snow
#

can you explain it?

cedar kindle
#

on phone, but else { if ... then {}}

#

makes sense?

modern snow
#

ahh nice

#

thanks 😄

waxen cosmos
#

@cedar kindle {_x setDamage 0.95} forEach (allMissionObjects "Land_PortableLight_single_F"); Yea that did the trick & it looks like double lights are subs of single so bingo!

astral tendon
#

side player == ENEMY and (side player isEqualTo ENEMY) do not give any value

#

but (side player == sideEnemy) does

#

can some one put a anotation on that wiki page too?

cunning nebula
#

why would you expect a string to be equal to a side ?

cedar kindle
#

i mean. it does say that it's an example of what the strings looks like when used with format

lone glade
#

the side page specifically says to use format

#

or str

little eagle
#

The debug console should be changed to properly serialize this stuff.

waxen cosmos
#

I've probably got this all wrong, but I'm using my begginers logic sense. I'm trying to add a HoldAddAction to all generators across the map:
Would the magic variable _x follow through to the 'then' or doe's it stay within the if() ? If not would I need to use '(_this select 0) ?

{
if (_x isEqualTo "Land_Portable_generator_F") then
{[
_x,
"Pump Generator",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"(alive _target) && ((_this distance _target) < 3)",
"_caller distance _target < 3",
{},
{},
{execvm "Fncs_Ambient\LightSwitchOn.sqf"},
{},
[],
10,
6,
false,
false
] remoteExec ["BIS_fnc_holdActionAdd", -2, _x];}
forEach (allMissionObjects "Land_PortableLight_single_F");

little eagle
#

allMissionObjects won't list map placed objects, only mission placed objects. You need nearestTerrainObjects for this as I already told you.

#
{
    if (_x isEqualTo "Land_Portable_generator_F") then {
        [
            _x,
            "Pump Generator",
            "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
            "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
            "(alive _target) && ((_this distance _target) < 3)",
            "_caller distance _target < 3",
            {},
            {},
            {execvm "Fncs_Ambient\LightSwitchOn.sqf"},
            {},
            [],
            10,
            6,
            false,
            false
        ] remoteExec ["BIS_fnc_holdActionAdd", -2, _x];
    ????
} forEach (allMissionObjects "Land_PortableLight_single_F");

The indentation is really bad. Hard to read the code. Here it's fixed. As you can see, there's a missing closing bracket. Totally not functional.

#

allMissionObjects would report OBJECTs. OBJECT are never equal to STRING.

#

Dunno about BIS_fnc_holdActionAdd, but remoteExec in a loop with so many objects will probably cause lag whenever someone connects.

#

remoteExec wants a boolean as 3rd argument in the rhs array. You have OBJECT?

#

Pretty sure adding actions to map objects doesn't work anyway. Better off adding one to the player using cursorObject.

waxen cosmos
#

Ok Commy, That is a thought cursor object. Sorry the copy and pasting was a mare due to my added notes will endeavour to keep it clean. Thank you for the help, I'll test some more and let you know what works

hollow bay
#

@little eagle You should get paid for this

astral tendon
#

didJIP still checks true even if you already spawn and you are inside the game?

lone glade
#

it works as intended

#

as in, it returns true if the player wasn't present during the mission init

rotund cypress
#

I am pretty certain that allMissionObjects return all map objects, even ones placed by yourself. I could be wrong, but IIRC I used it for something that needed the latest objects. Nevertheless, the performance of it is baaad and is very expensive operation.

#

@little eagle

indigo snow
#

Returns all mission objects (created by or during a mission)

rotund cypress
#

Ye, what I thought.

indigo snow
#

thats not terrain objects then

rotund cypress
#

Ah you mean like that

hollow bay
#

for code ```js
["Car", "init", {
params ["_car"];

if (PlayerSide == west) then {
_car addAction ["Impound Vehicle 2", {deleteVehicle (_this select 0)}];
};
}, nil, 1.5, true, true, "", "_this in _target]; call CBA_fnc_addClassEventHandler;```

indigo snow
#

you can see the error by the colour

#

hint the end isnt supposed to be a string (green)

hollow bay
#

its missing ""

indigo snow
#

yea so add it?

hollow bay
#

where?

indigo snow
#

where its not supposed to be green anymore

hollow bay
#

oh shit

#
}, nil, 1.5, true, true, "", "_this in _target"]; call CBA_fnc_addClassEventHandler;```
indigo snow
#

yea annd remove the extra semicolon too

hollow bay
#

Fucked that up

indigo snow
#

thats fucking you up too

hollow bay
#
}, nil, 1.5, true, true, "", "_this in _target"] call CBA_fnc_addClassEventHandler;```
#

@indigo snow good?

indigo snow
#

looks good to me

hollow bay
#

thanks

#
["Car", "init", {
    params ["_car"];

if (PlayerSide == west) then {
    _car addAction ["Impound Vehicle 2", {deleteVehicle (_this select 0)}];
};
}, nil, 1.5, true, true, "", "_this in _target"] call CBA_fnc_addClassEventHandler;```
indigo snow
#

check if your input matches what the function needs

#

you currently give it string, string, code, any, number, bool, bool, string, string

lost iris
#

So i have this script https://pastebin.com/raw/zvWfV67J and i was wondering how can i spawn the selected item in the list box when i press the spawn on position button?

lone glade
#

use a selection changed EH

#

onLBSelChanged for configs LBSelChanged for sqf

lost iris
#

ok but , how can i spawn the selected item in the list box, im not sure how i would do this

lone glade
#

what do you mean by spawn, create the listbox entry or doing something once the listbox entry is selected ?

#

oh, that's pretty simple actually

lost iris
#

i mean spawn the vehicle that is selected

lone glade
lost iris
#

@lone glade im still pretty clue less, do you mind showing me how?

frank ruin
#

It says it can't find the following image

#

\a3\ui_f_data\gui\cfg\cursors\hc_unsel_gs.paa

#

But my path seems correct ..

#

Did I overlook something?

robust hollow
#

\a3\ui_f\data\gui\cfg\cursors\hc_unsel_gs.paa

#

the ui_f_data prefix is a3\ui_f\data

frank ruin
#

Ah I'll check 😃

#

Cheers for your input already!

#

Cheers that did the job! 😃

cerulean whale
#

Is there a simple way to tell if an object's bounding box is colliding with the bounding box of another object?

cerulean whale
#

I've got a complex solution but it's not very optimized (at least in comparison to my other work) and am wondering if anyoone would help me find a more simple solution

robust hollow
#

you want it as colliding anywhere on the boundingbox or visually (walls and stuff)?

cerulean whale
#

Either @robust hollow For my application they are the same

astral tendon
#

i have a problem that all triggers fire at once when a JIP player join in the midle of the game

#

(of course only for the JIP)

#

and the triggers already got fired once by other player

#

in my case those triggers are to execute a audio from the plot in my mission, and they all play at once

subtle ore
#

@astral tendon of course, it's going to be evaluated when a player joins

astral tendon
#

i tryed to make the trigger deleat it self on the deactivation but it still exist

#

is there other way around it?

subtle ore
#

Don't use triggers

noble pond
#

triggers are a big ol gongshow.

#

they can be speedy because they are built in c++ but otherwise they are a mess

#

deleting and making them is a bit tricky, better to do whatever you want via script

#

JIP wise they fuck things up even more

#

do it all by script.

#

@astral tendon

astral tendon
#

ok, my situation is that i need audos do be played in cetain points in the mission

#

once they are in one particualry area, once a area have no enemys, and once one ting or another dies

#

what i can use instead?

#

i hear that scipts that runs every time also kills perfomace in the same way was triggers

#

like a loop trigger

subtle ore
#

sinks to floor in defeat

astral tendon
#

🙄

#

so all i have to do is accept defeat and give up on my project?

subtle ore
#

No, stop using triggers

#

everyone here has said the same thing over and over again

astral tendon
#

so what i can use to check conditions EVERY time?

subtle ore
#

LOOPS

#

a few flicks and clicks got me that link

astral tendon
#

yup, that is also coop 8 players friendly and perfomace friendly?

#

can i trust a week of work around it and dont have to re-work it later on?

#

is that JIP friendly?

subtle ore
#

Yes of course it's performance friendly

#

more than triggers

#

obviously running a loop in unscheduled is retarded

#

and that is what a lot of people fail to realize

#

so what I recommend you do is, don't use triggers and learn sqf

astral tendon
#

while still executes when it already mets the condition or it its keep running and can execute again?

subtle ore
#

keeps runnning unless you exit the scope

#

exitWith { }

astral tendon
#

im trying to use this one

{
hint selectRandom ["close2","close3","close4","close5"] 
};```
#

and it not looping on the console

cloud thunder
#

you can't run loops or sleep in console without spawning the code [] spawn { ...your code here ...};

subtle ore
#

I am going to assume un scheduled

#

which I warned you to do so earlier

astral tendon
#

how would i knoe that the debug console was un scheduled?

#

is not called unscheduled debug code

subtle ore
#

infinite facepalm into endless oblivion

astral tendon
#

rip

subtle ore
#

I literally just talked about it before he posted

#

gross

#

🤦

#

Eehh..

#

they got medication and cream for htat

strong shard
#

Hi, how many times per second FSM can change state?

jade abyss
#

Wasn't FSM per Frame? hmm 🤔 (not sure, tbh)

nocturne basalt
#

Hi guys. is it possible to differentiate between an object being deleted and an object being killed?

jade abyss
#

Eventhandler

nocturne basalt
#

yeah I tried the eventhandler, but can I check in a script somehow if its been deleted vs killed?

#

both ways of performing actions when killed work fine.
if (!alive _v) then {
and using the killed EH

#

but I dont want to perform some stuff if its deleted

#

by zeus or whatever

robust hollow
#

if its deleted itl be null, if its dead itl be !alive

#

or, the var for it would return null assumingu have one

nocturne basalt
#

so I can use
if (_v == null) ?

robust hollow
#

isNull _v

nocturne basalt
#

ohh

#

ahh

#

I'll try right away

#

thanks it worked xD

meager granite
#

How do you tell if PM from Apex belongs to Apex DLC?
getText(configFile >> "CfgWeapons" >> "hgun_Pistol_01_F" >> "DLC") returns ""

#

Is there another config structure that points to it?

#

Makarov pistol

#

"PM 9 mm" in game

strong shard
#

@meager granite all apex’s weapons without DLC parameter..., weapons in CfgPatches >> “A3_Weapons_F_Exp” should be used... need fix!

meager granite
#

Interesting, I can't seem to find any mention of CfgPatches in Arsenal

#

yet it correctly shows Apex icon for PM

little eagle
meager granite
#

Aha, I've been looking at outdated script which did
_dlc = gettext (_itemCfg >> "dlc");

#

Strange why they got rid of dlc value from configs though

little eagle
#

Anyway, the string reported by CSM should match a sub class in CfgMods:

    class CfgMods //sources - ["A3_Data_F","A3_Language_F_Beta","A3_Language_F_Gamma","A3_Language_F_EPA","A3_Language_F_EPB","A3_Language_F_EPC","A3_Data_F_Curator","A3_Data_F_Kart","A3_Data_F_Heli","A3_Data_F_Mark","A3_Data_F_Exp","A3_Data_F_Jets","A3_Data_F_Argo","A3_Data_F_Orange"]
    {
        defaultAction = "";
        class Mod_Base; //sources - ["A3_Data_F"]
        class Expansion: Mod_Base //inherits 12 parameters from bin\config.bin/CfgMods/Mod_Base, sources - ["A3_Data_F_Exp"]
        {
[...]
            appId = 395180;
[...]
            class Assets //sources - ["A3_Data_F_Exp"]
            {
                class TanoaTerrain //sources - ["A3_Data_F_Exp"]
                {
                    displayName = "Tanoa Terrain";
                    overviewPicture = "\A3\Data_F_Exp\Images\FeatureTanoaTerrain_co.paa";
                    description = "Walk, swim, drive, fly, and sail your way across the brand new South Pacific island terrain.";
                    dlcType = "expansion";
                };
                class WeaponAK12 //sources - ["A3_Data_F_Exp"]
                {
                    reference[] = {"CfgWeapons", "arifle_AK12_F"};
                    overviewPicture = "\A3\Data_F_Exp\Images\WeaponAK12_ca.paa";
                    tryAsset[] = {0, {"I_C_Soldier_Para_1_F", {"arifle_AK12_F"}}, ""};
                    dlcType = "expansion";
                };
#

And this is how the game determines which weapon belongs to which item.

meager granite
#

Yeah I've seen this structure in config but thought it was mainly used for DLC info displays and promotional menus

#

Thanks, it all makes sense now.

tough abyss
#

Does anyone remember in which PBO the code for the mount/dismount addAction from ACE2 was?

little eagle
#

I don't remember a mount/dismount addAction aside from eject left/right when inside a helicopter.

tough abyss
#

Probably that one.

little eagle
#

Why? We'll have this in ACE3 now in 3.11

tough abyss
#

I'm researching something...

little eagle
#

ACE2 code is really ugly.

tough abyss
#

Indubitably.

icy raft
#

I'm away from my main dev PC, does anyone know if Arma 3 accept binary notation? ( 0b00000001, 0b00000010, 0b00000011...)

still forum
#

No it doesn't

#

there are no integers in Arma

icy raft
#

😦

lone glade
#

what's the float limit again before they're rounded, 9 ?

little eagle
#

somewhere above 1E7

still forum
#

@lone glade you mean non-decimal numbers?

#

-16777215, 16777215 is the integer range you can store in float with 100% precision

frank ruin
#

Can I make listbox not be able to select items in it?

hidden field
#

@icy raft arma accepts hexadecimal (0xaf01) but it will be converted to a number (also 24bit max!)

#

@frank ruin like having a list but the player can't select something?

#

if you don't want to disable the listbox just set the select colors the same as if not selected (aka colorselect/2 = text color and selectBackground/2 = background color)

frank ruin
#

The issue is

#

When I have 2 of them selected

#

It act bit jinky

#

Like the script has troubles with interacting with 2 selected listboxes

#

Even when I mentioned it has to take the selected lines in listbox 1

#

If I selected something in listbox 2

#

it doesn't execute straight away

#

I have to reselect listbox1 in order to confirm kind of

#

Cause it selects listbox2 being more selected then listbox1 being selected

#

So I would like to make listbox2 not being able to be selected

#

So it doesn't interrupt with listbox1

tough abyss
#

Assuming I have the following script

#include "script_component.hpp"

private _objList = [];

{
    _objList pushBack _x; 
} forEach nearEntities [player, ["Tank", "Car", "Ship", "Helicopter", "Plane", "StaticWeapon", "CAManBase"], 50];

hint format ["%1", _objList];
``` And it returns ```
[B Alpha 1-1:1 (Neviothr),B Alpha 1-3:1]

Is there a way to use the array in order to execute code on a certain element from it? I.E ```
B Alpha 1-3:1 setDamage 1

(which obviously doesn't work).
cunning nebula
#

anyone know if I can look up the return of "surfaceType" somewhere in the config to get more information about the kind of surface ?

#

never messed around with those

#

@tough abyss forEach should be good enough for that, no ?

#

or apply

#

depending on what you want to do

#

and if you're looking for active objects then maye using "allUnits" would be better than nearEntities

#

since nearEntities also returns dead or destroyed ones

#

and is generally slower

tough abyss
#

I don't need every unit, all ones in a certain radius.

cunning nebula
#

you dont understand

#

allUnits can be filtered

#

but nearEntities returns more than you might want

tough abyss
#

The question is - can I adress a nameless unit remotely?

cunning nebula
#

sure

#

but the real question is

#

what do you want to do there

#
    _unitsnearby = allUnits inAreaArray [getPosATL player,  50, 50];
tough abyss
#

I'm not sure how to explain the purpose, really.

cunning nebula
#

you want to run code on certain units but i dont know which ones and for what purpose

tough abyss
#

Exactly.

cunning nebula
#

the types ob units / objets you want determine which command is best used to find them

tough abyss
#

Can be any unit, and any code.

cunning nebula
#

thats pretty vague

indigo snow
#

_unit = _array select 0; doCodeWith _unit; ???

tough abyss
#

@cunning nebula - let's say I'm in a SP or MP mission (which I can't edit), and there's a bug. A mission-critical unit, vehicle, etc. is damaged. How can I get the name or variable, if assigned, of that unit so I can manipulate it.

cunning nebula
#

ah, now were talking

#

cursorTarget

jade abyss
#
anyone know if I can look up the return of "surfaceType" somewhere in the config to get more information about the kind of surface ?
never messed around with those```
What kind of Information?
cunning nebula
#

any information really 😛 i dont know how much there is

jade abyss
#

You can basicly grab the clutter informations from it

#

mom

tough abyss
#

Hmm, I thought about using cursorTarget. But does it have a distance limit?

cunning nebula
#

hmm maybe but that is pretty far

#

but its very useful in the debug console

tough abyss
#

Like ```SQF
if (cursorTarget == objNull) then {
// Run some code on current player
} else {
// Run some code on target
};

jade abyss
#

isNull cursorTarget

tough abyss
#
The target has to be known to the player to some degree (knowsAbout > 0). If target is completely unknown, command returns objNull. 
```?
jade abyss
#

cursorObject > cursorTarget

#

Fresh spawned Vehicle on a Server for example might take time, until "your pawn" knows about it, even when you can clearly see it

tough abyss
#

That's an issue.

jade abyss
#

Thats "normal", since: always

#

CursorObject should detect it from the moment it's there

#

@cunning nebula

_Surface = (surfaceType position player) select [1,100];
        _CfgEntry = getText(configfile >> "CfgSurfaces" >> _Surface >> "files");```
Example
cunning nebula
#

if you do it from the debug console you can simply put typeOf cursorTarget in one of the debug lines

#

or whatever else information you need

#

ah, great

#

so they are in the config

#

thanks

tough abyss
#

I'm assuming cursorObjectalso doesn't have a distance limit?

jade abyss
#

Why do you need a Distance?

cunning nebula
#

if your aiming for units, then cursorTarget is better

jade abyss
#

+wasn't cursortarget ~2k?

cunning nebula
#

it doesnt pick up clutter

jade abyss
#

Or was that LineIntersectObject ... hmm

tough abyss
#

@jade abyss - I need distance because if I want he script to be "dual-purpose" if you will. As I posted above ```SQF
if (cursorTarget == objNull) then {
// Run some code on current player
} else {
// Run some code on target
};

jade abyss
#
so they are in the config```
Yeah, it's basicly just the config name what you get... but... yeah, thats it. Not more.
#

ISNULL

tough abyss
#

Yeah I got that.

jade abyss
#
if (isNull cursorTarget) then {```
....
tough abyss
#

I'll try that, thanks. If it doesn't fit the bill I can always add a distance check, make sure cursorTarget's return is closer than 5, 10, 50m.

jade abyss
#

Thats what you should do anyway

#

Why do you need to check for something thats >50m away?

#

Or even 20 oO

tough abyss
#

I just gave arbitrary numbers.

little eagle
#

I think you mean.

if (local cursorTarget) then {
jade abyss
#

local? oO

#

u drunk?

cunning nebula
#

there is also "allPlayers" if you're aming for someone specific

little eagle
#

Dude, reread the comments of the code.

#

It talks about remote and local.

jade abyss
#

Where?

tough abyss
#

@cunning nebula - doesn't have to be used on players, could be an empty vehicle.

cunning nebula
#

well, i still dont get the point

jade abyss
#

Same ¯_(ツ)_/¯

cunning nebula
#

if youre in the debug its up to you what you run it on

little eagle
#

Anyway, this one will always report false:

if (cursorTarget == objNull) then {
#

Because
objNull == objNull // false

jade abyss
#

Dude... stop deleting your answers... damn... thats annoying

little eagle
#

Who?

jade abyss
#

Nevi

tough abyss
#

There there ```
// Run some code on current player
} else {
// Run some code on target

little eagle
#
private _target = cursorTarget;

if (isNull _target) then {
    _target = player;
};

I guess this ^ code also makes sense. I don't really know what the result should be.

tough abyss
#

Sorry.

jade abyss
#

The thing is, he wants to check for something >50 or above... So his code could execute even if he looks at a house or... anything

#

And since he doesn't say, what he want's to achieve with it -> limited help

little eagle
#

cursorTarget doesn't work on map objects like hosues. It will report null for those.

tough abyss
#

@jade abyss - "[3:49 PM] Neviothr: I just gave arbitrary numbers."

jade abyss
#

Erm, nope? @little eagle

little eagle
#

You're thinking of cursorObject maybe. cursorTarget only works on vehicles and soldiers and stuff like that. Mission objects.

jade abyss
#

Not working with Trees, thats correct. But houses work

little eagle
#

Hmm.

jade abyss
#

iirc, if they don't have a config, cursorTarget won't work

#

Something like that

strong shard
#

@jade abyss tested FSM... now i am sure that “1 state change per frame”.. avg 0.999704 FrameNo diff for 3,5k frames

jade abyss
#

Thats why cursorObject was added, commy

#

👍

little eagle
#
// Run some code on target

This sounds to me like something about MP remote objects. ¯_(ツ)_/¯

jade abyss
#

Could be anything^^

#

like
_CTarget setDamage 1
😄

tough abyss
#

By "target" I meant whatever's under the cursor.

jade abyss
#

works even without locality 😛

little eagle
#

So you mean run "for" target?

#

Because "on" sounds like you want to remote execute stuff on a different machine.

jade abyss
#

gj repeating what i just wrote 😂

#

Because i can =}

#

(fighting with Vector stuff, always angry when doing that crap)

tough abyss
#

This probably should do it ```SQF
if ((player) distance (cursorObject) < 2) then {
cursorObject setFuel 1;
} else {
vehicle player setFuel 1;
};

jade abyss
#

Won't work without locality Check + damn

lone glade
#

dem round brackets

jade abyss
#

paralympics or however it was called

#

(parathesis?)

tough abyss
#

Exactly why do I need a locality check here?

jade abyss
#

if ((player) distance (cursorObject) < 2)
->
if ((player distance cursorObject) < 2)

#

check setFuel

#

It only works, when the Vehicle is local to you

lone glade
#

because setFuel is AL EG

jade abyss
tough abyss
#

(╯°□°)╯︵ ┻━┻

cunning nebula
#

@tough abyss try this

_target = [cursorTarget,player] select isNull cursorTarget;
jade abyss
#

Now you have to check if it's local and if a driver is in it, then you have to send that over to the owner OR set the ownership of that Veh to you

tough abyss
#

I fucking hate MP.

jade abyss
#

Basics of Arma MP

#

Locality

subtle ore
#

Woohoo Locality issues are my favorite!

little eagle
#

SQF <3

setDir - AL
setPos - AG
addBackpack - AL
addUniform - AG
addMagazine - AL
addMagazine ARRAY - AG
lone glade
#

use CBA targetEvent -> done 😄

tough abyss
#

@jade abyss - oh I know about locality, but I don't know shit about locality.

jade abyss
#

@Dscha - oh I know about locality, but I don't know shit about locality.
what?

subtle ore
#

0_0

jade abyss
#

🤔 i am a bit confuzl0rd

#

Basic thing is:

tough abyss
#

"I am aware of locality, but I don't know anything about locality".

cunning nebula
#

just make sure any command you send is executed where the targeted object is local and you're safe, for the most part

tough abyss
#

Thanks @cunning nebula.

jade abyss
#
if(local _CTarget) then { setFuel Command}
else
{
    _CTarget remoteExecCall ["SetFuelFunctionOnTheServer"];
};
lone glade
#

remoteExec takes nearly anything as target dude

jade abyss
#
SetFuelFunctionOnTheServer =
{
    [1] remoteExecCall ["SetFuel",owner _this];
};```
Or something like that
cunning nebula
#
[_target, 1] remoteExec ["setFuel", _target];
#

simple as that really

tough abyss
#

What I like the most is that I played MP once, yet try to make this thing MP compatible.

jade abyss
#

But you can't get the owner of a Vehicle from Clientside @lone glade

#

Or was that changed?

little eagle
#
[_target, 1] remoteExec ["setFuel", _target];
cunning nebula
#

filter targets via aimedAtTarget ?

subtle ore
#

iirc doesn't aimedAtTarget return accuracy?

#

or how well it's aligned with the target?

little eagle
#

The idea is that you're shooting at it if it's aimed at enough.

subtle ore
#

🤔

cunning nebula
#

pick the first one

#

thats most likely what hes shooting

#

but maybe checking aimedAt is faster, hard to tell

subtle ore
#

"most likely" 😐

little eagle
#

inAreaArray filter with a rotated rectangle in weapon direction and then using that sub array sort method to get the object that the weapon is aligned with the most.

cunning nebula
#

just tried targetsQuery on the local player

#

it lists the target im aiming at first

tough abyss
#

Something seems fishy, this can't be it ```SQF
_target = [cursorTarget, player] select isNull cursorTarget;
[_target, 1] remoteExec ["setFuel", _target];

jade abyss
#

Read what i worte about Owners Nevi

tough abyss
#
[4:07 PM] Dscha: But you can't get the owner of a Vehicle from Clientside @alganthe
[4:07 PM] Dscha: Or was that changed?
jade abyss
#

I doubt that will work above

#

Yep

cunning nebula
#

hmm

#

im pretty sure that works

jade abyss
#

(the setFuel part)

little eagle
#

Why wouldn't this work? It looks perfectly fine to me.

#

Aside from `player´ never being a vehicle and therefore never using fuel.

tough abyss
#

Idk, you guys wrote it 😂

jade abyss
#

So remoteExec ignores the locality of an Object?

little eagle
#

What?

cunning nebula
#

just because "owner" is restricted, doesnt mean remoteExec also is

little eagle
#

^

cunning nebula
#

would be stuipid if it was

little eagle
#

All remoteExec are send to the server anyway. The server knows which machine it to send to.

jade abyss
#

Don't ask about sense

tough abyss
#

@little eagle - well , vehicle player? I guess?

jade abyss
#

rgr that

little eagle
#

Sure.

jade abyss
#

Then Code should work

cunning nebula
#

it seems like it does

tough abyss
#

I'm going to assume it would work with setDamage and setAmmo as well.

jade abyss
#

Neviothr, learning by doing.

cunning nebula
#

it is sorted by knowledge

#

and the target aimed at is the best known one

tough abyss
#

@jade abyss - if only I had a proper MP testing environment 🤦

cunning nebula
#

map content ?

jade abyss
#

@tough abyss Starting a DediServer is easily doable on your own machine

cunning nebula
#

i dont have those

#

I hate them

tough abyss
#

@jade abyss - if only my machine could handle one 😦

jade abyss
#

If it runs Arma, you can run a Dedi in the BG. Nobody said it must be filled with x000 Players/Units

#

+Excuses, excuses, excuses

cunning nebula
#

no i was aiming at friendly to see if the array gets sorted

#

but since you want to know what a AI is shooting at....

#

its safe to say that he knows his target

little eagle
#

setDamage is AG, so it doesn't need remoteExec.

#

setAmmo does iirc.

cunning nebula
#

@jade abyss

getNumber(configfile >> "CfgSurfaces" >> (surfaceType getPosATL player) select [1] >> "grassCover");
#

thanks, found this very useful config value 😃

#

more than i had hoped for

tough abyss
#

@jade abyss - "+Excuses, excuses, excuses" is my life in a nutshell, but that's for another channel.

cunning nebula
#

@tough abyss ok, maybe i was wrong

#

when i tested it, i was standing between those targets

#

so i had to look in different directions

#

it doesnt work well when I'm some distance away and they stand close together

#

i guess in that case it returns the closest one or something like that

jade abyss
cunning nebula
#

hahaha

#

dscha early in the beta i used a pip-texture as camo for a uniform xD

#

erm alpha i mean

jade abyss
#

^^

#

I thought about that too, but then i rememberd: Oh, there are ppl who don't use PIP, damnit

cunning nebula
#

yup

#

and some other issues

#

but it was fun

jade abyss
#

i think i tested that with your brother, iirc ^^

Yeah, indeed it is

cunning nebula
jade abyss
#

hidd0rn

cunning nebula
#

i actually attached a camera between his legs xD

#

to get the ground texture

#

sadly pip also doesn't display shadows

jade abyss
#

Rly? Never payed attention to that

ionic orchid
#

is there any particular difference between using BIS_fnc_addStackedEventHandler VS addMissionEventHandler for "PlayerConnected" and other mission-related events?

cunning nebula
#

but damn, using surface texture is even better 😃

little eagle
#

Won't this turn black if there are multiple of these next to each other?

cunning nebula
#

yes probably

little eagle
#

addMissionEventHandler is newer and better.

jade abyss
#

Yeah, downside: You have to find out the path of the Tex on your own and adjust it for every fkn island 😦

ionic orchid
#

coolio, i'll use that one then

cunning nebula
#

hmm

rotund cypress
#

Hey guys, anyone here know if it's possible to have a progress bar in a listnbox?

jade abyss
tough abyss
#

So I tried what we we're doing earlier, setVehicleAmmo and setFuel don't work in the context on that script 😕

#

Well, sorta. setFuel works if you're look at the vehicle (it will be refueled), if you're in a vehicle while looking at a vehicle (the vehicle you're looking at will be refueled). Although it won't refuel the player's vehicle.

little eagle
#

cursorTarget?

tough abyss
#

Yes.

little eagle
#

Well duh.

#

The vehicle you're sitting in is reported by cameraOn, not cursorTarget.

tough abyss
#

Yeah but isn't this supposed to set _target to vehicle player if you're not looking at another vehicle? _target = [cursorTarget, vehicle player] select isNull cursorTarget

little eagle
#

Yes, but you probably looked at something.

tough abyss
#

Nope.

little eagle
#

Debug console, cursorTarget.

tough abyss
#

objNull, tested while setting in an ATV.

jade abyss
#

Didn't cursorTarget from inside a Veh always returns the Veh you are in?

#

Can't remember anymore

little eagle
#

No?

tough abyss
#

cursorObject is <NULL-object>, [cursorTarget, vehicle player] select isNull cursorTarget is B Alpha 1-1:1 (Neviothr).

#

Even if I look down right at the vehicle it's the same.

cunning nebula
#

hmmm just crashed arma two times in a row, seems like i'm doing something wrong xD

little eagle
#

right*

tough abyss
#

Ok so setFuel is now working properly.

#

Must've messed something up 😕

little eagle
#

You probably looked at a vehicle.

#

Or maybe a rabbit.

#

Snake.

tough abyss
#

It's setVehicleAmmo that's broken. There are no rabbits on VR.

little eagle
#

Who knows.

tough abyss
#

setVehicleAmmo only replenishes the current magazine...

little eagle
#

Yes.

#

Maybe you want setVehicleAmmoDef to restore the config state.

#

@open vigil Ban this bot ^

tough abyss
#

FM is offline, try @graceful pewter or @drowsy skiff.

jade abyss
#

Just because he isn't visible for you, doesn't mean he is offline 😛

graceful pewter
#

whats up

jade abyss
#

z_wo @graceful pewter

cunning nebula
#
player spawn {
    while { true } do 
    {
        waitUntil { sleep 3; alive _this };
        _this setVariable ["defcamo", _this getUnitTrait "camouflageCoef", true];
        while { alive _this } do     {
            if (stance _this == "PRONE") then {
                _surfaceType = (surfaceType getPosATL _this) select [1];
                _grassCover = getNumber(configfile >> "CfgSurfaces" >> _surfaceType >> "grassCover");
                _newCamo = 1 max 500 * _grassCover;
                _this setUnitTrait ["camouflageCoef", _newCamo];
            } else {
                _this setUnitTrait ["camouflageCoef", _this getVariable "defcamo"];
            };
            sleep 1;
        };
    };
};
graceful pewter
#

gone

cunning nebula
#

values may need some tweaking but it seems to work well

tough abyss
#

setVehicleAmmoDef is acting really weird.

#

It like, switchs the current weapon to empty one and shifts and player's camera...

jade abyss
#

AI-Stuff Tajin?

tough abyss
#

Can someone try setVehicleAmmoDef to reproduce the above?

cunning nebula
#

it makes your camo more effective when you're prone, depending on the amount of grass in that area

quartz coyote
#

Hello all,

How can I fix this ?

player addAction ["SHOW SCORE",hint parseText format ["Score : <br/><t color='#0000FF'>BLUE</t> %1<br/><t color='#FF0000'>RED</t> %2<br/><br/>Flag Touch : <br/><t color='#0000FF'>BLUE</t> %3<br/><t color='#FF0000'>RED</t> %4", WScore, EScore, westtouch, easttouch]];
#

is doesn't work :S

#

their are so many options in addaction i get lost

tough abyss
#

@quartz coyote Wrap your code in brackets:

player addAction ["SHOW SCORE", 
    { 
        hint parseText format ["Score : <br/><t color='#0000FF'>BLUE</t> %1<br/><t color='#FF0000'>RED</t> %2<br/><br/>Flag Touch : <br/><t color='#0000FF'>BLUE</t> %3<br/><t color='#FF0000'>RED</t> %4", WScore, EScore, westtouch, easttouch] 
    }
];
quartz coyote
#

Arfffhhhh I knew i wasn't too far away

#

The Garret

tough abyss
#

addAction takes either "hint 'hello';" string or { hint "hello"; } code

#

Code is easier to manage and read, but string can be useful in some cases.

quartz coyote
#

thanks man

tough abyss
#

Can also use functions or call a script.

tough abyss
#

Guys:

holsterKeydown = (findDisplay 46) displayAddEventHandler ["KeyDown", "if ((_this select 1) isEqualTo 0x23) then {_nul = [] execVM 'Client\Functions\Externals\KeyFunctions\WeaponHolster.sqf'};"];

Right now our mission uses the script above to determine if you push your "H" key and then allow you to holster your weapon. How do I assign a custom key?

little eagle
#

@tough abyss By changing 0x23

tough abyss
#

i'm following...to what?

little eagle
#

I posted it.

tough abyss
#

k let me read

#

i think i know what you think I meant

#

I mean...in arma...there's a whole "custom controls" option

#

user action 1, user action 2, and so on

#

how do I tell the script to point to user action 3

#

so taht the player can pick his key

little eagle
#

That will not work. You can bind those to e.g. Alt+H and the alt modifier will make the actionKeys command report a number above the single floating point precision.

tough abyss
#

damn ok

#

how do I add the extra step of making it ALT+H

little eagle
#

(_this select 1) isEqualTo 0x23 && (_this select 3)

#

Or was it (_this select 4)

#

?

#

_display, _key, _shift, _control, _alt

#

4

#

4 it was, not 3

#
(_this select 1) isEqualTo 0x23 && (_this select 4)
tough abyss
#

got it

#

thanks man, i'll test that out

#

much obliged!

little eagle
#

Sucks, but that's how it is. It worked in A2, but I think they broke it when they moved to A3 and never bothered to remove them from the keybinding menu.

jade abyss
#

or for CustomKeys:

if((_this select 1) in actionKeys 'User12')then```
#
  • @tough abyss
_ctrl = _this select 0;
_button = _this select 1;
_BtnShift = _this select 2;
_BtnCtrl = _this select 3;
_BtnAlt = _this select 4;```
Add something like that in the beginning of your file (or use params["_bla"] stuff, if you want to)
little eagle
#

Dscha, this breaks when you bind the action key to Alt+etc.

#

Did you even read what I wrote?

jade abyss
#

? oO

little eagle
#

actionKeys reports huge numbers for keys with modifiers.

jade abyss
#

if(_button in actionKeys 'User12' && _BtnShift )then

#

works

little eagle
#

Not if you bind the user12 to alt+h itself

#

or shift+h

#

Left Ctrl + Key = 486539264 + DIK
Left Shift + Key = 704643072 + DIK
Left Alt + Key = 939524096 + DIK
Right Ctrl + Key = -1660944384 + DIK
Right Shift + Key = 905969664 + DIK
Right Alt + Key = -1207959552 + DIK
#

This has been broken for 4 years and you still haven't realized it lmao.

jade abyss
#
if(_button in actionKeys 'User11')then
    {
        if(_BtnCtrl)then

bla, using it

little eagle
#

You don't understand why this won't work, do you?

jade abyss
#

Dude... i used it in OBE (wich works)

little eagle
#

Open the menu right now and bind it to shift+something

jade abyss
#

Load OBE

#

And go to a Window

little eagle
#

You'll see that it does not in fact not work.

jade abyss
#

Shift + the UserAction button

little eagle
#

Dude. If you bin User11 to alt+h.

#

Then actionKeys will report [hugeassnumber]

#

And hugeassnumber is not the DIK for whatever.

jade abyss
#

Who the F is doing that anyway

little eagle
#

Bind stuff to shift+anything? Everyone?

jade abyss
#

Not rly

little eagle
#

¯_(ツ)_/¯

#

It's broken.

jade abyss
#

if they bind it that way -> Pff, who cares. Bind it to single Buttons. I couldn't care less

little eagle
#

Right. Script stuff that only sometimes works. Great idea.

jade abyss
#

wait a sec

little eagle
#

"I couldn't care less"

#

/facepalm

jade abyss
#

Nah, for a moment i thought i would have any interest in it.

tough abyss
#

@little eagle the 'broken' part your reffering to is related to code involving allowing the player to set custom binds with their controlls config -> keybinds , blah blah right? Not code involving just setting a function/etc to a specific dik code, that may or may not include shift alt modifiers correct?

little eagle
#

actionKeys is essentially unusable.

#

Everything with actionKeys will break when modifier keys are used.

#

Shift, control, alt.

#

Get used to it. No work arounds.

tough abyss
#

i have noticed at least with enhanced movement, many keys wont work- and shift or alt modifiers never work

little eagle
#

Yep. That's why you shouldn't use actionKeys as a scripter.

waxen cosmos
#

Commy, I'm adding an addaction to all opfor units, it as intended for placed units using if side = east in the init. It doesn't work for any further dynamically spawned units which I guess as those units don't yet exist in the init. Could you offer some advice on how to give the new units the addaction?

little eagle
#

Mods or vanilla?

waxen cosmos
#

A mix - using Ravage, so I'm trying to loot the zombals (Main focus Mods then I guess)

little eagle
waxen cosmos
#

As in I'm spawning Vanilla & Non-Vanilla - Didn't want to give the incorrect answer

still forum
#

🍪

cold pebble
#

So it's modded

#

😉

waxen cosmos
#

++

little eagle
#
["All", "initPost", {
    params ["_object"];

    if (side _object == east) then {
                //something
    };
}] call CBA_fnc_addClassEventHandler;
#

Something like this? Idk.

waxen cosmos
#

uldn't of even thought of that direction - I was trying to do stuff with While loops. Ill have a tinker thank you. Thanks Commy, with the cleaning of the code and that code you provided it works 😄

tame portal
#

@little eagle That 🤔 blob version

#

Jesus

subtle ore
#

@tame portal pretty great huh?

tame portal
#

I wonder where he gets this kind of stuff from

little eagle
#

The interwebs.

subtle ore
#

can anyone confirm that this code completely freezes arma?

#
[_this] spawn
{
params["_unit"];
_unit select 0 addEventHandler["Killed",
    {
            params["_unit"];
            private _box = "Box_NATO_Wps_F" createVehicle (getposATL _unit);
            clearWeaponCargo _box;
            clearMagazineCargo _box;
            clearItemCargo _box;
            clearBackpackCargo _box;
            {_box addWeaponCargo[_x,1];} forEach (weapons _unit);
            {_box addMagazineCargo[_x,1];} forEach (magazines _unit);
            {_box addItemCargo[_x,1];} forEach (items _unit);
            _box addItemCargo[(uniform _unit),1];
            _box addItemCargo[(vest _unit),1];
            _box addBackpackCargo[(unitBackpack _unit),1];
            _box addUniform (uniform _unit);
    }];
};
#

nothing in rpt

#

just totally locks up

#

nope, just local to the player

#

_this would be everything thrown at it during executio

#

which atm is only the player variable

#

_unit select 0 selects the player unit from the spawn params array

#

what's the most confusing about this is that it was working perfectly a few days ago, and all of suddne it stopped working. Which isn't just because it feels like it, I did something wrong here...

little eagle
#

@subtle ore

[_this] spawn
{
params["_unit"];
_unit select 0 addEventHandler["Killed",

Should be:

_this spawn
{
params["_unit"];
_unit addEventHandler ["Killed",
#

addUniform is for persons. This will not work:

_box addUniform (uniform _unit);
#

Assuming that items etc. corresponds with the item needing addItemCargo etc. is very optimistic. I'm not sure that is always true.

            {_box addWeaponCargo[_x,1];} forEach (weapons _unit);
            {_box addMagazineCargo[_x,1];} forEach (magazines _unit);
            {_box addItemCargo[_x,1];} forEach (items _unit);
#

unitBackpack reports OBJECT. addBackpackCargo needs the classname:

_box addBackpackCargo[(unitBackpack _unit),1];

You also needs the Global versions of these addXCargo commands. addXCargoGlobal.

#

Pretty sure that some of these could lock up the game. If the game locks up, no error message might be printed.

#

Oh:

createVehicle (getposATL _unit);

should be:

createVehicle ASLToAGL getPosASL _unit;

So this doesn't spawn the box in mid air on an aircraft carrier? Not sure if this createVehicle version doesn't spawn on the ocean floor anyway.

quartz coyote
#

Hello Friends,
I'm encountering a weared situation. RPT file didn't give me any error and no error code ingame ether.
Description.ext

// Functions
class CfgFunctions
{
    class Server {
        tag = "ctf";
        class functions {
            file = "fnc\ctf";
            class outro {};
            class workflow {};
            class timealerts {};
            class scorereached {};
            class prepphase {};
        };
    };
};```

initServer.sqf
```sqf
    call ctf_fnc_workflow;
    call ctf_fnc_scorereached;
    call ctf_fnc_timealerts;

fn_scorereached.sqf

waitUntil {(ScoreP<10000 and ((WScore>=ScoreP) or (EScore>=ScoreP)))};

// Send End Status to allPlayers
TimeEnd=true;
publicVariable "TimeEnd";

hint parseText format ["Mission over<br/>Final Score : <br/><t color='#0000FF'>BLUE</t> %1<br/><t color='#FF0000'>RED</t> %2<br/><br/>Flag Touch : <br/><t color='#0000FF'>BLUE</t> %3<br/><t color='#FF0000'>RED</t> %4", WScore, EScore, westtouch, easttouch];

remoteexec ["ctf_fnc_outro"];

I tried putting a Hint "Test"; in th biggining of my function to see it was correctly executing but it never showed up ...

vivid quartz
#
spawn ctf_fnc_scorereached;
#

try that @quartz coyote

quartz coyote
#

That's what I thought too... I'll try and tell ya if it fails

quartz coyote
#

Yes ! It works

still forum
#

@Midnight#4592 _unit will already contain _this. do you really want _this select 0?
And why do you spawn a piece of code that shouldn't be spawned.

subtle ore
#

@still forum originally i had sleeped a different part of the code,

#

@little eagle thanks for the feedback.

little eagle
#

Would be interesting to know which of these bugs causes a freeze. Because I don't see it.

subtle ore
#

Dunno. Going to root it out and see what the problem is.

little eagle
#

Comment almost everything out and then uncomment bit by bit until it freezes again.

#

Debugging Arma style.

subtle ore
#

Hell yeah

#

Love tearing out my brain cells one bit by bit

little eagle
#

All you need is patience. You don't even have to use your brain that much doing it. I put myself in auto mode and just do it whenever I encoutner such a problem.

#

The creative thinking part is searching for an explanation afterwards.

subtle ore
#

Oh, i am very patient. I am just curious as to why i made so many mistakes in the first place, maybe i was sleepwalking whilst making this. Lol. I feel sometimes there isn't an explanation for everything and sqf is just what it id

little eagle
#

Eh, everyone makes mistakes. Just needs practice to make fewer of them.

subtle ore
#

🤷

little eagle
#

Why don't you try it and see if it works?

#

If it doesn't work then the code is not correct.

#

I don't think you can disable taking damage on map objects, but I can't remember the last time I tried something like this.

#

Syntax looks correct to me, but be aware that nearestBuilding only reports buildings with pathway lods for the persons etc.

#

So no streetlamps or some other small things like that.

#

What building are you using this on?

#

And it should be protected from artillery and other bombardment?

#

A radical solution would be to do a nearObjects scan every (?) frame and to delete everything resembling projectiles / ammunition.

#

That would make everything safe in there.

#

like 7 lines of code.

#

What's the base's positon and what should be the radius?

#
// init.sqf
if (isServer) then {
    addMissionEventHandler ["EachFrame", {
        {
            if (_x isKindOf ["Default", configFile >> "CfgAmmo"]) then {
                deleteVehicle _x;
            };
        } forEach (BASE_POSITION nearObjects SAFEZONE_RADIUS);
    }];
};
  • dunno if removing isServer is needed (if the code has to run everywhere)
  • people will suggest using the scheduler, but then it becomes a gamble if the loop is quick enough to catch a quick projectile with a short flypath.
#

It has to be executed on the server. Doesn't matter which file or framework.

#

You can do it by debug console in the editor to check if it works. That's what I'd do first.

#

I don't have Arma installed on this machine, so I might've posted garbage. You should get the idea though.

somber solstice
#

guys, I have a question about BuildingPos. how many buildPositions I can create?

lone glade
#

what do you mean by create? you mean in the 3D model?

somber solstice
#

yep

lone glade
#

way more than you'll ever use

somber solstice
#

for example I can make 1000?

lone glade
#

don't know, but it's way above 50 at least

somber solstice
#

ok, ty bro

subtle ore
#

🤔 Not really a scripting question

little eagle
#

folding rule

#

Oh. Yes. The distance in Arma is in meters.

#

Leave it out 😐

ionic orchid
#

I wish find took an expression

little eagle
#

Uhm, how'd that work?

ionic orchid
#

like a select, but stop at the first result, I think

#

or return an array of matching indices

little eagle
#

So basically a shorter version of:

private _result = -1;
{
    if (CONDITION) exitWith {
        _result = _forEachIndex;
    };
} forEach ARRAY;

?

subtle ore
#

my thoughts exactly ^

ionic orchid
#

yeah that'd be it

subtle ore
#

backtick.

#

not a single quote

#

` not '

#
hint "Hey kid, you like syntax highlighting?";
little eagle
#

```sqf

code here <<<

```

subtle ore
#

^

little eagle
#

Each individually. Also, the code is fully encapsulated by {}, but it's never called?

subtle ore
#

Whats with all those positions in the foreach?

#

Near objects is only going to take one of those

little eagle
#

Yes. One position per nearObjects

#

Though, this works:
((POS_1 nearObjects 500) + (POS_2 nearObjects 500) + (POS_3 nearObjects 500) + (POS_4 nearObjects 500))

subtle ore
#

👍

#

what are you using as a text editor?

#

ytou're missing an ending bracket

#

you're missing a ] at the end of the addition

#

Yep

#

fix that

#

and I think you should be fine...?

#

Yep.

#

btw it should be something more like this

#
{ 
    addMissionEventHandler ["EachFrame", 
    { 
               { 
                    if (_x isKindOf ["Default", configFile >> "CfgAmmo"]) then 
            { 
                       deleteVehicle _x; 
                    }; 
            } forEach (([14379.6,16139.4,5.34058e-005]nearObjects 500) + ([14808.6,16574.8,2.67029e-005]nearObjects 500) + ([15245.6,17253.1,3.43323e-005]nearObjects 500) + ([15415.1,17108.5,-0.000137329]nearObjects 500) + ([15248.4,16984.2,0.000112534]nearObjects 500))        ; 
        }]; 
};
#

I think you get the idea, freaking notepad

#

don't use execVM

#

but yeah, the formatting was just weird with yours

#
{ 
    addMissionEventHandler ["EachFrame", 
    { 
        { 
        if (_x isKindOf ["Default", configFile >> "CfgAmmo"]) then 
            { 
                       deleteVehicle _x; 
            }; 
        } forEach (([14379.6,16139.4,5.34058e-005]nearObjects 500) + ([14808.6,16574.8,2.67029e-005]nearObjects 500) + ([15245.6,17253.1,3.43323e-005]nearObjects 500) + ([15415.1,17108.5,-0.000137329]nearObjects 500) + ([15248.4,16984.2,0.000112534]nearObjects 500))        ; 
    }]; 
};
#

use call compile preProcessFile

#

[] call compil preProcessFile "scripts\BaseProtection.sqf";

#

faster

#

you had some really funky 3 spaces on some of those brackets..

#

no, just replace execVM "scripts\BaseProtection.sqf"; with that

simple solstice
#

add e

#

to compil

#

or just use cfgfunctions

subtle ore
#

🤦

#

yeah or cfgFunctions

simple solstice
#

with postinit

subtle ore
#

lool, compil

simple solstice
#

cfgfunctions is what you are supposed to do as a mission maker

#

compiles on mission load

#

easier to call/spawn the script

subtle ore
#

sure

simple solstice
#

and you can use pre/post init

subtle ore
#

honestly, there isn't any point if you're going to run it once