Jump to content

Give 2 use cases to a TYPE_USE subtype (drag and right click)


Recommended Posts

Hello guys,

I need some help. I want to create an item which has two functionalities:

1. you can drag the item to another item (named item2) to interact with item2 (e.g. change bonus of the item2)

2. you can right click (means use) the item and receive anything (like a treasure or sth)

At the moment I got this idea:

					case USE_NEW_ITEM:
					{
						LPITEM item2;
						if (!IsValidItemPosition(DestCell))
							return false;
						if (!(item2 = GetItem(DestCell))) { //item right clicked
							if (test_server) ChatPacket(CHAT_TYPE_INFO, "item used");
						}
						else { //item dropped to pet seal
							if (!item2) return false;
							if (item2->IsExchanging() || item2->IsEquipped())
								return false;
							if (test_server) ChatPacket(CHAT_TYPE_INFO, "item dragged");

						}
						break;
					}

With this code only the dragging works but the using (rightclicking) does not.

 

Do you know anything I could change?

solved myself: the problem was that I tried to check 

if (!IsValidItemPosition(DestCell))
							return false;

before making sure I really drag the item on another item

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.