Jump to content

Achivement System with no source edit


Recommended Posts


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   13
  • Joined:  01/07/12
  • Last Seen:  

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 /gg

Loki1991

lokis_achivement_system_1.0.zip

Edited by loki1991
  • Upvote 6
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

uoool! very good ;)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

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.

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  29
  • Topics Per Day:  0.01
  • Content Count:  566
  • Reputation:   34
  • Joined:  11/17/11
  • Last Seen:  

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! :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  292
  • Reputation:   17
  • Joined:  12/12/11
  • Last Seen:  

This is great..:) But I agree to Euphy on minimizing the use of Global variables.. :))

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  52
  • Reputation:   12
  • Joined:  12/22/11
  • Last Seen:  

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!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   1
  • Joined:  06/01/12
  • Last Seen:  

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 gya-.gif

Edited by nodiby
Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   13
  • Joined:  01/07/12
  • Last Seen:  

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

Link to comment
Share on other sites

  • 4 weeks later...

  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  162
  • Reputation:   1
  • Joined:  08/08/12
  • Last Seen:  

error1.jpg

Well, it says: Report, So, I do as it says :D

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...

Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   13
  • Joined:  01/07/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  82
  • Reputation:   2
  • Joined:  05/13/12
  • Last Seen:  

Edit:

thanks so much for the script!!

Edited by Atomiq
Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  162
  • Reputation:   1
  • Joined:  08/08/12
  • Last Seen:  

Well, the last version gives me next:

ac.png

Why It happens? Any support please?

Edited by Golem1988
Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   5
  • Joined:  09/21/12
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   5
  • Joined:  09/21/12
  • Last Seen:  

bug: achievement is awarded again even if it is already accomplished before. this happens when changing jobs

Link to comment
Share on other sites

  • 4 months later...

  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

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$

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

bug when achievement is mode Kill Monster

it's a bug when u set a kill 1 Phreeoni and 1 Ungoliant

they can't accomplish

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  928
  • Reputation:   170
  • Joined:  04/05/13
  • Last Seen:  

Work fine..  /no1

 

5 / 5 rated !

Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  928
  • Reputation:   170
  • Joined:  04/05/13
  • Last Seen:  

ALONG.jpg

 

I got this when I put 100 rows in Achievement.

Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   3
  • Joined:  04/12/13
  • Last Seen:  

5/5 STARS

nice idea , nice scripts ,it's great!

Link to comment
Share on other sites

  • 2 months later...

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   1
  • Joined:  06/24/12
  • Last Seen:  

Hello. I would like to change the position of cutin to the center of the screen as I do?
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  177
  • Reputation:   9
  • Joined:  06/25/12
  • Last Seen:  

wow 5 stars loki! This is really cool!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  271
  • Reputation:   7
  • Joined:  01/06/12
  • Last Seen:  

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 by Thanna
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  177
  • Reputation:   9
  • Joined:  06/25/12
  • Last Seen:  

Just a suggestion, can you add a achievement points shop? It sell something in exchange of your achievement points

Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  05/30/13
  • Last Seen:  

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 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  177
  • Reputation:   9
  • Joined:  06/25/12
  • Last Seen:  

is this compatible with hercules? :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...