• 🏆 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 Movement/Purchase Item/Recover

Status
Not open for further replies.
Level 31
Joined
May 3, 2008
Messages
3,155
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