Frictional Games Forum (read-only)
Whats wrong with this script? - 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: Whats wrong with this script? (/thread-12634.html)



Whats wrong with this script? - Datguy5 - 01-16-2012

Well the title says it..Heres the script:

////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "Khii", "Lockedd", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "FlyingJesus_1", "HolyJesus", true, 1);
AddEntityCollideCallback("Jesus1", "FlyingJesus_1", "Sound", true, 1);
AddEntityCollideCallback("Player", "Closett", "Monstar", true, 1);
AddEntityCollideCallback("Player", "Slam1", "func_slam", true, 1);
SetEntityCallbackFunc("Avain", "OnPickup");
}

void HolyJesus(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus1", true);
AddPropForce("Jesus1", 0, 0, 20000, "World");
}


void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_iron_maiden.snt", "FlyingJesus_1", 0, false);
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
}
AddEnemyPatrolNode("grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_2", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_3", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_4", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_5", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_6", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_7", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_8", 2, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_9", 1, "");
{
void func_slam(string &in asParent, string &in asChild, int alState)
}
SetSwingDoorClosed("Slammer", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(10.0f, true);
{
void Monstar(string &in asParent, string &in asChild, int alState)
}
SetEntityActive("Closet", true);
{
void KeyOnDoor(string &in asItem, string &in asEntity)
}
SetSwingDoorLocked("Lockedd", false, true);
PlaySoundAtEntity("", "unlock_door", "Lockedd", 0, false);
RemoveItem("Khii");
{
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}

the game crashes when i try to enter the next level and the crash report says something about unecpexted tokenidenfier {




RE: Whats wrong with this script? - flamez3 - 01-16-2012

Use this one:


Quote:////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "Khii", "Lockedd", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "FlyingJesus_1", "HolyJesus", true, 1);
AddEntityCollideCallback("Jesus1", "FlyingJesus_1", "Sound", true, 1);
AddEntityCollideCallback("Player", "Closett", "Monstar", true, 1);
AddEntityCollideCallback("Player", "Slam1", "func_slam", true, 1);
SetEntityCallbackFunc("Avain", "OnPickup");
}

void HolyJesus(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus1", true);
AddPropForce("Jesus1", 0, 0, 20000, "World");
}


void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_iron_maiden.snt", "FlyingJesus_1", 0, false);
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
AddEnemyPatrolNode("grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_2", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_3", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_4", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_5", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_6", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_7", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_8", 2, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_9", 1, "");
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Slammer", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(10.0f, true);
}


void Monstar(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Closet", true);
}


void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Lockedd", false, true);
PlaySoundAtEntity("", "unlock_door", "Lockedd", 0, false);
RemoveItem("Khii");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
You put some events in the wrong places.


RE: Whats wrong with this script? - Datguy5 - 01-16-2012

Thanks bro!