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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Want Enemies to Open Doors
convolution223 Offline
Member

Posts: 78
Threads: 15
Joined: Jul 2011
Reputation: 0
#1
Want Enemies to Open Doors

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.

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:
AddEntityCollideCallback("brute1", "EnemyAtDoor", "CollideAreaTest03", false, 1);
(This post was last modified: 07-14-2011, 06:51 AM by convolution223.)
07-14-2011, 06:45 AM
Find
Paulpolska Offline
Member

Posts: 144
Threads: 29
Joined: Jun 2011
Reputation: 0
#2
RE: Want Enemies to Open Doors

Try this:

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

should work

MY CUSTOM STORY - - STILL ALIVE - -
http://www.moddb.com/mods/still-alive
07-14-2011, 07:16 AM
Find
convolution223 Offline
Member

Posts: 78
Threads: 15
Joined: Jul 2011
Reputation: 0
#3
RE: Want Enemies to Open Doors

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

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:
if (GetEntitiesCollide("brute1","EnemyAtDoor") && (GetSwingDoorLocked("door1")==false)){
SetSwingDoorClosed("door1", false, false);
}
(This post was last modified: 07-14-2011, 07:36 AM by convolution223.)
07-14-2011, 07:34 AM
Find
Paulpolska Offline
Member

Posts: 144
Threads: 29
Joined: Jun 2011
Reputation: 0
#4
RE: Want Enemies to Open Doors

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

MY CUSTOM STORY - - STILL ALIVE - -
http://www.moddb.com/mods/still-alive
07-14-2011, 07:34 AM
Find
bigfoot Offline
Member

Posts: 58
Threads: 12
Joined: Dec 2010
Reputation: 0
#5
RE: Want Enemies to Open Doors

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:
if (GetEntitiesCollide("brute1","EnemyAtDoor")==true && GetSwingDoorLocked("door1")==false){
SetSwingDoorClosed("door1", false, false);
}

also,
Amnesia wiki script functions say this:

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
(This post was last modified: 07-14-2011, 09:48 AM by bigfoot.)
07-14-2011, 09:47 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#6
RE: Want Enemies to Open Doors

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

For example, this is what it should look like:

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


07-14-2011, 02:52 PM
Find
nemesis567 Offline
Posting Freak

Posts: 874
Threads: 65
Joined: May 2011
Reputation: 10
#7
RE: Want Enemies to Open Doors

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.

Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
07-14-2011, 03:31 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#8
RE: Want Enemies to Open Doors

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. :/

07-14-2011, 06:11 PM
Find
nemesis567 Offline
Posting Freak

Posts: 874
Threads: 65
Joined: May 2011
Reputation: 10
#9
RE: Want Enemies to Open Doors

He doesn't want it to break the door.

Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
(This post was last modified: 07-14-2011, 10:34 PM by nemesis567.)
07-14-2011, 06:19 PM
Find
convolution223 Offline
Member

Posts: 78
Threads: 15
Joined: Jul 2011
Reputation: 0
#10
RE: Want Enemies to Open Doors

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
if (GetEntitiesCollide("brute1","EnemyAtDoor")==true && GetSwingDoorLocked("door1")==false){
still not workin
(This post was last modified: 07-14-2011, 08:16 PM by convolution223.)
07-14-2011, 08:09 PM
Find




Users browsing this thread: 1 Guest(s)