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

[Spell] Need help with targeting

Status
Not open for further replies.
Level 2
Joined
Dec 5, 2017
Messages
7
Trying to make a mage knight who can restore mana to everyone except other mage knights.
I've tried a couple different "targeted as" and "targets allowed" combinations but cant find a combination that works.
 
Level 39
Joined
Feb 27, 2007
Messages
5,037
The ones I know to try are Ancient, Sapper, and Mechanical. The latter two will definitely alter some basic gameplay stuff, though. Undead would probably work too if that type isn't really used in your map. If you're having too much difficulty finding a combination it's really not that difficult to cancel the cast before it goes off and play a simulated error message.
 
Level 2
Joined
Dec 5, 2017
Messages
7
Hrmm
I gave it a try with the mage knight being targeted as Ancient, ground and the spell is a scroll of mana that targets friend, nonancient, notself, organic.
I feel like it should work but maybe im missing something?
 
Level 39
Joined
Feb 27, 2007
Messages
5,037
I noticed that you have "friend" but not "player units". That might make a difference before you try making this trigger:
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) equal to Scroll of Mana
  • Actions
    • Set RADIUS = whatever //a real variable to determine radius; if you want it to scale with level that can be done here
    • Set RESTORE_AMOUNT = whatever //same as above; if you want it to be a percentage, that can also be done
    • Set Owner = (Owner of (Triggering Unit)) //player variable
    • Set TempPoint = (Position of (Target unit of ability being cast)) //to clean the point leak later
    • -------- Use position of triggering unit instead if this ability has no target --------
    • Custom script: set bj_wantDestroyGroup = true //pre-emptively cleans a unit group leak that's about to occur in the next line
    • Unit Group - Pick every unit within RADIUS of TempPoint and do (Actions)
      • Loop - Actions
        • Set TempUnit = (Picked Unit)
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • (TempUnit is Alive) equal to True
            • (TempUnit belongs to an Ally of Owner) equal to True
            • (TempUnit is Mechanical) equal to False
            • (TempUnit is a Structure) equal to False
            • (Unit-type of TempUnit) not equal to Mage Knight
          • Then - Actions
            • Unit - Set Mana of TempUnit to ((Mana of TempUnit) + RESTORE_AMOUNT) //this shouldn't overflow or freak out if the unit doesn't have mana
            • Special Effect - Create a special effect attached to the WHEREVER of TempUnit using WHATEVER PATH YOU WANT
            • Special Effect - Destroy (Last created special effect) //this will still play its death animation or idle animation if it doesn't have one
          • Else - Actions
    • Custom script: call RemoveLocation(udg_TempPoint) //change the name to match your variable if not using TempPoint but keep the udg_ prefix
As for why I'm talking about "leaks": Things That Leak
 
Status
Not open for further replies.
Top