Jump to content

Recommended Posts

i wrote this NPC for my server Sanctuary RO, with the intention of sharing since it took a lot of work to write i wanted to let other people use the same NPC or be able to edit it or take snippets from it to use in their own creations

i'm designing the server economy to depend on cards so i wrote an NPC that will dispense coins every time a card is traded baised on how often that card is traded in by the whole server

note that item 9204 is a custom item on my server and it will probably need to be changed 

there may have been easier or cleaner ways to write this NPC but it absolutely works, the only issue is if you have too many cards in your inventory the menu wont display them all but it requires a lot to hit that point

 

 

cardshredder.txt

Share this post


Link to post
Share on other sites

I admit its cool idea, reminds me the card trader event I made long time ago
http://herc.ws/board/topic/11367-card-collector/

the problem is your script, and you should be glad you have posted on the board
let me simplify it ...

prontera,155,185,4	script	Card Shredder	2_VENDING_MACHINE1,{
	mes "[ Card Shredder ]";
	mes "You can shred cards to earn premium currency";
	mes "would you like to shred any cards? ";
	next;
	if ( select ( "Yes.", "No" ) == 2 ) close;
	mes "[ Card Shredder ]";
	mes "Please select the card you wish to shred.";
	getinventorylist;
	for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) {
		if ( getiteminfo( @inventorylist_id[.@i], ITEMINFO_TYPE ) == 6 ) {
			.@menu$ += getitemname( @inventorylist_id[.@i] ) +" "+ callsub( L_Coins, @inventorylist_id[.@i] ) +" Coins:";
			.@cardid[.@c++] = @inventorylist_id[.@i];
		}
	}
	.@menu$ += "No Card - Close";
	next;
	.@s = select( .@menu$ ) -1;
	if ( .@s == .@c ) close;
	mes "[ Card Shredder ]";
	mes "are you sure you want to shred a "+ getitemname( .@cardid[.@s] ) +" for "+ callsub( L_Coins, .@cardid[.@s] ) +" coins ?";
	next;	
	if ( select ( "Yes.", "No" ) == 2 ) close;
	delitem .@cardid[.@s], 1;
	getitem Poring_Coin, callsub( L_Coins, .@cardid[.@s] );
	++$cardid_shredded[ .@cardid[.@s] ];
	close;
L_Coins:
	if ( $cardid_shredded[ getarg(0) ] < 5 )
		return 5;
	else if ( $cardid_shredded[ getarg(0) ] < 10 )
		return 4;
	else if ( $cardid_shredded[ getarg(0) ] < 15 )
		return 3;
	else if ( $cardid_shredded[ getarg(0) ] < 20 )
		return 2;
	else 
		return 1;
}

I made it in a way without using 2 permanent variables
also found a bug though ... line 713

if (.@cardval < 1) set cardval,10; if (.@menu == 454) close;

why do you set a permanent player variable ... there ?


and about the issue about having too many cards in the menu, can be done with page system
https://rathena.org/board/topic/74630-help-array/

Share this post


Link to post
Share on other sites
L_Coins:
	if ( $cardid_shredded[ getarg(0) ] < 5 )
		return 5;
	else if ( $cardid_shredded[ getarg(0) ] < 10 )
		return 4;
	else if ( $cardid_shredded[ getarg(0) ] < 15 )
		return 3;
	else if ( $cardid_shredded[ getarg(0) ] < 20 )
		return 2;
	else 
		return 1;

I've read the original script, and in that script .... as you can see here the value will decrease the more players shred their cards
although I also prefer to have a fix value ... though

yes its possible ... but you want a fix value or a descending value ?

you know ... if its a fix value ... then sounds like a card trader npc

Share this post


Link to post
Share on other sites
On 5/30/2018 at 2:21 AM, AnnieRuru said:

I admit its cool idea, reminds me the card trader event I made long time ago
http://herc.ws/board/topic/11367-card-collector/

the problem is your script, and you should be glad you have posted on the board
let me simplify it ...


prontera,155,185,4	script	Card Shredder	2_VENDING_MACHINE1,{
	mes "[ Card Shredder ]";
	mes "You can shred cards to earn premium currency";
	mes "would you like to shred any cards? ";
	next;
	if ( select ( "Yes.", "No" ) == 2 ) close;
	mes "[ Card Shredder ]";
	mes "Please select the card you wish to shred.";
	getinventorylist;
	for ( .@i = 0; .@i < @inventorylist_count; ++.@i ) {
		if ( getiteminfo( @inventorylist_id[.@i], ITEMINFO_TYPE ) == 6 ) {
			.@menu$ += getitemname( @inventorylist_id[.@i] ) +" "+ callsub( L_Coins, @inventorylist_id[.@i] ) +" Coins:";
			.@cardid[.@c++] = @inventorylist_id[.@i];
		}
	}
	.@menu$ += "No Card - Close";
	next;
	.@s = select( .@menu$ ) -1;
	if ( .@s == .@c ) close;
	mes "[ Card Shredder ]";
	mes "are you sure you want to shred a "+ getitemname( .@cardid[.@s] ) +" for "+ callsub( L_Coins, .@cardid[.@s] ) +" coins ?";
	next;	
	if ( select ( "Yes.", "No" ) == 2 ) close;
	delitem .@cardid[.@s], 1;
	getitem Poring_Coin, callsub( L_Coins, .@cardid[.@s] );
	++$cardid_shredded[ .@cardid[.@s] ];
	close;
L_Coins:
	if ( $cardid_shredded[ getarg(0) ] < 5 )
		return 5;
	else if ( $cardid_shredded[ getarg(0) ] < 10 )
		return 4;
	else if ( $cardid_shredded[ getarg(0) ] < 15 )
		return 3;
	else if ( $cardid_shredded[ getarg(0) ] < 20 )
		return 2;
	else 
		return 1;
}

I made it in a way without using 2 permanent variables
also found a bug though ... line 713


if (.@cardval < 1) set cardval,10; if (.@menu == 454) close;

why do you set a permanent player variable ... there ?

 


and about the issue about having too many cards in the menu, can be done with page system
https://rathena.org/board/topic/74630-help-array/

To be honest i did it the way i knew how, I've not scripted since 2005 and i've forgotten more then i can remember thank you so much for simplifying this is awesome

And that line, i had an issue of it displaying the proper amount of coins to be dispensed if a card had never been traded that was me trying to bumble my way through that problem at least i think thats what that one was for, i had to take a few weeks away from RO stuffs due to Army obligations and i forget again what i was doing and have to relearn.... again

the idea is after enough cards have been traded values should eventually reflect availability and viability fairly accurately, if their rarer or have a better use being equipped you get more of that currency for that particular card. diversifying card values as a whole, and giving some value to otherwise useless cards especially rare ones. i've also considered a quest or server wide objective to reset this scale something to implement in the future. as your population increases you can also adjust the intensity of the scale too for different kinds of effects. at the end of the day this may also provide a real nice card RANK (reflecting both value in the form of rarity and viability) after enough data has been collected that may be useful to someone out there

i also have a coin sink... because every currency needs one... my Reset NPC scales the zeny price every time its used OR you can use some of these coins instead of zeny. not allowing an exchange for say... cash shop currency and its only use in the beginning is that reset NPC the hope is it will balance out in a fair way when enough time has passed

 

i have a fondness for global permanent values with server wide impacts

 

Quote

Is it possible to make another menu which is the MVP Cards = 10 Poring Coins? This is for high rate servers :D

if you roam the DB and find the item numbers for the MVP cards yes absolutely, i considered setting a fixed rate for MVP cards also that was significantly higher then the rest, and its something i might do later. what was written took a few days it was enough work at the time on my lower rate server this will not be a huge issue  since MVP Cards will almost never touch this NPC i decided it didn't warrant the extra work at the time of collecting the item numbers for the MVPs and adding that functionality to the script since the diminishing return effect would take a significant amount of time before it effects an MVP card on my server  (MVP card drops are the stock 0.01% on my server) 

Edited by Sashi

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.