• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Some help with the AI

Status
Not open for further replies.
Level 2
Joined
Oct 29, 2017
Messages
7
Hello there,

For some time now I've been working on a simple idea, and it wants to include basic AI
Take for example Reign of Chaos Orc campaign Chapter 3, each faction sends groups of units that alternate in size to attack the player or another computer player, then if a computer dies then the AI that killed it will switch targets, if that makes sense?

I'd also sum it up as Warcraft 2 AI without all the getting stuck in rocks forests and the rest.

I tried looking it up both on the forum and randomly on google/youtube, but all explain things way more complicated than my goal.

I managed to make an almost working ai with the ai editor, but, it's using only the default units(I did make a few custom ones, nothing too crazy, such as the undead using zombies skeleton warriors and archers etc and the orcs using warlocks and ogres) and would love to use those and I have little to no idea how to implement it in the missions of the campaign, or even test it with the mission I am working on.

Any ideas how I might do that?

Also, should I use the ai editor or triggers?
 
Level 2
Joined
Oct 29, 2017
Messages
7
That's okay :)

Maay I be a bother again, and ask which AI better, do it through triggers(and how?) or try the AI editor, this time just for basic attacks(and yea I'm that big of a newb)
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
Theoretically trigger editor lets you make the best AIs. It's incredibly hard though, because you have to do everything by yourself. It could also very well be very performance heavy.
Using the AI editor is a lot easier and should be enough for a basic AI. You can always use triggers to enhance your AI, for example control the spell usage of a hero with triggers.
 
Level 12
Joined
Jun 15, 2016
Messages
472
Theoretically trigger editor lets you make the best AIs. It's incredibly hard though, because you have to do everything by yourself. It could also very well be very performance heavy.
Using the AI editor is a lot easier and should be enough for a basic AI. You can always use triggers to enhance your AI, for example control the spell usage of a hero with triggers.

There is another alternative, which is creating the AI script by yourself, without an editor. It is a bit harder at the beginning, but I find it much less confusing after understanding how things work. I suggest reading this as a start.

Both things you requested can be done easily with custom script AI:

1. Using the "command" functionality to have the AI switch a target player when the target is dead.
2. Using custom units in custom script AI is as simple as that:

JASS:
//I  have a custom made unit named "lost soul". Pressing ctrl+D I find it has another name in the object editor 'u065'
//So I write this at the start of the script:
integer LOST_SOUL = 'u065'
//then write LOST_SOUL whenever I want to use that unit.
 
Level 13
Joined
Oct 12, 2016
Messages
769
Isn't he just asking how to start an AI script?

If that's what he means, well:
1) Open the world editor.
2) Export your object data for the race (after it's created)
3) Import the object data into the AI editor.
4) Create your AI script. I suggest using Blizzard's "Grunt Master" as an example. You can open the .wai file in the AI editor and look at it.
5) Save your AI data (.wai) somewhere for later use or changes.
6) Export the script.
7) Import the script into your map through the Import Manager.
8) There's a trigger for starting your custom race's AI script.
Make sure you give them starting units and resources through triggers.
The trigger is "AI - run custom AI script," you can use either "melee" or "campaign." It does not matter.
 
Level 2
Joined
Oct 29, 2017
Messages
7
Wow, thanks Nowow and Wark, these are pure gold, now I know what I was doing wrong in the AI editor, and creating a script by itself sounds more flexible

Thank you guys!
 
Status
Not open for further replies.
Top