OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Fabiantronc on 14 Oct 2008, 04:12:13

Title: Auto-level script need to be finished
Post by: Fabiantronc on 14 Oct 2008, 04:12:13
Hello.

The last week I suggested on the Spanish GIR clan forum a script for an airplane.
Well, -YO- made a script for a auto level script but I failed when I tried to add to an airplane.

My idea it's that will be appear a message when you are flying, the message will be like the Eject function or the Afterbuner function. If you are at 500 meters above sea level and if you active the auto level script the plane will be stay at the same altitude when you activated the script.

Well, that's my idea. My knowledge of script are bad and I can't understand how works scripts by this moment.

Code: [Select]
planeo_activo = [avion] execVM "planeo.sqf"

Script: planeo.sqf
_avion = _this select 0;
_altura = getPos _avion select 2;
_alturaASL = getPosASL _avion select 2;

while {true} do
{
_diferencial = (getPosASL _avion select 2)-_altura;
_avion flyInHeight (_altura-_diferencial);
sleep 2;
};

Translation
planeo_activo = active_glide
avion = airplane
planeo = glide
altura = altitude
diferencial = differential

Thanks in advance :)
Title: Re: Auto-level script need to be finished
Post by: h- on 14 Oct 2008, 20:52:01
Is this for an addon or for general mission use?
Title: Re: Auto-level script need to be finished
Post by: Fabiantronc on 15 Oct 2008, 01:41:04
I want this will be inside addon, but I think the code it's only for use on the editor.
Title: Re: Auto-level script need to be finished
Post by: Wolfrug on 15 Oct 2008, 10:12:15
I think you'll get better answers on the code in the general editing section --> moving.

If it turns to discussion about how to implement it in the addon, that can be given a new topic I think :)

Wolfrug out.
Title: Re: Auto-level script need to be finished
Post by: i0n0s on 15 Oct 2008, 11:00:20
Ok, then let's ask a few questions:
-AI pilot?
-ASL or above ground?
-How far should the pilot be able to control the plane while the script is active?
Title: Re: Auto-level script need to be finished
Post by: Mandoble on 15 Oct 2008, 11:36:51
Well, that doesnt work that way as _avion flyInHeight (_altura-_diferencial); will work only for AI and only if you add a move, doMove or commandMove command just after this. So each flyInHeight needs to be followed by some form of move command to activate it (you may even try to order it to move to its current position too). The AI will tend also to ignore flying heights if they are engaging some enemy. So, if you want to create something more standard, valid for AI but also for human controlled planes, you may simply play with setVelocity command to apply some positive Z when the altitude goes below the indicated one to compensate it. That Z may start with current Z (velocity vector select 2) and then you "slowly" increase it until you get a climbing attitude, you may keep applying this velocity override until the plane crosses the alt limit going up (and only if canMove returns true, else it is natural that the plane goes down and down til crash).
Title: Re: Auto-level script need to be finished
Post by: Fabiantronc on 16 Oct 2008, 01:30:27
Well, the script it's oriented for human players, I don't know if this will be usable on AI.

Like the auto-pilot, the script will be manage your plane, if you activate it the plane will be on horizontal position and I suposse will be stay with the same velocity when you activate the script.

What do you think?

It's possible to do it or it's too difficult?
Title: Re: Auto-level script need to be finished
Post by: Mandoble on 16 Oct 2008, 01:38:23
It is possible using setVelocity to generate the recover when needed (climb up), but not with flyInHeight, as it affects AI only.
Title: Re: Auto-level script need to be finished
Post by: Fabiantronc on 18 Oct 2008, 03:40:42
Is anyone interested in make that script?