Frictional Games Forum (read-only)
Scripting, need urgent help! - 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: Scripting, need urgent help! (/thread-9259.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

Alrighty! I will report back!
So, I tried that out, and for some reason, I enter the second map, and I get the unexpected end of code error... which is odd considering these are the last lines of code.

void OnLeave ()
{
}

Here is the whole thing:
////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "attickey", "atticdoor", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("atticdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "atticdoor", 0, false);
RemoveItem("attickey");
{
AddEntityCollideCallback("Player", "monster_death", "MonsterFunc1", true, 1);
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("mrflappyjaw2" , true);
SetPlayerActive(false);
CheckPoint ("EndGame", "Player_Start", "StartCredits", "DeathHintCategory", "DeathHintEntry");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{
}


RE: Scripting, need urgent help! - MrCookieh - 07-24-2011

Code:
void OnLeave ()
{
}

Here is the whole thing:
////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "attickey", "atticdoor", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("atticdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "atticdoor", 0, false);
RemoveItem("attickey");
[b]{
AddEntityCollideCallback("Player", "monster_death", "MonsterFunc1", true, 1);
}[/b]

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("mrflappyjaw2" , true);
SetPlayerActive(false);
CheckPoint ("EndGame", "Player_Start", "StartCredits", "DeathHintCategory", "DeathHintEntry");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{
}

the {
AddEntityCollideCallback("Player", "monster_death", "MonsterFunc1", true, 1);
}
you have to put this in OnStart()/OnEnter(). Now it isn't in any void to call.


RE: Scripting, need urgent help! - DRedshot - 07-24-2011

MrCookieh is right, the AddEntityCollideCallback needs to be in OnEnter, also there are a few more errors below,such as open brackets where close brackets should be, I'll post a fixed version for you. Also, you dont have the
void StartCredits(string &in asName , int &in alCount)
{
StartCredits( , , , );
}
without that when you die you will just respawn.

here is the fixed code
Spoiler below!

Code:
////////////////////////////
// Run when entering map
void OnEnter ()
{
    AddUseItemCallback("", "attickey", "atticdoor", "UsedKeyOnDoor", true);
    AddEntityCollideCallback("Player", "monster_death", "MonsterFunc1", true, 1);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("atticdoor", false, true);
    PlaySoundAtEntity("", "unlock_door", "atticdoor", 0, false);
    RemoveItem("attickey");
}

void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
    SetEntityActive("mrflappyjaw2" , true);
    SetPlayerActive(false);
    CheckPoint ("EndGame", "Player_Start", "StartCredits", "DeathHintCategory", "DeathHintEntry");
}
void StartCredits(string &in asName, int alCount)
{
    StartCredits("musicfile.ogg" , true , "Credits" , "End" , 1);
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{
}


ps: instead of SetPlayerActive(false);
- which might lower the immersion, because people will know it's a 'scripted death'
try instead SetPlayerMoveSpeedMul(0.xf);
- where x is any number you would like, also try
- SetPlayerJumpDisabled(true);

if the player can escape the monster though, stick with SetPlayerActive(false); Smile


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

Ill let you know!

Allright! Everything works amazingly! Now I just need to figure out how to roll the credits. Any tips?


RE: Scripting, need urgent help! - seth1466 - 07-25-2011

Thank you everyone for helping us with are scripting problems. Your assistance is appriciated. Big Grin


RE: Scripting, need urgent help! - JetlinerX - 07-25-2011

Indeed it is! I do however, have a new question.

When the player puts down a note, how do I trigger a loud banging sound, with Danial gasping and moving the player head to where the sound was.


RE: Scripting, need urgent help! - JenniferOrange - 07-25-2011

You mean when the player picks up a note? Daniel can't put notes down, but he can pick them up!


RE: Scripting, need urgent help! - JetlinerX - 07-25-2011

Sure, I guess, as long as they arent reading it when everything happends.


RE: Scripting, need urgent help! - JenniferOrange - 07-25-2011

He is going to be reading it when he picks it up, so the sounds won't play while he reads it, but after the note is closed the sounds will play.


RE: Scripting, need urgent help! - JetlinerX - 07-25-2011

Perfect, so then I just need to get him to gasp, and turn his head.