Frictional Games Forum (read-only)
How do i make Statues despawn? - 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: How do i make Statues despawn? (/thread-15989.html)

Pages: 1 2


How do i make Statues despawn? - Putkimato - 06-09-2012

I made 7 knights spawn when i go in area, but how i make them dissapear like after 5 second? Please help fast!


RE: How do i make Statues despawn? - Putkimato - 06-09-2012

(06-09-2012, 12:24 PM)Robosprog Wrote: Add a timer before you set them inactive? I think that's a solution.

Elaborating: I assume you have the script set up where once you step into the area the statues spawn? As far as my knowledge goes, you could create a timer so say, 5 seconds afterwards it activates another line that deactivates them.
Uhm. I dont know how i do that Big Grin Could you make it for me?


RE: How do i make Statues despawn? - FlawlessHappiness - 06-09-2012

AddTimer("", 5, KnightsDespawn);


void KnightsDespawn(string &in asTimer)
{
SetEntityActive("Knight1", false);
SetEntityActive("Knight2", false);

SetEntityActive("Knight3", false);

SetEntityActive("Knight4", false);

SetEntityActive("Knight5", false);

}


RE: How do i make Statues despawn? - Putkimato - 06-09-2012

(06-09-2012, 12:24 PM)Robosprog Wrote: Add a timer before you set them inactive? I think that's a solution.

Elaborating: I assume you have the script set up where once you step into the area the statues spawn? As far as my knowledge goes, you could create a timer so say, 5 seconds afterwards it activates another line that deactivates them.

(06-09-2012, 12:36 PM)beecake Wrote: AddTimer("", 5, KnightsDespawn);


void KnightsDespawn(string &in asTimer)
{
SetEntityActive("Knight1", false);
SetEntityActive("Knight2", false);

SetEntityActive("Knight3", false);

SetEntityActive("Knight4", false);

SetEntityActive("Knight5", false);

}
Ty!

(06-09-2012, 12:36 PM)beecake Wrote: AddTimer("", 5, KnightsDespawn);


void KnightsDespawn(string &in asTimer)
{
SetEntityActive("Knight1", false);
SetEntityActive("Knight2", false);

SetEntityActive("Knight3", false);

SetEntityActive("Knight4", false);

SetEntityActive("Knight5", false);

}
Uhm.. Could you clear my code? Because im getting error: main(92, 1) : ERR UNEXPECTED END OF FILE

////////////////////////////

// Run when entering map

void OnEnter()

{

AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
SetEntityPlayerInteractCallback("cabinettrap", "Spawn", true);
AddUseItemCallback("", "giantkey1", "cellarmain", "KeyOnDoor2", true);
SetEntityPlayerInteractCallback("note1", "Morsot1", true);
AddEntityCollideCallback("Player", "knact", "knact", true, 1);
}

void KeyOnDoor(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_1");

}

void Spawn(string &in asEntity)

{

SetEntityActive("corpse1", true);
AddTimer("Scare", 0.5f, "Scare1");
}

void Scare1(string &in asTimer)

{

GiveSanityDamage(10, true);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);

}

void KeyOnDoor2(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("cellarmain", false, true);
PlaySoundAtEntity("", "unlock_door", "cellarmain", 0, false);
RemoveItem("giantkey1");

}

void Morsot1(string &in item)

{

SetEntityActive("morso1", true);

}

void knact(string &in asParent, string &in asChild, int alState)

{
SetEntityActive("kn1", true);
SetEntityActive("kn2", true);
SetEntityActive("kn3", true);
SetEntityActive("kn4", true);
SetEntityActive("kn5", true);
SetEntityActive("kn6", true);
SetEntityActive("kn7", true);
AddTimer("", 3, KnightsDespawn);


void KnightsDespawn(string &in asTimer)
{
SetEntityActive("kn1", false);
SetEntityActive("kn2", false);
SetEntityActive("kn3", false);
SetEntityActive("kn4", false);
SetEntityActive("kn5", false);
SetEntityActive("kn6", false);
SetEntityActive("kn7", false);
}


RE: How do i make Statues despawn? - FlawlessHappiness - 06-09-2012

AddTimer ("", 3, "KnightsDespawn");

Sorry i forgot putting in quotations Wink Always remember that!

and also

void Morsot1(string &in asItem)

I believe it is asItem, like in everything else (asEntity, asTimer, asChild, asParent...)
When is morsot used anyway.. You don't call that function inside the script.
Do you call it in the level editor?


RE: How do i make Statues despawn? - Putkimato - 06-09-2012

(06-09-2012, 01:15 PM)beecake Wrote: AddTimer ("", 3, "KnightsDespawn");

Sorry i forgot putting in quotations Wink Always remember that!

and also

void Morsot1(string &in asItem)

I believe it is asItem, like in everything else (asEntity, asTimer, asChild, asParent...)
When is morsot used anyway.. You don't call that function inside the script.
Do you call it in the level editor?
Still the same problem.. Unexpected end of file


RE: How do i make Statues despawn? - i3670 - 06-09-2012

{
AddTimer("KnightSpawner1", 5.0f, "KnightTimer");
}

void KnightTimer(string &in asTimer)
{
if(asTimer == "KnightSpawner1"){
SetEntityActive("Knight1", false);
}
}


RE: How do i make Statues despawn? - Putkimato - 06-09-2012

(06-09-2012, 01:45 PM)i3670 Wrote: {
AddTimer("KnightSpawner1", 5.0f, "KnightTimer");
}

void KnightTimer(string &in asTimer)
{
if(asTimer == "KnightSpawner1"){
SetEntityActive("Knight1", false);
}
}
STill SAME! ..

(06-09-2012, 01:45 PM)i3670 Wrote: {
AddTimer("KnightSpawner1", 5.0f, "KnightTimer");
}

void KnightTimer(string &in asTimer)
{
if(asTimer == "KnightSpawner1"){
SetEntityActive("Knight1", false);
}
}
Or then i added it to wrong position. Could you add it to my code?


RE: How do i make Statues despawn? - i3670 - 06-09-2012

void knact(string &in asParent, string &in asChild, int alState)
{

SetEntityActive("kn1", true);
SetEntityActive("kn2", true);
SetEntityActive("kn3", true);
SetEntityActive("kn4", true);
SetEntityActive("kn5", true);
SetEntityActive("kn6", true);
SetEntityActive("kn7", true);
AddTimer("KnightSpawner1", 3.0f, "KnightsDespawn");

void KnightsDespawn(string &in asTimer)
{
if(asTimer == "KnightSpawner1"){
SetEntityActive("kn1", false);
SetEntityActive("kn2", false);
SetEntityActive("kn3", false);
SetEntityActive("kn4", false);
SetEntityActive("kn5", false);
SetEntityActive("kn6", false);
SetEntityActive("kn7", false);
}
}


RE: How do i make Statues despawn? - Ermu - 06-09-2012

void Morsot1(string &in asItem)


Correct oneSadstring &in asEntity)

(06-09-2012, 04:15 PM)i3670 Wrote: if(asTimer == "KnightSpawner1"){
SetEntityActive("kn1", false);
SetEntityActive("kn2", false);
SetEntityActive("kn3", false);
SetEntityActive("kn4", false);
SetEntityActive("kn5", false);
SetEntityActive("kn6", false);
SetEntityActive("kn7", false);
}
Isn't needed.


void KnightsDespawn(string &in asTimer)
{
SetEntityActive("kn1", false);
SetEntityActive("kn2", false);
SetEntityActive("kn3", false);
SetEntityActive("kn4", false);
SetEntityActive("kn5", false);
SetEntityActive("kn6", false);
SetEntityActive("kn7", false);
}


Is correct.


void knact(string &in asParent, string &in asChild, int alState)

{
SetEntityActive("kn1", true);
SetEntityActive("kn2", true);
SetEntityActive("kn3", true);
SetEntityActive("kn4", true);
SetEntityActive("kn5", true);
SetEntityActive("kn6", true);
SetEntityActive("kn7", true);
AddTimer("", 3, KnightsDespawn);

}
You forgot to close this one with an }

(06-09-2012, 01:15 PM)beecake Wrote: You don't call that function inside the script.
Do you call it in the level editor?
It's called in the void OnStart.

so (string &in asEntity)


SetEntityPlayerInteractCallback("note1", "Morsot1", true);