HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

AI - RemoveGuardPosition & SetUnitCreepGuard

04-16-2006, 10:03 PM#1
Yukitan
Okay, hello here I was wondering: did anyone notice this as well?

I'm working on aos-type map.. I have a problem: Most of the time the AI will not use their spells. A great example would be to spawn a Naga Royal Guard in a random map for the Neutral Aggressive player, order it to move to a certain point using the Attack order then put a random group of units to stop him. Okay, there you will notice (or is my warcraft 3 buggy?) he do not use his abilities.

So, I made .ai file for it. It work perfect and the Naga begin to cast it's spell. But the funny thing is that whenever I order him to move and call the function RemoveGuardPosition, he will just COMPLETELY STOP CASTING ANYTHING.

After somes test, SetUnitCreepGuard function seemed to work. You just call it after you create it, the naga suddenly use his abilities. (Wtf?)

Pretty much the same happen for other computer players. Except units don't use all of their abilities. (Druid of the Claw never shapeshift.) Also, once you call the function SetUnitCreepGuard(unit,true) then, it might sound funny but the AI stop order the unit to get back to it's initial guard point. I don't get it at all..

Basically, if you use the function RemoveGuardPosition the unit will never use their spell. Or hardly use them.

If you use the function SetUnitCreepGuard the unit will use their spell and will also ignore their guard position. But the unit will not always use their spell.

Other trouble: A Firelord given to a specific computer have it's Summon Lava Spawn up to max but never use it either. Yet, when he dies once, get revived by a trigger the Firelord SUDDENLY use the skill.

So my question is: Is there a way to make sure the unit will use their spells?

???

Thanks for help.
04-16-2006, 10:50 PM#2
moyack
Well, I've managed this using a slot controlled by a computer, different to Neutral Hostile.

In order to get the appropiate behavior, I used a dummy AI (it can be done in the AI editor, press F8) select the race that you want, put a name to the AI file, and add this AI file to the map, that's all.

Make sure that the player slot where you want to use the AI, has the computer controller selected, otherwise it doesn't work.

Trigger:
Melee Initialization
Collapse Events
Map initialization
Conditions
Collapse Actions
Melee Game - Use melee time of day (for all players)
Melee Game - Limit Heroes to 1 per Hero-type (for all players)
Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
Melee Game - Set starting resources (for all players)
AI - Start melee AI script for Player 2 (Blue): war3mapImported\dummy_AI.ai
04-16-2006, 11:05 PM#3
Yukitan
I know about the Dummy AI, the thing is... Why does calling the function RemoveGuardPosition makes the computer unable to use all the spells of their units?
04-16-2006, 11:47 PM#4
Earth-Fury
I wonder.... would modifying their camp location allow you to in essance "order" neutral / camping units to move to a specific location?
04-17-2006, 12:48 AM#5
Vuen
Quote:
Originally Posted by Yukitan
I know about the Dummy AI, the thing is... Why does calling the function RemoveGuardPosition makes the computer unable to use all the spells of their units?

I've noticed the same thing, but only for certain spells. For example, priests who've had RemoveGuardPosition will still constantly cast Heal, even without it being autocast (I can see autocast status because of shared control). However many spells will never be cast at all by units with removed guard position.

I have no idea why it happens or how to fix it.
04-27-2006, 01:49 PM#6
BertTheJasser
I think this is a general hard coded problem. Some spells like carion swarm are only then cast when enough units are in range or in a line. Burrow gets cast when the unit's hp goes under a specific percentage of mxa hp. etc. Every single spell has his own "conditions". I don't know every thing about taht, but I am quite sure that a carrionswarm ability with a target range of 0 will be never cast by an CPU. Tell me if I am wrong.