#arma3_scripting

1 messages ยท Page 93 of 1

foggy stratus
#

hahaha

#

Thanks for trying

little raptor
#

well using selectPlayer does work tho

#

or just John's idea

#

it's not ideal but well, the function is broken so...

#
params ["_AI"];
if (!isNil "jboy_player") exitWith {};
jboy_player = player;
selectPlayer _AI;
[missionNamespace, "arsenalClosed", { 
    selectPlayer jboy_player;
    jboy_player = nil;
}] call BIS_fnc_addScriptedEventHandler;
["open", true] call BIS_fnc_arsenal
kindred tide
#
    #define var (var_name) private var_name;
#else
    #define var (var_name) private #var_name;
#endif```
will this work?
#

(this is to allow to write just var _foo; and based on which game it is, it chooses whether to replace it with private "_foo"; or private _foo;)

little raptor
#

you can't write private _foo;

kindred tide
#

well, private _foo = somevalue

little raptor
#

I'd say do this:

#ifdef __ARMA3__
    #define PRIV private
#else
    #define PRIV local
#endif
PRIV _myVar = _value;
#

well it's A2+ tho so won't work with A1

#

but noone plays A1-

kindred tide
little raptor
#

well the question is why even bother to support those?!

#

you'll probably just waste your time blobdoggoshruggoogly

#

most people just play A2 or A3

#

and in A2 they generally play the DayZ mod afaik

kindred tide
#

a good mod could revive any oldie

little raptor
#

true but newer Arma titles are just enhanced old Armas

#

they've pretty much just built on top of the engine from generation to generation

#

so if you play Arma 3 you essentially have Arma 2 too (minus the assets, but there are many total conversions for A3 already)

kindred tide
#

what about this

hallow mortar
#

If people want to play and mod older Arma games that's their business, there are plenty of old games that still have active mod communities and that's great.
Trying to support all of them in the same mod is just making things unnecessarily complex for yourself though.

#

Like even if you want to have a mod that does the same thing in each game...make different versions of it. Otherwise you're gonna end up with like 50% of it by filesize being dead weight in any given game.

kindred tide
little raptor
#

so that's wrong

#

but apart from that, blobdoggoshruggoogly

kindred tide
#

will this part not break? private #var_name; var_name = def_value; it's 2 instructions in 1 define

little raptor
#

macros don't care about "instructions"

#

so no it won't

kindred tide
#

i thought the first semicolum could be seen as the end of the macro

little raptor
#

macros end at the end of the line

#

unless the end of the line is escaped with \

#

like C++

kindred tide
#

#define var(var_name, def_value) private #var_name; var_name = def_value; #define params(arr) for "_i" from 0 to (count _arr - 1) do {var (arr select _i, _this select _i);};

#

oh i think i wont be able to use it without () after params

#

unless it allows to pass the arguments in any brackets

little raptor
kindred tide
#

oh, those private vars will be only inside the for loop

#

ig i could use breakOut or breakTo but those weren't in OFP

little raptor
#

well they wouldn't help anyway

kindred tide
#

#define params(arr) private arr; for "_i" from 0 to (count _arr - 1) do { compile (arr select _i) = _this select _i;};

little raptor
#

I doubt it works either

#

behind = must be the variable itself

#

the same way you can't do _arr#0 = 2

#

the only way I can think of is doing something like:

#define params2(v1,v2) private #v1; v1 = _this select 0; private #v2; v2 = _this select 1
#

and similarly for more params

#

you can also just make another macro:

#define PARAM(x,i) private #x; x = _this select i

to make things shorter

#
#define params2(v1,v2) PARAM(v1,0); PARAM(v2,1)

the A3 version would just be:

#define params2(v1,v2) params [#v1, #v2]
opal zephyr
#

Someone was having trouble with this the other day but never posted the solution, I'm having trouble using the _actionParams with ace create action

opal zephyr
#

Its appearing in the statement code as any

#

This is the createAction:

_action1 = ["Intel",_interactionName,"",{[_target, _player, _actionParams]spawn J3FF_fnc_interactFunction;},{true},{},[_intelTitle],"",3.5] call ace_interact_menu_fnc_createAction;

and this is the interactFunction:

params ["_target","_player","_actionParams"];

systemChat (format["%1", _actionParams]);
#

_intelTitle should be passed through the third param, but its not correctly

little raptor
#

are you sure ACE even auto defines those?

#

I don't see anything in the docs

little raptor
opal zephyr
#

Thanks, will try

#

That did the trick, thanks Leopard!

kindred tide
#

var(_back, [_ABC, "init_queue"] call ABC_pop_back); doesn't work for some reason, although other lines that use this macro do work

#

the macro is #define var(var_name, def_value) private #var_name; var_name = def_value;

#

it's like it can't parse that instruction that's being passed as argument

#

it starts working if i move that instruction outside and pass its result as the argument, but that kinda ruins the purpose

#

oh it's the comma

kindred tide
#

will A3 not mind if i assign nil to a variable like private _foo = nil; before using it?
private _foo = nil; _foo = something;

#

i decided to remove the "default value" part from the var macro and assign nil as default instead, because it's kinda limited anyway

#
    #define var(var_name) private var_name = nil;
    #define par(par_name, par_index) private par_name = param [par_index];    
#else
    #define var(var_name) private #var_name; var_name = nil;
    #define par(par_name, par_index) private #par_name; par_name = _this select par_index;
#endif```
#

looks p neat

#

waaait.. do i have to put these into every SQF that uses them and not just one that gets compiled and executed first??

#
_this call compile preprocessFileLineNumbers "module_framework\libraries\ABC\ABC_core.sqf"; // << the macros are used HERE```
little raptor
#

I thought you knew C++...

#

because if you did you'd also know that you have to put them in every file (via #include)

#

macros can't be "compiled". they just tell the preprocessor to replace the macro with what you want

kindred tide
#

i treat the "compile" as include here cause it introduces things and i expected everything in the file to be introduced and become available for use lol

#

if A.sqf is preprocessed (and, optionally, compiled) before B.sqf is pre-processed, and it all happens in C.sqf, no macros from A.sqf will be usable for either B or C?

#

what is the SQF's way of doing #include then?

sullen sigil
#

#include

#

it effectively just copy pastes the file specified

kindred tide
#

lmao

#

it set me up to expect everything to be very different and i'm caught off guard every time it's not different

sullen sigil
#

welcome to arma

kindred tide
#

just like with #define, i was like no way

#

look at this shit

#

i've been doing #include this way this whole time for weeks

#

lmao

#

though tbf this is a bit different than copying the contents, it's adding functionality from those files and putting it into the module refered to by "_this"

sullen sigil
#

yes its different to #include as youre calling the code itself

#

though i do suppose if youre running something and #include code it'll just run that either way so

kindred tide
#

ig it works identically to #include when it comes to introducing global vars

sullen sigil
#

probably my brain is too worn out today to try figure out what that means

#

been netcoding sqf movement system

kindred tide
#

it's like a post-compile include

#

or mid-compile rather

#

and it only adds stuff to the module

sullen sigil
#

i wouldnt bother trying to explain it to me its quite possible i have brain damage right now

opal zephyr
#

playSound3d should return a id number since 2.12, im trying _soundID = playSound.... but it just says that the variable _soundID is undefined. Anyone know why?

#

Im trying to use stopSound

wary needle
#

i want to message, people in a tank. how would i hint only the tank passengers or crew

sullen sigil
opal zephyr
#

correct

sullen sigil
#

and are on the current version of arma

#

it was introduced on the 20th

opal zephyr
#

im on 2.12.15

sullen sigil
#
private _sound = playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player]; // alarm
stopSound _sound``` works fine for me
opal zephyr
#

the wiki says 2.12

#

so do the patch notes from july 20th

sullen sigil
little raptor
#

so does stopSound work right now?

opal zephyr
opal zephyr
sullen sigil
#

all i can recommend is you steam verify

little raptor
#

I mean the command itself

sullen sigil
#

ye

little raptor
#

weird I seem to remember it was for 2.14 blobdoggoshruggoogly

sullen sigil
#

yeah, it was

#

then was pushed to release on 20th

opal zephyr
#

Leopard do you need to manually update advanced dev tools? Or is the function recognition automatic?

#

It says stopSound is undefined

little raptor
#

auto

#

then your game is old

#

probably introduced in profiling

sullen sigil
#

nope, im on main branch

opal zephyr
#

Im running profiling, is that the problem maybe?

sullen sigil
#

possibly

opal zephyr
#

Ill test

#

ya that was the problem

#

its not on profiling yet :(

#

is it common that things aren't pushed to all branches at once?

little raptor
#

yes

opal zephyr
#

Alright, is the time it takes normally relatively standard? Like estimable standard?

little raptor
#

Dedmen will probably update it next week

opal zephyr
#

Alright, thankyou!

little raptor
#

maybe tomorrow

opal zephyr
#

cool, there isnt anywhere that that would be posted right? Like to indicate that it has

little raptor
opal zephyr
#

Sounds good!

kindred tide
#

so, so far the grand scheme of things has been that, a "module" is an object that starts empty (a GameLogic object) and upon initialization it "grows" with functions and variables, that get added to it by framework compiling lists of SQF files and passing that module object as parameter

#

it gets its functionality from "libraries" that are just SQF files and after the whole list is compiled the module becomes ready for use (the functions in it are "code" type variables)

#

this means that different modules can grow their functionality from the same set of libraries, selecting only what's needed

#

and ABC is like the foundation library, it actually adds stuff to the global namespace and is basically like a mini STL

#

so it's the one that's meant to introduce the macros and such

kindred tide
#

is this design doomed and there's something important i dont know yet

simple trout
#

which already exists

simple trout
#

that's always in the the std namespace...

kindred tide
simple trout
#

my man

#

A3A_fnc_createSomething;

#

is a global variable

#

with a type of code

#

cfg functions does this for you

kindred tide
simple trout
#
arguments call (uiNamespace getVariable "TAG_fnc_functionName");
kindred tide
#

yeah i have a shortcut for this, called ABC_function. it takes the namespace (an object), function name and args as parameters

simple trout
#

you do realize that all the end user has to do for cfgfunctions to work, is basically add a line in the config file.

kindred tide
simple trout
#

arma will do it for me automatically

#

I can every shorten the call be doing this

arguments call TAG_fnc_functionName;
#

no need to pass in a object, or it's name

kindred tide
#

fair, is it backwards compatible though lol

simple trout
#

it will take you like maybe 10 lines of code to do this

#

in arma 2

kindred tide
hallow mortar
simple trout
kindred tide
#

i'm targeting all games on this engine starting from the oldest, OFP

simple trout
#

You do you man

hallow mortar
#

Differences like the introduction of the Functions Library are why a single mod for all games is a bad idea ๐Ÿ™ƒ

simple trout
#

you also, be limited to only the first Arma cmds, and functions else you had checks for what version you are running

sage bridge
#

`*// Array of animal classes and their respective herd sizes.
private _animalClasses = [
["Sheep_random_F", 5], // Class name of sheep and herd size (5 sheep in a herd).
["Hen_random_F", 8], // Class name of hens and herd size (8 hens in a herd).
["Goat_random_F", 4] // Class name of goats and herd size (4 goats in a herd).
];

// Number of animal herds to spawn on the map.
private _numHerdsToSpawn = 10;

// Function to get a random position within the map boundaries.
private _getRandomPosition = {
private _radius = 5000; // Adjust this value based on how wide you want the spawning area to be.
private _pos = [getMarkerPos "center", _radius, 0] call BIS_fnc_findSafePos;
_pos set [2, 0];
_pos
};

// Function to spawn an animal herd at a random position.
private _spawnAnimalHerd = {
private ["_animalClass", "_herdSize", "_position"];
_animalClass = _this select 0;
_herdSize = _this select 1;
_position = _getRandomPosition();

_position set [2, 0]; // Set the height to 0 to avoid spawning animals in the air.
{
    private _randomPos = [_animalClass, _position, 15, 1, 3, 0, 0] call BIS_fnc_findSafePos;
    createAgent [_animalClass, _randomPos, [], 0, "CAN_COLLIDE"]; // Spawn the animal.
} forEach [1.._herdSize];

};

// Loop to spawn animal herds.
{
private _animalInfo = _x;
_spawnAnimalHerd call (_animalInfo select 0);
} forEach _animalClasses;

// Execute the spawning.*`

#

it says there is an error for missing ";" in line 24

warm hedge
#

Which is 24

simple trout
#

_getRandomPosition();

#

this doesn't exist

warm hedge
#

Also 1.._herdSize is invalid too

simple trout
#

cough, cough... chatgpt?

granite sky
#

It looks like someone was porting from another language and missed a couple of bits.

#

Also backwards: _spawnAnimalHerd call (_animalInfo select 0);

simple trout
#

I love how its trying calling a string as code

#

Damn, beat me to it

granite sky
#

Wrong anyway, should be just passing _animalInfo rather than the first element.

#

Doesn't really remind me of chatGPT but maybe some other trash AI

vapid scarab
#

This isnt for a script. I want to collect a list of weapon class names for the arsenal without writing each one down in note pad. In particular, I want every G36 with RIS mounts.
What I want to do is
("g36" in (toLower _weaponClassName)) and ("ris" in (toLower _weaponClassName)) for each CfgWeapon.
How do I go about forEaching the CfgWeapons config?

granite sky
#

configClasses

vapid scarab
#

How do I get the class name?

granite sky
#

From a config? configName

vapid scarab
#

No. That returns file paths.

simple trout
vapid scarab
#

this is what that returns: [bin\config.bin/CfgWeapons/CUP_muzzle_snds_G36_black,...]

granite sky
#

needs apply { configName _x } on the end.

#

(killer's code)

vapid scarab
#

This almost gets me what I want.

(flatten ((("'g36' in (toLower (configName _x))" configClasses (configFile >> "CfgWeapons")) apply { str _x }) apply { _x splitString "/\" })) select { "g36" in toLower _x }
simple trout
#

lol

vapid scarab
#

Im compiling a list of items for an ace arsenal. I dont need the code for a script. Just the result

simple trout
#

Alright, just know that splitString is slow, because the engine has to make arrays for that, and then you flatten the array...

vapid scarab
#

yup

#

Thanks Killer and John!

tough abyss
#

anyone know if the apex campaign missions (keystone specifically) are decrypted and released by bi yet?

warm hedge
#

Very already

tough abyss
#

link or file?

warm hedge
#

expansion\missions_f_exp

tough abyss
#

thx

sage bridge
#

is there anyway someone can help rewrite the script to work?

granite sky
#

We listed four? errors I think.

sage bridge
#

Yes

#

I see those

granite sky
#

but really you should try to learn the language.

sage bridge
#

SQF Syntax scripting language no?

sage bridge
#

} forEach [1, _herdSize];

#

?

granite sky
#

nah, you have to use the other type of for loop for that one.

#

forEach needs an array or hashmap as input. If you want to do something N times then it's not suitable.

sage bridge
#

so instead of forEach I want to just change it to for?

granite sky
#

No.

#

Read the page.

sage bridge
#

for "_i" from 0 to 1 do { _herdSize };

#

wait

#

for "_i" from 0 to _herdSize - 1 do {
_randomPos = [_animalClass, _position, 15, 1, 3, 0, 0] call BIS_fnc_findSafePos;
createAgent [_animalClass, _randomPos, [], 0, "CAN_COLLIDE"]; // Spawn the animal.
};
};

hallow mortar
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
granite sky
#

actually in the right ballpark

sage bridge
#
for "_i" from 0 to 1 do { _herdSize };
wait
for "_i" from 0 to _herdSize - 1 do {
        _randomPos = [_animalClass, _position, 15, 1, 3, 0, 0] call BIS_fnc_findSafePos;
        createAgent [_animalClass, _randomPos, [], 0, "CAN_COLLIDE"]; // Spawn the animal.
    };
};

it still says its missing ;

hallow mortar
#

wait isn't a real command

#

(and it is indeed missing a ; )

sage bridge
#

I accidently typed that

#

I looked at my sqf and it doesnt have that

#
for "_i" from 0 to 1 do { _herdSize };
for "_i" from 0 to _herdSize - 1 do {
        _randomPos = [_animalClass, _position, 15, 1, 3, 0, 0] call BIS_fnc_findSafePos;
        createAgent [_animalClass, _randomPos, [], 0, "CAN_COLLIDE"]; // Spawn the animal.
    };
};
hallow mortar
#

The first for, the one that's just doing _herdsize, is...not really doing anything of use. It's not causing the error but it's just getting the value of _herdsize and then doing nothing with it...twice.
What's probably causing the error is the extra }; at the end. { } are openers and closers, they have to match.

sage bridge
#
// Function to spawn an animal herd at a random position.
private _spawnAnimalHerd = {
    private ["_animalClass", "_herdSize", "_position"];
    _animalClass = _this select 0;
    _herdSize = _this select 1;
    _position = _getRandomPosition();
    
    for "_i" from 0 to _herdSize - 1 do {
        _randomPos = [_animalClass, _position, 15, 1, 3, 0, 0] call BIS_fnc_findSafePos;
        createAgent [_animalClass, _randomPos, [], 0, "CAN_COLLIDE"]; // Spawn the animal.
    };
};
#

it matches the "private _spawnAnimalHerd = {"

hallow mortar
#

_position = _getRandomPosition(); is wrong. It's just...approaching from several wrong angles.

#

Actually they're a little more wrong than I thought, you're using _animalClass as the first parameter but the first parameter for that function is the centre position, not a classname.

sage bridge
#
private _animalClasses = [
    ["Sheep_random_F", 5], // Class name of sheep and herd size (5 sheep in a herd).
    ["Hen_random_F", 8],   // Class name of hens and herd size (8 hens in a herd).
    ["Goat_random_F", 4]   // Class name of goats and herd size (4 goats in a herd).
];


private _numHerdsToSpawn = 2;

private _getRandomPosition = {
    private _radius = 5000;
    private _pos = [getMarkerPos "center", _radius, 0] call BIS_fnc_findSafePos;
    [_pos, _radius]
};

private _spawnAnimalHerd = {
    private ["_animalClass", "_herdSize", "_position"];
    _animalClass = _this select 0;
    _herdSize = _this select 1;
    _position = _getRandomPosition;
    
    for "_i" from 0 to _herdSize - 1 do {
        _randomPos = [_position select 0, _position select 1, 0] call BIS_fnc_findSafePos;
        createAgent [_animalClass, _randomPos, [], 0, "CAN_COLLIDE"];
    };
};

private _spawnAnimalHerdsRecursive = {
    private ["_animalInfo", "_numHerds"];
    _animalInfo = _this;
    _numHerds = count _animalInfo;

    if (_numHerds <= 0) exitWith {};

    [_animalInfo select 0, _animalInfo select 1] call _spawnAnimalHerd;

    _animalInfo = _animalInfo - [_animalInfo select 0];
    _numHerds = _numHerds - 1;
    _animalInfo spawn _spawnAnimalHerdsRecursive;
};

[_animalClasses] spawn _spawnAnimalHerdsRecursive;

#

what about this?

granite sky
#

oh god, why the recursion

#

{ } forEach _animalClasses is fine.

sage bridge
#

remove the recursion?

granite sky
#

please

sage bridge
#

Okay

granite sky
#

Also I think your BIS_fnc_findSafePos usage got weirder.

sage bridge
#
private _animalClasses = [
    ["Sheep_random_F", 5], // Class name of sheep and herd size.
    ["Hen_random_F", 8],   // Class name of hens and herd size.
    ["Goat_random_F", 4]   // Class name of goats and herd size.
];

private _numHerdsToSpawn = 2;

private _getRandomPosition = {
    private _radius = 5000;
    private _pos = [getMarkerPos "center", _radius, 0] call BIS_fnc_findSafePos;
    [_pos, _radius]
};

private _spawnAnimalHerd = {
    private ["_animalClass", "_herdSize", "_position"];
    _animalClass = _this select 0;
    _herdSize = _this select 1;
    _position = _getRandomPosition;
    
    if (_herdSize <= 0) exitWith {};
    
    for "_i" from 0 to _herdSize - 1 do {
        _randomPos = [_position select 0, _position select 1, 0] call BIS_fnc_findSafePos;
        createAgent [_animalClass, _randomPos, [], 0, "CAN_COLLIDE"];
    };
};

private _scheduleHerdSpawn = {
    private _animalInfo = _this;
    [_animalInfo select 0, _animalInfo select 1] call _spawnAnimalHerd;
};

{
    private _animalInfo = _x;
    for "_i" from 1 to _numHerdsToSpawn do {
        [] spawn _scheduleHerdSpawn;
        sleep 10;
    };
} forEach _animalClasses;

wary needle
#

hi i am making a script that adds aps to slammers. atm

if i want to redefine the changes how do do that without stacking on top of the last script.
A. i change the current charges somehow

B. i delete the prevoisly run script, and overide it with mine.
ether option works for me
i just have no idea how or what to do

#
if(true)then{ 
{ 
 if ((_x isKindOf "B_MBT_01_TUSK_F"))then{ 
  [_x,15,2]call addToTrophy; 
 }; 
} forEach vehicles; 
}; 

info on params
_x, 15, 2 
vehicle, range of aps, charges
granite haven
#

or more

wary needle
#

yeah

hallow mortar
#

How to do that depends on how the charge system is implemented in the APS code itself

wary needle
#

it would be simpler, when there is more that one instances run then it deletes the prev one. i dont even know how to set it up

south swan
#

blobdoggoshruggoogly if you spawn some loop per vehicle (which is terrible), you can store a script handle returned by spawn in some variable on the vehicle itself and terminate (_veh get "MUH_APS_ScriptHandle); before spawning a new one;
If you store all that in some singular global array, you can search through it for matching vehicle and change the entry (or delete old one and create a new one). findIf may be helpful for that.
If you store all the data in some global hasmap - you can use the vehicle as a key and just writing a new values would automatically overwrite whatever was stored there before.
If you store the relevant data in variables on the vehicle itself - it's basically the same. Writing new values would overwrite old ones..

proven charm
#

any tips how to determine what is actually lagging in mission? I mean is it units on map or scripts or what

proven charm
tender fossil
proven charm
#

ok

proven charm
#

if I could just get dev working :/

#

when debugging my mission I tried deleting objects to see how much they lag. can the diag_captureSlowFrame detect how fast those are processed?

#

i tried sqf { deletevehicle _x; } foreach (allMissionObjects "All");

#

which gave me around 10fps

#

anything else I can try deleting? (other than groups,units and scripts)

little raptor
#

I'd say first try capturing a frame and see what the issue is

#

Instead of deleting stuff

south swan
#

(inb4 it's AI)

little raptor
#

Yeah most likely

proven charm
#

cap frame via the diag tool?

#

deleting AI units gave me also 10fps ๐Ÿ˜„

little raptor
#

diag_captureFrame or whatever it's called

proven charm
#

ok

#

trying to update existing copy of Dev via Game updater isn't making any progress :/

kindred tide
#

ABC.sqf:

#

and then i just
_this call compile preprocessFileLineNumbers "module_framework\libraries\ABC.sqf";

#

i can now make things fully backwards compatible, now that the macros are in

wary needle
tough abyss
#

Does anyone know if there's an EH for footsteps or some other way to detect if a footstep happened?

winter rose
#

you could perhaps couple it with a " EntityCreated" Mission EH

little raptor
#

allObjects is better

hallow mortar
#

It's mildly annoying that soundPlayed EH doesn't detect footstep sounds

little raptor
#

also you can use animStateChanged EH

winter rose
little raptor
#

allObjects is binary...meowsweats
Not sure which one returned footsteps tho

#

Also iirc since v2.14 you can specify a type filter

#

Again not sure if it works with footsteps

winter rose
#

stop sweating

kindred tide
#

i cant wait to experience the feeling when i copypaste my magic abilities mod from OFP folder to Arma2 folder to Arma3 folder and it just works every time without having to make any changes

little raptor
#

What if you copy it and you realize nothing works?! ๐Ÿ˜…

winter rose
#

you will most likely sacrifice performance and/or readability

tough abyss
#

These seem to get me a bit closer but I need to be able to tell what object was the source of that footstep. thonk I was looking at animStateChange, I guess if I get desperate I could associate timings with footsteps to each animation.

#

Sometimes an animation has 4 footsteps, or 3, or 2, or it looks sometimes like, 2.5? ignore that im dumb

#

AnimStateChange could be used to play the initial foot steps, and AnimDone (seems like it's called after every loop) could clue me in to when the animation loop restarts

still forum
#

What is "Raw" SQF?
spawn only takes compiled functions, that's its syntax

#

That adds performance overhead to everything though.
It would be better to use a preprocessor macro

#define GROUP_CHAT(x) (player groupChat x) That wouldn't introduce performance overhead, and if you need logging you can update the define to call a function instead

#

There is already a highlighting plugin for C++ that works, no need to do by hand

#

getVariable has a default value, just use default false then you don't need isNil

kindred tide
#

it wasn't hard, i just copy-pasted all keywords from the doc page to here:

#

(this is notepad++)

still forum
#

All variables in SQF are by reference.
There are just a few commands that specifically copy, like + or select [start,end]

#

don't use private array, its slow.
also don't use _this select 0,... also slow

params is the new way to do it, it has private integrated

#

You can move the parameters out of isNil.
And if you remove the _queue variable in push front, you don't need isNil at all

still forum
#

you can always use a special null that never usually appears, like teamMemberNull

kindred tide
still forum
#

sqfc itself doesn't contain comments.
But sqfc also expects the .sqf file to be present next to it, and that one will have comments

hallow mortar
still forum
# opal zephyr im on 2.12.15

That's not the whole version, the last number is 6 digits, 15 are only the first two digits.
What are the remaining ones

kindred tide
still forum
# opal zephyr its not on profiling yet :(

Profiling cannot get script behaviour changing changes merged into it.
But this time we pushed one of these into stable.. And because it was a old change from months ago it was forgotten for profiling

kindred tide
#
this setVariable ["TEST", 20];
private "_t"; 
_t = this getVariable "TEST"; 
_t = 40; 
hint str (this getVariable "TEST"); //hint showed '20'```
still forum
# kindred tide

This can just be
#define CALL(obj, funcName) [obj, funcName] call (obj getVariable [funcName, {}})

still forum
still forum
#

You are not changing the value inside _A
you are assigning _A to reference a different value, in this case your 10

#

= doesn't change values, it reassigns variables to point to a different value

still forum
#

Every value is passed by reference, but there are only few ways to actually edit values
like set/append/pushBack

kindred tide
#

can i (*_t) = 40

still forum
#

no

#

That would break the game

#

_t = 20;

*_t = _t + 10;
First execution would be 30, second execution 40 (because you would be editing the value inside the compiled script)

#

but if you do
_a = "test";
_b = _a; // This does NOT copy "test", it becomes a reference to "test"

kindred tide
#

surely i can't foresee much ahead and how many parts will be "performance critical" lol

sullen sigil
#

sqf is a very slow language

kindred tide
#

i already avoid things that run like every frame, and moved all my "spawned" code into 1 serial loop

#

so it's not running 100 scripts for 100 objects but 1 for all

hallow mortar
#

Number of script threads isn't the only thing that affects performance

#

Engine implementation (a command that does the thing) is pretty much always faster than having to chain several SQF commands to do the thing manually. But a lot of those single engine implementations were introduced after OFP, so you can't use them, so you're losing performance.
There are also some things that are just completely impossible in older games.

sullen sigil
#

interpolation of setvectordirandup is still impossible in a3 ๐Ÿ™ƒ

still forum
#

You also have gameplay relevant features that are not available on old games.
setObjectScale, simple objects, ui on texture, many AI things, inventory management, eventhandlers, new UI elements.
And that's only the A3 stuff I can think of now
But if you think that doesn't affect the game experience then... ok blobdoggoshruggoogly

And.. good luck with remoteExec!

sullen sigil
#

setobjectscale changing the size of the tracers the object fires is very funny too

ornate whale
#

Is it possible to change the AI unit's sensitivity cfg value with a script command?

winter rose
#

and no, sensitivity is not part of it (but spotTime, spotDistance perhaps)

ornate whale
#

Thanks, I have tried setSkill and sub skills already, but I did not find it suitable for my scenario.

tender fossil
still forum
#

Code is a compiled function

#

_func = {}; 0 spawn _func;
Ded_fnc_func = {}; 0 spawn Ded_fnc_func;
0 spawn {};

is all the same

tender fossil
#

What about sqf spawn { hint "Yay!"; hint "Yay is no more"; } ? Shouldn't it work?

still forum
#

That's what I just posted

#

okey I omitted the arguments param on the left.
Becuase were were talkin about code side only

#

There edited in, still same thing
Code is code, how its stored doesn't make a difference

tender fossil
#

Does all code wrapped in {} get compiled at mission start?

still forum
#

It gets compiled when the file it's in gets compiled

tender fossil
#

Is it possible for a SQF file to not get compiled despite of it being accessed (in any way)?

#

Or do they get always compiled upon access

still forum
#

well if you read the text of it via loadFile or preprocessFile command

#

but it cannot be executed without compiling it

#

only Code can be executed, and Code is compiled

tender fossil
still forum
#

There is no first access overhead

#

The only thing I can think of.
If you have the same thing a dozen times copy pasted. It also compiles a dozen times.
But if you move it into a function it only compiles once

still forum
#

But as compiling generally only happens once (unless you use execVM and recompile your code on every execution...) it wouldn't matter much

tender fossil
#

Yes

hallow mortar
#

Wasn't there something about EHs being slightly less performant if they have code in them directly (vs calling a function) because they recompile every time they trigger

tender fossil
#

I'm slightly less dumb now ๐Ÿ˜

sharp grotto
#

Some people use execVM instead of functions ๐Ÿ‘€
In this case it will be compiled everytime, or ?

still forum
still forum
tender fossil
#

We should start "Remove execVM" movement

hallow mortar
kindred tide
hallow mortar
manic kettle
#

You can take my execVM from my cold dead hands

#

Jk I don't use it anymore

kindred tide
hallow mortar
kindred tide
#

i need at least one execVM, to initialize the god object

hallow mortar
manic kettle
#

execVM {{_x attachTo player} forEach allmissionobjects}

kindred tide
#

it's the one script that goes to the scheduled env and starts the "main" loop in it, where everything else happens

hallow mortar
#

Granted one execVM per mission is fine, but you could also achieve it with spawn and #include

#

or you could not support OFP, and then you could use the Functions Library for it

kindred tide
#

i like graphics in OFP

#

that's like, playing morrowind

#

i dont expect many ppl to get that lol

hallow mortar
#

and how many Morrowind mods also work in Skyrim AE with the same files?

kindred tide
#

i haven't tried to pull off something like this in those games

astral bone
#

Instead of setting intensity, I can do the Attenuation?

kindred zephyr
winter rose
#

also

If the same script is to be executed more than one time, declaring it as a Function is recommended to avoid recompiling and wasting performance with every execution.

kindred zephyr
#

OH lol, its been a while since i been to that page I didnt even notice that was there, nvm the suggestion then

simple trout
#

Honestly it should be a depreciated warning like c++

#

I might make a feedback track for that....

proven charm
#

wow diag_captureSlowFrame is cryptic ๐Ÿ˜…

still forum
simple trout
#

yeah, I definitely see that. I think we can agree that it would be better to at least notify users that the function is considered a bad practice

opal zephyr
#

^sorry this is wrong, one second

#

Profiling version is 2.12.150806

granite sky
#

lol @ at the idea of defining "bad practice" in SQF

lapis moth
#

The explosion happens all over the server and the player who did it does not appear in the log

#

Can anyone help

kindred tide
#

how do people usually ensure the right init order for objects that are sync'ed in editor?

#

like if these 2 things are synced i need one to be init'ed before the other

opal zephyr
#

You could put a brief sleep on one

#

Or a waituntil

kindred tide
#

thats.. for very simple scenarios

opal zephyr
#

If you're doing complex things id reccomend moving your code out of the initbox of the synced object

kindred tide
#

okay im leaving out too many important details lolg

#

i actually probably need to draw a scheme to explain

sleek galleon
#

Rookie question here, how do I add a radius of "X" meters on this line of script ?

this addAction ["Go to Camp Davis", {player setPos (getPos TeleportMarker_Davis)}]

I'm building a training map for my unit and want to have Altis Maps around to allow the players to navigate the different training sites easily, but right now, I can activate it from very far away.

Also, would stacking the same code work for different option ? Like this :

this addAction ["Go to there", {player setPos (getPos TeleportMarker_There)}] this addAction ["Go to Somewhere", {player setPos (getPos TeleportMarker_Somewhere)}] this addAction ["Go to here", {player setPos (getPos TeleportMarker_here)}]

kindred tide
#

what is "this"? an object on the map?

sleek galleon
#

It's the altis map (whiteboard) object

#

And i've put the script in the map's init

kindred tide
#

uh, you mean that by "this" the whole map is referred to?

sleek galleon
#

What I've done for now is the map show the option in the mouse wheel menu, and you teleport to an invisible helipad in the target area

#

That object

#

The whiteboard with the map of altis displayed on it, if you will ๐Ÿ˜„

kindred tide
#

and the action appears for you regardless of where you are?

sleek galleon
#

About 50m away from the object if I look at it

#

I've read somewhere that if you don't specify the radius, 50m is the default radius for the action to appear

opal zephyr
#

The addaction page tells you how

sleek galleon
#

I've tried what it says but I can't comprehend it, i'm shite at scripting

opal zephyr
#

This is the format for it
'''
object addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection, memoryPoint]
'''

sleek galleon
#

so I just gotta do this addAction ["Go to Camp Davis", {player setPos (getPos TeleportMarker_Davis),2}]

opal zephyr
#

No, you're putting the radius inside the script

#

You need to fill it, hold on ill show you

sleek galleon
#

Thanks ๐Ÿ™‚

opal zephyr
#

this addaction ["Go to Camp Davis", {player setPos (getPos TeleportMarker_Davis)},nil,1.5,true,true,"","true",2]

#

^that will use a radius of 2

sleek galleon
#

nil,1.5,true,true,"","true"

What are these ?

#

Thanks for taking the time to explain the basic shit ๐Ÿ™‚

opal zephyr
#

We have to fill it with the default values until we get to the variable we want to change, so had to fill arguemenrs, priority, showWindow, hideOnUse, Shortcut, and Condition

sleek galleon
#

I see, so for instance if I wanna change the radius, I have to still fill the other variables options until the radius, but I don't have to do unconscious, selection and memoryPoint ?

opal zephyr
#

Thats correct. All of these values are auto filled with the default (thats stated on the wiki page) if you dont manually state them

#

There unfortunately isnt a way to tell it "hey I just want to change the radius"

sleek galleon
#

I see where I went wrong then, thanks

#

Can I also just add more line to have more options ?

I want each map (items) to have all the other teleporting options, so can I just do something like this, but of course changing the names of the teleportmakers ?

["Go to Camp Davis", {player setPos (getPos TeleportMarker_Davis)},nil,1.5,true,true,"","true",2]
["Go to Camp Davis", {player setPos (getPos TeleportMarker_Davis)},nil,1.5,true,true,"","true",2]
["Go to Camp Davis", {player setPos (getPos TeleportMarker_Davis)},nil,1.5,true,true,"","true",2]
["Go to Camp Davis", {player setPos (getPos TeleportMarker_Davis)},nil,1.5,true,true,"","true",2]

#

Like, will it display all the options ?

opal zephyr
#

No I dont believe that will work, needs to have the object addAction bit at the start

sleek galleon
#

Oh yeah, right, I didn't Copied it ^^

this addaction ["Go to Camp Davis", {player setPos (getPos TeleportMarker_Davis)},nil,1.5,true,true,"","true",2]
this addaction ["Go to Camp Davis", {player setPos (getPos TeleportMarker_Davis)},nil,1.5,true,true,"","true",2]

(and so on)

#

That'd work then ?

opal zephyr
#

Yup, make sure to include a ; after the final square bracket. Also the name likely needs to be unique

sleek galleon
#

this addaction ["Go to Camp One", {player setPos (getPos TeleportMarker_One)},nil,1.5,true,true,"","true",2];
this addaction ["Go to Camp Two", {player setPos (getPos TeleportMarker_Two)},nil,1.5,true,true,"","true",2];

(and on and on)

#

That way ?

opal zephyr
#

Yes

kindred tide
#

okay so basically, i want to change the init order within the same tick/frame, using "sleep" is not acceptable

#

if i use sleep they get added into another tick's init queue

#

the queue is cleared every tick, and post-init queue is cleared afterwards

opal zephyr
#

Hm, unsure about that, have never had to do that before

kindred tide
#

ig i'll add priority and sort the queue based on priority before clearing it

#

how it works: every object's INIT event spawns a script that waits for the god object to initialize, and adds it to its init queue. from that point on, only a single script (the god object's) is running, processing the init queue and updating the objects every tick

kindred zephyr
#

is there a way to tell the engine to only render certain pip surfaces?

something like a scripted R2T that excludes anything else that is not allowed to render?

Lets say for example that I want to show a single PIP screen in the whole map, but nothing else, scopes, mirrors, targeting cameras, etc

thin heron
#

looking to see how i am able to only allow certain steam id's into certain slots on my server. someone shared a script with me, but not sure how to make it work

vivid junco
#

So daft question for someone smarter than me so I know there is a fold wings option for the ucav sentinels is there a fold rotor option anywhere ? Trying to find out if itโ€™s feasible to do before trying to make a vehicle that has folding rotors and finding out it isnโ€™t possible

thin heron
#
if (isServer) exitWith{}; 
// Zeus users - allowed to use Zeus slots
_zeusUIDs =[
        // Put player UIDs here
        "7656xxx", //admin1
        "7656yyy",//admin2
        "7656zzz"//admin3
    ];


// kick Player back to Lobby if Zeus and not a known player
if ((str(side player) == "LOGIC") && !(getPlayerUID player in _zeusUIDs)) then { 
//hint "Failmission";
failMission "LOSER"; 
};```
sleek galleon
#

So, i've got a similar problem than before with the addaction script.

I've got this addAction ["Spawn MTVR", {createVehicle [(_this select 3), (getPosATL DavisGroundVhcSpawner), [], 5, "NONE"];}, "CUP_B_MTVR_USA"];

And I wanna also add a radius of 2 meters for the activation of the addaction. I've tried the same pattern as J3FF showed me for the teleporting script, but it doesn't seem to work, either that or I can't identify where to add the other variables. I've tried this :

Could someone help me out ? (I've taken the script from a discussion in the BIS forum and modified it for my needs, which works just fine minus the radius issue.

Thanks in advance lads ๐Ÿ™‚

thin heron
#

i dont know where to put this? in the init section of the game master module?

opal zephyr
sleek galleon
# opal zephyr Does it work? Like spawns the vehicle?

Yes it does, there's even apparently a part of the script that makes sure a secondly spawned vehicle doesn't spawn in the previously spawned one, because when I activated it multiple times, multiple trucks spawned in a safe distance from each others

#

But there was again the issue where I could active the spawning 50m away

opal zephyr
#

createVehicle has a paramater that by default makes sure they dont spawn in eachother. If you copy pasted the addaction we did earlier then it wont work

#

Since this one has the addition of parameters

sleek galleon
#

So, basically there's more variables now that i've added the create vehicle thing

opal zephyr
#

No, the second paramater of your addaction is code {} you've decided to put a createVehicle script in it, great. You then do a comma and put the cup vehicle name, that spot your putting it in is the arguements spot. For the sake of this im not going to explain the passing if it.

opal zephyr
kindred tide
#

separating the code into a variable could help make it less confusing

#

put it into _spawnCode or something

sleek galleon
#

Oooo that's why it didn't work when I c/p what you added last time

sleek galleon
kindred tide
#

the code itself that you pass into the addAction

#

bet it looks very confusing rn

#

the "script" parameter

fair drum
kindred tide
#

per frame? sweet jesus why

#

it ticks at 1 per second

#

i dont need more

fair drum
#

you said you wanted it the same frame. you can have it exit the frame handler after its done

kindred tide
#

yeah the same frame the tick occurs, but it occurs not every frame

#

anyway i think i have an easy solution akin to sleep but the trick was in figuring out where to place it

#

the trick is to not process the init queue for X ticks to allow every object to board it lol

fair drum
#

Looking at further above, about ensuring object init order, I'm not 100% sure, but I would assume objects are initiated in the order they are in the .sqm file, using their id class. Worth testing and looking into

kindred tide
#

what i need to ensure is that every object boards the init queue for the first pass, so that every object will be in the post-init queue. going from one queue to the next in the same tick is the right init order

#

objects inside the init queue can enter in any order. what matters is that they will all be in the post init queue afterwards

fair drum
#

have you attempted to reach out to some of the devs that have access to the backend code to find your work arounds?

kindred tide
#

the post init queue is where relationship between objects builds, and the init queue is where they are basically constructed. so i need the relationships to be built after every object is constructed

#

no i havent

fair drum
#

look through the bohemia role tags and look for ones that have programmer tag and shoot them a dm. maybe they will respond.

pulsar pewter
#

Hey folks, just a quick question:

I've got a series of scripts, which work, that do lots of things to UAVs. These functions are activated by an event Handler, which I popped into a unit's init while writing/testing the scripts:

this addEventHandler ["FiredMan", { 
 params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"]; 
 [_unit, _weapon] call RG_fnc_CUAS;
}];

The way the EH/fnc are set up, the fnc is executed no matter the weapon.
Now (and here's the question part), I've made a model which I should soon be turning into a proper weapon. What would the process look like for ensuring that my function is executed only when THAT gun is fired?

pulsar pewter
#

--One option would be to just add the EH to all player units, and then just have a weapon check to see if function is executed, but idk if that's ideal, as EH would be fired every time a weapon is fired, whereas I imagine few/only one will have the weapon I'm making per session.

fair drum
pulsar pewter
fair drum
#

you do the conditional first, then add it if the conditional is true. this would all be external to the editor. I guess you could do the editor too if they are going to use the loadouts you give the units in the editor

#

but if units change weapons during the mission, then its still best to have it fire locally on everyone and have it added to everyone. its only 1 conditional it has to check, and you aren't going to be firing it every frame. its very minimal.

pulsar pewter
#

Hmm.
I'm trying to make this into a proper weapon mod, where the mod has both the gun model+the scripts for whenever the gun is fired.
I've got both parts pretty much done for when I assemble them together via the EH+initbox of a player, but I'm not sure how to translate this into a proper mod that doesn't require people assembling via editor (if that way of phrasing makes sense).

sullen sigil
#

has anyone here managed to interpolate setvectordirandup/addtorque smoothly across the network before? if so, how? kinda stuck how to do it ๐Ÿ˜…

fair drum
sullen sigil
#

it doesnt do it at all

#

setvectordirandup/addtorque has no engine interpolation as theres no angular velocity

kindred tide
#

in arma 2, in the 1st mission you are on the aircraft carrier and as part of training you can shoot some test targets that are launched from a thingy on the deck.. their flying trajectory is so badly interpolated, it's like a slideshow

sullen sigil
#

yeah, no thanks -- interpolation yes plz

#

worst comes to absolute worst i have to use a vtol/plane/whatever but i dont want to have to do that in the slightest

kindred tide
#

idk, slow down some character's animation and attach the object to its bones to make it move smoothly, adjust the character's position so that the trajectory matches what you want

sullen sigil
#

its for just a regular physx object

granite sky
#

svt should interpolate the vector dir & up if you give it sensible values.

sullen sigil
#

i do and it does not do so

#

at least not on an interval of 1 used eachframe but it does on the velocity

granite sky
#

You mean it jumps from start to end, or just shaky?

sullen sigil
#

stuttering like the velocity issue i was having

granite sky
#

oh, that's probably as much as Arma can manage.

sullen sigil
#

no angular velocity interpolation stuff so ๐Ÿคท

granite sky
#

Unless you create the thing locally and simulate it everywhere.

sullen sigil
#

yeah, no thanks
want turrets and shit on it too

#

plus trying to network sync that meowsweats

kindred tide
#

i bet physics are done in a fixed-rate update loop, while your code runs in a frame dependent update loop

granite sky
#

I feel like it might have been faster to learn modelling and make a real submarine :P

sullen sigil
#

its for vehicles outside of armas 50m requirement

granite sky
#

oh, is that a hard rule

sullen sigil
#

like the aircraft carrier and crap, just attach it to this and problem solved

sullen sigil
#

this doesnt give collisions but it allows me to have ships with walkable interiors etc

#

(can even have bigger on the inside interiors ๐Ÿ—ฟ)

kindred tide
#

theres this multiplayer game called angels fall first where you can walk inside big spaceships as they are piloted by other players

sullen sigil
#

yeah, you can do that in star citizen too etc iirc

kindred tide
#

and it was also possible in galactic conquest mod for battlefield 1942 (the old one)

sullen sigil
#

this is similar though not identical as youre still teleported to a static interior

#

never played battlefield

#

in a similar vein, what do people tend to use for invisible physx objects? ๐Ÿ˜…

#

big supply box might work for 1.6km long capital ships but for my bigger on the inside portapotty not so much

kindred tide
#

afaik to make AI drivers avoid obstacles

sullen sigil
#

you misunderstand
what objects do people use

kindred tide
#

they drive around physx objects

#

ah

jade turret
#

hello everybody and have a wonderful morning/midday/afternoon/evening/night. I want to mark all objects of the same type on the map in eden with a marker of my choosing in a color of my choosing. Any idea how this can be done ( marking everything by hand takes too long ).

#

foe example i want to mark all chapels on altis

#

i know how to find classnames in the wiki ...

#

thx in advance

simple trout
kindred tide
#

i mean to me it looks like A3 has more physics than OFP though

simple trout
#

Arma 3 has about 3 physics engine it

#

And its definitely lock step. Else you would have a lot more graphics bugs

opal zephyr
simple trout
sullen sigil
#

stuttering was fine once i added velocity as well as setposasl, there's just no angular velocity currently implemented ๐Ÿคท

jade turret
#

sorry i know i dont know much about this yet

opal zephyr
#

@jade turret Which objects are you trying to place it on?

thin heron
#

Anyone know how to limit roles that have Zeus to certain steam ids

jade turret
#

i want to display a marer on the map on the same positions as for example the chapel

#

marker

manic kettle
jade turret
#

like this exept i need a script for it since i will probably need to mark dozens maybe even hundreds of things.yes i am aware this will hurt perfomance

#

the chapel is maybe a bad example since it already has a map marker ...

opal zephyr
#

how are the objects placed? Are they apart of the map like the chapels, or are they put down in the 3den editor?

jade turret
#

editor

#

i put down the red square in editor

#

the church marker below it was already part of the map

#

i want to automate the process of putting down the marker

opal zephyr
#

that church is placed there as a part of the map, not the 3den editor

jade turret
#

yes

kindred tide
#

i did this thing in A1

jade turret
#

the church is the red marker is not

kindred tide
#

to find out class names of buildings

opal zephyr
#

What im asking though is are all the things you want to place markers on apart of the map, or are they placed in 3den

jade turret
opal zephyr
kindred tide
#

just iterate over nearObjects then

jade turret
#

i know where to find classnames

opal zephyr
#

or like 10x said, if you want to use classnames, do nearobjects

sharp grotto
#

just put typeOf cursorObject into one of the debug console watchfields and aim on the building
that will show you the classname

kindred tide
#

they want to mark the buildings on the map

jade turret
#

i will try give me a moment

#

well that command just gives me the coordinates on said objects in the console

#

but i want to mark it on the players map

kindred tide
#

createMarker

jade turret
#

if afraid i dont get it

#

can you give me the command for the example i listed above please

#

i might be able to work it out from there

kindred tide
#
     private _marker = createMarker [str _x, position _x];
     _marker setMarkerType "hd_dot";
     _marker setMarkerColor "ColorRed";
}
foreach ([0,0,0] nearObjects ["House", 99999999]);```
#

this should mark all buildings with red dots

#

is "hd_dot" a thing in A3?

jade turret
#

i think i can make that work

#

i can even change markers if needed

#

thx

opal zephyr
#

should use [worldSize / 2, worldSize / 2] for position, and worldSize * sqrt 2 / 2 for radius

jade turret
sharp grotto
#
{
    {
        private _ChurchToMark = _x;
        private _markerName = format ["ChurchMarker%1", _forEachIndex];
        private _markerstr = createMarker [_markerName, position _ChurchToMark];
        _markerstr setMarkerType "hd_flag";
        _markerstr setMarkerSize [0.8, 0.8];
        _markerstr setMarkerColor "ColorGreen";
        
    }foreach(getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition") nearObjects [_x,20000]);
}
foreach
[
    "Land_Chapel_Small_V1_F"
];
jade turret
#

thats the 4th command i understand now ...

#

although instead of chapels it now marked any building

#

can specify that more closely ?

#

wait i think El rabots command does that !

#

rabitos i mean sorry

#

his command works as well

#

one last thing:

#

i want to know how many objects were marked when i use the command.

sharp grotto
# jade turret i want to know how many objects were marked when i use the command.
private _MarkerCount = 0;
{
    {
        private _ChurchToMark = _x;
        private _markerName = format ["ChurchMarker%1", _forEachIndex];
        private _markerstr = createMarker [_markerName, position _ChurchToMark];
        _markerstr setMarkerType "hd_flag";
        _markerstr setMarkerSize [0.8, 0.8];
        _markerstr setMarkerColor "ColorGreen";
        _MarkerCount = _MarkerCount + 1;
        
    }foreach(getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition") nearObjects [_x,20000]);
}
foreach
[
    "Land_Chapel_Small_V1_F"
];

hint format ["Total Marked Buildings: %1", _MarkerCount];
ripe juniper
#

Hey, I'm having a few issues with this tidbit of code below. I'm pretty new to A3 scripting, but I've tried for four or five hours to get this and some other stuff to work. I've got the other stuff to work, but just not this. The gist is that in an HitPart EventHandler I added an if statement(if shouldExecuteSpray == 1 then) that fires the main functionality of the script. I intended for there to be a small delay for optimization purposes, so I set shouldExecuteSpray to 0, and I wanted this code below to reset it back to 1 after a very short delay(the uisleep), but it doesn't work? I'm not sure if setting it to privates/local variables would fix this, I intended to do that after I got this to work but I just haven't yet, not sure if globals would've been better but it's just the thing I tried first, since I'm pretty new to SQF.

    waitUntil {shouldExecuteSpray == 0};
    uiSleep 0.09;
    shouldExecuteSpray = 1;
    publicVariable "shouldExecuteSpray";
};```
granite sky
#

Where are you running that?

ripe juniper
#

init.sqf

granite sky
#

and where are you setting shouldExecuteSpray = 1?

ripe juniper
#

the same file, i've gotten my conditional to work and (presumably) have it set to 0 since the hitpart effects dont fire anymore, just not managed to actually figure out how to set it back to 1

granite sky
#

Do you know how to use diag_log?

ripe juniper
#

i do not

granite sky
#

You should learn. The most basic form of debugging is printf debugging.

sharp grotto
granite sky
#

Find your RPT. Put a diag_log format ["shouldExecuteSpray = %1", shouldExecuteSpray]; before and after the waitUntil. See whether either of them trigger.

ripe juniper
#

i tried looking for something like print since i know other languages yeah, i just didnt know what the equivalent of print would specifically be called

boreal parcel
#

Theres a couple ways to do it, I would say diag_log is the best but there is also hint and systemChat which I frequently use as they can be seen in-game

jade turret
# sharp grotto

works fine for buildings but not all objects f.e trees rocks, etc

sharp grotto
jade turret
#

i m a wierdperson

#

j3ff directed me to this command in the beginning but i couldnt get it to work ...

#

what does this word mean : _ChurchToMark

#

or what does it do precisely ?

kindred tide
#

it's the variable name

#

you can change it to almost anything

jade turret
#

ok

#

so i only need to change this when marking other structures "Land_Chapel_Small_V1_F"

kindred tide
#

yeah that there is the array of classes you want marked

#

you can add more items to it

jade turret
#

figured that ou laready

#

doesnt work with tree classnames though

kindred tide
#

probably because they are part of the terrain

jade turret
#

but then how can i mark those ?

#

i dont quite understand how nearObjectsworks

kindred tide
opal zephyr
#

Struggling on the wiki to find a way to get a config from just a classname, I want to be able to provide a classname and get the mod dir, as done in configSourceMod. I'm pretty much trying to check if a uniform is vanilla or not

kindred tide
#

configFile >> "CfgVehicles" >> (typeOf _obj) >> etc

opal zephyr
#

but doesnt that require the exact path?

kindred tide
#

no

jade turret
#

good

opal zephyr
kindred tide
#

then you already have it

jade turret
#

Bi wiki is sometimes a bit difficult to understand ...

kindred tide
#

instead of typeof you put the classname

opal zephyr
#

ya, that didnt work

kindred tide
#

what is the classname for

opal zephyr
#

a uniform

#

not the inventory item, but the actual uniform

#

hold on one sec

kindred tide
#

so, the question is, which cfg the uniforms are in

jade turret
#

ok i ask the other way around : if i wanted to mark all objects on the map with the classname class "t_FraxinusAV2s" how would i write the code ?

opal zephyr
opal zephyr
#

ya I didnt realize the uniform command gave the cfgWeapons class and not the vehicles one, thanks!

wary needle
#

how would i change this so it only applies the aps to tanks that dont have aps, as this script only does it once

#

if (true) then {
{
if ((_x isKindOf "B_MBT_01_TUSK_F")) then {
[_x, 15, 8]call addtoTrophy;
};
} forEach vehicles;
};

hallow mortar
#

When you add the APS to the vehicle, set a variable on it using setVariable. Then, when you collect vehicles to add, include a check to see if it has the variable, using getVariable.

wary needle
#

_vehicle setVariable ["APSadded", "", true];

hallow mortar
#

I'd recommend using a bool as the value, makes it a bit simpler to check on it

wary needle
#

_applyLoop= 0 spawn {
while {true} do {
if (true) then {

        {private _added = _x getVariable "apsAdded";
            if ((_x isKindOf "B_MBT_01_TUSK_F") && ( isnil "_added")) then {
                [_x, 15, 8]call addtoTrophy;
                hint "added to tank";
            };
        } forEach vehicles;
    };
    sleep 5;
};

};

#

IT WORKS EPIC

hallow mortar
#

Just use the default value syntax of getVariable

#
_vehicle setVariable ["APSadded", true, true];

if ((_x isKindOf "...") && {!(_x getVariable ["APSadded", false])}) then { ...```
#

How did you write an entire APS script without knowing what a bool is...?

wary needle
#

stole it of a forum, fixed a bunch of shit added the ablity to respuply. added range

#

idk

#

added limited charges

hallow mortar
#

I hope you left the author credit in

wary needle
#

deleted acount

hallow mortar
#

Anyway, if it was prebuilt, I wouldn't be surprised if it already sets a variable on the vehicle for exactly this purpose. You should check.

wary needle
#

it doesnt, was not writen very well

#

brain fart

hallow mortar
#

A bool is a Boolean value, that is, a value which is either True or False

wary needle
#

now the resupply is broken lol

hallow mortar
#

This change didn't touch anything about the resupply (assuming it was implemented as described), so ...

wary needle
#

here ill post what works and what doesnt

#

@hallow mortar cant post it here to big

hallow mortar
wary needle
#

doesnt work

#

does work

#

the only diffrence is the loop that applyies it to tanks. and the only thing that is broken is the resupply nothing else

#

you can see them right?

hallow mortar
#

Well, you're not setting the APSadded variable correctly for the type of check you're using, so that will happily add more copies of itself to vics that already have it

wary needle
#

it doesnt wdym?

#

oh ignore the "" it suposed to say true

#

i tested both

#

oh wait

hallow mortar
#

You don't need the _added = _x getVariable ... line, retrieving the variable is already being handled by the getVariable in the if condition itself

#

You have an if (true) then { which is pointless; true is always true, the if check can never fail, it doesn't need to be an if at all

#

There's also an else {} which is similarly pointless - an if with no else at all works exactly the same

midnight niche
#

how come sometimes the performance test in debug only runs 1 iteration?

little raptor
wary needle
#

shouldnt it be true?

little raptor
#
  1. the code has errors
midnight niche
hallow mortar
# wary needle shouldnt it be true?

No. We are using the default value syntax of getVariable to assume the variable is false if it's undefined. This allows us to use it directly for true/false checks, since it will only be either false (if undefined) or true (if we've already set it)

wary needle
#

when i use your way it goes on forever

hallow mortar
#

What does "goes on forever" mean

wary needle
#

aps added to tank a buch of times

hallow mortar
#

Are you correctly setting the variable to true when adding it? If you set it to "" the check will not work properly.

wary needle
#

wait ill change it gimme a sec

#
_vehicle setVariable ["APSadded", true, true];
_applyLoop= 0 spawn {
    while {true} do {
       
            {
             
                if ((_x isKindOf "B_MBT_01_TUSK_F") && {
                    !(_x getVariable ["APSadded", false])
                }) then {
                    systemChat "APS added to tank";
                };
            } forEach vehicles;
       
        sleep 5;
    };
};

#

this is what i testeed

#

omg

#

i am a dumbass

#

[_x, 15, 8]call addtoTrophy;

#

thats why nothings working lol

hallow mortar
#

Yeah you do need to actually run the code

wary needle
#

no i ran it but it kept on printing aps added, besoue i forgot to add the part that adds the aps lmao

#

it works now lol

hallow mortar
#

Yes, that's the code I meant

hallow mortar
#

For the record there are still several things about this APS script that should really be done differently, but that's not something I want to get into right now

midnight niche
#

What am I doing wrong here?

```sqf
_houses = nearestTerrainObjects [getpos player, ["House"], 350, false, true];

_allPos = [];
{_pos = _x buildingPos 1;
_allPos = _allPos + _pos;} forEach _houses;
systemChat format ["number of house/pos: %1/%2", count _houses, count _allPos];```
num houses = 122, num pos = 122
```sqf
_houses = nearestTerrainObjects [getpos player, ["House"], 350, false, true];

_allPos = [];
_addPos = _allPos append (_houses apply {_x buildingPos 1});

systemChat format ["number of house/pos: %1/%2", count _houses, count _allPos];```

theoretically they should be the same right? at least that's my intention, 

okay wait, 3 elements each, script 1  (+) is just adding it to one giant array. 
But I error with pushback or append despite _pos being an array?~~~

i'm a moron
winter rose
sage bridge
#

then what?

warm hedge
#

What Lou said is we do not like to have โ€œtextwallโ€ but just a (trustable) link

#

And... what fix? What issue?

south swan
#

"chatgpt code no worky" issue

sage bridge
#

I understand, Evertime I run this script it constantly says missing ";"

#

and constant errors

warm hedge
#

โ€œI do have errorsโ€ is not a troubleshoot or proper way to tell what's wrong

winter rose
#

who wrote that

sage bridge
#

I used chatgpt to build a script

warm hedge
#

Okay just check the pinned to troubleshoot

wary needle
#

is there a simple way to turn off ais collision avoidace?
with other ai on the ground.
its just im trying to make a horde of zombies and they stop and slow down when near other zombies. if they glitch through eachother thats fine.

sage bridge
#

'...his;
[_animalInfo select 0, _animalInfo |#|select 1] call _spawnAnimalHerd;
};

{
p...'
Error Zero divisor
File... line 33

#

this is the error I get

tough abyss
wary needle
#

what command would u use to diable collision

tough abyss
#

think disableCollisionWith lemme grab the biki link

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
sage bridge
warm hedge
#

Then do

sage bridge
# warm hedge Then do

mean't to say I do not understand what I am supposed to be looking for, just accidently sent it before I could finish, sorry.

tough abyss
#

if you want to actually learn and not just use an ai check what i replied to and searching for "fockers arma scripting guide" should also help

warm hedge
#

Isn't it obvious? The topmost pinned post

sage bridge
#

Just because I use chatgpt to help me learn and tells me how to structure a script doesn't mean anything.

#

I don't know how to read, or type sqf language, im very new to this

tough abyss
#

sqf (arma 3's coding language) is too niche for chatgpt to really bother correctly learning it / having the devs show it the correct way to do things and there is more outdated arma 3 info online than upto date info meaning it pulls incorrect info and fills in with assumptions from other languages

warm hedge
#

We're just telling you NOT to use ChatGPT or any other AIs to make Arma compatible scripts

tough abyss
#

you can use ai programs once you have a decent understanding for a structure or a base but don't try make the entire thing ai if you want it to work.

sage bridge
#

I just want animals to spawn in herds that are defined in amounts that are in the first bracket, then define how many herds I want to spawn, then the position

warm hedge
#

We're not going to troubleshoot GPT's script, especially if you do not know what you're doing, your intention and what they think

sage bridge
#

ill go ask for another persons help then.

warm hedge
#

Nobody is going to help, or, if they do, you shouldn't expect to make the code work. If they even do, it does mean full rewrite by themselves

tough abyss
hallow mortar
#

You can use the alt syntax to get magazines for a specific muzzle.
Often the weapon's primary muzzle will be the muzzle with the same name as its classname. This isn't strictly guaranteed though, a weapon could theoretically have its GL component as the main muzzle and its rifle component as an additional muzzle, or only have individually named muzzles.

tough abyss
#

is there any way to make ai not shoot at an uav yet still have the operator able to control it? tried using setcaptive and doesnt seem to work

jade acorn
#

setcaptive does work if your UAV is placed in editor and you don't disassemble it, if you keep packing and unpacking it you would need an eventhandler running to add setcaptive to its pilot every time.

#

it mighht not work if you use mods altering AI ofc.

tough abyss
#

had set it to this (ignore the condition was previously set to true)```sqf
P_1 addEventHandler ["WeaponAssembled", {
params ["_unit", "_staticWeapon"];
if ( _staticWeapon == typeof "") then {staticWeapon; setCaptive true; hint "1";};
}];

#

p_1 is a players unit without respawning

cosmic lichen
#

staticWeapon; setCaptive true;
What's that?

hallow mortar
#

What the hell is (_staticWeapon == typeof "") supposed to do

tough abyss
tough abyss
kindred tide
little raptor
#

which part do you think is advanced?

#

anyway it's very basic

kindred tide
#

i was being sarcastic

little raptor
#

I figured you were talking about the event handlers... meowsweats

kindred tide
#

nah, i already have my own EH system

#

with ways to subscribe and unsubscribe from events

#

this is the whole of it lolge

hallow mortar
#

Event handlers are in OFP, you don't have to make your own

kindred tide
#

this is for "custom" events that only exist for my types of objects

astral bone
#

Trying to use the note exmaple code, but then expand on it

#

I dunno the math behind this, but also kinda wanted to let there be offsets-

kindred zephyr
#

isnt vectorDir and Up engine level solution for that function?

astral bone
#

I don't understand that either. I do understand that if I give setPitchBank 180, it will make it be upside down x3

hallow mortar
#

I'm pretty sure that function uses vectorDir and up. It's just a wrapper that does some maths for you so you can use degrees instead of having to deal with vector directions.

astral bone
#

actually- maybe someone can help me with just vector dir/up

#

I have a model that I am making. Simple object. By default, it is 180 degrees off of the direction I want it to be facing. I also want it to take another object's rotation into account.

#
    _fObj setDir (getDir _this);
    (_this call BIS_fnc_getpitchBank) params ["_pitch", "_bank"];
    [_fObj, _pitch+180, _bank] call BIS_fnc_setPitchBank;
    private _tmp = [vectorDir _fObj, vectorUp _fObj];
    _fObj attachto [_this, [0, 0, -0.035]];
    _this setVariable ["RCHT_Light_info_Bulb", _fObj];
    _fObj setvectorDirAndUp _tmp;```
_this is the original object, _fObj is the simple object.
#

I tried doing this, but- no xD

#

wait-

#

But yea, this isn't working.

kindred zephyr
#

the comment on the function mentions something regarding attachTo

astral bone
#

Yea, so my attempt to get around that was do the rotations, save what it gives, attach, then apply what was previously saved

#

wait

#

BIS_fnc_setObjectRotation seems to work fine-

slender badge
#

I'm looking to check how a player started the scenario from the Eden Editor. I'd like to know the setting under Play in the attributes (Play in SP, SP with brief, SP at camera, MP). Is there a command or displayIDD I can check?

winter rose
kindred tide
jade acorn
#

how can I find a texture/image name of a marker used on map? Without having to unpack someone's mission and browsing through files or opening it in editor.

hallow mortar
#

You can combine allMapMarkers and markerType to find all the markers in use. The texture specifically would require a config lookup in CfgMarkers based on the classes retrieved.

astral bone
#

So, I've never really tried to mess with map making, only map editing via eden. Now, trying to "replace" roads on a map, I realized how I think roads are done and I can't unsee it...

#

Which also means, CUP terrain isn't useable for "replacing" roads

kindred tide
#

AI's way around bridges is funny

#

is a bridge part of a road or.. something else

#

i was playing A2 yesterday and when looking through scope at a tank that was driving on the bridge, the bridge rendered to me in front of the tank, as if it's Z draw order was messed up lol

#

but only the surface the tank was driving on, not the whole bridge

astral bone
#

There isn't a way to replace road textures right? xD
I doubt it.

winter rose
#

bingo - nope

astral bone
#

I wish I could. I'm populating the map with stuff. All the towns are gonna have dirt roads though xD

#

Welp, I wanna ask some more questions, but I shall do so in another channel. :P

unkempt wadi
#

Hi i would likรฉ ton know if there IS a script to force plane to attack a unit in Zeus ? (Init box/Zeus module/etc)

When i select a plan unit with a S&D waypoint it just fly around.

little raptor
#

well you can use the virtual CAS module

unkempt wadi
#

I tried it out but when the plane drop the bomb it goes 200 M ahead

little raptor
#

which plane do you use?

unkempt wadi
#

All planes like vanilla Or A-10 for exemple

little raptor
#

well the A10 works ok last I checked

#

is the unit on a tall building or something?

#

also are you using any mod that modifies the projectiles, such as ACE?

unkempt wadi
#

Yes i use ACE do i need a compatibility patch ?

little raptor
#

not sure. try without it if you can. see if it solves the problem

unkempt wadi
#

Ok thx i will try out

faint oasis
#

Hi, i have a question ? Is it possible to change the default "GuerAllegiance" in the Eden Editor like the "IFA3" mod or Spearhead 1944 dlc ?

little raptor
faint oasis
little raptor
#

I think it's a config thing think_turtle

faint oasis
#

yeah i wasn't sure about that so i will post that in the config channel then thank you ๐Ÿ˜„

little raptor
#

well I'm not sure

#

let me check

faint oasis
#

yeah same thing here ๐Ÿ˜„

#

i searched that in the config but i don't see any change on that "control" so i don't really know honnestly

kindred tide
#

is this gonna work:
_obj setVariable ["someCode", #include "someCode.sqf"];

little raptor
#

no

#

pp commands must start with whitespace (or nothing)

kindred tide
#
[
"someCode", 
#include "someCode.sqf"
];``` ?
faint oasis
little raptor
#

nope

faint oasis
#

oh ok thank you

kindred tide
#

that's like a cthulhu merge

vapid scarab
#

Are CfgFunctions stored as a missionNamespace variable like ^?

warm locust
#

Hello everyone, I'm using Killzonekid's r2t and PiP script.
I made changes, trying to get rid of the script created TV & UAV, using physically placed objects instead.
It works, sorta. Just the UAV no longer tracks the target, not sure what I'm breaking.


uav1 lockCameraTo [tv1, [0]];

/* create camera and stream to render surface /
cam = "camera" camCreate [0,0,0];
cam cameraEffect ["Internal", "Back", "uavrtt"];

/ attach cam to gunner cam position /
cam attachTo [uav1, [0,0,0], "PiP0_pos"];

/ make it zoom in a little /
cam camSetFov 0.1;

/ switch cam to thermal /
"uavrtt" setPiPEffect [2];

/ adjust cam orientation */
addMissionEventHandler ["Draw3D", {
    _dir = 
        (uav1 selectionPosition "PiP0_pos") 
            vectorFromTo 
        (uav1 selectionPosition "PiP0_dir");
    cam setVectorDirAndUp [
        _dir, 
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
    ];
}];```

Here is a link to the original code from Killzonekid's website http://killzonekid.com/arma-scripting-tutorials-uav-r2t-and-pip/
little raptor
#

defines just get removed

#

every PP line is removed

kindred tide
#

question is, when. at the moment the file is included or when the contents are being setVariable'd

#

like, do they get to have any effect on the file they're being included to

little raptor
#

if you know how a comment works, it's the same with PP

kindred tide
#

i dont assume i know how anything at all works

#

cause it was wrong too many times lol

little raptor
#

first the preprocessor runs over the file, removes the comments, removes the pp lines; replaces includes with what they include, and replaces macros. it also removes the parts that fail the #if test
it does this recursively for all files that you #include as well
this gives you a "preprocessed" string
then you pass this string to a compiler, which well, compiles it into something that can run

kindred tide
#

thank

little raptor
#

tho the preprocessor is hand-written so it might be different in some case from SQF's

kindred tide
little raptor
#

what is Kozlowski?

kindred tide
#

๐Ÿ˜ž

#

it's a character from OFP

little raptor
#

well it's for Arma 3 so no

simple trout
kindred tide
#

i mean Arma3 tools have been compatible so far

#

the pbo packing and such

#

though i'll be honest i haven't tried for OFP yet, only A1 and A2

velvet merlin
#

Warning Message: Problem occurred when saving profile data. The file may be set to read-only or can be blocked by another instance of the game (e.g., dedicated server).

#

is PNS not yet availble in preStart/main menu cutscene?

simple trout
#

the namespaces should be available during preStart

still forum
#

ProfileNamespace could possibly not be available at preStart, but don't know if it is.
Is quite easy to test though

stable dune
#

@ivory meteor I move this here because your question is more scripting than making textures.

Could you share your code with what you are using.

ivory meteor
#

Billboard1 setObjectTextureGlobal [0, "D:\SteamLibrary\steamapps\common\Arma 3\Media\CHERNA.png"];

unique pewter
#

Hey guys is there a way to force the ai to drive on the roads???๐Ÿซ im trying to get some tanks to drive on the road but itโ€™s not working

stable dune
ivory meteor
#

wdym where am I calling?

stable dune
#

You are using global command, so just thought if you are using that from the unit init

ivory meteor
#

I am I guess

little raptor
ivory meteor
#

Oh ok

little raptor
#

and then use getMissionPath "cherna.format"

#

(format is the new format that you use)

#

getMissionPath is probably not needed tho

ivory meteor
#

Yeah sorry I was just confused getting into this stuff is a mind bog

#

Thank you guys

ivory meteor
little raptor
#

whichever mission you're editing

fair drum
#

what's a work around to prevent a disabled simulation player from firing the round in the chamber?

little raptor
#

overriding the fire action

ivory meteor
little raptor
#

did you convert your image to some other format?

ivory meteor
#

yes

#

but I cant find me mission file

pulsar pewter
#

Most likely, go to Arma 3 - Other Profiles\whateveryourArmaProfnameis\missions\missionname.mapextension

#

If you're playing in the default Arma 3 profile, instead of Arma 3 - Other Profiles, it'll just be Arma 3.
All in My Documents

wind cairn
#

Does anyone know if its possible to know when a player stops ragdolling?

kindred tide
#

animStateChanged EH probably

#

(not 100% certain tho)

wind cairn
#

Thats actually a really good idea, thanks for that

unique pewter
#

Anybody know if there is a script or way to make ai use bipods??

winter rose
#

there is no way

hallow mortar
#

I don't see anything that looks wrong.
How are you determining whether the thing has been created? Bear in mind you're creating an invisible object

#

Can you expand on what "trying in Eden" means? Do you mean you're trying to make it happen in Editor mode, or when playing the mission?

south swan
#

inb4 trying to run scheduled code directly in Debug Console

#

wrap it in [] spawn { code_here }; to use from console/handlers/init blobdoggoshruggoogly

hallow mortar
#

Why'd you use execVM when they said to use spawn.....?
Use createVehicleCrew to create a crew for the vehicle.

trim hull
#

I'm fighting locality issues with addAction, can anyone tell me what I've done wrong?

Pie_fnc_CondHaltAllowed = {
    params ["_target", "_this"];
    _maxCommandAngle = 45;
    (!(_target getVariable "Pie_stopped") AND !(isNull driver _target) AND ((_target getRelDir _this < _maxCommandAngle) OR (_target getRelDir _this > 360 - _maxCommandAngle)))
};

[
    _truck, ["Halt!", {
        _truck = _this select 0;
        _truck setVariable ["Pie_stopped", true, true];
        [_truck, 0] remoteExec ["limitSpeed"];
        [_truck, 0] remoteExec ["forceSpeed"];
    },
    nil, 1.5, true, true, "", "[_target, _this] call Pie_fnc_CondHaltAllowed", 20]
] remoteExec ["addAction"];

Thanks

#

Weirdly, I got my mate to check it in the debug console ([truck, player] call Pie_fnc_CondHaltAllowed) and it returned true.. but still no action

hallow mortar
#

In addition to the scripted condition, you're using a 20-metre radius condition, so make sure the player is close enough to the truck. Note this is to the centre of the object, so for large objects you might need to be closer than you expect.
Also, make sure _truck is defined in the action-adding script.

#

Oh, also, Pie_fnc_CondHaltAllowed is only being defined on the machine that's executing this code. Machines that receive the action via remoteExec (i.e. every other machine) won't have the function.

tender fossil
trim hull
#

hosting a local server, I'm standing next to him and it works for me

#

with the debug console, no, used the actual variable name

#

...but I'm defining my function in initServer

#

that's probably it

trim hull
hallow mortar
#

it has some security benefits, but the main reason to use it here is ensuring all clients have all functions preloaded and ready to go during the mission preinit phase, making them easily accessible without broadcasting over network or anything like that.

trim hull
#

good to know, I'll look into it. thanks

astral bone
#

hm- if I wanted to test if something was nil in an array, would I need to assign it to a variable first or? I mean, I'm gonna, but yk, curious.
Also, any better ideas to only affect certain axis' then [0,nil,0]? :P

#

wait, does params give an error if you give the wrong type?

#
[0] params [
["_a",true,[true]]
];
_a; // Console returns true, but also shows on screen error for 'Bool expected, got number'
#

wait, is it like debug thing

winter rose
#

I expect params to return false here yes

winter rose
astral bone
#

I thought it gave "false" but didn't give an error? Unless I have extra errors shown or something-?

winter rose
#

don't set the expected data type array then

astral bone
#

Like, params to be used to silently correct it.

winter rose
#

no, no "silent autocorrect"
error

#

you call it wrongly, you want to know

astral bone
#

I guess I just never noticed it then? xD

#

I mean yea, makes sense.

hallow mortar
#

The specific purpose of the "expected data type" argument is to alert you if a wrong data type is passed

astral bone
#

and if I really wanted it to be silent, maybe I could do it in a try catch, but yk- yea, like Nikko said, I wanna know if bad data is passed.

astral bone
winter rose
#

leaves the chat

astral bone
#

nuuu

winter rose
#

isNil { _arr select _i }?

astral bone
#

oh-

winter rose
#

maybe even _arr findIf { isNil "_x" } could work, idk

astral bone
#

I thought it accepted a string xD

winter rose
astral bone
#

ohhh alt syntax

#

And is that a good way, or should I do it differently? To check if it should mess with that axis

winter rose
#

what

astral bone
#

script will mess with given object's position. Given [0,nil,0] it will set X and Z to 0, but leave Y unchanged.

winter rose
#

why not [0, 0] vs [0, 0, 0]?

#

that or use -1 as a fallback value - almost if not no chance for the real value to be that

astral bone
#

How would it know it's not 0 for X and Y but not Z?

winter rose
astral bone
#

Yea, maybe. In those cases, I could do [0,0] instead of [0,0,nil]

winter rose
#

"what should your code do" is a question you should ask yourself

astral bone
#
private _inpPos = [0,0,-0.001];
private _mode = 1; 
/*
0 - set;
1 - add to orig;
-1 - align to first obj (_inpPos -> bool, axis to align);
'nil' or no value means appropriate axis will be ignored.
*/

set just means it sets the given objects' positions to be whatever inpPos is.
Add or orig means add the inpPos to the object's current position. (Adjust all object's Z down by -0.001)
Align to first means the inpPos will be treated as if it's a 1 or 0, made to be a bool. All other objects will be set to the same position on the appropriate axis' as the first object.

astral bone
winter rose
astral bone
#

oh you mean like, no change for -1 to be used. Not negative numbers, but just -1?

winter rose
#

yep

kindred tide
#

oh shit i just saw this

#

(from setVariable page)

#

if under the hood they are all just references (i.e just an address in memory), why would it matter what the type even is

#

if by "setVariable" i'm practically just changing what a pointer is pointing to

winter rose
#

it is how it is

astral bone
#

I mean, if it's JIP, then it'd need to transmit the data over network, right?

#

So maybe type is useful then? idk x3

still forum
#

And yes, network sharing

#

For example Control's/Displays cannot be serialized as they are local only.
I'd think Namespace would work though, its not listed there

kindred tide
still forum
#

I assume what wasn't needed, wasn't implemented

kindred tide
#

so it means i have to macro my way around this limitation to set string/code variables as "Object" i guess

#

would that work

astral bone
#

wha

kindred tide
#

oh, object is an actual game object, not a general type lol

winter rose
#

why not try to emulate remoteExec in OFP too

#

also setVariable was introduced in Armed Assault ๐Ÿ˜

#

(OFP:E perhaps)

kindred tide
#

it's kinda self-contradicting

winter rose
#

I know, I wrote the page

#

time to fire OFP and see what autocomplete says