PDA

View Full Version : Another ZDoom script prob


Flame Spawn
December 24th, 2005, 02:03 PM
script 500 OPEN
{
if (gameskill()==SKILL_HARD || SKILL_VERY_HARD)
{
if (getactorproperty(0,APROP_HEALTH) > 40)
{
print(s:"\cGThe wrath of Hell is stealing your health!");
until (getactorproperty(0,APROP_HEALTH) == 40)
{
damagething(1);
delay(const:8);
}
}
}
if (gameskill()==SKILL_NORMAL)
{
if (getactorproperty(0,APROP_HEALTH) > 60)
{
print(s:"\cGThe wrath of Hell is stealing your health!");
until (getactorproperty(0,APROP_HEALTH) == 60)
{
damagething(1);
delay(const:8);
}
}
}
if (gameskill()==SKILL_EASY || SKILL_VERY_EASY)
{
if (getactorproperty(0,APROP_HEALTH) > 80)
{
print(s:"\cGThe wrath of Hell is stealing your health!");
until (getactorproperty(0,APROP_HEALTH) == 80)
{
damagething(1);
delay(const:8);
}
}
}
delay(1);
restart;
}

The initial health is 40. Whenever I type in "Give Megasphere" in the console, it gave me the Megasphere stuff, but this script never reduced my health to whatever amount I defined for the skill levels. Any help would be appreciated.

shtbag667
December 24th, 2005, 05:31 PM
maybe try delay(8) instead of delay(const: 8)?

If that doesn't work then I would try to void a skill 'if' statement to see if maybe thats the problem.

Or maybe its the damagething thats not working. Try giving it a tag of a monster a see it's health with a print statement.

In other words, I don't know whats wrong.

ace
December 24th, 2005, 07:08 PM
I can't believe it. I studied this for five minutes and the problem is so simple. Heh. :p

Okay, basically, when dealing with Damagething, because it doesn't use tag identification, it automatically damages whatever activated the special. Here's the problem: when you have an OPEN script, no thing is, per se, activating it, but rather the script runs as soon as the level loads.

ENTER scripts, on the other hand, work differently than OPEN scripts. ENTER scripts are activated when a player enters the level, and therefore will be activated by the player as well as every time the player enters it. This means that making it an ENTER script will make it activated by the player and clear the whole problem up.

Also, while looking at it, I also noticed that the way you have your "if" statements on game difficulty set up can be buggy in some cases. Luckily it won't be a problem in this case, but when dealing with doing something depending on different cases, it is best to use "else if" instead.

I think (IIRC) it's because when just using "if", it checks if the statement is true (or for that matter false, more, less, etc) and then when it's done doing that, it moves right on down the line to the next one. However, with "else if", it only checks the next parts if the last part wasn't true (or false, more, less, etc). So for example, replacing "if(gameskill()==SKILL_HARD || SKILL_VERY_HARD)" with "else if(gameskill()==SKILL_HARD || SKILL_VERY_HARD)" should make it more stable, or at least in most cases though it isn't necessary in this one.

Hope that clears it up and all. Also, chances are that for stuffs like this you will get better help at the ZDoom forums (http://forum.zdoom.org).