Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Unlock Door by picking up the lantern [Solved]
ShipinShen Offline
Junior Member

Posts: 23
Threads: 7
Joined: Apr 2014
Reputation: 0
#1
Unlock Door by picking up the lantern [Solved]

Hey, does anyone know how to unlock a door by picking up the lantern ?

Thanks for the help Smile

ShipinShen - YouTube
(This post was last modified: 04-21-2014, 12:08 PM by ShipinShen.)
04-21-2014, 03:24 AM
Find Reply
Romulator Offline
Not Tech Support ;-)

Posts: 3,626
Threads: 62
Joined: Jan 2013
Reputation: 195
#2
RE: Unlock Door by picking up the lantern

Firstly, FrictionalGames did do this in their second map, so it would be a good idea to look at how they did it Smile
Search up in the 01_old_archives.hps code for "//BEGIN PICK LANTERN & OIL//"

If you still can't figure it out, let us know where you're getting stuck! (While we can help just by giving code, it's still a good idea to learn about doing these things through looking at other code) Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 04-21-2014, 03:31 AM by Romulator.)
04-21-2014, 03:30 AM
Find Reply
ShipinShen Offline
Junior Member

Posts: 23
Threads: 7
Joined: Apr 2014
Reputation: 0
#3
RE: Unlock Door by picking up the lantern

(04-21-2014, 03:30 AM)Romulator Wrote: Firstly, FrictionalGames did do this in their second map, so it would be a good idea to look at how they did it Smile
Search up in the 01_old_archives.hps code for "//BEGIN PICK LANTERN & OIL//"

If you still can't figure it out, let us know where you're getting stuck! (While we can help just by giving code, it's still a good idea to learn about doing these things through looking at other code) Smile

sure its better to learn things from other codes, but i saw these.. its to high for me, because i think i dont need some if-statements.. also i dont understand this part Big Grin

ShipinShen - YouTube
04-21-2014, 04:33 AM
Find Reply
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: Unlock Door by picking up the lantern

Spoiler below!

PHP Code: (Select All)
void OnStart()
{
SetEntityCallbackFunc("Lantern""OpenDoor");
SetLocalVarInt("Door"0);
}

void OpenDoor(string &in asEntitystring &in type
{
AddLocalVarInt("Door"1);
CheckLocal();
}

void CheckLocal()
{
if (
GetLocalVarInt("Door") == 1)
{
SetSwingDoorLocked("DoorName"falsetrue);
}



"Veni, vidi, vici."
"I came, I saw, I conquered."
04-21-2014, 07:14 AM
Find Reply
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: Unlock Door by picking up the lantern

Actually you don't need a single if-statement.
Just use an interaction-callback.

Think about it like a sentence:
When touching the lantern
---unlock the door.

Now this can be made into an if-statement like this:
When walking through area
---IF the player has the lantern
------unlock the door

Trying is the first step to success.
04-21-2014, 10:34 AM
Find Reply
ShipinShen Offline
Junior Member

Posts: 23
Threads: 7
Joined: Apr 2014
Reputation: 0
#6
RE: Unlock Door by picking up the lantern

(04-21-2014, 07:14 AM)SomethingRidiculous Wrote:
Spoiler below!

PHP Code: (Select All)
void OnStart()
{
SetEntityCallbackFunc("Lantern""OpenDoor");
SetLocalVarInt("Door"0);
}

void OpenDoor(string &in asEntitystring &in type
{
AddLocalVarInt("Door"1);
CheckLocal();
}

void CheckLocal()
{
if (
GetLocalVarInt("Door") == 1)
{
SetSwingDoorLocked("DoorName"falsetrue);
}



Thanks a lot man!

ShipinShen - YouTube
04-21-2014, 12:07 PM
Find Reply




Users browsing this thread: 1 Guest(s)