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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script help for level door
afroduckie Offline
Junior Member

Posts: 35
Threads: 12
Joined: Jan 2013
Reputation: 0
#1
Script help for level door

This is the script for a locked level door. the key you need is level_4_key.
It is supposed to activate a grunt when the door is unlocked (as a scare).

void UseKey(string &in asItem, string &in asEntity)
{
AddUseItemCallback("", "level_4_key", "level4", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("level4", true);
PlaySoundAtEntity("", "unlock_door", "level4", 0, false);
RemoveItem("level_4_key");
SetEntityActive("servant_grunt", true);
}

Where did I go wrong?
02-10-2013, 02:21 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#2
RE: Script help for level door

Put
AddUseItemCallback("", "level_4_key", "level4", "UsedKeyOnDoor", true);
in your OnStart function.

Like this:
PHP Code: (Select All)
void OnStart()
{
    
AddUseItemCallback("""level_4_key""level4""UsedKeyOnDoor"true);


In Ruins [WIP]
(This post was last modified: 02-10-2013, 02:32 AM by NaxEla.)
02-10-2013, 02:31 AM
Find
No Author Offline
Posting Freak

Posts: 962
Threads: 10
Joined: Jun 2012
Reputation: 13
#3
RE: Script help for level door

I thought unlocking level doors use a different script.

EDIT : Never mind.

[Image: the-cabin-in-the-woods-masked-people.jpg]
(This post was last modified: 02-10-2013, 02:44 AM by No Author.)
02-10-2013, 02:39 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#4
RE: Script help for level door

Oh, I also just realized: In this line of your code:
SetLevelDoorLocked("level4", true);
you are actually making the door locked. By change true to false, it will unlock it.

@No Author
Swing doors use SetSwingDoorLocked, and level doors use SetLevelDoorLocked. So, yes, they do use slightly different functions.

In Ruins [WIP]
02-10-2013, 02:43 AM
Find
No Author Offline
Posting Freak

Posts: 962
Threads: 10
Joined: Jun 2012
Reputation: 13
#5
RE: Script help for level door

(02-10-2013, 02:43 AM)NaxEla Wrote: Oh, I also just realized: In this line of your code:
SetLevelDoorLocked("level4", true);
you are actually making the door locked. By change true to false, it will unlock it.

@No Author
Swing doors use SetSwingDoorLocked, and level doors use SetLevelDoorLocked. So, yes, they do use slightly different functions.

Lol. I didn't read it clearly in the first place.
I really need to improve my reading.

[Image: the-cabin-in-the-woods-masked-people.jpg]
02-10-2013, 02:56 AM
Find
afroduckie Offline
Junior Member

Posts: 35
Threads: 12
Joined: Jan 2013
Reputation: 0
#6
RE: Script help for level door

(02-10-2013, 02:56 AM)No Author Wrote:
(02-10-2013, 02:43 AM)NaxEla Wrote: Oh, I also just realized: In this line of your code:
SetLevelDoorLocked("level4", true);
you are actually making the door locked. By change true to false, it will unlock it.

@No Author
Swing doors use SetSwingDoorLocked, and level doors use SetLevelDoorLocked. So, yes, they do use slightly different functions.

Lol. I didn't read it clearly in the first place.
I really need to improve my reading.

I did notice that. Thanks for pointing it out.
02-10-2013, 03:00 AM
Find




Users browsing this thread: 1 Guest(s)