![]() |
Exp System - Doesn't work from 0.56b to 0.56d - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Exp System - Doesn't work from 0.56b to 0.56d (/Thread-Exp-System-Doesn-t-work-from-0-56b-to-0-56d) Pages: 1 2 |
Exp System - Doesn't work from 0.56b to 0.56d - Claus - 09-08-2019 10:08 PM Hello everyone, i'm here for a "porting" problem between sphere 0.56b and 0.56d I have this exp system Quote:[DEFNAME levelSystem] and i apply to the every single NPC these parameters TAG0.EXP = 5000 (the exp point i prefer for the kind of monster) TEVENTS=e_exp_gain and ON=@deathcorpse local.exp_gain = <calcNewExp <TAG0.EXP>,<ref1.tag.LevelUp>> [FUNCTION calcNewExp] if <argn2> < 5 argn1 -= 125 return <argn1> endif if <argn2> < 8 argn1 -= 150 return <argn1> endif here a example with skeleton Quote:[CHARDEF 0900] This script work very well on 0.56b but in 0.56d i have some problem with the e_exp_gain event. When i kill a monster, the event don't start. Can some1 help me? [excuse me for grammatical mistake, i don't speak eng very well] RE: Exp System - Doesn't work from 0.56b to 0.56d - Coruja - 09-09-2019 01:18 PM What trigger is not being called? The @DeathCorpse on NPC c_m_skeletonarcher or the @DeathCorpse on event e_exp_gain? --------------------- PS: note that REF1 is missing here Code: ON=@deathcorpse Code: ON=@deathcorpse RE: Exp System - Doesn't work from 0.56b to 0.56d - Claus - 09-09-2019 11:42 PM (09-09-2019 01:18 PM)Coruja Wrote: What trigger is not being called? The @DeathCorpse on NPC c_m_skeletonarcher or the @DeathCorpse on event e_exp_gain? still not working, and console not gives error. With 0.56B there isn't problem, and the script works very well, but not on 0.56d. I think i will return to 0.56b for now. thank you RE: Exp System - Doesn't work from 0.56b to 0.56d - darksun84 - 09-10-2019 03:08 AM You probably have not enabled the experience system in the 56d .ini ![]() RE: Exp System - Doesn't work from 0.56b to 0.56d - Claus - 09-11-2019 12:14 AM (09-10-2019 03:08 AM)darksun84 Wrote: You probably have not enabled the experience system in the 56d .ini vero, ma anche nel 56b non l'ho attivato e li il sistema funziona. Probabilmente il 56D invece ne ha bisogno. mo provo eng: true, but also in my 56b ini the system is not activated, but the script works. Maybe in 56D this is a necessary condition. Also if i try to run this script i have this error in console: ERROR:(sphere_exp_system.scp,9)Undefined symbol '' and the simbol is &&. How can i change it? Maybe the problem is here, but i don't know how can i change this operator. RE: Exp System - Doesn't work from 0.56b to 0.56d - Coruja - 09-11-2019 10:39 AM The best way to find any error on any code is debugging it. You just need to insert a random message/log on the code to check if the line is being reached, check if an trigger/function is being called, check an tag value, formula result, etc So to check if the trigger @DeathCorpse is being called you just need to do something like this Code: ON=@DeathCorpse The same can be used to check what is this "undefined symbol" on line 9. Symbol is not only characters like &&, but everything that can make sphere read the line incorrectly Eg: if you write "IF (<something> > 5)" where <something> is a null value, sphere will read this line as "IF ( > 5)" and will throw "undefined symbol" error because it doesn't know what means <something> Since this line 9 only use REF1 and DEF.LevelCap, probably this should be an empty REF1 or empty DEF.LevelCap. Again, to check what's wrong you just need to debug it Code: ON=@DeathCorpse RE: Exp System - Doesn't work from 0.56b to 0.56d - Claus - 09-11-2019 08:45 PM ok the @deathcorpse trigger is called both script (monster and exp system) 12:30:(sphere_exp_system.scp,8)trigger @deathcorpse called 12:30:(sphere_monsters.scp,56)trigger @deathcorpse called for the string Quote:SERV.LOG the REF1 value is "<REF1>" (<REF1.NAME>) and DEF.LevelCap value is "<DEF.LevelCap>"if i put it in this way Quote:ON=@DEATHCORPSE i have this Quote:ERROR:(sphere_exp_system.scp,9)Undefined symbol '' Also i tried to change the simbols && with AND and i have this message Quote:the REF1 value is "0" (0) and DEF.LevelCap value is "" Also, i tried to set "Ref1 == <argo.more2>" to see what error console gives to me and there is Quote:ERROR:(sphere_exp_system.scp,9)Undefined symbol '' ['= 0ffffffff'] The value 0ff... is the same that i can find in the killed monster at the voice more2, so the killer uid (me) is stored in a certain way. RE: Exp System - Doesn't work from 0.56b to 0.56d - Coruja - 09-12-2019 05:06 AM I guess you found the problem. After debug the code you got this Code: the REF1 value is "0" (0) and DEF.LevelCap value is "" So REF1 doesn't exist and DEF.LevelCap is a null value, and this will make sphere read this next line Code: IF (<Ref1.ISPLAYER>) && (<Ref1.tag0.levelUp> < <def.levelCap>) Code: IF () && ( < ) Anyway, the trigger @DeathCorpse is called after the char is already dead and with the corpse on ground. Since your script don't need the corpse, you can replace @DeathCorpse with @Death, which is called ~before~ the char die, and this will probably make the code set the REF1 value correctly Code: [EVENTS e_exp_gain] Also don't forget that sphere already have an native EXP/LEVEL system which works without any script required, and you can enable and customize it just changing some few settings on sphere.ini. Since your script is really simple, maybe it's better just use the sphere EXP/LEVEL system instead RE: Exp System - Doesn't work from 0.56b to 0.56d - Claus - 09-12-2019 08:27 AM (09-12-2019 05:06 AM)Coruja Wrote: Also don't forget that sphere already have an native EXP/LEVEL system which works without any script required, and you can enable and customize it just changing some few settings on sphere.ini. Since your script is really simple, maybe it's better just use the sphere EXP/LEVEL system instead I think I'll use it if I want to continue on 0.56d, but I didn't understand how to "use it". I explain, activating the system from sphere.ini is very easy, but once in play how does it "spin"? In other words, how is the monster experience assigned? How do players know how much exp they have and what level they are? But above all how do I set that at levelup it gives, for example, 5 strenght? I tried to find a guide but I couldn't find it In any case, thanks for the support RE: Exp System - Doesn't work from 0.56b to 0.56d - Coruja - 09-12-2019 12:05 PM The internal engine just have the basics, like internal <EXP> and <LEVEL> properties and some basic actions like raise EXP when kill monsters, gain messages, etc. But you can customize almost everything using scripts 1st step is set the EXP/LEVEL settings on sphere.ini Next you must add EXP on all NPCs based on their status Code: [EVENTS e_exp_npcs] // don't forget to set e_exp_npcs on EventsPet (sphere.ini) to add this event automatically on all NPCs To do custom actions on exp/level gain you just need to do the same thing using @ExpChange / @ExpLevelChange triggers Code: [EVENTS e_exp_players] // don't forget to set e_exp_players on EventsPlayers (sphere.ini) to add this event automatically on all players To view your current EXP/LEVEL you just need to use <EXP> or <LEVEL> on any dialog or create an simple function to show it as message Code: [PLEVEL 1] And to customize default messages you just need to edit these messages on sphere_msgs.scp, or use the event above to disable these default messages and show your own custom message |