• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

Random encounters in area

Not open for further replies.
Level 1
Jul 18, 2008
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
Mar 26, 2004
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
Nov 20, 2005
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).
Not open for further replies.