Jump to content

Silent Hill style door transition script?


Recommended Posts

Posted (edited)

Im trying to emulate the way Silent Hill transitions between entering and exiting doors (screen fades to black, plays the door opening sound, plays door closing sound, and finally fades out of black and the player is in the next room). I replicated this script however, I have a bunch of doors that have this behavior and like 20 so scripts for each door.


 

Spoiler

 

script 2 (void) //Door script
{
 SetPlayerProperty(1,1,4); //Freeze all players
 FadeTo (0, 0, 0, 1.0, 1.0); //Fade to black
 ambientsound("bdoropn",127);
 Delay(40);
 Teleport_NoFog(3,270,68);
 Delay(90);
 FadeTo (0, 0, 0, 0.0, 1.0); //Fade out of black
 SetPlayerProperty(1,0,4); //Unfreeze all players
 ambientsound("bdorcls",127);
}

script 3 (void) //Door script
{
 SetPlayerProperty(1,1,4); //Freeze all players
 FadeTo (0, 0, 0, 1.0, 1.0); //Fade to black
 ambientsound("bdoropn",127);
 Delay(40);
 Teleport_NoFog(4,90,69);
 Delay(90);
 FadeTo (0, 0, 0, 0.0, 1.0); //Fade out of black
 SetPlayerProperty(1,0,4); //Unfreeze all players
 ambientsound("bdorcls",127);
}

 

 

How can I condense or modify the scripts so that I wont end up with 90 scripts envolving the same door opening, closing script behavior?

Edited by Gunrock

Share this post


Link to post

Scripts can take arguments, so you can just write a single script with parameter "dest". This can be applied via script arguments (it should now show up as dest when you choose Script Execute and choose your script).

 

script "door_script" (int dest)
{
	SetPlayerProperty(1,1,4); //Freeze all players
	FadeTo (0, 0, 0, 1.0, 1.0); //Fade to black
	ambientsound("bdoropn",127);
	Delay(40);
	Teleport_NoFog(dest, 1);
	Delay(90);
	FadeTo (0, 0, 0, 0.0, 1.0); //Fade out of black
	SetPlayerProperty(1,0,4); //Unfreeze all players
	ambientsound("bdorcls",127);
}

Not that the Teleport_NoFog useangle acts a bit funky, but if you mess around with the destination thing's angle you should get the behavior you want.

Share this post


Link to post

Thank you!!!! It worked just as how you described it!!! No more typing out 50 scripts for each door. I been mapping for a long time and still learning different things!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...