(SOLVED) RoomInv Module Issues (not displaying item dropped)

Started by Vault15, Fri 26/10/2012 23:24:07

Previous topic - Next topic

Vault15

Sorry if you had just helped me with my previous method. It's pointless when I can just figure out this module. I set the iSMG with the cSMG(character) using the module script, but what I can't figure out is how the item is displayed.

I set the cSMG location to display coordinates with every click so that I could track it. It just stays in the current room at the default location.

I took a look at the RoomInv script to see what it actually does and apparently it's very automated so I really shouldn't have to do very much besides setting the InventoryItem to link the Character to.

Module Link:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=28770

Code: AGS


//If player brings grabbed item to the DropItem area (I haven't made it where player has to click it yet)

if(GUIControl.GetAtScreenXY(mouse.x, mouse.y) == DropItem && Mouse.Mode == eModeUseinv)
{    
     RoomInv[1].AddInventory(player.ActiveInventory); // add the item to room 1
     RoomInv[1].SetCharacterToUse(player.ActiveInventory, cSMG); //This should make cSMG auto change rooms to where the player is at, right?
     
     cEgo.DropInventoryItem(player.ActiveInventory, 1); //I figured this would work to display the item, but I don't see anything.
     
     //Inventory windows close
     gInventory.Visible = false;
     gInventory2.Visible = false;
     gInventory3.Visible = false;
     
}



The module has this in the ReadMe:

"
bool Character::DropInventory()
  Drops all of the character's inventory items into the current room. This will remove
  the items from the character's inventory.

bool Character::DropInventoryItem(InventoryItem*, optional int quantity)
  Drops the specified item into the character's current room (if the character was
  carrying the item). QUANTITY may be used to drop more than one of the item at once.

bool RoomInv[INDEX].SetCharacterToUse(InventoryItem*, Character*, optional int x,
optional int y)
  Sets the character to be used by the specified inventory item within the room
  specified by INDEX. In this way it is possible to show the room's inventory as
  "objects" that you can interact with.

bool RoomInv[INDEX].SetInventoryQuantity(InventoryItem*, int quantity)
  Sets the inventory quantity of the specified item in the room specified by INDEX to
  QUANTITY.
"

and others. I also went through the main post to see if I could get it working.


There's just something I'm leaving out or not understanding fully. I just would like to finally get this drop item method working.

Thanks to those helping repeatedly. It means a lot  :)

Khris

The main purpose of the module is to add inventories to rooms; displaying them is completely optional and according to the module's thread, in order to do so, you have to manually place the assigned character.
In other words, after calling player.DropInventoryItem(...), you need to call:
Code: ags
  cSMG.ChangeRoom(player.Room, player.x, player.y + 3);

(You can of course add this line to the module's function, using the Character* variable of the function instead of cSMG.)

Vault15

Quote from: Khris on Sat 27/10/2012 01:42:30
The main purpose of the module is to add inventories to rooms; displaying them is completely optional and according to the module's thread, in order to do so, you have to manually place the assigned character.
In other words, after calling player.DropInventoryItem(...), you need to call:
Code: ags
  cSMG.ChangeRoom(player.Room, player.x, player.y + 3);

(You can of course add this line to the module's function, using the Character* variable of the function instead of cSMG.)

perfect, thank you!

SMF spam blocked by CleanTalk