Frictional Games Forum (read-only)
[SCRIPT] What if player leaves level without lantern? - 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] What if player leaves level without lantern? (/thread-19194.html)



What if player leaves level without lantern? - jamistara - 11-12-2012

Hi! I started creating custom story called : Unconscious : Prelude .
I have a problem, that when the game starts, there is lantern in front of player. What if player doesnt take lantern and goes trough level door??! Thats my problem. Would someone send me complete script, because i tried to script it but i just doesnt work! Help guys, please!!!


RE: What if player leaves level without lantern? - Steve - 11-12-2012

Make an area at some point (just befor the door or something) and and put the leveldoor or swingdoor at locked and so when the player touches the area you activate (unlock with swingdoor) the unactive leveldoor that does teleport you to the next map. if you know what I mean. use this script you do have to fill in some names though but I'll highlighted them.
Spoiler below!

OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "haslantern", true, 1);
}
void haslantern(string &in asParent, string &in asChild, int alState)
{
if(HasItem("Lantern"))
{
SetEntityActive("THEOPENABLEDOORNAME", true);
SetEntityActive("THENOTWORKINGDOOR", false);
}
}

all you have to do further is to put a message on the not opanable door that says something like"I think I should take the lantern with me" if you have any questions be sure to ask Big Grin


RE: What if player leaves level without lantern? - jamistara - 11-12-2012

(11-12-2012, 04:54 PM)Steve Wrote: Make an area at some point (just befor the door or something) and and put the leveldoor or swingdoor at locked and so when the player touches the area you activate (unlock with swingdoor) the unactive leveldoor that does teleport you to the next map. if you know what I mean. use this script you do have to fill in some names though but I'll highlighted them.
Spoiler below!

OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "haslantern", true, 1);
}
void haslantern(string &in asParent, string &in asChild, int alState)
{
if(HasItem("Lantern"))
{
SetEntityActive("THEOPENABLEDOORNAME", true);
SetEntityActive("THENOTWORKINGDOOR", false);
}
}

all you have to do further is to put a message on the not opanable door that says something like"I think I should take the lantern with me" if you have any questions be sure to ask Big Grin
Its fine, but if i try the door before taking lantern, i will not open Thats Good!!! But when i take lantern after that, the door will not open anymore. My english is not good, but hope you understand, tell me if you not Big Grin

(11-12-2012, 05:35 PM)jamistara Wrote:
(11-12-2012, 04:54 PM)Steve Wrote: Make an area at some point (just befor the door or something) and and put the leveldoor or swingdoor at locked and so when the player touches the area you activate (unlock with swingdoor) the unactive leveldoor that does teleport you to the next map. if you know what I mean. use this script you do have to fill in some names though but I'll highlighted them.
Spoiler below!

OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "haslantern", true, 1);
}
void haslantern(string &in asParent, string &in asChild, int alState)
{
if(HasItem("Lantern"))
{
SetEntityActive("THEOPENABLEDOORNAME", true);
SetEntityActive("THENOTWORKINGDOOR", false);
}
}

all you have to do further is to put a message on the not opanable door that says something like"I think I should take the lantern with me" if you have any questions be sure to ask Big Grin
Its fine, but if i try the door before taking lantern, i will not open Thats Good!!! But when i take lantern after that, the door will not open anymore. My english is not good, but hope you understand, tell me if you not Big Grin
I meant IT will not open Big Grin


RE: What if player leaves level without lantern? - Your Computer - 11-12-2012

You should have the level door start off as locked, and have the locked message inform the player that the lantern is needed to progress. Then use an interaction callback on the lantern to unlock the door when the player picks up the lantern.


RE: What if player leaves level without lantern? - Steve - 11-12-2012

(11-12-2012, 05:51 PM)Your Computer Wrote: You should have the level door start off as locked, and have the locked message inform the player that the lantern is needed to progress. Then use an interaction callback on the lantern to unlock the door when the player picks up the lantern.

Damn that's way easier. I think I was just thinking to complicated at the moment.


RE: What if player leaves level without lantern? - jamistara - 11-12-2012

(11-12-2012, 06:17 PM)Steve Wrote:
(11-12-2012, 05:51 PM)Your Computer Wrote: You should have the level door start off as locked, and have the locked message inform the player that the lantern is needed to progress. Then use an interaction callback on the lantern to unlock the door when the player picks up the lantern.
Hey thanks to you all! It works now, and i can continue my custom story ! You are awesome Big Grin Big Grin
Damn that's way easier. I think I was just thinking to complicated at the moment.