Jump to content
  • 0

Command to recall npc script did not work


Question

Posted (edited)

as title said, i was trying to add @craft command so that player can call the npc from any map, but for dumb reason it did not work. here are the details.

Spoiler

image.thumb.png.cc146a9588aece8e90de1c5cb469b12f.png

and here are the script:

Spoiler
neko_isle,77,127,4	script	Crafter	826,{

	OnAtcommand:
	mes "^00c000Master Craft^000000";
	mes "Please select which would you like to craft";
	next;
	switch(select("- Weapon:- Armor:- Headgear:- Accessories:- Shield:- Garment:- Footgear:- Usable Item:- Exit"))
	{
		case 1:
			mes "^00c000Master Craft^000000";
			mes "Please select which would you like to craft";
			next;
			switch(select("- Dagger:- 1 Hand Swords:- 2 Hand Swords:- 1 Hand Spear:- 2 Hand Spear:- 1 Hand Axe:- 2 Hand Axe:- Mace:- 1 Hand Staff:- 2 Hand Staff:- Bow:- Knuckle:- Musical Weapons:- Whip:- Book:- Katar:- Revolver:- Rifle:- Gatling Gun:- Shot Gun:- Grenade Luncher:- Shuriken:- Exit"))
			{
			case 1:
			mes "^00c000Master Craft^000000";
			mes "Just give me the required items and ill give you Coin of Ymir.";
			mes "Required Mats per ^FF0000"+getitemname(.GiveItem)+"^000000:";
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
			mes "- ^FF0000"+.Item[.@i+1]+" "+getitemname(.Item[.@i]);
			next;
			if( select("Make ^FF0000"+getitemname( .GiveItem )+"^000000:Cancel") == 2 ) end;
			mes "[Ymir Coin Exchanger]";
			mes "How many would you like to make?";
			next;
			input .@amount,1,999;
			mes "[Ymir Coin Exchanger]";
			mes .@amount+"x ^FF0000"+getitemname(.GiveItem)+"^000000, is this correct?";
			next;
			if( select("Yes, Make ^FF0000"+.@amount+" "+getitemname( .GiveItem )+"^000000:Cancel") == 2 ) end;
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
			if( countitem( .Item[.@i] ) < .Item[.@i+1]*.@amount ){
			mes "[Ymir Coin Exchanger]";
			mes "Insufficient Materials";
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
				mes "- Need ( "+countitem(.Item[.@i])+"/"+.Item[.@i + 1]*.@amount+" ) "+getitemname( .Item[.@i] );
			end;
			}
			if(!checkweight(.GiveItem,.@amount)){
			mes "Insufficient inventory space or weight.";
			end;
			}
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
			delitem .Item[ .@i ],.Item[ .@i + 1 ]*.@amount;
			getitem .GiveItem,.@amount;
			mes "[Ymir Coin Exchanger]";
			mes "You have Made ^FF0000"+.@amount+"x "+getitemname( .GiveItem )+"^000000";
			announce "["+strcharinfo(0)+"] has made "+.@amount+"x ["+getitemname( .GiveItem )+"]",0;
			close;

			OnInit:
			bindatcmd "craft","Crafter::OnAtcommand";
			// What Item you want to Make ?
			set .GiveItem,7539;
			// Item Requirements + Amounts
			setarray .Item[0],
			607,1,
			608,1,
			512,1;
			end;
			
			case 2:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Swords";
			end;
			case 3:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Swords";
			end;
			case 4:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Spear";
			end;
			case 5:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Spear";
			end;
			case 6:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Axe";
			end;
			case 7:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Axe";
			end;
			case 8:
			mes "^00c000Master Craft^000000";
			mes "Mace";
			end;
			case 9:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Staff";
			case 10:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Staff";
			end;
			case 11:
			mes "^00c000Master Craft^000000";
			mes "Bow";
			end;
			case 12:
			mes "^00c000Master Craft^000000";
			mes "Knuckle";
			end;
			case 13:
			mes "^00c000Master Craft^000000";
			mes "Musical Weapons";
			end;
			case 14:
			mes "^00c000Master Craft^000000";
			mes "Whip";
			end;
			case 15:
			mes "^00c000Master Craft^000000";
			mes "Book";
			end;
			case 16:
			mes "^00c000Master Craft^000000";
			mes "Katar";
			end;
			case 17:
			mes "^00c000Master Craft^000000";
			mes "Revolver";
			end;
			case 18:
			mes "^00c000Master Craft^000000";
			mes "Rifle";
			end;
			case 19:
			mes "^00c000Master Craft^000000";
			mes "Gatling Gun";
			end;
			case 20:
			mes "^00c000Master Craft^000000";
			mes "Shot Gun";
			end;
			case 21:
			mes "^00c000Master Craft^000000";
			mes "Grenade Luncher";
			end;
			case 22:
			mes "^00c000Master Craft^000000";
			mes "Shuriken";
			end;
			case 23:
			mes "^00c000Master Craft^000000";
			mes "Good Bye";
			close;
		
			}
		case 2:
			warp "payon",165,59; // Change this warp coordinates
			end;
		case 3:
			warp "morocc",160,85; // Change this warp coordinates
			end;
		case 4:
			warp "geffen",119,67; // Change this warp coordinates
			end;
		case 5:
			warp "alberta",117,57; // Change this warp coordinates
			end;
		case 6:
			warp "aldebaran",141,114; // Change this warp coordinates
			end;
		case 7:
			warp "comodo",196,143; // Change this warp coordinates
			end;
		case 8:
			warp "izlude",127,107; // Change this warp coordinates
			end;
		case 9:
			mes "[Rohayu]";
			mes "Well if you need warp just come look for me";
			mes "Good Bye";
			close;
		
	}


}

 

and yeah the script is not well polished, if anyone could polish it for me that would be very nice.

the idea was for player to use command @craft and it will lay out the script for the player no matter where he is in the server

thanks

Edited by Dolphin86

2 answers to this question

Recommended Posts

  • 0
Posted
1 hour ago, Dolphin86 said:

as title said, i was trying to add @craft command so that player can call the npc from any map, but for dumb reason it did not work. here are the details.

  Reveal hidden contents

image.thumb.png.cc146a9588aece8e90de1c5cb469b12f.png

and here are the script:

  Reveal hidden contents
neko_isle,77,127,4	script	Crafter	826,{

	OnAtcommand:
	mes "^00c000Master Craft^000000";
	mes "Please select which would you like to craft";
	next;
	switch(select("- Weapon:- Armor:- Headgear:- Accessories:- Shield:- Garment:- Footgear:- Usable Item:- Exit"))
	{
		case 1:
			mes "^00c000Master Craft^000000";
			mes "Please select which would you like to craft";
			next;
			switch(select("- Dagger:- 1 Hand Swords:- 2 Hand Swords:- 1 Hand Spear:- 2 Hand Spear:- 1 Hand Axe:- 2 Hand Axe:- Mace:- 1 Hand Staff:- 2 Hand Staff:- Bow:- Knuckle:- Musical Weapons:- Whip:- Book:- Katar:- Revolver:- Rifle:- Gatling Gun:- Shot Gun:- Grenade Luncher:- Shuriken:- Exit"))
			{
			case 1:
			mes "^00c000Master Craft^000000";
			mes "Just give me the required items and ill give you Coin of Ymir.";
			mes "Required Mats per ^FF0000"+getitemname(.GiveItem)+"^000000:";
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
			mes "- ^FF0000"+.Item[.@i+1]+" "+getitemname(.Item[.@i]);
			next;
			if( select("Make ^FF0000"+getitemname( .GiveItem )+"^000000:Cancel") == 2 ) end;
			mes "[Ymir Coin Exchanger]";
			mes "How many would you like to make?";
			next;
			input .@amount,1,999;
			mes "[Ymir Coin Exchanger]";
			mes .@amount+"x ^FF0000"+getitemname(.GiveItem)+"^000000, is this correct?";
			next;
			if( select("Yes, Make ^FF0000"+.@amount+" "+getitemname( .GiveItem )+"^000000:Cancel") == 2 ) end;
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
			if( countitem( .Item[.@i] ) < .Item[.@i+1]*.@amount ){
			mes "[Ymir Coin Exchanger]";
			mes "Insufficient Materials";
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
				mes "- Need ( "+countitem(.Item[.@i])+"/"+.Item[.@i + 1]*.@amount+" ) "+getitemname( .Item[.@i] );
			end;
			}
			if(!checkweight(.GiveItem,.@amount)){
			mes "Insufficient inventory space or weight.";
			end;
			}
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
			delitem .Item[ .@i ],.Item[ .@i + 1 ]*.@amount;
			getitem .GiveItem,.@amount;
			mes "[Ymir Coin Exchanger]";
			mes "You have Made ^FF0000"+.@amount+"x "+getitemname( .GiveItem )+"^000000";
			announce "["+strcharinfo(0)+"] has made "+.@amount+"x ["+getitemname( .GiveItem )+"]",0;
			close;

			OnInit:
			bindatcmd "craft","Crafter::OnAtcommand";
			// What Item you want to Make ?
			set .GiveItem,7539;
			// Item Requirements + Amounts
			setarray .Item[0],
			607,1,
			608,1,
			512,1;
			end;
			
			case 2:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Swords";
			end;
			case 3:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Swords";
			end;
			case 4:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Spear";
			end;
			case 5:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Spear";
			end;
			case 6:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Axe";
			end;
			case 7:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Axe";
			end;
			case 8:
			mes "^00c000Master Craft^000000";
			mes "Mace";
			end;
			case 9:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Staff";
			case 10:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Staff";
			end;
			case 11:
			mes "^00c000Master Craft^000000";
			mes "Bow";
			end;
			case 12:
			mes "^00c000Master Craft^000000";
			mes "Knuckle";
			end;
			case 13:
			mes "^00c000Master Craft^000000";
			mes "Musical Weapons";
			end;
			case 14:
			mes "^00c000Master Craft^000000";
			mes "Whip";
			end;
			case 15:
			mes "^00c000Master Craft^000000";
			mes "Book";
			end;
			case 16:
			mes "^00c000Master Craft^000000";
			mes "Katar";
			end;
			case 17:
			mes "^00c000Master Craft^000000";
			mes "Revolver";
			end;
			case 18:
			mes "^00c000Master Craft^000000";
			mes "Rifle";
			end;
			case 19:
			mes "^00c000Master Craft^000000";
			mes "Gatling Gun";
			end;
			case 20:
			mes "^00c000Master Craft^000000";
			mes "Shot Gun";
			end;
			case 21:
			mes "^00c000Master Craft^000000";
			mes "Grenade Luncher";
			end;
			case 22:
			mes "^00c000Master Craft^000000";
			mes "Shuriken";
			end;
			case 23:
			mes "^00c000Master Craft^000000";
			mes "Good Bye";
			close;
		
			}
		case 2:
			warp "payon",165,59; // Change this warp coordinates
			end;
		case 3:
			warp "morocc",160,85; // Change this warp coordinates
			end;
		case 4:
			warp "geffen",119,67; // Change this warp coordinates
			end;
		case 5:
			warp "alberta",117,57; // Change this warp coordinates
			end;
		case 6:
			warp "aldebaran",141,114; // Change this warp coordinates
			end;
		case 7:
			warp "comodo",196,143; // Change this warp coordinates
			end;
		case 8:
			warp "izlude",127,107; // Change this warp coordinates
			end;
		case 9:
			mes "[Rohayu]";
			mes "Well if you need warp just come look for me";
			mes "Good Bye";
			close;
		
	}


}

 

and yeah the script is not well polished, if anyone could polish it for me that would be very nice.

the idea was for player to use command @craft and it will lay out the script for the player no matter where he is in the server

thanks

-	script	Crafter_Command	-1,{

	OnInit:
		bindatcmd "craft","Crafter_Command::OnCraftCommand";
		// What Item you want to Make ?
		set .GiveItem,7539;
		// Item Requirements + Amounts
		setarray .Item[0],607,1,608,1,512,1;
		end;

	OnCrafterMenu:
	OnCraftCommand:
	mes "^00c000Master Craft^000000";
	mes "Please select which would you like to craft";
	next;
	switch(select("- Weapon:- Armor:- Headgear:- Accessories:- Shield:- Garment:- Footgear:- Usable Item:- Exit"))
	{
		case 1:
			mes "^00c000Master Craft^000000";
			mes "Please select which would you like to craft";
			next;
			switch(select("- Dagger:- 1 Hand Swords:- 2 Hand Swords:- 1 Hand Spear:- 2 Hand Spear:- 1 Hand Axe:- 2 Hand Axe:- Mace:- 1 Hand Staff:- 2 Hand Staff:- Bow:- Knuckle:- Musical Weapons:- Whip:- Book:- Katar:- Revolver:- Rifle:- Gatling Gun:- Shot Gun:- Grenade Luncher:- Shuriken:- Exit"))
			{
			case 1:
			mes "^00c000Master Craft^000000";
			mes "Just give me the required items and ill give you Coin of Ymir.";
			mes "Required Mats per ^FF0000"+getitemname(.GiveItem)+"^000000:";
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
			mes "- ^FF0000"+.Item[.@i+1]+" "+getitemname(.Item[.@i]);
			next;
			if( select("Make ^FF0000"+getitemname( .GiveItem )+"^000000:Cancel") == 2 ) end;
			mes "[Ymir Coin Exchanger]";
			mes "How many would you like to make?";
			next;
			input .@amount,1,999;
			mes "[Ymir Coin Exchanger]";
			mes .@amount+"x ^FF0000"+getitemname(.GiveItem)+"^000000, is this correct?";
			next;
			if( select("Yes, Make ^FF0000"+.@amount+" "+getitemname( .GiveItem )+"^000000:Cancel") == 2 ) end;
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
			if( countitem( .Item[.@i] ) < .Item[.@i+1]*.@amount ){
			mes "[Ymir Coin Exchanger]";
			mes "Insufficient Materials";
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
				mes "- Need ( "+countitem(.Item[.@i])+"/"+.Item[.@i + 1]*.@amount+" ) "+getitemname( .Item[.@i] );
			end;
			}
			if(!checkweight(.GiveItem,.@amount)){
			mes "Insufficient inventory space or weight.";
			end;
			}
			for( set .@i,0; .@i < getarraysize( .Item ) - 1; set .@i,.@i + 2 )
			delitem .Item[ .@i ],.Item[ .@i + 1 ]*.@amount;
			getitem .GiveItem,.@amount;
			mes "[Ymir Coin Exchanger]";
			mes "You have Made ^FF0000"+.@amount+"x "+getitemname( .GiveItem )+"^000000";
			announce "["+strcharinfo(0)+"] has made "+.@amount+"x ["+getitemname( .GiveItem )+"]",0;
			close;
			
			case 2:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Swords";
			end;
			case 3:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Swords";
			end;
			case 4:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Spear";
			end;
			case 5:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Spear";
			end;
			case 6:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Axe";
			end;
			case 7:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Axe";
			end;
			case 8:
			mes "^00c000Master Craft^000000";
			mes "Mace";
			end;
			case 9:
			mes "^00c000Master Craft^000000";
			mes "1 Hand Staff";
			case 10:
			mes "^00c000Master Craft^000000";
			mes "2 Hand Staff";
			end;
			case 11:
			mes "^00c000Master Craft^000000";
			mes "Bow";
			end;
			case 12:
			mes "^00c000Master Craft^000000";
			mes "Knuckle";
			end;
			case 13:
			mes "^00c000Master Craft^000000";
			mes "Musical Weapons";
			end;
			case 14:
			mes "^00c000Master Craft^000000";
			mes "Whip";
			end;
			case 15:
			mes "^00c000Master Craft^000000";
			mes "Book";
			end;
			case 16:
			mes "^00c000Master Craft^000000";
			mes "Katar";
			end;
			case 17:
			mes "^00c000Master Craft^000000";
			mes "Revolver";
			end;
			case 18:
			mes "^00c000Master Craft^000000";
			mes "Rifle";
			end;
			case 19:
			mes "^00c000Master Craft^000000";
			mes "Gatling Gun";
			end;
			case 20:
			mes "^00c000Master Craft^000000";
			mes "Shot Gun";
			end;
			case 21:
			mes "^00c000Master Craft^000000";
			mes "Grenade Luncher";
			end;
			case 22:
			mes "^00c000Master Craft^000000";
			mes "Shuriken";
			end;
			case 23:
			mes "^00c000Master Craft^000000";
			mes "Good Bye";
			close;
		
			}
		case 2:
			warp "payon",165,59; // Change this warp coordinates
			end;
		case 3:
			warp "morocc",160,85; // Change this warp coordinates
			end;
		case 4:
			warp "geffen",119,67; // Change this warp coordinates
			end;
		case 5:
			warp "alberta",117,57; // Change this warp coordinates
			end;
		case 6:
			warp "aldebaran",141,114; // Change this warp coordinates
			end;
		case 7:
			warp "comodo",196,143; // Change this warp coordinates
			end;
		case 8:
			warp "izlude",127,107; // Change this warp coordinates
			end;
		case 9:
			mes "[Rohayu]";
			mes "Well if you need warp just come look for me";
			mes "Good Bye";
			close;
		
	}

}

function	script	call_crafter	{
	doevent "Crafter_Command::OnCrafterMenu";
	end;
}

neko_isle,77,127,4	script	Crafter	826,{ callfunc "call_crafter"; }


I'm not expert at scripting but i made it work. Tested and works fine.

When i type @craft 

image.thumb.png.50906acfd58699ddf2f0ba119334878d.png

image.thumb.png.fb6f0adacf5244743f55803a37ac182d.png

When i talk to npc:

image.thumb.png.7c05ee977f3aa9841d017bf26d79a09d.png

image.thumb.png.09dfd958fb5eb21068ee1aa6efc3104e.png

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