+ This system will allow you to make a unit undieable. When a unit die instead of it die immediately, it will have a revive bar and do death animation .......
+ Trigger:
SYSTEM
US Initialization
Events
Map initialization
Conditions Actions
-------- Create US Hashtable -------- Hashtable - Create a hashtable Set US_Hashtable = (Last created hashtable) -------- Set time interval in Looping Trigger -------- Set US_TimeInterval = 0.03 Trigger - Add to US Loop <gen> the event (Time - Every US_TimeInterval seconds of game time) -------- Set size and color of Reviving Bar -------- Set US_BarColor = |cffffcc00 Set US_BarSize = 5.50
US Add Unit
Events Conditions Actions
Unit Group - Add US_Unit to US_Group Set US_ID = (Custom value of US_Unit) Hashtable - Save US_ReviveTime as US_ID of 0 in US_Hashtable Set US_Player = (Owner of US_Unit) Custom script: if udg_US_Player == GetLocalPlayer() then Floating Text - Create floating text that reads above US_Unit with Z offset -5.50, using font size US_BarSize, color (100.00%, 100.00%, 100.00%), and 0.00% transparency Hashtable - Save Handle Of(Last created floating text) as US_ID of 2 in US_Hashtable Hashtable - Save US_SFX[1] as US_ID of 3 in US_Hashtable Hashtable - Save US_SFX[2] as US_ID of 4 in US_Hashtable Custom script: endif Set US_SFX[1] = <Empty String> Set US_SFX[2] = <Empty String> Custom script: call SaveReal(udg_US_Hashtable, udg_US_ID, 6, GetLocationX(udg_US_ReviveLoc)) Custom script: call SaveReal(udg_US_Hashtable, udg_US_ID, 7, GetLocationY(udg_US_ReviveLoc)) Set US_Unit = No unit
US Set Damage
Events
Game - DamageModifierEvent becomes Equal to 1.00
Conditions
DamageEventOverride Equal to False
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(DamageEventTarget is in US_Group) Equal to True DamageEventAmount Greater than or equal to (Life of DamageEventTarget)
Then - Actions
Set DamageEventAmount = 0.00 -------- Action do when a unit die (fake dying) -------- Set US_Unit = DamageEventTarget Set US_ID = (Custom value of US_Unit) Hashtable - Save (Load US_ID of 0 from US_Hashtable) as US_ID of 1 in US_Hashtable Unit - Make US_Unit Invulnerable Unit - Pause US_Unit Animation - Play US_Unit's death animation Special Effect - Create a special effect attached to the origin of US_Unit using (Load US_ID of 3 from US_Hashtable) Hashtable - Save Handle Of(Last created special effect) as US_ID of 5 in US_Hashtable Unit Group - Add US_Unit to US_DyingGroup -------- ================ -------- Set US_Event = 1.00 Set US_Event = 0.00
Else - Actions
Set US_Event = 0.00
US Loop
Events Conditions Actions
Unit Group - Pick every unit in US_DyingGroup and do (Actions)
Loop - Actions
Set US_Unit = (Picked unit) Set US_ID = (Custom value of US_Unit) Set US_ReviveTime = (Load US_ID of 0 from US_Hashtable) Set US_Time = (Load US_ID of 1 from US_Hashtable) Set US_Time = (US_Time - US_TimeInterval) Hashtable - Save US_Time as US_ID of 1 in US_Hashtable If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
US_Time Greater than 0.00
Then - Actions
-------- Action do when a unit is in reviving time. -------- Set US_String = US_BarColor For each (Integer US_Int) from 1 to (100 - (Integer(((US_Time x 100.00) / US_ReviveTime)))), do (Actions)
Loop - Actions
Set US_String = (US_String + |)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((100 - (Integer(((100.00 x US_Time) / US_ReviveTime)))) mod 2) Equal to 1
Then - Actions
Set US_String = (US_String + ||r)
Else - Actions
Set US_String = (US_String + |r|)
For each (Integer US_Int) from 1 to (Integer(((US_Time x 100.00) / US_ReviveTime))), do (Actions)
Loop - Actions
Set US_String = (US_String + |)
Custom script: if udg_US_Player == GetLocalPlayer() then Floating Text - Change text of (Load US_ID of 2 in US_HashtableIf the label is not found, this function returns NULL.) to US_String using font size US_BarSize Floating Text - Change the position of (Load US_ID of 2 in US_HashtableIf the label is not found, this function returns NULL.) to US_Unit with Z offset -5.50 Custom script: endif Set US_String = <Empty String> -------- ================ -------- Set US_Event = 1.50 Set US_Event = 0.00
Else - Actions
-------- Action do when a unit revive -------- Custom script: call SetUnitX(udg_US_Unit, LoadReal(udg_US_Hashtable, udg_US_ID,6)) Custom script: call SetUnitY(udg_US_Unit, LoadReal(udg_US_Hashtable, udg_US_ID,7)) Special Effect - Create a special effect attached to the origin of US_Unit using (Load US_ID of 4 from US_Hashtable) Special Effect - Destroy (Last created special effect) Unit - Make US_Unit Vulnerable Unit - Unpause US_Unit Unit - Set life of US_Unit to 100.00% Unit - Set mana of US_Unit to 100.00% Animation - Reset US_Unit's animation Special Effect - Destroy (Load US_ID of 5 in US_Hashtable) Set US_String = <Empty String> Custom script: if udg_US_Player == GetLocalPlayer() then Floating Text - Change text of (Load US_ID of 2 in US_HashtableIf the label is not found, this function returns NULL.) to US_String using font size US_BarSize Floating Text - Change the position of (Load US_ID of 2 in US_HashtableIf the label is not found, this function returns NULL.) to US_Unit with Z offset -5.50 Custom script: endif Unit Group - Remove US_Unit from US_DyingGroup -------- ================ -------- Set US_Event = 2.00 Set US_Event = 0.00
+ HOW TO USE:
ADD UNIT
US Test Add Unit
Set US_Unit = Footman 0000 <gen> Set US_ReviveTime = 5.00 Set US_SFX[1] = Abilities\Spells\Orc\Reincarnation\ReincarnationTarget.mdl Set US_SFX[2] = Abilities\Spells\Other\Awaken\Awaken.mdl Set US_ReviveLoc = (Center of (Playable map area)) Trigger - Run US Add Unit <gen> (checking conditions)
Undieable Event
Game - US_Event becomes Equal to 1.00
-> When a unit die (fake dying)
Game - US_Event becomes Equal to 1.50
-> A Unit is in reviving time.
Game - US_Event becomes Equal to 2.00
-> A unit revive.
+
NEW CHANGELOG
- Change almost code.
+
OLD CHANGELOG
- Use SetUnitX(udg_unit, LoadReal(...)) and SetUnitY(udg_unit, LoadReal(...)) instead of create a location by loading the coordinates from the hashtable and passing them to Point(x, y).
- Run code before Set US_Event.
- Fix some minor codes.
+ Credit: Bribe (Damage Engine and GUI Unit Indexer)
Oh I was hoping more for a different kind of spinoff, where as the dead unit will stay there until an allied unit comes and channels next to him, reviving the guy :P
But this is nice too.
Oh I was hoping more for a different kind of spinoff, where as the dead unit will stay there until an allied unit comes and channels next to him, reviving the guy :P
But this is nice too.
This system is configurable. You can easy to change it or use it to do what you want :D
It would be even nicer if user can edit things (easily) such as:
Percentage/amount of hitpoints the dead unit's animation has
percentage/amount of hp the unit has after its revived
But i can see uppoints of your system:
original
special effects
easy configurable
hashtables
For voting, i give: 4.5 (Since there's no 4.5, i voted 4)
Thanks, it was useful for me
__________________
Wanna see DotA heroes on paper? ===> Click to visit <===
Nothing is IMPOSSIBLE but Nothing is EASY