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:
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.