Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-08-2011, 03:18 AM
Ohk4y Ohk4y is offline
Registered User
Ohk4y's Avatar
Join Date: Jun 2011
Posts: 43
Ohk4y is an unknown quantity at this point
Send a message via AIM to Ohk4y
Exclamation HUD Doubles on Death

Hello again, I have been experiencing this issue since the hud script was created, the issue is that when you die, the gui doubles untill you come alive again, quite odd.. Well here's some images of the proof:
Normal:

Doubled:


Here's the script:
PHP Code:

//#CLIENTSIDE

function onCreated() onTimeOut(); 
function 
onTimeout() {

  
fileupdate("e_gui.png");
  if(
client.loggedin != null) {
    
this.hudx=5;
    
this.hudy=10;

with(findimg(1000)) {
  
image player.head;
  
this.hudx+35;
  
this.hudx+25;
  
changeimgpart(1000,0,63,33,32);
  
changeimgvis(1000,0);
  
layer 5;
}
  
with(findimg(900)) {
  
image "e_gui.png";
  
this.hudx-5;
  
this.hudy;
  
changeimgpart(900,this.hudx,this.hudy,182,92);
  
layer 5;
}

//hp bar
showimg(202,"e_gui.png",this.hudx+68,this.hudy+22);
changeimgpart(202,18,103,102,12);
changeimgvis(202,18);
changeimgpart(202,18,103,clientr.player.stats.curhp*102/clientr.player.stats.maxhp,12);

//energy bar
showimg(302,"e_gui.png",this.hudx+68,this.hudy+36);
changeimgpart(302,18,123,102,12);
changeimgvis(302,18);
changeimgpart(302,18,123,clientr.player.stats.energy*100/clientr.player.stats.energy,12);

//Exp Bar
showimg(402,"e_gui.png",this.hudx+58,this.hudy+51);
changeimgpart(402,23,145,91,6);
changeimgvis(402,18);
changeimgpart(402,23,145,clientr.exp*100/clientr.expneeded,6);

//level text
with (showText400this.hudx+4559.7"Impact""a",clientr.explevel))     
{
layer 21;zoom .71;alpha =.90;zoom =.5;}
changeimgcolors(400,0,0,0,.99);
with (showText401this.hudx+4559.7"Impact""a",clientr.explevel))    
{
layer 22;zoom .70;alpha =.90;zoom =.5;}
changeimgcolors(401,1,1,1,.99);


//Money
with (showText2000this.hudx+9071"Impact""a",player.rupees))     
{
layer 21;zoom .71;alpha =.90;}
changeimgcolors(2000,0,0,0,.99);
with (showText2001this.hudx+9071"Impact""a",player.rupees))    
{
layer 22;zoom .70;alpha =.90;}
changeimgcolors(2001,1,1,1,.99);


//Nickname
with (showText3000this.hudx+93.5this.hudy+3"Arial""ab",player.nick))     
{
layer 21;zoom .71;alpha =.90;zoom =.7;}
changeimgcolors(3000,0,0,0,.99);
with (showText3000this.hudx+93.5this.hudy+3"Arial""ab",player.nick))    
{
layer 22;zoom .70;alpha =.90;zoom =.7;}
changeimgcolors(3000,1,1,1,.99);

}
settimer(.05);

Thanks in advance!
__________________
Reply With Quote
  #2  
Old 09-08-2011, 03:51 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Haven't looked at your code since I can't be bothered to try to decipher poorly formatted code right now, but I'd bet the problem is you're trying to use changeimgpart with a width or height of zero. Hide the HP/MP/whatever bars when they're at zero to fix it.

Please format your code prior to posting it. If nothing else, use this.
__________________
Reply With Quote
  #3  
Old 09-08-2011, 04:02 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
ChangeImgPart does this alot when you use 0.. just hide if less then 1.. or force a minimum of 1.
Reply With Quote
  #4  
Old 09-08-2011, 04:05 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
If you specify a 0 width in changeimgpart it uses the entire width. So you can easily fix it like this:

PHP Code:
// HP Bar
temp.bar_width max(clientr.player.stats.curhp*102/clientr.player.stats.maxhp1);
changeimgpart(202,18,103,temp.bar_width,12); 
max(a, b) - returns the higher number.

So in the case above if your calculated width is lower than 1 it'll pick 1 instead.
__________________
Quote:
Reply With Quote
  #5  
Old 09-08-2011, 04:35 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by fowlplay4 View Post
If you specify a 0 width in changeimgpart it uses the entire width. So you can easily fix it like this:

PHP Code:
// HP Bar
temp.bar_width max(clientr.player.stats.curhp*102/clientr.player.stats.maxhp1);
changeimgpart(202,18,103,temp.bar_width,12); 
max(a, b) - returns the higher number.

So in the case above if your calculated width is lower than 1 it'll pick 1 instead.
I never knew about
PHP Code:
max(ab) - returns the higher number
But I find that very usefull..

PHP Code:
You must spread some Reputation around before giving it to fowlplay4 again
Reply With Quote
  #6  
Old 09-08-2011, 11:15 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by scriptless View Post
I never knew about
PHP Code:
max(ab) - returns the higher number
It also works well together with min() to "lock" a number to a certain range:
PHP Code:
max(0min(100temp.var)) 
Will return temp.var, 0 if it's below 0 and 100 if it's above 100.
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:48 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.