HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Animate Dead Trigger

04-29-2004, 08:55 PM#1
Dp1983
Ok, I'm trying to create a spell so that one of my heroes (necromancer) can raise a dead unit until it dies and the amount of units that can be raised, not at one time but all together, is based on the level of the hero. I'm trying to mimic the Animate Dead of some Rom based pk muds.

Ok so I changed the spell to raise 1 unit at a time and set the duration to hero 0, and dur 0 to make the unit last until it dies. What is hero dur for this spell by the way? Can you animate hero corpses?

I couldn't figure out how to limit the amount of corpses that could be raised until I started messing with triggers. I was going to post here but I decided to try and figure it out on my own. This is what I came up with so far.

Spell Animate Dead(based off of animate dead):

Event:

Unit - A unit owned by (Owner of Necromancer 0124 <gen>) Spawns a summoned unit

Condition:

(Number of units in (Units owned by (Owner of Necromancer 0124 <gen>))) Equal to 3

---This was all I could think of to check the amount of dead units he has raised. In this case I only want him to be able to have 2 zombies.}---

Actions:

Unit - Kill (Summoned unit)



Ok I think that will work but then I got greedy. Then I wanted the amount of zombies that were able to be raised based on the heros level. I can't figure out how to do it. I thought I had seen a Hero level comparison Condition or Event or something somwhere but I couldn't find it.

So am I doing this right so far and how can I continue to complete this spell?

Thank you for your help.
04-29-2004, 09:00 PM#2
ThyFlame
I think theres another way, but neh.


Everytime the spell is learned, set the set an integer variable array + 1.

for each integer A 1 to integer variable array
Create 1 dummy unit with your raise dead spell
set animation - vertex coloring to 100% transparency for last created unit
order last created unit to do [base of your spell]
add last created unit to tempRaisedDeath
wait 1 seconds
pick all units in tempRaisedDeath and do
remove - picked unit from the game



That's it in a nutshell. Anything you don't understand?
04-29-2004, 09:28 PM#3
Dp1983
That's it in a nutshell. Anything you don't understand?[/quote]

Hmm, I haven't dealt with anything that required me to do all that before, dummy units, arrays and what not. Probably be good to learn but I was hoping that it would be easier heh.

So there is no way for me to

Unit create summoned unit

If player hero level <= 10 and
units under control of player of unit X = 3

kill summoned unit


and then just create a new trigger for each hero level increment that I want.

Thanks your help is appreciated.

edit: Also I wanted the ability to have to be purchased only once and then after that only hero level affected the amount of zombies raised. If I understand your workaround correctly I think its based on the level of the skill. Sorry if I wasn't clear. Most likely I just dont understand properly.

Thanks again.

Update:

Upon testing of my first trigger that limits the amount of dead that can be animated that doesn't even work. So I tried some things and I can't get it to work.

Here is where I am stuck right now:

Trigger 1(Sets up zombie unit group):

Event:

Unit - A unit owned by (Owner of Necromancer 0124 <gen>) Spawns a summoned unit

Action:

Unit Group - Add (Summoned unit) to NecoPlayerZombies

Trigger 2(kills zombie if too many)

Event:

Unit - A unit owned by (Owner of Necromancer 0124 <gen>) Spawns a summoned unit

Condition:

(Number of units in NecoPlayerZombies) Equal to 3

Actions:

Unit - Kill (Summoned unit)
Unit Group - Remove (Summoned unit) from NecoPlayerZombies



What am I doing wrong?

Thanks.
04-30-2004, 02:19 AM#4
Shimrra
Try these triggers:
Code:
TheTrigger
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Animate Dead 
    Actions
        Set OwnerofCaster = (Owner of (Casting unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Integer Greater than or equal to (Hero level of (Casting unit))
            Then - Actions
                Do nothing
            Else - Actions
                Set Integer = (Integer + 1)
                Unit - Create 1 Zombie for OwnerofCaster at ((Position of (Casting unit)) offset by 150.00 towards 270.00 degrees) facing Default building facing degrees
                Special Effect - Create a special effect at (Position of (Last created unit)) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl

And this one:


Code:
Death
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Zombie
    Actions
        Set Integer = (Integer - 1)

To make this work, you must have a player variable (OwnerofCaster in this trigger) and an integer variable (Integer in this trigger). The first trigger will create a zombie as long as the integer is not greater then or equal to the caster's level. When it creates the zombie, the trigger adds one to the integer. The second trigger makes it so that when a zombie dies, it subtracts one from the integer, allowing you to create an additional zombie. You can replace the ability with whatever ability you see fit as well as the zombie (just make sure to replace all the instances of the zombie in the triggers) Also note that this will only work for one player. Tell me if you need it to work for multiple players and I'll rearrange the trigger to allow them. I hope this helps you!
-Shimrra
04-30-2004, 03:04 AM#5
Dp1983
Ok, I'm doing this right now. This looks like it can help me do what I want.

I got to a point and I noticed a few things.

One the player variable. I guess I might need it for multiple players like you said. The variable makes me specify the player color. Only one player will be using the casting unit but that player isn't determined before the map loads. edit: Well he is but he changes teams based on a trigger. How can I do this?

Also, I mentioned zombies but having started on these great triggers you gave me it seems that you thought I wanted the actual unit, I meant the product of using the raise dead skill. So I want the skill to still act in the same way that it does, in that raising a corpse will create a "zombie" with the stats of the dead monster not an actual zombie unit. But the amount of "zombies" that can be obtained simultaneously is based on the level of the hero. Although, not neccessarly in that 1 level = 1 zombie, which should be easy for me to change with your trigger. If I am way off on my interpretation of this please forgive me. edit: Perhaps the special affect does something to the zombie unit? Guess I should just test it out before I talk heh.. didn't want to miss you though.

Thank you for taking your time in helping me with this.

Update:

Ok, I recreated your trigger and this is what I found.

The spell creates zombies.. which is cool I like that. I might use this if I can find a way. However, I was relying on the zombie having the stats of the dead unit for balance reasons. Yes, I could create custom zombies but I wanted the power of the zombie to be directly linked to that of the monster.. a zombie of the monster if you will. This is important to me because I need the zombies to be easily scalable in power so that the skill is still useful later on.

So just to restate. I want to limit the amount of raised beings animate dead will raise in total. Right now I have it set in the editor to raise 1 zombie at a time. Now lets say my hero is only of a level where I want him to be able to raise amd have control over 3 zombies at a time. Then he tries to use animate dead again. I want it to either not allow it, or more likely allow it and then get rid of the summoned unit(if thats what animate dead uses summoned units?) and then display a message saying your not powerful enough to control another undead being or some such.
04-30-2004, 07:10 PM#6
Shimrra
I'll get to work and make a trigger that will raise a corpse instead of making a zombie. The player variable is set for whoever happens to cast the spell, so as long as only player can use the spell, everything will work, no matter what team he's\she's on. Also, I'll make it so it'll kill a "zombie" instead of just doing nothing.
04-30-2004, 07:24 PM#7
Dp1983
Wow I appreciate that. Wish I could figure this out on my own. I think I can learn a lot from your trigger when it's finished though. Thank you.
04-30-2004, 08:43 PM#8
Shimrra
OK... This trigger has become a alot more complex... You will need the following variables for this trigger:

- UnitVariable (Same name in trigger)
- UnitTypeVariable (Same name in trigger)
- PlayerVariable (OwnerofCaster in trigger)
- PlayerGroupVariable (OwnerofCaster2 in trigger)
- IntegerVariable (Integer in trigger)
- UnitGroupVariable

Here's the first trigger:
Code:
TheTrigger
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Animate Dead 
    Actions
        Set OwnerofCaster = (Owner of (Casting unit))
        Set OwnerofCaster2 = (Player group(OwnerofCaster))
        Unit Group - Pick every unit in (Units within 900.00 of (Position of (Casting unit)) matching (((Matching unit) is dead) Equal to True)) and do (Actions)
            Loop - Actions
                Unit Group - Add (Picked unit) to UnitGroupVariable
        Game - Display to (All players) the text: (String((Number of units in UnitGroupVariable)))
        Game - Display to (All players) the text: (String((Unit-type of (Casting unit))))
        Game - Display to (All players) the text: (String(Integer))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Integer Greater than or equal to (Hero level of (Casting unit))
            Then - Actions
                Game - Display to OwnerofCaster2 the text: No usable corpses a...
            Else - Actions
                Set Integer = (Integer + 1)
                Unit Group - Pick every unit in (Random 1 units from UnitGroupVariable) and do (Set UnitVariable = (Picked unit))
                Set UnitTypeVariable = (Unit-type of UnitVariable)
                Game - Display to (All players) the text: (String(UnitTypeVariable))
                Special Effect - Create a special effect at (Position of UnitVariable) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                Unit - Create 1 UnitTypeVariable for OwnerofCaster at (Position of UnitVariable) facing (Position of UnitVariable)
                Animation - Change (Last created unit)'s vertex coloring to (50.00%, 10.00%, 10.00%) with 0.00% transparency
                Unit - Set the custom value of (Last created unit) to 1
                Unit - Make (Last created unit) Explode on death
                Unit - Disable supply usage for (Last created unit)
                Unit - Remove UnitVariable from the game
        Unit Group - Remove all units from UnitGroupVariable

And trigger two...

Code:
Death
    Events
        Unit - A unit Dies
    Conditions
        (Custom value of (Dying unit)) Equal to 1
    Actions
        Set Integer = (Integer - 1)

Some things to remember are to make sure the custom value used in this trigger does not equal the same thing as any others. (If you don't have any custom values, then ignore this part) If you are using a custom value of 1 for another perpose, just change it to something else.

Hope this is the right thing!

-Shimrra
05-01-2004, 12:07 AM#9
Dp1983
This is exactly what I was looking for. Very nicely done. Thank you.

A few questions.

1. Can I remove the Game Display commands that refer to strings without affecting the trigger? Having players see wierd numbers they don't understand will probably take away from the expierience.

2. I can't base this off animate dead because I couldn't figure out a way to stop animate dead from raising units(lowest it will go is 1). Do you know a way? Right now I have it based off of frost armor but I have to cast it on myself to get it to work.. not exactly what I am looking for. Perhaps a better spell to base it off of? I can't think of any. Or perhaps a workaround?


With regards to your trigger though... just awesome.
05-01-2004, 12:58 AM#10
linkmaster23
Use anything that requires no target. WarStomp, ThunderClap... ETC.
05-01-2004, 02:56 AM#11
Shimrra
You can delete the strings without harming the triggers. The only reason they are there is because I was using them for glitch testing and forgot to remove them. As for the spell, create a spell that uses no target, like Fan of Knives. Once the spell is created, make it do absolutely nothing. (Delete the effects, damage, et cetera) You can use Animate Dead, however, you must hold down shift whilst you double click on the Number of Units raised option. This will allow you to put zero in for a number. And thanks for the complements on my trigger!

-Shimrra
05-01-2004, 03:08 AM#12
linkmaster23
:), I'm just browsing the forums, looking for stuff to put in my tutorial... >.<, isn't going so well. :P Anyways, Shimrra, get on MSN please.