Checking if the MapMgr exists
Sometimes we need to make sure the MapMgr exists. This is because when the compiler checks your scripts for errors, it runs through the script. When the compiler runs through the script the MapMgr instance has not yet been initialized, so anything invoking a method on MapMgr will complain the said method to be nil. To counter this we place this at the top of the script to stop your script running until MapMgr is loaded.
if not MapMgr then return end -- You can also only run your script on a specific map if you want. if not MapMgr:GetMapInfo().mapid == ### then return end -- If you do this your script will cease running on the Map unless it matches the chosen Map ID.
--Sympathy 04:56, 4 March 2011 (MST)