Jump to content
  • 0

Item Swap


Radian

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

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.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

-	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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

Anyone got an idea how the method works? I'll work on the rest. thank you

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

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!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.02
  • Content Count:  291
  • Reputation:   26
  • Joined:  12/16/17
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

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?

Link to comment
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.   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.

×
×
  • Create New...