#arma3_scripting
1 messages ยท Page 93 of 1
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
#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;)
you can't write private _foo;
well, private _foo = somevalue
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-
that's false lol
well the question is why even bother to support those?!
you'll probably just waste your time 
most people just play A2 or A3
and in A2 they generally play the DayZ mod afaik
a good mod could revive any oldie
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)
#define var (var_name, def_value) private var_name = def_value;
#else
#define var (var_name, def_value) private #var_name; var_name = def_value;
#endif```
what about this
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.
it's more of a framework than a mod though, the mod will use the framework, and it makes sense for the framework to be reusable because i dont wanta write the same code several times
you can't put space before the (
so that's wrong
but apart from that, 
will this part not break? private #var_name; var_name = def_value; it's 2 instructions in 1 define
i thought the first semicolum could be seen as the end of the macro
macros end at the end of the line
unless the end of the line is escaped with \
like C++
#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
that's not the problem. the real problem is you're not paying attention to scopes
oh, those private vars will be only inside the for loop
ig i could use breakOut or breakTo but those weren't in OFP
well they wouldn't help anyway
#define params(arr) private arr; for "_i" from 0 to (count _arr - 1) do { compile (arr select _i) = _this select _i;};
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]
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
what's the problem?
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
instead of this do _this spawn ...:
_action1 = ["Intel",_interactionName,"",{_this spawn J3FF_fnc_interactFunction;},{true},{},[_intelTitle],"",3.5] call ace_interact_menu_fnc_createAction;
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
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```
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
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?
lmao
it set me up to expect everything to be very different and i'm caught off guard every time it's not different
welcome to arma
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"
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
ig it works identically to #include when it comes to introducing global vars
probably my brain is too worn out today to try figure out what that means
been netcoding sqf movement system
it's like a post-compile include
or mid-compile rather
and it only adds stuff to the module
i wouldnt bother trying to explain it to me its quite possible i have brain damage right now
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
i want to message, people in a tank. how would i hint only the tank passengers or crew
you are using playsound3d not playsound, yes?
correct
im on 2.12.15
private _sound = playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player]; // alarm
stopSound _sound``` works fine for me
you sure it's not 2.14?
it was introduced few days ago
so does stopSound work right now?
this still says undefined for me.. odd
Its not working for me, but kjw says it is
all i can recommend is you steam verify
I mean the command itself
ye
weird I seem to remember it was for 2.14 
Leopard do you need to manually update advanced dev tools? Or is the function recognition automatic?
It says stopSound is undefined
nope, im on main branch
Im running profiling, is that the problem maybe?
possibly
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?
yes
Alright, is the time it takes normally relatively standard? Like estimable standard?
Dedmen will probably update it next week
Alright, thankyou!
maybe tomorrow
cool, there isnt anywhere that that would be posted right? Like to indicate that it has
Sounds good!
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
is this design doomed and there's something important i dont know yet
you just created a missionNamespace
which already exists
STL never adds stuff to the global namespace
that's always in the the std namespace...
how? the functions are storead as variables in the modules, it's more like every module is a namespace
my man
A3A_fnc_createSomething;
is a global variable
with a type of code
cfg functions does this for you
the "adds stuff to the global namespace" and "is basically like STL" weren't meant to be like, connected, my bad. it's like STL in the sense that it introduces things such as queue, list, etc, but it does so into the global namespace
arguments call (uiNamespace getVariable "TAG_fnc_functionName");
yeah i have a shortcut for this, called ABC_function. it takes the namespace (an object), function name and args as parameters
you do realize that all the end user has to do for cfgfunctions to work, is basically add a line in the config file.
I don't have to do this as a end user
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
fair, is it backwards compatible though lol
starting from A2 yes
Also Modules are already a real thing https://community.bistudio.com/wiki/Modules
are you targeting the first Arma? If so why?
i'm targeting all games on this engine starting from the oldest, OFP
You do you man
Differences like the introduction of the Functions Library are why a single mod for all games is a bad idea ๐
you also, be limited to only the first Arma cmds, and functions else you had checks for what version you are running
`*// 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
Which is 24
Also 1.._herdSize is invalid too
cough, cough... chatgpt?
It looks like someone was porting from another language and missed a couple of bits.
Also backwards: _spawnAnimalHerd call (_animalInfo select 0);
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
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?
configClasses
How do I get the class name?
From a config? configName
No. That returns file paths.
private _configs = "true" configClasses (configFile >> "CfgWeapons");
private _classNames = _configs select {((toLower (configName _x)) find "g36") isNotEqualTo -1};
this is what that returns: [bin\config.bin/CfgWeapons/CUP_muzzle_snds_G36_black,...]
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 }
wow, would it not be my code if you didn't fix John?
lol
that's gonna be slowish
Im compiling a list of items for an ace arsenal. I dont need the code for a script. Just the result
Alright, just know that splitString is slow, because the engine has to make arrays for that, and then you flatten the array...
anyone know if the apex campaign missions (keystone specifically) are decrypted and released by bi yet?
Very already
link or file?
expansion\missions_f_exp
thx
Yes, I used chatgpt to help me write this script and its not going anywhere
is there anyway someone can help rewrite the script to work?
We listed four? errors I think.
but really you should try to learn the language.
SQF Syntax scripting language no?
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.
so instead of forEach I want to just change it to for?
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.
};
};
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
actually in the right ballpark
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 ;
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.
};
};
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.
// 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 = {"
_position = _getRandomPosition(); is wrong. It's just...approaching from several wrong angles.
The parameters for BIS_fnc_findSafePos are slightly wrong; you have the water mode set to 3, but as documented (https://community.bistudio.com/wiki/BIS_fnc_findSafePos), the water mode can only be 0, 1, or 2.
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.
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?
remove the recursion?
please
Okay
Also I think your BIS_fnc_findSafePos usage got weirder.
Explain?
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;
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
if 2 is your charges like you said, change it to 4?
or more
yeah
That's how to change it in the initial call. What they want to do is change it later, after it's already been turned on
How to do that depends on how the charge system is implemented in the APS code itself
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
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..
any tips how to determine what is actually lagging in mission? I mean is it units on map or scripts or what
interesting stuff but I think that only covers script performance. thx
Performance profiling covers other things too. Check the screenshots on the BIKI page
ok
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)
I'd say first try capturing a frame and see what the issue is
Instead of deleting stuff
(inb4 it's AI)
Yeah most likely
diag_captureFrame or whatever it's called
ok
trying to update existing copy of Dev via Game updater isn't making any progress :/
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
I will take a look. Never used hashmaps before lol
Does anyone know if there's an EH for footsteps or some other way to detect if a footstep happened?
nope
there is https://community.bistudio.com/wiki/allMissionObjects "#mark"
you could perhaps couple it with a " EntityCreated" Mission EH
allObjects is better
It's mildly annoying that soundPlayed EH doesn't detect footstep sounds
also you can use animStateChanged EH
then allObjects 4?
allObjects is binary...
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
stop sweating
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
What if you copy it and you realize nothing works?! ๐
you will most likely sacrifice performance and/or readability
These seem to get me a bit closer but I need to be able to tell what object was the source of that footstep.
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
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
it wasn't hard, i just copy-pasted all keywords from the doc page to here:
(this is notepad++)
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
already handled
you can always use a special null that never usually appears, like teamMemberNull
wait does that mean if i do
_A = _obj getVariable "A"; _A = 10; _B = _obj getVariable "A"; //_B is 10?
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
teamMemberNull was introduced in A2 so they can't use it, because they want this to work in OFP as well ๐ถ
That's not the whole version, the last number is 6 digits, 15 are only the first two digits.
What are the remaining ones
just tested, it was a copy, not a reference.
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
this setVariable ["TEST", 20];
private "_t";
_t = this getVariable "TEST";
_t = 40;
hint str (this getVariable "TEST"); //hint showed '20'```
This can just be
#define CALL(obj, funcName) [obj, funcName] call (obj getVariable [funcName, {}})
Trying to create a modern mod for a modern game, using a two decade old version of its scripting language from back when it was just in its infancy, is frankly.. a stupid idea
I fail to see how a mod that refuses to take advantage of any of the features added in the last 20 years, would be considered "good"
no
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
"TEST" variable is a reference to the 20 value
_t is also a reference to that same value, it now has two references to it.
_t now references a different value, the 40, now 40 has one reference to it, and 20 has one reference to it
Every value is passed by reference, but there are only few ways to actually edit values
like set/append/pushBack
can i (*_t) = 40
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"
that'll only matter in performance-critical parts as far as affecting game experience goes
surely i can't foresee much ahead and how many parts will be "performance critical" lol
sqf is a very slow language
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
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.
interpolation of setvectordirandup is still impossible in a3 ๐
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 
And.. good luck with remoteExec!
setobjectscale changing the size of the tracers the object fires is very funny too
Is it possible to change the AI unit's sensitivity cfg value with a script command?
setSkill is all you have
https://community.bistudio.com/wiki/setSkill
and no, sensitivity is not part of it (but spotTime, spotDistance perhaps)
Thanks, I have tried setSkill and sub skills already, but I did not find it suitable for my scenario.
Why does BIKI state it as arguments spawn code? Code can be also other code than a compiled function, or am I totally wrong here?
Code is a compiled function
_func = {}; 0 spawn _func;
Ded_fnc_func = {}; 0 spawn Ded_fnc_func;
0 spawn {};
is all the same
What about sqf spawn { hint "Yay!"; hint "Yay is no more"; } ? Shouldn't it work?
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
Does all code wrapped in {} get compiled at mission start?
It gets compiled when the file it's in gets compiled
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
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
...I see, you learn something new every day. I guess it would be still beneficial (even if only slightly) to compile the code beforehand to avoid the overhead during first access?
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
Yeah, this is what I meant
But as compiling generally only happens once (unless you use execVM and recompile your code on every execution...) it wouldn't matter much
Yes
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
I'm slightly less dumb now ๐
Some people use execVM instead of functions ๐
In this case it will be compiled everytime, or ?
Was once yes.
But even if you pass a function into it, it would be the same.
You'd specifically need to do {call G_Function} so it only recompiles that small thing, if you pass a function G_Function to it, it would still recompile.
Because as I said, how the code is stored doesn't make a difference.
Many mission developers specifically.
Yes
We should start "Remove execVM" movement
Was it fixed then?
If so you can close your ticket :P https://feedback.bistudio.com/T123355
oh speaking of that, i tried setting courage skil really high but i dont think it helped, i basically wanted units (especially those that are yet unarmed) to not care about safety and just run towards their destination (where they would receive weapons)
๐ข I like my ticket
set their behaviour to careless and force their speed mode to full?
they still froze in shock if there was shooting happening nearby iirc
and I like to know when bugs are fixed. It seems we have ourselves an impasse ๐ค
i need at least one execVM, to initialize the god object
Why do you need specifically execVM for that?
execVM {{_x attachTo player} forEach allmissionobjects}
cause it runs an sqf file and does so in scheduled env
it's the one script that goes to the scheduled env and starts the "main" loop in it, where everything else happens
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
i like graphics in OFP
that's like, playing morrowind
i dont expect many ppl to get that lol
and how many Morrowind mods also work in Skyrim AE with the same files?
i haven't tried to pull off something like this in those games
Instead of setting intensity, I can do the Attenuation?
a "legacy" warning Maybe?
ExecVM should only be used if code or functions needs to be recompiled, otherwise avoid it and properly declare your functions using CfgFunctions and then use Spawn to execute the function in scheduled environment.
๐
well, call is unscheduled too if started from unscheduled ๐
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.
OH lol, its been a while since i been to that page I didnt even notice that was there, nvm the suggestion then
Honestly it should be a depreciated warning like c++
I might make a feedback track for that....
wow diag_captureSlowFrame is cryptic ๐
Would be pretty much useless.
Tons of old stuff would just spam that, even though it will never get updated/fixed.
But maybe only in -debug mode
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
Whole number is 2.12.150779. Do you know when it might reach profiling?
^sorry this is wrong, one second
Profiling version is 2.12.150806
lol @ at the idea of defining "bad practice" in SQF
The explosion happens all over the server and the player who did it does not appear in the log
Can anyone help
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
thats.. for very simple scenarios
If you're doing complex things id reccomend moving your code out of the initbox of the synced object
okay im leaving out too many important details lolg
i actually probably need to draw a scheme to explain
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)}]
what is "this"? an object on the map?
uh, you mean that by "this" the whole map is referred to?
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
This
That object
The whiteboard with the map of altis displayed on it, if you will ๐
and the action appears for you regardless of where you are?
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
I've tried what it says but I can't comprehend it, i'm shite at scripting
This is the format for it
'''
object addAction [title, script, arguments, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection, memoryPoint]
'''
so I just gotta do this addAction ["Go to Camp Davis", {player setPos (getPos TeleportMarker_Davis),2}]
No, you're putting the radius inside the script
You need to fill it, hold on ill show you
Thanks ๐
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
nil,1.5,true,true,"","true"
What are these ?
Thanks for taking the time to explain the basic shit ๐
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
Using this format
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 ?
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"
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 ?
No I dont believe that will work, needs to have the object addAction bit at the start
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 ?
Yup, make sure to include a ; after the final square bracket. Also the name likely needs to be unique
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 ?
Yes
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
Hm, unsure about that, have never had to do that before
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
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
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
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
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";
};```
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 ๐
i dont know where to put this? in the init section of the game master module?
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
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
So, basically there's more variables now that i've added the create vehicle thing
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.
Remember this format? This time you've already filled all the way up to arguements, which is one more than last time. Now just insert the defaults until you get to the radius
separating the code into a variable could help make it less confusing
put it into _spawnCode or something
Oooo that's why it didn't work when I c/p what you added last time
Wdym ?
the code itself that you pass into the addAction
bet it looks very confusing rn
the "script" parameter
do you already have a perFrameHandler setup akin to CBA's perFrameHandler?
you said you wanted it the same frame. you can have it exit the frame handler after its done
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
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
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
have you attempted to reach out to some of the devs that have access to the backend code to find your work arounds?
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
look through the bohemia role tags and look for ones that have programmer tag and shoot them a dm. maybe they will respond.
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?
--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.
its fine if its every time. its meant for that. just have it exit early if its not the weapon you want.
Right, but is there any way to make it so that the "fired" EH is added to a player unit only when they have this particular weapon equipped? That would prevent EH firing whenever someone fires with a different gun.
oh i see what you mean. yes it just depends where you want to add it.
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.
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).
has anyone here managed to interpolate setvectordirandup/addtorque smoothly across the network before? if so, how? kinda stuck how to do it ๐
even the game itself doesn't do it well lol
it doesnt do it at all
setvectordirandup/addtorque has no engine interpolation as theres no angular velocity
hence my messages in #arma3_feedback_tracker ๐
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
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
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
its for just a regular physx object
svt should interpolate the vector dir & up if you give it sensible values.
i do and it does not do so
at least not on an interval of 1 used eachframe but it does on the velocity
You mean it jumps from start to end, or just shaky?
stuttering like the velocity issue i was having
oh, that's probably as much as Arma can manage.
no angular velocity interpolation stuff so ๐คท
Unless you create the thing locally and simulate it everywhere.
i bet physics are done in a fixed-rate update loop, while your code runs in a frame dependent update loop
I feel like it might have been faster to learn modelling and make a real submarine :P
its for vehicles outside of armas 50m requirement
oh, is that a hard rule
like the aircraft carrier and crap, just attach it to this and problem solved
for collisions yes iirc
this doesnt give collisions but it allows me to have ships with walkable interiors etc
(can even have bigger on the inside interiors ๐ฟ)
theres this multiplayer game called angels fall first where you can walk inside big spaceships as they are piloted by other players
yeah, you can do that in star citizen too etc iirc
and it was also possible in galactic conquest mod for battlefield 1942 (the old one)
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
afaik to make AI drivers avoid obstacles
you misunderstand
what objects do people use
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
Nah, the physics engine is lock step with the frame rate. You forget that this is a 20+ year old engine
i mean to me it looks like A3 has more physics than OFP though
Arma 3 has about 3 physics engine it
And its definitely lock step. Else you would have a lot more graphics bugs
Could use a combo of nearestTerrainObjects, and createMarker/setMarkerType/setMarkerColor
Rotor lib, Physx, and the non Physx physics library that I think was developed in house
stuttering was fine once i added velocity as well as setposasl, there's just no angular velocity currently implemented ๐คท
how precisely would such a command work ?
sorry i know i dont know much about this yet
@jade turret Which objects are you trying to place it on?
Anyone know how to limit roles that have Zeus to certain steam ids
i want to display a marer on the map on the same positions as for example the chapel
marker
You put the steam ID in the owner box. This is more a mission maker question tho
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 ...
how are the objects placed? Are they apart of the map like the chapels, or are they put down in the 3den editor?
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
that church is placed there as a part of the map, not the 3den editor
yes
i did this thing in A1
the church is the red marker is not
to find out class names of buildings
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
all the places i want to mark are part of the map YES
If they are listed on this wiki, then you can use this command https://community.bistudio.com/wiki/nearestTerrainObjects
just iterate over nearObjects then
i know where to find classnames
or like 10x said, if you want to use classnames, do nearobjects
just put typeOf cursorObject into one of the debug console watchfields and aim on the building
that will show you the classname
they want to mark the buildings on the map
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
createMarker
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
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?
should use [worldSize / 2, worldSize / 2] for position, and worldSize * sqrt 2 / 2 for radius
nice
{
{
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"
];
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.
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];
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";
};```
Where are you running that?
init.sqf
and where are you setting shouldExecuteSpray = 1?
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
Do you know how to use diag_log?
i do not
You should learn. The most basic form of debugging is printf debugging.
Find your RPT. Put a diag_log format ["shouldExecuteSpray = %1", shouldExecuteSpray]; before and after the waitUntil. See whether either of them trigger.
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
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
works fine for buildings but not all objects f.e trees rocks, etc
i have this beautiful thing:
Because it's using nearObjects, for terrain objects like trees, rocks you need to use https://community.bistudio.com/wiki/nearestTerrainObjects
Not sure why you would want to mark rocks or trees tho 
mapping what tree speciec grow where
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 ?
ok
so i only need to change this when marking other structures "Land_Chapel_Small_V1_F"
yeah that there is the array of classes you want marked
you can add more items to it
probably because they are part of the terrain
https://community.bistudio.com/wiki/nearObjects
BI Wiki is your friend
just replace nearObjects with nearestTerrainObjects and change the class name to "TREE"
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
configFile >> "CfgVehicles" >> (typeOf _obj) >> etc
but doesnt that require the exact path?
is that mean for me ?
no
good
also, typeof is for an object, I just have a classname
just how "exact"? a lot of things are in cfgVehicles
then you already have it
Bi wiki is sometimes a bit difficult to understand ...
instead of typeof you put the classname
ya, that didnt work
what is the classname for
so, the question is, which cfg the uniforms are in
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 ?
theyre in vehicles, i think I was using the wrong class, let me double check
ya I didnt realize the uniform command gave the cfgWeapons class and not the vehicles one, thanks!
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;
};
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.
_vehicle setVariable ["APSadded", "", true];
I'd recommend using a bool as the value, makes it a bit simpler to check on it
_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
whats a bool
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...?
stole it of a forum, fixed a bunch of shit added the ablity to respuply. added range
idk
added limited charges
I hope you left the author credit in
deleted acount
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.
A bool is a Boolean value, that is, a value which is either True or False
now the resupply is broken lol
This change didn't touch anything about the resupply (assuming it was implemented as described), so ...
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?
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
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
how come sometimes the performance test in debug only runs 1 iteration?
why is is false here
- the code is too slow
- you're in MP
shouldnt it be true?
- the code has errors
#2 will do it, thanks
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)
when i use your way it goes on forever
What does "goes on forever" mean
aps added to tank a buch of times
Are you correctly setting the variable to true when adding it? If you set it to "" the check will not work properly.
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
Yeah you do need to actually run the code
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
Yes, that's the code I meant
Expansion: you could also set false, assume true, and remove the ! from the check, but I find it tidier to have true be "yes, added"
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
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
please move this code to https://sqfbin.com/ thank you
What Lou said is we do not like to have โtextwallโ but just a (trustable) link
And... what fix? What issue?
"chatgpt code no worky" issue
I understand, Evertime I run this script it constantly says missing ";"
and constant errors
โI do have errorsโ is not a troubleshoot or proper way to tell what's wrong
who wrote that
I used chatgpt to build a script
Okay just check the pinned to troubleshoot
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.
'...his;
[_animalInfo select 0, _animalInfo |#|select 1] call _spawnAnimalHerd;
};
{
p...'
Error Zero divisor
File... line 33
this is the error I get
best i've seen without a fsm is just disabling their collision or fucking around with making them semi local but has weird consequences
what command would u use to diable collision
Once again, check the pinned.
oh and
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
I do not
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.
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
Isn't it obvious? The topmost pinned post
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
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
We're just telling you NOT to use ChatGPT or any other AIs to make Arma compatible scripts
refer to this if you're new and want to learn it takes time and effort but that is how most people who code get started
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.
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
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
ill go ask for another persons help then.
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
https://community.bistudio.com/wiki/compatibleMagazines without knowing what weapon someone is using how would one make sure that the compatible magazines only get the main weapon's muzzle (as in the one that fires bullets in the case of a weapon with an ugl)
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.
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
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.
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
staticWeapon; setCaptive true;
What's that?
What the hell is (_staticWeapon == typeof "") supposed to do
as i said ignore the condition
jesus im blind
is this code too advanced for me and is using some tricks i dont know yet
well it has errors so 
which part do you think is advanced?
anyway it's very basic
i was being sarcastic
I figured you were talking about the event handlers... 
nah, i already have my own EH system
with ways to subscribe and unsubscribe from events
this is the whole of it lolge
Event handlers are in OFP, you don't have to make your own
this is for "custom" events that only exist for my types of objects
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-
isnt vectorDir and Up engine level solution for that function?
I don't understand that either. I do understand that if I give setPitchBank 180, it will make it be upside down x3
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.
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.
the comment on the function mentions something regarding attachTo
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-
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?
not a direct one, but you may be able to deduce it using init.sqf, isMultiplayer etc
meme
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.
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.
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
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
There isn't a way to replace road textures right? xD
I doubt it.
bingo - nope
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
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.
well you can use the virtual CAS module
I tried it out but when the plane drop the bomb it goes 200 M ahead
which plane do you use?
All planes like vanilla Or A-10 for exemple
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?
Yes i use ACE do i need a compatibility patch ?
not sure. try without it if you can. see if it solves the problem
Ok thx i will try out
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 ?
yes. iirc it's under Attributes->General
ah yeah but i meant if it was possible to change the default value in the code so i don't need to do that everytime and i can customize that. It's what i meant sorry ๐
I think it's a config thing 
yeah i wasn't sure about that so i will post that in the config channel then thank you ๐
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
is this gonna work:
_obj setVariable ["someCode", #include "someCode.sqf"];
[
"someCode",
#include "someCode.sqf"
];``` ?
did you find something ?
nope
yeah
oh ok thank you
waait what if the included file here brings a bunch more pp stuff like defines
that's like a cthulhu merge
Are CfgFunctions stored as a missionNamespace variable like ^?
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/
what about it?
defines just get removed
every PP line is removed
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
if you know how a comment works, it's the same with PP
i dont assume i know how anything at all works
cause it was wrong too many times lol
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
thank
if you use my mod:
https://steamcommunity.com/sharedfiles/filedetails/?id=2369477168
and press Ctrl+Shift+C in its editor, it copies the preprocessed string to your clipboard, you can paste it to some temp file to see what's happened to your file
tho the preprocessor is hand-written so it might be different in some case from SQF's
i suspect it's not Kozlowski-compatible
what is Kozlowski?
well it's for Arma 3 so no
The joys of backwards compatibility
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
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?
Did you check if the file was open in another process/program
the namespaces should be available during preStart
like #include? oh heck no, they are done properly.
ProfileNamespace could possibly not be available at preStart, but don't know if it is.
Is quite easy to test though
@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.
Billboard1 setObjectTextureGlobal [0, "D:\SteamLibrary\steamapps\common\Arma 3\Media\CHERNA.png"];
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
Supported formats: .pac, .paa, .jpg, .jpeg, .ogg, .ogv
And where are you calling the current code?
wdym where am I calling?
You are using global command, so just thought if you are using that from the unit init
I am I guess
png is not supported
and you must put the picture in your mission folder
Oh ok
and then use getMissionPath "cherna.format"
(format is the new format that you use)
getMissionPath is probably not needed tho
Yeah sorry I was just confused getting into this stuff is a mind bog
Thank you guys
do i need to put it in the certain mission file or just the missions file
whichever mission you're editing
what's a work around to prevent a disabled simulation player from firing the round in the chamber?
overriding the fire action
It still didnt work
did you convert your image to some other format?
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
Does anyone know if its possible to know when a player stops ragdolling?
Thats actually a really good idea, thanks for that
Anybody know if there is a script or way to make ai use bipods??
there is no way
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?
inb4 trying to run scheduled code directly in Debug Console
wrap it in [] spawn { code_here }; to use from console/handlers/init 
Why'd you use execVM when they said to use spawn.....?
Use createVehicleCrew to create a crew for the vehicle.
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
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.
I'd recommend defining your function via CfgFunctions (https://community.bistudio.com/wiki/Arma_3:_Functions_Library) to make sure all machines have it.
Also, did you use exactly that code? Because it's lacking the _ before truck variable (i.e. you're using global variable instead of a local one), while _truck in the addAction is a local variable instead. It might not be defined like NikkoJT wrote
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
yes, initServer was it. thanks heaps!! I didn't realise CfgFunctions worked on mission level, might have to look into that. though I am running with trusted clients
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.
good to know, I'll look into it. thanks
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
I expect params to return false here yes
yes, that's the point of params
I thought it gave "false" but didn't give an error? Unless I have extra errors shown or something-?
don't set the expected data type array then
Like, params to be used to silently correct it.
The specific purpose of the "expected data type" argument is to alert you if a wrong data type is passed
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.
Well, while I got yall, any ideas for this? ;P
leaves the chat
nuuu
isNil { _arr select _i }?
oh-
maybe even _arr findIf { isNil "_x" } could work, idk
I thought it accepted a string xD
ohhh alt syntax
And is that a good way, or should I do it differently? To check if it should mess with that axis
what
script will mess with given object's position. Given [0,nil,0] it will set X and Z to 0, but leave Y unchanged.
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
How would it know it's not 0 for X and Y but not Z?
your code, your design, your decision
are there cases where you will change only X or Y but not Z?
Yea, maybe. In those cases, I could do [0,0] instead of [0,0,nil]
"what should your code do" is a question you should ask yourself
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.
that being said, if the mode was 1 and given -1, then would it want to move it be -1, or ignore the axis? :P
that's what I told you, unlikely for the value to be -1
if you have "coords modes" then use one for set or set2D and be done with it
oh you mean like, no change for -1 to be used. Not negative numbers, but just -1?
yep
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
it is how it is
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
Because many script command themselves have a list of allowed types
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
i mean not the usefullness of type but type safety being limited to just 4 types in OFP, why wouldn't "String" work there
I assume what wasn't needed, wasn't implemented
so it means i have to macro my way around this limitation to set string/code variables as "Object" i guess
would that work
wha
oh, object is an actual game object, not a general type lol
why not try to emulate remoteExec in OFP too
also setVariable was introduced in Armed Assault ๐
(OFP:E perhaps)
unsure. because it shows the available types for OFP on that screenshot
it's kinda self-contradicting