• 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.

[AI] AI Movement/Purchase Item/Recover

Status
Not open for further replies.
Level 31
Joined
May 3, 2008
Messages
3,154
I almost complete my map, the only thing I need to do is to fix the trigger for AI computer.

  • AI Normal Movement
    • Events
      • Time - Every (Random real number between 5.00 and 7.00) seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in AI_Unit and do (Actions)
        • Loop - Actions
          • Set AI_Movement = (Random point in (Playable map area))
          • Unit - Add Wander (Neutral) to (Picked unit)
          • Unit - Order (Picked unit) to Attack-Move To AI_Movement
          • Custom script: call RemoveLocation(udg_AI_Movement)
For this first trigger, I want to know how to stop the unit from moving around the map when he is casting XXX spell or when his life below 60% while staying close to the fountain.


  • AI Easy Hp Recovery
    • Events
      • Unit - Hive Member 0013 <gen>'s life becomes Less than 50.00
      • Unit - Hive Member 0014 <gen>'s life becomes Less than 50.00
      • Unit - Hive Member 0015 <gen>'s life becomes Less than 50.00
      • Unit - Hive Member 0016 <gen>'s life becomes Less than 50.00
      • Unit - Hive Member 0017 <gen>'s life becomes Less than 50.00
      • Unit - Hive Member 0018 <gen>'s life becomes Less than 50.00
      • Unit - Hive Member 0019 <gen>'s life becomes Less than 50.00
      • Unit - Hive Member 0020 <gen>'s life becomes Less than 50.00
      • Unit - Hive Member 0021 <gen>'s life becomes Less than 50.00
      • Unit - Hive Member 0022 <gen>'s life becomes Less than 50.00
      • Unit - Hive Member 0023 <gen>'s life becomes Less than 50.00
    • Conditions
      • ((Owner of (Triggering unit)) controller) Equal to Computer
      • (Melee AI of (Owner of (Triggering unit))) Equal to Easy AI
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of (Triggering unit)) Less than (Random percentage)
        • Then - Actions
          • Set AI_Fountain_Healing = (Position of Fountain of Ice 0025 <gen>)
          • Unit - Order (Triggering unit) to Move To AI_Fountain_Healing
          • Custom script: call RemoveLocation(udg_AI_Fountain_Healing)
        • Else - Actions
As for the 2nd trigger, I would like to know how to set that if unit xxx belong to computer player hp goes below 60%. The unit would use potion of healing to recover his life or else he would go to fountain and heal. I know there is a possible way to make it much simple, but I cannot recall how to do it.

  • AI Easy Purchase Item
    • Events
    • Conditions
      • ((Triggering player) controller) Equal to Computer
      • (Melee AI of (Triggering player)) Equal to Easy AI
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
        • Else - Actions
As for this 3rd trigger, I would like to know how to set a AI to purchase xxx item when the amount of gold reach xxx or else it would purchase other stuff.
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
Third Trigger:

You could set a real variable every X seconds of game time = the amount of gold of the player, which owns the Ai-Unit.
Then you just add as Event, that the gold-real-Var becomes Gleich X.
You compare in the IF THEN ELSE, which exact amount it is, and then you order the AI-Unit to buy the item, you want it to.

First Trigger: you could add a IF THEN ELSE in the Pick-Loop, wich compares the actual hp to 60% od the max hp of the picked unit.
And for the fountain, just compare the Distance between the picked unit and the fountain. You can find this at "Real Comparisson"

Greets
 
Status
Not open for further replies.
Top