FragdaddyXXL
Member
Posts: 136
Threads: 20
Joined: Apr 2012
Reputation:
7
|
Trying to use CreateEntityAtArea
Can't get that statue to spawn. Setting the entity active does not work for this entity.
The wiki description is a little vague. Here's my code:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "TriggerArea", true, 1);
}
void TriggerArea(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
PlayMusic("break_glass_bottle3", false, 0.8f, 0.1f, 5, true);
CreateEntityAtArea("deformed_man_2", "deformed_man", "SpawnEntityArea", false);
}
}
I want to know:
What kind of area does an entity spawn at?
|
|
04-10-2012, 10:14 AM |
|
Cranky Old Man
Posting Freak
Posts: 986
Threads: 20
Joined: Apr 2012
Reputation:
38
|
RE: Trying to use CreateEntityAtArea
If you bothered rigging up that screenshot, why haven't you tried it and found out yet?
|
|
04-10-2012, 01:30 PM |
|
FragdaddyXXL
Member
Posts: 136
Threads: 20
Joined: Apr 2012
Reputation:
7
|
RE: Trying to use CreateEntityAtArea
I made that level to teach my self new things. I was like, "Alright, I saw this function called CreateEntityAtArea, lemme see if I can figure out how to use it." And when I tried multiple things (different areas, different names, etc.) and couldn't get it to work, I gave up and headed to the internets. So I wrote up the question, pasted my code, and took a screenshot of what my concoction looked like (maybe it would provide clues?).
|
|
04-10-2012, 02:15 PM |
|
jens
Frictional Games
Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation:
202
|
RE: Trying to use CreateEntityAtArea
I'm guessing the statue is a static prop type of entity and those can't be turned on/off with script (if I recall correctly). Try using another entitiy and see if that works, if so then make a copy of the statue and edit it with the model editor to set it to be another type in user variables.
|
|
04-10-2012, 02:36 PM |
|
FragdaddyXXL
Member
Posts: 136
Threads: 20
Joined: Apr 2012
Reputation:
7
|
RE: Trying to use CreateEntityAtArea
(04-10-2012, 02:36 PM)jens Wrote: I'm guessing the statue is a static prop type of entity and those can't be turned on/off with script (if I recall correctly). Try using another entitiy and see if that works, if so then make a copy of the statue and edit it with the model editor to set it to be another type in user variables. Yeah, I noticed that too. Activation/Deactivation doesn't effect those. But I was thinking Creation would.
|
|
04-10-2012, 03:28 PM |
|
FragdaddyXXL
Member
Posts: 136
Threads: 20
Joined: Apr 2012
Reputation:
7
|
RE: Trying to use CreateEntityAtArea
So, can anyone clear up what exactly this function does?
|
|
04-10-2012, 08:19 PM |
|
Putmalk
Senior Member
Posts: 290
Threads: 13
Joined: Apr 2012
Reputation:
15
|
RE: Trying to use CreateEntityAtArea
Creates an entity, not a static object.
Ignore this post, I'm an idiot. Let's see if I can delete it.
(This post was last modified: 04-10-2012, 08:36 PM by Putmalk.)
|
|
04-10-2012, 08:35 PM |
|
FragdaddyXXL
Member
Posts: 136
Threads: 20
Joined: Apr 2012
Reputation:
7
|
RE: Trying to use CreateEntityAtArea
I just tried to create an entity (normal 'ol dynamic storage box) at a playerStart area when I flipped a switch. No luck. Anyone use this function???
|
|
04-12-2012, 10:36 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Trying to use CreateEntityAtArea
You're supposed to create them at Script areas, not PlayerStart or PosNode areas.
|
|
04-12-2012, 10:44 PM |
|
FragdaddyXXL
Member
Posts: 136
Threads: 20
Joined: Apr 2012
Reputation:
7
|
RE: Trying to use CreateEntityAtArea
(04-12-2012, 10:44 PM)Your Computer Wrote: You're supposed to create them at Script areas, not PlayerStart or PosNode areas. AH!! Finally! Thank you. There wouldn't be a hidden RemoveEntity function by any chance?
It keeps creating new ones with the flip of the switch without removing old ones. Does every one of those have the same name as the first one created? Or do they take care of it by just adding _# to the name (companionCube2, companionCube2_1, etc.)? Not a real important question, just curious.
|
|
04-12-2012, 11:28 PM |
|
|