#arma3_scripting

1 messages ยท Page 269 of 1

tough abyss
#

Is where it is stored

jade abyss
#

ui_f

tough abyss
#

^

jade abyss
tough abyss
#

inc files

#

is what you'll need to look at

rancid ruin
#

imagine if BI documented IDCs

jade abyss
#

For what?

tough abyss
#

To find the exit button IDC

rancid ruin
#

for making it easier to mod their game

jade abyss
#

Not absolutely everything must be documented.

tough abyss
#

Somethings are self-documenting

jade abyss
#

Its a thing of max 1min to find that button

rancid ruin
#

how?

jade abyss
rancid ruin
#

grep'ing exit/quit/etc?

jade abyss
#

ffs... Why don't you just try it?

#

i hate this generation... instead of trying it, they ask for every fkn shit...

tough abyss
#

^

#

Coding is 90% testing

#

Atleast.

rancid ruin
#

what generation is that lol

#

i could be 75 for all you know

tough abyss
#

Asking stupid questions is bad.

#

Specifically questions you can answer yourself.

rancid ruin
#

right

jade abyss
#

"Can i do this" - "Have you tested it?" - "Can i test it?" - "Why do ask me?" - "Can i ask you?"

tough abyss
#

Get familiar with the P-drive

#

It will de-pbo everything

#

Then you can view it ๐Ÿ˜„

jade abyss
#

Not even familiar, just some basic logical thinking and some thinking of your own. Its no mastermind needed :/

rancid ruin
#

ok i'm sorry i don't spend every waking hour figuring out how to mod specific arma stuff

tough abyss
#

@jade abyss Not many people have learned the basic understanding of logic

jade abyss
#

Or "(re)searching"

tough abyss
#

One of the things need to be familiar with, development.

#

You become a googler

#

So much googling.

jade abyss
#

@rancid ruin Don't get me wrong, but:

oneoh - Today at 2:08 AM
grep'ing exit/quit/etc?```
This is the most stupid kind of question to ask. Instead of just searching for it first... You would get your answer for yourself, instead of asking if you could do it.
#

No realy, why didn't you just search for that kind?
+what Geeky said: Google. I bet there is min. 1 entry that will answer your question, if you type "Arma 3 IDC Exit button"

tough abyss
#

^

#

But.

#

You must understand the question to answer your question

#

I know thats a little circular but it is true

#

You can not solve a problem you do not understand.

#

If you are already familiar for IDC's and how they work

#

That will help.

willow basin
#

Had a bad day? ^^

tough abyss
#

As well as how the config files actually work.

#

More than likely the definitions for the exit button are.

#

a "button class type" obviously.

#

Thats probably the class type it's defined as.

#

How can I delete and reload the P drive @jade abyss

#

I just realised it unpacked to my C drive...

#

:/

jade abyss
#

Even if not:
"Text=" is the important part. Every button has a Text, wich means: Every button has a text defined in its config, wich means: Every button has a text="StringYourSearchFor", wich means: You can find that particular putton pretty easy.

#

There should be something in the Tools, where you can define a Part for the P: Drive

tough abyss
#

Can I delete it the same way?

jade abyss
#

for example mine was:
E:\ARMA_Workdrive

#

everything was in there

tough abyss
#

Yeah mine was meant to be D:

jade abyss
#

Nah, no need to delete

tough abyss
#

It went to C

jade abyss
#

Check the ArmaTools settings

tough abyss
#

Ah path to P drive

#

So what it will do some wizardry

#

and redirect it's unpack?

jade abyss
#

(I don't have them installed anymore)

#

"Path to P Drive" Yeah, i think so. Just copy everything from C to that new Folder you defined

tough abyss
#

Do you use Posedion tools or N++ ?

#

@jade abyss

jade abyss
#

Nothing anymore. Used n++ before.

tough abyss
#

@jade abyss Doing what you said

#

then changing the dir

#

Broke the P-drive

#

Now it refuses to mount correctly.

jade abyss
#

Restart

tough abyss
#

Windows?

jade abyss
#

+before you mount -> Copy everything over.

#

Yes, Windumb

tough abyss
#

xD

tough abyss
#

@jade abyss thanks for the assist it wasn't that though

#

Derp you can't put your P drive in the D:\ root dir

#

It requires a seperate folder

#

Double derp

#

It would overwrite the D:\ drive

#

and be bad.

jade abyss
#

Oh my

tough abyss
#

Atleast windows didn't allow me to do it

#

XD

#

So windows I guess isn't as dumb as we think

#

It's unpacking all the data now.

#

Thanks again @jade abyss will make scripting and dev'ing much easier

#

I use a flashdrive as my working drive

jade abyss
#

o7 yw

tough abyss
#

Also @jade abyss is there a way to interface with the Dynamic simulation system?

#

Via scripting commands etc?

#

I reworked lots of things on my code systems to englobe simple objects just to notice right after that simple objects are very specific objects and need to be threated separatelly.

#

You probabily will never want a building with doors to be simple object.

jade abyss
#

is there a way to interface with the Dynamic simulation system? <- ??

tough abyss
#

Recent update added in dynamic simulation manager

#

What it does is doesn't simulate everything thats in the mission

#

Only what players are near.

jade abyss
#

No clue, haven't touched Arma for... about 4-5 Month's

tough abyss
#

So the simulation loop doesn't spend so much time on things it doesn't need to.

#

As with old arma 3. ALL vehicles, ALL Objects, ALL AI

#

is simulated by clients and the server

jade abyss
#

I don't do anything in Arma anymore. More or less retired. Just here to rant around ๐Ÿ˜„

tough abyss
#

Would the Biminions help?

#

If I paged them?

jade abyss
#

Guess they have better things to do^^

#

(i would wonder if, but also understand it)

tough abyss
#

Anyone else familiar with the new dynamic simulation?

#

I noticed I can set it on vehs.

#

Biggest problem.

jade abyss
#

Ask the same Q in about 10 Hrs again.

tough abyss
#

I want a scripting command to use it.

#

Is there any way to use arsenal and incorporate it into a mission? A mission like BECTI that is...where certain gear shows based on a team's upgrade level

#

also, has anyone gotten arsenal to load in a way that doesn't load the virtual space, and keeps you in the current space you're in

#

We use ALIVE

#

so it uses a virtual profiler

#

They need to do 1 thing @tough abyss

#

Make it internal engine command based

#

Just like the new garbage collector

#

addToRemainsCollector

native hemlock
tough abyss
#

Machine Gun Wars

jade abyss
#

Wait, that sounds like the stuff i was talking about 1-2 weeks ago oO
(just without caching it)

native hemlock
#

https://dev.arma3.com/post/sitrep-00181

Many of you got excited to see Dynamic Simulation in the Release Candidate build. Unfortunately, as we've expanded on its implementation quite a bit recently, the feature requires more testing time by our QA experts and we've decided not to include it in Update 1.66.
tough abyss
#

Good morning @little eagle !

little eagle
#

oh boy

cedar bay
#

how can I make a checker that would createvehicle explosion if a player is found carrying a certain type of weapon in his hands? I have 2 weapons that I would need to "prevent" for players to use and punish them.

little eagle
#

using CBA?

["weapon", {
    params ["_unit", "_weapon"];

    if (_weapon == WHATEVER) then {
        // explosion
    };
}] call CBA_fnc_addPlayerEventHandler;

Using vanilla? Probably a trigger testing currentWeapon player

little eagle
tough abyss
#

In SQF this "60000 mod 33" is more expensive than "600 mod 33"?

split coral
#

No idea, doubt it. You could check it with code performance.

buoyant heath
#

Tested - no difference

tough abyss
#

@buoyant heath thanks a lot.

#

I have a counter that starts in 0 and receive + 1 each cicle.

#

Then it triggers something when "_counter mod _someNumber" return zero.

#

So its periodically triggers many things.

#

The counter can reach really big values, and if a want to reset it i need to reset it on the number that is Connom Minimum Multiple to not break any trigger cycle.

#

And this CMM is really big also.

buoyant heath
#

Is this all an attempt to spread out the execution of code?

noble juniper
#

hi

tough abyss
#

Hey guys

tough abyss
#

@buoyant heath is to have many execution periods in just one loop.

#

So one execute when _counter mod 10 is 0

#

Other execute when _counter mod 300 is 0

#

And so on...

#

In this example "... mod 10" and "... mod 300" i can reset the counter to 0 when it reachs 300.

#

With "... mod 3", "... mod 5" and "... mod 7" i can reset the counter to 0 when it reachs 3x5x7=105

#

Or never reset it, but it will reach really high values.

velvet merlin
#

@little eagle sure go ahead

#

@native hemlock BI messed up and parts of DynSim is in 1.66

grizzled cliff
cedar bay
#

Tnx commy2, usibg cba yeah

#

That goes into trigger or?

halcyon crypt
#

@grizzled cliff huh, wasn't it already for a while? ๐Ÿ˜›

tough abyss
#

On this code:

_building setDamage 1;
_building setVariable ["needClean",true,true];```
The var "needClean" will be set on the ruins?
#

Check the details of _building after you demolish it.

#

Specifically the classname, I would venture to guess it will be ruins.

#

@grizzled cliff If only we could integrate ACRE as a vanilla product and call it "Advanced Communications"

grizzled cliff
#

@halcyon crypt Yea but this is officially now the case. ๐Ÿ˜›

#

@tough abyss Haha yea that'd be nice

tough abyss
#

@tough abyss thanks man!

tough abyss
#

Code performance now. Works in MP

turbid coral
#

Good evening guys, quick question

vale hull
#

Anyone out there using Taskforce Radio, how u pre-setting radio channels with latest version of TFR?

#

was previously using tf_freq_west_lr = false call TFAR_fnc_generateLrSettings; tf_freq_west_lr set [2,["80.1","81.1","82.1","83.1","84.1","85.1","86.1","87.1"]]; doesnt seem to work now with new version

turbid coral
#

Essentially, I have an odd issue. I have moved a bunch of scripts to Server-Side, and I can call this perfectly fine, but when I put it in my add action it doesn't do anything. It appears, but when I click it it does nothing. The function is life_fnc_bankteller , as I said works perfectly fine when called in console. The add action is = init="this enableSimulation false; this allowDamage false; this addaction [""Bank Worker Sign Up"",call compile life_fnc_bankteller];";

#

@vale hull Not certain bud, never messed with the default radio channels personally.

vale hull
#

addactions are local, you will need to remoteexec it to server if you want it to run on the server

turbid coral
#

Sorry, that was one of my tests

#

The addaction is init="this enableSimulation false; this allowDamage false; this addaction [""Bank Worker Sign Up"", life_fnc_bankteller];";

#

All functions are precompiled via precompilelinenumbers

#

Sorry, I may of got mixed up. Big project, let me double check.

#

Okay, sorry. Thats how our InitFunctions are called. Our algorithm makes them all public variables and compiles them. Is it failing to compile the only possibility if the script works when calling in console vs. Addactions?

#

Our other functions in the algorithm is compiling and working via add action, so it's odd

tough abyss
#

@vale hull

#define RADIO_SW_FREQUENIES [[1,"41"],[2,"41.1"],[3,"41.2"],[4,"41.3"],[5,"41.4"],[6,"41.5"],[7,"41.6"],[8,"41.7"]]
#define RADIO_LR_FREQUENIES [[1,"70"],[2,"71"],[3,"71.2"],[4,"72"],[5,"73"],[6,"74"],[7,"75"],[8,"76"]]

player addEventHandler ["InventoryClosed", {
    if (call TFAR_fnc_haveSWRadio) then {
        {
            [call TFAR_fnc_activeSWRadio, _x select 0, _x select 1] call TFAR_fnc_SetChannelFrequency;
        } forEach RADIO_SW_FREQUENIES;
    };

    if (call TFAR_fnc_haveLRRadio) then {
        {
            [call TFAR_fnc_activeLRRadio, _x select 0, _x select 1] call TFAR_fnc_SetChannelFrequency;
        } forEach RADIO_LR_FREQUENIES;
    };
}];
#

Thats what I use for my group

turbid coral
#

@tough abyss Wrong chap, Look above @vale hull

tough abyss
#

Oops

#

Thats my pre-programmer attached to an EVH

#

As soon as you press I for inventory

#

It sets all your radios

turbid coral
#

Alright, one sec, let me give it a try

#

Crashed my dev server, it didn't like single quotes XDD

vale hull
#

thanks @tough abyss will use that if i cant find the config to do it

#

i think can do TFAR_defaultFrequencies_sr_west = ["310","320","330","340","350","360","370","380","30.6"]; TFAR_defaultFrequencies_lr_west = ["84.4","31","32","33","34","35","36","37","38","30,6"]; now but need to test

tough abyss
#

Remember the script has to actually be executed

cerulean whale
#

@tough abyss Already fixed the problem. It's because we are running the functions through the compiling algorithm and not the actual cfgFunctions which is what the addAction is configured to look for (currently addAction ["function",fnc_function] we changed to addAction ["function", { spawn fnc_functionl }])

#

I was just at school and didn't have time to change it to my new system before I left lol

tough abyss
#

@cerulean whale Stop using the old method.

#

Use cfgFunctions.hpp

little eagle
#

which is what the addAction is configured to look for

#

pretty sure it's just a race condition, but w/e

cerulean whale
#

Hey, it didn't work before, now it does. So whatever ye. xD @tough abyss what @tough abyss said.

#

In the end it actually increased all the load times of our crap a ton and stopped all our script lag where it occured

#

ended up quite well (occured in the first instance because of bad scripts that other people made) but it also meant people can't just steal my crap anymore

cerulean whale
#

They can but it's harder

#

As in, idiots can't steal it

#

by just copying the missin

jade abyss
#

sniffsniff I smell life in here sniff

cerulean whale
#

Well, they can, but at least I have the satisfaction of knowing someone actually had to try ๐Ÿ˜„

#

How would I execute it though if it was outside? (just like a normal mod I assume?)

#

@tough abyss

#

Thanks a ton, I've only just got into serverside scripting other this weekend

#

Kinda new to it but it seems to be a lot better than clientside

#

yeah

#

ah

jade abyss
#

Not rly, can be screwing up the bandwith if you overdo it (e.g. Yellow/Red Chains, Lags when ppl connect)

cerulean whale
#

I guess we'll see how it goes, we are paying quite a good server tho

jade abyss
#

The question is: Is it rly needed? Worth the effort?

#

99% of the cases: Don't think so.

#

Exactly.

cerulean whale
#

The main reason we are doing it is to keep a few hostile people away from our files

jade abyss
#

and then?

cerulean whale
#

We don't want to get our crap ripped instantly. We are ok with it after awhile tho

#

I don't think it should overstress the server, we have 64mb RAM, a crap ton of bandwidth and a really powerful CPU

jade abyss
#

Its not "overstress" the Server, read what i wrote before.

#

You can have a 1GBit connection and still: Ppl can lag around like a rubberband in the hand of a kiddo

#

and if your Server is not properly setup -> all other Clients, that are currently connected, can feel that lag.

#

(even with proper setup, lag can occur)

#

w/e

cerulean whale
#

Also a way to get rid of goddamn mission updates that give _CUR_MP.pbo errors

#

The ammount of people who don't know how to fix that is a absolute pain!

thin pine
#

"I don't think it should overstress the server, we have 64mb RAM, a crap ton of bandwidth and a really powerful CPU". Holy shit 64mb of ram. :O hehe

spring ravine
#

some deditated wam

vague hull
#

Raspberry Pi Mini I guess

#

Never the less, it is more secure, if you understand to use battle eye .. however, we all know.. battleye isn't perfect

dim owl
#

hi can i use publicvariable just for one side for example i have testvar = 1; for independent and testvar = 30; for west ?

#

maybe with

testvar = 30;
{
    if (side _x isEqualTo west)then {
        _x publicvariableClient "testvar";
    };
}foreach playableUnits;

?

indigo snow
#

publicVariableClient takes a client ID, not an object. Convert with owner (only works on servers)

native hemlock
#

Another option would be just to have a function that set the variable, then you would remoteExec it only on one side

dim owl
#

okay because i want a persisten variable for one side
so i am not sure what to use

indigo snow
#

remoteExec would likely be better since it is JIP compatible and persistent

dim owl
#

okay thank you ๐Ÿ˜ƒ

#

which number do i need to use with remoteexec to execute it just serverside ?

indigo snow
dim owl
#

yeah sorry havent seen it ^^

indigo snow
#

server ID is 2

dusk sage
#

You may specify a side as a target @dim owl

#

As an fyi

kindred kayak
#

Has anyone discovered a way to remap keybinds for cameras used by spectator modes like EGSpectator, etc... ? The underlying camera used is CamCurator, though I haven't noticed a way to hook into keybinds for that type of cam.

#

The hardcoded values aren't ideal for some Intl layouts.

rotund cypress
#

Is it possible to make a dialog that will dynamically rezise itself based on how much text is inside it? E.g.: dynamically resize the height value?

steep matrix
#

@tough abyss np

cerulean whale
#

@thin pine I just made myself look like such an idiot hahahahaha

#

@rotund cypress Depends.... If you are making it show text then yeah. The box will resize with text.

#

Just enable Simulation true

#

I believe will do it

dusk sage
#

You can always manually change the size @rotund cypress

rotund cypress
#

But it's a replacement for hints @dusk sage

#

And thank you @cerulean whale It's two controls: title and then text

vernal rune
#

Does anyone know any ways of forcing someone's (ingame/profile) name to something apart from kicking them and asking them to change it?

dim owl
#

And how can i fill it ?

proven pike
#

Whats the little snip of code to load a dialog in from a mission already, I used to know how, but it's been ages since so I forgot and can't really find it anywhere

sharp jay
#

Hello, #arma3_scripting! If anyone has time to explain how to save player data to a database on a server i would appreciate it. What i am trying to do is save player inventory and also have a "personal safe" that will be backed up and accesible in multiple missions.

halcyon crypt
#

I doubt that it's explainable in a Discord setting.. Review DayZmod or any of it's clones, Exile, A3 life probably, ALiVE, etc

dusk sage
#

Look into extDB3 @sharp jay

sharp jay
#

@BoGuu#1044 I did and i could not understand it, but i will look harder. Thanks

dusk sage
#

As marcel said, use those as examples

dim owl
#

okay the problem with the listbox i figured out. now my next problem is how can i set the active color of the lb ?

dim owl
#

No idea anyone ?

halcyon crypt
#

there's probably also a config property for it but can't remember

dim owl
#

@halcyon crypt Thanks, but i dont help me because the problem is still it will not set the color if i use lbsetcolor or ctrlsettextcolor. nothing of it works. maybe theres another way to do this

#

now it works with lbsetselectcolor

#

๐Ÿ˜„

tough abyss
#

How many of you guys actually write your pseudo code before coding?

#

I've noticed if I do it often turns out better than wing-ing it coding.

rancid ruin
#

i kinda do yeah. i lay out the bones of it, do comments, then flesh it out after

#

not sure if it results in better code for me, but it saves time

tough abyss
#

PSEUDO-code is very helpful.

#

It accelerates development.

dusk sage
#

I usually stay one down from pseudo code, if you will. I either go straight into it, or write a bare bones structure out

#

Usually file format

tough abyss
#

I've been trying to work with I&A's code for the past hour

#

And resulted to just gutting 90% of it and re-writing it.

cerulean whale
#

@rotund cypress I've just done the exact same thing xD

tough abyss
#

How does the path to #included macros work?

dusk sage
#

How ever you want

#

Can use relative or absolute

rotund cypress
#

Did you get it working with resizing the dialog?

tough abyss
#

@dusk sage Problem is when I attempt to include the file

#

from a specific folder

#

Arma goes nope

#

Can't find it.

rancid ruin
#

does setButtonAction have any benefits over ctrlSetEventHandler'ing the button instead?

#

as far as I can tell, you can't tell what ctrl the button press originated from with setButtonAction, or am I missing something?

halcyon crypt
#

there is no setButtonAction

#

there is buttonSetAction though, and it's from the OFP/SQS era. You should probably forget about that one ๐Ÿ˜ƒ

#

either use the action property in the config or use the UI EHs, IMO

rancid ruin
#

buttonSetAction yeah sorry

#

wiki says it only allows SQS but SQF seems to work no problem. i would use configs but all the displays/dialogs are created via script

weak tiger
#

14:33:48 Server: Object 2:3895 not found (message Type_121)

#

rpt flooded with these any ideas?

rancid ruin
#

think that's some kind of locality issue

weak tiger
#

trying to do stuff on a non-local object?

#

that was my fear so you kinda confirmed it thanks

rotund cypress
#

@cerulean whale Did you get it working with resizing the dialog?

rotund cypress
#

If I want to return a name of a player that is in a vehicle on my cursor, how would I do that? I tried name vehicle cursorTarget but that did not work

rancid ruin
#

get the crew then get the name i guess

#

name (crew vehicle select 0) or something i'd say

rotund cypress
#

ah ok thanks

#

What is the best command if I want to check a vehicle type? I tried cursorTarget isKindOf getArray ["Tank","Helicopter"]

#

also typeOf cursorTarget in ["Tank","Helicopter"];

#

E.g: If it is either a Heli tank or car I want the statement to be true

#

I tried all sorts of commands but it aint working,.

rancid ruin
#

getArray is for returning arrays from cfg entries

#

((cursorTarget isKindOf "Tank") || (cursorTarget isKindOf "Helicopter")) should work

#

or something like typeOf cursorTarget in ["Tank", "Helicopter"]

rotund cypress
#

I did typeOf cursorTarget in ["Car", "Tank", "Helicopter"]; pointing at a prowler but it returned false

tough abyss
#

cursorTarget isKindOf "Tank" || { cursorTarget isKindOf "Helicopter" }

rotund cypress
#

So there isnt any way of getting it in a array to make it cleaner ? @tough abyss

rancid ruin
#

typeOf returns classname actually

rotund cypress
#

ye

rancid ruin
#

so that won't work

tough abyss
#
if ( ( count _veh_list ) > 0 ) then { ... };```
rotund cypress
#

Also does airplane name return true for the ceasar and all jets?

#

So like cursorTarget isKindOf "Airplane"

tough abyss
#

you can use nearEntities instead of nearestObjects for alive-only vehicles.

rotund cypress
#

oh yeah

tough abyss
#

I wish there was a list of the generic names on the wiki (plane, tank, etc)

rotund cypress
#

yeah

rancid ruin
#

what, a class name list? there is

rotund cypress
#

no

#

Type of vehicles

#

Airplance, Helicopter, Car

#

etc

split coral
rotund cypress
#

So an airplane would just be Air I guess?

split coral
#

I think so.

rancid ruin
#

"Air" is a class which "Helicopter" and "Plane" both inherit from

rotund cypress
#

Ah ok

#

So isKindOf "Air" would return true if airplane or heli?

split coral
#

yeah

rotund cypress
#

Another question. I've been looking for the case code for key ยง on my keyboard. Does anyone know what key code that is?

#

I checked all lists but couldnt find it

rancid ruin
#

create a handler for keycodes, make it log/hint the pressed key, press the key, note down output

rotund cypress
#

well...

#

oh found one

split coral
rotund cypress
#

Yeah checked that one but added an eventhandler instead in debug which logged what key I pressed instead as @rancid ruin mentioned.

#

Thanks though!! ๐Ÿ˜ƒ

rancid ruin
#

what kind of keyboard has a section key anyway?

#

i'd have to press alt + a load of numpad numbers to type that character

rotund cypress
#

I think most european ones.

#

I'm on a Nordic keyboard ATM

split coral
#

ยง

#

yeah me too

#

it seems

rotund cypress
#

Nordic? @split coral

split coral
#

yes

rancid ruin
#

i'd use a more common key tbh

#

uk + us keyboards don't have a section key

rotund cypress
#

Okey maybe thanks for the input. Ill use another key then

dim owl
#

hey how can i get the display image of an object like a roadbarrier ?

little eagle
#

"display image"?

#

the jpg from 3den?

#

getText (configFile >> "CfgVehicles" >> typeOf _barrier >> "editorPreview")

#

I guess

dim owl
#

yeah thx. but i think there are other pictures like the chemlight picture. need it for an inventory item

little eagle
#

you said road barrier

#

replace CfgVehicles with CfgWeapons and editorPreview with picture

#

and remove the typeOf ofc

dim owl
#

yeah i want to have it in my inventory and creating for that my own inventory item. but now i need a displaypicture

little eagle
#

you can check all this in the ingame config viewer

dim owl
#

thx

rotund cypress
#

will this work if target is a player? _vehiclePicture = [getText (configFile >> "CfgVehicles" >> (typeOf _target) >> "icon")] call BIS_fnc_textureVehicleIcon;

#

Type "Man" vehicle I guess?

tough abyss
#

@little eagle Does arma 3 not like you putting macro definitions in non-root folders?

noble juniper
#

@tough abyss i'm 100% sure that your include path is wrong

#

cuz i use macros a lot. And take a look at Altis life, macros everywhere

little eagle
#

relative path:
#include "script_component.hpp"
path from root:
#include "\x\cba\addons\main\script_macros.hpp"

#

note, leading slash = root, no leading slasg=relative

#

I think C++ uses <path> vs "path" for this, but in Arma both quote marks and triangles do the same

#

the "\x\cba\addons
part is from pbo prefix:
x\cba\addons\COMPONENT

#

leave that out if you don't use it and use the BI tools instead

tough abyss
#

#include "\Mission Framework\shared\mission_script_macros.hpp"

#

Inside of a file that is not in the same directory as shared

#

It complains that the mission_script_macros.hpp don't exist.

#

"Mission Framework\Library\Setup\fn_setupEnemyInfantry.sqf"

#

Is the directory I'm including from.

#

@little eagle

#

#include "shared\mission_script_macros.hpp"

#

Also tried that.

#

Still no go.

#

Complains it doesn't exist

#

crashes arma 3

little eagle
#

description.ext?

tough abyss
#

Does it have to go into the description.ext as well?

little eagle
#

BI broke it there. Can't use it. Crashes sever all the time

#

in description.ext

tough abyss
#

No it's not in the description.ext

#

I't included inside this file.

#
//---------- CONFIG
#include "shared\mission_script_macros.hpp"
params [
    ["_marker",""]
];
//---------- INFANTRY PATROLS RANDOM
    for "_i" from 1 to PARAMS_GroupPatrol do {
        tickInGrp = diag_tickTime;
        _patrolGroup = createGroup east;
        _randomPos = [[[getMarkerPos currentAO, (PARAMS_AOSize)],[]],["water"]] call BIS_fnc_randomPos;
        _selectPatrolType = selectRandom [INF_TYPE];
        _patrolGroup = [_randomPos, EAST, (GRPSCLASS >> _selectPatrolType)] call BIS_fnc_spawnGroup;
        [_patrolGroup, getMarkerPos currentAO, 400] call BIS_fnc_taskPatrol;

        _enemiesArray = _enemiesArray + [_patrolGroup];

        {
            _x addCuratorEditableObjects [(units _patrolGroup), false];
        } foreach adminCurators;
    };
    tickOutGrp = diag_tickTime;
    diag_log format ["Groups intialisation completed in %1",tickOutGrp - tickInGrp];    
#

GRPSCLASS is the group superclass

little eagle
#

where is this file?

tough abyss
#

defined in the macros.

#

"Mission Framework\Library\Setup\fn_setupEnemyInfantry.sqf"

little eagle
#

what path is this file?

tough abyss
#

There.

#

That path.

little eagle
#

And "shared" is inside "Setup" ?

tough abyss
#

No.

little eagle
#

then it won't work

tough abyss
#

Shared is inside this folder.

little eagle
#

which one?

tough abyss
#

#include "\Mission Framework\shared"

#

shared also contains a cfgFunctions.hpp

little eagle
#

that is a file and not a folder

tough abyss
#

and a remoteExec.hpp

#

Mission Framework\shared is where the .hpp is

little eagle
#

#include "..\..\shared\mission_script_macros.hpp"

#

use this

#

can't use root path for missions

#

but you can use parent folders I think

tough abyss
#

No crash thats a good sign

little eagle
#

I heard something about .. not working in missions

#

no idea

#

but yeah. can't use the absolute path for missions

#

at all

#

outside of description.ext you can, but it uses the addon root

#

and description.ext and all includes files straight up crash the game

#

the server at least when changing missions

#

I think the first mission works or something. really weird and broken

tough abyss
#

So how does arma 3 parse this?

#

#include "..\..\shared\mission_script_macros.hpp"

#

What does it basically look for?

little eagle
#

.. means one folder back

#

It works?

tough abyss
#

Yes

rancid ruin
#

you're allowed to have spaces in the file path?

little eagle
#

in Arma you are

#

ยฏ_(ใƒ„)_/ยฏ

meager granite
#

you can't include locations above current with #include

#

so .. wouldn't work

little eagle
#

in missions?

#

because I do it all the time in addons

tough abyss
#

Well it didn't complain undefind variable.

#

For the Preprocessor directive

little eagle
#

but did it include the file?

tough abyss
#

Must have.

#

Otherwise that function wouldn't have called correctly.

little eagle
#

there. works

#

another problem solved

#

now let me sleep

#

aaaaaa

tough abyss
#

Whats the best way of naming variables?

#

Got any guidelines @little eagle

#

?

little eagle
#

camel case and descriptive names

#

grrrr

tough abyss
#

kk

#

And use ACE3 / CBA documentation gotcha

meager granite
#

I remember it wasn't working in the missions for security purposes (so you can't reach out of the game files of people that joins your server and downloads the mission)

#

Maybe it is allowed with addons, I don't know

dusk sage
#

Whats the best way of naming variables?

#

In a way that's allowed? It's your mission

tough abyss
#

Interesting question

#

Do variables need to be initialised?

#

before being used?

#

e.g delcared?

little eagle
#

no, but it's good practice to define a home scope for them

#

which almost looks like you're doing the same

tough abyss
#

    private ["_pos","_i","_position","_flatPos",
    "_roughPos","_targetStartText","_targets",
    "_targetsLeft","_unitsArray","_radioTowerDownText",
    "_targetCompleteText","_regionCompleteText",
    "_null","_mines","_chance"];
    
eastSide = createCenter east;
enemiesInf = [];
enemiesVeh = [];
//---------------------------------------------- AO location marker array

// Disabled fobs.
// ["FOB_SE","FOB_SE_Hmv","FOB_SE_Hmv_1","FOB_SE_LZ","FOB_SE_Repair","FOB_SE_Medic","FOB_SE_Fuel","FOB_SE_Ammo","FOB_SE_APC","FOB_SE_Supp"] execVM "mission\Fob\FOB_Main.sqf";

//----------------------------------------------- AO MAIN SEQUENCE
    _target = [] call MM_fnc_buildLocationsPosAndNameMain;
    AOMarker_IDs = _target call MM_fnc_createMissionMarker;    
    
    currentAO = AOMarker_IDs select 0; // Return Primary marker
    AO_String_Name = _target select 0; 
    sleep 1;

    //------------------------------------------ Spawn enemies
    enemyInfs =[currentAO] call MM_fnc_setupEnemyInfantry;
    // enemyInfs = [currentAO] call MM_fnc_setupEnemyVehs;
    enemiesInf pushBack enemyInfs;
    // enemiesArray pushBack enemyVehs;
#

Complains that enemyInfs is undeclared.

#
#include "..\..\shared\mission_script_macros.hpp"
params [
    ["_marker",""]
];
//---------- INFANTRY PATROLS RANDOM
    for "_i" from 1 to PARAMS_GroupPatrol do {
        tickInGrp = diag_tickTime;
        private _patrolGroup = createGroup east;
        private _randomPos = [[[getMarkerPos currentAO, (PARAMS_AOSize)],[]],["water"]] call BIS_fnc_randomPos;
        private _selectPatrolType = selectRandom [INF_TYPE];
        private _patrolGroup = [_randomPos, EAST,GETUNITCLASS(_selectPatrolType)] call BIS_fnc_spawnGroup;
        diag_log format ["_patrolGroup :%1",_patrolGroup];
        [_patrolGroup, getMarkerPos currentAO, 400] call BIS_fnc_taskPatrol;

        enemiesInf = enemiesInf + [_patrolGroup];
        diag_log format ["enemiesInf: %1",enemiesInf];

        {
            _x addCuratorEditableObjects [(units _patrolGroup), false];
        } foreach adminCurators;
    };
    tickOutGrp = diag_tickTime;
    diag_log format ["Groups intialisation completed in %1",tickOutGrp - tickInGrp];
#

Even though I add a value to it

#

then diag_log it out

#

It exists.

#

Should I declare enemyInfs?

#

see if it fixes it?

#

Or should I just use setVariable and give it a default var?

#

Might try that.

little eagle
#

I have no idea, it's too late.

tough abyss
#

"enemiesInf: [O Alpha 1-3,O Alpha 2-2,O Alpha 3-1,O Alpha 3-3,O Alpha 4-2]"

#

See returns the AI

#

even spawns them.

little eagle
#

But everytime you use that private array thing a puppy dies.

#

so stop

tough abyss
#

should I use ?

#

params?

#

For all of it?

dusk sage
#

For parameters

#

Yeh

little eagle
#

No, the keyword. params is for _this or other arrays

buoyant heath
#

private _var = stuff;

dusk sage
#

Use private keywords for the rest

little eagle
#

^

dusk sage
#

^^

tough abyss
#

Oh the legacy code.

#

the private ["_array"];

#

Thats old It's being phased out if you look in 1 script

little eagle
#

you wanted advice about variable names?

tough abyss
#

Wonder if pushBack doesn't work on global arrays.

dusk sage
#

It does work

little eagle
#

having both _pos and _position is horrible

dusk sage
#

Hehe

tough abyss
#

What should I do instead?

little eagle
#

enemyInfs =[currentAO] call MM_fnc_setupEnemyInfantry;

dusk sage
#

I'm sure you can work that out

little eagle
#

I think this line just assigns nil

#

MM_fnc_setupEnemyInfantry probably reports nothing

tough abyss
#

Yeah thats what I saw.

#

It should be returning as the global var

#

inside that function gets updated.

#

ohhh derp...

dusk sage
#

Huh

tough abyss
#

facepalm

dusk sage
#

๐Ÿ™ˆ

tough abyss
#

Yep...

#

that was it..

#

Now the codes working.

little eagle
#

another problem solved

#

now let me sleep

tough abyss
#

@meager granite Are global variables still alive when a script finishes?

dusk sage
#

Yes

#

You can ask people without mentioning them too ๐Ÿ˜‰

tough abyss
#

Oh...

#

:/ Sorry.

tough abyss
#

When an object is destroyed do all setVariables to that object get null'ified?

rancid ruin
#

like setDamage 1 or what?

tough abyss
#

Damn event handler not firing...

#

Why?

#

Radio-tower gets destroyed but the EH is not firing.

#

Why particularly reason why?

#

Previous tests it worked perfectly.

tough abyss
#

Ah k.

#

@tough abyss What can prevent an EH from firing?

#
params [
    ["_object",objNull],
    ["_state",false]
];
missionNameSpace setVariable ["towerDestroyed",false,true];
diag_log format ["_object: %1",_object];
_HandlerID = _object addEventHandler ["killed",{ 
    diag_log "Handler executed";
    /* 
    missionNameSpace setVariable ["towerDestroyed",true,true];
    diag_log format ["towerDestroyed: %1",towerDestroyed];
    [] spawn {
    waitUntil {
            sleep 10;
            (towerDestroyed && ((east countSide (enemiesInfs)) < PARAMS_EnemyLeftThreshhold))
            };
        };
        private _aoClean = [enemiesInfs] spawn QS_fnc_AOdelete;
        private _MarkersClean = AOMarker_IDs spawn MM_fnc_deleteMissionMarkers;
        
        waitUntil {(scriptDone _aoClean) && (scriptDone _MarkersClean)};
    */
}];        
diag_log format ["_HandlerID: %1",_HandlerID];
_object removeEventHandler ["killed",_HandlerID];
#

Doesn't even register firing.

#

...

#

Might have just noticed the issue

#

Yep that was it.

#

Holy cow

#

My EH based objective system is flawless

#

Everything works.

rancid ruin
#

wasn't it not working properly about 20 minutes ago?

#

are you sure you've tested it thoroughly?

tough abyss
#

No it was a problem with the EH not firing

#

Was related to me attempting to call it and expecting a return from an eventhandler

#

without explicitly providing one.

#

More fool me.

#

Codes lightning fast tough.

#

though*

rancid ruin
#

so you're using EHs to control mission flow and track objectives?

tough abyss
#

Yep

#

No more while {true} do {} in I&A

#

EH is attached to the radio

rancid ruin
#

towerDestroyed is just a single global var? not attached to an actual tower object?

tough abyss
#

Nope as I had a problem

#

setVariables on local objects

#

are destroyed when the object is destroyed.

#

Or are they?

rancid ruin
#

i would guess that setdamage 1 would not destroy the var, but deleteVehicle'ing the object definitely would

#

that's just my assumption though. wouldn't take long to test

#

what i'd do is just create a logic/location of a specific type, at the position of the tower, and store all vars on that

#

locations are good shit

tough abyss
#

Best thing about my EH?

#

I can re-use it for any mission flow

#

that involves blowing things up

#

I can also probably ditch BIS_fnc_randomPos for

#

selectBestPlaces

#

with an accurate of 100

#

precision*

rancid ruin
#

selecting interesting and suitable random positions is always a bit of a struggle

tough abyss
#

selectBestPlaces will scan for specific expressions

rancid ruin
#

someone always spawns inside a rock or some shit

tough abyss
#

Fairly underused.

rancid ruin
#

i've used that, it's generally good but not 100% reliable

tough abyss
#

One good rule I've noticed works

#

is spawning AI on roads.

#

Using a small scan distance per cycle

rancid ruin
#

yeah that's reliable but not so versatile

tough abyss
#

And randomising the selection of the road.

#

using selectRandom

#

I'm incremental debugging right now.

#

I've gutted large bits of I&A's code.

#

I doesn't even look like I&A anymore.

#

I've seperated spawning into 2 seperate systems

#

1 for vehicles 1 for infantry

#

Infantry is executed first as 2 operations are not necessary for it.

rancid ruin
#

was I&A's code bad to begin with?

tough abyss
#

I would say, yes and no.

#

It definitely could have been far far more efficient.

#

I'm assembling components piece by piece.

#

EH based mission flow is extremely efficient.

#

As it indepdently can now manage the AOs in sync?

#

Why? because I can literally execute them all in parallel

#

And not have to update them inside a loop

#

There is no code watching them or while {true} do {}ing

#

Which is utterly dirty in my opinion

#

Is there a cleaner way to do this?

#
for [ {_i = 0}, {_i < count(paramsArray)}, {_i = _i + 1} ] do {
    call compile format
    [
        "PARAMS_%1 = %2",
        (configName ((missionConfigFile >> "Params") select _i)),
        (paramsArray select _i)
    ];
};
#

Oh

#

I can micro-optimise here and improve readability

#

for "_i" from 0 to count(paramsArray) step 1 do {};

rancid ruin
#

i couldn't tell you right now, it's too late

#

it's certainly not very readable though...call compile format never is

tough abyss
#

getMissionConfigValue [attribute, defaultValue]

#

Last time I tried this it had problems

rancid ruin
#

ask commy tomorrow and he will solve it with a 1 liner

dusk sage
#

Don't use that syntax in for loops, use the one you posted after (you can omit the step 1). Also, use missionNamespace setVariable instead of the call compile

#

@tough abyss

tough abyss
#

?

#

Example?

#

That codes not mine

#

It's I&A's

#

I just wanted a better way to do it.

buoyant heath
#

What is that code for? I'm drawing a blank on understanding it.

tough abyss
#

Parameter initialisation

#

Does this.

#

for "_i" from 1 to PARAMS_GroupPatrol do {

#
for [ {_i = 0}, {_i < count(paramsArray)}, {_i = _i + 1} ] do {
    call compile format
    [
        "PARAMS_%1 = %2",
        (configName ((missionConfigFile >> "Params") select _i)),
        (paramsArray select _i)
    ];
};
#

Takes the Parameters name an data

#

and assigns it to a global variable

rancid ruin
dusk sage
#

Use missionNamespace setVariable [..]

rancid ruin
#

it's just taking vars from mission cfg entries and making them global vars in mission namespace right?

tough abyss
#

Thats it.

dusk sage
#

Call compile is not good for performance, definitely don't want to loop it

tough abyss
#

I figured as much.

rancid ruin
#

i just downloaded I&A source and i'll say: if you're re-doing the mission, compress or remove the sound files

#

there's 1.2MB of oggs here which is a lot of filesize for little value

tough abyss
#

I&A 3?

#

or I&A 2?

rancid ruin
#

3

tough abyss
#

No I have I&A 2

#

I didn't like a lot of things in I&A 3 and 2

#

E.g mod-server-side componenting everything.

#

So no-one can look at the source code.

#

Although last I heard, people can just hack it anyway.

#

And if I want to be lazy.

#
for "_i" from (0) to ((count paramsArray) - 1) do {
    missionNamespace setVariable [toUpper(configName ((missionConfigFile/"Params")) select _i), 
    paramsArray select _i];
};
buoyant heath
#

https://community.bistudio.com/wiki/getMissionConfigValue Doesn't that simplify things event further?

tough abyss
#

Parameters for my mission are in a .hpp

rancid ruin
#

it looks like a pretty simple mission code-wise, that gives me more faith in my future mission making

buoyant heath
#

Ah, yeah, that makes sense

tough abyss
#

I&A?

#

Yeah it's simple

#

But half the code I've gutted.

#

Been assembling pieces as I need them.

rancid ruin
#

it's all way more simple than any of the wasteland missions i've looked inside

tough abyss
#

Wasteland is evil

#

Stay away from wasteland

#

Got your P-drive setup?

rancid ruin
#

i've got some kind of leper P drive

#

it's set up but i'm always low on SSD space so half the data isn't there

tough abyss
#

Yeah read BI's functions

#

and open ACE3s source-code

#

and CBA's

#

Much to learn from that.

#

Much more than Altis Life or Wasteland

rancid ruin
#

ye, i'm more interested in the mission flow part

tough abyss
#

Most of BI-missions I've found

#

use FSMs

#

For mission flow.

#
params [
    ["_object",objNull],
    ["_state",false]
];
missionNameSpace setVariable ["towerDestroyed",false,true];
diag_log format ["_object: %1",_object];
_HandlerID = _object addEventHandler ["killed",{ 
    diag_log "EH Fired";
    missionNameSpace setVariable ["towerDestroyed",true,true];
    diag_log format ["towerDestroyed: %1",towerDestroyed];
    [] spawn {
    waitUntil {
            (towerDestroyed && (count (enemiesInfs)) < PARAMS_EnemyLeftThreshhold))
            };
        private _aoClean = [enemiesInfs] spawn QS_fnc_AOdelete;
        private _MarkersClean = AOMarker_IDs spawn MM_fnc_deleteMissionMarkers;

        waitUntil {(scriptDone _aoClean) && (scriptDone _MarkersClean)};
    };
}];        
#

Thats my entire system watching the radio-tower

#

I can even hook the side missions into that code.

#

I have intentions of making that into a generalised function

#

where I can set the state.

#

and name the "setVariable" anything I want.

#

Feel free to use it.

#

Garbage collector is next.

#

This mission works partially

#

AI gets deleted

#

Main AO initialises correctly.

#

There is some tiny bugs left here and there.

#

and the BIS_fnc_notification I might do away with aswell

#

and integrate into the new BIS_fnc_setTask system

#

@rancid ruin Some advice.

#

I learned from code.

#

Incremental debugging.

#

You can always start with the skeleton and say oh I'd like X feature.

#

And add it later.

rancid ruin
#

ye, i'm not a noob, been scripting since arma 2

#

just haven't released any proper missions yet. got a shit load of miscellaneous functions and addons i've made which will hopefully materialise in to something one day

rancid ruin
#

MouseButtonClick EH isn't functioning as I expected. it fires straight after mouse down, rather than firing after mouse down + mouse up

#
_yo = [] spawn { 
    disableSerialization; 
    private _parentDisplay = (findDisplay 12); 
    waitUntil { !(isNull _parentDisplay) }; 
    _ctrl = _parentDisplay ctrlCreate ["RscButton", 6557]; 
    _ctrl ctrlSetPosition [SafeZoneX + (15 / 1920) * SafeZoneW, SafeZoneY + (795.25 / 1080) * SafeZoneH];  
    _ctrl ctrlSetText "default"; 
    _ctrl ctrlAddEventHandler ["MouseButtonDown", {_this select 0 ctrlSetText "down" }];
    _ctrl ctrlAddEventHandler ["MouseButtonUp", {_this select 0 ctrlSetText "up" }];
    _ctrl ctrlAddEventHandler ["MouseButtonClick", {_this select 0 ctrlSetText "clicked" }];
    _ctrl ctrlCommit 0;
};
#

can someone test that? it adds a button to the map display

#

click and hold on the button, mouse away from the button, mouse up - that shouldn't fire clicked EH like it does, right?

dim owl
#

hey guys, how can i make my inventory items (mods) useable. cant find it out. heard something with EVH but i dont know how i can use them in my mod (config)

thin pine
#

Do you mean like double clicking or having a dropdown menu on items in the inventory?

dim owl
#

double click

#

@thin pine

indigo snow
dim owl
#

@indigo snow yeah but how can i connect these script in a mod ? in a mission i have my init and so. but how can i do this in mods ?

indigo snow
#

Mods can run scripts too. I myself use CBA stuff but I believe simply putting an init.sqf inside the pbo works.

dim owl
#

okay thx i will try it

thin pine
#

Config cpp. Cfgfunctions function with preInit or postInit attribute set to 1. Whatever file that you designated in that function will then be automatically run either before or after init sqf

#

I've never seen init.sqf in a mod. I doubt that'd work

#

Find the wiki page on cfgfunctions

indigo snow
#

Ah yes id recommend using cfgFunctions as well, forget about the init attributes.

tough abyss
#

There are any way to know if the player is in the green areas of the map (florest).

split coral
#

Does "surfaceType" do anything useful?

jade abyss
#

Yep, afaik the only command that returns that.

stoic sphinx
#

Hi all! Do you guys have suggestions to select the shortest distance between a player and a list of objects?

#

Thanksยฌ

tame portal
#

@stoic sphinx iterate through the array of objects and always check whether the current object is closer than the closest

#

If yes, make it the closest one

#

If not, continue iterating

#

If the closes object is null (not set yet), make the current object the closest

stoic sphinx
#

Thanks for replying! That's the method I'm currently using, but I need something "faster". Is there anything more efficient?

#

(I'm making a zombie script, and a dozen zombies using that method is not very effiecient)

buoyant heath
#

How often are you checking the distances BobbyDot?

tame portal
#

That snippet should be the fastest

#

^

stoic sphinx
#

every second.

buoyant heath
#

That's probably unnecessarily often.

stoic sphinx
#

@tough abyss I disagree, sorry lol

#

@buoyant heath I have tried every 2 seconds, but then zombies start hitting players too early when he's moving

#

@tame portal k, it'll do for now

tame portal
#

Obviously there's nearestObject

stoic sphinx
#

Zombies look for targets within 100m

tame portal
#

But that might be notsocpufriendly

#

But that might be notsocpufriendly

stoic sphinx
#

nearestObject has a limit of 50m max. Zombies give up the chase too early if the players Sprint

#

nice suggestion though

tame portal
#

Well then check which method is faster

#

Zombies shouldn't hit someone unless they are locked onto the player, and this lock on check can run in Greater intervals than 1 second

#

If a player is locked on, use a smaller interval for distance checking of the target

#

Basically a hybrid

#

If a player is locked on, use a smaller interval for distance checking of the target

stoic sphinx
#

Never thought of that before, I'll be sure to try it out.

#

thanks!

jade abyss
#

+keep one thing in mind: Walls/Doors/ThingsThatShouldBlockIt

#

( e.g. making a check with LineIntersectSurface if Player)

stoic sphinx
#

@jade abyss I'll consider it if I want stealth, but for now zombies will detect you immiedietly ๐Ÿ˜ƒ

jade abyss
#

For CloseRange (>5m range)

#

Otherwise they would detect a player through a housewall, for example.

#

Means: Just executing the LineIntersectSurface check when <Xm Distance to player

#

If <X -> Execute Attack

#

Just a friendly reminder

sharp jay
#

anybody know where i can find a wasteland mission outside of a pbo so i can look at the scripts?

zenith bramble
#

google is your friend my friend

sharp jay
#

thanks

#

mmust have skipped past it ๐Ÿ˜ƒ

zenith bramble
#

NP enjoy your viewing/learning session, lots to grasp

little eagle
#

camera_update_target
"camera" used as tag ๐Ÿ˜ฆ

dusk sage
#

For checking minimum distance, selectMin might come in handle for a quick one or two liner

little eagle
#

example?

#

More commands , more stuff to choose from. But I don't see much utility in this one particular

dusk sage
#

array of objects -> array of distances -> selectMin, select from objects. On phone though

little eagle
#

how would you do that?

dusk sage
#

I posted one the other day. Only downside was using find, which wasn't too bad

little eagle
#

Yeah, I see

dusk sage
#

Might be a neater way than find though

little eagle
#

make a new array with apply of the distances to origin

dusk sage
#

๐Ÿ‘Œ

little eagle
#

and pick from the objects array the index with the lowest distance

dusk sage
#

Yeh

#

Certainly a neat way, no idea what the total performance would look like. For large arrays, might well be better

little eagle
#

true

#

those should be the slowest part of all of this

#

but it's still better than sorting

dusk sage
#

You'd have to know about selectMin engine side

#

Probably just a normal O(n) operation

#

Yep

little eagle
#

I found one minor problem with these commands:
Wiki says: Other non Number elements are also permitted, but their value will be treated as 0.

dusk sage
#

But 1000 times more preferable

#

Odd

little eagle
#

But if you use anything other than a number or booleans in the array, it prints:
Bad conversion: scalar

#

into the RPT

little eagle
#

mixing booleans and numbers is also weird, since when you have a 0 and false in your array, it will pick the leftmost one

#

I hate those errors that don't appear on screen and only in RPT when talking about scripting

#

also, it should not treat them as 0

#

but instead either just ignore them or error

#

now it treats them as 0 and errors off screen

#

worst case scenario

#

also

#

selectMin [nil,1]

#

-> nil

#

assignedTeam player reports nothing when you remote control a drone or via zeus

#

ยฏ_(ใƒ„)_/ยฏ

#

currentWeaponMode reports a number 0 when used on vehicles

ocean veldt
stoic sphinx
#

@dusk sage Using selectMin for distance check now ^^ . It's halved the run time of my last mthod

dusk sage
#

๐Ÿ‘

#

What code are you using @stoic sphinx ?

stoic sphinx
#

_distanceArray = [];
{_distanceArray pushBack (_x distance _unit)} forEach _targetArray;
_item = _targetArray select ( _distanceArray find (selectMin _distanceArray));
//_unit => The zombie
//_targetArray => Array of players, which zombie wants to eat

#

//Speed is around 0.006

#

//Or 0.06, I can't remember which

#

//Using debug console's performance testy thing

#

//_item gives the player who closest to the zombie

dusk sage
#

You can populate a distance array with apply

#
_distanceArray = _targetArray apply {_x distance _unit}
#

etc

stoic sphinx
#

Apply? What is this wizardry XD

little eagle
#

basically what you wrote with that forEach and pushBack thing, but less words

tough abyss
#

@tough abyss thanks man! I'm doing a simple radar and it have different efficience if the object is in a florest or if there is terrain beetwen radar and object

bold timber
#

Anyone knows where the screenshots are saved when using BIS_fnc_exportCfgVehicles function?

turbid jolt
#

My Documents\Arma 3 or Arma 3 - Other Profiles depending on if you're using the default player profile or a custom one. Then it's in a folder called Screenshots\EditorPreviews

native hemlock
bold timber
#

Ehm..

native hemlock
#

Last time I checked it was using a command that is no longer available to take screenshots

bold timber
#

@native hemlock exactly, that is diag_screenshot, but now it can be changed to "screenshot" I think, let me check if It can be fixed..

native hemlock
#

Yeah that should work, I did something similar

tough abyss
#

So it's official

#

EH based code is brilliant for mission flow.

bold timber
#

@native hemlock Ok, I can confirm It works like acharm ๐Ÿ˜„

tough abyss
#

Whats the syntax for !=

#

in isEqualTo ?

#

!isEqualTo

#

?

noble juniper
#

you can do if !(...

#

the !equalTo could work, but im not sure, blame arma

#

() will fix everything

tough abyss
#

Nope brackets don't fix it.

native hemlock
#

!(_something isEqualTo _somethingElse)

tough abyss
#
#define AIR_TYPE "O_Heli_Attack_02_F","O_Heli_Attack_02_black_F","I_Heli_light_03_F","O_Heli_Light_02_F"
tickStart = diag_tickTime;
_pos = getMarkerPos (_this select 0);
_ParamName = 
_enemiesArray = [];
_x = 0;
// Spawn Light vehicles first.
_localParam = missionNameSpace getVariable [format ["PARAMS_%1",],""];
    tickStart = diag_tickTime;
    for "_x" from 1 to PARAMS_AAPatrol do {
        tickInAA = diag_tickTime;
        _AAPatrolArray = [3,_enemiesArray] call MM_fnc_createVehicles;
        sleep 1;
        diag_log format ["Is this scheduled environment: %1",canSuspend];
        if (_x == PARAMS_AAPatrol) exitWith {};
    };
#

Ha!

#

1 function to do it all

#

Spawn any vehicle I want after passing PARAM name.

#

๐Ÿ˜„

#

There goes another big slab of code from I&A

#

Still being re-written

tough abyss
#

How can I whitelist a player slot?

#

This for Zeus?

tough abyss
#

yea

#

sorta similiar

#

it's a mod for Optre there's a commander slot that allows players to use Zeus

kindred lichen
#

Is there a way to replicate the effect of the ordinance module from a script? I'm Trying to create a rocket barrage, but I want them to fall sort of randomly,

#

if i try creating a bunch of randomized timeout triggers they seem to bunch up and all drop in waves.

#

Can't seem to find much information about how to use the 230mm rocket module other than syncing to triggers,

#

I want to have about 20 rockets drop over 20 seconds, but if I use timeouts, even manually they keep grouping up and I have like 2 or 3 groups.

#

I had a script that I used for a mortar barrage, but it involved spawning the mortars at ground level, you get the explosions, but you don't get the rocket trails which is what I'm most interested in.

vale hull
#

Could just have rocket artillery fire them and space the firing out as needed?

#

i have a barrage script you could change to fire 1 rocket each second or something with 20 rockets all up

dim terrace
#

@sweet raft would it be possible to get those sources retrived by scripting command too? "Added: New "engineTemp", "wheelsTemp" and "turretGunTemp" vehicle animation sources "

sweet raft
#

๐Ÿƒ

jade abyss
#

๐Ÿ›‘ STOP ๐Ÿ›‘

tough abyss
#

I think Dscha doesn't want more commands

halcyon crypt
#

yeah he's definitely not stopping @sweet raft from fleeing.. ๐Ÿ˜

jade abyss
#

I just wanna stop... exactly ๐Ÿ˜„

tough abyss
#

if (!!!!true) then {systemChat "Holly cheeese!";};

tough abyss
#

hey guys have some way to verify two arrays with same values but not same sequence like _array1["one", "two", "three"] - _array2["three", "two", "one"] ?

dusk sage
#

Huh ๐Ÿค” ?

halcyon crypt
#

:^)

tough abyss
#

i have two arrays with same values but not same sequence

#

so if i use _array1 == _array2 not work

#

becase is not "equal'. but have the same values but in different orders

halcyon crypt
#

I guess this could work for == -> if (({!(_x in _array2)} count _array1) == 0) then {};

#

not sure if you can exit the count early as soon as something isn't in _array2 (to avoid unnecessary testing)

dusk sage
#

Would also not take into into account duplicates @halcyon crypt

halcyon crypt
#

true

dusk sage
#

I seem to remember it was possible to exit out too, it came up the other day

#

Can't quite remember

halcyon crypt
#
_array1 sort true;
_array2 sort true;
if (_array1 isEqualTo _array2) then {};
#

๐Ÿ˜›

dusk sage
#

๐Ÿ‘Œ

tough abyss
#

ty guys ๐Ÿ˜ƒ

halcyon crypt
#

you should probably test the length of both arrays before using the sort method for performance reasons though

tough abyss
#

with count right?

halcyon crypt
#

yep

tough abyss
#

nice

#

ty again ๐Ÿ˜Š

halcyon crypt
#

anything for name buddies ๐Ÿ˜†

tough abyss
#

hahaha

tough abyss
#

How does one create a script addon?

halcyon crypt
#

what?

meager granite
#

Have addon with CfgPatches entry in config, addon path prefix ($PBOPREFIX$ if you use cpbo for packing) and any script files you want

#

Then access them by that prefix path and whatever directories and filenames for scripts you have

cerulean whale
#

@tough abyss You could use an eventhandler for init in the config

rancid ruin
#
    class someClass {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {};
        init = "call compile preprocessFileLineNumbers '\nameofpbo\init.sqf'";
    };
};```
#

that config.cpp inside @addon/addons/nameofpbo.pbo

#

along with init.sqf

#

i think

tough abyss
#

Heh. It is simplier than I thought.

rancid ruin
#

that's how i do it, there might be a more proper way

thin pine
#

cries alone in CfgFunctions

jade abyss
#

Lemme give you a hug @thin pine I know how you feel. Just read/seen it.

thin pine
#

MrSalametro? You're triggering me

#

:D

jade abyss
#

oh wow, stupid Discord^^

#

*Fixed ๐Ÿ˜„

open vigil
#

You'll have to excuse Dscha, he had Salami on his mind.

thin pine
#

Can't blame him ๐Ÿ˜

jade abyss
#

ffs?

open vigil
#

Schnitzel, Salami... do you see a pattern here? ๐Ÿ˜‰

jade abyss
#

step on Lego!1oneeleven

rancid ruin
#

setVelocityModelSpace, nice

#

i wish they would add some more drawing commands in future

#

for drawing solid polygons, etc

#

also pathfinding debug commands would be awesome

#

oh gosh

#

time to reinstall dev branch

#

sounds like that's purely visual debug, would be nice to be able to return an array of pathfinding points or something

#

how have they made those graphs?

#

i've seen people do it on map ctrls, but that seems so hacky

tough abyss
#

Check out

#

YAB

#

Yet Another benchmark

#

Inside there they draw a graph.

#

@rancid ruin

rancid ruin
#

yeah that's with a map ctrl and drawLine iirc

split coral
#

Yeah, it was a map ctrl.

#

i remember thinking of doing it with individual line controls, but it would've been even more difficult

sharp jay
#

you put the variable name of the vehicle and then the variable name of the unit that is going to get the kill i think

#

might seem like a stupid question, but how can i copy a command's output so i can paste it elsewhere

little eagle
#

setShotParents has to run on the server

#

that's the only potential problem I can see.

#

And missiles, grenades and some others are still reported as null projectiles if the firing object isn't local

little eagle
#

maybe it's borked ยฏ_(ใƒ„)_/ยฏ

sharp jay
#

thanks @tough abyss

#

no problem

#

just need it in the editor

hollow lantern
#

Anyone knows why this is not working? ```{if (side _x == west && _x != Player) exitwith {deleteVehicle _x};} forEach allUnits;

#

west units do not get deleted

little eagle
#

then, not exitWith

hollow lantern
#

ah I see

little eagle
#

you're leaving the loops scope

#

after the first encountered unit to delete

hollow lantern
#

yep correct, I just oversaw that, thanks

little eagle
#

also

#

side group _x

#

otherwise it will not delete units of that side that did friendly fire

#

or are captive

hollow lantern
#

okay, thanks ^^

rotund cypress
#

Hey guys I have a problem atm with a vehicle icon not showing up in a HUD i made. This is the code I have private _getVehiclePicture = [getText (configFile >> "CfgVehicles" >> (typeOf _target) >> "icon")] call BIS_fnc_textureVehicleIcon; _vehiclePicture ctrlSetText parsetext format ["<img image='%1' size='2'></img>", _getVehiclePicture];

#

When I did this ```_target = cursorObject;
hint format ["<img image='%1' />",[getText (configFile >> "CfgVehicles" >> (typeOf _target) >> "icon")] call BIS_fnc_textureVehicleIcon];

#

I am only getting the path

#

not the icon itself is not showing up

rotund cypress
#

Anyone have an idea?

meager granite
#

You don't need closing tag for img

dim owl
#

hi, how can i delete a array at given position when number in my array is for example 1 ?
tested it with this:

test = [[0,"John Collins"],[1,"blabla"]];
_test = test select {(_x select 0) isEqualTo 1};
test deleteAt _test;

any ideas ?

rotund cypress
#

@meager granite Ok, but do you know why its not showing the icon?

meager granite
#

what do you mean "getting the path"

rotund cypress
#

When I do this _target = cursorObject; hint format ["<img image='%1'>",[getText (configFile >> "CfgVehicles" >> (typeOf _target) >> "icon")] call BIS_fnc_textureVehicleIcon]; it only types out the path to the image, doesnt show the image

meager granite
#

Because you're sending string to hint, not text

#

hint parseText format ...

rotund cypress
#

Oh thanks that worked

#

I needed a space after the img though for it to show in a hint

meager granite
#

yes hint needs at least single character to show up

#

img tag is not considered one

#

@dim owl

{
    if(_x select 0 == 1) exitWith {
        test deleteAt _forEachIndex;
    };
} forEach test;
dim owl
#

thx

rotund cypress
#

I have another question @meager granite If I want to get a vehicle type: e.g.: car, boat etc I would think I can use typeOf cursorObject but that doesnt work for getting the type it only gets the model like plane_f

dusk sage
#

That is the type

rotund cypress
#

What could I do to get the Car name like SUV or Ifrit e.g.?

#

@dusk sage

#

ooh found it getText(configFile >> "CfgVehicles" >> (typeOf cursorObject) >> "displayName");

dusk sage
#

getText (configFile >> "CfgVehicles" >> _className >> "displayName")

#

yeh

#

heh

tough abyss
#

I love berating bad communities code.

#

It's entertaining.

tough abyss
#

@dusk sage I know thats being an ass.

rotund cypress
#

Hey Guys, Currently having an error relating to this _vehiclePicture ctrlSetText parsetext format ["<img image='%1' size='2'></img> ", [getText (configFile >> "CfgVehicles" >> (typeOf _target) >> "icon")] call BIS_fnc_textureVehicleIcon];

#
_vehiclePicture ctrlSetText parsetext format ["<img imag>
 2:19:57   Error position: <ctrlSetText parsetext format ["<img imag>
 2:19:57   Error ctrlsettext: Type Text, expected String
 2:19:57 File mpmissions\__CUR_MP.altis\core\functions\FL\fn_metaGame.sqf, line 76
 2:22:19 Ref to nonnetwork object 69de4080# 1783533: b_soldier_02.p3d
 2:22:19 No speaker given for Henry Wilson
 2:22:28 WARNING: Function 'name' - Max MacDonald is dead
 2:22:28 WARNING: Function 'name' - Max MacDonald is dead
 2:22:28 Error in expression <manName];

};

};

};


_vehiclePicture ctrlSetText parsetext format ["<img imag>
 2:22:28   Error position: <ctrlSetText parsetext format ["<img imag>
 2:22:28   Error ctrlsettext: Type Text, expected String
 2:22:28 File mpmissions\__CUR_MP.altis\core\functions\FL\fn_metaGame.sqf, line 76
 2:22:31 Error in expression <manName];

};

};

};
#

That is the error I get

#

But cant figure out what that is

tame portal
#

It says what the error is

#

ctrlSetText only accepts strings, not structured text

#

You cant parsetext because that makes your string a text

#

If you want to use structured text use a RscStructuredText and ctrlSetStructuredText

rotund cypress
#

Ah thanks

tough abyss
#

@rotund cypress This type of error is known as a type coercion error

#

ctrlSetStructureText I believe exists?

rotund cypress
#

ctrlSetStructuredText

tough abyss
#

Yeah

#

Data types in A3 are strange.

#

Not to say the least.

rotund cypress
#

ye

tough abyss
#

But all your usual language contructs exist.

#

Floats, Integers, etc.

#

But no explicit declaration is required before assignment

rotund cypress
#

course

#

I have another problem

tough abyss
#

It's implicit declaration at time of assignment.

rotund cypress
#

im trying to set an RscText with a background colour with _sideColour ctrlSetBackgroundColor [0, 0.3, 0.6, 1];

#

But that doesnt work

#

the box is just no colour at all

tough abyss
#

Sure it's the correct syntax?

#

If in doubt, check it's the right way to do it.

#

On the Wiki

#

ASSUME nothing.

rotund cypress
#

_control ctrlSetBackgroundColor [1, 0, 0, 1]

tough abyss
#

Assumptions always screw you up.

rotund cypress
#

wiki

tough abyss
#

Read the more specifics normally thats in RGBA values

#

Sometimes thats reversed too

rotund cypress
#

that is the colour for west directly pulled from the wiki

#

i made a switch like this

#
switch (_playerSide) do {

    case west: {

        _sideColour ctrlSetBackgroundColor [0, 0.3, 0.6, 1];

    };

    case independent: {

        _sideColour ctrlSetBackgroundColor [0, 0.5, 0, 1];

    };

    case civilian: {

        _sideColour ctrlSetBackgroundColor [0.4, 0, 0.5, 1];

    };

    case opfor: {

        _sideColour ctrlSetBackgroundColor [0.5, 0, 0, 1];

    };

};```
tough abyss
#

Are you sure player-side is correct?

#

and the code actually evalulates?

#

Putt a diag_log in the case west