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 08-06-2011, 05:05 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Send a message via Skype™ to Gunderak
Custom Health Display

Basically iv scripted a bar background which stays there permanently and a red bar on top of it which on a time out when the players health changes so does the red bars width, i was wondering if there is a more efficant way of achiving this without changing the width and having tons of if statements.
Thanks in advanced im sure some of you pro's will be able to help xD
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 08-06-2011, 05:28 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Graal Script Code:
width = (player.hearts/player.maxhearts)*maxWidth
If this is what you mean. maxWidth being the full width of your image.
__________________

Reply With Quote
  #3  
Old 08-06-2011, 05:33 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
In whatever function you use for hitting the player, have it trigger the appropriate script, then redraw it.
__________________
Reply With Quote
  #4  
Old 08-06-2011, 05:59 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is a jewel in the roughTricxta is a jewel in the rough
Quote:
Originally Posted by Gunderak View Post
i was wondering if there is a more efficant way of achiving this without changing the width and having tons of if statements.
I dont get why you need tons of if statements o_0

its basically just:
Graal Script Code:
if (health>0)
{
   
part=(health/maxhealth)*maxwidth;//as jazz stated
   
showimg (300,"someimage.png",posx+maxwidth-part,posy);//where posx and posy are where you want it to sit on the screen
   
changeimgpart (300,maxwidth-part,0,part,imageheight);
   
changeimgvis (300,4);
}
else 
hideimg 300
Or do you have something different? Note this is for a horizontal bar and not a vertical although the same method can be applied

also can who ever neg repped me for this just tell me who you are... im sorry for not knowing gs2! in actual fact since its a person with high rep power im kinda half suspecting who it might be. Sorry for trying to help, I will just refrain for showing an example of what I mean.... YES THATS RIGHT! **** YOU!
__________________
Quote:
Originally Posted by Crono View Post
No look at it, Stefan is totally trolling Thor. Calling Classic a "playerworld" (something it's not supposed to be) is the ultimate subtle insult to a true fan.

It's genius.
Reply With Quote
  #5  
Old 08-06-2011, 06:57 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Send a message via Skype™ to Gunderak
ahh i see i shall have a play around with that, how does changeimhpart work? what do each int's do?
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #6  
Old 08-06-2011, 07:18 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
Quote:
Originally Posted by Gunderak View Post
ahh i see i shall have a play around with that, how does changeimhpart work? what do each int's do?
http://wiki.graal.net/index.php/Crea.../Changeimgpart
__________________
Reply With Quote
  #7  
Old 08-06-2011, 07:53 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Send a message via Skype™ to Gunderak
thanks for that, but wouldnt it just be as easy to use Guiwhatever.width = whatever;
that wiki seems quite handy. i might use it more instead of posting here.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #8  
Old 08-06-2011, 08:23 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
Quote:
Originally Posted by Gunderak View Post
thanks for that, but wouldnt it just be as easy to use Guiwhatever.width = whatever;
If you're using GUI controls, yes. changeimgpart only works when you're using showimg.
__________________
Reply With Quote
  #9  
Old 08-06-2011, 08:36 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Send a message via Skype™ to Gunderak
ah ok, so how would i make i if the gui was Health_Text so that it changes the image width to how big player.health is?
also is there a way to check what the players hewlth is ajd make its width accordingly withiut using if(player.health == 3){ do this if player health 2.5 etc etcv
i dont understand how the first method works
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #10  
Old 08-07-2011, 10:33 AM
Entrok Entrok is offline
Registered User
Join Date: Sep 2009
Location: Sweden
Posts: 51
Entrok is on a distinguished road
Send a message via MSN to Entrok
Quote:
Originally Posted by Tricxta View Post
I dont get why you need tons of if statements o_0

its basically just:
Graal Script Code:
if (health>0)
{
   
part=(health/maxhealth)*maxwidth;//as jazz stated
   
showimg (300,"someimage.png",posx+maxwidth-part,posy);//where posx and posy are where you want it to sit on the screen
   
changeimgpart (300,maxwidth-part,0,part,imageheight);
   
changeimgvis (300,4);
}
else 
hideimg 300
Or do you have something different? Note this is for a horizontal bar and not a vertical although the same method can be applied

also can who ever neg repped me for this just tell me who you are... im sorry for not knowing gs2! in actual fact since its a person with high rep power im kinda half suspecting who it might be. Sorry for trying to help, I will just refrain for showing an example of what I mean.... YES THATS RIGHT! **** YOU!
Want to fix some of the things i did see in this script

Graal Script Code:
if (health>0)
{
  
part=(health/maxhealth)*maxwidth//as jazz stated
  
showimg(300"someimage.png"posx+maxwidth-partposy); // where posx and posy are where you want it to sit on the screen
  
changeimgpart(300maxwidth-part0partimageheight);
  
changeimgvis(3004);
}
else 
hideimg(300); 
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 08:43 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.