- Joined
- Jun 22, 2009
- Messages
- 18
Reviving Heroes at a Changeable Region
Table of Contents
Table of Contents |
Top Table of Contents Introduction What You Need Creating the Regions and Triggers Conclusion |
Introduction:
Hi, and welcome to my tutorial. This is my first tutorial, so sorry if it's not too great.

I looked through the tutorials a few times and I never saw a hero revival system (or at least one that revives in this manner), so I thought I might give tutorial-making a try

If you have ever played an RPG or ORPG like Twilight's Eve ORPG, you might know what I'm talking about.
Basically, this tutorial will teach you how to set a region for a hero to respawn in, but when a hero enters another "respawnable" region (checkpoint, anyone?

This tutorial uses custom scripts in the triggers, but they are only used to prevent memory leaks (if you have no idea I'm talking about, check out Ralle's tutorial: Basic Memory Leaks; however, knowledge of memory leaks is not needed for this.)
What you need:
- Basic World Editor knowledge
- World Editor (duh)
Creating the Regions and Triggers:
Creating the Regions:
What we will do in this section is very simple. Open up your map and press the [R] key to open the Region Palette. Create a region wherever you want the heroes to be able to respawn. You don't have to do this, but I like placing a Resurrection Stone and/or an Energy Field in/around the region. Create as many as you like (Although the more you create, the longer it will take later


If you are creating a map where your main unit is a hero and your hero spawns somewhere other than that very location upon selection, you may want to have the hero spawn at the first respawn region (a.k.a. checkpoint.)
Creating the Triggers:
This is the hardest part. Hopefully, it's not too hard to understand.
First, I will explain the variables that are needed.
Variable Name | Variable Type | Array? (size) | Initial Value |
loc* | Point | No | - None - |
Player_Group* | Player Group | Yes (1) | Empty Player Group |
Respawn_Region* | Region | Yes (1) | - None - |
unit* | Unit | Yes (1) | - None - |
*Names can be anything you want, but these are what I will be using in the triggers.
Now, the triggers:
When you pick your hero in your map, you will need to add an extra line to it. This is:
-
Set unit[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
-
Actions
-
Set loc = (Center of spawn <gen>)
-
Unit - Remove (Triggering unit) from the game
-
Unit - Create 1 Paladin for Player 1 (Red) at loc facing Default building facing degrees
-
Set unit[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
-
Camera - Pan camera for Player 1 (Red) to loc over 1.00 seconds
-
Custom script: call RemoveLocation(udg_loc)
-
Now, let's look at the Initalization:
-
Initalization
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
-
Set Respawn_Region[(Player number of (Picked player))] = Respawn1 <gen>
-
Set Player_Group[(Player number of (Picked player))] = (Player group((Picked player)))
-
-
-
-
-
Events
-
Map initialization
-
-
Conditions

Now for the actions:
-
Actions
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
-
-
This also does the actions for players like Player 12 (Brown). While, as far as I know, this does not change the outcome, you could change it to (All players matching (((Picked player) controller) equal to User) to be more precise. But it's your map, so do as you wish
.

-
Set Respawn_Region[(Player number of (Picked player))] = Respawn1 <gen>
-
Set Player_Group[(Player number of (Picked player))] = (Player group((Picked player)))
Now, we will create the trigger that sets or changes the respawn region for a hero:
-
Enter Region 1
-
Events
-
Unit - A unit enters Respawn1 <gen>
-
-
Conditions
-
((Owner of (Triggering unit)) controller) Equal to User
-
-
Actions
-
Set Respawn_Region[(Player number of (Owner of (Triggering unit)))] = Respawn1 <gen>
-
Game - Display to Player_Group[(Player number of (Owner of (Triggering unit)))] the text: Your Revival Point ...
-
-
-
Events
-
Unit - A unit enters Respawn1 <gen>
-
-
Conditions
-
((Owner of (Triggering unit)) controller) Equal to User
-
-
Actions
-
Set Respawn_Region[(Player number of (Owner of (Triggering unit)))] = Respawn1 <gen>
-
-
Game - Display to Player_Group[(Player number of (Owner of (Triggering unit)))] the text: Your Revival Point ...
Now, we just Copy and Paste that trigger and change the regions:
-
Enter Region 2
-
Events
-
Unit - A unit enters Respawn2 <gen>
-
-
Conditions
-
((Owner of (Triggering unit)) controller) Equal to User
-
-
Actions
-
Set Respawn_Region[(Player number of (Owner of (Triggering unit)))] = Respawn2 <gen>
-
Game - Display to Player_Group[(Player number of (Owner of (Triggering unit)))] the text: Your Revival Point ...
-
-
Finally, the Respawn trigger:
-
Revive
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
((Triggering unit) is A Hero) Equal to True
-
((Owner of (Triggering unit)) controller) Equal to User
-
-
Actions
-
Wait ((Real((Hero level of unit[(Player number of (Owner of (Triggering unit)))]))) x 5.00) seconds
-
Set loc = (Random point in Respawn_Region[(Player number of (Owner of (Triggering unit)))])
-
Hero - Instantly revive (Triggering unit) at loc, Hide revival graphics
-
Custom script: call RemoveLocation(udg_loc)
-
-
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
((Triggering unit) is A Hero) Equal to True
-
((Owner of (Triggering unit)) controller) Equal to User
-
-
Actions
-
Wait ((Real((Hero level of unit[(Player number of (Owner of (Triggering unit)))]))) x 5.00) seconds
-
-
Set loc = (Random point in Respawn_Region[(Player number of (Owner of (Triggering unit)))])
-
Hero - Instantly revive (Triggering unit) at loc, Hide revival graphics

And finally:
-
Custom script: call RemoveLocation(udg_loc)
Conclusion:
Well, that concludes my tutorial. I hope it didn't have too many mistakes and wasn't too hard to understand. Please correct me where I'm wrong and offer constructive criticism instead of flaming

- 3.23.2010 - Created tutorial, fixed table so it actually was a table, added the changelog and credits, and created Table of Contents
- 3.24.2010 Changed "Dying unit" and "Entering unit" to Triggering unit
Me (dOT145) for creating tutorial 
The makers of Twilight's Eve ORPG (don't their names) for not only a great ORPG but I also got the idea to do this from their map.

The makers of Twilight's Eve ORPG (don't their names) for not only a great ORPG but I also got the idea to do this from their map.
I have included a map to help you, if you need it. It is in the attachments.
--dOT145
Attachments
Last edited: