Legacy Development Community Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Legacy Development Community Forum

World of Warcraft Development Forums
 
HomeHome  PortalPortal  GalleryGallery  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  

 

 Default Creature actions

Go down 
AuthorMessage
Devincean

Devincean


Number of posts : 39
Registration date : 2006-11-28

Default Creature actions Empty
PostSubject: Default Creature actions   Default Creature actions EmptySun Apr 22, 2007 10:08 pm

Ok been kinda dabeling with this and wanted to see if anyone had any imput here is the default.py been using for all AI types basicly ya can turn on and off what ya want its based off a the old ogrimar guard scripts. Allowing yout to set a mob to flee or cry for help or both and kinda gives them alittle better agro

Code:
#
# AI Behavior Module
#
# To disable some handler, comment it out or rename, so loader doesn't find it by name
#
# Rewritten by Devincean on 19-04-2007
#
from Ludmilla import *
import consts as co
reload(co)
from random import *

#------------------------------------------------------------------------------
def OnEnemyDetected (self, attacker):
    """ Function is called when NPC 'self' notifies (aggroes) player 'attacker'
        right before the moment when Hate is added.
        Param: (Unit attacker, Unit attacker)
    """
    pass
   
#------------------------------------------------------------------------------
#attack_emotes = [EMOTE_ONESHOT_RUDE, EMOTE_ONESHOT_ROAR, EMOTE_ONESHOT_POINT]
#attack_messages = ["The Brotherhood will not tolerate your actions!",  "Ah, chance to test

this freshly sharpened blade!"]
def OnAttacked (self, attacker):
    """ Param: (Unit npc, Unit npc2)
        Function is called when npc is attacked by npc2, just before attack
        reaction game function called. If OnAttacked returns 0 or None, then
        normal reaction for current aiclass is called (attack back or flee).
    """
#------------------------------------------------------------------------------
#runaway_messages = ["Sorry, I got to go!", "Whoops, its dinner time!",
#    "See you later!", "Got to go!", "Have a nice day!"]


def OnTakeDamage (self, attacker):
    """ Function is called when NPC 'self' takes damage in combat from npc or
        player 'attacker'
        Param: (Unit attacker, Unit attacker)
    """
    if 100.0 * self.GetHealth() / self.GetMaxHealth() <= 20:
        if randrange (100) < 10:
            self.Say (attacker, choice (runaway_messages), co.LANG_UNIVERSAL, co.MONSTER_SAY)
        self.Emote is good to

        # Trigger 10 second flee mode when creature ignores damage with 15
        # meters help radius. If no help found, return back and attack.
        #
        self.Flee (attacker, 10, 15)


#--- END ---

However the problem I run into is how to implement it on a family type rather then on each creature by its ID.

Any know is it possible to write a in the startup.ai.py a script that will allow a Family type for instance family "7" being all beasts so any creature with the family number 7 would have the default script ai.type.beast.default.py applied.
Back to top Go down
 
Default Creature actions
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Legacy Development Community Forum :: Kobold Legacy-
Jump to: