HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Quick Help Please! Unit Variables?

11-27-2003, 03:41 AM#1
Dark_Army
I am trying to get a variable to work for an orc unit.

Basicly I am trying to get a unit to be created, then be assigned a unit variable. I want the unit to then move to a location, then die after a few minutes. Here is sort of what I want to do, the unit is called Marugal:

Actions
Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Human\ControlMagic\ControlMagicTarget.mdl
Unit - Create 1 Portal for Neutral Passive at (Center of Portal <gen>) facing 100.00 degrees
Animation - Play (Last created unit)'s birth animation
Set portal = (Last created unit)
Wait 9.00 seconds
Special Effect - Create a special effect at (Center of Portal <gen>) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Special Effect - Create a special effect at (Center of Portal <gen>) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Unit - Create 1 Morugal The Warlock for Neutral Passive at (Center of Portal <gen>) facing 270.00 degrees
Set warlock = (Last created unit)
Wait 2.00 seconds
Unit - Order warlock to Move To (Center of Morugal Rune <gen>)
Wait 3.00 seconds
Unit - Make warlock face 225.00 over 2.00 seconds
Wait 10.00 seconds

Animation - Play portal's death animation
Wait 4.00 seconds
Unit - Remove portal from the game
Wait 101.00 seconds
Unit - Kill warlock

Variable Name: warlock
Variable Type: Unit

The portal variable works just as it should, the portal plays death animation and is removed but the warlock just stands there after he is created. What I am Doing Wrong?
11-27-2003, 03:56 AM#2
Dragon
Hm.. funny. I can't detect any faulty code.
11-27-2003, 04:00 AM#3
FerretDruid
Looks okay to me. Only thing I can think of, is that it may be somehow setting your "warlock" variable to be the portal, or your morugal rune region might be messed up.
11-27-2003, 04:36 AM#4
Dark_Army
Ok, I figured it out. But from that trigger, how would I set it up so that it can't be activated over and over. I am trying to figure out a way to make it say, only work when the warlock is dead. But I can't figure out a way to achieve that =/

Right now unlimited portals can be summoned lol :ggani:
11-27-2003, 05:01 AM#5
Dragon
Make a variable. Call it "WarlockDeadGuyNoPortalSpawnHaha" make its default value 1

Make a condition in your trigger saying "WarlockDeadGuyNoPortalSpawnHaha" equal to 1 true

At the end of your trigger make a action to say Set "WarlockDeadGuyNoPortalSpawnHaha" to 0
11-27-2003, 05:57 AM#6
FerretDruid
A good practice to use for some cinematic triggers (well, for a lot more than just cinematics, but cinematics in particular since they usually should only be run once), is turning off the trigger during it's execution. You can make another trigger to turn it back on again if a certain event happens.

Just put the action Trigger - Turn off (this trigger) as your first action and it will only run once (turning off the trigger this way doesn't stop the rest of the actions from happening, it just stops the trigger from being run again by the same event until the trigger is turned on again). You could make another trigger that says "E / Warlock dies" - "A / Trigger - Turn on (that other trigger)" to turn it back on.
11-27-2003, 06:16 AM#7
Iceybro
I believe this is the perfect case in order to use local variables!
I suggest using this tutorial, it should be useful in helping you understand what local variables are and how you use them.