Frictional Games Forum (read-only)

Full Version: How to make a player collapse?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What is the scripting, that when i touch an area, the character collapses and the screen turns black for 5 seconds. I'm not asking for the exact script (or else i will never learn on my own) but just the names of them, and maybe what goes inside the parenthesis to.
You can check the scripts written in 03_Archives level. When you pick up the third diary note, player falls on the ground. I used it.
(10-21-2011, 01:51 AM)Tanshaydar Wrote: [ -> ]You can check the scripts written in 03_Archives level. When you pick up the third diary note, player falls on the ground. I used it.
I can't tell if this is the right script or not. It's under /*Picking the third diary activates the vision



void MapFlashbackOver()
{
//If the diary flashback is running, then need to set back some stuff when flashback is over.
if(GetLocalVarInt("DiaryFlashbackActive")==1)
{
SetLocalVarInt("DiaryFlashbackActive",0);

FadeImageTrailTo(1.2f, 2);
FadeSepiaColorTo(0.65f, 0.5f);
FadePlayerFOVMulTo(2, 0.04f);
}
}
My thinking is that you would need him to enable force crouching, and then make the players camera (head) rotate and go to the side. You could check maps like "Scroobs castle" because at the start is has something exactly like that.
Oh boy do I have experience with this...

To make collapses etc. you're going to need to work with either a case switch or a timer based setup (I use timers, but that's just personal preference). Here's an example of one of my collapse sequences:

Code:
void UsePotion(string &in asEntity, string &in type)
{
GiveSanityDamage(0,true);
SetPlayerCrouchDisabled(true);
SetPlayerJumpDisabled(true);
SetInventoryDisabled(true);
SetSanityDrainDisabled(true);
SetPlayerMoveSpeedMul(0.6f);
SetPlayerLookSpeedMul(0.4f);
FadeRadialBlurTo(0.1f,8);
AddTimer("PTt2",2,"PotionTimer");
AddTimer("PTt4",4,"PotionTimer");
AddTimer("PTt7p5",7.5f,"PotionTimer");
AddTimer("PTt9",9,"PotionTimer");
}

void PotionTimer(string &in asTimer)
{
if(asTimer == "PTt2")
{
FadePlayerRollTo(25,3,8);
MovePlayerHeadPos(-0.2f,-0.3f,0,0.2f,1);
}
else if(asTimer == "PTt4")
{
FadePlayerRollTo(-45,5,15);
MovePlayerHeadPos(0.5f,-1,0,0.3f,1);
FadeOut(3.5f);
}
else if(asTimer == "PTt7p5")
{
PlayGuiSound("player_bodyfall",1);
}
else if(asTimer == "PTt9")
{
ChangeMap("04Laboratory.map","PlayerStartArea_1","","");
}
}

The code is set to activate as soon as the player clicks on a certain potion, and causes the player to collapse and the map to change when it's over.

Collapsing is mostly just the FadePlayerRollTo and MovePlayerHeadPos functions set to play in a certain sequence.