Frictional Games Forum (read-only)

Full Version: Can't make door explode?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, I can't make my "prison_section_plain_2" door explode for colliding with an area.
The door is set locked. It's openamount is 0.

Code:
void OnStart()
{
PlayMusic("04_amb.ogg", true, 1, 0.1, 0, true);
SetEntityCallbackFunc("lantern_2", "OnPickup");
AddEntityCollideCallback("Player","ScriptArea_1","DoorExplode",true,1);
}void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("ScriptArea_1", true);
}void DoorExplode(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("prison_section_plain_2", 10, 100, "");
SetPropHealth("prison_section_plain_2", 0.0f);
GiveSanityDamage(10, true);
PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
FadeImageTrailTo(3, 1);
FadeSepiaColorTo(5, 1);
FadePlayerFOVMulTo(0.7, 0.05);
AddTimer("timerReset", 1.0f, "TimerResetPlayer");
}void TimerResetPlayer(string &in asTimer)
{
ChangePlayerStateToNormal();
StopPlayerLookAt(); FadeImageTrailTo(0, 1);
FadeSepiaColorTo(0, 1);
//FadeRadialBlurTo(0, 1);
FadePlayerFOVMulTo(1, 0.01f); SetPlayerMoveSpeedMul(1);
SetPlayerRunSpeedMul(1);
SetPlayerLookSpeedMul(1);
}

If the door cannot be destroyed like this, is there any workaround?
I do not wish to interact with the door directly.
(02-03-2012, 11:42 PM)JenniferOrange Wrote: [ -> ][url]http://wiki.frictionalgames.com/hpl2/tut...oding_door[/url]
This should help. :]
I've seen it, and it only includes on how to destroy a door with interaction, I would like it to be destroyed when entering a script area.

Change the door to a script area then.

void OnStart()


{
AddEntityCollideCallback("Player", "NAMEOFSCRIPTAREA", "Explode", true, 1);
}


void Explode(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("door1", 0.0f);


PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);


PlaySoundAtEntity("", "react_scare", "Player", 0, false);


PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);


GiveSanityDamage(5.0f, true);
}


WARNING: not tested, though it should work.

EDIT: just realized you tried something like this.
The script is perfectly fine, the problem is, the prison section just can't explode. I know for a fact there are some entities/doors that just won't do certain things. Replace the door with a different one, and try the script again. It should explode this time.
(02-03-2012, 11:50 PM)JenniferOrange Wrote: [ -> ]The script is perfectly fine, the problem is, the prison section just can't explode. I know for a fact there are some entities/doors that just won't do certain things. Replace the door with a different one, and try the script again. It should explode this time.
Alright, thanks. I think I'll make it slam open it then since I can't really fit any other door there.

(02-03-2012, 11:42 PM)JenniferOrange Wrote: [ -> ][url]http://wiki.frictionalgames.com/hpl2/tut...oding_door[/url]
This should help. :]
Hey I noticed a problem there! It says to replace

void func_slam(string &in asParent, string &in asChild, int alState)

With

void func_slam(string &in asEntity)


Then the final script is this

void OnStart()


{
SetEntityPlayerInteractCallback("door1", "func_slam", true);
}


void func_slam(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("door1", 0.0f);


PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);


PlaySoundAtEntity("", "react_scare", "Player", 0, false);


PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);


GiveSanityDamage(5.0f, true);
}




:|


(02-04-2012, 03:43 PM)XxRoCkBaNdMaNxX Wrote: [ -> ]
(02-03-2012, 11:42 PM)JenniferOrange Wrote: [ -> ][url]http://wiki.frictionalgames.com/hpl2/tut...oding_door[/url]
This should help. :]
Hey I noticed a problem there! It says to replace

void func_slam(string &in asParent, string &in asChild, int alState)

With

void func_slam(string &in asEntity)


Then the final script is this

void OnStart()


{
SetEntityPlayerInteractCallback("door1", "func_slam", true);
}


void func_slam(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("door1", 0.0f);


PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);


PlaySoundAtEntity("", "react_scare", "Player", 0, false);


PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);


GiveSanityDamage(5.0f, true);
}




:|
You're right! o:
Unfortunately it's not my tutorial so..