Jump to content
  • 0

Record board NPC


citylala

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  12
  • Reputation:   0
  • Joined:  11/30/12
  • Last Seen:  

hello, im goign to make an Holiday Event... i wan player to hunt certain monsters.. and who hunt the most .. .. i need a Board NPC that record players killed how many the monster. Top1 ~ top10 ranks

Link to comment
Share on other sites

21 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

try this..

http://pastebin.com/raw.php?i=gM2yYtva

Top1 ~ top10 ranks

change

LIMIT 127

to

LIMIT 10

refer post#4

Edited by Emistry
Refer Post#4 for updated script contents.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

txt style ladder ... been some time I'm able to do this

holiday_event_ladder.0.1.txt

@emistry

query_sql( "INSERT INTO `kill_rank` VALUES ( '"++"','1' ) ON DUPLICATE KEY UPDATE `kill`=`kill`+1"

'"++"' is so weird

missing strcharinfo(0) inside ?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

LOL......

haha yaya..missing strcharinfo(0)..... >.<

@TS

anyway..try this....

http://pastebin.com/raw.php?i=QNnfz9T7

or

http://pastebin.com/raw.php?i=NCRNceBw

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

your 2nd script

.@rank = query_sql( "SELECT `char_id`,`value` FROM `global_reg_value` WHERE `str`='mobkill' ORDER BY `value` DESC LIMIT 10",.@cid,.@kill );

change into

.@rank = query_sql( "SELECT `char_id`,`value` FROM `global_reg_value` WHERE `str`='mobkill' ORDER BY CAST( `value` AS SIGNED ) DESC LIMIT 10",.@cid,.@kill );

`value` in `global_reg_value` is a STRING type column,

if the value has

1111,2222,12345

will be sort as

2222

12345

1111

because the first string is being sort 1st, as it is a string type ...

it should be sort as integers, so do

CAST( `value` AS SIGNED )

something wrong with your SQL knowledge ....

or perhaps you are sleepy

EDIT:

another one

rid2name( .@cid[.@i] )

I'm quite sure our rid2name script command doesn't support char ID field .....

try refer to this post to how it being made ...

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

it should be sort as integers, so do

CAST( `value` AS SIGNED )

owh...well this is new to be....i mean the "CAST()"

haha i didnt know there is something like that..

and..ya i forgot that the string sorting would be different from integer...LOL... >.< thx for remind....

something wrong with your SQL knowledge ....

or perhaps you are sleepy

another one

rid2name( .@cid[.@i] )

I'm quite sure our rid2name script command doesn't support char ID field .....

try refer to this post to how it being made ...

aw...O.O.....thx for the information and remind..xD


usually i would prefer of using this script..

http://pastebin.com/raw.php?i=QNnfz9T7

because most of the time i can easily find out the data i wan...manipulate it easily in the way i want..

so i less using `global_reg_value` >.<

guess i have to study more on SQL stuff later on ~

haha~

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

You could use rid2name in combination with getcharid to retrieve the char I'd, but, I have no idea how the script is written or if this is even remotely close to what's being talked about since I'm on my phone lol.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

1.

rid2name script command requires players to online

2.

rid2name only search account_id on players

	if ((bl = map_id2bl(rid))) {
	switch (bl->type) {
.....
		case BL_PC:
			script_pushstrcopy(st,((TBL_PC *)bl)->status.name);
			break;

the map_id2bl function in source, only store the information that is inside the map_server.exe

if players is not online, the data is left inside SQL table ( which is why we can freely edit them once @kick them out )

and the type of information is already predefine in the source

//Limits to avoid ID collision with other game objects

#define START_ACCOUNT_NUM 2000000

#define END_ACCOUNT_NUM 100000000

#define START_CHAR_NUM 150000

account ID starts with 2000000 and ends at 100000000

if you start your test server and use getnpcid(0), it always start with 100000001 because these ranges are already predefined

charID is somehow is in other range with other objects

*Proof*

prontera,153,182,5	script	jhfksdjf	100,{
dispbottom " ==== ";
dispbottom rid2name( 2000000 ); // Annieruru is online, return "Annieruru"
dispbottom rid2name( 2000001 ); // Ennyruru is online, return "Ennyruru"
dispbottom rid2name( 2000002 ); // Kinoruru is offline, return "(null)"
dispbottom rid2name( getcharid(0) ); // your ownself CharID, which doesn't work, return "(null)"
}

post-8685-0-82888300-1354303335_thumb.jpg

emistry script on post#4 there which using rid2name sure doesn't work if the user has score a ladder in the board doesn't online

will return "(null)"

	} else {
	ShowError("buildin_rid2name: invalid RID\n");
	script_pushconststr(st,"(null)");
}

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Ahh i see lol. I made that comment at the time, without having looked at the script so i didn't know in which way it was being used, but after looking at it, yes i see your point lol.

I was under the impression that Emistry made a (so unlike him) mistake and used rid2name to obtain the char's id.. only did it wrong lol. But like i said, that's so not like him.

But yes, I agree with you on that one Annie. After reviewing the script, that would indeed not work.

However his improved script is efficient enough in its task :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  12
  • Reputation:   0
  • Joined:  11/30/12
  • Last Seen:  

haha! so download the #4 that 1?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

let's see ... my script on post#3 and emistry script on post#6 is stable script

my script use txt style ladder, which generate 1 perm player variable + 2 global array

emistry script use sql style ladder which require SQL table

try use either one of the solution provided

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  12
  • Reputation:   0
  • Joined:  11/30/12
  • Last Seen:  

let's see ... my script on post#3 and emistry script on post#6 is stable script

my script use txt style ladder, which generate 1 perm player variable + 2 global array

emistry script use sql style ladder which require SQL table

try use either one of the solution provided

annie im using ur script, btw how do i set it just kill "Jakk" this monster and record it to the board npc?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

OnNPCKillEvent:
if( killedrid != <MOBID> ) end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

OnNPCKillEvent:
if( killedrid != <MOBID> ) end;

replace to where?

OnNPCKillEvent:

holiday_event_points++;

become

OnNPCKillEvent:

if( killedrid != <MOBID> ) end;

holiday_event_points++;

?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

OnNPCKillEvent:

if( killedrid != <MOBID> ) end;

holiday_event_points++;

?

Yes.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

OnNPCKillEvent:

if( killedrid != <MOBID> ) end;

holiday_event_points++;

?

Yes.

ERROR. i put 3007 into the modid

3007 is my custom monster id

i clicke the npc and the npc didnt respond anything

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Umm, it responds to when you kill that monster, not when you talk to the NPC.

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:  

You should read the documentation. trunk/doc/script_commands.txt

OnNPCKillEvent:

This special label triggers when a player kills a monster. The variable

'killedrid' is set to the Class of the monster killed.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

may i know how to reset theranking? xD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  344
  • Topics Per Day:  0.08
  • Content Count:  1060
  • Reputation:   1
  • Joined:  02/13/12
  • Last Seen:  

can i suggesst to remove players from the list?

post-2303-0-27099500-1354945880_thumb.jpg

got 2 player name same at the board there=.= bug?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

wait wait wait.. wait.... wait .......wait ..............

I created mine from scratch, and even compare to terces pvp ladder script ...

if terces pvp ladder script doesn't have his bug, then mine should be the same .....

questions ... did you ever use reset ladder function once already ?

but even so ... I couldn't reproduce this bug, unless someone else can find it for me

holiday_event_ladder.0.3.txt

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
Answer this question...

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