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

(GUI) Unit respawn friendly to Bribe's Indexing

Status
Not open for further replies.
Level 10
Joined
Nov 24, 2010
Messages
546
Hello everyone
I need unit respawn system friendly with Evade system (check triggers).
That one respawn system is bugged but Evade system works 100% fine.
Ofcourse, if I import this system to my map it breaks Evade system.
So this one is working but disables my evade system:
:

  • CreepInt
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Res_Respawn_Time = 120.00
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Set Res_Temp_Integer = (Res_Temp_Integer + 1)
          • Unit - Set the custom value of (Picked unit) to Res_Temp_Integer
          • Set Res_Creep_Point[Res_Temp_Integer] = (Position of (Picked unit))
  • CreepRespawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
      • (Custom value of (Triggering unit)) Greater than 0
    • Actions
      • Wait Res_Respawn_Time game-time seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at Res_Creep_Point[(Custom value of (Triggering unit))] facing 270.00 degrees
      • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
      • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
      • Special Effect - Destroy (Last created special effect)
  • CreepRespawnAdd
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set Res_Temp_Integer = (Res_Temp_Integer + 1)
      • Unit - Set the custom value of (Triggering unit) to Res_Temp_Integer
      • Set Res_Creep_Point[Res_Temp_Integer] = (Position of (Triggering unit))

This respawn system is bugged but Evade works 100%

  • Is Unit Moving
    • Events
      • Time - Every 0.05 seconds of game time
      • Game - UnitIndexEvent becomes Equal to 1.00
      • Game - UnitIndexEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexEvent Equal to 1.00
        • Then - Actions
          • -------- --------
          • -------- The next conditions let you filter out unwanted units --------
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Default movement speed of UDexUnits[UDex]) Not equal to 0.00
            • Then - Actions
              • -------- --------
              • -------- Register the indexed unit to the list --------
              • -------- --------
              • Set UMovPrev[UMovNext[0]] = UDex
              • Set UMovNext[UDex] = UMovNext[0]
              • Set UMovNext[0] = UDex
              • Custom script: set udg_UnitMovingX[udg_UDex] = GetUnitX(udg_UDexUnits[udg_UDex])
              • Custom script: set udg_UnitMovingY[udg_UDex] = GetUnitY(udg_UDexUnits[udg_UDex])
            • Else - Actions
              • -------- --------
              • -------- The unit will not be registered --------
              • -------- --------
          • Custom script: elseif udg_UnitIndexEvent == 2 then
          • Custom script: if udg_UMovPrev[udg_UDex] != 0 or udg_UMovNext[0] == udg_UDex then
          • -------- --------
          • -------- Unregister the deindexed unit from the list --------
          • -------- --------
          • Set UnitMoving[UDex] = False
          • Set UMovNext[UMovPrev[UDex]] = UMovNext[UDex]
          • Set UMovPrev[UMovNext[UDex]] = UMovPrev[UDex]
          • Set UMovPrev[UDex] = 0
          • Custom script: endif
        • Else - Actions
          • Set UDex = UMovNext[0]
          • Custom script: loop
          • Custom script: exitwhen udg_UDex == 0
          • Custom script: set udg_TempX = GetUnitX(udg_UDexUnits[udg_UDex])
          • Custom script: set udg_TempY = GetUnitY(udg_UDexUnits[udg_UDex])
          • -------- --------
          • -------- Check if unit's coordinates have changed --------
          • -------- --------
          • Custom script: if udg_TempX != udg_UnitMovingX[udg_UDex] or udg_TempY != udg_UnitMovingY[udg_UDex] then
          • Set UnitMovingX[UDex] = TempX
          • Set UnitMovingY[UDex] = TempY
          • Custom script: if not udg_UnitMoving[udg_UDex] then
          • -------- --------
          • -------- The unit has started moving, fire event for UDex --------
          • -------- --------
          • Set UnitMoving[UDex] = True
          • Set UnitMovingEvent = 1.00
          • Set UnitMovingEvent = 0.00
          • Custom script: endif
          • Custom script: elseif udg_UnitMoving[udg_UDex] then
          • -------- --------
          • -------- The unit has stopped moving, fire event for UDex --------
          • -------- --------
          • Set UnitMoving[UDex] = False
          • Custom script: if GetUnitTypeId(udg_UDexUnits[udg_UDex]) != 0 then //To prevent firing when the unit decays/gets removed
          • Set UnitMovingEvent = 2.00
          • Set UnitMovingEvent = 0.00
          • Custom script: endif
          • Custom script: endif
          • Set UDex = UMovNext[UDex]
          • Custom script: endloop
  • GetCreep
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))) and do (Actions)
        • Loop - Actions
          • Set key = (Custom value of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UnitMoving[key] Equal to True
              • ((Picked unit) is in EvadeGroup) Not equal to True
            • Then - Actions
              • Unit Group - Add (Picked unit) to EvadeGroup
              • Trigger - Turn on EvadeSystem <gen>
            • Else - Actions
  • GetInitloc
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set RespawnTime = 185.00
      • Set EvadeDist = 550.00
      • Set EvadeDelay = 1.00
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set key = (Custom value of (Picked unit))
          • Custom script: set udg_x[udg_key] = GetUnitX(GetEnumUnit())
          • Custom script: set udg_y[udg_key] = GetUnitY(GetEnumUnit())
          • Set time[key] = RespawnTime
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
  • GetLoc
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Set key = (Custom value of (Triggering unit))
      • Custom script: set udg_x[udg_key] = GetUnitX(GetTriggerUnit())
      • Custom script: set udg_y[udg_key] = GetUnitY(GetTriggerUnit())
      • Set time[key] = RespawnTime
  • UnitRespawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Not equal to True
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Custom script: local integer i = GetUnitUserData(GetTriggerUnit())
      • Custom script: local integer id = GetUnitTypeId(GetTriggerUnit())
      • Custom script: local player p = GetOwningPlayer(GetTriggerUnit())
      • Set key = (Custom value of (Triggering unit))
      • Wait time[key] seconds
      • Custom script: set udg_key = i
      • Custom script: set bj_lastCreatedUnit = CreateUnit(p, id, udg_x[udg_key], udg_y[udg_key], bj_UNIT_FACING)
      • Custom script: set udg_key = GetUnitUserData(bj_lastCreatedUnit)
      • Custom script: set udg_x[udg_key] = GetUnitX(bj_lastCreatedUnit)
      • Custom script: set udg_y[udg_key] = GetUnitY(bj_lastCreatedUnit)
      • Custom script: set p = null
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Neutral Hostile
        • Then - Actions
          • Unit Group - Remove (Triggering unit) from EvadeGroup
        • Else - Actions
  • EvadeSystem
    • Events
      • Time - Every 0.15 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in EvadeGroup and do (Actions)
        • Loop - Actions
          • Custom script: local unit u = GetEnumUnit()
          • Custom script: local integer key = GetUnitUserData(u)
          • Custom script: local real dx = GetUnitX(u) - udg_x[key]
          • Custom script: local real dy = GetUnitY(u) - udg_y[key]
          • -------- -------------------------------------------------------------------------------- --------
          • -------- Check if calculations should be started --------
          • -------- -------------------------------------------------------------------------------- --------
          • Custom script: if udg_UnitMoving[key] and not udg_OnEvade[key] then
          • -------- -------------------------------------------------------------------------------- --------
          • -------- If unit pass the conditions, count distance --------
          • -------- -------------------------------------------------------------------------------- --------
          • Custom script: if SquareRoot(dx * dx + dy * dy) >= udg_EvadeDist then
          • Custom script: call IssuePointOrderById(u, 851986, udg_x[key], udg_y[key])
          • Custom script: set udg_OnEvade[key] = true
          • Custom script: set udg_p = Location(GetUnitX(u), GetUnitY(u))
          • -------- -------------------------------------------------------------------------------- --------
          • -------- If greater than constant global EvadeDist then start 'evade' event --------
          • -------- -------------------------------------------------------------------------------- --------
          • Unit - Make (Picked unit) Invulnerable
          • -------- -------------------------------------------------------------------------------- --------
          • -------- Creating floating text --------
          • -------- -------------------------------------------------------------------------------- --------
          • Floating Text - Create floating text that reads Evade at p with Z offset 0.00, using font size 9.00, color (100.00%, 100.00%, 0.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 3.40 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 2.70 seconds
          • Custom script: endif
          • -------- -------------------------------------------------------------------------------- --------
          • -------- Check if unit in is 'evade' state --------
          • -------- -------------------------------------------------------------------------------- --------
          • Custom script: elseif udg_OnEvade[key] then
          • -------- -------------------------------------------------------------------------------- --------
          • -------- Additional action to prefent unit from avoiding 'evade state' --------
          • -------- -------------------------------------------------------------------------------- --------
          • Custom script: if GetUnitCurrentOrder(u) != 851986 then
          • Custom script: call IssuePointOrderById(u, 851986, udg_x[key], udg_y[key])
          • Custom script: endif
          • -------- -------------------------------------------------------------------------------- --------
          • -------- If delay if enought, unit is restored --------
          • -------- -------------------------------------------------------------------------------- --------
          • Custom script: if udg_OnDelay[key] >= udg_EvadeDelay and not udg_UnitMoving[key] then
          • Unit - Make (Picked unit) Vulnerable
          • Unit - Reset ability cooldowns for (Picked unit)
          • Custom script: call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_MAX_LIFE))
          • Custom script: call SetUnitState(u, UNIT_STATE_MANA, GetUnitState(u, UNIT_STATE_MAX_MANA))
          • Custom script: set udg_OnEvade[key] = false
          • Custom script: set udg_OnDelay[key] = 0
          • Custom script: call GroupRemoveUnit(udg_EvadeGroup, u)
          • -------- -------------------------------------------------------------------------------- --------
          • -------- If not, delay will be increased --------
          • -------- -------------------------------------------------------------------------------- --------
          • Custom script: elseif not udg_UnitMoving[key] then
          • Custom script: set udg_OnDelay[key] = udg_OnDelay[key] + 0.1
          • Custom script: endif
          • Custom script: endif
          • -------- -------------------------------------------------------------------------------- --------
          • -------- Check if unit is dead to remove it from group --------
          • -------- -------------------------------------------------------------------------------- --------
          • Custom script: if GetWidgetLife(u) < 0.405 then
          • Custom script: call GroupRemoveUnit(udg_EvadeGroup, u)
          • Custom script: endif
          • -------- -------------------------------------------------------------------------------- --------
          • -------- Check if group is empty, if so stop the function --------
          • -------- -------------------------------------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (EvadeGroup is empty) Equal to True
            • Then - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
          • -------- -------------------------------------------------------------------------------- --------
          • -------- Clearing leaks --------
          • -------- -------------------------------------------------------------------------------- --------
          • Custom script: call RemoveLocation(udg_p)
          • Custom script: set u = null


So basically what I request is Evade and Respawn systems working together.
+ rep and credits will be given to creator
 
Status
Not open for further replies.
Top