1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[AI] AI Keeps on Running back to base

Discussion in 'Triggers & Scripts' started by SunTzu7387, Jan 11, 2012.

  1. SunTzu7387

    SunTzu7387

    Joined:
    Mar 28, 2009
    Messages:
    66
    Resources:
    0
    Resources:
    0
    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
     
  2. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
  3. SunTzu7387

    SunTzu7387

    Joined:
    Mar 28, 2009
    Messages:
    66
    Resources:
    0
    Resources:
    0
    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
     
  4. Arhowk

    Arhowk

    Joined:
    Aug 8, 2007
    Messages:
    2,752
    Resources:
    0
    Resources:
    0
    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
     
  5. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    - see "AI - Ignore Guard position" or something like that...
    - see my EngageSystem and GuardPostSystem, it is meant for the AI...
    - btw the 'wait' and 'do nothing' is really bad, use timers instead and remove the do
    nothing like Maker said...
     
  6. SunTzu7387

    SunTzu7387

    Joined:
    Mar 28, 2009
    Messages:
    66
    Resources:
    0
    Resources:
    0
    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: Jan 12, 2012
  7. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    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...
     
  8. SunTzu7387

    SunTzu7387

    Joined:
    Mar 28, 2009
    Messages:
    66
    Resources:
    0
    Resources:
    0
    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. :)
     
  9. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    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


    yes, but the GuardPost system does all that...
     
  10. SunTzu7387

    SunTzu7387

    Joined:
    Mar 28, 2009
    Messages:
    66
    Resources:
    0
    Resources:
    0
    ok thanx for the help