A Project for Chronicle 4 based on L2JServer.


    Few AI temp fixes

    Share
    avatar
    Karakan

    Posts : 428
    Join date : 2013-10-04

    Few AI temp fixes

    Post  Karakan on 3rd May 2014, 17:07

    This isnt retail like AI.
    But at least better then nothing.

    This adds second spawns to few monsters (after they die).

    2nd Blade of Splendor should be spawned "onAttack", but havent got time to finish that.
    also...all these polymorps must have a random chance. (atm its 100% after each kill)



    data/script/ai/group_template/polymorphing_mob.py


    Code:
    import sys
    from net.sf.l2j.gameserver.ai import CtrlIntention
    from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

    # mobs spawns...when one of the mob in the keys dies, the other mob will spawn.

    class polymorphing_mob(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.MobSpawns ={
                    1020:1021, #Fallen Orc Shaman -> Sharp Talon Tiger
                    1521:1522, #Claws of Splendor -> Claws of Splendor Panther
                    1524:1525, #Blade of Splendor -> Blade of Splendor 2nd
                    1527:1528, #Anger of Splendor -> Anger of Splendor Panther
                    1533:1534, #Alliance of Splendor -> Alliance of Splendor Panther
                    1537:1538 #Fang of Splendor -> Fang of Splendor Panther
                    }
            # finally, don't forget to call the parent constructor to prepare the event triggering
            # mechanisms etc.
            JQuest.__init__(self,id,name,descr)

        def onKill (self,npc,player,isPet):
            npcId = npc.getNpcId()
            if self.MobSpawns.has_key(npcId) :
                newNpc = self.addSpawn(self.MobSpawns[npcId],npc)
                killer = player
                if isPet :
                    killer = player.getPet()
                newNpc.setRunning()
                newNpc.addDamageHate(killer,0,99999)
                newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, killer)
            return

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

    for i in QUEST.MobSpawns.keys() :
        QUEST.addKillId(i)





    data/script/ai/group_template/__init__.py


    Code:
    __all__ = [
    'polymorphing_angel',
    'polymorphing_mob',
    'feedable_beasts',
    'chests',
    'fairy_trees'
    ]

    for name in __all__ :
        try :
            __import__(name,globals(), locals(), [], -1)
        except :
            print "Failed to import ai : ",name
    avatar
    DnR
    Admin
    Admin

    Posts : 1027
    Join date : 2012-12-03

    Re: Few AI temp fixes

    Post  DnR on 7th May 2014, 14:24

    Good one. I'm going to include it to next revision.
    I'm also going to do some corrections to get rid of the error that makes quests not work until restart.
    Part 1 will contain 1st occupation quests and few more.

    Thanks for sharing. Smile
    avatar
    Karakan

    Posts : 428
    Join date : 2013-10-04

    Re: Few AI temp fixes

    Post  Karakan on 7th May 2014, 21:22

    I'm also going to do some corrections to get rid of the error that makes quests not work until restart.

    Does this also effects 2nd class quests ?
    That would be a relief.


    Anyways keep up the good work !! Smile
    avatar
    DnR
    Admin
    Admin

    Posts : 1027
    Join date : 2012-12-03

    Re: Few AI temp fixes

    Post  DnR on 8th May 2014, 07:29

    Karakan wrote:
    I'm also going to do some corrections to get rid of the error that makes quests not work until restart.

    Does this also effects 2nd class quests ?
    That would be a relief.


    Anyways keep up the good work !! Smile
    I' ll focus on them at the weekend. It's changes in the script for each quest, but I won't let 2nd class uneffected.
    avatar
    DnR
    Admin
    Admin

    Posts : 1027
    Join date : 2012-12-03

    Re: Few AI temp fixes

    Post  DnR on 8th May 2014, 21:56

    Done for 2nd class quests, as well.

    The main goal of this cleaning-fixing update is to get rid of this error.

    Code:

    TypeError: int() argument must be a string or a number

      at org.python.core.Py.TypeError(Unknown Source)
      at org.python.core.PyInteger.asPyInteger(Unknown Source)
      at org.python.core.PyInteger.int_new(Unknown Source)
      at org.python.core.PyInteger$1.new_impl(Unknown Source)
      at org.python.core.PyType.invoke_new_(Unknown Source)
      at org.python.core.PyType.type___call__(Unknown Source)
      at org.python.core.PyType.__call__(Unknown Source)
      at org.python.core.PyObject.__call__(Unknown Source)

    I' ll update ALL quests little by little.
    Feel free to report if any error occurs.

    Sponsored content

    Re: Few AI temp fixes

    Post  Sponsored content


      Current date/time is 18th November 2017, 19:27