Subversion Repositories nw_plus

Rev

Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
--------------------------------------------------------------------------------
Duke: Nuclear Winter
By Joris Weimar
© 1997 Simply Silly Software
--------------------------------------------------------------------------------
Duke: Nuclear Winter Plus
By Hendricks266
--------------------------------------------------------------------------------
*/

state checkcommhitstate

  ifhitweapon
  {
    guts JIBS6 2

    ifdead
    {
      ifwasweapon FREEZEBLAST
      {
        sound SOMETHINGFROZE
        spritepal 1
        move 0
        action ACOMMFROZEN
        strength 0
        state icesmoke
        break
      }
      else
        ifwasweapon GROWSPARK
      {
        sound ACTOR_GROWING
        ai AICOMMGROW
        break
      }

      addkills 1 state specialdeath

      ifwasweapon RADIUSEXPLOSION
      {
        spawn BLOODPOOL
        sound SQUISHED
        state standard_jibs
        killit
      }
      else
        ifwasweapon RPG
      {
        sound SQUISHED
        spawn BLOODPOOL
        state standard_jibs
        killit
      }

      sound COMM_DYING
      ai AICOMMDYING
    }
    else
    {
      soundonce COMM_PAIN
      ifwasweapon SHRINKSPARK
      {
        sound ACTOR_SHRINKING
        ai AICOMMSHRUNK
      }
      else
        ifwasweapon GROWSPARK
          sound EXPANDERHIT
      else
        ifrnd 24
          ai AICOMMABOUTTOSHOOT
    }
  }
ends

state commshootbot

state calczdist
ldist xydist THISACTOR target
ifvare xydist 0 setvar xydist 1

ifvarand monstflags 32
{
        mulvar zdist 768
        divvarvar zdist xydist
        setprojectile[ELECTROPROJ].workslike 36866
        ezshoot zdist ELECTROPROJ
        setthisprojectile[RETURN].extra 50
        ifvarand monstflags 8
        {
                ezshoot zdist ELECTROPROJ
                setthisprojectile[RETURN].extra 50
        }
        setprojectile[ELECTROPROJ].workslike 32770
}
ifvarand monstflags 16
{
        eshoot FIREBALLPROJ 
        ifvarand monstflags 8 
        {
                setthisprojectile[RETURN].pal 13
                setthisprojectile[RETURN].extra 64
        }
} 
else
{
        mulvar zdist 644
        divvarvar zdist xydist
        ezshoot zdist FREEZEBLAST // NOAIM
        ifvarand monstflags 8 setactor[RETURN].extra 100
        setactor[RETURN].ang sprite[THISACTOR].ang

}


resetactioncount

ends

state commshooting

ifvarn target -1 { state commshootbot break }

ifvarand monstflags 32
{
        eshoot ELECTROPROJ
        setthisprojectile[RETURN].extra 50
        ifvarand monstflags 8
        {
                eshoot ELECTROPROJ
                setthisprojectile[RETURN].extra 50
        }
} else
ifvarand monstflags 16
{
        eshoot FIREBALLPROJ 
        ifvarand monstflags 8 
        {
                setthisprojectile[RETURN].pal 13
                setthisprojectile[RETURN].extra 64
        }
} 
else
{
        shoot FREEZEBLAST
        ifvarand monstflags 8 shoot FREEZEBLAST
}


resetactioncount

ends

actor COMMANDERSTAYPUT COMMANDERSTRENGTH
  cactor COMMANDER
  ai AICOMMABOUTTOSHOOT
enda

state commspinbotstate

getactor[target].x mx
getactor[target].y my
getactor[target].z mz
getactor[THISACTOR].x x
getactor[THISACTOR].y y
getactor[THISACTOR].z z
subvarvar mx x
subvarvar my y
getangle angvar mx my

cos xvel angvar
sin yvel angvar
shiftvarr xvel 7
shiftvarr yvel 7
subvarvar z mz 
ifvarg z 2048
setvar zvel -512 else
ifvarl z -2048 setvar zvel 512
movesprite THISACTOR xvel yvel zvel CLIPMASK0 RETURN

    soundonce COMM_SPIN
    ifcount 16
    {
      ifvarl xydist 1280
      {
            setvar nw_temp CAPTSPINNINGPLAYER
        ifvarand monstflags 8 mulvar nw_temp -2 else mulvar nw_temp -1
        setactor[target].htextra nw_temp
        setactor[target].htpicnum RPG
        setactor[target].htowner THISACTOR
        //sound DUKE_GRUNT
        resetcount
      }
      else
        ifvarg xydist 2300
          ai AICOMMWAIT
    }
    ifactioncount 52
      ai AICOMMWAIT
    ifnotmoving
      ifrnd 32
        operate

ends

state commspinstate

getplayer[THISACTOR].posx mx
getplayer[THISACTOR].posy my
getactor[THISACTOR].x x
getactor[THISACTOR].y y
subvarvar mx x
subvarvar my y
getangle angvar mx my

cos xvel angvar
sin yvel angvar
shiftvarr xvel 7
shiftvarr yvel 7
setvar zvel 0
movesprite THISACTOR xvel yvel zvel CLIPMASK0 RETURN 

    soundonce COMM_SPIN
    ifcount 16
    {
      ifpdistl 1280 ifvarg canshootplayer 0
      {
        addphealth CAPTSPINNINGPLAYER
        ifvarand monstflags 8 addphealth CAPTSPINNINGPLAYER
        sound DUKE_GRUNT
        palfrom 32 16 
        resetcount
      }
      else
        ifpdistg 2300
          ai AICOMMWAIT
    }
    ifactioncount 52
      ai AICOMMWAIT
    ifnotmoving
      ifrnd 32
        operate
        
ends

state commfrisbeestate

setvar weapcount -1
ifcount 6
{
        ifcount 7 nullop else
        {
                getplayer[THISACTOR].posx mx
                getplayer[THISACTOR].posy my
                getactor[THISACTOR].x x
                getactor[THISACTOR].y y
                subvarvar mx x
                subvarvar my y
                getangle peractor5 mx my
        }
        
        cos xvel peractor5
        sin yvel peractor5
        shiftvarr xvel 5
        shiftvarr yvel 5
        setvar zvel 0
        movesprite THISACTOR xvel yvel zvel CLIPMASK0 RETURN
        ifvarn RETURN 0
        {
                addvar RETURN 16384
        ifvarl RETURN 16384
        ifvarg RETURN -1 // hit a sprite
        {
                getactor[RETURN].picnum nw_picnum
                getactorvar[RETURN].monstatus nw_temp
                ifvare nw_picnum APLAYER sound SQUISHED else
                ifvare nw_temp 1 sound SQUISHED
                setactor[RETURN].htpicnum RPG
                setactor[RETURN].htextra 100
                setactor[RETURN].htowner THISACTOR
                setactor[RETURN].htang peractor5
                sound COMM_ATTACK
                
        }
        ai AICOMMWAIT
        setvar weapcount 0
    }
}

    soundonce COMM_SPIN
    
      ifpdistl 1280
      ifvarg canseeplayer 0
      {
        addphealth -1
        ifvarand monstflags 8 addphealth -1
        sound DUKE_GRUNT
        palfrom 32 16 
      }
      
    
    ifactioncount 52
    {
      ai AICOMMWAIT
      setvar weapcount 0
    }
ends

actor COMMANDER COMMANDERSTRENGTH

ifvarn target -1
{
        getactor[THISACTOR].z z
        getactor[target].z mz
}

  state checksquished
  state monsterai
  ifaction ACOMMFROZEN
  {
    fall

    ifcount THAWTIME
    {
      getlastpal
      ai AICOMMWAIT
    }
    else
      ifcount FROZENDRIPTIME
    {
      ifactioncount 26
      {
        spawn WATERDRIP
        resetactioncount
      }
    }

    ifhitweapon
    {
      ifwasweapon FREEZEBLAST
      {
        strength 0
        break
      }
      addkills 1 state specialdeath

      ifrnd 84
        spawn BLOODPOOL
      lotsofglass 30
      state standard_jibs
      sound GLASS_BREAKING
      killit
    }
    ifp pfacing
      ifpdistl FROZENQUICKKICKDIST
      ifvare superkicking 0
        pkick
    break
  }
  ifai 0
    ai AICOMMSHOOT
  else
    ifai AICOMMWAIT
  {
    ifcount 20
    {
          ifvarn target -1
          {
                  ifrnd 96
                    ai AICOMMGET
                  else
                    ai AICOMMABOUTTOSHOOT
          }
          else
          {
                  ifvarand monstflags 2048
                  {
                          ifvarg targetlock 0
                          {
                                ifrnd 96
                      ai AICOMMGET
                    else ifvare playerally 0
                      ai AICOMMABOUTTOSHOOT
                  }
                  else
                     ai AICOMMGET
              }
              else
              
              ifvarg canseeplayer 0
              {
                ifvarg canshootplayer 0
                {
                  ifrnd 96
                    ai AICOMMGET
                  else ifvare playerally 0
                    ai AICOMMABOUTTOSHOOT
                }
              }
              else
                ai AICOMMGET
      }
    }
  }
  else
    ifai AICOMMABOUTTOSHOOT
  {
        ifvare target -1 ifvarn playerally 0 { ai AICOMMGET break }
    ifactioncount 2
    {
          ifvarn target -1 ai AICOMMSHOOT else
      ifvarg canseeplayer 0 ifvare playerally 0
        ai AICOMMSHOOT
      else
      {
        ai AICOMMGET
        break
      }
    }
    ifrnd 32 soundonce COMM_ATTACK
  }
  else
    ifai AICOMMSHOOT
  {
        ifvare target -1 ifvarn playerally 0 { ai AICOMMGET break }
        setvar nw_temp 0
        ifvarn target -1 setvar nw_temp 1
        ifvarand monstflags 2048
        ifvare playerally 0
        {
                ifangdiffl 512 
                { 
                        ai AICOMMFRISBEE 
                        break 
                } 
                else ifvarg targetlock 0 setvar nw_temp 1 
        } else
        ifvarg canshootplayer 0 setvar nw_temp 1
    ifvare nw_temp 1
    {
      ifcount 24
        ifrnd 16
          ai AICOMMWAIT
      ifactioncount 2
      {
            state commshooting
      }
    }
    else
      ai AICOMMGET
  }
  else
    ifai AICOMMSHRUNK
  {
    ifcount SHRUNKDONECOUNT
      ai AICOMMGET
    else
      ifcount SHRUNKCOUNT
        sizeto 48 40
    else
      state genericshrunkcode
  }
  else
    ifai AICOMMGROW
      state genericgrowcode
  else
    ifai AICOMMGET
  {
        ifvarn playerally 0 ifvare target -1 ifpdistl 1280 { ai AICOMMWAIT break }
    ifnotmoving
      ifrnd 4
        operate
    ifvare playerally 0
    ifpdistl 1280
      ifp palive
    {
      sound COMM_SPIN
      ai AICOMMSPIN
      break
    }
    ifvarn target -1
      ifvarl xydist 1280
    {
          sound COMM_SPIN
          ai AICOMMSPIN
          break
    }

    ifvarg canseeplayer 0
    {
          setvar nw_temp 0
          ifp phigher setvar nw_temp 1
          ifvarn target -1
          ifvarvarg z mz setvar nw_temp 1
          
      ifvare nw_temp 1
        move COMMGETUPVELS getv geth faceplayer
      else
        move COMMGETVELS getv geth faceplayer
    }
    ifactioncount 8
      ifrnd 2
        ai AICOMMABOUTTOSHOOT
  }
  else
    ifai AICOMMSPIN
  {
        ifvarn target -1 state commspinbotstate else
        state commspinstate
  }
  else ifai AICOMMFRISBEE state commfrisbeestate

  ifai AICOMMDYING
  {
    fall
    strength 0

    ifhitweapon
      ifwasweapon RADIUSEXPLOSION
    {
      sound SQUISHED
      spawn BLOODPOOL
      state standard_jibs
      killit
    }

    ifaction ACOMMDYING
      ifactioncount 8
    {
      iffloordistl 8
        sound THUD
      cstat 0
      action ANULLACTION
      //action ACOMMDEAD
      move 0
      cactor COMMANDERCORPSE
    }
  }
  else
  {
    ifrnd 2
      soundonce COMM_ROAM
    state checkcommhitstate
  }
enda




useractor enemy TANK TANKSTRENGTH fall
  state monsterai
  ifaction 0
  {
   // sizeat 60 60
    action ATANKWAIT
    cstat 257
    clipdist 100
  }
  else
    ifaction ATANKSPIN
  {
    soundonce TANK_ROAM

    ifactioncount 20
    {
          ifvare target -1 ifvarn playerally 0 nullop else
      ifrnd 16
        ifvarg canseeplayer 0
          ifvarg canshootplayer 0
      {
        move STOPPED geth
        action ATANKSHOOTING
        stopsound TANK_ROAM
      }
    }

    ifrnd 16
      move TANKFORWARD seekplayer
  }
  else
    ifaction ATANKSHOOTING
  {
        ifvarn target -1 state tankshootbot else
        {
                ifvarn playerally 0 { move 0 action ATANKWAIT break }
            ifactioncount 22
            {
              ifpdistg 8192
              {
                sound BOS1_ATTACK2
                shoot MORTER
                ifvarand monstflags 8 shoot MORTER
              }
              resetcount
              move 0 action ATANKWAIT
            }
            else
              ifactioncount 2
            {
              ifvarg canseeplayer 0
              {
                ifpdistl 16384
                {
                  ifrnd 128
                  {
                        ifvarand monstflags 16
                        {
                                ifvarand morefx 16
                                ifvarn rendmode 0 espawn SHOTSPARK5
                                sound PISTOL_LOW
                                shoot STARPROJ
                                ifvarand monstflags 8 shoot STARPROJ
                        } else
                        {
                                ifvarand morefx 16
                                ifvarn rendmode 0 espawn SHOTSPARK5
                                addvar position 1 ifvarg position 3 setvar position 0
                                setactorvar[RETURN].position position
                                ifvare dpsounds YES sound DPCHAINGUNFIRE else
                            sound PISTOL_FIRE
                            shoot SHOTSPARK1
                            ifvarand monstflags 8 shoot SHOTSPARK1
                    }
                  }
                }
                else
                  ifrnd 128
                {
                        ifvarand monstflags 16
                        {
                                sound RPG_SHOOT
                                shoot FIREBULLET
                                ifvarand monstflags 8 shoot FIREBULLET
                        }
                        else
                        {
                              ifvare dpsounds YES sound PRED_ATTACK2 else
                          sound PRED_ATTACK
                          shoot FIRELASER
                          ifvarand monstflags 8 shoot FIRELASER
                    }
                }
              }
              else
              {
                move TANKFORWARD seekplayer
                action ATANKSPIN
              }
            }
        
            ifrnd 16
            {
              stopsound TANK_ROAM
              move STOPPED faceplayerslow
            }
    }
  }
  else
    ifaction ATANKWAIT
  {
    ifactioncount 32
    {
      move TANKFORWARD seekplayer
      action ATANKSPIN
    }
  }
  else
    ifaction ATANKDEAD
  {
    addkills 1 state specialdeath
    hitradius 6144 TOUGH TOUGH TOUGH TOUGH
    sound LASERTRIP_EXPLODE
    debris SCRAP1 15
    spawn EXPLOSION2
    ifrnd 128 spawn SNOWMAN
    killit
  }

  ifhitweapon
  {
    ifdead
      action ATANKDEAD
    else
    {
      debris SCRAP1 1
      ifaction ATANKSHOOTING break
          ifvare target -1 ifvarn playerally 0 nullop else
      ifrnd 192
      {
        move STOPPED geth
        action ATANKSHOOTING
        stopsound TANK_ROAM
      }
    }
  }

enda