Frictional Games Forum (read-only)

Full Version: Script problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Whats wrong with this Script ? Sad


// Run first time starting map

void OnStart()
{
AddUseItemCallback("", "key_tomb_1", "mansion_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("ITEM", "OnPickup");
}
void UsedKeyOnDoor(string &in asitem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key-tomb_1");


void OnPickup(string &in asEntity, string &in type)
{
PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
PlaySoundAtEntity("", "00_faint.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetEntityActive("servant_grunt_1", true);
}


// Run when entering map

void OnEnter()
{

}
////////////////////////////

// Run when leaving map

void OnLeave()

{
  • I don't see any pathnodes for the grunt.
(06-16-2012, 04:27 PM)KillerFlo Wrote: [ -> ]Whats wrong with this Script ? Sad


// Run first time starting map

void OnStart()
{
AddUseItemCallback("", "key_tomb_1", "mansion_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("ITEM", "OnPickup");
}
void UsedKeyOnDoor(string &in asitem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key-tomb_1");


void OnPickup(string &in asEntity, string &in type)
{
after the RemoveItem line you forgot to close it with bracket...

so it should look like

void UsedKeyOnDoor(string &in asitem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key-tomb_1");
}