• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

2 problems with GUI spell triggers.

Status
Not open for further replies.
Level 6
Joined
May 8, 2010
Messages
150
Spell 1
Deals a % of the heroes hp onto a targeted unit, while damaging himself.
This is the trigger below.. not sure the problem.

[trigger=Punishment]Punishment
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Punishment 2
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of (Ability being cast) for (Triggering unit)) Equal to 1
Then - Actions
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (5.00 / (Life of (Triggering unit))) damage of attack type Spells and damage type Normal
Unit - Cause (Triggering unit) to damage (Triggering unit), dealing (20.00 / (Life of (Triggering unit))) damage of attack type Spells and damage type Normal
Floating Text - Create floating text that reads (String((Abs((Integer((20.00 / (Life of (Triggering unit))))))))) above (Target unit of ability being cast) with Z offset 0.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), 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 4.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of (Ability being cast) for (Triggering unit)) Equal to 2
Then - Actions
Floating Text - Create floating text that reads (String((Abs((Integer((2.50 / (Life of (Triggering unit))))))))) above (Target unit of ability being cast) with Z offset 0.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), 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 4.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (2.50 / (Life of (Triggering unit))) damage of attack type Spells and damage type Normal
Unit - Cause (Triggering unit) to damage (Triggering unit), dealing (9.00 / (Life of (Triggering unit))) damage of attack type Spells and damage type Normal
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of (Ability being cast) for (Triggering unit)) Equal to 3
Then - Actions
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (2.00 / (Life of (Triggering unit))) damage of attack type Spells and damage type Normal
Unit - Cause (Triggering unit) to damage (Triggering unit), dealing (5.50 / (Life of (Triggering unit))) damage of attack type Spells and damage type Normal
Floating Text - Create floating text that reads (String((Abs((Integer((50.00 / (Life of (Triggering unit))))))))) above (Target unit of ability being cast) with Z offset 0.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), 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 4.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Else - Actions
[/trigger]


Trigger 2 =
A hero casts a spell, which heals all allied units around him by a % of his hp. But it currently doesnt work.
I also want the spell to damage himself by a percentage like 5 when cast.
[trigger=Sacrifice]
Sacrifice
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Sacrifice
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of (Ability being cast) for (Triggering unit)) Equal to 1
Then - Actions
Set SacrificeHeal[(Player number of (Owner of (Triggering unit)))] = (5 / (Integer((Life of (Triggering unit)))))
Unit Group - Pick every unit in (Units within 400.00 of (Position of (Casting unit)) matching (((Owner of (Matching unit)) is an ally of (Owner of (Triggering unit))) Equal to True)) and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(SacrificeHeal[(Player number of (Owner of (Triggering unit)))]))))
Floating Text - Create floating text that reads (String((Abs(SacrificeHeal[(Player number of (Owner of (Triggering unit)))])))) above (Picked unit) with Z offset 0.00, using font size 8.00, color (0.00%, 100.00%, 0.00%), 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 4.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of (Ability being cast) for (Triggering unit)) Equal to 2
Then - Actions
Set SacrificeHeal[(Player number of (Owner of (Triggering unit)))] = (3 / (Integer((Life of (Triggering unit)))))
Unit Group - Pick every unit in (Units within 400.00 of (Position of (Casting unit)) matching (((Owner of (Matching unit)) is an ally of (Owner of (Triggering unit))) Equal to True)) and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(SacrificeHeal[(Player number of (Owner of (Triggering unit)))]))))
Floating Text - Create floating text that reads (String((Abs(SacrificeHeal[(Player number of (Owner of (Triggering unit)))])))) above (Picked unit) with Z offset 0.00, using font size 8.00, color (0.00%, 100.00%, 0.00%), 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 4.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of (Ability being cast) for (Triggering unit)) Equal to 3
Then - Actions
Set SacrificeHeal[(Player number of (Owner of (Triggering unit)))] = (2 / (Integer((Life of (Triggering unit)))))
Unit Group - Pick every unit in (Units within 400.00 of (Position of (Casting unit)) matching (((Owner of (Matching unit)) is an ally of (Owner of (Triggering unit))) Equal to True)) and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(SacrificeHeal[(Player number of (Owner of (Triggering unit)))]))))
Floating Text - Create floating text that reads (String((Abs(SacrificeHeal[(Player number of (Owner of (Triggering unit)))])))) above (Picked unit) with Z offset 0.00, using font size 8.00, color (0.00%, 100.00%, 0.00%), 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 4.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Else - Actions
[/trigger]
 
Why are you using 5/ Life of trigering unit? Let's say you unit have 100 hp. It would heal all units around it by 5/100 = 0.05. It's not correct. If you want it to heal by 5% of the units health use :

  • Set SacrificeHeal[(Player number of (Owner of (Triggering unit)))] = ((Integer((Life of (Triggering unit) * 0.05))))
100 * 0.05 = 5

Any number * 1 = 100%, so:
for 50% use *0.50
for 5% use *0.05
for 0.5% use *0.005
and so on. Pretty simple.
 
To trigger one i guess it should be not cause trigg unit damage trigg unit, but set a variable, the 20/life and then set the life to life-var it should be better. I'll redo all your spells tomorrow i HOPE, but one suggestion. Never Use Begins Casting a Spell unless the spell is channeling. Use starts the effects of abil. Cause if begins, then i can click the spell and before the spell is cast (casting time) press stop and the spell runs. If i use starts the effects, it runs only when the spell IS cast. :)
 
Why are you using 5/ Life of trigering unit? Let's say you unit have 100 hp. It would heal all units around it by 5/100 = 0.05. It's not correct. If you want it to heal by 5% of the units health use :

  • Set SacrificeHeal[(Player number of (Owner of (Triggering unit)))] = ((Integer((Life of (Triggering unit) * 0.05))))
100 * 0.05 = 5

Any number * 1 = 100%, so:
for 50% use *0.50
for 5% use *0.05
for 0.5% use *0.005
and so on. Pretty simple.

"*"

How do i use that with the maths?
Can you create a quick trigger so i can find it :)
 
1st. Use a loop action for each Level. More flexible.

2nd. You leak really much. I can create this to u easy just give me some time. =)

EDIT: Here is the first one. Insert the things you need.
  • Sacrifice
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • For each (Integer S_Loop) from 1 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Animate Dead for (Triggering unit)) Equal to S_Loop
            • Then - Actions
              • Set Sacrifice_Integer[(Player number of (Owner of (Triggering unit)))] = ((Integer((Life of (Triggering unit)))) / 5)
            • Else - Actions
 
The "*" is the symbol for multiplication.
When using Integer/Real functions when you click them (GUI) you most of the times
see a Value + 1 don't you? Well, just click the "+" and you get a drop list with +,- , x and /. In math, how we often use X as an variable in equations, they decided to use * instead of x.

I'm going to make an example, one second :)

Edit: Here it is. It's very simple, actually. But note the trigger that set the casters HP. You must use percentage, cause using "life of triggering unit * 0.95" won't work. I don't know why, but i think it's because that kind of multiplication isn't allowed as a life of a unit must be a integer.
 

Attachments

Last edited:
The "*" is the symbol for multiplication.
When using Integer/Real functions when you click them (GUI) you most of the times
see a Value + 1 don't you? Well, just click the "+" and you get a drop list with +,- , x and /. In math, how we often use X as an variable in equations, they decided to use * instead of x.

I'm going to make an example, one second :)

Edit: Here it is. It's very simple, actually. But note the trigger that set the casters HP. You must use percentage, cause using "life of triggering unit * 0.95" won't work. I don't know why, but i think it's because that kind of multiplication isn't allowed as a life of a unit must be a integer.


I understand better now, :)
+rep
 
Okay one problem soul,

to remove a % off a enemy unit.. would it be (life of triggering unit)/ 0.30
^^ and then deal that?

&&&&&
Your map, the spell sacrifice doesnt work.
:/

&

Set SacrificeHeal[(Player number of (Owner of (Triggering unit)))] = ((Integer((Life of (Triggering unit)))) x (Integer(0.25)))

doesnt work :/
 
Strange, the spell only works when the hero is under 1000hp. Guess mid-battle i missed it. Found the problem. Working on that.

Also, 0.25 is not a integer, it's a real, so you can't use it in integer functions ;p
 
Just realized two things: forgot that the unit group was picking the caster two (solved) and the percentage life, sadly, is based on unit's max hp, so it will get more complicated. (solving in a minute).

Edit: Also, you want the unit to be dmged equal to 5% of it's total hp, or it's current hp?

Edit2: Don't knew wich one, so i made both. Also, added a damage display :)
 

Attachments

Last edited:
[trigger=Sacrifice]
Sacrifice
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Sacrifice
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of (Ability being cast) for (Triggering unit)) Equal to 1
Then - Actions
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - ((Life of (Triggering unit)) / 0.95))
Unit Group - Pick every unit in (Units within 600.00 of (Position of (Triggering unit)) matching (((Picked unit) Not equal to (Casting unit)) and (((Owner of (Picked unit)) is an ally of (Owner of (Triggering unit))) Equal to True))) and do (Actions)
Loop - Actions
Set SacrificeHeal[(Player number of (Owner of (Triggering unit)))] = ((Life of (Triggering unit)) / 4.00)
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + SacrificeHeal[(Player number of (Owner of (Triggering unit)))])
Floating Text - Create floating text that reads (String((Abs(SacrificeHeal[(Player number of (Owner of (Triggering unit)))])))) above (Picked unit) with Z offset 0.00, using font size 8.00, color (0.00%, 100.00%, 0.00%), 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 4.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Else - Actions
[/trigger]
 
Wheyy, got it working!

[trigger=Sacrifice]
Sacrifice
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Sacrifice
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of (Ability being cast) for (Triggering unit)) Equal to 1
Then - Actions
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - ((Life of (Triggering unit)) / 20.00))
Unit Group - Pick every unit in (Units within 600.00 of (Position of (Triggering unit)) matching (((Picked unit) Not equal to (Casting unit)) and (((Owner of (Matching unit)) is an ally of (Owner of (Triggering unit))) Equal to True))) and do (Actions)
Loop - Actions
Set SacrificeHeal[(Player number of (Owner of (Triggering unit)))] = ((Life of (Triggering unit)) / 4.00)
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + SacrificeHeal[(Player number of (Owner of (Triggering unit)))])
Floating Text - Create floating text that reads (String((Abs(SacrificeHeal[(Player number of (Owner of (Triggering unit)))])))) above (Picked unit) with Z offset 0.00, using font size 8.00, color (0.00%, 100.00%, 0.00%), 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 4.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Else - Actions
[/trigger]


One thing tho..
when the floating text is displayed on how much a unit is healed.. it comes up with (for example 20% off 100) 20.00 , rather then 20.

know how i can change it ?
cheers
 
You mean, you don't want the .00 afther the 20?
Try not using absolute value. ;p Although i don't know what it does haha
 
Just occured me that if you convert the real to a integer it will not display the .00. But i dunno what will happen with the real values that got any value after the "."
 
Status
Not open for further replies.
Back
Top