Duke4.net Forums: Walls problem ! (for monsters) - 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!

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Walls problem ! (for monsters)  "Moving blocked from a sprite, by lines or corridors."

User is offline   Firefly_Trooper 

  • 41

#1

Hello ! I open a new topic, because the old one I created is not too topical. I have already worked a lot on my codings.

However, I have an unsolved problem with the new monsters I added in the original game (useful for new cards even more fun).

In the original game, monsters pass smoothly through narrow passages like hallways and even different areas (from one room to another). Here, my monsters can not do all that. instead, I find myself with monsters that are blocked by walls and can not just go into those narrow passages. I do not know if it's a problem related to these values:

cstat
clipdist
ifawayfromwall
ifnotmoving

If someone has an idea. Thank you !
0

User is online   Mark 

  • Honored Donor
  • 2,864

#2

Can you post a screenshot in 2D mode of the hallways that the monsters get stuck in? Or tell us how many build units wide they are.

Clipdist is for models and not 2D sprites IIRC so it wouldn't be that.

This post has been edited by Mark: 11 September 2018 - 04:50 PM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,758

#3

View PostMark, on 11 September 2018 - 04:45 PM, said:

Clipdist is for models and not 2D sprites IIRC so it wouldn't be that.


clipdist sets clipping distance, period. Models simply inherit their clipping from their sprites. Setting a small clipdist, such as clipdist 32, would be worth trying.
0

User is online   Mark 

  • Honored Donor
  • 2,864

#4

I guess once again I misunderstood the wiki which says:

"The clipdist is only used for sprites that are not flat. If it is flat, the game would use the sprite's dimensions as its clipping boundaries."

Not flat I assumed meant models. I guess not.

This post has been edited by Mark: 11 September 2018 - 05:01 PM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,758

#5

Flat means either floor aligned or wall aligned.
0

User is offline   Firefly_Trooper 

  • 41

#6

I myself denoted the grid in Mapster32 like this: grid size 3 (256 units). Unless it is also the size of the sprite that must be in 40 40.

So will it take a clipdist if I understand correctly?
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,758

#7

https://wiki.eduke32.com/wiki/Clipdist

The wiki implies that custom actors start with a clipdist of 32, which is pretty small already. I don't know if custom enemies start with a higher number, though. Thee's a good chance that changing it won't help. If you want to post your actor code in this thread, someone might be able to make a helpful suggestion.
0

User is offline   Firefly_Trooper 

  • 41

#8

Okay ! Here is an example of a monster:

https://www.sendspace.com/file/drp6i4
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,758

#9

I meant pasting the code into the forum using code tags. It's too much trouble if I have to download it and open it up in an editor -- for one thing it makes it hard to quote.
0

User is offline   Firefly_Trooper 

  • 41

#10


define LIZTROOPCARI 6530

define LIZTROOPCARIRUNNING 6531
define LIZTROOPCARISTAYPUT 6532
define LIZTROOPCARISHOOT 6565
define LIZTROOPCARIJETPACK 6575
define LIZTROOPCARIDSPRITE 6584
define LIZTROOPCARIONTOILET 6591
define LIZTROOPCARIJUSTSIT 6592
define LIZTROOPCARIDUCKING 6594

action ATROOPCARISTAND 0  1  5  1  1
action ATROOPCARIGROW 0  1  5  1  1
action ATROOPCARISTAYSTAND -2  1  5  1  1
action ATROOPCARIWALKING 0  4  5  1   12
action ATROOPCARIWALKINGBACK 15   4  5   -1   12
action ATROOPCARIRUNNING 0  4  5  1  8
action ATROOPCARISHOOT 35  1  5  1   30
action ATROOPCARIJETPACK 40  1  5  1  1
action ATROOPCARIJETPACKILL 40  2  5  1   50
action ATROOPCARICFLINTCH 50  1  1  1  6
action ATROOPCARIDYING 50  5  1  1   16
action ATROOPCARIDEAD 54
action ATROOPCARIPLAYDEAD 54
action ATROOPCARISUFFERDEAD 58  2  1   -4   24
action ATROOPCARISUFFERING 59  2  1  1   21
action ATROOPCARIDUCK 64  1  5  1  3
action ATROOPCARIDUCKSHOOT 64  2  5  1   25
action ATROOPCARIABOUTHIDE 74  1  1  1   25
action ATROOPCARIHIDE 79  1  1  1   25
action ATROOPCARIREAPPEAR 74  1  1  1   25
action ATROOPCARIFROZEN 0  1  5

move TROOPCARIWALKVELS 72
move TROOPCARIWALKVELSBACK -72
move TROOPCARIJETPACKVELS 64 -84
move TROOPCARIJETPACKILLVELS 192 -38
move TROOPCARIRUNVELS 108
move TROOPCARISTOPPED
move CARIDONTGETUP
move CARISHRUNKVELS 32

ai AITROOPCARISEEKENEMY  ATROOPCARIWALKING   TROOPCARIWALKVELS seekplayer
ai AITROOPCARISEEKPLAYER ATROOPCARIWALKING   TROOPCARIWALKVELS seekplayer
ai AITROOPCARIFLEEING  ATROOPCARIWALKING   TROOPCARIWALKVELS fleeenemy
ai AITROOPCARIFLEEINGBACK ATROOPCARIWALKINGBACK   TROOPCARIWALKVELSBACK faceplayer
ai AITROOPCARIDODGE    ATROOPCARIWALKING   TROOPCARIRUNVELS  dodgebullet
ai AITROOPCARISHOOTING   ATROOPCARISHOOT   TROOPCARISTOPPED  faceplayer
ai AITROOPCARIDUCKING  ATROOPCARIDUCK    TROOPCARISTOPPED  faceplayer
ai AITROOPCARIJETPACK  ATROOPCARIJETPACK   TROOPCARIJETPACKVELS seekplayer
ai AITROOPCARISHRUNK   ATROOPCARIWALKING   CARISHRUNKVELS fleeenemy
ai AITROOPCARIHIDE     ATROOPCARIABOUTHIDE TROOPCARISTOPPED faceplayer
ai AITROOPCARIGROW     ATROOPCARIGROW    CARIDONTGETUP faceplayerslow

state troophidestatecari
  ifaction ATROOPCARIREAPPEAR
  {
    ifactioncount 2
    {
      sound TELEPORTER
      ai AITROOPCARISHOOTING
      cstat 257
    }
    else
    {
      sizeto 41 40
      sizeto 41 40
      sizeto 41 40
      sizeto 41 40
      spawn FRAMEEFFECT1
    }
  }
  else
    ifaction ATROOPCARIWALKING
  {
    ifpdistl 2448
      ifpdistg 1024
    {
      ifceilingdistl 48
        break
      ifp pfacing
        break

      ifgapzl 64 nullop
      else
        ifawayfromwall
      {
        spawn TRANSPORTERSTAR
        action ATROOPCARIREAPPEAR
        move 0
        break
      }
    }
  }
  else
    ifaction ATROOPCARIHIDE
  {
    ifactioncount 2
    {
      spawn TRANSPORTERSTAR
      sound TELEPORTER
      action ATROOPCARIWALKING
      move TROOPCARIWALKVELS faceplayer
      cstat 32768
    }
    else
    {
      sizeto 4 40
      sizeto 4 40
      sizeto 4 40
      sizeto 4 40
      spawn FRAMEEFFECT1
    }
  }
  else
    ifaction ATROOPCARIABOUTHIDE
      ifactioncount 2
    {
      action ATROOPCARIHIDE
      cstat 0
    }
ends


state troopgunnashootcari
  ifp palive
  {
    ifpdistl 1024
      ai AITROOPCARISHOOTING
    else
      ifactornotstayput
    {
      ifactioncount 12
        ifrnd 16
          ifcanshoottarget
      {
        ifspritepal 21
          ifrnd 4
            ifpdistg 4096
              ai AITROOPCARIHIDE
        else
        {
          ifpdistl 1100
            ai AITROOPCARIFLEEING
          else
          {
            ifpdistl 4096
              ifcansee
                ifcanshoottarget
                  ai AITROOPCARISHOOTING
            else
            {
              move TROOPCARIRUNVELS seekplayer
              action ATROOPCARIRUNNING
            }
          }
        }
      }
    }
    else
      ifcount 26
        ifrnd 32
          ai AITROOPCARISHOOTING
  }
ends

state troopseekstatecari
  state troopgunnashootcari
  ifinwater
  {
    ai AITROOPCARIJETPACK
    break
  }
  ifcansee
  {
    ifmove TROOPCARIRUNVELS
      ifpdistl 1596
        ai AITROOPCARIDUCKING
    ifp phigher
    {
      ifceilingdistl 128 nullop
      else
        ifactornotstayput
          ai AITROOPCARIJETPACK
      break
    }
    else
      ifrnd 2
    {
      ifspritepal 21
        ifpdistg 1596
      {
        ai AITROOPCARIHIDE
        break
      }
      ifbulletnear
      {
        ifrnd 128
          ai AITROOPCARIDODGE
        else
          ai AITROOPCARIDUCKING
        break
      }
    }
  }
  ifnotmoving
  {
    ifrnd 32
      operate
    else
      ifcount 32
        ifp palive
          ifcansee
            ifcanshoottarget
              ai AITROOPCARISHOOTING
  }
  ifrnd 1
  {
    ifrnd 128
      soundonce PRED_ROAM
    else
      soundonce PRED_ROAM2
  }
ends

state troopduckstatecari
  ifaction ATROOPCARIDUCK
  {
    ifactioncount 8
    {
      ifp palive
      {
        ifrnd 128
          action ATROOPCARIDUCKSHOOT
      }
      else
        ifmove CARIDONTGETUP
          break
        else
          ai AITROOPCARISEEKPLAYER
    }
  }
  else
    ifaction ATROOPCARIDUCKSHOOT
  {
    ifcount 64
    {
      ifmove CARIDONTGETUP
        resetcount
      else
      {
        ifpdistl 1100
          ai AITROOPCARIFLEEING
        else
          ai AITROOPCARISEEKPLAYER
      }
    }
    else
      ifactioncount 2
      {
        ifcanshoottarget
        {
          sound PRED_ATTACK
          resetactioncount
          shoot FIRELASER
        }
        else ai AITROOPCARISEEKPLAYER
      }
  }
ends

state troopshootstatecari
  ifactioncount 2
  {
    ifcanshoottarget
    {
      shoot FIRELASER
      sound PRED_ATTACK
      resetactioncount
      ifrnd 128
        ai AITROOPCARISEEKPLAYER
      ifcount 24
      {
        ifrnd 96
          ifpdistg 2048
            ai AITROOPCARISEEKPLAYER
          else
          {
            ifpdistg 1596
              ai AITROOPCARIFLEEING
            else
              ai AITROOPCARIFLEEINGBACK
          }
      }
    }
    else
      ai AITROOPCARISEEKPLAYER
  }
ends

state troopfleestatecari
  ifactioncount 7
  {
    ifpdistg 3084
    {
      ai AITROOPCARISEEKPLAYER
      break
    }
    else
      ifrnd 32
        ifp palive
          ifcansee
            ifcanshoottarget
      {
        ifrnd 128
          ai AITROOPCARIDUCKING
        else
          ai AITROOPCARISHOOTING
          break
      }
  }
  ifnotmoving
  {
    ifrnd 32
      operate
    else
      ifcount 32
        ifp palive
          ifcansee
            ifcanshoottarget
      {
        ifrnd 128
          ai AITROOPCARISHOOTING
        else
          ai AITROOPCARIDUCKING
      }
  }
ends

state troopdyingcari
  iffloordistl 32
  {
    ifactioncount 5
    {
      cstat 0
      iffloordistl 8
      sound THUD
      ifrnd 64
        spawn BLOODPOOL
      state rf
      strength 0
      move TROOPCARISTOPPED
      action ATROOPCARIDEAD
    }
    break
  }
  else
  {
    state rf
    move 0
    action ATROOPCARIDYING
  }
ends

state checktroophitcari
  ifaction ATROOPCARISUFFERING
  {
    stopsound LIZARD_BEG
    sound PRED_DYING
    cstat 0
    strength 0
    action ATROOPCARISUFFERDEAD
    break
  }
  ifdead
  {
    ifwasweapon FREEZEBLAST
    {
      cstat 257
      sound SOMETHINGFROZE
      spritepal 1
      move 0
      action ATROOPCARIFROZEN
      strength 0
      break
    }

    state drop_ammo
    state random_wall_jibs

    ifwasweapon GROWSPARK
    {
      cstat 257
      sound ACTOR_GROWING
      ai AITROOPCARIGROW
      break
    }

    addkills 1
    
    ifwasweapon RPG
    {
      sound SQUISHED
      state troop_body_jibs
      state standard_jibs
      killit
    }
    else
      ifwasweapon RADIUSEXPLOSION
    {
      sound SQUISHED
      state troop_body_jibs
      state standard_jibs
      killit
    }
    else
    {
      sound PRED_DYING
      ifrnd 32
        iffloordistl 32
      {
        sound LIZARD_BEG
        spawn BLOODPOOL
        strength 0
        move 0
        action ATROOPCARISUFFERING
        break
      }
      action ATROOPCARIDYING
      break
    }
  }
  else
  {
    state random_wall_jibs
    sound PRED_PAIN

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

state troopjetpackstatecari
  ifaction ATROOPCARIJETPACKILL
  {
    ifcansee
      ifactioncount 2
    {
      resetactioncount
      sound PRED_ATTACK
      shoot FIRELASER
    }

    ifp phigher
      ai AITROOPCARIJETPACK
    else
      ifinwater
        ai AITROOPCARIJETPACK
    else
      ifcount 26
        iffloordistl 32
          ai AITROOPCARISEEKPLAYER
  }
  else
    ifcount 48
      ifcansee
  {
    action ATROOPCARIJETPACKILL
    move TROOPCARIJETPACKILLVELS
    seekplayer
  }
ends

state checksquished
  ifsquished
  {
    addkills 1
    sound SQUISHED
    state standard_jibs
    state random_ooz
    killit
  }
ends

state troopsufferingstatecari
  ifactioncount 2
  {
    ifrnd 16
      spawn WATERDRIP
    ifactioncount 14
    {
      stopsound LIZARD_BEG
      cstat 0
      strength 0
      action ATROOPCARISUFFERDEAD
      break
    }
  }
ends

state troopshrunkstatecari
  ifcount SHRUNKDONECOUNT
    ai AITROOPCARISEEKENEMY
  else
    ifcount SHRUNKCOUNT
      sizeto 48 40
  else
    state genericshrunkcode
ends


state troopcodecari fall
  ifinwater
    ifrnd 1
      spawn WATERBUBBLE
  ifaction ATROOPCARISTAND
  {
    ifrnd 192
      ai AITROOPCARISHOOTING
    else
      ai AITROOPCARISEEKPLAYER
  }
  else
    ifaction ATROOPCARIFROZEN
  {
    ifcount THAWTIME
    {
      ai AITROOPCARISEEKENEMY
      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 ATROOPCARIPLAYDEAD
  {
    ifhitweapon
    {
      ifwasweapon RADIUSEXPLOSION
      {
        sound SQUISHED
        state troop_body_jibs
        state standard_jibs
        killit
      }
      break
    }
    else
      state checksquished

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

    break
  }
  else
    ifaction ATROOPCARIDEAD
  {
    strength 0
    ifrespawn
      ifcount RESPAWNACTORTIME
    {
      spawn TRANSPORTERSTAR
      cstat 257
      strength TROOPSTRENGTH
      ai AITROOPCARISEEKENEMY
    }
    ifhitweapon
    {
      ifwasweapon RADIUSEXPLOSION
      {
        sound SQUISHED
        state troop_body_jibs
        state standard_jibs
        killit
      }
      break
    }
    else
      state checksquished
    break
  }
  else
    ifaction ATROOPCARISUFFERDEAD
  {
    ifactioncount 2
    {
      ifrnd 64
      {
        resetcount
        action ATROOPCARIPLAYDEAD
      }
      else
      {
        soundonce PRED_DYING
        action ATROOPCARIDEAD
      }
    }
  }
  else
    ifaction ATROOPCARIDYING
  {
    state troopdyingcari
    break
  }
  else
    ifaction ATROOPCARISUFFERING
  {
    state troopsufferingstatecari
    ifhitweapon
      state checktroophitcari
    break
  }
  else
    ifaction ATROOPFLINTCH
  {
    ifactioncount 4
      ai AITROOPCARISEEKENEMY
  }
  else
  {
    ifai AITROOPCARISEEKPLAYER
      state troopseekstatecari
    else
      ifai AITROOPCARIJETPACK
    {
      state troopjetpackstatecari
      ifinwater nullop
      else
        soundonce DUKE_JETPACK_IDLE
    }
    else
      ifai AITROOPCARISEEKENEMY
        state troopseekstatecari
    else
      ifai AITROOPCARISHOOTING
        state troopshootstatecari
    else
      ifai AITROOPCARIFLEEING
        state troopfleestatecari
    else
      ifai AITROOPCARIFLEEINGBACK
        state troopfleestatecari
    else
      ifai AITROOPCARIDODGE
        state troopseekstatecari
    else
      ifai AITROOPCARIDUCKING
        state troopduckstatecari
    else
      ifai AITROOPCARISHRUNK
        state troopshrunkstatecari
    else
      ifai AITROOPCARIGROW
        state genericgrowcode
    else
      ifai AITROOPCARIHIDE
    {
      state troophidestatecari
      break
    }
  }

  ifhitweapon
    state checktroophitcari
  else
    state checksquished
ends

state checktrooppalettecari
  ifai 0
  {
  ife sprite[].htactorstayput -1
    sound PRED_RECOG
    cstat 257
    sizeat 41 40
    ifspritepal 0
        nullop
    else
        ifspritepal 21
          addstrength TROOPSTRENGTH
  }
ends

appendevent EVENT_RECOGSOUND
  ifactor LIZTROOPCARI
  {
    set RETURN -1
    sound PRED_RECOG
  }
endevent

useractor enemy LIZTROOPCARIJETPACK TROOPSTRENGTH
  state checktrooppalettecari
  ai AITROOPCARIJETPACK
  cactor LIZTROOPCARI
enda

useractor enemy LIZTROOPCARIDUCKING TROOPSTRENGTH
  state checktrooppalettecari
  ai AITROOPCARIDUCKING
  cactor LIZTROOPCARI
  ifgapzl 48
    move CARIDONTGETUP
enda

useractor enemy LIZTROOPCARISHOOT TROOPSTRENGTH ATROOPCARISTAND
  state checktrooppalettecari
  ai AITROOPCARISHOOTING
  cactor LIZTROOPCARI
enda
useractor enemystayput LIZTROOPCARISTAYPUT TROOPSTRENGTH ATROOPCARISTAYSTAND
  state checktrooppalettecari
  ai AITROOPCARISEEKPLAYER
  cactor LIZTROOPCARI
enda
useractor enemy LIZTROOPCARIRUNNING TROOPSTRENGTH ATROOPCARISTAND
  state checktrooppalettecari
  ai AITROOPCARISEEKPLAYER
  cactor LIZTROOPCARI
enda
useractor enemy LIZTROOPCARIONTOILET TROOPSTRENGTH
  ifcount 24
  {
    sound FLUSH_TOILET
    operate
    ai AITROOPCARISEEKPLAYER
    cactor LIZTROOPCARI
  }
  else
    ifcount 2
      nullop
  else
    state checktrooppalettecari
enda

useractor enemy LIZTROOPCARIJUSTSIT TROOPSTRENGTH
  ifcount 30
  {
    operate
    ai AITROOPCARISEEKPLAYER
    cactor LIZTROOPCARI
  }
  else
    ifcount 2
      nullop
  else
    state checktrooppalettecari
enda


useractor enemy LIZTROOPCARI TROOPSTRENGTH ATROOPCARISTAND
  ife sprite[].htextra -1
  state checktrooppalettecari
  state troopcodecari
enda

0

User is offline   Firefly_Trooper 

  • 41

#11

Sorry to have to put everything. With a mobile phone it's complicated.

This post has been edited by leninjableu: 12 September 2018 - 02:19 AM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,758

#12

What are the pixel dimensions of this tile?

define LIZTROOPCARI 6530


Your actor is almost entirely a copy-paste of LIZTROOP with a few differences. I notice that you removed the jetpack check in the ifnotmoving block during the seek state. That could be a problem because it removes the only way that the actor has of getting unstuck when the player is not in line of sight to it. I don't know if that's the main problem, though.
0

User is offline   Firefly_Trooper 

  • 41

#13

I'll see pixel dimensions in an hour.
It's not a good idea to copy and paste? This avoids re-typing the codes. I totally ignored the ifnotmoving value in the AILIZTROOPCARIJETPACK state. I will add that. If it is, it is the solution with the clipdist to add.
0

User is offline   Firefly_Trooper 

  • 41

#14

Here are the dimensions:

55 x 78, xoffset 1 yoffset -3

40 x 40 (sizeat CON file)

This post has been edited by leninjableu: 12 September 2018 - 06:13 AM

0

User is offline   Firefly_Trooper 

  • 41

#15

I added clipdist 32 and it was the simplest solution. Obviously, I did not really look for the problem. The monsters are operational.

On the other hand for the ifnotmoving, or do I have to add it to have no problem? Thank you !
0

User is offline   Firefly_Trooper 

  • 41

#16

This thread must be closed
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked


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