OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started 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.
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 :)
-
Is this for an addon or for general mission use?
-
I want this will be inside addon, but I think the code it's only for use on the editor.
-
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.
-
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?
-
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).
-
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?
-
It is possible using setVelocity to generate the recover when needed (climb up), but not with flyInHeight, as it affects AI only.
-
Is anyone interested in make that script?