• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Simple Spawning and Reviving System 1.2f [GUI]


- This system will handle reviving issues for you, be it Normal Units or Heroes, both can be revived ! (except Buildings).

- You can set a unique settings for each unit to have different place to respawn, respawn duration and what unit will be affected by this system.

- It is perfectly MUI.

- Each timer created is player-color based, meaning you know which died units does that belongs to.

- Regardless of who owns the unit, the unit-type of the dying unit will always respawn according to the setup trigger (if Red and Blue dies - both of them from Rifleman, both of that unit will be respawned at the Rifleman Region).

- This respawn system favors more towards Unit-Type, not Player-own.

- It's in GUI !



- All instructions are in the SR Setup trigger (under Trigger Comment).

External Instruction:
- Open World Editor -> File -> Preferences... -> General Tab -> Tick the Automatically create unknown variables while pasting trigger data.
- Copy the Folder Simple Spawning and Reviving System and paste it in your Trigger Editor.
- Follow the instructions comments inside the SR Setup trigger.



  • SR Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- 1st unit --------
      • Set SR_SpawnUnit[1] = Paladin
      • Set SR_SpawnLimit[1] = 4
      • Set SR_SpawnRegion[1] = PaladinRegion <gen>
      • Set SR_RespawnDuration[1] = 2.00
      • -------- 2nd unit --------
      • Set SR_SpawnUnit[2] = Archmage
      • Set SR_SpawnLimit[2] = 3
      • Set SR_SpawnRegion[2] = ArchmageRegion <gen>
      • Set SR_RespawnDuration[2] = 6.00
      • -------- 3rd unit --------
      • Set SR_SpawnUnit[3] = Mountain King
      • Set SR_SpawnLimit[3] = 5
      • Set SR_SpawnRegion[3] = MountainKingRegion <gen>
      • Set SR_RespawnDuration[3] = 1.00
      • -------- 4th unit --------
      • Set SR_SpawnUnit[4] = Blood Mage
      • Set SR_SpawnLimit[4] = 1
      • Set SR_SpawnRegion[4] = BloodMageRegion <gen>
      • Set SR_RespawnDuration[4] = 4.00
      • -------- 5th unit --------
      • Set SR_SpawnUnit[5] = Footman
      • Set SR_SpawnLimit[5] = 2
      • Set SR_SpawnRegion[5] = Player 5 Army <gen>
      • Set SR_RespawnDuration[5] = 10.00
      • -------- 6th unit --------
      • Set SR_SpawnUnit[6] = Knight
      • Set SR_SpawnLimit[6] = 1
      • Set SR_SpawnRegion[6] = Player 6 Army <gen>
      • Set SR_RespawnDuration[6] = 15.00
      • -------- 7th unit --------
      • Set SR_SpawnUnit[7] = Rifleman
      • Set SR_SpawnLimit[7] = 3
      • Set SR_SpawnRegion[7] = Player 7 Army <gen>
      • Set SR_RespawnDuration[7] = 7.00
      • -------- 8th unit --------
      • Set SR_SpawnUnit[8] = Mortar Team
      • Set SR_SpawnLimit[8] = 3
      • Set SR_SpawnRegion[8] = Player 8 Army <gen>
      • Set SR_RespawnDuration[8] = 8.00
      • -------- This is Player Color to match the Timer Color --------
      • Set SR_PlayerColor[1] = |CFFFF0303
      • Set SR_PlayerColor[2] = |CFF0042FF
      • Set SR_PlayerColor[3] = |CFF1CB619
      • Set SR_PlayerColor[4] = |CFF540081
      • Set SR_PlayerColor[5] = |CFFFFFF01
      • Set SR_PlayerColor[6] = |CFFFE8A0E
      • Set SR_PlayerColor[7] = |CFF20C000
      • Set SR_PlayerColor[8] = |CFFE55BB0
      • Set SR_PlayerColor[9] = |CFF959697
      • Set SR_PlayerColor[10] = |CFF7EBFF1
      • Set SR_PlayerColor[11] = |CFF106246
      • Set SR_PlayerColor[12] = |CFF4E2A04
      • -------- Maximum units that you have set --------
      • Set SR_MaxSpawnUnitType = 8
      • -------- DO NOT TOUCH IF YOU DON'T UNDERSTAND --------
      • -------- The creations of these units is optional, it's up to you how the units enter the map --------
      • -------- Hashtable creating for future saving data --------
      • Custom script: set udg_SR_Hashtable = InitHashtable()
      • -------- How often your timer moves per interval (to be realistic, the lower the value, the realistic it is) --------
      • Set SR_Interval = 0.03
      • Trigger - Add to SR Respawn Time <gen> the event (Time - Every SR_Interval seconds of game time)
  • SR Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A structure) Equal to False
    • Actions
      • Set TempUnit = (Triggering unit)
      • For each (Integer LoopingInteger) from 1 to SR_MaxSpawnUnitType, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of TempUnit) Equal to SR_SpawnUnit[LoopingInteger]
            • Then - Actions
              • Unit Group - Add TempUnit to SR_DeadGroup
              • Custom script: set udg_SR_Key = GetHandleId(udg_TempUnit)
              • Trigger - Turn on SR Respawn Time <gen>
              • Hashtable - Save SR_RespawnDuration[LoopingInteger] as 0 of SR_Key in SR_Hashtable
              • Hashtable - Save LoopingInteger as 1 of SR_Key in SR_Hashtable
              • Skip remaining actions
            • Else - Actions
  • SR Respawn Time
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SR_DeadGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in SR_DeadGroup and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • Custom script: set udg_SR_Key = GetHandleId(udg_TempUnit)
              • Set SR_RespawnDuration[(SR_MaxSpawnUnitType + 1)] = (Load 0 of SR_Key from SR_Hashtable)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SR_RespawnDuration[(SR_MaxSpawnUnitType + 1)] Greater than 0.00
                • Then - Actions
                  • Floating Text - Create floating text that reads (SR_PlayerColor[(Player number of (Owner of TempUnit))] + ((String(SR_RespawnDuration[(SR_MaxSpawnUnitType + 1)])) + |r)) above TempUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to SR_Interval seconds
                  • Floating Text - Change the fading age of (Last created floating text) to SR_Interval seconds
                  • Hashtable - Save (SR_RespawnDuration[(SR_MaxSpawnUnitType + 1)] - SR_Interval) as 0 of SR_Key in SR_Hashtable
                • Else - Actions
                  • Set TempLoc = (Center of SR_SpawnRegion[(Load 1 of SR_Key from SR_Hashtable)])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (TempUnit is A Hero) Equal to True
                    • Then - Actions
                      • Hero - Instantly revive TempUnit at TempLoc, Show revival graphics
                    • Else - Actions
                      • Unit - Create 1 (Unit-type of TempUnit) for (Owner of TempUnit) at TempLoc facing Default building facing degrees
                  • Custom script: call RemoveLocation(udg_TempLoc)
                  • Hashtable - Clear all child hashtables of child SR_Key in SR_Hashtable
                  • Unit Group - Remove TempUnit from SR_DeadGroup

- Nightbrowler -> For requested this sytem.
- KnnO -> Proper Unit Group checks.
- Pharaoh_ -> Review the old comment.



v1.0
- Initial release

v1.1
- Fixed location leak
- SR_SpawnRegion variable has been changed to Region type
- Map is slightly optimized (coding)

v1.2f
- Optimized the code.


I made this system based on Nightbrowler's request.

If you don't understand how this system works or you find any bugs, you can post it here and also PM me if you want it private and more detailed explanation.

Keywords:
simple, spawning, reviving, system, defskull, respawn, player, color, Nightbrowler.
Contents

Just another Warcraft III map (Map)

Reviews
Moderator: Pharaoh_ Date: 20:44, 5th Jul 2012 Very useful and does the job just fine. Recommended • Use Regions, instead of locations in the Map Init to define their spawning spot. Remove TempLoc leaks (two, at the moment). • Though you...

Moderator

M

Moderator

160036-albums4747-picture55861.png

Moderator: Pharaoh_
Date: 20:44, 5th Jul 2012

Review
Very useful and does the job just fine.

Recommended
• Use Regions, instead of locations in the Map Init to define their spawning spot. Remove TempLoc leaks (two, at the moment).

• Though you should pick regions into the code,
  • Set TempLoc = SR_SpawnRegion[LoopingInteger]
  • Hashtable - Save Handle OfTempLoc as (Key RespawnLoc) of SR_Key in SR_Hashtable
Simply:
  • Hashtable - Save Handle Of SR_SpawnRegion[LoopingInteger] as (Key RespawnLoc) of SR_Key in SR_Hashtable
Well, that's not exactly what I said, but if you want to stick with that, you are currently leaking a location, upon saving it.

If you were up to using locations, then you would use the method above; if not, then you can go for the next solution:
• When the unit dies, after checking what array index (LoopingInteger variable) it belongs to, save the LoopingInteger to it and when the time-out comes, then set
  • TempLoc = (Center of SpawnRegions[(Load 20 of SR_Key from SR_Hashtable)])[trigger]
  • Where Load 20 is the LoopingInteger.[/hidden]
  • [/box][/td][/tr][/TABLE][/center]
 
Level 8
Joined
Sep 18, 2011
Messages
195
Everything seems to be good
except this:

  • Unit Group - Add TempUnit to SR_DeadGroup
  • Trigger - Turn on SR Respawn Time <gen>
Put them after the looping integer, because what if the dying unit is not used in the system?
You can solve that by this:

  • SR Death
    • Events
    • Conditions
    • Actions
    • Set TempUnit = (Triggering unit)
    • Set TempInteger = -1
    • For each (Integer LoopingInteger) from 1 to SR_MaxSpawnUnitType, do (Actions)
      • Loop - Actions
        • ------------------ You check in the loop if it's the same unit, and set a temp integer variable = LoopingInteger
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • TempInteger not equal to -1
      • Then - Actions
        • Custom script: set udg_SR_Key = GetHandleId(udg_TempUnit)
        • Unit Group - Add TempUnit to SR_DeadGroup
        • Trigger - Turn on SR Respawn Time <gen>
        • Set TempDelay = SR_RespawnDuration[TempInteger]
        • Set TempLoc = SR_SpawnRegion[TempInteger]
        • Hashtable - Save TempDelay as (Key RespawnTime) of SR_Key in SR_Hashtable
        • Hashtable - Save Handle OfTempLoc as (Key RespawnLoc) of SR_Key in SR_Hashtable
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I will add an exceptions later on by using array variables.
Or so I think the map creator will just filter the unit through the IF condition below Events.

That looping is a check whether the unit is in the system or not (set via Setup Trigger).

It will loop through the remaining indexes in the array, if it cannot find at least 1 similarity to that unit, it will do nothing at all (the unit is excluded from the system by itself)
 
Level 5
Joined
Jan 18, 2012
Messages
179
You don't understand whats Item Drop? It's the thing that when you put Item Drop to a Unit a white circle-thing comes uppon its head. Thats the way you set Item Drops without triggers.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I found a bug : When 2 of the same types of heroes die from 2 different players, they respawn at the same respawn point, even if they are set in 2 different points.

Regardless of who owns the unit, the unit-type of the dying unit will always respawn according to the setup trigger (if Red and Blue dies - both of them from Rifleman, both of that unit will be respawned at the Rifleman Region).

- This respawn system favors more towards Unit-Type, not Player-own.

It's not a bug, it's what this system purposes.
 
Level 1
Joined
Sep 3, 2018
Messages
1
Hey, thanks @defskull for this. I'm working on something for fun, who knows if I will ever get far enough to release it. I always start something, and then days later I start on another project. But if I do ever finish it, or get far enough to release a little something. I will make sure you get the credit for assisting in the script.
 
Level 17
Joined
Jun 2, 2009
Messages
1,112
Hello my friend. Can you help me about that? Somehow it won't work for me.

 
Top