#arma3_scripting
1 messages ยท Page 359 of 1
dno, never saved for m:9
Either way, in hindsight, it was dumb of me to save profilenamspace every second
@little eagle vanilla.
I use this to hide a weapon on a player
player action ["SwitchWeapon", player, player, 100];
And i want to block him from taking his weapon in hands after this command
I could use a while loop and check when currentWeapon != "" and then switchWeapon but that's not the best solution
lol
["commy_keepWeapon", "onEachFrame", {
private _unit = player;
if (currentWeapon _unit != primaryWeapon _unit) then {
_unit selectWeapon primaryWeapon _unit;
};
}] call BIS_fnc_addStackedEventHandler;
Hmm I need a help one more time. I need to have a variable starting with 0, and whenever script is executed, the variable is incremented. I was thinking, can I" transmit" a variable from one script(example init.sqf) to another?
@whoever was helping me trying to figure out why error report line numbers were being weird, is it possibly because we do #include </some/path/to/file.hpp> instead of #include "/some/path/to/file.hpp"? ๐
No, they are the same in Arma.
dammit ^^
@neon snow if you declare your variable without the _ , you can use it anywhere in your mission.
Oh ok, thank you ๐
if (isPlayer gunner car1) then {
doGetOut [gunner car1];
};
what is wrong in this one?
This is a trigger condition to eject the gunner of car1 if he is a player
if (isPlayer gunner car1) then {doGetOut [gunner car1];
};
i format this a little now it is worling, strange really.
if you don't want player to get in the gunner
i already solve that
Just do ```sqf
if (player isEqualTo (gunner car1)) then {
"end_inGunner" call BIS_fnc_endMission;
};
is just a trigger to in a certain point the gunner gets kick out of the vehicle
if (diag_fps < 50) then {
"end_lowfps" call BIS_fnc_endMission;
};
You'd have to define the ending yourself, but that would end mission if fps is low
thats... not really what i want it
but does the enableSimulation false save perfomacy?
How do you make supersimple ?
what is that super-simple?
Never heard of it only simple I heard about.
I need to test that.. been using simple this whole time..
Well.. you'll still get more FPS if you downright DELETE the object
I've been missing soo much performance ๐
LMAO
xD
Theres no other way to hide chat with scripting commands is there other than through enableChat?
this perf chart is funny because in most cases i use simple object on houses and buildings...
Yeah, when in reality that's gonna make the least amount of difference ๐
@slender halo run a loop that checks if the display for chat exists, if it does, close the display
@warm gorge ^
Ah damnit was hoping there was an easier way. Surprised theres no script command for it
yeah but usually i only have simple object suitable cars at the base camp, i mostly make coop scenarios for my clan
I only use it on fortification objects.
I've made my own objectMapper that uses it and it dynamically spawns in fortifications for buildings.
Nice. I dream of a furniture etc. script and yeah, fortifications sound very nice
I could do furniture, it spawns the objects on 99.99% the same place.
In my testing it didn't spawn wrong yet so ๐
Yeah setposRel ?
It automatically checks for rotations. So very usefull.
๐๐ฟ
my vehicles tend to screw up way too much, can some one help me making a teleporting unit when he is in a X amout of a distance?
just make a unit teleport behind another unit once a distance is meet
Hey How do I do time Triggers
@sick drum can you describe more?
Let's say I am making a scenario In the scenario you have to destroy an anti air system in 30 minutes, If you don't do it in 30 minutes you automatically fail
in init
0 spawn {
uisleep 1800;
if (<condition>) then {
"end1" call BIS_fnc_endMission;
};
};
you could name the anti air system eg. antiairsys = this; and then the condition would be !alive antiairsys
sleep 1; in front of that, because time should start when game starts, briefing might take 30 minutes as well
waitUntil {getClientStateNumber > 9};
before that
so it starts when briefing was read
ok, ok i see thanks
you could do some kind of a timer
but that requires messing with display files ๐
Not really.
without using a hint you can create some kind of custom dialog?
Yep. With just scripting.
now im curious
A timer is not a dialog though. It would be a control.
// initCounter.sqf
params ["_display"];
private _control = _display ctrlCreate ["RscText", -1];
_control ctrlSetText "splendid";
_control ctrlSetTextColor [0.1,1.0,0.1,1.0];
_control ctrlSetPosition [
safezoneX + safezoneW - 0.2,
safezoneY + 0.0 * safezoneH,
safezoneW * 0.1,
safezoneH * 0.3
];
_control ctrlCommit 0;
MyMission_Counter = [_control];
//To change the text:
(MyMission_Counter select 0) ctrlSetText "hello world";
CBA_missionTime would make it super easy to have a synchronized and JIP and savegame compatible timescale...
What? It's Just An Ordinary scripting OH MY GOODNESS!
so im not doing time scenarios haha
Well, is there a machine connected to the slot of headless_client ?
Check
owner headless_client
3
It's working, I'm getting debug on the hc
Looks like they changed it at some point
Yea. Good to know.
btw how does arma kill all scripts when for ex. mission is unloaded?
Magic from C++ land. Same way it clears the mission namespace.
So, all scripts are stored somehow... But how can I acces that? Iassume c++ land
I've always wanted to close all spawned scripts
You can theoretically guess the script ID (what spawn returns) and just bruteforce close everything ๐
Or... you use cheat engine and set a single number to 0
You can't get scripthandles with pure sqf.
If you don't save it, there is no way to get it.
They are just numbers internally... hmpf.. well then... #Intercept ๐ Theoretically..
haha
You can create scripthandles with Intercept by providing the scripts ID. Too much hassle tho
With your hacking mods one could shut down everything in Arma one by one...
With my Hack yes. With Intercept and the Debugger... not everything but more than what SQF can ^^
But I don't seee much use in that. Use profiling branch to check what scripts are running
Is there any way to create custom events for addEventHandler? I think in the meantime I wll have to use _unit spawn fnc_eventHandler; Where fnc_event is something like: if(isServer) then { _eventDone = false; while(!_eventDone) do { } };
At least I think spawning a thread and checking for the event conditions seems the way to do it
@frail zephyr only loops :(
I figured as much... not ideal, but I can live with it. Would be so much easier to create a custom event, but I shall live.
What is the thing you want to eventizise? Maybe there is a better way for the exact thing you are doing
BIS_fnc_enemyDetected
ouh... hm...
Ehh long story short, I was having trouble with idleAnimationCombat, so used idleAnimation, wanna use enemyDetected or firedNear to call __terminate on the idleAnimation.
I really should just get idleAnimationCombat working right...
firedNear has an event, fnc_enemyDetected does not.
Youd probably be best off with a waitUntil and some amount of sleep. If you use CBA you can use a few more fancy things but in lieu of actual custom event handlers youll have to check in a loop anyway
Hmmm that seems like a better idea; I just felt wasting cycles in a polling loop felt wrong.
I still think an enemy detected EH would be really good to happen but no real chance on that
I would absolutely love that, I was searching for any kind of enemy, sound, or detected event handler and the closest I found was firedNear. I'll stick with relying on BIS_fnc_enemyDetected in the mean time.
I noticed in RHS with some vehicles that the getin/getout actions wait for the doors to open/close. What script functions do this?
@frail zephyr are we talking mod or mission here? in a mod you could possibly add some hooks to the danger.fsm
might even be possible to do it inside a mission by disabling default AI and loading modified. that could be tricky and is likely to not work thoug. not an expert on default arma AI at all. jsut some random brain storming ideas
Mission. although I'm open for making it a mod. Really, in the end, I would want this to be an editor module that you can place like Sites modules, but have been having tons of trouble making a new module.
It would probably work fine that way, but seems like a lot of extra effort just to switch some states from idle -> notIdle
I would love to go the editor module route if anyone has any tips for getting that to work; followed the wiki but couldn't get my custom module to show up in editor. Was probably missing a key step.
I remember doing something similar using an AnimDone EH, and checking group behaviour.
^now this is a grea idea. depending on how long those ambient anims are
worst case scenario would be something playing till the end but no big deal if the anim isn't that long
In my head it would be like the group commander calling "alert" and then some individuals would be lazier than others =p
and you could also always throw in the "firedNear" EH for really urgent cases. maybe even a "hit" one to make them isnta react on being hit
The thing is, I don't care when the animation is done, I want them to continue their animation in a loop until there are enemies detected or there is fire detected. I'm fairly certain the civs combatMode won't change, as they are friendly to everyone in my mission.
firedNear would also help deativating idling dudes through their firing team mates so the distance limit shouldn't be too bad of a problem
oh. civs?
The animations should loop. When one completes, check group behaviour and end if COMBAT, else do nothing.
make Enemy attack when BIS_fnc_enemyDetected
Would the civ behaviour ever be COMBAT?
Yes. (95% sure)
Hmm then that could work fine
I was under the assumption they didn't get a COMBAT behaviour mode, probably a wrong assumption
But that doesn't mean they'll shoot at who you want them to.
Nope, just a state
Right.
Luckily, I just need the civs to quit their idle animation and flee, and the OPFOR quit their idle animiations and attack BLUEFOR. I think I got a good idea on how to do it now.
a unit that has disableAI "PATH" will still run their CombatBehavior switching AI correct?
If so, this will work fine then.
Correct.
Good, I'll give that a shot tonight after work; thanks for the ideas, I'll give everyone a heads up if it works.
@little eagle stop finding weird SQF quirks pls
my VM now also can use , instead of ; because it was requested ๐
besides, any command only for units/vehicles that will error out if the target is indeed, OBJECT type but not unit/vehicle? (unit => createUnit; vehicle => createVehicle; Asking for any known error that happens due to object being vehicle instead of unit)
Does anyone know if it's possible to blacklist certain vehicles in bis_fnc_garage (the virtual garage)? Like I want it to not spawn planes helicopters or boats
str missionNamespace``` what is this outputting?
annoyingly
"Namespace"
"Namespace"
awww too slow
Namespaces know their name though... it could output "missionNamespace" if it wanted to
str [missionNamespace, uiNamespace, profileNamespace, parsingNamespace]
"[Namespace,Namespace,Namespace,Namespace]"
10/10.
๐คฆ
This would be likely the first thing I'd change if I could.
You can try to convince devs on the feedback tracker.
:u
could continue with while etc.
you are asking awesome questions ๐
but somehow i highly doubt isEqualTo is actually giving correct output for those
Checking
questions that arise if you try to copycat SQF
false
XD
if you compare ForType it always returns false
false
no matter if it matches
kk
so only the actual types actually return something useful
Seems like it.
IF type returns whether the condition is the same
meh ... so need to add more edge edges
so you could just remove the "if" and get same result
...
now to find when isEqualTo is actually comparing and when it does not
wohooo
while...
if code matches ret true.
If no code exists... return false... if... type of code... doesn't match.. return false... uhm.... wat?
how can code in while not be of type code....
can you use while STRING ?
while {true} isEqualTo while {true}
true
while {true} isEqualTo while {!true}
false
while {true} isEqualTo while {!!true}
false
I don't think so
undocumented "feature"
They first check if the code is the same. then if no code exists.. then the type... then they check if the code is the same again..
uhm ... so while {true} isEqualTo {true} => true ? Oo
Nope
IF type is Boolean type @little eagle
Nope
IF and BOOL are different types
If is boolean. Just with different typename
y
everything else is the same
inheritance wise
Only because the are the same stringified does not mean they are the same isEqualTo. And only because they are the same isEqualTo does not mean they are the same stringified.
uhm
@little eagle can you check while {true} isEqualTo nil ?
unsigned char is_equal_to(PVM vm, PVALUE l, PVALUE r)
{
...
if (l->type != r->type)
return 0;
if (l->type == SCALAR_TYPE()) { ... }
else if (l->type == BOOL_TYPE() || l->type == IF_TYPE()) { ... }
else if (l->type == ARRAY_TYPE()) { ... }
else if (l->type == STRING_TYPE()) { ... }
else if (l->type == NAMESPACE_TYPE()) { ... }
else if (l->type == CODE_TYPE() || l->type == WHILE_TYPE()) { ... }
else if (l->type == SIDE_TYPE()) { ... }
else if (l->type == OBJECT_TYPE()) { ... }
else { return 0; }
}
``` that is how i do it right now ...
to make things faster, anything i missed?
isEqualTo nil
just reports nil, because one argument is undefined
is there any other type that doesn't contain a value? probably not
Because... WHILE isEqualTo <something that contains no value. like nil> crashes the game with a nullpointer exception
Every command reports nil and fails silently in scheduled environment when one argument is nil. Note that arrays with one nil element are not nil.
By "reports" I mean is fed the argument nil (on either side). OOps.
@little eagle
while {true} isEqualTo for {test} ?
for {test}
is syntax error
hm... I have to investigate that further some day
horrible enough that this is valid SQF sqf test = "test123", test2 = "test45", diag_log format["hello -test => %1 -test2 => %2", test, test2]
diag_log uses the same logic as str and format I believe.
with is not yet implemented
with missionNamespace isEqualTo with profileNamespace -> false
returns true if you compare the same namespaces
Exceptions also always return false if you compare them
just wondering right now ...
_veh = "pleasechangewithvalidvehicleclassname" createVehicle [0, 0, 0];
_veh2 = _veh;
deleteVehicle _veh; //nullify _veh & _veh2
_veh isEqualTo _veh2
SWITCH also always false
_switch = switch (true); _switch isEqualTo _switch
false
always false, can confirm
nil is also always false
Example?
Nothing too
It should just report nil
I'm checking Intercepts internal isEqualTo. Which uses what the isEqualTo script function uses in the backend
if you pass nil it probably stops before even going to backend
any one of you could check the bit of code i pasted in here quickly?
Here is something super annoying:
jclass returns if case insensitive names of both classes match
_a = [nil]; _a isEqualTo _a
true
[nil] isEqualTo [nil]
false
_veh = "pleasechangewithvalidvehicleclassname" createVehicle [0, 0, 0];
_veh2 = _veh;
deleteVehicle _veh; //nullify _veh & _veh2
_veh isEqualTo _veh2```
Can confirm
and with objNull on one side?
objNull === objNull essentially
or what about objNul on both sides?
objNull is equal to objNull
objNull isEqualTo objNull
true
maybe i should start writing that stuff down ...
and publish the big book of SQF specs
5kk pages
with all edge cases
gah ...
_veh = "B_Soldier_F" createVehicle [0, 0, 0];
deleteVehicle _veh;
_veh isEqualTo objNull
false
I think I broke it
_veh = "B_Soldier_F" createVehicle [0, 0, 0];
deleteVehicle _veh;
isNull _veh
false
lol
objNull is probably nullpointer on first level. deleted vehicle is nullpointer on second level
maybe it takes a frame?
_veh = "B_Soldier_F" createVehicle [0, 0, 0];
deleteVehicle _veh;
_veh
1305311ea80# 44: b_soldier_01.p3d
probably
Seems like it's deleteVehicle that fails.
Yup, one frame later it's null.
So it's just a delay of the effects of deleteVehicle
[] spawn {
_veh = "pleasechangewithvalidvehicleclassname" createVehicle [0, 0, 0];
_veh2 = _veh;
deleteVehicle _veh; //nullify _veh & _veh2
sleep 1;
systemChat str (_veh isEqualTo _veh2);
systemChat str (_veh isEqualTo objNull);
systemChat str (objNull isEqualTo objNull);
};
so if SQF-VM executes in unscheduled.. it would not be null. If scheduled then it can be null if it happens to pause the script right there. and if you add a sleep in scheduled it is 100% null after that
if (((POBJECT)l->val.ptr)->inner == 0 && ((POBJECT)r->val.ptr)->inner == 0)
{ return 1; }
else
{ return l->val.ptr == r->val.ptr; }```
taken care
I love compact code
ty btw
return (((POBJECT)l->val.ptr)->inner == 0 && ((POBJECT)r->val.ptr)->inner == 0) ? 1 : l->val.ptr == r->val.ptr;
๐
nah ... confuses ppl when they read it
return l->val.isNull();
not correct due to r might not being null and not in c++lands
#GloryToArstotzka
veh = "B_Soldier_F" createVehicle [0, 0, 0];
0 spawn {
sleep 1;
isNil
deleteVehicle veh;
systemChat str (veh isEqualTo objNull);
systemChat str (veh isEqualTo veh);
};
};
false
true
^???
The debug console ate a {
lol
tasty
veh = "B_Soldier_F" createVehicle [0, 0, 0];
0 spawn {
sleep 1;
isNil {
deleteVehicle veh;
systemChat str (veh isEqualTo objNull);
systemChat str (veh isEqualTo veh);
};
};
That was the code. And it seems like deleteVehicle does not have immediate effect.
false
true
the wiki says as much, though?
NOTE: Actual object deletion, when object becomes objNull, happens on the next frame after command execution, but there are some object modifications that happen immediately. For example if the object is unit in a group, it immediately becomes groupless
yup
kinda nutty that it immediately deals with some other things first
that aren't entirely specified
SQF
questions nobody ever asked because he fears the answer
asdf
deleteLocation has immediate effect.
Once again LOCATION > OBJECT
No surprises here.
probably has to do with allowing network to take effect
I'm in SP though.
does not matters
would not add edge cases for SP
would just cause problems in MP which do not happen in SP then
or other way around
is "B_Soldier_F" createVehicle [0, 0, 0] actually creating a vehicle Oo
Yes
or is the result acting like a weirdo unit?
which means my inner concept (sqf-vm) will get completly fucked up ๐
Just a brainless soldier looking statue
kk
so there IS a difference between unit and vehicle
cannot execute doMove too i guess?
B_Soldier_F and arifle_MX_F are like the only classnames I can ever remember. Aside from BWA3, which has sane classnames.
Hey guys, anyone here knows if ctrlShown command returns true if faded out? As in ctrl ctrlSetFade 1; ctrl ctrlCommit 0;
opacity and isShown are two different things
Probably false unless you use ctrlShow
Ye, that's what I thought
For the fade you're supposed to use ctrlCommited I think...
check https://community.bistudio.com/wiki/Category:Command_Group:_GUI_Control for all of em
However, isShown is not the command @queen cargo
I know what I am doing with the fading
Was just a bit wondersome since ctrlShown was returning true
After fading, but probably control is just still shown
because ctrlShow allows for the edit
Of course
ctrlFade only changes opacity
I know
--> control is still rendered
I know
only thing they did not added quirks is the UI system
well ... besides the known quirk of that weirdo config crap
The GUI system is ok.., could be better however
though, in theory one could create a complete separate design language for it
that builds everything using ctrlCreate
no
it would be beautiful
coding XAML instead of weird config commands would be great โค
Well of course, @little eagle, what my question was; if fading out a control would return false when running that ctrl command
Cause it wouldn't surprise me if it didn't, but we came to the conclusion that it didn't.
Try it?
Ye I did
I can't be debug nanny for everyone^^
I did try it myself, after I asked ๐
after
Didn't ask anyone to debug for me, was just curious if anyone here already knew
I can't really trust my knowledge, unless I just tested it right before. I can always misremember...
Of course, we can all do that ๐
now ... next question: [createGroup west createUnit ["B_Soldier_F", [0, 0, 0], [], 0, "FORM"], 1, createGroup west createUnit ["B_Soldier_F", [0, 0, 0], [], 0, "FORM"]] doMove [100, 100, 0]
what is happening in here?
do both soldiers move?
does only one move, and if yes, which one?
or does it only throws a script error?
or may it does nothing of all those things??
just spotted this fancy lil command
resetSubGroupDirection
not documented in the wiki
unary, takes OBJECT as param
ahh wait
found it
resetSubgroupDirection thats correct casing
Is this the correct way to remove an event handler when a condition is met? I'm not home, but am getting some scripts done on lunch:
_unit addEventHandler ["FiredNear", {
// ...
_unit removeEventHandler ["FiredNear", _thisEventHandler];
}];
Or should I grab the _idx from the addEventHandler call? Will that be in scope?
_unit removeAllEventHandlers "FiredNear";
if you have only one FiredNear EH its easier that way
I like that better; should only ever have one, runs on init and only on the server.
avoid that command like you would avoid a leaking nuclear power plant
unless you are surely always and in any case running on vanilla
the moment, one mod adds such an EH, you also remove that mods EH
breaking the actual functionality of the mod you installed
better: put the ID of your EH into a var eg. _unit setVariable ["dockam_my_fired_near", _unit addEventHandler ["FiredNear", {...}] and remove it later by getting the variable from the unit again
@simple solstice @frail zephyr
Doesn't _thisEventHandler cover it?
before 1.63.137807 that was not existing
in any version after, that is correct
everybody does
your solution would completly cover your usecase
though ... you might want to rethink your code unless you rly only need that EH temporary
might be more useful to leave it attached
instead of readding it everytime
@queen cargo right.. I forgot about mods
I only add it once
my bad then, listen to what he said!
As in, I add it once, and test a condition on each time it fires, don't remove it every time, only once I'm done with it.
if it is done via a trigger, you might better be off by removing it in that trigger again
but both will work
just one way might cause confusion when you revisit
Yep, good points. And no not done with a trigger; esentially spawning units with static idle animations and want to call __terminate under certain conditions.
When animIdleCombat wasn't working for me for some reason.
Which, if I could get that to work, would make all of this so much easier and moot.
@ShadowRanger#8911 showChat false; will hide chat.
0 = [] spawn
{
while{true}do
{
playMusic "Track_22";
sleep 50;};
};
i manage to loop this music
but how to stop it? lol
also, this is on a trigger condition.
playing an empty track instead?
if i play another track with playMusic "othertrack"; still goes back to play this
i even tryed to delet the trigger but it does not worked
well yea you dont save either the handle to the spawned thread or use a variable for the loop condition
either save the return from spawn to a variable you can terminate, or change the true to a variable you can set to false
when trigger deactivates you want it to stop?
xyz_playMusic = true;
0 = [] spawn {
while {xyz_playMusic} do {
playMusic "Track_22";
sleep 50;
};
};```
to turn off, just do xyz_playMusic = false
to stop it when the trigger deactivates:
0 = thisTrigger spawn {
while {triggerActivated _this} do {
playMusic "Track_22";
sleep 50;
};
};```
And more fun variations in the same trend
that xyz_playMusic = false i put on another trigger?
Sure
thanks for the help, got to go.
guys I have a problem, I need to create conditions, 3 seperate conditions for each situation , when variable is equal 1,2,3. However I cant use "=" sign for some reason.(it is in the config I know, but it is more logical queston). I can only use expressions:+,-,<,>*,/. Condition look like: condition="variable" for example means that if "variable" is 0, then the condition is true
and ARMA reads anything above 0 as true
and here is my problem
becouse I need to distinguish the conditions. When is equal 1, when is equal 2 etc...
My heads hurts at the moment becouse of that
= is an assignment.
== is like <
I know that from CPP, but for some reason, == doesnt work in config for me.
And here there is no == :/
Yeah, simple expression has no ==. It's not really SQF
That is weird for me. Ok , sorry for posting here then
You can use multiplication and addition as AND and OR though.
Hmm that might work, I'll check it
what is the best way to get a random position from inside an area marker?
_radius = param [0,100,[0]];
_pos = getMarkerPos "TestMarker0";
_rndx = round(random _radius);
_rndy = round(random _radius);
_newPos = [(_pos select 0) + _rndx, (_pos select 0) + _rndy, 0];
I came up with this for a regular marker
Not sure if it is the best way, but I will test it out
Depends on if the marker is a rectangle or a circle.
I would imagine a circle is much easier since it is just a radius
I guess. A rectangle can be rotated, so that could make it harder.
If the sides of the rectangle align with the world x and y axis, west and north, then it's easy. Like you posted. But I think you misused the word "radius".
Trying to make a sliding animating. but its squeezing my image xD anyone know if there is a way of stopping it squeezing ?
https://gyazo.com/583e139a412b41054b5936bbdec616d5
Don't think there is Leighham. There is no way to make the upper parts invisible and you have to not change the controls height.
Yeah , i got another neat animation by trying keepAspect though
Dont know whether to keep the squeezing or go with that one.
what do you think commy ?
That one is a good compromise I think.
Quick, hopefully simple, question. Anyway to extend/alter the base BIS functions? Example: BIS_fnc_ambientAnimCombat has an _acceptableStates of animations it can accept; but it calls "[_unit,_animset,_gear,nil,nil,false] call BIS_fnc_ambientAnim;" which has a significantly larger set of animations available to it. Otherwise, I'll have to call ambientAnim and replicate what the BIS function does.
https://community.bistudio.com/wiki/a_-_b is this creating a new array or editing the existing?
not noted anywhere on that page
i mean ... i can guess
Test it?
one usually has arma running in here
Prefer to pushing back an element is using pushBack
I'm currently writing a data-structures library for arma 3.
So I make use of it fairly frequently.
data-structures library??
Stacks and Queues.
still no idea what such a library is supposed to be
Can be a useful tool in increasing performance in code.
also, [0, [0], [[0]]] - [[0]] has nothing to do with pushBack Oo
so you create a tool that does static analysis of code
Good way to manage and clean-up of dead stuff.
Array deleteAt 0; is a 1 direciton queue.
pushBack allows you to add 1 element to the queue
- creates a new array. Flat copy.
is there a marker type that only displays the marker text?
Yes
"Empty"
No marker.
Probably not directly obvious how a Queue or a Stack is useful.
But BIS_fnc_stackedEventHandler probably uses it.
empty shows nothing
You have to add text to it.
[0, [0], [[0]]] - [[0]]
Better example of this is this.
i did
[1,
[2],[
[3]
]
] ] -
[4]
]
]
or is class name "Empty" a different one than the one called empty in the editor?
so you are not even creating an AST ... seriously ... the fuck are you doing!?
you cant see empty markers, pretty sure they are invisible on the map. use a different type and set the size to 0 so the icon doesnt show
I am just saying what that multi-nested array it's called a tree.
I am simply writing a collection of small functions to act as data-structures thats it.
ah ofc. thx @robust hollow
Hey guys How do I add supports like artillery
thats it?
Pretty much.
You've got to also let it know if it needs to be the group who has access or just 1 unit.
Then it will show up in the "supports section" menu
seriously @tough abyss ... you have to work on your wording for your projects
right now i imaginating you writing python code to parse SQF into semi-structured AST/Token lists which you want to call via SQF (and probably callextension) for ... reason
No no.
using SQF to replicate python data structures
It can't be a direct 1 : 1 conversion it has to use procedural / functional programming.
Which deleteAt etc.
Is all I'll need.
so
see? that was clear ๐
I was using computer science speak...
you have posted vague terms that can mean anything without any context
can tell you i work on a stack-based machine for arma
you would still not know what it is doing
Fair enough.
telling i work on a stack-based runtime for SQF would tell you everything ๐
@little eagle Do you know how support artillery works?
Yeah it's to simpilfy some things with clean up.
unless you do not know what that magic word runtime is ๐
In theory I could even store string-code into it to be processed.
[codestrings,codestrings] etc.
so ["Some SQF script here","Another SQF script", "Yet Another"]
The idea behind it is it can handle any kind of code.
or datatype.
I know that now
its ok you helped me so its cool
fun fact: found a use for the , quirk of SQF
Which quirk is that?
you can use it to allow for comma separation with ; ๐
@tough abyss SQF allows you to use , instead of ;
_obj1 = "B_Soldier_F" createVehicle [0, 0, 0],
_obj2 = "B_Soldier_F" createVehicle [0, 0, 0],
_obj1 != _obj2 //true;```
mhh?
well ... thats due to commands accepting strings then
Yeah, but VBS allows a more... wider use.
Wish A3 had VBS3's external script interpreter console...
VBS took DayZ's map...
Why can't we have some of VBS's quality of life stuff?
I mean wouldn't you like this @queen cargo ?
Also look at MinErrorLevel
https://resources.bisimulations.com/wiki/noInterrupt would be cool
but ... scheduled is already exxisting in arma
Yeah VBS has some internal details about how the SQF engine works
The more scripts/โthreadsโ running at one time, the more time will be taken by the script switching logic and the less time the chosen script has to run before being interrupted again. As a result, this number should be kept as low as possible, using call compile preprocessFile "script.sqf" in place of execVM "script.sqf" as demonstrated above unless it is absolutely necessary to do otherwise. You should limit the number of scripts with infinite loops checking for some conditions and see if a similar logic cannot be performed using an event handler.
So less VM scripts == better
This section details the actual workings of the script interrupter within the engine. You do not need to understand it and it is here mainly for those who are curious.
All scripts placed in a queue ordered from the least recently executed to the most recently executed script. Every time the limit for processing scripts within the current frame is reached, the execution of the current script is interrupted. Upon entering the new frame a new script to execute is selected based on whether its condition allows it (the script might be sleeping or waiting for a condition). Thanks to the ordering, the least recently run script with a satisfied condition will run. If no script satisfies its condition the whole process is repeated the next frame.
That was the most interesting part I've found about the SQF engine itself.
So @queen cargo dedmen was playing with an FPS limit parameter
Why doesn't BI just add -limitfps parameter
?
I mean if it's 1 line of code he saw.
Let people decide if they want 60 FPS or 30 FPS
On the server-side.
Obviously VBS added this functionality quite a while ago.
The only good thing about the scheduler is, that it warns about undefined variables. Too bad it also errors on them as well.
Yeah...
Some scripts can't work in unscheduled very well
Weather changing stuff from my experience
Broke...
if it wasn't run in scheduled.
No idea why.
Whats your opinion about adding a -limitfps option @little eagle
For both servers and clients?
The more options the better I guess.
Weather works just "fine" in unscheduled. Fine as in it's just as broken.
Oh. Well if someone told me that before I tried to implement a more dynamic weather system.
It was a headache the engine hated you changing stuff instantly.
using skipTime 24;
then skipTime -24;
The clouds wouldn't sync, then the rain wouldn't sync. you'd end up with this grey empty sky.
There is zero consistency with the weather commands and rain and fog are just b0rked.
so you'd have to issue simulWeatherSync;
Which sometimes failed to work.
BI removed a lot of the "weather commands"
like controlling the humidity etc.
Simul weather is just another third party library that causes me more headache than it does good. The other being PhysX and AFM.
They'll apparently fix tanks falling over for no reason, but there is still scenarios where I can't understand why a physics simulation throws around 60 ton vehicles as if they were rubber balls.
AFM is just annoying to implement for a custom helicopter. Mainly because you don't have the tools to create the xml tables.
Like two weeks ago there was this guy that talked about the SAGE engine. There you had all movement properties in a config that you could copy from one vehicle class to another. I wish it were like this in Arma too. Model based masses are just a huge pita.
my random location script seems to send my test object about 620 meters from the center point of the marker
Not sure why, I have the positions hint and it looks right
Why not?
I have spent almost three days making this scenario But I want to say thank you to everyone that helped me script half of this
So guys I want to put in UAV support but I don't know how to do it, does anyone know how?
mhh ... what if ... one would ever do this:
_arr = [];
missionNamespace setVariable ["test", 10];
uiNamespace setVariable ["test", 20];
parsingNamespace setVariable ["test", 30];
profileNamespace setVariable ["test", 40];
_arr pushBack test;
with uiNamespace do
{
_arr pushBack test;
with parsingNamespace do
{
_arr pushBack test;
with profileNamespace do
{
_arr pushBack test;
};
_arr pushBack test;
};
_arr pushBack test;
};
_arr pushBack test;
_arr```
_arr => [10, 20, 30, 40, 30, 20, 10] //Expectation
_arr => [10,20,30,40,30,20,10] //Reality```
Why would https://community.bistudio.com/wiki/selectBestPlaces - consider this - https://i.imgur.com/NQtdmlr.png
https://i.imgur.com/reLZtyW.jpg - a good place? Its inside a rock? Thats not a best place bohemia. Thats a worst place .
Is there a way to get the name of a unit that is displayed in the Eden editor and not the class name?
@frail zephyr https://community.bistudio.com/wiki/roleDescription ?
Ty! I had no clue what to search for and name/title got nowhere.
yeah no problem
@daring pawn I'd always run in to exactly the same problem with that function so ended up rolling my own
it's not so bad to do
I was going to try and add an extra filter to make sure rock objects weren't nearby
But damn, thats soo silly... I was using the "meadow + 2*hills" and its like, oh so you want to be IN the hill!?
Rocks could be in the way of hill definitions
Technically, it doesn't see the rock if that's the case.
Nah seemingly not, but theres filters for "houses" and "DeadBodies" in the bestPlaces commmand for some reason
but a rock is too much ~_~
Oh well, easy to fix.
i never really noticed it until tanoa, there's just so many big rocks on that map
but it does it on any map, the function is bad
I honestly think i'mm better off combining isFlatEmpty and findEmptyPosition for what I want anyway, i just liked the thought of using bestPlaces to select some spots more randomly
There is another option
i guess you could return a load of positions from selectBestPlaces and then just choose one which is >X meters away from rocks
Simply select a rock location find out it's bounding box edges
fuck why didn't i think of that before i wrote my own
You'd need to find a lot though, it also seems to freeze my game on even a very few
displace the player outside those bounding boxes
you don't have to do this during the mission, you could precompute 5000 random positions well in advance
Thats also true. I'm using it to find positions around a player or group of players at different conditions
To like have some "events" happen
Orrr...maybe see if the player is stuck inside the wrock and move the player outside of the rock?
like a crashed heli or something of similar nature, just to add some more variety
Or spawning of a composition
if you move him out of the rock manually then how do you know the new position is a good position?
surely this could just go on forever putting you in bad positions
Yea precreating a bunch of positions and then removing the ones that are inside objects would be a decent idea
if it fits in with the mission i've always been a fan of precomputing as much stuff as possible
@rancid ruin Possibly just continiously ask for a new position that isn't in a rock?
then exit when it's finished
I mean, unless you want to take a guess with seelctBestPlaces again I suppose
but it also needs to adhere to the conditions you feed the BIS function in the first place
like you could move him out of a rock and in to the sea for example
Hmm
by which point you might as well just write a whole new function
Right, that's the idea.
oooooor do it BR/PUBG style, stick them in a parachute and let them find their own random position
guaranteed to probably not land inside a rock
but still possible because arma
Hahahahah.
You'd end up on another map with that ๐
I've always hated that whole community + concept
arma 2 dayz and wasteland was bad for that, people would prone, roll, and glitch below buildings/rocks and camp there
you can probably still do it in arma 3 tbh
Not as bad in arma 3, but yeah.
Its not as bad in A3
{alive _x} count (units fob + units fob1 + units fob2 + units fob3 + units fob4 + units fob5 + units fob6 + units fob7 + units fob8 + units fob9 + units fob10) == 0
Is there anything wrong here?
I tested it once and it worked but I was playing the game to make Sure that The scenario was ready to Launch, {And I think} I killed all the enemies But it wasn't triggering the next Objective. But I'm going to try something and hopefully it works
Ok got it to work
@GeekGuy884#0311 We have script Interruption. Just can't disable it. We also have a FPS Limit cheat only clientside though.
And BIKI page about Arma 3's scheduler also has all that info. Just not as nice I guess I guess we'll just add a link to the VBS page to it.
@GeekGuy884#0311 @GeekGuy884#0311 I hate Discord...
With respect to adding Event Handlers with the command "displayAddEventhandler"; If i add an "onUnload" EH to a menu like this ```sqf
spawnMenuDisplayEH = (findDisplay 12034) displayAddEventHandler ["Unload",{
[] spawn mld_fnc_spawnMenuCancel;
}];
afaik re-add
ok, so the EH is destroyed as soon as the display/dialogs is closed?
Would say yes. But not sure. IMO this would deserve a comment on the displayAddEventHandler wiki page
ok thanks for the help
!alive at1 && at2;
Will this work?
if at2 is a boolean. yes
so.. probably not
you wrote !alive OBJECT && OBJECT https://community.bistudio.com/wiki/a_%26%26_b only takes boolean or code.
So trying to call && with an object will fail
The At1 Is anti-tank Vehicles you have to destroy them
If you want to check both. You have to do that.
The game can't know what you want to do with at2. So you have to tell it that you want to check if it's alive
just add another !alive
Ah yes thats it
(!alive at1) && (!alive at2)
@limpid pewter
Will the EH always trigger when the display Unloads, no matter how many loads and unloads happen?
There can only ever be one unload event per dialog, because after it's been unloaded, it's destroyed. There can be multiple displays of the same type just as there can be multiple vehicles of the same type and they don't share event handlers.
This game still can't add event handlers to classes of dialogs or objects out of the box and needs mods for that, i.e. cba_a3.
if I replace myFunction = {<code>}; by myFunction = compileFinal str {<code>};, would it solve the injenction problem, or compileFinal str {<code>} is not equal to {<code>}?
str {code} returns "{code}" if you compile that it would result in {{code}}
you can just cut off these brackets
good point. besides the brakets, is there any problem (e.g. escaping quotes or else)?
(I see you have been using it, so I guess it is fine)
Didn't have any issue with that while it was being used.. Besides the call to compile crashing the game because we deleted the command ๐
would it solve the injenction problem
No and compileFinal is pointless unless you're using it to prevent the cached function in ui namespace to be overwritten with very primitive methods.
commy2, could you elaborate? Generally, I am trying to move a mission to be run on a public server. I though compileFinal (or putting in on cfgFunctions) was a step of this process.
If they can change the game data with a tool, they can also change a compileFinal'd function with a tool. No difference.
cfgFunctions compileFinal's by default
All compileFinal does is to prevent a function to be overwritten by the game itself. With a tool you can get around everything and you as server owner can do nothing about it.
With Intercept for example you can just swap out the code inside the variable. And ignore the final flag.. Though that is a bad thing to do and no one should ever do it
Think about it. If it were so easy, they'd just implement the magic into everything else.
You can still use it as placebo if you think you feel better afterwards though.
let me then refrase it: what steps do I need to take (on the SQF level) to make a mission public-safe. I do not care about whether there are in-securities on other systems, I care about what I can control
just use CfgFunctions. it compileFinals anyway so users cannot override them.
But if you run without battleye players can do anything anyway
so what do you mean by "safe" ?
Assume battleEye is on.
battleye and bisigning enable. Don't need to worry about compileFinal as players can't do anything anyway
great. That is what I wanted to know. is bisigning needed for a mission, or only for addons?
so, I need that the server verifies the signatures of the addons it uses, right?
If you let people load their own debug console... then they will be able to use it ofacuse
yes
for battleye, I need to declare the right functions in cfgRemoteExec, so that the client can execute server code. Correct?
yes
great. Thanks a lot @still forum and @little eagle, it clarified everything
But we didn't even tell you about params yet
@little eagle Yeah that makes alot of sense about the display EHs, thanks
@little eagle, ok, but I do need to declare the functions in cfgRemoteExec, or is that deprecated or something?
@still forum tell me about them (671 results in 271 files) ๐
ok. Yes, the mission needs it a lot to communicate between the client and the server (since I avoid publicVariable)
1,327 code results in acemod/ACE3
Does anyone has an idea what this error would be?
Error in expression <c"] select Gear;waitUntil {scriptDone processParamsArray}; If (!isNil "PE_PL")> Error position: <processParamsArray}; If (!isNil "PE_PL")> Error Undefined variable in expression: processparamsarray File mpmissions\__cur_mp.Takistan\tfwp_scripts\gear_script\gearSelector.sqf, line 3
waitUntil {scriptDone processParamsArray};
welll..
Undefined variable in expression: processparamsarray
No.. I have absolutly no clue what it could be
Sure won't be a undefined variable. that's for sure
it is defined though
processParamsArray = [] execVM "functions\ParamsArray.sqf";
inside the init file
It's not
?:|
it can still be set to nil if ParamsArray.sqf returns Nil or isn't found
and a variable set to nil is undefined
what is inside ParamsArray.sqf
for [ { _i = 0 }, { _i < count(paramsArray) }, { _i = _i + 1 } ] do
{
_paramName =(configName ((missionConfigFile >> "Params") select _i));
_paramValue = (paramsArray select _i);
_paramCode = ( getText (missionConfigFile >> "Params" >> _paramName >> "code"));
_code = format[_paramCode, _paramValue];
call compile _code;
};
uh
that doesn't return anything
ahh wait
are you sure that processParamsArray is never written to anywhere else?
yep
Can you send me whole mission without the mission.sqm?
or pastebin every scriptfile in there ๐
give me a sec
yup. the script file doesn't exist
ParamsArray.sqf is in functions\ParamsArray.sqf
you are calling processParamsArray = [] execVM "functions\ParamsArray.sqf"; inside tfwp_scripts\init.sqf meaning your working directory is tfwp_scripts and tfwp_scripts\functions\ParamsArray.sqf doesn't exist
execVM "..\functions\ParamsArray.sqf" might work
or you should just use cfgFunctions and spawn instead of execVM
you are even already using cfgFunctions
but not using it.
I do, to spawn gearScript.sqf
just use spawn F_common_fnc_processParamsArray instead of execVM stuff
also the code in fn_processParamsArray is quite bad.. Should tell the F3 guys to optimize that ๐
should I exchange the code with paramsarray and fn_processparamsarray?
what code?
The one I quoted at the begining of the conv
just use fn_processParamsArray via the function name you defined using CfgFunctions
yup
and it can stay inside its original place right? because we are not using execVM anymore
yes
It still goes
Error in expression <c"] select Gear;waitUntil {scriptDone processParamsArray};If (!isNil "PE_PL")> Error position: <processParamsArray};If (!isNil "PE_PL")> Error Undefined variable in expression: processparamsarray File mpmissions\__cur_mp.Takistan\tfwp_scripts\gear_script\gearSelector.sqf, line 3
did you check if f_common_fnc... is the correct name?
maybe I swapped common and fnc
class F // Defines the "owner"
{
class common // catagory
{
file = "functions";
class processParamsArray
{
preInit = 1;
postInit = 1;
};
};
};
I will just put that line in the root folder ini
r u trying to call processparamsarray itself or is it the result of spawning a script?
but processParamsArray itself is code? idk im not thinking straight so im not understanding that. also with no tag defined it should be common_processParamsArray
pretty sure
oh, no common_fnc_processParamsArray
but the F has to be somewhere in there too..
doesn't it default to classname if you don't set a tag?
to the category not the owner (as adir described it)
I actually did not, I was that way ><
it is tag_fnc_function. so F_fnc_processParamsArray
and tag is classname if not set otherwise
category is completly ignored
so it's like f_fnc_processParamsArray
๐
The script is being executed now, but I still get errors
๐
The same errors as before
I'm not using the debug console
Yes.. that's what I'm trying to recommend you to do
put the spawn call into the watch field and check if you get correct result
put your variable into watch field and check if you get correct result
trial and error is only gonna get you so far
no errors when using watch fields
Hey guys I'm making a scenario where you have to escape an island And I want a objective to say pick up your gun In the container, Then when you pick the gun up the game tells you to go to the other objective.
What do I do for the game to realize I have picked up the gun from the container And to tell the character to go to the other objective?
do the watch fields show the correct output
put a trigger area around the container
and as condition primaryWeapon player == "weaponsClassname"
processParamsArray = [] spawn f_fnc_processParamsArray;
returns nothing
waitUntil {scriptDone processParamsArray};
returns true
uhm
ok cool thxs
you mean scriptDone returns true? or waitUntil returns true?
An assignment obviously does not report true. But what does this report:
processParamsArray = [] spawn f_fnc_processParamsArray;
processParamsArray
<NULL-script>
the full code of fn_processparamsarray.sqf
NULL-script is correct
it means scriptDone == true
so it means your scripts are all correct and work properly... but... Arma still thinks the variable is undefined
where is the function that checks scriptDone called from?
I only get those errors
also your cfgFunctions entry is kinda wrong. You are calling the processParamsArray function 3 times. preInit,postInit via cfgFunctions and then again in your init.sqf
you are executing your gearScript via remoteExec
it might arrive and execute on the client before the ParamsArray func....
you are... calling your gear script on every player for every player that joins... meaning for 4 players it executes 4 times on each player.. 16 in total
don't you really want it to execute once on each player?
just execute it in init.sqf then
where does it
why are you using BIS_fnc_MP?
oh
right after you call ParamsArray.sqf
I thought that way it will work with MP ><
ok
why did you think all the other stuff would work without it then?
we could spend over an hour talking about everything that's wrong or unoptimal in your code ^^
But I won't do that if you don't ask specifically ^^
so is it wrong to work with MP? or should i work with MP on everything
no where
unless you need it
but... generally you don't need it
if you don't know if you do. then you don't
init.sqf runs on every client. so no need to make it run on every client again
alright so I just made it a normal execVM..
If I remove the
preInit = 1;
postInit = 1;
and let only the init call the function.
Will it work?
yes
but I would recommend just leaving it in preInit
then you don't even need to call it and don't need the scriptDone check
because you are guaranteed that it will be completed when init.sqf runs
because it runs preinit
.-.
so you said I don't need to waituntil processparamsarray is done?
xes
Where does it 'say" that the script runs 4 times on every player that joins
your BIS_fnc_MP
it executes on local machine and all other players
and it is in init.sqf meaning all players execute it
meaning every player executes it once on local machine and then once on every other player
oh so it's fixed already because I changed it to execVM
like execVM "tfwp_scripts\gear_script\gearSelector.sqf";
I also removed processParamsArray = [] spawn F_fnc_processParamsArray;
why not just execute in initplayerlocal.sqf?
oh yeah.. init.sqf also executes on server. You probably don't want your gear scripts to execute on server
so just move execVM "tfwp_scripts\gear_script\gearSelector.sqf"; to initPlayerLocal.sqf?
Yes
initPlayerLocal.sqf right next to where your init.sqf is
jup jup
it won't give me my gear ๐
you might have to wait for the player object to exist https://community.bistudio.com/wiki/Initialization_Order
I'd recommend postInit. But then you need a !isServer check
I put processParamsArray = [] spawn F_fnc_processParamsArray; back in and it worked
@still forum What do you mean?
Meaning to make sure the script isn't running on the server
Anyone here have any decent experience with ACE ? I'm trying to change the location of the action point on a certain object-type
But can not get it working, interaction point is always centered in model
Thought the arg for position in the addAceInteraction was the function for it, but seems not
@still forum the script won't run whenever I remove processParamsArray = [] spawn F_fnc_processParamsArray;
ยฏ_(ใ)_/ยฏ
:\
@pale wind #channel_invites_list scroll to top and look for ace slack
thanks ๐
i cannot get this trigger to loop for the life of me
true
0 = [] spawn {"marker_4" setMarkerPos getPos asl; "marker_6" setMarkerPos getPos bsl; "marker_5" setMarkerPos getPos csl; "marker_7" setMarkerPos getPos operator}
and im set on keeping this a single mission file for use as a template
this is a trigger that always loops? Is it ever stopped?
never. i could make it stop if the player dies if that helps, but i couldnt figure that out either
i read "while" doesnt work in triggers. again, im set on keeping this a single file
[] spawn {
while {true} do {
"marker_4" setMarkerPos getPos asl; "marker_6" setMarkerPos getPos bsl; "marker_5" setMarkerPos getPos csl; "marker_7" setMarkerPos getPos operator;
sleep 0.5;
};
};
it does
put this into trigger with execute once
or into the init of ONE unit
no wait.. init of one unit might not the that great of an idea
[] spawn {
if (!isNil "markerLoopRunning") exitWith{};
markerLoopRunning = true;
while {true} do {
"marker_4" setMarkerPos getPos asl; "marker_6" setMarkerPos getPos bsl; "marker_5" setMarkerPos getPos csl; "marker_7" setMarkerPos getPos operator;
sleep 0.5;
};
};
There. Put that in as many unit inits as you want. but you only really need one
got it! first one worked. i dont know where you got some of the variables in the second one
imagination and creativity
lesson here is that you can define conditions in the init field
the first one might not work with JIP
other players that join later might not see the markers update
yeah, i read that could be an issue, but in this particular case, i wouldnt need it in a mp environment
Do I even need to remove
processParamsArray = [] spawn F_fnc_processParamsArray;
?
dunno
it will get executed twice if it already runs at preInit
there is no NEED to remove anything
you can have the same code running in a loop a thousand times every frame..
Yo, im trying something and just wanna check, pretty basic but syntax is key.
_a = true;
if (_a) then {do something} else {do something else};
Does that if function search for _a being true or do i need to define it more?
it's fine
I already have a private array with all the variables in the script listed
๐
Thanks for the clarification tho
private before a variable is faster
When I create helicopter and then pilot and gunner I end up with scenario that Helicopter spawns with pilot already in helicopter flying, but gunner spawn at [0,0,0] and heli land and wait untill gunner come from end of map and enter heli. My question is WHY is gunner not in helicopter?
`
_helicopter = createVehicle ["I_Heli_light_03_F", [0,0,0], [], 0, "FLY"];
_helicopter setPos _spawnPos;
_helicopter flyInHeight 50;
_group = createGroup east;
_pilot = _group createUnit ["O_helipilot_F", [0,0,0], [], 0, "FORM"];
_pilot assignAsDriver _helicopter;
_pilot moveInDriver _helicopter;
_gunner = _group createUnit ["O_crew_F", [0,0,0], [], 0, "FORM"];
_gunner assignAsGunner _helicopter;
_gunner moveInGunner _helicopter;
`
Because! eh... mh... Good question..
From WiKi: moveInGunner - move soldier into vehicle gunner position (Immediate, no animation).
maybe first move them in and then setPos/flyInHeight the helicopter
so Wiki is lying, again
@real tartan , works on my machinbe
do you have example mission? I just edited it to: create heli, create pilot, create gunner and AFTER THAT move heli, same result
call {
if (isNull (assignedDriver _vehicle)) exitWith {
_unit moveInDriver _vehicle;
_unit setskill ["aimingAccuracy",0.05];
};
if ((_vehicle emptyPositions "Gunner") > 0) exitWith {
_unit moveInGunner _vehicle;
_unit setskill ["aimingAccuracy",0.01];
};
if ((_vehicle emptyPositions "Commander") > 0) exitWith {
_unit moveInCommander _vehicle;
_unit setskill ["aimingAccuracy",0.01];
};
if (count _turrets > 0) exitWith {
_unit moveInTurret [_vehicle,(_turrets select 0)];
_turrets = _turrets - [ (_turrets select 0)];
_unit setskill ["aimingAccuracy",0.01];
};
if ((_vehicle emptyPositions "cargo") > 0) exitWith {
_unit moveInCargo _vehicle;
_unit setskill ["aimingAccuracy",0.3];
};
};
yes, execVM (for testing)
maybe your heli does not have a gunner
do
player moveInGunner cursorObject when looking at your heli
Either way, I don't have any suspension, but run in scheduled. And never had an issue
Maybe you just don't know that you have suspension
if ((_units select 1) >= 10) then {
_setPos = [(_setPos select 0), (_setPos select 1), 150];
_vehicle = createVehicle [_veh, _setPos, [], 0, "FLY"];
} else {
_vehicle = _veh createVehicle _setPos;
};
_vehicle setDir _dir;
_unitArray = _unitArray - [(_unitArray select 0)];
_turrets = allTurrets [_vehicle,true];
{
_unit = _gName createUnit [ _x, position _vehicle, [], 20, "NONE" ];
_unit addEventHandler ["Killed", aiMaster_fnc_onKilled];
_unit setSkill _skill;
_unit setskill ["aimingAccuracy",0.01];
call {
if (isNull (assignedDriver _vehicle)) exitWith {
_unit moveInDriver _vehicle;
_unit setskill ["aimingAccuracy",0.05];
};
if ((_vehicle emptyPositions "Gunner") > 0) exitWith {
_unit moveInGunner _vehicle;
_unit setskill ["aimingAccuracy",0.01];
};
if ((_vehicle emptyPositions "Commander") > 0) exitWith {
_unit moveInCommander _vehicle;
_unit setskill ["aimingAccuracy",0.01];
};
if (count _turrets > 0) exitWith {
_unit moveInTurret [_vehicle,(_turrets select 0)];
_turrets = _turrets - [ (_turrets select 0)];
_unit setskill ["aimingAccuracy",0.01];
};
if ((_vehicle emptyPositions "cargo") > 0) exitWith {
_unit moveInCargo _vehicle;
_unit setskill ["aimingAccuracy",0.3];
};
};
_unit setskill ["aimingSpeed",0.3];
_unit setskill ["spotTime",0.7];
_unit setskill ["spotDistance",0.8];
_unit setskill ["Courage",0.5];
_unit allowFleeing 0;
true
} count _unitArray;
the call maybe ๐
should not take more than 3 ms, therefor it would be on same ffame
probably not.. but..
yes. should. dunno ^^