Jump to content
  • 0

Request Squash Event [L2Jfrozen]


Question

Posted

hello people were looking for a l2jfrozen squash.py working event since the last revision of this l2jfrozen bugged, the problem that I have in my script is that the seeds do not grow to feed them, when use nectar the console say: Attribute Error getLifeTime()

 

here is my script:

import sys

from com.l2jfrozen.gameserver.ai import CtrlIntention
from com.l2jfrozen.gameserver.idfactory import IdFactory
from com.l2jfrozen.gameserver.datatables.sql import NpcTable
from com.l2jfrozen.gameserver.model.actor.instance import L2GourdInstance
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jfrozen.gameserver.network.serverpackets import CreatureSay
from com.l2jfrozen.gameserver.network.serverpackets import SocialAction
from com.l2jfrozen.util.random import Rnd

POLLEN = 6391
SKILL_NECTAR = 9998

class squash (JQuest):

 # Init function. Add in here variables that you'd like to be inherited by subclasses (if any)
 def __init__ (self, id, name, descr):
     JQuest.__init__ (self, id, name, descr)
     # Pour
     self.wateredSquash = [12774,12775,12776,12777,12778,12779]
     # Raised
     self.adultSmallSquash = [12775,12776]
     self.adultLargeSquash = [12778,12779]

     self.nectar = 0

     for i in self.wateredSquash:
         self.addSkillUseId (i)
         self.addAttackId (i)
         self.addKillId (i)
         
 def onAdvEvent (self, event, npc, player):
    objId = npc.getObjectId ()
    if event == "Good By" and npc and player:
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "Good By!! LOL."))
       npc.onDecay ()
       self.nectar = 0
    elif event == "Good By1" and npc and player:
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "Everybody, goodbye ... Big Pumpkin said good-bye ..."))
       npc.onDecay ()
       self.nectar = 0
    elif event == "Good By2" and npc and player:
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "you do not need? After 30 seconds, I run away ..."))
    elif event == "Good By3" and npc and player:
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "I interrupt with you in 20 seconds!"))
    elif event == "Good By4" and npc and player:
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "Hurry up, I was left with just 10 seconds! 9. 8. 7 .."))
    elif event == "Good By5" and npc and player:
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "Hey, Good luck! Idiot, forget about me!"))

 def onSkillUse (self, npc, player, skill):
    npcId = npc.getNpcId ()
    skillId = skill.getId ()
    if skillId != SKILL_NECTAR: return
    if npcId not in self.wateredSquash: return
    objectId = npc.getObjectId ()
    if skillId == SKILL_NECTAR:
# The first watering
       if self.nectar == 0:
          if npc.getLifeTime () == 1000: # bad
             mytext = ["Do not hurry! Too often, I do not have time!"
                       "I'm not a machine, I did not rate of napoish"]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
          elif npc.getLifeTime () == 2000: # bad
             mytext = ["Do not hurry as you are! Too often, I do not have time!"
                       "Ooopyat, twenty-five, I told you - not part of the"]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
          elif npc.getLifeTime () == 3000: # bad
             mytext = ["Yes, where are you hurry! Too often, I do not have time!"
                       "Oops, again too soon"]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
          elif npc.getLifeTime () == 4000: # bad
             mytext = ["Come a bit more slowly, slowly, slowly take out a bottle and pour it slowly!"
                       "Have you no sense of speed? Slower come"]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
          elif npc.getLifeTime () == 5000: # good
             mytext = ["fruit of a beautiful young pumpkin starts to shine when the seed is buried! Since that time will be able to become healthy and strong!"
                       "Oh, have not seen?"
"Suddenly to see my beautiful appearance?"
"Well, this is - something! Nectar?"
"Refueling! Season 5 bottles so I could turn into a big pumpkin! Oh!"]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
          else:
             npc.setLifeTime (5000) # bad
             mytext = ["To be able to grow, I should only drink nectar and more ..."
"If you will soon pour nectar to me - I grow up faster!"
"Well, believe me, sprinkles the nectar, I can certainly turn into a big pumpkin!"
"Bring the nectar to grow a pumpkin!"]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
# The second irrigation
       elif self.nectar == 1:
          if npc.getLifeTime () == 10000: # good
             mytext = ["I wish to become a big pumpkin!"
                       "Yum, yum, yum! It turned out! Cares - good!"
"How dumaesh I mature, or rotten?"
"Nectar - only the best! Ha! Ha! Ha!"]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
          else:
             npc.setLifeTime (10000) # bad
             mytext = ["Oh, by again! Maybe too fast raskhoduesh nectar?"
                       "If I die like now, you only get a young pumpkin ..."
"Grow a little faster! A good idea to become a big pumpkin, a young pumpkin is not good!"
"This little pumpkin you all need to eat? Bring nectar, I can be more!"]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
# The third irrigation
       elif self.nectar == 2:
          if npc.getLifeTime () == 15000: # good
             if npcId == 12774:
                newGourd = self.addSpawn (12775, npc)
                self.startQuestTimer ("Good By1", 120,000, newGourd, player) # # After 2 minutes, the disappearance of
                self.startQuestTimer ("Good By2", 90000, newGourd, player) # 30 seconds to extinction
                self.startQuestTimer ("Good By3", 100,000, newGourd, player) # 20 seconds to extinction
                self.startQuestTimer ("Good By4", 110,000, newGourd, player) # 10 seconds to extinction
                mytext = ["Young pumpkin zhazhdyaschaya! As already grown?"
                           "I'll run in 2 minutes"
                          "A couple of times and I'll be ready ..."]
                npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
                npc.onDecay ()
                self.nectar = self.nectar + 1
             else:
                newGourd = self.addSpawn (12778, npc)
                self.startQuestTimer ("Good By1", 120,000, newGourd, player) # After 2 minutes, the disappearance of
                self.startQuestTimer ("Good By2", 90000, newGourd, player) # 30 seconds to extinction
                self.startQuestTimer ("Good By3", 100,000, newGourd, player) # 20 seconds to extinction
                self.startQuestTimer ("Good By4", 110,000, newGourd, player) # 10 seconds to extinction
                mytext = ["Mercy is a very good feature. Now look, I feel increasingly good,"
                          "I'll run in 2 minutes"]
                npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
                npc.onDecay ()
                self.nectar = self.nectar + 1
          else: # failed
             npc.setLifeTime (15000)
             if npcId == 12774:
                 newGourd = self.addSpawn (12776, npc)
                 mytext = ["Hey, was - was not! Done Now! You can not properly care? so I rot!"
                       "Wow, stop? Why thank you,"
"I thirst for the nectar ..."
"You want a great pumpkin? But I want to stay a little pumpkin ..."]
                 npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
                 npc.onDecay ()
                 self.nectar = self.nectar + 1
             if npcId == 12777:
                 newGourd = self.addSpawn (12779, npc)
                 mytext = ["Hey, was - was not! Done Now! You can not properly care? I rot!"
                       "Wow, stop? Why thank you,"
"I thirst for the nectar ..."
"You want a great pumpkin? But I want to stay a little pumpkin ..."]
                 npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
                 npc.onDecay ()
                 self.nectar = self.nectar + 1
# The fourth irrigation
       elif self.nectar == 3:
          if npc.getLifeTime () == 20000: # good
             mytext = ["Great Pumpkin, starved! Requests to quench your thirst!"
                       "Well, finally ... it's really tasty! There yet?"
"Take care of me just to eat? Well, is your chance ... to prevent suicide manna"]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
          else:
             npc.setLifeTime (20000) # bad
             mytext = ["Do not water if you add? What flavor?"
                       "Master, save me ... I do not have the flavor of the nectar, I shall die ..."]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
# Fifth watering
       elif self.nectar == 4:
          if npc.getLifeTime () == 25000: # good
             mytext = ["Very well, doing extremely well! You know what the next step should be done?"
                       "If you catch me, I give you 10 million adena!!! Do you agree?"]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = 5
          else:
             npc.setLifeTime (25000) # bad
             mytext = ["I'm hungry, you want me to dried?"
                       "I demand the nectar to grow a little faster."]
             npc.broadcastPacket (CreatureSay (objectId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))
             self.nectar = self.nectar + 1
       return

# Unfortunately onAttack () gets the focus only if
# Damage> 0, but it is necessary that worked and damage == 0
# Otherwise the sentence will appear only in the case of a Chrono weapon

 def onAttack (self, npc, player, damage, isPet):
    npcId = npc.getNpcId ()
    objId = npc.getObjectId ()
    if npcId not in self.wateredSquash: return
    if npcId in self.adultLargeSquash:
       if Rnd.get (30) <2: # TODO: need to pick up the frequency of cries
          mytext = ["rat bites tat ... to replace ... the body ...!"
                   "Ha ha, grew! Fully at all!"
                   "You can not aim at all chtoli? See everything not to run away ..."
                   "I feel your blows Oh, like a blow again!"
                   "Do not waste your time!"
                   "Ha, that sounds really good to hear?"
                   "I consume your attacks to grow up!"
                   "The time to strike again! Hit it again!"
                   "Only the music can be useful to open a large pumpkin ... I can not open arms!"]
          npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), mytext [Rnd.get (len (mytext))]))

    return
   
 def onKill (self, npc, player, isPet):
    npcId = npc.getNpcId ()
    objId = npc.getObjectId ()
    if npcId not in self.wateredSquash: return
    if npcId in self.adultSmallSquash:
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "Pumpkin opened!"))
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "eeee! Opens! A lot of good things ..."))
       self.nectar = 0
    elif npcId in self.adultLargeSquash:
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "Pumpkin opened!"))
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "eeee! Opens! A lot of good things ..."))
       self.nectar = 0
    else:
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "For what, boss?"))
       npc.broadcastPacket (CreatureSay (objId, 0, npc.getName (), "Oh, spilled guts!"))
       self.nectar = 0
    return

QUEST = squash (-1, "group_template", "ai")

if anyone knows I would appreciate any solution,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...