Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do i make Statues despawn?
Putkimato Offline
Junior Member

Posts: 25
Threads: 8
Joined: Jun 2012
Reputation: 0
#1
How do i make Statues despawn?

I made 7 knights spawn when i go in area, but how i make them dissapear like after 5 second? Please help fast!
(This post was last modified: 06-09-2012, 09:27 PM by Putkimato.)
06-09-2012, 12:23 PM
Find
Putkimato Offline
Junior Member

Posts: 25
Threads: 8
Joined: Jun 2012
Reputation: 0
#2
RE: How do i make Statues despawn?

(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?
06-09-2012, 12:35 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: How do i make Statues despawn?

AddTimer("", 5, KnightsDespawn);


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

SetEntityActive("Knight3", false);

SetEntityActive("Knight4", false);

SetEntityActive("Knight5", false);

}

Trying is the first step to success.
06-09-2012, 12:36 PM
Find
Putkimato Offline
Junior Member

Posts: 25
Threads: 8
Joined: Jun 2012
Reputation: 0
#4
RE: How do i make Statues despawn?

(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);
}
(This post was last modified: 06-09-2012, 12:52 PM by Putkimato.)
06-09-2012, 12:40 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: How do i make Statues despawn?

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?

Trying is the first step to success.
(This post was last modified: 06-09-2012, 01:18 PM by FlawlessHappiness.)
06-09-2012, 01:15 PM
Find
Putkimato Offline
Junior Member

Posts: 25
Threads: 8
Joined: Jun 2012
Reputation: 0
#6
RE: How do i make Statues despawn?

(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
06-09-2012, 01:36 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#7
RE: How do i make Statues despawn?

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

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

"What you think is irrelevant" - A character of our time

A Christmas Hunt
06-09-2012, 01:45 PM
Find
Putkimato Offline
Junior Member

Posts: 25
Threads: 8
Joined: Jun 2012
Reputation: 0
#8
RE: How do i make Statues despawn?

(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?
(This post was last modified: 06-09-2012, 01:57 PM by Putkimato.)
06-09-2012, 01:54 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#9
RE: How do i make Statues despawn?

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

"What you think is irrelevant" - A character of our time

A Christmas Hunt
(This post was last modified: 06-09-2012, 04:18 PM by i3670.)
06-09-2012, 04:15 PM
Find
Ermu Offline
Member

Posts: 86
Threads: 13
Joined: Jan 2012
Reputation: 2
#10
RE: How do i make Statues despawn?

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);
(This post was last modified: 06-09-2012, 09:28 PM by Ermu.)
06-09-2012, 09:22 PM
Find




Users browsing this thread: 2 Guest(s)