Simple trigger problems, help?

soider8

New Member
Reaction score
0
Events
-----Time - Every 3.00 seconds of game time

Conditions

Actions
---Set Temp_Group = (Units in Blue Zone <gen>)
---Unit Group - Pick every unit in Temp_Group and do (Actions)
------Loop - Actions
---------Unit - Order (Picked unit) to build a Necromancer Base at (Random point in Blue Zone <gen>)
---------Unit - Order (Picked unit) to build a Demon Spawn at (Random point in Blue Zone <gen>)
---------Unit - Order (Picked unit) to build a Spider Graveyard at (Random point in Blue Zone <gen>)
Custom script: call RemoveLocation (udg_Temp_Point)


So I'll briefly explain what I want to achieve. I currently have a worker, which creates these set buildings (but with problems ^^), there is an income which is attained, and each building is of equal price, 100g. Now I would like someone to edit this so the worker creates all these buildings in a queue, e.g. 1st. Demon Spawn, 2nd. Necro Base. Or allow the builder to choose randomly from these three and create the building. As it now currently does this in the game: Builds the last order (Spider Graveyard), and continuously creates Necromancer Bases for an unknown reason, although the only link I can find is that Necromancer Base is the first unit on the Build Structure of the worker.

Thanks :)
 

HydraRancher

Truth begins in lies
Reaction score
197
Use a unit array. So Building[1] = Necromancer Base etc.

Then make it build a Building[(Random Number between 1 and 3) so it is always random.

Also, your trigger leaks.

1. The Custom Script at the end is removing an undeclared variable

2. Random point in Blue Zone <gen> is not removed 3 times

3. Temp_Group is never removed.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
This builds every 3 seconds, are you sure? You can just set your builder to a unit variable and order it to build.
 

Sevion

The DIY Ninja
Reaction score
424
There are a couple ways to do this.

You can make a unittype array and use a pick every unit loop with a counter; which is what HydraRancher is saying.

I won't point out trigger leaks as HydraRanger has already done so.
 

HydraRancher

Truth begins in lies
Reaction score
197
You don't entirely need to set the builder. You could just make it run every 30 seconds. The disadvantage would be that EVERY unit in the zone will try to build.

But anyway, you just use Set UNITVARIABLE = Builder.
 

soider8

New Member
Reaction score
0
You don't entirely need to set the builder. You could just make it run every 30 seconds. The disadvantage would be that EVERY unit in the zone will try to build.

But anyway, you just use Set UNITVARIABLE = Builder.

Okay, I managed to successfully follow everything you've told me so far, although slight problem is that currently all builders build, including my own builder, is there a type of array or variable to enable only computer controlled players to do this?

I do know about a player group, but I can't seem to put it all together, as in I can't put together in one trigger: All computer controlled players + Allies of Player 2 + Pick Every Unit in Temp_Group.

AI
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Set Building[1] = Necromancer Base
Set Building[2] = Spider Graveyard
Set Building[3] = Demon Spawn
Set Temp_Group = (Units in Blue Zone <gen>)
Unit Group - Pick every unit in Temp_Group and do (Actions)
Loop - Actions
Unit - Order (Picked unit) to build a Building[(Random integer number between 1 and 3)] at (Random point in Blue Zone <gen>)
Custom script: call DestroyGroup (udg_Temp_Group)
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
You would want to replace
Set Temp_Group = (Units in Blue Zone <gen>)
with
Set Temp_Group = (Units in Blue Zone <gen> matching (((Owner of (Matching unit)) controller) Equal to Computer))

That way only units owned by computers would be allowed into the unit group.
 

soider8

New Member
Reaction score
0
You would want to replace
Set Temp_Group = (Units in Blue Zone <gen>)
with
Set Temp_Group = (Units in Blue Zone <gen> matching (((Owner of (Matching unit)) controller) Equal to Computer))

That way only units owned by computers would be allowed into the unit group.

This is useful information but for some reason I can only get this close?
Set Temp_Group = (Units in Blue Zone <gen> matching ((Owner of (Matching unit)) Equal to (Random player from (All players controlled by a Computer player))))

Things that need to be fixed are, the removal of Random player, and All players need to replaced with Allies of Player 2 (Blue Team)
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
If you want the trigger to work for all players that are allies of Player 2, you could do something like this instead:

Set Temp_Group = (Units in Blue Zone <gen> matching (((Owner of (Matching unit)) is an ally of Player 2 (Blue)) Equal to True))

To get this condition, go to Boolean Comparison, and look for Player - Player is an Ally of Player.
 

soider8

New Member
Reaction score
0
If you want the trigger to work for all players that are allies of Player 2, you could do something like this instead:

Set Temp_Group = (Units in Blue Zone <gen> matching (((Owner of (Matching unit)) is an ally of Player 2 (Blue)) Equal to True))

To get this condition, go to Boolean Comparison, and look for Player - Player is an Ally of Player.

Okay but this is where the problem lies, how can the Ally of Player + Controlled by Computer somehow combine? :D

Also in "(Units in Blue Zone <gen> matching (((Owner of (Matching unit)) controller) Equal to Computer))"

Where do I find the part 'controller' and how do I get it to become 'Equal to Computer'?

Btw, thanks for the help so far :D
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
Ok so, your going to want to have the action be:

Set Temp_Group = (Units in Blue Zone <gen> matching ((((Owner of (Matching unit)) is an ally of Player 2 (Blue)) Equal to True) or (((Owner of (Matching unit)) controller) Equal to Computer)))

For the condition, go to the very bottom and select Or, which will make units added to the group if they match one of two conditions. I've already described the first condition, so for the second condition, go to Player Controller Comparison.
 

soider8

New Member
Reaction score
0
Ok so, your going to want to have the action be:

Set Temp_Group = (Units in Blue Zone <gen> matching ((((Owner of (Matching unit)) is an ally of Player 2 (Blue)) Equal to True) or (((Owner of (Matching unit)) controller) Equal to Computer)))

For the condition, go to the very bottom and select Or, which will make units added to the group if they match one of two conditions. I've already described the first condition, so for the second condition, go to Player Controller Comparison.

Thank you for all your help, I'm just about to test it.
But seriously thanks loads :D
 

soider8

New Member
Reaction score
0
Thank you to you both!
Hydra you finished it off, and Ryushi thanks for the continuous help :)
I've got it working perfectly now.
Thanks!
 

soider8

New Member
Reaction score
0
Don't you need and? Because you want it to be an ally of Player 2 AND be a computer.

Although I have one more question, my builders have to build their buildings in quite a large area, and they have only 2 seconds to get to each randomly generated build area, if not they completely change to another build area, is there anyway to allow the unit to continue on his journey until it reaches its destination? Or some other way?

I've tried increasing it's speed to maximum, but still not quite quick enough.
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
You could increase the time in the event so the unit has more time to reach the spot.

Or you could also change the trigger to run when a unit finishes construction, so it will automatically go to build a new building whenever it finishes building its current one.

Or you could add a condition to the trigger to check if the unit is currently building, and if it is, don't give it a new order.

Or you could make the units capable of building from a further distance.
 

soider8

New Member
Reaction score
0
You could increase the time in the event so the unit has more time to reach the spot.

Or you could also change the trigger to run when a unit finishes construction, so it will automatically go to build a new building whenever it finishes building its current one.

Or you could add a condition to the trigger to check if the unit is currently building, and if it is, don't give it a new order.

Or you could make the units capable of building from a further distance.

Oh okay, trouble is, I don't know how to do any of these..
I'll add a list from most to least preferable solution.

Or you could also change the trigger to run when a unit finishes construction, so it will automatically go to build a new building whenever it finishes building its current one. - 1
Or you could add a condition to the trigger to check if the unit is currently building, and if it is, don't give it a new order. - 2

The other two, I don't like them as much, instructions on how to do the above ^^ please?
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
For the first method, I realized that if that unit is caused to stop building in any way, it would not finish building, and therefore not be ordered to build a new building, which could be problematic. For the second method, I added a condition to check if the unit doesn't have an order, and if it doesn't order it to build. The entire trigger would look like this:
Code:
trigger
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Set Building[1] = Necropolis
        Set Building[2] = Halls of the Dead
        Set Building[3] = Black Citadel
        Set Temp_Group = (Units in Blue Zone <gen> matching ((((Matching unit) belongs to an ally of Player 2 (Blue)) Equal to True) and (((Owner of (Matching unit)) controller) Equal to Computer)))
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Current order of (Picked unit)) Equal to (Order(<Empty String>))
                    Then - Actions
                        Set Temp_Point = (Random point in Blue Zone <gen>)
                        Unit - Order (Picked unit) to build a Building[(Random integer number between 1 and 3)] at Temp_Point
                        Custom script:   call RemoveLocation (udg_Temp_Point)
                    Else - Actions
        Custom script:   call DestroyGroup (udg_Temp_Group)
This would periodically pick every unit in your region owned by the correct player who doesn't have an order, and order them to build.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top