Home   Help Search Login Register  

Author Topic: Auto-level script need to be finished  (Read 1732 times)

0 Members and 1 Guest are viewing this topic.

Offline Fabiantronc

  • Members
  • *
Auto-level script need to be finished
« 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 :)

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Auto-level script need to be finished
« Reply #1 on: 14 Oct 2008, 20:52:01 »
Is this for an addon or for general mission use?
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Fabiantronc

  • Members
  • *
Re: Auto-level script need to be finished
« Reply #2 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.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Auto-level script need to be finished
« Reply #3 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.
"When 900 years YOU reach, look as good you will not!"

Offline i0n0s

  • Former Staff
  • ****
Re: Auto-level script need to be finished
« Reply #4 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?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Auto-level script need to be finished
« Reply #5 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).

Offline Fabiantronc

  • Members
  • *
Re: Auto-level script need to be finished
« Reply #6 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?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Auto-level script need to be finished
« Reply #7 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.

Offline Fabiantronc

  • Members
  • *
Re: Auto-level script need to be finished
« Reply #8 on: 18 Oct 2008, 03:40:42 »
Is anyone interested in make that script?