Jump to content
  • 0

Record board NPC


Question

Posted

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

21 answers to this question

Recommended Posts

Posted (edited)

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
Posted

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~

Posted

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.

Posted (edited)

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
Posted

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

Posted

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

Posted

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?

Posted

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

replace to where?

OnNPCKillEvent:

holiday_event_points++;

become

OnNPCKillEvent:

if( killedrid != <MOBID> ) end;

holiday_event_points++;

?

Posted
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

Posted

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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...