fighter lua

fighter lua

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

fighter lua

Post by Gota »

http://pastebin.com/m529b89a4

This is a lua script made by CarRepairer(thx a lot)that makes gunships do flybys as they attack.
There is an issue however since it does not work in many cases for example when you give an attack command to several fighters.
Can anyone see a better way of implementing this?or maybe an easy way to patch this up?
Is there a chance someone will add some options to air behavior in the engine so it is more flexible?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: fighter lua

Post by smoth »

Gota wrote:Is there a chance someone will add some options to air behavior in the engine so it is more flexible?
seriously... asking the same question over and over again does not make people want to comply.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: fighter lua

Post by Gota »

smoth wrote:
Gota wrote:Is there a chance someone will add some options to air behavior in the engine so it is more flexible?
seriously... asking the same question over and over again does not make people want to comply.
Well i know of at least one other game maker that would like it to be more flexible.
The more people are in need of a certain implementation the more chances it will get implemented?
Especially since this is not(from what i understand) some grandiose undertaking(not that i disrespect anyone's time).
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: fighter lua

Post by smoth »

Indeed, it is well known that you want ota flight behaviors and the bugs*features* that come with it. However, as mentioned in that moderator thread. you seem to not understand no is the end of it. You continue to ask over and over and over again. As a child this may work when begging for toys or candy but as an adult you will find this approach actually makes people less likely to do it. Not that I am trying to pick on you but lately you say you want to get better. This is one of the key things that alienates you from other content devs who actually could help you.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: fighter lua

Post by Gota »

If you want to make enemies, try to change something. ~Woodrow Wilson
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: fighter lua

Post by smoth »

you are not Woodrow Wilson.
User avatar
Otherside
Posts: 2296
Joined: 21 Feb 2006, 14:09

Re: fighter lua

Post by Otherside »

its been a while since GOTA last made an OTA flight behaviour thread good to know hes trying to change... :p
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: fighter lua

Post by Niobium »

If you could make a bomber attack like a gunship, then you'd be in business, with all the fly-by stuff done for you. Some sort of fake bomb weapon to get the behavior, then another weapon which shoots down on things in it's path. Will be a lot less buggy then trying to hack it in with lua.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: fighter lua

Post by Gota »

what i need is gunship movement but without gunship attack.the attacking needs to be fly bys.
How would i make bombers move like gunships...If i knew that there would be no problem.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: fighter lua

Post by Pressure Line »

In may 2009 I wrote:Solution to Gota's problem, will probably need some tweaks.

Fake weapon!

Code:
[LOCKBREAKER]
{
name=Lock Breaker;
rendertype=0;
lineofsight=1;
turret=1;
range=360;
minintensity=1;
reloadtime=1;
energypershot=0;
weaponvelocity=2500;
areaofeffect=14;
firestarter=90;
beamlaser=1;
thickness=3;
corethickness=0.2;
laserflaresize=10;
targetmoveerror=0.2;
beamtime=0.15;
rgbcolor=0 0 1;
tolerance=10000;
impulsefactor=0.123;
impulseboost=0.123;
cratermult=0;
craterboost=0;
noselfdamage=1;
projectiles=0;
toairweapon=1;
[DAMAGE]
{
default=1;
}
}


In the unit .fbi/.lua!

Code:
weapon2=LOCKBREAKER;
OnlyTargetCategory2=VTOL;
weaponmaindir2=0 0 -1;
maxangledif2=180;
weaponslaveto2=1;


Code:
Drag=0.00;
maxBank=0.4; //0.8
maxPitch=0.225; //0.45
maxRudder=0.016; //0.004


In the script!

At the start or in an include...
Code:
#define CHANGE_TARGET 98

With the rest of the weapon code...
Code:
QueryWeapon2(piecenum)
{
piecenum = rearthrust; //or some other suitable location, it doesn't really matter.
}

AimWeapon2(heading, pitch)
{
return( TRUE );
}

FireWeapon2()
{
set CHANGE_TARGET to 1;
}


This stuff should break the target lock of a fighter if its intended (air) target is too close behind it, forcing it to choose another target. It also has changes to .fbi/.lua values to make the figters handle more like ota gunships. Tested, seems to work quite well, but ymmv.

NOW SHUT UP BECAUSE I DON'T WANT TO HEAR ANY MORE ABOUT IT!
just drop maxBank (about 0.3 should do) and keep buffing maxRudder (try 0.02 first, small increments are the key) until it's working as you want. this will work 100% of the time, and wont crapout nomatter how many planes you have selected.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: fighter lua

Post by Gota »

THX i will try this but the biggest issue with fighters is that even if they turn sharply they still have this tag that tells them how long they should fly before turning around and flying back to the target(air or land target).
This also controls you ability to turn them around.
If a fighter is flying forward and you want it to turn around you have to click behind it at a certain distance that is the number in that tag.
If you do not click far enough behind him he will keep flying until he reaches this minimum distance and than he will turn around.
This makes microing them annoying as hell (same with bombers).

If this tag was split to when the airplane is controlled by the ai and when the player controls it and gives it move orders the issue would have been solved but ...
Hmm perhaps this "splitting" can be done with lua?

The tag is called turnradius and it not only controls the minimal radius the fighter will fly before turning back to the target but also the movement to any point.
When you click behind it it treats it liek its that place is a target and keeps moving forward until the distance from it to the clicked location is = to the turn radius.
Last edited by Gota on 04 Dec 2009, 10:07, edited 2 times in total.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: fighter lua

Post by Gota »

Your solution is meant to work when the unit is a fighter or when it has hoverattack=1?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: fighter lua

Post by Argh »

There isn't any way to do a dual-state for flying things atm. Aircraft parameters are not currently accessible via Gadgets.

Seriously... what needs to be done is for somebody to write a complete MoveCtrl solution for aircraft, and ditch the current aircraft code entirely. No, I don't have time atm, too much other crap piled up, don't ask.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: fighter lua

Post by Pressure Line »

Gota wrote:Your solution is meant to work when the unit is a fighter or when it has hoverattack=1?
fighter.
Post Reply

Return to “Lua Scripts”