Dropping inventory items

Started by Kennedy, Wed 27/08/2003 02:12:38

Previous topic - Next topic

Kennedy

Are there any plans to increase the number of objects allowed for each room?
Also I noticed that the objects in the room use the same properties as the rooms themselves rather than having thier own.

Has anybody made a script allowing the player to drop inventory items?
I suppose this could be done by creating an inventory property that stores the item's location.

dtm1980

#1
If you want to have the number of object increased, make a suggestion in the technical forum and call it "Suggestion: Increase number of objects" ...
If you're lucky the inventor of this engine will work on that then, I think there are lots of people who would find it quite useful.

Well, the second point is difficult, too.
You cannot drop inventory, you cannot pick it up either, because they are "objects" in a room.
So you're not able to drop inventory, but you can make a loseinventory function and place an object instead on the screen that has same graphics as the inventory.
But for there's an limitation you cannot "drop" more than the maximum number of objects.

I've got another idea, why don't you put a box, bag, etc. in the room, where you can put all the stuff in that you don't want to carry around?

GarageGothic

Maybe this is a really dumb suggestion, but couldn't you use characters instead of objects for droppable items?

Ishmael

Yes, you could, and that wouldn't be so hard I think. :P
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Pumaman

#4
Why do you need more objects in the room? Yes, there's an artifical limit and could be increased, but in general there are better ways of accomplishing the game thing, for example using hotspots.

However, I accept that there are cases where more objects are required so I'll look into increasing it further.

Crash

#5
Here is part of the code in my game that lets you drop inv items.
There are 30 characters put aside to be inventory items and they re-initialise whenever you change rooms (ie. you can drop 30 inv. items in each room.

Code: ags

struct roomobj { int x; int y; int nmbr; int on; } ;
roomobj current[30]; roomobj room1[30]; roomobj room2[30]; roomobj room3[30];

//////////////////////////////
// Update Objects           // put in When Player Enters Room (Before Fadein) script
//////////////////////////////

function UpdateObjects() { // 1
 int I;  I = 1; 
  if (character[EGO].room == 1) { while (I<30) { if (room1[I].on == 1) { character[I+3].room = 1; character[I+3].x = room1[I].x; character[I+3].y = room1[I].y; current[I].nmbr = room1[I].nmbr; } I++; } }
  if (character[EGO].room == 2) { while (I<30) { if (room2[I].on == 1) { character[I+3].room = 2; character[I+3].x = room2[I].x; character[I+3].y = room2[I].y; current[I].nmbr = room2[I].nmbr; } I++; } }
  if (character[EGO].room == 3) { while (I<30) { if (room3[I].on == 1) { character[I+3].room = 3; character[I+3].x = room3[I].x; character[I+3].y = room3[I].y; current[I].nmbr = room3[I].nmbr; } I++; } }
   
  int T; T = 1;
   while (T<30) {
   if (current[T].nmbr == 1) { SetCharacterView(T+3,2); }
   if (current[T].nmbr == 2) { SetCharacterView(T+3,8); }
   if (current[T].nmbr == 3) { SetCharacterView(T+3,9); }
   if (current[T].nmbr == 4) { SetCharacterView(T+3,87); }
    T++;
   } //2
  } //1  
  
//////////////////////////////
// Drop Objects             //
//////////////////////////////
function DropObject (int num, int x, int y, int room) { //1
 int I;  int done;  I = 1; 
  if (character[EGO].room == 1) { while (I<30) { if (room1[I].on == 0) { room1[I].nmbr = num; room1[I].x = x; room1[I].y = y; room1[I].on = 1; I= 30; done = 1; } I++; } }
  if (character[EGO].room == 2) { while (I<30) { if (room2[I].on == 0) { room2[I].nmbr = num; room2[I].x = x; room2[I].y = y; room2[I].on = 1; I= 30; done = 1; } I++; } }
  if (character[EGO].room == 3) { while (I<30) { if (room3[I].on == 0) { room3[I].nmbr = num; room3[I].x = x; room3[I].y = y; room3[I].on = 1; I= 30; done = 1; } I++; } }
if (done == 0) { Display("There is no room left."); }
 UpdateObjects();
} // 0

//////////////////////////////
// Pick Up Objects          //
//////////////////////////////
function GetObject(int num) { // 1

if (GetGlobalInt(105)-GetGlobalInt(104) >= 1) { //2  
  if (character[EGO].room == 1) { AddInventory(room1[num-3].nmbr); character[num].room = -1; room1[num-3].on = 0; SetGlobalInt(104,GetGlobalInt(104)+1); } 
  if (character[EGO].room == 2) { AddInventory(room2[num-3].nmbr); character[num].room = -1; room2[num-3].on = 0; SetGlobalInt(104,GetGlobalInt(104)+1); } 
  if (character[EGO].room == 3) { AddInventory(room3[num-3].nmbr); character[num].room = -1; room3[num-3].on = 0; SetGlobalInt(104,GetGlobalInt(104)+1); } 
} else { Display("The inventory is full."); }
  UpdateObjects(); } //0


That's just the functions, I've probably left some vital part of the script out that was in the repeatedly execute part, but my script is so messy I can't be bothered looking for it...
I'm not *that* inbred!

Kennedy

#6
Maybe you could implement objects in rooms in a way similar to characters or inventory items where they get there own category called "static objects".
Then you could have the same object appear in multiple rooms.
also you could have commands for the objects like:

AddObjectRoom(object# room# xpos# ypos#)
RemoveObjectRoom(object# room# xpos# ypos#)

Also maybe adding an ability for inventory items to be placed in the rooms like objects:
AddInvRoom(InventoryItem# room# xpos# ypos#)
RemoveInvRoom(InventoryItem# room# xpos# ypos#)
And you could also make new use of the GetInvAt function.

Then dropping inventory items would be possible and you could also have an inventoryitem appear at various locations.

Pumaman

#7
I could definately add some sort of AddObjectToRoom function, to allow you to add new ones.

However, in terms of droppable object functionality overall, I'm not really sure whether to go down that route or not. Being able to drop things and then pick them up later is really suited to RPG's more than adventure games. It would be possible for me to add, but I'm not sure if it's the sort of thing I should be spending time on.

Kennedy

#8
Well, the reason for droppable items is to put a limit on how much the player can carry.
Most of the old text adventures like the Infocom games and Collosal Cave put a limit on how much can be carried at a time.
Dropping items was part of how players were expected to be able to map that "maze of twisty passages, all alike".

Kennedym

Another reason for adding in the ability for players to drop innventory items would be that then you could have events trigured if the character ISN'T carrying a certain inventory item.
For example they wouldn't be allowed into the hotel if they are carrying a weapon. If they can drop items though then they put certain objects down and pick them up again later.

Probably the best way to implement a system to allow dropping of inventory objects would be for each room to have its own inventory the way characters do.

Skio

#10
As for the "bag" option, this is a piece of code I devised recently.

*** GUIS ***

Create a GUI containing a LISTBOX and an EXIT button.
Script it to appear when the bag is searched. (It is Gui 6 in this example)

*** GUI SCRIPT ***

Code: ags

    if (interface == BAG) {
    // They clicked a button on the bag
    
    if (button==0) {   // the retrieve code
     int count=0;
     int item=1;
      string retrieve;
      string additem;
      ListBoxGetItemText (6,0,ListBoxGetSelected(6,0),retrieve);
      Display ("You retrieve the %s from the trashcan.", retrieve);
      ListBoxRemove (6, 0, ListBoxGetSelected(6,0));

      // AddInventory check
        while (count==0) {
          GetInvName (item, additem);
          if (StrComp(additem, retrieve)==0) {
            count=1;
            }
          else item++;
          }
        AddInventory(item);
      }

    if (button == 1) {   // exit bag
     GUIOff(BAG);
     SetCursorMode(MODE_WALK);
     }
  }  // end if interface BAG


*** BAG INTERACTIONS ***

Code: ags

// deposit items (use inv on the bag)
  string bag;
  GetInvName (player.activeinv, bag);
  Display("You deposit the %s in the bag.", bag);
  LoseInventory(character[EGO].activeinv);
  ListBoxAdd (6, 0, bag);


Code: ags

// look bag
  Display ("A bag.");  
  GUIOn (BAG);
  SetCursorMode(6);
Î'νδρων Επιφανων Πασα Î"η ΤαφοÏ,

A�rendyll (formerly Yurina)

Are you sure these objects are all destined to get removed or re-activated?

If you only need interaction, but no serious remove or re-activate stuff you should use hotspots.
Yuna: Give me a Y!
Rikku: Give me an R!
Paine: Give me a break...
~Final Fantasy X-2

I've been

SMF spam blocked by CleanTalk