RE: Area Triggers Help! - Tanshaydar - 08-17-2011
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.
RE: Area Triggers Help! - JetlinerX - 08-17-2011
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!
RE: Area Triggers Help! - JetlinerX - 08-17-2011
Anyone got some more ideas??
RE: Area Triggers Help! - Tanshaydar - 08-17-2011
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.
RE: Area Triggers Help! - JetlinerX - 08-17-2011
...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.
Code:
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 ()
{
}
RE: Area Triggers Help! - Tanshaydar - 08-17-2011
OnPickup("note_attic_desk");
What is this?
RE: Area Triggers Help! - JetlinerX - 08-17-2011
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?
RE: Area Triggers Help! - GreyFox - 08-17-2011
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
RE: Area Triggers Help! - JetlinerX - 08-17-2011
I have a SetEntityPlayerInteractCallback, but how do I make it activate the area after picking up the note? My current code is:
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", "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:
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!!!!!!!!!!!!!
RE: Area Triggers Help! - Homicide13 - 08-18-2011
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!