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

Doom Builder 2 - Multiple Switches Activating at the Same Time

Recommended Posts

[ZDoom/Skulltag] (Doom in Hexen Format)

I have two switches that activated the same thing.

How do I get both switches to activate at the same time if I press one or the other?

(This should be it for a good long while.)

Share this post


Link to post

What exactly is the action for the switch? Are you lowering a floor, opening a door? Depending on what the action is this could be an easy solution.

Share this post


Link to post

Help please? Trying to get 2 switches in the same room (2 different sectors but are joined as 1 sector) to activate at the same time - along with - stay on not having the lift come down in Doom in Hexen Format using Doom Builder 2.

I got the following code (Code 1) from someone - when it is in the script, I could kinda follow it but I am running 5 other scripts on top of this one along with the tag of line and sector being 5 and having SW1SLAD so what it should be is Code 2 but it doesn't work. I tried it with and without (renaming 6 to 1) having the other scripts and it STILL doesn't work.

Code 1:

#include "zcommon.acs"

bool pressed;

script 1 (void)
{
  LocalAmbientSound("switches/normbutn", 127);
  setlinetexture(1, SIDE_FRONT, TEXTURE_MIDDLE, "SWON");
  Plat_UpByValue(1, 10, 105, 8);
  tagwait(1);
  setlinetexture(1, SIDE_FRONT, TEXTURE_MIDDLE, "SWOFF");
}
Code 2:
#include "zcommon.acs"

bool pressed;

script 1 (void){setmusic("d_song2");}
script 2 (void){setmusic("d_song3");}
script 3 (void){setmusic("d_song4");}
script 4 (void){setmusic("d_song5");}
script 5 (void){setmusic("d_song6");}

script 6 (void)
{
  LocalAmbientSound("switches/normbutn", 127);
  setlinetexture(5, SIDE_FRONT, TEXTURE_MIDDLE, "SW2SLAD");
  Plat_UpByValue(5, 8, 0, 424);
  tagwait(5);
  setlinetexture(5, SIDE_FRONT, TEXTURE_MIDDLE, "SW1SLAD");
}

Share this post


Link to post

I'm not big into coding, so I'm not the best source on this, but it looks like part of your problem may be that you are using 2 different line id's within the 2 variations of the script posted for what you wanted to be the same function (though neither work). I notice that these line id's almost match the script numbers they were used for, which leads me to this: are you sure that you've set the first integer within the () to the same number as the switches' line tags?

Share this post


Link to post
Fonze said:

I'm not big into coding, so I'm not the best source on this, but it looks like part of your problem may be that you are using 2 different line id's within the 2 variations of the script posted for what you wanted to be the same function (though neither work). I notice that these line id's almost match the script numbers they were used for, which leads me to this: are you sure that you've set the first integer within the () to the same number as the switches' line tags?

I did - the one who did this did it in UDMF format (which what I speculate is the problem but I could be wrong when doing Hexen Format)

The line tag for both lines are 5 - The lift works but both switches do not activate when one or the other are activated.

Share this post


Link to post
JagDogger2525 said:

The line tag for both lines are 5

SetLineTexture doesn't identify linedefs via their tags, it does so via their line IDs (which are neither tags nor linedef indexes). In UDMF, you set line IDs directly. In Hexen format, you need to use Line_SetIdentification on the line itself, as in, actually put it onto the line as the line's own action (instead of the switch action) just to give it a line ID, and then (if you want the linedef to actually be a switch) assign the switch action to the line via SetLineSpecial, which also uses line IDs to identify lines.

Share this post


Link to post
scifista42 said:

SetLineTexture doesn't identify linedefs via their tags, it does so via their line IDs (which are neither tags nor linedef indexes). In UDMF, you set line IDs directly. In Hexen format, you need to use Line_SetIdentification on the line itself, as in, actually put it onto the line as the line's own action (instead of the switch action) just to give it a line ID, and then (if you want the linedef to actually be a switch) assign the switch action to the line via SetLineSpecial, which also uses line IDs to identify lines.



I am still confused. Right now, I just want both switches to activate at the same time and I do not care about the lift.

The LineDef IDs are 1998 and 2009 with mid texture of SW1SLAD and just want to activate them at the same time using the same things as previously posted.

Please. This is the second to last thing that I need before I am able to finally finish and upload the map and would like for it to work before I start adding the things (weap,ene,heal,item,start).

Share this post


Link to post
JagDogger2525 said:

The LineDef IDs are 1998 and 2009

Those are indexes, not IDs. You need to define IDs yourself, the way I told you.

Share this post


Link to post
scifista42 said:

Those are indexes, not IDs. You need to define IDs yourself, the way I told you.

Oh, well I tried defining the linedef id using action 121 script 7 with the following code and it STILL didn't work

#include "zcommon.acs"

bool pressed;

script 1 (void){setmusic("d_song1");}
script 2 (void){setmusic("d_song2");}
script 3 (void){setmusic("d_song3");}
script 4 (void){setmusic("d_song4");}
script 5 (void){setmusic("d_song5");}
script 6 (void){setmusic("d_song6");}

script 7 (void)
{
  LocalAmbientSound("switches/normbutn", 127);
  setlinetexture(5, SIDE_FRONT, TEXTURE_MIDDLE, "SW2SLAD");
  Plat_UpByValue(5, 8, 0, 424);
  tagwait(5);
  setlinetexture(5, SIDE_FRONT, TEXTURE_MIDDLE, "SW1SLAD");
}
I am using Doom Builder 2.1.2.1553 and testing with GZDoom 2.3.1



scifista42 said:

SetLineTexture doesn't identify linedefs via their tags, it does so via their line IDs (which are neither tags nor linedef indexes). In UDMF, you set line IDs directly. In Hexen format, you need to use Line_SetIdentification on the line itself, as in, actually put it onto the line as the line's own action (instead of the switch action) just to give it a line ID, and then (if you want the linedef to actually be a switch) assign the switch action to the line via SetLineSpecial, which also uses line IDs to identify lines.


SetLineSpecial? UGH - I am still new at this and I am getting confused


I tried this and STILL doesn't work:

Script 7 (void)
{
SetLineSpecial(5,Floor_RaiseToHighest,5,8);
}


What should the script actually look like?

I am stumped beyond belief

Share this post


Link to post

Is the linedef actually tagged with ID 5 ?

At this point it might not be a bad idea to post your map
or a snipet of your map which shows the problem, which
would involve a lot less guesswork in helping you.

Share this post


Link to post
Kappes Buur said:

Is the linedef actually tagged with ID 5 ?

At this point it might not be a bad idea to post your map
or a snipet of your map which shows the problem, which
would involve a lot less guesswork in helping you.


Well, I actually got the solution - I was supposed to have the SetLineSpecial in a separate script of the local, texture, etc. (of which I was not aware) and then it worked.

Line Action: 121; Line ID: 5; Lift Height: 240 (was changed into 424 for my map) - and then script this:

#include "zcommon.acs"

script 7 OPEN
{
setlinespecial(5, 80, 8, 0);
}

script 8 (void)
{
LocalAmbientSound("switches/normbutn", 127);
setlinetexture(5, SIDE_FRONT, TEXTURE_MIDDLE, "SW2LION");
Floor_RaiseByValue(5, 8, 240);
tagwait(5);
setlinetexture(5, SIDE_FRONT, TEXTURE_MIDDLE, "SW1LION");
setlinespecial(5, 0);
}

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×