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?
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.
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
}
Ah that sounds great, simple yet (should) be effective, thanks!
(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
Code:
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