Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    2d rpg random encounters?

    Coding
    2
    3
    324
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • poof92
      poof92 last edited by

      I've been working on this rpg for a while and I think I've gotten alot done but I haven't got a clue how to do random enemy encounters by just walking on the ground and ideas perhaps as simple as possible and thank you.

      1 Reply Last reply Reply Quote 0
      • R
        Richard F last edited by

        You could generate a random number each step then check if it was less than a predefined probability to enter a battle. Something like:

        battle = random(100)
        if battle < 5 then
            startBattleFunction()
        endif
        

        This would give an encounter every 20 steps on average. You could play with the numbers until you got an encounter rate that was right for your game.

        1 Reply Last reply Reply Quote 1
        • poof92
          poof92 last edited by

          Thank you I'll give it a try.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post