Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-30-2011, 10:12 PM
pez307 pez307 is offline
ImThatGuy
pez307's Avatar
Join Date: Apr 2007
Posts: 58
pez307 is an unknown quantity at this point
Question GUI Help?

I've got a GUI what i need help with, this script has currently been posted on forums, and i've edited it abit to make the custom health system i have installed match, but doesn't seem to work.

1. The image is only half filled.

2. When i attack it takes away the health, parts of the image, but when the image is all gone the player is still alive.


Screenshots:
1. http://img848.imageshack.us/f/imagehalffull.png/

2.http://img27.imageshack.us/f/playerstillalive.png/

Script:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.HUDimage   "dusty_guibartest1.png"// Define the image of the bar;
  
showstats(1024);        // Hide all but the player
  
this.HUDx       50;   // Center 'X' position of the HUD
  
this.HUDy       50;   // Center 'Y' position of the HUD
  
this.radius     24;   // Distance the bar extends out to from center
  
this.thickness  15;   // Thickness of bar in pixels
  
this.margin     2;    // Thickness of outline in pixels
  
this.startangle pi/2// Starting angle of bar
  
this.direction  1;    // Direction the bar goes. -1 = left, 1 = right
  
this.maxlife    100;   // Define the max amount of life possible

  
onTimeout();
}

function 
onTimeout() {
  
// RECORD CUSTOMIZATIONS INTO TEMPORARY VARIABLES
  // THIS IS SIMPLY FOR THE EASE OF SHORTER VARIABLE NAMES
  
temp.sa this.startangle;
  
temp.ox this.HUDx;
  
temp.oy this.HUDy;
  
temp.this.radius;
  
temp.this.thickness;
  
temp.this.margin;

  
// DISPLAY THE HEART IMAGE
  // THIS CAN BE CHANGED TO SOMETHING LIKE THE PLAYER'S HEAD
  
with (findimg(1000)) {
    
image "state.png";
    
ox 20;
    
oy 22;
    
partw 40;
    
parth 44;
    
layer 6;
  }

  
// ALTER THE 'FILL'. THIS IS A VARIABLE THAT COUNTS UP
  // OR DOWN TO THE PLAYER'S HEARTS, SO WE CAN USE IT AS
  // AN ALTERNATIVE, THUS ANIMATING THE BAR FILLING
  
if (this.fill != clientr.stats.hp_curthis.fill += (this.fill clientr.stats.hp_cur) ? 3.05 : - .5;
  else 
this.fill clientr.stats.hp_cur;

  
// IF NEW IMAGE COUNT IS LESS THAN THE OLD, HIDE EXCESSIVE IMAGES
  
if (this.oldi clientr.stats.hp_max*2hideimgs(200,300+this.oldi);

  for (
temp.i=0;i<clientr.stats.hp_max*2;i++) {
    
temp.seg pi/this.maxlife;
    
temp.= (sa + (i*seg)*this.direction);
    
temp.padding = {(== 0)*pi/40,(((i+1)/2) == clientr.stats.hp_cur)*pi/40};
    
with (findimg(200+i)) {
      
polygon = {
        
ox cos(padding[0])*(r+t)      ,oy sin(padding[0])*(r+t)      ,
        
ox cos(seg padding[1])*(r+t),oy sin(seg padding[1])*(r+t),
        
ox cos(seg padding[1])*r    ,oy sin(seg padding[1])*r    ,
        
ox cos(padding[0])*r          ,oy sin(padding[0])*r          ,
      };
      
red blue green 0;
      
alpha 1;
      
layer 4;
    } 

    if (
this.fill*2) {
      
with (findimg(300+i)) {
        
polygon = {
          
ox cos(a)*(r+t-m)      ,oy sin(a)*(r+t-m)      ,
          
ox cos(seg)*(r+t-m),oy sin(seg)*(r+t-m),
          
ox cos(seg)*(r+m)  ,oy sin(seg)*(r+m)  ,
          
ox cos(a)*(r+m)        ,oy sin(a)*(r+m)        ,
        };
        
image thiso.HUDimage;
        
layer 5;
      }
    } else 
hideimg(300+i);
  }
  
this.oldi i// RECORD THIS IMAGE COUNT AS OLD

  // IF BAR IS FILLED, SET A LONGER TIMEOUT FOR EFFICIENCY, OTHERWISE
  // SET IT AS LOW AS POSSIBLE FOR SMOOTHER FILL ANIMATION
  
setTimer(this.fill == clientr.stats.hp_cur 0.05 0.05);

__________________
Cm*
Reply With Quote
  #2  
Old 04-01-2011, 02:31 PM
pez307 pez307 is offline
ImThatGuy
pez307's Avatar
Join Date: Apr 2007
Posts: 58
pez307 is an unknown quantity at this point
Cmon please, abit of help? I need help, it will be appreciated.
__________________
Cm*
Reply With Quote
  #3  
Old 04-01-2011, 05:37 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
i'm guessing it has to do with the fact that you have 100 hp max, while hearts have 23 as max.
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you

Last edited by Deas_Voice; 04-01-2011 at 05:41 PM.. Reason: no copy/pasting solutions
Reply With Quote
  #4  
Old 04-10-2011, 03:46 AM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
Quote:
Originally Posted by Deas_Voice View Post
i'm guessing it has to do with the fact that you have 100 hp max, while hearts have 23 as max.
He's not using player.hearts though, I don't think ;o

check your math + restrictions
Reply With Quote
Reply


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 11:19 PM.


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