I'm having a problem with LWM's lifebar script.

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Giest118
Posts: 2914
Joined: Fri Dec 05, 2003 11:02 pm

I'm having a problem with LWM's lifebar script.

Post by Giest118 »

This is possibly the most annoying thing I have yet encountered.

Code: Select all

Script 90 (void)
{
	Print(s:"Oh shit!11 It's the flying thing!11 Kill it!11");
	SetPlayerProperty(1, 1, PROP_TOTALLYFROZEN);
	SetMusic("D_BOSS_B");
	Delay(120);
	ACS_Execute(91, 0, 0, 0, 0);
	SetPlayerProperty(1, 0, PROP_TOTALLYFROZEN);
	Thing_Activate(28);
}

Script 91 (void)
{
	ACS_Execute(92, 0, 0, 0, 0);
}

script 92 (void)
{
while (Thingcount (0, 28) == 0)                   //Is the boss there?
        {
        delay (const:35);
        }
while (Thingcount (0, 28) > 0)
	{

HP = (GetActorProperty (28, APROP_Health) / 250);  //Check the bosses health

if (HP <= 100) {SetFont ("HP100");}                //Change the bar according to health
if (HP <= 96) {SetFont ("HP96");}                  //The hudmessage doesn't change - only the font
if (HP <= 92) {SetFont ("HP92");}
if (HP <= 88) {SetFont ("HP88");}
if (HP <= 84) {SetFont ("HP84");}
if (HP <= 80) {SetFont ("HP80");}
if (HP <= 76) {SetFont ("HP76");}
if (HP <= 72) {SetFont ("HP72");}
if (HP <= 68) {SetFont ("HP68");}
if (HP <= 64) {SetFont ("HP64");}
if (HP <= 60) {SetFont ("HP60");}
if (HP <= 56) {SetFont ("HP56");}
if (HP <= 52) {SetFont ("HP52");}
if (HP <= 48) {SetFont ("HP48");}
if (HP <= 44) {SetFont ("HP44");}
if (HP <= 40) {SetFont ("HP40");}
if (HP <= 36) {SetFont ("HP36");}
if (HP <= 32) {SetFont ("HP32");}
if (HP <= 28) {SetFont ("HP28");}
if (HP <= 24) {SetFont ("HP24");}
if (HP <= 20) {SetFont ("HP20");}
if (HP <= 16) {SetFont ("HP16");}
if (HP <= 12) {SetFont ("HP12");}
if (HP <= 8) {SetFont ("HP8");}
if (HP <= 4) {SetFont ("HP4");}
if (HP <= 0) {SetFont ("HP0");}

hudmessage (s:"|";0,0,CR_RED,0.50,0.15,0.5);

SetFont ("HPBACK");

hudmessage (s:"#";0,0,CR_RED,0.50,0.15,0.5);



delay (const:16);
	}

}
Is there anything wrong with that? I can't see any problems... but here's the thing.... When I kill the flying thing monster in the map, the lifebar remains with just a little bit left in it. And I can't find any other monster in the map with the same tag as the flying thing... wtf is going on?

EDIT: And here's something even wierder! I'll kill the bloody thing, but the lifebar refills a bit after it dies! :? :?:
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

You never clear the bar off the screen. After the enemy dies, the script just exits and the hudmessage isn't erased.
User avatar
Giest118
Posts: 2914
Joined: Fri Dec 05, 2003 11:02 pm

Post by Giest118 »

... That wouldn't make any sense. I copied/pasted that script from another part of the scripts lump... that is, I copied a script that worked.
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Post by Xaser »

You probably didn't copy the part that erased the healthbar.
User avatar
Giest118
Posts: 2914
Joined: Fri Dec 05, 2003 11:02 pm

Post by Giest118 »

There is no part of the "working script" that says something along the lines of erasing the health bar. There is no difference between the two scripts, execpt for the tag and the amount of health to compare to.. and the script number, of course...

EDIT: I even copied the "un-working" script to work on another monster... and it worked properly. Now I'm really confused. :?: :?
User avatar
Giest118
Posts: 2914
Joined: Fri Dec 05, 2003 11:02 pm

Post by Giest118 »

.... *bump*
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

Maybe the level was supposed to end the instant it dies, so the health bar would go away at start of next level.
User avatar
Giest118
Posts: 2914
Joined: Fri Dec 05, 2003 11:02 pm

Post by Giest118 »

No. The script it activates upon death is supposed to raise a switch from the ground, which it does, but the lifebar just hangs around... being dumb and annoying... blah-blah-blah...
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Post by Xaser »

Well, why don't you just add a hudmessage that cancels out the lifebar after the end of the while loop? It'll fix it just fine.
User avatar
Giest118
Posts: 2914
Joined: Fri Dec 05, 2003 11:02 pm

Post by Giest118 »

OOOOhhhh and stuff plus things times generic objects multiplied by features.
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Post by Xaser »

...divided by stupidity. :P
User avatar
Giest118
Posts: 2914
Joined: Fri Dec 05, 2003 11:02 pm

Post by Giest118 »

Wait, how do I do that?
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Post by Xaser »

Well, with a Hudmessage, you can Give it an ID (the first argument after the string, I think). Normally this is set to 0, which acts normally. If you give the bar displaying Hudmessage an ID, then after the while loop, make an empty Hudmessage with the dame ID, it'll completely erase the Bar Hudmessage (because it is actually being replaced with the hudmessage with the same ID, which is blank, so nothing shows up). I hope this somewhat helps, if you can understand what the heck I'm trying to say. :P
User avatar
Giest118
Posts: 2914
Joined: Fri Dec 05, 2003 11:02 pm

Post by Giest118 »

Um, that didn't work.

@%$# it seems like I'm stuck with a faulty lifebar.

EDIT: Okay, I tried something completely different. I changed the TID of the boss.... and it worked.
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Post by Xaser »

Hmm... Okay. Now that's just strange. :?
Locked

Return to “Editing (Archive)”