Jump to content
  • 0

Item Swap


Question

Posted

Hey guys, can i request this kind of script? I am having issue on how to start on it.

How it works, is

  1. If player got the item from any of the list, he/she can select to switch it 1:1 from the same list.
    • list example: setarray .item_list, 32037,32031,32326,32035,32034,32032,32033,32036,32325,32324;
    • I was hoping if possible to make 3 different list for it.

Thank you so much.

5 answers to this question

Recommended Posts

  • 0
Posted
-	script	item_swap	-1,{
	for(.@i = 0; .@i < .size; .@i++){
		.@menu$ += "List " + (.@i+1) + ":";
	}
	mes "Select a list.";
	next;
	.@s = select(.@menu$) - 1;
	explode(.@item$,.item_list$[.@s],",");
	for(.@i = 0; .@i < getarraysize(.@item$); .@i++){
		.@id = atoi(.@item$[.@i]);
		.@item[.@i] = .@id;
		if(countitem(.@id)){
			.@temp[getarraysize(.@temp)] = .@id;
			.@data$ += getitemname(.@id) + ":";		
		} else {
			continue;
		}
	}
	mes "Select the item you want to swap.";
	next;
	.@s = select(.@data$) - 1;
	.@swap_id = .@temp[.@s];
	.@index = inarray(.@item,.@swap_id);
	for(.@i = 0; .@i < getarraysize(.@item); .@i++){
		if(.@i == .@index) continue;
		.@swap[getarraysize(.@swap)] = .@item[.@i];
		.@swap$ += getitemname(.@item[.@i]) + ":";
	}
	mes "select the item you want to swap into.";
	next;
	.@s = select(.@swap$) - 1;
	delitem .@swap_id,1;
	getitem .@swap[.@s],1;
	end;
	
OnInit:
	setarray .item_list$,"501,502,503,504,505","506,507,508,509,510";
	.size = getarraysize(.item_list$);
	end;
}

Haven't tested this but pretty sure it will work..

  • Love 1
  • 0
Posted
2 hours ago, crazyarashi said:

-	script	item_swap	-1,{
	for(.@i = 0; .@i < .size; .@i++){
		.@menu$ += "List " + (.@i+1) + ":";
	}
	mes "Select a list.";
	next;
	.@s = select(.@menu$) - 1;
	explode(.@item$,.item_list$[.@s],",");
	for(.@i = 0; .@i < getarraysize(.@item$); .@i++){
		.@id = atoi(.@item$[.@i]);
		.@item[.@i] = .@id;
		if(countitem(.@id)){
			.@temp[getarraysize(.@temp)] = .@id;
			.@data$ += getitemname(.@id) + ":";		
		} else {
			continue;
		}
	}
	mes "Select the item you want to swap.";
	next;
	.@s = select(.@data$) - 1;
	.@swap_id = .@temp[.@s];
	.@index = inarray(.@item,.@swap_id);
	for(.@i = 0; .@i < getarraysize(.@item); .@i++){
		if(.@i == .@index) continue;
		.@swap[getarraysize(.@swap)] = .@item[.@i];
		.@swap$ += getitemname(.@item[.@i]) + ":";
	}
	mes "select the item you want to swap into.";
	next;
	.@s = select(.@swap$) - 1;
	delitem .@swap_id,1;
	getitem .@swap[.@s],1;
	end;
	
OnInit:
	setarray .item_list$,"501,502,503,504,505","506,507,508,509,510";
	.size = getarraysize(.item_list$);
	end;
}

Haven't tested this but pretty sure it will work..

Thank you so much, Working perfectly!

  • 0
Posted
On 9/25/2019 at 8:32 AM, DevMarikuLabsan said:

Hi, @Radian how this works? Thanks? Is this commandable? like @swap to swap the equipment? can you explain hehe

No. It's an npc that allow players to switch from Headgear1 to Headgear2, Headgear3 or Headgear4

@crazyarashi Hi, Where do i need to change if i want to keep the refine + cards of the old headgear into the new headgear?

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