HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to make computer use spells?

06-30-2008, 09:54 AM#1
Moss
Hi everyone,

Does anybody know what it is that determines whether computer controlled units use their abilities?

I have a map where each player produces a bunch of units but control is given to a computer ally, so the player is in control of production, not unit movement, like Tech Wars. One unit type has the Taunt ability and they used to use it, but at some point I changed some player settings or triggers and now they refuse to taunt. If the unit belongs to Neutral Hostile then it works. But I need the computer allies to be within the 1-12 range and it used to work before without them being neutral hostile.
06-30-2008, 10:22 AM#2
Gorman
yes, i know what makes them use/not use abilities.

Firstly u need to make sure that in the initialisation trigger it says "Melee Game - Run melee AI scripts (for computer players)"
Which makes them actualy react to stuff

Then make sure if your using a dummy unit that they will cast at the right time that you want it to.

Taunt is in the actual game, so it should be fine, they will cast it at the normal time, just check he trigger.
06-30-2008, 03:19 PM#3
moyack
To make it more functional, I'd create a file with this line:

Collapse JASS:
function main takes nothing returns nothing
endfunction

save it as dummy.ai and import it to the map, then, by triggers set the AI with this file and voila!!

Why doing all this procedure? because the standard AItends to keep the units in the player start location, with this, we'll ensure that you can move those units with triggers and only take advantage of the hardcoded ability casting.
06-30-2008, 08:37 PM#4
Moss
Sorry guys, I tried both your suggestions and neither one works. There must be something else interfering. I thought maybe it has to do with the fact that the units are initially spawned for the human player but I use triggers to convert it to the computer ally. That isn't the issue though because when I pre-place units on the map they still don't use their abilities, but the neutral hostile pre-placed units do...

Some more info about my map: players 1-6 are set to User, 7-12 are set to Computer with fixed start location. The Forces tab is left at defaults. I have initialization triggers that make player 1 ally with player 6, player 2 ally with player 7, etc.
07-01-2008, 09:01 AM#5
Gorman
hang on, did u just say they are allied to the caster?
Coz then they wont cast for sure.
07-02-2008, 01:20 AM#6
Moss
This is bizarre. I have found out that if I mess with "Use Custom Forces" then I can get the computer allies to cast their spells, sometimes. It seems unpredictable, I change one thing and then it stops working. I'm still trying to figure it out, I swear it does different things each time.

I don't really want to have "Use Custom Forces" turned on. I liked it how I had it where only slots for players 1-6 were visible in the game lobby and players could change their teams and even be allies. If I turn on "Use Custom Forces" it breaks it all up into set teams. I suppose I could make alliances settable in-game. But now I am having trouble making it so that slots 7-12 are reserved for computer use only.

This stuff is all very strange and hard to control.
07-02-2008, 02:00 AM#7
moyack
Could you describe us how are the abilities (mainly the base ability and what those abilities do)? this has a relation with a bad spell behavior and casting as you mentioned.
07-02-2008, 06:45 AM#8
Moss
Moyack: I'm not sure I understand your question. But the spells so far ar Taunt, Sleep and Heal. No triggered spells or anything weird. I think the heal might work fine, but maybe autocast abilities are handled different.

Actually I figured out better what the situation is. The units will use their abilities as long as their slots are set to Computer (Easy/Normal/Insane) before you start the game. At first it wasn't working because slots 7-12 were set to None in the editor. Then I set them to Computer, but I'm using the NewGen editor with Grimoire to start the game with custom player settings and all those slots were set to Team 1. I fixed that and now they cast spells.

So I guess the real problem now is how do I lock slots 7-12 to make sure they are used by the computer? Even though I set them as Computer in the Player Properties window, when I host the game the slots are all listed as Open.
07-02-2008, 07:43 AM#9
Pyrogasm
"Lock player force settings".
07-02-2008, 10:58 PM#10
Ignitedstar
Go to player properties, then check the box that says something along the lines of "Fixed Player Settings". This will always make that player position be whatever it is that you put in.
07-03-2008, 04:12 AM#11
Moss
OK, it's Fixed Player Settings, in the Forces tab, but I swear it wasn't working before, not consistently. The problem is that players can't set their teams (or colors) before the game starts now. If that is the way it has to be then I will make some trigger system for allying in-game, but that is not ideal. Another problem I was having was that the fixed player settings were causing some of my triggers to bug out, but I have fixed them.

So basically I guess I have a workable situation now. Thanks for the help guys. If anybody thinks it is still possible to make the computers use their spells without having Use Custom Forces turned on, please let me know!

For those with similar problems, this was my ultimate solution:
In Player Properties I have 6 User players and 6 Computer players. The Computers have fixed start locations so that human players can't end up with their start locations (important for my map). In the forces tab "Use Custom Forces" and "Fixed Player Settings" are both on. There are 6 forces each with one of the User players and one of the Computer players. The Allied check boxes are turned on. And that is basically it. No AI script is needed. I have triggers so that the player controlled buildings effectively produce computer controlled allied units and any spells they have get cast according to the Warcraft default AI.