User Stats
User Stats
I'm currently working on a layout for my game, and I would like certain stats to appear is set locations. I understand that I would need recreate the stats module, and maybe look at passing the data through a multidimensional array. Is that the best way to go about it? any tips would be extremely welcome. Thanks
- a_bertrand
- Posts: 1536
- Joined: Mon Feb 25, 2013 1:46 pm
Re: User Stats
Not sure what you want here. Is that the user profile you want to redo? Such that you can see other players stats? Or is it the stats on top of the page?
Creator of Dot World Maker
Mad programmer and annoying composer
Mad programmer and annoying composer
Re: User Stats
Sorry it's the stats at the top of the page; level, experience, AP etc with the maxValue as well.
Edit - just had a thought about changing the for loop from outputting the data to putting it into an array. Could that work? I did try putting in an array but got an error but I think I didn't put it into a multi array
Edit - just had a thought about changing the for loop from outputting the data to putting it into an array. Could that work? I did try putting in an array but got an error but I think I didn't put it into a multi array
- a_bertrand
- Posts: 1536
- Joined: Mon Feb 25, 2013 1:46 pm
Re: User Stats
You should rewrite the module stats then, and display what you want.
Creator of Dot World Maker
Mad programmer and annoying composer
Mad programmer and annoying composer
Re: User Stats
okay i've made a start:
What I get back is:
Which is exactly what I wanted. However, it only puts the health information into an array. How do I add, the XP, Level etc into another array? is there code already available in the engine that could help me?
Thanks!
Code: Select all
$search = $db->Execute("select user_stats.*,user_stat_types.*
from user_stats
left join user_stat_types
on user_stat_types.id=user_stats.stat_type where user_id = ?", $userId);
if ($search->EOF)
return array();
$display = $search->fields['name']. " " . $search->fields['value'];
echo $display
$search->Close();
Code: Select all
Health 100
Thanks!
- a_bertrand
- Posts: 1536
- Joined: Mon Feb 25, 2013 1:46 pm
Re: User Stats
Here you should start to check out what a loop is, and how to do it. Sorry but those are really basic things, and I'm not sure if I fix your code you will actually learn it.
Creator of Dot World Maker
Mad programmer and annoying composer
Mad programmer and annoying composer
Re: User Stats
So you want to put your stats in a different order? or you want to add additional stats: "MaxValue" on top? or you want to display Health in a set location: "Health" display in location= 5 only (block all display of stats at this location= 5)
i'm confuse too on what you really want?
i'm confuse too on what you really want?
Re: User Stats
I want to show XP, Health and AP in the forms of bars, so need the data to be able to produce those. I've tried a couple of while loops but not having much luck at the moment. Will battle on
Re: User Stats
maybe try to make it simple as possible. ok, lets try using a table as a "BAR" and the background as filling the "BAR"
for example:
if 445HP = 100% So for every 1% = 4.45HP.
Now take the percentage from the background size and replace it with a variable"
for example:
background health size= $Hp ">
every time the player click on the attack or defend button it will give you a damage of:
for example:
222 damage! (which is equal to 48.88% of HP, which also the size of the background)
pretty much create a table with a color background and adjust the size of the background base on the outcome damage.
i hope that helps. if not i sux!![Laughing :lol:](./images/smilies/icon_lol.gif)
for example:
if 445HP = 100% So for every 1% = 4.45HP.
Now take the percentage from the background size and replace it with a variable"
for example:
background health size= $Hp ">
every time the player click on the attack or defend button it will give you a damage of:
for example:
222 damage! (which is equal to 48.88% of HP, which also the size of the background)
pretty much create a table with a color background and adjust the size of the background base on the outcome damage.
i hope that helps. if not i sux!
![Laughing :lol:](./images/smilies/icon_lol.gif)