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

Hexen - Switch doesn't work [solved]

Recommended Posts

Hi,

I am not sure if I really understand how the switches work in Hexen. So I created a switch. 121 - line identification set as "41"

Then I made a script that shows a message

script 37 (void)
{
sectorsound("Switch1", 127);
sectorsound("SwitchOtherLevel", 127);
setlinetexture(41, SIDE_FRONT, TEXTURE_MIDDLE, "SW_OL2");
delay(const: 2);
setlinetexture(41, SIDE_FRONT, TEXTURE_MIDDLE, "SW_OL3");
delay(const: 2);
setlinetexture(41, SIDE_FRONT, TEXTURE_MIDDLE, "SW_OL4");
delay(const: 2);
setlinetexture(41, SIDE_FRONT, TEXTURE_MIDDLE, "SW_OL5");
printbold(s: "NOTHING HAPPENED");
}


It was originally a script number 17, however it doesn't work in the game and it shows something like "Cannot execute script 37"

37?

So I changed the script to 37 and it works all of sudden.

I made another switch and I its line is set as 30

script 32 (void)
{
if (gametype() != GAME_NET_DEATHMATCH)
{
sectorsound("SwitchOtherLevel", 127);
setlinetexture(30, SIDE_FRONT, TEXTURE_MIDDLE, "SW_OL2");
delay(const: 2);
setlinetexture(30, SIDE_FRONT, TEXTURE_MIDDLE, "SW_OL3");
delay(const: 2);
setlinetexture(30, SIDE_FRONT, TEXTURE_MIDDLE, "SW_OL4");
delay(const: 2);
setlinetexture(30, SIDE_FRONT, TEXTURE_MIDDLE, "SW_OL5");
ACS_Execute(const: 21, 1, 0, 0, 0);
printbold(s: "A SECRET DOOR OPENED");
delay(const: 96);
}
}


But this time the switch does nothing!

How come? Is there any explanation? It's MAP02

Share this post


Link to post
enkeli33 said:

But this time the switch does nothing!

Is the switch's Action "ACS_Execute" with parameter "32" and Activation type "Player presses use" and the linedef's front side faces the player who uses it?

Share this post


Link to post
scifista42 said:

Is the switch's Action "ACS_Execute" with parameter "32" and Activation type "Player presses use" and the linedef's front side faces the player who uses it?


Nah It has only line identification.

That's how are all these switches set in each map in original Hexen.

However I tried to set it as a script execute like you suggested and it kinda works, except the texture changing, so no animation :)

Share this post


Link to post

How were you executing script 32 before? I thought it was by a switch-activated linedef that executes it upon being pressed. That's what I referred to as a "switch".

Share this post


Link to post
scifista42 said:

How were you executing script 32 before? I thought it was by a switch-activated linedef that executes it upon being pressed. That's what I referred to as a "switch".


Anyhow

The previous switch is only a line identification



And it works

the second on the other hand... :)

Share this post


Link to post

So, how were you executing script 37 in the first example? Where was the script being called from?

Share this post


Link to post
scifista42 said:

So, how were you executing script 37 in the first example? Where was the script being called from?


anyhow

it works by itself (really)

but looks only one times, then not

Share this post


Link to post

A script of type (void) never executes automatically, it has to be called from somewhere. Are you relying on some OPEN/ENTER scripts that execute upon map start and call other scripts?

Share this post


Link to post
scifista42 said:

A script of type (void) never executes automatically, it has to be called from somewhere. Are you relying on some OPEN/ENTER scripts that execute upon map start and call other scripts?


I know it sounds crazy, but look, here is a script from original Hexen: Beyond Heretic Map 02 - Seven Portals





And this is how it's set in the map. So it works somehow even without execution :)

Share this post


Link to post
enkeli33 said:

So it works somehow even without execution :)

No, it doesn't. Either it's called from another script, or from a linedef upon being triggered, or from a thing upon being killed or otherwise triggered. But it HAS to be from somewhere.

EDIT:

Note that it can be assigned to a particular line via SetLineSpecial to be executed when that line will be triggered by the player later. If so, you need to make sure that the respective SetLineSpecial was actually called before the player attempted to trigger that line.

Share this post


Link to post
enkeli33 said:

That's how are all these switches set in each map in original Hexen.



That's only part of how it works. All the actions on these lines are set from within an OPEN script with setlinespecial. Line_SetIdentification by itself does absolutely nothing when a line gets activated.

Share this post


Link to post

Hi, sorry for my late reply, but couple minutes after I posted this, my belly started hurt. I just arrived home from hospital. It was fucking Appendix.

So about the script again. So how should I make it work? For example in map04 I just looked at OPEN scripts and none of these has anytghing to do with linedefs and so on.

I am not sure how it works now :(

script 34 OPEN
{
if (gametype() != GAME_NET_DEATHMATCH)
{
setlinespecial(30, 80, 32, 0, 0, 0, 0);
setlinespecial(31, 80, 33, 0, 0, 0, 0);
}
}


This it maybe the right one!

Share this post


Link to post

Yes, if you set your line ID to 41, you will have to call setlinespecial to make it an active line.

setlinespecial(41 <-- your line ID

setlinespecial(41, 80 <-- ACS_Execute

setlinespecial(41, 80, 37 <-- your script number



Also you don't need the whole "if (gametype() != GAME_NET_DEATHMATCH)" unless you want the line not to have any effect in deathmatch.

Share this post


Link to post
Gez said:

Yes, if you set your line ID to 41, you will have to call setlinespecial to make it an active line.

setlinespecial(41 <-- your line ID

setlinespecial(41, 80 <-- ACS_Execute

setlinespecial(41, 80, 37 <-- your script number



Also you don't need the whole "if (gametype() != GAME_NET_DEATHMATCH)" unless you want the line not to have any effect in deathmatch.


Thanks.
It works now!

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
×