Frictional Games Forum (read-only)

Full Version: Door Explosion.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here again.. Hopefully soon I won't have to revert to asking you lot for advice/help. You're an incredibly helpful lot, but I'd rather not waste my time, nor yours. But to the point. I'm trying to script a door, so that when the player tries to open it, it explodes outwards and knocks them back. Then, a broken door appears on the floor next to them. When the door explodes, the screen fades to white momentarily, as otherwise they would see the original door disintegrate. (I have not yet scripted it so that the player moves back with the explosion - would that require another area on the level editor?)

Here is my script so far :
PHP Code:
void OnStart()
{
}

////////////////////////////
// Run when entering map

void OnEnter()
{
AddUseItemCallback("""room101key""room101""UsedKeyOnDoor"true);
AddUseItemCallback("""room100key""room100""UsedKeyOnDoor"true);
AddUseItemCallback("""hollow_needle_1""padlock_rusty_1""unlock_prison_section_1"true);
AddEntityCollideCallback("Player""prison_1swingarea""func_slam"true1);
SetEntityPlayerInteractCallback("prison_1""func_slam"true);
SetEntityCallbackFunc("room100key""OnPickup");
SetEntityCallbackFunc("NOTETWO""OnPickup");
}

void func_slam(string &in asEntity)
{
SetPropHealth("prison_1"0.0f);
PlaySoundAtEntity("""react_breath_slow.snt""Player"0false);
PlaySoundAtEntity("""react_scare""Player"0false);
PlaySoundAtEntity("""close_door.snt""Player"0false);
GiveSanityDamage(5.0ftrue);
StartEffectFlash(0.2f 12.0f);
AddTimer(""0.5f"prisondoorbreak");

}

void prisondoorbreak(string &in asTimer)
{
SetEntityActive("prison_1_broken"true);
}

void unlock_prison_section_1(string &in asItemstring &in asEntity)
{
SetPropHealth("padlock_rusty_1"0.0f);
SetEntityActive("padlock_broken_1"true);
RemoveItem("hollow_needle_1");
SetEntityActive("padlock_rusty_1"false);
PlaySoundAtEntity("""break_wood_metal.snt""padlockarea_1"false);
}

void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked(asEntityfalsetrue);
PlaySoundAtEntity(""asEntity"room101"0false);
PlaySoundAtEntity(""asEntity"room100"0false);
RemoveItem(asItem);
}

void OnPickup(string &in asEntitystring &in type)
{
    if(
asEntity == "room100key")
{
  
SetEntityActive("poofer1"true);
  
ShowEnemyPlayerPosition("poofer1");
  
PlaySoundAtEntity("""04_break.snt""poofer1"0false);
  
PlaySoundAtEntity("""react_breath_slow.snt""Player"0false);
  
PlaySoundAtEntity("""react_scare""Player"0false);
  
StartPlayerLookAt("poofer1",7,7,"");
  
GiveSanityDamage(20.0ftrue);
  
AddTimer("",1.5f,"StopLook");
}
    else if(
asEntity == "NOTETWO")
{
  
SetSwingDoorLocked("room102",false,false);
  
SetEntityActive("brute1",true);  
  
ShowEnemyPlayerPosition("brute1");
  
PlaySoundAtEntity("""react_breath_fast.snt""Player"0false);
  
PlaySoundAtEntity("""react_scare""Player"0false);
  
StartPlayerLookAt("brute1",7,7,"");
  
GiveSanityDamage(30.0ftrue);
  
AddTimer("",1.0f,"StopLook");
  
StartScreenShake(0.5f1.5f12);
  
PlaySoundAtEntity("","explosion_rock_large.snt","brute1",0,false);
}
}

void StopLook(string &in asTimer
{
  
StopPlayerLookAt();


As of now, the explosion works, the fading to white timer needs to be fixed as it does not hide the disintegration properly, but the broken door does not appear on the floor as it should.
There's a door explosion tutorial in the wiki.
(06-21-2012, 11:57 AM)CrazyArts Wrote: [ -> ]There's a door explosion tutorial in the wiki.
I'm aware of that - As I said, the actual explosion part works, but the extras do not.

EDIT: Never mind, I sorted it out.