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??
Inventory Space limits
Re: Inventory Space limits
make a field in the database that is maxspace in inventory and then go from there
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Inventory Space limits
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.
The indelible lord of tl;dr
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Inventory Space limits
exactly, simply put a if statement that checks for a field in the players table called maxinventory or something.
psuedo code
this way you can have the players pat to increase their inventory size or base it on strength
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!";
}Re: Inventory Space limits
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.
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.
New Site Coming Soon! Stay tuned 
Re: Inventory Space limits
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
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
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Inventory Space limits
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).
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).
The indelible lord of tl;dr
Re: Inventory Space limits
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.
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Inventory Space limits
thats exactly what i posted above.....maxinventory 