Frictional Games Forum (read-only)
Trying to use CreateEntityAtArea - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Trying to use CreateEntityAtArea (/thread-14673.html)

Pages: 1 2


Trying to use CreateEntityAtArea - FragdaddyXXL - 04-10-2012

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:


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]



RE: Trying to use CreateEntityAtArea - Cranky Old Man - 04-10-2012

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




RE: Trying to use CreateEntityAtArea - FragdaddyXXL - 04-10-2012

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?).



RE: Trying to use CreateEntityAtArea - jens - 04-10-2012

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.



RE: Trying to use CreateEntityAtArea - FragdaddyXXL - 04-10-2012

(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.




RE: Trying to use CreateEntityAtArea - FragdaddyXXL - 04-10-2012

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




RE: Trying to use CreateEntityAtArea - Putmalk - 04-10-2012

Creates an entity, not a static object. Tongue

Ignore this post, I'm an idiot. Let's see if I can delete it.


RE: Trying to use CreateEntityAtArea - FragdaddyXXL - 04-12-2012

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???



RE: Trying to use CreateEntityAtArea - Your Computer - 04-12-2012

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


RE: Trying to use CreateEntityAtArea - FragdaddyXXL - 04-12-2012

(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.