• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Magic Tower

Status
Not open for further replies.
Level 3
Joined
Dec 26, 2007
Messages
30
Okay, the thing is I want to make a tower that (when attacks) has a 5% chance to cast Cripple and another 5% chance to cast Purge on the attacked unit. The rest of the time, (90%) it'd do normal damage.
I tried making a normal tower with two orb-based abilities but it didn't work.
I've also tried using this trigger with it:
  • Events
    • Unit - A unit Is attacked
  • Conditions
    • (Unit-type of (Attacking unit)) Equal to Magic Tower
  • Actions
    • Set integer_random = (Random integer number between 1 and 20)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • integer_random Equal to 7
      • Then - Actions
        • Unit - Add Cripple to (Attacking unit)
        • Wait 2.00 seconds
        • Unit - Remove Cripple from (Attacking unit)
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • integer_random Equal to 4
            • Then - Actions
              • Unit - Add Purge to (Attacking unit)
              • Wait 2.00 seconds
              • Unit - Remove Hex from (Attacking unit)
            • Else - Actions
              • Do nothing
It doesn't work because the abilities need to be activated, I suppose.

Any ideas?
Thanks.
 
Level 22
Joined
Feb 26, 2008
Messages
891
Make some trigger with the A Unit Is Attacked event, and check if the Attacking Unit's unit-type is your tower. Then, create some dummy unit to cast a spell on the Attacked Unit IF some Random Integer between 1 and 100 is less than or equal to 5. (5%)

Make sense?
 
Level 3
Joined
Dec 26, 2007
Messages
30
Make some trigger with the A Unit Is Attacked event, and check if the Attacking Unit's unit-type is your tower. Then, create some dummy unit to cast a spell on the Attacked Unit IF some Random Integer between 1 and 100 is less than or equal to 5. (5%)

Make sense?

That could work, but the problem is I can't find the way to order a unit to cast a spell on GUI.
 
Level 3
Joined
Dec 26, 2007
Messages
30
Yeah, I've tried that, but it gives you a list of preset spells.
For example:

  • Unit - Order (Attacking unit) to Human Sorceress - Slow (Attacked unit)
  • -------- or --------
  • Unit - Order (Attacking unit) to Orc Shaman - Purge (Attacked unit)
That'd cast the human sorceress' slow spell or the orc shaman's purge one on the attacked unit, but I can't order a unit to cast a custom spell (with the values I want) on it.

That's the main problem.
 
Level 3
Joined
Dec 26, 2007
Messages
30
But that wouldn't be a custom spell then, it'd be a modified one from the default Blizzard spells. I mean, there'd be no need to copy/paste anything, just editing the 'raw' spell, right?

Anyway, I'll try that and tell you if it works.
 
Level 22
Joined
Feb 26, 2008
Messages
891
> But that wouldn't be a custom spell then, it'd be a modified one from the default Blizzard spells. I mean, there'd be no need to copy/paste anything, just editing the 'raw' spell, right?

Well, I could give you some explanation, but it might confuse you....

Each spell has an Order Id.
Except for very few exceptions, this Order Id cannot be changed.
It doesn't change when you create a new ability - it simply copies the Order Id of its "parent" ability.
You can't see the Order Id other than those few exceptions.
So, when you order some unit to cast a spell, it actually orders the Order Id in question, so any and all abilities that the unit has with that Order Id will be ordered to cast.
 
Level 3
Joined
Dec 26, 2007
Messages
30
So... if I order a unit to cast purge on another unit and I've based off 5 custom spells out of purge, the 5 of them plus purge itself would be casted?
 
Level 3
Joined
Dec 26, 2007
Messages
30
Ohhh, okay.

Give me a second, I'll try that.

EDIT:

Okay, I tried using this trigger and it didn't work:

  • MagicTower
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Magic Tower
    • Actions
      • Set integer_random_magic = (Random integer number between 1 and 20)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • integer_random_magic Equal to 7
        • Then - Actions
          • Unit - Create 1 Dummy Unit for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing 270.00 degrees
          • Unit - Order (Last created unit) to Undead Necromancer - Cripple (Attacked unit)
          • Wait 1.00 seconds
          • Unit - Kill (Last created unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • integer_random_magic Equal to 4
            • Then - Actions
              • Unit - Create 1 Dummy Unit for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing 270.00 degrees
              • Unit - Order (Last created unit) to Orc Shaman - Purge (Attacked unit)
              • Wait 1.00 seconds
              • Unit - Kill (Last created unit)
            • Else - Actions
              • Do nothing
The dummy unit DOES appear but it doesn't cast the spells.
Both spells cost 0 mana, and the dummy unit has them both in its 'Abilities - Normal' 'box'.

By the way, I know there are leaks in the trigger, but I want to make it work first.
And... if you want the map let mi know, I can PM it to you.
 
Last edited:
Level 3
Joined
Dec 26, 2007
Messages
30
Make sure the dummy isn't too far away from the unit.

Both abilities' casting range is 9999 (and they don't have cooldown), I don't think that'd be a problem. =/

Add an expiration timer to the unit of about 2 seconds instead of killing it after a wait.

True, forgot about that.
Done.
Give the dummy a model just to see if it is ordered correctly.

Yeah, I already did that.

Only purge is casted, cripple doesn't seem to work. I moved the tower close to the attacked unit like you said in case the trigger I made was referring to the wrong ability, but it's still the same.

What could be the problem with cripple?
 
Level 8
Joined
Jun 25, 2007
Messages
165
MAKE SURE that the ability that you give to dummy unit COST NO MANA.

If you want a trigger (its work for me):
  • Magic Tower
    • Events
      • Unit - A unit is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Magic Tower
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less or Equal to 5
        • Then - Actions
          • Unit - Create 1 DUMMY for (Owner of (Attacking unit)) at (Position of (Attacked unit)) facing Default building orientation
          • Unit - Add Purge to (Last created unit)
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Orc Shaman - Purge (Attacked unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less or Equal to 5
            • Then - Actions
              • Unit - Create 1 DUMMY for (Owner of (Attacking unit)) at (Position of (Attacked unit)) facing Default building orientation
              • Unit - Add Cripple to (Last created unit)
              • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to Undead Necromancer - Cripple (Attacked unit)
            • Else - Actions
              • Do nothing
 
Status
Not open for further replies.
Top