User Stats

General Chat, Comments
Post Reply
cyborg
Posts: 38
Joined: Mon Feb 03, 2014 11:09 am

User Stats

Post by cyborg »

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
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: User Stats

Post by a_bertrand »

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
cyborg
Posts: 38
Joined: Mon Feb 03, 2014 11:09 am

Re: User Stats

Post by cyborg »

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
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: User Stats

Post by a_bertrand »

You should rewrite the module stats then, and display what you want.
Creator of Dot World Maker
Mad programmer and annoying composer
cyborg
Posts: 38
Joined: Mon Feb 03, 2014 11:09 am

Re: User Stats

Post by cyborg »

okay i've made a start:

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();
	
What I get back is:

Code: Select all

Health 100
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!
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: User Stats

Post by a_bertrand »

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
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

Re: User Stats

Post by KaL »

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?
cyborg
Posts: 38
Joined: Mon Feb 03, 2014 11:09 am

Re: User Stats

Post by cyborg »

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
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

Re: User Stats

Post by KaL »

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! :lol:
Post Reply

Return to “General”