How to: Spawn units timed?

-Brainiac-

New Member
Reaction score
7
Hello there, what I am trying to do is that if I buy a unit it has to spawn on two lanes. (A,B) But, this may only happen every 20 seconds so therefor I have to save the buyed unit somewhere right? It will look ugly if it will stand near the base because other players have the ability to see the entire map and will see the by you bought unit, and then can predict your strategy or something in that direction.

Does anyone know how to do it? (If this works with hashtables and so on, wich prob be? I never done anything with that so explain step by step please ^^)

Thanks

Brain
 

vypur85

Hibernate
Reaction score
803
Perhaps create the units in the starting region. Then hide them (Unit - Hide). When the time is right, pick every units within that region and unhide them and carry on the moving trigger.
 

-Brainiac-

New Member
Reaction score
7
Perhaps create the units in the starting region. Then hide them (Unit - Hide). When the time is right, pick every units within that region and unhide them and carry on the moving trigger.

Good Idea, just that I don't know if the unit is unattackable and/or can it block other units? Because with "Hide" you make them invisable and don't remove them from the map right?

Correct me if i'm wrong, never tried this so just wondering because there is a chance units from the opposite team can reach the region the hidden units are in and maybe they block in someway?

Regards

EDIT:

There is my trigger but it is not working :(

Trigger:
  • Red
    • Events
      • Unit - A unit enters Red <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Red <gen> contains (Entering unit)) Equal to True
        • Then - Actions
          • Set TempPoint = (Center of LNLM1 <gen>)
          • Unit - Create 1 Footman for Player 1 (Red) at TempPoint facing Default building facing degrees
          • Unit - Hide (Last created unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for Wave_Timer) Less than or equal to 0.00
            • Then - Actions
              • Unit - Unhide (Last created unit)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Set TempPoint = (Center of LNLT1 <gen>)
          • Unit - Create 1 Footman for Player 1 (Red) at TempPoint facing Default building facing degrees
          • Unit - Hide (Last created unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for Wave_Timer) Less than or equal to 0.00
            • Then - Actions
              • Unit - Unhide (Last created unit)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Unit - Remove (Entering unit) from the game
        • Else - Actions
 

vypur85

Hibernate
Reaction score
803
Hmmm... Your way is not right.

My idea was something like:
Code:
Event
 A unit sells a unit
Condition
 Unit-type of (Triggering unit) Equal to YOURTAVERN
Action
 Unit - Move (Sold unit) to REGIONX
 Unit - Hide (Sold unit)

Code:
Event
 TimerX Expires
Condition
Action
 Unit group - Pick every unit in REGIONX matching (Matching unit) is hidden Equal to True...
   Loop - Actions
     Unit - Unhide (Picked unit)
     Unit - Order to move....
     -etc-
 

-Brainiac-

New Member
Reaction score
7
Hmmm... Your way is not right.

My idea was something like:
Code:
Event
 A unit sells a unit
Condition
 Unit-type of (Triggering unit) Equal to YOURTAVERN
Action
 Unit - Move (Sold unit) to REGIONX
 Unit - Hide (Sold unit)

Code:
Event
 TimerX Expires
Condition
Action
 Unit group - Pick every unit in REGIONX matching (Matching unit) is hidden Equal to True...
   Loop - Actions
     Unit - Unhide (Picked unit)
     Unit - Order to move....
     -etc-


Ok I get your idea but I have to spawn the same unit on two lanes, so I made this:

Trigger:
  • Red 1
    • Events
      • Unit - A unit owned by Player 1 (Red) Sells a unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Ivory Tower
    • Actions
      • Set TempPoint = (Center of LNLM1 <gen>)
      • Unit - Move (Sold unit) instantly to TempPoint
      • Unit - Hide (Sold unit)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Set TempPoint = (Center of LNLT1 <gen>)
      • Unit - Create 1 (Unit-type of (Sold unit)) for Player 1 (Red) at (Center of LNLT1 <gen>) facing Default building facing degrees
      • Unit - Hide (Last created unit)
      • Custom script: call RemoveLocation(udg_TempPoint)

Trigger:
  • Red 2
    • Events
      • Time - Wave_Timer expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in LNLM1 <gen> matching (((Matching unit) is hidden) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)
      • Unit Group - Pick every unit in (Units in LNLT1 <gen> matching (((Matching unit) is hidden) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)


Just that that doesn't work....
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Trigger:
  • Unit - A unit owned by Player 1 (Red) Sells a unit


Are you sure that the Selling unit is owned by Player 1 (Red) ? :eek:

Trigger:
  • (Unit-type of (Triggering unit)) Equal to Ivory Tower


Are you sure that it's the Selling unit's unit-type you want to be Ivory Tomer ? :eek:

Trigger:
  • Unit - Create 1 (Unit-type of (Sold unit)) for Player 1 (Red) at (Center of LNLT1 <gen>) facing Default building facing degrees


Use the point variable for "(Center of LNLT1 <gen>)" :p (Just a note ;))

Trigger:
  • Time - Wave_Timer expires


Can't see you starting it anywhere :S
 

-Brainiac-

New Member
Reaction score
7
Start Timer
Trigger:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 2000
          • Player - Set (Picked player) Current lumber to 1
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across (Playable map area)
      • Wait 0.01 seconds
      • Countdown Timer - Start Wave_Timer as a Repeating timer that will expire in 30.00 seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title Next Wave:


Expiring Timer
Trigger:
  • Red 2
    • Events
      • Time - Wave_Timer expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in LNLM1 &lt;gen&gt; matching (((Matching unit) is hidden) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set TempPoint = (Center of LSLM1 &lt;gen&gt;)
          • Unit - Unhide (Picked unit)
          • Unit - Order (Picked unit) to Attack-Move To TempPoint
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Unit Group - Pick every unit in (Units in LNLT1 &lt;gen&gt; matching (((Matching unit) is hidden) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set TempPoint = (Center of LNLT1 &lt;gen&gt;)
          • Unit - Unhide (Picked unit)
          • Unit - Order (Picked unit) to Attack-Move To TempPoint
          • Custom script: call RemoveLocation(udg_TempPoint)


Are you sure that the Selling unit is owned by Player 1 (Red) ?
Yes I am sure.

Are you sure that it's the Selling unit's unit-type you want to be Ivory Tomer ?

Well I made a custom unit and that unit sells the unit, so yea.

Use the point variable for "(Center of LNLT1 <gen>)" (Just a note )

You mean to prevent leaking? Because I set the temppoints but did not mentioned them in my "unit - create". I changed that now, but I don't understand your question completly.

-----------------------------------------------------------------------

I do have another problem. Once I added more players to my multiboard something bugged;
Player Name Life
Player 1 50
Player 2 50
etc

that is how it is supossed to look but after a unit enters a certain region that triggers -1 life to the enemy player the sentence: Life dissapears and will be replaced by 50. How come?

Trigger:
  • Player Life Update 1
    • Events
      • Unit - A unit enters LNLM1 &lt;gen&gt;
      • Unit - A unit enters LNLT1 &lt;gen&gt;
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Entering unit) belongs to an enemy of Player 1 (Red)) Equal to True
        • Then - Actions
          • Set Life_Red = (Life_Red - 1)
          • Multiboard - Set the text for (Last created multiboard) item in column 3, row Multiboard_Spots[(Player number of Player 1 (Red))] to (String(Life_Red))
        • Else - Actions
          • Do nothing


Trigger:
  • Create Multiboard
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set Player_Count = (Number of players in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))))
      • Multiboard - Create a multiboard with 3 columns and (1 + Player_Count) rows, titled Score Board
      • Multiboard - Set the text for (Last created multiboard) item in column 2, row 1 to Player Name
      • Multiboard - Set the text for (Last created multiboard) item in column 3, row 1 to Life
      • For each (Integer A) from 1 to (1 + Player_Count), do (Actions)
        • Loop - Actions
          • Multiboard - Set the display style for (Last created multiboard) item in column 1, row 1 to Show text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 1, row (Integer A) to Show text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 2, row (Integer A) to Show text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 3, row (Integer A) to Show text and Hide icons
          • Multiboard - Set the width for (Last created multiboard) item in column 1, row (Integer A) to 2.00% of the total screen width
          • Multiboard - Set the width for (Last created multiboard) item in column 2, row (Integer A) to 8.00% of the total screen width
          • Multiboard - Set the width for (Last created multiboard) item in column 3, row (Integer A) to 3.00% of the total screen width
      • Set List = 2
      • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User))) and do (Actions)
        • Loop - Actions
          • Set Multiboard_Spots[(Player number of (Picked player))] = List
          • Multiboard - Set the icon for (Last created multiboard) item in column 1, row List to ReplaceableTextures\CommandButtons\BTNVillagerMan.blp
          • Multiboard - Set the text for (Last created multiboard) item in column 2, row List to (Player_Colors[(Player number of (Picked player))] + ((Name of (Picked player)) + |r))
          • Multiboard - Set the text for (Last created multiboard) item in column 3, row List to 50
          • Set List = (List + 1)
      • Multiboard - Show (Last created multiboard)


How I fix that? My own units will also hit me in my life points, and when I try to hide them untill the timer expires the units wont appear at all, so in my triggers above you see that they are just unhidden. I'll change that later on, just mentioning..
Could be if there is something wrong in my trigger, i'm not good with multiboards.

Regards
 

kaboo

New Member
Reaction score
45
i think this is the easiest way how to do it:

1. for every unit you have create ability that does nothing, targets nothing, costs 0 mana and has 20 second cooldown
2. add those abilities to your baracks -> also remove "sells a unit"
3. when this spell is cast check if owner of casting unit has enough gold (gold cost of unit) if no - do nothing, if yes create two units of wanted type at wanted place and take gold from owner of casting unit
 

-Brainiac-

New Member
Reaction score
7
i think this is the easiest way how to do it:

1. for every unit you have create ability that does nothing, targets nothing, costs 0 mana and has 20 second cooldown
2. add those abilities to your baracks -> also remove "sells a unit"
3. when this spell is cast check if owner of casting unit has enough gold (gold cost of unit) if no - do nothing, if yes create two units of wanted type at wanted place and take gold from owner of casting unit

might work but the problem is that the units have to be spawned at the same time for everyplayer. So like player 1 buys 1 footman, and player 2 buys 3 archers and player three buys 1 knight, that all these units ( 2 footman, 6 archers, 2 knights) are spawned on the 20st second, repeating over and over. But after each 'wave' new units should be bought and spawned repeating this over and over. Your way is going the right way though :p just that I have like 20 custum units, then I have to make 20 different useless buffs right?

Regards and thanks!
 

kaboo

New Member
Reaction score
45
yes, for 20 units you have to create 20 abilities, but they wont be useless :p
 

Halofan

New Member
Reaction score
7
What you want to do is make a region where the purchased units appear. Then, once you buy the unit:
Code:
Untitled Trigger 000
    Events
        Unit - A unit Sells a unit
    Conditions
    Actions
        Unit - Hide (Sold unit)
As for showing the unit, try this:
Code:
Untitled Trigger 001
    Events
        Time - Every <YOUR INTERVAL> seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in <SPAWN AREA REGION>) and do (Unit - Unhide (Picked unit))
This should work, so long as the units you sell stay within the region. So if you purchase too many units, that could be an issue. For multiple players, just make an action for each region.
 
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