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

How to write a decission?

Recommended Posts

I want to use two switches in a decission (if). For example: the player must flip main generator and then operate switch near pit to raise the bridge. If the player won't switch on the generator, the switch controlling the bridge will do nothing. If generator is turned on, the bridge-switch will rise the bridge.
I think that this is possible, but I don't know the variables.
How to declare two switches? How does ZDoom recognize, that I mean "these" two switches, not the other?
Variable sw1 or sw2 etc., used in some tutorial, doesn't work.

BTW: What are all variables, supported by ZDoom or how to make my own variable (mytexture, mysound etc.)?

Thanx for help. :-}

Share this post


Link to post

It is somewhat tricky to do. I know how to do it without scipting. You simply make a see-through door 1 pixel away from the switch that raises the bridge, then make the "power generator switch" open the see-through door. This lets you activate the switch now. I haven't tried it, but it should work.

Share this post


Link to post

With ACS scripts, this is easy to implement. Write two scripts, something like:

int generator; // declaration

script 10 ( void )
{
  generator = 1;
  print ( s: "Generator on" );
}

script 11 ( void )
{
  if ( generator != 0 )
  {
    // raise or lower the floor, etc...
  }
}

Then assign script 10 to the generator switch, and script 11 to the bridge switch (ACS_Execute special, first parameter is the script number).

Share this post


Link to post

Loser (who isn't :) hit the nail on the head. His scripts should work just fine.

I just wanted to mention the ACS Script Primer I have on the ZDoom Knowledge Base. It will give you an introduction to scripting that may help you.

Share this post


Link to post
loser said:

With ACS scripts, this is easy to implement. Write two scripts, something like:

int generator; // declaration

script 10 ( void )
{
  generator = 1;
  print ( s: "Generator on" );
}

script 11 ( void )
{
  if ( generator != 0 )
  {
    // raise or lower the floor, etc...
  }
}

Then assign script 10 to the generator switch, and script 11 to the bridge switch (ACS_Execute special, first parameter is the script number).

How can that work, at least half the stuff the game needs to know is missing?

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  
×