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

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,287
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