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

Switch behavior on 3D sectors?

Recommended Posts

Hi all.

Situation: regular sector with switch effect applied to one of its linedefs. 3D sector with switch texture superimposed on regular sector at run-time (and in DB2, all hail Visual Mode plugin).

Predictable result: switch functions, but no texture change and/or switch sound. Crowd rages.

ACS Workaround: use SetLineTexture and ThingSound to simulate switch being pressed. Crowd cheers.

It works, of course, but it seems a little hackish. Is there a "legitimate" way to get the beforementioned 3D sector to play nice? It doesn't seem possible, but I just want to make sure.

Thanks!

Share this post


Link to post

Assign your switch texture and specials to the upper texture of your in-game sector; the relevant linedef of the control sector can have any texture.

The most effective way to achieve the switching action is to give the in-game linedef with the switch texture a Line_SetIdentification special. Then use ACS to activate the actual switching action.

Example (with Line ID = 1):

Script 1 OPEN
{
SetLineSpecial(1,80,2,0,0,0,0); //Switch triggers script 2
}

script 2 (void)
{
[Switching action, e.g. open door]
}

Share this post


Link to post

If I'm not mistaken if you do this the switch will be able to be activated at any height, the player could run under the 3d sector and still activate the switch just because he's on the line. Maybe this isn't happening for you? Either way here is some work around script to alleviate difficulties. The key line is line 2 this makes sure the player is at the correct ZHeight to activate the switch otherwise don't activate the switch.

script 1 (void)
{
if (script1executed == 1) Terminate;
if (GetActorZ(0) < -10 || GetActorZ(0) > 40) Terminate;
script1executed = 1;
ActivatorSound("switches/normbutn",127);
SetLineTexture(19, SIDE_FRONT, TEXTURE_MIDDLE, "SW2GARG");
Floor_LowerByValue(185, 20, 296);
}

Share this post


Link to post

I could be wrong but I interpret the original question as:

There is a switch on the side of my 3D floor. When I use the switch the action works but the switch does not change appearance.


If that is the problem, you can use the flags field of the 3D floor line arguments to tell the 3D floor to use whatever textures are on the upper or lower sidedef of the containing sector rather than the one on the 3DLine. From memory, flag 16 means "use the upper texture" and 32 means "use the lower texture".

So, assuming that such a setup is suitable for your level...

Create your 3D floor using either flag 16 or 32 on the 3D floor line

Put a switch texture on the upper or lower side of the switch line* of the containing sector.

Assign the special to the line as normal and that's it.

When you use the line, the upper/lower texture changes (even if you can't see it) and the change is transferred to the 3D floor.


*You would probably want to do this where there is no height difference between the ceiling (or floor if you used flag 32) of the containing sector and the one adjacent to it so the switch cannot be seen anywhere other than the side of the 3D floor.


If you want to make sure that the player can only activate the switch when they are at the right height then use what Pottus gave you but there would be no need for the line that changes the texture.

Share this post


Link to post

Assign your switch texture and specials to the upper texture of your in-game sector; the relevant linedef of the control sector can have any texture.


UDMF-only, I guess? Just plopping down some textures didn't seem to do anything.

Edit: Actually, assigning flag 16 and an upper texture made the entire 3D sector disappear. I'm supposed to assign it to the control sector, right? *puzzled look*

There is a switch on the side of my 3D floor. When I use the switch the action works but the switch does not change appearance.


Actually, the switch effect is completely seperate from the 3D floor - which is obviously why the 3D floor doesn't respond to me flipping the switch. I fixed that with some ACS stuff, but it kind of made me feel like I was re-inventing the wheel.

@Pottus: Yeah, I already had a Z check in place. Of course, I had to screw up first before that came to mind - but you live, you learn.

Share this post


Link to post
Luke Gevaerts said:

Actually, assigning flag 16 and an upper texture made the entire 3D sector disappear. I'm supposed to assign it to the control sector, right? *puzzled look*

I may have misunderstood your question. I had believed that you have a switch composed of a 3D sector. In other words, a switch that sticks out of the wall.

Perhaps if you post a picture of what you have right now it will allow us to understand your question better.

Share this post


Link to post

Well, here's four screenshots. The metal thing circled red is the sector that'll get lowered by the switch; feel free to ignore that.

http://www.femlob.com/temp/switch-db2-a.jpg (floating inside some map elements, hence the weird view)
http://www.femlob.com/temp/switch-db2-b.jpg (grid view; the switch is the small rectangle near the Visual Mode Camera thing)
http://www.femlob.com/temp/switch-gzdoom-a.jpg (in-game)
http://www.femlob.com/temp/switch-gzdoom-b.jpg (in-game, taken from the bottom of the poison basin to try and visualize the whole 3D thing)

The switch, as stated, is just a regular sector with the switch effect applied to a linedef; the 3D sector is placed on top of it. And under it. Actually, there's a lot of 3D shit going on there. Anyway.

Share this post


Link to post
Luke Gevaerts said:

Edit: Actually, assigning flag 16 and an upper texture made the entire 3D sector disappear.


Correct. The 16 tells the game to put what ever is on the upper sidedef of the containing sector on to the side of the 3D floor. If you do not have anything on the upper sidedef, then there will nothing on the side of the 3D sector.

If you want, you can download this example. The final switch does what you want (I think). It has sloped 3D floors so GZDoom only, not ZDoom.

http://www.zen64060.zen.co.uk/examples/3d_floor.zip

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×