Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to use CreateEntityAtArea
Author Message
FragdaddyXXL Offline
Member

Posts: 136
Joined: Apr 2012
Reputation: 7
Post: #1
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?
[Image: Editotttest.png]

Dark Seclusion Here
04-10-2012 10:14 AM
Find all posts by this user Quote this message in a reply
Cranky Old Man Offline
Posting Freak

Posts: 922
Joined: Apr 2012
Reputation: 37
Post: #2
RE: Trying to use CreateEntityAtArea

If you bothered rigging up that screenshot, why haven't you tried it and found out yet?

Noob scripting tutorial: From Noob to Pro

04-10-2012 01:30 PM
Find all posts by this user Quote this message in a reply
FragdaddyXXL Offline
Member

Posts: 136
Joined: Apr 2012
Reputation: 7
Post: #3
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?).

Dark Seclusion Here
04-10-2012 02:15 PM
Find all posts by this user Quote this message in a reply
jens Offline
Frictional Games

Posts: 3,566
Joined: Apr 2006
Reputation: 172
Post: #4
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
Visit this user's website Find all posts by this user Quote this message in a reply
FragdaddyXXL Offline
Member

Posts: 136
Joined: Apr 2012
Reputation: 7
Post: #5
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.

Dark Seclusion Here
04-10-2012 03:28 PM
Find all posts by this user Quote this message in a reply
FragdaddyXXL Offline
Member

Posts: 136
Joined: Apr 2012
Reputation: 7
Post: #6
RE: Trying to use CreateEntityAtArea

So, can anyone clear up what exactly this function does?

Dark Seclusion Here
04-10-2012 08:19 PM
Find all posts by this user Quote this message in a reply
Putmalk Offline
Senior Member

Posts: 291
Joined: Apr 2012
Reputation: 15
Post: #7
RE: Trying to use CreateEntityAtArea

Creates an entity, not a static object. Tongue

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
Find all posts by this user Quote this message in a reply
FragdaddyXXL Offline
Member

Posts: 136
Joined: Apr 2012
Reputation: 7
Post: #8
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???

Dark Seclusion Here
04-12-2012 10:36 PM
Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,475
Joined: Jul 2011
Reputation: 234
Post: #9
RE: Trying to use CreateEntityAtArea

You're supposed to create them at Script areas, not PlayerStart or PosNode areas.

Tutorials: From Noob to Pro
04-12-2012 10:44 PM
Visit this user's website Find all posts by this user Quote this message in a reply
FragdaddyXXL Offline
Member

Posts: 136
Joined: Apr 2012
Reputation: 7
Post: #10
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.

Dark Seclusion Here
04-12-2012 11:28 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)