Frictional Games Forum (read-only)
Door/Script Area not working - 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: Door/Script Area not working (/thread-10815.html)



Door/Script Area not working - GhastDagger - 10-17-2011

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()
{


}


RE: Door/Script Area not working - Darion97 - 10-17-2011

the door is special?


RE: Door/Script Area not working - schmupper - 10-17-2011

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.





RE: Door/Script Area not working - Darion97 - 10-17-2011

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");
}




RE: Door/Script Area not working - GhastDagger - 10-17-2011

Thanks alot guys! that helped alot, but still facing problems with the door, can't unlock it by using the key Confused



RE: Door/Script Area not working - flamez3 - 10-18-2011

(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.