• 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] how to make Spawn System?

Status
Not open for further replies.
Level 9
Joined
Apr 23, 2011
Messages
460
There's another thread floating around here about that, try searching for it. The basic concept is to store all creep units original coordinates in an array or a hashtable (don't remember). Then do some sort of dynamic indexing for each unit and have them be comparable to the coordinates, after said time, create a new unit at the coordinates. This is just off the top of my head, I'll see if I can find it for you.

Edit: http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/creep-respawn-gui-65987/
http://www.hiveworkshop.com/forums/world-editor-help-zone-98/unit-respawn-210630/#post2088177
 
Level 4
Joined
Feb 6, 2012
Messages
43
There's another thread floating around here about that, try searching for it. The basic concept is to store all creep units original coordinates in an array or a hashtable (don't remember). Then do some sort of dynamic indexing for each unit and have them be comparable to the coordinates, after said time, create a new unit at the coordinates. This is just off the top of my head, I'll see if I can find it for you.

Edit: http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/creep-respawn-gui-65987/
http://www.hiveworkshop.com/forums/world-editor-help-zone-98/unit-respawn-210630/#post2088177

thanks :grin:
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
A simple trigger is needed (revive the unit at the spot where they died)
Don't worry, it's MUI :)

  • Melee Initialization
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • Set p = (Position of (Triggering unit))
      • Wait 60.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at p facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_p)
This is the most basic respawn triggers that I can show you, there are the ones that is advanced (with many variables to change) and revive where the spot they initially spawn
 
Level 4
Joined
Feb 6, 2012
Messages
43
anyone can help? my trigger error with Custom Script. ( Save And Load System )
Expected a name
set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
set udg_Code = SaveLoad_Encode()
set udg_Validate = SaveLoad_Decode( udg_Code )
set udg_Validate = SaveLoad_Decode( udg_Code )
set udg_Validate = SaveLoad_Decode( udg_Code )
 
Level 4
Joined
Feb 6, 2012
Messages
43
sorry this the trigger and variables and i forgot im using what variables :grin: so im using screenshot and the problem at Custom Script

  • SaveLoad Save All
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as An exact match
      • Player - Player 2 (Blue) types a chat message containing -save as An exact match
      • Player - Player 3 (Teal) types a chat message containing -save as An exact match
      • Player - Player 4 (Purple) types a chat message containing -save as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -save as An exact match
      • Player - Player 6 (Orange) types a chat message containing -save as An exact match
      • Player - Player 7 (Green) types a chat message containing -save as An exact match
      • Player - Player 8 (Pink) types a chat message containing -save as An exact match
      • Player - Player 9 (Gray) types a chat message containing -save as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
    • Conditions
    • Actions
      • -------- Prepare the save array with this player's Hero --------
      • Set SaveCount = 0
      • -------- Player's Goldbar --------
      • Set SaveCount = ((SaveCount + 1) + 1)
      • Set Save[SaveCount] = ((Triggering player) Current lumber)
      • -------- Take all Heroes --------
      • Set UnitGroup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Number of units in UnitGroup)
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • -------- Save the Hero --------
          • Set SaveCount = (SaveCount + 1)
          • Set TempUnit = (Picked unit)
          • Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
          • -------- Hero Experience --------
          • Set SaveCount = (SaveCount + 1)
          • Set Save[SaveCount] = (Hero experience of (Picked unit))
          • -------- How many items does he carry --------
          • Set SaveCount = (SaveCount + 1)
          • Set Save[SaveCount] = (Number of items carried by (Picked unit))
          • -------- Add all items --------
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Item carried by (Picked unit) in slot (Integer A)) is owned) Equal to True
                • Then - Actions
                  • -------- The actual item --------
                  • Set SaveCount = (SaveCount + 1)
                  • Set TempItem = (Item carried by (Picked unit) in slot (Integer A))
                  • Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
                  • -------- The number of charges it has --------
                  • Set SaveCount = (SaveCount + 1)
                  • Set Save[SaveCount] = (Charges remaining in (Item carried by (Picked unit) in slot (Integer A)))
                • Else - Actions
      • -------- Turn values into code --------
      • Custom script: set udg_Code = SaveLoad_Encode()
      • -------- Show code to player --------
      • Game - Display to (Player group((Triggering player))) for 25.00 seconds the text: ( |cffff0000You Code|r: + Code)
      • Game - Display to (Player group((Triggering player))) for 25.00 seconds the text: -------------------...
  • SaveLoad Load All
    • Events
      • Player - Player 1 (Red) types a chat message containing -load as A substring
      • Player - Player 2 (Blue) types a chat message containing -load as A substring
      • Player - Player 3 (Teal) types a chat message containing -load as A substring
      • Player - Player 4 (Purple) types a chat message containing -load as A substring
      • Player - Player 5 (Yellow) types a chat message containing -load as A substring
      • Player - Player 6 (Orange) types a chat message containing -load as A substring
      • Player - Player 7 (Green) types a chat message containing -load as A substring
      • Player - Player 8 (Pink) types a chat message containing -load as A substring
      • Player - Player 9 (Gray) types a chat message containing -load as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -load as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
      • (Length of (Entered chat string)) Greater than 6
      • Check_Players[(Player number of (Triggering player))] Equal to False
    • Actions
      • -------- Try to decode what was typed --------
      • Set Code = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
      • Custom script: set udg_Validate = SaveLoad_Decode( udg_Code )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Validate Equal to False
        • Then - Actions
          • -------- Invalid code --------
          • Game - Display to (Player group((Triggering player))) the text: |cffd8bfd8Hunter|r,...
          • Skip remaining actions
        • Else - Actions
      • -------- It worked, let's do something with it --------
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Set SaveCount = 1
      • -------- Restore Gold and Goldbar --------
      • Player - Set (Triggering player) Current lumber to Save[SaveCount]
      • -------- Number of Heroes --------
      • Set SaveCount = (SaveCount + 1)
      • For each (Integer B) from 1 to Save[SaveCount], do (Actions)
        • Loop - Actions
          • Set Check_Players[(Player number of (Triggering player))] = True
          • -------- Restore Hero --------
          • Set SaveCount = (SaveCount + 1)
          • Custom script: set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
          • Unit - Create 1 TempUnitType for (Triggering player) at (Center of Respawn Area <gen>) facing Default building facing degrees
          • Camera - Pan camera for (Triggering player) to (Center of Respawn Area <gen>) over 0.00 seconds
          • -------- Set Experience --------
          • Set SaveCount = (SaveCount + 1)
          • Hero - Set (Last created unit) experience to Save[SaveCount], Hide level-up graphics
          • -------- Recreate all items --------
          • Set SaveCount = (SaveCount + 1)
          • For each (Integer A) from 1 to Save[SaveCount], do (Actions)
            • Loop - Actions
              • -------- The actual item --------
              • Set SaveCount = (SaveCount + 1)
              • Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
              • Hero - Create TempItemType and give it to (Last created unit)
              • -------- Number of charges --------
              • Set SaveCount = (SaveCount + 1)
              • Item - Set charges remaining in (Last created item) to Save[SaveCount]
variables.jpg
 
Level 4
Joined
Feb 6, 2012
Messages
43
A simple trigger is needed (revive the unit at the spot where they died)
Don't worry, it's MUI :)

  • Melee Initialization
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • Set p = (Position of (Triggering unit))
      • Wait 60.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at p facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_p)
This is the most basic respawn triggers that I can show you, there are the ones that is advanced (with many variables to change) and revive where the spot they initially spawn
Care this won't work if you wait longer than unit expire/decay timer.
 
Level 4
Joined
Feb 6, 2012
Messages
43
this creep respawn system work :)

  • Creep Respawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
      • (Custom value of (Triggering unit)) Greater than 0
    • Actions
      • Wait 60.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 12 (Brown) at Creep_Point[(Custom value of (Triggering unit))] facing (Facing of (Triggering unit)) degrees
      • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
      • Special Effect - Create a special effect at Creep_Point[Temp_Integer] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Special Effect - Destroy (Last created special effect)
 
that creep system is quite old and bad coz it manually adjust tha custom value of the unit, it will conflict UnitIndexer systems, use http://www.hiveworkshop.com/forums/...a-197329/?prev=search=UnitIndexer&d=list&r=20 instead...

  • Custom script: local unit u = GetTriggerUnit()
  • Wait 60.00 seconds
  • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 12 (Brown) at Creep_Point[(Custom value of (Triggering unit))] facing (Facing of (Triggering unit)) degrees
  • Custom script: set udg_ Creep_Point[GetUnitUserData(bj_lastCreatedUnit)] = GetUnitLoc(bj_lastCreatedUnit)
  • Custom script: call RemoveLocation(udg_Creep_Point[GetUnitUserData(u)])
  • Custom script: DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl",GetUnitX(u),GetUnitY(u)))
  • Custom script: set u = null
 
Status
Not open for further replies.
Top