Monster not working.

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England

Monster not working.

Post by Hidden Hands »

Something is wrong with my monster. It just flaps its wings hovering on the spot. It doesn't give chase to the player or attack. I'm not sure what's wrong with it. Also, despite me putting in the code to say ABCD for animations, it seems to "jump" the frames after a few seconds. Can someone advise me on this? My monster code is as follows:

Code: Select all

actor FlyingMonster 30133
{
//$Category Monsters
//$Title Flying Monster
  Health 200
  RENDERSTYLE Normal
  Monster
  +NOGRAVITY
  +DROPOFF
  +FLOAT
  +FLOORCLIP
  +TELESTOMP
  +FLOATBOB
  +DONTHARMCLASS
  
  Obituary "%o was eaten by flying monster."
  States
  {
  Spawn: 
      CCHN ABCD 10 A_Look 
      Loop 
   See: 
      CCHN AABBCCDD 3 A_Chase 
      Loop 
   Missile: 
      Goto See 
   Melee: 
      CCHN EE 8 A_FaceTarget 
      CCHN F 8 A_ComboAttack 
      Goto See 
   Pain: 
      CCHN G 2 
      CCHN G 2 A_Pain 
      Goto See 
   Death: 
      CCHN H 8 
      CCHN I 8 A_Scream 
      CCHN J 8 
      CCHN K 8 A_NoBlocking 
      CCHN L 8  
      CCHN M -1 
      Stop 
   Raise: 
      CCHN MLKJIH 8 
      Goto See 
  }
}
Thanks in advance.
User avatar
krokots
Posts: 272
Joined: Tue Jan 19, 2010 5:07 pm

Re: Monster not working.

Post by krokots »

If the monster is not supposed to shoot, you don't have to add Missile state. Or if it's supposed to shoot, remove the "Goto see" line.

Code: Select all

   Missile:
   Melee:
      CCHN EE 8 A_FaceTarget
      CCHN F 8 A_ComboAttack
      Goto See 
BTW if you wan't to know what's happening : if a monster sees player, he goes to See state, and every frame, there is a chance to go to Missile state (if he's not near enough for melee). Because in your Missile state you go straight to See, the animation will be broken (say, he will be on frame B on "See", decide to shoot, goes to "Missile" state, and goes back to "See" - and changes to frame A again).
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England

Re: Monster not working.

Post by Hidden Hands »

krokots wrote:If the monster is not supposed to shoot, you don't have to add Missile state. Or if it's supposed to shoot, remove the "Goto see" line.

Code: Select all

   Missile:
   Melee:
      CCHN EE 8 A_FaceTarget
      CCHN F 8 A_ComboAttack
      Goto See 
BTW if you wan't to know what's happening : if a monster sees player, he goes to See state, and every frame, there is a chance to go to Missile state (if he's not near enough for melee). Because in your Missile state you go straight to See, the animation will be broken (say, he will be on frame B on "See", decide to shoot, goes to "Missile" state, and goes back to "See" - and changes to frame A again).
Thank you for your reply, this has helped a lot. My only issue now, is that the monster seems to hover on the spot. It still doesn't chase me. ?? Also, it seems to be hovering on that spot doing the animation for attacks even when I'm not close to it???
User avatar
krokots
Posts: 272
Joined: Tue Jan 19, 2010 5:07 pm

Re: Monster not working.

Post by krokots »

I'm not sure, because the monster code looks fine to me now (if you deleted the Goto See line in Missile). Only possible idea is to remove FLOATBOB, i think this is supposed to be used only for items, not monsters. You can try to delete FLOATBOB and see if it fixes the problems.

Edit. I see you are using old and obsolete function A_ComboAttack. I think this will not work if you don't provide a missile name in properties or something. Change this to A_CustomComboAttack with some default values.
User avatar
AFADoomer
Posts: 1337
Joined: Tue Jul 15, 2003 4:18 pm

Re: Monster not working.

Post by AFADoomer »

Try setting the Speed property... I'm pretty sure that it defaults to zero.
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England

Re: Monster not working.

Post by Hidden Hands »


I took the liberty of suppluing this video of my monsters behaviour. This is how its acting.... will removing the comboattack or changing the speed fix this?
User avatar
krokots
Posts: 272
Joined: Tue Jan 19, 2010 5:07 pm

Re: Monster not working.

Post by krokots »

I think if you don't specify speed, it uses some default value anyway.

Try these things:
1) Add "Speed 10" or any other speed, just not 0
2) Remove FLOATBOB
3) Change A_ComboAttack to A_CustomComboAttack("BaronBall", 32, 10 * random(1, 8), "baron/melee") just for testing. BTW your monster is supposed to shoot missiles ? Because that's what A_ComboAttack do, if it is away from player, it shoots missiles.
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England

Re: Monster not working.

Post by Hidden Hands »

krokots wrote:I think if you don't specify speed, it uses some default value anyway.

Try these things:
1) Add "Speed 10" or any other speed, just not 0
2) Remove FLOATBOB
3) Change A_ComboAttack to A_CustomComboAttack("BaronBall", 32, 10 * random(1, 8), "baron/melee") just for testing. BTW your monster is supposed to shoot missiles ? Because that's what A_ComboAttack do, if it is away from player, it shoots missiles.
Thank you greatly, you fixed it! It was the speed as you suggested. It works great at speed 10 now. I removed the combo attack too, and made it have a melee only one instead. Thank you!

Return to “Scripting”