Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

random enemy encounter

hi there again
i was wondering if someone could help me out by making a random battle script.
i dont really know how to explain it very well so here is what i want to happen...
in my dungeons in my game i have monsters walking around, i have them set to follow you, but when they touch you it goes into a battle.. that all works good right now.. but what i want is to have it choose a monster group at random out of the three that i made for the cave.. this way i dont have to set all the battles.. and it would be predictable... the player would be able to prepare for the exact monster as it is right now.. if they get gameover they know what to expect when they come back through..

thanx
 

Jason

Awesome Bro

You should just make a variable for this that picks a random number between 1 and 3 (You said you had three), and for each one make it start battle with a different set of troops.

Hope I helped !
 
Yeah, you don't really need a script for this. As jbrist said, you must make an event which chooses a random number between 1 and 3, and then you have to fork the conditions for each possible outcome of the variable.
 
im sorry i really have no idea what im doing with variables.. could you please explain how to set this up.. all i could figure out is this line
Code:
<>Variable: [0001: Cave Of Spirits Battles] = Random (1,3)
yeah.... after that im stuck.. i dont get the whole forking the conditions or whatever...
 
This is amazing...Have people really forgotten how to event these days? =_=

Anyways, how it works is like this.

http://i28.photobucket.com/albums/c206/ ... alcode.png[/img]

Copy the conditional branch twice and change the variable numbers and enemy groups. That's all there is to it. Ignore the EXP code. That's not needed.

Edit: Now that I think about it. it would be better to remove the erase event from the end of the code and put it inside the end of the victory condition. The way it is now, the event will erase when you escape as well. Oops.
 
oh i see, i guess if i spent enough time looking around i would have figured that out... i never really spent any time using variables... i consider myself a decent eventer, i can usually do anything in events that i need.. just using switches and junk... but i thought that since it was brought up i would try to learn how to use variables... thanx everyone it all works great.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top