Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Lycaon

Question about monster behaviour

Recommended Posts

I've created an actor that throws knives after looking at you for some time. It throws 3 knifes in a row or 3 in a cone at the same time. The problem i have is that it's easy to find a spot where the monster keeps throwing knifes until it completes a sequence of attacks and doesn't realize he's actually hitting a box or a wall. You just make it start shooting and make it so that he hits a box or something, and you get to finnish it off rather quickly. It's supposed to be a unique enemy that gives a good fight. I guess what I would have to do is have him check if the player is in the line of fire each time before he throws, but i don't know how to do it. This is in fact the first monster i created, although using an existin sprite set. Here is the decorate

states
  {
  Spawn:
    REEL E 1 A_Look
   loop
  See:
    REEL A 0 A_JumpIfHealthLower(30, 4)
    REEL AABBCCDD 2 A_Chase
   Goto See
    REEL A 0 A_Jump(32, 1)
    REEL A 0 A_ChangeFlag("Frightened", 1)
    REEL A 0
   Goto See+3
    REEL A 0 A_Jump(128, 1)
   Goto See+5
    REEL AAABBBCCCDDD 2 A_Chase
   Goto See
  Missile:
    REEL E 0 A_JumpIfCloser (150, "Missile2") 
  Missile1:
	REEL A 20 A_FaceTarget
	REEL A 0 A_PlaySound("weapons/kunai")
    REEL A 0 A_CustomMissile("Knife_Throw",28,0,0,0)
    REEL E 2
    REEL A 0 A_PlaySound("weapons/kunai")
	REEL A 20 A_FaceTarget
    REEL A 0 A_CustomMissile("Knife_Throw",28,0,0,0)
	REEL A 0 A_CustomMissile("Knife_Throw",28,0,-6,0)
	REEL A 0 A_CustomMissile("Knife_Throw",28,0,6,0)
    REEL E 2
    REEL A 0 A_PlaySound("weapons/kunai")
	REEL A 20 A_FaceTarget
    REEL A 0 A_CustomMissile("Knife_Throw",28,0,0,0)
	REEL A 0 A_CustomMissile("Knife_Throw",28,0,-6,0)
	REEL A 0 A_CustomMissile("Knife_Throw",28,0,6,0)
    REEL E 2
    REEL E 0 A_CPosRefire
   Goto Missile1
    REEL C 15 A_FaceTarget
    REEL C 1 A_PlaySound("weapons/kunai")
    REEL C 1 A_CustomMissile("Knife_Throw",28,0,0,0)
    REEL E 6 A_FaceTarget
   Goto See
  Missile2:
    REEL E 10 A_FaceTarget
    REEL F 0 bright A_PlaySound("BlackOps/Attack2")
    REEL F 3 bright A_CustomBulletAttack(5,5,4,7,BulletPuff)
    REEL E 2 A_FaceTarget
   Goto Missile
    REEL E 0
   Goto See
  Pain:
    REEL G 3
    REEL G 3 A_Pain
   goto See
  Death:
    REED A 5
    REED B 5 A_Scream
    REED C 5 A_NoBlocking
    REED DEF 5
    REED G -1
   stop
  XDeath:
    REED H 5 A_Scream
    REED K 0 Bright A_SpawnItemEx("BlackOpsGib1", 1, 0, 9, 1, 0, 0, -130, 128)
    REED K 0 Bright A_SpawnItemEx("BlackOpsGib2", 6, 0, 7, 8, 0, 0, -90, 128)
    REED K 0 Bright A_SpawnItemEx("BlackOpsGib3", 5, 0, 6, 3, 0, 0, -80, 128)
    REED K 0 Bright A_SpawnItemEx("BlackOpsGib4", 1, 0, 9, 1, 0, 0,  130, 128)
    REED K 0 Bright A_SpawnItemEx("BlackOpsGib5", 6, 0, 7, 8, 0, 0,  90, 128)
    REED K 0 Bright A_SpawnItemEx("BlackOpsGib6", 5, 0, 6, 3, 0, 0,  80, 128)
    REED I 5
    REED J 5 A_NoBlocking
    REED L 5
    REED M 5
    REED N -1
   stop
  Death.Fire:
    REEB A 3 A_PlaySound("BlackOpsF/Burn")
    REEB B 3 A_CustomMissile("SpawnFire", 0, 0, 0)
    REEB C 3 A_NoBlocking
    REEB D 3 A_CustomMissile("SpawnFire", 0, 0, 0)
    REEB E 3
    REEB F 3 A_CustomMissile("SpawnFire", 0, 0, 0)
    REEB G 3
    REEB H 3 A_CustomMissile("SpawnFire", 0, 0, 0)
    REEB I 3
    REEB J 3 A_CustomMissile("SpawnFire", 0, 0, 0) 
    REEB K 3
    REEB L 3 A_CustomMissile("SpawnFire", 0, 0, 0)
    REEB M 3
    REEB N 3 A_CustomMissile("SpawnFire", 0, 0, 0)
    REEB O 3
    REEB P 3 A_CustomMissile("SpawnFire", 0, 0, 0)
    REEB Q 3
    REEB R 3 A_CustomMissile("SpawnFire", 0, 0, 0)
    REEB S 3
    REEB T 3 A_CustomMissile("SpawnFire", 0, 0, 0)
    REEB W 3
    REEB V -1
   stop
  Raise:
    REED GFEDCBA 3
   goto See
  }
}

Share this post


Link to post
scifista42 said:

Use

http://zdoom.org/wiki/A_MonsterRefire (put it right before each attack, then the monster will abort attack if player is out of sight)

or

http://zdoom.org/wiki/A_JumpIfTargetInLOS (beware, works vice versa than A_MonsterRefire, the jump is performed if the monster CAN see the player)


Thank you, i wouldn't have thought "MonsterRefire" meant that. I thought it was literally just "fire again" lol

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×