Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
YukiTakashi

Int Power Take 2

Recommended Posts

I REALLY need to check what goes in what before posting. Well bugger.

Anywho,

Hi, I'm trying something new, a script where to activate a switch to restore power to a door so you can open it again.

Seen other scripts, confusing as heck. Could someone please give me a example for a script like that?

Thanks in advance.

-Omegalore

Share this post


Link to post

here's a little pseudocode to help. hopefully this will give a little idea

bool powered = false;

use door script function
{
if powered == false
print door is not powered. must power to open
electricity crackle scripts go here

else
open door script goes here
script to possibly change indicator from red to green goes here
}

script for switch
{
if powered == false
print door is now powered. you may open the door.
else
print door is already powered.
}

Share this post


Link to post

There is probably a simpler, more elegant way, but this works for me:

#include "zcommon.acs"

int p = 0;

script 1 (void)
{
p++;
print(s:"A door somewhere has been powered.");
}

script 2 (void)
{
if (p == 0)
{
print(s:"The door isn't powered!");
}
else
{
Door_Open(0,80,0);
}
}


I missed that you wanted to do it with a switch, but a simple "if (p == 0) / else" in script 1 could handle the distinction between not powered and already powered.

Here's a simple WAD in ZDoom UDMF that demonstrates it. Try opening the door before and after killing the demon. (As that sentence alone should demonstrate, this WAD is extremely terrible.)

http://www.mediafire.com/download/dgpaplfii31j8g8/scriptdemo.wad

Share this post


Link to post
rdwpa said:

There is probably a simpler, more elegant way, but this works for me:



Alright, that works great with me. Thanks.

Closing thread.

Share this post


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