Frictional Games Forum (read-only)
How to make script "Drop lantern and pick it up" (Solved) - 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: How to make script "Drop lantern and pick it up" (Solved) (/thread-8359.html)



How to make script "Drop lantern and pick it up" (Solved) - HumiliatioN - 05-31-2011

Yep I need to know how?

What code i need to make this script works?

Help is appreciated. Sleepy


RE: How to make script "Drop lantern and pick it up" - Kyle - 05-31-2011

To remove it requires a combination of things to happen.

SetLanternActive(false, true);
SetLanternDisabled(true);
RemoveItem("lantern");

I don't know what you mean to pick it up, but you just simply set the second one active.

SetEntityActive("lantern_2", true);


RE: How to make script "Drop lantern and pick it up" - HumiliatioN - 05-31-2011

(05-31-2011, 11:04 AM)Kyle Wrote: To remove it requires a combination of things to happen.

SetLanternActive(false, true);
SetLanternDisabled(true);
RemoveItem("lantern");

I don't know what you mean to pick it up, but you just simply set the second one active.

SetEntityActive("lantern_2", true);

I mean just that when player pick ups lantern back.. Okay this is the script basically?

Script: AddEntityCollideCallback("Player", "shake_1", "Lanterndrop", true, 1);

SetLanternActive(false, true);
SetLanternDisabled(true);
RemoveItem("lantern");

SetEntityActive("lantern_2", true);

Right?


RE: How to make script "Drop lantern and pick it up" - Kyle - 05-31-2011

Yeah, basically.

And when the player picks it back up, you need to do this:

SetLanternDisabled(false);

So the player can use it again unless you want it to be broken somehow and the player not being able to pick it back up.


RE: How to make script "Drop lantern and pick it up" - HumiliatioN - 05-31-2011


(05-31-2011, 11:13 AM)Kyle Wrote: Yeah, basically.

And when the player picks it back up, you need to do this:

SetLanternDisabled(false);

So the player can use it again unless you want it to be broken somehow and the player not being able to pick it back up.

Okay but can you show simple script how i can do this?

When player walks the area, player gets scared and drop lantern accidentally then pick it up? Like i mean believable script.


RE: How to make script "Drop lantern and pick it up" - Kyle - 05-31-2011

Code:
void OnStart()
{
     AddEntityCollideCallback("Player", shake_1", "Lanterndrop", true, 1);
     SetEntityPlayerInteractCallback("lantern_2", "Lanternpickup", true);
}
void Lanterndrop(string &in asParent, string &in asChild, int alState)
{
     SetLanternActive(false, true);
     SetLanternDisabled(true);
     RemoveItem("lantern");
     SetEntityActive("lantern_2", true);
}
void Lanternpickup(string &in asEntity)
{
     SetLanternDisabled(false);
     SetLanternActive(true, true);
}



RE: How to make script "Drop lantern and pick it up" - HumiliatioN - 05-31-2011

(05-31-2011, 11:38 AM)Kyle Wrote:
Code:
void OnStart()
{
     AddEntityCollideCallback("Player", shake_1", "Lanterndrop", true, 1);
     SetEntityPlayerInteractCallback("lantern_2", "Lanternpickup", true);
}
void Lanterndrop(string &in asParent, string &in asChild, int alState)
{
     SetLanternActive(false, true);
     SetLanternDisabled(true);
     RemoveItem("lantern");
     SetEntityActive("lantern_2", true);
}
void Lanternpickup(string &in asEntity)
{
     SetLanternDisabled(false);
     SetLanternActive(true, true);
}

Thanks now it works and its pretty believable!