Frictional Games Forum (read-only)

Full Version: I need help with multiple keys
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 .
you forgto to make the second: void UsedKeyOnDoor_1
you ave three void UsedKeyOnDoor
(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 ^
(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
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
(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