• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Spawn System

Status
Not open for further replies.
  • Spawn
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set RandomAnimals = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomAnimals Less than or equal to 30
        • Then - Actions
          • Unit - Create 1 Deer for Player 12 (Brown) at (Random point in (Playable map area)) facing Default building facing degrees
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomAnimals Less than or equal to 60
            • Then - Actions
              • Unit - Create 1 Rabbit for Player 12 (Brown) at (Random point in (Playable map area)) facing Default building facing degrees
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomAnimals Less than or equal to 100
                • Then - Actions
                  • Unit - Create 1 Sheep for Player 12 (Brown) at (Random point in (Playable map area)) facing Default building facing degrees
                • Else - Actions
Sometimes they spawn in the water. How can I fix it?
 
If you check if walkability at this point if true, they should not spawn in deep water anymore

  • Set Point = (Random point in (Playable map area))
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • IF - Conditions
      • (Terrain pathing at Point of type Walkability is off) Equals False
    • Then - Actions
      • Unit - Create YourUnir for Player at Point facing 0 degrees
    • Else - Actions
  • Custom script: call RemoveLocation (udg_Point)
Or if it's maybe a single rect (your water), you can create a region where you don't want to spawn your units and then check ..
  • ((Region) contains Point) Equalse False
 
Also, you may Set Variable - Point instead of using Random Point in Playable Map Area. Work with variables everytime it is possible.

This is partially true.

You should use a variable whenever the action is repeated twice or more.

In the case with random point though you need to use a variable as random point leaks if not removed.
 
This is partially true.

You should use a variable whenever the action is repeated twice or more.

In the case with random point though you need to use a variable as random point leaks if not removed.

Yeah! That`s what I mean. His trigger will spawn a critter each 10 seconds in a random point of the map. This represents 6 leaks per minute for each player!!
So Points Variables are must here.
 
So how about this?

  • Spawn
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set RandomAnimals = (Random integer number between 1 and 100)
      • Set SpawnPoint = (Random point in (Playable map area))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomAnimals Less than or equal to 40
          • (Terrain pathing at SpawnPoint of type Walkability is off) Equal to False
        • Then - Actions
          • Unit - Create 1 Deer for Player 12 (Brown) at SpawnPoint facing Default building facing degrees
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomAnimals Less than or equal to 80
              • (Terrain pathing at SpawnPoint of type Walkability is off) Equal to False
            • Then - Actions
              • Unit - Create 1 Rabbit for Player 12 (Brown) at SpawnPoint facing Default building facing degrees
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomAnimals Less than or equal to 20
                  • (Terrain pathing at SpawnPoint of type Walkability is off) Equal to False
                • Then - Actions
                  • Unit - Create 1 Sheep for Player 12 (Brown) at SpawnPoint facing Default building facing degrees
                • Else - Actions
      • Custom script: call RemoveLocation(udg_SpawnPoint)
 
Your trigger is wrong. In that case, BOTH CONDITIONS may be true to create the Deer. If both are not true (and note if you random a number less then 40 but the point arrives on an unpathable area, it will disconsider the deer and jump to next phase verification. That would be false too, because the number you sorted still less then 80 and the point is still in the same unpathable place. And, at last, your third filter is having the same behavior, so it will lead to the last
  • Else - Actions
that is empty. So nothing happens when the point is unpathable.

So the best to do is to create two triggers.
One will occur every ten seconds of the game and will random a point and a number and, then, run the second one (that will have no event on the heading).
The second one will contain your ITE (If - Then - Else) that select the correct unit/pathable point to spawn the critter. But, you need to add another IF inside each previous THEN. So ity may be like:

  • If - Conditions
    • RandomAnimals Less than or equal to 40
    • Then - Actions
      • If - Conditions
        • (Terrain pathing at SpawnPoint of type Walkability is off) Equal to False
      • Then - Actions
        • Unit - Create 1 Deer for Player 12 (Brown) at SpawnPoint facing Default building facing degrees
      • Else - Actions
        • Set SpawnPoint = (Random point in (Playable map area))
        • Run (This Trigger).
 
The trigger could be structured like this
  • Untitled Trigger 004
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at (Center of (Playable map area)) of type Walkability is off) Equal to True
        • Then - Actions
          • Set i = (Random integer number between 1 and 10)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • i Less than 41
            • Then - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • i Less than 81
                • Then - Actions
                • Else - Actions
 
  • (Terrain pathing at SpawnPoint of type Walkability is off) Equal to False
This should be true instead of false

No, friend, it shouldnt be true because you checking:

IF terrain pathing at point of type WALKABILITY is OFF = false

Means that you should do THEN - ACTIONS if the terrain at the point is walkable. If not walkable, the ELSE - ACTIONS should run.
 
To clarify

  • Untitled Trigger 001
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Set p = (Position of u)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at p of type Floatability is off) Equal to False
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at p of type Walkability is off) Equal to True
            • Then - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: deep water
            • Else - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: shallow water
        • Else - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: not water
 
No, friend, it shouldnt be true because you checking:

IF terrain pathing at point of type WALKABILITY is OFF = false

Means that you should do THEN - ACTIONS if the terrain at the point is walkable. If not walkable, the ELSE - ACTIONS should run.

Seems I misunderstood then, never mind.
 
dude, you need a "respawn" unit or "spawn" unit system? respawn for me is reviving death unit.. wait, sorry I didn't follow the comments..

I suggest you to use something I call "repeater". repeater is a looping integer that never ends until the matching conditions are met.
for example:

  • for loop integer A from 0 to 2
  • actions
  • set integer A = 0
  • set point = (random point in map)
  • if (point walkability is on equal to true)
    • set integer A = 3 //this will ends the loop
  • else
    • destroy point
in that trigger, the system will always find a new point until the condition(point walkability blablabla) is met. I will explain more if you dont get clear enough..
 
dude, you need a "respawn" unit or "spawn" unit system? respawn for me is reviving death unit.. wait, sorry I didn't follow the comments..

I suggest you to use something I call "repeater". repeater is a looping integer that never ends until the matching conditions are met.
for example:

  • for loop integer A from 0 to 2
  • actions
  • set integer A = 0
  • set point = (random point in map)
  • if (point walkability is on equal to true)
    • set integer A = 3 //this will ends the loop
  • else
    • destroy point
in that trigger, the system will always find a new point until the condition(point walkability blablabla) is met. I will explain more if you dont get clear enough..

I don't like this type of work. Kinda consume too much memory while infinitely looping.. Better check the previous suggestions, they're kinda better.
 
Status
Not open for further replies.
Back
Top