Computer Ai

TooSlowFcker

New Member
Reaction score
10
Hey I used
event- period time event 10 seconds
condition
action- units( owned by) Player 12)) patrol random point in playable map area
but the problem is that I spawned 4 units, and they all go to the same area
im wondering if I can do the same thing, but on each unit rather than all of them, without making a trigger for each of them, please help
any questions about my question you can just question me about okay?:)<3

can you do this for me, cause this is too complicated =(
if you go to Spawn Heroes Attacker, and Wave 1, you'll see the unit I want to patrol, if you need that
and under Ai category, you can find the trigger I want you to use
thanks, I really suck, send it to me when you're done
 

Attachments

  • Castle Tag.w3x
    55.2 KB · Views: 110

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Assign Custom values to all of the units, assign them to unit arrays according to their custom value, then put a loop in doing your actions.
 

watermelon

New Member
Reaction score
2
Code:
Computer AI
    Events
        Time - Every 10.00 seconds of game time
    Conditions
    Actions
        Set unitgroup = (Units owned by Player 12 (Brown) matching (((Matching unit) is A structure) Equal to False))
        For each (Integer A) from 1 to (Number of units in unitgroup), do (Actions)
            Loop - Actions
                Set loc = (Random point in (Playable map area))
                Set dumb = (Random unit from unitgroup)
                Unit - Order (Random unit from unitgroup) to Patrol To loc
                Unit Group - Remove dumb from unitgroup
        Custom script:   set udg_dumb = null
        Custom script:   call RemoveLocation(udg_loc)
        Custom script:   call DestroyGroup(udg_unitgroup)
Well, this is my method...
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
You do realize that is the EXACT same way I said.. You just did the shorter way of doing it, except yours won't loop right. :D
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Code:
Untitled Trigger 001
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        ((Owner of (Triggering unit)) Equal to Player 12 (Brown)) and (((Triggering unit) is A structure) Equal to False)
    Actions
        Unit - Set the custom value of (Triggering unit) to (Execution count of (This trigger))
        Set CV = (Execution count of (This trigger))
        Set YourUnit[(Custom value of (Triggering unit))] = (Triggering unit)

Code:
Untitled Trigger 002
    Events
        Time - Every 10.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to CV, do (Actions)
            Loop - Actions
                Set YourRegion = (Random point in (Playable map area))
                Unit - Order YourUnit[(Integer A)] to Patrol To YourRegion
                Custom script:   call RemoveLocation (udg_YourRegion)

This may work.
 

TooSlowFcker

New Member
Reaction score
10
wha does he mean execution count?
action
Unit - Set the custom value of (Triggering unit) to (Execution count of (This trigger)
wow didnt look hard enough just found it
 

watermelon

New Member
Reaction score
2
For the execution count, it was Trigger - Trigger Execution Count.
Try scrolling down more.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Ok, Open Trigger Editor, see the yellow X at the top of the window? Click it. Then, say create new variable. Assign a name, any name. Then set it's classification to integer, and voila!
 

LightChaosma

New Member
Reaction score
60
in the actions, go to the sections units, scroll about 2/3 down, you see set costum value of unit. set the unit to the unit you wish to have this costum value attached to, then set the 0 to your variable, shoosable in the top of the window that pops up
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top