Warstomp AI

Status
Not open for further replies.
Level 7
Joined
May 11, 2010
Messages
278
Hey. I've got a Neutral Hostile (not player-owned) unit with the Warstomp ability. I don't want him to use it unless there's more that 11 units around him.
Can it be fixed? If yes, how do i fix it?

Thanks for replying :)
 
Level 5
Joined
Jan 4, 2007
Messages
103
Don't know if it could get fixed, maybe if you create a new script and remove it there, tho you could do this: Remove the ability from the caster and then check when there are 11 units near him and then add the ability, order him to cast and check again when there are less than 11 units around him and remove the ability ect. Here:

  • Events
    • Time - Every 0.50 seconds of game Time
  • Conditions
    • ((Your Unit) is alive) Equal to True
  • Actions
    • Set Point = (Position of (Your unit))
    • Set Group1 = (Units in (Region centered at Point with size (800.00, 800.00)) matching (((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in Group1) Greater than or equal to 11
      • Then - Actions
        • Unit - Add War Stomp (Neutral Hostile 1) to (Your unit)
        • Unit - Order (Your Unit) to Orc Tauren Chieftain - War Stomp
        • Set Integer1 = 1
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer1 Equal to 1
        • Then - Actions
          • Unit - Remove War Stomp (Neutral Hostile 1) from (Your unit)
          • Set Integer1 = 0
        • Else - Actions
          • Do nothing
    • Custom script: call RemoveLocation (udg_Point)
    • Custom script: call DestroyGroup (udg_Group1)
Point is a point variable, Group1 is a group variable, Integer1 is an Integer variable. Maybe there's a way to simply remove the command from Neutral Hostile's script but this is ok. Hope it helps:)
 
Here is my MUI version. (works for more than 1 unit)
  • Warstomp AI
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • -------- The below code removes Unit group leaks --------
      • Custom script: set bj_wantDestroyGroup = true
      • -------- By picking every unit, it means all unit swith Neutral Hostile will be affected --------
      • -------- I have set it so that only Footmen unit-types can be picked. Change the conditions to your need. --------
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Footman))) and do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • -------- Now checking if there are 11 nearby units --------
          • Set temp_point = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units within 500.00 of temp_point)) Greater than or equal to 11
            • Then - Actions
              • -------- If there are, allow the Picked Unit to cast War Stomp --------
              • Unit - Add War Stomp (Neutral Hostile 1) to (Picked unit)
              • Unit - Order (Picked unit) to Orc Tauren Chieftain - War Stomp
              • Unit - Remove War Stomp (Neutral Hostile 1) from (Picked unit)
            • Else - Actions
          • -------- Remove location leak --------
          • Custom script: call RemoveLocation(udg_temp_point)
 
Level 11
Joined
May 26, 2009
Messages
760
But this makes the unit use it every time there are 11 units within a radius of 500.00, right? What if I'd want the unit to need mana and no cooldown in order to use it, what changes would be made?
 
But this makes the unit use it every time there are 11 units within a radius of 500.00, right? What if I'd want the unit to need mana and no cooldown in order to use it, what changes would be made?

just add those to the conditions...

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in (Units within 500.00 of temp_point)) Greater than or equal to 11
      • Mana of PickedUnit is greater than...
    • Then - Actions
for the no cooldown, that is only possible if
1)the cast point and backswing of the unit is 0.00
You dont need to set cooldown to 0.00 since you just add/remove the ability...
 
Level 20
Joined
Feb 24, 2009
Messages
2,999
It shouldn't be able to use it if it doesn't have any mana/it's cooling down ?
But if your really paranoid just add a condition in the if box (with the 11 unit check)

if picked unit's mana > x

Or if you want a random "factor" (sometimes he does it sometimes he doesn't) you could use set 'integer' to rnd num function combined with an if 'integer' is greater than condition:



Here is my MUI version. (works for more than 1 unit)
  • Warstomp AI
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • -------- The below code removes Unit group leaks --------
      • Custom script: set bj_wantDestroyGroup = true
      • -------- By picking every unit, it means all unit swith Neutral Hostile will be affected --------
      • -------- I have set it so that only Footmen unit-types can be picked. Change the conditions to your need. --------
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Footman))) and do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • -------- Now checking if there are 11 nearby units --------
          • Set temp_point = (Position of (Picked unit))
  • Set tmp_int = (Random integer number between 1 and 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in (Units within 500.00 of temp_point)) Greater than or equal to 11
          • tmp_int Greater than 90
          • (Mana of (Picked unit)) Greater than or equal to ?cost of spell?
      • Then - Actions
        • -------- If there are, allow the Picked Unit to cast War Stomp --------
        • Unit - Add War Stomp (Neutral Hostile 1) to (Picked unit)
        • Unit - Order (Picked unit) to Orc Tauren Chieftain - War Stomp
        • Unit - Remove War Stomp (Neutral Hostile 1) from (Picked unit)
      • Else - Actions
    • -------- Remove location leak --------
    • Custom script: call RemoveLocation(udg_temp_point)
  • Set tmp_int = 0


EDIT: Ninja'd!
 
Level 7
Joined
May 11, 2010
Messages
278
Thanx for the help, i appreciate it lots :grin:

+ rep to you guys :thumbs_up:

Edit: umm... i can't find "Unit Group - Pick every unit in (Units in (Playable map area) matching..."
only "Unit Group - Pick every unit in (Units in (Playable map area) and do (Actions)" halpz lol? xD
 
Last edited:
Level 5
Joined
Jan 4, 2007
Messages
103
Thanx for the help, i appreciate it lots :grin:

+ rep to you guys :thumbs_up:

Edit: umm... i can't find "Unit Group - Pick every unit in (Units in (Playable map area) matching..."
only "Unit Group - Pick every unit in (Units in (Playable map area) and do (Actions)" halpz lol? xD

It's there, in Unit Group - Pick every Unit in ect. just click on the (Units in (Playable map area) and choose Units in Region Matching Condition instead of Units in Region.:)
 
Status
Not open for further replies.
Top