GrAVit
Senior Member
Posts: 580
Threads: 15
Joined: Oct 2011
Reputation:
22
|
Can't make door explode?
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.
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, 10:33 PM |
|
JenniferOrange
Senior Member
Posts: 424
Threads: 43
Joined: Jun 2011
Reputation:
33
|
RE: Can't make door explode?
Ba-da bing, ba-da boom.
|
|
02-03-2012, 11:42 PM |
|
GrAVit
Senior Member
Posts: 580
Threads: 15
Joined: Oct 2011
Reputation:
22
|
RE: Can't make door explode?
(02-03-2012, 11:42 PM)JenniferOrange Wrote: http://wiki.frictionalgames.com/hpl2/tut...oding_door
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.
|
|
02-03-2012, 11:46 PM |
|
JenniferOrange
Senior Member
Posts: 424
Threads: 43
Joined: Jun 2011
Reputation:
33
|
RE: Can't make door explode?
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.
Ba-da bing, ba-da boom.
(This post was last modified: 02-03-2012, 11:52 PM by JenniferOrange.)
|
|
02-03-2012, 11:50 PM |
|
GrAVit
Senior Member
Posts: 580
Threads: 15
Joined: Oct 2011
Reputation:
22
|
RE: Can't make door explode?
(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:56 PM |
|
RawkBandMan
Posting Freak
Posts: 1,146
Threads: 35
Joined: Nov 2010
Reputation:
5
|
RE: Can't make door explode?
(02-03-2012, 11:42 PM)JenniferOrange Wrote: http://wiki.frictionalgames.com/hpl2/tut...oding_door
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);
}
:|
I've come to learn to not fear the living, nor the dead... But the monsters that hide in closets.
|
|
02-04-2012, 03:43 PM |
|
JenniferOrange
Senior Member
Posts: 424
Threads: 43
Joined: Jun 2011
Reputation:
33
|
RE: Can't make door explode?
(02-04-2012, 03:43 PM)XxRoCkBaNdMaNxX Wrote: (02-03-2012, 11:42 PM)JenniferOrange Wrote: http://wiki.frictionalgames.com/hpl2/tut...oding_door
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..
Ba-da bing, ba-da boom.
|
|
02-04-2012, 05:09 PM |
|
|