User login

Navigation

Poll

I downloaded the ETQW demo and....
...I'm too busy playing for polls.
14%
...it's awesome.
43%
...it's okay, I expected better.
14%
...I'm lost in the valley, anyone have a map?
0%
...my machine won't run it. :-(
29%
Total votes: 7

Who's online

There are currently 0 users and 28 guests online.

Welcome to RUST | Gamedesign.net

Morphing A Hero (Or Learning To Use Triggers)

Submitted by RaVenous on Sun, 2004-11-14 17:19.

Introduction

The Metamorphosis skill is one way you can morph a hero into something else. However, you're stuck with having to use the same stats and primary attribute, as well as the same skills (else the spell won't work and Warcraft III will error out).
In this tutorial, I will show you how to create a skill similiar to Metamorphosis that will use triggers to do exactly what we want the ability to do; using a different model, stats, and skills. Plus, not only will the ability transform the hero into a different unit, but it will do so in a cinematic fashion by playing animations. Also, as you read through this tutorial and follow along, you will gain a better understanding as to how triggers work as well as how to set up triggers.


How To Do It

The first thing you must do is set up a hero. I'll leave that part up to you. For this tutorial, I will use
    Hero1
as the name.
Next, create a new spell (doesn't matter what it is based off of). Set the spell up so that it does nothing when clicked; only has text that tells you that this skill will morph the hero (and set it to however many levels you want; for this tutorial, I'm going to make the skill 3 levels). I'll name the new skill:
    Morph
Now, I'll give my hero the new ability.
Finally, create a new unit that you want the hero to morph into (a sheep, a human, a princess, whatever). Since I am making my skill 3 levels, I will copy and paste this new unit 2 times so that I have a total of 3 units (you can make them heroes or not; if they are not heroes, then they will not get the items from the original hero, but they will get them if they are heroes). Then, I'll make each one a bit stronger than the last. I'll use
    Morph1
    Morph2
    Morph3
for the names.

Now, to put together all the triggers that will make this spell work properly.
In the Trigger Editor, create a new trigger. Mine will be called
    Morph
just like the skill. Now, select your new trigger, and click on this button ( ) or press Ctrl+E to create a new "Event". A dialog box will appear with 2 drop-down boxes.



Click on the smaller box and select "Unit". Next, click on the bigger box and select "Player-Owned Unit Event". It should say this in the dialog box:
    A unit owned by Player 1 (Red) Dies
Now, you should be able to click on "Player 1 (Red)" and "Dies". Click on "Dies" and select "Begins casting an ability". You should now see this:
    A unit owned by Player 1 (Red) Begins casting an ability
Now click the "OK" button.
Now we have set up the trigger to function whenever a unit owned by Player 1 casts an ability; however, this could be any ability, but we want only the "Morph" ability to turn on this trigger.

So, now we need to set up some conditions. First, click on this button ( ) or just press Ctrl+D. A diablog box will appear that looks just like the last one we saw. Select the bigger drop-down box and click on "And, Multiple Conditions", then click "OK". Once that is done, click on the text that says "Conditions" underneath the "And - All (Conditions) are true" text. Right-click and select "New event" or click on this button ( ) or press Ctrl+D. The same dialog box appears. Select "Integer Comparison" from the big drop-down box. You should now see this in the dialog box:
    (Number of units in (Units in (Playable map area))) Equal to 0
First, click on the number 0. Set the new value to 1 and press "OK". Now click on "(Number of units in (Units in (Playable map Area)))". This dialog box will pop up:



From the currently selected drop-down box, click on "Unit - Level Of Ability For Unit". You should see this:
    Level of Ability for (Triggering Unit)
Click on "Ability". Now, in the middle section of the new dialog box, click on the radio button next to the word "Function" and press "OK". Then, hit "OK" again. Here's what you should have:
    (Level of (Ability being cast) for (Triggering unit)) Equal to 1
Click "OK" one last time.
Now, create a second condition under our multiple conditions box by doing what I described earlier. Once you have done that, select "Ability Comparison". You should see this:
    (Ability being cast) Equal to Animate Dead
Click on "Animate Dead". In the bottom section of the new dialog box, you'll see a list of skills. First, select "Custom" from the second drop-down menu. Then click on your custom ability (in this case, "Morph"). Click "OK". Here's what you get:
    (Ability being cast) Equal to Morph
Now that our trigger is set up so that it will only operate when our custom spell is cast, it's time to set up the trigger to do what we want it to; that is, morph the hero into a different unit.
At this point all the dialog boxes will still look like the ones we have seen earlier.
Alright... To start off, first we need to set up some variables. Click on this button ( ) or just press Ctrl+b. In the following window, click on the circled button to create a new variable.



Now, name the new variable
    HeroMorph
and in the drop-down box, select "Unit". Do the same thing to create 2 more variables named
    HeroCache1
    HeroCache2
and make both of them "Unit" variable types as well. Hit "OK" and you should be back at the main trigger editing window.

The next thing to do is start creating your "Action" commands. To do this, simply right-click and select "New Action" or click on this button ( ) or press Ctrl+R. The same window you should already be familiar with will pop up. From the small drop-down menu select "-General", and then from the large drop-down menu select "Set Variable". First click on the red text labeled "Variable". Select this variable:
    HeroCache1
and hit "OK". Now click on value and set it to "Event Response - Triggering Unit" from the drop-down menu that is currently selected. Hit "OK" and then hit "OK" again.
What we have just done is set a variable equal to the original hero unit; that way we can save the unit (with all of its abilities, items, and stats) and reload it again later.
Now, create another "Action". This time, in the small drop-down menu, select "Game Cache". After that, just click on the blue text labeled "MapName.w3v" and set the name to whatever you like. For this tutorial, I used the name "map01.w3v" (which is also the name of the map itself). Now click "OK" twice.
Create another "Action". From the small drop-down box, click on "Game Cache" again. In the big drop-down menu, click on "Store Unit". Now, click on the red text labeled "Unit". In the new window, click on the middle radio button next to the "Variable" text. The variable we want to use is already selected for us, so hit "OK". Now click on "Label". Give it a value of whatever; for this tutorial, I just used "Hero", but you can use the hero's name or classification or whatever you like. Now hit "OK" twice and we're done setting that up.

Now, to make the spell look cool, we'll use a special effect while the unit is morphing. I just used the "Feral Spirit" special effect (it's the cloud that you see when feral spirits are summoned using the "Feral Spirit" skill). You can use whichever effect you like though.
Alright, first thing is, of course, create a new "Action". From the small menu, select "Special Effect", and from the larger menu select "Create Special Effect on Unit".
First, let's decide where we want the special effect to appear at on the unit. Click on the blue text labeled "overhead".

Orc Peon
"Here is a list of all the attachment points and modifiers: Attachment Points And Modifiers."

Once you've entered in the value you want, hit "OK" (for this tutorial, I used the "chest" value).
Next click on the blue text labeled "Abilities\Spells\Other\TalkToMe\TalkToMe.mdl". In the new window, click on the "Choose Model" button. Once you've chosen the effect (Feral Spirit for this tutorial), click "OK" 3 times.
To make sure that the special effect plays at the same time that the unit morphs, create a new "Action" and in the large drop-down menu, select "Wait". Click on the "2.00" and enter the number "0.50"; that is the number I found that causes the trigger to wait long enough so that the unit morphs and the special effect plays at the same.

Now that that is done, let's make the unit actually morph.
At this point, you should be pretty familiar with how the trigger system works. So, to make things simpler, I will just tell you what you need to change or set certain things to.
Create a new "Action".
Small drop-down menu: "Unit"
Large drop-down menu: "Replace"
Click on the blue text labeled "Footman". In the new window, find your custom unit (for this tutorial, that would be "Morph1"). Click "OK" twice. Now our hero with "morph" into the unit "Morph1".
Now we need to set a variable to the morphed unit so that we can have the unit selected.
Create a new "Action".
Small drop-down menu: "-General"
Large drop-down menu: "Set Variable"
Now, set the variable "HeroMorph" equal to "Last Replaced Unit".

Create a new "Action".
Small drop-down menu: "Selection"
Large drop-down menu: "Select Unit For Player:
Click on the blue text labeled "(Triggering Unit)". In the new window, select the "Variable" radio button and click on "HeroMorph" from the drop-down menu next to it. Click "OK" twice.

Alright. So far, we have a trigger set up so that is will morph the unit and play a special effect at the same time and it will also select the morphed unit for the player. Now it's time to set the time limit that the unit is morphed for and the "Actions" that will morph the unit back to its original state.

Create a new "Action".
Small drop-down menu: "-General"
Large drop-down menu: "Wait"
Click on the number "2.00" and change it to a number value that you would like the duration of the morph to be (for this tutorial, I set the value to 45, which means that after 45 seconds, the nhero will return to normal).

Now, click on the first special effects "Action" and press Ctrl+C (to copy it). Now, paste it. Make sure the "Action" you just pasted is at the bottom (you can move it by clicking and holding and then dragging it down with the mouse). Do the same thing and copy and paste the "Wait - 0.50 seconds" "Action" (again making sure it is at the bottom).

Now, it's time to make the "Action" that will restore the hero back to their original form. Create a new "Action".
Small drop-down menu: "Game Cache"
Large drop-down menu: "Restore Unit Facing Angle"
First, click on "Label". Now type in the label you gave your hero earlier (in this tutorial, I used "Hero" as the label). Click "OK".
Next, click on the blue text called "(Center of (Playable map area))". From the selected drop-down box, click on "Unit - Position Of Unit". Now, click on "(Triggering Unit)". Click on the variable radio button and select the variable "HeroMorph". Click "OK" 3 times.

Create a new "Action". Set the variable "HeroCache2" equal to "Last Restored Unit".

Now we take out the morphed form of the hero. Create a new "Action".
Small drop-down menu: "Unit"
Large drop-dwon menu: "Remove"
Click on "(Triggering Unit)" and select the variable radio button. From the drop-down menu, select the "HeroMorph" variable. Click "OK" twice.

And finally, create 1 last "Action".
Small drop-down menu: "Selection"
Large drop-down menu: "Select Unit For Player"
Click on "(Triggering Unit)" and select the variable radio button. From the drop-down menu, select the "HeroCache2" variable. Click "OK" twice.

Now we are done! If you decided to make the ability more than 1 level, you can copy the trigger you just made. Then, all you have to do is change one of the conditions to say:
    (Level of (Ability being cast) for (Triggering unit)) Equal to 1
Just note that the only thing you change is the number (to match the level). The other thing you'll need to change is the "Action" that changes the hero:
    Unit - Replace (Triggering unit) with a Morph 1 using The old unit's relative life and mana
For that "Action" all you would do is change "Morph 1" to the respective morphed form unit.
Here is what the complete product will look like (for skill level 1):
Orc Peon
"Some steps in this tutorial can be (and have been) simplified by copying and pasting. You can use copying and pasting to create multiple "Actions" (or "Events" or "Conditions") that do the same thing or do similiar things but with a couple different settings. Experiment more to get a better understanding of copying/pasting."


Wrap Up

At the time of this tutorial being compiled, I was unable to figure out a way to make the skill still recharging when the unit morphed back to normal. So, as soon as the unit returns to normal, the skill can be used again (there's no delay from cooldown).
I'm pretty sure that certain items that are used (like tomes) won't apply to the hero in the hero's original form.
Items picked up by the hero in their morphed form do not stay when the hero returns to normal (working on a fix).


Resources Used

Attachment Points And Modifiers
RUST | Gamedesign.net is your source for all the latest game-editing news and tutorials. If you are seeing this message, this means that you are using a browser that does not support CSS. Please upgrade your browser and enjoy your stay at RUST and if you have any questions, comments, or suggestions, please contact a site administrator.