Frictional Games Forum (read-only)
Want Enemies to Open Doors - 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: Want Enemies to Open Doors (/thread-9139.html)

Pages: 1 2


Want Enemies to Open Doors - convolution223 - 07-14-2011

Please. I've been trying to do this by having the enemy walk into a script area that says to open the door. But it doesn't work. Can anyone think of a better method, or should this definitely work and there's just something wrong with my code?

also i noticed this door acts like its hinges are greased or something cuz when I open it, it starts to move back closed. I don't mean open it a little, I mean, I open it all the way, it bounces back and starts slowly closing, so I have to carefully place the door open.

It's actually kinda funny cuz one time it closed on my enemy after it walked into the room and it had to break through it to get out.

But yeah, please help.

Code:
void CollideAreaTest03(string &in asParent, string &in asChild, int alState)
{
    if(GetSwingDoorLocked("door1")==false){
    //SetMoveObjectStateExt("door1", 1, 0.9, 1, 0.2, true);
    //SetMoveObjectState("door1", 1);
    SetSwingDoorClosed("door1", false, false);
    }
}
and in OnEnter, i have:
Code:
AddEntityCollideCallback("brute1", "EnemyAtDoor", "CollideAreaTest03", false, 1);



RE: Want Enemies to Open Doors - Paulpolska - 07-14-2011

Try this:

Code:
If(GetEntitiesCollide("A,"B") && if(GetSwingDoorLocked("door1")==false){
...

should work


RE: Want Enemies to Open Doors - convolution223 - 07-14-2011

(07-14-2011, 07:16 AM)Paulpolska Wrote: Try this:

Code:
If(GetEntitiesCollide("A,"B") && if(GetSwingDoorLocked("door1")==false){
...

should work

Got an error, saying it's missing an "expected expression value" or something like that. now it says it's missing a parenthesis lol. okay, third time, here goes...

nope, he still broke through it in a pompous display of his brute strength (ha see what i did there) Sad

for the "expected expression" thing i just removed the second "if" and kept everything else, also it was missing a parenthesis on the end so here's the version i got running but he still won't open the door:
Code:
if (GetEntitiesCollide("brute1","EnemyAtDoor") && (GetSwingDoorLocked("door1")==false)){
SetSwingDoorClosed("door1", false, false);
}



RE: Want Enemies to Open Doors - Paulpolska - 07-14-2011

If(GetEntitiesCollide("A,"B")==true << for example should this is problem


RE: Want Enemies to Open Doors - bigfoot - 07-14-2011

I'm just wondering

but why do you do this:

if (GetEntitiesCollide("brute1","EnemyAtDoor") && (GetSwingDoorLocked("door1")==false)){
SetSwingDoorClosed("door1", false, false);
}

shouldn't it be:
Code:
if (GetEntitiesCollide("brute1","EnemyAtDoor")==true && GetSwingDoorLocked("door1")==false){
SetSwingDoorClosed("door1", false, false);
}

also,
Amnesia wiki script functions say this:

Code:
bool GetEntitiesCollide(string& asEntityA, string& asEntityB);

so GetEntitiesCollide(string& asEntityA, string& asEntityB); is either false or true. Which you don't have in your script.


If I am wrong, please do tell otherwise I'll keep telling people wrong things and we don't want that do we? :p


RE: Want Enemies to Open Doors - Kyle - 07-14-2011

You are wrong for the first part, somewhat. The second part, I don't know.

For example, this is what it should look like:

Code:
if (GetLocalVarInt("Var01") == 1) && (GetLocalVarInt("Var02") == 1)




RE: Want Enemies to Open Doors - nemesis567 - 07-14-2011

If you want thtat to happen, go to the model editor and change your object type from door to something like object-grab. It should work.


RE: Want Enemies to Open Doors - Kyle - 07-14-2011

Wait a second, why don't you just have the path nodes go through the closed door and then have the water lurker break the door, which it should do by itself...

Unless I mistaken myself. :/


RE: Want Enemies to Open Doors - nemesis567 - 07-14-2011

He doesn't want it to break the door.


RE: Want Enemies to Open Doors - convolution223 - 07-14-2011

I just tried to do something else with my original attempt (using AddEntityCollideCallback with the enemy) and it didn't work at all either. Does that function not work with enemies? I'll try and use the GetEntitiesCollide thing again. I'm going to try: if ((GetEntitiesCollide("brute1","EnemyAtDoor")==true) && (GetSwingDoorLocked("door1")==false)){


I also tried
Code:
if (GetEntitiesCollide("brute1","EnemyAtDoor")==true && GetSwingDoorLocked("door1")==false){
still not workin