Jump to content

ZDooM scripting question


ReX

Recommended Posts

I have three areas in which I want to execute a delayed damage script (i.e., damage starts occurring a few seconds after entering the area). Two of the areas have only a single entry/exit door, while the third area has three entry/exit doors. I want the delayed damage to reset itself after the player exits any of these areas. That is, after the player leaves one of these areas and re-enters it later, the damage again should begin only after a few seconds. So far I can only get it so that the delayed damage occurs the first time the player enters the area. The next time the player enters that area the damage begins right away. Here is my script:

script 15 (void)
{
delay(const:35*10);
Sector_SetDamage(20,3,0);
}

I have tried it by adding one or both of the following commands:
restart;
delay(const:35*10);
at the end of the script, but that does not work.

I would appreciate any help. Thanks.

Share this post


Link to post

If I'm understanding you right this should work:

script 1 (void)
{
if(lineside() == SIDE_FRONT)
{
delay(const:35*10);
Sector_SetDamage(20, 3, 0);
}
else Sector_SetDamage(0, 0, 0);
}

This will make the script only execute when it is triggered from the front side. Change SIDE_FRONT to SIDE_BACK to reverse that.

Share this post


Link to post

Tarin, I take my hat off to you. When I thought about the problem, the logic was so obscure that I thought no one would respond to my question. But you found an answer, and I'm very grateful. I'm constantly amazed at how much you and others in the DooM community know, and are willing to share with those of us who are learning. Thanks again.

(Btw, when I first implemented your script it didn't solve my problem, and the script continued to behave as before. Then I realized that in the "else" statement you probably meant sector 20, instead of sector 0. I changed that, and Voila! it worked beautifully.)

Share this post


Link to post
Guest
This topic is now closed to further replies.
×
×
  • Create New...