| 03-17-2008, 06:20 AM | #1 |
So I made a spell, that, when cast, it takes the total mana of the casting unit, divides it by two and does that much damage on the target. The problem is that it doesn't show how much mana gets burned. It burns 285, then 4 etc. It goes all random, so how can I fix this? Here is my code btw: Trigger: When Casted
|
| 03-17-2008, 07:17 AM | #2 |
Well, you've set up your trigger improperly. The way you've done it works... but it would be better (and bug-free) if written like this: Trigger:
|
| 03-17-2008, 02:38 PM | #3 |
If you want to show floating text, you'll need to trigger it. I've got this lovely function in JASS for it, but it can be done in GUI with similar looking functions. JASS://*************************************************************************************************************** //*Creates fading text and does all that fun stuff in one. //* function FadingText takes player p, string msg, integer red, integer green, integer blue, real x, real y, real vel, real fade, real life returns nothing local texttag t = CreateTextTag() call SetTextTagText(t, msg, 0.024) call SetTextTagPos(t, x, y, 0.00) call SetTextTagColor(t, red, green, blue, 255) call SetTextTagVelocity(t, 0, vel) if p != null then call SetTextTagVisibility(t, (GetLocalPlayer() == p)) endif call SetTextTagFadepoint(t, fade) call SetTextTagLifespan(t, life) call SetTextTagPermanent(t, false) set t = null endfunction |
| 03-18-2008, 05:22 AM | #4 |
The spell is supposed to take the casters total mana, divide it by two and do that much damage, and also showing the floating text of how much damage it does. How can I do that, and remove the "-x" text that the original mana burn spell shows, and create floating text of how much damage the spell does? |
| 03-18-2008, 06:40 AM | #5 |
You based the spell on mana burn? Doing the damage this way won't affect how much mana is burned by the spell; you'd have to do that manually, like so: Trigger: Actions![]() Set HalfMana = (Min(((Mana of (Triggering Unit)) / 2.00), (Mana of (Target unit of ability being cast))))![]() ----- So that the spell doesn't do more damage than it can burn in mana -----![]() Unit - Cause (Triggering Unit) to damage (Target unit of ability being cast) for HalfMana damage of attack type Chaos and damage type Universal![]() Set TempPoint = (Position of (Target unit of ability being cast))![]() Floating Text - Create floating text that reads (- + String(Integer(HalfMana))) at TempPoint with Z offset 0.00, using font size 10.00, color (100%, 32.15%, 32.15%) and 0.00% transparency![]() Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees![]() Floating Text - Change (Last created floating text): Disable permanence![]() Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds![]() Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds |
| 03-19-2008, 06:05 AM | #7 |
You didn't really set up the TempPoint stuff properly... you should have this instead: Trigger: Actions![]() ----- ... -----![]() Set TempPoint = (Position of (Target unit of ability being cast)) <This is a point variable, not a region variable!>![]() Floating Text - Create floating text that reads (- + (String(HalfManaInt))) at TempPoint with Z offset 0.00, using font size 10.00, color (32.15%, 32.15%, 100.00%), and 0.00% transparency ![]() Custom script: call RemoveLocation(udg_TempPoint) |
