• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Restart Game

Status
Not open for further replies.
Level 6
Joined
Aug 14, 2016
Messages
174
Anyone know how to make restart game
Example:
If all player hero died, the command will show it.
Mission Fail, You want play again?
Write -restart to restart the game.
All hero will revive comeback but lost all items.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,229
You need to record the starting state of the map. For units this can be done by picking every unit on the map at map initialization and then recording their state inside various arrays, incrementing the index used for each different unit. When you reset you remove all units on the map, and then use the array to recreate them in their initial state.

All variables related to progress also need to be reset to initial values. This includes reinitializing all unit variables to represent the new replacement units.

Be warned that leaks can only be cleared by starting a new map session. To avoid performance problems in the long run it is very important that one leaks as little as possible.
 
Status
Not open for further replies.
Top