• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Mobs using their abilities

Status
Not open for further replies.
Level 5
Joined
Dec 3, 2012
Messages
117
So, I've been wondering this forever and I see it all the time, but apparently it's not as easy at it looks, because it simply won't work.

How to make neutral hostile/enemy mobs use their abilities?
Working on a pretty big RPG project and I really need mobs to use their abilities but I do not know how to do this. :/
 
The AI will automaticly use all spells based on how the AI would use the ability the spell is based on.
However, it will never use channel-based abilities.

So if you want the AI to autocast spells, make sure they are based on an ability that has the desired AI behaviour.


If the abilities are channel, you must manually script the AI.
 
Level 23
Joined
Oct 20, 2012
Messages
3,075
You could try something like this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Triggering unit) Equal to (Your hero)
          • (Attacking unit) Equal to (Casting Monster)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 40
        • Then - Actions
          • Issue order to cast spell
        • Else - Actions
 
Level 5
Joined
Dec 3, 2012
Messages
117
You could try something like this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Triggering unit) Equal to (Your hero)
          • (Attacking unit) Equal to (Casting Monster)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 40
        • Then - Actions
          • Issue order to cast spell
        • Else - Actions

Yeah I was thinking about summin like that, thanks guys :)
 
Level 5
Joined
Dec 3, 2012
Messages
117
I cannot seem to figure out how to order the monster to use custom abilities.
All I can pick from are some preset hero abilities, but as these units aren't all heroes, that's extremely useless to me atm =/

Isn't there a way to order units to use a custom spell ?
In Custom Script if needed D;
 
Level 5
Joined
Dec 3, 2012
Messages
117
It's easy, create a database/library of abilities then make many triggers or one trigger with different kinds of events and activators to make them cast.

I suggest using channel.
Holy sh... What? o.o;


Wasn't there a way in which 2 or more abilities would cast simultaneously ?
I remember it being something in the abilities editor giving 2 abilities the same to turn on..?
 
You asked how to make the AI cast their own abilities right? If you use the standard almost AI ones then it could somewhat work without requiring you to re-trigger everything however war stomp only works with 3+ units for example.

call IssueTargetOrderBJ( null, "invisibility", null ) That is what this looks like Unit - Order No unit to Human Sorceress - Invisibility No unit.
You could try messing around with the JASS version however I don't know of a way so if there is one without making a massive library of abilities then I would as well appreciate anyone sharing their knowledge of it. Though you could just use normal ability checks and normal ability orders though it is slower and looks quite bad. Why use channel is for its versatility. Able to change your order string is quite the useful feature it provided for everyone.

Yes though you could give two abilities however some don't double-cast such as blink or blizzard because they're point targets while warstomp and thunderclap would both cast I think because of no-target or point order.
 
Level 5
Joined
Dec 3, 2012
Messages
117
I don't get why they made it so difficult to let neutral/enemy monsters/units use custom abilities...
How do they do it in all those RPG maps etc ?
 
Usually like warstomp and common spells then ordering them anyways or using what I suggested. Some even do timers and randomizing such as impossible bosses I think or well It sure looked like it.

Take for example firebolt, it only takes one unit. Do you still want an example or do you want to take the easier way?
We could wait for someone to suggest something else though you know.

GreeN!x has a good understanding of it and showed you a method.

Hope this may provide some insight into your problem. http://www.hiveworkshop.com/forums/...m-v2-2-4-a-211823/?prev=search=ai&d=list&r=20

Sadly Blizzard made it really hard on us GUI'ers, since I never bothered with abilities themselves much I am not sure if it is impossible or not for something else from what I have typed besides hashtables.
 
Level 5
Joined
Dec 3, 2012
Messages
117
-The AI does not list-

-Buy items from shop. (The AOS version of this system has a item buy system try it.)
-Use skills. (I recomend to use the blizzard's order string.)

Again, made for the blizzard skills =(

For example I'm trying to get a random mob to cast sleep, either as autocast or as a random chance when attacked, but neither is working, as there is simply no way in the trigger editor to have a unit cast "custom spell sleep"

And seeing as it's an RPG map, I'm going to need many more monster skills, both for random monsters, mini bosses and bosses.
 
Level 4
Joined
Jan 5, 2014
Messages
79
Is it really so hard?

I guess you based your custom sleep spell on the normal sleep spell.
There were also some talks about the spell being cast with some chance on an autoattack.

So lets have unit A with the spell and unit B which attacks unit A.

Event would be:
Unit A is attacked

Condition
Random integer between 1 and 100 is lower than 70 (unit A will try to cast the spell in 70 percent of the cases when it is attacked)

Action:
(I persume you didn't change the order field for the spell in the editor)
Order Unit A to Undead - Lich - Sleep the Unit B (or a random unit in 300 radius or whatever, be aware of leaks)
(I use the Issue an order targeting a unit, I am not sure with the "Undead - Lich - Sleep" part, but it is something simmilar and you will surely find it there)

I have to admit that I guess that the problem is more complicated coz so lot has been written here and I think my solution is too simple, yet I try
 
Level 5
Joined
Dec 3, 2012
Messages
117
I don't see what your issue is or the problem your facing. . .
Yeah RPG's need lots.

Why is there no way for a unit to cast custom sleep? Re-check before assuming.

Haven't tested your link yet, but I'm not assuming, I have been trying for a while and cannot find a way.
And like I said before, it's not just sleep I need, it's a wide array of custom abilities that need to work.


Is it really so hard?

I guess you based your custom sleep spell on the normal sleep spell.
There were also some talks about the spell being cast with some chance on an autoattack.

So lets have unit A with the spell and unit B which attacks unit A.

Event would be:
Unit A is attacked

Condition
Random integer between 1 and 100 is lower than 70 (unit A will try to cast the spell in 70 percent of the cases when it is attacked)

Action:
(I persume you didn't change the order field for the spell in the editor)
Order Unit A to Undead - Lich - Sleep the Unit B (or a random unit in 300 radius or whatever, be aware of leaks)
(I use the Issue an order targeting a unit, I am not sure with the "Undead - Lich - Sleep" part, but it is something simmilar and you will surely find it there)

I have to admit that I guess that the problem is more complicated coz so lot has been written here and I think my solution is too simple, yet I try

This doesn't seem to work, even if you base it off the Hero Sleep spell.


This might be helpful for you: Link
There is a demo map how to make use of blizzard's standarts in order to fire custom abilities.

Keep in mind that most of these base abilities are fired as a response of i.e damage and not out of the blue.

If you need a more intelligent creep behaviour, you'll have to write or use an AI System.

This seems promising, but in this list it says base ability Sleep should be cast by AIs... weird, cause it doesn't
 
Level 4
Joined
Jan 5, 2014
Messages
79
This doesn't seem to work, even if you base it off the Hero Sleep spell.

kinda interesting, for me it works perfectly

in the attached map just learn the sleep ability with the dreadlord and than, when the ghoul attacks the dreadlord the dreadlord immidiately casts the sleep on the ghoul
 

Attachments

  • sleep.w3x
    16.1 KB · Views: 86
Level 5
Joined
Dec 3, 2012
Messages
117
You really should have tried my test-map instead of denying everyone trying to help you.

Don't get me wrong, please, I am definitely not denying anyone trying to help me without reason.

I have tested your map and I see it does indeed work, but it did not for me, so forgive me for being skeptical.
So if I understand this correctly, the copied Sleep ability needs to remain a Hero ability for this to work?


kinda interesting, for me it works perfectly

in the attached map just learn the sleep ability with the dreadlord and than, when the ghoul attacks the dreadlord the dreadlord immidiately casts the sleep on the ghoul

I never doubted that casting Dreadlord - Sleep using triggers would work with an actual Dreadlord hero with the Sleep ability.

What I'm trying is to get normal units (non heroes) to be able to cast abilities
 
Level 5
Joined
Dec 3, 2012
Messages
117
OE Sleep Stats:
http://imgur.com/ncQE3Yv

Trigger;
  • Sleep Attack Copy
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Sleep Attack Lv4 (Mobs) for (Attacked unit)) Equal to 1
    • Actions
      • Set TEMPInteger = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TEMPInteger Equal to 1
        • Then - Actions
          • Game - Display to (All players) the text: Sucess!
          • Unit - Order (Casting unit) to Undead Dreadlord - Sleep (Attacking unit)
        • Else - Actions
      • -------- Lvl 1 --------
Stlll doesn't work... Could it be the name, could it be that simple? :/

EDIT: It's not the name, either.

What about the JASS version that u also included in the map, how does that work ? (I'm terrible at JASS, I cannot script at all) But if that works with any (Base-)ability at all, that would be way, way preferred to use ofc, seeing as I will also have non preset hero abilities that need to be used.
 
OE Sleep Stats:
http://imgur.com/ncQE3Yv

Trigger;
  • Sleep Attack Copy
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Sleep Attack Lv4 (Mobs) for (Attacked unit)) Equal to 1
    • Actions
      • Set TEMPInteger = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TEMPInteger Equal to 1
        • Then - Actions
          • Game - Display to (All players) the text: Sucess!
          • Unit - Order (Casting unit) to Undead Dreadlord - Sleep (Attacking unit)
        • Else - Actions
      • -------- Lvl 1 --------
Stlll doesn't work... Could it be the name, could it be that simple? :/

EDIT: It's not the name, either.

What about the JASS version that u also included in the map, how does that work ? (I'm terrible at JASS, I cannot script at all) But if that works with any (Base-)ability at all, that would be way, way preferred to use ofc, seeing as I will also have non preset hero abilities that need to be used.

Trigger;
  • Sleep Attack Copy
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Sleep Attack Lv4 (Mobs) for (Triggering unit)) Equal to 1
    • Actions
      • Set TEMPInteger = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TEMPInteger Equal to 1
        • Then - Actions
          • Game - Display to (All players) the text: Sucess!
          • Unit - Order (Triggering unit) to Undead Dreadlord - Sleep (Attacking unit)
        • Else - Actions
      • -------- Lvl 1 --------
You don't really need TEMPInteger for a 1 to 2 part.
 
Level 5
Joined
Dec 3, 2012
Messages
117
Oh, well, I basically just always use TEMPInteger for stuff like that in almost every trigger xD
I find it easier to oversee stuff like that

Anyway, I finally fixed it, it works (YAY), only this sprouted a new problem; right after the short invulnerable period (while still sleeping) the mob decides to attack me. dumbass.

I'd also like to know more about that JASS system you put in that map you showed me, can that make mobs use any ability and not just the preset hero abilities?
 
Last edited:
Status
Not open for further replies.
Top