Project X Forums
http://px.worms2d.info/forum/

Some weapon ideas: Zeppelin, Spitfire, Helicopter revisions
http://px.worms2d.info/forum/viewtopic.php?f=15&t=594
Page 1 of 2

Author:  -raffie- [ Sun Jan 27, 2013 2:03 pm ]
Post subject:  Some weapon ideas: Zeppelin, Spitfire, Helicopter revisions

After having a couple games with in-between turn floating helicopters (/ts enabled) and a couple changes I made to the Helicopter, I think there's some very cool possibilities with floating weapons:

Zeppelin:

Once selected, the worm is in the Zeppelin and can float around in it (slowly) and use weapons from it. The Worm in Zeppelin should definitely remain in the air in between turns.
Once hit, the Zeppelin doesn't explode immediately, but starts to burn, really hard (I'm thinking Pyro's fire would look cool) and slowly comes down (or faster if hit with big weapon) until it hits the ground and then explodes with lots of persistant fire.

The Zeppelin would be affected by wind, while going in a direction as well as when idle. I don't know if it's at all possible to have this while the worm is not active without desync?

(could use the sprite I made for this map, I can make any additional sprites)

Spitfire:

The WWII plane with it's epic look and sound. Would take off horizontally, so need a little bit open space, have on-board machine gun (also with epic sound effect). Comes down pretty fast when no forward motion, or when out of fuel (but still controllable). I'm also thinking kamikaze style hits, come from great height and target worm on ground. (I've made little script more speed = bigger explosion for Helicopter)


Helicopter revisions:

Some changes I made to the Heli script by StepS:
- Crash explosion size controlled by fuel left in tank, as well as the speed with which the Helicopter was flying. I didn't intend for the Heli to run out of fuel really, but just to be a factor in crash explosion size, the way I did this was: fuel = 200. 200 to 100 controls explosion size and decreases normally, 100 to 0 is minimal explosion size and decreases very slowly.
- Upward motion uses the most fuel, left/right very little, downward none.

Some more ideas i had for the Helicopter:
- Exhaust fumes come out of Heli
- Some sort of on-board weapon like Spitfire, but different (if the Spitfire would ever become reality) like for example Missiles.
- Possible to have it remain airborn inbetween turns without using /ts?


Maybe a system of gas crates (with own sprite that really make it a gas can) that add up gas to the entire team's fuel total and thus controls wether you can keep your Helicopters (that remain airborn inbetween turns) in the air?

Author:  -raffie- [ Sun Jan 27, 2013 2:05 pm ]
Post subject:  Re: Some weapon ideas: Zeppelin, Spitfire, Helicopter revisi

I'll just post the Heli script by StepS, with my alterations:

Code:
CSprite* HeliAnim;
CSprite* HeliJumpIn;

override CWorm::CWorm(CObject* Parent,int aTeam,int aIndex,CWormParams* params)
{
    fixed hframenum;
    fixed jumpinframenum;
    fixed explosionSize;
    fixed SpeedAverage;
    super;
}

void helicopter_SCRIPT::InitGraphic()
{
    CFile* f;
    f = GetAttachment("heli-anim.png");           HeliAnim   = LoadSprite(f, 3, 1);
    f = GetAttachment("heli-jumpin-sprite.png");  HeliJumpIn = LoadSprite(f, 23, 1);
}

override void CWorm::Message(CObject* sender,EMType Type,int MSize,CMessageData* MData)
{
    CWorm* w = GetCurrentWorm();
    local Shifth = keySync->KeyPressed(16);
   
        if (Type == M_FRAME)
        {
            if (ObjState == WS_FIRED && CurWeapon->CheckName("Helicopter"))
            {
                jumpin = true;
                jumpinframenum = jumpinframenum + 0.047;
            }
       
            if (helicopter)
            {
                if (helilaunch)
                {
                    JetFuel = 200*65536;
                    jumpinframenum = 0;                     
                    jumpin = false;
                    helilaunch = false;
                }
               
                if (PressedUp == 0 && PressedDown == 0) SpY = SpY / 1.05;
                if (PressedLeft == 0 && PressedRight == 0) SpX = SpX / 1.05;
                if (PressedUp == 1 && PressedDown == 1) SpY = SpY / 1.05;
                if (PressedLeft == 1 && PressedRight == 1) SpX = SpX / 1.05;
               
                     if (hframenum == 0.99) hframenum = 0.00;
                else if (hframenum == 0.50) hframenum = 0.99;
                else if (hframenum == 0.00) hframenum = 0.50;
               
                if (PressedUp == 1)
                {
                    PressedUp = 0;
                    if (JetFuel > 100*65536){
                       if (Root->RetreatTimer == 0) JetFuel -= 0.2*65536;
                    } else
                    {
                       if (Root->RetreatTimer == 0) JetFuel -= 0.020*65536;
                    }
                   
                    if (SpY > -10)
                    {
                        SpY -= 0.2;
                    }
                }
               
                if (PressedDown == 1)
                {
                    PressedDown = 0;
                    //if (Root->RetreatTimer == 0) JetFuel -= 0.020*65536;
                   
                    if (SpY < 10)
                    {
                        SpY += 0.2;
                    }
                }
               
                if (PressedLeft == 1)
                {
                    PressedLeft = 0;
                    if (Root->RetreatTimer == 0) JetFuel -= 0.010*65536;
                    if (w != NullObj) {if (!Shifth) TurnSide = -1;}
                   
                    if (SpX > -10)
                    {
                        SpX -= 0.2;
                    }
                }
               
                if (PressedRight == 1)
                {
                    PressedRight = 0;
                    if (Root->RetreatTimer == 0) JetFuel -= 0.010*65536;
                    if (w != NullObj) {if (!Shifth) TurnSide = 1;}
                   
                    if (SpX < 10)
                    {
                        SpX += 0.2;                                         
                    }
                }
               
                if (ObjState != WS_JETPACK)
                {
                    if (SpY == 0 && ObjState != WS_FIRED && ObjState != WS_TELEPORTING) SetState(WS_FLYING);
                    GravityFactor = 1;
                    helicopter = false;                                 
                }
               
                else if (JetFuel <= 1*65536)
                {
                    DoExplosion(PosX,PosY,100,10,0,0);
                    GravityFactor = 1;
                    helicopter = false;
                }
               
                else if (disableheli)
                {
                    if(SpX == 0)
                     { SpeedAverage = abs(SpY)*20; }
                     else{
                    SpeedAverage = (abs(SpY) + abs(SpX))/1;
                    }
                    explosionSize = ((JetFuel/65536-75)/10)*SpeedAverage;
                    if (explosionSize < 10){
                       explosionSize = 10;
                    }

                    DoExplosion(PosX,PosY,100,explosionSize,0,0);
                    GravityFactor = 1;                                       
                    helicopter = false;
                    disableheli = false;
                }                                                               
            }
        }
       
        if (Type == M_TURNEND)
        {
            if (ObjState != WS_JETPACK && helicopter)
            {
                DoExplosion(PosX,PosY,100,10,0,0);
                GravityFactor = 1;
                helicopter = false;                                 
            }
           
            else if (helicopter)
            {
                SpX = 0;
                SpY = 0;
            }
        }
       
        if (Type == M_DRAWQUEUE)
        {
            if (helicopter)
            {
                if (TurnSide > 0)
                {
                    AddSpriteEx(4,PosX,PosY,HeliAnim->Index,hframenum,sin(SpX/24),1);
                }
               
                else
                {
                    AddSpriteEx(4,PosX,PosY,HeliAnim->Index+262144,hframenum,sin(SpX/24),1);
                }
            }
           
            else if (jumpin)
            {
                if (TurnSide > 0)
                {
                    AddSpriteEx(4,PosX-11.5,PosY+1,HeliJumpIn->Index,jumpinframenum,0,1);
                }
               
                else
                {
                    AddSpriteEx(4,PosX+12.5,PosY+1,HeliJumpIn->Index+262144,jumpinframenum,0,1);
                }
            }
        }
super;
}

override void CWorm::RenderWorm()
{
    if (!helicopter && !jumpin) super;


override void CWorm::Collide(CGObject* Obj,int type)
{
    if (helicopter)
    {
        if (Obj != NullObj)
        {
            if (Obj->ClType != OC_Mine) disableheli = true;
        }
    }
   
    super;
}


override void CWorm::FireFinal(CWeapon* Weap,CShootDesc* Desc)
{
    if (Weap->CheckName("Helicopter"))
    {
        GravityFactor = 0;
        helicopter = true;
        helilaunch = true;
    }
    super;
}

Author:  stRiNgkiNg [ Mon Jan 28, 2013 10:29 pm ]
Post subject:  Re: Some weapon ideas: Zeppelin, Spitfire, Helicopter revisi

cool man! Good ideas, but ya know... the heli could reeaaalllly use a basic sound loop from the propellers rotating. It just needs to be there. I like the idea of heli not using fuel when moving downward - very good


So i could just copy the above script into my heli lib and it would do all the things you mentioned?

Author:  PyroMan [ Mon Jan 28, 2013 10:39 pm ]
Post subject:  Re: Some weapon ideas: Zeppelin, Spitfire, Helicopter revisi

stRiNgkiNg wrote:
cool man! Good ideas, but ya know... the heli could reeaaalllly use a basic sound loop from the propellers rotating. It just needs to be there. I like the idea of heli not using fuel when moving downward - very good


So i could just copy the above script into my heli lib and it would do all the things you mentioned?


wait, i would recommend dont replace or make copies of libs, but just override with adjustments into independed libs. Or suggest to StepS with this ideas.
I can make some overrided libs for that, but need some time

Author:  stRiNgkiNg [ Tue Jan 29, 2013 4:28 am ]
Post subject:  Re: Some weapon ideas: Zeppelin, Spitfire, Helicopter revisi

well if i was to replace the stuff i wouldn't save over the original name. And before i even hosted with it I would play single-player first just to test it

Author:  PyroMan [ Wed Jan 30, 2013 8:25 am ]
Post subject:  Re: Some weapon ideas: Zeppelin, Spitfire, Helicopter revisi

Alright, mate.
First of all i`ve noticed that you using old StepsWeaps5. In your version helicopter was a lil wrong working, often coused loosing control after being disabled. Steps fixed that + separated helicopter and swimsuit script out of stepsweaps5 library. So u dont need override it all. And i will recommend upgrade his weaps.

The problem with your SpY, SpX readings was that you tryed to read them after collision. Bollean "disableheli" activates from CWorm::Collide function. Apparently after collision worm looses some speed.
I`ve made him to read speed and calculate damage before that speed valueswill change coz collision.
So now you have working script.

As lons, as its all written on CWorm (not as new CObject/CGObject) - overriding will be pretty hard. + too many changes, so better have separated helicopter script.
There u have it:
http://www.ex.ua/view_storage/605586767056

Author:  PyroMan [ Wed Jan 30, 2013 8:32 am ]
Post subject:  Re: Some weapon ideas: Zeppelin, Spitfire, Helicopter revisi

Quote:
Maybe a system of gas crates (with own sprite that really make it a gas can) that add up gas to the entire team's fuel total and thus controls wether you can keep your Helicopters (that remain airborn inbetween turns) in the air?


remeber my healing zones? they add fuel. I can make those zones to work as map objects, with adjusted script and sprites. Or how should they work? I mean how should they spawn on map? or simply like crates?

Author:  -raffie- [ Wed Jan 30, 2013 9:22 pm ]
Post subject:  Re: Some weapon ideas: Zeppelin, Spitfire, Helicopter revisi

First off thanks for your help with helicoper Pyro, much appreciated,
My idea for gas was indeed for simple 'crate' but with a unique sprite (I can do it if it's possible to code) and if possible have a Team supply of gas (so gas adds up to team, not to 1 Heli).
But I'll be happy with anything u can come up with offcourse

Author:  -raffie- [ Mon May 13, 2013 7:58 am ]
Post subject:  Re: Some weapon ideas: Zeppelin, Spitfire, Helicopter revisi

I was fiddling with the Helicopter code a bit, and adding a 'turbo' mode to it, I noticed that even though I changed the value for maximum speed from 10 to 200, it doesn't go any faster (with /ts on of course), Isn't /ts supposed to remove speed of object limits?

I was also trying to insert some random worms facial expressions, like for example, the worm blinking, looking outside the window... at random points just as a normal idle worm does. I've done some sprites, but I can't code it :?

Attachments:
helicopter_SCRIPT.rar [1.92 KiB]
Downloaded 711 times

Author:  PyroMan [ Wed May 15, 2013 11:36 pm ]
Post subject:  Re: Some weapon ideas: Zeppelin, Spitfire, Helicopter revisi

Max speed for CGObjects is 32 pixels per frame. At least i couldn't make it faster yet.

Page 1 of 2 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/