PDA

View Full Version : Giving items from player to another



Ikael
March 11th, 2009, 08:25
Hi, recently I had an idea of making player-to-player item exhanging easier/automated. What I really though was that players could drag any item from his inventorylist and drop it to other player's portrait, which would add it to chosen player's inventorylist and remove it from player who gave it.

I have already done some changes to charsheet inventorylist where each invenrotylistitem has shortcut link (which points to specific item in my item-module). I had successfully done the part that removes item from player who gives the item away to other player by dragging it from his inventorylist on other player's portrait, but the difficulty is how to add it to other player's inventorylist.

I have tried to use findWindow() to find the other player's inventorylist windowinstance which has the function to add new items, but the findWindow returns a nil value. The operation (remove and add) succeeds only if I have both player's inventorylist window's open, but wonder if there would be any easier way to access a other player's windowinstances?

Anybody done/had similar issues?

Foen
March 11th, 2009, 20:35
I think you will run into trouble trying to make this work on the player-side, as players don't have update access to each others' character data (in fact, they don't even have read access by default).

If you are happy to do this only on the GM-side, I'd suggest you do it by copying database nodes rather than trying to access the windowlists. Tenian worked on something similar for the 4e ruleset (copying items to a character sheet inventory) and you might find some pointers on this thread (https://www.fantasygrounds.com/forums/showthread.php?t=8703&page=3).

Cheers

Foen

Ikael
March 11th, 2009, 20:52
Thanks for answering,
I encountered player's access problem and decided the item-exchanging to let it be GM's feature. I did this by calling the openWindow() function to get the windowinstance and called the "add" function using the windowinstance and close() to prevent the window from comming front before I managed to see it.