Advertisement
cressidagp

Supervisor Raelen

Feb 25th, 2024 (edited)
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.14 KB | None | 0 0
  1. '''
  2.  
  3. Engine: APE
  4. Zone: EF
  5. Creature: Supervisor Raelen
  6. .npc portto 53868
  7.  
  8. '''
  9.  
  10. import arcemu
  11. import ArcPyMath as Math
  12. #from arcemu import ObjectLocator
  13. from arcemu import CreatureScript
  14.  
  15.  
  16. RAELEN_TEXTS = [
  17. "We have yet to meet our quota for the wood demand. Now back to work with you.",
  18. "Daylight is still upon us so let's see that axe of yours chopping some more wood.",
  19. "We need to get this wagon filled by the end of the day. So back to work with you. Chop, chop!"
  20. ]
  21.  
  22. RAELEN_EMOTES = [ 25, 1, 5 ]
  23.  
  24. NPC_ID_SUPERVISOR_RAELEN = 10616
  25. NPC_ID_EASTVALE_PEASANT = 11328
  26.  
  27. class SupervisorRaelenCreatureScript( CreatureScript ):
  28.  
  29.      isEnabled = True
  30.      timerToEnable = 20
  31.  
  32.      def __init__( self, unit ):
  33.           CreatureScript.__init__( self, unit )
  34.  
  35.      def OnLoad( self ):
  36.           npc = self.creature
  37.           npc.RegisterAIUpdateEvent( 1000 )
  38.           self.isEnabled = True
  39.  
  40.      def AIUpdate( self ):
  41.          
  42.           if self.isEnabled == False:
  43.                self.timerToEnable = self.timerToEnable - 1
  44.                if self.timerToEnable <= 0:
  45.                     self.isEnabled = True
  46.                return
  47.          
  48.           npc = self.creature
  49.           objects = npc.getObjectsInRange()
  50.           for o in objects:
  51.                c = arcemu.toCreature( o )
  52.                if c is not None:
  53.                     entry = c.getUInt32Value( arcemu.OBJECT_FIELD_ENTRY )
  54.                     if entry == NPC_ID_EASTVALE_PEASANT:
  55.                          distance = npc.calcDistance( c )
  56.                          if distance < 4:
  57.                               i = Math.randomUInt( 2 )
  58.                               npc.sendChatMessage( arcemu.CHAT_MSG_MONSTER_SAY, arcemu.LANG_COMMON, RAELEN_TEXTS[ Math.randomUInt( i ) ] )
  59.                               npc.emote( RAELEN_EMOTES[ Math.randomUInt( i ) ], 0 )
  60.                               self.isEnabled = False
  61.                               self.timerToEnable = 20
  62.  
  63.      @staticmethod
  64.      def create( unit ):
  65.           return SupervisorRaelenCreatureScript( unit )
  66.  
  67. arcemu.RegisterCreatureScript( NPC_ID_SUPERVISOR_RAELEN, SupervisorRaelenCreatureScript.create )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement