HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spell Problems

03-03-2009, 06:21 AM#1
dabest2503
Trigger:
Life Essence
Collapse Events
Unit - A unit Dies
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units within 800.00 of (Position of (Dying unit)) matching (((((Matching unit) is alive) Equal to True) and ((Level of Invulnerable (Neutral) for (Matching unit)) Equal to 0)) and ((((Matching unit) belongs to an ally of (Owner of (Dying unit))) Equal to True and do (Actions)
Collapse Loop - Actions
Set TempUnit = (Picked unit)
Unit - Create 1 Dummy Caster for (Owner of TempUnit) at (Position of (Dying unit)) facing Default building facing degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Unit - Add Healing Wave to (Last created unit)
Unit - Set level of Healing Wave for (Last created unit) to (Level of Life Essence for TempUnit)
Unit - Order (Last created unit) to Orc Shadow Hunter - Healing Wave TempUnit

This spell is supposed to create a dummy unit that heals TempUnit, in this case, an ally of the dying unit. The spell works normally when an ally of a unit with the ability Life Essence dies. However, whenever the same unit with the ability gets attacked, this trigger runs and heals TempUnit, and the origin of the healing waves come from the position of already dead allies. Any suggestions?

Trigger:
Soul Steal
Collapse Events
Unit - A unit Dies
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
(Level of Soul Steal for PlayerHero[(Player number of (Owner of (Killing unit)))]) Greater than or equal to 1
Collapse Then - Actions
Unit - Set life of PlayerHero[(Player number of (Owner of (Killing unit)))] to ((Life of PlayerHero[(Player number of (Owner of (Killing unit)))]) + (40.00 + ((Real((Level of Soul Steal for PlayerHero[(Player number of (Owner of (Killing unit)))]))) x 30.00)))
Unit - Set mana of PlayerHero[(Player number of (Owner of (Killing unit)))] to ((Mana of PlayerHero[(Player number of (Owner of (Killing unit)))]) + (15.00 + (15.00 x (Real((Level of Soul Steal for PlayerHero[(Player number of (Owner of (Killing unit)))]))))))
Unit - Create 1 Soul Steal Target Art for (Owner of PlayerHero[(Player number of (Owner of (Killing unit)))]) at (Position of (Dying unit)) facing Default building facing degrees
Unit - Order (Last created unit) to Attack Once PlayerHero[(Player number of (Owner of (Killing unit)))]
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Else - Actions

Another spell with the event "A unit dies". Same problem as above, but this trigger runs forever the moment a unit gets killed by a unit with the ability "Soul Steal". It seems that once a "Soul Steal Target Art" is a unit that will attack the unit with the ability Soul Steal and somehow, less than a second after it attacks, "Soul Steal Target Art" spawns and attacks the unit.

Is my triggering wrong, or is this a bug?
03-03-2009, 08:45 AM#2
Blacktastic
Your first trigger doesn't make much sense to me honestly... you arn't even checking for a hero that has your Life Essence ability o.O.

Also, Position of (whatever) leaks. Make a variable location called TempPoint and set it equal to those positions. Then after you are done with it pull up CustomScript and type this in [thumbnail]call RemoveLocation(udg_TempPoint)[/thumbnail]. That will prevent your locations from leaking.

As for your second trigger, do you have 2 heroes on opposite sides that both have this ability?
03-03-2009, 09:15 AM#3
ShadowWolf
He leaks more than just a location, unit groups as well, but leaks wouldn't cause his problems.

My best guess is that for some reason your dummy units aren't being removed. The generic timer should take care of them, but from what you say it sounds like they're still around. If the dummy unit is controlled by a computer player, then it would naturally cast heal on the hurt unit to heal it if the dummy is idle.

Make your dummy units visible then watch in game to see if they are actually being removed.
03-03-2009, 12:59 PM#4
dabest2503
Quote:
Originally Posted by Blacktastic
As for your second trigger, do you have 2 heroes on opposite sides that both have this ability?

No. Only 1 hero has the ability.

Quote:
Originally Posted by ShadowWolf
My best guess is that for some reason your dummy units aren't being removed. The generic timer should take care of them, but from what you say it sounds like they're still around. If the dummy unit is controlled by a computer player, then it would naturally cast heal on the hurt unit to heal it if the dummy is idle.

Make your dummy units visible then watch in game to see if they are actually being removed.

The dummy units are getting removed, and are getting created over and over again. The dummy units are created for the Hero with the ability, and not controlled by a computer player, if that is what you meant. Any suggestions?
03-03-2009, 05:25 PM#5
ShadowWolf
Remove the dead allies from the game after they've already been used once, unless you absolutely need those corpses there for later purposes.
03-04-2009, 10:44 AM#6
dabest2503
I do need the corpses for later purposes (spells etc.). Are these corpses causing the trigger to be run over and over again?
03-04-2009, 10:54 AM#7
xombie
The reason it runs forever is because you're adding an expiring timer (at the end of which, the unit dies) to the dummy unit every time a unit dies. So every time a unit dies, kill a unit, etc.
03-04-2009, 05:30 PM#8
ShadowWolf
Dur, why didn't I see that. Just add a condition to the spell or turn the trigger off after it runs, then wait 1.1 seconds, then turn it back on.
03-06-2009, 05:52 AM#9
dabest2503
Somehow, the second trigger is also picking up dying allied units (dummy units/normal units etc.). Adding
Trigger:
Conditions
((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
.. is of no use. More help?
03-06-2009, 08:04 AM#10
xombie
Quote:
Originally Posted by dabest2503
This spell is supposed to create a dummy unit that heals TempUnit, in this case, an ally of the dying unit. The spell works normally when an ally of a unit with the ability Life Essence dies. However, whenever the same unit with the ability gets attacked, this trigger runs and heals TempUnit, and the origin of the healing waves come from the position of already dead allies. Any suggestions?

So what you're saying here is that when you -attack- a unit it runs this trigger? There is definitely something else wrong with your code if an attack triggers a death event.

For your other problem...

Try using "((Dying unit) belongs to an ally of (Owner of (Killing unit))) Equal to False"
03-06-2009, 01:55 PM#11
dabest2503
Quote:
Originally Posted by xombie
So what you're saying here is that when you -attack- a unit it runs this trigger? There is definitely something else wrong with your code if an attack triggers a death event.

Actually, the trigger continued running indefinitely, but its fixed now.

Also, the second problem still isn't fixed. Here's the trigger

Trigger:
Soul Steal
Collapse Events
Unit - A unit Dies
Collapse Conditions
((Dying unit) belongs to an ally of (Owner of (Killing unit))) Equal to False
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Killing unit) belongs to an enemy of (Owner of (Dying unit))) Equal to True
(Level of Soul Steal for PlayerHero[(Player number of (Owner of (Killing unit)))]) Greater than or equal to 1
Collapse Then - Actions
Unit - Set life of PlayerHero[(Player number of (Owner of (Killing unit)))] to ((Life of PlayerHero[(Player number of (Owner of (Killing unit)))]) + (40.00 + ((Real((Level of Soul Steal for PlayerHero[(Player number of (Owner of (Killing unit)))]))) x 30.00)))
Unit - Set mana of PlayerHero[(Player number of (Owner of (Killing unit)))] to ((Mana of PlayerHero[(Player number of (Owner of (Killing unit)))]) + (15.00 + (15.00 x (Real((Level of Soul Steal for PlayerHero[(Player number of (Owner of (Killing unit)))]))))))
Set TempPoint = (Position of (Dying unit))
Unit - Create 1 Soul Steal Target Art for (Owner of PlayerHero[(Player number of (Owner of (Killing unit)))]) at TempPoint facing Default building facing degrees
Unit - Order (Last created unit) to Attack Once PlayerHero[(Player number of (Owner of (Killing unit)))]
Unit - Add a 0.15 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempPoint)
Trigger - Run Soul Steal OnOff trigger <gen> (checking conditions)
Trigger - Turn off (This trigger)
Else - Actions

It is still running when allies die.
03-06-2009, 02:12 PM#12
xombie
Hmm. See the problem is sometimes conditions like these don't act as they should. Try using (Triggering unit) instead of (Dying unit).
03-07-2009, 02:48 AM#13
dabest2503
Hmm, it seems that units that die from an expiration timer make the trigger run, even if its an ally or enemy. Strange..
03-07-2009, 03:21 AM#14
ShadowWolf
That's easily fixed by adding a unit-type condition, just check to make sure it's not the dummy type. Checking for enemy/ally is a bit silly way to do it.
03-07-2009, 09:56 AM#15
xombie
Quote:
Originally Posted by xombie
The reason it runs forever is because you're adding an expiring timer (at the end of which, the unit dies) to the dummy unit every time a unit dies. So every time a unit dies, kill a unit, etc.

I knew I commented on that earlier :P