Frictional Games Forum (read-only)
[SCRIPT] Can't make door explode? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Can't make door explode? (/thread-13080.html)



Can't make door explode? - GrAVit - 02-03-2012

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.



RE: Can't make door explode? - JenniferOrange - 02-03-2012

http://wiki.frictionalgames.com/hpl2/tutorials/script/events#the_exploding_door
This should help. :]



RE: Can't make door explode? - GrAVit - 02-03-2012

(02-03-2012, 11:42 PM)JenniferOrange Wrote: http://wiki.frictionalgames.com/hpl2/tutorials/script/events#the_exploding_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.




RE: Can't make door explode? - JenniferOrange - 02-03-2012

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.


RE: Can't make door explode? - GrAVit - 02-03-2012

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




RE: Can't make door explode? - RawkBandMan - 02-04-2012

(02-03-2012, 11:42 PM)JenniferOrange Wrote: http://wiki.frictionalgames.com/hpl2/tutorials/script/events#the_exploding_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);
}




:|





RE: Can't make door explode? - JenniferOrange - 02-04-2012

(02-04-2012, 03:43 PM)XxRoCkBaNdMaNxX Wrote:
(02-03-2012, 11:42 PM)JenniferOrange Wrote: http://wiki.frictionalgames.com/hpl2/tutorials/script/events#the_exploding_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..