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

Jump to content

  • 17 Pages +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

CON coding problems.  "Improvements and progress."

User is online   Danukem 

  • Duke Plus Developer

#61

Yeah, the code is wrong. You aren't using any inner bracess, so every single line of code after "state troop_body_jibs" in those outer braces is going to be executed every time the corpse is hit by anything.

This is what it should look like:

  ifhitweapon
  {
    ifwasweapon RADIUSEXPLOSION
    {
      state troop_body_jibs
      state standard_jibs
      sound SQUISHED
      killit
     }
  }


CON is not Python. There is no off-side rule. The compiler doesn't give one fuck what is indented and what is not. You MUST group commands using { }. I have noticed this problem several times in what you have posted.

This post has been edited by Trooper Dan: 09 December 2018 - 07:10 PM
Reason for edit: typos

0

User is offline   F!re-Fly 

#62

Thank you for this precious help. It's true that I do not use enough "{}"

Currently, I correct the whole file GAME.CON, because in the end, a lot of problem was not corrected. I rely on coding already done by other people and also by me for some additions.

I tested everything with these updates and the result is really great.

For example, I redid all the codes of all the monsters and this has corrected a lot of bug.

Actions are more fluid for each animation.

General kills codes are fixed.

Etc...

This post has been edited by Firefly_Trooper: 10 December 2018 - 09:32 AM

1

User is offline   F!re-Fly 

#63

I finally managed to code the two "spritepal" actions of BOSS1.

ifai 0
  {
    ifspritepal 0
      ai AIBOSS1RUNENEMY
    else
    {
      ifspritepal 3 nullop
      else
      {
        strength BOSS1PALSTRENGTH
        ai AIBOSS1RUNENEMY
        clipdist 16
        break
      }
      ifspritepal 22 nullop
      else
      {
        strength BOSS1PALSTRENGTH
        ai AIBOSS1SHOOTENEMY
        clipdist 16
        break
      }
    }
  }


There is just one last thing. The actions have been reversed:

Spritepal 3 = SHOOTENEMY, instead of RUNENEMY
Spritepal 22 = RUNENEMY instead of SHOOTENEMY

One question: Is it worth adding the "spritepal 3" elsewhere in the boss code ?
0

User is offline   F!re-Fly 

#64

Needless question, I corrected everything. I just reversed the "ai" SHOOT and RUN and simply added in the code "state hit" the spritepal. So, it is not useful to add several spritepal 3 in the code. :)
0

User is offline   F!re-Fly 

#65

Here is the updated BOSS2 code:

action ABOSS2STAND    0 1 5
action ABOSS2STAYSTAND    -1 1 5 1 1
action ABOSS2WALK    0 4 5 1 30
action ABOSS2FROZEN    0 1 5
action ABOSS2RUN    0 4 5 1 15
action ABOSS2SHOOT    20 2 5 1 15
action ABOSS2LOB    30 2 5 1 105
action ABOSS2DYING    40 8 1 1 35
action ABOSS2FLINTCH    40 1 1 1 1
action ABOSS2DEAD    48
action ABOSS2GROW    0 1 5 1 1
action ABOSS2FROZENSHRUNK    0 1 5

define BOSS2PALSTRENGTH 1000

move PALBOSS2SHRUNKRUNVELS 32
move PALBOSS2RUNVELS 84
move BOSS2WALKVELS 192
move BOSS2RUNVELS 256
move BOSS2STOPPED

ai AIBOSS2SEEKENEMY ABOSS2WALK BOSS2WALKVELS seekplayer
ai AIBOSS2RUNENEMY ABOSS2RUN BOSS2RUNVELS faceplayer
ai AIBOSS2SHOOTENEMY ABOSS2SHOOT BOSS2STOPPED faceplayer
ai AIBOSS2LOBBED ABOSS2LOB BOSS2STOPPED faceplayer
ai AIBOSS2DYING ABOSS2DYING BOSS2STOPPED geth
ai AIBOSS2PALSHRINK ABOSS2WALK PALBOSS2SHRUNKRUNVELS furthestdir
ai AIBOSS2GROW ABOSS2GROW BOSS2STOPPED faceplayerslow

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

state boss2palshrunkstate
  ifcount SHRUNKDONECOUNT
    ai AIBOSS2SEEKENEMY
  else
    ifcount SHRUNKCOUNT
      sizeto 40 40
  else
    state genericshrunkcode
ends

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

state boss2runenemystate
  ifcansee
  {
    ifactioncount 3
    {
      ifcanshoottarget
      {
        resetactioncount
        sound BOS1_WALK
      }
      else
        ai AIBOSS2SEEKENEMY
    }
    ifcount 48
      ifrnd 2
    {
      ifp palive
      {
        sound BOS2_ATTACK
        ai AIBOSS2SHOOTENEMY
      }
      break
    }
  }
  else
    ai AIBOSS2SEEKENEMY
ends

state boss2seekenemystate
  ifrnd 2
    soundonce BOS2_ROAM
  else
    ifactioncount 3
  {
    resetactioncount
    sound BOS1_WALK
  }

  ifcansee
    ifcount 32
      ifp palive
        ifrnd 48
          ifcanshoottarget
  {
    ifrnd 64
      ifpdistg 4096
    {
      ai AIBOSS2RUNENEMY
      ifspritepal 0 nullop
      else
      ifspritepal 3 nullop
      else
      ifspritepal 22 nullop
      else
        move PALBOSS2RUNVELS seekplayer
      break
    }

    ifpdistl 10240
    {
      ifrnd 128
      {
        sound BOS2_ATTACK
        ai AIBOSS2LOBBED
      }
    }
    else
    {
      sound BOS2_ATTACK
      ai AIBOSS2SHOOTENEMY
    }
  }
ends

state boss2dyingstate
  ifaction ABOSS2DEAD
  {
    ifspritepal 0
      break
    ifspritepal 3
      break
    ifspritepal 22
      break
    ifrespawn
      ifcount RESPAWNACTORTIME
    {
      spawn TRANSPORTERSTAR
      sizeat 40 40
      cstat 257
      strength PIGCOPSTRENGTH
      state checkboss2seekstate
    }
    else
    {
      strength 0
      ifsquished
      {
        sound SQUISHED
        state standard_jibs
        state random_ooz
        killit
      }
      ifhitweapon
        ifwasweapon RADIUSEXPLOSION
      {
        sound SQUISHED
        state standard_jibs
        state standard_jibs
        state standard_jibs
        state standard_jibs
        killit
      }
      break
    }
  }
  ifactioncount 8
  {
    iffloordistl 8
      sound THUD0
    action ABOSS2DEAD
//    cstat 0
    state rf_unblock
    ifspritepal 0
      endofgame 52
  }
ends

state boss2lobbedstate
  ifcansee
  {
    ifactioncount 2
      resetactioncount
    else
      ifactioncount 1
    {
      ifrnd 128
        { eshoot COOLEXPLOSION1
          setactor[RETURN].x sprite[THISACTOR].x
          setactor[RETURN].y sprite[THISACTOR].y
        }
    }
    else
      ifcount 64
        ifrnd 16
          state checkboss2seekstate
  }
  else
    state checkboss2seekstate
ends

state boss2shootenemy
  ifcount 72
    state checkboss2seekstate
  else
    ifaction ABOSS2SHOOT
      ifactioncount 2
  {
    shoot RPG
    sound BOS1_ATTACK2
    resetactioncount
  }
ends

state checkboss2hitstate
  ifrnd 2
    spawn BLOODPOOL
  ifdead
  {
    ifspritepal 0
      globalsound DUKE_TALKTOBOSSFALL
    else
    ifspritepal 3
      globalsound DUKE_TALKTOBOSSFALL
    else
    ifspritepal 22
      globalsound DUKE_TALKTOBOSSFALL
    else
    {
      ifwasweapon FREEZEBLAST
      {
        sound SOMETHINGFROZE
        spritepal 1
        move 0
        ifai AIBOSS2PALSHRINK action ABOSS2FROZENSHRUNK
        else action ABOSS2FROZEN
        strength 0
        break
      }
      else ifrnd 64
        globalsound DUKE_TALKTOBOSSFALL
    }

    ifwasweapon GROWSPARK
    {
      sound ACTOR_GROWING
      ai AIBOSS2GROW
      break
    }

    ifwasweapon RADIUSEXPLOSION
    {
      sound SQUISHED
      globalsound DUKE_TALKTOBOSSFALL
      state standard_jibs
      state standard_jibs
      state standard_jibs
      state standard_jibs
      addkills 1
      killit
    }
    else
      ifwasweapon RPG
    {
      sound SQUISHED
      globalsound DUKE_TALKTOBOSSFALL
      state standard_jibs
      state standard_jibs
      state standard_jibs
      state standard_jibs
      addkills 1
      killit
    }

    sound BOS2_DYING

    addkills 1
    ai AIBOSS2DYING
    ifrnd 128 cstator 4
  }
  else
  {
    ifwasweapon SHRINKSPARK
    { ifspritepal 0 break
      ifai AIBOSS2PALSHRINK break
      sound ACTOR_SHRINKING
      soundonce BOS2_PAIN
      ai AIBOSS2PALSHRINK
      break
    }

    ifrnd 144
    {
      soundonce BOS2_PAIN

      ifai AIBOSS2PALSHRINK break

      ifrnd 32
      {
        action ABOSS2FLINTCH
        move 0
      }
      else
      {
        sound BOS2_ATTACK
        ai AIBOSS2SHOOTENEMY
      }
    }
    ifai AIBOSS2PALSHRINK break
    debris SCRAP1 1
    guts JIBS6 1
  }
ends

state boss2frozen
  ifcount THAWTIME
  {
    getlastpal
    ifaction ABOSS2FROZENSHRUNK
    { ai AIBOSS2PALSHRINK
      count SHRUNKCOUNT
    }
    else ai AIBOSS2SEEKENEMY
//    spritepal 21
  }
  else
    ifcount FROZENDRIPTIME
  {
    ifactioncount 26
    {
      spawn WATERDRIP
      resetactioncount
    }
  }

  ifhitweapon
  {
    ifwasweapon FREEZEBLAST
    {
      strength 0
      break
    }
    ifrnd 64
      globalsound DUKE_TALKTOBOSSFALL

    lotsofglass 100
    sound GLASS_BREAKING
    ifrnd 84 spawn BLOODPOOL
    addkills 1
    killit
  }
  ifp pfacing
    ifpdistl FROZENQUICKKICKDIST
      ifaction ABOSS2FROZENSHRUNK
        pkick
ends

state boss2code

state checksquished
ifspritepal 0 nullop else

  ifaction ABOSS2FROZEN
  { state boss2frozen
    break
  }
  ifaction ABOSS2FROZENSHRUNK
  { state boss2frozen
    break
  }
  ifai 0
  {
    ifspritepal 0
      ai AIBOSS2RUNENEMY
    else
    { sound BOS2_ATTACK ai AIBOSS2SHOOTENEMY }
    {
      ifspritepal 3 nullop
      else
      {
        strength BOSS1PALSTRENGTH
        ai AIBOSS2SHOOTENEMY
        clipdist 16
        break
      }
      ifspritepal 22 nullop
      else
      {
        strength BOSS1PALSTRENGTH
        ai AIBOSS2RUNENEMY
        clipdist 16
        break
      }
    }
  }
  else
    ifaction ABOSS2FLINTCH
  {
    ifactioncount 3
      ai AIBOSS2SEEKENEMY
  }
  else
    ifai AIBOSS2SEEKENEMY
      state boss2seekenemystate
  else
    ifai AIBOSS2RUNENEMY
      state boss2runenemystate
  else
    ifai AIBOSS2SHOOTENEMY
      state boss2shootenemy
  else
    ifai AIBOSS2GROW
      state boss2growstate
  else
    ifai AIBOSS2LOBBED
      state boss2lobbedstate
  else
    ifai AIBOSS2PALSHRINK
      state boss2palshrunkstate

  ifai AIBOSS2DYING
    state boss2dyingstate
  else
  { ifvarg sprite[THISACTOR].htextra 0
    ifvarvare sprite[THISACTOR].htowner THISACTOR
      setactor[THISACTOR].htextra -1 // Disable self damage

    ifhitweapon state checkboss2hitstate
    else
    ifp palive
    ifpdistl 1280
    { ifspritepal 0
      { setplayer[THISACTOR].wackedbyactor THISACTOR
        addphealth -1000
        palfrom 63 63
      }
      else
      { ifai AIBOSS2SEEKENEMY
          { sound BOS2_ATTACK ai AIBOSS2SHOOTENEMY }
        else ifai AIBOSS2SEEKENEMY
          { sound BOS2_ATTACK ai AIBOSS2SHOOTENEMY }
      }
    }
    else
    ifp palive
    ifpdistl 1280
    { ifspritepal 22
      { setplayer[THISACTOR].wackedbyactor THISACTOR
        addphealth -1000
        palfrom 63 63
      }
      else
      { ifai AIBOSS2SEEKENEMY
          { sound BOS2_ATTACK ai AIBOSS2SHOOTENEMY }
        else ifai AIBOSS2SEEKENEMY
          { sound BOS2_ATTACK ai AIBOSS2SHOOTENEMY }
      }
    }
  }
  ifp pshrunk
  state badguystomphit
ends

useractor enemy BOSS2STAYPUT BOSS2STRENGTH ABOSS2STAYSTAND cactor BOSS2 enda
actor BOSS2 BOSS2STRENGTH ABOSS2STAND fall state boss2code enda


There is only one small problem. The corpse of BOSS2 sets on "spritepal 3", refuses to be jibed.
0

User is offline   F!re-Fly 

#66

Same code procedure for BOSS3:

  ifai 0
  {
    ifspritepal 0
      ai AIBOSS3RUNENEMY
    else
    {
      ifspritepal 3 nullop
      else
      {
        strength BOSS3PALSTRENGTH
        ai AIBOSS3LOBENEMY
        clipdist 16
        break
      }
      ifspritepal 22 nullop
      else
      {
        strength BOSS3PALSTRENGTH
        ai AIBOSS3RUNENEMY
        clipdist 16
        break
      }
    }
  }


By cons, I have a problem without explanation. The BOSS1 and BOSS2, work very well with "spritepal 3 and 22" except that I can not destroy the corpses (only in spritepal 22). Here, the BOSS3 does not activate the two actions "spritepal 3 and 22" I have either, even having coded in the same way.

Result two BOSS problems to finish.

1. jibbed corpses (spritepal 3)
2. activate two actions for the BOSS3 (spritepal 3 and 22).
0

User is offline   F!re-Fly 

#67

As I have advanced with the monsters (especially the GAME.CON file), I would like to put the small problems of BOSS to later.

So I decided to code this famous flame thrower of the WT. just the first tutorial finished, I have some problems that I do not understand.

I will start with video tests:

WT



Personal con file



Here is my first part of the code:

gamevar WEAPON9_FLAGS 4 1
gamevar WEAPON9_FIREDELAY 4 1
gamevar WEAPON9_TOTALTIME 16 1
gamevar WEAPON9_HOLDDELAY 0 1
gamevar WEAPON9_FIRESOUND FLAMETHROWER_INTRO 1

state initweapondisplay
  setvar angvar 0
  setvar orientation 0
  subvarvar digx looking_angSR1
  addvarvar digy looking_arc
  subvarvar digy gun_pos
  addvarvar digx weapon_xoffset
  setvarvar shade gs
  getsector[THISACTOR].floorpal pal
  ifvarg pal 13 setvar pal 0
ends

state flamethrower
 switch weaponcount
  case 0 case 1
   setvar digz 65536
   setvar digx 210
   setvar digy 261
   setvar picnum 5138
   setvar orientation 0
   state initweapondisplay
   rotatesprite digx digy digz angvar picnum shade pal orientation 0 0 xdim ydim
  break
  case 2
   setvar digz 65536
   setvar digx 200
   setvar digy 277
   setvar picnum 5139
   setvar orientation 0
   state initweapondisplay
   rotatesprite digx digy digz angvar picnum shade pal orientation 0 0 xdim ydim
  break
  case 3
   setvar digz 65536
   setvar digx 200
   setvar digy 277
   setvar picnum 5139
   setvar orientation 0
   state initweapondisplay
   rotatesprite digx digy digz angvar picnum shade pal orientation 0 0 xdim ydim
  break
  case 4
   setvar digz 65536
   setvar digx 200
   setvar digy 277
   setvar picnum 5139
   setvar orientation 0
   state initweapondisplay
   rotatesprite digx digy digz angvar picnum shade pal orientation 0 0 xdim ydim
  break
 endswitch
ends

state flamethrowerfire
 switch weaponcount
  case 2
   setvar digz 65536
   setvar digx 200
   setvar digy 251
   setvar picnum 5141
   setvar orientation 0
   state initweapondisplay
   rotatesprite digx digy digz angvar picnum shade pal orientation 0 0 xdim ydim
  break
  case 3
   setvar digz 65536
   setvar digx 200
   setvar digy 251
   setvar picnum 5142
   setvar orientation 0
   state initweapondisplay
   rotatesprite digx digy digz angvar picnum shade pal orientation 0 0 xdim ydim
  break
  case 4
   setvar digz 65536
   setvar digx 200
   setvar digy 251
   setvar picnum 5140
   setvar orientation 0
   state initweapondisplay
   rotatesprite digx digy digz angvar picnum shade pal orientation 0 0 xdim ydim
  break
 endswitch
ends

state flamethrowerpilot
 switch weaponcount
  case 0 case 1
   setvar digz 65536
   setvar digx 211
   setvar digy 261
   setvar picnum 5174
   setvar orientation 0
   state initweapondisplay
   rotatesprite digx digy digz angvar picnum shade pal orientation 0 0 xdim ydim
  break
 endswitch
ends

onevent EVENT_DRAWWEAPON

 ifvare currentweapon 9
  {
   setvar RETURN -1
   state flamethrowerpilot
   state flamethrower
   state flamethrowerfire
  }
endevent


The problems encountered:

1. I really do not know what to choose in the codes "gamevar WEAPON"
2. The weapon does not vibrate when shooting.
3. During the firing time, the weapon's weapon does not stay long (as on the WT video).
4. The display of the weapon on the screen is in two parts (tiles 5139 to 5142). When she moves with the player, while shooting with it, the two images of the weapon separate slightly (a cut line is created).

Of course, I remain very enthusiastic to progress and, above all, to understand what to choose as a specific weapon.
0

User is offline   Mark 

#68

Are you sure your tiles are defined and animated properly in the def files? Maybe its that and not the cons.
0

User is offline   F!re-Fly 

#69

The images are good, but there must be a missing animation.

I have some difficulties for this first tutorial only. I looked at the other parts of the same tutorial and it is less complex for me.

I think I found the right rate of fire from the flamethrower. The time between each shot matches well.

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

0

User is offline   F!re-Fly 

#70

As the coding of a new weapon is pretty boring, I'll come back to it a little later. Let's go back to the BOSS2 and BOSS3 code. Do you have an idea for spritepal problems?
0

User is offline   F!re-Fly 

#71

I have another different question besides BOSS. How to avoid monsters shooting in the void, even when they do not see the player?

When the monster is right behind a wall, it still pulls and kills itself.

This post has been edited by Firefly_Trooper: 14 December 2018 - 09:00 AM

0

User is offline   F!re-Fly 

#72

All BOSS spritepal codes is fixed ! All BOSS jibbed corpses is fixed (with spritepal 3).

I take advantage of it to make a special LIZTROOP. A "super LIZTROOP"

Posted Image

Description:

1. health point 300
2. movement speed 150 (ground and jetpack)
3. has shield that can release.
4. is far more resistant to explosions (with spriteflags)
5. His weapon is expander with gust of fire in 12 shots (very deadly!)
6. Is absolutely not affected by the Shrinker.
7. He releases ammunition from the expander

optional:

8. all sounds have been changed (RECOG, ROAM, HURT and DIE)
9. spritepal 23
10. Do everything to avoid projectiles (like the drone).

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

0

User is offline   F!re-Fly 

#73

UPDATE GAME.CON file :)

Improved and logical gameplay:

1. A shrunken monster, will not be able to crush Duke who is also shrunk.

2. Shrunk monsters will no longer be able to generate items. The appearance of a large sprite of weapon / ammunition, generated by a shrunken monster is not consistent as well as the appearance of a sprite that has been reduced, is supposed not to be usable for a large Duke.
0

User is offline   F!re-Fly 

#74

I have two more questions to finish the Shrinker related codes.

How to cancel the boot print in a bloodpool and how to cancel the animation frame of its reduced size?

When Duke walks on a bloodpool, his height decreases. I would just like to cancel these actions only for shrunken monsters. I would choose the size of the bloodpool myself. If these actions are not canceled, the bloodpool is bugged because it will want to decrease.

This post has been edited by Firefly_Trooper: 16 December 2018 - 12:08 PM

0

User is offline   F!re-Fly 

#75

I found in the wiki, the code that prevents the damage that the actors inflict themselves. But I have not yet found a code that prevents an actor from firing projectiles without them seeing the player.
0

User is online   Danukem 

  • Duke Plus Developer

#76

Normally it suffices when "ifcansee ifcanshoottarget" is true when firing.
0

User is offline   F!re-Fly 

#77

The code is like this and the Dragon fires projectiles, even if the Duke is hidden:

state DRAGONBOUNCESTATE

state checkdragonsquished
state dragongrowstate

ifai AIDRAGONBOUNCE
  {
  ifactioncount 2
    {
    sound DRAGONROAM
    ai AIDRAGONBOUNCE2
    }
  }
  else
  {
  ifactioncount 3
    {
    ai AIDRAGONBOUNCE
    }
  }

  ifcansee
  ifrnd 64
  ifcanshoottarget
  {
  ifp palive
  {
  ai AIDRAGONSHOOT
  }
  else
  {
  ai AIDRAGONBOUNCESEE
  }
 }
ends


I tried this code but without result:

ifvarg sprite[THISACTOR].htextra 0
    ifvarvare sprite[THISACTOR].htowner THISACTOR
      setactor[THISACTOR].htextra -1 // Disable self damage

0

User is online   Danukem 

  • Duke Plus Developer

#78

Checking visibility before entering AIDRAGONSHOOT does not mean that it continues to check when about to actually fire.
0

User is offline   F!re-Fly 

#79

Okay great thank. For the previous message on the small bloodpool and size. Do you have an idea ?

This post has been edited by Firefly_Trooper: 18 December 2018 - 04:07 AM

0

User is offline   F!re-Fly 

#80

Another corrected contribution in my work. The boss of NW is completely redone and the bugs are fixed.

I just have one last thing to code and it concerns the guts. How to correctly code two sprites to add them in my new tripe code? I have two original "jibs" from "Santa Claus"

I created a definition, actions and a new actor for these two sprites.

The only concern is how to fall on the floor, the sprites of a tripe code?

This post has been edited by Firefly_Trooper: 18 December 2018 - 01:01 PM

0

User is offline   F!re-Fly 

#81

I have another frame for the PIGCOP: looking at the number 2030, he is standing shooting. I wanted to use this tile, to create a new action or the Pigcop draws directly by seeing the player (similar to PICOPDIVE).

I added this:

action APIGSHOOTSTAND    30 2 5 1 58
action APIGSHOOTSTAND2    0 2 5 1 58
action APIGSHOOTSTANDSTAND    0 1 5

ai AIPIGSHOOTINGSTAND APIGSHOOTSTAND PIGSTOPPED faceplayer

state pigshootstandstate
  ifcansee  { }
  ifaction APIGSHOOT
  {
//    ifcansee
//    {
      ifcount 12 nullop
      else
        ifcount 11
      { ifcansee
        {
          ifcanshoottarget
          {
            sound PIG_ATTACK
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
          }
          else
          { cactor PIGCOP ai AIPIGSEEKENEMY }
        }
        else
        { cactor PIGCOP ai AIPIGSEEKENEMY }
      }
      ifcount 25 nullop
      else
        ifcount 24
          sound SHOTGUN_COCK
      ifcount 48 nullop
      else
        ifcount 47
      {
        ifcansee
        {
          ifcanshoottarget
          {
            sound PIG_ATTACK
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
          }
          else
          { cactor PIGCOP ai AIPIGSEEKENEMY }
        }
        else
        { cactor PIGCOP ai AIPIGSEEKENEMY }
      }
      ifcount 60 nullop
      else
        ifcount 59
      {
        sound SHOTGUN_COCK
        ifgapzl 32
          ai AIPIGSHOOTINGSTAND
        else
        {
          ifpdistl 4096
            { cactor PIGCOP ai AIPIGFLEEENEMY }
          else
            { cactor PIGCOP ai AIPIGSEEKENEMY }
        }
      }
//    }
//    else
//      ifgapzl 32
//        ai AIPIGSHOOTINGSTAND
//      else
//        { cactor PIGCOP ai AIPIGSEEKENEMY }
  }
  else
  ifaction APIGSHOOTSTAND
  { ifactioncount 1 { cactor PIGCOPSHOOTINGSTAND action APIGSHOOTSTAND2 } }
  else
  ifaction APIGSHOOTSTAND2
  { ifactioncount 1
    { ifp palive
      {
        resetcount
        action APIGSHOOT
      }
      else { cactor PIGCOP action APIGSHOOTSTAND }
    }
  }
ends

useractor enemy PIGCOPSHOOTINGSTAND PIGCOPSTRENGTH
  state pigcopcode
  ifai 0 { ai AIPIGSHOOTINGSTAND
           action APIGSHOOT }
  fall
enda


Everything works fine except the "action" animation frame. I can not define tiles for "action" animation. This shifts the images, as if it was the number "PIGCOPDIVE 2045" everything is played as if it was PIGCOPDIVE while I changed everything.

How to force an actor to animate the frame of action?
0

User is offline   F!re-Fly 

#82


0

User is offline   Mark 

#83

Its hard to find the problems without all the other code for the pigcop such as the defs to make sure the anims are correct. I also see that most of the code you posted is the creation of a state. But there is no call to use the state inside the actor. Maybe that call is in another part of the code not shown?
0

User is offline   F!re-Fly 

#84

Here is the whole code with a second try. I do not know where the problem lies.

action APIGDIVESTAND    0 1 5
action APIGSTAYSTAND    29 1 5
action APIGWALK    0 4 5 1 20
action APIGRUN    0 4 5 1 11
action APIGSHOOT    30 2 5 1 58
action APIGCOCK    25 1 5 1 16
action APIGSTAND    30 1 5 1 1
// action APIGDIVE    40 2 5 1 40
// action APIGDIVESHOOT    45 2 5 1 58
action APIGDIVE1    40 1 5 1 40
action APIGDIVE2    0 1 5 1 40
action APIGDIVESHOOT    0 2 5 1 58
action APIGDYING    55 5 1 1 15
action APIGHIT    55 1 1 1 10
action APIGDEAD    60 1 1 1 1
action APIGFROZEN    0 1 5
action APIGFROZENSHRUNK    0 1 5
action APIGGROW    0 1 5 1 1

action APIGSTANDSHOOT    7 8 5 1 58
action APIGSTANDSHOOTSTAND    0 1 5

move PIGWALKVELS 72
move PIGRUNVELS 108
move PIGSTOPPED

ai AIPIGSEEKENEMY APIGWALK PIGWALKVELS seekplayer
ai AIPIGSHOOTENEMY APIGSHOOT PIGSTOPPED faceplayer
ai AIPIGFLEEENEMY APIGWALK PIGWALKVELS fleeenemy
ai AIPIGSHOOT APIGSHOOT PIGSTOPPED faceplayer
ai AIPIGDODGE APIGRUN PIGRUNVELS dodgebullet
ai AIPIGCHARGE APIGRUN PIGRUNVELS seekplayer
ai AIPIGDIVING APIGDIVE1 PIGSTOPPED faceplayer
ai AIPIGDYING APIGDYING PIGSTOPPED geth
ai AIPIGSHRINK APIGWALK SHRUNKVELS fleeenemy
ai AIPIGGROW APIGGROW PIGSTOPPED faceplayerslow
ai AIPIGHIT APIGHIT PIGSTOPPED faceplayer

ai AIPIGSHOOT2 APIGSTANDSHOOT PIGSTOPPED faceplayer

state pigseekenemystate

  ifai AIPIGCHARGE
  {
    ifcansee
      ifpdistl 3084
    {
      ifnotmoving
        ai AIPIGSEEKENEMY
      else
        ai AIPIGDIVING
    }
    break
  }
  else iffloordistl 32
  {
    ifpdistg 4096
    {
      ifactornotstayput
      ai AIPIGCHARGE
    }
    ifrnd 8
    {
      ifbulletnear
        ai AIPIGDODGE
    }
  }

  ifrnd 128
    ifcansee
  {
    ifai AIPIGDODGE
    {
      ifcount 32
        ai AIPIGCHARGE
          break
    }
    iffloordistl 32
    {
      ifpdistl 1024
        ifp palive
          ifcanshoottarget
      {
        ai AIPIGSHOOTENEMY
        break
      }
      ifcount 48
      {
        ifrnd 8
          ifp palive
            ifcanshoottarget
        {
          ifrnd 192
            ai AIPIGSHOOTENEMY
          else
            ai AIPIGDIVING
          break
        }
      }
    }
  }
ends

state pigshootenemystate
//  ifcansee
//  {
    ifcount 12 nullop
    else
      ifcount 11
    {
      ifcanshoottarget
      {
        sound PIG_ATTACK
        shoot SHOTGUN
        shoot SHOTGUN
        shoot SHOTGUN
        shoot SHOTGUN
        shoot SHOTGUN
      }
      else
        ai AIPIGSEEKENEMY
    }
    ifcount 25 nullop
    else
      ifcount 24
      {
        action APIGCOCK
        sound SHOTGUN_COCK
      }
    ifcount 48 nullop
    else
      ifcount 47
    {
      ifcanshoottarget
      {
        sound PIG_ATTACK
        shoot SHOTGUN
        shoot SHOTGUN
        shoot SHOTGUN
        shoot SHOTGUN
        shoot SHOTGUN
      }
      else
        ai AIPIGSEEKENEMY
    }
    ifcount 60 nullop
    else
      ifcount 59
      {
        action APIGCOCK
        sound SHOTGUN_COCK
      }
    ifcount 72
    {
      ifrnd 64
        resetcount
      else
      {
        ifpdistl 768
          ai AIPIGFLEEENEMY
        else
          ai AIPIGSEEKENEMY
      }
    }
    ifaction APIGCOCK
      ifactioncount 2
        action APIGSHOOT
//  }
//  else
//    ai AIPIGSEEKENEMY
ends

state pigfleeenemystate
  ifactioncount 8
    ai AIPIGSEEKENEMY
  else
    ifnotmoving
      ai AIPIGSEEKENEMY
ends

state pigdivestate
  ifcansee  { } // needed to update the 'last seen' position
  ifaction APIGDIVESHOOT
  {
//    ifcansee
//    {
      ifcount 12 nullop
      else
        ifcount 11
      { ifcansee
        {
          ifcanshoottarget
          {
            sound PIG_ATTACK
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
          }
          else
          { cactor PIGCOP ai AIPIGSEEKENEMY }
        }
        else
        { cactor PIGCOP ai AIPIGSEEKENEMY }
      }
      ifcount 25 nullop
      else
        ifcount 24
          sound SHOTGUN_COCK
      ifcount 48 nullop
      else
        ifcount 47
      {
        ifcansee
        {
          ifcanshoottarget
          {
            sound PIG_ATTACK
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
          }
          else
          { cactor PIGCOP ai AIPIGSEEKENEMY }
        }
        else
        { cactor PIGCOP ai AIPIGSEEKENEMY }
      }
      ifcount 60 nullop
      else
        ifcount 59
      {
        sound SHOTGUN_COCK
        ifgapzl 32
          ai AIPIGDIVING
        else
        {
          ifpdistl 4096
            { cactor PIGCOP ai AIPIGFLEEENEMY }
          else
            { cactor PIGCOP ai AIPIGSEEKENEMY }
        }
      }
//    }
//    else
//      ifgapzl 32
//        ai APIGDIVESHOOT
//      else
//        { cactor PIGCOP ai AIPIGSEEKENEMY }
  }
  else
  ifaction APIGDIVE1
  { ifactioncount 1 { cactor PIGCOPDIVE action APIGDIVE2 } }
  else
  ifaction APIGDIVE2
  { ifactioncount 1
    { ifp palive
      {
        resetcount
        action APIGDIVESHOOT
      }
      else { cactor PIGCOP action APIGDIVE1 }
    }
  }
ends

state pigstandshootstate
  ifaction APIGSHOOT
  {
    ifcansee
    {
      ifcount 12 nullop
      else
        ifcount 11
      {
        ifcanshoottarget
        {
          sound PIG_ATTACK
          shoot SHOTGUN
          shoot SHOTGUN
          shoot SHOTGUN
          shoot SHOTGUN
        }
        else
          ai AIPIGSEEKENEMY
      }
      ifcount 25 nullop
      else
        ifcount 24
          sound SHOTGUN_COCK
      ifcount 48 nullop
      else
        ifcount 47
      {
        ifcanshoottarget
        {
          sound PIG_ATTACK
          shoot SHOTGUN
          shoot SHOTGUN
          shoot SHOTGUN
          shoot SHOTGUN
        }
        else
          ai AIPIGSEEKENEMY
      }
      ifcount 60 nullop
      else
        ifcount 59
      {
        sound SHOTGUN_COCK
        ifgapzl 32
          ai AIPIGSHOOT2
        else
        {
          ifpdistl 4096
            ai AIPIGFLEEENEMY
          else
            ai AIPIGSEEKENEMY
        }
      }
    }
    else
      ifgapzl 32
        ai AIPIGSHOOT2
      else
        ai AIPIGSEEKENEMY
  }
  else
    ifactioncount 2
    ifp palive
    {
      resetcount
      action APIGSHOOT
    }
ends

state checkpighitstate
  ifdead
  {
    state random_wall_jibs

    ifwasweapon FREEZEBLAST
    {
      ifactor PIGCOPDIVE cactor PIGCOP
      sound SOMETHINGFROZE
      spritepal 1
      move 0
      ifai AIPIGSHRINK action APIGFROZENSHRUNK
      else action APIGFROZEN
      strength 0
      break
    }

    ifai AIPIGSHRINK nullop
    else
    { ifrnd 16
      { espawn SHIELD
        randvar TEMPFIX1 2047
        setactor[RETURN].ang TEMPFIX1
      }
      else
        state drop_shotgun
    }

    ifwasweapon GROWSPARK
    {
      ifactor PIGCOPDIVE cactor PIGCOP
      sound ACTOR_GROWING
      ai AIPIGGROW
      break
    }
    else
      ifwasweapon RADIUSEXPLOSION
    {
      spawn BLOOD
      sound SQUISHED
      state standard_jibs
      addkills 1
      killit
    }
    else
      ifwasweapon RPG
    {
      spawn BLOOD
      sound SQUISHED
      state standard_jibs
      addkills 1
      killit
    }
    else
    { ifactor PIGCOPDIVE cactor PIGCOP
      ai AIPIGDYING
      spawn BLOOD
      ifrnd 128 cstator 4
      addkills 1
      sound PIG_DYING
    }
  }
  else
  {
    sound PIG_PAIN

    ifwasweapon SHRINKSPARK
    { ifai AIPIGSHRINK break
      ifactor PIGCOPDIVE cactor PIGCOP
      sound ACTOR_SHRINKING
      ai AIPIGSHRINK
      break
    }
    else
      ifwasweapon GROWSPARK
        sound EXPANDERHIT
    else
    { ifai AIPIGSHRINK break
      ifrnd 32 // avoid resetting animation when hit
        { ifactor PIGCOPDIVE cactor PIGCOP ai AIPIGHIT }
      else
        ifrnd 64
          { ifai AIPIGSHOOTENEMY nullop
            else ifai AIPIGDIVING nullop
            else { ifactor PIGCOPDIVE cactor PIGCOP ai AIPIGSHOOTENEMY }
          }
      else
        ifrnd 64
        { ifai AIPIGSHOOTENEMY nullop
          else ifai AIPIGDIVING nullop
          else
          { ifactor PIGCOP cactor PIGCOPDIVE ai AIPIGDIVING
            action APIGDIVESHOOT
          }
        }
     }
    state random_wall_jibs
    spawn BLOOD
  }
ends

state pigshrinkstate
  ifcount SHRUNKDONECOUNT
    { sizeat 40 40 ai AIPIGSEEKENEMY }
  else
    ifcount SHRUNKCOUNT
      sizeto 40 40
  else
    state genericshrunkcode
ends

state pigfrozen
  ifcount THAWTIME
  { ifaction APIGFROZENSHRUNK
    { ai AIPIGSHRINK
      count SHRUNKCOUNT
    }
    else ai AIPIGSEEKENEMY
    getlastpal
  }
  else
    ifcount FROZENDRIPTIME
      ifrnd 8
        spawn WATERDRIP

  ifhitweapon
  {
    ifwasweapon FREEZEBLAST
    {
      strength 0
      break
    }

    ifaction APIGFROZEN
    { ifrnd 16
        spawn SHIELD
      else
        state drop_shotgun
    }

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

state pigdyingstate
  ifactioncount 5
  {
    ifrnd 64
      spawn BLOODPOOL
    state rf_unblock
    iffloordistl 8
      sound THUD
    action APIGDEAD
    move PIGSTOPPED
    break
  }
ends

state pigcopcode
  state checksquished
  ifaction APIGSTAND
    ai AIPIGSEEKENEMY
  else
    ifaction APIGDEAD
  {
    ifrespawn
      ifcount RESPAWNACTORTIME
    {
      spawn TRANSPORTERSTAR
      sizeat 40 40
      cstat 257
      strength PIGCOPSTRENGTH
      ai AIPIGSEEKENEMY
    }
    else
    {
      strength 0
      ifhitweapon
        ifwasweapon RADIUSEXPLOSION
      {
        sound SQUISHED
        state standard_jibs
        killit
      }
      break
    }
  }
  else
    ifaction APIGFROZEN
  { state pigfrozen
    break
  }
  else
    ifaction APIGFROZENSHRUNK
  { state pigfrozen
    break
  }
  else
    ifai AIPIGDYING
      state pigdyingstate
  else
    ifai AIPIGHIT
    {
      ifactioncount 3
      ai AIPIGSEEKENEMY
    }
  else
    ifai AIPIGSHRINK
    { ifhitweapon state checkpighitstate
      state pigshrinkstate
      break
    }
  else
  {
    ifai AIPIGSEEKENEMY
      state pigseekenemystate
    else
      ifai AIPIGDODGE
        state pigseekenemystate
    else
      ifai AIPIGSHOOTENEMY
        state pigshootenemystate
    else
      ifai AIPIGGROW
        state genericgrowcode
    else
      ifai AIPIGFLEEENEMY
        state pigfleeenemystate
    else
      ifai AIPIGDIVING
        state pigdivestate
    else
      ifai AIPIGSHOOT2
        state pigstandshootstate
    else
      ifai AIPIGCHARGE
        state pigseekenemystate
    ifhitweapon
      state checkpighitstate
    ifrnd 1
    {
      ifrnd 32
        soundonce PIG_ROAM
      else
        ifrnd 64
          soundonce PIG_ROAM2
      else
        soundonce PIG_ROAM3
    }
  }
  ifp pshrunk
  state badguystomphit
ends

actor PIGCOPDIVE PIGCOPSTRENGTH APIGDIVESTAND
  state pigcopcode
  ifai 0 { ai AIPIGDIVING
           action APIGDIVESHOOT }
  fall
enda

actor PIGCOPSTAYPUT PIGCOPSTRENGTH APIGSTAYSTAND
  ai AIPIGSEEKENEMY
  cactor PIGCOP
enda

actor PIGCOP PIGCOPSTRENGTH APIGSTAND
state pigcopcode
fall
enda

useractor enemy PIGCOPSTANDSHOOT PIGCOPSTRENGTH APIGSTANDSHOOTSTAND
  state pigcopcode
  ifai 0 { ai AIPIGSHOOT2
           action APIGSHOOT }
fall
enda

0

User is offline   Kyanos 

#85

action APIGDIVE1 40 2 5 1 40

2nd number is amount of frames, iirc
0

User is offline   Mark 

#86

Before I look at all the code I will ask again about any def files lines to make sure those new PIGSTANDSHOOT tiles are properly defined. If they were not used in the original game its possible they do not have any defs. As a test I would add my own lines in a def file just to make sure they are defined. Your actions won't work unless those tiles are defined properly first. If they still don't work, then its time to look at the rest of your code.

EDIT: I loaded up Mapster and saw that there are dummytile dimensions and offsets for those tiles so I'm guessing they are defined properly. So on to the code...

This post has been edited by Mark: 19 December 2018 - 02:26 PM

0

User is offline   Mark 

#87

The new PIGSTANDSHOOTSTAND tiles start at 2030 but your action starting with a 0 will start at tile 2000.

Oops. I see at the very end of your code you made the PIGSTANDSHOOTSTAND a new actor. I assumed he was part of the main pig actor.

So, is the new actor defined as tile 2030?

This post has been edited by Mark: 19 December 2018 - 02:45 PM

0

User is offline   F!re-Fly 

#88

I was wrong for sure. At first try it was the same. I will review this code and say what's wrong.
0

User is offline   F!re-Fly 

#89

The idea would be to use only 30 and 2 for the action. 30 for 2030 and 2 for the shooting frame.
0

User is offline   F!re-Fly 

#90

Hi Mark ! That's how I proceeded.

1. New frame tile location (2080 instead of 2030)
2. News actions
3. New AI
4. New state
5. AI and state added in the general code
6. New actor (useractor)
7. Automatic resize
8. RECOG sound added

action APIGSTANDSHOOT 0 4 5 1 58 // new! Unused frame
action APIGSTANDSHOOTSTAND 0 1 5 // new! Unused frame

ai AIPIGSTANDSHOOT APIGSTANDSHOOT PIGSTOPPED faceplayer

state pigstandshootstate // new! Unused frame
  ifcansee  { }
  ifaction APIGSTANDSHOOT
  {
//    ifcansee
//    {
      ifcount 12 nullop
      else
        ifcount 11
      { ifcansee
        {
          ifcanshoottarget
          {
            sound PIG_ATTACK
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
          }
          else
          { cactor PIGCOP ai AIPIGSEEKENEMY }
        }
        else
        { cactor PIGCOP ai AIPIGSEEKENEMY }
      }
      ifcount 25 nullop
      else
        ifcount 24
          sound SHOTGUN_COCK
      ifcount 48 nullop
      else
        ifcount 47
      {
        ifcansee
        {
          ifcanshoottarget
          {
            sound PIG_ATTACK
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
            shoot SHOTGUN
          }
          else
          { cactor PIGCOP ai AIPIGSEEKENEMY }
        }
        else
        { cactor PIGCOP ai AIPIGSEEKENEMY }
      }
      ifcount 60 nullop
      else
        ifcount 59
      {
        sound SHOTGUN_COCK
        ifgapzl 32
          ai AIPIGSTANDSHOOT
        else
        {
          ifpdistl 4096
            { cactor PIGCOP ai AIPIGFLEEENEMY }
          else
            { cactor PIGCOP ai AIPIGSEEKENEMY }
        }
      }
//    }
//    else
//      ifgapzl 32
//        ai AIPIGSTANDSHOOT
//      else
//        { cactor PIGCOP ai AIPIGSEEKENEMY }
  }
  else
    ifactioncount 2
    ifp palive
    {
      resetcount
      action APIGSTANDSHOOT
    }
ends

useractor enemy PIGCOPSTANDSHOOT PIGCOPSTRENGTH APIGSTANDSHOOTSTAND // new! Unused frame
  state pigcopcode
  ifai 0 { ai AIPIGSTANDSHOOT
           action APIGSTANDSHOOT }
  fall
enda

appendevent EVENT_LOADACTOR
  ifactor PIGCOPSTANDSHOOT // new! Unused frame
  {
    sizeat 40 40
  }
endevent

appendevent EVENT_RECOGSOUND
  ifactor PIGCOPSTANDSHOOT
  {
    set RETURN -1
    sound PIG_RECOG
  }
endevent


Only small problem related to the frame: I can not have again, shooting animation. What remains to be defined is the actions of killing, shrinking, freezing, etc ... within the general code.
0

Share this topic:


  • 17 Pages +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic


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

Enter your sign in name and password


Sign in options