• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need help with a easy trigger

Status
Not open for further replies.
Level 2
Joined
Oct 13, 2007
Messages
20
Pretty simple, so I am making a caster map and i wanted a trigger that costs the caster 5 mana per normal attack, can anyone tell me the triggers for that?::cry:
 
Level 30
Joined
Dec 6, 2007
Messages
2,228
y, try this:

Events
Unit - A unit Is attacked
Conditions
((Attacking unit) is in (Units of type Bloodmage)) is True
Actions
Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 5.00)

Just a little explication (any questions left?..read down or just ask me):


Use for the event: "Unit-Generic unit event" and look for "a unit is attacked"

Use for the condition: "Boolean Comparison" and look for "unit-unit in unit group". then change triggering unit in attacking units and the second part into "unit-unit of type" and choose your mage.

Use for the action: "unit-set mana (to value)". change "triggering unit" in "attacking unit" and change the number to the example i gave you above.

HF
 
Level 30
Joined
Dec 6, 2007
Messages
2,228
You forgot another thing:

The trigger runs even when the bloodmage has less than 5 mana.

Condition:
(Attacking unit)'s mana is greater than or equal to 5
lets better make an if-then-else action.

if (Attacking unit)'s mana is greater than or equal to 5 then do nothing else unit-order (attacking unit) to stop


just add this action before the action i gave you.
 
Level 6
Joined
Jan 15, 2005
Messages
188
lets better make an if-then-else action.

if (Attacking unit)'s mana is greater than or equal to 5 then do nothing else unit-order (attacking unit) to stop


just add this action before the action i gave you.

Ah, I stand corrected.

But now a new problem. When he hits attack, even if the attack doesn't go off, he will still get drained by 5 mana and go down to 0 again, which might continue endlessly. So here's another action you need to add after that:

if (Attacking unit)'s mana is greater than or equal to 5 then Do nothing else Skip remaining actions


So in the end it would look like this (2 triggers to make it easy):

Variables Required:
spelldrainvarsbs8.png


Trigger 1 (Abilities):
spelldrainabilityxk0.png


Trigger 2 (Attack):
spelldrainattackul1.png
 
Level 2
Joined
Oct 13, 2007
Messages
20
you both helped me a lot for telling me this, i apreciate you both so i will give credit to you both in my map: Kamikazzee and paladon~
 
Level 2
Joined
Oct 13, 2007
Messages
20
a few more questions:
step by step, how do i make-Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 5.00)
and
(mana of CurrentUnit) less than or equal to 5 ?
 
Level 6
Joined
Jan 15, 2005
Messages
188
a few more questions:
step by step, how do i make-Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 5.00)
and
(mana of CurrentUnit) less than or equal to 5 ?

Alright first off, I don't go by the name of Kamikazzee anymore, it's SinisteRing =).

Anyways, here's how you do it (In the most simple, smallest steps I could possibly do it):

Step 1, select Unit - Set Mana (Value):
smstep1zt5.png


Step 2, make the unit whose mana to be set is CurrentUnit:
smstep2dm3.png


Step 3, select Arithmetic for what the operation on the mana will be. This will allow you to select the units mana, then subtract from it, all in 1 fell swoop:
smstep3fc5.png


Step 4, select the first of the Arithmetic, and go to Unit - Property:
smstep4wt0.png


Step 5, set the first part of it to "Mana" and the picked unit to "CurrentUnit":
smstep5zf1.png


Step 6, set the operator of the Arithmetic to subtraction, and the amount to be subtracted to 5.00:
smstep6nt9.png


Finally, you are done. It should look like so:
smstep7et5.png


I hope that helped you out a little more.

Oh, and for the (Mana of CurrentUnit) less than or equal to 5:

The condition is not Integer, it's Real. If that is what confused you, just go to the "Real Condition" instead of "Integer Condition".
 
Status
Not open for further replies.
Top