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


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

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#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 Reply
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#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 Reply
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#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 Reply
jens Offline
Frictional Games

Posts: 4,095
Threads: 199
Joined: Apr 2006
Reputation: 202
#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
Website Find Reply
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#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 Reply
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#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 Reply
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#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 Reply
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#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 Reply
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#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
Website Find Reply
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#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 Reply




Users browsing this thread: 1 Guest(s)