Jump to content
MakeWebGames

Avatar Edit


mrhat187
 Share

Recommended Posts

Does anyone know where to edit the pick of the black figure in the combat module when your fighting. I woul dlike to change this picture, also would it be possible to make the picture change based upon a persons level? Ive already started to remove the other images and create ones that more fit my theme, just want to change the I think its Favatar2 picture.

Link to comment
Share on other sites

The code/html of the avatar image during compat images is at modules/combat/lib.php around line 197 (around becuse I did some changes to test the variables)

 

echo "<img src='{$webBaseDir}modules/combat/avatar.png'>";

 

It seems like this part is incomplete. As modules/combat/avatar.png does not exist. And uploaded avatar images are at modules/avatar/##userid##.png

The incoming $user variable does not contain the user id.

It will be best to wait for the developer to make an official update

But as a dirty workaround for testing or just funzies

Replace this function, add /* before and */ after the old function, so you can easily revert back.

 

function ShowInteractiveInterface ($user, $npc, $buttons)
{
   global $webBaseDir, $userStats, $userId;


   echo "<table class='plainTable'><tr valign='top'><td align='center' width='1%'>";
   ShowStats($user);

   echo "<br><br>";
   if ($buttons)
       ShowCombatButtons($npc, $user);

   echo "</td><td align='center'>";

 if($userStats['Level']->value < 5){
   echo "<img src='{$webBaseDir}modules/avatar/images/{$userId}.png'>";
 } else {
 	//This version will be used if levelis above 5
 	//This example adds a border just for testing, not to be used 
 	echo "<img border='10' src='{$webBaseDir}modules/avatar/images/{$userId}.png'>";
 }
   echo "<img src='{$webBaseDir}modules/combat/npc/" . $npc['image_id'] . ".png'>";

   if (! isset($_SESSION["combatLog"]))
       $_SESSION["combatLog"] = "";
       // echo $_SESSION["combatLog"];

   echo "</td><td width='1%'>";

   ShowSecondStats($npc);

   echo "</td></tr></table>";
}

 

In general, when making a custom version of a module, I would make a copy of the module. As changes will be lost when updating the module.

EDIT: as I re-read post title and and the content. I am unsure about what you mean. However echo "<img src='{$webBaseDir}modules/combat/npc/" . $npc['image_id'] . ".png'>"; is the enemy "avatar" image. You could apply the level check above, and have 2 versions of the enemy image, and make the image $npc['image_id'] . "-highlevelversion.png'. The rat image would then be at modules/combat/npc/1-highlevelversion.png

Edited by Someone
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...