Frictional Games Forum (read-only)
[SCRIPT] cheap scare - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] cheap scare (/thread-14455.html)



cheap scare - zombiehacker595 - 04-03-2012

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?



RE: cheap scare - Obliviator27 - 04-03-2012

Use a timer to set him inactive.



RE: cheap scare - Xanthos - 04-03-2012

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


RE: cheap scare - JetlinerX - 04-04-2012

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?



RE: cheap scare - zombiehacker595 - 04-04-2012

(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


RE: cheap scare - Xanthos - 04-04-2012

(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.