CopyObject - Gold
4BOLTMAIN
Member Posts: 90
I have come across an issue that when a player drops gold on a placeable object that does not have inventory the gold is removed from the players inventory and even though the gold does show in the objects inventory through checking with a script, there is no way for a player to retrieve the gold that they lost due to "misclicking" an object with no inventory.
I am not sure if I am explaining that right so...
A player drops gold on an object that does not have any inventory (the box has inventory not checked in the toolset).
The gold is removed from the players inventory.
The player can not click on the object to open its inventory since has inventory in the toolset is not checked for the object.
I can run a script to cycle through the objects inventory and the script does show that the object does have the players dropped gold in its inventory.
If gold is dropped multiple times on the object the script returns each one, it does not stack into one item.
Over the years I have figured out that if I use CopyItem for gold that has been dropped I can copy gold that has been dropped in an area to a chest and the amount of gold remains the same.
On the modules unacquire script I have scripted it so when this happens the gold is returned to the player using CopyItem but this makes it look like their action failed because nothing happens, you cant even see the gold amount change in the inventory screen.
However, I am fussy about things and I want to make it look like the player actually dropped the gold on the ground.
When I use CopyObject to copy the gold to the players location it does work but the amount of gold is not correct. When testing I can drop up to 65,535 gold and the amount copied is correct.
Any amount over 65,536 does not copy the exact amount of gold. If I drop 70,000 gold I only see 4,464 gold (funny thing is that 70,000 - 4,464 = 65,536)
There are a few other things that I have done to make sure the player can retrieve their gold but for simplicity I am wondering how I can make it look like the player dropped their gold on the ground and have CopyObject not change the amount of gold that was dropped?
I am not sure if I am explaining that right so...
A player drops gold on an object that does not have any inventory (the box has inventory not checked in the toolset).
The gold is removed from the players inventory.
The player can not click on the object to open its inventory since has inventory in the toolset is not checked for the object.
I can run a script to cycle through the objects inventory and the script does show that the object does have the players dropped gold in its inventory.
If gold is dropped multiple times on the object the script returns each one, it does not stack into one item.
Over the years I have figured out that if I use CopyItem for gold that has been dropped I can copy gold that has been dropped in an area to a chest and the amount of gold remains the same.
On the modules unacquire script I have scripted it so when this happens the gold is returned to the player using CopyItem but this makes it look like their action failed because nothing happens, you cant even see the gold amount change in the inventory screen.
However, I am fussy about things and I want to make it look like the player actually dropped the gold on the ground.
When I use CopyObject to copy the gold to the players location it does work but the amount of gold is not correct. When testing I can drop up to 65,535 gold and the amount copied is correct.
Any amount over 65,536 does not copy the exact amount of gold. If I drop 70,000 gold I only see 4,464 gold (funny thing is that 70,000 - 4,464 = 65,536)
There are a few other things that I have done to make sure the player can retrieve their gold but for simplicity I am wondering how I can make it look like the player dropped their gold on the ground and have CopyObject not change the amount of gold that was dropped?
0
Comments
I created a loot bag in the toolset with inventory.
On the unacquire script I checked if the item was gold and if the object possessor contained inventory.
If the item was gold and the object did not contain inventory I created the loot bag at the pc's location and then copied the item (gold) to the loot bag.
If the loot bag was empty on closed then it was destroyed.
If the intention is for the PC to retrieve items from the chest by opening it, that's the simplest solution.
Alternatively, you could use CreateItemOnObject() for gold. I have this working for chests with
The maximum stack size for gold is 65,535 (64k - 1) so scripts that copy gold to a placeable's inventory need to look something like this: I prefer to use 50000 because I like round numbers.
So rather than just using CopyItem to copy the gold back to the players inventory in the unacquire script, I wanted something that looked like factory game mechanics. After several hours of testing and trying different things I found the best option was to create a loot bag at the players location, have the player do a GET_LOW animation and then use CopyItem to copy the lost gold (oItem) to the loot bag. The loot bag is destroyed if it has no inventory after the gold is retrieved from it.
I am having a hard time understanding why CopyItem works with gold no matter what the amount is but CopyObject doesnt. Obviously if CopyItem could use a location like CopyObject that would be ideal but with a little more work I have it working like I want.
TR
I'm glad you've been able to find a working fix. I had no such luck trying to block pick-pocketing. When it comes to gold, there's no way to deal with it.
The main objects are weapon racks that players use to choose different options for merchants when buying and selling items. Every usable object with no inventory has a purpose.
Yeah, I would never do this but there's always that one person who likes to try things and then carry on about it in shout, lol!
During testing I noticed that you can not drop gold on doors or transitions. What is strange is when I try to drop gold on a dungeon portal it opens the conversation and doesn't remove any gold. The weapon racks are set up to open a conversation also but your gold is removed. All the flags on both objects are exactly the same, the scripts follow the same format (clear actions, then start conversation) but yet they behave differently... SOLVED: After a few minutes of looking at the area both objects do the same thing. I have a trigger around the portal that also opens the conversation when you get near it so the trigger was clearing the actions before my character would actually reach the portal to drop the gold. Good to know.
I removed the PVP aspect from my module in 1.69. There was just too much drama for me to keep up with. I think we all can agree that there are certain things missing that would make PVP a lot easier to admin but that's another topic.
Thanks for the response everyone. I appreciate the feedback and comments.
It's really weird that you can drop gold into the inventory of a no-inventory placeable object in the first place. That sounds like a bug to me.
If you want to use the script, you can just remove the else and the bracketed section after it. If you don't want or need feedback, then erase the speakstring line.
No-feedback, gold-only script: