#arma3_scripting
1 messages ยท Page 263 of 1
How is asking every five seconds if the mission is finished better than using some kind of custom event handler?
That was how I&A did it.
I had no real say.
My assumption was eh if it isn't broke don't fix it.
Obviously that was incorrect.
We'll thats how I&A has always done it check every so often if finished
I clearly made a bad choice in how long the time out was or
I had changed the timeout to test for something breaking
One of the things that actually created the vehicles was this.
_randomPos = [[[getMarkerPos currentAO, (PARAMS_AOSize)],[]],["water"]] call BIS_fnc_randomPos;
_patrolGroup = [_randomPos, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> [INF_TYPE] call BIS_fnc_selectRandom)] call BIS_fnc_spawnGroup;
[_patrolGroup, getMarkerPos currentAO, 400] call BIS_fnc_taskPatrol;
_enemiesArray = _enemiesArray + [_patrolGroup];
{
_x addCuratorEditableObjects [units _patrolGroup, false];
} foreach adminCurators;
A lot of I&A uses builtin BI function code
such as randomPos or taskPatrol
Hello... can anyone tell me if scripting alone allows the interaction with the virtual reality hardware?
No.
@tough abyss
@tough abyss would you have any idea how this is done then? https://www.youtube.com/watch?v=I1UzLh-WVVw
All this code was mostly from the original I&A
I just partitioned the data into different files
@tough abyss was that to me?
No @little eagle
ah, sorry... do you have an answer to my question or do you not know?
But yes I know my code is of bad design
I was avoiding re-writing it largely because I felt I couldn't do it better @little eagle
@little eagle Is there a difference in performance
with not vs !
vs?
is the key word if not(_condition) then {false}; faster or slower than the character if(!_condition) then {false};
Or are they identical?
there will be a negligible difference I imagine
I think it's exactly the same
there actually is a difference between
getPos _unit
and
position _unit
because position can be used with LOCATION type, so there are additional type checks in C++ land
But not and ! only invert booleans
yeah, no. the functions are precompiled and the result is identical
What functions?
or execVM pseudo threads
Although it probably is still different in memory since these functions seem to be strings with a special byte
And you can tell the difference between not and ! there
I'd say use ! and otherwise, at least be consistent
Long ago I came across this @little eagle http://www.ofpec.com/tutorials/index.php?action=show&mode=new&id=287
Explains in detail the different ways to run scripts
how much of ArmA scripting overlap with 'real world' programming like C and stuffy stuff?
@tough abyss Apparently I need to mention someone to get responses, at least in the other channels, so please help ๐
No, you need to be patient and wait for a response. Mention spamming to get responses is very poor form.
@finite silo There is elements that C contains SQF contains (Status Quo Function) which is ArmA 3's formal language name.
@open vigil Oh I see, sorry.
@tough abyss I see. So SQF would be pretty narrow then?
Includes are similar to C
SQF also has a PreProcessor similar to C
and #define MacroFunc(INPUTS)
Hmm ok. So, if I'm like awesome at SQF, how much work would it take me to be awesome at C as well?
like hypothetically
C is very low level
You operate on bytes sometimes bits
you also have the ability to define user data-types
using struct { }
You also won't like C in regards to not liking unhomogenous datatypes
E.g you can do this in A3 _array = [1,"",3,[]];
You cannot do that.
in C
I SEE. Thanks bro
functions also require datatype declaration
And last but not least
You must allocate memory manually
Unlike C++ that does a lot of that automatically
So SQF vs C
They're not even remotely the same, that just share syntax. Not construction.
@finite silo
SQF is a dirty mixture of PHP,C,Java,JavaScript
Thats the only real was to describe it.
scripting vs programming. On one hand you have a relatively small set of commands we use and abuse to do sometimes impressive things. On the other hand you have a massive and comprehensive language that arguably the majority of modern computing is built on.
^
Aka the GNU standard library
You can effectively given the comprehension do anything in a programming language.
Python is considered a scripting language I am not sure why as it has as many functionality components as any more lower level language
Compiled vs Run Time?
Can be
I don't think the difference is all that distinct in python's case any more. Way back when it was younger though
Ah same with Ruby I take it?
Python is "compiled" into .pyc files. It's not the same as compiling C code. It compiles down to Python bytecode that the interpreter can run, not an actual executable.
@paper rain I know Java does the same
switch (_caller) do
{
case teamLeader:
case medic1:
{
hint "Teamleader or medic";
};
};
Will using switch this way do the code if _caller is teamleader or medic?
figured it out
Had to use ; after teamLeader instead
What ew? ๐
No fan of switch?
Switches can be good for code overview. As long as you have more than two conditions
But in ArmA switches are slower than multiple if statements, is that still so?
Are they really slower?
I tested the speed of switch vs if statements a while ago but I forgot the results
If they are, the difference is negligible for 97% of all scripts
Naturally, but a ladder of if's does more local lookups which can be expensive.
I think the difference in speed may be that switch evaluates all conditions perhaps...not sure though
It doesn't evaluate all conditions.
Check the last bit of https://foxhound.international/arma-3-sqf-grammar.html, switch bodies are just regular code that's executed in sequence.
When it matches it does something similar to breakOut
Someone should check the difference between speeds. Someone with a PC :p
Unless the difference is huge it would be context dependant anyhow.
Agree @thin pine
Tbh. I find if conditions unreliable at times. Sometimes they work, sometimes they don't (depends on what you are coding).
Plus it makes the code cleaner with a switch condition.
@thin pine same ๐
When don't IF conditions work? If your code isn't faulty that is.
@tribal crane switch in Arma DOES evaluate all conditions
a = 0;
add = { a = a + 1; a };
switch (2) do
{
case call add: { };
case call add: { };
case call add: { };
case call add: { };
case call add: { };
case call add: { };
case call add: { };
}
Is "a" 2, or 7?
(After that executes)
It shouldn't be.
If you have a lot of scopes and locals it should do a lot less namespace searching.
call {
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
};
0.0082 ms
switch (true) do {
case (random 0.5 < 1): {};
case (random 0.5 < 1): {};
case (random 0.5 < 1): {};
case (random 0.5 < 1): {};
case (random 0.5 < 1): {};
};
0.0141 ms
What if you replace the cases with the if's?
?
switch (true) do {
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
if (random 0.5 < 1) exitWith {};
};
How many times is it testing it?
Replacing it with true would work as well, SQF isn't that smart.
omg
random 0.5 < 1 is flawed
retesting...
switch {
case (random 1 < 0.5): {};
case (random 1 < 0.5): {};
case (random 1 < 0.5): {};
case (random 1 < 0.5): {};
case (random 1 < 0.5): {};
};
0.0017 ms
call {
if (random 1 < 0.5) exitWith {};
if (random 1 < 0.5) exitWith {};
if (random 1 < 0.5) exitWith {};
if (random 1 < 0.5) exitWith {};
if (random 1 < 0.5) exitWith {};
};
0.0117 ms
there we go. switch is better
Only when you don't use the "do" operator. ๐
0.0164 ms for the hybrid thing
derp
0.0161 ms
yeah. call, exitWith still faster
It's a shame, really
private _a = random 5;
switch (true) do {
case (_a < 1): {};
case (_a < 2): {};
case (_a < 3): {};
case (_a < 4): {};
case (_a < 5): {};
};
0.0237 ms
private _a = random 5;
call {
if (_a < 1) exitWith {};
if (_a < 2) exitWith {};
if (_a < 3) exitWith {};
if (_a < 4) exitWith {};
if (_a < 5) exitWith {};
};
0.0147 ms
Without referencing _a every time
how would that work?
private _a = random 5;
private _a = floor random 5;
switch (true) do {
case 0: {};
case 1: {};
case 2: {};
case 3: {};
case 4: {};
};
private _a = floor random 5;
switch (_a) do {
case (1): {};
case (2): {};
case (3): {};
case (4): {};
case (5): {};
};
0.0176 ms
private _a = floor random 5;
call {
if (_a isEqualTo 1) exitWith {};
if (_a isEqualTo 2) exitWith {};
if (_a isEqualTo 3) exitWith {};
if (_a isEqualTo 4) exitWith {};
if (_a isEqualTo 5) exitWith {};
};
0.0141 ms
@little eagle try it with fixed numbers
and not random
so you can see if the performance differnce come from the random or from the swich/if
5 for call exitWith: 0.0174 ms
5 for switch 0.0174 ms
1 for if exitWith 0.0081 ms
1 for switch 0.0145 ms
best case faster worse case Equal
So it seems to overtake eventually for switch, but only if you after about 5 failed tries when loading the variable
Yeah. Most of my switch seem to be switch (true) though
And those seem to be always worse
if you already use integers you might as well use ARRAY select
this are still the same results i had a year ago
yeah as i started working on ace i did this test and i had the same results
private _a = random 5;
call ([
{},
{},
{},
{},
{}
] select _a);
0.0038 ms
rate xD
0.0043 ms with floor
private _a = sideLogic;
call ([
{},
{},
{},
{},
{}
] select ([west, east, resistance, civilian, sideLogic] find _a));
0.0064 ms
๐
so basically just use switch do case ๐
if you want to be able to read your code , sure. If you need every ms, then....
true, but control structures appear everywhere
Yeah, but in actual code a switch may be quicker.
how so?
One of the more expensive things in SQF is searching for locals. In your benchmarks the local hashes only ever have 1-2 entries.
And they are only 1 or 2 scopes deep.
When you did a normal switch/if where you used a local variable the timings got very close to each other.
have you seen my last example? it searches _a exactly as often as switch would do. once
0.014 vs 0.017
Yeah, short of doing that though any difference between switch/if for artificial benchmarks may disappear in real scripts with larger scopes (even for small numbers of items).
so should we add a private [...] full of throwaway variables to the benchmark?
Or use globals instead?
Yeah, you'd need to nest calls and fill the private namespaces.
Globals are generally faster than locals but don't say that out loud in case someone decides that means everything should be a global.
Would thought it be the otherway around to be honest
Didn't Nou do a bunch of testing at some point?
vars = [];
for "_i" from 0 to 1000 do {
vars pushBack format ["_%1", _i];
};
It depends on how deep your scope stack is though so you can't just have one-liner benchmarks to test it.
private vars;
private _a = floor random 5;
call {
if (_a isEqualTo 1) exitWith {};
if (_a isEqualTo 2) exitWith {};
if (_a isEqualTo 3) exitWith {};
if (_a isEqualTo 4) exitWith {};
if (_a isEqualTo 5) exitWith {};
};
takes forever, but it might be due to the private command at the start
yeah. it's the private vars; part. Sadly no way to test then I think
the benchmark command from KK does not carry over local variables either
diag_codePerformance
Guess it makes sense
Engine is prob losing time walking the scopes checking for the variable name. Compared to checking a single scope in global namespace
Yeah. If the hashes are done right checking a single hash will be mostly converting the value to the hash key; walking the scopes does that repeatedly for each scope.
I still don't see how this can make switch faster than the call-select-find thing
It won't, but if we're no longer comparing if to switch then something written in Intercept C++ will kill your find code.
Sure, but it's something than can be done today
You can't write a .dll today? ๐
I don't think Intercept will be ready to use today ๐
"ianbanks takes on challenge" pleeeaaaseeee โค
๐
(fixing up Intercept that is)
What's wrong with it?
To quote @grizzled cliff: By the way, last time I tried to boot with Intercept it was crashing on my test missions right off the bat, so there is probably some stuff that changed in Apex regarding the SQF interfaces.
Yeah, hence my previous warnings against using it (as cool as it is).
Only way to fix it is to break out IDA and blow many hours/days.
I thought that finding the addresses for the functions was dynamic-ish?
or whatever it's called ^^
Which means it works after changes to unrelated parts of the application; changes to related parts will still break it though.
hmm my C++/very low level system stuff isn't at the level to fully understand what's going on with Intercept
๐ฆ
To work it needs to know (probably) hundreds of details about A3 internals, each one that would take a substantial amount of time to determine, and many of which may change with each minor release.
hmm back when I tried to go through Intercept I didn't find any statically defined stuff like addresses and such
IIRC Intercept was searching pointers to functions starting from the address at end of the output buffer of RVExtension().
That's just the entry point.
To do anything it has to mirror/emulate a large number of A3 memory structures.
If you want to create an A3 string for example you need to know both the vtable and data layout of A3 strings.
(Or assume you know enough about the semantics of A3 strings to just manipulate the data directly, but that's even worse than assuming vtables don't change)
uintptr_t unary_hash = state_addr_ + 16;
uintptr_t binary_hash = state_addr_ + 28;
uintptr_t nulars_hash = state_addr_ + 40;
The very next thing it does is assume those offsets.
mhm seems like loader::do_function_walk does all the pointer magic
There's assumptions about A3 layouts everywhere; much of it is in struct definitions too.
BI should just absorb it and make it official ๐
Hopefully they've done enfusion well enough that it's not necessary.
any ideas why i can't get agents to move anywhere?
this from the wiki does nothing
{agent _x moveTo position player} forEach agents;
tried doMove as well
What is the agent ? custom animal or normal ai
normal ai i think
i just dropped in a random vanilla a3 unit as the player and created a typeOf player agent
@halcyon crypt _x moveTo will throw an error, agent _x moveTo does not
mhm that's why I said "nvm", didn't think before spewing misinformation ๐
@rancid ruin did you disable the animal behaviour script by setting BIS_fnc_animalBehaviour_disable to true?
That used to be a thing you had to do to get agents to do what you want...not sure if that's still needed
greetings why is this not working its suppose to disable fall damage since am using an exoskeleton mod
nolandDamage = {_damage = 0;
if((_this select 4) != "") then{_damage = _this select 2;
};_damage};
{ _x addEventHandler ["HandleDamage", { _this call nolandDamage }];
} foreach (units (group player));
so what? only the last return value is used. if you have multiple handleDamage returning stuff, only one get's used
I've used add before and had multiple keypress handlers. I'd have to experiment with damage handling. But I know multiple is possible.
nope. only the last return value of handleDamage is used
also, there is no setEventHandler for this
right, I'm confusing it with displayeventhandler
yes
re-whitespacing the function for my own sake:
nolandDamage = {
_damage = 0;
if ((_this select 4) != "") then {
_damage = _this select 2;
};
_damage
};
{
_x addEventHandler ["HandleDamage", { _this call nolandDamage }];
} foreach (units (group player));```
Do you know the handler is firing? Did you test it with something like:
_x addeventhandler ["HandleDamage",{ systemChat format ["T=%1 : %2", time, _this]; } ];
@little eagle Thanks for the help yesterday. Got a followup question though. To run remoteExec I had to preprocess my script. If I wan't to remoteExec something simple like playMusic <song> would this in init.sqf work
playSong1 = {playMusic <song>};
Instead of using playMusic <song> in a file and then this in init.sqf
playSong1 = compile preprocessFileLineNumbers "filename";
I am using remoteExec from debug menu in MP btw
yes it would. it's not about preprocessing the file. It's just that the function has to be saved in a mission namespace variable
if all you're doing is a single command
like playMusic
then you can also use:
_song remoteExec ["playMusic"];
single commands are supported too
no need to make a function for that
although it can help appending the code with debug stuff etc.
Like I don't need to add anything in init.sqf?
no function is needed for remotely executing single commands
So this in debug menu would be enough?
"song_name" remoteExec ["playMusic"];
@ionic aurora Is that the exoskeleton mod from the steam workshop?
Hey @little eagle Do both functions and commands inside those functions
require whitelisting to use them?
I think they are all white listed by default, but any mission can wreck it if they disable them
@tough abyss yeah thats from the steam workshop
bare in mind this the script i was supplied with from the bi forums , so i barely understaing it my self ๐
you won't be able to get it working if you don't understand it
As I said that mod is getting taken down
mod getting taken down how come ?
You cannot steal models from other games
@A3L Life
If you wanted to make an exoskeleton mod yourself by all means do it.
Me I'd love to do it.
I have no idea how to approach it though.
well i am an artist aftera ll but the coding is washy at best
same here
there is no tutorial i have found so far for making a mod
The exosuit I'd implement would be the HULC
a full fledged mod
HULC reduces fatigue
i know how to script and pu the add action not howto assign buttons to scripts and such ๐ฆ
Exoskeleton discussion moved to #offtopic_arma
I can't see anything about an exoskeleton?
Now there is
does anyone know how to get old mission files into new editor ??
Load old mission in new editor and let it convert
See what I said @tough abyss in #arma3_scenario
@split coral if you have 3 IF and ELSE commands, your code would execute 3 of the ELSE conditions. Rule of thumb is that if you only want 1 ELSE condition to run (but have several IF conditions executed), then SWITCH or EXITWITH Is best suited for that scenario.
I had issues using the IF and ELSE conditions for that particular reason, when creating DSS. So that's why imo SWITCH is best for that particular scenario.
I could've used EXITWITH, but I wanted the code to continue after the condition.
Another thing. If the first IF condition returns as FALSE, the other IF conditions won't run because it has been ended with EXITWITH.
Actually, this hass been tested earlier the if/exitwith is actually faster then a switch. https://community.bistudio.com/wiki/Code_Optimisation#If_Else_If_Else_If_Else_...
Switch is not implemented the best according to KillzoneKid's blog.
It's not that much faster, so don't let this get in the way of better looking code of a switch just looks nicer.
Not rare, but a lot seem to get bored and move on after a while. What is rare are the older scripters with deep understanding of how arma works and how to get it to do what they want.
Well i've been re-writing I&A
Been more focused on learning software development
as I could quickly translate that directly to SQF
E.g I've already got plans to replace the AO initialisation with an event handler triggered system
using the radiotower as the event
I know scripters that understand sqf, have an idea how to do things. Can write something to get the job done. Then I know people that could write the same thing, quicker, cleaner, and more efficient because they have a better understanding of how different aspects effect others, what works better in different situations.
radiotower is created after a eventhandler gets registered to the tower object it initialises all the vehicles etc.
All I had to do was register the EVH in the global space once it had a value > 1
calls the code to start all the AI units
Biggest problem @tough abyss was I&A's biggest flaw was you used BI functions
I mean functionality wise this is fine.
But it had a pretty expensive cost when it came to spawning the AO units
Not sure why.
Yeah that was a big problem I noticed.
Some functions I tried to implement to make AI more dynamic like using selectBestPositions
It was expensive but made Viper-teams spawn in tree covered areas
I probably should have pre-computed the next AO while the current one was running
And stored all the "candidate" positions in an array
then looped through them when the new mission was ready
It's a known optimisation if you can pre-compute data ahead of time for the next task.
And that applies to programming in general.
Not sure that would work
It could..
Depends on how long it takes for arma 3 to search the array if it would be faster.
@tough abyss well understanding and studying BIs code such as the Main Menu or Editor, qualifies. :P
I can create SP mods and scripts. But MP Is where I struggle at. >.<
MP is just a bunch of SP interacting with one another.
@earnest valve locality is pretty much the only thing that's important in MP -> http://killzonekid.com/arma-scripting-tutorials-locality/
once you wrap your head around that stuff you're good (enough) ๐
@tough abyss i for one was passionately working on a big mp gamemode for 7 months. However script fatigue kicks in and the fact arma is just a game and doesn't make your living are reasons why big script projects are rare
Finished script projects *
@halcyon crypt Cool, thanks! ๐
Hi guys does anyone know a tool available that people can use to create GUI menus for Arma 3 multilayer missions ? Like rule lists, settings etc etc
CBA
and/or the GUI editor that's part of the debug console, I think
@queen cargo was working on an external GUI editor but no clue about it's state
I've tried the GUI editor yes, but it didn't really work as intended. I've tried some other external ones but they simply didn't work anymore due to updates on ArmA 3
uhh which GUI editor? ๐ค
I honestly don't remember. Kinda gave up on the idea but working on a new Arma 3 project now for which an interactive menu would really streamline player experience
well @halcyon crypt
currently do not find the time to work on anything due to study & job & real life ... sooo ... its on hold
@tough abyss https://forums.bistudio.com/topic/183842-gui-editor/
it's official and most definitely works
@queen cargo ah pitty ๐ฆ
I've used it, but it won't allow multiple windows. Also tried importing images to in paa format but they wouldn't load
but most people seem to use outdated versions anyway :3
Best way to make UIs - learn to write UI configs yourself, then you'll understand them to full extent
still PITA in regards of designing them @meager granite
Personally I learned off VBS wiki, it has lots of info and examples: https://resources.bisimulations.com/wiki/VBS:_Displays
greetings gents , am trying this code so i can emulate an exo suit assisted jump using a loop but am not sure where am going wrong
code/
player addAction [
"<t color='#00FFFF'>exo assist.</t>", {
while {a < 8} do {
a = a + 1;player setPos (
player modelToWorld [0,1,1]
);
}
]
/code
you never define a
@indigo snow thanks bud can you put it in the code please
am kind of new to scripting
a=0;
where exactly do i put it
just before you start the while loop
sorry can you modify the code with the change please
when the code goes while {a < 8} do { ... };, a has no value so the script gives an error
so you need to define a before your code does while {a < 8}
Anyone have a link to the wiki for how to script an item into a mission?... like... create an item that can be carried in the inventory and take up space in the inventory that doesn't exist in the vanilla game?
Didn't that revolve around taking another item and modifying the inventory control?
@indigo snow thanks buddy i got it working
@indigo snow, was your last question aimed at me about inventory control? If so, I have NO idea.
yea, i believe it was something hacky like that. might help you add some search terms haha
Oh. Okay! I'll try to check it out more. I've seen some medical systems add in medical items without requiring mods, all done in-mission scripting. I'm trying to add in mortars as inventory objects.
im not sure how far you came but this thread addresses beign able to double click an item and firing code
https://forums.bistudio.com/topic/151006-interaction-with-inventory-items/
where you see he gets the lbValues , you can see which parts of the control you need to interact with (the text and pic lb values, at least!)
May be this recomenfation does not exist but there is a guide or something that state basic recomendations to make your mod compatible with the most number of other mods possible? Thankyou in advance.
Thanks, @indigo snow!
is there a command that can show config file owner?
@lethal cave the parent of a config class?
Wouldn't be the last that edited it but there is this https://community.bistudio.com/wiki/configSourceModList
that looks good, thanks a lot
Similar concept as well https://community.bistudio.com/wiki/configSourceAddonList
for some reason my searching abilities fail me on the biki
CfgPatches is more specific than CfgMods
Is it possible to freeze an animation in a certain frame until conditions are met??
do you mean like so:
0 = this spawn {waitUntil {behaviour _this == "combat"};
_this call BIS_fnc_ambientAnim__terminate;}
@shadow sapphire
freeze:
_unit unit setAnimSpeedCoef 0;
unfreeze:
_unit unit setAnimSpeedCoef 1;
Thanks so much, @little eagle!
yw
Hmm... I wonder why there isn't an Arma 3 animation for just plain position of attention without the salute.
Is there a way to prevent the salute animation altogether while retaining the position of attention?
No and don't think so
Rats. Can you cancel an animation?
_unit switchMove "";
Interesting... I'll experiment with everything you've shown me. Maybe they can be used in combination to create a keydown position of attention.
I seriously doubt it
timing would be impossible with anything you have in SQF
especially in MP and low FPS
Ugh... sorry for so many questions today...
But, can AI units in a group be given individual waypoints?
Well, that's okay. If they all salute before they leave the position of attention, it'll just be a quirk, assuming that I can get the animation to freeze at the appropriate time.
you can doMove individual units
@indigo snow, thanks so much!
I'm trying to take a marker and create a location from it, but the bounds just seem... off
private _marker_pos = markerPos _marker_name;
private _marker_size = markerSize _marker_name;
private _location = createLocation [ "Name" , _marker_pos, (_marker_size select 0), (_marker_size select 1)];
_location setText format ["Location"];
_location setDirection (markerDir _marker_name);```
Is it off by a lot?
This makes a loction that seems... too small? I've tried doubling the size lengths and rotating the direction by 90
the center is correct
and no, not by too much
but noticable
Could it be a rounding error? Is it a small location you're making?
Correct
Now I have an error in an action condition
and (makerColor (name (nearestLocation [player, "Name"])) == [side player, true] call BIS_fnc_sideColor)```
```17:05:56 Error in expression <arestLocation [player, "Name"]))
and (makerColor (name (nearestLocation [playe>
17:05:56 Error position: <makerColor (name (nearestLocation [playe>
17:05:56 Error Generic error in expression```
If I remove the condition after the and it works fine
makerColor is not a command
Hey guys, hopefully simple question here.. I run a unit with quite a lot of people, and we are a "Paramarine" unit, so we jump at the beginning of every operation. That means we have 30+ people on each transport aircraft. Unfortunately, there is one asshat in the unit that will constantly play with the doors and ramp on the aircraft EVERY jump - I cannot figure out who it is, most likely one of the new recruits, only started happening recently.
Is there a way that I can disable the commands for everyone in the "Passenger" seats in the aircraft?
And make it so only crew members can access the ramp + door features? Any help would be awesome.
You could assign the action to the pilot, so that he Is the only one who has control. But you may need to name your plane and the script calling it, something like "plane1".
There's also some parameters in the addAction command that you can specify who can use it, too.
One sec
I'm really a scripting noob. - how can I remove the action when it's already made in the planes mod?
Yeah - it's Sabs C130 and a C17A1 mod.
Damn
They both have the option for passengers to open/close jump doors, as well as the ramp.
So it's an action that's already there that I would like to remove for everyone but the pilots.
or, in a perfect world, only enable for people who are in the crew seats.
Yeah I can't help you with that, unfortunately. You may need to ask the Author of that mod, probably.
How do you modify an existing eventhandler? AI on init needs to be immune (AllowDamage False) and after a trigger needs to only take damage from a specific side
_damage = _this select 2;
_shooter = _this select 3;
if (side _shooter == side _unit)then{_damage == 0;_unit setDamage 0;};
_damage;```
problem is after trigger the AI is still immune to all damage from either side.
Any idea why?
You cannot modify the existing eventHandler. Until you remove it, it's in effect.
@cptnnick#7051 can i use the domove command to produce something like custom formations
Or at least make a group take positions for a while like in a circle back to back or so?
And why do my mentions @whoever not work anymore in discord?
And would anyone know if MCC will be available to the voted admin, if i restrict it to admins? Gotta play with that later...
Also can mcc be restricted to admin by default? Problem is that it is freely available also in set missions, where i dont want players to have mcc access and i cant/dont want to edit all the maps to add a module i think.
Not sure if people still use MCC. It's not something I'd expect to be answered in here imo
Unfortunately you will need that module to restrict MCC access. However due to the created dependency I removed MCC completely. I think you'd be best off having an experienced Zeus-er do small operations. AI wise I'd recommend a custom ASR setting
@thin pine
@proven crystal
MCC became quite useless with the release of Zeus, especially when combined with ARES imo.
hm I would consider ARES obsolete with the release of ACHILLES
it has way more functionality
@thin pine It's basically ARES + more features https://forums.bistudio.com/topic/191113-ares-mod-achilles-expansion/
You only need Achilles, not ARES itself
Any Lua lovers? :)
@broken mural add the handler then remove it
Why didnt they call it Mars. I mean the other 2 are gods, why step it down if you upgrade. We went from father of gods to gods to son of a god.
I have little use for it (community-less) but it looks pretty good
Eden-fied zeus ๐
That looks like a good tool to add to my arsenal of mission creation tools
This Mars editor looks like it would superseed ares
or even compliment it.
Apparently achilles does that too. So how do achilles and mars compare then?
i made some tanoa pixel art by way of map markers: http://i.imgur.com/sq0dbzs.png
neat ๐
Achilles is only client sided or do i need to run it on the server?
Because it says there only zeus needs to have it installed
and all it does is add a few modules to zeus?
No need to include it at all on the server I believe
Mars is a complete replacement for Zeus, not an extension of. It offers superior AI order and spawning controls, 3den-like unit/object selection and placement controls, simplified extension framework, faster execution, etc.
But apparently quite some bugs
Well, it was the first early beta release this week. Definitely not bug free or feature complete. I think he's planning on an update this weekend/early next week.
achilles + MCC4 as combo for the zeus on the admin/zeus on the server
Do #defines propagate down the call stack?
e.g. I call a function and it "inherits" the defines from the calling script
#defines (and all macros) only get processed when a file is loaded, they dont propagate through
They should propagate
I.e
#define test 100
systemChat str test;
[] call {
systemChat str test;
};
should work
On the logic they do work with spawn
I guess I'll find out if it works when I load up the game soon-ish ๐
I'd put money on it working ๐
But
e.g. I call a function
I don't think will work
If your function is pre compiled, I doubt it
inside one file they propagate, but if you call a function defined outside of that file, it wont
ah that's what I'm doing, pitty
as the code that is above this part, is a safezone that deletes bullets etc, people without our squad xml can freely fire at base
I'll check rpt one more time, but only thing I notice is guests firing freely at base
maybe infistar breaks it or something? I don't know
And _email is defined right?
yes the hint shows up properly
no but it seems that that part breaks it
as when someone is seen as true, the safezone works
who's seen as false can fire freely
Possibly found the answer in Infistar. Will report back results
FIXED!
@halcyon crypt More specific definition is macros are only defined after code is preprocessed
Script finds a macro #define doessomething(psuedofunc)
And replaces that macro with whatever is defined by the #define
damn macros ๐
More specific definition is macros are only defined after code is preprocessed
I would say that they are "resolved" not defined
Yeah you #define them then the code is when you execVM
is basically equivalent to this
You can place all your macro definitions inside a header file and include that in every script
#include
[8:56 PM] commy2: You can place all your macro definitions inside a header file and include that in every script
Ah, we're already including script_component.hpp anyway. Should probably move them there. ๐
execVM reads the file fron disc, preprocesses it, compiles the string to code and then spawns a scheduler pseudo thread. definitely not something you want to do mid mission
@little eagle People still do it you know?
i mean, it doesn't matter if your file is a 5 liner without header
But it's definitely not good practice
BI for example replaced all door opening scripts, which where execVM'd with precompiled functions
I pre-compile most of my code as I've said before.
script_component.hpp is where the macros should go
You just have to be carefull when you also include it into .cpp and you're making a mod with pbo project
It fails if you redefine a macro
for whatever reason
works in SQF
hmm I've put the defines in script_component.hpp and included it in the script but it's not recognizing them.. :/
facepalm.. wrong component ๐
coding guidelines, definitely a good idea.
@noble juniper It partially reminds me of PEP-8
@tough abyss how come that you know PEP-8 ?
@tough abyss nice to know, wasn't using my head, am busy with arma stuff .
I've been over a few programming guidelines
Atleast ACE3 adds one
The amount of inconsistencies within the community in terms of "code design"
Some things I've come across are downright ugly...
oh jea .... and don't even mention securety holes and stuff
Which can mostly be avoided by defensive programming.
Macros are good for checking violations
As they become hardcoded
if you want them to.
do you have a specific example because i don't 100% get what you meant with that.
i know macros, i think i get what you mean with defensive programming, ehm
interesting example, but why not use param and params ?
Doesn't catch illegal expresions like nullObjects
as far as I know
If it does well, then why do we use exitWiths so much?
should return false if it needed to intervene.
May as well stop using them.
if i remember correctly
You really dont need Macros for that though
Personnally i find SQF Macros make it harder to read exactly what some code is doing & making Battleye scripts harder. Since you can just do a search for the script snippet that got logged in the mod files.
Anyone know if it is possible to make like a radar for incoming missile and number them like "23421" And "32315" its kinda like a ID
I tried to wrap an error checking function into 1 piece of code
It went okay.
simply using a function call giving it a "legal" and illegal expression if the passed was an illegal it just broke out of all of the code.
checkLegality = [_passedArg,_compareTo] call GG_fnc_checkVarType;
if (!checkLegality) exitWith {};
Use 1 function instead of 5 or 6 different check expressions etc.
The theory behind it was sound
Atleast a cfgFunctions.hpp compiled check function
more or less was "hack protected"
Thats right isn't it?
cfgFunctions.hpp defined functions are compileFInal'd therefore can't be tampered with?
yes, if you don't fidle with the ram => BE
@tough abyss whats your Background AL ?
Not a huge amount
I never particularly liked the mission
Too many swagger teenage prepubscents @noble juniper
And it's genuinely boring.
So much grind for little reward
@tough abyss i know what you mean.
@noble juniper Is it "easy" for people to fiddle with RAM?
in regards to arma 3?
I mean I can use ProcessHacker to look at memory addresses
but I can't edit them.
Or well actually you could...
That program does allow you to.
But battle-eye obviously doesn't mind a lot.
If I did edit the memory battle-eye would probably have a hissyfit?
im not that up to date, but i think that has become good in detecting those.
Especially because it now runns before the game gets loaded
Would it ban me for process hacker?
and while BE is runing, you get insta Baned i think
If I am not actually tampering with anything*
i guess, 2 years ago i read some one had some ram usage scanner on his mac and got baned because BE in the VM Detected it ..
could be hoax, but be careful. Maybe not fiddle around with the ram while running arma
try it out ?
hey guys need help with locality
_caller = _this select 0;
if (player != _caller) exitwith {};
this used to work in A2... in A3 it doesnt work for player only. Any ideas how to enforce that on player only?
where do youactually need that ?
well, remoteExec has pretty good adressing
but this doesn't look like remoteExec usecase.
Yeah @cedar bay need more context
well it is a special night vision that worked if you were that player
it now activates even in 3den
Full code?
_caller = _this select 0;
if (player != _caller) exitwith {};
"colorCorrections" ppEffectEnable true;
"colorCorrections" ppEffectAdjust[ 1, 0.66, 0, [-5, -2.14, -1.2, 0],[-5, -0.4, -0.16, -3.14],[-5, -0.13, -0.01, 0]];
"colorCorrections" ppEffectCommit 1;
thats it
What calls it ?
how do you get that code executed ?
Nothings call it..
config of unit
init.sqf
the class init block?
yes
AH.
First question
Are you absolutely sure that is the correct syntax?
_caller = _this select 0; ?
worked in A2 ๐
init line is:
init="[_this select 0] execVM ""\addon\scripts\init.sqf""";
that is funy code
Don't know much about the init.sqf quirks
[_this select 0] ... is redundant
in addons
_this execVM is idetnical...
^
if you had [_var1,_var2] execVM "some.sqf"
then you would need _this select 0
as _this select 0 == indexes
no
No?
you should do the hole processing there where you actually know what to do with it
So, you should just send everything on, and select in the sqf file where you are using that info
but that is just a very minor thing , nothing to bitch about
@cedar bay Did you try this?
_caller = _this select 0;
diag_log ["_caller value was: %1",_caller];
if (player != _caller) exitwith {};
"colorCorrections" ppEffectEnable true;
"colorCorrections" ppEffectAdjust[ 1, 0.66, 0, [-5, -2.14, -1.2, 0],[-5, -0.4, -0.16, -3.14],[-5, -0.13, -0.01, 0]];
"colorCorrections" ppEffectCommit 1;
i got rid of select... i'll see what causes eden to lit up ... it seems it takes player immediatelly
?
add diag_log
check through your rpt where it says "_caller value was"
If it returns objNull etc.
Then there is an issue
diag_log format ["%1,%2,%3",_var1,_var2,_var3];
is your friend.
tnx, will take a look
it seems the problem is in PPeffects not in the exec itself ๐ฎ
params [
[["_position",[0,0,0]]],
[["_radius",0],
];
_vehicleOnRoad = isOnRoad _position;
_listOfRoads = _position nearRoads _radius;
private _roadObject = roadAt _position;
private _roadAttribs = [_vehicleOnRoad,_listOfRoads,_roadObject];
_roadAttribs;
Anyway to improve this?
I wrapped this into fn_roadAttributes.sqf
Generalised it into a single tool basically
now I can just [_position,_radius] call GG_fnc_roadAttributes
Your parenthesis inside of the params are incorrect, it should just be like this
params [
["_position", [0, 0, 0]],
["_radius", 0],
["_roadObject", objNull]
];
ah 1 square bracket was wrong
No, there were more
Fixed
params [
["_position",[0,0,0]],
["_radius",0]
];
_vehicleOnRoad = isOnRoad _position;
_listOfRoads = _position nearRoads _radius;
private _roadObject = roadAt _position;
private _roadAttribs = [_vehicleOnRoad,_listOfRoads,_roadObject];
_roadAttribs;
?
I am coding blindly here by the way
I don't know if they work.
I know listOfRoads will return a double nested array
might take all the getDir command variant pack them into a single function
I assume you are creating a random spawner?
_vehicleOnRoad returns as a boolean. _listOfRoads returns as an array of positions. _roadObject I can assume returns an ID? I'm not sure. But _roadAttribs returns the listed variables in a nice array.
You could also try this, instead of the params line?:
`_position = _this select 0;
_radius = _this select 1;
_vehicleOnRoad = isOnRoad _position;
_listOfRoads = _position nearRoads _radius;
private _roadObject = roadAt _position;
private _roadAttribs = [_vehicleOnRoad,_listOfRoads,_roadObject];
_roadAttribs;
/*
optional - returns in hint format
*/
hint format ["%1", _roadAttribs];`
The / / at the bottom has a *, btw. Discord seems to have removed it
params [
["_position1",[0,0,0]],
["_position2",[0,0,0]],
["_object",objNull]
];
_dirFrom3D = _position1 getDir _position2;
_dirFromObject = getDir _object;
_retDir = [_dirFrom3D,_dirFromObject] select (!_position2 isEqualTo [0,0,0]);
_retDir;
Generalised Dir function
Supports both syntaxes
Anyone know if debugLog
works outside of BI code?
Because a BI function for spawning groups
I want to over-write
the wall of TypeName calls hurts my eyes
@earnest valve Do you know if debugLog works outside of BI code?
I now know why BIS_fnc_spawnGroup is so inefficient
A wall of these
if ((typeName _pos) != (typeName []))
It does.. ish. debugLog notes stuff in the ArmA 3 logs.
So is it worth me removing all this completely in a BI-function
I haven't updated ArmA in a while, though. So I might have to check when I get online.
just to improve efficiency?
if ((typeName _pos) != (typeName [])) exitWith {debugLog "Log: [spawnGroup] Position (0) should be an Array!"; grpNull};
There is about 9 checking for that.
all checking if typeName ! = []
Hmm
I'm very confused. Is this related to the block of code 40 minutes ago?
No this is a BI-function call BIS_fnc_spawnGroup
Ok
It uses lots and lots of if (typeName "ARRAY" != Array etc
I can replace most of those with typeName as isEqualTo []
or if (!isEqualTo [] ) exitWith {debugLog
You could give it a go, I guess. But I usually leave the functions alone, unless they need some slight tweaking
One sec. I'll see if I can get online. (Being on mobile is difficult, unless I have the game opened with the code)
Yeah I can't get online just yet. But I'll look at the code via wikia.
is anyone here familiar with makeing an animation work? when ever i run it it doesnt work but if i run arma's version of the animation it does, i used theres in a custom class to get it working, but its not and i copied the code from a forum post posted by a dev so not sure whats happening....
@tough abyss yeah it'll definitely run a lot more faster with the above code you have written.
Give your code a test, though, to be sure it works. ๐
@spring kindle I am, yes. But I'm confused by what you mean by I used theres in a custom class O_o
However, the issue would be best suited in #arma3_config, tbh.
Or #arma3_animation, if the animation Is somewhat setup wrong.
I got a response from a dev finalyt thanks though
Np
@cedar bay not sure if still needed but add if (is3DEN) exitwith {}; up top
On my phone so sorry if not relevant lol
Aren't objects in the editor already editable for the mission maker in 3den?
100 FPS in Eden
Does anyone know how to enable the cursor when showing something using RscTitles?
Alright, thanks.
@MrSanchez#5319 I tried both and it doesn't work.
@tough abyss looking inside the sqm can be a pretty easy way of finding out
Does anyone know a command that returns the skeletonBone of a model? Like let's say cursorObject "command" then I want in the watch field that it returns the door name, for example "Door_1". Is there anything like that? So it'll be easier to find out which door is what and where.
no such command, but you can build something with intersect commands
lol. ignore L33
@tough abyss I don't think you can interact with RscTitles with mouse at all
I'd suggest to hide your title and create copy of it as dialog
Hey guys,
I have this ```
animTextureNormal = "gui\img\icon_messages.paa";
animTextureDisabled = "gui\img\icon_messages.paa";
animTextureOver = "gui\img\icon_messages.paa";
animTextureFocused = "gui\img\icon_messages.paa";
animTexturePressed = "gui\img\icon_messages.paa";
animTextureDefault = "gui\img\icon_messages.paa";
You want to resize the Icon?
Yes @heavy plover
No
I don't think you can with ShortcutButton
RscButtonMenu is CT_SHORTCUTBUTTON
Oh my bad
To have button with picture and resizable image try CT_ACTIVETEXT
Not sure if you can have text AND image there though
Double checked, I don't think you can, you specify your texture in text property so its just image with changable colors
But since you have same icon everywhere I assume you don't need text, just clickable resized image
So CT_ACTIVETEXT might suit you
Ok thanks, but how would I resize image then?
It gets resized by control size
Make sure you have style set to ST_PICTURE
of the active text control
yes
Here is me using active text as buttons for altis life phone, I guess you're implementing something similar: https://www.youtube.com/watch?v=YyBo4Ksfz_Y
(Warning, loud music)
Yes, and also, I just use onButtonClick aswell right? @meager granite
No, action
Actually you can have changable icons with onMouseEnter\Exit if you want
so action = "[] call myfunc"; ? @meager granite
yes
Thanks a lot mate
Actually in my case it is image then much bigger transparent active text on top of it
so you don't have to click right on the icon but anywhere near it
Thanks @meager granite!
@meager granite https://gyazo.com/6632adfd17e58e8ed62ded441fa49ed8
idc = -1;
style = ST_PICTURE;
text = "gui\img\icon_messages.paa";
tooltip = "Text Messaging";
action = "[] call FLF_fnc_openPhone;";
x = 0.654689 * safezoneW + safezoneX;
y = 0.3218 * safezoneH + safezoneY;
w = 0.0360937 * safezoneW;
h = 0.055 * safezoneH;
colorBackground[] = {0,0,0,0.8};
colorBackgroundFocused[] = {0,0,0,0.9};
class Attributes
{
color = "#FFFFFF";
shadow = 0;
align = center;
font = "Purista";
};
@meager granite
What did you mean by 0x30?
are there publically released functions for coordinate transformations somewhere? (e.g. 4x4 matrix multiplication with other 4x4 matrices, or 4x1 vectors, transpose 4x4 and 3x3 matrices, ...)
Are you sure ST_PICTURE is defined as 0x30?
How do I define it as 0x30 @meager granite
you can put it into same config or just 0x30 instead of it
oh ok thanks
what would be a good place to define the onPreloadFinished EH ?
mission side, server side, client mod ?
client mod
nice, thanks !
Is it possible to create script to make waterfall os something like that?
Hmm even stuff like smoke machines that kind of effect would be awesome to have at some places
Waterfall, most likely not.
For smoke machines you can spawn a smoke grenade and that's about it ๐
unless you start modding
I asked for script is it possible to make it :) and ab waterfall couldnt we use same script with few changes ? Something like particle effect which i could place on map
Same like ground fog script but instead of covering whole map area make it permanent at small map areas
Short: Too many Particles = PerformanceKiller.
I am aware of it
Sadly.. Ponds ๐ฆ
I have major performance issues on my server. Is this what could cause it ? ```while {true} do
{
if ("ItemRadio" in assignedItems player) then {
player setVariable["comms-seized", false, true];
};
};
yes
Will a sleep 1; help?
yes
you're currently asking ~1200 times a frame if you have that radio in your inventory
Ah ok
and even worse
you're creating 1200 times a frame that network traffic if you do have it
while {true} do
{
if ("ItemRadio" in assignedItems player) then {
player setVariable["comms-seized", false, true];
};
sleep 1;
};
probably red chaining the whole serverr
THat iwll help?
yeah, but you still do network traffic every second
with many players that is very bad
Check out the "Take" and "Put" Events: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
while {true} do {
if (currentChannel isEqualTo 7 || currentChannel isEqualTo 6 || currentChannel isEqualTo 1) then {setCurrentChannel 5}; // -- Set channel to direct
sleep 1; // -- Sleep 0.1 seconds
};
and maybe "InventoryClosed" and "InventoryOpened" too
well at least setCurrentChannel does not create network traffic
but it's stupid
just disable the channels
There is ways to get around the disableChannels in description.ext
Sometimes it doesnt work
yeah, you cannot disable the global channel on the server machine
and side channel on every machine
but your code can be cheated anyway
you just have to be quick enough
Yeah
ask BI to fix disabling side and global channel
if (currentChannel in [7,6,1]) then {setCurrentChannel 5};
less awkward
ty
while {true} do
{
if ("ItemRadio" in assignedItems player) then {
if( (player getVariable "comms-seized"))then
{
player setVariable["comms-seized", false, true];
};
};
sleep 1;
};```
@rotund cypress More like that.
But will that really fixed the problems? Isn't it still checking a lot of times?
Clientside, every 1s. If its already set -> SetVariable won't be executed.
So the setvariable is the problem with the traffic?
As @little eagle mentioned: You would send every 1s that Command over the Network (the "true" in setVariable means "Available for everyone" means sync with every client)
With the simple check before it (if its already false or not) -> You don't execute it again and again and again and again and again and again and again and again and again and again
Ok thanks a lot
I'm trying to add multiple ctrls to the map which function like map markers - staying at one spot on the map. This works for a single marker, but what would be the best way to do it for dynamically created ctrls?
findDisplay 12 ctrlCreate ["RscButton",6558];
findDisplay 12 displayCtrl 6558 ctrlSetPosition [-10, -10, 0.1, 0.1];
findDisplay 12 displayCtrl 6558 ctrlCommit 0;
findDisplay 12 displayCtrl 6558 ctrlSetText "player";
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["draw",{
_xy = (findDisplay 12 displayCtrl 51) ctrlMapWorldToScreen position player;
_w = (184 / 1920) * SafeZoneW;
_h = (34.75 / 1080) * SafeZoneH;
findDisplay 12 displayCtrl 6558 ctrlSetPosition [_xy select 0, _xy select 1, _w, _h];
findDisplay 12 displayCtrl 6558 ctrlCommit 0;
}];```
i'll need to use disableSerialization and store the dynamically created variable names somehow right?
_Btn1 = ctrlCreate blablubCreatestuff;
_Btn2 = ctrlCreate blablubCreatestuff2;
_Btn1 ctrlSetText "abc";
_Btn2 ctrlSetText "abc2";
?
but then i can't refer to _Btn1 in the ctrlSetEventHandler bit
@tough abyss cheers for that ๐ will try to remake it to use without the dam and for arma 3 :))
@rancid ruin Give it an ID
findDisplay 46 ctrlCreate ["RscText", 1234];
https://community.bistudio.com/wiki/ctrlCreate
After that:
https://community.bistudio.com/wiki/displayCtrl
_Btn1 CtrlSetText "blafart";```
@rancid ruin If you don't know a lot about GUI this is one key thing you should know about it
The main part of your "GUI element" is the base class
which normally contains an IDD
This IDD then has IDCs
IDCs are the childclasses that are initialised along with the main parent IDD class
Hey, Im trying to get a trigger to play a sound i have in my mission file. I can only seem to find online the play sound function witch requires description scripting. Anyway to trigger the sound directly? so on act: Playsound 0, "Soundhere.ogg"
https://community.bistudio.com/wiki/playSound3D might this work?
i saw this... but im not looking to play in 3D, need it to play globaly. And not sure what the config is for pbo directorys.. (sorry, been away from arma for about a year. Feel like a noob)
was it like [0, "folder/sound"];
or something like that
what kind of soud is it? can't you just pack it into addon? would be much simpler
Ok figured it out. Thanks.
any idea why this isnt working? hint "10"; sleep 1; hint "9";
@royal coral 0 = [] spawn { hint "10"; sleep 1; hint "9"; };
Triggers require handles when spawned or execVM is used. the 0 acts as the handle
Thanks man, ill give it a shot
Also if you plan on counting all the way down, perhaps a loop? Depends on how comfortable you are with scripting though ๐ 0 = [] spawn { for "_i" from 10 to 1 step -1 do { hint str _i; sleep 1; }; hint "go"; };
Not very.. not qouite yet. But thanks. I'll look into that too.
Alright ^^
Arma is so retarded for requiring the script in init boxes and triggers to report nil, but then does not complain about trying to use a number as variable name.
This is one thing I hoped would've been fixed by Eden
Hi. Im new to Scripting.. and could use some help
Im trying to make a script that will allow a player to collect all gear from a Unconscious/dead player adding "xxx kg" to that player
and giving him an option to drop it again. when that happens it all needs to be stored in one Container (backpack if possible)
The getting part i was wondering if i could use getUnitLoadout and then use RemoveAll xx to clear the body/Unconscious player
Right now i dont have any idea how to get the Stored gear from the array into a box (dosent seem like setUnitLoadout will work on Crates/Backpacks) when the player decides to drop it
Any help is greatly appriciated and please dont just Write the entire code im trying to learn ๐
what you're trying to do will end up in a huge clusterfuck
because the inventory system in Arma 3 is still shit
especially on the scripting / modding side
Certain things are just impossible to get right. filled uniforms/vests/backpacks inside ground weapon holders
attachments on weapons
magazines on weapons
It's really inconvenient to turn the arma inventory commands into a list that matches the inventory screen, but it's doable.
Not rly.
filled uniforms/vests/backpacks inside ground weapon holders
attachments on weapons
magazines on weapons
these are impossible
Also: It's not possible to remove SingleItems from a GroundWeaponHolder/Vehicle. This will also end in a pita.
true. many problems
Sadly.
That's one of the biggest headaches, removing stuff
Another issue with the clearing commands for gwh cargo space is that the gwh is deleted the next frame if you remove all items even if you add new ones
0.5s iirc
you always have to add a safety dummy
Last time I tried it was deleted anyway
despite unscheduled env, so no time delay
Strange
doesn't weaponsItemsCargo return the weapon and its attachments?
Still, inventory is a mess.
It does, but adding weapons incl. Attachments to it -> Nope.
ah, adding
So either you "unbreak"/Deattach everything, that is attached to a Weapon (another Workaround) or you just leave it as it is.
The inventory command names and lack of paired functions is frustrating
It is, yeah.
addUniform: Arguments global
addBackpack: Arguments local
addHeadgear: Arguments global
addWeapon: Arguments local
addMagazine: Arguments local
addMagazine array: Arguments global
Even with addWeaponGlobal executed on the Server -> Nope, won't add it to the unit.
oh yeah. that one is hilarious
This command is broken when used on dedicated server
thanks a lot
Yep.
If you use addWeapon on a remote unit many times
the client that has that unit can end up with multiple primary weapons
drop one and you get a new one
it's funny
"funny"
hey. it's cool to empty a weapon and throw it away to get a new one instead of reloading
Good for a COD-like shooter ๐
The issues with the system keep getting worse in fact
Page 57 of 57 - Scripting Discussion (dev branch) - posted in ARMA 3 - DEVELOPMENT BRANCH: Wrong? Wrong it was removed? I dont think so. Wrong it was duplicating functionality? This is why it was removed. You said: >playerControlled was added and removed because it was duplicating existing functionality. If I remember correctly you could get the same results with cameraOn. But the changelog says: >Arma 3 1.24: New command playerControlled (like the playe...
_string select [3] <-- ??? Why []?
AH!
[0,1,2,3,4,5] select [3]
should be
[3,4,5]
but it errors
you have to write
[0,1,2,3,4,5] select [3, 1E7]
which is fugly
yeah
It's really strange that the string syntax "length" parameter default to whatever the end of sting is
but the array "count" one needs to be explicit
doesn't default, you have to write something
fastest is 1E7
or any other bigger number
Instead of counting the Array, yeah.
_a = [1,2,3,4,5,6];
_b = _a select [3,(count(_a)-1)];
Oh boy, yeah... thats bs
Misstyped
that one is slower. just assuming 1E7 is the fastest
it's the array size limit we have now
Or just use 10000 ๐