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

Pages: 1 2


Script wont work - Dizturbed - 07-31-2011

This is my script that wont work in-game, well I want a monster to spawn whenthe player enters an area, pretty easy I know, but it wont work, help please.

PHP Code:
void Onstart()
{
SetPlayerMoveSpeedMul(0.75f);
SetPlayerRunSpeedMul(0.90f);
PlayMusic("22_amb.ogg", true, 5, 4.0f, 0, false); //Plays music.
AddEntityCollideCallback("Player", "SpawnSuitor", "SpawnMonster", true, 0);
AddEntityCollideCallback("Suitor", "DepawnSuitor", "DespawnMonster", true, 0);
AddUseItemCallback("", "key_tower_1", "level_wood_1", "UnlockDoor", true);
}
void SpawnMonster(string &in asParent, string &in asChild, int alState) 
{
SetEntityActive("Suitor", true);
AddEnemyPatrolNode("Suitor", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Suitor", "PathNodeArea_2", 0, "");
StartPlayerLookAt("Suitor", 10.0f, 10.0f, "");
SetPlayerActive(false);
PlayGuiSound("react_breath6.ogg", 1.0f);
AddTimer("Timer", 2.5f, "NoLook");
}
void NoLook(string&in asTimer)
{
StopPlayerLookAt();
AddTimer("Timer", 1.0f, "LookAtTree");
SetEntityActive("Suitor_1", false);
}
void LookAtTree(string&in asTimer)
{
StartPlayerLookAt("falling_tree_1", 10.0f, 10.0f, "");
PlayGuiSound("joint_bend_door.ogg", 10.0f);
StartScreenShake(1.0f, 1.0f, 2.0f, 3.0f);
AddTimer("Timer", 1.0f, "LookAtTree2");
}
void LookAtTree2(string&in asTimer)
{
SetEntityActive("falling_tree_2", true);
SetEntityActive("falling_tree_1", false);
PlayGuiSound("lurker_hit_wood4.ogg", 10.0f);
AddTimer("Timer", 1.0f, "LookAtMonster");
}
void LookAtMonster(string&in asTimer)
{
AddEnemyPatrolNode("Suitor", "PathNodeArea_3", 0, "");
SetEntityActive("Suitor", true);
StartPlayerLookAt("Suitor", 10.0f, 10.0f, "");
SetPlayerCrouching(true);
GiveSanityDamage(50.0f, true);
PlayGuiSound("react_pant2.ogg", 0.4f);
PlayGuiSound("react_breath3.ogg", 1.0f);
FadeOut(3.0f);
}
void DespawnMonster(string &in asParent, string &in asChild, int alState) 
{
SetEntityActive("Suitor", false);
} 
-Dizturbed


RE: Script wont work - ObsidianLegion - 07-31-2011

(07-31-2011, 04:56 PM)Dizturbed Wrote: This is my script that wont work in-game, well I want a monster to spawn whenthe player enters an area, pretty easy I know, but it wont work, help please.

PHP Code:
void Onstart()
{
SetPlayerMoveSpeedMul(0.75f);
SetPlayerRunSpeedMul(0.90f);
PlayMusic("22_amb.ogg", true, 5, 4.0f, 0, false); //Plays music.
AddEntityCollideCallback("Player", "SpawnSuitor", "SpawnMonster", true, 0);
AddEntityCollideCallback("Suitor", "DepawnSuitor", "DespawnMonster", true, 0);
AddUseItemCallback("", "key_tower_1", "level_wood_1", "UnlockDoor", true);
}
void SpawnMonster(string &in asParent, string &in asChild, int alState) 
{
SetEntityActive("Suitor", true);
AddEnemyPatrolNode("Suitor", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("Suitor", "PathNodeArea_2", 0, "");
StartPlayerLookAt("Suitor", 10.0f, 10.0f, "");
SetPlayerActive(false);
PlayGuiSound("react_breath6.ogg", 1.0f);
AddTimer("Timer", 2.5f, "NoLook");
}
void NoLook(string&in asTimer)
{
StopPlayerLookAt();
AddTimer("Timer", 1.0f, "LookAtTree");
SetEntityActive("Suitor_1", false);
}
void LookAtTree(string&in asTimer)
{
StartPlayerLookAt("falling_tree_1", 10.0f, 10.0f, "");
PlayGuiSound("joint_bend_door.ogg", 10.0f);
StartScreenShake(1.0f, 1.0f, 2.0f, 3.0f);
AddTimer("Timer", 1.0f, "LookAtTree2");
}
void LookAtTree2(string&in asTimer)
{
SetEntityActive("falling_tree_2", true);
SetEntityActive("falling_tree_1", false);
PlayGuiSound("lurker_hit_wood4.ogg", 10.0f);
AddTimer("Timer", 1.0f, "LookAtMonster");
}
void LookAtMonster(string&in asTimer)
{
AddEnemyPatrolNode("Suitor", "PathNodeArea_3", 0, "");
SetEntityActive("Suitor", true);
StartPlayerLookAt("Suitor", 10.0f, 10.0f, "");
SetPlayerCrouching(true);
GiveSanityDamage(50.0f, true);
PlayGuiSound("react_pant2.ogg", 0.4f);
PlayGuiSound("react_breath3.ogg", 1.0f);
FadeOut(3.0f);
}
void DespawnMonster(string &in asParent, string &in asChild, int alState) 
{
SetEntityActive("Suitor", false);
} 
-Dizturbed

Tell me what the error is. Assuming it comes up with one


RE: Script wont work - Dizturbed - 07-31-2011

No errors, it just wont work.


RE: Script wont work - ObsidianLegion - 07-31-2011

(07-31-2011, 05:01 PM)Dizturbed Wrote: No errors, it just wont work.

I have the same problem. I don't know what's wrong I'm sorry. Suffice to say your script is fine.


RE: Script wont work - MrCookieh - 07-31-2011

Are you sure that your areas/your monster has the right name?

Otherwise,
AddEntityCollideCallback("Player", "SpawnSuitor", "SpawnMonster", true, 1);
AddEntityCollideCallback("Suitor", "DepawnSuitor", "DespawnMonster", true, 1);

try this. I don't know why it shouldn't work with 0, but I only took a fast look at it and couldn't find anything else


RE: Script wont work - Dizturbed - 07-31-2011

Still doesn't work : /


RE: Script wont work - MrCookieh - 07-31-2011

ah, now I see.
you wrote void Onstart()
it should be void OnStart()


RE: Script wont work - Dizturbed - 07-31-2011

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOH.. MYY.. GOD!
Thanks, im so freakin dumb!


RE: Script wont work - ObsidianLegion - 07-31-2011

(07-31-2011, 05:11 PM)MrCookieh Wrote: ah, now I see.
you wrote void Onstart()
it should be void OnStart()

Dude!!! :S Help meeee! No solution to mine Angry


RE: Script wont work - Kyle - 07-31-2011

(07-31-2011, 05:27 PM)Lolnesia09 Wrote:
(07-31-2011, 05:11 PM)MrCookieh Wrote: ah, now I see.
you wrote void Onstart()
it should be void OnStart()

Dude!!! :S Help meeee! No solution to mine Angry

No solution to yours what? Show your script so I can look at it if it's a script.

Edit: Nevermind, I know what you're asking for. Tongue