Frictional Games Forum (read-only)

Full Version: Script help (Key to door)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Yo yo. Im kinda stuck with something again.
I made the door and the key. But how do i make the key fit with the door? :<
void OnStart()
{
AddUseItemCallback("", "nameofkey", "nameofdoor", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("nameofdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("nameofkey");
}
I created a script:
Anyone can spot whats wrong?

I get error whenever i try to load my custom story:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback(''awesomekey_1'', ''castle_1'', ''UsedKeyOnDoor'', True);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(''castle_1''' , false, true);
PlaySoundAtEntity('' '', ''unlock_door'' , ''castle_1'' , 0, false);
RemoveItem(''awesomekey_1'');
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
(01-30-2012, 11:11 AM)QysteiN Wrote: [ -> ]I created a script:
Anyone can spot whats wrong?

I get error whenever i try to load my custom story:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback(''awesomekey_1'', ''castle_1'', ''UsedKeyOnDoor'', True);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(''castle_1''' , false, true);
PlaySoundAtEntity('' '', ''unlock_door'' , ''castle_1'' , 0, false);
RemoveItem(''awesomekey_1'');
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
Dude what on earth are you doing, if you need help make your own thread......


You are using 2 ' to make the quotation. Hold shift and press the button left of the Enter to make ".
(01-30-2012, 11:14 AM)Saren Wrote: [ -> ]
(01-30-2012, 11:11 AM)QysteiN Wrote: [ -> ]I created a script:
Anyone can spot whats wrong?

I get error whenever i try to load my custom story:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback(''awesomekey_1'', ''castle_1'', ''UsedKeyOnDoor'', True);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(''castle_1''' , false, true);
PlaySoundAtEntity('' '', ''unlock_door'' , ''castle_1'' , 0, false);
RemoveItem(''awesomekey_1'');
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
Dude what on earth are you doing, if you need help make your own thread......
This is his/her thread.

Omg sry, I went into the wrong 1... xD
thanks flamez once again lol =D
(01-30-2012, 12:07 PM)QysteiN Wrote: [ -> ]thanks flamez once again lol =D
: )