refreshClientScore

This is the development community to discuss tribes mod coding or to ask questions.

Moderator: Moderators

1 Wed Dec 18, 2013 1:53 am

So i'm trying to get it to display a players Armor in the tab menu instead of which team they are on. This refreshClientScore function confuses the hell out of me. This is what i'm working with...

Code: Select all
function Game::refreshClientScore(%clientId)
{
   %armor = Player::getArmor(%clientId);
   %team = Client::getTeam(%clientId);
   // objective mission sorts by team first.
   Client::setScore(%clientId, "%n\t%t\t     "      @$personalEnergy[%clientId]@"\t%p\t%l", %clientId.score + (9 - %team) * 10000);
//   Client::setScore(%clientId, "%n\t%t\t  " @ %clientId.score, %clientId.score);
}


I have tried tweaking this dozens of times by adding the %armor variable to no avail. I don't understand %n\t%t\t or "\t%p\t%l", so some help would be appreciated.
User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
 
Posts: 94

2 Wed Dec 18, 2013 4:38 pm

replace %t with " "@player::getArmor(%clientId)@" "

where player::getArmor(%clientId) can be replaced with the expression that evaluates to what you want.

You can also use setTeamScoreHeading() and setClientScoreHeading() to modify the table headers for the 2
tables you see in the menu. the hex chars there somehow represent the width of the cell of the table. Probably not, I am not sure...
Code: Select all
setClientScoreHeading("Player Name\t\x78Team\t\xC8Score");
setTeamScoreHeading("Team Name\t\xC8Score");
User avatar
C--
Sorry....
 
Posts: 3299

3 Fri Dec 20, 2013 1:07 am

Thanks man. How would I go about getting the name of the armor rather than the shape file though? Right now it says larmor instead of Light Armor.
User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
 
Posts: 94

4 Fri Dec 20, 2013 12:43 pm

Base mod has this code

Code: Select all
$ArmorType[Male, LightArmor] = larmor;
$ArmorType[Male, MediumArmor] = marmor;
$ArmorType[Male, HeavyArmor] = harmor;
$ArmorType[Female, LightArmor] = lfemale;
$ArmorType[Female, MediumArmor] = mfemale;      
$ArmorType[Female, HeavyArmor] = harmor;

$ArmorName[larmor] = LightArmor;
$ArmorName[marmor] = MediumArmor;
$ArmorName[harmor] = HeavyArmor;
$ArmorName[lfemale] = LightArmor;
$ArmorName[mfemale] = MediumArmor;


At the beginning of item.cs, you can use $armorname to move from armor block to the item, and then
you can get the item's .description field.

So if you have %armor that is equal to "larmor", then $ArmorName[%armor].description should evaluate to "Light Armor".
Hope that explains some things
User avatar
C--
Sorry....
 
Posts: 3299

5 Fri Dec 20, 2013 2:48 pm

Thanks bud! :D
User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
 
Posts: 94


Return to Coder's Hangout

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron