View Single Post
  #1  
Old 01-07-2010, 03:39 PM
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
GANI scripts in attributes; updating

I'm having trouble with GANI scripts used in player attributes to show an HP bar. It works for the first display, but then doesn't always update.

This is the code (serverside):

PHP Code:
this.attr[3] = "era_hpbar.gani," @ (this.health this.initialHealth); 
and this is the GANI script:

PHP Code:
SCRIPT
function onCreated() {
  
showBar(params[0]);
}

function 
onPlayerEnters() {
  
onCreated();
}

function 
showBar(percent) {
  
with (findimg(200)) {
    
image "erai_hpbar.png";
    
    
this.0.25;
    
this.1.5;
    
layer 1;
    
    
attachtoowner true;
  }
  
  
changeImgPart(200004111);
  
  
with (findimg(201)) {
    
image "erai_hpbar.png";
    
    
this.0.25;
    
this.1.5;
    
    
layer 2;
    
    
attachtoowner true;
  }
  
  
changeImgPart(201012max(141 percent), 11);
}
SCRIPTEND 
The bar will always show correctly if I try to display it when the bar isn't already showing, but if it is already showing, it won't update.
__________________
Reply With Quote