Jump to content

Roughly two or three questions.


Cless

Recommended Posts

Hello,

 

Not sure what the topic for this should be, so I named it Roughly two or three questions. Lol. Uhm, yeah. My questions are: How do you store Money? (I'm quite sure you wouldn't use a variable, as, variables are only temporary).

 

Also, how would you store equipment or items? (Like, on an RPG). My friend also wants to know how to store characters statistics, and giving how to give the character items. So, like, the item gets added to the player's inventory.

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/57606-roughly-two-or-three-questions/
Share on other sites

Well I store money in a bank.  (not what you asking, so be more clear)

 

For the second part your talking a series of mySQL tables that are linked with primary keys.  However if you can't grasb this basic idea i don't think your quite ready to be making your own php game

I mean... um, allowing the character to have money to buy items and such with, on the game.

 

Lol. I'm not making one yet, what I'm doing is practicing, and have learned most of the stuff, however, I needed to know some of these things. But, yeah, I mostly understand what you are talking about.

 

Thanks.

 

PS. Dark Nonique? Ah, yes. I know JoJo. An Administrator of TPF. Also, how could I use variables? Aren't variables only temporary? So, when the script ends, the money would be 0 again.

Make some column in your SQL database, likely in the User table or however you have it. Make that your money column or w/e you use..

 

Make a variable that pulls the value from the SQL and displays it. And you can modify it depending on what they buy and such. So this way, even if the user leaves the site, their money still remains in the SQL.

just tack on the money to the character data table then have a second table for items, maybe a third table for quest.  For the items give the items a link to users via a common key.  The trick is to store the lleast you can in the table and get away with.  Store the rest via functionality like switches/if/else/functions/loops.

 

If your game will involve a "map" system you will have a lot more issues because you will need to keep track of their position.  One suggestion is if you click to walk store their coordinates in a X,Y system and then you can splash out images based on their position but that involves tilling a huge map image HUGE

 

Its doable, but it will take a lot of coding and you have to watch optimization because you will be doing a great deal of querying

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.