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?
 
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?
 
0 mana cost. The pet has the custom ability. The ability is based on Roar.
 
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"
 
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.
 
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.
 
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 :)
 
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.
 
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.
 
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 :)
 
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.
 
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?
 
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 :)
 
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.
 
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. :/
 
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.
 
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.
 
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 :/
 
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.
 
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 The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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