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

Pet Attack button - possible?

Status
Not open for further replies.
Level 2
Joined
Jan 22, 2012
Messages
6
Hey folks. I've been wracking my brain for the past couple of days on this, lol...

Here's what I got...
I'm using the Summon Misha (Rexxar) ability to summon my pet, so it's a permanent pet.

Here's what I want...
A button (ability) for my Hero to tell my pet to attack a target. Basically, I hit this "ability", click on the target and BAM my pet runs off to attack it. Is it actually possible?

Here's what I've tried...
My latest attempt I tried coupling it with Faerie Fire so when I cast Faerie Fire on a target, my pet would go attack it (kinda cool I thought).
"Order (Units owned by Player 1 (Red) of type Misha (level 1)) to Attack (Target unit of ability being cast).
It did nothing.

I've tried so many variations of that and honestly I am about to give up. I'm not a pro at this, obviously lol but I'm trying. If anyone could help me out or even just point me in the right direction, would be greatly appreciated :)
 
Level 3
Joined
Dec 30, 2011
Messages
54
Try this : use a variable for your summoned unit (in my example it's called Misha)
Then
  • Pet attack
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to "your ability"
    • Actions
      • Unit - Order Misha to Attack (Target unit of ability being cast)
 
Level 7
Joined
Apr 30, 2011
Messages
359
Try this : use a variable for your summoned unit (in my example it's called Misha)
Then
  • Pet attack
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to "your ability"
    • Actions
      • Unit - Order Misha to Attack (Target unit of ability being cast)

should be like this:
  • Pet Store
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Misha
    • Actions
      • Set Misha = (Summoned unit)
  • Pet Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Misha Attack!
    • Actions
      • Unit - Order Misha to Attack (Target unit of ability being cast)
Misha Attack! is the skill name, and Misha is the summoned unit . . .
 
Level 2
Joined
Jan 22, 2012
Messages
6
Sweet, it works! ... I can't believe I have been struggling with this for the past couple of days /sigh.

I was messing up on the variable because I forgot to set it LOL... how did I miss that for 2 days? Oh well, live and learn I guess!

Thanks, guys.. much appreciated! :)
 
Level 3
Joined
Dec 30, 2011
Messages
54
should be like this:
  • Pet Store
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Misha
    • Actions
      • Set Misha = (Summoned unit)
  • Pet Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Misha Attack!
    • Actions
      • Unit - Order Misha to Attack (Target unit of ability being cast)
Misha Attack! is the skill name, and Misha is the summoned unit . . .

Yeah i didn't show the variable setting :p
 
Actually, this is the best:

  • OnSummon
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Misha
    • Actions
      • Set TempUnit = (Summoned unit)
      • If (Condtions) do (Then - Actions) else do (Else - Actions)
        • If - Conditions
          • (Unit-type of TempUnit) Equal to Misha
        • Then - Actions
          • Set Misha = (Summoned unit)
  • Pet Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Misha Attack!
    • Actions
      • Unit - Order Misha to Attack (Target unit of ability being cast)
Sometimes, when you're repeating function calls within a condition, it's simply better to use an if/then/else block instead so you can cache the data into global variables for reusage.
 
Level 7
Joined
Apr 30, 2011
Messages
359
Actually, this is the best:

  • OnSummon
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Misha
    • Actions
      • Set TempUnit = (Summoned unit)
      • If (Condtions) do (Then - Actions) else do (Else - Actions)
        • If - Conditions
          • (Unit-type of TempUnit) Equal to Misha
        • Then - Actions
          • Set Misha = (Summoned unit)
  • Pet Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Misha Attack!
    • Actions
      • Unit - Order Misha to Attack (Target unit of ability being cast)
Sometimes, when you're repeating function calls within a condition, it's simply better to use an if/then/else block instead so you can cache the data into global variables for reusage.

should be like this maybe?

  • On Summon
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Misha
    • Actions
      • Set TempUnit = (Summoned unit)
      • If (Condtions) do (Then - Actions) else do (Else - Actions)
        • If - Conditions
          • (Unit-type of TempUnit) Equal to Misha
        • Then - Actions
          • Set Misha = TempUnit
      • Custom script: set udg_TempUnit = null
  • Pet Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Misha Attack!
    • Actions
      • Unit - Order Misha to Attack (Target unit of ability being cast)
 
Status
Not open for further replies.
Top