Frictional Games Forum (read-only)
Why wont this script work? - 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: Why wont this script work? (/thread-12495.html)



Why wont this script work? - Datguy5 - 01-09-2012

Heres the script

////////////////////////////
// Run when the map starts
void OnStart()
{
AddEntityCollideCallback("Player", "FlyingJesus_1", "HolyJesus", true, 1);
AddEntityCollideCallback("Jesus1", "FlyingJesus_1", "Sound", true, 1);
SetEntityCallbackFunc("Avain", "OnPickup");
}


void HolyJesus(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus1");
AddPropForce("Jesus1", 0, 0, 30000, "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, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_10", 1, "");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Whats wrong with it?





RE: Why wont this script work? - MulleDK19 - 01-09-2012

You tell us. If you want help, tell us what's wrong.

What do you want to happen, and what happens instead?


RE: Why wont this script work? - Datguy5 - 01-09-2012

(01-09-2012, 05:50 PM)MulleDK19 Wrote: You tell us. If you want help, tell us what's wrong.

What do you want to happen, and what happens instead?
The first map works fine,but when i enter through the level door the game crashes.It started crashing when i added the flying jesus script.And the crash report is just random.It says something about doooors.




RE: Why wont this script work? - Inurias - 01-09-2012

On your first use of "SetEntityActive" in your "HolyJesus" function you are missing the second parameter.

Also, I found another little flaw in your script, but I'm not sure if it is important:
Code:
AddPropForce("Jesus1", 0, 0, 30000, "World");
You should use "world" instead of "World", it is probably case sensitive.

I am not sure what you want to reach with your script so I did not check if it would really work, I just checked if you used your calls correctly.

- Inurias



RE: Why wont this script work? - Datguy5 - 01-09-2012

Oh nvm,i fixed it Big Grin Apparently i was missing one function from Setentityactive script.Just like Inurias said.