Frictional Games Forum (read-only)
[REQUEST] Lantern Off - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: [REQUEST] Lantern Off (/thread-8325.html)



Lantern Off - laser50 - 05-29-2011

Imma keep this quick and simple since my cat pissed in my room, I can't find where it is comming from and it smells.
----


What was the code to make a Lantern turn off?


RE: Lantern Off - Tanshaydar - 05-29-2011

Ever checked the wiki? Might come in handy -> http://wiki.frictionalgames.com/hpl2/amnesia/script_functions

Code:
void SetLanternActive(bool abX, bool abUseEffects);

Makes the player use his lantern.


bool GetLanternActive();

Checks whether the player currently uses his lantern.


void SetLanternDisabled(bool abX);

Enables/Disables the player's ability to use his lantern.


void SetLanternLitCallback(string& asCallback);

Sets the function to call when the player uses his lantern.
Callback syntax: MyFunc(bool abLit)



RE: Lantern Off - Ongka - 05-29-2011

SetLanternActive(false, true); // To turn off the lantern.
SetLanternDisabled(true); // To deactivate the lantern.


RE: Lantern Off - laser50 - 05-29-2011

Thanks, Those 2 Functions got me another step further. but i came onto a new question.


In a youtube movie, I saw this door. Not opening or being destroyed, But someone began banging on it.

How do i make something like this?


RE: Lantern Off - Ongka - 05-29-2011

void OnStart()
{
AddEntityCollideCallback("Player", "AreaDoor", "CollideDoor", true, 1);
}

void CollideDoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("door", 0, 0, 20, "World"); // 0, 0, 20 are the x y z coordinates. You may have to adjust them a bit.
GiveSanityDamage(6.0f, true);
PlaySoundAtEntity("", "hit_wood.snt", "door", 0.0f, false);
AddTimer("DoorTimer", 1.0f, "TimerDoor");
}

void TimerDoor(string &in asTimer)
{
AddPropImpulse("door", 0, 0, 20, "World");
PlaySoundAtEntity("", "scare_male_terrified.snt", "door", 0.0f, false);
SetPropHealth("door", 20); //Only if you wish to damage the door.
}


RE: Lantern Off - laser50 - 05-29-2011

Thank you. I hope the stuff i'm trying works out Big Grin