HELP WITH BASIC BAG SYSTEM.

Posts

Pages: 1
Hi, I'm hoping someone can help me with this. I'm hoping it won't be too complicated.

1. I will have 4 different bags in the game, one of each.

2. Each bag increases Cargo Capacity by 1, to a max of 4.

3. Picking up any item of Cargo decreases Cargo Capacity by 1. Dropping it increases it, etc.

4. This is unrelated to actual inventory capacity. I want this limit to apply only to specific Cargo items. Player should be able to carry any amount of other items.

The idea is that early in the game, the player can only carry a small amount of Cargo for trade. Later on, your capacity increases. Most of the inventory scripts I've seen look extremely complicated, with way more features than I need. Can anyone give me a hand getting this to work?

Thanks for looking.



I think that I basically just need something like this:
if [Burlap Sack} is in inventory, add 1 to [Capacity]
or
if [Burlap Sack] is in inventory, [BSack] = 1;
if [Linen Bag] is in inventory, [LBack] = 1;
[Capacity] = [BSack]+[LBag];
but I don't really know the syntax for this code.
Variables should be enough to handle this. Have your game check which item is being held (Burlap, Linen, etc) and set a variable to how many slots you have to use - so if you've Burlap you'd set the variable to 3 (for example).
Then, every time you pick up an item for those bags you use a conditional branch that checks to see if another variable is equal to the amount in the first variable. If it's equal then you can't carry any more. If it's below, then +1 to the second variable. When you remove a piece of cargo, -1 from the second variable. It's pretty simple.

Found Cargo. Take with? (Take/Drop Cargo)
>Take
IF Variable (Cargo Held) = (Cargo Space)
>> You cannot carry more cargo

ELSE
>>Change Variable (Cargo Held) +1

END


>Drop Cargo
IF Variable (Cargo Held) >0
>> Change Variable (Cargo Held) -1

ELSE
You currently have no cargo.

END
Thanks Liberty, I think I've got it more or less figured out. It's even simpler than I thought. The player can carry all four bags at once, and each just increases overall capacity by one, so as long as I'm careful about checking inventory, I can just do a +1 to Capacity whenever I give the player a bag. Then I compare Capacity to Cargo and time I want to pick something up, and add the requisite amount to Capacity. When I deliver it, I just subtract. Now I just have to make sure it works...

edit: It seems to be working so far! Thanks for your help Liberty. If anyone has any questions about how I got it working, feel free to ask.

Pages: 1