Frictional Games Forum (read-only)
I need help with multiple keys - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: I need help with multiple keys (/thread-17673.html)



I need help with multiple keys - andrejapotic98 - 08-11-2012

I realy need help so please respond Smile .

I am making my custom story for a while and i already made the key for one locked door.
Now i decided to make another key for the another door.
So what i did, I copied the whole script again and just renamed key and locked door.
When i start the custom story the game crashes and shows:ERR: A function with the same name and parameters already exists.
I dont know whats the problem this is how it looks like:

void OnEnter ()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true) ;
AddUseItemCallback("", "hallwaykey", "HallWayDoor", "UsedKeyOnDoor_1", true) ;
}

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


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

I saw that you have forum and i was like oh great someone will answer me. So please if you know the solution answer Big Grin .


RE: I need help with multiple keys - Steve - 08-11-2012

you forgto to make the second: void UsedKeyOnDoor_1
you ave three void UsedKeyOnDoor


RE: I need help with multiple keys - The Shanus - 08-11-2012

(08-11-2012, 11:29 AM)andrejapotic98 Wrote: void OnEnter ()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true) ;
AddUseItemCallback("", "hallwaykey", "HallWayDoor", "UsedKeyOnDoor_1", true) ;
}

void UsedKeyOnDoor (string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true) ;
PlaySoundAtEntity("", asEntity, "monsterdoor", 0, false) ;
PlaySoundAtEntity("", asEntity, "HallWayDoor", 0, false) ;
RemoveItem (asItem) ;
}
Try that ^


RE: I need help with multiple keys - andrejapotic98 - 08-11-2012

(08-11-2012, 12:18 PM)The Shanus Wrote:
(08-11-2012, 11:29 AM)andrejapotic98 Wrote: void OnEnter ()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true) ;
AddUseItemCallback("", "hallwaykey", "HallWayDoor", "UsedKeyOnDoor_1", true) ;
}

void UsedKeyOnDoor (string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true) ;
PlaySoundAtEntity("", asEntity, "monsterdoor", 0, false) ;
PlaySoundAtEntity("", asEntity, "HallWayDoor", 0, false) ;
RemoveItem (asItem) ;
}
Try that ^
It wont work it still says name and parameters already in use Sad
If you can answer me fast as you answered now thanks in advance Big Grin


RE: I need help with multiple keys - Adny - 08-11-2012

Try this:


void OnStart()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true);
AddUseItemCallback("", "hallwaykey", "HallWayDoor", "UsedKeyOnDoor", true);
}

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

Hope that helped


RE: I need help with multiple keys - andrejapotic98 - 08-11-2012

(08-11-2012, 12:18 PM)The Shanus Wrote:
(08-11-2012, 11:29 AM)andrejapotic98 Wrote: void OnEnter ()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true) ;
AddUseItemCallback("", "hallwaykey", "HallWayDoor", "UsedKeyOnDoor_1", true) ;
}

void UsedKeyOnDoor (string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true) ;
PlaySoundAtEntity("", asEntity, "monsterdoor", 0, false) ;
PlaySoundAtEntity("", asEntity, "HallWayDoor", 0, false) ;
RemoveItem (asItem) ;
}
Try that ^
Srry i saw where mistake was it all works perfect now thanks guys so much Big Grin