HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Computers that use abilities automatically HELP!!

03-23-2006, 03:34 PM#1
Ghost.X
Trying to figure this out gives me a headache . I'm trying to figure out how to make computer units use their abilities automatically as they would if they were attacking. I came up with something like this.

Event - every 2.5 game seconds
Action - (Pick every unit within 1500 range of "the unit i selected" matching condition is in player group all players of user control) do action (order "the unit i selected' to impale to position of picked unit.

This works allright but the only problem is i have to do this trigger for every unit I want to use an ability. I want a system that would do this for all units of the type that has the ability to use it as if they were attacking. So if i was to walk up to the unit it would start using that ability on me. It's for my Contra: Rave of Death map. If anyone can figure this out you have made my whole map project series easier and a lot funner and my extreme gratitude and a place in the credits
05-04-2006, 07:16 PM#2
BertTheJasser
Hmm... You can just create a dummy AI and start it for the depending players
Or...
careat group g
Create a trigger[inrange]
Attach group g to trigger[inrange]
Create a trigger[enterrect] that registers whenevere a unit enters the map rect. Then add a eventresponse to the trigger[inrange] "whenever unit enters range of unit"... add the picked unit to g. Then whenever a unit comes to close to a non human unit it will exectute thr triggeraction of trigger[inrange]. There you must loop all units of the group to get the unit's inrange of the picked unit. Then whenever a unit fullfills the conditions, order the depending spell.

Hope I could help. ;D
05-04-2006, 08:11 PM#3
Ghost.X
Umm...appreciate your help but I don't quite understand what your saying.
05-04-2006, 10:50 PM#4
xXx-Tricky-xXx
well theyll use one ability if you set it in default active ability.
05-05-2006, 04:06 PM#5
Captain Griffen
Quote:
Originally Posted by xXx-Tricky-xXx
well theyll use one ability if you set it in default active ability.

No, that will make it default to being autocast on. Which only works on autocast abilities.
05-05-2006, 06:58 PM#6
Thunder_Eye
The units will use the abilities, you dont need to make a AI script for this.
I'm 100% sure of this because before I had some trouble accomplishing this. But I found a way.

Not sure how I did, but it did not involve triggers. If you for example just try place a computer owned unit on a map with level 1 on each ability and attack him, he will defend himself with his abilities.(Try an Mountain King for example)

The problem was something about the computer settings, so try playing with them.
05-05-2006, 10:02 PM#7
shadow1500
This will only work well for melee style games because the AI was built for it, a computer will only cast war stomp if he is sorrounded, this won't happen often in hero arenas for example, so a good way to do this is to base the spells on abilities that computers use often, like storm bolt.
05-06-2006, 06:41 AM#8
BertTheJasser
There must be a way to do it properly. The solutions displayed here are not perfect at all.
05-06-2006, 08:37 AM#9
Thunder_Eye
I believe there are 3 ways(that I can think of)
1.make an AI script for it
2.Like Ghost.X did with triggers
3.Like I suggested just basing them on suiting abilites (as shadow1500 said this might give some problem as you cant really modify it for your own will)
05-06-2006, 04:57 PM#10
shadow1500
I dont think you can change the way the AI will cast spells by with an AI script, i think its built-in feature of the AI.
05-06-2006, 05:09 PM#11
TaintedReality
I don't see what's so hard about it, just use a slightly modified form of the original trigger. If your unit casting the Impale ability is a Footman:

Trigger:
Impalers
Collapse Events
Time - Every 2.50 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units of type Footman) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Undead Crypt Lord - Impale (Random unit from (Units within 1500.00 of (Position of (Picked unit)) matching (((Owner of (Matching unit)) controller) Equal to User)))

Simply loops through all Footman and orders them to impale a random unit nearby them. Oh, and it leaks, but some people don't care about leaks so I'll let you take care of them if you want to.

If multiple unit types have the ability and you want all of them to use it, you could also do something like this:
Trigger:
Impalers
Collapse Events
Time - Every 2.50 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in (Playable map area) matching ((Level of Impale for (Matching unit)) Greater than 0)) and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Undead Crypt Lord - Impale (Random unit from (Units within 1500.00 of (Position of (Picked unit)) matching (((Owner of (Matching unit)) controller) Equal to User)))
05-07-2006, 06:58 AM#12
BertTheJasser
Everything posted here is nearly nonsense(sorry). Every player will further or later get, how the AI acts. An AI must be intelligent, as it tells. For example, when it is targeted by a spell like shockwave, let the unit run left/right. When attacked, cast a spell backward, if the unit is still alive or just attack. Then maybe prefer heroes and units that are near to death. If the unit has the dispel ability, first kill summoned units. An AI has 100s of aspects to think of. So it's quite hard to get an actually intelligent AI.

I come to the conclusion that a quite complex system is needed to detect just for a single unit how to act when. I see myself still working at that problem.
05-08-2006, 06:51 PM#13
Ghost.X
I really appreciate everyones help. I'll give you all rep when this is solved.

I also forgot to mention that the unit has to only use the ability on the player. to explain the situation more. I need to find an efficient system I can apply to any unit to use an ability.