jdf318 Posted October 20, 2008 Author Share Posted October 20, 2008 How would I make an item that is used up upon use. Ive tried it before, but I can't seem to get it right.It's for my teleport scroll by the way.Any help apreciated. Link to comment Share on other sites More sharing options...
AdrianC Posted October 20, 2008 Share Posted October 20, 2008 Add this to the bottom of your main.txt:```Sub TakeItem(index, item, value)If value = "all" ThenSLOT = 1Do While SLOT < 25If GetPlayerInvItemNum(index, SLOT) = item ThenCall SetPlayerInvItemNum(index, SLOT, 0)Call SetPlayerInvItemValue(index, SLOT, 0)Call SendInventoryUpdate(index, SLOT)SLOT = 25End IfSLOT = SLOT+1LoopElseSLOT = 1Do While SLOT < 25If GetPlayerInvItemNum(index, SLOT) = item ThenCall SetPlayerInvItemNum(index, SLOT, 0)Call SetPlayerInvItemValue(index, SLOT, GetPlayerInvItemValue(index, SLOT) - value)Call SendInventoryUpdate(index, SLOT)SLOT = 25End IfSLOT = SLOT+1LoopEnd IfEnd Sub```And now you can sayCall TakeItem(index, item#, # of items)to take an item from a player. Link to comment Share on other sites More sharing options...
jdf318 Posted October 21, 2008 Author Share Posted October 21, 2008 Thanks, it worked, but I have one problem with it. It takes all items if its a stackable item. I can manage if I can't make it take only one in a stack, but it would be more helpful if it did. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now