• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[AI] Need Help Programming AI For Tree Tag (Infernal)

Status
Not open for further replies.
Level 2
Joined
Mar 9, 2008
Messages
10
*Please note that I am a relative novice at using the editor but have learned a lot, I know next to nothing about programming AI using triggers.

I have been working on my own brand of Tree Tag (Tree Tag Modified, currently on V2.3 but working on V3.0) and as of now I have the balance of my map roughly where I want it and only have a few tweaks to make here and there. The thing that I plan on using from really separating my Tree Tag map from the rest will be the AI I plan to incorporate into the Player 12 (making him a computer controlled AI, it should be easy to make the other infernal slots AI if needed, at least the way I have started my AI script). Basically I want this guy to patrol around the map, attack a number of predefined areas (with Ents being the priority) and return the center of the map when ever it is detected that an Ent controlled unit has entered an area just larger than the rescue zone. I also want my guy to use his infernal abilities as well as leave Sentry Wards on the ground when ever the timer expires. It would also be great if he could purchase items from the vendors.

This is what I have so far:

*30 seconds after the game starts the game will spawn the correct infernal under computer control (tested to work). This is the strength infernal if anyone is wondering. Note, my map allows players to select what ever infernal they want when the game starts.

*The first abilities that the AI will select for the infernal is shock wave. ( trigger implemented, works in theory but unknown in practice)

*Every 45 seconds (periodic) the AI should try and learn more of the Infernal's abilities if the Infernal has enough skill points to learn more abilities. (trigger implemented, works in theory but unknown in practice)

This is what I need or need help with:
*When an Ent controlled unit moves to "AIReturnToCenterZone" the AI will move the Infernal to the center of the map. (What I have so far is attached at the bottom as "AttackCenter AI.JPG"). I can't figure out how get it to make my infernal move move to this zone, all I can find is options to move Triggering Units.

*I need a script to tell my infernal to attack move (and clear all destructables in his path) to a random Ent unit and than attack/kill that Ent unit. I also want him to attack move so he kills all Ent units he sees along the way. I originally wanted to have a number of regions he would clear out but that is not a practical solution.

*I need to know how to make my Infernal leave a Sentry Ward at his current location every time the cooldown is up.

*I need to know how to make the Infernal buy items from the shops when he has enough money (and than actually use them if they have a use). I want the infernal to buy the items when he paths past the vendor instead of visiting the vendor every certain interval. If I can't do this, could I just make a trigger that spawns an item in the Infernal's inventory and removes a certain amount of money upon doing this (without spawning replicate items).


I really appreciate any help you guys can give. I will continue working on this myself and update my post with any progress that I make.
 

Attachments

  • AttackCenter AI.JPG
    AttackCenter AI.JPG
    67.5 KB · Views: 755
Last edited:
Level 2
Joined
Mar 9, 2008
Messages
10
So I think I figured out a script to tell my Infernal to attack all units within "AIReturnToCenterZone"

Can anyone look this over for me?
 

Attachments

  • AttackCenter AI2.jpg
    AttackCenter AI2.jpg
    49.4 KB · Views: 528
Level 2
Joined
Mar 9, 2008
Messages
10
OK, I figured out how to tell my infernal to attack Ents. Basically he targets 4 random Ent units on the map at a time and is told to attack these. The only problem is that my AI is incredibly stupid. He can't go around obstacles and will not attack units or trees in its way. All it does is try to attack the Ent units it has targeted. I can't seem to get him to do anything but what he is doing now. This is the only issue that plagues my map, after I solve this I will have created a Tree Tag map with an actual AI!

EDIT: I forgot to mention that I have the infermal set to "Attack-Move To" and that as of this moment I am allowing him to move through trees by giving him a special version of "Tree Plow" so that every 10.1 (there is a reason for it be 10.1 and has to do with the way the map starts) seconds all the trees around him die. In this way does have some mobility.

Can any please advice me how to make my AI less stupid? I just want it to attack trees and move around obstacles on its way to its target.
 
Level 2
Joined
Mar 9, 2008
Messages
10
Well, I have been working hard on my AI and now only need to know how to set up a few scripts and my AI should be perfect. Could anyone please tell me how to:

1. Detect if a unit has not moved for X seconds and if the unit has not moved than move him randomly.
2. Check to see if a unit is in line of sight before "picking" it.


I think thats all I need, any help is appreciated!

EDIT: Anachron, I just saw your post after I made mine. I have decided to just give my AI controlled Infernal a special version of "Tree Plow" and than make him move slower than normal. The result is that he can walk through trees (slowly) when he has targeted an Ent. My only problem is that sometimes my Infernal tries to cut across terrain he can't move over and he gets stuck. I just need some scripts that will hopefully stop this behavior, or if he does get stuck, allow him to unstuck himself. If you could help me with this I would gladly share what I have for my scripts.

EDIT2: Does anyone know if it is possible to start a timer visible only to player 12 if it detected that a specific unit belonging to player 12 has stopped moving? If this is possible I think I may have found my answer to point #1; as long as the timer can be deactivated when movement is detected that is...

EDIT3: I wanted to make sure my AI is learning his skills when he levels up, can anybody tell me if this automatic or if I need some form of script for this? I will be programming in the ability for my Infernal to use his abilities and I wanted to make sure that they are actually learned and will actually be the correct level (considering my Infernal can level up).
 
Last edited:
EDIT: Anachron, I just saw your post after I made mine. I have decided to just give my AI controlled Infernal a special version of "Tree Plow" and than make him move slower than normal. The result is that he can walk through trees (slowly) when he has targeted an Ent. My only problem is that sometimes my Infernal tries to cut across terrain he can't move over and he gets stuck. I just need some scripts that will hopefully stop this behavior, or if he does get stuck, allow him to unstuck himself. If you could help me with this I would gladly share what I have for my scripts.

Well, giving the AI a few extra spells is something I don't like. I would prefer making an AI that detects the best route to a target and cuts down all trees on that route. But I am currenetly on another good map which is a really great
one.

EDIT2: Does anyone know if it is possible to start a timer visible only to player 12 if it detected that a specific unit belonging to player 12 has stopped moving? If this is possible I think I may have found my answer to point #1; as long as the timer can be deactivated when movement is detected that is...

E: A Unit gets an order without aim
C: Order -Issuded Order Equal to Stop
Owner of (Triggering Unit) is Player 12
A: Unit STOPPED!!!

This will detect each time a unit stops all its actions.

EDIT3: I wanted to make sure my AI is learning his skills when he levels up, can anybody tell me if this automatic or if I need some form of script for this? I will be programming in the ability for my Infernal to use his abilities and I wanted to make sure that they are actually learned and will actually be the correct level (considering my Infernal can level up).

E: A units becomes a new level
C: Owner of(Triggering Unit) controller status equal to Computer
A: Hero - Learn *Skill* for Triggering Unit.

Something like that.
 
Level 2
Joined
Mar 9, 2008
Messages
10
So I have a working Unstuck script for my Infernal that works really quite well (although getting it to this point was very funny at times; I had at point becoming stuck to cause my infernal to randomly teleport (move instantly) around the map (caught in an endless loop where he teleports to a random spot on the map every 0.01 seconds) when ever he became stuck). If anyone want to to know what I did, I created 3 triggers. The first move a regions center to the location of my Infernal, targets a random point in that region, and moves instantly the infernal to that point (I destroy the points afterwards); after all this the trigger turns itself off and turns another trigger on. This other trigger tells the infernal to attack move to a random location before it turns itself off. My third trigger turns on my first trigger every 1 second (so that it can be used again, I had to turn it off to prevent infinite looping). The good thing about this is that it only happens when my infernal is stuck (tested to work).

Anyway, now I am onto the stage where I need to make my infernal learn new abilities and use those abilities when appropriate. I have already tried the trigger Anachron has given me (was actually the script I described in my OP) and all I could make it do was learn all the skills I want him to at once, resulting in him starting the game at -2 skill points while having all the abilities learned, is there a way to make the AI randomly pick (by itself) an ability to learn when it levels up (I can tell it do something when it gains a level)? Also, why is it that when I try to create a trigger for my AI to use an ability it only lets me pick from a list of predefined abilities? Is there a way to allow me to pick a custom ability?

Once again, thanks for the help. My AI is almost complete.
 
Level 2
Joined
Mar 9, 2008
Messages
10
Thanks, I'll look over it when I get home. I have worked out a theoretical way to get the infernal to move through the trees (without outside aid, although I may have to artificially increase his attack range) in my head and I want to give that a shot. I will edit this post with my AI when I get back home as well.
 
Level 2
Joined
Mar 9, 2008
Messages
10
Anyway, I took a look at what you have and I think I can cannibalize parts of it into my AI. I'll post my map, it is *almost* done but it is still really a beta.

If you want to test it, you need at least 1 player/computer (besides the Infernal AI) on each team. I'd post just a basic map with the AI but my AI is too interwoven with the rest of my map to provide a real stand-alone.

P.S. My skills with the editor are obviously far worse than yours, but I did think that some of my scripts could be adapted to your AI to work out some of the kinks.

I would also appreciate any feedback on my map itself and my AI code.
 

Attachments

  • Tree Tag Modified v3.0.w3x
    259.9 KB · Views: 717
I am just looking at the scripts atm.. plz wait a bit^^

Edit:
Oh my god!
Your AI is lagging on a high level.
Please remove those "5 Actions in one" actions you got.
( For Example: Order (RandomUnitFrom(...))) and use "Set Unit=Random Unit From... instead... and then ORder Unit to...

Remember you need to clean ALL LOCATIONS, GROUPS and EFFECTS
 
Level 2
Joined
Mar 9, 2008
Messages
10
As I said I am a noob at this :( I don't really know how to do all this cleaning, but I think I have an idea.
 
Level 2
Joined
Mar 9, 2008
Messages
10
I will continue working on my AI while I start working on some other maps and things. This AI turned out to be a lot more complex than I even anticipated, especially considering my original AI was a single trigger with a single event/condition and two actions...
 
Level 2
Joined
Mar 9, 2008
Messages
10
Well, if you don't mind... It isn't an AI problem per say, but it is an annoying bug I have been having with my Tree Tag game that I am trying to fix (I am planning on releasing a v2.4; meaning no AI) but I can't figure out how to remove this bug that has to do with tunnel entrances.

Basically what is happening is that when a tunnel entrance is destroyed (by Self Destruct or being killed) it is leaving behind a waypoint location and if a player uses the other tunnel that the destroyed tunnel was connected to, the player will be transported to the location of the destroyed tunnel (despite the tunnel being destroyed).

What I want to do to fix this problem is destroy both ends of the tunnel system when one end dies (this is what I can't figure out how to do). All I have managed to do is destroy *every* tunnel on the map when one tunnel does. The map I uploaded earlier has this game trigger (I didn't write most of the triggers in the game, I have been "modifying" them) in its original state. Do you have any suggestions?

Thanks.
 
Status
Not open for further replies.
Top