06-09-2012, 12:23 PM
Pages: 1 2
06-09-2012, 12:35 PM
(06-09-2012, 12:24 PM)Robosprog Wrote: [ -> ]Add a timer before you set them inactive? I think that's a solution.Uhm. I dont know how i do that Could you make it for me?
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
AddTimer("", 5, KnightsDespawn);
void KnightsDespawn(string &in asTimer)
{
SetEntityActive("Knight1", false);
SetEntityActive("Knight2", false);
SetEntityActive("Knight3", false);
SetEntityActive("Knight4", false);
SetEntityActive("Knight5", false);
}
void KnightsDespawn(string &in asTimer)
{
SetEntityActive("Knight1", false);
SetEntityActive("Knight2", false);
SetEntityActive("Knight3", false);
SetEntityActive("Knight4", false);
SetEntityActive("Knight5", false);
}
06-09-2012, 12:40 PM
(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);Ty!
void KnightsDespawn(string &in asTimer)
{
SetEntityActive("Knight1", false);
SetEntityActive("Knight2", false);
SetEntityActive("Knight3", false);
SetEntityActive("Knight4", false);
SetEntityActive("Knight5", false);
}
(06-09-2012, 12:36 PM)beecake Wrote: [ -> ]AddTimer("", 5, KnightsDespawn);Uhm.. Could you clear my code? Because im getting error: main(92, 1) : ERR UNEXPECTED END OF FILE
void KnightsDespawn(string &in asTimer)
{
SetEntityActive("Knight1", false);
SetEntityActive("Knight2", false);
SetEntityActive("Knight3", false);
SetEntityActive("Knight4", false);
SetEntityActive("Knight5", false);
}
////////////////////////////
// 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);
}
06-09-2012, 01:15 PM
AddTimer ("", 3, "KnightsDespawn");
Sorry i forgot putting in quotations 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?
Sorry i forgot putting in quotations 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?
06-09-2012, 01:36 PM
(06-09-2012, 01:15 PM)beecake Wrote: [ -> ]AddTimer ("", 3, "KnightsDespawn");Still the same problem.. Unexpected end of file
Sorry i forgot putting in quotations 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?
06-09-2012, 01:45 PM
{
AddTimer("KnightSpawner1", 5.0f, "KnightTimer");
}
void KnightTimer(string &in asTimer)
{
if(asTimer == "KnightSpawner1"){
SetEntityActive("Knight1", false);
}
}
AddTimer("KnightSpawner1", 5.0f, "KnightTimer");
}
void KnightTimer(string &in asTimer)
{
if(asTimer == "KnightSpawner1"){
SetEntityActive("Knight1", false);
}
}
06-09-2012, 01:54 PM
(06-09-2012, 01:45 PM)i3670 Wrote: [ -> ]{STill SAME! ..
AddTimer("KnightSpawner1", 5.0f, "KnightTimer");
}
void KnightTimer(string &in asTimer)
{
if(asTimer == "KnightSpawner1"){
SetEntityActive("Knight1", false);
}
}
(06-09-2012, 01:45 PM)i3670 Wrote: [ -> ]{Or then i added it to wrong position. Could you add it to my code?
AddTimer("KnightSpawner1", 5.0f, "KnightTimer");
}
void KnightTimer(string &in asTimer)
{
if(asTimer == "KnightSpawner1"){
SetEntityActive("Knight1", false);
}
}
06-09-2012, 04:15 PM
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);
}
}
{
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);
}
}
06-09-2012, 09:22 PM
void Morsot1(string &in asItem)
Correct onestring &in asEntity)
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 }
so (string &in asEntity)
SetEntityPlayerInteractCallback("note1", "Morsot1", true);
Correct onestring &in asEntity)
(06-09-2012, 04:15 PM)i3670 Wrote: [ -> ]if(asTimer == "KnightSpawner1"){Isn't needed.
SetEntityActive("kn1", false);
SetEntityActive("kn2", false);
SetEntityActive("kn3", false);
SetEntityActive("kn4", false);
SetEntityActive("kn5", false);
SetEntityActive("kn6", false);
SetEntityActive("kn7", false);
}
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.It's called in the void OnStart.
Do you call it in the level editor?
so (string &in asEntity)
SetEntityPlayerInteractCallback("note1", "Morsot1", true);
Pages: 1 2