Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
C30N9

ACS scripting problem

Recommended Posts

Script 5 (void)
{
int FI;

Floor_RaiseByValueTimes8(15,24,11);
Delay(35);
Floor_LowerByValueTimes8(14,10,7);
Delay(70);
SetFont("SMALLFONT");
HudMessageBold(s:"Bringing Imps to a whole new level"; HUDMSG_TYPEON, 0, CR_DARKGREEN, 0.5, 0.45, 1.5, 0.07,1.0);
Delay(70);

FI = 0;
While (FI < 12) {
Fi++;
Thing_Spawn(Random (16,19), 201, 90, 20);
Delay(70);
}

While ( FI = 12 )
{
While( ThingCount (201, 20) > 0 )
{
Delay(35);
Floor_LowerToLowest(15,24);
}
}
}
In this code, monsters should be spawned in random spots till they reach 12. After that, the script must check if all of these monsters with 20 TID are dead, if so, it should make a floor to be lowered.

But I keep getting the problem "Missing ')'" at line:
While ( FI = 12 )

Any ideas to fix this?

Share this post


Link to post

Shouldn't it be

C30N9 said:

While ( FI == 12 )

?

"=" and "==" are different things. "b = 2" gives "b" a value of 2 but "b == 2" returns TRUE if b = 2 and FALSE if b != 2.

Share this post


Link to post

Memfis saves the day. Thanks.

One more thing, what is the angle that makes the new monsters look south?

EDIT: Nevermind.

Share this post


Link to post

Another problem, according to the above script, after the spawning event finishes, the floor will be lowered by itself. Also, if the monsters' count reaches 0, a message pops up saying:
"Runaway Script 5 Terminated"

Share this post


Link to post

Try this:

While ( FI == 12 )
{

if ( ThingCount (201, 20) == 0 ) // if all imps are dead then do something
{
Floor_LowerToLowest(15,24);
FI = 0; 
}

Delay(35);
}
I change the value of FI after the floor lowers so that the script stops working. I think you get that "script terminated" message because the script gets stuck in an infinite loop.

Share this post


Link to post

If you want to keep checking for all monsters being dead, then lower the floor ONCE after they're all dead:

I'd delete this line and below it:
While ( FI = 12 )

Then replace with this:

int checkingForAllDead = 1;
while(checkingForAllDead == 1)
{
    if( ThingCount (201, 20) == 0 )
    {
        Floor_LowerToLowest(15,24);
        checkingForAllDead = 0;
    }
    delay(1);
}
or you can just put while(checkingForAllDead)

Or here's the same thing using a break instead of an extra variable (while(1) is an infinite loope so needs to be broken out of):
while(1)
{
    if( ThingCount (201, 20) == 0 )
    {
        Floor_LowerToLowest(15,24);
        break;
    }
    delay(1);
}
make the delay number higher if you want it to be less computationally intensive (but then it'd only check every n ticks instead of every tic so might have a delay before lowering.

Share this post


Link to post

Thank you for your help.

How to remove sector's damaging ability by ACS? I tried using "SectorDamage" and "Sector_SetDamage" setting the amount and type/mod to 0. The sectors originally damage as "Hell slime" or 20 per second.

Any idea?

Share this post


Link to post

Boom has "lower floor and remove effect" type of stuff, but I don't see that for acs "doom in hexen" maps. I found this page:
http://zdoom.org/wiki/Sector_damage

If all else fails, I would know how to do the sectordamage option probably. Make your intended damaging sectors normal/nondamaging, but tag them:

int floorIsDamaging = 1;
script 1 open
{
    while(floorIsDamaging)
    {
        SectorDamage (int tag, int amount, str type, str protection_item, int flags)
        delay(35);
    }
}
then when you want them to not damage, set floorIsDamaging to 0.

Share this post


Link to post
gggmork said:

Boom has "lower floor and remove effect" type of stuff, but I don't see that for acs "doom in hexen" maps. I found this page:
http://zdoom.org/wiki/Sector_damage

If all else fails, I would know how to do the sectordamage option probably. Make your intended damaging sectors normal/nondamaging, but tag them:

then when you want them to not damage, set floorIsDamaging to 0.


That's pretty neat, it worked fine.

Share this post


Link to post
gggmork said:

Boom has "lower floor and remove effect" type of stuff, but I don't see that for acs "doom in hexen" maps.


Every linetype in Boom has a corresponding Hexen-style special in ZDoom. You'd probably want to look at Generic_Floor.

Share this post


Link to post

Are there any ways to make the intermission screen ingame? (%Kills, Items and Secrets?)

Share this post


Link to post

http://zdoom.org/wiki/GetLevelInfo

Here's a guess:

int percentSecrets = (getLevelInfo(LEVELINFO_FOUND_SECRETS)*100) / getLevelInfo(LEVELINFO_TOTAL_SECRETS)*1.0;

print(f: percentSecrets);
to find percent its:
found / total = ?/100
then cross multiply:
? = (100*found)/total

The 1.0 crap is because integer division cuts off remainder:
5/4 is just 1 even
but:
5.0 / 4 or 5 / 4.0 makes a decimal (fixed point) answer like normal)
but if both are decimal you have to use fixeddiv():
fixeddiv(5.0, 4.0)

Or something, didn't test any of that.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×