All pastes #583902 Raw Edit

darkwolf

public text v1 · immutable
·published 2007-06-22 15:16 UTC
rendered paste body
# werewolf Ai.        #
# Written by Darkwolf #
# # # # # # # # # # # #
import sys
from net.sf.l2j.util import Rnd
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
from net.sf.l2j.gameserver.serverpackets import SocialAction

# Monster: werewolf
class werewolf(JQuest) :

    # init function.  Add in here variables that you'd like to be inherited by subclasses (if any)
    def __init__(self,id,name,descr):
        self.werewolf = 20132
        self.FirstAttacked = False
        # finally, don't forget to call the parent constructor to prepare the event triggering
        # mechanisms etc.
        JQuest.__init__(self,id,name,descr)

    def onAttack (self,npc,player):
        objectId = npc.getObjectId()
        if self.FirstAttacked:
           if Rnd.get(100) : return
        npc.broadcastPacket(SocialAction(objectId,1))
        return

# now call the constructor (starts up the ai)
QUEST		= werewolf(-1,"werewolf","ai")

QUEST.addKillId(QUEST.werewolf)
QUEST.addAttackId(QUEST.werewolf)

print "AI: individuals: werewolf...loaded!"