HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spell question

02-27-2005, 01:57 PM#1
Guest
Ok how do I make a spell like in ToB where you loose health INSTEAD of mana, I think it's like this.

Event - Spell is cast
Conditions Spell equal to spell
Actions - set units* life to 800 (out of 1000)

A) This won't work because there might be more than one of these units*
B) If one spell takes away 500 health and then the player casts a spell that takes away 300 health he would be gaining 200 health.
C) Is there even a "spell is cast"?

Anyways so I know that wouldn't work 100% so any other suggestions?
02-27-2005, 03:41 PM#2
shadow1500
its Event - Unit - Unit begins the effect of an ability.
and for the life instead of mana use
Action - Unit - Set life of (casting unit) to (Life of (Casting unit)) - 200
02-27-2005, 04:17 PM#3
Guest
How exactly will this work? Because in words this is what the trigger would do:
A unit casts the effect
Set its life to its life...

Edit: Tough I did as you said, it didn't work but by doing this I stumbled across something that does work

Event -Unit - A unit Begins/Finishes casting an ability
Conditions - (Ability being cast) Equal <spell>
Actions - Unit - Set life of (Casting unit) to <percent/values>

Edit #2: And I thought the problem ended. (Refer to letter C in 1st post)
EX)Impale makes your health go down by 30%
EX)Storm Bolt makes your health go down by 10%
You gain 20%.....
Is there a way to make it so it takes away that % of your current health not your Total Health

Edit #3: This would most likely involve dummy units wouldn't it? If it would tell me how to make dummies...because I didn't get it last time when someone tried to explain it to me
02-27-2005, 07:15 PM#4
Guest
Ummm, yeah, current health should be easy.

If you want to reduce it by a set cost X, use this:
Unit - Set Life of (Casting unit) to ((Life of (Casting unit)) - X)

If you want to reduce by a percent X of CURRENT hitpoints, use this:
Unit - Set Life of (Casting unit) to ((Life of (Casting unit)) * (1.0 - (X / 100)))

If you want to reduce by a percent X of MAX hitpoints, use this:
Unit - Set Life of (Casting unit) to ((Life of (Casting unit)) - ((Max Life of (Casting unit)) * (X / 100)))

When I say percent X, I mean like 20% or 76%, not 0.2 or 0.76; the forumulas given contain that conversion.

"Life of (unit)" and "Max Life of (unit)" can both be found in the "Unit - Property" function.