• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Random encounters in area

Status
Not open for further replies.
Level 1
Joined
Jul 18, 2008
Messages
1
I'm making an RPG map with a 'random encounter' system, i.e., in certain predefined areas a player's hero will freeze at random and their screen will center over a small room that acts as a separate "battle area" (a la Pokemon) where their hero will be transported and and a monster will appear. The game will then detect combatants and the combat system will kick in. It will be based off of certain regions that will each have different possible monster tables (difficulty increasing as the map goes along).

My question is this: what would be the most efficient way to implement the random part of it? What I'd like to do is have a trigger that runs a check every 2 seconds with a 20% chance of initiating a battle- so the average rate of battles as long as a hero remains in the region is one every 10 seconds. How would you go about doing this? Is this possible without JASS?
 
Level 16
Joined
Mar 26, 2004
Messages
569
This trigger is improvised, i can't use my WE cause something's wrong with my wc3. (need to reinstall)
  • Events
    • Unit - Unit enters RectX
  • Conditions
    • (Boolean)Unit is inside RectX
    • (Boolean)Battle is equal to False
  • Actions
    • >Do chance triggers<
    • Wait random number between 10 and 15 seconds
    • Trigger - Run (this trigger)
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
I'd have a variable encounter chance rate, where the chance increases as the time since the last encounter increases (meaning they are more evenly distributed).

I'd probably have a single trigger running ever X seconds, and then if/then/else for each of the regions (this could get messy if the number of regions is too high though).
 
Status
Not open for further replies.
Top