Jump to content
  • 0

two walking npc


Question

Posted (edited)

hi i need two walking npc i hope someone can help me

 

 

1 npc walk and he ask for trade items just for test do trade id 512(apple) to 515(Carrost)

and the npc say in chat "T>your Apples to my Carrost"

and the npc ask how much you want trade put number and he trade for some number like i put 50apple and trade so the npc give me 50 Carrost

 

 

and one npc ask for buy items

just for test

the npc want buy apple for Carrot

for 1m zeny(just test)

and the npc say in chat "B>Apple 1m"

and the npc ask how much you want to sell

just put number and its sold to npc(1m per each just for test)

 

the npc move randomly in the map

 

note pls make easy to change the item id and the price :)

 

ty :meow:

Edited by angelingh

9 answers to this question

Recommended Posts

  • 0
Posted

npc 1

prontera,155,175,5	script	Sample#npc1	4_F_KAFRA9,{
	
	mes "Do you want Carrot?";
	if ( select( "Trade my Apple to Carrots","Cancel" ) == 1 ) {
		input .@count,0,countitem( 512 );
		if ( .@count ) {
			getitem 515,.@count;
			delitem 512,.@count;
		}
		mes "Exchanged "+.@count+"x Apple to Carrot";
	}
	close;
	
	OnInit:
		npcspeed 200;
		getmapxy( .npc_map$, .npc_x, .npc_y,1 );
		initnpctimer;
		end;
		
	OnTimer10000:
		.@x = .npc_x + rand( -10,10 );
		.@y = .npc_y + rand( -10,10 );
		npcwalkto .@x,.@y;
		setnpctimer 0;
		end;
}

npc 2

prontera,155,175,5	script	Sample#npc2	4_F_KAFRA9,{
	
	mes "Do you have apple?";
	if ( select( "Sell Apple to NPC","Cancel" ) == 1 ) {
		input .@count,0,countitem( 512 );
		if ( .@count ) {
			delitem 512,.@count;
			Zeny += ( .@count * 1000000 );
		}
		mes "Sold "+.@count+"x Apple to NPC";
	}
	close;
	
	OnInit:
		waitingroom "B>Apple for 1M",0;
		npcspeed 200;
		getmapxy( .npc_map$, .npc_x, .npc_y,1 );
		initnpctimer;
		end;
		
	OnTimer10000:
		.@x = .npc_x + rand( -10,10 );
		.@y = .npc_y + rand( -10,10 );
		npcwalkto .@x,.@y;
		setnpctimer 0;
		end;
}
  • Upvote 1
  • 0
Posted (edited)

prontera,156,184,0 script YOUR_NPC_NAME 899,{


set .@STOPWALK,"1";


//YOUR SCRIPT HERE


//
//
//


//YOUR SCRIPT END HERE


set .@STOPWALK,"0";


close;


OnInit:
if(.@STOPWALK == 0){
addrid(0);
while(1){
npcspeed 300;
if (getmapxy(@mapname$, @mapx, @mapy, UNITTYPE_NPC, "YOUR_NPC_NAME") !=0) {
end;
}
set .@X_RANDOM,rand(-5,5);
set .@Y_RANDOM,rand(-5,5);
npcwalkto @mapx+.@X_RANDOM,@mapy+.@Y_RANDOM;
sleep2 5000;
}
}
end;
}
Edited by TARTs
  • 0
Posted (edited)

 

prontera,156,184,0 script YOUR_NPC_NAME 899,{


set .@STOPWALK,"1";


//YOUR SCRIPT HERE


//
//
//


//YOUR SCRIPT END HERE


set .@STOPWALK,"0";


close;


OnInit:
if(.@STOPWALK == 0){
addrid(0);
while(1){
npcspeed 300;
if (getmapxy(@mapname$, @mapx, @mapy, UNITTYPE_NPC, "YOUR_NPC_NAME") !=0) {
end;
}
set .@X_RANDOM,rand(-5,5);
set .@Y_RANDOM,rand(-5,5);
npcwalkto @mapx+.@X_RANDOM,@mapy+.@Y_RANDOM;
sleep2 5000;
}
}
end;
}

ty!!

but i have problem with that too maybe you know how fix its?

the npc not load

PAoPHMT.png

 

edit i try change the name its no load too

Edited by angelingh
  • 0
Posted (edited)

using TAB

 

not Spacebar in first line of scripts.

 

prontera,156,184,0>>TAB HERE<<script>>TAB HERE<<YOUR_NPC_NAME>>TAB HERE<<899,{

Edited by TARTs
  • 0
Posted

using TAB

 

not Spacebar in first line of scripts.

 

prontera,156,184,0>>TAB HERE<<script>>TAB HERE<<YOUR_NPC_NAME>>TAB HERE<<899,{

ty now its load the npc

i need do someting for make its walk? its no moveing

  • 0
Posted (edited)

 

npc 1

prontera,155,175,5	script	Sample#npc1	4_F_KAFRA9,{
	
	mes "Do you want Carrot?";
	if ( select( "Trade my Apple to Carrots","Cancel" ) == 1 ) {
		input .@count,0,countitem( 512 );
		if ( .@count ) {
			getitem 515,.@count;
			delitem 512,.@count;
		}
		mes "Exchanged "+.@count+"x Apple to Carrot";
	}
	close;
	
	OnInit:
		npcspeed 200;
		getmapxy( .npc_map$, .npc_x, .npc_y,1 );
		initnpctimer;
		end;
		
	OnTimer10000:
		.@x = .npc_x + rand( -10,10 );
		.@y = .npc_y + rand( -10,10 );
		npcwalkto .@x,.@y;
		setnpctimer 0;
		end;
}

npc 2

prontera,155,175,5	script	Sample#npc2	4_F_KAFRA9,{
	
	mes "Do you have apple?";
	if ( select( "Sell Apple to NPC","Cancel" ) == 1 ) {
		input .@count,0,countitem( 512 );
		if ( .@count ) {
			delitem 512,.@count;
			Zeny += ( .@count * 1000000 );
		}
		mes "Sold "+.@count+"x Apple to NPC";
	}
	close;
	
	OnInit:
		waitingroom "B>Apple for 1M",0;
		npcspeed 200;
		getmapxy( .npc_map$, .npc_x, .npc_y,1 );
		initnpctimer;
		end;
		
	OnTimer10000:
		.@x = .npc_x + rand( -10,10 );
		.@y = .npc_y + rand( -10,10 );
		npcwalkto .@x,.@y;
		setnpctimer 0;
		end;
}

 

ty !!! :)

 

just question i test the first one and its move only one time? its have timer for moveing?

 

npc 1

prontera,155,175,5	script	Sample#npc1	4_F_KAFRA9,{
	
	mes "Do you want Carrot?";
	if ( select( "Trade my Apple to Carrots","Cancel" ) == 1 ) {
		input .@count,0,countitem( 512 );
		if ( .@count ) {
			getitem 515,.@count;
			delitem 512,.@count;
		}
		mes "Exchanged "+.@count+"x Apple to Carrot";
	}
	close;
	
	OnInit:
		npcspeed 200;
		getmapxy( .npc_map$, .npc_x, .npc_y,1 );
		initnpctimer;
		end;
		
	OnTimer10000:
		.@x = .npc_x + rand( -10,10 );
		.@y = .npc_y + rand( -10,10 );
		npcwalkto .@x,.@y;
		setnpctimer 0;
		end;
}

npc 2

prontera,155,175,5	script	Sample#npc2	4_F_KAFRA9,{
	
	mes "Do you have apple?";
	if ( select( "Sell Apple to NPC","Cancel" ) == 1 ) {
		input .@count,0,countitem( 512 );
		if ( .@count ) {
			delitem 512,.@count;
			Zeny += ( .@count * 1000000 );
		}
		mes "Sold "+.@count+"x Apple to NPC";
	}
	close;
	
	OnInit:
		waitingroom "B>Apple for 1M",0;
		npcspeed 200;
		getmapxy( .npc_map$, .npc_x, .npc_y,1 );
		initnpctimer;
		end;
		
	OnTimer10000:
		.@x = .npc_x + rand( -10,10 );
		.@y = .npc_y + rand( -10,10 );
		npcwalkto .@x,.@y;
		setnpctimer 0;
		end;
}

 

 

using TAB

 

not Spacebar in first line of scripts.

 

prontera,156,184,0>>TAB HERE<<script>>TAB HERE<<YOUR_NPC_NAME>>TAB HERE<<899,{

 

 

ty its work good now !! :)

 

someone know where i can get all jobs walk npc id? i mean Sprite

  Edited by angelingh

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