Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
RE: Area Triggers Help!
void OnPickup(string &in entity){
AddEntityCollideCallback("Player", "mainatticscare", "OnScare", true, 1);
You didn't close the block, there is a { to open, but there is no } to close.
08-17-2011, 03:22 PM
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
RE: Area Triggers Help!
Added the closing bracket, get the same errors.
Pictures!
My Code:
Spoiler below!
void OnEnter ()
{
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 ()
{
}
Hope that helps!
(This post was last modified: 08-17-2011, 04:23 PM by JetlinerX .)
08-17-2011, 03:36 PM
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
RE: Area Triggers Help!
Anyone got some more ideas??
08-17-2011, 04:39 PM
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
RE: Area Triggers Help!
You don't have an OnStart() function in your code.
SetEntityPlayerInteractCallback("note_attic_desk1", "OnPickup", true);
is not in any function block, you need to put it in your OnStart() function.
08-17-2011, 05:24 PM
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
RE: Area Triggers Help!
...I dont understand... What should the code look like in order to clear those errors?
New Code,
Still getting the "OnStart" error, and now I get an Expected Identifier for line 16.
void OnStart ()
{
AddEntityCollideCallback("Player", "attic_sound_scare1", "Noise", true, 1);
SetEntityPlayerInteractCallback("note_attic_desk", "OnPickup", true);
AddEntityCollideCallback("Player", "mainatticscare", "OnScare", 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);
}
OnPickup("note_attic_desk");
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 ()
{
}
(This post was last modified: 08-17-2011, 06:22 PM by JetlinerX .)
08-17-2011, 05:32 PM
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
RE: Area Triggers Help!
OnPickup("note_attic_desk");
What is this?
08-17-2011, 07:01 PM
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
RE: Area Triggers Help!
I need the "mainatticscare" area to be in-active until the player picks up "note_attic_desk" Then I need it to be active again, so that was my attempt at that code. Can you tell me the right code?
Also, how do I work timers? Because as it is, the player just spins around, not moving, with blurred vision because I dont have a working timer. What can I do to make those two timers work?
(This post was last modified: 08-17-2011, 07:16 PM by JetlinerX .)
08-17-2011, 07:14 PM
GreyFox
Member
Posts: 162
Threads: 23
Joined: Jul 2011
Reputation:
2
RE: Area Triggers Help!
On Pickup?
I believe that is not a correct functions. you could do SetEntityPlayerInteractCallback so when you interact with that certain Entity (IE a Note, Latern, Potion, etc) you could make it activate whatever you want like a trigger or a sound or anything.
-Grey Fox
Current Project
Forgotten
08-17-2011, 07:17 PM
JetlinerX
Senior Member
Posts: 599
Threads: 49
Joined: Jun 2011
Reputation:
19
RE: Area Triggers Help!
I have a SetEntityPlayerInteractCallback, but how do I make it activate the area after picking up the note? My current code is:
void OnStart()
{
AddEntityCollideCallback("Player", "attic_sound_scare1", "OnStart", true, 1);
SetEntityPlayerInteractCallback("note_attic_desk", "OnPickup", true);
AddEntityCollideCallback("Player", "mainatticscare", "OnPickup", true, 1);
}
void OnStart(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);
}
void OnPickup(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, "Timer1");
AddTimer("", 10, "Timer2");
GivePlayerDamage(10, "BloodSplat", false, false);
SetLanternDisabled(true);
PlaySoundAtEntity("", "player_bodyfall", "Player", 0, false);
FadeRadialBlurTo(1, 0.5);
}
}
void OnLeave ()
{
}
The "OnStart, OnPickup" are both just space fillers because I have NO IDEA what to add there xD
AERGG!!! I am so close! New Code:
void OnStart()
{
AddEntityCollideCallback("Player", "attic_sound_scare1", "OnStart", true, 1);
SetEntityPlayerInteractCallback("note_attic_desk", "OnPickup", true);
AddEntityCollideCallback("Player", "mainatticscare", "OnPickup", true, 1);
}
void OnStart(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.snt", "mainatticscare", 0, true);
}
void OnPickup(string &in parent, string &in child, int state)
{
if (parent == "Player" && child == "note_attic_desk")
{
CreateParticleSystemAtEntity("", "ps_dust_impact", "Partdoor1", false);
CreateParticleSystemAtEntity("", "ps_door_damage_wood", "Partdoor1", false);
CreateParticleSystemAtEntity("", "ps_dust_impact", "Partdoor2", false);
CreateParticleSystemAtEntity("", "ps_door_damage_wood", "Partdoor2", false);
CreateParticleSystemAtEntity("", "ps_dust_impact", "Partdoor3", false);
CreateParticleSystemAtEntity("", "ps_door_damage_wood", "Partdoor3", false);
CreateParticleSystemAtEntity("", "ps_dust_impact", "Partdoor4", false);
CreateParticleSystemAtEntity("", "ps_door_damage_wood", "Partdoor4", false);
PlaySoundAtEntity("", "lurker_hit_Wood", "Player", 0, false);
GiveSanityDamage(20, true);
SetPlayerActive(false);
AddPlayerBodyForce(-40000, 25000, 0, false);
FadePlayerRollTo(75, 3, 2);
StartPlayerLookAt("level_celler_1", 2, 2, "");
SetPlayerCrouching(true);
AddTimer("", 2, "Timer1");
AddTimer("", 10, "Timer2");
GivePlayerDamage(10, "BloodSplat", false, false);
SetLanternDisabled(true);
PlaySoundAtEntity("", "player_bodyfall", "Player", 0, false);
FadeRadialBlurTo(1, 0.5);
}
}
void OnLeave ()
{
}
Someone please just tell me how to make an area inactive until a note is picked up, then the area activates! PLEASE!!!!!!!!!!!!!
(This post was last modified: 08-17-2011, 08:17 PM by JetlinerX .)
08-17-2011, 07:21 PM
Homicide13
Senior Member
Posts: 323
Threads: 41
Joined: Nov 2010
Reputation:
14
RE: Area Triggers Help!
Just use a local variable.
When the player picks up the note, have it set the variable to 1 [ SetLocalVarInt("nameofvar",1); ]. Then when the player enters the area you want them to trigger after they've picked up the note, just use the if than script to check if the variable is 1 [ if(GetLocalVarInt("nameofvar") == 1) {} ] and have one of the functions that runs in the if than script remove the collide callback for the area (set your original collide callback function to not auto-remove itself).
you don't need to worry about initializing the variable, it creates itself the first time it's used.
Hope that helps!
08-18-2011, 06:56 AM