SphereCommunity
Pet level system - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Pet level system (/Thread-Pet-level-system--4172)



Pet level system - Van Glan Bloom - 05-10-2015 12:04 PM

Good night people. I have a small problem in a script.

This is a script to evolve pets. All animals are born with a event e_no_pet_level_system, they can not be trained. But through an item we can start the animal training. With the script he would withdraw the already existing event in the animal and add a new one.

Code:
ON=@TARGON_CHAR
if (<src.targ.distance> > 3)
        src.sysmessage @09c1 You are unable to reach the creature.
            return 1
elseif (<src.targ.body>==c_man) || (<src.targ.body>==c_woman) || (<src.targ.npc>==0)
        src.sysmessage @09c1 You can not training another human!
            return 1
elseif ( <src.targ.flags> & statf_conjured )
        src.sysmessage @09c1 You can not training summoned animals!
            return 1
elseif (!<src.targ.ismypet>)
        src.sysmessage @09c1 The animal must be loyal to you!
            return 1
elseif (<src.targ.events>==e_pet_level_system)
        src.sysmessage @09c1 The training is already in progress.
            return 1
else
    src.targ.events=-e_no_pet_level_system
        src.targ.tag.level=0
            src.targ.tag.experience=0
                src.targ.events=+e_pet_level_system
            src.consume 1 i_pet_level_system
        src.sysmessage @09c1 Now you can training your pet.
    endif
return 1

The problem appears when time add the event to the animal the script always blocks on the same line. Says when the animal is already being training


RE: Pet level system - XuN - 05-10-2015 07:07 PM

elseif (<src.targ.isevent.e_pet_level_system>)


RE: Pet level system - Van Glan Bloom - 05-11-2015 10:22 AM

Thx XuN the bug is fixed =)