The Daily Click ::. Forums ::. Klik Coding Help ::. Need help with random enemy attacks
 

Post Reply  Post Oekaki 
 

Posted By Message

Jay Walker



Registered
  02/12/2005
Points
  8
3rd December, 2005 at 12:50:10 -

In MMF, I have an enemy that has 3 different attacks. How do I create a random number generator or something similar so that the enemy will attack with one of the three at random with no set pattern.

I also need help with enemy movement. I want it so that when my character touches an active, then the enemy will start moving toward the character, and when it touches the character, it should stop and start an attack animations. Please help. Thanks in advance.

Image Edited by the Author.

 
Dance Avatar Dance!

David Newton (DavidN)

Invisible

Registered
  27/10/2002
Points
  8322

Honored Admin Alumnus
3rd December, 2005 at 14:19:48 -

random is the "random" expression in MMF - it generates a random number between 0 and n-1. To get a random attack, set a counter or alterable value to random(3) when an enemy is to attack, and then perform an attack based on whether that number was 0, 1 or 2.

I'm not sure how to help with the enemy movement, because you've pretty much described how to code it in your description!

 
http://www.davidn.co.nr - Games, music, living in America

Mr.Mean



Registered
  22/08/2003
Points
  925
3rd December, 2005 at 14:29:58 -

the first question is solved by:
always- set "A value" to "random(3)"
then
"player" colide with "enemy"+ "A value"=0 set "enemy animation attack1"
"player" colide with "enemy"+ "A value"=1 set "enemy animation attack2"
"player" colide with "enemy"+ "A value"=2 set "enemy animation attack3"

i leave the second question to someone who is better at describing programing...

 
Some people are born to early, but I'm glad, I was born on my birthday
http://joNickart.tk

Jay Walker



Registered
  02/12/2005
Points
  8
3rd December, 2005 at 14:31:49 -

Thank you so much

Image Edited by the Author.

 
Dance Avatar Dance!

Mr.Mean



Registered
  22/08/2003
Points
  925
3rd December, 2005 at 14:34:23 -

he was not many seconds before me

 
Some people are born to early, but I'm glad, I was born on my birthday
http://joNickart.tk
   

Post Reply



 



Advertisement

Worth A Click