Duke4.net Forums: CON coding problems. - Duke4.net Forums

Jump to content

  • 17 Pages +
  • « First
  • 5
  • 6
  • 7
  • 8
  • 9
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

CON coding problems.  "Improvements and progress."

User is offline   F!re-Fly 

#181

Ok no problem.

Surely a gamevar TEMPFIX1 could help.
0

User is offline   Darkus 

#182

View PostFirefly_Trooper, on 14 March 2019 - 11:37 AM, said:

Surely a gamevar TEMPFIX1 could help.


It will not work, it's a global variable, also as its name implies, TEMPFIX1 is a temporary variable, it's used for small operations, not for stocking data. You'll have to create your own per-actor variable.
0

User is offline   F!re-Fly 

#183

Let's see the steps:

1. create a gamevar (gamevar MRESPAWN)
2. create an EVENT_LOADACTOR with this gamevar.
3. Use the operaterespawns value with the saved gamevar.

A question ! The value operaterespawns must be placed in "EVENT_LOADACTOR" or in the code of an actor ?

I think I followed the steps and it does not work.
0

User is offline   Darkus 

#184

You problably missed something. Here's how to make monsters appear with actor's hitag: first, create your own per-actor variable:

gamevar MRESPAWN 0 2


Since hitag is not retained during gameplay, copy the value into your custom variable, by adding this with actors at EVENT_LOADACTOR:

setvarvar MRESPAWN sprite[THISACTOR].hitag
setactor[THISACTOR].hitag 0


Finally, put this in the actor code (and also in EVENT_KILLIT) where you want to spawn monsters:

ifvarg MRESPAWN 0 { operaterespawns MRESPAWN setvar MRESPAWN 0 }

0

User is offline   F!re-Fly 

#185

Thank you so much. Indeed I forgot some values ​​and I did not know that it was necessary to use EVENT_KILLIT. I have very little control over gamevars. This is part of the coding that is still difficult for me.
0

User is offline   F!re-Fly 

#186

GOOOOOOOD !!!!!

I had to add the "ifvarg MRESPAWN 0 {operaterespawns MRESPAWN setvar MRESPAWN 0}" line in the "hit states" of monsters that have a corpse.

I removed that same value for tanks (inside EVENT_KILLIT) for one reason only. When the pilot is alive, RESPAWN will not activate. If he's dead, it's better!

:)

This post has been edited by Firefly_Trooper: 16 March 2019 - 01:49 PM

0

User is offline   F!re-Fly 

#187

Next problem to solve: disable the sounds "RECOG" of all the monsters "stayput" and each time they locate the player on the map.

Originally, the Liztroop stayput does not have a recognition sound. I would like to apply this for everyone.

I will also fix a clipdist problem for the bosses.

Activate a clipdist 40 to reduce them with the shrinker.

Enable a clipdist 80 to prevent them from moving in narrow areas.

This post has been edited by Firefly_Trooper: 16 March 2019 - 05:04 PM

0

User is offline   F!re-Fly 

#188

Third problem to see.
Prevent certain projectiles thrown by certain enemies from exploding on their own.
RPG and morter.
0

User is offline   Darkus 

#189

View PostFirefly_Trooper, on 16 March 2019 - 05:00 PM, said:

Next problem to solve: disable the sounds "RECOG" of all the monsters "stayput" and each time they locate the player on the map.

Originally, the Liztroop stayput does not have a recognition sound. I would like to apply this for everyone.


Not tested, but I think of EVENT_RECOGSOUND or Stopactorsound

View PostFirefly_Trooper, on 17 March 2019 - 11:27 AM, said:

Third problem to see.
Prevent certain projectiles thrown by certain enemies from exploding on their own.
RPG and morter.

You mean you don't want to let projectiles explode or monsters inflicting self-damage?
0

User is offline   F!re-Fly 

#190

View PostDarkus, on 18 March 2019 - 01:55 PM, said:

Not tested, but I think of EVENT_RECOGSOUND or Stopactorsound


You mean you don't want to let projectiles explode or monsters inflicting self-damage?


No!

The problem of damage dealt by monster projectiles and already corrected.
Sometimes some projectiles do not launch properly. They sometimes explode on themselves.
0

User is offline   F!re-Fly 

#191

For the sounds of recognition, I made a code that works but to a certain extent.

LIZTROOPSTAYPUT is related to LIZTROOP in the code.

With EVENT_SOUND and the value RETURN, I managed to stop the sound of LIZTROOPSTAYPUT, but I had to add LIZTROOP with this one. I tested with an ifspritepal and it works.

I wonder how to add only stayput, or add a gamevar only for all existing pal.
0

User is offline   F!re-Fly 

#192

I will test EVENT_RECOGSOUND again with the code I created.
0

User is offline   F!re-Fly 

#193

Here is an example code, based on shaded enemies:

appendevent EVENT_SOUND
  ife RETURN PRED_RECOG
  {
    ifspritepal 4
    ife sprite[].picnum LIZTROOP
    set RETURN BLANK
    else
    ifspritepal 4
    ife sprite[].picnum LIZTROOPSTAYPUT
    set RETURN BLANK
  }
endevent


1. LIZTROOP is the main sprite.

2. LIZTROOPSTAYPUT is depend on the first sprite in the code.

3. in the "RETURN" value of LIZTROOP, the sound "BLANK" is played at the same time as LIZTROOPSTAYPUT.

4. When I change the sound of the first sprite, the LIZTROOPSTAYPUT plays the same sound.

I will have to find a solution to keep only the value amplified in the sprite LIZTROOPSTAYPUT and found the way to use the "ifspritepal from 0 to 25" without the basic LIZTROOP is affected.
0

User is offline   F!re-Fly 

#194

I noticed other problems related to the behavior of some monsters.

King Cobra attacks without even seeing the player.

Assault Commander Cari and Flying Frosty, remain stuck on the spot and do not advance towards the player.
0

User is offline   F!re-Fly 

#195

Summarize the small problems of movements and attacks of certain monsters:

1. King Cobra - attacks without even seeing the player.

2. Assault Commander Cari / Flying Frosty - remain stuck on the spot and do not advance towards the player. They still fire projectiles while the player is dead.

3. Predator - The corpse drops ammunition and weapons when he explodes. Prevent doing that.

4. Mini-Battlelord / Captain Gorilla - The RPG and Mortier projectiles sometimes explode on the enemy without reason (once in four). Clipdist problem ?

5. Santa Claus - same problem as 4.
0

User is offline   Darkus 

#196

View PostFirefly_Trooper, on 21 March 2019 - 09:21 AM, said:

Summarize the small problems of movements and attacks of certain monsters:

1. King Cobra - attacks without even seeing the player.

3. Predator - The corpse drops ammunition and weapons when he explodes. Prevent doing that.


Those should be easy to fix.

View PostFirefly_Trooper, on 21 March 2019 - 09:21 AM, said:

2. Assault Commander Cari / Flying Frosty - remain stuck on the spot and do not advance towards the player. They still fire projectiles while the player is dead.


Maybe they have the stayput flag. Changing htflags can resolve the problem... or not.

View PostFirefly_Trooper, on 21 March 2019 - 09:21 AM, said:

4. Mini-Battlelord / Captain Gorilla - The RPG and Mortier projectiles sometimes explode on the enemy without reason (once in four). Clipdist problem ?

5. Santa Claus - same problem as 4.

I think it's more a problem with EDuke rather than clipdist.
0

User is offline   F!re-Fly 

#197

View PostDarkus, on 23 March 2019 - 12:38 PM, said:

Those should be easy to fix.



Maybe they have the stayput flag. Changing htflags can resolve the problem... or not.


I think it's more a problem with EDuke rather than clipdist.


Problems of Commander Cari / Flying Frosty not fixed.

For the problem of Eduke32, I use this version:

EDuke32 r6775
0

User is offline   Mark 

#198

2. Is move command missing? Or missing seekenemy in the AI? Maybe ifp pdead nullop else { firing code }

This post has been edited by Mark: 24 March 2019 - 01:49 PM

0

User is offline   F!re-Fly 

#199

Maybe yes.

However, the code of these two monsters is a copy in conformity with the original Commander.

Maybe some actions are hard coded.

Once all Nuclear monsters are over, I'll settle those actions.

This post has been edited by Firefly_Trooper: 27 March 2019 - 01:19 PM

0

User is offline   F!re-Fly 

#200

Regarding the code "shadow monster" it lacks one thing that I did not manage to do.

Simply remove the shadow on the ground.
0

User is offline   F!re-Fly 

#201

Hello ! I tried to solve these small problems of movement and action and I did not succeed.

I will post the codes to find out how.Hello ! I tried to solve these small problems of movement and action and I did not succeed.

I will post the codes to find out how.

----

1. King Cobra - attacks without even seeing the player.

//
//
//    KING COBRA CODE
//
//

define COBRASTRENGTH 200
define COBRA_DODGEBULLET_FREQ 1
define COBRA_ATTACKFREQ 24
define COBRA_SHOOTLASER_FREQ 64

action ACOBRASTAND    16 3 5 1 16
action ACOBRASTAYSTAND    -1 1 5
action ACOBRAWALKING    0 3 5 1 16
action ACOBRARUNNING    0 3 5 1 12
action ACOBRATHINK    16 2 5 1 40
action ACOBRASCREAM    0 1 5 1 2
action ACOBRAJUMP    0 3 5 1 20
action ACOBRAJUMPSTAND    5 1 5
action ACOBRAFALL    0 1 5
action ACOBRASHOOTING    21 2 3 1 14
action ACOBRADYING    28 6 1 1 20
action ACOBRALYINGDEAD    33 1 1 1 10
action ACOBRAFROZEN    0 1 5
action ACOBRAFROZENSHRUNK    0 1 5
action ACOBRAGROW    27

action ACOBRABITE    15 2 1 1 32

move COBRAWALKVEL 72
move COBRARUNVEL 140
move COBRAJUMPVEL 160
move COBRASTOP

ai AICOBRAGETENEMY ACOBRAWALKING COBRAWALKVEL seekplayer
ai AICOBRADODGE ACOBRARUNNING COBRARUNVEL dodgebullet
ai AICOBRACHARGEENEMY ACOBRARUNNING COBRARUNVEL seekplayer
ai AICOBRAFLEENEMY ACOBRAWALKING COBRAWALKVEL fleeenemy
ai AICOBRASHOOTENEMY ACOBRASHOOTING COBRASTOP faceplayer
ai AICOBRAJUMPENEMY ACOBRAJUMP COBRAJUMPVEL jumptoplayer
ai AICOBRATHINK ACOBRATHINK COBRASTOP faceplayerslow
ai AICOBRASHRUNK ACOBRAWALKING SHRUNKVELS fleeenemy
ai AICOBRAGROW ACOBRAGROW COBRASTOP faceplayerslow
ai AICOBRASPIT ACOBRASCREAM COBRASTOP faceplayerslow
ai AICOBRADYING ACOBRADYING COBRASTOP geth

ai AICOBRABITE ACOBRABITE COBRASTOP faceplayer

action POISONFRAMES 0 4 1 1 10

actor POISON 0 POISONFRAMES enda

defineprojectile POISON PROJ_WORKSLIKE 258
defineprojectile POISON PROJ_SPAWNS -1
defineprojectile POISON PROJ_EXTRA 6
defineprojectile POISON PROJ_HITRADIUS -1
defineprojectile POISON PROJ_PAL 8
defineprojectile POISON PROJ_VEL 292
defineprojectile POISON PROJ_DROP -50
defineprojectile POISON PROJ_OFFSET -100
defineprojectile POISON PROJ_XREPEAT 10
defineprojectile POISON PROJ_YREPEAT 10
defineprojectile POISON PROJ_SHADE 0

state cobrabitestate
  ifpdistg 1280
    ai AICOBRAGETENEMY
  ifp pdead
    ai AICOBRAGETENEMY
  else
    ifcount 18
  {
    resetcount
    ifp palive
    { sound COBRA_BITE
      palfrom 8 32
      quote 130

      getplayer[THISACTOR].i TEMPFIX1
      getactor[TEMPFIX1].extra TEMPFIX2

      setvar TEMPFIX1 -6
      mulvar TEMPFIX1 -1 addvar TEMPFIX1 1

      ifvarvarl TEMPFIX2 TEMPFIX1
        setplayer[THISACTOR].wackedbyactor THISACTOR
      addphealth -6
    }
  }
ends

state cobraseekstate

  ifactornotstayput
  {
    ifcansee
      ifp palive
        ifpdistl 2048
          ifcount 16
            ifcanshoottarget
    {
      ai AICOBRASHOOTENEMY
      break
    }
    ifai AICOBRACHARGEENEMY
    {
      ifcount 72
        ifcanshoottarget
      {
        ai AICOBRASHOOTENEMY
        break
      }
      ifp phigher
        ifpdistg 2048
          ifrnd 6
      {
        ai AICOBRAJUMPENEMY
        break
      }
    }
    else
    ifpdistg 4096
    {
      ifrnd 92
      {
        ifcount 48
          ifcanshoottarget
            ai AICOBRASHOOTENEMY
      }
      else
        ifcount 24
      {
        ai AICOBRACHARGEENEMY
        break
      }
    }

    iffloordistl 16
    {
      ifcount 48
        ifnotmoving
          ifcansee
      {
        ai AICOBRAJUMPENEMY
        break
      }
    }
    else
    {
      ifpdistg 1280
        ai AICOBRAJUMPENEMY
      break
    }

    ifrnd 4
      ifnotmoving
        operate
    else
      ifrnd COBRA_DODGEBULLET_FREQ
        ifbulletnear
    {
      ifgapzl 128
        ai AICOBRADODGE
      else
        ifactornotstayput
      {
        ifrnd 32
          ai AICOBRAJUMPENEMY
        else
          ai AICOBRADODGE
      }
    }
  }
  else
  {
    ifactioncount 16
    {
      ifp palive
        ifrnd 32
          ifcansee
            ifcanshoottarget
              ai AICOBRASHOOTENEMY
    }
    ifcount 16
      ifrnd 32
        move COBRAWALKVEL randomangle geth
  }
  ifrnd 32
    ifpdistl 1280
      ai AICOBRABITE
ends

state cobrashrunkstate
  ifcount SHRUNKDONECOUNT
    { sizeat 40 40 ai AICOBRAGETENEMY }
  else
    ifcount SHRUNKCOUNT
      sizeto 40 40
  else
    state genericshrunkcode
ends

state cobrafleestate
  ifcount 16
  {
    ifrnd 48
      ifp palive
        ifcansee
          { cactor KINGCOBRA ai AICOBRASPIT }

    sound COBRA_SPIT
    shoot FIRELASER
  }
  else
  {
    iffloordistl 16 nullop
    else
      ai AICOBRAGETENEMY
    break
  }
ends

state cobrathinkstate
  ifrnd 8
    soundonce COBRA_ROAM
  ifactioncount 3
  {
    ifrnd 32
      ifp palive
        ifcansee
          ai AICOBRASPIT
        else
          ifrnd 96
            { cactor KINGCOBRA ai AICOBRAGETENEMY }

    sound COBRA_SPIT
    shoot FIRELASER
  }
  else
    ifactioncount 2

  ifrnd COBRA_DODGEBULLET_FREQ
    ifbulletnear
  {
    cactor KINGCOBRA
    ifgapzl 96
      ai AICOBRADODGE
    else
    {
      ifrnd 128
        ai AICOBRAJUMPENEMY
      else
        ai AICOBRADODGE
    }
  }
ends

state cobrashootstate
  ifcount 20
    ifrnd 8
  {
    ifcansee
      ifpdistl 2048
    {
      ifrnd 72
        ai AICOBRAFLEENEMY
      break
    }

    ifrnd 80
      { cactor KINGCOBRA ai AICOBRATHINK }
    else
      ai AICOBRAGETENEMY
  }
  ifactioncount 1

  ifrnd COBRA_SHOOTLASER_FREQ
  shoot FIRELASER

  ifactioncount 2
  {
    ifcansee
    {
      ifcanshoottarget
      {
        sound COBRA_SPIT
        shoot POISON
        resetactioncount

        ifrnd COBRA_SHOOTLASER_FREQ
        shoot FIRELASER
      }
      else
        { cactor KINGCOBRA ai AICOBRATHINK }
    }
    else
      ai AICOBRAGETENEMY
  }
ends

state cobrahitstate
  ifdead
  {
    ifwasweapon FREEZEBLAST
    {
      ifactor KINGCOBRASPITTING cactor KINGCOBRA
      sound SOMETHINGFROZE
      spritepal 1
      move 0
      ifai AICOBRASHRUNK action ACOBRAFROZENSHRUNK
      else action ACOBRAFROZEN
      strength 0
      break
    }

    ifai AICOBRASHRUNK nullop
    else { }

    ifwasweapon GROWSPARK
    {
      ifactor KINGCOBRASPITTING cactor KINGCOBRA
      cstat 257
      sound ACTOR_GROWING
      addvar KILLCOUNTFIX 1
      setvar ISDEADFIX 1
      ai AICOBRAGROW
      break
    }
    else
      ifwasweapon RPG
    {
      spawn BLOOD
      sound SQUISHED
      state standard_jibs
      killit
    }
    else
      ifwasweapon RADIUSEXPLOSION
    {
      spawn BLOOD
      sound SQUISHED
      state standard_jibs
      killit
    }
    else
    {
      ifvarg MRESPAWN 0 { operaterespawns MRESPAWN setvar MRESPAWN 0 }
      ifactor KINGCOBRASPITTING cactor KINGCOBRA
      spawn BLOOD
      state rf
      addkills 1
      addvar KILLCOUNTFIX 1
      setvar ISDEADFIX 1
      ai AICOBRADYING
    }
    sound COBRA_DYING
  }
  else
  {
    sound COBRA_PAIN
    ifwasweapon SHRINKSPARK
    {
      ifai AICOBRASHRUNK break
      ifactor KINGCOBRASPITTING cactor KINGCOBRA
      ai AICOBRASHRUNK
      sound ACTOR_SHRINKING
      break
    }
    ifwasweapon GROWSPARK
      sound EXPANDERHIT

    guts JIBS3 5
    guts JIBS4 3
    spawn BLOOD
    state random_wall_jibs
    ifp palive
      ifcansee
        ifcanshoottarget
    {
      ifai AICOBRASHRUNK break
      ifactor KINGCOBRASPITTING cactor KINGCOBRA
      ai AICOBRASHOOTENEMY
      break
    }
  }
ends

state cobrafrozen
  ifcount THAWTIME
  { ifaction ACOBRAFROZENSHRUNK
    { ai AICOBRASHRUNK
      count SHRUNKCOUNT
    }
    else ai AICOBRAGETENEMY
    getlastpal
  }
  else
    ifcount FROZENDRIPTIME
  {
    ifactioncount 26
    {
      spawn WATERDRIP
      resetactioncount
    }
  }

  ifhitweapon
  {
    ifwasweapon FREEZEBLAST
    {
      strength 0
      break
    }

    ifrnd 84
      spawn BLOODPOOL
    lotsofglass 30
    sound GLASS_BREAKING
    ifaction ACOBRAFROZEN
    killit
  }
  ifp pfacing
    ifpdistl FROZENQUICKKICKDIST
      ifaction ACOBRAFROZEN
        pkick
ends

state cobrajumpstate
  ifaction ACOBRAFALL
  {
    iffloordistl 24
       ai AICOBRAGETENEMY
          soundonce COBRA_JUMPING
  }
  else
    ifactioncount 5
      action ACOBRAFALL
ends

state cobradyingstate
  ifaction ACOBRALYINGDEAD
  {
    strength 0
    ifhitweapon
      ifwasweapon RADIUSEXPLOSION
    {
      sound SQUISHED
      state standard_jibs
      killit
    }
    ifrespawn
      ifcount RESPAWNACTORTIME
    {
      spawn TRANSPORTERSTAR
      sizeat 40 40
      cstat 257
      strength COBRASTRENGTH
      setvar ISDEADFIX 0
      ai AICOBRAGETENEMY
      ifvarn userdef[THISACTOR].player_skill 4
        subvar KILLCOUNTFIX 1
    }
  }
  else 
    ifai AICOBRADYING
      ifactioncount 4
  {
    iffloordistl 8
      sound THUD
    move COBRASTOP
    action ACOBRALYINGDEAD
    ifrnd 64
      spawn BLOODPOOL
  }
ends

state cobradodgestate
  ifcount 13
    ai AICOBRAGETENEMY
ends

state cobracode
  state checksquished

  ifai 0
    { ifactor KINGCOBRASPITTING ai AICOBRASPIT
      else ai AICOBRAGETENEMY }
  else
    ifaction ACOBRALYINGDEAD
  {
    fall
    state cobradyingstate
    break
  }
  else
    ifaction ACOBRAFROZEN
    { state cobrafrozen
      break
    }
  else
    ifaction ACOBRAFROZENSHRUNK
    { state cobrafrozen
      break
    }
  else
    ifai AICOBRAJUMPENEMY
      state cobrajumpstate
  else
  {
    fall
    ifai AICOBRAGETENEMY
      state cobraseekstate
    else
      ifai AICOBRACHARGEENEMY
        state cobraseekstate
    else
      ifai AICOBRADODGE
        state cobradodgestate
    else
      ifai AICOBRABITE
        state cobrabitestate
    else
      ifai AICOBRASHOOTENEMY
        state cobrashootstate
    else
      ifai AICOBRAFLEENEMY
        state cobrafleestate
    else
      ifai AICOBRATHINK
        state cobrathinkstate
    else
      ifai AICOBRASHRUNK
        state cobrashrunkstate
    else
      ifai AICOBRAGROW
        state genericgrowcode
    else
      ifai AICOBRADYING
        state cobradyingstate
    else
      ifai AICOBRASPIT
    {
      ifcount 26
        { cactor KINGCOBRA ai AICOBRAGETENEMY }
      else
        ifcount 18
          ifrnd COBRA_ATTACKFREQ
      {
        shoot POISON
        sound COBRA_SPIT
      }
    }
  }
  ifrnd 1
    {
      ifrnd 32
        soundonce COBRA_ROAM2
      else
      ifrnd 64
        soundonce COBRA_ROAM3
    }

  ifhitweapon
    state cobrahitstate

  ifai AICOBRASHRUNK break
    ifp pshrunk
      state badguystomphit
ends

useractor enemystayput KINGCOBRASTAYPUT COBRASTRENGTH ACOBRASTAYSTAND
  ai AICOBRAGETENEMY
  cactor KINGCOBRA
enda

useractor enemy KINGCOBRASPITTING COBRASTRENGTH ACOBRASTAYSTAND
  fall
  state cobracode
enda

useractor enemy KINGCOBRAJUMP COBRASTRENGTH ACOBRAJUMPSTAND
  ai AICOBRAJUMPENEMY
  cactor KINGCOBRA
enda

useractor enemy KINGCOBRA COBRASTRENGTH ACOBRASTAND
  fall
  state cobracode
  clipdist 40
  spriteflags 5242880
enda

useractor enemy KINGCOBRADEADSPRITE
  fall
  state checksquished
  cstat 0
  strength 0
  ifhitweapon
  {
    ifwasweapon RADIUSEXPLOSION
    {
      state standard_jibs
      sound SQUISHED
      killit
    }
  }
enda

appendevent EVENT_LOADACTOR
  ifactor KINGCOBRA
  {
    sizeat 40 40
    cstat 1
  }
  else
  ifactor KINGCOBRASTAYPUT
  {
    sizeat 40 40
    cstat 1
  }
  else
  ifactor KINGCOBRASPITTING
  {
    sizeat 40 40
    cstat 1
  }
  else
  ifactor KINGCOBRAJUMP
  {
    sizeat 40 40
    cstat 1
  }
  else
  ifactor KINGCOBRADEADSPRITE
  {
    sizeat 40 40
  }
endevent

appendevent EVENT_RECOGSOUND
  ifactor KINGCOBRA
  {
    set RETURN -1
    sound COBRA_RECOG
  }
  else
  ifactor KINGCOBRASPITTING
  {
    set RETURN -1
    sound COBRA_RECOG
  }
  else
  ifactor KINGCOBRAJUMP
  {
    set RETURN -1
    sound COBRA_RECOG
  }
endevent

0

User is offline   F!re-Fly 

#202

2. Predator - The corpse drops ammunition and weapons when he explodes. Prevent doing that.

//
//
//    PREDATOR CODE
//
//

/* Spritepal Info
0       = Firelaser
9       = Heatseeker
10      = Chaingun
11      = Expander
12      = Freezethrower
13      = Shotgun
14      = Morter
15      = RPG
16      = Shrinker
18      = Pistol
21      = Spit
22      = Wierdshot fly
-------------- */

define PRED1STRENGTH 100
define PRED2STRENGTH 200
define PRED3STRENGTH 250
define PRED4STRENGTH 400
define PRED5STRENGTH 250
define PRED6STRENGTH 400
define PRED7STRENGTH 350
define PRED8STRENGTH 200
define PRED9STRENGTH 600
define PRED10STRENGTH 250
define PRED11STRENGTH 250
define PRED12STRENGTH 250

action APREDWALK    0 4 5 1 20
action APREDRUN    0 4 5 1 8
action APREDRUN2    -6 1 5 1 5
action APREDSTAND    -12 1 5 1 1
action APREDSTAYSTAND    -1 1 5
action APREDSHOOT    21 1 1 1 30
action APREDPAIN    25 1 1 1 6
action APREDFROZEN    0 1 5
action APREDDYING    25 5 1 1 16
action APREDDEAD    30 1 1 1 1
action APREDGROW    25
action APREDFROZENSHRUNK    15 1 5

move PREDWALKVELS 170
move PREDRUNVELS 400
move PREDMACH1 900
move PREDSLOWVELS 150
move PREDJUMPVELS 600
move PREDSTOPPED

ai AIPREDSEEK APREDWALK PREDWALKVELS seekplayer
ai AIPREDHUNT APREDRUN PREDRUNVELS faceplayerslow
ai AIPREDSHOOT APREDSHOOT PREDSTOPPED faceplayersmart
ai AIPREDHIDE APREDWALK PREDWALKVELS seekplayer
ai AIPREDHIDDEN APREDWALK PREDMACH1 faceplayerslow
ai AIPREDSHOW APREDWALK PREDWALKVELS seekplayer
ai AIPREDSTOMP APREDWALK PREDWALKVELS faceplayer
ai AIPREDFLEE APREDRUN PREDRUNVELS fleeenemy
ai AIPREDHIT APREDPAIN PREDSTOPPED faceplayer
ai AIPREDGROW APREDGROW PREDSTOPPED faceplayer
ai AIPREDSHRUNK APREDWALK PREDSLOWVELS fleeenemy
ai AIPREDDODGE APREDRUN2 PREDJUMPVELS dodgebullet
ai AIPREDFALL APREDWALK PREDSTOPPED faceplayer
ai AIPREDDYING APREDDYING PREDSTOPPED geth // NEW!!!

state predgrowstate
  ifcount 32
  {
    state standard_jibs
    sound SQUISHED
    sound PIPEBOMB_EXPLODE
    hitradius 2048 60 70 80 90
    spawn BLOODPOOL
    spawn EXPLOSION2
    spawn BURNING
    killit
  }
  else
  {
    sizeto MAXXSTRETCH MAXYSTRETCH
    break
  }
ends

state predstompstate

  ifcansee { }

  ifp pshrunk
  {
  ifpdistl 1280
    {
      addphealth -1000
      palfrom 63 63
      state standard_pjibs
      break
    }
  }
  else
  ai AIPREDSEEK
ends

state predpalshootstate
  ifspritepal 22
  {
    eshoot COOLEXPLOSION1
    eshoot COOLEXPLOSION1
    setactor[RETURN].x sprite[THISACTOR].x
    setactor[RETURN].y sprite[THISACTOR].y
    sound WIERDSHOT_FLY
  }
  else
  ifspritepal 21
  {
    shoot SPIT
    shoot SPIT
    sound LIZARD_SPIT
  }
  else
  ifspritepal 18
  {
    shoot SHOTSPARK1
    shoot SHOTSPARK1
    shoot SHOTSPARK1
    shoot SHOTSPARK1
    sound PISTOL_FIRE3
  }
  else
  ifspritepal 16
  {
    eshoot SHRINKER
    setactor[RETURN].x sprite[THISACTOR].x
    setactor[RETURN].y sprite[THISACTOR].y
    sound SHRINKER_FIRE
  }
  else
  ifspritepal 15
  {
    shoot RPG
    sound RPG_SHOOT
  }
  else
  ifspritepal 14
  {
    shoot MORTER
    sound BOS1_ATTACK2
  }
  else
  ifspritepal 13
  {
    shoot SHOTGUN
    shoot SHOTGUN
    shoot SHOTGUN
    sound SHOTGUN_FIRE
  }
  else
  ifspritepal 12
  {
    shoot FREEZEBLAST
    shoot FREEZEBLAST
    shoot FREEZEBLAST
    shoot FREEZEBLAST
    sound SOMETHINGFROZE
  }
  else
  ifspritepal 10
  nullop
  else
  ifspritepal 11
  {
    shoot GROWSPARK
    shoot GROWSPARK
    shoot GROWSPARK
    shoot GROWSPARK
    sound EXPANDERSHOOT
  }
  else
  ifspritepal 9
  {
    spawn HEATSEEKER
    sound RPG_SHOOT
  }
  else
  {
    shoot FIRELASER
    shoot FIRELASER
    sound RECO_ATTACK
  }
ends

state doshoot
  ifcansee
    ifpdistl 2096
    {
      ai AIPREDSHOOT
    }
    else
    {
      ifcanshoottarget
      ai AIPREDSHOOT
    }
ends

state predseekstate

  ifrnd 1
    {
      ifrnd 128
      sound PREDA_ROAM
    }
  ifrnd 1
  {
  ifrnd 128
    {
      ai AIPREDHIDE
      break
    }
  }
  ifpdistl 1024
  {
  ifrnd 1
    ai AIPREDHIDE
    else
    ifrnd 32
      ai AIPREDFLEE
  }
  else
  ifpdistl 6000
  {
    ifrnd 16
    {
      state doshoot
      break
    }
  }
  else
    ifpdistl 12000
    {
      ifrnd 4
      state doshoot
      else
    ifai AIPREDHUNT nullop
    else
      ifcansee
        ai AIPREDHUNT
    }
    else
    {
    ifrnd 2
      state doshoot
      else
    ifai AIPREDSEEK nullop
    else
      ai AIPREDSEEK
    }
  ifcansee { }
ends

state predshootstate

  ifcansee { }

  ifspritepal 10
  {
    ifcanshoottarget
    {
      ifcount 3
      {
        ifcansee
        {
          shoot CHAINGUN
          sound CHAINGUN_FIRE
          resetcount
        }
      }
    }
    ifrnd 2
    {
      ai AIPREDHUNT
      resetcount
      break
    }
    ifactioncount 4
    {
      ifrnd 200
      ai AIPREDHUNT
      resetactioncount
      break
    }
  }
  else

  ifactioncount 3
  {
    ifcansee
    {
      ifcanshoottarget
      {
        state predpalshootstate
        resetactioncount
        ifrnd 196
        ai AIPREDSEEK
      }
      else
        ai AIPREDSEEK
    }
  }
ends

state predhidestate

  spawn FRAMEEFFECT1

  ifai AIPREDHIDDEN
  {
    ifcount 64
    {
      ai AIPREDSHOW
      resetcount
    }
  ifcansee { }
  break
  }
  else
  {

    ifcount 10
      nullop
    else
       ifcount 9
       {
         cstat 2
       }
       ifcount 20
         nullop
       else
          ifcount 19
          {
            cstat 514
          }
          ifcount 30
            nullop
          else
             ifcount 29
             {
               resetcount
               cstat 32768
               ai AIPREDHIDDEN
             }
  }
ends

state predammostate

  ifrnd 128
  {
    ifspritepal 22
      { spawn COOLEXPLOSION1 }
  else
    ifspritepal 21
      { spawn SPIT }
  else
    ifspritepal 18
      { ifrnd 128 spawn FIRSTGUNSPRITE else spawn AMMO }
  else
    ifspritepal 16
      { ifrnd 128 spawn SHRINKERSPRITE else spawn CRYSTALAMMO }
  else
    ifspritepal 15
      { ifrnd 128 spawn RPGSPRITE else spawn RPGAMMO }
  else
    ifspritepal 14
      { spawn MORTER }
  else
    ifspritepal 13
      { ifrnd 128 spawn SHOTGUNSPRITE else spawn SHOTGUNAMMO }
  else
    ifspritepal 12
      { ifrnd 128 spawn FREEZESPRITE else spawn FREEZEAMMO }
  else
    ifspritepal 11
      { ifrnd 128 spawn GROWSPRITE else spawn GROWAMMO }
  else
    ifspritepal 10
      { ifrnd 128 spawn CHAINGUNSPRITE else spawn BATTERYAMMO }
  }
ends

state predshowstate

  spawn FRAMEEFFECT1
    ifcount 10
      nullop
  else
    ifcount 9
    {
      cstat 514
    }
    ifcount 20
      nullop
  else
    ifcount 19
    {
     cstat 2
    }
    ifcount 30
      nullop
  else
    ifcount 29
    {
      resetcount
        cstat 257
          ifrnd 192
            state doshoot
      else
      ai AIPREDSEEK
    }
ends

state predfleestate

  ifcansee nullop
    else
      ai AIPREDSEEK

  ifpdistg 3000
  {
    ai AIPREDSEEK
  }
  else
  ifrnd 2
    ai AIPREDHIDE

  ifcount 5
    ai AIPREDSEEK

  ifrnd 1
    state doshoot
ends

state preddodgestate

  ifcansee nullop
    else
      ai AIPREDSEEK
  ifcount 5
  {
    resetcount
    ifbulletnear
    nullop
  else
    ai AIPREDSEEK
  }
ends

state predhitstate
  ifdead
  {
    ifwasweapon FREEZEBLAST
    {
      sound SOMETHINGFROZE
      spritepal 1
      move 0
      ifai AIPREDSHRUNK action APREDFROZENSHRUNK
      else action APREDFROZEN
      strength 0
      break
    }

    ifai AIPREDSHRUNK nullop
    else state predammostate

    ifwasweapon GROWSPARK
    {
      cstat 257
      sound ACTOR_GROWING
      addvar KILLCOUNTFIX 1
      setvar ISDEADFIX 1
      ai AIPREDGROW
      break
    }
    else
      ifwasweapon RPG
    {
      sound SQUISHED
      state standard_jibs
      state standard_jibs
      state standard_jibs
      state standard_jibs
      killit
    }
    else
      ifwasweapon RADIUSEXPLOSION
    {
      sound SQUISHED
      state standard_jibs
      state standard_jibs
      state standard_jibs
      state standard_jibs
      killit
    }
    else
    {
      ifvarg MRESPAWN 0 { operaterespawns MRESPAWN setvar MRESPAWN 0 }
      addkills 1
      addvar KILLCOUNTFIX 1
      setvar ISDEADFIX 1
      ai AIPREDDYING
    }
    sound PREDA_DYING
  }
  else
  {
    sound PREDA_PAIN
    state random_wall_jibs

    ifai AIPREDSHRUNK break

    ifwasweapon SHRINKSPARK
    {
      sound ACTOR_SHRINKING
      ai AIPREDSHRUNK
      break
    }
    ifwasweapon GROWSPARK
      sound EXPANDERHIT

    {
      ifrnd 24
        state predpalshootstate
      else
        ifrnd 12
          ai AIPREDHIDE
    }
  }
  ifactioncount 2
  {
    resetactioncount
    ai AIPREDSEEK
  }
ends

state predshrunkstate
  ifcount SHRUNKDONECOUNT
    { sizeat 42 36 ai AIPREDSEEK }
  else
    ifcount SHRUNKCOUNT
      sizeto 40 40
  else
    state genericshrunkcode
ends

state predfrozen
  ifcount THAWTIME
  {
    getlastpal
    ifaction APREDFROZENSHRUNK
    { ai AIPREDSHRUNK
      count SHRUNKCOUNT
    }
    else ai AIPREDSEEK
//    spritepal 22
  }
  else
    ifcount FROZENDRIPTIME
  {
    ifactioncount 26
    {
      spawn WATERDRIP
      resetactioncount
    }
  }

  ifhitweapon
  {
    ifwasweapon FREEZEBLAST
    {
      strength 0
      break
    }
    lotsofglass 30
    ifrnd 84
      spawn BLOODPOOL
    sound GLASS_BREAKING
      state predammostate
    killit
  }
  ifp pfacing
    ifpdistl FROZENQUICKKICKDIST
      ifaction APREDFROZEN
        pkick
ends

state predsetstrength
  ifspritepal 0
    strength PRED1STRENGTH
  else
  ifspritepal 9
    strength PRED9STRENGTH
  else
  ifspritepal 10
    strength PRED2STRENGTH
  else
  ifspritepal 11
    strength PRED3STRENGTH
  else
  ifspritepal 12
    strength PRED4STRENGTH
  else
  ifspritepal 13
    strength PRED5STRENGTH
  else
  ifspritepal 14
    strength PRED6STRENGTH
  else
  ifspritepal 15
    strength PRED7STRENGTH
  else
  ifspritepal 16
    strength PRED8STRENGTH
  else
  ifspritepal 18
    strength PRED10STRENGTH
  else
  ifspritepal 21
    strength PRED11STRENGTH
  else
  ifspritepal 22
    strength PRED12STRENGTH
ends

state preddyingstate
  ifaction APREDDEAD
  {
    strength 0
    ifhitweapon
      ifwasweapon RADIUSEXPLOSION
    {
      sound SQUISHED
      state standard_jibs
      state standard_jibs
      state standard_jibs
      state standard_jibs
      killit
    }
    ifrespawn
      ifcount RESPAWNACTORTIME
    {
      spawn TRANSPORTERSTAR
      sizeat 40 40
      cstat 257
      state predsetstrength
      setvar ISDEADFIX 0
      ai AIPREDSEEK
      ifvarn userdef[THISACTOR].player_skill 4
        subvar KILLCOUNTFIX 1
    }
  }
  else
    ifai AIPREDDYING
      ifactioncount 5
  {
    iffloordistl 8
      sound THUD
    state rf
    strength 0
    move PREDSTOPPED
    action APREDDEAD
    ifrnd 64
      spawn BLOODPOOL
  }
ends

state predcode

    ifaction APREDFROZEN
    { state predfrozen
      break
    }
  else
    ifaction APREDFROZENSHRUNK
    { state predfrozen
      break
    }
  else

  {
    ifhitweapon
      state predhitstate
  }

  ifai 0
  {
    state predsetstrength
    ifrnd 150
    {
      ai AIPREDHUNT
      state doshoot
    }
  else
  {
    ifrnd 128
    {
      ai AIPREDSEEK
    }
  else
    {
      ai AIPREDHIDE
    }
  }
  }
  else
    ifaction APREDDEAD
  {
    state preddyingstate
    break
  }

  ifrnd 2
    operate

  ifai AIPREDSHRUNK
  {
    state predshrunkstate
    break
  }

  ifp pdead
  {
    ifcansee { }
    break
  }
  else
  ifp pshrunk
  {
    ifai AIPREDSTOMP nullop
  else
    { ai AIPREDSTOMP break }
  }

  ifhitweapon
  {
    ai AIPREDHIT
  }
  else
  {
    ifbulletnear
    {
        ifai AIPREDHIDE nullop
      else
        ifai AIPREDHIDDEN nullop
      else
        ifai AIPREDSHOW nullop
      else
      ifrnd 256
      {
        ai AIPREDDODGE
      }
    }
  }
  state checksquished

  ifai AIPREDSEEK
    state predseekstate
  else
  ifai AIPREDHUNT
    state predseekstate
  else
  ifai AIPREDSHOOT
    state predshootstate
  else
  ifai AIPREDHIDE
    state predhidestate
  else
  ifai AIPREDHIDDEN
    state predhidestate
  else
  ifai AIPREDSHOW
    state predshowstate
  else
  ifai AIPREDSTOMP
    state predstompstate
  else
  ifai AIPREDFLEE
    state predfleestate
  else
  ifai AIPREDHIT
    state predhitstate
  else
  ifai AIPREDGROW
    state predgrowstate
  else
  ifai AIPREDSHRUNK
    state predshrunkstate
  else
  ifai AIPREDDODGE
    state preddodgestate
  else
  ifai AIPREDDYING
    state preddyingstate
  else

  ifai AIPREDSHRUNK break
    ifp pshrunk
      state predstompstate
ends

useractor enemystayput PREDATORSTAYPUT PRED1STRENGTH APREDSTAYSTAND
  ai AIPREDSEEK
  cactor PREDATOR
enda

useractor enemy PREDATOR PRED1STRENGTH APREDSTAND
  fall
  state predcode
  clipdist 40
  spriteflags 5242880
enda

useractor enemy PREDATORDEADSPRITE
  state checksquished
  cstat 0
  strength 0
  ifhitweapon
  {
    ifwasweapon RADIUSEXPLOSION
    { state standard_jibs
      state standard_jibs
      state standard_jibs
      state standard_jibs
      sound SQUISHED
      killit
    }
  }
enda

appendevent EVENT_LOADACTOR
  ifactor PREDATOR
  {
    sizeat 42 36
    cstat 1
  }
  else
  ifactor PREDATORSTAYPUT
  {
    sizeat 42 36
    cstat 1
  }
  ifactor PREDATORDEADSPRITE // enemy corpse
  {
    sizeat 42 36
  }
endevent

appendevent EVENT_RECOGSOUND
  ifactor PREDATOR
  {
    set RETURN -1
    sound PREDA_RECO
  }
endevent

onevent EVENT_GAME // corrected jibs color
  { switch sprite[THISACTOR].picnum
  case JIBS1
  case JIBS2
  case JIBS3
  case JIBS4
  case JIBS5
  case JIBS6
    ifspritepal 9
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 9
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
    else
    ifspritepal 10
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 10
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
    else
    ifspritepal 11
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 11
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
    else
    ifspritepal 12
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 12
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
    else
    ifspritepal 13
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 13
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
    else
    ifspritepal 14
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 14
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
    else
    ifspritepal 15
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 15
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
    else
    ifspritepal 16
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 16
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
    else
    ifspritepal 18
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 18
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
    else
    ifspritepal 21
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 21
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
    else
    ifspritepal 22
    ifspawnedby PREDATOR
      setactor[THISACTOR].pal 0
    else
    ifspritepal 22
    ifspawnedby PREDATORSTAYPUT
      setactor[THISACTOR].pal 0
  break
  endswitch
  }
endevent

0

User is offline   F!re-Fly 

#203

3. Assault Commander Cari / Flying Frosty - remain stuck on the spot and do not advance towards the player. They still fire projectiles while the player is dead.

//
//
//    ASSAULT COMMANDER CARI CODE
//
//

action ACOMMCARISTAND    0 1 5
action ACOMMCARISTAYSTAND    -1 1 5
action ACOMMCARIBREETH    0 3 5 1 40
action ACOMMCARIFROZEN    0 1 5
action ACOMMCARISPIN    -5 1 5 1 12
action ACOMMCARIGET    0 3 5 1 30
action ACOMMCARISHOOT    19 1 5 1 35
action ACOMMCARIABOUTTOSHOOT    19 1 5 1 30
action ACOMMCARIDYING    30 8 1 1 12
action ACOMMCARIDEAD    38 1 1 1 1
action ACOMMCARIFROZENSHRUNK    0 1 5
action ACOMMCARIGROW    29

move COMMCARIGETUPVELS 128 -64
move COMMCARIGETVELS 128 64
move COMMCARISLOW 64 24
move COMMCARISTOPPED

ai AICOMMCARIWAIT ACOMMCARIBREETH COMMCARISTOPPED faceplayerslow
ai AICOMMCARIGET ACOMMCARIGET COMMCARIGETVELS seekplayer
ai AICOMMCARISHOOT ACOMMCARISHOOT COMMCARISTOPPED faceplayerslow
ai AICOMMCARIABOUTTOSHOOT ACOMMCARIABOUTTOSHOOT COMMCARISTOPPED faceplayerslow
ai AICOMMCARISPIN ACOMMCARISPIN COMMCARIGETVELS spin
ai AICOMMCARIDYING ACOMMCARIDYING COMMCARISTOPPED geth
ai AICOMMCARISHRUNK ACOMMCARIGET COMMCARISLOW furthestdir
ai AICOMMCARIGROW ACOMMCARIGROW COMMCARISTOPPED furthestdir

state commcarihitstate

  ifhitweapon
  {
    ifdead
    {
      ifwasweapon FREEZEBLAST
      {
        sound SOMETHINGFROZE
        spritepal 1
        move 0
        ifai AICOMMCARISHRUNK action ACOMMCARIFROZENSHRUNK
        else action ACOMMCARIFROZEN
        strength 0
        break
      }
      else ifwasweapon GROWSPARK
      {
        cstat 257
        sound ACTOR_GROWING
        ai AICOMMCARIGROW
        addvar KILLCOUNTFIX 1
        setvar ISDEADFIX 1
        break
      }
      else ifwasweapon RADIUSEXPLOSION
      {
        spawn BLOODPOOL
        sound SQUISHED
        state standard_jibs
        killit
      }

      ifai AICOMMCARISHRUNK nullop
      else { }

        ifwasweapon RPG
      {
        sound SQUISHED
        spawn BLOODPOOL
        state standard_jibs
        killit
      }

      ifvarg MRESPAWN 0 { operaterespawns MRESPAWN setvar MRESPAWN 0 }
      guts JIBS6 2
      sound COMM_DYING
      ai AICOMMCARIDYING
      ifrnd 128 cstator 4
      addvar KILLCOUNTFIX 1
      addkills 1
      setvar ISDEADFIX 1
    }
    else
    {
      soundonce COMM_PAIN
      ifwasweapon GROWSPARK
        sound EXPANDERHIT
      else
      ifwasweapon SHRINKSPARK
      { ifai AICOMMCARISHRUNK break
        sound ACTOR_SHRINKING
        ai AICOMMCARISHRUNK
        break
      }
      else
        ifrnd 24
          ai AICOMMCARIABOUTTOSHOOT
      guts JIBS6 2
    }
  }
ends

state commcarifrozen
  fall

  ifcount THAWTIME
  {
    getlastpal
    ifaction ACOMMCARIFROZENSHRUNK
    { ai AICOMMCARISHRUNK
      count SHRUNKCOUNT
    }
    else ai AICOMMCARIWAIT
  }
  else
    ifcount FROZENDRIPTIME
  {
    ifactioncount 26
    {
      spawn WATERDRIP
      resetactioncount
    }
  }

  ifhitweapon
  {
    ifwasweapon FREEZEBLAST
    {
      strength 0
      break
    }

    ifrnd 84
      spawn BLOODPOOL
    lotsofglass 30
    sound GLASS_BREAKING
    killit
  }
  ifp pfacing
    ifpdistl FROZENQUICKKICKDIST
      ifaction ACOMMCARIFROZEN
        pkick
ends

useractor enemystayput COMMANDERCARISTAYPUT COMMANDERSTRENGTH ACOMMCARISTAYSTAND
  cactor COMMANDERCARI
  ai AICOMMCARIABOUTTOSHOOT
enda

useractor enemy COMMANDERCARI COMMANDERSTRENGTH ACOMMCARISTAND

  state checksquished

  ifaction ACOMMCARIFROZEN
  { state commcarifrozen
    break
  }
  ifaction ACOMMCARIFROZENSHRUNK
  { state commcarifrozen
    break
  }
  ifai 0
    ai AICOMMCARISHOOT
  else
    ifai AICOMMCARIWAIT
  {
    ifcount 20
    {
      ifcansee
      {
        ifcanshoottarget
        {
          ifrnd 96
            ai AICOMMCARIGET
          else
            ai AICOMMCARIABOUTTOSHOOT
        }
      }
      else
        ai AICOMMCARIGET
    }
  }
  else
    ifai AICOMMCARIABOUTTOSHOOT
  {
    ifactioncount 2
    {
      ifcansee
        ai AICOMMCARISHOOT
      else
      {
        ai AICOMMCARIGET
        break
      }
    }
    ifrnd 32 soundonce COMM_ATTACK
  }
  else
    ifai AICOMMCARISHOOT
  {
    ifcanshoottarget
    {
      ifcount 24
        ifrnd 16
          ai AICOMMCARIWAIT
      ifactioncount 2
      {
        shoot COCOANUT
        sound DRAGONSHOOTING
        resetactioncount
      }
    }
    else
      ai AICOMMCARIGET
  }
  else
    ifai AICOMMCARISHRUNK
  {
    ifcount SHRUNKDONECOUNT
      { sizeat 40 40 ai AICOMMCARIGET }
    else
      ifcount SHRUNKCOUNT
        sizeto 48 40
    else
      state genericshrunkcode
  }
  else
    ifai AICOMMCARIGROW
      state genericgrowcode
  else
    ifai AICOMMCARIGET
  {
    ifnotmoving
      ifrnd 4
        operate
    ifpdistl 1024
      ifp palive
    {
      sound COMM_SPIN
      ai AICOMMCARISPIN
      break
    }

    ifcansee ifp palive
    {
      ifp phigher
        move COMMCARIGETUPVELS getv geth faceplayer
      else
        move COMMCARIGETVELS getv geth faceplayer
    }
    ifactioncount 8
      ifrnd 2
        ai AICOMMCARIABOUTTOSHOOT
  }
  else
    ifai AICOMMCARISPIN
  {
    soundonce COMM_SPIN
    ifcount 16
    {
      ifpdistl 1280
      { ifp palive
        { getplayer[THISACTOR].i TEMPFIX1
          getactor[TEMPFIX1].extra TEMPFIX2

          setvar TEMPFIX1 CAPTSPINNINGPLAYER
          mulvar TEMPFIX1 -1 addvar TEMPFIX1 1

          ifvarvarl TEMPFIX2 TEMPFIX1
          setplayer[THISACTOR].wackedbyactor THISACTOR

          addphealth CAPTSPINNINGPLAYER
          globalsound DUKE_GRUNT
          palfrom 32 16
        }
        resetcount
      }
      else
        ifpdistg 2300
          ai AICOMMCARIWAIT
    }
    ifactioncount 52
      ai AICOMMCARIWAIT
    ifnotmoving
      ifrnd 32
        operate
  }

  ifai AICOMMCARIDYING
  {
    fall
    strength 0

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

    ifaction ACOMMCARIDYING
    { ifactioncount 8
      {
        iffloordistl 8
          sound THUD
        state rf_unblock
        action ACOMMCARIDEAD
      }
      ifrespawn
        ifcount RESPAWNACTORTIME
      {
        spawn TRANSPORTERSTAR
        sizeat 40 40
        cstat 257
        strength COMMANDERSTRENGTH
        setvar ISDEADFIX 0
        ai AICOMMCARIGET
        ifvarn userdef[THISACTOR].player_skill 4
          subvar KILLCOUNTFIX 1
      }
    }
  }
  else
  {
    ifrnd 2
      soundonce COMM_ROAM

    ifvarg sprite[THISACTOR].htextra 0
    ifvarvare sprite[THISACTOR].htowner THISACTOR
      setactor[THISACTOR].htextra -1

    state commcarihitstate
      spriteflags SFLAG_HURTSPAWNBLOOD
  }
    spriteflags SFLAG_NODAMAGEPUSH
enda

useractor enemy COMMANDERCARIDEADSPRITE
  fall
  state checksquished
  cstat 0
  strength 0
  ifhitweapon
  {
    ifwasweapon RADIUSEXPLOSION
    {
      state standard_jibs
      sound SQUISHED
      killit
    }
  }
enda

appendevent EVENT_LOADACTOR
  ifactor COMMANDERCARI
  {
    sizeat 40 40
    cstat 1
  }
  ifactor COMMANDERCARISTAYPUT
  {
    sizeat 40 40
    cstat 1
  }
  ifactor COMMANDERCARIDEADSPRITE
  {
    sizeat 40 40
  }
endevent

appendevent EVENT_RECOGSOUND
  ifactor COMMANDERCARI
  {
    set RETURN -1
    sound COMM_RECOG
  }
endevent

0

User is offline   LeoD 

  • Duke4.net topic/3513

#204

View PostFirefly_Trooper, on 31 March 2019 - 03:15 PM, said:

Walls of code
Put these in spoiler tags man! As long as you can still edit your posts. Example:
Spoiler

Click 'Reply' to see how it's done.
0

User is offline   Mark 

#205

I didn't give a full look but I saw only a single instance of seekplayer in the commander AI lines. Maybe other AI needs seekplayer added in?
0

User is offline   Danukem 

  • Duke Plus Developer

#206

ifp phigher
        move COMMCARIGETUPVELS getv geth faceplayer
      else
        move COMMCARIGETVELS getv geth faceplayer


This is bad code in the AICOMMCARIGET block because it will constantly reset the actor's move, never giving it a chance to accelerate. When you copy and paste code from one of the original enemies with hardcoding (in this case COMMANDER), you can't assume it will work the same in a useractor.

Anyway, that's my best and only guess. The fix should be obvious.
0

User is offline   F!re-Fly 

#207

Okay I see that I was wrong again.

For the problem of King Cobra and Predator, you also have an idea?
0

User is offline   F!re-Fly 

#208

I'm testing this code:

ifcansee ifp phigher
    {
      ifp palive
        move COMMCARIGETUPVELS getv geth faceplayer
      else
        move COMMCARIGETVELS getv geth faceplayer


On the other hand, when the player is dead, he continues shooting shots.
0

User is offline   F!re-Fly 

#209

Normally, this code is correct. I have a good result:

ifcansee ifp phigher
    {
      ifp palive
        move COMMCARIGETUPVELS getv geth faceplayer
      else
        move COMMCARIGETVELS getv geth faceplayer
    }
      { ifp pdead break }
    ifactioncount 8
      ifrnd 2
        ai AICOMMCARIABOUTTOSHOOT
  }

0

User is offline   F!re-Fly 

#210

There is, however, a strange point in this block.

In the Commander's original code, the "ifp phigher" function was in the same place and worked very well.

There, it is about reversing the two values and it works.
0

Share this topic:


  • 17 Pages +
  • « First
  • 5
  • 6
  • 7
  • 8
  • 9
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options