(10-29-2013, 03:03 PM)Neelke Wrote: I made a script where a corridor collapses and the screen fades out for a sec. When the screen is back on, the camera is upside down. I have no idea what causes this. But you guys might be able to help me.
The script (if now necessary):
void TimerCollapse(string &in asTimer)
{
FadeOut(0.3);
StopMusic(0.3f, 0);
StartScreenShake(0.1, 4.7, 0.05, 0.5);
FadePlayerFOVMulTo(0.5, 3);
PlaySoundAtEntity("rumble", "general_rock_rumble_no3d.snt", "Player", 0.5f, true);
AddTimer("1", 1.0f, "TimerCaveIn");
AddTimer("3", 3.0f, "TimerCaveIn");
FadePlayerFOVMulTo(4.0f, 4.0f);
SetRadialBlurStartDist(0.1f);
FadeRadialBlurTo(1.0f, 5.0f);
StartEffectFlash(0.2, 0.1,0.3);
SetPlayerActive(false);
AddTimer("caveindone", 3.5f, "TimerCaveInDone");
SetPlayerCrouchDisabled(true);
SetPlayerJumpDisabled(true);
}
void TimerCaveInDone(string &in asTimer)
{
float fCaveInSpeed = 1.0f;
AddLocalVarInt("fCaveInSpeed", 1);
switch(GetLocalVarInt("fCaveInSpeed")){
case 1:
FadeIn(2.0f);
MovePlayerHeadPos(0.0f, 0.8f, 0.5f, 0.8f, 0.8f);
FadePlayerRollTo(30.0f, 2.0f, 2.0f);
StartPlayerLookAt("AreaLook_1", 1.2f, 1.2f, "");
PlayMusic("15_event_elevator.ogg", false, 1.0f, 0.5f, 10, false);
//To avoid it happen again
SetLevelDoorLocked("level_engine_1", true);
SetEntityPlayerInteractCallback("level_engine_1", "InteractCollapsedDoor", false);
fCaveInSpeed = 1.0f;
break;
case 2:
PlaySoundAtEntity("cloth1", "player_crouch", "Player", 0.2f, false);
MovePlayerHeadPos(0.0f, 0.8f, 0.5, 1.2f, 1.2f);
fCaveInSpeed = 1.5f;
break;
case 3:
StartPlayerLookAt("AreaLook_2", 0.5f, 0.5f, "");
FadeOut(5.0f);
PlaySoundAtEntity("sight1", "react_sigh", "Player", 0.5f, false);
fCaveInSpeed = 2.0f;
break;
case 4:
StartPlayerLookAt("AreaLook_3", 2.5f, 2.5f, "");
FadeIn(2.0f);
FadePlayerRollTo(30.0f, 6.0f, 6.0f);
break;
case 5:
PlaySoundAtEntity("sight1", "react_sigh", "Player", 0.5f, false);
StartPlayerLookAt("AreaLook_1", 0.5f, 0.5f, "");
FadePlayerRollTo(30.0f, 10.0f, 10.0f);
FadeOut(3.0f);
break;
case 6:
PlaySoundAtEntity("cloth2", "player_climb", "Player", 0.2f, false);
MovePlayerHeadPos(0.0f, 0.5f, 0.25f, 0.5f, 0.5f);
fCaveInSpeed = 0.5f;
break;
case 7:
FadePlayerRollTo(0.0f, 15.0f, 15.0f);
fCaveInSpeed = 2.0f;
break;
case 8:
PlaySoundAtEntity("sight2", "react_sigh", "Player", 0.4f, false);
FadeIn(2.0f);
FadePlayerRollTo(30.0f, 8.0f, 8.0f);
MovePlayerHeadPos(0.0f, 0.8f, 0.5f, 0.7f, 0.5f);
PlaySoundAtEntity("cloth3", "player_crouch", "Player", 0.2f, false);
break;
case 9:
StartPlayerLookAt("AreaLook_1", 1.0f, 0.5f, "");
fCaveInSpeed = 0.5f;
break;
case 10:
FadePlayerRollTo(30, 30.0f, 30.0f);
PlaySoundAtEntity("cloth4", "player_stand", "Player", 0.2f, false);
fCaveInSpeed = 0.5f;
break;
case 11:
FadePlayerRollTo(0, 0.0f, 0.0f);
PlaySoundAtEntity("cloth5", "player_climb", "Player", 0.5f, false);
fCaveInSpeed = 0.5f;
break;
case 12:
StartPlayerLookAt("AreaLook_2", 1.5f, 1.5f, "");
fCaveInSpeed = 1.0f;
break;
case 13:
SetPlayerCrouchDisabled(false);
SetPlayerJumpDisabled(false);
FadePlayerRollTo(0, 8.0f, 8.0f);
MovePlayerHeadPos(0.0f, 0.0f, 0.0f, 0.8f, 0.8f);
break;
case 14:
SetPlayerActive(true);
break;
}
if(GetLocalVarInt("fCaveInSpeed") < 14) AddTimer("", fCaveInSpeed, "TimerCaveInDone");
}
void TimerCaveIn(string &in asTimer)
{
if(asTimer == "1"){
CreateParticleSystemAtEntity("cavein", "ps_break_cavein_local", "cave_in", false);
PlaySoundAtEntity("caveins", "explosion_rock_large", "cave_in", 0.0f, false);
TeleportPlayer("PlayerStartArea_5");
}
else if(asTimer == "3"){
StopSound("rumble", 3.0f);
}
}
Here's a script should be:
void OnStart ()
{
AddEntityCollideCallback("Player", "Collapse", "TimerCollapse", true, 0);
}
void TimerCollapse(string &in asParent, string &in asChild, int alState)
{
FadeOut(0.3);
StopMusic(0.3f, 0);
StartScreenShake(0.1, 4.7, 0.05, 0.5);
FadePlayerFOVMulTo(0.5, 3);
PlaySoundAtEntity("rumble", "general_rock_rumble_no3d.snt", "Player", 0.5f, true);
FadePlayerFOVMulTo(4.0f, 4.0f);
SetRadialBlurStartDist(0.1f);
FadeRadialBlurTo(1.0f, 5.0f);
StartEffectFlash(0.2, 0.1,0.3);
SetPlayerActive(false);
SetPlayerCrouchDisabled(true);
SetPlayerJumpDisabled(true);
AddTimer("caveindone", 3.5f, "TimerCaveInDone");
AddTimer("1", 1.0f, "TimerCaveIn");
AddTimer("3", 3.0f, "TimerCaveIn");
}
void TimerCaveInDone(string &in asTimer)
{
float fCaveInSpeed = 1.0f;
AddLocalVarInt("fCaveInSpeed", 1);
switch(GetLocalVarInt("fCaveInSpeed")){
case 1:
FadeIn(2.0f);
MovePlayerHeadPos(0.0f, 0.8f, 0.5f, 0.8f, 0.8f);
FadePlayerRollTo(30.0f, 2.0f, 2.0f);
StartPlayerLookAt("AreaLook_1", 1.2f, 1.2f, "");
PlayMusic("15_event_elevator.ogg", false, 1.0f, 0.5f, 10, false);
//To avoid it happen again
SetLevelDoorLocked("level_engine_1", true);
SetEntityPlayerInteractCallback("level_engine_1", "InteractCollapsedDoor", false);
fCaveInSpeed = 1.0f;
break;
case 2:
PlaySoundAtEntity("cloth1", "player_crouch", "Player", 0.2f, false);
MovePlayerHeadPos(0.0f, 0.8f, 0.5, 1.2f, 1.2f);
fCaveInSpeed = 1.5f;
break;
case 3:
StartPlayerLookAt("AreaLook_2", 0.5f, 0.5f, "");
FadeOut(5.0f);
PlaySoundAtEntity("sight1", "react_sigh", "Player", 0.5f, false);
fCaveInSpeed = 2.0f;
break;
case 4:
StartPlayerLookAt("AreaLook_3", 2.5f, 2.5f, "");
FadeIn(2.0f);
FadePlayerRollTo(30.0f, 6.0f, 6.0f);
break;
case 5:
PlaySoundAtEntity("sight1", "react_sigh", "Player", 0.5f, false);
StartPlayerLookAt("AreaLook_1", 0.5f, 0.5f, "");
FadePlayerRollTo(30.0f, 10.0f, 10.0f);
FadeOut(3.0f);
break;
case 6:
PlaySoundAtEntity("cloth2", "player_climb", "Player", 0.2f, false);
MovePlayerHeadPos(0.0f, 0.5f, 0.25f, 0.5f, 0.5f);
fCaveInSpeed = 0.5f;
break;
case 7:
FadePlayerRollTo(0.0f, 15.0f, 15.0f);
fCaveInSpeed = 2.0f;
break;
case 8:
PlaySoundAtEntity("sight2", "react_sigh", "Player", 0.4f, false);
FadeIn(2.0f);
FadePlayerRollTo(30.0f, 8.0f, 8.0f);
MovePlayerHeadPos(0.0f, 0.8f, 0.5f, 0.7f, 0.5f);
PlaySoundAtEntity("cloth3", "player_crouch", "Player", 0.2f, false);
break;
case 9:
StartPlayerLookAt("AreaLook_1", 1.0f, 0.5f, "");
fCaveInSpeed = 0.5f;
break;
case 10:
FadePlayerRollTo(30, 30.0f, 30.0f);
PlaySoundAtEntity("cloth4", "player_stand", "Player", 0.2f, false);
fCaveInSpeed = 0.5f;
break;
case 11:
FadePlayerRollTo(0, 0.0f, 0.0f);
PlaySoundAtEntity("cloth5", "player_climb", "Player", 0.5f, false);
fCaveInSpeed = 0.5f;
break;
case 12:
StartPlayerLookAt("AreaLook_2", 1.5f, 1.5f, "");
fCaveInSpeed = 1.0f;
break;
case 13:
SetPlayerCrouchDisabled(false);
SetPlayerJumpDisabled(false);
FadePlayerRollTo(0, 8.0f, 8.0f);
MovePlayerHeadPos(0.0f, 0.0f, 0.0f, 0.8f, 0.8f);
break;
case 14:
SetPlayerActive(true);
break;
}
if(GetLocalVarInt("fCaveInSpeed") < 14) AddTimer("", fCaveInSpeed, "TimerCaveInDone");
}
void TimerCaveIn(string &in asTimer)
{
if(asTimer == "1"){
CreateParticleSystemAtEntity("cavein", "ps_break_cavein_local", "cave_in", false);
PlaySoundAtEntity("caveins", "explosion_rock_large", "cave_in", 0.0f, false);
TeleportPlayer("PlayerStartArea_5");
}
else if(asTimer == "3"){
StopSound("rumble", 3.0f);
}
}