Page 1 of 1
Inventory Space limits
Posted: Sun Jan 17, 2010 1:24 am
by roah235
heyy. i was meesing around with a new stylesheet layout that looks more like a WOW type gui.
and my weapon display table thing went over my new style sheet.
so i thought it might be useful for space and gameplay in general to make a max amount of items
i know this prolly seems reaaalllyy simple but i'm kinda stuck on it.
any ideas??
Re: Inventory Space limits
Posted: Sun Jan 17, 2010 1:38 am
by ZeroComp
make a field in the database that is maxspace in inventory and then go from there
Re: Inventory Space limits
Posted: Sun Jan 17, 2010 2:32 am
by Jackolantern
Just be sure to make a test of the max number of items a player can hold versus how many they currently hold when the player attempts to pick up another item. If their current amount is equal to or over the max, don't give them the item and display a message saying they can't hold any more. It may sound strange to test for over the max since you won't let them hold more than the max, but be sure to also test it for security reasons. If an item gets added through some other method and they go over the max without an overage check, they would then have unlimited storage.
Re: Inventory Space limits
Posted: Sun Jan 17, 2010 2:51 am
by hallsofvallhalla
exactly, simply put a if statement that checks for a field in the players table called maxinventory or something.
psuedo code
Code: Select all
$query = select * from inventory where name=$playername;
while $query
{
$count = $count + 1;
}
if ($count>$playerinfo3['maxinventory'])
{
echo "you have too many items!";
}
this way you can have the players pat to increase their inventory size or base it on strength
Re: Inventory Space limits
Posted: Sun Jan 17, 2010 3:07 am
by Torniquet
you have also got to think about what if some1 wanted the item they cant pick up more than something they have in their bag.
for instance, you find an ultimate power god wrath blade, rarest item in game. aww crap bags full... some1 not gunna be best pleased lol.
Re: Inventory Space limits
Posted: Sun Jan 17, 2010 3:11 am
by ZeroComp
Thats where you could put an option like this
You have found the uber god blade
your bags are full!
go to inventory
(go to inventory)
super nub dagger Equip-Drop
drop.php
are you sure you want to drop? yes-no
Re: Inventory Space limits
Posted: Sun Jan 17, 2010 3:45 am
by Jackolantern
Ohh, it would probably be best to craft the max inventory space check as a function, since it is likely that as your game grows, you will have several different sources of items. It could be setup so that the function returns 1 if the item can be picked up, or 0 if inventory is full, and each instance of an item source could be written to respond accordingly to the results.
EDIT: Or, you could design the function so you can pass in references for whatever you need for the calculations, and handle it all within the function, and then pass back to the int only for displaying the message (which would likely be page-specific and better off outside the function).
Re: Inventory Space limits
Posted: Sun Jan 17, 2010 7:39 pm
by ZeroComp
heres an idea if you use that in your game that i've seen in other browser games. Have a P2P offer where if you subscibe or do a one time payment then you have increased inventory space and have uprgadable slots for f2p where you could buy slots for say 50000 gold or something like that.
Re: Inventory Space limits
Posted: Sun Jan 17, 2010 8:53 pm
by hallsofvallhalla
thats exactly what i posted above.....maxinventory
