Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 5 Vote(s) - 3.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting, need urgent help!
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#71
RE: Scripting, need urgent help!

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

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 07-24-2011, 06:08 AM by JetlinerX.)
07-24-2011, 05:42 AM
Website Find
MrCookieh Offline
Member

Posts: 157
Threads: 8
Joined: Jul 2011
Reputation: 0
#72
RE: Scripting, need urgent help!

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.

The Well: Descent - Take a look at it!
(This post was last modified: 07-24-2011, 09:12 AM by MrCookieh.)
07-24-2011, 09:08 AM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#73
RE: Scripting, need urgent help!

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!

////////////////////////////
// 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

(This post was last modified: 07-24-2011, 12:19 PM by DRedshot.)
07-24-2011, 12:19 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#74
RE: Scripting, need urgent help!

Ill let you know!

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

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 07-24-2011, 04:10 PM by JetlinerX.)
07-24-2011, 04:01 PM
Website Find
seth1466 Offline
Member

Posts: 59
Threads: 4
Joined: Jun 2011
Reputation: 6
#75
RE: Scripting, need urgent help!

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

-Seth1466

The Attic ModDB
07-25-2011, 06:20 PM
Website Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#76
RE: Scripting, need urgent help!

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.

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-25-2011, 06:21 PM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#77
RE: Scripting, need urgent help!

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

Ba-da bing, ba-da boom.
07-25-2011, 06:25 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#78
RE: Scripting, need urgent help!

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

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-25-2011, 06:31 PM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#79
RE: Scripting, need urgent help!

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.

Ba-da bing, ba-da boom.
07-25-2011, 06:32 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#80
RE: Scripting, need urgent help!

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

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-25-2011, 06:34 PM
Website Find




Users browsing this thread: 3 Guest(s)