Gunrock Posted March 24 (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 March 24 by Gunrock 1 Quote Share this post Link to post
Aurelius Posted March 24 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. 1 Quote Share this post Link to post
Gunrock Posted March 24 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! 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.