Frictional Games Forum (read-only)

Full Version: Open a door with script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey I have a kinda dumb question I gues.. but I wanted to know if it is possible to open a door with a script.
You close it with the setswingdoorclosed command but if you set it to false the door doesn't open, thats what i tried first.
So does anybody know how to open a door with script?

I mean not to unlock it but to make it swing open...
SetSwingDoorLocked("DoorName", false, true);
(01-09-2011, 02:57 PM)Tottel Wrote: [ -> ]SetSwingDoorLocked("DoorName", false, true);

Uuhm I mean to make the door open not just unlock it i mean i want it to swing open..
Oh, my bad.

I haven't actually used these before, but you can probably use one of these:

void AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
void AddPropImpulse(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
Just use SetSwingDoorClosed Big Grin
(01-09-2011, 03:12 PM)Tottel Wrote: [ -> ]Oh, my bad.

I haven't actually used these before, but you can probably use one of these:

void AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
void AddPropImpulse(string& asName, float afX, float afY, float afZ, string& asCoordSystem);

I#ll try these also they look a little bit complex...

(01-09-2011, 03:15 PM)Frontcannon Wrote: [ -> ]Just use SetSwingDoorClosed Big Grin

as I said i tried this but it didn't worked...
They allow you to put a force along a 3D vector (hence the 3 axes).
(01-09-2011, 03:24 PM)Tottel Wrote: [ -> ]They allow you to put a force along a 3D vector (hence the 3 axes).

The Script function site on wiki says that these commands shouldn't be used together with swingdoors as this would cause the game to crash.
No, it says do not use them on the joints. ^^

But as I said, I haven't used them before.
Code:
AddPropForce("MyDoor", 100.0f, 0.0f, 0.0f, "World");
That's how I implemented it successfully at various locations (as well as the developers Smile).
The example assumes that your door swings open towards the x-axis. If I remember it correctly, 100.0 is not enough to open the door completely, so you might have to either call this multiple times by means of a timer or adjust the force value.
Pages: 1 2