Frictional Games Forum (read-only)

Full Version: Door/Script Area not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys, the title says it all.. the specific key for the work doesn't work and it says "Cannot use this item this way" or something when i use it on the door, and the script area are supposed to spawn monsters but when i walk on the area it doesn't work..so what's possibly wrong with the scripts ? and sorry for my too many questions Confused

here's the HPS file:



////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "lolkey_1", "level_orb_room_door_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "DoorScare", "DoorScare", true, 1);
AddEntityCollideCallback("Player", "HorrorStart", "CollideHorrorStart", false, 1);

}


void KeyOndoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("level_orb_room_door_1", false);
PlaySoundAtEntity("", "unlock_door", "level_orb_room_door_1", 0, false);
RemoveItem("lolkey_1");
}


void DoorScare(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("TrapzDoor", true, true);
SetSwingDoorLocked("TrapzDoor", true, true);
PlaySoundAtEntity("", "Close_Door.snt", "TrapzDoor", 0.0f, true);
GiveSanityDamage(10, true);
}


void HorrorStart(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "screams", "Player", 0, false);
GiveSanityDamage(10, true);
SetEntityActive("enemy_suitor_alois_1", true);
SetEntityActive("Servant_grunt_1", true);
SetEntityActive("Servant_brute_1", true);
ShowEnemyPlayerPosition("enemy_suitor_alois_1");
}


void OnPickUp(string &in asEntity, string &in type)
{
SetEntityActive("Corpsy", true);
PlaySoundAtEntity("", "screams", "Player", 0, false);
GiveSanityDamage(10, true);
PlaySoundAtEntity("alois_notice_long", "alois_notice_long.snt", "Player", 0, false);
}


////////////////////////////
// Run when entering map
void OnEnter()
{


}

////////////////////////////
// Run when leaving map
void OnLeave()
{


}
the door is special?
Code:
void OnStart()
{
AddUseItemCallback("", "lolkey_1", "level_orb_room_door_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "DoorScare", "DoorScare", true, 1);
AddEntityCollideCallback("Player", "HorrorStart", "CollideHorrorStart", false, 1);
}


void HorrorStart(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "screams", "Player", 0, false);
GiveSanityDamage(10, true);
SetEntityActive("enemy_suitor_alois_1", true);
SetEntityActive("Servant_grunt_1", true);
SetEntityActive("Servant_brute_1", true);
ShowEnemyPlayerPosition("enemy_suitor_alois_1");
}


The function to call is not namned correct, should be CollideHorrorStart instead of HorrorStart.


you must put this the third function:

SetEntityPlayerInteractCallback("namekey", "callfunction", true);

you must put this for the door:

void KeyOndoor(string &in asItem, string &in asEntity)

{
SetSwingDoorLocked("level_orb_room_door_1", false, true);
SetLevelDoorLocked(asEntity, false);
PlaySoundAtEntity("", "unlock_door", "level_orb_room_door_1", 0, false);
RemoveItem("lolkey_1");
}

Thanks alot guys! that helped alot, but still facing problems with the door, can't unlock it by using the key Confused
(10-17-2011, 07:42 PM)GhastDagger Wrote: [ -> ]Thanks alot guys! that helped alot, but still facing problems with the door, can't unlock it by using the key Confused
One problem i saw is that you named the function KeyOnDoor in the list. but in void you name it KeyOndoor.