HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Mana restoring spell not working

04-25-2010, 06:37 PM#1
The Druidinator
I have a spell I've worked on for a map, called Deathmark. It's meant to use a dummy version of Acid Bomb, and I created a trigger around it. I would post the trigger if I knew how (help, please?), but it works along the way of noticing the cast, setting target to a variable and the caster to another variable, and then set the mana of DeathmarkCaster to (current mana)+(50). But it doesn't seem to work as well as I would like it, and it can't notice the "A unit Dies" event, with the condition "Dying unit Equals to DeathmarkTarget, even though the target clearly is set to the variable (since the other functions of a second trigger, that continuosly creates effects on DeathmarkTarget, work fine).
So, my problem is starting the trigger. I know, the information may be a little tangled, but I'm not sure on how to post it so you can see for yourselves, and explaining a trigger in text is not the easiest thing. All help would be appreciated.
04-25-2010, 08:05 PM#2
Anopob
To copy the trigger onto here, right click it and select "Copy as Text". Then past it in [GUI] tags in the forum (I'm assuming you're using GUI here...).

About your problem, it seems that it lies within your death event. Events and their conditions for the most part are created during map initialization, so when your condition says "Dying unit equals to deathmark target" it actually means "Dying unit equals to deathmark target, but whatever the value was during map initialization (which most likely is null)." I'm guessing an alternative to your spell is to give the unit a buff, and detect if the unit has the buff or not upon death.
04-25-2010, 08:14 PM#3
The Druidinator
First, thanks for the quick help. Second, the two vital parts of the trigger follow here (the third part of it is merely cosmetical):

Trigger:
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Deathmark
Collapse Actions
Set DeathMarkCaster = (Triggering unit)
Set DeathMarkTarget = (Target unit of ability being cast)
Trigger - Turn on Deathmark Lightning Effect <gen>
Trigger - Turn on Deathmark Target Death <gen>
Wait 10.00 seconds
Set DeathMarkTarget = No unit
Set DeathMarkCaster = No unit
Trigger - Turn off Deathmark Lightning Effect <gen>
Trigger - Turn off Deathmark Target Death <gen>

This is obviously the casting of the spell, and setting variables. But you mean that even though the variables are set in this trigger, the game still counts them as NULL in this following trigger?

Trigger:
Deathmark Target Death
Collapse Events
Unit - A unit Dies
Collapse Conditions
(Dying unit) Equal to DeathMarkTarget
Collapse Actions
Trigger - Turn off Deathmark Lightning Effect <gen>
Set DeathMarkTarget = No unit
Set DeathMarkCaster = No unit
Special Effect - Create a special effect at (Position of DeathMarkCaster) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
Unit - Set mana of DeathMarkCaster to ((Mana of DeathMarkCaster) + 50.00)

Since in the cosmetical one works pretty fine.

Trigger:
Deathmark Lightning Effect
Collapse Events
Time - Every 0.50 seconds of game time
Conditions
Collapse Actions
Unit - Create 1 Deathmark Lightning Caster for Player 1 (Red) at ((Position of DeathMarkTarget) offset by 30.00 towards (Angle from (Position of DeathMarkTarget) to (Position of DeathMarkCaster)) degrees) facing Default building facing degrees
Unit - Add Deathmark Lightning Effect (Dummy) to (Last created unit)
Unit - Order (Last created unit) to Human Blood Mage - Siphon Mana DeathMarkCaster
Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
04-25-2010, 08:16 PM#4
Anitarf
Quote:
Originally Posted by Anopob
About your problem, it seems that it lies within your death event. Events and their conditions for the most part are created during map initialization, so when your condition says "Dying unit equals to deathmark target" it actually means "Dying unit equals to deathmark target, but whatever the value was during map initialization (which most likely is null)."
Not quite correct. This would be true if the variable was used when creating something like a specific unit event, but when used in a condition like that, it should get evalauated for whatever unit the variable is pointing to whenever the condition runs, rather than the one it was pointing to when the condition was created.

Edit: your problem is that you set the caster variable to "no unit" before you restore that unit's mana.
04-25-2010, 08:27 PM#5
The Druidinator
Quote:
Originally Posted by Anitarf
Edit: your problem is that you set the caster variable to "no unit" before you restore that unit's mana.

Oh, my ignorant stupidity shines through. I just checked it, and it works wonders. Have been pulling my hair (almost) over this trigger, and it turns out to such a simple little mistake. Many thanks!
04-26-2010, 01:08 AM#6
Anopob
Quote:
Originally Posted by Anitarf
Not quite correct. This would be true if the variable was used when creating something like a specific unit event, but when used in a condition like that, it should get evalauated for whatever unit the variable is pointing to whenever the condition runs, rather than the one it was pointing to when the condition was created.
Damn, I confused the two up >.< Sorry about that.