Function not Checking?! - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Function not Checking?! (/Thread-Function-not-Checking) |
Function not Checking?! - Chukwuemeka - 11-11-2016 03:30 AM Hey folks, I'm editing a level system script and I'm getting a problem. Code: [FUNCTION f_levelup] When I use it with a player, it checks the TAG and works great. Code: ON=@DEATHCORPSE Now, I want to make summons and pets give the player EXP. It says I got the right EXP, but I always level up. Code: IF (<REF1.FLAGS> & statf_pet) && (<REF1.ISNPC>) && (<i.ISNPC>) It seems to be missing this check (<TAG0.EXP> >= <TAG0.LEVELUP>). Where am I going wrong? Thank you! RE: Function not Checking?! - darksun84 - 11-11-2016 09:31 PM Probably it's caused by the TRY command, when you use an operator like += Sphere does this: x += y x = <eval (x+y)> So that TRY line becomes: TRY UID.<REF1.MEMORYFINDTYPE.memory_ipet.LINK>.tag0.exp += <EVAL <LOCAL.EXP_GAIN>> TRY UID.<REF1.MEMORYFINDTYPE.memory_ipet.LINK>.tag0.exp = <eval (<TRY <UID.<REF1.MEMORYFINDTYPE.memory_ipet.LINK>.tag0.exp> + <EVAL <LOCAL.EXP_GAIN>>) Anyway, according to the Wiki the TRY is obsolete since 2006, so you can safely remove it. RE: Function not Checking?! - ShiryuX - 11-12-2016 03:12 AM Maybe you have to go basic at the start of the script. Code: ON=@DeathCorpse if your npcs gain level also, just put an "else" after setting the pet link as ref1. RE: Function not Checking?! - Chukwuemeka - 11-13-2016 09:27 PM Thanks a lot! TRY was indeed the problem. |