• 🏆 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!

spell to heal and damage random unit not working

Status
Not open for further replies.
Level 6
Joined
Apr 26, 2007
Messages
225
I'm making a spell that when you channel it, it pick 2 random targets around the caster, if they are enemy it damage them depending on the level and if it's an ally it heal the target. The spell dont work at all, it heals the shop but dont do damage neither does it heal friendly ally around me.

EDIT: by the way the unit variable "priest" is set when the player choose the hero. and has no array as the hero can only be picked once.

EDIT2: hmmmm so i found out (well remembered) that "wait" is not compatible with unit loop... how can i make the holy light evveft appear and dissapear after .5 second??

EDIT3: actualy managed to fix it myself so i guess that tread is going nowhere lol sorry about that

  • heavenly bolt
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Heavenly Bolt
    • Actions
      • Trigger - Turn on heavenly bolt active <gen>
  • heavenly bolt stop
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Heavenly Bolt
    • Actions
      • Trigger - Turn off heavenly bolt active <gen>
 
Last edited:
Level 14
Joined
Aug 30, 2004
Messages
909
make 2 unit variables called "SpellTarget1" and "SpellTarget2" or something like that.

Then put something like:

set SpellTarget1 = random unit within 512 of priest
set SpellTarget2 = random unit within 512 of priest matching Matching unit not = SpellTarget1

Those are your two targets. Then just heal or damage them accordingly after your wait. Make sure to change your conditions so it's if SpellTarget1 is an ally of whoever... rather than "Picked" unit.

Also if you want to avoid leaks, try putting the "destroy sp. effect" command immediately after you create the special effect. For most special effects it will still display in full length even though you destroyed it, and that way it won't leak.
 
Level 6
Joined
Apr 26, 2007
Messages
225
(i removed the trigger from my first post because it was long and am gona repost it..)

Well like i said i managed to fix it but i would like to know how to destroy the special effects after 1~2 sec in this trigger because i think its gonna lag afte a while with the leak
 
Last edited:
Level 14
Joined
Aug 30, 2004
Messages
909
Try destroying it literally right after you make it.

Create Special Effect *blah*
Destroy Special Effect *blah*

Often that will solve it for you. If you try that and don't see the special effect, then make a special effect variable, put the special effect in the variable, then at the end of the trigger, wait .5 seconds and destroy it.
 
Level 4
Joined
Jul 23, 2008
Messages
99
Johnpath... I see your trigger has a lot of codes. Why you don't use formula? So the trigger won't be longer.
 
Level 6
Joined
Apr 26, 2007
Messages
225
I'm not realy good at that :angry: i can manage to make the things i was... wich dont alway work but it's alway long and full of leaks i dont realy know how to make it detect levela nd all in one trigger block each spell has to have its block for each level:thumbs_down:

EDIT: well actualy i managed to make something good lol tell me if there are leaks but i dont think there are:

  • heavenly bolt active
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Random heavenlybolttargets units from (Units within 512.00 of (Position of priest) matching ((Life of (Matching unit)) Greater than 0.00))) and do (Actions)
        • Loop - Actions
          • Unit - Set mana of priest to ((Percentage mana of priest) - 1.00)%
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 9 (Gray)
            • Then - Actions
              • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Cause priest to damage (Picked unit), dealing heaenlyboltdamage damage of attack type Spells and damage type Magic
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Percentage life of (Picked unit)) Less than 100.00
                • Then - Actions
                  • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + heaenlyboltdamage)
                • Else - Actions
                  • Unit Group - Pick every unit in (Random 1 units from (Units within 512.00 of (Position of priest) matching ((Owner of (Matching unit)) Equal to Player 9 (Gray)))) and do (Actions)
                    • Loop - Actions
                      • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Cause priest to damage (Picked unit), dealing heaenlyboltdamage damage of attack type Spells and damage type Magic
heavenlyboltdamage and heavenlybolttargets are both set when the skill levels up and priest is set when the character is picked.
 
Last edited:
Status
Not open for further replies.
Top