In this video Jesse Freeman will teach you how to reward the player for defeating a monster in combat. You’ll learn how to randomly choose a gold reward amount from the monster’s template, apply that value to the player and message it at the end of combat. You’ll also wire up the game windows and complete the flow of the RPG with a start, game and game over screen flow.
- [Voiceover] Now we're ready to do the last two things…to clean up our entire battle system.…The first thing we're gonna do is reward the player…for defeating the monster by giving them gold.…Let's open up our Battle window.…Now let's scroll down to the bottom,…and go to our OnBattleOver method.…The first thing we're gonna do here…is cut the DisplayMessage…and paste it above the yield return.…Then, above where we display our message,…let's go ahead and add a new variable…to store the amount of gold we're gonna give our player.…
We'll call this variable gold…and we're gonna set it equal to Random.Range(0,…and for the max, we're gonna set it…to the monster's gold value.…Next we're gonna test to see…if gold is greater than zero and the player is alive.…If it is, we're gonna modify the message above.…Here we'll simply type out message +=…and we'll start with a string and use an empty space.…
Then we're gonna add the player.name…and we'll add another string starting with a space…receives ended with a space.…Add our gold variable, and then we'll end it with a string…
- 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.