loki1991 Posted June 15, 2012 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 22 Reputation: 13 Joined: 01/07/12 Last Seen: August 9, 2014 Share Posted June 15, 2012 (edited) Loki's Achievement System with no source edit This system contains many possible kinds of achievements, getting achievement points, announcing your achievement and displaying a cutin. And all that without any source edit. Only with trigger and a cache sytem, that your sql server won't be spamed with querys! I was really frustrated that most of the source edit versions haven't worked on my server. I hope you will enjoy it I will explain it's functions below. Downloads: lokis_achivement_system_1.0.1.zip loki_achivement_demodata_1.0.zip Supported Achievements: Mode 0 = Your custom achievements, see point Custom Achivemetns below. Mode 1 = Items in your inventar. It will be checked after every login and after every time when you are killing a mob. 9 different items at once are possible. Mode 2 = Kill Mobs. Will be checked after every mob kill. 9 different mobs at once are possible. Mode 3 = Mvp kills. Will be checked after every mob kill. Only 1 value is possible (ex. Kill 15 MvPs, Kill 30 Mvps. This mode is not like Kill 10 Phreeonis, for this use Mode 2!) Mode 4 = Pvp Kills. Will be checked after every pvp kill. Only 1 value is possible (ex. Kill 1 other Player, Kill 666 other Player etc.) Mode 5 = Reach Baselevel X. Will be checked on every BaseLevel up (@commands won't effect this trigger!). Only 1 value is possible Mode 6 = Reach Joblevel X. Will be checked on every JobLevel up (@commands won't effect this trigger!). Only 1 value is possible Creating a Achievement: All achievements are in your SQL database, so we just need to insert something in the table "achievement". name = name of your achievement desc = Your description for the achievement and will only be used by Bob (see below). Can be used for your website etc. mode = Your mode (see category above this one) deleted = should ever be "n"! Due to the cache system, you should never delete a Entry by "DELETE FROM achievement WHERE id=X". NEVER! Just set deleted="y" cutin = your cutin image. If you leave this NULL or empty, no cutin will be displayed. points = how many points do the user get for this achievement? singleval = will be used for mode 3,4,5,6. It would confuse everybody, if I would save the data in val1 or anywhere else. val1 - val9 = Will be used for Mode 1 and 2. Here you will write the itemID or the monsterID. val1amount - val9amount = The amount, the user have of itemID in his inventar or how many monster the user have to kill. If you want that the player have to kill 10 porings and 20 drops, you would save the follow: val1: 1002 val1amount: 10 val2: 1113 val2amount: 20 Every received achievement will be saved in the table achievement_log. Due to that here are no @commands, the table achievement_force is made to force player to get a achievement or to reset/remove a achievement. You don't have to create any insert. Just talk to Bob (see below). Configurate your achievement system: There isn't much to configure set $a_cache_expire,120; set $a_effect_id,908; set $a_cutin_delay,8000; $a_cache_expire = in how many seconds the global cache will be expire? $a_effect_id = which effect will be displayed on the user when he received an achivement (@effect 908) $a_cutin_delay = for how many milliseconds the cutin should be displayed in the bottom of your screen? Create a custom Achievement (mode 0): You can call the achievement you want to give in any of your scripts with just writing: callfunc "achieve",<<achievementId>>; Here is an example, which I placed in my custom instance. If the user is joining there the first time, he would get the achievement 18! warp "hellfire",264,129; if(a_done_18 != 1 && $a_del_18$ == "n") { sleep2 5000; callfunc "achieve",18; } a_done_X = have user already got the achievement? 1=yes, 0=no $a_del_X$ = is achievement active and not deleted? y=yes, n=no. This both flags should be placed everywhere where you use this function. sleep2 5000; is just for skipping the delay of warping to the map. Just ignore this If you want to use custom script with trigger, you can build them like that. This script checks if your zeny is higher than the "singel_val" value in the database ($a_sval_17). You could also just write if(Zeny >= 1000000) callfunc "achieve",17; - script ach_17 -1,{ OnPCLoginEvent: OnNPCKillEvent: if(a_done_17 == 1 || $a_del_17$ == "y") end; if(Zeny >= $a_sval_17) callfunc "achieve",17; end; } This script can be found in the demodata pack with 16 other achievement If you want to make an item_use Achievement, just place the important line above in the item script. Achievement Bob (including in lokis_achievement_system_X.X): This script is made for GM's and Player. The player can get information about all achievements, which they have or have to get and how many achievement points they have. The GM Menu have many more functions: Force Player Achievement This function will save entries into the table achievement_force. It can be used to give a player an achievement or to reset an achievement. The user just have to talk to Bob after you clicked through the form. There isn't any validation. So be careful, that the user won't get a achievement 2 or more times. Enable/Disable Achievements This function just set the deleted=y or deleted=n flag. If you change something, you should clear the cache (or wait until it expires). Clear cache Set Flag to clear cache. It will be renewed when a player is login into your server. Compare log with achievement points Compares the achievement_log table with the score of achievements of the player. If there is a difference, the real value will be saved. WARNING: If you have something like a cashshop with this points, this function will destroy your database :/ Points should only be used in viewing only or for a ranking. Else you should change the core of this function. Error Handing: Due to a lot of trigger events, your server may cause some phantom errors like "players event queue is full". To fix this, just edit the src/map/map.h and increase the #define MAX_EVENTQUEUE 2 value to 20. I hope this guide helped you in this complex system Have fun with it Loki1991 lokis_achivement_system_1.0.zip Edited August 1, 2012 by loki1991 6 Quote Link to comment Share on other sites More sharing options...
HD Scripts Posted June 15, 2012 Group: Members Topic Count: 23 Topics Per Day: 0.00 Content Count: 184 Reputation: 15 Joined: 06/10/12 Last Seen: Sunday at 07:41 PM Share Posted June 15, 2012 uoool! very good Quote Link to comment Share on other sites More sharing options...
Euphy Posted June 15, 2012 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted June 15, 2012 A few notes: As of r15979, "callfunc" is no longer needed. Users can call your function by only typing "achieve <ID>". You should consider using bitwise integers (or even a conversion string) to store the permanent character values, because the script would eat up a significant portion of the 256 maximum otherwise. Similarly, try to reduce permanent global variables, if you can. There's also a limit to those. If you can push values into arrays or use temporary values, it'd help a lot. Also, moving this thread into "Utility Script Releases" for now. 2 Quote Link to comment Share on other sites More sharing options...
Jezu Posted June 16, 2012 Group: Members Topic Count: 29 Topics Per Day: 0.01 Content Count: 566 Reputation: 34 Joined: 11/17/11 Last Seen: January 24 Share Posted June 16, 2012 A few notes: As of r15979, "callfunc" is no longer needed. Users can call your function by only typing "achieve <ID>". You should consider using bitwise integers (or even a conversion string) to store the permanent character values, because the script would eat up a significant portion of the 256 maximum otherwise. Similarly, try to reduce permanent global variables, if you can. There's also a limit to those. If you can push values into arrays or use temporary values, it'd help a lot. Also, moving this thread into "Utility Script Releases" for now. The script is great, it will be better if @Euphy's skill can optimize this script! Quote Link to comment Share on other sites More sharing options...
Elijah23 Posted June 16, 2012 Group: Members Topic Count: 46 Topics Per Day: 0.01 Content Count: 292 Reputation: 17 Joined: 12/12/11 Last Seen: April 4 Share Posted June 16, 2012 This is great.. But I agree to Euphy on minimizing the use of Global variables.. ) Quote Link to comment Share on other sites More sharing options...
gilbertobitt Posted June 20, 2012 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 52 Reputation: 12 Joined: 12/22/11 Last Seen: August 9, 2023 Share Posted June 20, 2012 is possible add a group achivement, like a achivement that player just can get if he are in a group EX: Group MVP Killer [10/3]. and all player of the group can get! Quote Link to comment Share on other sites More sharing options...
nodiby Posted June 24, 2012 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 6 Reputation: 1 Joined: 06/01/12 Last Seen: January 1, 2013 Share Posted June 24, 2012 (edited) Hi, I have a problem, I put the line: "import: npc/custom/myachievments.txt" in the file: scripts_main.conf and the content of Data in my GRF. When I test to unlock the Achievement of 1M zeny I have nothing happens. Did i made a mistake somewhere? (sorry for my bad english) After several researches and tests, it finally works! I am beginner in this domain Edited June 24, 2012 by nodiby Quote Link to comment Share on other sites More sharing options...
loki1991 Posted August 1, 2012 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 22 Reputation: 13 Joined: 01/07/12 Last Seen: August 9, 2014 Author Share Posted August 1, 2012 Version 1.0.1 released. It is not needed to update this script when you haven't got any error in version 1.0! Sometimes if you have an older rathena or eathena system, there was an error by the s_val field. For Example the MvP Hunter Silver Medial. Kill 15 MvPS [2/0] insteed of [2/15]. But now it should work on all systems fine. Greetings, Loki1991 Quote Link to comment Share on other sites More sharing options...
Golem1988 Posted August 24, 2012 Group: Members Topic Count: 57 Topics Per Day: 0.01 Content Count: 162 Reputation: 1 Joined: 08/08/12 Last Seen: December 10, 2023 Share Posted August 24, 2012 Well, it says: Report, So, I do as it says Any support with this thing? And... lol, dunno why, It gives achievements for nothing... for novice just started to play gives MVP gold achieve... maybe I haven't cleaned something... and overall what I see testing it are: too much bugs and system is unsafe... It's a pity that Jonne's system isn't supported anymore... Quote Link to comment Share on other sites More sharing options...
loki1991 Posted September 2, 2012 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 22 Reputation: 13 Joined: 01/07/12 Last Seen: August 9, 2014 Author Share Posted September 2, 2012 Well this bug should be fixed in version 1.0.1. It should be the same bug like above: Kill 15 MvPS [2/0] insteed of [2/15]. Talk to Sam and check the requirements of the achievement. Quote Link to comment Share on other sites More sharing options...
Atomiq Posted September 4, 2012 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 82 Reputation: 2 Joined: 05/13/12 Last Seen: November 17, 2015 Share Posted September 4, 2012 (edited) Edit: thanks so much for the script!! Edited September 6, 2012 by Atomiq Quote Link to comment Share on other sites More sharing options...
Golem1988 Posted September 26, 2012 Group: Members Topic Count: 57 Topics Per Day: 0.01 Content Count: 162 Reputation: 1 Joined: 08/08/12 Last Seen: December 10, 2023 Share Posted September 26, 2012 (edited) Well, the last version gives me next: Why It happens? Any support please? Edited September 26, 2012 by Golem1988 Quote Link to comment Share on other sites More sharing options...
alkhaleej Posted October 15, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 58 Reputation: 5 Joined: 09/21/12 Last Seen: January 16, 2014 Share Posted October 15, 2012 Please help in may array: prontera mapflag loadevent morocc mapflag loadevent geffen mapflag loadevent payon mapflag loadevent alberta mapflag loadevent izlude mapflag loadevent aldebaran mapflag loadevent xmas mapflag loadevent comodo mapflag loadevent yuno mapflag loadevent amatsu mapflag loadevent gonryun mapflag loadevent umbala mapflag loadevent niflheim mapflag loadevent louyang mapflag loadevent new_1-1 mapflag loadevent sec_pri mapflag loadevent jawaii mapflag loadevent ayothaya mapflag loadevent einbroch mapflag loadevent lighthalzen mapflag loadevent einbech mapflag loadevent hugel mapflag loadevent rachel mapflag loadevent veins mapflag loadevent moscovia mapflag loadevent mid_camp mapflag loadevent manuk mapflag loadevent splendide mapflag loadevent brasilis mapflag loadevent dicastes01 mapflag loadevent mora mapflag loadevent dewata mapflag loadevent malangdo mapflag loadevent malaya mapflag loadevent eclage mapflag loadevent - script ach_0021_to_0056 -1,{ OnInit: setarray $scriptcount$[0],"21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56"; setarray $@maptown$[0],"prontera","morocc","geffen","payon","alberta","izlude","aldebaran","xmas","comodo","yuno","amatsu","gonryun","umbala","niflheim","louyang","new_1-1","sec_pri","jawaii","ayothaya","einbroch","lighthalzen","einbech","hugel","rachel","veins","moscovia","mid_camp","manuk","splendide","brasilis","dicastes01","mora","dewata","malangdo","malaya","eclage"; end; OnPCLoadMapEvent: for(set @d,0; @d < getarraysize($@maptown$); set @d,@d+1); set donecheck,"a_done_" + $scriptcount$[@d]; set delcheck,"$a_del_" + $scriptcount$[@d] + "$"; if(donecheck == 1 || delcheck == "y") end; if(strcharinfo(3) == $@maptown$[@d]) callfunc "achieve",$scriptcount$[@d]; end; } it is giving out error on mapserver: script:op_2: invalid data for operator C_EQ [Debug]: Data: number value=0 [Debug]: Data: string value="y" [Debug]: Source (NPC): ach_0021_to_0056 (invisible/not on a map I think I have a problem with my donecheck and delcheck string concatenation. I'm new in this. Quote Link to comment Share on other sites More sharing options...
alkhaleej Posted November 18, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 58 Reputation: 5 Joined: 09/21/12 Last Seen: January 16, 2014 Share Posted November 18, 2012 bug: achievement is awarded again even if it is already accomplished before. this happens when changing jobs Quote Link to comment Share on other sites More sharing options...
PewN Posted March 22, 2013 Group: Members Topic Count: 209 Topics Per Day: 0.04 Content Count: 892 Reputation: 27 Joined: 12/09/11 Last Seen: April 16, 2016 Share Posted March 22, 2013 Please help in may array: prontera mapflag loadevent morocc mapflag loadevent geffen mapflag loadevent payon mapflag loadevent alberta mapflag loadevent izlude mapflag loadevent aldebaran mapflag loadevent xmas mapflag loadevent comodo mapflag loadevent yuno mapflag loadevent amatsu mapflag loadevent gonryun mapflag loadevent umbala mapflag loadevent niflheim mapflag loadevent louyang mapflag loadevent new_1-1 mapflag loadevent sec_pri mapflag loadevent jawaii mapflag loadevent ayothaya mapflag loadevent einbroch mapflag loadevent lighthalzen mapflag loadevent einbech mapflag loadevent hugel mapflag loadevent rachel mapflag loadevent veins mapflag loadevent moscovia mapflag loadevent mid_camp mapflag loadevent manuk mapflag loadevent splendide mapflag loadevent brasilis mapflag loadevent dicastes01 mapflag loadevent mora mapflag loadevent dewata mapflag loadevent malangdo mapflag loadevent malaya mapflag loadevent eclage mapflag loadevent - script ach_0021_to_0056 -1,{ OnInit: setarray $scriptcount$[0],"21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56"; setarray $@maptown$[0],"prontera","morocc","geffen","payon","alberta","izlude","aldebaran","xmas","comodo","yuno","amatsu","gonryun","umbala","niflheim","louyang","new_1-1","sec_pri","jawaii","ayothaya","einbroch","lighthalzen","einbech","hugel","rachel","veins","moscovia","mid_camp","manuk","splendide","brasilis","dicastes01","mora","dewata","malangdo","malaya","eclage"; end; OnPCLoadMapEvent: for(set @d,0; @d < getarraysize($@maptown$); set @d,@d+1); set donecheck,"a_done_" + $scriptcount$[@d]; set delcheck,"$a_del_" + $scriptcount$[@d] + "$"; if(donecheck == 1 || delcheck == "y") end; if(strcharinfo(3) == $@maptown$[@d]) callfunc "achieve",$scriptcount$[@d]; end; } it is giving out error on mapserver: script:op_2: invalid data for operator C_EQ [Debug]: Data: number value=0 [Debug]: Data: string value="y" [Debug]: Source (NPC): ach_0021_to_0056 (invisible/not on a map I think I have a problem with my donecheck and delcheck string concatenation. I'm new in this. donecheck$ delcheck$ Quote Link to comment Share on other sites More sharing options...
PewN Posted March 28, 2013 Group: Members Topic Count: 209 Topics Per Day: 0.04 Content Count: 892 Reputation: 27 Joined: 12/09/11 Last Seen: April 16, 2016 Share Posted March 28, 2013 bug when achievement is mode Kill Monsterit's a bug when u set a kill 1 Phreeoni and 1 Ungoliantthey can't accomplish Quote Link to comment Share on other sites More sharing options...
Start_ Posted April 14, 2013 Group: Members Topic Count: 26 Topics Per Day: 0.01 Content Count: 950 Reputation: 180 Joined: 04/05/13 Last Seen: 22 hours ago Share Posted April 14, 2013 Work fine.. 5 / 5 rated ! Quote Link to comment Share on other sites More sharing options...
Start_ Posted April 23, 2013 Group: Members Topic Count: 26 Topics Per Day: 0.01 Content Count: 950 Reputation: 180 Joined: 04/05/13 Last Seen: 22 hours ago Share Posted April 23, 2013 I got this when I put 100 rows in Achievement. Quote Link to comment Share on other sites More sharing options...
rosfus Posted May 4, 2013 Group: Members Topic Count: 15 Topics Per Day: 0.00 Content Count: 75 Reputation: 3 Joined: 04/12/13 Last Seen: August 15, 2014 Share Posted May 4, 2013 5/5 STARS nice idea , nice scripts ,it's great! Quote Link to comment Share on other sites More sharing options...
deehlusa Posted July 9, 2013 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 9 Reputation: 1 Joined: 06/24/12 Last Seen: January 15, 2023 Share Posted July 9, 2013 Hello. I would like to change the position of cutin to the center of the screen as I do? Quote Link to comment Share on other sites More sharing options...
Mad Walker Posted July 21, 2013 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 177 Reputation: 9 Joined: 06/25/12 Last Seen: October 31, 2016 Share Posted July 21, 2013 wow 5 stars loki! This is really cool! Quote Link to comment Share on other sites More sharing options...
Thanna Posted July 26, 2013 Group: Members Topic Count: 45 Topics Per Day: 0.01 Content Count: 271 Reputation: 7 Joined: 01/06/12 Last Seen: May 16, 2015 Share Posted July 26, 2013 (edited) sir it works fine but how can I give a reward depending on the difficulty of the monster, I hope someone can help me out thanks in advance Edited July 26, 2013 by Thanna Quote Link to comment Share on other sites More sharing options...
Mad Walker Posted July 28, 2013 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 177 Reputation: 9 Joined: 06/25/12 Last Seen: October 31, 2016 Share Posted July 28, 2013 Just a suggestion, can you add a achievement points shop? It sell something in exchange of your achievement points Quote Link to comment Share on other sites More sharing options...
elmiria Posted August 5, 2013 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 1 Reputation: 0 Joined: 05/30/13 Last Seen: November 24, 2016 Share Posted August 5, 2013 just add getitem 7711,getd("$a_points_"+.@achieveId); after query_sql("UPDATE `char` SET achievement_points=achievement_points+"+getd("$a_points_"+.@achieveId)+" WHERE char_id="+getcharid(0)); there 7711 your item currensy Quote Link to comment Share on other sites More sharing options...
Mad Walker Posted August 6, 2013 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 177 Reputation: 9 Joined: 06/25/12 Last Seen: October 31, 2016 Share Posted August 6, 2013 is this compatible with hercules? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.