Jump to content
  • 0

[HELP] King of the Hill (FREYA)


Question

Posted

hi , i`ve got a problem if i start the server; i dont know why or what i did wrong but i got this message: Cannot executing script : .\gameserver\data\scripts\quests\100400_eventmanager\__init__.py

 

here is log of __init__.py

 

   1. \L2j srv\gameserver\data\scripts\quests\100400_eventmanager\__init__.py.error.log
   2. Line: -1 - Column: -1
   3.  
   4. Traceback (innermost last):
   5.   (no code object) at line 0
   6. SyntaxError: ('invalid syntax', ('__init__.py', 3, 2, ' import sys'))

 

This is the way how i wanted to do it:

1. I have created 2htmls (100400.htm,100401.htm) and put them into ".\gameserver\data\html\default"

2. I have created 2 NPCs with IDs 100400,100401

3. I have created new folder in ".\gameserver\data\scripts\quests\100400_eventmanager" and put there __init__.py as well....

4. I have put the __init__.py as well into the ".\gameserver\data\scripts\ai\group_template" and renamed it into EventManager.py

5. I have added this line into scripts.cfg "quests/100400_eventmanager/__init__.py" and "ai/group_template/EventManager.py"

 

__init_.py looks like this:

# #King of the Hill event
#  #by TheOne
#  import sys
#  from com.l2jserver.gameserver              import Announcements
#  from com.l2jserver.util                    import Rnd
#  from java.lang                      import System
#  from com.l2jserver.gameserver.model.quest          import State
#  from com.l2jserver.gameserver.model.quest          import QuestState
#  from com.l2jserver.gameserver.model.quest.jython       import QuestJython as JQuest
#  from com.l2jserver.gameserver.model.actor.instance     import L2PcInstance
#  from com.l2jserver.gameserver.model.actor.instance     import L2NpcInstance
#  
#  
#  MANAGER = 100400
#  TOPNPC  = 100401
#  
#  #Change the reward and amount according to your needs
#  Reward = 3470
#  Amount = 3
#  
#  #Mountain top NPC coords
#  MNPCX   = 144291
#  MNPCY   = 157446
#  MNPCZ   = -466
#  
#  #Mountain bottom and giran(1) NPC coords
#  MBX1    = 146164
#  MBY1    = -55546
#  MBZ1    = -2763
#  MBX = 143370
#  MBY = 161135
#  MBZ = -1925
#  
#  #number of participants
#  MountainMinPlayers = 2
#  MountainMaxPlayers = 30
#  
#  eventInterval = 14400000  # 4 hours after the first event there is the second one and the others after are 4 hours too, change according to your needs
#  FirstStart = 3000  #45 minutes after each restart there is the first event
#  
#  
#  class kingHill (JQuest):
#  
#      def __init__(self,id,name,descr):
#          JQuest.__init__(self,id,name,descr)
#          #Bartz
#          self.startQuestTimer("KingHillPrepare", FirstStart, None, None)
#          self.kingHill1 = []
#          self.Registration = []
#          self.numberPlayers = []
#          self.TopNpc = []
#          self.Team1 = []
#          self.Team2 = []
#          self.OrangeLooses = False
#  
#      def onAdvEvent (self,event,npc,player):
#          if event == "KingHillPrepare" :
#              self.kingHill1 = self.addSpawn(MANAGER,MBX1,MBY1,MBZ1,0,False,0)
#              self.TopNpc = self.addSpawn(TOPNPC,MNPCX,MNPCY,MNPCZ,0,False,0)
#              self.Registration = []
#              Announcements.getInstance().announceToAll("King of the hill event registration is open!!")
#              Announcements.getInstance().announceToAll("All those who wish to participate should come to meet me in Giran town")
#              Announcements.getInstance().announceToAll("Registration will last 15 minutes")
#              self.startQuestTimer("MountainSelect", 900000, None, None)                          
#              self.startQuestTimer("10minutes", 300000, None, None)                            
#              self.startQuestTimer("5minutes", 600000, None, None)                            
#              self.startQuestTimer("2minutes", 780000, None, None)                            
#              self.startQuestTimer("1minute", 840000, None, None)          
#     if event == "10minutes":
#          Announcements.getInstance().announceToAll("10 minutes left for event registration in Giran")
#          if event == "5minutes":
#              Announcements.getInstance().announceToAll("5 minutes left for event registration in Giran")
#          if event == "2minutes":
#              Announcements.getInstance().announceToAll("2 minutes left for event registration in Giran")
#          if event == "1minutes":
#              Announcements.getInstance().announceToAll("1 minute left for event registration in Giran")
#  
#          if event == "MountainSelect" :
#                  self.kingHill1.deleteMe()
#                  totalplayers = len(self.Registration)
#                  print totalplayers
#                  print MountainMinPlayers
#                  if totalplayers >= MountainMinPlayers:
#                      self.startQuestTimer("MountainStart", 5000, None, None)                            
#                      self.numberOfTeams = int((len(self.Registration))/2)
#                      numberOfTeams = int((len(self.Registration))/2)
#                      Id = []
#                      #this part will remove anyone from the registration list who is not online when the event starts, this prevents players from cheating by registering a bunch of characters but playing only with one and getting the reward for all of their characters who were on the winning team even if these are not online during the event.
#                      for i in self.Registration:
#                          rr = i.getClient()
#                          if rr == None:
#                              for i in range(len(self.Registration)):
#                                  if player == self.Registration[i]:
#                                      Id.append(i)
#                              if len(Id) > 1:
#                                  for i in range(len(Id)):
#                                      self.Registration.pop(Id[i])
#                      self.OrangeLooses = False
#                      Team1 = []
#                      Team2 = []
#                      for i in range(len(self.Registration)/2) :
#                          Team1.append(self.Registration.pop(Rnd.get(len(self.Registration))))
#                      Team2 = self.Registration
#                      for i in Team1:
#                          i.teleToLocation(MNPCX,MNPCY,MNPCZ)#tele to top of mountain
#                          i.getAppearance().setNameColor(0x005de2) #orange
#                          i.getAppearance().setTitleColor(0x005de2) #orange
#                      for i in Team2:
#                          i.teleToLocation(MBX,MBY,MBZ)#tele to location A
#                          i.getAppearance().setNameColor(0xd5e200) #yellow
#                          i.getAppearance().setTitleColor(0xd5e200) #yellow
#                      Announcements.getInstance().announceToAll("Team 1 - blue - has 20 minutes to take control of the mountain and talk to the Event Manager NPC on the Top to win this event.")
#                      Announcements.getInstance().announceToAll("Team 2 - orange - has to defend the mountain to win.  Event starts in 1 minute, wait for the signal.")
#                      self.Team1 = []
#                      self.Team2 = []
#                      self.Team1 = Team1
#                      self.Team2 = Team2
#                  else:
#                      print "else"
#                     Announcements.getInstance().announceToAll("Event cancelled due to lack of participation.")
#                      self.kingHill1.deleteMe()
#                      self.TopNpc.deleteMe()
#                      self.cancelQuestTimer("round_finish", None, None)
#                      self.cancelQuestTimer("15Tofinish", None, None)
#                      self.cancelQuestTimer("10Tofinish", None, None)
#                      self.cancelQuestTimer("5Tofinish", None, None)
#                      self.cancelQuestTimer("1Tofinish", None, None)
#  
#          if event == "MountainStart":
#              Announcements.getInstance().announceToAll("Start the event!!! Team 2, ATTACK!!! Good luck to both teams!")
#              self.startQuestTimer("round_finish", 1200000, None, None) #sera 1200000                          
#              self.startQuestTimer("15Tofinish", 300000, None, None)                            
#              self.startQuestTimer("10Tofinish", 600000, None, None)                            
#              self.startQuestTimer("5Tofinish", 900000, None, None)                            
#              self.startQuestTimer("1Tofinish", 1140000, None, None)                            
#          if event == "15Tofinish":
#              Announcements.getInstance().announceToAll("15 minutes until the end of the event")
#          if event == "10Tofinish":
#              Announcements.getInstance().announceToAll("10 minutes until the end of the event")
#          if event == "5Tofinish":
#              Announcements.getInstance().announceToAll("5 minutes until the end of the event")
#          if event == "1Tofinish":
#              Announcements.getInstance().announceToAll("1 minute until the end of the event")
#  
#          if event == "round_finish" :
#              self.OrangeLooses = False
#              self.TopNpc.deleteMe()
#              self.startQuestTimer("KingHillPrepare", eventInterval, None, None)                        
#              self.cancelQuestTimer("15Tofinish", None, None)
#              self.cancelQuestTimer("10Tofinish", None, None)
#              self.cancelQuestTimer("5Tofinish", None, None)
#              self.cancelQuestTimer("1Tofinish", None, None)
#              Announcements.getInstance().announceToAll("Orange team wins!")
#              reward = Reward
#              for i in self.Team2:
#                 rr = (Rnd.get(100) - 50)
#                 xx = MBX1 + rr
#                 yy = MBY1 + rr
#                 i.getAppearance().setNameColor(0xffffff)
#                 i.getAppearance().setTitleColor(0xffffff)
#                 i.teleToLocation(MBX1,MBY1,MBZ1)#tele back to town
#              for i in self.Team1:
#                 rr = (Rnd.get(100) - 50)
#                 xx = MBX1 + rr
#                 yy = MBY1 + rr
#                 i.getQuestState("kingHill").giveItems(Reward,Amount)
#                 i.getQuestState("kingHill").playSound("ItemSound.quest_fanfare_1")
#                 i.getAppearance().setNameColor(0xffffff)
#                 i.getAppearance().setTitleColor(0xffffff)
#                 i.teleToLocation(MBX1,MBY1,MBZ1)#tele back to town
#  
#  
#      def onTalk (self,npc,player) :
#          npcId = npc.getNpcId()
#          if not player.getQuestState("kingHill") : return
#          if npcId == MANAGER :
#             if not player in self.Registration:
#                  if len(self.Registration) < MountainMaxPlayers:
#                      self.Registration.append(player)
#                      Reg = list(self.Registration)
#                      Id = []
#                      for player in self.Registration:
#                          rr = player.getClient()
#                          if rr == None:
#                              for i in range(len(self.Registration)):
#                                  if player == self.Registration[i]:
#                                      Id.append[i]
#                              if len(Id) > 1:
#                                  for i in range(len(Id)):
#                                      self.Registration.pop(Id[i])
#                      return "<html><body>You have been added to the event list, teams will be made randomly 1 minute before the start of the event</body></html>"
#                  else:
#                      self.Full = True
#                      return "<html><body>Event is full, try again next time</body></html>"
#            else:
#                  return "<html><body>You are already registered</body></html>"
#  
#          if npcId == TOPNPC :
#              if player in self.Team2:
#                   self.TopNpc.deleteMe()
#                    self.OrangeLooses = True
#                    self.cancelQuestTimer("round_finish", None, None)
#                    self.cancelQuestTimer("15Tofinish", None, None)
#                    self.cancelQuestTimer("10Tofinish", None, None)
#                    self.cancelQuestTimer("5Tofinish", None, None)
#                    self.cancelQuestTimer("1Tofinish", None, None)
#                    Announcements.getInstance().announceToAll("Blue team wins!")
#                    reward = Reward
#                    self.startQuestTimer("KingHillPrepare", eventInterval, None, None)                        
#                    for i in self.Team1:
#                            rr = (Rnd.get(100) - 50)
#                            xx = MBX1 + rr
#                            yy = MBY1 + rr
#                            i.getAppearance().setNameColor(0xffffff)
#                            i.getAppearance().setTitleColor(0xffffff)
#                            i.teleToLocation(MBX1,MBY1,MBZ1)#tele back to town
#                    for i in self.Team2:
#                            rr = (Rnd.get(100) - 50)
#                            xx = MBX1 + rr
#                            yy = MBY1 + rr
#                            i.getQuestState("kingHill").playSound("ItemSound.quest_fanfare_1")
#                            i.getQuestState("kingHill").giveItems(Reward,Amount)
#                            i.getAppearance().setNameColor(0xffffff)
#                            i.getAppearance().setTitleColor(0xffffff)
#                            i.teleToLocation(MBX1,MBY1,MBZ1)#tele back to town
#             if player in self.Team1:
#                  return "<html><body>You are on the defending team!!! Defend me, stop talking!</body></html>"
#  
#              #else:
#  
#                  # player.sendMessage("You are trying to cheat, you will now go to jail to think about this")
#  
#                  # player.setInJail(True,10) #sends the cheater to jail for 10 minutes so he can think about this...       ----> I have take this 2 lines out because I was getting error
#  
#  
#  QUEST       = kingHill(-1, "kingHill", "ai")
#  
#  QUEST.addStartNpc(100400)
#  QUEST.addStartNpc(100401)
#  QUEST.addTalkId(100400)
#  QUEST.addTalkId(100401)
#  
#  print "King of the Hill event loaded!!!"

 

I am using the lastes revisions of L2j and L2jDP

what did i do wrong pls ?

thanks

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...