I'm just trying to get my NPC ally to use a units default abilities. Nothing custom, just the basic stuff like the ghosts cloak. When I give myself a ghost it has the cloak ability by default, if I spawn a ghost for my NPC ally, it should have cloak as well but it wont use it and I don't know why.
What am I missing and how can I make my NPC ally use the basic abilities?
An AI doesn't know what to do unless you tell it what to do.
You could, for example, write this trigger:
Events
Unit - Any Unit is attacked
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) == (Your ally player # here)
(Unit type of (Triggering unit)) == Ghost
Then
Unit - Order (Triggering unit) to (Ghost - Cloak (Ghost)) (Before Existing Orders)
Else
This trigger would make your ally Ghost cloak when he is attacked.
Thats going to get annoying for every ability each unit has. ; ; I guess I was assuming that functionality would already be present seeing as how it can use abilities in player vs AI melee matches. Seems a little odd to me. Either way, I guess it's off to the triggers menu I go.
So I've got quite a few abilities up and running, my cloakers cloak, my ravens spit out their turrets, Marines use their stimpack, etc...
My siege tanks don't come out of siege mode though. I've tried a bunch of different things with the idea that I want the tank to go back to tank mode when their are no more targets in range. I haven't been able to find a trigger that does this yet. It would be nice if I'm dumb and just missing it...
What I currently have that makes them dance back and forth from siege mode to tank mode after they go into siege mode the first time. It's on a periodic timer. "Unit - Any Unit dies" produces similar results. The problem with it is the acquired target part, it's not the acquired target of the picked unit but I don't see anything that gives me that information.
In order to get my AI to use abilities I set them on auto cast with a range of 10 (This may be too high for your needs). I then watched my AI and saw that they never cast unless I was within that range.
Hopefully you can make this work for you for all the abilities instead of making triggers for everything.
Yeah, I don't think triggers are going to work. I've started to get errors that shut every thing down saying too many threads are running. Do I do that in the data editor for the ability?
Yes its in the data editor for the ability. As an example I have set the sentry forcefield to auto cast range 10 and turned on the flags for auto cast and auto cast on. Give it a shot and let me know if it works for you.
I see the fields Auto Cast Validators and Validators, but nothing to turn on the auto cast. I also don't see anything about range so I may not be looking in the same spot as you. Do you think you could break it down Barney style and step me through what your talking about?
Right now I'm in the 'Abilities' tab looking at 'Ghost - Personal Cloaking' I've set the validators to very simple things like just plain 'has energy' if you have the energy, then cloak and I still get nothing.
EDIT: Just took a look at snipe and it has the auto cast range and a few other fields to play with. I'll keep tinkering...
Went to sleep, woke up took another crack at it and realized I'm an idiot. Either that or I should stop trying to work when I'm so tired my eyes are burning and I can't think straight. I didn't set the flag for auto cast on and auto cast. Once I set that and both the ability validators and ability autocast validators it worked.
Thanks for the help.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm just trying to get my NPC ally to use a units default abilities. Nothing custom, just the basic stuff like the ghosts cloak. When I give myself a ghost it has the cloak ability by default, if I spawn a ghost for my NPC ally, it should have cloak as well but it wont use it and I don't know why.
What am I missing and how can I make my NPC ally use the basic abilities?
An AI doesn't know what to do unless you tell it what to do.
You could, for example, write this trigger:
Events
Unit - Any Unit is attacked
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) == (Your ally player # here)
(Unit type of (Triggering unit)) == Ghost
Then
Unit - Order (Triggering unit) to (Ghost - Cloak (Ghost)) (Before Existing Orders)
Else
This trigger would make your ally Ghost cloak when he is attacked.
Thats going to get annoying for every ability each unit has. ; ; I guess I was assuming that functionality would already be present seeing as how it can use abilities in player vs AI melee matches. Seems a little odd to me. Either way, I guess it's off to the triggers menu I go.
Thanks for the explanation.
@Mastershadow:
They use abilities because the AI in melee matches has it's own personal triggers as well. They're a lot more complex, though...
Maybe it's possible to get them to be smart about it by using the melee AI, but I don't know how. Doubt it's possible anyways.
So I've got quite a few abilities up and running, my cloakers cloak, my ravens spit out their turrets, Marines use their stimpack, etc...
My siege tanks don't come out of siege mode though. I've tried a bunch of different things with the idea that I want the tank to go back to tank mode when their are no more targets in range. I haven't been able to find a trigger that does this yet. It would be nice if I'm dumb and just missing it...
What I currently have that makes them dance back and forth from siege mode to tank mode after they go into siege mode the first time. It's on a periodic timer. "Unit - Any Unit dies" produces similar results. The problem with it is the acquired target part, it's not the acquired target of the picked unit but I don't see anything that gives me that information.
TL;DR In short, how do I get my tanks out of siege mode once the enemy is out of it's attack range?
@Mastershadow:
In order to get my AI to use abilities I set them on auto cast with a range of 10 (This may be too high for your needs). I then watched my AI and saw that they never cast unless I was within that range.
Hopefully you can make this work for you for all the abilities instead of making triggers for everything.
Yeah, I don't think triggers are going to work. I've started to get errors that shut every thing down saying too many threads are running. Do I do that in the data editor for the ability?
@Mastershadow:
Yes its in the data editor for the ability. As an example I have set the sentry forcefield to auto cast range 10 and turned on the flags for auto cast and auto cast on. Give it a shot and let me know if it works for you.
I see the fields Auto Cast Validators and Validators, but nothing to turn on the auto cast. I also don't see anything about range so I may not be looking in the same spot as you. Do you think you could break it down Barney style and step me through what your talking about?
Right now I'm in the 'Abilities' tab looking at 'Ghost - Personal Cloaking' I've set the validators to very simple things like just plain 'has energy' if you have the energy, then cloak and I still get nothing.
EDIT: Just took a look at snipe and it has the auto cast range and a few other fields to play with. I'll keep tinkering...
Went to sleep, woke up took another crack at it and realized I'm an idiot. Either that or I should stop trying to work when I'm so tired my eyes are burning and I can't think straight. I didn't set the flag for auto cast on and auto cast. Once I set that and both the ability validators and ability autocast validators it worked.
Thanks for the help.