• 🏆 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!

Having Spawns randomly attack a type of player on the map.

Status
Not open for further replies.
Level 1
Joined
Jan 5, 2017
Messages
3
Good Evening,

My name is Thomas. I'm working on creating a newer version of Kodo Tag and I'm having an issue of the kodo's attacking only the walls and towers and not focusing on the mountain king heros like I set them up to do. Would anyone be able to help? Here is my current setup:

The current issue is that the units aren't focusing on the hero's, rather they are staying near the spawning place and there are no buildings near the spawn.
 

Attachments

  • Unit Spawn.png
    Unit Spawn.png
    37.9 KB · Views: 59
Last edited:
Level 3
Joined
Jun 18, 2016
Messages
68
Try this
  • Kodo
    • Events
      • Time - Elapsed game time is 30.00 seconds
    • Conditions
    • Actions
      • Unit - Create 4 Draenei Guardian for Player 12 (Brown) at (Center of Region 000 <gen>) facing Default building facing degrees
      • Set Unit = (Last Created Unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 500.00 of (Position of Unit) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of (Unit))) Equal to True
            • Then - Actions
              • Unit - Order (Unit) to Attack (Picked unit)
            • Else - Actions
Something like that
 
Level 1
Joined
Jan 5, 2017
Messages
3
Thank you XiiaOYanG12! My only question is, what does the custom script do?

Also, I put this into practice with no success =/. It seems that they will still just stay and walk by the spawn.. Our scripts are essentially word for word unless you have more inside of your variable for the (unit).

Thank you,
Thomas
 
Last edited:
Level 3
Joined
Jun 18, 2016
Messages
68
Thank you XiiaOYanG12! My only question is, what does the custom script do?
Yes, as bear_369 says it can destroy the group after the group are picked since it wasn't store in a variable so we are unbale to destroy the variable. So we use custom script to destroy not stored unit group.

Example if you want to destroy a stored point
  • Set Point = (Position of (Unit))
We can destroy it by using this custom script
  • Custom Script: call RemoveLocation[udg_point]
NOTED : you must add "udg_" before type the variable name

Edit: sorry if anything get wrong cause I'm using my phone right now
 
Level 39
Joined
Feb 27, 2007
Messages
5,028
You leak a couple locations: Unit Group - Pick every unit in (Units within 500.00 of (Position of Unit) and do (Actions). So following XiiaOYanG12 above me it should be Units within 500.00 of Point.

The trigger he posted kinda does the right thing but kinda doesn't. It only orders the one most recently created unit to attack... and it orders it to attack every single structure or mountain king on the map (ultimately only the last one it picks gets attacked). What you want to do is create them inside of a loop so you can use 'last created unit' to get them all. To make things easier, when you create a Mountain King for a player add them to a group called MKs; we will order each kodo to attack a random unit from the group.
  • Kodo
    • Events
      • Time - Elapsed game time is 30.00 seconds
    • Conditions
    • Actions
      • Set Point = (Center of Region 000 <gen>)
      • For each (Integer A) from 1 to 4 do (Actions)
        • Loop - Actions
          • Unit - Create 1 Draenei Guardian for Player 12 (Brown) at Point facing Default building facing degrees
          • Unit - Order (Last Created Unit) to Attack (Random unit from MKs)
      • Custom script: call RemoveLocation(udg_Point)
Now they will still be dumb though and if they're mazed off from their target they may not attack walls/towers. You'll have to see.
 
Level 1
Joined
Jan 5, 2017
Messages
3
Thank you Bear_369, XiaaOYang12, and Pyrogasm! You guys have been a huge help although I'm still having trouble, I feel that I may be missing some minor details. When I try to add in the last Unit - Order, my variable is calling for an index and I'm unsure of how to set the index to have the value of the mountain kings. I currently want to give the creeps the ability to have to go through the maze. It would help part of the experience for this game. Also, if you're on and could spare just two minutes. I could add you on Skype or Discord to view my current status and make the small improvement!

Thank you much,
Thomas.


EDIT: Tested the current version of the trigger and they all just stay in the middle of the map. I have the middle of my map blocked in and they are all trying to get into the part that's blocked in. I'm not sure why.
 

Attachments

  • Try 2.png
    Try 2.png
    48.8 KB · Views: 77
Last edited:
Level 3
Joined
Jun 18, 2016
Messages
68
Thank you Bear_369, XiaaOYang12, and Pyrogasm! You guys have been a huge help although I'm still having trouble, I feel that I may be missing some minor details. When I try to add in the last Unit - Order, my variable is calling for an index and I'm unsure of how to set the index to have the value of the mountain kings. I currently want to give the creeps the ability to have to go through the maze. It would help part of the experience for this game. Also, if you're on and could spare just two minutes. I could add you on Skype or Discord to view my current status and make the small improvement!

Thank you much,
Thomas.


EDIT: Tested the current version of the trigger and they all just stay in the middle of the map. I have the middle of my map blocked in and they are all trying to get into the part that's blocked in. I'm not sure why.

You must set a loop that those unit will find and attack the player's structure and make sure you have check the boolean of (Picked Unit) equal to a structure equal to true. So that they will only attack buildings
 
Status
Not open for further replies.
Top