• 🏆 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!

[Trigger] Creep Revive(Lag & Bug)

Status
Not open for further replies.
Level 10
Joined
Feb 20, 2008
Messages
448
code
  • InitCreepRespawn
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set temp_SecondsPerLevel = 100
      • -------- 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))))
      • 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 --------
          • Set temp_TimeFrequencyMAX[ID] = temp_SecondsPerLevel
          • 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 (Dying 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
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • temp_TimeFrequencyMAX[(Custom value of (Triggering unit))] Equal to 0
            • Then - Actions
              • Set temp_TimeLeft[(Custom value of (Triggering unit))] = temp_TimeFrequencyMAX[(Custom value of (Picked unit))]
              • Unit - Create 1 temp_UnitTypes[(Custom value of (Triggering unit))] for Neutral Hostile at (Point(X[(Custom value of (Triggering unit))], Y[(Custom value of (Triggering unit))])) facing Default building facing degrees
              • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
              • Unit - Remove (Triggering unit) from the game
              • -------- if you dont like the special effect, just delete the last 2 actions below this comment --------
            • Else - Actions
              • Unit Group - Add (Triggering unit) to temp_RevivingCreeps
        • Else - Actions
  • ReviveTheUnit
    • Events
      • Time - Every 0.10 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
            • Else - Actions
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
Why using this...Huge trigger?You can simply use this one,small and effective and no lag at all.
  • Store
  • Events
  • Map initialization
  • Conditions
  • Actions
  • Set Respawn_Time = 5.00
  • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
  • Loop - Actions
  • Set Temp_Integer = (Temp_Integer + 1)
  • Unit - Set the custom value of (Picked unit) to Temp_Integer
  • Set Creep_Point[Temp_Integer] = (Position of (Picked unit))

  • Respawn
  • Events
  • Unit - A unit Dies
  • Conditions
  • (Owner of (Triggering unit)) Equal to Neutral Hostile
  • (Custom Value of (Triggering unit)) Greater than 0
  • Actions
  • Custom script: local integer i = GetUnitTypeId(GetTriggerUnit())
  • Custom script: local integer ii = GetUnitUserData(GetTriggerUnit())
  • Wait Respawn_Time game-time seconds
  • Custom script: call SetUnitUserData(CreateUnit(Player(12),i,GetLocationX(udg_Creep_Point[ii]),GetLocationY(udg_Creep_Point[ii]),270),ii)
 
Status
Not open for further replies.
Top