• 🏆 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] AI Keeps on Running back to base

Status
Not open for further replies.
Level 4
Joined
Mar 28, 2009
Messages
66
This is an example of a Trigger I am using. Melee AI is turned on. And I tried to get them to attack by using this but they still will just sit at the spawn. How do I fix this? +rep for helping

  • Events
    • Unit - A unit enters Stormreaver Clan <gen>
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Owner of (Entering unit)) Equal to Player 6 (Orange)
        • (Player 6 (Orange) controller) Equal to Computer
      • Then - Actions
        • Unit Group - Add (Entering unit) to (Units in Stormreaver Clan <gen> owned by Player 6 (Orange))
        • Wait 49.00 game-time seconds
        • Unit Group - Order (Units in Stormreaver Clan <gen> owned by Player 6 (Orange)) to Attack-Move To (Random point in Blackrock Clan <gen>)
      • Else - Actions
        • Do nothing
 
Level 4
Joined
Mar 28, 2009
Messages
66
Ok I did this one for AI player 3 and AI player 3 still will run back and forth around thier base.

  • Events
    • Unit - A unit enters Burning Blade Clan <gen>
  • Conditions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Owner of (Entering unit)) Equal to Player 3 (Teal)
      • (Player 3 (Teal) controller) Equal to Computer
    • Then - Actions
      • Set group_BurningBlade3 = (Units in Burning Blade Clan <gen> owned by Player 3 (Teal))
      • Set point_warsong = (Random point in Warsong Clan <gen>)
      • Unit Group - Add (Entering unit) to group_BurningBlade3
      • Wait 49.00 game-time seconds
      • Unit Group - Order group_BurningBlade3 to Attack-Move To point_warsong
      • Custom script: call RemoveLocation(udg_point_warsong)
      • Custom script: call DestroyGroup(udg_group_BurningBlade3)
    • Else - Actions
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Ok I did this one for AI player 3 and AI player 3 still will run back and forth around thier base.

  • Events
    • Unit - A unit enters Burning Blade Clan <gen>
  • Conditions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Owner of (Entering unit)) Equal to Player 3 (Teal)
      • (Player 3 (Teal) controller) Equal to Computer
    • Then - Actions
      • Set group_BurningBlade3 = (Units in Burning Blade Clan <gen> owned by Player 3 (Teal))
      • Set point_warsong = (Random point in Warsong Clan <gen>)
      • Unit Group - Add (Entering unit) to group_BurningBlade3
      • Wait 49.00 game-time seconds
      • Unit Group - Order group_BurningBlade3 to Attack-Move To point_warsong
      • Custom script: call RemoveLocation(udg_point_warsong)
      • Custom script: call DestroyGroup(udg_group_BurningBlade3)
    • Else - Actions

AI is taking over and telling them to return to base because attacking isnt part of their AI script. You have to disable the AI for that group (idk how AI works so..)

Assuming P3 is a computer
 
Level 4
Joined
Mar 28, 2009
Messages
66
Edit: I set the Timer for every 49 seconds of the game and they are still not wanting to move. They started to move in the direction I wanted them to go then they ran back and they keep on doing it again until they get 30sh or so troops and finally see the enemy and attack. They will send in Thier FIrst wave but once AI is activated they still dont move lol. How Do I fix this? Do I need to redue my AI editor and Uncheck Melle ai?
  • Events
    • Time - Every 49.00 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Player 3 (Teal) controller) Equal to Computer
      • Then - Actions
        • AI - Ignore the guard positions of all Player 3 (Teal) units
        • Set group_BurningBlade3 = (Units in Burning Blade Clan <gen> owned by Player 3 (Teal))
        • Set point_warsong = (Random point in Warsong Clan <gen>)
        • Unit Group - Order group_BurningBlade3 to Attack-Move To point_warsong
        • Custom script: call RemoveLocation(udg_point_warsong)
        • Custom script: call DestroyGroup(udg_group_BurningBlade3)
      • Else - Actions
 
Last edited:
Level 29
Joined
Mar 10, 2009
Messages
5,016
better is...
  • Event
    • Unit - A unit finishes training a unit
  • Conditions
    • whateverer
  • Actions
    • AI - Ignore the guard positions of TrainedUnit
    • Unit - Add Trained unit to group_BurningBlade3
then...
  • Event
    • Time - Every 49.00 seconds of game time
  • Actions
  • Unit - Pick every unit in group_BurningBlade3
    • Set point_warsong = (Random point in Warsong Clan <gen>)
    • Unit Group - Order group_BurningBlade3 to Attack-Move To point_warsong
    • Custom script: call RemoveLocation(udg_point_warsong)
you do not need to destroy the group, just remove the unit from it when unit dies...

lastly, you really need to have a look to GuardPosts system...
 
Level 4
Joined
Mar 28, 2009
Messages
66
better is...
  • Event
  • Unit - A unit finishes training a unit
  • Conditions
  • whateverer
  • Actions
  • AI - Ignore the guard positions of TrainedUnit
  • Unit - Add Trained unit to group_BurningBlade3
then...
  • Event
  • Time - Every 49.00 seconds of game time
  • Actions
  • Unit - Pick every unit in group_BurningBlade3
  • Set point_warsong = (Random point in Warsong Clan <gen>)
  • Unit Group - Order group_BurningBlade3 to Attack-Move To point_warsong
  • Custom script: call RemoveLocation(udg_point_warsong)
you do not need to destroy the group, just remove the unit from it when unit dies...

lastly, you really need to have a look to GuardPosts system...

Ok here is the Problem tho. The AI is not Training Units its not a melee map. Units are spawning at thier base.
like this

  • Events
    • Time - Every 7.00 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Orc Warlord 0015 <gen> is alive) Equal to True
      • Then - Actions
        • Set pointy_player3 = (Center of GruntSpawnLightBlue <gen>)
        • Unit - Create 1 Burning Blade Grunt for Player 3 (Teal) at pointy_player3 facing Default building facing degrees
        • Custom script: call RemoveLocation(udg_pointy_player3)
      • Else - Actions
So basically I should Make the first trigger as a .. event -unit enters region blah blah then do ur first trigger then do a 2nd trigger like you did for your 2nd trigger?

Thanx for showing me the guard post system Im checking it out right now. when i can u will get another +rep for that. :)
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
then do like this...
  • Unit - Create 1 Burning Blade Grunt for Player 3 (Teal) at pointy_player3 facing Default building facing degrees
  • AI - Ignore the guard positions of LastCreatedUnit
  • Unit - Add LastCreatedUnit to group_BurningBlade3
So basically I should Make the first trigger as a .. event -unit enters region blah blah then do ur first trigger then do a 2nd trigger like you did for your 2nd trigger?

yes, but the GuardPost system does all that...
 
Status
Not open for further replies.
Top