Code:
def getModule():
EnvironmentData = {
# Explanation:
# 16 - (16:00:00 - 16:59:59)
# "d:/ymir work/environment/capedragonhead.msenv" - Environment what will be set on this time.
# You can add how many environments you want.
4: "d:/ymir work/environment/metin2_map_n_flame_dragon_01.msenv",
8: "d:/ymir work/environment/mtthunder.msenv",
12: "d:/ymir work/environment/bayblacksand.msenv",
16: "d:/ymir work/environment/capedragonhead.msenv",
20: "d:/ymir work/environment/snowm02.msenv",
22: "d:/ymir work/environment/trent02.msenv"
}
return EnvironmentData # Returns the dict with all items
def getHour():
return ((app.GetGlobalTimeStamp() / 60) / 60 % 24) # Returns the hour from server timestamp (loaded by TPacketGCTime)
def Main():
for key, c_pszName in getModule().iteritems():
if getHour() is key and app.IsExistFile(c_pszName): # Checks if current hour is equal with index from dict EnvironmentData and it checks if environment exists (file .msenv) in pack.
background.RegisterEnvironmentData(0, c_pszName) # Set the environment
background.SetEnvironmentData(0)
You can execute the function in two parts for loaded automatically.
File: root/game.py
On function:
- def OnUpdate(self): - Check every time hour and inserted environment, you should add a break to stop condition after check is true.
- def Open(self): - Check on every start the client / teleport - Much better optimization.







