HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
How to make script "Drop lantern and pick it up" (Solved)
Yep I need to know how?
What code i need to make this script works?
Help is appreciated.
“Life is a game, play it”
(This post was last modified: 05-31-2011, 12:28 PM by HumiliatioN.)
|
|
05-31-2011, 10:49 AM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: How to make script "Drop lantern and pick it up"
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 |
|
HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
RE: How to make script "Drop lantern and pick it up"
(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?
“Life is a game, play it”
|
|
05-31-2011, 11:08 AM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: How to make script "Drop lantern and pick it up"
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.
(This post was last modified: 05-31-2011, 11:16 AM by Kyle.)
|
|
05-31-2011, 11:13 AM |
|
HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
RE: How to make script "Drop lantern and pick it 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.
“Life is a game, play it”
(This post was last modified: 05-31-2011, 11:25 AM by HumiliatioN.)
|
|
05-31-2011, 11:23 AM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: How to make script "Drop lantern and pick it up"
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 |
|
HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
RE: How to make script "Drop lantern and pick it up"
(05-31-2011, 11:38 AM)Kyle Wrote: 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!
“Life is a game, play it”
|
|
05-31-2011, 11:42 AM |
|
|