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
Is it possible to make monsters open doors?
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#1
Is it possible to make monsters open doors?

I was wondering if its possible to make monster not break doors when going through them but instead have the door open and let them through?

07-28-2013, 02:07 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Is it possible to make monsters open doors?

Sure. Have a script to open the door when the monster simultaneously in front of the door. To do this, add a script area and a AddEntityCollideCallback script but with the Monster as the Parent object.

"Veni, vidi, vici."
"I came, I saw, I conquered."
07-28-2013, 02:24 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#3
RE: Is it possible to make monsters open doors?

Which is the same as:

void OnStart()
{
AddEntityCollideCallback("Monster", "ScriptDoor", "OpenLikeMoses", true, 1);
}

void OpenLikeMoses (string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door", false, false);
AddBodyForce("Door_body_1", 0, 0, 0, "world"); ///Without Body force, it won't work, so you have to play with the numbers
}

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
07-28-2013, 10:42 AM
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#4
RE: Is it possible to make monsters open doors?

Ah that sounds great, simple yet (should) be effective, thanks!

07-28-2013, 12:31 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#5
RE: Is it possible to make monsters open doors?

(07-28-2013, 10:42 AM)The chaser Wrote: AddBodyForce("Door_body_1", 0, 0, 0, "world"); ///Without Body force, it

Just to add to this, if you use the coordinate setting "local" rather than "world" as the 5th parameter, then it uses the coordinates (x,y,z) of the door entity itself, rather than the whole world. That means that if you have 2 doors at a right angle to each other, you can apply force in the same direction and it will still open it, meaning you can use 1 generic function for any door

For example, I used this function in a test i was doing

void OnStart()
{
    SetEntityPlayerInteractCallback("castle_1", "OpenTheDoors", false);
    SetEntityPlayerInteractCallback("castle_arched01_1", "OpenTheDoors", false);
    SetEntityPlayerInteractCallback("prison_1", "OpenTheDoors", false);
    SetEntityPlayerInteractCallback("sewer_arched_1", "OpenTheDoors", false);
    SetEntityPlayerInteractCallback("metal_1", "OpenTheDoors", false);
}

void OpenTheDoors(string &in strEnt)
{
    SetSwingDoorDisableAutoClose(strEnt, true);
    if (GetSwingDoorClosed(strEnt)) SetSwingDoorClosed(strEnt, false, true);
    AddPropImpulse(strEnt, 0, 0, 4, "Local");
}

That meant I could call OpenTheDoors("name_of_any_door") or use SetEntityPlayerInteractCallback to swing open any door, keeping the function generic enough to work (with the exception of mansion doors, iirc)
Should be easy to transfer that idea to using an area collide callback

(This post was last modified: 07-29-2013, 07:45 PM by Adrianis.)
07-29-2013, 07:43 PM
Find




Users browsing this thread: 1 Guest(s)