It's even more confusing than that. Maybe I should mention that this was done in a library, outside of the wad that the map is contained in.
I just re-created the scripts within the map itself, and it helped me catch a few errors with the code in my post. First, ACS_ExecuteAlways was screwed up, amongst a few other things.
Code: Select all
script 916 OPEN
{
while(ThingCountSector("T_NONE",900,20) > 0)
{
int damage;
if(lightresistpl > 0 && lightresistpl <= 9)
{
damage=5;
}
else if(lightresistpl >= 10 && lightresistpl <= 19)
{
damage=4;
}
else if(lightresistpl >= 20 && lightresistpl <= 29)
{
damage=3;
}
else if(lightresistpl >= 30 && lightresistpl <= 39)
{
damage=2;
}
else if(lightresistpl >= 40 && lightresistpl <= 49)
{
damage=1;
}
else if(lightresistpl == 50)
{
damage=0;
}
Thing_Damage2(900,damage,"LightDamage");
ACS_ExecuteAlways(917,0,1,damage,0);
Delay(35);
}
Delay(1);
Restart;
}
script 917 (int option,int lightresistamount)
{
if(option==1)
{
if(lightresistpl < 50)
{
lightresistexp+=lightresistamount;
while(lightresistexp >= lightresistpl*10)
{
lightresistexp-=(lightresistpl*10);
lightresistpl+=1;
Delay(1);
}
}
}
else if(option==2)
{
lightresistpl=1;
}
}
I altered the formula for calculating damage to make it easier to see exactly what damage values should be gotten.
I added this script when testing in my map:
Code: Select all
script 1 ENTER
{
Thing_ChangeTID(0,900);
Delay(1);
Restart;
}
That is basically a condensed version of the initilization script found in the library of my actual project.
Anyway after all that stuff, it worked. It was damaging by the correct amount every second and raising the power level (pl) when it was supposed to. Everything worked properly, so I copied it directly to my library, and now it doesn't work...