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
Key Isn't Opening My 2nd Door?
g2uypie Offline
Junior Member

Posts: 13
Threads: 5
Joined: Jun 2012
Reputation: 1
#1
Exclamation  Key Isn't Opening My 2nd Door?

Every time I use the key on the door, it doesn't open it, and says I cant use it this way. Is there anything wrong with my script?

void OnStart(){SetEntityConnectionStateChangeCallback("lever", "func_shelf");    AddUseItemCallback("", "key_1", "mansion_1", "UsedKeyOnDoor", true);    AddUseItemCallback("", "key_2", "mansion_3", "UsedKeyOnDoor", true);}//----------------------------------------------------------------//void UsedKeyOnDoor(string &in asItem, string &in asEntity){    SetSwingDoorLocked("mansion_1", false, true);    PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);    RemoveItem("key_1");}//----------------------------------------------------------------//void UsedKeyOnDoor2(string &in asItem, string &in asEntity){        SetSwingDoorLocked("mansion_3", false, true);    PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);    RemoveItem("key_2");}//----------------------------------------------------------------//

There is more code, but it's not related to the door.
It's key_2 that isn't opening mansion_3.

EDIT: It's looks terrible in the code section, so i'll provide the file too. I'l rename it from .hps to .txt


Attached Files
.txt   wuthOne.txt (Size: 1.19 KB / Downloads: 81)
(This post was last modified: 09-03-2012, 04:44 AM by g2uypie.)
09-02-2012, 03:10 AM
Website Find
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#2
RE: Key Isn't Opening My 2nd Door?

you forgot a 2 this should work.
void OnStart()
{
SetEntityConnectionStateChangeCallback("lever", "func_shelf");
AddUseItemCallback("", "key_1", "mansion_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_2", "mansion_3", "UsedKeyOnDoor2", true);
}
//----------------------------------------------------------------//
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_1");
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("key_2");
}

void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("shelf",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}

void OnEnter()
{
}
void OnLeave()
{
}
I Highlighted the 2 you were missing

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
09-02-2012, 09:48 AM
Find
g2uypie Offline
Junior Member

Posts: 13
Threads: 5
Joined: Jun 2012
Reputation: 1
#3
RE: Key Isn't Opening My 2nd Door?

(09-02-2012, 09:48 AM)Steve Wrote: you forgot a 2 this should work.
void OnStart()
{
SetEntityConnectionStateChangeCallback("lever", "func_shelf");
AddUseItemCallback("", "key_1", "mansion_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_2", "mansion_3", "UsedKeyOnDoor2", true);
}
//----------------------------------------------------------------//
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_1");
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("key_2");
}

void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("shelf",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}

void OnEnter()
{
}
void OnLeave()
{
}
I Highlighted the 2 you were missing
Thanks a ton! Damn me, and my little mistakes. Coding won't accept that Sad
09-03-2012, 04:44 AM
Website Find




Users browsing this thread: 1 Guest(s)