In this video Jesse Freeman will teach you how to connect up run away logic for your RPG battle system. You’ll set up the odds and chance for successfully running away in combat and then connect the runaway logic to the close battle window method. Once the player runs away, they will end combat allowing them to fight another day.
- View Offline
- Exercise Files
- [Voiceover] Now it's time for us…to connect up our run action.…Let's open up our battle window…and at the top of the battle window,…we're gonna add a new field.…We're gonna set this up as a range…and inside of the range, we'll set the minimum value…to zero and the maximum value to .9f.…Now let's create a public float,…and we're gonna call this runOdds,…and we're gonna set this equal to .3f.…Now at the bottom of our class,…let's create a new IEnumerator,…and we're gonna call this OnRun.…
Inside of this method, we're gonna hide the actions group.…We'll do this by calling the SetActive method to false.…Now when you run, we'll hide the actions…so that the player can't do anything…until they see if the run was successful or not.…Now let's create a new variable called chance.…And here, we'll set the value to Random.Range…with a minimum value of zero and a maximum value of 1f.…Now let's test to see if our chance…is less than our RunOdds.…
If it is, we're gonna call DisplayMessage,…and we're gonna pass in a string that says…
- Preparing the user interface
- Creating game and message windows
- Building a battle window
- Adding a monster and action buttons
- Creating an actor class
- Adding player and monster attack actions
- Triggering battles from the map
- Ending a battle
- Cleaning up the battle and attack systems
- Rewarding the player
Skill Level Intermediate
1. Preparing the UI
2. Message Window
3. The Battle Window
4. Actor Classes
5. Battle Actions
6. Cleaning Up Combat
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.