Jump to content
  • 0

Asking for a prize NPC


Milky Holmes

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  11/06/12
  • Last Seen:  

Can anyone give me a script that give an item to the first 5 ppl that reaches 150 ?

1st ppl can choose what they want...

2nd will have to choose the rest after 1st person

3rd will have to choose the rest after 1st & 2nd person

and so on until 5th person...

The NPC doesn't have to be popped once the person is lv 150.. it can be a visible NPC and the ppl can report to the NPC if he/she is already lv 150... Then ask to enter their name... and once there are 5 person the npc will disactivate the event itself and say, there are already 5 ppl reaches 150 before you.. then list the name.. from 1. 2. 3. 4. 5. ppl that reaches lv 150 first.. can anyone please help me make that ? :)

I've read the godly item quests.. but I don't really understand for the autodisactivate after the designated ppl... :( can someone please help...

Edited by Milky Holmes
Link to comment
Share on other sites

10 answers to this question

Recommended Posts


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

prontera,153,182,5	script	jhfksdjf	100,{
mes "these are the ones that has raced to level 150 in this server";
.@size = getarraysize( $race_level150_name$ );
if ( .@size ) {
	for ( .@i = 0; .@i < .@size; .@i++ )
		mes ( .@i +1 )+". "+ $race_level150_name$[.@i];
}
else
	mes "-> no record yet";
close;
OnPCBaseLvUpEvent:
if ( baselevel != 150 ) end; // if its not level150 ... ops just now I put 2 for testing purpose
.@size = getarraysize( $race_level150_name$ );
if ( .@size == 5 ) end; // after 5th place, no more
announce strcharinfo(0) +" has race to No."+( .@size +1 )+" position to level 150 !!", 0;
if ( .@size == 0 ) // 1st place
	getitem 501, 1;
else if ( .@size == 1 ) // 2nd place
	getitem 502, 1;
else if ( .@size == 2 ) // 3rd place
	getitem 503, 1;
else if ( .@size == 3 ) // 4th place
	getitem 504, 1;
else if ( .@size == 4 ) // 5th place
	getitem 505, 1;
$race_level150_name$[ .@size ] = strcharinfo(0); // save the record
end;
}

simple script

btw why you want the user to choose the item themself ? isn't that will create some kind of exploit ...

also, if the 1st place user purposely don't want to claim an item, the rest will complain to GM they can't claim the reward

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  11/06/12
  • Last Seen:  

btw why you want the user to choose the item themself ? isn't that will create some kind of exploit ...

also, if the 1st place user purposely don't want to claim an item, the rest will complain to GM they can't claim the reward

Thanks.. well, I'm still a noob in scripting... especially with Onblablabla, array, quests hunting, for, @i, and etc.. lol...

btw the script you gave me, does it let the first person choose? and doesn't if it use .@, when I reloadscript it will reset and it will activate again? or it doesn't /heh

Sorry if I asked too many question.. still learning :D

can I add this? if ( baselevel != 150 && getgmlevel() >= 1) because if the GM lv 150 wouldn't the GM that got the prize?

and how about don't use the OnPCBaseLevelUpEvent: will it still create some kind of exploit? if the lv 150 person claim and choose the prize themselves at the npc... hmm..

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:  

btw the script you gave me, does it let the first person choose? and doesn't if it use .@, when I reloadscript it will reset and it will activate again? or it doesn't /heh
nope I didn't ... straight give away the rewards when they reach level150

can I add this? if ( baselevel != 150 && getgmlevel() >= 1) because if the GM lv 150 wouldn't the GM that got the prize?

and how about don't use the OnPCBaseLevelUpEvent: will it still create some kind of exploit?

OnPCBaseLvUpEvent event label only trigger when player killing a mob

it wont trigger with GM commands or script commands, so its safe, no need to do such checks

ops ... read my next post

if the lv 150 person claim and choose the prize themselves at the npc... hmm..
what kind of prize ? Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  11/06/12
  • Last Seen:  

OnPCBaseLvUpEvent doesn't have effect on NPC? because I made an npc that submit a quest item then got base & job exp... I think that would exploit the server too..

if the lv 150 person claim and choose the prize themselves at the npc... hmm..
what kind of prize ?

so doesn't use OnPCBaseLevelUpEvent

maybe like set the 5 items..

then the 1st can choose the 5 item..

then the 2nd can only choose the 4 left item.. and so on

u need to claim it your self when u ar level 150... so it doesn't matter who got lv 150 first, but the first person that go to the NPC and ofcourse lv 150..

and ofcourse when 5 ppl submit, it ends..

Ah.. and doesn't if it use .@, when I reloadscript it will reset and it will activate again?

Edited by Milky Holmes
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:  

OnPCBaseLvUpEvent doesn't have effect on NPC? because I made an npc that submit a quest item then got base & job exp... I think that would exploit the server too..

oh I actually means

set baselevel, 150; or @lvup 150 <-- will not trigger OnPCBaseLvUpEvent:

however

getexp ... set baseexp, baseexp + n; ... or killing a monster <-- will trigger OnPCBaseLvUpEvent:

so if you got quest script, of course can trigger this event label

Ah.. and doesn't if it use .@, when I reloadscript it will reset and it will activate again?

I used $ <-- permanent global variable

it will survive through @reloadscript and server restart, so no problem

try this ... quite simple to me actually

prontera,153,182,5	script	jhfksdjf	100,{
mes "these are the ones that has raced to level 150 in this server";
.@size = getarraysize( $race_level150_name$ );
if ( .@size ) {
	for ( .@i = 0; .@i < .@size; .@i++ )
		mes ( .@i +1 )+". "+ $race_level150_name$[.@i];
}
else
	mes "-> no record yet";

while ( $race_level150_name$[.@r] != strcharinfo(0) && .@r < 5 ) .@r++; // search the user
if ( .@r == 5 )
	close; // means you are not in the list
else if ( $race_level150_bits & 1 << .@r )
	close; // already claimed the prize

next;
mes "you can claim a reward from me";
next;
.@size = getarraysize( $race_level150_item );
for ( .@i = 0; .@i < .@size; .@i++ )
	.@menu$ = .@menu$ + getitemname( $race_level150_item[.@i] ) +":";
.@s = select( .@menu$ ) -1;

// special = this is a race, player also can race to talk to this npc, so make sure the data is unchanged while players choosing for the reward
if ( getarraysize( $race_level150_item ) != .@size ) {
	mes "I'm sorry, the item list has changed, please talk to me again!";
	close;
}

getitem $race_level150_item[.@s], 1;
mes "Congrats for getting "+ getitemname( $race_level150_item[.@s] ) +"!!";
deletearray $race_level150_item[.@s], 1; // remove 1 item index
$race_level150_bits = $race_level150_bits | 1 << .@r; // save the bits of winner (in index) has claimed the prize
close;
OnPCBaseLvUpEvent:
if ( baselevel != 150 ) end; // if its not level150, don't need run the rest
.@size = getarraysize( $race_level150_name$ );
if ( .@size == 5 ) end; // after 5th place, no more
announce strcharinfo(0) +" has race to No."+( .@size +1 )+" position to level 150 !!", 0;
$race_level150_name$[ .@size ] = strcharinfo(0); // save the record
end;
OnInit:
if ( !$race_level150_item && !getstrlen($race_level150_name$) )
	setarray $race_level150_item, 501,502,503,504,505; // *CONFIG* = set your own item ID for prize giver here
end;
}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  11/06/12
  • Last Seen:  

umm.. thanks but if I use that script it wouldn't be exploit like what u said? if the first player didn't take the item the next person

btw why you want the user to choose the item themself ? isn't that will create some kind of exploit ...

also, if the 1st place user purposely don't want to claim an item, the rest will complain to GM they can't claim the reward

if it did maybe can I move the .@size= getarraysize( $race_level150_name$ );

after they claim the item? u get what i mean ?

maybe I need to learn from u.. lol... I'm wondering if it is $ is permanent how to reset it? would deleting the script from the server remove it?

I still need a LOT of learning /sob still far from good... lol..

Edited by Milky Holmes
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:  

lol its natural ... this is an event script ...

umm.. thanks but if I use that script it wouldn't be exploit like what u said? if the first player didn't take the item the next person
they will race for the level, and they will also race for the prize

if 1st and 2nd place level up to level150 almost the same time

they will race for the prize too

so the first player who talk to this npc, they will get to choose 5 items, and claimed the prize

so even 2nd place can claim the most unique prize they want if they race to this npc before 1st place does

maybe I need to learn from u.. lol... I'm wondering if it is $ is permanent how to reset it? would deleting the script from the server remove it?
to reset, create another script to clear them -> deletarray $var;

or shut down your server and manually remove the lines inside `mapreg` table -> delete from mapreg where varname = '$var';

I still need a LOT of learning /sob still far from good... lol..
... actually at my current scripting ability, any kinds of event script looks easy to me atm /oops
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  11/06/12
  • Last Seen:  

actually at my current scripting ability, any kinds of event script looks easy to me atm /oops

Well indeed.. I see some other posts when you are having some showdown.. :D learning little by little from it, trying to understand it.. lol

and.. really!! thanks for the script... :)

btw what is .@i++ means? because I see at the rathena wiki it use set @i,@i+1 or is it the same? last question :D

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:  

ah, forgot to add,

and the trick is keep trying :D

I lost count how many scripts I've made ...

.@i++ is

set .@i, .@i +1;

yes it is the same

http://rathena.org/b...-engine-update/

... I pay very high respect to @Epoque ... damn he's inactive

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  11/06/12
  • Last Seen:  

Well I keep trying to make scripts.. Now I still practice on making some easy scripts... quests, antibot login, and fishing mining etc2, the "easy" version.. lol...

and will try to use array and for loop later on.. :D

suddenly when I started a server I found scripting is fun!! xD

http://rathena.org/b...-engine-update/

... I pay very high respect to @Epoque ... damn he's inactive

whoaa he is one of a good scripter then...

I don't understand what it means though :( especially the signs i've never seen (+=, -=, /=, *= etc.) and while loop command x_x

well.. thanks either way for helping me.. :D

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