#arma3_scripting
1 messages ยท Page 429 of 1
If the array length isn't exactly 2, it'll error
but are those actual errors? or does script execution continues?
2 expected, X provided
If the array doesn't have 2 elements it will return Nil.
If first element is not a string it will return nil.
For objects!
The function will not be compiled, X39. Nothing of the script will be executed.
Groups, Namespaces, others can be different
No line before, no line after.
not compiled? wut?
no ... do not say the behavior is different for objects and namespaces and...
what have i gotten myself into ...
missionNamespace getVariable []; or any other incorrect argument will error and return Nothing
i rly need a new HDD ... ever since my old one broke, i have no room for frking arma
if it aborts the script, that is enough for me @still forum
i won't return nil for the lulz ๐
or maybe nil. they're reported the same, haven't checked
Many different types have different getVariable functions
so how much do you trust BI that they do the same thing in each of them?
_a = missionNamespace getVariable ["foo"]; // Error 1 elements provided, 2 expected
isNil "_a"```
`true`
... uhm ...... ye .......... not a single bit @still forum
_a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10]; // Error 11 elements provided, 2 expected
isNil "_a"```
`true`
missionNamespace setVariable ["foo"]; //Arraysize != throws "expected 2..." error
missionNamespace setVariable "foo"; //That command doesn't exist.
missionNamespace setVariable []; //Arraysize != throws "expected 2..." error
missionNamespace setVariable [1, "foo"]; // type is not string. throws type error
DISPLAY getVariable [varname, default]
used to return nil even though a default was provided if the variable was defined previously and then set to nil later.
wait ... it is an actual size != 2 check @compact galleon ?
set variable always says "expected 3, got X" even though it could work with 2.
It should work with 3 if the third one is true though.
and they always abort script execution?
getVariable doesn't
Oh, ok. Sorry.
setVariable (object. Others are subject to BI's consistency)
if arraysize== 3 and array[2] not a bool then throw type error and return nil.
if arraysize!=2 throw "expected 3, got x" error and return nil
If array[0] not a string then throw type error and return nil
getVariable (object again)
if arraysize!=2 throw "expected 2, got x" error and return nil
if array[0] not a string then throw type error and return nil
all aborting errors i guess?
errors are errors. I guess they abort yeah
https://pastebin.com/67zsjJQw this is what i got now, anything i forgot?
non-aborting errors are warnings for me
I think every error aborts the script aka skips to just past the last instruction and then returns
Or.. It aborts the whole script instance
nah, there are also some commands where script execution continues
example?
is the first that comes in my mind
but there was some other too
think it was private ... but not sure right now
That set's an error just like the others. So it should behave the same
It does not interrupt the script execution.
Test scheduled vs. unscheduled.
now, the same for object
no
no!
there is no difference between scheduled vs unscheduled
!!!
please no
Well, there are plenty already without this specifically.
_a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10]; // Error 11 elements provided, 2 expected
isNil "_a"
But this reported true.
No, error, but it continues and makes the command report nil.
0 spawn {
_a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10];
isNil {
systemChat str [_a];
};
};
I wonder if this prints [any] or not though (besides the error).
i do not understand anything now anymore
SQF
Don't expect EnScript to be any better though. ยฏ_(ใ)_/ยฏ
i do expect a lot from enscript
and i still do not understand now ...
is getVariable with > 2 elementsi n the array now returning the correct item or nil?
and does not continues
Apparently it does continue, at least in unscheduled.
๐ฟ
_a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10]; // Error 11 elements provided, 2 expected
isNil "_a"
^ That continues no matter the context
This will write true.
No error is ignored in scheduled.
0 spawn {
_a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10];
isNil {
systemChat str [_a];
};
};
@compact galleon Tried this?
OMG this is a mess.
If there is a command exception waiting while you throw in a try/catch block or if you use breakTo/breakOut then it will kill the script instance.
Otherwise the error is just shown and doesn't kill anything
?????
Exactly my thoughts
no, i do not understand what you mean by that
errors cannot be catched by try catch when they come from SQF itself and not from throw
The error message itself generally doesn't kill or stop the script at all
exactly
command exception != SQF throw command
@little eagle true
that is why i said there is warning and error
Thanks, Mulle.
systemChat str [_a]; prints <null>
but if there is a unhandled exception while you execute a throw/breakTo/breakOut it will kill the entire script instance
Well, [<null>]
that is known @still forum
right
With brackets.
0 spawn {
_a = missionNamespace getVariable ["foo",1,2,3,4,5,6,7,8,9,10];
_a;
systemChat "works";
};
I wonder if maybe using undefined variables in scheduled environment ends the script prematurely.
Well, errors alone don't end them at least
Yep. But this is a special kind of error.
Eh
Because without the spawn, this would work fine. Aside from the error in L1 of course.
Works both with and without spawn
Should print "error undefined variable in expression" though with spawn.
But you don't use the variable
And?
Ah yeah. forget that
Thought it would be so intelligent not to notice if you don't use the variable at all
It would be great it it were valid syntax.
Doesn't print undefined with or without spawn, because the "expected 2" error overshadows it
It only prints the first errors, the rest are not displayed
Oh, interesting.
Nil variables don't actually kill the scheduled script?
Apparently not.
terminate
Always thought it kills them
Same.
Well an unhandled exception in a throw/breakOut/breakTo terminates a script.
Although I usually just fix the error and not bother testing further.
Scripts probably just seem to terminate because only the first error is printed, and the rest of the commands are executed and do nothing because they also have errors due to the first error
Eg. sqf _special = missionNamespace getVariable ["special", "NONE", 1337]; _vehicle = createVehicle ["B_LSV_01_unarmed_F", getPos player, [], 0, _special];
Will errror on getVariable, and then createVehicle will error because _special is nil and won't create the vehicle. But won't show an error because of the first error
Agreed, seems likely.
Append
hint format ["Vehicle: %1", _vehicle];```
And it'll print Vehicle: <NULL-object>
All is executed
I wonder if in scheduled environment, another error will be shown if the first one disappeared. Like when you use a long sleep.
I think errors are printed if you suspend
0 spawn {
missionNamespace getVariable ["special", "NONE", 1337];
sleep 20;
missionNamespace getVariable ["special", "NONE", 1337];
systemChat "end";
};
Like if this shows both errors, because the first one already faded.
Or maybe on scope end? I guess I'm too tired for this
It doesn't even print any subsequent errors to the RPT
14:25:27 Error in expression <0 spawn{
_special = missionNamespace getVariable ["special", "NONE", 1337];
>
14:25:27 Error position: <getVariable ["special", "NONE", 1337];
>
14:25:27 Error 3 elements provided, 2 expected```
That's all
"end" in chat?
end of scope
Is that a yes or no?
@little eagle No, he's talking about when scopes end
@still forum Yup, it's 1 error per scope
14:28:15 Error position: <getVariable ["special", "NONE", 1337];
>
14:28:15 Error 3 elements provided, 2 expected
14:28:15 Error in expression <SV_01_unarmed_F", getPos player, [], 0, _lol];
hint format ["Vehicle: %1", _veh>
14:28:15 Error position: <_lol];
hint format ["Vehicle: %1", _veh>
14:28:15 Error Undefined variable in expression: _lol
0 spawn
{
_lol = call
{
_special = missionNamespace getVariable ["special", "NONE", 1337];
_special;
};
_vehicle = createVehicle ["B_LSV_01_unarmed_F", getPos player, [], 0, _lol];
hint format ["Vehicle: %1", _vehicle];
}```
Well, you have your work cut out for you, X39.
wondering right now, https://community.bistudio.com/wiki/exitWith Exits current scope {...} it is executed from if condition evaluates true, creates new scope {...code...} and executes the given code in it.
so ... ```sqf
private _foo = "bar";
if true exitWith { isNil "_foo"; };
would this return `true` now? according to wiki, it should
cannot remember as i barely used exitWith
It'd exit with false.
It executes the code in a sub-scope meaning _foo carries over. And then returns whatever value is on the stack when the exitWith code is over
cannot remember as i barely used exitWith
You've been scripting for this game for at least 5 years.
and when i use exitWith i literally use it with empty {}
to ... well ... exit the scope
and is arma 3 rly already 5 years out? man ... i get old
2013
Last I looked at the wiki page for exitWith it had a note saying using it in a script had undefined behaviour
As in, the initial scope in a script
But it never had any ill-effects for me
And the notice is gone
Well, if you use it in handleDamage for example, the return value is ignored.
Unless you wrap it in a call. I guess that is what is meant.
flashbacks to arma2 when all scripts you downloaded ended with if (true) exitWith {};
@little eagle wut?
but that would remove the effect of the exitWith
xD
wait
o.O
Maybe I need my caffaine
But
hint call { if true exitWith {"LOL"} }```
I'd expect that to print LOL ?
So exitWith doesn't return it's value?
it does
'cause it returns nil
It should print "LOL".
what?
This is a unary call.
what does this output?
i need alcohol to compensate this
And expected it to output "LOL"
Obviously that'd PRINT "LOL", but output nothing
lol
Phew.. My faith in reality restored
As expected.
SQF;0;41;hint call { if true exitWith {"LOL"}; }
UNARYEXPRESSION;0;39;
UNARYOP;0;4;hint
UNARYEXPRESSION;5;34;
UNARYOP;5;4;call
CODE;10;29;
BINARYEXPRESSION;12;0;
UNARYEXPRESSION;12;7;
UNARYOP;12;2;if
NULAROP;15;4;true
BINARYOP;20;8;exitWith
CODE;29;7;
STRING;30;5;"LOL"
-------------------------------
[HINT] LOL
[WORK] <NOTHING> nil```
WORK is the return value?
that is whatever is left on the varstack
thus, yes
SQF;0;3;1
NUMBER;0;1;1
-------------------------------
[WORK] <SCALAR> 1.000000```
Hm? What tool is that from?
Oh, where can I get my hands on that?
there is a bot in there
that is still on the c branch
but that will change soon to the cpp branch
has no sqf-AST printing though ... that is special to the cpp branch right now
in case you are just interested in the AST generation, i can provide you a special build doing just that
@queen cargo If you think you've got your work cut out for you with the error checking
hint str damage player;
Shows the damage of the locally controlled player unit converted to a string in a hint.
I might have to rethink this tool, lol
not sure what you mean by that
should work fine and print whatever dmg the player has rightnow
ahh
And it's probably too much work in the end xD
explaining all code? yes
Can it automatically generate comments that comment each line of code and explain what it does? ๐
hint (if true then { "foo" }) @compact galleon
@still forum sqf if (alive player) then { hint ("You're alive! Your damage is " + str damage player); } else { hint "You're not alive!"; };
1: Shows (the damage of the locally controlled player unit converted to a string concatenated to the text "You're alive! Your damage is ") in a hint.
If NOT the locally controlled player unit is alive, executes the following code block:
1: Shows the text "You're not alive!" in a hint.```
@compact galleon this here is right now my work schedule https://docs.google.com/spreadsheets/d/1smu1vn9a8uiatg8RMSiOsuWOdOTqOD0Hhyxptm3Jzxo/edit#gid=0
need to get all of them done so i can replace the c branch of sqf-vm
soooo ... just in case you are bored: https://github.com/X39/sqf-vm/tree/cpp
@compact galleon
fullCrew vehicle _unit select {(_x select 0) isEqualTo _unit} param [0, [nil, ""]] select 1
How does it try to explain this one?
BOOOOOOOM
It's assignedTeam _unit, except that it doesn't break when the unit is inside a group with AI as leader.
Pardon, assignedVehicleRole, not team.
@little eagle I haven't updated it in a long while
It doesn't even know fullCrew is an operator
And it doesn't really "explain" as much as it converts to english
@queen cargo hint (if true then { "foo" })
1: The text "foo".
) in a hint.```ยด
acceptible
not good, but acceptible
I justed wanted a long and convulted sentence.
hint str str str str str str str str str str str str 1337;
1: Shows the number 1337 converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string converted to a string in a hint.
hint str (1+2+3+4+5*2);```
`1: Shows (the number 5 multiplied by the number 2 added to the number 4 added to the number 3 added to the number 2 added to the number 1) converted to a string in a hint.`
That's not really convoluted. Just long and repetetive.
@queen cargo does sqf vm handle array locality in the same way that arma does?
mhh?
In arma, arrays are storied in their own location in memory, this location doesn't change as they are passed to and from threads and methods. Only with _arr = +array; is a new location mapped and all the values cloned.
_arr = [0];
_arr2 = _arr;
_arr2 pushBack 1;
diag_log [_arr, _arr2] //[[0.000000, 1.000000], [0.000000, 1.000000]]``` you mean this?
if you could make that example a lot simpler so i do not have to read through lines of code in a pic, that would be nice
but i guess my example also covers what you were talking about if i understood your comment correctly
C branch does the same
@little eagle sqf hint ("Vehicle: " + str createVehicle ["B_LSV_01_unarmed_F", getPos player, [], 0, "NONE"]);
all variables are handled as reference
thus, the answer is yes
1: Shows (a new vehicle of type "B_LSV_01_unarmed_F", spawned at the position of the locally controlled player unit converted to a string concatenated to the text "Vehicle: ") in a hint.
Every datatype has their own pool allocator and thus stored in different locations.
You mean that arrays are passed by reference instead of copied
And all other variables are also passed as reference
You just can't really edit something inside them as in an array
@still forum Thanks & @queen cargo sweet, I'll check it out later today then, seems very useful
Could theoretically do the same with every other datatype. But people would just be even more confused if you could edit numbers by reference
will now implement the mess that switch do case default : is
you do not edit the number itself
you are not editing the number itself though
as no command is editing existing numbers
unlike commands for arrays
god forbid that pushBack would create and return a new array each time
I never tried to make a increment/decrement command because I always thought I'd need the variable name. But if I edit the number by reference then I don't need the varname.
could somebody check what happens if only case 123 is executed outside of a switch?
iirc should return nil and not error
++_i
the inc command?
I thought it might error if ___switch is undefined. But it doesn't even check that
It statically casts the pointer of the data in the game value to a switch data. And then reads from the pointer
without even checking if it's a nullptr
It'd need the name, or need to be a special construct like =
also not sure what exactly case 123 is returning
it returns SwitchType
case returns the value inside the ___switch variable
then used as left argument to :
default checks if ___switch is nil and returns Nil if so.
But : and case don't even check for nil and grab the raw pointer
Foreign Error well, that's new
Error Foreign error: Unable to evaluate switch block
:D
Atleast no crash...
@compact galleon i remember that
spoiler there is more where that came from in the switch construct
Probably
Haven't checked how the whole thing works entirely yet
Except changing ___switch
switch 0
{
___switch = switch 20;
case 20:
{
hint "LOL";
};
};```
Not sure how they handle fall-through cases yet, though
there are non iirc?
crap ...
i see
there are
more is explained here. https://foxhound.international/arma-3-sqf-grammar.html
how default was handled is more funny though
That's what I was expecting. Just wasn't sure where it stored the flag
woah
I crashed it
great
with?`
switch 0 do
{
case 0;
___switch2 = ___switch;
};
switch 0 do
{
___switch = ___switch2;
case 45:
{
hint "LOL";
};
};```
oh
shit
forgot to define ___switch2 outside the switch
You've set ___switch to nil
but why does it crash in your example. But not if you execute case 45 by itself where ___switch is also nil
what?
when you got that Foreign error. You just executed a case right?
case 45 will refuse to work outside the scope created by switch do
Yeah. I'd have thought it checks if ___switch is undefined and errors based on that
One of the changelogs says that it does
It errors and doesn't crash.
In your example ___switch is also undefined. But in your example it crashes instead of just erroring
Fixed: CTD when ___switch is nil
Dec 8, 2015
There. Now it prints LOL ```sqf
___switch2 = nil;
switch 0 do
{
case 0;
___switch2 = ___switch;
};
switch 0 do
{
___switch = ___switch2;
case 45:
{
hint "LOL";
};
};```
i would guess that ___switch is not set to nil but rather deleted completly at the end
thus making the ___switch2 not a nil but rather a dead pointer
Well, yeah, normally. It's stored in the scope created by do
which leads in access violation
All types are refcounted though. You'd have to really really want it to do such a thing
Can't find any deliberate deletion of that. It just goes out of scope and get's left to refcounting
switch 1 do {
default {1};
default {2};
};``` what about this?
What about it?
what happens here
do returns 1
: and default breaks out of the scope after executing the codeblock
switch 1 do {
default {1};
case 1 : {"will execute"}
};```
I see
Judging from the wiki, default doesn't do anything but store the code block passed to it somewhere, and do will execute that if no case has matched
Judging by The default block will be executed only if no case matches, no matter at which position inside the switch it is. It is not a case, and will never be entered by fallthrough.
question was more related to will a second default override the last one
you tested?
yes
switch 1 do { default {2}; default {1}; }; returns 1
switch 1 do { default {1}; default {2}; }; returns 2
kk
i think i have the switch now perfectly covered in the c++ branch
now to test those idiotic cases
yup
got it covered fully
https://github.com/arma3/arma3.github.io/blob/9af929b2b57b5c2a3152e7dde4a3c93a3c954f6f/_posts/2018-01-21-ITE-the-scheduler.md First try. Not someone make that pretty ๐
Now dedmen just needs to get some good writing skills.
Including punctuation
:D
Just before the sorting a Timer was started doesn't read well
I'm used to arguing with people in here using short text messages
Yeah. I wanted to write the timer before that.
Just before the sorting, a Timer was started **
I tried to put everything into chronological order as the engine does it. But I only thought about the timer after I wrote the first paragraph
Really? ๐คฆ Well. I did that wrong my entire life except when I was too lazy to use '
it's not its
timer/time classes or something?
its does not exist.
why capitalized
i'll do a full review @still forum
@lone glade Are you trolling, or just ignorant?
It's is a contraction of it is
Its is possessive
Wait with the review like.. 10 minutes atleast till I fixed up parts
that's why you use the apostrophe
No, if you use apostrophe it becomes it is
@compact galleon... maybe go back and read?
its DOES exist
In that case its is correct.
scheduler ends its cycle it ends its cycle and not it ends it is cycle
it is not a cycle. It ends the cycle it possesses
its doesnโt exist? ๐ค
Its does exist, @cedar kindle.
And I'm ready to go sleep again
I completely forgot about possession...
...
Its is possessive.
i know lol
indeed, mybad ๐
timeing ๐
timing
Yea, no shit
Updated it. There is still no real layout in there. And it ended up shorter than I expected.. Turns out the scheduler is easy ๐
I missed my bus... ๐
I'll get a grammar / spell check plugin...
isn't the organisation name somewhat not a good thing?
True.
Commy didn't want me to just write "Arma 3" because that could make it look official.
So I just turned it into something unofficial looking
Organization name?
at first I thought BI started something on github ^^
arma3 name was used by some exile guy that never did anything but register and fork a exile repo. So I asked github to delete his account and free up the name
Those commas
(โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
you mean there's none? huehuehue
Also sometimes you use the Oxford comma and other times you don't.
Just spam me with comments on that PR ๐
It's my first blog post. I'll learn. But I have to catch my bus in 4 minutes and I'll make sure not to miss it again
nevermind found them, yep.
Oxford comma?
I prefer the oxford comma
but this:
A SQS script will execute until it, is done, suspends, or after it executed for a total of 3ms. If the 3ms limit is reached it will be forced to suspend.
Oh.. If I used oxford it was a mistake
I had a brain aneurysm reading this
Shouldn't be one there
Yeah @lone glade thatโs what I was about to paste
But if you prefer then I'll keep that. In German it's usually left out
Also spell check
I should probably stay with ranting at random people in chat rather than writing blog posts ๐
Ofcause
Yeah I got myself a spell check extension
now
But I need something that checks commas too
I'd prefer a list instead of enumerating them like that
Well, without the Oxford comma you might end up conveying the wrong thing
We invited the strippers, JFK, and Stalin. << You're inviting strippers, and jfk and stalin
We invited the strippers, JFK and Stalin. << you're inviting two strippers named JFK and Stalin
I love oxford comma examples, they're just glorious
oxford commas are the truth
canโt believe school taught me the wrong way
If you're stupid, say 'phone'
phone
:D
;0
The highlights of his global tour include encounters with Nelson Mandela, an 800-year-old demigod and a dildo collector. << haha, the lack of Oxford comma makes Nelson Mandela a dildo collector
Personally, I actually hate the Oxford comma. I write my sentences to not be ambiguous instead
If I was writing a script to climb onto or over things, would cursorObject or another command be better to start with? I'm looking for one that would find the height of the object a player was looking at?
you could find some inspiration from ace https://github.com/acemod/ACE3/tree/master/addons/movement/functions
e.g canClimb
@cedar kindle, thanks! Will give it a look.
does someone know how to make a listbox scrolling horizontally?
not in the original way up down
@still forum Hahaha
ofcause of cause is ofcause wrong
of cause is also wrong
it's of course
xD
it must of bin an exhaustion error, rather then incorrect grammer
incoming flaming in 3, 2, โฆ
๐
is it possible to determine server side whether a player is outside a certain distance from a marker, as player is null for the server?
@tough abyss search for units near the marker position.
hmm AllUnits then?
AllUnits, allPlayers , playableUnits, ... depends on what you need. for MP playableUnits should do.
( if(_x distance2D _base > 1500) then { exitWith{ null = call tag_fnc_some_nifty_function; }; }; ) forEach playableUnits;``` would only call the function *once* when it finds its first victim and then skips the rest right?
iirc it does.
great, thanks!
np o7
@tough abyss
{
if (_x distance2D _base > 1500) exitWith {[] call tag_fnc_some_nifty_function};
} forEach playableUnits;
i didn't read correctly lol
Yeah, no need to do if()then{exitWith{};};.
also () forEach won't work ^^
yea you're right, point was the exitWith ๐
Any reason why disableUserInput false; works when in same if as disableUserInput true; but not if outside? I'm 100% that this block of code with it is firing.
@shadow sapphire
Something that takes places like Feres and Oreokastro and makes it look not like a ghost towns, but for the whole map.
Warning: test it for small map like Stratis! ๐
0 spawn {
(nearestObjects [getArray (configfile >> "CfgWorlds" >> worldName >> "safePositionAnchor"),["House","Building"], worldSize]) apply {_x setDamage 1};
};
@meager heart, that would be much easier than the way I'm doing it, but I don't think that will work. I will certainly try it. Does that go into like a game logic or something?
put it in debug console... just don't try it for Altis... it will ruin your fps
_object = nearestObjects [player, ["house","ruins","walls"], 800];
{
switch (typeof _x) do {
case "Land_u_House_Big_01_V1_F": {
_dir = getdir _x;
HideObjectGlobal _x;
_h = createvehicle [(selectRandom ["Land_i_House_Big_01_b_blue_F","Land_i_House_Big_01_b_brown_F"]), position _x, [], 0, "NONE"];
_h attachto [_x,[0,0,0]];
detach _h;
_h setdir _dir;
deletevehicle _x;
};
case "Land_u_House_Big_02_V1_F": {
_dir = getdir _x;
HideObjectGlobal _x;
_h = createvehicle ["Land_i_House_Big_02_b_white_F", position _x, [], 0, "NONE"];
_h attachto [_x,[0,0,0]];
detach _h;
_h setdir _dir;
deletevehicle _x;
};
};
} foreach _object;
Etc... is what I'm trying currently...
@native siren disableUserInput works on a standalone basis for both true and false. Are you sure that your re-enable command is being executed after your disable command? (Also worth noting that you have to do the thing on the biki page for cases where user input starts automatically when you re-enable input)
@meager heart, shouldn't your code have setdamage 0 rather than setdamage 1?
(nearestObjects [player, ["house","ruins","walls"], 800]) apply {_x setDamage 1}; //--- destroyed
(nearestObjects [player, ["house","ruins","walls"], 800]) apply {_x setDamage 0}; //--- not destroyed
Right... I'm trying to make them not destroyed. Anyway, thanks! That does something for sure, but it's not what I'm looking to do. I've tried something like that before, and I tried your version just now. The problem is that even at full health, the buildings look abandoned, broken, and destroyed.
also when you hide building and spawn new on that position, it makes your fps go down ๐
Only for a moment. But this will be done on server init, before players join the game. Eventually the script will be modified so that each of these buildings is dynamically simulated.
@meager heart, if you check out the screenshots channel, you'll see what I'm doing.
yep saw that
arma 4 confirmed
Okay. So, the ruins are their own model. They aren't damaged versions of the buildings. IDK WHY BIS makes certain choices...
its possible to have multiple damage parts for a building etc
Well, I mean the map objects are just weird. Like, there is Land_i_House_Small_01_b_F or something like that but then the damaged version of it on the map doesn't have the same object name, it's called Land_u_House_Small_01_V1_F.
hey Im new to mission making and have a few questions. BTW i know the basics of where to put the scripts. first im trying to make an ai unit salute when i get close how do i do that.
@ruby breach So I get system message "Unblocked" but I still cannot do anything.
if (var_block) then {
disableUserInput false;
systemChat "unblocked";
};```
if I remove if it works
@native siren disableUserInput result might stack for some reasons, so currently its useful to check userInputDisabled before disabling or enabling.
Is there actually anything in secondaryWeaponItems besdies the secondaryWeapon magazine? What accessories can actually exist for launcher-like weapons, cant remind any.
scopes
also with addons (RHS has it) with SMAW, you will have spotting rifle magazines
also x2 if anyone will create bipod for rpg 7...it will be there (yes bipod for rpg 7 exist!) ๐
Wow
Wondering if anyone would like to be a hired dev for an A3L server, simple shit just need someone to do it so im offerring $$ for motivation
It's been a problem since day one,
and uh...well..
ok I've been trying this for hours now. time to ask. I'm trying to find a place able position inside a building close to a marker and move an object there.
ive tried using this _allBuildings = (nearestObjects [cache_1, ["house"], 40] select {!(_x buildingPos -1 isEqualTo [])});
_rndBuilding = selectRandom _allBuildings;
_rndPos1 = selectRandom (_rndBuilding buildingPos -1);
nevermind, ive gotten so lost with what ive tried I don't know where to start now
nearestObjects only picks up objects in the internal mission-objects list. But buildings are terrain-objects. One exist depending on the terrain/map, the others are placed in the editor or created on the fly during the mission.
You have to use:
nearestTerrainObjects [cache_1, [], 40]
instead of nearestObjects.
Please note that both commands are different in that second argument array. nearestObjects takes classnames and nearestTerrainObjects takes a generic object type, NOT classnames. Best to leave it empty and let the select / buildingPos -1 block filter out all non-buildings.
@sinful sky ^
ok, I think this is closer to what you mean.
_allBuildings = nearestTerrainObjects [cache_1, house, 80,0,0, true];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;
Syntax of nearestTerrainObjects is wrong.
ive no idea that that means
ive been trying to lean what the ASP pos means but
I'm getting more lost atm
The parameters are: [position, types, radius, sort, 2Dmode], where sort and 2Dmode are optional.
Your second argument is house, which is not an ARRAY, but an undefined variable.
I got it like this
_allBuildings = nearestTerrainObjects [_pos, _types, _radius, false, true];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;
Did you read https://community.bistudio.com/wiki/nearestTerrainObjects ?
i think so, tbh ive real ALOT in the past few hours a lot has just confused me
leme look
ok so that looks for map stuff not objects
And do not just copy paste the examples. Read carefully what _types is, otherwise your script will miss a lot of Building`s.
ok so that looks for map stuff not objects
You didn't even read what I posted in this chat 5 minutes ago...
Yep, you ignored what I wrote 5 minutes ago.
Okay, I repeat it.
nearestObjects only picks up objects in the internal mission-objects list. But buildings are terrain-objects. One exist depending on the terrain/map, the others are placed in the editor or created on the fly during the mission.
that's what i said isn't it?
so it looks for things placed?
no
i mean the other one
so i was right
ebfore
before*
nearestTerrainObjects looks for building and rocks and trees
and mre
ok so that looks for map stuff not objects
This sentence makes no sense. Map stuff are objects. This can't be right.
I'm just trying to get this straight in my head
Both are objects. Some are mission-objects, the others are terrain-objects.
i'm assuming by objects they mean editor placed objects
Good. Now you can write your script so it picks up terrain-objects like buildings belonging to the map.
ok so this
_allBuildings = nearestTerrainObjects [_pos, _types, _radius, false, true];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;
should work if i get the syntax correct
?
Well, as long as the variables are defined it should work as far as I can tell.
Though, this does not filter out buildings that have no building positions.
well that would be ok as im looking for it to be random some inside soje out
YES, i dont what an array is a string,
I think the script would error further down, because _spawnPos would be undefined for buildings without positions.
Enter "array" or "string" into the searchbar of the wiki.
You will not be able to write any scripts without knowing what an array is. Sorry.
ok so it would just have no possition for some of them
well ive done ok so far with simple stuff over the years
ok so it would just have no possition for some of them
Yes, and depending on how the rest of your script looks like, it might cause a script error and stop working
well ive done ok so far with simple stuff over the years
You were working on this simple thing for hours...
lol wana be more codecending?
ok
well i thaught an array was a 0,0,0
I'm not condecending. Everyone here will agree that you have to at least know the very basic things.
Just trying to help you.
well i thaught an array was a 0,0,0
That's not correct. It's close, but wrong.
lol see im close
The game won't care if you were close. The game needs the correct input or you'll stare at it for an hour and nothing will happen.
yes i know that
code dont bend for no man
soo, i neen the first line to be
nearestTerrainObjects [marker1, ["House"], 100];
well after pos=
nope
says 0 elements provided 3 needed
well thanks but, hasnt helped. i dont get what im missing
@sinful sky markers aren't considered objects
or positions
they're markers
so your first thing should be getMarkerPos "marker1"
ok
so far i have this
housepos = getpos "cache_1";
_allBuildings = nearestTerrainObjects [housepos, "House", 100];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;
types: Array - list of types of the objects to search for.
"house" there is not an array
what is?
["house"] like you had before
change one thing at a time ๐
i try lol, ive got a map full if triggers atm
wait do i have to getmarkerpos ?
ok first line is ok, still getting the array thing
_allBuildings = nearestTerrainObjects [housepos, ["House"], 100];
thats almost exactly whats on the BI wiki
nearestTerrainObjects [player, ["House"], 200];
thast the wiki example
nope i still dont get what is wrong with this
_allBuildings = nearestTerrainObjects [housepos, ["House"], 100];
surely thats an array
?
you guys given up on me?
i cant learn whats correct buy being told whats wrong.
im just guessing by this stage. and i read through the pages ive been sent but it doesnt mean enought to see what im doing wrong
even the example doesnt work
can you paste the exact error?
Also it's 10AM on a weekday in Europe, replies will be slow at this time of day ๐
look in %localappdata%\Arma 3
there will be files that end in .rpt
open the most recent one with notepad
your error should be somewhere there
actually, just paste the contents on https://pastebin.com/
and put the link here
its saying error 0 elements provided, 3 expected
that's fine, but show me the exact error in the RPT file as described above.
ok was going to ask waht file you wanted
i just wrote that above...
๐
ok its back
suiside ive been reading a lot for the past 6 hours, sorry if I miss things
@meager heart ๐
errm the RPT file its thousand of lines long
ah at th bottom duur
lol well ive no idea how to use this paste bin
<100mb is no othhing
can anybody tell me whats wrong with this line
_allBuildings = nearestTerrainObjects [housepos, ["House"], 100];
error is 9:02:17 Error position: <nearestTerrainObjects [housepos, ["House>
9:02:17 Error 0 elements provided, 3 expected
maybe housepos isn't an object or a valid position?
could somebody check if this here works:
100 call {
for "_i" from _this to _this + 100 do {
systemChat _i;
};
};
i do assume that this should work perfectly fine ... but ... well ... just do it please
hmm i set the house pos from
housepos = getmarpos "marker1"
*getmarkerpos
How are people putting it in boxes in the chat?
hmm well that may be the problem i chaged it to
getpos player
ah THANKYOU
that would explain it i guess
nody pointed that out yet ๐
nobody
is that markerpos?
ok
so
Check biking, I think it is markerposition
housepos = markerpos "cachepos_1";
_allBuildings = nearestTerrainObjects [housepos, ["House"],100];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;
@queen cargo Didn't try it, but I'm pretty sure that wouldn't work
this is what ive got
As far as I know no overload of + takes a ForType on the left side
need to know for sure
- has higher predecense
thus it should work theoretically
but my sqf ast tree breaks on it
It does?
eh
Alright then
@queen cargo Don't you have the game yourself?
@queen cargo Doesn't work since systemChat doesn't take a number ๐
But the loop works
do have the game myself, but not installed
due to HDD death ...
and no monez for new one
but for SQF you do not need arma installed ... just to confirm stuff
and that now means that i have to fix whatever is wrong in my AST generator -.-
Just in case somebody is extremly bored, in need of strong headache and understands at least C, https://github.com/X39/sqf-vm/blob/cpp/sqfvm-cpp/parsesqf.cpp#L243-L250 feel free to fix
magic word that is completly misspelled
And I don't know C, only C++
also enough
C is required to understand the code
C++ bases on C
youre fine
in case you did not have been joking, PN me and i will further explain to you ๐
C is vastly different from C++
not in regards of what needs to be done there
basic understanding what the . operator does is required there with basic understanding of programming
no allocation or anything like that is done there outside of simple push operations that require locally allocated structures
thus even somebody with any other language could do it (as long as it is not something like SQF or eg. lua)
then why cant you?, not being rude but im confused looking at this convo
was coding the whole morning and simply got other stuff to do too
not like i can spend the full day just doing some random arma stuff that is fully non-compensated (the monez ya kno)
sqf-vm?
that is something i do for the community
to emulate SQF
outside of arma
did not was expecting anybody to actually provide a fix btw. just random chatting ...
would have been surprised if somebody said "ye i can do it"
did not was expecting >:D
well nobody could answer my question yet ether
i am half asleep @compact galleon
leave me be
go fix my issue !!!! @compact galleon ๐
ive been trying to do one thing for hours in about 10 diffrent ways
still more confused than i started
i thinkl
```sqf
<yourcode>
```
@sinful sky
great way to confuse me more lol
that is to create those "boxes"
oh
the issue you have tells you that housepos is not having 3 elements
that wasnt the question o ment but thanks
yes
lol i know that
too well
what i dont know is what it wants
well ... a position?
but it has one
did you checked housePos?
housepos = markerpos cachepos_1;
_allBuildings = nearestTerrainObjects [housepos, ["House"], 900 ];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;
housepos <-- global var
check what it outputs
that is what you wrote up there
If cachepos_1 is the name of a marker you need to use markerPos "cachepos_1"
ah
wait that waht ive got
o no
i did
well
thats how i had it before
houseplace = markerpos "cachepos_1";
_allBuildings = nearestTerrainObjects [houseplace, ["House"], 900 ];
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;
cache_1 setpos _spawnPos;
but the box doesnt move
now im not getting any error
well im pretty much where i stated, i can move a box to a marker
but ive dont that before lol
Can I get fii in Arma ?
fit*?
Fibonach constant. Fii
@sinful sky Your problem is that you're selecting random houses, and not all houses have random positions
So executing it just once won't necessarily find a position
You'll have to choose a house that has positions
well i found a script erlier that only found positions in houses with them
but ive been through so many i cant find it now
Might want to use select on the houses array
TBH untill i see ascrip that works most of this means nothing to mean
im really thinking about it but it doesnt help
houseplace = markerpos "cachepos_1";
_allBuildings = nearestTerrainObjects [houseplace, ["House"], 900 ];
_allBuildings = _allBuildings select { count (_x buildingPos -1) > 0 };
_building = selectRandom _allBuildings;
_allBuildingPos = _building buildingPos -1;
_spawnPos = selectRandom _allBuildingPos;```
That'll work ^
ok so you added a count bit
ARRAY select CODE returns an array of the elements in the specified array that matches the condition in the code block
brain just melted
i really need to get sombody to teach me the arrays string and still
*stuff
ive read through the wiki but its not making sence to me. its good to know what ive dne wrong.
leme try that anyway
arrays string ?
@sinful sky Learning the basics is always a good idea
Hi, anyone know a way around or if there is a way for object to show inside the LoW DLC (closed) van? I can see it when I stand outside but can't see the object when I sit in the back... I used attachTo command
the thing is knowing and applying are a bit diffrence too
Nigel, you mean the golden ratio?
Yes
Just define the constant as a macro.
Hi, i got a lot of players being kicked by battleeye. Reason: PublicVariable Restriction #37
Anyone know what is wrong?
is there something wrong with my be filters or is this just normal?
Given that pubVar#37 could be well... anything. Thereโs no way to know if thatโs normal.
publicVariable.txt/.log would tell you what is causing the kicks. Whether you have that in your actual mission would tell you if itโs intended behavior or not.
(โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
โฌโโฌ ใ( ใ-ใใ) chill
@still forum Still haven't fixed your wiki page
I just came home :U
Btw to A SQS script will execute until it, is done, suspends, or after it executed for a total of 3ms. If the 3ms limit is reached it will be forced to suspend.
it, is
I used that comma to show the start of the list
Eh, what about:
A SQS script will execute until it: is done, suspends, or after it executed for a total of 3ms. If the 3ms limit is reached it will be forced to suspend.
Well... That seems kinda obvious... ๐คฆ
Tbh, I'd also get rid of the Oxford's comma.
A SQS script will execute until it: is done, suspends or after it executed for a total of 3ms.
USE BULLET POINTS
I also think it's "an SQS script". "es-qu-es".
Already using bullet points on one level
An SQS script will execute until it:
- Is done.
- Suspends.
- It executed for a total of 3ms.
.<
So, quick question here. Is it peformance friendly to be getting a variable value from missionnamespace every few seconds or are there better alternatives?
wat
it's performancewise irrelevant
I don't think there is an alternative. If that is what you have to do, then it's what you have to do.
Okay then, thanks for the feedback.
in itself it's irrelevant like ded said, it's mostly why you're doing it that matters
This doesn't need bulletin points, alganthe.
well, it's more readable that way imho.
Well why: I want to be able to (during runtime) throw in extra code into a loop
That's basically... what call my_fnc_dostuff does
throw in extra code... Into some code
literally what it does
You are very much overcomplicating what you want to do ๐
true
Alrighty, i will try and less overcomplicate what i am trying to do
less overcomplicate
"simplify"?
we can't really help you without context
because your explanations are pretty abstract right now
I have a function, it adds given code to array stored in mission namespace. Other fnc initializes array on missionnamespace and starts loop given that the variable has code and parameters inside stored as arrays inside arrays
so then in the loop, it itterrates through all of the array and calls the code with parameters
simplified:
I call a function that stores code in a global variable, other func checks all vars in missionNamespace and starts a loop.
That's kinda how CBA eventhandlers work
Hey guys, me and my friends have started playing IFA3 recently and I started creating a new mission for it, but all of the enemies die way too fast and it isn't fun. I'm trying to make a script that makes it so that the enemies need to take double the damage they would normally take but I can't seem to get it to work for some reason
I made a thread on reddit which didn't get any attention so I've come here:
https://www.reddit.com/r/armadev/comments/7z6ods/started_playing_with_ifa3_but_it_feels_too_easy/
Just use ace and 8ncrase enemy health in cba settings
I'm not very practical with this thing but can someone give me an input on how should I modify whatever is inside the dialog and insert other different controls? This is the rsc I'm looking to use: RscDisplayWelcome
What for?
Mission, addon, or what?
mission
@winter dune Well dialog/display is a class where you can create (if not exists) a class called controls or controlsBackground. This example provides the minimum for display to exist:
class dialogName {
name = "dialogName";
idd = -1;
movingEnable = false;
enableSimulation = true;
class controls {};
class controlsBackground {};
};
createDialog "RscDisplayWelcome";
private _display = uiNamespace getVariable "RscDisplayWelcome";
private _ctrlText1 = _display displayCtrl 1100;
private _ctrlText2 = _display displayCtrl 1102;
private _ctrlSpoilerText = _display displayCtrl 1101;
private _ctrlButtonSpoiler = _display displayCtrl 2400;
// compose text
private _line1 = parseText "<t align='center' size='10' shadow='0'>HELLO</t>";
private _line2 = parseText "Blah blah blah";
_ctrlText1 ctrlSetStructuredText composeText [
_line1, lineBreak,
_line2, lineBreak
];
// set position
private _position = ctrlPosition _ctrlText1;
_position params ["_x", "_y", "_width", "_height"];
_height = ctrlTextHeight _ctrlText1;
_ctrlText1 ctrlSetPosition [_x, _y, _width, _height];
_ctrlText1 ctrlCommit 0;
// disable and hide these
{
_x ctrlSetFade 1;
_x ctrlCommit 0;
_x ctrlEnable false;
} forEach [_ctrlText2, _ctrlSpoilerText, _ctrlButtonSpoiler];
This is what I have lying around.
ok, so the only thing is to modify the dialog with sqf, right?
i'll work on it, thanks
I don't see how you'd do it otherwise without breaking everything that uses the dialog.
๐
Edited line 2 to make it work more reliably...
Anyone have experience using bis_fnc_replaceWithSimpleObject?
biki says Use with caution as this technique is not very clean - should not be used for many objects and definitely not in MP games., Why exactly is it not clean and should be avoided?
Because you have to create a full object first and this function then deletes it and creates a simple object copy.
May aswell create the simple object from the start.
^ and sometimes that fails to replicate the attributes, or fail in general if used many times.
sometimes dir/up is wrong, sometimes object just disappear for some reason.
Does it run locally on every client? This would be used once at the very beginning of a mission
Server only.
@finite jackal Better do it in preInit then.
There are no objects to replace at preInit.
The pre stands for before objects are created.
Currently have it in the Object: Init field of around 130 objects that are always there since mission start
@little eagle Well I still able to apply hideObjectGlobal to a map objects in preInit ยฏ_(ใ)_/ยฏ
How do i do a sequence of animations. do you just repeat this: player switchMove "YourAnimation";
sleep 2.00;
Then repeat?
@weary pivot https://community.bistudio.com/wiki/Arma_3:_Event_Handlers -> AnimDone
@commy2 ๐ฉ#9913 Well you can simply launch preinit function from a server which does hideObjectGlobal on any map object - it will work.
@weary pivot
playMove will add next anim to the queue, so you can do it like this
0 = player spawn {
_this playMove "amovppnemstpsraswrfldnon";
_this playMove "amovpknlmstpsraswrfldnon";
_this playMove "ainvpknlmstpsnonwnondnon_medic_1";
_this playMove "amovppnemstpsraswrfldnon";
_this playMove "amovpknlmstpsraswrfldnon";
_this playMove "ainvpknlmstpsnonwnondnon_medic_1";
};
or you can adjust timings with sleep
0 = player spawn {
sleep 2;
_this playMove "amovppnemstpsraswrfldnon";
sleep 2;
_this playMove "amovpknlmstpsraswrfldnon";
sleep 2;
_this playMove "ainvpknlmstpsnonwnondnon_medic_1";
};
or you can check when animation is finished like this
0 = player spawn {
private _animation = toLower "Acts_welcomeOnHUB01_PlayerWalk";
_this switchMove _animation;
waitUntil {
hintSilent format [ "Animation state: \n%1", animationState _this];
(animationState _this select [0, count _animation] != _animation)
};
hint "Animations finished";
};
or you can check it with https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#AnimDone
Why the toLower? ๐ค
@meager heart AnimDone is the best way, because unsheduled.
@subtle ore My guess would be habit in comparing strings and case sensitivity
animationState returns forced lowercase
(granted, != isn't case sensitive, which is why I say habit)
I see, I'm not sure I ever run into case sensitive classes or commands all that often
isEqualTo, in, switch do etc are all case sensitive for string comparisons
okay, good t o know
== is not case sensitive for string comparison
#fakenews
https://i.imgur.com/ix38Dsq.png @ruby breach
isEqualTo is case sensitive, what would in other languages be ===
Sorry yeah, it's isEqualTo that's case sensitive
why lowercase...
//"AmosffsfvPercMstpsfsfsSlowsffsfWrflDnon"
/*
A mov //ACTION move
P erc //POSITION erect
M stp //MOVE stopped
D non //DIRECTION none
W rfl //WEAPON rifle
S low //STATE lowered
*/
fix for isEqualTo yes which was replaced with == ๐
@subtle ore
I see now, always wondered the naming convention of all those lol.
@unborn ether yes AnimDone is the best way i think
but maybe there is some better solutions idk
@meager heart AnimDone is handled by the engine internally, doesn't require spawn so stays unscheduled, easy to use. Nothing else can benefit the same.
Can anybody unearth a huge secret about how BIS adds additional controls such as text and progress bars to a RscListBox like its done in gear?
Hi everyone, i'm using a script to spawn a group of units at a set position with the BIS_fnc_spawngroup function, but since i'm using an Area trigger and it being an P mission, when many people steps in ti executes for each client
Is it enough to set said trigger to execute "Server Only"?
for "_i" from 2 to 4 do {
_spawnPos = selectRandom [getMarkerPos "spawn2",getMarkerPos "spawn3"];
_UnsGroup = createGroup [east,true];
_typeofgrp = selectRandom [(configfile >> "CfgGroups" >> "East" >> "UNSUNG_EV_VC" >> "vcmainforceInfantry" >> "vc_mainriflesquadone"),(configfile >> "CfgGroups" >> "East" >> "UNSUNG_EV_VC" >> "vcmainforceInfantry" >> "vc_mainweaponsquadtwo")];
_UnsGroup = [_spawnPos, EAST, _typeofgrp] call BIS_fnc_spawnGroup;
_ranWay = selectRandom [[2105.670,859.581],[2040.258,722.678]];
_UnsGroup addWaypoint [_ranWay,0];
}
Thats the script i'm using, would it be enough to add:
if (!isServer) exitwith {};
At the beggining?
SAy, for example:
if (!isServer) exitwith {
for "_i" from 2 to 4 do {
_spawnPos = selectRandom [getMarkerPos "spawn2",getMarkerPos "spawn3"];
_UnsGroup = createGroup [east,true];
_typeofgrp = selectRandom [(configfile >> "CfgGroups" >> "East" >> "UNSUNG_EV_VC" >> "vcmainforceInfantry" >> "vc_mainriflesquadone"),(configfile >> "CfgGroups" >> "East" >> "UNSUNG_EV_VC" >> "vcmainforceInfantry" >> "vc_mainweaponsquadtwo")];
_UnsGroup = [_spawnPos, EAST, _typeofgrp] call BIS_fnc_spawnGroup;
_ranWay = selectRandom [[2105.670,859.581],[2040.258,722.678]];
_UnsGroup addWaypoint [_ranWay,0];
}
}
I feel like BIS just adds more controls to the same dialogue
Is it worth using a headless client to take load off the server from serverside scripts etc?
how to optimize this best?
waitUntil {(_obj distance (_obj findNearestEnemy (position _obj))) < 40};```
just a sleep (1 + random (1/_skillUnit))?
Anybody have or know where to get a template for scripting task in sqf. I need to make a 5 task mission. Each one linked to the next. Thanks.
The wiki isnโt helpful
@subtle wigeon rn its too late over here but first thing morning i log into Discord i'll give you an example
AnimDoneis the best way, because unsheduled. @unborn ether
unscheduled* And no. It's the best way because it's a Eventhandler. Not because it's unscheduled.
@little eagle Map objects might exist at preInit. But not objects placed in the mission which is what you meant.
Can anybody unearth a huge secret about how BIS adds additional controls such as text and progress bars to aRscListBoxlike its done in gear?
They have unlimited possibilities in engine. Stuff that might not be exposed to scripts or config.
BOOM ๐
@velvet merlin You wont optimize something by making it slower :D
The engine already won't execute that code if it doesn't have enough free time. And if the engine has too much free time and wants to use it for something. Why not let it ^^
I have no idea what your usecase is so I don't know why you would random and what _skillUnit is
If you mean the inventory UI by gear Then that's mostly in engine. So they are most likely using stuff that isn't exposed
Yep that one that is RscDisplayInventory under idd=602
ended up with this
_position = position _obj;
_skill = skill _obj;
waitUntil
{
sleep (1 + random (1/_skill));
(_obj distance (_obj findNearestEnemy _position)) < 40
};```
- have it checked way less frequently
- natural delay as AI should have no inhuman speed
- skill modifier
What if position changes?
@velvet merlin ^ position should be private to waitUntil to keep it updated.
sorry context was missing: the unit is inside a static weapon
also maybe just sleep <number> ? ๐
th escript is to make the crew eject if an enemy number gets nearby
@meager heart see 3.
๐ฎ
it should not be the same all the time
reveal after waitUntil ?
The unit already knows about the enemy. So why reveal?
According to wiki yes.
didnt they change this a bit in A3 finally
Wiki says both though.
Returns a null object if the object's group does not know about any enemies. This command will return nearest object that is known to the unit and is considered enemy
i thought task is to make ai react somehow, Dedmen
@meager heart Yes. It will leave/eject it's gun.
Reveal isn't needed though as the unit already knows about the enemy. So telling it again won't do much
maybe you're right... but knowledge values can be low, but if you force it ๐ค
Maybe you should use https://community.bistudio.com/wiki/getHideFrom
Because the AI might know that some enemy is 100m away and findNearestEnemy will find them. And your script will trigger if that enemy is 40m away. Although the AI itself still thinks he is far away
good find. ty
also if enemy is player maybe setUnitTrait camouflageCoef ? ๐ฌ
Would there be a way to create if expression, that will check if "_var" variable is equal to any variable in array?
Yes...
Many ways infact
Easiest way if (_var in _array)
Checks if _var is in _array
Thank you very much ๐
Are headless clients worth using to take load off the server from serverside scripts etc? Im working on a mission but not sure if it is worth implementing the use of one.
We can't tell you that
If your script is so heavy that it's worth it then it's probably worth it.
If it's not worth it then it's probably not worth it.
Why can't you log into the wiki anymore?
you mean can't register?
No, log in
Clicking "Log In" says you can't register
But I'm already registered
Exactly that's what I meant ๐
That should go into #community_wiki ;)
BI Account was merged into everything. So you have one BI account for BIF/Wiki/Store.
If you access Wiki for the first time it has to link your existing account to your BI account or it will register a new one
Maybe the name on your BI account isn't exactly the same as your biki account so it tries to create a new one. Which is currently disabled because Spambots found how easy it is to use a BI Account to spam the wiki
My BI account is MulleDK19. My Wiki account is MulleDK13
Ah yeah see...
I guess you could try to temporarly rename your BI account
then try to access wiki and rename back
I hope that doesn't work
Major security issue if you can just hijack people's accounts by changing your name
I guess it uses email and name
Doesn't work either
"This nickname is already taken."
When trying to change to MulleDK13
So someone else either took that name for some reason. Or it was auto generated ๐
New BI account stuff is certainly alot of fun
Also... The wiki's SSL cert is invalid for me ๐
Probably my companies fault.. I have no friggin Idea what's going on here. I can't push to github, half an hour ago google was unreachable and now that ssl cert is broken
Fantastic...
Wiki says MulleDK13 and MulleDK19 both don't exist ๐ Fun