• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Posting here in hope of aid

Status
Not open for further replies.

Taksheel

Banned
Level 2
Joined
Apr 8, 2016
Messages
7
Hello, and good day to all!

First of all, I would like to apologize if I am asking about an issue which is already solved, asking in the wrong thread, or asking inappropriately - I'm not quite used to forums and forum rules, so if an administrator notices that I am breaking some rules, by all means, notify me and point me in the right direction.

I have joined the Hive Workshop community today with a single reason - I need assistance with an issue that I have been trying to solve for over three weeks now, and I'm not ready to give up just yet, and definitely not before I try asking this community for help.

As a lot of you may or may not now, the default behavior of the AI is that the moment it calculates the odds of an upcoming battle between two forces and realizes that it MIGHT lose, the computer will immediately pull all its forces back into the base to its base. This results in each and every fight to look more like a Benny Hill chase than an actual clash of armies.

And that sucks.

After messing around with the World Editor for some time (note that I have no knowledge of the technicalities of it whatsoever), I realized that there is such a thing as the AI editor, and three fields attracted my attention: Units Flee, Heroes Flee, and Groups Flee. This is where I ran into problems seeing as I have no idea what to do next.

Logically, I tried unchecking the options (they are turned on by default), and then tried all the options that came to my mind - exporting the AI, importing it directly into the map, I even tried making the custom map into a campaign map (having previously read that campaign AI never runs away from a fight), but to no success.

My question is the following: Is there a way at all to prevent the AI in a custom game from running away from a battle as soon as it realizes there's a chance of losing it, and if yes, can it be achieved with the help of the World Editor?

I apologize once again if this matter has already been resolved, I simply wasn't able to find a thread that had the solution to my problem. If anyone is willing to help a senior gamer that wishes to relive the game from a completely different angle, I would be more than grateful.

Best wishes to all of you,
Taksheel.
 

Taksheel

Banned
Level 2
Joined
Apr 8, 2016
Messages
7
I' m not sure what it is that I tried doing, I think it was something about adding a custom map (Slalom) into a custom campaign, but that yielded absolutely no results.

Yes, I've read that Campaign AI never flees from a battle, I was wondering is it possible to incorporate that aspect of the AI into custom games?

And I'm not talking about heavily modified custom games, mind you. I simply want to play a random map with two bases and two sides battling it out. The map I'm currently trying to do it on is Slalom, for eight players.
 

Taksheel

Banned
Level 2
Joined
Apr 8, 2016
Messages
7
This is quite the detailed guide for something that I need only about 0.1% of. The main issue that I'm having is that once I uncheck the Groups/Heroes/Units Flee options I can't seem to find a way to save my settings and then apply them to the map I'm currently editing in the World Editor. Do you have any suggestions on how to do that? There's an option that says "Add to current map" or something like that, but it simply doesn't work.
 
You need to save it using the AI editor interface (there's a save button) as .wai file (and .ai autogenerates as well).

Then, you import the file to the map using import manager. Then at the map initialization trigger, create a trigger that picks all player then add ai for the player if it suits your conditions (use IF/THEN/ELSE. Put it above the default ai initialization).

Hope it helps!
 

Taksheel

Banned
Level 2
Joined
Apr 8, 2016
Messages
7
A thousand blessings upon ye, friend. I will try it in an hour or so, and if it works, I'll be sure to let you know.

And I think it might just work, because I haven't done what you wrote there. We'll see.

Well, I can honestly say that I got lost in the trigger editor. To be precise, I don't know what you mean by "creating a trigger that picks all player," or in other words, I can't find it on the trigger list. Would it be a problem to further clarify what you meant?
 
Last edited by a moderator:
Level 10
Joined
Jun 6, 2007
Messages
392
Create ai for each race using ai editor and disable fleeing. Export the ai data as an .ai file (Export script).

Import those 4 files using import manager.

Remove "Melee Game - Run melee AI scripts (for computer players)" from initialization trigger.

Start your own ai script for each player that is cntrolled by a computer player:

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • 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 - Create starting units (for all players)
      • Melee Game - Set starting resources (for all players)
      • Melee Game - Remove creeps and critters from used start locations (for all players)
      • Melee Game - Create starting units (for all players)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) is in (All players controlled by a User player)) Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Human
                • Then - Actions
                  • AI - Start melee AI script for (Picked player): war3mapImported\myHumanAi.ai
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Race of (Picked player)) Equal to Orc
                    • Then - Actions
                      • AI - Start melee AI script for (Picked player): war3mapImported\myOrcAi.ai
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Race of (Picked player)) Equal to Undead
                        • Then - Actions
                          • AI - Start melee AI script for (Picked player): war3mapImported\myUndeadAi.ai
                        • Else - Actions
                          • AI - Start melee AI script for (Picked player): war3mapImported\myNightelfAi.ai
            • Else - Actions
 

Taksheel

Banned
Level 2
Joined
Apr 8, 2016
Messages
7
I will have time to test it out later during the evening. I'll let you know if it works, and thank you so much, it means a lot to me!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
As a lot of you may or may not now, the default behavior of the AI is that the moment it calculates the odds of an upcoming battle between two forces and realizes that it MIGHT lose, the computer will immediately pull all its forces back into the base to its base. This results in each and every fight to look more like a Benny Hill chase than an actual clash of armies.
It is called a "strategic withdraw" and is a very effective tactic since you minimize losses and can recuperate and over power foolish chasers with their lack of reinforcements and heavy casualties.

And that sucks.
Yes it does suck if you are the enemy and are expecting to shoot fish in a barrel. If you want real challenge though this is where it all is at.

After messing around with the World Editor for some time (note that I have no knowledge of the technicalities of it whatsoever), I realized that there is such a thing as the AI editor, and three fields attracted my attention: Units Flee, Heroes Flee, and Groups Flee. This is where I ran into problems seeing as I have no idea what to do next.

Logically, I tried unchecking the options (they are turned on by default), and then tried all the options that came to my mind - exporting the AI, importing it directly into the map, I even tried making the custom map into a campaign map (having previously read that campaign AI never runs away from a fight), but to no success.
WE's AI editor is unfortunately kind of rubbish. It appears the melee AI was made in pure JASS as an AI script. You can export it from the MPQ archives (patch archive?), modify it, import it as a different name and then order it to run for a certain player at map initialization.

My question is the following: Is there a way at all to prevent the AI in a custom game from running away from a battle as soon as it realizes there's a chance of losing it, and if yes, can it be achieved with the help of the World Editor?
My AI understanding of WC3 is limited however I would hope they had an option equivalent to StarCraft II "suicide" which does exactly what you are after. In StarCraft II when you order an AI to "suicide" some units it sends them off mercilessly towards any reachable hostile unit until either all reachable hostile units are eliminated or the unit dies. In StarCraft II you call AI natives like you do any trigger native but in WC3 they need to be run from AI scripts.

Looking at the AI native list for WC3 I found this...
JASS:
native SuicideUnit takes integer count,integer unitid returns nothing
This should (I hope...) make the executing player (player who is running the AI script) suicide count units of unitid. That is if WC3's meaning of "suicide" is the same as StarCraft II, if not it will likely have hilarious results.
 
Status
Not open for further replies.
Top