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 Unlocking Door [HELP]
wretic91 Offline
Junior Member

Posts: 21
Threads: 11
Joined: Jan 2012
Reputation: 0
#1
Script Unlocking Door [HELP]

Hello,

ok so.. i got the key working with all the names and things... problem is.. i cant unlock the door now.. i will place my .HPS file and .lang file here..maybe you can guys help me out !

HPS FILE
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "Housedoorkey", "housedoor", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("housedoor", false, true);
PlaySoundAtEntity("", "unlock_door", "housedoor", 0, false);
RemoveItem(Housedoorkey);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

---------------------------------------------------------

.LANG file

<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description"> A young adult searching for his missing dad ENJOY!!</Entry>
</CATEGORY>
<CATEGORY Name ="Inventory">
<Entry Name="ItemDesc_Housedoorkey">"Our main key of our House"</Entry>
<Entry Name="ItemName_Housedoorkey">" Main House key"</Entry>

</CATEGORY>

</LANGUAGE>

Wretic.
01-30-2012, 07:32 PM
Find
trollox Offline
Member

Posts: 215
Threads: 16
Joined: Dec 2011
Reputation: 3
#2
RE: Script Unlocking Door [HELP]

////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "Housedoorkey", "housedoor", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("housedoor", false, true);
PlaySoundAtEntity("", "unlock_door", "housedoor", 0, false);
RemoveItem(Housedoorkey);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
}









That should work.
(This post was last modified: 01-30-2012, 07:38 PM by trollox.)
01-30-2012, 07:35 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#3
RE: Script Unlocking Door [HELP]


Try this Smile////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "Housedoorkey", "housedoor", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("housedoor", false, true);
PlaySoundAtEntity("", "unlock_door", "housedoor", 0, false);
RemoveItem(Housedoorkey);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

When Life No Longer Exists
Full-conversion mod
01-30-2012, 07:37 PM
Website Find
wretic91 Offline
Junior Member

Posts: 21
Threads: 11
Joined: Jan 2012
Reputation: 0
#4
RE: Script Unlocking Door [HELP]

it still says Can't Use this item this way! ;[
01-30-2012, 07:39 PM
Find
PerkeleTappaa Offline
Junior Member

Posts: 13
Threads: 2
Joined: Jan 2012
Reputation: 1
#5
RE: Script Unlocking Door [HELP]

Tongue im sorry but i dont know anything about scripts sorry!
01-30-2012, 07:45 PM
Find
trollox Offline
Member

Posts: 215
Threads: 16
Joined: Dec 2011
Reputation: 3
#6
RE: Script Unlocking Door [HELP]

And you named the key housedoorkey in the level editor aswell in the subitemtypename i think it's called aswell?
01-30-2012, 08:04 PM
Find
wretic91 Offline
Junior Member

Posts: 21
Threads: 11
Joined: Jan 2012
Reputation: 0
#7
RE: Script Unlocking Door [HELP]

(01-30-2012, 08:04 PM)trollox Wrote: And you named the key housedoorkey in the level editor aswell in the subitemtypename i think it's called aswell?
yes
01-30-2012, 08:16 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: Script Unlocking Door [HELP]

Never suggest to manually type the name of the door and item for the UsedKeyOnDoor function. That's bad programming. One of the reasons for the existence of functions is to not repeat yourself.

A proper function definition would be:
PHP Code: (Select All)
void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked(asEntityfalsetrue);
    
PlaySoundAtEntity("""unlock_door"asEntity0false);
    
RemoveItem(asItem); // though this is unnecessary given the current use of AddUseItemCallback


Tutorials: From Noob to Pro
01-30-2012, 08:51 PM
Website Find
trollox Offline
Member

Posts: 215
Threads: 16
Joined: Dec 2011
Reputation: 3
#9
RE: Script Unlocking Door [HELP]

(01-30-2012, 08:16 PM)wretic91 Wrote:
(01-30-2012, 08:04 PM)trollox Wrote: And you named the key housedoorkey in the level editor aswell in the subitemtypename i think it's called aswell?
yes
Then i have no ideas mate :/ i'm sort of new to scripting aswell try asking flamez3 he's a pro on scripts.
01-30-2012, 08:52 PM
Find




Users browsing this thread: 2 Guest(s)