convolution223
Member
Posts: 78
Threads: 15
Joined: Jul 2011
Reputation:
0
|
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 |
|
Paulpolska
Member
Posts: 144
Threads: 29
Joined: Jun 2011
Reputation:
0
|
RE: Want Enemies to Open Doors
Try this:
If(GetEntitiesCollide("A,"B") && if(GetSwingDoorLocked("door1")==false){
...
should work
|
|
07-14-2011, 07:16 AM |
|
convolution223
Member
Posts: 78
Threads: 15
Joined: Jul 2011
Reputation:
0
|
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)
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 |
|
Paulpolska
Member
Posts: 144
Threads: 29
Joined: Jun 2011
Reputation:
0
|
RE: Want Enemies to Open Doors
If(GetEntitiesCollide("A,"B")==true << for example should this is problem
|
|
07-14-2011, 07:34 AM |
|
bigfoot
Member
Posts: 58
Threads: 12
Joined: Dec 2010
Reputation:
0
|
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 |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
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 |
|
nemesis567
Posting Freak
Posts: 874
Threads: 65
Joined: May 2011
Reputation:
10
|
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 |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
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 |
|
nemesis567
Posting Freak
Posts: 874
Threads: 65
Joined: May 2011
Reputation:
10
|
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 |
|
convolution223
Member
Posts: 78
Threads: 15
Joined: Jul 2011
Reputation:
0
|
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 |
|
|