#arma3_scripting
1 messages Β· Page 367 of 1
@Roque_THE_GAMER to execute it on many units forEach could be used
Params["_myCivyDude"];
You have to assign them in order by the way
Using params at least
_x is a special variable for allUnits , the fear.sqf doesn't understand what that is
sorry, how would i do that?
like i said, params will assign your passed variables
which are received and set by the params
to be honest I don't know how you made your mission work without using arguments
well it's possible but tedious
global var everything π
aren't triggers just loops
yes, otherwise i would put a new trigger to every singe unit
The trigger conditions are yeah
don't put too much triggers.
yup
i am just not that smart
Don't have to be. Just muscle through some of the quirks of sqf and you'll be fkne
It's mainly just understanding the commands
The biki is now your bible. I wish they had printed versions of that shit, or printable at least
Going to each biki command page and having to print each would be annoying and a waste of toner and paper
nevermind that, it way too hard for me.
@astral tendon a friend of mine is carpenter and learned in about 2-3 days of combined lessons. You can if you want to, it ain't that hard.
Oh wait for ARMA 4 C++ object orientated scripting. Wohoo
By not taking a day or two to teach yourself the basics of normal SQF usage, you actually make it a lot harder for yourself π
Yep
- the things you'll learn are worth it, even if it is the logical side of things.
Because you have to do everything in an unconvential way you run into weird issues that you would not have otherwise
Because you do not understand, you run into weird issues you would not have otherwise
@astral tendon
I am a gas fitter, i learnt how to code about 14 years ago when OFP was released and I wanted to make my own missions
I spent a week reading through all the scripting posts I could find just to understand what is and isn't possible in the scripting language that Arma uses.
Coding for arma is made up of 4 basic elements
Logic (Typicaally most things have 3 possible states, Everything is either On, Off or doesnt exist, true, false, nul) so when you code you have to code in such a way that you take into consideration all the possibilities
Syntax (This is the hardest bit for new coders, its here where everyone struggles initially)
Timing (There is pre init, time 0 and post init, some code has to be run at certain times, before other code is run, in simple terms you cant build a wall if the foundation isnt set and you can't lay bricks if you havent carried them to the wall first etc)
Locality (Some code has to be run on certain nodes (Machines like client, server etc) dependant on where the object is that you are referring too, the comref details this very well)
speaking of triggers, how resource intense are they? Did not realize they where just loops running in the background, always assumed they were converted to some kind of event for me.
any metric like x amount triggers is roughly -y fps or something?
My first mission was a ctf called riverdance. I spent in excess of 100 hours of headache coding making that mission and when it was released, it had a lot more functionality than other missions of the same type made by my peers . It was also popular..
So if your attitude is "Its too hard", then you are making an excuse for not trying rather than digging in and getting stuck into it
Try very very basic stuff
Learn how the comref is laid out and understand the syntax
Also learn how to debug, that is, learn how to return values in a way you can see them, or check a script has gotten to a certain point, this is fundamental to understanding and developing code>
And just for folks like you, i even made a tutorial up about it, it should be simple to follow and will get you started....
Link.... https://forums.bistudio.com/forums/topic/166233-zeu-debugging-tutorial-foundation-template/
hey guys, what are the best tutorials or (in general) practices for getting good with A3's displays? is there anything anyone getting started should be particularly noted about that'll save tons of time later?
thanks!
Triggers check their condition every 0.5 seconds
thanks, @queen cargo , but I'm aware of those already and it doesn't help much to receive an advice as general as yours. I'm looking for something more specific.
@timber ridge then google your specific question, somone has likely asked before π
@timber ridge useage or hereditary and #define for common values, such as multipiers etc
hm, just found this one: http://killzonekid.com/arma-scripting-tutorials-gui-part-1/
seems like a pretty nice beginning.
it's even an entire series of tutorials.
@slim verge thx!
@scenic shard thing is, Arma community needs a platform like Stack overflow very much where voting for questions and answers is functional and when you're getting started with something new, you can just search by a tag and sort for the most upvoted questions.
you also need to be aware that the gui can look different on different screen sizes unless you code that intoi the gui, fairly easy to do
BI forums don't help much in this case as many of the examples there may even date back to A2:CO days when found in the google results.
BI and the 21st century, your having a laugh π
that would be cool, but I wonder how active it would really be
well arma survives on the moddability, so there is quite a strong following there, nothing stopping someone creating a stack overflow type forum somewhere
I laughed when you said part of this game is logic.
anything at least closely resembling SO would be a huge step forward for the scripting communtiy and retainance of knowledge
i meant a logical mind, eg folks will automatically try to open a door before walking through it, code doesnt think
@little eagle Stack overflow.
DEEP MIND ?
A forum where every question gets their thread and possibly an answer.
we need a new language, that knows your intent
There are multiple of these. Sub on the BIF, /r/armadev. But they all get cluttered by the same questions over and over again and frankly low quality answers.
IMHO, voting is exactly the thing that may motivate people to post informative and at least properly spelled answers that will probably get accepted by the OP and won't confuse people.
Atm, when you're browsing BIF, there's almost no apparent indication of an answer or any helpful post at all. You just see a mess of text cluttered around and some votes being exchanged between the folks.
Also, a requirement for every question to have at least 4 tags is pretty ok compared to having none (BI forum threads).
Helps a lot when searching around for stuff.
thats because stackoverflow is not a discussion forum, BI forums are
I'm not talking about BIF in general, obviously, just the editing / scripting / configs subforums.
It would be nice if the wiki was at least complete. By that I mean listing all the quirks of all the commands.
stackoverflow is more of a Q&A site
Like those C++ guides.
the wiki does in a lot of cases explain the oddities, funnily though those oddities are added by the wiki users, such as you and me, so the anmswer to that, is when you find an oddity add it to the talk page
I see no reaason why BIS couldn't make a SO-like QA website for SQF and Arma editing, configs in general. It's just a matter of effort put in as it'd help the community a lot when spreading knowledge.
A QA subforums could be even be perfectly integrated into the current BIF.
if BI see an economic gain for that maybe they woulkd
dont forget they are a business and businesses dont like spending money unless its really necessary, they rather spoend your pension fund instead
@timber ridge you asked for documents, https://community.bistudio.com/wiki/Dialog_Control https://forums.bistudio.com/forums/topic/136099-how-to-compile-into-a-gui-question/#comment-2219824 https://community.bistudio.com/wiki/Category:Command_Group:_GUI_Control https://resources.bisimulations.com/w/index.php?title=Dialog_Control
you got documents
I recently started collecting some of my answers in this chat as gists, but it's a short list and it's mostly just the code snippets without explanation.
@little eagle good one, but I think BIWiki has generally improved a lot in the past 2 years, thanks to numerous contributions of people like killzone_kid and others.
True.
alternative source for c/cpp btw. http://en.cppreference.com/w/c/string/byte/strstr @little eagle
^^
personally enjoy that one more when i know where to look fore due to more explaining
the one you posted is better for browsing
if (isServer) then { [[this,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"] };
[]spawn {
while {true} do {
if ((damage healed) < 0.2) then {healed call BIS_fnc_ambientAnim__terminate};
sleep 1.00;
};
};
this command works
but it shows the problem we face in SQF
how to present the data to the programme
E.g. if someone asks again how to convert n objects position to eden euler angles, I can copy paste this: https://gist.github.com/commy2/d60b11fd38cf53f5c2ec02cda0dc3426
but i wanna trow that command on any init of any unit
if i swap civ1 to this it does not work
@little eagle would you be interested in a repo or even a separate website for SQF gists?
what i need to change?
all units have a variabloe called allunits
{... do something...}foreach Allunits;
healed -> this if you want it on the init.
@timber ridge probably useless due to the fact that it simply is not needed
would be a pile of junk after a week or so
unless heavily moderated
I really like the Github markdown. And so far it's not too many that they'd need their own website. Sounds like a hassle to maintain one.
@queen cargo I'd largely disagree. You can always ensure qualty when accepting/declining PRs.
You: You can always ensure qualty when accepting/declining PRs.
Me: unless heavily moderated
however that really should be run on a hit or damaged eventhandler which is trigger on the event hit or damaged
@queen cargo well, i don't know what's your point, but of course it'd be have to be moderated , common sense there π
while {true} do it is always a bad idea to use true as condition. you want to break out of the loop eventually
in regards of commands help, SQF-VM can serve for that purpose
the help__ command output is prety useful when used in the unary variant
can easily be printed then
however ... SQF-VM is not supporting all commands yet
what he means is.... alwsys stay clear of a continous loop, as this constantly takes up resources.... so if you want to run codew when a unit is damaged, hit, then run that code via a hot or damaged event handler which is automativc ally triggered when that event occurs
excuse my typos fat fingers small keyboard
btw @little eagle speaking of those stupid angles, i dug up this in the 3den pbo
https://gist.github.com/cptnnick/dbf5b0d73c8b32e926f4822dde9f476d
(_dir select 2),// _dir is the array of 3den rotation angles
-(_dir select 0),
-(_dir select 1),
@timber ridge we talk about a sort-of pastebin with the possibility to search for snippets easily
- every snipped would need to be checked against correctness (testcases etc. need to be created)
- every snipped would need to have description and header perfectly clear for everybody
- tags or something like that would be required too for easy finding with keywords
all that would need to be done and checked by moderators
for me that looks heavily like 3den utilizes opengl coordinates Oo
@slender halo ^^
so you would add an event handler to each unit and tyhat event handler code would run.... if ((damage healed) < 0.2) then {healed call BIS_fnc_ambientAnim__terminate};
event handlers, the syntax toi use them, their locality requirements are all listed here...... https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
@queen cargo i completely agree, storng moderation, test cases etc. would be ideal for the best quality possible, but that's a long way to go, at first it'd be nice just to have easily foundable and visible examples, sortable, categorized by [something], etc.
after that, sure, you can always iterate to the next level (whatever that may be).
the moment you drop those requirements, you loose the quality
start like that, and you will have a pile of junk you have to fix
but the thing is, SQF communtiy don't have quality anyways, so a wise choice would probably be just to improve on that gradually and experiment with stuff and find enough collaborators within time
no quality π
I mean, why not just compile a list of gists from the results of a large dataset from a SQF QA site (choosing accepted answers in Q threads)?
that'd simply be a start.
Its a scripting language for a game, not a language for programming :P
lemme repeat: start with bad quality and you will leave those bad-quality stuff in there for ever
@indigo snow well, let's hope Enscript will make Arma scripting more of a lang ;D
Terox thanks for the help
if (isServer) then { [[this,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"] };
[]spawn {
while {true} do {
if ((damage healed) < 0.2) then {healed call BIS_fnc_ambientAnim__terminate};
};
};
healed = this
Such a site would probably devolve into endless discussions about whether or not you should use { in a new line and that you should replace all forEach with count etc.
notlikethis
why?
Why not get that AIS eh?
that true
@little eagle good thing here would be: does not matters
those snippets would need to be heavily commented --> reason why using count > forEach would have to be placed into comments
@little eagle you mean codestyle discussions?
HandleHeal
there's a separate site for those π
not rly ... stack overflow and thousands of other pages had those discussions already for non-sqf languages
it is just like the old discussion space vs tabs
you will never find an answer
you guys are way too negative about this, nobody hasn't even tried anything like that for Arma / SQF and you're already banishing it to the eternity. that's some exceptional spirit I guess π
i do not banish it
i already know what success it would have ...
few ppl using it
only me (if i create it) moderating it
ppl getting angry about me not adding enough info to the snippets and so on
that depends, you knowing how something will turn out does not guarantee it'll turn out like that
even BIS could participate in promoting a special QA site for SQFscripting, etc.
any help from them would be gladly accepted.
you knowing how something will turn out does not guarantee it'll turn out like that
chances are quite low for any other outcome
it is hard to find participants for any project
to keep them interested is even harder if you always have to reject changes they propose
at best: one is the manager not writing any code and you got some code monkeys doing coding for ya
manager then only moderates
code monkeys write code
@queen cargo good points, yeah, but if you keep looking, you may find some knowledgeable and trusted people that could help out, even temporarily since everyone can get busy with RL at any given time and should have resign for a while / forever.
as for managing, sure, it's nice to classify by roles, but why not just let it flow at the beginning and see how much traction it gets? just setup some google analytics on the site and see how it's being used, etc.
then make decisions of what hierarchy is needed, if any. and since it's a non-profit project, no hierarchy should be enforced by default, right?
btw, are you saying that without hierarchy setup properly things will fall part quickly and inevitably?
talking about: either you get ppl hyped or you cannot fill those positions
as you are the one person left with doing all work
There's tons of people doing shit, unite them if they do the same thing... I bet that's extremely hard 'tho
more like impossible
ppl jump on and off projects unless they feel entitled to them
either pay them or youre fucked
to pay ppl you need money
@peak plover you can say RHS did that to a greatly successful degree.
to get money you need to get ppl giving you money
you are a modder
you wont find ppl giving you money
unless those few rare golden eggs suddenly get a large group
If you want money, then mods is not the place to be.
guess that sums up this evening's discussion in terms of community-driven projects etc π
@astral tendon
if (isServer) then {
[[this,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"]
[this] spawn {
params ["_unit"];
waitUntil { (damage _unit) < 0.2 };
_unit call BIS_fnc_ambientAnim__terminate;
};
};
if you absolutely must put in in the units init
keep in mind you really shouldnt have many of these because this is pretty bad practice
Yea, pretty bad when they stack up. Might be an error, i quickly typed it on my phone.
Something like below is better practice (same error disclaimer)
<initServer.sqf or something>
private _unitsList = [unit1, unit2] + units someGroup; // Two examples to get a list of units
{
[[_x,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"]
} forEach _unitsList; // Fire this for all units
[_unitsList] spawn { // I'm passing the _unitsList variable into the spawned code
params ["_unitsList"]; // I'm grabbing the passed variable and naming it _unitsList. I dont have to
while {true} do { // Neverending loop
sleep 2; // Some sleep is good or it will tank FPS for sure
{ // Check all units
if ((damage _x) < 0.2 then { // Check damage of the current unit were checking
_unit call BIS_fnc_ambientAnim__terminate; // If condition, call the fnc, and remove unit from the list
_unitsList = _unitsList - [_x];
};
} forEach _unitsList; // Iterates through the list
};
};
Since theres one loop that handles every unit
even better would be to use event handlers to detect it getting hit, so you dont need loops
Theres many ways of doing it but most of them are pretty bad
i just put that on a unit init?
then afther?
im sorry? i dont understand
just copy and paste that on a initServer.sqf and its done?
there might be errors, but yea
dont include the part between <>
and you need to put the units in _unitsList
but instead of just putting it in, take some time to see how its structured
so, i still have to specify what unit i want it?
yes, i dont know the names of your units or your groups
Ive added comments for understanding
i havent tested it and its probably pretty bad
all i just wanna to do is make a default wounded civilian that can be revived by bluefor
and then he will follow the way point to safety
sure
its more about the structure of the thing
using a list of all units and handling it all in one place, instead of infinite loops everywhere
so, how to stop a loop?
depends on the loop type
either a variable that it checks that you set to false, or terminate the thread
while {isNil "stopLoop"} do {
};
but you shouldnt have many running in the first place
instead of removing them when done
theyll still slow things down while theyre active
fo exemple
my original problem was this
if (isServer) then { [[this,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"] };
[]spawn {
while {true} do {
if ((damage this) < 0.2) then {this call BIS_fnc_ambientAnim__terminate};
sleep 1.00;
};
};
the ting is i cannot use "this"
indeed
_handle = [] spawn {
while {true} do {
};
};
//
terminate _handle;
you can see how i passed variables in the script bits above
while {true} do {
if (true) exitWith {}:
};
[var1,var2,var3] spawn { // List of vars
params ["_a","_b","_c"]; // I store them into these. _a = var1, _b = var2, etc
... commands where i can use _a, _b and _c ...
};```
it would be more easy if i could use "this"
its just a name for a variable at that point
arma doesnt know what this is
there are many units, and you can use this in all their init fields
so, how he know what "this" is when i put if (isServer) then { [[this,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"] };
because that all happens the moment the unit gets spawned in
and this is the current unit that gets spawned in
its something else as soon as the next unit spawns in
and it gets set to nothing when the last object is created
(is a way of explaining it)
so that loop creates an entirely different bit of code, and that code doesnt know about this anymore, because all the units have already been spawned
this isnt how it really works but it might suit as an explanation
then, i tink im gonna make it simple
if (isServer) then { [[this,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"] };
[]spawn {
while {true} do {
if ((damage civ_1) < 0.2) then {civ_1 call BIS_fnc_ambientAnim__terminate};
sleep 1.00;
};
};
like this
just give the unit a name like civ_1
it works, but now i just need a way to stop the loop
try putting this in the init line
if (isServer) then { [[this,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"] };
this addEventHandler ["AnimDone", {
if (damage (_this select 0) < 0.2 ) then {
(_this select 0) call BIS_fnc_ambientAnim__terminate;
};
}];
it will check the damage every time one loop of the animation finishes
theres handleHeal as well
generic error
forgot a ]
I dont get it. ArmA is always giving me this weired error with my custom function.
Function:
/*
Author: FurtherV
Description:
Makes a base indestructible.
Parameter(s):
0: POSITION - Array as position
1: NUMBER - Radius
Returns:
NOTHING
*/
_result = params [["_location", [0,0,0], [[]], [2,3]], ["_radius", 100, [2]]];
_buildings = nearestObjects [_location, ["House", "Building"], _radius, true];
{
_x allowDamage false;
_x setDamage 0;
} forEach _buildings;
Code which spawns the function:
[getPos basearea, 500] spawn DEF_fnc_safeBase;
Entry in description.ext:
class CfgFunctions
{
class DEF
{
class SpawnFunctions
{
file = "functions";
class addSpawn {preInit = 1; headerType = 0;};
class addClass {postInit = 1; headerType = 0;};
class safeBase {postInit = 1; headerType = 0;};
};
};
};
Error:
_result = params [["_location", [0,0,0], [[]], [2,>
21:28:22 Error position: <params [["_location", [0,0,0], [[]], [2,>
21:28:22 Error Params: Type Bool, expected Number
21:28:22 File functions\fn_safeBase.sqf [DEF_fnc_safeBase], line 15
21:28:23 Mission id: a5c3304f76155055fdda3b4334a3bda4177dbc6c
Please Help me to find the error
But... I never give the function a boolean...
I give it a array in format of a position + a number
arma is saying you do!
well... arma is clearly lying...
it also gives me the same error when I dont spawn / call the function
so I dont believe it happens when I call it...
ah wait one sec
still nothing
@delicate lotus you gave it the postInit flag, it gets called in postInit
by the function framework itself
whyd you put that in there π
if (isServer) then { [[this,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"] };
0 = this addEventHandler ["HandleHeal", {
_this spawn {
params ["_injured","_healer"];
_startDamage = damage _injured;
if (_startDamage > 0) then {
waitUntil {damage _injured != _startDamage};
if (damage _injured < 0.2) then {
//add "get up" animation?
_injured call BIS_fnc_ambientAnim__terminate;
};
};
};
}];```
not tested but should work @astral tendon
um... because I want to function to work after the mission is initialized
of course it will work
that flag just tells the game to actually call it during postinit
it will exist from before preInit
about 3 dumb
other question: what does the header stuff do?
headerType = -1; //Set function header type: -1 - no header; 0 - default header; 1 - system header.
if you look at your fnc in the fnc viewer i think it add some lines to it
not 100% sure
ah okay
@scenic shard it worked! thanks!
at least using it for the 0 flag wont have any effect at all
nice work @scenic shard
is this also perfomace friendly?
yes
all wonders
actually _startDamage is probably always > 0 so you can probably skip that if statement. but yea
the game itself will call it when you do the healing action, instead of you constantly checking in a loop
yay no error...
Let me guess, the init stuff and such is for setting up stuff while the game is still loading using given parameters by the engine / game?
@scenic shard cookie points if you remove it after the __terminate fnc is called π
@delicate lotus yea but you dont really use those passed values
youd use it as e.g. an init.sqf that always loads after everything is created but before the mission starts
yea, this is probably a one time thing so the EH could be removed after it fires.
would sqf _injured removeEventHandler ["HandleHeal", _thisEventHandler]; work? havent actually tried removing EHs from within a EH before.
it would, yea
nice, good to know! then add that line @astral tendon after you terminate the animation and remove the if-statement to optimize it further π
how should i add it?
if (isServer) then { [[this,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"] };
0 = this addEventHandler ["HandleHeal", {
_this spawn {
params ["_injured","_healer"];
_startDamage = damage _injured;
if (_startDamage > 0) then {
waitUntil {damage _injured != _startDamage};
if (damage _injured < 0.2) then {
_injured call BIS_fnc_ambientAnim__terminate;
_injured removeEventHandler ["HandleHeal", _thisEventHandler];
};
};
};
}];
like this?
yep
it gives a error
oh, which?
and you can remove if (_startDamage > 0) then {
and it's }; if you like, it's not really needed as you cant heal a unit if its not injured anyway.
undefined variable in expression _thiseventhandler
texen you mean this?
if (_startDamage > 0) then {
waitUntil {damage _injured != _startDamage};
what i should remove?
is there a simple way to change the side of the demining drone?
oh wait ofc its not defined, theres a spawn in the EH
nvm did the misison.sqm workaround and just changed Civ to WEST
@indigo snow pass the vars
how
Spawn takes the vars, [_coolCookieVaf] spawn {}; . it'll pass everything into an array of vars
@cptnnick#7051
ok thanks
Yeah
Yeah
aah, thx. Learned something new! this should work then @astral tendon
if (isServer) then { [[this,"PRONE_INJURED_U1"],BIS_fnc_ambientAnim] remoteExec ["call"] };
0 = this addEventHandler ["HandleHeal", {
[_this select 0, _this select 1, _thisEventHandler] spawn {
params ["_injured","_healer", "_EH_Handle"];
_startDamage = damage _injured;
waitUntil {damage _injured != _startDamage};
if (damage _injured < 0.2) then {
//add "get up" anim?
_injured call BIS_fnc_ambientAnim__terminate;
_injured removeEventHandler ["HandleHeal", _EH_Handle];
};
};
}];```
_this pushBack _thisEventHandler; _this spawn ... or (_this + [_thisEventHandler]) spawn ... but thats largely a style thing
Saves you typing out all those select's
Why not remove the eh immediately?
This could loop forever if the scheduler suspends at the wrong time?
For reference of the above, side group x is considered a workaround, but doesn't always return properly.
@hasty violet
_side = side group _AI;```
If its too long ago, you might have to setVar the side at mission start
i checked but not tested
@indigo snow neat, yea that looks better.
@little eagle that makes sense, also if the player is shot during the healing animation or interrupted some other way we are still potentially stuck in the loop until the unit is healed.
maybe the best would be to add a timeout condition to the waitUntil as well and just re-add the eh and break if it takes too long
looks pretty much like your initial finding to invert the pitch bank values @slender halo
which turned out to only work in certain rotation combinations
TB import needs overhaul.
Good evening at all! You might know the Arma-internal spectator camera... We got the problem that players are able to control the AI player they are currently spectating after they pressed the spacebutton or the enterbutton on the numblock... Does anyone know how to disable this? π
in case anybody ever brings up SQF is inconsistent ... i will directly send you over to create a simple window with JavaFX where you got a menubar with a simple quit item and a button in the middle ...
getChildren() getItems() getMenus()
those are the ones you will need then
all doing the same
but different for each control
Arma is very consistent there
Because it doesn't have a command like that all together
Outside of config lookups there isn't a way to tell which children a controlgroupsctrl has, so if you use ctrlCreate you'd have to manually keep a list
apply vs count those are SQFs inconsistencies
inconsistency has nothing to do with that particular feature
All I want is ARRAY forEach CODE.
is there a good sorted kind of wiki for arma 3 scripters ?
thats the best so far right?
@royal abyss Yeah...? What exactly are you looking for?
i just want to sneak and sniff around what could be done in arma π
and im always searching for "the best" performance
also suuuper interesting
@subtle ore is there a "attachTo" where it doesnt act frozen?
@royal abyss No, it's disabled collision and "acts frozen" otherwise you'd be running around with a piece of collision material bound to induce lag
yeah i saw that with killzone kids ragdoll he did that to add weight to the spine
yeah, artifically setting physical properties, then setting mass, deleting, allowing for player to slop over
but for vehicles?
attachTo with vehicles you mean?
if you are attempting ViV , then it's already been a thing since Apex of last year
yeah but with a joint function
You aren't really going to achieve something like that in arma's current state.
Sure why not
sadly we cant play around to much π
because even if we would start to work with extensions /dlls battleeye would punch us in the nuts π
as soon as it goes clientside
is it possible to get DayZΒ΄s car shifting into A3?
Car shifting?
yeah i saw that with killzone kids ragdoll he did that to add weight to the spine
No, that is not at all what happened in that script.
What you mean by car shifting? @royal abyss
Gear stick?!
Response to me @little eagle?
Yee, I have the same question.
And if yes, Dayz utilizes manual gear shifting?
I really really doubt that.
Looks like it is a thing
Personally never got far enough to get a vehicle together
You can't get this in A3 then. Question answered.
You can with limitspeed
That's very different.
interesting
No it's not.
Never said it would be nice
like ace speed limiter?
limiting the speed is totally different from shifting gears.
I know
But it is the best way to reassemble the behavior
setvelocity maybe?
If one also would make smart usage of setvelocity it could get better...
But in any case
Nothing for rookies
You can't pull this off.
That is not at all how shifting gears works.
Would now say gonna prove you wrong.. But tbh... Not that bored
guys chill π
You could do a hackjob and call it "shifting gears", but it wouldn't be what you advertise it as
Why is it so difficult for people to accept that some things are impossible?
It's not possible period.
Obviously it would not
Question was to archive the effects of it in arma
Missing API.
You can't get the effects in A3 with SQF without major changes to the engine and API.
Back to this:
yeah i saw that with killzone kids ragdoll he did that to add weight to the spine
And unless the velocity script commands and limit speed is not working, it would be possible
This is completely wrong.
commy2 i only sayed that he used it to ad weight to the spine but not that it is how his script works but it was about something completly diffrent read up everything to be clear π
attachTo doesn't "add weight". I fact, the attached objects physics are completely ignored.
The point of attachTo was to move the collider dummy object into the players body.
yeah but u can set mass to it
If you attach an object, it has no mass dude.
And people don't have mass in Arma anyway. They're not part of the physX simulation. Well I guess ragdolls have internal masses, but that is completely different and not possible to influence with attachTo.
attachTo is there to have an object collide with the player. That's it. Adding mass to the spine is false information.
if (vehicle player != player) exitWith {};
private "_rag";
_rag = "Land_Can_V3_F" createVehicleLocal [0,0,0];
_rag setMass 1e10;
_rag attachTo [player, [0,0,0], "Spine3"];
_rag setVelocity [0,0,6];
player allowDamage false;
detach _rag;
0 = _rag spawn {
deleteVehicle _this;
player allowDamage true;
};```
spine is just a selection at the very center of the model.
Yes, the object is attached there to collide with the player. Your interpretation is completely wrong.
I know this script and btw, it doesn't work (reliably).
it does for me o.O
Try it in MP.
i do
Try it while moving
thats because player addEventHandler ["AnimStateChanged", { if (_this select 1 == "incapacitated") then { player allowDamage false; player setPosWorld getPosWorld player; player allowDamage true; }; }];
No, it's because the collision detection doesn't pick it up.
That's how the script works. You create a fast moving object inside the player and make it collide with them.
Nothing about adding mass to the spine. You could replace this attachTo with setPosX.
And the collision detection is very unreliable in MP or when moving and it doesn't even work all the time while just standing.
See: > it doesn't work (reliably).
emphasis: reliable
Unreliable scripts are worthless.
Anyone know how to spawn stuff only clientside ?
but if its a vehicle and the player enter the vehicle what happens?
do the people clientside drive in a car but serverside sit in a invisible car ?
Yes.
lets say i let spawn weapons local if they are in a radius of 50-100 meters and despawn after leaving that would make performance on the server better or?
if you are trying to fix performance then that isn't the main issue
but it does improve or?
Rather have worse performance on the server than the clients...
yup!
but it does improve or?
Iron.
Cookie!
but normal weapons are server wide in render distance or?
That made no sense.
again.. weapons are not the issue you are having with performance
its just if 100 poeple runn around and 1000 items getting spawned because they are in towns and thats worse for the server and every single person why not let the weapons and loot spawn only on close distance clientside
Well, you don't know how many weapons there are
we dont have any performance issius atm one of our users has a GTX 1080 and I7 and has 60-70 fps on the server
You'll not solve this by offloading the work to the clients.
even i have 30-40 fps with a AMD fx 8350 and a HD 7850 (both 5 years old)
not to fix but to improve
well offloading to clients won't improve
maybe it does because Singleplayer performance is always better then multiplayer so then less the server has to handle then more it will improve on the client side cant realy describe that
than*
delete it on players disconnect / death /
or it gets deleted anyway because nobody is close to it
This sounds like a good idea if you want to have it optimized to me.
only spawning loot locally could be good though.. A player will only know about his loot.. not the stuff in next town
That openLoot solution sounds way better
Simple objects should be even smoother though.
Don't need to create them on the fly.
hmh
Yep.
but i was making a deathmatch once and got very bad performance from placing a "few" ammoboxes
but there was nothing else
just a empty map ammoboxes and the playerspawns
yea not the ammo boxes
but it was even in the editor realy bad
but that wasnt being caused by some ammo boxes
the amount of contents dont matter
hmm...
and 40-50 boxes is less bad for server resources than that many players / ai
~40-50 ammo boxxes
Whoa
theyre just a pretty simple object, some simulation and an inventory
there was no scripts or ai at this point and i was the only player
lol you can choose not to accept what were saying
but its not caused by the ammo boxes
it was x64 but also got other problems like naked trees on tanoa
have you considered your pc / arma install is fucked? π
cma_x64 is actually faster than default allocator π
3 fps and naked trees and low quality models is 3FPS bug
which still isn't fixed btw.
That's a mem leak, right?
I've got 8gigs of ram, it uses all of it. It sucks
3fps bug is Arma's "memory emergency mode"
like.. Oh god I'm out of memory! Leave the ship! Throw everything out we can!
So it switches to extremly low poly models and textures... But still doesn't clear any Ram like it really should
BI focused on fixing the cause for the memory emergency event. Instead of just fixing the memory emergency mode.. It should throw everything out of Ram. Then it will have enough free memory again and slowly load stuff back
instead.. It says "Throw everything out!" And the guy responsible for throwing stuff out is just laying in his chair and sleeping
Can you edit a bit in the .exe to fix that ? π
no
That's why π
Never took a look at how that part works
is there something to get "around" triggers
Any scripting tricks to fix frames/ram?
no
also something to handle players renderdistance
setobjetviewdistance [OBJECT,SHADOW]
because if someone 20-40 km farts every player "sees" that
Hello, I want to edit function of the spectator button (on the new respawn screen) can you point me to the right direction ? I suppose it would be tha same as editing functions of menu buttons, but did not find anything on that either.
ui_f.pbo
Something more, scripting for dummies level ?
you might find the respawn menu in there
Not sure...
I'd start by looking for it in the game files
@inland condor depends on what you mean by "edit"
That button is probably a config eventhandler.. you won't do much on that via scripting
hide the button, replace with your own.
Acts_UnconsciousStandUp_part1
how do i make a unit play this animation?
he does not move afther the animation finished
Is there a way to check for the existence of a script in a defined location and if it's not there shut down the server?
@tough abyss commands like execVM and spawn return script handlers, which you can use commands like scriptDone with and i believe you can check if it is running
civ_1 setFormDir (civ_1 getDir player);
this command makes the unit look at the player
but what about if there is 2 players?
@subtle ore how would I specify a script
@tough abyss filter it.
{
If(_x select 0 == "cookieHandler") then {
//Code
};
} forEach diag_activeSQFScripts;
@astral tendon in sp, the player is only the unit where you have selected as player, in mp it's any player that is local when executing the script
in this case
@tough abyss Use https://community.bistudio.com/wiki/scriptName, to specify the name of your script inside diag_activeSQFScripts
@little oxide absolutely no point. Diag_activeSQFScripts already returns the script name
scriptName:Β StringΒ - function or filename. Custom name can be set withΒ scriptName
scriptName would be for readability if anything in this case.
No dude, it returns something like this : [["<spawn>","",true,1]] when you spawning a script
Pls read the wiki before tell me something π©
if (isServer) then { [[this, selectRandom ["PRONE_INJURED_U1", "SIT_LOW_U", "PRONE_INJURED"],"ASIS"],BIS_fnc_ambientAnim] remoteExec ["call"] };
0 = this addEventHandler ["HandleHeal", {
[_this select 0, _this select 1, _thisEventHandler] spawn {
params ["_injured","_healer", "_EH_Handle"];
_startDamage = damage _injured;
waitUntil {damage _injured != _startDamage};
if (damage _injured < 0.2) then {
_injured switchMove "AmovPpneMstpSnonWnonDnon_AmovPercMstpSnonWnonDnon";
Sleep 1;
_injured call BIS_fnc_ambientAnim__terminate;
Sleep 1;
_injured setFormDir (_injured getDir player);
Sleep 2;
_injured switchMove "Acts_CivilTalking_2";
Sleep 4;
_injured call BIS_fnc_ambientAnim__terminate;
_injured removeEventHandler ["HandleHeal", _EH_Handle];
};
};
}];
the civilian will turn around and talk to the player
Roque please use the formatting with discord
Use code tags pls
how?
Wait sow how am I doing this?
Back ticks
` not '
Not quotes
0 = this addEventHandler ["HandleHeal", {
[_this select 0, _this select 1, _thisEventHandler] spawn {
params ["_injured","_healer", "_EH_Handle"];
_startDamage = damage _injured;
waitUntil {damage _injured != _startDamage};
if (damage _injured < 0.2) then {
_injured switchMove "AmovPpneMstpSnonWnonDnon_AmovPercMstpSnonWnonDnon";
Sleep 1;
_injured call BIS_fnc_ambientAnim__terminate;
Sleep 1;
_injured setFormDir (_injured getDir player);
Sleep 2;
_injured switchMove "Acts_CivilTalking_2";
Sleep 4;
_injured call BIS_fnc_ambientAnim__terminate;
_injured removeEventHandler ["HandleHeal", _EH_Handle];
};
};
}];```
You can also syntax highlight it
@tough abyss You want only need to find if the script exist inside a location ?
Yes
Hint "works!";
is this case, the civilian will turn around to the player that triggered the addEventHandler ?
This can be useful http://killzonekid.com/arma-scripting-tutorials-kk_fnc_fileexists/ @tough abyss But it's not working on dedicated because you don't have interface
HealSoldier action will move the player to the injured, so you can use that instead
i want to make this a little cinematic
the player heals the civilian, gets up, and thank him
How would it work on a dedicated?
and in some cases he will give a piece of info
@tough abyss you don't. Kk's method is based on creating controls, which has to have a display to make them on and a dedicated server has none
Including hc's
@astral tendon so what's the issue?
Instead of player use _healer
Okay, well. From what it looks like. The script checks if it's running on server, remotely executes the unconcious anim so that all players can see it. Then adds an event handler to execute code when the unit is healed. Checks to make sure the unit is above 0.2 in damage or it waits until. Hence the spawn.
Then moves the unit to the upright position, sleeps, looks at the player (setFormDir) and plays the civ talking anim
_injured setFormDir (_injured getDir _healer)
Yeah healer will be more accurate
And will allow for mp compatibility
Because it doesn't look like this is executed local to the player
Right, exactly.
good call, that works
writing code to return every magazine on a unit.... how do i return the current magazine loaded into a secondary weapon if it isnt the current weapon ?
Check their weaponItems? You can add magazines with that, maybe get them too.
primaryWeaponItems and its variants
Well primaryWeaponMagazine, and secondaryWeapon variants are good too
Let me take a far fetched guess.. https://community.bistudio.com/wiki/secondaryWeaponMagazine
I don't know.. It just came over me
Woah
Divine scriptervention
Hah π
thx for the feedback, i'll use weaponsitems, can grabn all muzzles from primary with that too, thx again
why cant they just have an Allitems unit, Allmagazines unit etc instead of having top piece it all together
Well yes. "Medkit" in (items player)
that doesnt do it all, stop being clever π
Waddya got these things bookmarked?
I can press CTRL+F
weaponSrate does π
there are a lot of ways to return the equipment a unit has but none of them do it well and completely
Hey that's cheating! @still forum
@slim verge You're either in it for one or get the lacking of another. π€·
weaponitems is not that good, instead of adding the second muzzle mag into the mag array (select 4) it adds another array as select 5, screwing things up from being nice n tidy, f****** BIS
and weaponstate doesnt cycle through all the possible muzzles, they have to be defined for each muzzle,
so you have to cycle through all the subarrays for weaponitems checking if the sub element is an array to catch all of them
: there are a lot of ways to return the equipment a unit has but none of them do it well and completely
that π¦
getUnitLoadout contains everything
thats true but its not final therefore not to be rel;ied on yet
i did look at that then decided against
It is in that exact same non final state since it was added
i havent checked it but, if u were to add a weapoon to the backjpack, how would that return it, doesnt state it in the wiki
just another inconsistency to code in and there is also an issue using ACRE, TFAR objects
how would that return it, doesnt state it in the wiki
diag_log it? Use the .rpt + setUnitLoadout to put it in? No clue where the Prob is
Really a shame setunitloadout etc doesn't work on vehicles/containers
Haven't seen you in a while, @jade abyss. How have you been?
π π
You missed a lot of good stuff @jade abyss
π€
If it's about Arma and scripting, i doubt it π
removing map objects that will not be part of the mission does increse perfomacy?
@jade abyss did you try this one?
https://community.bistudio.com/wiki/Arma_3_Actions#TakeMagazine_.2F_TakeWeapon
Yeah
not sure what you mean ^^
I assume you talk about the singleItem removal from a Veh/Container?
yes
As i mentioned before: Another Unit/Logic is needed (or needs to be created), blablabla, long story short: Just another Workaround (again)
yea, like usual arma scripting π
^^
Β―_(γ)_/Β―
like is the assignment one way...
I am just amazed right now...
I am waiting for arma to give me if(1=2)=false;if(2=1)=ture
Is it possible to check if a unit has fully unholstered a gun? Say for example you have a pistol out, then you switch to a primary weapon but I want to be able to detect if theyve fully switched to the new weapon
@warm gorge look around https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
it could be AnimDone EH, though, not entirely sure, haven't played with this.
what's a good way to get an AI unit to stay inside a building, at a window, facing outside?
@tough abyss it'd be actually nice to have some AI specific scrpt commands like searchForClosestWindow, closestDoor, etc. to which you could listen and then provide specific behavior or animations for the AI simulate after he found "it"
@tough abyss hahha, well, there was some refactoring for the AI, namely the driving, but that brought in new problems we haven't seen before and still yet to be fixed
in some cases, driving in OFP (a 2001 game...) is better than in A3, espeically when it comes to convoys and vehicles following each other
some say OFP's AI was "too simple", "too inflexible" etc. but who gives a shit when it works as expected and provides you with good results? f.e., simply arrives at a waypoint when being issued one as a convoy... π
@inland condor
how does that even happen ?
You made the mistake thinking that vehicle var names are unique. Multiple objects can have the vehicle var name "master_5", but the global variablemaster_5can only refer to one object. The editor name field sets the vehicle var name and the global variable. But during gameplay, more objects can take the same vehicle var name and the object assigned to the global variable with the identifier being equivalent to the vehicle var name can change. One example is simply respawning. Both corpse and new body hare the same vehicle var name, but the variable can only refer to one of them.
getAssignedCuratorLogic getAssignedCuratorUnit master_5_zeus
This ^ for example will report master_5_zeus correctly, because you don't lose information by relying on vehicle var names.
I'm trying to creat Zeus modules via script - I have an array of player UIDs and am creating a module for each one, with the module's owner parameter set via setVariable. It seems to work "sometimes" - it worked the first few times but it appears I've just broken something. Can someone take a look? https://gist.github.com/anonymous/ee1b4a3143058bd842070feae9559b2f
The modules appear to have been created based on the .rpt file, but I can't enter Zeus anymore
I guess placing eden logics is not a solution for you?
manually and setting their owner
I was hoping to automate zeus setup for all of my unit's missions via script, rather than updating the modules manually for each mission
the only possible solution I can think of is adding JIP to setVariables
but it's just a wild guess
Changed line 47 to: _curatorModule setVariable["owner", _x, true];
Still not able to enter Zeus
I guess one thing i left out is that there are a bunch of "No speaker given for" messages between my diag_log calls
I always ignored those errors whenever they came up tho, not sure if they matter now
@AGENT_STEELMEAT#4476 i prefer spawning curators directly instead of using the module
just good old createVehicle
with "curator_f"
zeusuids = [000, 000, 000, ....];
addZeusEH = addMissionEventHandler ["PlayerConnected", {
params ["_id","_uid","_name","_jip","_owner"];
private ["_cur"];
if !(_uid in zeusuids) exitWith {};
waitUntil {
sleep 1;
({_uid isEqualTo getPlayerUID _x} count allPlayers) > 0
};
_player = allPlayers select {_uid isEqualTo getPlayerUID _x};
_cur = "curator_f" createVehicle [0,0,0];
_cur addCuratorAddons activatedAddons;
_player assignCurator _cur;
_cur addCuratorEditableObjects [allMissionObjects "all",false];
_player setVariable ["cur",_cur,true];
}];
removeZeusEH = addMissionEventHandler ["HandleDisconnect", {
params ["_unit","_id","_uid","_name"];
deleteVehicle (_unit getVariable ["cur",objNull];)
}];
yup, much easier to work with the curator object directly
I'll make a gist out of this and I will not credit you.
if that pleases you, go ahead
@cunning nebula use
```sqf
...
```
next time for proper highlighting π
uuuh, fancy
if you think thats fancy, wait until sqf-vm gets support for those commands you just used there @cunning nebula
hehe can't wait to run ALiVE in sqf-vm π
callExtension is what i want to implement next
soooo ... thats gonna work actually
right now i have to do actual job related stuff
afterwards i implement the callExtension stuff
in case it's somewhat a reply to me, ALiVE only uses extensions to communicate with our server which isn't mandatory ^^
it was @halcyon crypt
and in any case, you always can raise github issues for things next to implement
otherwise i will just do it "nach gutdΓΌnken"
When I use helicopter1 action ["lightOn", helicopter1]; to turn an AI helicopter lights on, they turn on and then immediatly turn off, is there a way to keep them on?
AI needs to be in CARELESS, SAFE or AWARE (not sure about this one) mode to keep their lights on
He is on safe right now, I'll try aware
for ground vehicles anyway
you could try with https://community.bistudio.com/wiki/setPilotLight
that probably forces it
no the ground vehicles comment and the link aren't related to each other π
isLightOn helicopter1; in the watch field returns true although there are no lights .-.
oh nvm now it returns false
π¦
the IA dont wanna cross my bridge, is there a way to fix it?
Quiksilver and SuicideKing could tell you all about it Roque π
And how is that supposed to help?
It really doesn't
but I guess that's really the only way to force their ass over a bridge
i imagine how they make on the DLC a buldozer APC drive over a roadblock
possible
Good example is VCOM AI, all FSM scripts.
Over bridges
move in cars
use guns
etc
?
setDriveOnPath makes they ignore anything on the way
π€£
I think you have some pretty big misconceptions about what a FSM does.
Have you ever opened a FSM from Arma?
Yes I have
How would you implement "move around it" and why does this have to be done in a FSM?
doesn't have to be in FSM
if it won't go over, then it might as well go around the bridge
Yes, in fact, the FSM would make it more complicated than it has to be. While offering nothing.
Sure.
Why did you suggest it then?
Good question
π
then, you guys know the infanrty version of the setDriveOnPath ?
There's none.
@astral tendon @little eagle Play an animation on AI and execute the same anim with a EH AnimDone for X times or while measuring the distance to your destination and terminating the anim loop when distance is less than Y?
ofc, this is just for making AI walk straight and ignore any surroundings. that's all you can do with a forced anim. ( I suppose )
How about setVelocity :P. Like those boosters on a pinball machine.
or check if any players are looking at the bridge and if not, simply teleport the AI across. π
there is an unlimited amount of silly solutions
just no proper one
BIS_fnc_unitPlay/Capture?
I guess just making them walk straight withing the boundaries of the bridge should be enough. Like Inleso said.
hmm maybe if we write a function to force-move a soldier from point a to point b in a straight line
perhaps with some interruptions to let them look around or a few other animations mixed in
could be good enough
Ingame config viewer.
CfgVehicles
muzzles[] array. May be located in the turrets/turretX subclass for turret slots.
This is better with an example...
class CfgVehicles {
class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F {
class Turrets: Turrets {
class MainTurret: MainTurret {
weapons[] = {
"autocannon_40mm_CTWS",
"LMG_M200_body"
};
class CfgWeapons {
class autocannon_40mm_CTWS: autocannon_Base_F {
muzzles[] = {
"HE",
"AP"
};
B_APC_Wheeled_01_cannon_F/Turrets/MainTurret -> weapons[] "autocannon_40mm_CTWS" -> CfgWeapons -> muzzles[] "HE"
jesus crist, the conig view is a mess
Yes, but don't complain to me about this.
Anyone know if the ondisconnectevent fires on loosing connection and alt f4ing?
handleDisconnect*
It triggers for everything, including going back to lobby
Its server event, it doesn't matter how client left the game, even if they smashed their PC with a hammer
If client left, it will fire
hahaha Okay mate thanks
@grizzled spindle no it will not fire before they leave and no, this will not solve any of your problems.
Only thing it's useful for is keeping logs, doing shit that keeps track of players and notifying others when they leave. Not for interacting with their player data etc.
handleDisconnect is more useful for most these things
this setskill ["general",0.01];
i can put a number bellow 0.1 or even 0 and still counts?
@rotund cypress Its for removing containers from the house. Using the uid which is passed by the event to query the db to get their containers to delete em
I suppose it's an alright event for that purpose.
@grizzled spindle HandleDisconnect supposed to handle player unit depending on event returned value, be careful not to get unexpected result like player unit turning into AI
is there a command to make a AI turn out?
i found it
TankOne action ["TurnIn", TankOne];
@astral tendon
player action ["TurnOut", vehicle player];
π
π€¦
i just put that on the unit init and works
but the unit init? Why?
Is it possible to selectively share tasks using the shared objectives system? Or am I going to end up basically re-writing it
why not?
Looking for a admin script that can zeus and bans/kicks or even IP bans.
Dose anyone know of a script that can do that?
@winged narwhal Not that I know of,
you can't get the IP of a player.
Intercepting IP's would require a DLL
I know theres a script out there th blocks players from rejoining after baning
thats called being banned?
u can ban a playerid with servercommand if thats the kind of thing ur after.
BE handles banning
BE?
Battle eye. [sic]
ok
hmmm
case 0: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\useBlacklist.sqf";};
case 1: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\custom.sqf";};
case 2: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\killahpotatoes.sqf";};
case 3: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\rhsusaf.sqf";};
case 4: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\rhsusaf_ace.sqf";};
case 5: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\rhsusaf_ace_acre.sqf";};
case 6: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\3cbBAF.sqf";};
default {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\useBlacklist.sqf";};
Terrible @little eagle
Wouldn't it be easier to just wrap it into 1 function.
?
diag_log "Initializing arsenal presets [START]";
[] call compileFinal preprocessFileLineNumbers "scripts\client\misc\init_markers.sqf";
switch (KP_liberation_arsenal) do {
case 0: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\useBlacklist.sqf";};
case 1: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\custom.sqf";};
case 2: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\killahpotatoes.sqf";};
case 3: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\rhsusaf.sqf";};
case 4: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\rhsusaf_ace.sqf";};
case 5: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\rhsusaf_ace_acre.sqf";};
case 6: {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\3cbBAF.sqf";};
default {[] call compileFinal preprocessFileLineNumbers "arsenal_presets\useBlacklist.sqf";};
};
diag_log "Initializing arsenal presets [END]";
diag_log "Initializing markers and UI manager [START]";
if ( typeOf player == "VirtualSpectator_F" ) exitWith {
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\markers\empty_vehicles_marker.sqf";
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\markers\fob_markers.sqf";
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\markers\group_icons.sqf";
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\markers\hostile_groups.sqf";
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\markers\sector_manager.sqf";
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\markers\spot_timer.sqf";
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\misc\synchronise_vars.sqf";
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\ui\ui_manager.sqf";
};
This is the init_client.sqf
Hang on.
I'll pastebin it
Long ago I did change a function in I&A which was used to generate missions from
[] execVM "some mission" to
_handle = [] spawn (missionNameSpace getVariable "mission_type")
where mission type was defined by GG_fnc_missionName1, etc
mission_type = ["GG_fnc_mission1","GG_fnc_mission2"];
etc
Then just compiled the strings
To work as a dynamic script
At least replace the compileFinal with compile or something.
All I see is patterns and a wall of text. At least it uses ofpec tags.
I know exactly how to change that easily.
["preset name"] select index == preset
then just feed that into the compileFinal ProcessFileLineNumbers;
This way it only needs to process a single index
Not an entire switch
I agree with this conceptually, but in contrast to other members of this channel, I think that optimizing something so minor like this after the fact is pretty pointless. I guess you can still do it because you want to learn? If so then go ahead and try what works best for you.
preset_choice = ["arsenal_presets\useBlacklist.sqf",
"arsenal_presets\custom.sqf",
"arsenal_presets\killahpotatoes.sqf",
"arsenal_presets\rhsusaf.sqf",
"arsenal_presets\rhsusaf_ace.sqf",
"arsenal_presets\rhsusaf_ace_acre.sqf",
"arsenal_presets\3cbBAF.sqf",
"arsenal_presets\useBlacklist.sqf"];
get_preset = [] call (compileFinal preprocessFileLineNumbers (preset_choice select KP_liberation_arsenal));
No more switch
Preset choice is run once
@little eagle
Now it doesn't have to search through each line
Yes, the formatting sucks now though. And it should be a local variable. And use compile...
No, the formatting sucks, because it does
private _preset = [
"arsenal_presets\useBlacklist.sqf",
"arsenal_presets\custom.sqf",
"arsenal_presets\killahpotatoes.sqf",
"arsenal_presets\rhsusaf.sqf",
"arsenal_presets\rhsusaf_ace.sqf",
"arsenal_presets\rhsusaf_ace_acre.sqf",
"arsenal_presets\3cbBAF.sqf",
"arsenal_presets\useBlacklist.sqf"
];
[] call compile preprocessFileLineNumbers (_preset select KP_liberation_arsenal);
There. It makes it so much more readable for so little effort.
Use a for loop?
No, that has nothing to do with formatting. Formatting is just how you apply spaces and newlines to your file.
Thats what the pastebin had commy
No, the whitespace is vastly improved and I reduced it somewhat.
How much white space should I use at most?
Uhm, as much as needed and as little as possible?
Okay, question. You do see the difference between:
preset_choice = ["arsenal_presets\useBlacklist.sqf",
"arsenal_presets\custom.sqf",
"arsenal_presets\killahpotatoes.sqf",
"arsenal_presets\rhsusaf.sqf",
"arsenal_presets\rhsusaf_ace.sqf",
"arsenal_presets\rhsusaf_ace_acre.sqf",
"arsenal_presets\3cbBAF.sqf",
"arsenal_presets\useBlacklist.sqf"];
and:
private _preset = [
"arsenal_presets\useBlacklist.sqf",
"arsenal_presets\custom.sqf",
"arsenal_presets\killahpotatoes.sqf",
"arsenal_presets\rhsusaf.sqf",
"arsenal_presets\rhsusaf_ace.sqf",
"arsenal_presets\rhsusaf_ace_acre.sqf",
"arsenal_presets\3cbBAF.sqf",
"arsenal_presets\useBlacklist.sqf"
];
Right? And I don't mean the variable name or the private.
And which one is nicer to work with?
Do you understand what I mean by "formatting"? Because I'm not sure you do or if I can explain it to you any differently.
The amount of indentation and alignment also known as style in C?
Yes. And there is no attempt at aligning in your example.
You're still asleep or something? ^^
Tabs are bad.
You can use spaces and it'll align in any program / on github / in any chat and for every user.
Until the day comes everyone can agree with one tab size: spaces > tabs.
How many spaces?
For SQF? 4
It depends on the langue and how many indentation layers you can expect.
Now also make it auto replace them with 4 spaces.
In ST3 it's called "Indent using Spaces" and it replaces any key press of Tab with 4 spaces instead of the tab char.
yeah thats what it is set to
Tab Length: Number of spaces used to represent a tab
4
Default 2
@tough abyss That script looks like some idiot got told that call compile preprocessFileLineNumbers is better than execVM... And then he heard elsewhere that compileFinal is more secure.. So that asshat of an Idiot assumend combining them both and replacing all his execVM's would make his scripts better
Agreed ^.
VBS recommends using call compile preprocessfilelinenumbers over execVM
Officially isolated the error to 1 file
yeah thats what it is set to
Tab Length: Number of spaces used to represent a tab
4
Default 2
That is not what I'm talking about.
There's a difference between how long your editor makes a tab and if it replaces the character entirely.
exactly.. So why are you using compileFinal if it tells you to use compile?
Also.. Instead of all that crap... use CfgFunctions for all your functions.. and just call the function.
Not my code @still forum this is a popular mission.
I am free to re-write it if I want to though.
It's MIT Licensed
Somewhere in here is the error
re-write it properly then.. If you already start with it
Btw in this case.. If the script is called once.. ExecVM is just fine
What is the error?
I just read all messages again I cannot find a mention of an error
Nope I've found the actual file
Thats causing it
Bad conversion: bool
Over and over
I know what it is.
"
if ( isText( _x >> 'Item' ) ) then {
_virtualItems pushback _configName;
};
" configClasses _this;
This reports the array index from pushBack, but configClasses expects a boolean.
This is why rengineering the wheel can be a good thing..
{
if ( isText ( _x >> 'Item' ) ) then {
_virtualItems pushback _configName;
};
} forEach ("true" configClasses _this);
This is the proper way. I guess they're trying to save looping through the array once... But they're probably wasting more time with the write to file operation of the error than they save...
_virtualItems append ("isText (_x >> 'Item')" configClasses _this);
There. Perfect, no error and faster.
No, replace what I posted from the code with what I posted last.
And do the same for the other loop. Can't be arsed to do it myself.
Any way to stop lights from flickering?
As in, I want 100 lights, but only 10 emit light at a time
2 letters
;'(
I don't think lights cause any performance issues, because they don't even cast shadows
lighjts flicker like crazy π¦
@little eagle This stuff is alien to me never worked with traversing configFiles
My favourites. : )
I mean I know they're a tree data structure
Just never had to work with them.
They look kind of messy.
And the scripting around them is full of pitfalls. Could write a short book about all the quirks and issues.
@peak plover I think lights have a hardcoded limit or something
but I don't think you'd normally need 100 of them
They flicker in normal towns, ultra should have no limit, it should be ULTRA
@little eagle talking about configs and shitty interactions some commands have?
eg. that select cannot get inherited properties?
just like count wont count inherited
If you know how the backend works then that behaviour is logical.
a config class has a list of entries and a pointer to it's parent..
ofcause count only goes through list of entries. and ofcause select does the same
thing is more: there is no special command to get the count including hirarchy
and i also just wanted to give some examples π
Hello does anyone know if this works for a synched timer solution ?
TimeServer < Param select 0
Or TimeServer < 10000 what ever lol
for all those interested folks, sqf-vm project now has its own discord https://discord.gg/vpdwJtG
The Biki isn't clear on how TimeServer works
Never heard of TimeServer
@quartz coyote did you mean serverTime?
and Param select 0 is also not really correct syntax
@quartz coyote serverTime returns the amount of seconds since the server application started and loaded everything necessary to run
It doesn't reset when the server changes the missionfile that is being played
Yes sorry for the syntax I'm at work @compact current @still forum .
Ok so it can't be used like this.
I'm actually using time < (match duration time chosen by admin)
But at the end on mission, some players have 15s ahead or late from others
I'm trying to synch all this
You can store the serverTime at missionStart from serverside and pvar it to the clients I guess
but the serverTime wiki page says there might be problems with that
Or..
you just run the script on the server instead of the clients
the server only has one clock
Mmmh... I've put a while {time < 10000} do {
sleep 1;
};
In the initServer.sqf.
If I but and [] execVM "outro.sqf" after that will it executives the Outro for all players at the same time or is execVM only for local execution ?
Could you give me the syntax ? No trace of it on the BIKI
I mean to remoteexec a execvm
"outro.sqf" remoteexec ['execvm',-2]
Awesome ! Thanks a lot
while {time < 10000} do { sleep 1; };
I don't think I ever saw a piece of code that brain-limited
sleep 10000;
Your script runs right at missionStart anyway.
I put 10000 as an example dude. I'm at work and on my phone I don't have all the data in mind. No brain limited in here. Only no can't do situation. Bye.
the 10000 has nothing to do with this. And you seem to have known that sleep takes the number of seconds to wait.. As you just wrote that in your code.
private _tmp = 10000 - time;
if(_tmp > 0) then { sleep _tmp; };
why _tmp? Also you don't need >0 check. sleep ignores <=0
In my situation, I replace 10000 by a user or admin chosen data. Selected from the user params at mission lobby.
Doesn't change what I said. As I said. the 10000 is not the problem
He's saying, a while loop to check time and then sleep is stoopid
Which; it kinda is
So you suggest I but a
Sleep (user defined time);
exactly
was not sure about that @still forum
thats why π
That would delete a loop I understand
could also have resulted in script warning stuff like sleep -1
never used negative values in there ...
You know how long you have to sleep for.. When you go to bed at night. you set your alarm clock to wake you up in 8 hours...
Setting your alarm clock to wake you up in 5 minutes so you can check the clock.. notice it's not time yet.. and then go to sleep to be woken up again in 5 minutes and repeat that till the 8 hours are over.
That's just idiotic.
sleep (MY_SPECIAL_VALUE - time)