Jump to content
  • 0
Sign in to follow this  
kerbiii

help with this npc tia

Question

1. NPC that will warp you to a specific map if:
- novice only
- level 1 only
- no items equip
- no items on inventory
- no items at all
- 1m entrance free
 
2. NPC that will warp you to prontera:
    - no items equipped (if no equipped next) (if with equipped reject)
upon warping:
 - delete all items in the inventory
 - reset job into novice b/jlvl 1
 - autosave on prontera,x,y,
 
3. NPC that will warp you if:
- must be in the party
- no same job in the party
- autosave infront of the npc

 

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Sample1 = first request

Sample2 = second request

Sample3 = third request

 

Didn't test though ( /me lazy ). Just a side note i just copy the function of @KeyWorld here ( http://rathena.org/board/topic/66255-party-checker-job/?p=118481 ) so credits to him. If any error occur post it. 

prontera,150,150,0	script	Sample1	100,{	getinventorylist;	query_sql "SELECT `nameid` FROM `storage` WHERE `account_id` = '" +getcharid(3)+ "'", .@names;	if ( ( BaseClass == Job_Novice ) && ( BaseLevel == 1 ) && ( Zeny > 1000000 ) && ( @inventorylist_count == 0 ) && ( !.@names ) ) {		for ( .@i = 1; .@i < 15; .@i++ ) {			if ( getequipid(.@i) == -1 ) {				mes "Where you want to warp?";				next;				input .@map$;				Zeny -= 1000000;				warp .@map$,0,0;				close;			}		}	}}prontera,153,153,0	script	Sample2	100,{	for ( .@i = 1; .@i < 15; .@i++ ) {		if ( getequipid(.@i) == -1 ) {			getinventorylist;			for ( set .@a, 0; .@a < @inventorylist_count; .@a++ ) {				delitem @inventorylist_id[.@a], @inventorylist_amount[.@a];			}			jobchange Job_Novice;			BaseLevel = 1;			JobLevel = 1;			savepoint "prontera",150,150;			end;		}	}}prontera,156,156,0	script	Sample3	100,{	if ( getcharid(2) ) {		if ( callfunc("party_has_duplicate_job") ) {			mes "It seems that someone in the party has the same class than another member. Please check again the requirements...";			close;		}		getmapxy .@map$, .@x, .@y, 0;		savepoint .@map$, .@x, .@y;		end;	}}function	script	party_has_duplicate_job{	set .@party_id, getarg( 0, getcharid(1) );	// Need to have a party.	if ( .@party_id != 1 )	{		return -1;	}	// Loading party members variables	getpartymember getcharid(1),1;	getpartymember getcharid(1),2;	// Keep rid attached.	set .@rid, playerattached();	// Check all members	for ( set .@i,0; .@i<$@partymembercount; set .@i, .@i+1 )	{		// Online user		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i]) )		{			// Attach the member to access "Class"			attachrid( $@partymemberaid[.@i] );			if ( compare( .@tmp_class$ + "|", "|" + Class + "|" ) )			{				if ( .@rid )					attachrid(.@rid);				else					detachrid;				return 1;			}			set .@tmp_class$, .@tmp_class$ + "|" + Class;		}		// Offline user (use sql)		else		{			set .@sql$, .@sql$ + ( .@sql_i ? "OR " : "" ) "`char_id`='" + $@partymembercid[.@i] + "' ";			set .@sql_i, .@sql_i + 1;		}	}	// SQL for offline users	if ( getstrlen(.@sql$) )	{		// get class from offline members		set .@count, query_sql("SELECT `class` FROM `char` WHERE " + .@sql$, .@class );		// Check the class.		for ( set .@i, 0; .@i<.@count; set .@i, .@i+1 )		{			if ( compare( .@tmp_class$ + "|", "|" + .@class[.@i] + "|" ) )			{				if ( .@rid )					attachrid(.@rid);				else					detachrid;				return 1;			}			set .@tmp_class$, .@tmp_class$ + "|" + .@class[.@i];		}	}		// Restore RID.	if ( .@rid )		attachrid(.@rid);	else		detachrid;	return 0;}

Share this post


Link to post
Share on other sites
  • 0

 

Sample1 = first request

Sample2 = second request

Sample3 = third request

 

Didn't test though ( /me lazy ). Just a side note i just copy the function of @KeyWorld here ( http://rathena.org/board/topic/66255-party-checker-job/?p=118481 ) so credits to him. If any error occur post it. 

prontera,150,150,0	script	Sample1	100,{	getinventorylist;	query_sql "SELECT `nameid` FROM `storage` WHERE `account_id` = '" +getcharid(3)+ "'", .@names;	if ( ( BaseClass == Job_Novice ) && ( BaseLevel == 1 ) && ( Zeny > 1000000 ) && ( @inventorylist_count == 0 ) && ( !.@names ) ) {		for ( .@i = 1; .@i < 15; .@i++ ) {			if ( getequipid(.@i) == -1 ) {				mes "Where you want to warp?";				next;				input .@map$;				Zeny -= 1000000;				warp .@map$,0,0;				close;			}		}	}}prontera,153,153,0	script	Sample2	100,{	for ( .@i = 1; .@i < 15; .@i++ ) {		if ( getequipid(.@i) == -1 ) {			getinventorylist;			for ( set .@a, 0; .@a < @inventorylist_count; .@a++ ) {				delitem @inventorylist_id[.@a], @inventorylist_amount[.@a];			}			jobchange Job_Novice;			BaseLevel = 1;			JobLevel = 1;			savepoint "prontera",150,150;			end;		}	}}prontera,156,156,0	script	Sample3	100,{	if ( getcharid(2) ) {		if ( callfunc("party_has_duplicate_job") ) {			mes "It seems that someone in the party has the same class than another member. Please check again the requirements...";			close;		}		getmapxy .@map$, .@x, .@y, 0;		savepoint .@map$, .@x, .@y;		end;	}}function	script	party_has_duplicate_job{	set .@party_id, getarg( 0, getcharid(1) );	// Need to have a party.	if ( .@party_id != 1 )	{		return -1;	}	// Loading party members variables	getpartymember getcharid(1),1;	getpartymember getcharid(1),2;	// Keep rid attached.	set .@rid, playerattached();	// Check all members	for ( set .@i,0; .@i<$@partymembercount; set .@i, .@i+1 )	{		// Online user		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i]) )		{			// Attach the member to access "Class"			attachrid( $@partymemberaid[.@i] );			if ( compare( .@tmp_class$ + "|", "|" + Class + "|" ) )			{				if ( .@rid )					attachrid(.@rid);				else					detachrid;				return 1;			}			set .@tmp_class$, .@tmp_class$ + "|" + Class;		}		// Offline user (use sql)		else		{			set .@sql$, .@sql$ + ( .@sql_i ? "OR " : "" ) "`char_id`='" + $@partymembercid[.@i] + "' ";			set .@sql_i, .@sql_i + 1;		}	}	// SQL for offline users	if ( getstrlen(.@sql$) )	{		// get class from offline members		set .@count, query_sql("SELECT `class` FROM `char` WHERE " + .@sql$, .@class );		// Check the class.		for ( set .@i, 0; .@i<.@count; set .@i, .@i+1 )		{			if ( compare( .@tmp_class$ + "|", "|" + .@class[.@i] + "|" ) )			{				if ( .@rid )					attachrid(.@rid);				else					detachrid;				return 1;			}			set .@tmp_class$, .@tmp_class$ + "|" + .@class[.@i];		}	}		// Restore RID.	if ( .@rid )		attachrid(.@rid);	else		detachrid;	return 0;}

wow thnx for the last reply, i will test it now, will post the result after

Share this post


Link to post
Share on other sites
  • 0

For third request (no duplicate jobs in party) deleting items from cart it's not useful, so I think you mean the cart items aren't being deleted in the second request.

 

Cart items are just like a second storage and aren't officially removed if, for example, you rebirth a Blacksmith or Alchemist since when you get back to High Merchant the're still there, so it'd be normal if "resetted" players still had their cart content, isn't it?

Share this post


Link to post
Share on other sites
  • 0

I should instead use clearitem commands instead of loops and inventory list comand :

*clearitem;This command will destroy all items the invoking character has in theirinventory (including equipped items). It will not affect anything else,like storage or cart.

Back to business, If you want to delete cart items of an invoking player you need to run a sql query for that ( i think unless there is a command in hercules that deletes cart items ). You can add this to my script.

 

Change : 

mes "Where you want to warp?";next;input .@map$;Zeny -= 1000000;warp .@map$,0,0;close;

to :

if ( checkcart() ) {	query_sql "SELECT `nameid` FROM `cart_inventory` WHERE `char_id` = '" +getcharid(0)+ "'",.@a;	if ( .@a ) end;}mes "Where you want to warp?";next;input .@map$;Zeny -= 1000000;warp .@map$,0,0;close;

Be sure next time you are more specific when you are requesting scripts. Not tested!

Share this post


Link to post
Share on other sites
  • 0

I should instead use clearitem commands instead of loops and inventory list comand :

*clearitem;This command will destroy all items the invoking character has in theirinventory (including equipped items). It will not affect anything else,like storage or cart.

Back to business, If you want to delete cart items of an invoking player you need to run a sql query for that ( i think unless there is a command in hercules that deletes cart items ). You can add this to my script.

 

Change : 

mes "Where you want to warp?";next;input .@map$;Zeny -= 1000000;warp .@map$,0,0;close;

to :

if ( checkcart() ) {	query_sql "SELECT `nameid` FROM `cart_inventory` WHERE `char_id` = '" +getcharid(0)+ "'",.@a;	if ( .@a ) end;}mes "Where you want to warp?";next;input .@map$;Zeny -= 1000000;warp .@map$,0,0;close;

Be sure next time you are more specific when you are requesting scripts. Not tested!

one last thing how to add the cart wipe script on the sample 2?

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

×   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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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