taylor122002
Junior Member
Posts: 13
Threads: 10
Joined: Aug 2012
Reputation:
0
|
Make Statues Appear Behind You?
Hello everyone! I have another question about scripting that I'm stuck on again.
My question is, is in my story, there is a secret room which you have to find a key for. After you find the key and unlock the door, there is an Iron Maiden. When the player opens the Iron Maiden, it's full of good things such as oil potions, health potions and sanity potions. After the player picks up the goodies, there is a note that simply reads "See, not all Iron Maiden's are bad". And after you read it and turn around, there is a random statue just standing there behind the player.
Does anyone know how to script this and how I would set it up so a statue would appear behind you after reading the note? I've seen multiple things this, but not knowing how to set up the whole thing. Like in a custom story, a note will say "Behind you", and when you turn around, there is a statue there or a monster or whatever. Can anyone help me with this?
Thank you in advanced!
EDIT: Ah, wait, never mind, kind of. I just did the same scripting I did with the grunt that appears behind you by using the SetEntityActive thingy. I put that in the Iron Maiden so I made it appear before you leave the secret room. But if anybody knows how to make it so when I pick up something too, then it appears behind you if it's possible, please feel free to reply!
(This post was last modified: 11-12-2012, 03:08 AM by taylor122002.)
|
|
11-12-2012, 02:49 AM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Make Statues Appear Behind You?
Under the properties of the note, there is a space with something called "SetInteractCallback" (Or something like that).
In there, write your function. It could be "StatueAppearFunction".
Then in you script write:
void StatueAppearFunction(string &in asEntity)
{
SetEntityActive("ENTITY", true);
}
Trying is the first step to success.
|
|
11-12-2012, 06:47 AM |
|
thetastyfish
Junior Member
Posts: 18
Threads: 6
Joined: Feb 2013
Reputation:
0
|
RE: Make Statues Appear Behind You?
I am trying to do the same thing, but I want the statue to appear when the player collides with a certain script area. I have tried the SetEntityActive and CreateEntityAtArea functions but to no avail. I'm working with an eagle statue, but don't know which function to use. If you could please explain in detail how to make the statue appear, I would really appreciate it!
|
|
02-28-2013, 01:42 AM |
|
Tiger
Posting Freak
Posts: 1,874
Threads: 16
Joined: Nov 2012
Reputation:
55
|
RE: Make Statues Appear Behind You?
(02-28-2013, 01:42 AM)thetastyfish Wrote: I am trying to do the same thing, but I want the statue to appear when the player collides with a certain script area. I have tried the SetEntityActive and CreateEntityAtArea functions but to no avail. I'm working with an eagle statue, but don't know which function to use. If you could please explain in detail how to make the statue appear, I would really appreciate it!
Use 'PlayerCollideCallback' and 'SetEntityActive'? If it's not working you're probably not doing it right.
|
|
02-28-2013, 02:03 AM |
|
thetastyfish
Junior Member
Posts: 18
Threads: 6
Joined: Feb 2013
Reputation:
0
|
RE: Make Statues Appear Behind You?
(02-28-2013, 02:03 AM)Tigerwaw Wrote: (02-28-2013, 01:42 AM)thetastyfish Wrote: I am trying to do the same thing, but I want the statue to appear when the player collides with a certain script area. I have tried the SetEntityActive and CreateEntityAtArea functions but to no avail. I'm working with an eagle statue, but don't know which function to use. If you could please explain in detail how to make the statue appear, I would really appreciate it!
Use 'PlayerCollideCallback' and 'SetEntityActive'? If it's not working you're probably not doing it right.
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_7", "FUNCTION7", true, 1);
}
void FUNCTION7(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("eagle_1", true);
SetLightVisible("PointLight_2", true);
SetLightVisible("PointLight_1", true);
}
This is what I've tried, and it doesn't work.
|
|
02-28-2013, 03:47 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Make Statues Appear Behind You?
(02-28-2013, 03:47 AM)thetastyfish Wrote: (02-28-2013, 02:03 AM)Tigerwaw Wrote: (02-28-2013, 01:42 AM)thetastyfish Wrote: I am trying to do the same thing, but I want the statue to appear when the player collides with a certain script area. I have tried the SetEntityActive and CreateEntityAtArea functions but to no avail. I'm working with an eagle statue, but don't know which function to use. If you could please explain in detail how to make the statue appear, I would really appreciate it!
Use 'PlayerCollideCallback' and 'SetEntityActive'? If it's not working you're probably not doing it right.
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_7", "FUNCTION7", true, 1);
}
void FUNCTION7(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("eagle_1", true);
SetLightVisible("PointLight_2", true);
SetLightVisible("PointLight_1", true);
}
This is what I've tried, and it doesn't work.
Did you collide with ScriptArea_7 in-game?
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
02-28-2013, 08:17 AM |
|
thetastyfish
Junior Member
Posts: 18
Threads: 6
Joined: Feb 2013
Reputation:
0
|
RE: Make Statues Appear Behind You?
(02-28-2013, 08:17 AM)JustAnotherPlayer Wrote: (02-28-2013, 03:47 AM)thetastyfish Wrote: (02-28-2013, 02:03 AM)Tigerwaw Wrote: (02-28-2013, 01:42 AM)thetastyfish Wrote: I am trying to do the same thing, but I want the statue to appear when the player collides with a certain script area. I have tried the SetEntityActive and CreateEntityAtArea functions but to no avail. I'm working with an eagle statue, but don't know which function to use. If you could please explain in detail how to make the statue appear, I would really appreciate it!
Use 'PlayerCollideCallback' and 'SetEntityActive'? If it's not working you're probably not doing it right.
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_7", "FUNCTION7", true, 1);
}
void FUNCTION7(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("eagle_1", true);
SetLightVisible("PointLight_2", true);
SetLightVisible("PointLight_1", true);
}
This is what I've tried, and it doesn't work.
Did you collide with ScriptArea_7 in-game?
I did, and it didn't work.
|
|
02-28-2013, 12:56 PM |
|
Tiger
Posting Freak
Posts: 1,874
Threads: 16
Joined: Nov 2012
Reputation:
55
|
RE: Make Statues Appear Behind You?
Make sure you've named everything right in the level editor.
|
|
02-28-2013, 01:24 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Make Statues Appear Behind You?
The eagle is a static_object!
Static objects cannot(!) be set active and inactive.
To solve this you need to create a .ent file for the eagle (By copying it from another entity, and editing the .dea path).
After that make it an object that cannot be moved, but do not make it into a static object because this will result in the same as static_objects.
Trying is the first step to success.
|
|
02-28-2013, 02:14 PM |
|
i3670
Posting Freak
Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation:
36
|
RE: Make Statues Appear Behind You?
(02-28-2013, 02:14 PM)BeeKayK Wrote: The eagle is a static_object!
Static objects cannot(!) be set active and inactive.
The eagle is an entity, under statues.
|
|
02-28-2013, 03:38 PM |
|
|