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

#1

Hello ! Having done three thousand times different threads, in each different section, Trooper Dan kindly advised me to stop and simply make a real thread, all my improvements and my coding problems.

What strikes me is that simple solutions never hit my mind the first time. :lol:

So, I'll post here, most of the problems that I can not fix (for the moment).

We will resume from the beginning. I will relaunch the subject of BOSS, before the other subject: "bloodpool sprite resize"

--------------------------------------------------------------------------------- -------------------
--------------------------------------------------------------------------------- -------------------
--------------------------------------------------------------------------------- -------------------
--------------------------------------------------------------------------------- -------------------

The subject concerned the value "ifspritepal 3" that I chose for a specific action: to make in first action, a BOSS which advances towards the player, before it attacks.

I tested and placed the code in the file, and it did not work. My question was this:

state checkboss2seekstate
  ai AIBOSS2SEEKENEMY
  ifspritepal 0 nullop
  else   // a fake way of doing a ifspritepal NOT.
  ifspritepal 3 nullop
  else
  ifspritepal 22 nullop
    else
    move PALBOSS2RUNVELS seekplayer
ends


Do I have to put the same code each time there is "pal 0" and "pal 22" ?
0

User is offline   Firefly_Trooper 

  • 12

#2

Others codes not fixed:

----01 BLOODPOOL sprite resize.

What is the best way to gradually show the bloodpool sprite with the chosen size?

I created a code for the boss2, but the sprite appears the first time, without frame animation.

I'm looking for another way, to make the game more consistent, for the killing of shrunken monsters and boss.

1. Little bloodpool for the monsters shrunked
2. Big bloodpool for the boss

Codes (I used this for a BOSS) and shrinker.

onevent EVENT_SPAWN
  switch sprite[THISACTOR].picnum
  case BLOODPOOL
  state genericshrunkcode
  ifcount 32
  {
    ifpdistl SQUISHABLEDISTANCE
    pstomp
  }
  sizeat 10 10
  break
  endswitch
endevent


onevent EVENT_SPAWN // big bloodpool for BOSS1
  switch sprite[THISACTOR].picnum
  case BLOODPOOL
  ifspawnedby BOSS1
  sizeat 60 60
  break
  endswitch
endevent


----02 Shrunk monsters: respawn action

New post for a particular topic about sprites.

When a monster is shrunk, I can now kill it another way. This has been improved for a while, by correcting codes.

However, I noticed two things that are not consistent.

1. A Liztroop that has been shrunk, will generate large ammunition and BLOODPOOL.

I would like to reduce the BLOODPOOL and removed the appearance of ammunition, only when they are shrunk. If the ammunition appeared are also small sizes, it will not be logical either.

----03 sound SQUISHED problem

I have a really tough problem here. I have defined a new "SQUISHED" sound for the monsters of the PSX version. However, this sound and that of the recognition, refuse to be played at the same time and even if it is the same sound that is played. These sounds simply refuse to be played multiple times at the same time.

For this first example in video, there is only one sound "SQUISHED" played



and image, or it is impossible to launch the sound several times, otherwise it bug.

Posted Image

I do not know what's causing this kind of shit.

A second video more explicit. Green color (LIZTROOP classics). Blue (LIZTROOP PSX version), for a comparison of sounds played.

On the side of classic green LIZTROOP, everything is fine (obviously, since it is the game at the base). As for the added blue LIZTROOP PSX, it's buggy.

1. "Sound of recognition" wanting to play several times, it's buggy.

2. "Sound SQUISHED2" wanting to play several times, sometimes it does not play at all.

There must be a solution on the side of the "gamevar" attributes for a sound to be played correctly without any problem.

This post has been edited by Firefly_Trooper: 14 November 2018 - 09:45 AM

0

User is offline   Firefly_Trooper 

  • 12

#3

LIZTROOPPSX CODE

define LIZTROOPPSX 4968

define LIZTROOPPSXRUNNING 4969
define LIZTROOPPSXSTAYPUT 4970
define LIZTROOPPSXSHOOT 5003
define LIZTROOPPSXJETPACK 5013
define LIZTROOPPSXDEADSPRITE 5022
define LIZTROOPPSXONTOILET 5029
define LIZTROOPPSXJUSTSIT 5030
define LIZTROOPPSXDUCKING 5032

action ATROOPPSXSTAND 0  1  5  1  1
action ATROOPPSXGROW 0  1  5  1  1
action ATROOPPSXSTAYSTAND -2  1  5  1  1
action ATROOPPSXWALKING 0  4  5  1   12
action ATROOPPSXWALKINGBACK 15   4  5   -1   12
action ATROOPPSXRUNNING 0  4  5  1  8
action ATROOPPSXSHOOT 35  1  5  1   30
action ATROOPPSXJETPACK 40  1  5  1  1
action ATROOPPSXJETPACKILL 40  2  5  1   50
action ATROOPPSXCFLINTCH 50  1  1  1  6
action ATROOPPSXDYING 50  5  1  1   16
action ATROOPPSXDEAD 54
action ATROOPPSXPLAYDEAD 54
action ATROOPPSXSUFFERDEAD 58  2  1   -4   24
action ATROOPPSXSUFFERING 59  2  1  1   21
action ATROOPPSXDUCK 64  1  5  1  3
action ATROOPPSXDUCKSHOOT 64  2  5  1   25
action ATROOPPSXABOUTHIDE 74  1  1  1   25
action ATROOPPSXHIDE 79  1  1  1   25
action ATROOPPSXREAPPEAR 74  1  1  1   25
action ATROOPPSXFROZEN 0  1  5

move TROOPPSXWALKVELS 72
move TROOPPSXWALKVELSBACK -72
move TROOPPSXJETPACKVELS 64 -84
move TROOPPSXJETPACKILLVELS 192 -38
move TROOPPSXRUNVELS 108
move TROOPPSXSTOPPED
move PSXDONTGETUP
move PSXSHRUNKVELS 32

ai AITROOPPSXSEEKENEMY  ATROOPPSXWALKING   TROOPPSXWALKVELS seekplayer
ai AITROOPPSXSEEKPLAYER ATROOPPSXWALKING   TROOPPSXWALKVELS seekplayer
ai AITROOPPSXFLEEING  ATROOPPSXWALKING   TROOPPSXWALKVELS fleeenemy
ai AITROOPPSXFLEEINGBACK ATROOPPSXWALKINGBACK   TROOPPSXWALKVELSBACK faceplayer
ai AITROOPPSXDODGE    ATROOPPSXWALKING   TROOPPSXRUNVELS  dodgebullet
ai AITROOPPSXSHOOTING   ATROOPPSXSHOOT   TROOPPSXSTOPPED  faceplayer
ai AITROOPPSXDUCKING  ATROOPPSXDUCK    TROOPPSXSTOPPED  faceplayer
ai AITROOPPSXJETPACK  ATROOPPSXJETPACK   TROOPPSXJETPACKVELS seekplayer
ai AITROOPPSXSHRUNK   ATROOPPSXWALKING   PSXSHRUNKVELS fleeenemy
ai AITROOPPSXHIDE     ATROOPPSXABOUTHIDE TROOPPSXSTOPPED faceplayer
ai AITROOPPSXGROW     ATROOPPSXGROW    PSXDONTGETUP faceplayerslow

state troophidestatepsx
  ifaction ATROOPPSXREAPPEAR
  {
    ifactioncount 2
    {
      sound TELEPORTER2
      ai AITROOPPSXSHOOTING
      cstat 257
    }
    else
    {
      sizeto 41 40
      sizeto 41 40
      sizeto 41 40
      sizeto 41 40
      spawn FRAMEEFFECT1
    }
  }
  else
    ifaction ATROOPPSXWALKING
  {
    ifpdistl 2448
      ifpdistg 1024
    {
      ifceilingdistl 48
        break
      ifp pfacing
        break

      ifgapzl 64 nullop
      else
        ifawayfromwall
      {
        spawn TRANSPORTERSTAR
        action ATROOPPSXREAPPEAR
        move 0
        break
      }
    }
  }
  else
    ifaction ATROOPPSXHIDE
  {
    ifactioncount 2
    {
      spawn TRANSPORTERSTAR
      sound TELEPORTER2
      action ATROOPPSXWALKING
      move TROOPPSXWALKVELS faceplayer
      cstat 32768
    }
    else
    {
      sizeto 4 40
      sizeto 4 40
      sizeto 4 40
      sizeto 4 40
      spawn FRAMEEFFECT1
    }
  }
  else
    ifaction ATROOPPSXABOUTHIDE
      ifactioncount 2
    {
      action ATROOPPSXHIDE
      cstat 0
    }
ends


state troopgunnashootpsx
  ifp palive
  {
    ifpdistl 1024
      ai AITROOPPSXSHOOTING
    else
      ifactornotstayput
    {
      ifactioncount 12
        ifrnd 16
          ifcanshoottarget
      {
        ifspritepal 21
          ifrnd 4
            ifpdistg 4096
              ai AITROOPPSXHIDE
        else
        {
          ifpdistl 1100
            ai AITROOPPSXFLEEING
          else
          {
            ifpdistl 4096
              ifcansee
                ifcanshoottarget
                  ai AITROOPPSXSHOOTING
            else
            {
              move TROOPPSXRUNVELS seekplayer
              action ATROOPPSXRUNNING
            }
          }
        }
      }
    }
    else
      ifcount 26
        ifrnd 32
          ai AITROOPPSXSHOOTING
  }
ends

state troopseekstatepsx

  ifp pshrunk
  state badguystomphit

  state troopgunnashootpsx
  ifinwater
  {
    ai AITROOPPSXJETPACK
    break
  }
  ifcansee
  {
    ifmove TROOPPSXRUNVELS
      ifpdistl 1596
        ai AITROOPPSXDUCKING
    ifp phigher
    {
      ifceilingdistl 128 nullop
      else
        ifactornotstayput
          ai AITROOPPSXJETPACK
      break
    }
    else
      ifrnd 2
    {
      ifspritepal 21
        ifpdistg 1596
      {
        ai AITROOPPSXHIDE
        break
      }
      ifbulletnear
      {
        ifrnd 128
          ai AITROOPPSXDODGE
        else
          ai AITROOPPSXDUCKING
        break
      }
    }
  }
  ifnotmoving
  {
    ifrnd 32
      operate
    else
      ifcount 32
        ifp palive
          ifcansee
            ifcanshoottarget
              ai AITROOPPSXSHOOTING
  }
  ifrnd 1
  {
    ifrnd 128
      soundonce PRED_ROAM
    else
      soundonce PRED_ROAM2
  }
ends

state troopduckstatepsx
  ifaction ATROOPPSXDUCK
  {
    ifactioncount 8
    {
      ifp palive
      {
        ifrnd 128
          action ATROOPPSXDUCKSHOOT
      }
      else
        ifmove PSXDONTGETUP
          break
        else
          ai AITROOPPSXSEEKPLAYER
    }
  }
  else
    ifaction ATROOPPSXDUCKSHOOT
  {
    ifcount 64
    {
      ifmove PSXDONTGETUP
        resetcount
      else
      {
        ifpdistl 1100
          ai AITROOPPSXFLEEING
        else
          ai AITROOPPSXSEEKPLAYER
      }
    }
    else
      ifactioncount 2
      {
        ifcanshoottarget
        {
          sound PRED_ATTACK
          resetactioncount
          shoot FIRELASER
        }
        else ai AITROOPPSXSEEKPLAYER
      }
  }
ends

state troopshootstatepsx
  ifactioncount 2
  {
    ifcanshoottarget
    {
      shoot FIRELASER
      sound PRED_ATTACK
      resetactioncount
      ifrnd 128
        ai AITROOPPSXSEEKPLAYER
      ifcount 24
      {
        ifrnd 96
          ifpdistg 2048
            ai AITROOPPSXSEEKPLAYER
          else
          {
            ifpdistg 1596
              ai AITROOPPSXFLEEING
            else
              ai AITROOPPSXFLEEINGBACK
          }
      }
    }
    else
      ai AITROOPPSXSEEKPLAYER
  }
ends

state troopfleestatepsx
  ifactioncount 7
  {
    ifpdistg 3084
    {
      ai AITROOPPSXSEEKPLAYER
      break
    }
    else
      ifrnd 32
        ifp palive
          ifcansee
            ifcanshoottarget
      {
        ifrnd 128
          ai AITROOPPSXDUCKING
        else
          ai AITROOPPSXSHOOTING
          break
      }
  }
  ifnotmoving
  {
    ifrnd 32
      operate
    else
      ifcount 32
        ifp palive
          ifcansee
            ifcanshoottarget
      {
        ifrnd 128
          ai AITROOPPSXSHOOTING
        else
          ai AITROOPPSXDUCKING
      }
  }
ends

state troopdyingpsx
  iffloordistl 32
  {
    ifactioncount 5
    {
      cstat 257
      iffloordistl 8
      sound THUD
      ifrnd 64
        spawn BLOODPOOL
      state rf
      strength 0
      move TROOPPSXSTOPPED
      action ATROOPPSXDEAD
    }
    break
  }
  else
  {
    state rf
    move 0
    action ATROOPPSXDYING
  }
ends

state checktroophitpsx
  ifaction ATROOPPSXSUFFERING
  {
    stopsound LIZARD_BEG0
    sound PRED_DYING
    cstat 0
    strength 0
    action ATROOPPSXSUFFERDEAD
    break
  }
  ifdead
  {
    ifwasweapon FREEZEBLAST
    {
      sound SOMETHINGFROZE
      spritepal 1
      move 0
      action ATROOPPSXFROZEN
      strength 0
      break
    }

    state drop_ammo
    state random_wall_jibs

    ifwasweapon GROWSPARK
    {
      cstat 0
      sound ACTOR_GROWING
      ai AITROOPPSXGROW
      break
    }

    addkills 1

    ifwasweapon RPG
    {
      sound SQUISHED2
      state troop_body_jibs
      state standard_jibs
      killit
    }
    else
      ifwasweapon RADIUSEXPLOSION
    {
      sound SQUISHED2
      state troop_body_jibs
      state standard_jibs
      killit
    }
    else
    {
      sound PRED_DYING
      ifrnd 32
        iffloordistl 32
      {
        sound LIZARD_BEG0
        spawn BLOODPOOL
        strength 0
        move 0
        action ATROOPPSXSUFFERING
        break
      }
      action ATROOPPSXDYING
      break
    }
  }
  else
  {
    state random_wall_jibs
    sound PREDPSX_PAIN

    ifwasweapon SHRINKSPARK
    {
      sound ACTOR_SHRINKING
      ai AITROOPPSXSHRUNK
    }
    else
      ifwasweapon GROWSPARK
        sound EXPANDERHIT
    ifai AITROOPPSXSHRUNK break
    else
      iffloordistl 32
        ifrnd 96
          action ATROOPFLINTCH
  }
ends

state troopjetpackstatepsx
  ifaction ATROOPPSXJETPACKILL
  {
    ifcansee
      ifactioncount 2
    {
      resetactioncount
      sound PRED_ATTACK
      shoot FIRELASER
    }

    ifp phigher
      ai AITROOPPSXJETPACK
    else
      ifinwater
        ai AITROOPPSXJETPACK
    else
      ifcount 26
        iffloordistl 32
          ai AITROOPPSXSEEKPLAYER
  }
  else
    ifcount 48
      ifcansee
  {
    action ATROOPPSXJETPACKILL
    move TROOPPSXJETPACKILLVELS
    seekplayer
  }
ends

state troopsufferingstatepsx
  ifactioncount 2
  {
    ifrnd 16
      spawn WATERDRIP
    ifactioncount 14
    {
      stopsound LIZARD_BEG0
      cstat 0
      strength 0
      action ATROOPPSXSUFFERDEAD
      break
    }
  }
ends

state troopshrunkstatepsx
  ifcount SHRUNKDONECOUNT
    ai AITROOPPSXSEEKENEMY
  else
    ifcount SHRUNKCOUNT
      sizeto 48 40
  else
    state genericshrunkcode
ends


state troopcodepsx fall
  ifinwater
    ifrnd 1
      spawn WATERBUBBLE
  ifaction ATROOPPSXSTAND
  {
    ifrnd 192
      ai AITROOPPSXSHOOTING
    else
      ai AITROOPPSXSEEKPLAYER
  }
  else
    ifaction ATROOPPSXFROZEN
  {
    ifcount THAWTIME
    {
      ai AITROOPPSXSEEKENEMY
      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
  }
  else ifaction ATROOPPSXPLAYDEAD
  {
    ifhitweapon
    {
      ifwasweapon RADIUSEXPLOSION
      {
        sound SQUISHED2
        state troop_body_jibs
        state standard_jibs
        killit
      }
      break
    }
    else
      state checkpsxsquished

    ifcount PLAYDEADTIME
    {
      addkills -1
      soundonce PRED_ROAM
      cstat 257
      strength 1
      ai AITROOPPSXSHOOTING
    }
    else
      ifp pfacing
        resetcount

    break
  }
  else
    ifaction ATROOPPSXDEAD
  {
    strength 0
    ifrespawn
      ifcount RESPAWNACTORTIME
    {
      spawn TRANSPORTERSTAR
      cstat 257
      strength TROOPSTRENGTH
      ai AITROOPPSXSEEKENEMY
    }
    ifhitweapon
    {
      ifwasweapon RADIUSEXPLOSION
      {
        sound SQUISHED2
        state troop_body_jibs
        state standard_jibs
        killit
      }
      break
    }
    else
      state checkpsxsquished
    break
  }
  else
    ifaction ATROOPPSXSUFFERDEAD
  {
    ifactioncount 2
    {
      ifrnd 64
      {
        resetcount
        action ATROOPPSXPLAYDEAD
      }
      else
      {
        soundonce PRED_DYING
        action ATROOPPSXDEAD
      }
    }
  }
  else
    ifaction ATROOPPSXDYING
  {
    state troopdyingpsx
    break
  }
  else
    ifaction ATROOPPSXSUFFERING
  {
    state troopsufferingstatepsx
    ifhitweapon
      state checkpsxsquished
    break
  }
  else
    ifaction ATROOPFLINTCH
  {
    ifactioncount 4
      ai AITROOPPSXSEEKENEMY
  }
  else
  {
    ifai AITROOPPSXSEEKPLAYER
      state troopseekstatepsx
    else
      ifai AITROOPPSXJETPACK
    {
      state troopjetpackstatepsx
      ifinwater nullop
      else
        soundonce DUKE_JETPACK_IDLE
    }
    else
      ifai AITROOPPSXSEEKENEMY
        state troopseekstatepsx
    else
      ifai AITROOPPSXSHOOTING
        state troopshootstatepsx
    else
      ifai AITROOPPSXFLEEING
        state troopfleestatepsx
    else
      ifai AITROOPPSXFLEEINGBACK
        state troopfleestatepsx
    else
      ifai AITROOPPSXDODGE
        state troopseekstatepsx
    else
      ifai AITROOPPSXDUCKING
        state troopduckstatepsx
    else
      ifai AITROOPPSXSHRUNK
        state troopshrunkstatepsx
    else
      ifai AITROOPPSXGROW
        state psxgrowstate
    else
      ifai AITROOPPSXHIDE
    {
      state troophidestatepsx
      break
    }
  }

  ifhitweapon
    state checktroophitpsx
  else
    state checkpsxsquished
ends

state checktrooppalettepsx
  ifai 0
  {
    clipdist 32
    cstat 257
    sizeat 40 40
    ifspritepal 0
        nullop
    else
        ifspritepal 21
          addstrength TROOPSTRENGTH
  }
ends

useractor enemy LIZTROOPPSXJETPACK TROOPSTRENGTH
  state checktrooppalettepsx
  ai AITROOPPSXJETPACK
  cactor LIZTROOPPSX
enda

useractor enemy LIZTROOPPSXDUCKING TROOPSTRENGTH
  state checktrooppalettepsx
  ai AITROOPPSXDUCKING
  cactor LIZTROOPPSX
  ifgapzl 48
    move PSXDONTGETUP
enda

useractor enemy LIZTROOPPSXSHOOT TROOPSTRENGTH ATROOPPSXSTAND
  state checktrooppalettepsx
  ai AITROOPPSXSHOOTING
  cactor LIZTROOPPSX
enda

useractor enemystayput LIZTROOPPSXSTAYPUT TROOPSTRENGTH ATROOPPSXSTAYSTAND
  state checktrooppalettepsx
  ai AITROOPPSXSEEKPLAYER
  cactor LIZTROOPPSX
enda

useractor enemy LIZTROOPPSXRUNNING TROOPSTRENGTH ATROOPPSXSTAND
  state checktrooppalettepsx
  ai AITROOPPSXSEEKPLAYER
  cactor LIZTROOPPSX
enda

useractor enemy LIZTROOPPSXONTOILET TROOPSTRENGTH
  ifcount 24
  {
    sound FLUSH_TOILET
    operate
    ai AITROOPPSXSEEKPLAYER
    cactor LIZTROOPPSX
  }
  else
    ifcount 2
      nullop
  else
    state checktrooppalettepsx
enda

useractor enemy LIZTROOPPSXJUSTSIT TROOPSTRENGTH
  ifcount 30
  {
    operate
    ai AITROOPPSXSEEKPLAYER
    cactor LIZTROOPPSX
  }
  else
    ifcount 2
      nullop
  else
    state checktrooppalettepsx
enda

useractor enemy LIZTROOPPSX TROOPSTRENGTH ATROOPPSXSTAND
  state checktrooppalettepsx
  state troopcodepsx
enda

useractor enemy LIZTROOPPSXDEADSPRITE
  state checkpsxsquished
  cstat 0
  ifhitweapon
  {
  ifwasweapon RADIUSEXPLOSION sound SQUISHED2
    state troop_body_jibs
    state standard_jibs
    killit
  }
enda

appendevent EVENT_LOADACTOR
  ifactor LIZTROOPPSX
  {
    sizeat 40 40
  }
  ifactor LIZTROOPPSXRUNNING
  {
    sizeat 40 40
  }
  ifactor LIZTROOPPSXSTAYPUT
  {
    sizeat 40 40
  }
  ifactor LIZTROOPPSXSHOOT
  {
    sizeat 40 40
  }
  ifactor LIZTROOPPSXJETPACK
  {
    sizeat 40 40
  }
  ifactor LIZTROOPPSXONTOILET
  {
    sizeat 40 40
  }
  ifactor LIZTROOPPSXJUSTSIT
  {
    sizeat 40 40
  }
  ifactor LIZTROOPPSXDUCKING
  {
    sizeat 40 40
  }
  ifactor LIZTROOPPSXDEADSPRITE // enemy corpse
  {
    sizeat 40 40
  }
endevent

appendevent EVENT_SOUND
ife RETURN SQUISHED
{
  ife sprite[].picnum LIZTROOPPSX
  set RETURN SQUISHED2
}
endevent

appendevent EVENT_RECOGSOUND
  ifactor LIZTROOPPSX
  {
    set RETURN -1
    sound PRED_RECOG
  }
  ifactor LIZTROOPPSXRUNNING
  {
    set RETURN -1
    sound PRED_RECOG
  }
  ifactor LIZTROOPPSXSHOOT
  {
    set RETURN -1
    sound PRED_RECOG
  }
  ifactor LIZTROOPPSXJETPACK
  {
    set RETURN -1
    sound PRED_RECOG
  }
  ifactor LIZTROOPPSXONTOILET
  {
    set RETURN -1
    sound PRED_RECOG
  }
  ifactor LIZTROOPPSXJUSTSIT
  {
    set RETURN -1
    sound PRED_RECOG
  }
  ifactor LIZTROOPPSXDUCKING
  {
    set RETURN -1
    sound PRED_RECOG
  }
endevent


Totals of unsettled codes

01. BOSS and "ifspritepal 3" for the first move action.
02. BLOODPOOL resize for the all BOSS and shrinker.
03. Deleted AMMO for the monsters shrunked.
04. SQUISHED sound problem for all monsters for the PSX version.

This post has been edited by Firefly_Trooper: 14 November 2018 - 09:49 AM

0

User is online   Jimmy 4k 

  • Duke4 Thot Patrol
  • 4,163

#4

View PostFirefly_Trooper, on 14 November 2018 - 04:32 AM, said:

I tested and placed the code in the file, and it did not work. My question was this:

state checkboss2seekstate
  ai AIBOSS2SEEKENEMY
  ifspritepal 0 nullop
  else   // a fake way of doing a ifspritepal NOT.
  ifspritepal 3 nullop
  else
  ifspritepal 22 nullop
    else
    move PALBOSS2RUNVELS seekplayer
ends


Do I have to put the same code each time there is "pal 0" and "pal 22" ?

Okay, I'm going to explain some basic coding philosophy that really helped me when it was explained to me this way. I was once intimidated by coding because I believed it to be largely mathematical, and I'm terrible with math. While mathematics are a large component of programming what it really is is language and it's crucial you think of it this way because that's how it actually functions. When you're programming what you're really doing is speaking to a computer in it's own language. So if your language is poor your outcome is equally as poor, because the computer isn't like a person. It won't "basically understand" what you're "trying to say" and adjust it's response because you're not "speaking" it's language well. You have to be very precise because it's going to either spit out exactly what you tell it to, or if your "language" is really bad then crazy, strange or catastrophic events will occur. If the computer interprets nothing but gibberish, you'll probably get a crash. An equal output for the input.

Okay so what I'm going to do is "translate" portions of your code into English and I want you to tell me why setting pal to 3 doesn't do anything.

state checkboss2seekstate
  ai AIBOSS2SEEKENEMY
  if the sprite's palette is set to 0 DO NOTHING
  else
  if the sprite's palette is set to 3 DO NOTHING
  else
  if the sprite's palette is set to 22 DO NOTHING
    else (if the sprite's palette is set to LITERALLY ANY OTHER NUMBER)
    move PALBOSS2RUNVELS seekplayer
ends


Posted Image

This post has been edited by Jimmy 4k: 14 November 2018 - 10:07 AM

0

User is offline   Firefly_Trooper 

  • 12

#5

Should the nullop value of "pal 3" be removed?
0

User is online   Jimmy 4k 

  • Duke4 Thot Patrol
  • 4,163

#6

You tell me.

Posted Image
0

User is offline   Firefly_Trooper 

  • 12

#7

Frankly I do not know. All I wish is to be able to advance to the player a mini-boss. The "pal 0" with a lotag of "3" in one sector, the action works. To do the same thing with a mini-boss? I do not know.
0

User is offline   Firefly_Trooper 

  • 12

#8

I think the code is misplaced.
0

User is online   Jimmy 4k 

  • Duke4 Thot Patrol
  • 4,163

#9

I'm not going to write your code for you or give you the answer because you'll never learn otherwise. Study my post and the code and try to understand what the code actually says. The problem is very simple. If you want a miniboss with sprite pal 3 to do something, then you need to actually tell it to do something. Right now your code is actually working 100% as written, but because you don't understand the code you've written it's not doing what you're intending.

Posted Image
0

User is offline   Firefly_Trooper 

  • 12

#10

I must surely add an "ai" like for example "ai AIBOSS2SEEKENEMY"

A small question. Do I place the value "spritepal 3" several times as I did?

This post has been edited by Firefly_Trooper: 14 November 2018 - 03:53 PM

0

User is offline   Mark 

  • Honored Donor
  • 2,717

#11

comment out (one at a time) each spritepal 3 and run a test to see what happens.
0

User is offline   Firefly_Trooper 

  • 12

#12

I have carefully read your comments and I think I know the problem. I will test the code again in several fragments.
0

User is offline   Firefly_Trooper 

  • 12

#13

I managed to move the BOSS2 in first action. However ! I still have a construction code problem.

ifai 0
  {
    ifspritepal 0
      ai AIBOSS2RUNENEMY
    else
    {
      ifspritepal 3 nullop
    else
        strength 1000
      ai AIBOSS2RUNENEMY
      clipdist 16

      ifspritepal 22 nullop
    else
        strength 1000
      ai AIBOSS2SHOOTENEMY
      clipdist 16
    }
  }


I can not keep both "spritepal" actions 3 and 22 at the same time. I do not know how to correctly build the line of code because I tried a lot of method but nothing worked.

This post has been edited by Firefly_Trooper: 16 November 2018 - 12:30 PM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,252

#14

Learn how to use braces and learn what the break command does.
0

User is offline   Firefly_Trooper 

  • 12

#15

I have already tried the values "break" it does not matter.

ifai 0
  {
    ifspritepal 0
      ai AIBOSS2RUNENEMY
    else
    {
      ifspritepal 3 nullop
    else
        strength 1000
      ai AIBOSS2RUNENEMY
      clipdist 16
    }
    break
    {
      ifspritepal 22 nullop
    else
        strength 1000
      ai AIBOSS2SHOOTENEMY
      clipdist 16
    }
    break
  }

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,252

#16

It doesn't matter that you are stopping code execution before it checks for pal 22?

You need to learn how to use braces and learn what the break command does.
1

User is online   Jimmy 4k 

  • Duke4 Thot Patrol
  • 4,163

#17

You're guessing how to write code, and that's the problem. You don't understand the commands and how they should be used. What you want to do is incredibly simple, but you need to learn what the commands mean first.

Posted Image
0

User is offline   Firefly_Trooper 

  • 12

#18

Of course with critical remarks, I will surely move forward and understand very quickly. I see only one thing on this forum. Sometimes you are not always sensitive when you answer. I feel like an idiot, rather than an apprentice coder who wants to make an effort. I am not targeting anyone here. I just feel like you're a bit "tough" and maybe not humble enough?

To return to this code "incredibly simple" but it is not at all for me. Even looking at the wiki more often, I am sometimes overwhelmed.

I'm going (again), review this code.
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,252

#19

Tough but fair. I would say, if you aren't making the effort to learn what the commands mean and how to use them (through the wiki and hundreds of examples which can be found in any CON code) then you aren't really respecting the time of those who are trying to help you.
1

User is offline   Firefly_Trooper 

  • 12

#20

So far, I have already made a lot of progress in my project and I have also managed to create my codes. I have already done a lot of effort. It's just that at times, some codes are "ABSOLUTELY NOT" obvious.

Despite my failures, I want to continue coding. I will return to this passage of BOSS2.
0

User is offline   Firefly_Trooper 

  • 12

#21

I still can not, and it's really boring to spend hours on such a "simple" thing.
0

User is offline   Firefly_Trooper 

  • 12

#22

ifai 0
  {
    ifspritepal 0
      ai AIBOSS2RUNENEMY
    else
    {
      ifspritepal 3 nullop
    else
        strength BOSS2PALSTRENGTH
      ai AIBOSS2RUNENEMY
      clipdist 16
    }
    {
      ifspritepal 22 nullop
    else
        strength BOSS2PALSTRENGTH
      ai AIBOSS2SHOOTENEMY
      clipdist 16
    }
  }


My last attempt, of course, does not work. I swear to you that I do not deliberately do not understand. I have absolutely no clue or concrete example for the two "spritepal" values to work.
0

User is offline   Mblackwell 

  • Evil Overlord
  • 847

#23

Think of it as a simple chain of logic, line by line. What you wrote is:

"If the sprite's palette is 0, use the normal ai routine, otherwise let's move on. Now we've checked the sprite's palette to see if it was number 3, and it was not so we will apply this new strength value. Now let's start this new ai routine we have here and change the clipping distance of this sprite. Okay, so now we will check this sprite's palette again to see if it was 22, and it was so we'll do nothing. Now let's apply the same ai routine we already applied, and we'll also set the sprite's clipping distance to 16 again."

To group statements together so they apply to the same if or else you use { }

You can use "else if" statements to make sure to check another case before moving on completely with "else".

Music: The Rejected Applications (listen now)
EDuke32 || EDuke32 Wiki || Latest EDuke32 Snapshots
I'm getting too old for this shit...
1

User is online   Jimmy 4k 

  • Duke4 Thot Patrol
  • 4,163

#24

I'm being tough because this is foundational. If you don't understand what the problem is here you will run into this very same problem over and over again. This is a critical learning point for you.

Posted Image
1

User is online   Commando Nukem 

  • Judge Mental
  • 2,377

#25

Coding is like any other language. You have to learn it. You can't guess your way through a conversation in another language.

OPEN MAW PRODUCTIONS
Facebook Youtube and Twitter
0

User is offline   Firefly_Trooper 

  • 12

#26

I agree, of course ! The only thing I ask is to be more forgiving and less brutal. In short, let's move on to something else.
Surely the "ai" with the "spritepal" must be in "ifai"

This post has been edited by Firefly_Trooper: 17 November 2018 - 11:12 AM

0

User is offline   Firefly_Trooper 

  • 12

#27

The famous code of "spritepal" that has not been solved, even reading the wiki, I always feel overwhelmed.

While waiting to finally have an answer to this problem, I took care of another code still related to the BOSS.

I made a code with "onevent" to enlarge the BLOODPOOL in a progressive way.

onevent EVENT_SPAWN // big bloodpool for BOSS2
  switch sprite[THISACTOR].picnum
  case BLOODPOOL
  ifspawnedby BOSS2
  sizeat 60 60
  break
  endswitch
endevent


It works well, except that the sprite "BLOODPOOL" appears brutally, without progressive animation frame. I wanted to replace "sizeat" with "sizeto" and it did not work. I also tried this:

onevent EVENT_SPAWN // big bloodpool for BOSS2
  switch sprite[THISACTOR].picnum
  case BLOODPOOL
  ifspawnedby BOSS2
  setactor[THISACTOR].xrepeat 60
  setactor[THISACTOR].yrepeat 60
  break
  endswitch
endevent


Result, nothing!

How can we show some sprites in a progressive way? Thanks you for your answers.
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,252

#28

The sizeto command changes size incrementally each time it is executed. EVENT_SPAWN only executes once, when a sprite spawns, so using sizeto there is useless.
1

User is offline   Firefly_Trooper 

  • 12

#29

onevent EVENT_GAME // big bloodpool for BOSS1
  switch sprite[THISACTOR].picnum
  case BLOODPOOL
  ifspawnedby BOSS1
  sizeto 60 60
  break
  endswitch
endevent


I changed "onevent" and it works better. Thanks ! Now, I will make sure to remove the appearance of items, when a monster is shrunk.
1

User is offline   Firefly_Trooper 

  • 12

#30

Last question about BLOODPOOL sprite. When I use this same code for shrunken monsters, the sprite BLOODPOOL bug a bit when Duke walks on it. It is as if the puddle continues to be diminished when it is already small. Is there a value that blocks the size action of a sprite ?
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