• 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.

[Trigger] Creep Respawn

Status
Not open for further replies.
Level 3
Joined
May 6, 2007
Messages
22
Im working on the trigger where creeps respawn right after the decaying of the ones that were just there and for somereason i cant find it :D any help would be appriciated thanks.... Also i wanna resapwn diffrent groups of enemys at random or they get stronger the more you kill them.:infl_thumbs_up:
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
1.
  • Unknown
    • Events
      • Unit - A unit Decays
    • Conditions
    • Actions
      • Set TempLoc = (Position of (Triggering unit))
      • Unit - Create 1 Your_Unit for Some_Player at TempLoc facing Default building facing degrees
      • Custom script: call RemoveLocation( udg_TempLoc )

2.
  • Unknown
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Integar = (Random integer number between 1 and 5)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integar Equal to 1
        • Then - Actions
          • Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integar Equal to 2
            • Then - Actions
              • Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Integar Equal to 3
                • Then - Actions
                  • Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Integar Equal to 4
                    • Then - Actions
                      • Actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integar Equal to 5
                        • Then - Actions
                          • Actions
                        • Else - Actions

3.
  • Unknown
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Triggering unit)) Equal to Your_Unit_Type)) and do (Actions)
        • Loop - Actions
          • Set Integar = (Number of units in (Last created unit group))
  • Unknown
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in (Last created unit group)) Equal to True
    • Actions
      • Set Integar = (Integar - 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Integar Equal to 0
    • Then - Actions
      • Unit - Create 10 Your_Unit_Type for Some_Player at Some_Place facing Default building facing degrees
      • Set Integar = (Number of units in (Last created unit group))
    • Else - Actions

You would most likely add a variable to the group.
To make them strong you can either make them another unit type.
Or make them have inventory and add an item to it (if they are heros you could add attributes).

Hope I helped.
 
Level 12
Joined
Aug 18, 2006
Messages
1,193
i would say this is easier
#1
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit type of (Dying unit)) Not equal to Respawn Unit
    • Add other Conditions if you wish, like units that are not supposed to respawn
  • Actions
    • Set TempPos = (Position of (Dying unit))
    • Unit - Create 1 Respawn Unit at TempPos for (Owner of (Dying unit)) facing Default Building Facing
    • Unit - Add a (How long before respawn) second Generic exparasion timer
    • Unit - Set Custom Value of (Last Created unit) to (Point Value of (Dying unit))
    • Custom script: call RemoveLocation(udg_TempPos)
#2
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit type of (Dying unit)) Equal to Respawn Unit
  • Actions
    • Set TempUnit[1] = YourFirstUnit
    • Set TempUnit[2] = YourSecondUnit
    • and so on
    • Set TempPos = (Position of (Dying unit))
    • Create 1 TempUnit[(Custom Value of (Dying unit))] for (Owner of (Dying unit)) facing WhatEverFacingYouWish
    • Custom script: call RemoveLocation(udg_TempPos)
Respawn Unit should be a 0 Sight Range/Invurnable/Invisible/Unmovable/Locust unit with no attack

These triggers also require that you set the Point Values of the unit types :p

This system allows individual units to respawn aswell, and not when the whole group is killed
 
Level 3
Joined
May 6, 2007
Messages
22
ok for the most part i got it to respawn a creep every 30 seconds thats good enough for a bit. :D this is only the beta
 
Level 8
Joined
Feb 20, 2007
Messages
338
If you can not figure out the random creep respawn system then perhaps something a little one liner will work better for you:

Here is an example of how this would work:

  • Creep Respawn
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
      • ((Triggering unit) is A Hero) Not equal to True
    • Actions
      • Wait 40.00 seconds
      • If ((Number of units in (Units within 700.00 of (Center of (Region centered at (Position of (Dying unit)) with size (1.00, 1.00))) matching (((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True))) Equal to 0) then do (Unit - Replace (Dying unit) with a (Unit-type of (Dying unit)) using The new unit's max life and mana) else do (Do nothing)
In this case the action replaces the dying unit with the same kind of unit. If you want a higher level creep you would modify that to read:

  • If ((Number of units in (Units within 700.00 of (Center of (Region centered at (Position of (Dying unit)) with size (1.00, 1.00))) matching (((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True))) Equal to 0) then do (Unit - Replace (Dying unit) with a (Random level ((Level of (Dying unit)) + 1) creep unit-type) using The new unit's max life and mana) else do (Do nothing)
Upside, your creeps grow in level, down side is that random creep means that - it will pull a random creep from any tile set that is +1 in level to the dying creep.

This means if you place murlocs they could be replaced by dragons, bandits or skeletons - anything that is the next level up will be used or picked from randomly.

This can be a down if you are seeking to maintain a certain feel for your game, lets say you want nothing more than just murlocs along your coast, Then you are going to need to set up your respawning units in a different trigger assigning numbers to them. Then your death trigger would call upon that number as Ghost outlined above.

40 second wait - TO match what ever you have decay set to. Perhaps a tad easier for you?

Of course you can set the event to anything you like. If it is based upon decay they you do not need the wait. I used Unit - Player = Owned unit event as dies, you can use: Unit - A unit owned by Neutral Hostile Decays

I used the condition "not a hero" simply to fill space - you can have any condition you need. Or no conditions at all.

Why I have the condition 'number of units in....' so creeps will not respawn where say peasants are building the next town hall, tower or what not. One would hate to have a creep respawn over and over again inside of a base. This would remove that respawning creep allowing your "town" or "base" to be built unhindered.

It is based on the If/Then/Else trigger (not the multiple functions one commonly used).

Decay of flesh, bones and buildings are all controlled via the Advanced/Gameplay Constants - the same place were you can control how many levels your hero can get, what time the sun rises, what time the sun sets and the duration of a game day, etcetera, etcetera, etcetera -


Of course you would set your temporary location/point (a variable you make) and you would destroy it (this is removing a leak point). Razor used this in his trigger:

Set TempPos = (Position of (Dying unit))
Custom script: call RemoveLocation(udg_TempPos)

Are two lines added to remove what will be a costly leak point in a map when tied to "respawning".

In this case he made a variable in the variable editor (the yellow X at the top of the trigger editor opens up variables) he named it TempPos (you may name it anything you want) In the variable editor it would be a point. He used Set Variable setting it to the position of the dying unit. At the end of the trigger he placed in a custom script line. That line is simply:

RemoveLocation(udg_TempPos)


To read more on leaks: http://www.hiveworkshop.com/forums/showthread.php?t=35124
 
Level 10
Joined
Sep 21, 2007
Messages
517
You can just go DL my RPG Systems pack [GO TO SPELLS SECTION] or do these triggers yourself, which i dont really reccommend since they are pretty long ;D
  • InitCreepRespawn
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This sets the Advanced Unit Type Timings --------
      • Trigger - Run AdvancedUserControlledTime <gen> (checking conditions)
      • -------- sets the seconds per level for the creep's revival time. --------
      • -------- for example if the units level is 1 then 7 x 1(level of unit) = 7 which means the unit will revive in 7 seconds --------
      • Set temp_SecondsPerLevel = 7
      • -------- ----------------------------------------------------------------------------------------------------------------------------------- --------
      • -------- ----------------------------------------------------------------------------------------------------------------------------------- --------
      • -------- ----------------------------------------------------------------------------------------------------------------------------------- --------
      • -------- ----------------------------------------------------------------------------------------------------------------------------------- --------
      • -------- YOU DON'T NEED TO LEARN THE OTHER PARTS, TO USE THE SYSTEM JUST --------
      • -------- CHANGE THE temp_SecondsPerLevel --------
      • -------- For more advanced users who want a specific time for a specific unit type of creep --------
      • -------- go to the trigger "AdvancedUserControlledTime" --------
      • -------- ----------------------------------------------------------------------------------------------------------------------------------- --------
      • -------- ----------------------------------------------------------------------------------------------------------------------------------- --------
      • -------- Initializes the creeps and stores them in arrays. --------
      • -------- Only Gets Non-Building, Non-Hero Units. --------
      • -------- You Can Easily Change That By Adding/Removing Conditions I Put For Matching Unit --------
      • -------- just a debug message. Ignore this. --------
      • Set strDebugMSG = Insufficient space left to store remaining units. Maximum units that can be stored are 8192.
      • -------- ---- --------
      • Set temp_UnitGroup = (Units owned by Neutral Hostile matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A Hero) Equal to False) and (((Matching unit) is alive) Equal to True))))
      • Trigger - Run SameTimeForAllCreeps <gen> (checking conditions)
      • Unit Group - Pick every unit in temp_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ID Greater than or equal to 8192
            • Then - Actions
              • Game - Display to (All players) the text: strDebugMSG
              • Skip remaining actions
            • Else - Actions
          • Set ID = (ID + 1)
          • Set temp_CreepSpawnLoc = (Position of (Picked unit))
          • Set temp_UnitTypes[ID] = (Unit-type of (Picked unit))
          • Set X[ID] = (X of temp_CreepSpawnLoc)
          • Set Y[ID] = (Y of temp_CreepSpawnLoc)
          • Unit - Set the custom value of (Picked unit) to ID
          • -------- Checks off that the unit has been stored. --------
          • Set temp_bHasUnitBeenStored[ID] = True
          • -------- Customizes The Unit's Time From The AdvancedTimeFeature --------
          • -------- If You Customized It --------
          • For each (Integer A) from 1 to temp_MaxCustomizedArray, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • zz_bDisableSameTime Equal to True
                  • zz_bDisableRanges Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • temp_UnitTypes[ID] Equal to temp_UnitTypes_ForTime[(Integer A)]
                      • temp_MaxCustomizedArray Greater than or equal to 1
                    • Then - Actions
                      • Set temp_TimeFrequencyMAX[ID] = temp_CustomizedTime[(Integer A)]
                    • Else - Actions
                      • Set temp_TimeFrequencyMAX[ID] = (temp_SecondsPerLevel x (Level of (Picked unit)))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • zz_bDisableSameTime Equal to False
                      • zz_bDisableSameTime Not equal to True
                    • Then - Actions
                      • Set temp_TimeFrequencyMAX[ID] = zz_TimeCreeps
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • zz_bDisableRanges Equal to False
                          • zz_bDisableRanges Not equal to True
                        • Then - Actions
                          • Set temp_TimeFrequencyMAX[ID] = (Random integer number between zz_TimeRange[1] and zz_TimeRange[2])
                        • Else - Actions
          • Set temp_TimeLeft[ID] = temp_TimeFrequencyMAX[ID]
          • Custom script: call RemoveLocation(udg_temp_CreepSpawnLoc)
          • Custom script: set udg_temp_CreepSpawnLoc = null
      • Custom script: call DestroyGroup(udg_temp_UnitGroup)
      • Custom script: set udg_temp_UnitGroup = null
  • AunitDies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
      • ((Triggering unit) is A structure) Equal to False
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • -------- This trigger sets the unit's revival when it dies --------
      • -------- The condition checks if the unit was previously stored or not --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • temp_bHasUnitBeenStored[(Custom value of (Triggering unit))] Equal to True
        • Then - Actions
          • Unit Group - Add (Triggering unit) to temp_RevivingCreeps
        • Else - Actions
  • ReviveTheUnit
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • -------- This is the core of the system, it does the reviving --------
      • Unit Group - Pick every unit in temp_RevivingCreeps and do (Actions)
        • Loop - Actions
          • Set temp_TimeLeft[(Custom value of (Picked unit))] = (temp_TimeLeft[(Custom value of (Picked unit))] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • temp_TimeLeft[(Custom value of (Picked unit))] Less than or equal to 0
            • Then - Actions
              • Set temp_TimeLeft[(Custom value of (Picked unit))] = temp_TimeFrequencyMAX[(Custom value of (Picked unit))]
              • Unit - Create 1 temp_UnitTypes[(Custom value of (Picked unit))] for Neutral Hostile at (Point(X[(Custom value of (Picked unit))], Y[(Custom value of (Picked unit))])) facing Default building facing degrees
              • Unit - Set the custom value of (Last created unit) to (Custom value of (Picked unit))
              • Unit - Remove (Picked unit) from the game
              • -------- if you dont like the special effect, just delete the last 2 actions below this comment --------
              • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
  • SameTimeForAllCreeps
    • Events
    • Conditions
    • Actions
      • -------- both features/techniques can only work if you disabled one and enabled another --------
      • -------- Disable both if you dont want any of these techniques/features. --------
      • -------- This basically sets a revival time for creeps of ALL TYPES AND LEVELS to revive --------
      • -------- to disable this feature just set the variable zz_DisableSameTime = True --------
      • Set zz_bDisableSameTime = True
      • Set zz_TimeCreeps = 0
      • -------- This technique sets a random revival time between 2 numbers for creeps of ALL types and levels --------
      • -------- to disable this technique just set zz_bDisableRanges to True --------
      • Set zz_bDisableRanges = False
      • Set zz_TimeRange[1] = 1
      • Set zz_TimeRange[2] = 2
      • -------- if zz_TimeRange[1] = 30 and zz_TimeRange[2] = 45 --------
      • -------- Then creeps will have random revival times between 30 and 45 seconds --------
 
Level 11
Joined
Aug 25, 2006
Messages
971
Seems pretty damn long, but there are a lot of comments. Even when I did soley GUI I seem to remember mine being shorter. This is what I did.
First at the start of the map I picked every creep and gave them a unique custom unit value. In an array with the index of their custom unit value I stored their location.
Then when one of them died a spawned a unit exactly like them in a secluded location away from the player and gave the new unit the same custom unit value as the old. I gave the new unit an X second expiration timer. The X stands for how long I wanted it to take to respawn. When the unit died (I checked that the unit was in that secluded location) I spawned a new one at the location specified by the custom value and gave the new unit the same custom value. Not amazingly efficient, but it worked. Of course there are much better possibilities in JASS. (Like structs)
 
Level 1
Joined
Dec 5, 2007
Messages
1
i would say this is easier
#1
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit type of (Dying unit)) Not equal to Respawn Unit
    • Add other Conditions if you wish, like units that are not supposed to respawn
  • Actions
    • Set TempPos = (Position of (Dying unit))
    • Unit - Create 1 Respawn Unit at TempPos for (Owner of (Dying unit)) facing Default Building Facing
    • Unit - Add a (How long before respawn) second Generic exparasion timer
    • Unit - Set Custom Value of (Last Created unit) to (Point Value of (Dying unit))
    • Custom script: call RemoveLocation(udg_TempPos)
#2
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit type of (Dying unit)) Equal to Respawn Unit
  • Actions
    • Set TempUnit[1] = YourFirstUnit
    • Set TempUnit[2] = YourSecondUnit
    • and so on
    • Set TempPos = (Position of (Dying unit))
    • Create 1 TempUnit[(Custom Value of (Dying unit))] for (Owner of (Dying unit)) facing WhatEverFacingYouWish
    • Custom script: call RemoveLocation(udg_TempPos)
Respawn Unit should be a 0 Sight Range/Invurnable/Invisible/Unmovable/Locust unit with no attack

These triggers also require that you set the Point Values of the unit types :p

This system allows individual units to respawn aswell, and not when the whole group is killed


What do you mean with Set TempPos = (Position of (Dying unit)) ?? Sorry iam german :wsmile:
 
Status
Not open for further replies.
Top