Game Development Community

Stat Updating

by CSMP · in General Discussion · 01/04/2008 (10:59 am) · 3 replies

I need help getting Will Browns Stats (http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=13020) to increment and update the player health, energy and jump and i cant seem to figure out how to write the function or where to place it.

#1
01/04/2008 (11:32 pm)
It might be helpful if you could show/describe what you've done so far.
#2
01/08/2008 (3:21 am)
Example function,


function Player::updateAttributes(%this, %cl)
{
// here we are updating all the stats the player
// for example making sure that player maxHP = STA * 10
// this will most likely be called at spawn and when gaining a level
%this.maxHP = %this.maxhp * 2;
%this.maxMP = %this.maxmp * 2;

//you gained a level, have full health and mana!
%this.HP = %this.maxHP;
%this.MP = %this.maxMP;
%this.player.maxdamage = %this.maxhp; // csmp this is my attempt at updating life with stats
%this.player.maxenergy = %this.haxmp; // csmp this is my attempt at updating energy with stats
}

im tryin to take the stat window updates and update the playergui health/energy and eventually jumpforce

p.s. i am a newbie
#3
01/09/2008 (2:57 am)
Ok thanks to joobot for his resource
(http://www.garagegames.com/mg/forums/result.thread.php?qt=32880)

and found out all i needed was ".getdatablock()" in the coding
%this.getDataBlock().maxDamage = %this.maxHP;
%this.getDataBlock().maxEnergy = %this.maxMP;
%this.getDataBlock().jumpforce = %this.getDataBlock().jumpforce * 2;