Frictional Games Forum (read-only)
Script problem - 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: Script problem (/thread-16203.html)



Script problem - KillerFlo - 06-16-2012

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

{


RE: Script problem - MaZiCUT - 06-16-2012

  • I don't see any pathnodes for the grunt.



RE: Script problem - Nice - 06-16-2012

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