Making a auto cast Roar for a pet.

mr_fj

New Member
Reaction score
10
I'm making a AoS map, and I want my hero's pet to auto cast Roar...
I haven't been able to make a true Auto-Cast Roar (If you know how, please enlighten me), so I made this trigger,to make the pet cast it on attack, by copying from triggers converted to text, and using my knowledge of coding in general:
Trigger:
  • Bear Roar
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(attack))
      • ((Ordered unit) is A ground unit) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Ordered unit)) Equal to Adult Bear (Level 3)
          • (Unit-type of (Ordered unit)) Equal to Trained Bear (Level 4)
          • (Unit-type of (Ordered unit)) Equal to Champion Bear (Level 5)
    • Actions
      • Custom script: local unit BEAR
      • Custom script: local unit TARGET
      • Custom script: set BEAR = GetOrderedUnit()
      • Custom script: set TARGET = GetOrderTargetUnit()
      • Unit - Order (Ordered unit) to Night Elf Druid Of The Claw - Roar
      • Custom script: call IssueTargetOrderBJ( BEAR, "attack", TARGET )


Why isn't it working?
 

DuelPlayer

Member
Reaction score
21
Maybe the pet dont have enough mana? or the spell requires mana? or the pet does not have the ability? or the ability not based on roar upon creation?
 

mr_fj

New Member
Reaction score
10
0 mana cost. The pet has the custom ability. The ability is based on Roar.
 

HeX.16

Isn't Trollin You Right Now
Reaction score
131
Make an item based off a tome of health. Add the roar ability to the item. Then add that item to your pet. It will use it. If the field is "use when aquired"
 

Bogrim

y hello thar
Reaction score
154
The easiest way to make a unit auto-cast something like Roar is to give it Frenzy (the Quilbeast's auto-cast ability) and simply pick up on the cast in a trigger, create a dummy unit and make the dummy cast the Roar spell.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
I'm making a AoS map, and I want my hero's pet to auto cast Roar...
I haven't been able to make a true Auto-Cast Roar (If you know how, please enlighten me), so I made this trigger,to make the pet cast it on attack, by copying from triggers converted to text, and using my knowledge of coding in general:
Trigger:
  • Bear Roar
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(attack))
      • ((Ordered unit) is A ground unit) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Ordered unit)) Equal to Adult Bear (Level 3)
          • (Unit-type of (Ordered unit)) Equal to Trained Bear (Level 4)
          • (Unit-type of (Ordered unit)) Equal to Champion Bear (Level 5)
    • Actions
      • Custom script: local unit BEAR
      • Custom script: local unit TARGET
      • Custom script: set BEAR = GetOrderedUnit()
      • Custom script: set TARGET = GetOrderTargetUnit()
      • Unit - Order (Ordered unit) to Night Elf Druid Of The Claw - Roar
      • Custom script: call IssueTargetOrderBJ( BEAR, "attack", TARGET )


Why isn't it working?

first of all, what do you need the Jass code for? everything you do can be done with simple GUI, besides you forgot to null the local variables.

next, what do you need this condition for:
Trigger:
  • ((Ordered unit) is A ground unit) Equal to True

if you know what unit types shall auto cast it you can be sure whether they are ground or flying units.

another thing is that you order your unit to attack in your trigger though the trigger itself is running with an event which detects whether a unit is ordered to attack, this will result in an infinite loop if you dont turn off that trigger before and on afterwards.

another issue might be that right-clicking a target is not considered an order to attack but smart. the order attack is only given if you click the attack button and left click the target.
 

mr_fj

New Member
Reaction score
10
first of all, what do you need the Jass code for? everything you do can be done with simple GUI, besides you forgot to null the local variables.

next, what do you need this condition for:
Trigger:
  • ((Ordered unit) is A ground unit) Equal to True

if you know what unit types shall auto cast it you can be sure whether they are ground or flying units.

another thing is that you order your unit to attack in your trigger though the trigger itself is running with an event which detects whether a unit is ordered to attack, this will result in an infinite loop if you dont turn off that trigger before and on afterwards.

another issue might be that right-clicking a target is not considered an order to attack but smart. the order attack is only given if you click the attack button and left click the target.

As for the Jass code, I have not used Jass code before, at all. What I meant with the "copied from other triggers... using basic coding knowledge" part is, I know the world editor pretty well, but the custom script is, as i said, partly loaned from another trigger.
By looking at other spells in the past, I thought I needed the locals because: When this trigger fires (if it worked), the unit stops what it is doing to roar, then afterwards it returns to attack what it was already attacking. If I tried to do this without the locals, the "ordered unit" variable would be overwritten as the unit roars, would it not? Then how do I refer to it's original attack order?

You have to do a "LOCAL = null" after each trigger in Jass? I guess I thought the local would just get killed when the trigger had fired. Hmm I'll add that then.

No, I guess I don't need the "is a ground unit" condition :p, it's a remnant from when the trigger looked a lot different, will remove it now :)

The fact is that the roar spell is on a cooldown, I see the loop problem, how do you suggest I do a "Is spell on cooldown" check?

I didn't even think about right click being a different command... Hmm I will try to find another way to do the check, open for suggestions :)
 

mr_fj

New Member
Reaction score
10
Okay... What... The... Well...

Um... Here's my trigger so far, I realise there is still the loop, but I have a very strange problem with the trigger as it is now.

Trigger:
  • Bear Roar
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Adult Bear (Level 3)
          • (Unit-type of (Attacking unit)) Equal to Trained Bear (Level 4)
          • (Unit-type of (Attacking unit)) Equal to Champion Bear (Level 5)
    • Actions
      • Custom script: local unit BEAR
      • Custom script: local unit TARGET
      • Custom script: set BEAR = GetOrderedUnit()
      • Custom script: set TARGET = GetOrderTargetUnit()
      • Unit - Order (Ordered unit) to Night Elf Druid Of The Claw - Roar
      • Custom script: call IssueTargetOrderBJ( BEAR, "attack", TARGET )
      • Custom script: set BEAR = null
      • Custom script: set TARGET = null


The Bear does not Roar.
 

Tamisrah

Active Member
Reaction score
16
JASS:
local unit bear = GetTriggerUnit() // equal to: GetAttackedUnitBJ()
local unit target = GetAttacker()
call IssueImmediateOrder(bear,"roar")
call TriggerSleepAction(0.)
call IssueTargetOrder(bear,"attack",target)
set bear = null
set target = null


I didn't check in WE so might not work but I'd try it like that.
The most important thing is that you can't issue 2 orders at once iirc.

PS: You should definitely come up with something to keep your pet from switching targets all the time.
 

BlackRose

Forum User
Reaction score
239
Uhm. Roar doesn't interrupt orders does it? Also, I'd go with what Bogrim said. Have an autocast spell, like Frost Armor, when it procs, order a dummy to "ROARRRRRRRRRRRRRRRRRRRRRRRRR" for it.

Eliminates the re-order of attack and the problem :)
 

Bogrim

y hello thar
Reaction score
154
Roar isn't like Berserk - because it has an animation, the unit must stop to cast the ability. That means you can't immediately issue a new order without overwriting the previous order. In general, issuing orders for player controlled units with triggers is bad and should be avoided whenever possible.

The reason for your trigger doesn't work is because the "unit is attacked" event triggers when the attacking unit begins the swing and not on the actual damage event, and when you reissue the attack order you reset the swing, creating a trigger loop (which is probably the reason the bear is removed from the game).

Again, the best way to do this is to use Frenzy, since Frenzy is an auto-cast version of Berserk and you can detect the cast with an event.
 

mr_fj

New Member
Reaction score
10
I really really don't want to use a dummy unit/spell... And are you guys sure there isn't a way to check if a spell is on cooldown? Hmm I think I have another Idea, is there a way to do a "Wait until animation finishes" Alternately, how long does a roar last?
 

mr_fj

New Member
Reaction score
10
JASS:
local unit bear = GetTriggerUnit() // equal to: GetAttackedUnitBJ()
local unit target = GetAttacker()
call IssueImmediateOrder(bear,"roar")
call TriggerSleepAction(0.)
call IssueTargetOrder(bear,"attack",target)
set bear = null
set target = null


I didn't check in WE so might not work but I'd try it like that.
The most important thing is that you can't issue 2 orders at once iirc.

PS: You should definitely come up with something to keep your pet from switching targets all the time.

Will try your code :)
 

Bogrim

y hello thar
Reaction score
154
I really really don't want to use a dummy unit/spell...
I'd answer your other questions, but this simply isn't a good enough reason to ignore the better solution. Why would you not want to use a dummy unit? That is how almost every trigger spell in WC3 works.
 

mr_fj

New Member
Reaction score
10
I'd answer your other questions, but this simply isn't a good enough reason to ignore the better solution. Why would you not want to use a dummy unit? That is how almost every trigger spell in WC3 works.

I'm trying to avoid trigger spells as much as possible in this map, a dummy is a bit too much imo. Sorry, I wont be using dummies. :/
 

mr_fj

New Member
Reaction score
10
Okay what... My trigger was disabled because of errors and my Bear still gets deleted the second time he attacks :S :S I don't have any other spells related to this Bear...

Edit: Fixed the error and tried again with the trigger enabled, this trigger:
Trigger:
  • Bear Roar
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • BearRoar Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Adult Bear (Level 3)
          • (Unit-type of (Attacking unit)) Equal to Trained Bear (Level 4)
          • (Unit-type of (Attacking unit)) Equal to Champion Bear (Level 5)
    • Actions
      • Custom script: local unit BEAR
      • Custom script: local unit TARGET
      • Custom script: set BEAR = GetAttacker()
      • Custom script: set TARGET = GetAttackedUnitBJ()
      • Unit - Order (Ordered unit) to Night Elf Druid Of The Claw - Roar
      • Wait 1.00 seconds
      • Custom script: call IssueTargetOrderBJ( BEAR, "attack", TARGET )
      • Custom script: set BEAR = null
      • Custom script: set TARGET = null
      • Set BearRoar = False
      • Wait 30.00 seconds
      • Set BearRoar = True
Still doesn't roar.
 

Bogrim

y hello thar
Reaction score
154
I'm trying to avoid trigger spells as much as possible in this map, a dummy is a bit too much imo. Sorry, I wont be using dummies. :/
Set a location. Create a model-less locust unit. Add Roar to last created unit. Add an expiration to last created unit. Order last created unit to use roar. Remove location.

It's fewer lines than what your trigger has.
 

mr_fj

New Member
Reaction score
10
Set a location. Create a model-less locust unit. Add Roar to last created unit. Add an expiration to last created unit. Order last created unit to use roar. Remove location.

It's fewer lines than what your trigger has.

1. The bear won't do any animations
2. I have no control over whether the bear get's the buff or not.
3. I want to find a way to do it without using dummies :/
 

Bogrim

y hello thar
Reaction score
154
1. The bear won't do any animations
2. I have no control over whether the bear get's the buff or not.
3. I want to find a way to do it without using dummies :/
1.
Trigger:
  • Actions
    • Animation - Play (Triggering unit)'s spell animation
    • Animation - Queue (Triggering unit)'s stand animation

2. If the bear matches the target requirements of the Roar cast, it will always get the buff.

3. Dummy units is one of the best way to do triggers, and you won't find 1 map with triggers which doesn't use at least one type of dummy units.

Fj, you think of this as an unexplored territory and want to be secure about the method you use. That's understandable and a good approach for a working map. However, what you really need to understand that this is amongst the most trivial things and it's just about being willing to learn.

The solution was posted on page one. We're on page two and you're still not even willing to try making the other trigger. It's not going to destroy your map.
 

mr_fj

New Member
Reaction score
10
1.
Trigger:
  • Actions
    • Animation - Play (Triggering unit)'s spell animation
    • Animation - Queue (Triggering unit)'s stand animation

2. If the bear matches the target requirements of the Roar cast, it will always get the buff.

3. Dummy units is one of the best way to do triggers, and you won't find 1 map with triggers which doesn't use at least one type of dummy units.

Fj, you think of this as an unexplored territory and want to be secure about the method you use. That's understandable and a good approach for a working map. However, what you really need to understand that this is amongst the most trivial things and it's just about being willing to learn.

The solution was posted on page one. We're on page two and you're still not even willing to try making the other trigger. It's not going to destroy your map.

1. Yes, but that just doesn't seem as real to me.

2. Yes, but if I use a dummy unit, the bear is no longer "self" and I can't choose not to target the bear.

3. Yeah, no... There are lots of maps that don't use dummy units.

I have used dummy units before, several times. I just don't want to use them in this map, I want to see if I can do it without using a dummy, why can't you just accept that? :)

Look I made a trigger with a dummy:
Trigger:
  • RoarDummy
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Roar
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Adult Bear (Level 3)
          • (Unit-type of (Attacking unit)) Equal to Trained Bear (Level 4)
          • (Unit-type of (Attacking unit)) Equal to Champion Bear (Level 5)
    • Actions
      • Unit - Create 1 Roar Dummy for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Unit - Make (Last created unit) Invulnerable
      • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Roar
      • Animation - Play (Attacking unit)'s spell animation
      • Animation - Queue (Attacking unit)'s stand animation
      • Unit - Remove (Last created unit) from the game


I still wont be using it though, I want to try to do it without. So if you have any ideas for my problem, please do tell :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top