Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help cheap scare
Author Message
zombiehacker595 Offline
Member

Posts: 141
Joined: Mar 2012
Reputation: 3
Post: #1
cheap scare
so i put in a cheap scare into my game bassically you walk into the room no one on the chair get close to the chair naked man shows up this is my script

AddEntityCollideCallback("Player", "ScriptArea_3", "CheapScare", true, 1);
AddEntityCollideCallback("corpse_bloody_2", "ScriptArea_3", "Sound", true, 1);
}

void CheapScare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("corpse_bloody_2", true);
GiveSanityDamage(5.0f, true);
}

void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_iron_maiden.snt", "ScriptArea_3", 0, false);
}



this script is working. so what would i add to get rid off him after about 1 or 2 seconds?
04-03-2012 01:22 AM
Find all posts by this user Quote this message in a reply
Obliviator27 Offline
Posting Freak

Posts: 801
Joined: Jul 2011
Reputation: 65
Post: #2
RE: cheap scare
Use a timer to set him inactive.

04-03-2012 01:38 AM
Find all posts by this user Quote this message in a reply
Xanthos Offline
Senior Member

Posts: 322
Joined: Mar 2012
Reputation: 8
Post: #3
RE: cheap scare
(04-03-2012 01:22 AM)zombiehacker595 Wrote:  so i put in a cheap scare into my game bassically you walk into the room no one on the chair get close to the chair naked man shows up this is my script

AddEntityCollideCallback("Player", "ScriptArea_3", "CheapScare", true, 1);
AddEntityCollideCallback("corpse_bloody_2", "ScriptArea_3", "Sound", true, 1);
}

void CheapScare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("corpse_bloody_2", true);
GiveSanityDamage(5.0f, true);
}

void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_iron_maiden.snt", "ScriptArea_3", 0, false);
}



this script is working. so what would i add to get rid off him after about 1 or 2 seconds?
void CheapScare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("corpse_bloody_2", true);
GiveSanityDamage(5.0f, true);
AddTimer("1", 0.5f, "BEGONE");
}



void BEGONE(string &in asTimer)
{
if(asTimer == "1"){
SetEntityActive("corpse_bloody_2", false);
}
}

04-03-2012 05:21 PM
Find all posts by this user Quote this message in a reply
JetlinerX Offline
Senior Member

Posts: 601
Joined: Jun 2011
Reputation: 19
Post: #4
RE: cheap scare
With your current script, the corpse has to be in the script area for the sound to play. Are you sure this is what you want?

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 04-04-2012 01:57 AM by JetlinerX.)
04-04-2012 01:55 AM
Visit this user's website Find all posts by this user Quote this message in a reply
zombiehacker595 Offline
Member

Posts: 141
Joined: Mar 2012
Reputation: 3
Post: #5
RE: cheap scare
(04-04-2012 01:55 AM)JetlinerX Wrote:  With your current script, the corpse has to be in the script area for the sound to play. Are you sure this is what you want?


yea but the script area is bassically 3/4 of the room i just left out the door area
(04-03-2012 05:21 PM)Xanthos Wrote:  
(04-03-2012 01:22 AM)zombiehacker595 Wrote:  so i put in a cheap scare into my game bassically you walk into the room no one on the chair get close to the chair naked man shows up this is my script

AddEntityCollideCallback("Player", "ScriptArea_3", "CheapScare", true, 1);
AddEntityCollideCallback("corpse_bloody_2", "ScriptArea_3", "Sound", true, 1);
}

void CheapScare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("corpse_bloody_2", true);
GiveSanityDamage(5.0f, true);
}

void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_iron_maiden.snt", "ScriptArea_3", 0, false);
}



this script is working. so what would i add to get rid off him after about 1 or 2 seconds?

void CheapScare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("corpse_bloody_2", true);
GiveSanityDamage(5.0f, true);
AddTimer("1", 0.5f, "BEGONE");
}



void BEGONE(string &in asTimer)
{
if(asTimer == "1"){
SetEntityActive("corpse_bloody_2", false);
}
}


worked but there was no need for the if just crashed the game Smile
(This post was last modified: 04-04-2012 03:54 AM by zombiehacker595.)
04-04-2012 03:29 AM
Find all posts by this user Quote this message in a reply
Xanthos Offline
Senior Member

Posts: 322
Joined: Mar 2012
Reputation: 8
Post: #6
RE: cheap scare
(04-04-2012 03:29 AM)zombiehacker595 Wrote:  
(04-04-2012 01:55 AM)JetlinerX Wrote:  With your current script, the corpse has to be in the script area for the sound to play. Are you sure this is what you want?


yea but the script area is bassically 3/4 of the room i just left out the door area
(04-03-2012 05:21 PM)Xanthos Wrote:  
(04-03-2012 01:22 AM)zombiehacker595 Wrote:  so i put in a cheap scare into my game bassically you walk into the room no one on the chair get close to the chair naked man shows up this is my script

AddEntityCollideCallback("Player", "ScriptArea_3", "CheapScare", true, 1);
AddEntityCollideCallback("corpse_bloody_2", "ScriptArea_3", "Sound", true, 1);
}

void CheapScare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("corpse_bloody_2", true);
GiveSanityDamage(5.0f, true);
}

void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_iron_maiden.snt", "ScriptArea_3", 0, false);
}



this script is working. so what would i add to get rid off him after about 1 or 2 seconds?

void CheapScare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("corpse_bloody_2", true);
GiveSanityDamage(5.0f, true);
AddTimer("1", 0.5f, "BEGONE");
}



void BEGONE(string &in asTimer)
{
if(asTimer == "1"){
SetEntityActive("corpse_bloody_2", false);
}
}


worked but there was no need for the if just crashed the game Smile
How could it crash the game?
hmm Oh well, if it worked.

04-04-2012 05:06 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)