You are here

We're currently evaluating new forum software that is meant to replace these here soon. Go have a look.

Remotely opening an inventory?

4 posts / 0 new
Last post
Baaleos
Baaleos's picture
Remotely opening an inventory?

Is it possible to open an inventory window of a chest that is a 'distance' away.
Eg: I am working on making  a 'telekinetic' power.
One of the defining traits would be looting chests at a distance.
Along with opening and closing doors, triggering traps and knocking the odd enemy down via point and click etc.

 

The Inventory window is just my main concern now - wondering if that would require a nwnx bit of code.

 

  • up
    50%
  • down
    50%
meaglyn
meaglyn's picture

I don't know if you could use nwnx to get around the range limits of interaction with an object.

But for what you are doing you could create an invisible inventory placable nearer the PC and copy all the items from the chest to that. Have the PC interact with it to open it. Then you need to adjust the real chest's inventory based on what changed and destroy the invisible one and any remaining copied items when PC closes it.

 

  • up
    100%
  • down
    0%
Proleric
Proleric's picture

You could try spawning an invisible object next to the player, duplicating the chest's inventory, then ActionInteractObject. You'd need OnDisturbed and OnClose scripts to keep the inventories in sync. Haven't tested this, though.

EDIT - ninja'd!

NWN and DAO adventures at http://proleric.com/

  • up
    100%
  • down
    0%
Baaleos
Baaleos's picture

There does seem to be some 'interesting' methods in the nwserver itself that may facilitate this.

  • 0805376c T CNWSPlayerInventoryGUI::CNWSPlayerInventoryGUI(void)
  • 08053804 T CNWSPlayerInventoryGUI::SetOpen(int)
  • 0805385c T CNWSPlayerContainerGUI::SetNextPage(CNWSPlayer *)
  • 080538c8 T CNWSPlayerContainerGUI::SetPreviousPage(CNWSPlayer *)
  • 08053928 T CNWSPlayerContainerGUI::SetOpen(CNWSPlayer *, unsigned long, int)   <-- Probably the one that gets used for DM viewing players inventories.
 


The way I imagine this working, would be a user opens their inventory - which creates the CNWSPlayerInventoryGUI (which is a field on the player themselves)
If I were to change the owner of the GUIObject - it might change the inventory it is displaying.
At this stage its conjecture though.
Dungeon Masters do it somehow - I suspect through the last method above.
Eg: CNWSPlayerContainerGUI is already bound to the player object, so it doesn't make much sense for it to have both a CNWSPlayer object AND an unsigned long as arguments.
The unsigned long is most likely the object or inventory object who is being viewed, and the int - not entirely sure, possibly a 1 or 0 to open or close the inventory?

  • up
    50%
  • down
    50%