[General] AI and Spells

Level 4
Joined
Apr 21, 2016
Messages
31
Hi all!

Firstly, I'd like to apologise if this subject was discussed somewhere but I wasn't able to find it. If so, getting pointed to it would be highly appreciated!

Now the crux of my problem.
In a map of several Players and a Computer, there is a computer controlled building with abilities that players can use -but- the issue is that the computer casts them at the first opportunity and wastes the CD. I want to prevent computer from casting them but still allowing players to use them. I tried with triggers that apply Stop command whenever computer uses a spell but that prevents other continuous action from happening. Tried applying a custom upgrade through a trigger when a spell is bought so only players have the requirements but that still leaves players unable to cast as they are greyed out (because computer is missing the upgrade).

Is there a way to make it so that the computer unit doesn't cast them until players decide to?

Thank you in advance!
 
Level 12
Joined
May 29, 2008
Messages
149
You could try not putting a computer player in that player slot? Without a computer in the slot, there will be no AI to cast the abilities. This applies to all of the units owned by the computer, but could solve your issue if the AI only controls things that you don't want casting abilities. You can continue using the play slot as you would in your triggers and creating units for it.
 
Level 11
Joined
Nov 15, 2007
Messages
800
If you need to run melee AI scripts for the computer players, have an extra "Neutral" ally that controls the spell building(s) instead. If the computer AI has to build the building beforehand, have its ownership transferred to the neutral ally when it's built. If you don't need melee AI scripts at all just remove the action that turns on melee AI scripts from the map initialization trigger.

Another solution would be to base all the shared spells off of a non-melee spell like Channel, which the AI shouldn't cast because it's not scripted to do so, and trigger the effects of the spells instead.
 
Level 4
Joined
Apr 21, 2016
Messages
31
You can use Player - Enable/Disable Ability to make the abilities unavailable at map init for the computer player and then restore them whenever you want
Tried that. If I enable it for players and not the computer, the spells players bought aren't shown on the NPC.
You could try not putting a computer player in that player slot? Without a computer in the slot, there will be no AI to cast the abilities. This applies to all of the units owned by the computer, but could solve your issue if the AI only controls things that you don't want casting abilities. You can continue using the play slot as you would in your triggers and creating units for it.
Will that still enable the NPC to attack enemies that come within range?
If you need to run melee AI scripts for the computer players, have an extra "Neutral" ally that controls the spell building(s) instead. If the computer AI has to build the building beforehand, have its ownership transferred to the neutral ally when it's built. If you don't need melee AI scripts at all just remove the action that turns on melee AI scripts from the map initialization trigger.

Another solution would be to base all the shared spells off of a non-melee spell like Channel, which the AI shouldn't cast because it's not scripted to do so, and trigger the effects of the spells instead.
What exactly do you mean by the latter? Adding channel into Art - Animation Names?
The channel one (Blizzard) has stand, channel and some don't have anything.

P.S wow! Thank you for such fast replies! ❤️
 
Level 11
Joined
Nov 15, 2007
Messages
800
What exactly do you mean by the latter? Adding channel into Art - Animation Names?
The channel one (Blizzard) has stand, channel and some don't have anything.
Just use "Channel" as the base spell. The ability does nothing but cost mana and have a cooldown, you would have a trigger that performs the actual spell effects when it's cast.
 
Level 21
Joined
Mar 16, 2008
Messages
955
Top