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


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Area Triggers Help!
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#1
Area Triggers Help!

Hey all!

So I am trying to make this happen here:

Player walks through level transfer door into new map. Player goes to end of map and finds note. When player returns to the same level transfer door they entered from, the following "area" is triggered with the following events:

{
GiveSanityDamage(20, true);
SetPlayerActive(false);
AddPlayerBodyForce(-40000, 25000, 0, false);
FadePlayerRollTo(75, 3, 2);
StartPlayerLookAt("level_celler_1", 2, 2, "");
SetPlayerCrouching(true);
AddTimer("", 2, "");
AddTimer("", 10, "");
GivePlayerDamage(10, "BloodSplat", false, false);
SetLanternDisabled(true);
PlaySoundAtEntity("", "player_bodyfall", "Player", 0, false);
FadeRadialBlurTo(1, 0.5);
}

How is it possible for me to make these events triggered by the area, and is it possible to make the area in-active until the player finds the note at the end of the level?

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

08-17-2011, 05:10 AM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Area Triggers Help!

(08-17-2011, 05:10 AM)JetlinerX Wrote: How is it possible for me to make these events triggered by the area, and is it possible to make the area in-active until the player finds the note at the end of the level?

AddEntityCollideCallback(): pass "Player" and the area name into the two entity parameters. This only after the user has interacted with the note. For that you should be able to use SetEntityPlayerInteractCallback().

Tutorials: From Noob to Pro
08-17-2011, 05:16 AM
Website Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#3
RE: Area Triggers Help!

I'm actually pretty new to scripting, can you make that a tad more simple please?

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

08-17-2011, 05:19 AM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Area Triggers Help!

(08-17-2011, 05:19 AM)JetlinerX Wrote: I'm actually pretty new to scripting, can you make that a tad more simple please?
  • In OnStart(), SetEntityPlayerInteractCallback("name_of_note", "name_of_callback_function", true), which should call a function upon interacting with the note.

    • Inside the callback function put AddEntityCollideCallback("Player", "name_of_area", "name_of_callback_function", true, 1), which will call a function when player enters the area.

      • Inside the next callback function do all that stuff you posted.

Be sure to end each statement with a semicolon.

Tutorials: From Noob to Pro
08-17-2011, 05:37 AM
Website Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#5
RE: Area Triggers Help!

Soooo... Like this?

SetEntityPlayerInteractCallback("note_attic_desk1, "OnPickup", true);
AddEntityCollideCallback("Player", "scarearea1", "WHAT GOES HERE?!", true, 1);
{
GiveSanityDamage(20, true);
SetPlayerActive(false);
AddPlayerBodyForce(-40000, 25000, 0, false);
FadePlayerRollTo(75, 3, 2);
StartPlayerLookAt("level_celler_1", 2, 2, "");
SetPlayerCrouching(true);
AddTimer("", 2, "viimenen2");
AddTimer("", 10, "viimenen6");
GivePlayerDamage(10, "BloodSplat", false, false);
SetLanternDisabled(true);
PlaySoundAtEntity("", "player_bodyfall", "Player", 0, false);
FadeRadialBlurTo(1, 0.5);
}


Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

08-17-2011, 05:44 AM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: Area Triggers Help!

(08-17-2011, 05:44 AM)JetlinerX Wrote: Soooo... Like this?

void OnStart(){
     SetEntityPlayerInteractCallback("name_of_note", "name_of_first_callback_function", true);
}

void name_of_first_callback_function(string &in entity){
     if (entity == "name_of_note")
          AddEntityCollideCallback("Player", "name_of_area", "name_of_second_callback_function", true, 1);
}

void name_of_second_callback_function(string &in parent, string &in child, int state){
     if (parent == "Player" && child == "name_of_area")
     {
          // put all your stuff here...
     }
}

Tutorials: From Noob to Pro
(This post was last modified: 08-17-2011, 06:00 AM by Your Computer.)
08-17-2011, 05:57 AM
Website Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#7
RE: Area Triggers Help!

Oh! Okay! But what should the second callback function be?!

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

08-17-2011, 06:01 AM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: Area Triggers Help!

(08-17-2011, 06:01 AM)JetlinerX Wrote: Oh! Okay! But what should the second callback function be?!

I'm not sure what you're asking here. The name of callback functions can be just about anything so long as they match the names specified in SetEntityPlayerInteractCallback() and AddEntityCollideCallback(), which they do in the code example i provided.

Tutorials: From Noob to Pro
08-17-2011, 06:08 AM
Website Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#9
RE: Area Triggers Help!

Oh, so they dont have to be something like: OnPickup, OnIgnite etc? My bad! I shall test now, and report back!
So I am getting these errors:
ExcuteString (1,1):ERR No Mathing Signatures to OnStart()
and
41,2 ERR Unexpected end of file (I dont have a line 41)

Here is my code, whats wrong?

void OnStart ()
{
AddEntityCollideCallback("Player", "attic_sound_scare1", "Noise", true, 1);
}
void Noise(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "amb_idle_whimp.snt", "attic_sound_scare1", 0.0f, true);
PlaySoundAtEntity("", "insanity_baby_cry.snt", "attic_sound_scare1", 0.0f, true);
PlaySoundAtEntity("", "door_level_cistern_close.snt", "attic_sound_scare1", 0.0f, true);
PlaySoundAtEntity("", "general_thunder.snt", "attic_sound_scare1", 0.0f, true);
PlaySoundAtEntity("", "break_stairs.snt", "attic_sound_scare1", 0.0f, true);
PlaySoundAtEntity("", "lurker_hit_Wood", "mainatticscare", 0, false);
}
SetEntityPlayerInteractCallback("note_attic_desk1", "OnPickup", true);

void OnPickup(string &in entity){
     AddEntityCollideCallback("Player", "mainatticscare", "OnScare", true, 1);


void OnScare(string &in parent, string &in child, int state){
     if (parent == "Player" && child == "mainatticscare")
     {
          GiveSanityDamage(20, true);
         SetPlayerActive(false);
         AddPlayerBodyForce(-40000, 25000, 0, false);
         FadePlayerRollTo(75, 3, 2);
         StartPlayerLookAt("level_celler_1", 2, 2, "");
         SetPlayerCrouching(true);
         AddTimer("", 2, "viimenen2");
         AddTimer("", 10, "viimenen6");
         GivePlayerDamage(10, "BloodSplat", false, false);
         SetLanternDisabled(true);
         PlaySoundAtEntity("", "player_bodyfall", "Player", 0, false);
         FadeRadialBlurTo(1, 0.5);
     }

void OnLeave ()
{
}

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 08-17-2011, 06:22 AM by JetlinerX.)
08-17-2011, 06:12 AM
Website Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#10
RE: Area Triggers Help!

Anyone know?

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

08-17-2011, 03:12 PM
Website Find




Users browsing this thread: 2 Guest(s)