Jump to content
  • 0

Question

Posted

Hi all !
i have a problem i was trying to make a custom quest  i want a npc teleport to a raidboss ,when char is there i want to spawn 4 bosses 1 by one with cinematic ,so i copied and adapt sailren .py but i have a problem that i cant understand.i am getting error at line 48 "getObjectId"  the python code is below.i use l2jfrozen.

import sys
from com.l2jfrozen.gameserver.ai import CtrlIntention
from com.l2jfrozen.gameserver.managers import GrandBossManager
from com.l2jfrozen.gameserver.model.actor.position import L2CharPosition
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jfrozen.gameserver.network.serverpackets import SocialAction
from com.l2jfrozen.gameserver.network.serverpackets import SpecialCamera
from com.l2jfrozen.util.random import Rnd
from java.lang import System

STATUE = 50000
SAILREN = 35646
VELO = 35647
PTERO = 90000
TREX = 35648

STONE = 6673

class Grandmaster (JQuest) :

 def __init__(self,id,name,descr):
   self.vlc = []
   self.ptr = []
   self.trx = []
   self.slrn = []
   JQuest.__init__(self,id,name,descr)

 def onAdvEvent (self,event,npc,player):
   if event == "start" :
     self.vlc = self.addSpawn(VELO,96452,159940,-3275,45000,False,0)
     self.startQuestTimer("camera",2000, self.vlc, player)
     self.cancelQuestTimer("start",npc,None)
   if event == "round2" :
     self.ptr = self.addSpawn(PTERO,96409,160011,-3261,45000,False,0)
     self.startQuestTimer("camera",2000, self.ptr, player)
     self.cancelQuestTimer("round2",npc,None)
   if event == "round3" :
     self.trx = self.addSpawn(TREX,96500,159998,-3275,45000,False,0)
     self.startQuestTimer("camera",2000, self.trx, player)
     self.cancelQuestTimer("round3",npc,None)
   if event == "grandmaster" :
     self.slrn = self.addSpawn(SAILREN,96403,160011,-3299,45000,False,0)
     self.startQuestTimer("camera",2000, self.slrn, player)
     self.startQuestTimer("vkrovatku",1200000, self.slrn, None)
     self.cancelQuestTimer("round4",npc,None)
   elif event == "camera" :
     player.broadcastPacket(SpecialCamera(npc.getObjectId(),400,-75,3,-150,5000))
     npc.broadcastPacket(SocialAction(npc.getObjectId(),1))
   elif event == "open" :
     self.deleteGlobalQuestVar("close")  
     self.cancelQuestTimer("open",npc,None)
   elif event == "vkrovatku" :
     npc.deleteMe()
     self.deleteGlobalQuestVar("close")
     self.cancelQuestTimer("open",npc,None)
     self.cancelQuestTimer("vkrovatku",npc,None)
   return
        
 def onTalk (self,npc,player):
   st = player.getQuestState("grandmaster")  
   npcId = npc.getNpcId()
   close = self.loadGlobalQuestVar("close")
   time = self.loadGlobalQuestVar("time")
   party = player.getParty()
   if npcId == STATUE :
     if st.getQuestItemsCount(STONE) >= 1 :
       if close == "" :
         if party:
           for player in party.getPartyMembers() :
             st.takeItems(STONE,1)
             self.saveGlobalQuestVar("close", "1")
             zone = GrandBossManager.getInstance().getZone(97235,160539,-3312)
             if zone:
               zone.allowPlayerEntry(player, 3600)
             player.teleToLocation(97235,160539,-3312)
             self.startQuestTimer("start",30000,npc,player)
             self.startQuestTimer("open",1800000,npc,None)
         else :
           return "<html><body><font color=LEVEL>Only with party...</font></body></html>"
       else :
         return "<html><body><font color=LEVEL>Some one else is inside...</font></body></html>"
     else :
       return "<html><body>You need quest item: <font color=LEVEL>Gazkh...</font></body></html>"
   return

 def onKill(self,npc,player,isPet):
   if npc == self.vlc :
     self.startQuestTimer("round2",30000,npc,player)
   if npc == self.ptr :
     self.startQuestTimer("round3",60000,npc,player)
   if npc == self.trx :
     self.startQuestTimer("grandmaster",180000,npc,player)
   if npc == self.slrn :
     self.deleteGlobalQuestVar("close")
     self.cancelQuestTimer("open",npc,None)
   return

QUEST = Grandmaster(-1,"grandmaster","ai")
CREATED = State('Start',QUEST)

QUEST.setInitialState(CREATED)

QUEST.addStartNpc(STATUE)
QUEST.addTalkId(STATUE)
QUEST.addKillId(VELO)
QUEST.addKillId(PTERO)
QUEST.addKillId(TREX)
QUEST.addKillId(SAILREN)



2 answers to this question

Recommended Posts

  • 0
Posted (edited)

I just fastchecked, but most probably your npc is null at a line. Be sure all events "camera" refer to a real, existing object.

 

As you cancel the timer "start" inside "start", most probably references are lost time the next event is fired. All in one, as an event, it's idiot to cancel yourself (cancel got a meaning when regular behavior must be aborted, otherwise nope). And "grandmaster" cancels "round4" which isn't existing.

 

Following variables got no uses, you can simply check via npcId (since you already store the npcId and don't use the variables to despawn NPCs).

  self.vlc = []
   self.ptr = []
   self.trx = []
   self.slrn = []

"vkrovatku" timer use is probably wrong, until you want your boss to be killed before a specific time (and even if it's the case, there is no cancel of that timer anywhere except by itself - see my second paragraph -, so it will be fired anyway).

Edited by Tryskell
  • 0
Posted

I just fastchecked, but most probably your npc is null at a line. Be sure all events "camera" refer to a real, existing object.

 

As you cancel the timer "start" inside "start", most probably references are lost time the next event is fired. All in one, as an event, it's idiot to cancel yourself (cancel got a meaning when regular behavior must be aborted, otherwise nope). And "grandmaster" cancels "round4" which isn't existing.

 

Following variables got no uses, you can simply check via npcId (since you already store the npcId and don't use the variables to despawn NPCs).

  self.vlc = []
   self.ptr = []
   self.trx = []
   self.slrn = []

"vkrovatku" timer use is probably wrong, until you want your boss to be killed before a specific time (and even if it's the case, there is no cancel of that timer anywhere except by itself - see my second paragraph -, so it will be fired anyway).

problem solved thank for your help mate, someone close topic

Guest
This topic is now closed to further replies.


  • Posts

    • ElmoreLab Harbor - Eternal C1 x1: ✅ https://harbor.elmorelab.com ElmoreLab Harbor - Eternal C1 x1 - is an exclusive server of the Eternal C1 chronicles from the top project ElmoreLab Harbor.   A unique server of its kind, on which everyone will have maximum pleasure, such as oldschool players who dream of nostalgia and to feel the warmest and classic C1 chronicles, as well as experienced players who are tired of thousands unbalanced servers of late chronicles. Due to the professional corrections of the balance system and the HONEST gameplay system - on this server, EVERY player will feel like in their own, warm and cozy Harbor C1. Let's return to the origins of L2 - back to 2004 in C1! ❤️   ⭐ Server characteristics:   STRICTLY 1 window, NO BOXES Bans for RMT and bots/cheats No donations with benefits Unique and high-quality PTS-build from Master Toma Professional corrections and full class-balance Reworked economy and closed all abuses Improved animations and all aspects of the game Exclusive HD-client with high-quality textures Experienced administration and management Fixed all bugs, geodata, exploits and holes Maximum sociality due to the 1-box system Discovering, exploring and researching Big online International server Nostalgia and oldschool-feelings   Rates: x1 Server start: 14.02.2025   The server is at the final stages of development and preparation for release. Information on the server will be updated, soon the patchnotes and changes/edits will be posted. Don't miss the legendary and epic experience on the best server in the last 20 years! ❤️ Join our C1-forum with a lot of information about server and active discussions.   ⭐ Website: https://harbor.elmorelab.com   ✅ Forum: https://forum-harbor.elmorelab.com   💥 Telegram: https://t.me/l2harbor https://t.me/l2harbor_chat   ⚡ Discord: https://discord.gg/harborelmorelab
    • yeah ok, if you say what is fuctional 100% i can't say something different 😛  but if someone find hard to compile it or get vs and all that things i have here one more simple way here to put overlay in your own server or to change your window name with few money.
    • I've been using this for 2 years now with no issues from Discord. I don't use ogg.dll either. This one works with any l2.exe too; I don’t see any difference between them.
    • hmm.. ok i just see that, is different code first of all. My sources is totally different based in other way, with else libraries.  I have access to modify everything even to make the clock to stop show how many time users play in server. 1) so maybe keep some personal info more hide. 2) i dont use ogg.dll 3) i create it and give it ready + support to install it. Plus what is mine can working with what ever .exe you want not just l2 with same simple method. And i am sure if you try this source to compile it, after 3 hours discord will like shadowban your API too thats my source
  • Topics

×
×
  • Create New...