Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Check out my lifemeter..... (https://forums.graalonline.com/forums/showthread.php?t=1734)

G_yoshi 04-23-2001 12:17 PM

I made this really nifty lifemeter thing.....it decreases and increases on both normal health and max health....it sorta replaces the hearts.......but i am having some trouble with it, cause it wont let me get into my weapons list when i push Q. I also want to know how to get it to display the hp in actual numbers on the image.....

anyway....here is what i did.......includes 1 board w/the lifemeter script +extra npcs that play with it. Also include 4 flavors and 1 template.......(hpbar img)

G_yoshi 04-23-2001 12:19 PM

bah......
 
1 Attachment(s)
it screwed up.........here it is

I should also mention that it does not work right for baddies......

Er1c 04-24-2001 08:44 AM

Why you cant use Q
 
Whenever a player's hearts get changed/set, the normal playing screen is displayed. With that script, every .05 secconds you're setting the player's hearts, which makes the Q screen hide whenever someone trys to display it. Getting numbers to display the health is a bit more advanced, but you need to use changeimgpart a lot for it...

Er1c 04-24-2001 08:46 AM

WOW, only 7 posts!!! Heh, heres another.

G_yoshi 04-24-2001 11:31 AM

so....then what should i do? I want to make sure that the bar does not lag

LilbrojX 04-24-2001 12:19 PM

WOAH, I wish I could script this well

G_yoshi 04-24-2001 04:03 PM

1 Attachment(s)
Pheh........im not that good......but how would i know....
but im flattered that you think so

anyway....i have made a small update to it......check it out......also comes with 2 new skins!!!

i still need to find out how to make it decrease hp when the player is hit by arrows, thrown objects, and bombs....

also need to find out how to make it work when the player is in a bed........

i wonder if there is some kind of flag that is set when the player is in a bed........

grim_squeaker_x 04-24-2001 07:21 PM

Blah.
 
It currently sets it every 0.05 seconds to the players fullhearts?
then use this:
NPC Code:
if (playerhurt) {
playerhearts=playerfullhearts;
}


Then you will only restore the hearts whenever the player is hurt ;)

G_yoshi 04-25-2001 03:07 AM

THANK YOU!!!!!! :D
 
1 Attachment(s)
Thank you so much!! Now i got it so it works with baddies and bombs and stuff!!! Now I must get it to work when a player is in a bed.........

Here is another update for it too......since Grim's suggestion helped imensely.

No new skins though....maybe i will make somemore later.

G_yoshi 04-25-2001 05:29 AM

oops.....sorry
 
1 Attachment(s)
hehe........me r dummy.......i forgot a few files......
here is the full thing

G_yoshi 04-25-2001 02:32 PM

1 Attachment(s)
And if you really even care......here are 3 more skins i made.......

General 04-26-2001 09:05 AM

Re: oops.....sorry
 
Use if Sprite=Uhm that number...

G_yoshi 04-26-2001 03:19 PM

?????

G_yoshi 05-01-2001 01:22 AM

I still need some help with my HP meter displaying numbers.........i can get it to do it some what.....but it does not always work right.......

hp=strtofloat(#s(player_hp));
hp3=int(hp/100);
hp1=int(hp/10);
hp2=(hp%10);
showimg 202,hp_bar_#s(flavor).png,425,37;
changeimgpart 202,hp3*16,44,16,16;
changeimgvis 202,4;
showimg 203,hp_bar_#s(flavor).png,434,37;
changeimgpart 203,hp1*16,44,16,16;
changeimgvis 203,4;
showimg 204,hp_bar_#s(flavor).png,443,37;
changeimgpart 204,hp2*16,44,16,16;
changeimgvis 204,4;

that is what i have........if someone can help me, that would be great........

WhoopA 05-02-2001 08:02 AM

WhoopA to the rescue! Here's some code you can use. It'll use the default letters.png for the readout. You should be able to modify it to your own use.

NPC Code:

// Digital readout function Draw()
// Script by WhoopA
// Displays a value, left aligned, on the player's screen.
//
// These variables muse be set before this function is called!
// num: Number to display
// dx, dy: Position to display the number on the player's screen. These will be changed as the function runs.
// img: Image values to use (start with 200). This is the parameter supplied to showimg and will be incremented automatically.

function Draw()
{
dr_val = 10; while (dr_val < num) dr_val *= 10;
while (dr_val > 1) {
dr_val = dr_val / 10;
dr_i = int(num / dr_val) % 10;
showimg img,letters.png,dx,dy;
changeimgpart img,64*dr_i,96,12,32;
changeimgvis dr_i,4;
dx += 12; img++;
}
}



At the end of your timeout, you can take care of cleanup by running these lines (assuming you use this method of doing your status):

for (i=200;i<this.lastimg;i++) hideimg i;
this.lastimg = img;

Hope this helps.

G_yoshi 05-02-2001 11:03 AM

thanks......i will see what if this will help


All times are GMT +2. The time now is 01:47 PM.

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