Frictional Games Forum (read-only)

Full Version: Doors not opening when the propforce function is used
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have this area which when a player looks at it, it forces a door to burst open. Here is the coding I have:

Added in onstart:
Code:
SetEntityPlayerLookAtCallback("wind", "windopen", true);

Another function I have set to activate the area:
Code:
void OnPickup(string &in asEntity, string &in type)
{
if(type == "OnPickup")
  {
   SetEntityActive("doorunlock", true);
   SetEntityActive("wind", true);
  }
}

and last but not least, the actual door function:
Code:
void windopen(string &in asEntity, int alState)
{
        
       SetSwingDoorDisableAutoClose("earthquakedoor", true);
       SetSwingDoorClosed("earthquakedoor", false, true);
       AddPropForce("earthquakedoor", -900, -900, -900, "world");

}



Any help would be much appreciated. ALSO telling me to use the collide callback function will not help as I want it to activate after I look at the area.
I usually use the propimpulse. Propforce requires a higher number. Have you checked that the lookat is called? Add a debugmessage or message to it.
(09-01-2011, 07:58 AM)Acies Wrote: [ -> ]I usually use the propimpulse. Propforce requires a higher number. Have you checked that the lookat is called? Add a debugmessage or message to it.

Yes the look at is being called because I added a sound to play in the windopen function, and the sound plays fine.
Then its a matter of numbers. You have set every number to -900. Check which direction the opens (positive or negative x or z) and only apply force or impulse in that direction. Try to impulse command too.
(09-01-2011, 08:08 AM)Acies Wrote: [ -> ]Then its a matter of numbers. You have set every number to -900. Check which direction the opens (positive or negative x or z) and only apply force or impulse in that direction. Try to impulse command too.

Is there anyway to check this? Like on which axis it opens on and which direction?
(09-01-2011, 08:14 AM)ZRPT Wrote: [ -> ]Is there anyway to check this? Like on which axis it opens on and which direction?
In the level editor, when you select an object, you will see blue, red and green arrows. The blue one is Z axis, red one is X axis, green is Y axis. They point in relation to world coordinates.

BTW, you don't need more than 500 for prop force to open a door by force.
Thanks to all that helped( Your Computer/Acies ) I have go it to work now. The only things I need too add now are some noises and reactions. Thank again!