having a spawned monster lower a platform when killed ???

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.
Locked
mikenet2007
Posts: 340
Joined: Wed Jan 24, 2007 8:54 pm

having a spawned monster lower a platform when killed ???

Post by mikenet2007 »

Can anyone tell me what is wrong with this code?? How this works is a switch hit by the player lowers a platform enough for a cyberdemon to be released but not enough for the player to leave the area, then when the cyberdemon dies the same platform lowers again allowing the player to move on, the first part works fine but the platform doesn't lower the second time when the Cyberdemon is killed.

This is the code in ACS and the mapspot has a tid of 112


script 79 (void) //this script works as far as lowering the platform and spawning the cyberdemon, perhaps I didnt assign the new tid correctly I dont know.
{

Floor_LowerByValue (55,7,260);
Floor_LowerByValue (5,7,260);

SpawnSpot ("CYBERDEMON",112,113,0); // I believe 113 here assigns a new tid to the spawned monster.
}


script 81 (void) {
if (ThingCount(T_CYBERDEMON,113) == 0){
Floor_LowerByValue (55,7,100);
Floor_LowerByValue (5,7,100);
}
}

// This script doesn't work and I cant figure out why, it worked before on a set of monsters that didn't have to be spawned in another area of the map, but this time I cant get it to further lower the platform that is lowered in script 79. Its almost as if the function for that script is terminated and wont work again. I dont know whats going on, any ideas?
User avatar
Doomguy0505
Posts: 625
Joined: Tue Mar 29, 2005 4:53 am
Contact:

Post by Doomguy0505 »

Code: Select all

script 79 (void)
{
	Floor_LowerByValue (55,7,260);
	Floor_LowerByValue (5,7,260);
	SpawnSpot ("CYBERDEMON",112,113,0);
	ACS_Execute(81, 0, 0, 0, 0);
}
script 81 (void)
{
	do
	{
		Floor_LowerByValue (55,7,100);
		Floor_LowerByValue (5,7,100);
		delay(1);
	} while(ThingCount(T_CYBERDEMON,113));
}
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

Even better,

Code: Select all

script 79 (void)
{
  Floor_LowerByValue (55,7,260);
  Floor_LowerByValue (5,7,260);
  SpawnSpot ("CYBERDEMON",112,113,0);
  SetThingSpecial(113, ACS_Execute, 81 ); // When the CyberDemon dies, do this
}

script 81 (void)
{
  Floor_LowerByValue (55,7,100);
  Floor_LowerByValue (5,7,100);
}
mikenet2007
Posts: 340
Joined: Wed Jan 24, 2007 8:54 pm

Post by mikenet2007 »

Well I almost got the first one to work, only problem is it didn't stop working, for some reason or another after the first script was executed the platform continued to lower nonstop until I killed the Cyberdemon then it lowered the additional 100 units and stopped. I'm sure there is a quick fix for that script maybe by adding acs_terminate somewhere, but I tried the second one and it seemed to work out good, thanks to both of you for the help.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

The first solution was just plain wrong, because it looped on the condition that the Cyberdemon had NOT been killed, rather than the other way around.
User avatar
Isle
Posts: 687
Joined: Fri Nov 21, 2003 1:30 am
Location: Arizona, USA

Post by Isle »

nah, you'd want it to loop while the cyb was alive. you just need to move the actions after the loop so it dosent do anything untill after the cyb is dead.

Code: Select all

script 81 (void) 
{ 
   do //nothing! lol
   { 
      delay(1); 
   } while(ThingCount(T_CYBERDEMON,113)); 
   Floor_LowerByValue (55,7,100); 
   Floor_LowerByValue (5,7,100); 
}
User avatar
Doomguy0505
Posts: 625
Joined: Tue Mar 29, 2005 4:53 am
Contact:

Post by Doomguy0505 »

HotWax wrote:The first solution was just plain wrong, because it looped on the condition that the Cyberdemon had NOT been killed, rather than the other way around.
I forgot to test that script :oops:
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Post by Ryan Cordell »

Since when the hell was 'do' in ACS?
User avatar
Doomguy0505
Posts: 625
Joined: Tue Mar 29, 2005 4:53 am
Contact:

Post by Doomguy0505 »

Is it documented?
User avatar
Isle
Posts: 687
Joined: Fri Nov 21, 2003 1:30 am
Location: Arizona, USA

Post by Isle »

Blade Nightflame wrote:Since when the hell was 'do' in ACS?
for as long as 'while' has been I should hope.
User avatar
Niya
Posts: 150
Joined: Thu Sep 14, 2006 8:56 pm

Post by Niya »

There is no do in ACS.
User avatar
Isle
Posts: 687
Joined: Fri Nov 21, 2003 1:30 am
Location: Arizona, USA

Post by Isle »

dude you fail, hard.
User avatar
Niya
Posts: 150
Joined: Thu Sep 14, 2006 8:56 pm

Post by Niya »

Oh shit yeah.......You're right.
Locked

Return to “Editing (Archive)”