Frictional Games Forum (read-only)

Full Version: How to make script "Drop lantern and pick it up" (Solved)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Yep I need to know how?

What code i need to make this script works?

Help is appreciated. Sleepy
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);
(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?
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.

(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.
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);
}
(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!