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

Jump to content

Hide message Show message
Welcome to the Duke4.net Forums!

Register an account now to get access to all board features. After you've registered and logged in, you'll be able to create topics, post replies, send and receive private messages, disable the viewing of ads and more!

  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

CON coding problems.  "Improvements and progress."

User is offline   Firefly_Trooper 

  • 12

#31

Example for the LIZTROOP code:

onevent EVENT_GAME // little bloodpool for monsters shrunked
  switch sprite[THISACTOR].picnum
  case BLOODPOOL
  ifspawnedby LIZTROOP
  { 
    state troopshrunkstate
    sizeto 10 10
  }
  break
  endswitch
endevent


This code works, but it supports the unshrunk LIZTROOP. I'll have to look at the code again.
0

User is online   Jimmy 4k 

  • Duke4 Thot Patrol
  • 4,163

#32

What's happening is that code in EVENT_GAME is being constantly executed. It is not just executed once. What you need to do is write your code so that it is only executed that one time when it spawns, using a VAR to make a "check" would probably be the easiest way.

Also I'm not sure why you've added "state troopshrunkstate" into this code. Again, you really need to slow down and learn the language you're using instead of guessing.

Posted Image

This post has been edited by Jimmy 4k: 18 November 2018 - 05:10 PM

0

User is offline   Firefly_Trooper 

  • 12

#33

Hi Jimmy ! I added "state troopshrunkstate" for a test.

Mmmh ... I think my result is a bit complicated.

I'll have to redo this code, but that applies to absolutely all the narrowed monsters, and ONLY, for the all monsters shrunked.

1. Monsters of normal size, BLOODPOOL by default (40 40).
2. Monsters of reduced sizes, BLOODPOOL reduced (between 10 10 and 20 20 according to the desired result).

Moreover, it will be necessary to change the permanent execution of the sprites. Stopped the reduction of a puddle of blood that already small.

On the other hand, my code "onevent" with "EVENT_GAME", works very well for BOSS. BLOODPOOL size 60 60 is fixed.

This post has been edited by Firefly_Trooper: 19 November 2018 - 09:34 AM

0

User is offline   Firefly_Trooper 

  • 12

#34

I rework on my very first enemy, the "Predator" of the Gate.

I have three things that I can not do:

1. Can not kill it on expander.
2. Can not kill it on freezethrower.
3. I do not know where I have to put the "THUD" sound when it's falling.

The code:

/* Start Of 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      = Lizman spit
22      = Octabrain wierdshot fly
-------------- */

define PREDATOR 4818
define PREDSTAYPUT 4819

define PREDATORDEADSPRITE 4848

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 APREDSHOOT     21 1 1 1 30
action APREDPAIN      25 1 1 1 6
action APREDFROZEN    0  1 5 1
action APREDDYING     25 5 1 1 16
action APREDDEAD      30 1 1 1 1
action APREDGROW      0

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 // NEW!!!

state predstompstate
cstat 257

ifcansee { }

ifp pshrunk
  {
  ifpdistl 1280
    {
    sound SQUISHED
    state standard_jibs
    state standard_jibs
    addphealth -1000
    break
    }
  }
  else
  ai AIPREDSEEK

ends

state predpalshootstate
ifspritepal 22
{
shoot COOLEXPLOSION1
sound WIERDSHOT_FLY
}
else
ifspritepal 21
{
shoot SPIT
sound LIZARD_SPIT
}
else
ifspritepal 18
{
shoot SHOTSPARK1
sound PISTOL_FIRE3
}
else
ifspritepal 16
{
shoot SHRINKER
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
shoot FREEZEBLAST
shoot FREEZEBLAST
sound SOMETHINGFROZE
}
else
ifspritepal 10
nullop
else
ifspritepal 11
{
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
cstat 257

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
cstat 257

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 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
cstat 257

ifcansee nullop else ai AIPREDSEEK

ifpdistg 3000
  {
  ai AIPREDSEEK
  }
  else
  ifrnd 2
    ai AIPREDHIDE

ifcount 5
  ai AIPREDSEEK

ifrnd 1
  state doshoot

ends

state predhitstate
cstat 257

ifdead
  {
  ifrnd 128 spawn BLOODPOOL
  ifwasweapon FREEZEBLAST
    {
    sound SOMETHINGFROZE
    spritepal 1
    move 0
    action APREDFROZEN
    strength 0
    break
    }

  state random_wall_jibs
  shoot BLOODSPLAT1
  shoot BLOODSPLAT3
  shoot BLOODSPLAT2

  ifwasweapon GROWSPARK
    {
    sound ACTOR_GROWING
    ai AIPREDGROW
    break
    }
    else state predammostate

  addkills 1

  ifwasweapon RPG
    {
    sound SQUISHED
    state standard_jibs
    state standard_jibs
    state standard_jibs
    state standard_jibs
    state random_wall_jibs
    shoot BLOODSPLAT2
    shoot BLOODSPLAT3
    killit
    }
    else
  ifwasweapon RADIUSEXPLOSION
    {
    sound SQUISHED
    state standard_jibs
    state standard_jibs
    state standard_jibs
    state standard_jibs
    shoot BLOODSPLAT1
    shoot BLOODSPLAT2
    state random_wall_jibs
    killit
    }
    else
    {
    sound PREDA_DYING
    action APREDDYING
    break
    }

  }
  else
  {
  state random_wall_jibs
  shoot BLOODSPLAT1
  shoot BLOODSPLAT2
  shoot BLOODSPLAT1
  sound PREDA_PAIN

  ifwasweapon SHRINKSPARK
    {
    sound ACTOR_SHRINKING
    ai AIPREDSHRUNK
    cstat 0
    break
    }
    else
    ifwasweapon GROWSPARK
      sound EXPANDERHIT

    ifrnd 24
      state predpalshootstate
      else
      ifrnd 12
        ai AIPREDHIDE

  }

ifactioncount 2
  {
  resetactioncount
  ai AIPREDSEEK
  }

ends

state preddodgestate
cstat 257

ifcansee nullop else ai AIPREDSEEK

ifcount 5
  {
  resetcount
  ifbulletnear
    nullop
    else
    ai AIPREDSEEK
  }

ends


state predshrunkstate
cstat 257
ifcount SHRUNKDONECOUNT
  ai AIPREDSEEK
  else
  ifcount SHRUNKCOUNT
  sizeto 46 38
  else
  state genericshrunkcode
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

useractor enemystayput PREDSTAYPUT PRED1STRENGTH
  ai AIPREDSEEK
  cactor PREDATOR
  clipdist 32
enda

useractor enemy PREDATOR PRED1STRENGTH APREDSTAND
fall

  clipdist 32

ifaction APREDDYING
  {
  ifactioncount 5
    {
    action APREDDEAD
    }
  break
  }
  else
  {
  ifaction APREDDEAD
    {
    }
    else
    {
    ifdead
      {
      action APREDDYING
      break
      }
    }
  }

ifaction APREDFROZEN
  {
    ifcount THAWTIME
    {
      ai AIPREDSEEK
      getlastpal
    }
    else
      ifcount FROZENDRIPTIME
    {
      ifactioncount 26
      {
        spawn WATERDRIP
        resetactioncount
      }
    }
    ifhitweapon
    {
      ifwasweapon FREEZEBLAST
      {
        strength 0
        break
      }
      addkills 1

      ifrnd 84
        spawn BLOODPOOL
      lotsofglass 30
      sound GLASS_BREAKING
      killit
    }
    ifp pfacing
      ifpdistl FROZENQUICKKICKDIST
        pkick
    break
  }

ifaction APREDDEAD
  {
  cstat 0
  strength 0
  ifrespawn
    ifcount RESPAWNACTORTIME
      {
      spawn TRANSPORTERSTAR
      cstat 257
      state predsetstrength
      ai AIPREDSEEK
      }
  ifhitweapon
    {
    ifwasweapon RADIUSEXPLOSION
      {
      sound SQUISHED
      state standard_jibs
      state standard_jibs
      state standard_jibs
      shoot BLOODSPLAT2
      shoot BLOODSPLAT3
      state random_wall_jibs
      killit
      }
    break
    }
    else
      state checksquished
  break
  }

iffloordistl 20
  {
  ifai AIPREDFALL
    {
    ai AIPREDSEEK
    }
  }
  else
  {
  ifai AIPREDFALL
    {
    break
    }
    else
    ai AIPREDFALL
  }

state checksquished

ifai NO
{
sizeat 42 36
state predsetstrength
sound PREDA_RECO
ifrnd 150
  {
  ai AIPREDHUNT
  state doshoot
  }
  else
  {
  ifrnd 128
    {
    ai AIPREDSEEK
    }
    else
    {
    ai AIPREDHIDE
    }
  }

}

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
      }
    }
  }

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 genericgrowcode
  else
ifai AIPREDDODGE
    state preddodgestate
enda

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

appendevent EVENT_LOADACTOR
  ifactor PREDATOR
  {
    sizeat 40 40
  }
  else
  ifactor PREDSTAYPUT
  {
    sizeat 40 40
  }
  ifactor PREDATORDEADSPRITE // enemy corpse
  {
    sizeat 40 40
  }
endevent

/* End Of Predator Code   */
/* ---------------------- */

// Sprite resize bugfix for Predator (4818 PREDATOR / 4819 PREDSTAYPUT)
appendevent EVENT_SPAWN
    ifvarl sprite[THISACTOR].xrepeat 1
        break 
    switch sprite[THISACTOR].picnum
    case PREDATOR
    case PREDSTAYPUT
        sizeat 42 36
        break
    endswitch
endevent


Is the code in general good? Are there any errors?
0

User is offline   Mark 

  • Honored Donor
  • 2,717

#35

I could be wrong so wait for a better answer from someone that knows more than I do. I remember somebody else mentioned you were using "break" incorrectly. To me it looks like there are a few times in the code it should not be there. It stops parts of your code from running.
0

User is offline   Firefly_Trooper 

  • 12

#36

All the Predator code, is the one that was present for TC "The Gate"
I added some extra features, without changing the structure. Basically, the monster was not intended to be killed by the freezer and expander. Instead, he is jibed. I believe anyway that it was badly coded.
0

User is offline   Firefly_Trooper 

  • 12

#37

I found a solution for the SQUISHED sound of the PSX monsters. I'm just going to copy the same sound and assign it a pitch effect, in the USER.CON file.
0

User is offline   Firefly_Trooper 

  • 12

#38

I do not know what value "break" is misused. Here is an old image, for the Predator:

Posted Image

This post has been edited by Firefly_Trooper: 25 November 2018 - 01:35 AM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,252

#39

If you want to make the predator work with the freezer and expander like other monsters, there are plenty of examples in the original GAME.CON

It's mostly a matter of copy/pasting a few blocks of code in the right places. It's a good novice exercise for you.
0

User is offline   Firefly_Trooper 

  • 12

#40

The problem comes from there. He does not die properly.

ifaction APREDDYING
  {
  ifactioncount 5
    {
    action APREDDEAD
    }
  break
  }
  else
  {
  ifaction APREDDEAD
    {
    }
    else
    {
    ifdead
      {
      action APREDDYING
      break
      }
    }
  }

0

User is offline   Firefly_Trooper 

  • 12

#41

There are four codes to correct.

1. The appearance of the BLOODPOOL sprite when it dies.
2. The sound "THUD" for the fall
3. Killed with Expander
4. Killed with the freezethrower

The problem comes from the code "DEAD" and "DYING" in the useractor part.

This post has been edited by Firefly_Trooper: 25 November 2018 - 10:49 AM

0

User is offline   Firefly_Trooper 

  • 12

#42

The Predator does not have a "state preddyingstate" code for the animation of death. I'll just add it and replace it with the first line in useractor. Then add this "state" code in the appropriate line.
0

User is offline   Firefly_Trooper 

  • 12

#43

I copied the code of another monster, and here is the result. This is the code of the original Predator:

ifaction APREDDYING
  {
  ifactioncount 5
    {
    action APREDDEAD
    }
  break
  }
  else
  {
  ifaction APREDDEAD
    {
    }
    else
    {
    ifdead
      {
      action APREDDYING
      break
      }
    }
  }

ifaction APREDDEAD
  {
  cstat 0
  strength 0
  ifrespawn
    ifcount RESPAWNACTORTIME
      {
      spawn TRANSPORTERSTAR
      cstat 257
      state predsetstrength
      ai AIPREDSEEK
      }
  ifhitweapon
    {
    ifwasweapon RADIUSEXPLOSION
      {
      sound SQUISHED
      state standard_jibs
      state standard_jibs
      state standard_jibs
      shoot BLOODSPLAT2
      shoot BLOODSPLAT3
      state random_wall_jibs
      killit
      }
    break
    }
    else
      state checksquished
  break
  }


Result:

1. The Predator normally dies with basic weapons (shotgun and pistol for exemple).
2. He does not die with the freezethrower and expander it.

Here is the replacement code:

ifaction APREDSTAND
    ai AIPREDSEEK
  else
    ifaction APREDDEAD
  {
    ifrespawn
      ifcount RESPAWNACTORTIME
    {
      spawn TRANSPORTERSTAR
      cstat 257
      strength PRED1STRENGTH
      ai AIPREDSEEK
    }
    else
    {
      strength 0
      ifhitweapon
        ifwasweapon RADIUSEXPLOSION
      {
        sound SQUISHED
        state standard_jibs
        killit
      }
      break
    }
  }
  else
    ifaction APREDFROZEN
  {
    ifcount THAWTIME
    {
      ai AIPREDSEEK
      getlastpal
    }
    else
      ifcount FROZENDRIPTIME
        ifrnd 8
          spawn WATERDRIP

    ifhitweapon
    {
      ifwasweapon FREEZEBLAST
      {
        strength 0
        break
      }
      addkills 1

      lotsofglass 30
      ifrnd 84 spawn BLOODPOOL
      sound GLASS_BREAKING
      killit
    }
    ifp pfacing
      ifpdistl FROZENQUICKKICKDIST
        pkick
    break
  }


ifai AIPREDDEAD
     state preddyingstate
else


As well as the code of death:

state preddyingstate
  iffloordistl 32
  {
    ifactioncount 5
    {
      cstat 257
      iffloordistl 8
      sound THUD
      ifrnd 64
        spawn BLOODPOOL
      state rf
      strength 0
      move PREDSTOPPED
      action APREDDEAD
    }
    break
  }
  else
  {
    state rf
    move 0
    action APREDDYING
  }
ends


Result:

1. It does not die any more normally, with the basics weapons (shotgun and pistol for exemple).
2. Freezethrower and expander work.
3. the code "state preddyingstate" is not taken into account, especially for the sound "THUD"

The RPG and pipebomb weapons are not affected. They work very well.

This post has been edited by Firefly_Trooper: 25 November 2018 - 02:06 PM

0

User is offline   Firefly_Trooper 

  • 12

#44

The Predator all death animation is fixed !



ifaction APREDDYING
  {
  ifactioncount 5
    {
    action APREDDEAD
    }
  break
  }

ifaction APREDDEAD
  {
  cstat 0
  strength 0
  ifrespawn
    ifcount RESPAWNACTORTIME
      {
      spawn TRANSPORTERSTAR
      cstat 257
      state predsetstrength
      ai AIPREDSEEK
      }
  ifhitweapon
    {
    ifwasweapon RADIUSEXPLOSION
      {
      sound SQUISHED
      state standard_jibs
      state standard_jibs
      state standard_jibs
      shoot BLOODSPLAT2
      shoot BLOODSPLAT3
      state random_wall_jibs
      killit
      }
    break
    }
    else
      state checksquished
  break
  }

  else
    ifaction APREDFROZEN
  {
    ifcount THAWTIME
    {
      ai AIPREDSEEK
      getlastpal
    }
    else
      ifcount FROZENDRIPTIME
        ifrnd 8
          spawn WATERDRIP

    ifhitweapon
    {
      ifwasweapon FREEZEBLAST
      {
        strength 0
        break
      }
      addkills 1

      lotsofglass 30
      ifrnd 84 spawn BLOODPOOL
      sound GLASS_BREAKING
      killit
    }
    ifp pfacing
      ifpdistl FROZENQUICKKICKDIST
        pkick
    break
  }


This part of the code can not be recognized:

ifai AIPREDDEAD state preddyingstate


This post has been edited by Firefly_Trooper: 26 November 2018 - 02:19 PM

0

User is offline   Firefly_Trooper 

  • 12

#45

Predator code (state) has been modified and arranged. Everything is OK.
0

User is offline   Firefly_Trooper 

  • 12

#46

I would like to add a second "Atomic Health" named "Pearl Health" that comes from Caribbean and here is a copy of the code:

state get2code
  ifactor PEARLHEALTH
    globalsound GETPEARLHEALTH
  else
    globalsound DUKE_GET
  palfrom 16 0 32
  ifrespawn
  {
    move RESPAWN_ACTOR_FLAG
    spawn RESPAWNMARKERRED
    cstat 32768
  }
  else
    killit
ends

state quikget2
  ifactor PEARLHEALTH
    globalsound GETPEARLHEALTH
  else
    globalsound DUKE_GET
  palfrom 16 0 32
  killit
ends

useractor notenemy PEARLHEALTH
  fall
  ifmove RESPAWN_ACTOR_FLAG
    state respawnit
  else
    ifp pshrunk nullop
    else
      ifp palive
        ifpdistl RETRIEVEDISTANCE
          ifcount 6
            ifphealthl MAXPLAYERPEARLHEALTH
              ifcanseetarget
      {
        addphealth 50
        quote 129
        ifspawnedby PEARLHEALTH
          state get2code
        else
          state quikget2
      }
enda


The only thing that does not work is health that should be increased.

Is USER.CON:

define MAXPLAYERPEARLHEALTH     200

0

User is offline   Mark 

  • Honored Donor
  • 2,717

#47

The wiki shows to use a number with ifphealthl not a defined name. Try replacing MAXPLAYERPEARLHEALTH with 200 in the pearl code.
https://wiki.eduke32...wiki/Ifphealthl

This post has been edited by Mark: 27 November 2018 - 11:42 AM

0

User is offline   Firefly_Trooper 

  • 12

#48

View PostMark, on 27 November 2018 - 11:39 AM, said:

The wiki shows to use a number with ifphealthl not a defined name. Try replacing MAXPLAYERPEARLHEALTH with 200 in the pearl code.
https://wiki.eduke32...wiki/Ifphealthl


Thank you Mark! I had already watched in the wiki, but it did not work.
0

User is offline   Firefly_Trooper 

  • 12

#49

useractor notenemy PEARLHEALTH
  fall
  ifmove RESPAWN_ACTOR_FLAG
    state respawnit
  else
    ifp pshrunk nullop
    else
      ifp palive
        ifpdistl RETRIEVEDISTANCE
          ifcount 6
            ifphealthl 200
              ifcanseetarget
      {
        addphealth 100
        quote 129
        ifspawnedby PEARLHEALTH
          state getpearlcode
        else
          state quikgetpearl
      }
enda


The "Pearl Health" works, when the player has a health of -30. What I would like to do is give the player 100 health points instead of 50. Except that it does not increase health to 200.
0

User is offline   Firefly_Trooper 

  • 12

#50

I took another code, that of the boss "NW" "the Santa Claws" I improved some things:

1. death animation, without "action" killit (to kill him normally and jibbed the corpse).
2. All sounds "quotes" is fixed.
3. Adding the shrinker as a fourth weapon (added in the code, but unused).
4. Spawn PRESENTS sprite.
5. Action death animation is fixed.

I found three problems:

1. When he falls on the ground, he dies!
2. He sometimes shoots RPGs while injuring himself, without seeing the player.
3. When he falls without seeing the player, he hovers slowly down.

The BOSS "Santa Claws" already had a "spritepal 21" value for a mini-boss. I simply changed the health of the basic BOSS.

define SOBBOTWALK 7514
define SOBBOTFLY 7554

define SOBBOTSTRENGTH 1
define MINIBOSSSTRENGTH 1000

move botshrunkspeed 50
move botsteroidspeed 400
move botstopped
move botfall 0 -38
move bothardfall 0
move botflyupspeed 200 -140
move botflydownspeed 200 -38
move botflyspeed 200 // -38
move botdodgespeedfly 250 -140
move botdodgespeeddownfly 250 140

action ABOTFLY        0  1 5 1 13
action ABOTFLYDYING   0 5 1 1 18
action ABOTFLYDIEBACK 0 5 1 -1 18
action ABOTFLYDEAD    0 1 1 1 1
action ABOTFLYFROZEN  0 1 5 1 1

ai AIBOTFLYUP ABOTFLY botflyupspeed faceplayer
ai AIBOTFLYDOWN ABOTFLY botflydownspeed faceplayer
ai AIBOTFLYSEEKUP ABOTFLY botflyupspeed geth seekplayer randomangle
ai AIBOTFLYSEEKDOWN ABOTFLY botflydownspeed geth seekplayer randomangle
ai AIBOTFLYDODGEUP ABOTFLY botdodgespeedfly fleeenemy randomangle
ai AIBOTFLYDODGEDOWN ABOTFLY botdodgespeeddownfly fleeenemy randomangle
ai AIBOTFLYNOTMOVING
ai AIBOTFLYCAMPING ABOTFLY botstopped faceplayer
ai AIBOTFLYDYING ABOTFLYDYING botstopped faceplayer
ai AIFLYWAIT ABOTFLY botstopped faceplayer
ai AIFLYUPMOMENT ABOTFLY botflyupspeed faceplayer
ai AIFLYUPHOLD ABOTFLY botflyupspeed faceplayer
ai AIBOTFLYSTRAIGHT ABOTFLY botflyspeed geth getv
ai AIBOTFLYGROW ABOTFLY botstopped geth getv
ai AIBOTFLYSHRINK ABOTFLY botshrunkspeed fleeenemy
ai AIBOTFLYSTEROIDS ABOTFLY botsteroidspeed randomangle
ai AIBOTFLYFLEE ABOTFLY botflyspeed randomangle

action ABOTWALK   5 4 5 1 13
action ABOTWALK1  5 1 5 1 13
action ABOTWALKGO 5 4 5 1 13
action ABOTKICK   5 2 5 1 25
action ABOTCRAWL  -96 3 5 1 13
action ABOTJUMPUP 40 2 5 1 13
action ABOTFALL   50 1 5 1 1
action ABOTWDYING 70 5 1 1 18
action ABOTWDEAD  75 1 1 1 1
action ABOTWALKDIEBACK 74 5 1 -1 18
action ABOTWALKFROZEN  0 1 5 1 1

move botwalkspeed 250
move botjumpspeed 250 -115
move botjumpdspeed 250 150
move botcrawlspeed 0
move botfallspeed 250 100

ai AIBOTWALKKICK ABOTKICK botstopped faceplayer
ai AIBOTWALKHUNT ABOTWALK botwalkspeed faceplayer
ai AIBOTWALKSEEK ABOTWALK botwalkspeed seekplayer
ai AIBOTWALKSEEK2
ai AIBOTWALKCAMPING ABOTWALK botstopped faceplayersmart
ai AIBOTWALKSTRJUMP1 ABOTJUMPUP botjumpspeed geth getv
ai AIBOTWALKSTRJUMP2 ABOTFALL botjumpdspeed geth getv
ai AIBOTWALKSTRJUMP1S ABOTJUMPUP botjumpspeed faceplayer
ai AIBOTWALKSTRJUMP2S ABOTFALL botjumpdspeed faceplayer
ai AIBOTWALKJUMP1 ABOTJUMPUP botjumpspeed faceplayer
ai AIBOTWALKJUMP2 ABOTFALL botjumpdspeed faceplayer
ai AIBOTWALKDYING ABOTWDYING botstopped faceplayer
ai AIWALKFALL ABOTFALL botstopped faceplayer
ai AIWALKFALLHARD ABOTFALL botstopped faceplayer
ai AIBOTWALKSTRAIGHT ABOTWALK botwalkspeed geth getv
ai AIBOTWALKGROW ABOTWALK1 botstopped geth getv
ai AIBOTWALKSHRINK ABOTWALK botshrunkspeed fleeenemy
ai AIBOTWALKSTEROIDS ABOTWALK botsteroidspeed randomangle
ai AIBOTWALKFLEE ABOTWALK botwalkspeed randomangle
ai AIBOTLETFALL ABOTFALL botfallspeed getv geth
ai AIBOTWALKNOTMOVING
ai AIWALKWAIT ABOTWALK botstopped faceplayer

state miniboss

sound SANTA_TRASH1

spawn EXPLOSION2
spawn EXPLOSION2
spawn PIGCOP
spawn PIGCOP
killit

ends

state stomphisfreakingass

ifp pdead
  {
  }
  else
  {
  ifpdistl SQUISHABLEDISTANCE
    {
    addphealth -1000
    sound SQUISHED
    state standard_pjibs
    state standard_pjibs
    sound SANTA_TRASH9
    }
  }

ends


state botchangeweaponstate

ifspritepal 21 break

resetcount

ifspritepal 0
  {
  ifpdistl 4096
    {
    ifrnd 128
      spritepal 3
      else
      spritepal 9
    }
    else
    {
    ifrnd 128
      spritepal 3
    }
  }
  else
ifspritepal 3
  {
  ifpdistg 4096
    {
    ifrnd 128
      spritepal 0
      else
      spritepal 9
    }
    else
    {
    ifrnd 128
      spritepal 9
    }
  }
  else
ifspritepal 9
  {
  ifpdistg 4096
    {
    ifrnd 128
      spritepal 0
      else
      spritepal 3
    }
    else
    {
    ifrnd 128
      spritepal 9
    }
  }

sound SELECT_WEAPON

ends

state botquickshootstate

ifspritepal 21 break

ifp pshrunk break
ifp pdead break

ifspritepal 0
  {
  shoot RPG sound RPG_SHOOT
  }
  else
ifspritepal 3
  {
  shoot CHAINGUN sound CHAINGUN_FIRE
  }
  else
ifspritepal 9
  {
  shoot SHOTGUN sound SHOTGUN_FIRE
  }

ends


state botshootstate

ifspritepal 21 break // ifcanshoottarget { } // ifcanseetarget { }

ifp pdead break
ifp pshrunk break

ifspritepal 0
  {
  ifcount 5
    {
    ifactioncount 5
      {
      resetactioncount
      shoot RPG
      sound RPG_SHOOT
      }

    ifpdistl 4096
      {
      ifrnd 5
        state botchangeweaponstate
      }
    }
  }
  else
ifspritepal 3
  {
  ifcount 5
    {
    ifactioncount 1
      {
      resetactioncount
      shoot SHOTSPARK1 shoot CHAINGUN shoot CHAINGUN shoot CHAINGUN
      sound CHAINGUN_FIRE
      }
    ifrnd 1 state botchangeweaponstate
    }
  }
  else
ifspritepal 9
  {
  ifcount 5
    {
    ifactioncount 5
      {
      resetactioncount
      shoot SHOTGUN
      sound SHOTGUN_FIRE
      }
    ifp ponsteroids
      {
      ifrnd 64
        state botchangeweaponstate
      }
    ifrnd 1 state botchangeweaponstate
    }
  }



ends

state dudehurt

        ifstrength YELLHURTSOUNDSTRENGTHMP
        {
          ifrnd 64
            sound SANTA_GOTHIT
          else
            ifrnd 64
              sound SANTA_TRASH6
          else
            sound SANTA_TRASH8
        }
        else
        {
          ifrnd 64
            sound SANTA_GOTHIT
          else ifrnd 64
            sound SANTA_TRASH6
          else
            sound SANTA_TRASH8
        }

        ifrnd 80
          sound SANTA_GOTHIT
ends

state dukehurt

        ifrnd 80
          sound SANTA_GOTHIT
/*

        ifphealthl YELLHURTSOUNDSTRENGTHMP
        {
          ifrnd 64
            sound DUKE_LONGTERM_PAIN2
          else
            ifrnd 64
              sound DUKE_LONGTERM_PAIN3
          else
            ifrnd 64
              sound DUKE_LONGTERM_PAIN4
          else
            sound DUKE_DEAD
        }
        else
        {
          ifrnd 64
            sound DUKE_LONGTERM_PAIN5
          else ifrnd 64
            sound DUKE_LONGTERM_PAIN6
          else ifrnd 64
            sound DUKE_LONGTERM_PAIN7
          else
            sound DUKE_LONGTERM_PAIN8
        }
*/
ends

// WALK STATES

state botwalkhitstate

state botshootstate

spawn BLOOD

ifdead
  {
  ifspritepal 21
    {
    state miniboss
    }
  else
    ifrnd 64
    soundonce SANTA_DEAD
    else ifrnd 64
    soundonce SANTA_TRASH4

  ifwasweapon FREEZEBLAST
    {
    spritepal 1
    strength 0
    move 0
    action ABOTWALKFROZEN
    sound SOMETHINGFROZE
    break
    }
    else
  ifwasweapon GROWSPARK
    {
    cstat 0
    sound ACTOR_GROWING
    ai AIBOTWALKGROW
    break
    }
    else
  ifwasweapon RADIUSEXPLOSION
    {
    state standard_pjibs
    state standard_pjibs
    state standard_pjibs
    state standard_pjibs
    sound SQUISHED
    addkills 1
    killit
    }
    else
  ifwasweapon RPG
    {
    state standard_pjibs
    state standard_pjibs
    state standard_pjibs
    state standard_pjibs
    sound SQUISHED
    addkills 1
    killit
    }
    else
    {
    ai AIBOTWALKDYING
    break
    }

  }
  else
  {
  state dudehurt

  ifwasweapon SHRINKSPARK
    {
    ifai AIBOTWALKSTEROIDS
       {
       }
       else
       {
       ai AIBOTWALKSHRINK
       break
       }
    }
  }

ends

state botwalkdyingstate
fall

ifactioncount 5
  {
    cstat 257
    iffloordistl 8
    sound THUD
    ifrnd 64
      spawn BLOODPOOL
    state rf
    strength 0
    move botstopped
    action ABOTWDEAD
  }
  break
ends

state botwalkseekstate

ifcansee
  {
  ai AIBOTWALKHUNT
  break
  }
  else
  {
  }

  ifrnd SWEARFREQUENCY
  { randvar TEMPFIX1 4
    ifvare TEMPFIX1 0 soundonce SANTA_TRASH2
    else ifvare TEMPFIX1 1 soundonce SANTA_TRASH3
    else ifvare TEMPFIX1 2 soundonce SANTA_TRASH5
    else ifvare TEMPFIX1 3 soundonce SANTA_TRASH7
  }

ifgapzl 100
  {
  }
  else
  {
  ifnotmoving
    {
    ifrnd 4 operate
    ifpdistl 8000
      {
      ai AIFLYUPMOMENT
      cactor SOBBOTFLY
      break
      }
      else
      ai AIBOTWALKJUMP1
    break
    }
  }

ends

state botwalkjumpstate

ifrnd 4
  ifpdistl 6000
    state botquickshootstate

ifai AIBOTWALKJUMP1
  {
  ifactioncount 2
    {
    ai AIBOTWALKJUMP2
    break
    }
  }

ifai AIBOTWALKJUMP2
  {
  ifactioncount 1
    {
    state botshootstate
    iffloordistl 16
      {
      sound DUKE_LAND
      operate
      ai AIBOTWALKHUNT
      }
    }
  }

ends

state botwalkhuntstate

state botshootstate

ifrnd 3
  {
  ai AIBOTWALKSTRJUMP1S
  count 10
  }

ifcansee
  {
  ifpdistl 1024
    {
    ifrnd 24
      {
      ifp pdead
        nullop
        else
        ai AIBOTWALKKICK
      break
      }
    }
  }
  else
  {
  ifphealthl 50
    ifrnd 64
      ifpdistl 8000
        {
          ifrnd 80
            sound SANTA_TRASH1
        }

  ifrnd 128
    {
    ifp phigher
      {
      ai AIFLYUPMOMENT
      cactor SOBBOTFLY
      break
      }
      else
      {
      ai AIBOTWALKSTRAIGHT
      break
      }
    }
    else
    {
    ai AIBOTWALKSTRAIGHT
    break
    }
  ai AIBOTWALKSEEK
  break
  }

ifrnd 128
  ifnotmoving
    {
    ifrnd 8
      operate
    ai AIBOTWALKJUMP1
    break
    }

ends

state botwalkkickstate

ifactioncount 2
  {
  resetactioncount
  ifpdistl 1024
    {
    ifp pdead
      {
      ai AIBOTWALKHUNT
      break
      }
    ifp pfacing
      ifrnd 16
        {
          globalsound SANTA_TRASH8
        }
    sound KICK_HIT
    ifspritepal 21
      {
      addphealth -1
      }
      else
      {
      addphealth -6
      }
    state dukehurt
    }
    else
    {
    ai AIBOTWALKHUNT
    break
    }

  ifrnd 50
    {
    ai AIBOTWALKHUNT
    break
    }
  }

ends

state botwalkstraightjumpstate

ifai AIBOTWALKSTRJUMP1
  {
  ifcount 20
    {
    ai AIBOTWALKSTRJUMP2
    break
    }
  }
  else
ifai AIBOTWALKSTRJUMP2
  {
  ifcount 18
    {
    iffloordistl 16
      {
      operate
      ifrnd 128
      sound DUKE_LAND
      ifrnd 200
        ai AIBOTWALKSTRAIGHT
        else
        ai AIBOTWALKSEEK
      }
    }
  }

ends

state botjumpshootstate

ifai AIBOTWALKSTRJUMP1S
  {
  state botshootstate

  ifcount 20
    {
    ai AIBOTWALKSTRJUMP2S
    resetactioncount
    count 10
    break
    }

  }
  else
ifai AIBOTWALKSTRJUMP2S
  {
  ifcount 18
    {
    iffloordistl 16
      {
      operate
      sound DUKE_LAND
      ai AIBOTWALKHUNT
      count 10
      }
    }
  }


ends


state botwalkstraightstate

ifpdistg 20000
  ai AIBOTWALKSEEK

ifcansee
  {
  ifnotmoving
    {
    ai AIBOTWALKSTRJUMP1
    break
    }
  ifrnd 64
    ai AIBOTWALKHUNT
  }
  else
  {
  ifrnd 128
    ifnotmoving
      ai AIBOTWALKSTRJUMP1
  }

ends

state steroidswalk

soundonce DUKE_HARTBEAT
spawn FRAMEEFFECT1

ifhitweapon
  {
  state botwalkhitstate
  break
  }

ifcount 150
  {
  ai AIBOTWALKHUNT
  }

ifcount 34
  {
  }
  else
  {
  sizeto 42 36
  }

ends

state botletfallstate

ifactioncount 5
  {
  }
  else
  ifactioncount 6
    {
    soundonce SANTA_TRASH7
    }

ifcansee
  {
  ai AIFLYWAIT
  cactor SOBBOTFLY
  break
  }
  else
  {
  iffloordistl 50
    {
    ai AIFLYWAIT
    cactor SOBBOTFLY
    break
    }
  }

ends

useractor enemy SOBBOTWALK SOBBOTSTRENGTH ABOTWALK
state checksquished

ifai NO
  {

  ifspawnedby RECON
    {
    spawn PIGCOP
    killit
    }

  ifcansee { } else { break }

  sizeat 42 36
  cstat 257

  ai AIBOTWALKSEEK

  ifspritepal 21
    {
    strength MINIBOSSSTRENGTH
    else ifrnd 64 soundonce SANTA_TRASH9
    }
    else
    {
    spritepal 0
    }
  sound INSERT_CLIP
  break
  }


fall
sleeptime 300

ifaction ABOTWDEAD
  {
  cstat 0
  strength 0
  ifrespawn
    ifcount RESPAWNACTORTIME
      {
      spawn TRANSPORTERSTAR
      cstat 257
      state botwalkstraightstate
      ai AIBOTWALKSEEK
      }
  ifhitweapon
    {
    ifwasweapon RADIUSEXPLOSION
      {
      state standard_pjibs
      state standard_pjibs
      state standard_pjibs
      state standard_pjibs
      sound SQUISHED
      killit
      }
    break
    }
    else
      state checksquished
  break
  }
ifaction ABOTWALKFROZEN
  {

  ifcount THAWTIME
    {
    ai AIBOTWALKHUNT
    getlastpal
    }
    else
    ifcount FROZENDRIPTIME
      {
      ifactioncount 26
        {
        spawn WATERDRIP
        resetactioncount
        }
      }
  ifhitweapon
    {
    ifwasweapon FREEZEBLAST
      {
      strength 0
      break
      }
    addkills 1

    ifrnd 84
      spawn BLOODPOOL
    lotsofglass 30
    spawn ATOMICHEALTH
    sound GLASS_BREAKING
    ifspritepal 21
       state miniboss
    killit
    }
  ifp pfacing
    ifpdistl FROZENQUICKKICKDIST
      pkick
  break
  }
  else
ifai AIBOTWALKSTEROIDS
  {
  state steroidswalk
  break
  }
  else
ifai AIBOTWALKGROW
  {
  ifcount 32
    {
    guts JIBS4 24
    guts JIBS6 28
    addkills 1
    sound SQUISHED
    sound PIPEBOMB_EXPLODE
    hitradius 2048 60 70 80 90
    spawn BLOODPOOL
    spawn EXPLOSION2
    spawn BURNING
    ifspritepal 21
      state miniboss
    killit
    }
    else
    {
    sizeto MAXXSTRETCH MAXYSTRETCH
    break
    }
  break
  }
  else
ifai AIBOTWALKSHRINK
  {

  ifcount SHRUNKDONECOUNT
    ai AIBOTWALKHUNT
    else
    ifcount SHRUNKCOUNT
      {
      spawn FRAMEEFFECT1
      sizeto 42 36
      }
      else
      {
      ifcount 31
        nullop
        else
        {
        ifcount 30
          {
          ifrnd 255
            {
            sound DUKE_TAKEPILLS
            ai AIBOTWALKSTEROIDS
            break
            }
          }
        }
      ifcount 32
        {
        ifpdistl SQUISHABLEDISTANCE
          {
          ifspritepal 0
          {
          ifrnd 128
              sound SANTA_DEAD
              else
              sound SANTA_TRASH9
          }
          state standard_pjibs
          sound SQUISHED
          spawn BLOODPOOL
          pkick
          wackplayer
          wackplayer
          wackplayer
          wackplayer
          ifspritepal 21
            {
            state miniboss
            }
          killit
          }
        }
        else
        {
        sizeto MINXSTRETCH MINYSTRETCH
        spawn FRAMEEFFECT1
        }
      }

  break
  }
  else
ifai AIBOTWALKDYING
  {
  state botwalkdyingstate
  break
  }
  else
  ifrnd 1
    operate

ifhitweapon
  {
  state botwalkhitstate
  break
  }
  else
ifai AIWALKFALLHARD
  {
  iffloordistl 16
    {
    ai AIBOTWALKHUNT
    }
    else
    {
    break
    }
  }
  else
  {
  ifai AIWALKFALL
    {
    state botshootstate
    iffloordistl 16
      {
      ai AIBOTWALKHUNT
      }
      else
      {
      break
      }
    }
  }

ifp pshrunk
  state stomphisfreakingass

iffloordistl 550
  nullop
  else
  {
  ai AIFLYWAIT
  cactor SOBBOTFLY
  }

ifonwater
  {
  }
  else
  {
  ifp pjetpack
    ifp phigher
      ifcansee
        {
        ai AIFLYWAIT
        cactor SOBBOTFLY
        }
  }

ifp phigher
  {
  ifrnd 1
    {
    ifrnd 196
      {
      ai AIFLYWAIT
      cactor SOBBOTFLY
      }
    }
  }

ifai AIWALKWAIT
  {
  ai AIBOTWALKSEEK
  break
  }
  else
ifai AIBOTWALKSEEK
  state botwalkseekstate
    else
ifai AIBOTWALKHUNT
  state botwalkhuntstate
    else
ifai AIBOTWALKJUMP1
  state botwalkjumpstate
    else
ifai AIBOTWALKJUMP2
  state botwalkjumpstate
    else
ifai AIBOTWALKKICK
  state botwalkkickstate
    else
ifai AIBOTWALKSTRAIGHT
  state botwalkstraightstate
    else
ifai AIBOTWALKSTRJUMP1
  state botwalkstraightjumpstate
    else
ifai AIBOTWALKSTRJUMP2
  state botwalkstraightjumpstate
    else
ifai AIBOTLETFALL
  state botletfallstate
    else
ifai AIBOTWALKSTRJUMP1S
  state botjumpshootstate
    else
ifai AIBOTWALKSTRJUMP2S
  state botjumpshootstate


enda

state botflydyingstate

fall

strength 0
cstat 0

ifactioncount 5
  {
  action ABOTFLYDEAD
  ifspritepal 21
    state miniboss
  }

ends

state choosedodgefly

ifceilingdistl 100
  {
  ifai AIBOTFLYDODGEDOWN
    nullop
    else
    ai AIBOTFLYDODGEDOWN
  }
  else
  {
  ifai AIBOTFLYDODGEUP
    nullop
    else
    ai AIBOTFLYDODGEUP
  }

ends


state botflydodgestate

ifcanshoottarget
  state botshootstate

ifcansee
  {
  ifrnd 2
    {
    ifceilingdistl 100
      ai AIBOTFLYDODGEDOWN
      else
      ai AIBOTFLYDODGEUP
    }
  }
  else
  {
  ai AIBOTFLYSEEKUP
  }

ifcount 10
  ai AIBOTFLYDOWN

ends

state botflyhitstate

state botshootstate

spawn BLOOD

ifdead
  {
  ifspritepal 21
    state miniboss
  else
    ifrnd 64
    sound SANTA_DEAD
    else ifrnd 64
    sound SANTA_TRASH4

  ifwasweapon FREEZEBLAST
    {
    spritepal 1
    strength 0
    move 0
    action ABOTFLYFROZEN
    sound SOMETHINGFROZE
    break
    }
    else
  ifwasweapon GROWSPARK
    {
    cstat 0
    sound ACTOR_GROWING
    ai AIBOTFLYGROW
    break
    }
    else
  ifwasweapon RADIUSEXPLOSION
    {
    state standard_pjibs
    state standard_pjibs
    state standard_pjibs
    state standard_pjibs
    sound SQUISHED
    addkills 1
    killit
    }
    else
  ifwasweapon RPG
    {
    state standard_pjibs
    state standard_pjibs
    state standard_pjibs
    state standard_pjibs
    sound SQUISHED
    addkills 1
    killit
    }
    else
    {
    ai AIBOTFLYDYING
    }

  }
  else
  {
  state dudehurt

  ifwasweapon SHRINKSPARK
    {
    ifai AIBOTFLYSTEROIDS
       {
       }
       else
       {
       ai AIBOTFLYSHRINK
       break
       }
    }
  }

ends

state botflyseekupstate

ifcansee
  {
  ai AIBOTFLYUP
  break
  }

ifp phigher
  {
  }
  else
  {
  ai AIBOTFLYSEEKDOWN
  break
  }

ends

state botflyseekdownstate

ifcansee
  {
  ai AIBOTFLYDOWN
  break
  }
  else
  {
  ifp phigher
    {
    }
    else
    {
    ai AIBOTLETFALL
    cactor SOBBOTWALK
    }
  }

ifp phigher
  {
  ai AIBOTFLYSEEKUP
  break
  }

ends

state botflydownstate

state botshootstate

ifrnd 16
  {
  ifp phigher
    {
    ai AIBOTFLYUP
    break
    }
  }

ifcansee
  {
  }
  else
  {
  ai AIBOTFLYSTRAIGHT
  break
  }

ends

state botflyupstate

state botshootstate

ifrnd 16
  {
  ifp phigher
    nullop
    else
    {
    ai AIBOTFLYDOWN
    break
    }
  }

ifcansee
  {
  }
  else
  {
  ai AIBOTFLYSTRAIGHT
  }

ends

state botflyupmomentstate

ifcansee
  {
  ifcount 10 ai AIBOTFLYUP
  break
  }
  else
  {
  ifcount 50
    {
    ai AIBOTLETFALL
    cactor SOBBOTWALK
    }
  }

ends

state botflyholdstate

state botshootstate

ifcount 50
  {
  ai AIBOTFLYUP
  }

ends

state botflystraightstate

ifpdistg 20000
  ai AIBOTFLYSEEKDOWN

ifcansee
  {
  ai AIBOTFLYDOWN
  }
  else
  {
  ifrnd 128
    ifnotmoving
      ai AIFLYUPMOMENT
  }

ends

state steroidsfly

soundonce DUKE_HARTBEAT
spawn FRAMEEFFECT1

ifcount 100
  {
  ai AIBOTFLYUP
  }

ifcount 34
  {
  }
  else
  {
  sizeto 42 36
  }

ifhitweapon
  {
  state botflyhitstate
  break
  }

ends

// FLY ACTOR

useractor enemy SOBBOTFLY SOBBOTSTRENGTH ABOTFLY
state checksquished

ifai NO
  {
  ifcansee { } else { break }
  ifspritepal 21
    {
    strength MINIBOSSSTRENGTH
    }
  sizeat 42 36
  cstat 257
  sound INSERT_CLIP
  ai AIBOTFLYSEEKDOWN
  spritepal 0
  break
  }


fall

sleeptime 300

ifaction ABOTFLYDEAD
  break
  else
ifaction ABOTFLYFROZEN
  {
  ifcount THAWTIME
    {
    ai AIBOTFLYUP
    getlastpal
    }
    else
    ifcount FROZENDRIPTIME
      {
      ifactioncount 26
        {
        spawn WATERDRIP
        resetactioncount
        }
      }
  ifhitweapon
    {
    ifwasweapon FREEZEBLAST
      {
      strength 0
      break
      }
    addkills 1

    ifrnd 84
      spawn BLOODPOOL

    lotsofglass 30
    spawn ATOMICHEALTH
    sound GLASS_BREAKING
    ifspritepal 21
      state miniboss
    killit
    }

  ifp pfacing
    ifpdistl FROZENQUICKKICKDIST
      pkick
  break
  }
  else
ifai AIBOTFLYSTEROIDS
  {
  soundonce DUKE_JETPACK_IDLE
  state steroidsfly
  break
  }
  else
ifai AIBOTFLYGROW
  {
  ifcount 32
    {
    guts JIBS4 24
    guts JIBS6 28
    addkills 1
    sound SQUISHED
    sound PIPEBOMB_EXPLODE
    hitradius 2048 60 70 80 90
    spawn BLOODPOOL
    spawn EXPLOSION2
    ifspritepal 21
      state miniboss
    killit
    }
    else
    {
    sizeto MAXXSTRETCH MAXYSTRETCH
    break
    }
  break
  }
  else
ifai AIBOTFLYSHRINK
  {
  ifcount SHRUNKDONECOUNT
    ai AIBOTFLYUP
    else
    ifcount SHRUNKCOUNT
      {
      spawn FRAMEEFFECT1
      sizeto 42 36
      }
      else
      {
      ifcount 31
        nullop
        else
        {
        ifcount 30
          {
          ifrnd 255
            {
            sound DUKE_TAKEPILLS
            ai AIBOTFLYSTEROIDS
            break
            }
          }
        }
      ifcount 32
        {

        ifpdistl SQUISHABLEDISTANCE
          {
          ifspritepal 0
          {
            ifrnd 128
              sound SANTA_DEAD
              else
              sound SANTA_TRASH4
          }
          state standard_pjibs
          state standard_pjibs
          state standard_pjibs
          state standard_pjibs
          sound SQUISHED
          spawn BLOODPOOL
          pkick
          wackplayer
          wackplayer
          wackplayer
          wackplayer
          ifspritepal 21
            state miniboss
          killit
          }
        }
        else
        {
        sizeto MINXSTRETCH MINYSTRETCH
        spawn FRAMEEFFECT1
        }
      }
  break
  }

soundonce DUKE_JETPACK_IDLE

ifai AIBOTFLYDYING
  {
  state botflydyingstate
  break
  }

ifhitweapon
  state botflyhitstate

ifrnd 2 operate

ifp pshrunk
  {
  state stomphisfreakingass
  }

ifrnd 25
  {
  ifp phigher
    {
    }
    else
    {
    ifp ponground
      {
      iffloordistl 200
        {
        sound DUKE_JETPACK_OFF
        iffloordistl 100 ai AIWALKFALL else ai AIWALKFALLHARD
        cactor SOBBOTWALK
        }
      }
    }
  }

ifai AIFLYWAIT
  {
  move 0
  sound DUKE_JETPACK_ON
  ai AIBOTFLYSEEKDOWN
  }

ifai AIBOTFLYSEEKUP
  state botflyseekupstate
    else
ifai AIBOTFLYSEEKDOWN
  state botflyseekdownstate
    else
ifai AIBOTFLYDOWN
  state botflydownstate
    else
ifai AIBOTFLYUP
  state botflyupstate
    else
ifai AIBOTFLYDODGEUP
  state botflydodgestate
    else
ifai AIBOTFLYDODGEDOWN
  state botflydodgestate
    else
ifai AIFLYUPMOMENT
  state botflyupmomentstate
    else
ifai AIFLYUPHOLD
  state botflyholdstate
    else
ifai AIBOTFLYSTRAIGHT
  state botflystraightstate

break
enda

appendevent EVENT_RECOGSOUND
  ifactor SOBBOTWALK
  {
    set RETURN -1
    sound SANTA_FOUNDPLANS
  }
endevent

appendevent EVENT_LOADACTOR
  ifactor SOBBOTWALK
  {
    sizeat 40 40
  }
  ifactor SOBBOTFLY
  {
    sizeat 40 40
  }
endevent


This post has been edited by Firefly_Trooper: 28 November 2018 - 10:13 AM

0

User is offline   Firefly_Trooper 

  • 12

#51



This post has been edited by Firefly_Trooper: 03 December 2018 - 06:04 PM

0

User is offline   Firefly_Trooper 

  • 12

#52

Hello everyone I have two small questions for coding.

1. How to add a shadow to a monster?

2. With my jibbed corpses code, with cstat 0, I noticed that the shrinker still affects the sprite. How to correct this problem?

Thank you !

This post has been edited by Firefly_Trooper: 05 December 2018 - 02:31 PM

0

User is offline   Perro Seco 

  • 194

#53

View PostFirefly_Trooper, on 05 December 2018 - 02:28 PM, said:

1. How to add a shadow to a monster?
That one is very easy. Put "spriteshadow XXX" wherever you want, but I think it has to be outside of any actor. XXX can be the name or the tile number of the monster.

Posted Image
0

User is offline   Firefly_Trooper 

  • 12

#54

Ow yes, it's easy indeed. For the second problem an idea?
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,252

#55

View PostFirefly_Trooper, on 05 December 2018 - 02:28 PM, said:

2. With my jibbed corpses code, with cstat 0, I noticed that the shrinker still affects the sprite. How to correct this problem?


The shrinker does has a splash radius, but I've never had a problem with dead actors responding to it. If it's shrinking corpses, that can only be due to your code explicitly telling the corpses to shrink when hit by the shrinker. So....don't do that?
0

User is offline   Firefly_Trooper 

  • 12

#56

The code I created is only related to simple corpses (we agree). The reality of the shrunker weapon, it makes disappear all at once the sprite when it is touched. It is surely related to the cstat.

This post has been edited by Firefly_Trooper: 07 December 2018 - 03:42 AM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,252

#57

Ok, but, the sprite isn't going to turn invisible or delete unless your code told it to do that. Since the game doesn't do that normally, it can only be due to your code making that happen. So, you may not find this advice helpful, but honestly all I can tell you is to stop coding the sprites to disappear.
0

User is offline   Firefly_Trooper 

  • 12

#58

Indeed, I added the value killit, to jibe the corpses.

It's funny to know that such a great game can not work properly.

I will be posting this code soon.

This post has been edited by Firefly_Trooper: 08 December 2018 - 08:45 AM

0

User is online   Jimmy 4k 

  • Duke4 Thot Patrol
  • 4,163

#59

The game isn't the problem. You are. The game can only do what you tell it to do.

Posted Image
0

User is offline   Firefly_Trooper 

  • 12

#60

Here is the code (here, the Liztroop for example):

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

0

Share this topic:


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks are property of their respective owners. Instead of reading this text, you could be playing Ion Maiden! ;) © 2018 Voidpoint, LLC

Enter your sign in name and password


Sign in options