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

weird script bug

Recommended Posts

i encountered a pretty weird bug in my current map.

here's the script:

#include "zcommon.acs"
 //created by zzzornbringer

script 50(void) //trap starting room
{
SpawnSpotFacingForced("zcacodemon",21,98);
while((thingcount("zcacodemon",98)==1))
{
Light_Fade(50,64,50);
Light_Fade(51,64,50);
Light_Fade(52,64,50);
Light_Fade(53,64,50);
delay(50);
while((thingcount("zcacodemon",98)==1))
{
int x =random(64,92);
int y=random(224,255);
Light_Fade(50,x,2);
Light_Fade(51,x,2);
Light_Fade(52,x,2);
Light_Fade(53,x,2);
delay(random(2,4));
Light_Fade(50,y,2);
Light_Fade(51,y,2);
Light_Fade(52,y,2);
Light_Fade(53,y,2);
delay(random(2,4));
}
}
Light_Fade(50,92,2);
Light_Fade(51,92,2);
Light_Fade(52,92,2);
Light_Fade(53,92,2);
delay(50);
Light_Fade(50,255,100);
Light_Fade(51,160,100);
Light_Fade(52,224,100);
Light_Fade(53,192,100);
}

script 88(void)
{
switch(random(1,6))
{
case 1:
print(s:"\cgthis is the end");
break;
case 2:
print(s:"\cgnothing here");
break;
case 3:
print(s:"\cgcome back later");
break;
case 4:
print(s:"\cgthis door won't open");
break;
case 5:
print(s:"\cgout of order");
break;
case 6:
print(s:"\cgthanks for playing");
break;
}
}

script 40 enter //lightsequence
{
while(true)
{
for(int x=41;x<=44;x++)
{
Light_Fade(x,255,5);
delay(5);
Light_Fade(x,160,5);
delay(5);
}
for(int y=41;y<=44;y++)
{
Light_Fade(y,255,5);
delay(5);
Light_Fade(y,160,5);
delay(5);
}
x=41;
y=41;
}
}

script 30 (void) //plat activate by player
{
Plat_DownWaitUpStay(30,16,150);
}

script 80 enter 
{
SpawnSpotFacingForced("zhangingvictim",80,0);
}

script 10 (void) //trap_door hallway
{
Generic_Door(10,64,1,0,0);delay(1);
while(true)
{
Light_Fade(1,128,2);
delay(random(2,4));
Light_Fade(1,224,2);
delay(random(2,4));
}
}

script 2 enter //light_flicker 
{
while(true)
{
int x=1;
delay(random(100,500));
Light_Fade(2,128,5);
delay(5);
Light_Fade(2,255,5);

for(x=1;x<=10;x++)
{
Light_Fade(2,128,4);
delay(2);
Light_Fade(2,255,4);
}
delay(random(100,500));
Light_Fade(2,128,10);
delay(5);
Light_Fade(2,255,10);
}
}

script 12 (void) //generic_door
{
Generic_Door(12,16,0,34,0);
}

script 13 (void) //generic_door
{
Generic_Door(13,16,0,34,0);
}
script 14 (void) //generic_door
{
Generic_Door(14,16,0,34,0);
}
script 15 (void) //generic_door
{
Generic_Door(15,16,0,34,0);
}

script 20 enter //monster_spawn hallway, plat room, light room
{
SpawnSpotFacingForced("zzombieman",18,99);
SpawnSpotFacingForced("zshotgunguy",19,99);
SpawnSpotFacingForced("zsupershotgunguy",20,99);
SpawnSpotFacingForced("zshotgunguy",24,96);
}




script 22 (void) //monster_spawn big room
{
SpawnSpotFacingForced("zcacodemon",22,97);
for(int x=1;x<=8;x++)
{
spawnspotfacingforced("TeleportFog",23,0);
delay(25);
SpawnSpotFacingForced("zbloodimp",23,96);
delay(random(50,100));
}
}

script 24 (void) //trapdoor plat room
{
floor_lowerbyvalue(24,64,120);
}

script 25 (void)
{
for(int x=1;x<=2;x++)
{
SpawnSpotFacingForced("demon",25,95);
thing_hate(95,0,0);
}
}

script 26 (void)
{
spawnspotfacingforced("TeleportFog",26,0);
delay(25);
SpawnSpotFacingForced("hellknight",26,94);
}

now, you can ignore most of it. i just want to point you to script number 50 at the top. this script gets executed when you pick up a healthpack. a cacodemon is spawned and a light sequence starts as long as it's alive. this version of the script totally works.

however, if i put the script 50 at the bottom or any other position other than the top of the script document, it won't run properly. it will only spawn the cacodemon, turn the lights down and back up. the flicker sequence is skipped for whatever reason.
why is that? the script is exactly the same, i only changed the position within the document which should have no impact on script execution whatsoever.

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  
×