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 09-18-2010, 10:16 PM
12171217 12171217 is offline
Banned
Join Date: Jan 2009
Posts: 453
12171217 has a spectacular aura about
lol.. well that's one way to do it..

To simply answer your first question, you have to hide the images as well.

hideimg(index); to hide a single showimg.
or
hideimgs(min index, max index); to do a range.

Other than that, your scripting is extremely distasteful, but I suppose it'll work and I don't care to tell you much more than that.

Also, use setTimer(.05); instead of timeout=.05;

Here's a hint for making it better:
PHP Code:
function onPlayerEnters() {
  
onTimeOut();
}
function 
onTimeOut() {
  
setTimer(.05);
  
hideimgs(300this.images);  //Clear the old images
  
this.images 300;  //Start a new image counter
  
temp.maxHearts 5//Max heart count
  
for (temp.i=0;temp.i<temp.maxHearts;temp.i++) { //Loop through the possible heart values
    
if (temp.i>player.hearts) break; //Dont exceed the players heart count
    
this.images++; //"Allocate" a new image
    
showimg(this.images"block.png"32+temp.i*4832); //Draw the heart at the proper position.
    
findimg(this.images).layer 5//Screen-relative layer
  
}

Ya. If something doesn't work or whatever, I did type this on my phone.. But I hope you appreciate that little snippet.
}

Last edited by 12171217; 09-18-2010 at 10:26 PM..
Reply With Quote
  #2  
Old 09-18-2010, 11:48 PM
brasilboy109 brasilboy109 is offline
Exorian
Join Date: Aug 2010
Posts: 5
brasilboy109 is on a distinguished road
Quote:
Originally Posted by 12171217 View Post
lol.. well that's one way to do it..

To simply answer your first question, you have to hide the images as well.

hideimg(index); to hide a single showimg.
or
hideimgs(min index, max index); to do a range.

Other than that, your scripting is extremely distasteful, but I suppose it'll work and I don't care to tell you much more than that.

Also, use setTimer(.05); instead of timeout=.05;

Here's a hint for making it better:
PHP Code:
function onPlayerEnters() {
  
onTimeOut();
}
function 
onTimeOut() {
  
setTimer(.05);
  
hideimgs(300this.images);  //Clear the old images
  
this.images 300;  //Start a new image counter
  
temp.maxHearts 5//Max heart count
  
for (temp.i=0;temp.i<temp.maxHearts;temp.i++) { //Loop through the possible heart values
    
if (temp.i>player.hearts) break; //Dont exceed the players heart count
    
this.images++; //"Allocate" a new image
    
showimg(this.images"block.png"32+temp.i*4832); //Draw the heart at the proper position.
    
findimg(this.images).layer 5//Screen-relative layer
  
}

Ya. If something doesn't work or whatever, I did type this on my phone.. But I hope you appreciate that little snippet.
}
Yea thanks that helped alot.
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 05:38 AM.


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