Jump to content
  • 0

armor upgrading script


Question

Posted

does anyone have a script npc that can upgrade the armor?

 

example:

 

i want to upgrade the Sniper Suit's into a 2 slotted suit..

player will just bring the requirement to get the upgraded item on the npc..

 

does anyone have it?

12 answers to this question

Recommended Posts

Posted
prontera,150,180,4	script	npc name	123,{
	mes "I can turn a "+ getitemname(.before) +" into a "+ getitemname(.after) +"";
	mes "All I need is the following:";
	for(set .@i,0; .@i<.items; set .@i,.@i+1)
		{mes "["+ .amt[.@i] +"]x "+ getitemname(.req[.@i]) +"";}
	if(switch(select("Turn in items:Cancel"))==2){close;}
	Case 1:
	for(set .@j,0; .@j<.items; set .@j,.@j+1)
		{if(countitem(.req[.@j]) < .amt[.@j]){mes "You don't have enough, "+ getitemname(.req[.@j]) +". You have ^FF0000"+ countitem(.req[.@j]) +"/"+ .amt[.@j] +""; close;}}
	for(set .@a,0; .@a<.items; set .@a,.@a+1)
		{delitem(.req[.@a],.@amt[.@a]);}
	getitem(.after,1);
	close;
	OnInit:
	set .before,25500;
	set .after,25508;
	setarray .req[0],501,502,503; //Replace with any items you want, can go upto 128 items.
	setarray .amt[0],1,1,1;//Replace with amount for it's respective item above.
	set .items,getarraysize(.req);
	end;
}

That should do it O.o assuming I have the items right lol.

Posted

Well, before you can do that, you first need to create the 2slotted item and add it to your db. When you have done that, post back with your custom items IDs and you'll be able to get further assistance.

Posted

Well, before you can do that, you first need to create the 2slotted item and add it to your db. When you have done that, post back with your custom items IDs and you'll be able to get further assistance.

here is the id 25500 to 25508

Posted

oh thanks



prontera,150,180,4	script	npc name	123,{
	mes "I can turn a "+ getitemname(.before) +" into a "+ getitemname(.after) +"";
	mes "All I need is the following:";
	for(set .@i,0; .@i<.items; set .@i,.@i+1)
		{mes "["+ .amt[.@i] +"]x "+ getitemname(.req[.@i]) +"";}
	if(switch(select("Turn in items:Cancel"))==2){close;}
	Case 1:
	for(set .@j,0; .@j<.items; set .@j,.@j+1)
		{if(countitem(.req[.@j]) < .amt[.@j]){mes "You don't have enough, "+ getitemname(.req[.@j]) +". You have ^FF0000"+ countitem(.req[.@j]) +"/"+ .amt[.@j] +""; close;}}
	for(set .@a,0; .@a<.items; set .@a,.@a+1)
		{delitem(.req[.@a],.@amt[.@a]);}
	getitem(.after,1);
	close;
	OnInit:
	set .before,25500;
	set .after,25508;
	setarray .req[0],501,502,503; //Replace with any items you want, can go upto 128 items.
	setarray .amt[0],1,1,1;//Replace with amount for it's respective item above.
	set .items,getarraysize(.req);
	end;
}

That should do it O.o assuming I have the items right lol.

Sir, only 1 item can be traded in this script?

Posted

Okay, I think this should be it..

prontera,150,180,4	script	npc name	123,{
	mes "I can upgrade items into a more powerful version.";
	mes "Interested?";
	if(select("Yes!:Not in the slightest")==2){close;}
	next;
	mes "What Item do you want to make?";
	set .@a,1;
	while(.@a != .total)
		{set .@menu$,""+ getitemname( getd(".item"+.@a+"[0]") ) +"";}
	select(.@menu$);
	next;
	mes "All I need is the following:";
	set .@i,2;
	set .@menu,@menu;
	mes "[1]x "+ getitemname(getd(".item"+.@menu+"[0]")) +"";
	while(getd(".item"+.@menu+"["+.@i+"]"))
		{mes "["+ getd(".item"+.@menu+"["+(.@i+1)+"]") +"]x "+ getitemname( getd(".item"+.@menu+"["+.@i+"]") ) +""; set .@i,.@i+2;}
	if(select("Turn in items:Cancel")==2){close;}
	set .@i,2;
	if(!countitem( getd(".item"+.@menu+"[0]") ){mes "You need to have 1, "+ getitemname(getd(".item"+.@menu+"[0]")) +""; close;}
	while(getd(".item"+.@menu+"["+.@i+"]"))
		{if(countitem(getd(".item"+.@menu+"["+.@i+"]")) < getd(".item"+.@menu+"["+(.@i+1)+"]"))
			{mes "You don't have enough, "+ getitemname(getd(".item"+.@menu+"["+.@i+"]")) +". You have ^FF0000"+ countitem(getd(".item"+.@menu+"["+.@i+"]")) +"/"+ getd(".item"+.@menu+"["+(.@i+1)+"]") +""; close;}}
	set .@i,2;
	while(getd(".item"+.@menu+"["+.@i+"]"))
		{delitem( getd(".item"+.@menu+"["+.@i+"]"), getd(".item"+.@menu+"["+(.@i+1)+"]") );}
	delitem(getd(".item"+.@menu+"[0]"),1);
	getitem(getd(".item"+.@menu+"[1]"),1);
	close;
	OnInit:
	//[0] = Old Item | [1] = New Item | [2] = ItemReq1 | [3] = ItemAmt1 | [4] = ItemReq2 | etc...
	setarray .item1[0],25500,25508,501,1,502,1,503,1;
	setarray .item2[0],olditem,newitem,req1,amt1,req2,amt2,etc,...;
	set .total,2; //Set to number of arrays made.
	end;
}

I'm going to go to sleep now. So if there are any errors, than maybe someone else will be able to fix them for you in the mean time. At any rate, this script should allow you to have as many items as you like, however, your limited to 64 Requirements per item.

Ex: To make a Orange Potion, I can only set 64 ' different ' required items each with their own amount.

 

Should be more than enough for something like this lol.

Posted

uhm why i can't click the npc?? i mean nothing happen when im clicking the npc



Line 20 miss a bracket

->

if(!countitem( getd(".item"+.@menu+"[0]") ) ) {mes "You need to have 1, "+ getitemname(getd(".item"+.@menu+"[0]")) +""; close;}

no error now but nothing happen when clicking the npc



aww error

 

 

[Error]: run_script: infinity loop !
[Debug]: Source (NPC): Yii Haruka at force_2-3 (96,190)
Posted (edited)

Lol, my bad... looks like I really was tired writing this @.@;

give me a moment and i'll fix it

 

Edit: Here you go, you'll notice that I did change the array set up around, I had them backwards lol... I coded it 1 way, while telling you to put it in another way lmao..(note to self - stop writing scripts while falling asleep).

prontera,150,180,4	script	npc name	123,{
	mes "I can upgrade items into a more powerful version.";
	mes "Interested?";
	if(select("Yes!:Not in the slightest")==2){close;}
	next;
	mes "What Item do you want to make?";
	set .@a,1;
	set .@menu$,""+ getitemname(getd(".item"+.@a+"[0]")) +"";
	while(.@a != .total)
		{set .@a,.@a+1; set .@menu$,.@menu$ + ":"+ getitemname( getd(".item"+.@a+"[0]") ) +"";}
	select(.@menu$);
	next;
	mes "All I need is the following:";
	set .@i,2;
	set .@menu,@menu;
	mes "[1]x "+ getitemname(getd(".item"+.@menu+"[1]")) +"";
	while(getd(".item"+.@menu+"["+.@i+"]"))
		{mes "["+ getd(".item"+.@menu+"["+(.@i+1)+"]") +"]x "+ getitemname( getd(".item"+.@menu+"["+.@i+"]") ) +""; set .@i,.@i+2;}
	if(select("Turn in items:Cancel")==2){close;}
	set .@i,2;
	if(!countitem( getd(".item"+.@menu+"[1]") )){mes "You need to have 1, "+ getitemname(getd(".item"+.@menu+"[1]")) +""; close;}
	while(getd(".item"+.@menu+"["+.@i+"]"))
		{if(countitem(getd(".item"+.@menu+"["+.@i+"]")) < getd(".item"+.@menu+"["+(.@i+1)+"]"))
			{mes "You don't have enough, "+ getitemname(getd(".item"+.@menu+"["+.@i+"]")) +". You have ^FF0000"+ countitem(getd(".item"+.@menu+"["+.@i+"]")) +"/"+ getd(".item"+.@menu+"["+(.@i+1)+"]") +""; close;}
			set .@i,.@i+2;}
	set .@i,2;
	while(getd(".item"+.@menu+"["+.@i+"]"))
		{delitem( getd(".item"+.@menu+"["+.@i+"]"), getd(".item"+.@menu+"["+(.@i+1)+"]") ); set .@i,.@i+2;}
	delitem(getd(".item"+.@menu+"[1]"),1);
	getitem(getd(".item"+.@menu+"[0]"),1);
	close;
	OnInit:
	//[0] = New Item | [1] = Old Item | [2] = ItemReq1 | [3] = ItemAmt1 | [4] = ItemReq2 | etc...
	setarray .item1[0],505,504,501,1,502,1,503,1;
	setarray .item2[0],506,504,501,1,502,1,503,1;
	//setarray .item3[0],olditem,newitem,req1,amt1,req2,amt2,etc,...;
	set .total,2; //Set to number of arrays made.
	end;
}
Edited by GmOcean
Posted

Lol, my bad... looks like I really was tired writing this @.@;

give me a moment and i'll fix it

 

Edit: Here you go, you'll notice that I did change the array set up around, I had them backwards lol... I coded it 1 way, while telling you to put it in another way lmao..(note to self - stop writing scripts while falling asleep).

prontera,150,180,4	script	npc name	123,{
	mes "I can upgrade items into a more powerful version.";
	mes "Interested?";
	if(select("Yes!:Not in the slightest")==2){close;}
	next;
	mes "What Item do you want to make?";
	set .@a,1;
	set .@menu$,""+ getitemname(getd(".item"+.@a+"[0]")) +"";
	while(.@a != .total)
		{set .@a,.@a+1; set .@menu$,.@menu$ + ":"+ getitemname( getd(".item"+.@a+"[0]") ) +"";}
	select(.@menu$);
	next;
	mes "All I need is the following:";
	set .@i,2;
	set .@menu,@menu;
	mes "[1]x "+ getitemname(getd(".item"+.@menu+"[1]")) +"";
	while(getd(".item"+.@menu+"["+.@i+"]"))
		{mes "["+ getd(".item"+.@menu+"["+(.@i+1)+"]") +"]x "+ getitemname( getd(".item"+.@menu+"["+.@i+"]") ) +""; set .@i,.@i+2;}
	if(select("Turn in items:Cancel")==2){close;}
	set .@i,2;
	if(!countitem( getd(".item"+.@menu+"[1]") )){mes "You need to have 1, "+ getitemname(getd(".item"+.@menu+"[1]")) +""; close;}
	while(getd(".item"+.@menu+"["+.@i+"]"))
		{if(countitem(getd(".item"+.@menu+"["+.@i+"]")) < getd(".item"+.@menu+"["+(.@i+1)+"]"))
			{mes "You don't have enough, "+ getitemname(getd(".item"+.@menu+"["+.@i+"]")) +". You have ^FF0000"+ countitem(getd(".item"+.@menu+"["+.@i+"]")) +"/"+ getd(".item"+.@menu+"["+(.@i+1)+"]") +""; close;}
			set .@i,.@i+2;}
	set .@i,2;
	while(getd(".item"+.@menu+"["+.@i+"]"))
		{delitem( getd(".item"+.@menu+"["+.@i+"]"), getd(".item"+.@menu+"["+(.@i+1)+"]") ); set .@i,.@i+2;}
	delitem(getd(".item"+.@menu+"[1]"),1);
	getitem(getd(".item"+.@menu+"[0]"),1);
	close;
	OnInit:
	//[0] = New Item | [1] = Old Item | [2] = ItemReq1 | [3] = ItemAmt1 | [4] = ItemReq2 | etc...
	setarray .item1[0],505,504,501,1,502,1,503,1;
	setarray .item2[0],506,504,501,1,502,1,503,1;
	//setarray .item3[0],olditem,newitem,req1,amt1,req2,amt2,etc,...;
	set .total,2; //Set to number of arrays made.
	end;
}

ok boss i will try later thanks

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