View Full Version : door that rotates open.

11-15-2003, 09:33 PM
is it possible to make a door that rotates open like its on a hinge?

and if so could you tell me how :)

11-15-2003, 10:30 PM
Sure it is. With scripting. You need but one func_static that has the origin brush where you want the hinges to be (in the XY coordinates, and no need for multiple origins of course). Then in BehavEd you rotate the func_static the way you like, to the direction you desire. Mess around with the rotate command a little bit. It might not work quite the way you thought it would. It only takes in absolute direction values corresponding to the original angles of the brush in radiant, so it doesn't in a certain sense remember previous rotations.

If you haven't scripted before, then you should just first familiarise yourself with ICARUS, and only then build you hinged doors.

Well, this was the way in JO. It bet it's not much different in JA.

11-15-2003, 11:28 PM
thank you very much for your help.

alright a few questions. could you explain in greater detail how i implement the script and how i have it so it rotates when a player goes a certain place.

11-16-2003, 10:01 AM
Most likely you want to place one trigger_multiple around the door. It should be long enough so that it stretches throught the door (in this case func_static) to both side of it. So that no matter from what direction you approach the door, the trigger would launch. The just set some wait value to the trigger, like 5 seconds (needs probably to be adjusted), so that the script won't try to launch too many times in too short a time. Target the trigger to a target_scriptrunner.

In the scriptrunner, set "count" to "-1", so that the door can be opened as many times as wanted. Then enter "usescript" key and as the value: "mymapname/hingeddoor". That is of course the path to the script and the actual script name. Naturally you must have under script folder a subfolder named after your map's name.

Ah, the func_static itself. Like I said, you need to have the actual visible door composed of as many brushes as you want. Then just insert the origin brush. It's just a brush covered with system/origin, an ugly orange shader. The exact center of that origin brush is the center of rotation. So if you look the door from above, the center of the origin brush needs to be where your hinges lie. The origin brush won't show ingame, it's just in the editor, and it doens't even need to be inside the actual visible entity. Give the func_static a "script_targetname" key with a value: "hingedoor".

Then you need to launch the good old, trustworthy BehavEd, and make the script. Start it with:

//Generated by BehavEd

affect ( "hingedoor", /*@AFFECT_TYPE*/ FLUSH )

task ( "opendoor" )
rotate ( < 0.000 90.000 0.000 >, 1400.000 );

task ( "closedoor" )
rotate ( < 0.000 0.000 0.000 >, 1400.000 );

dowait ( "opendoor" );
wait ( 3000.000 );
dowait ( "closedoor" );

Now, this script would rotate the func_static to point to the direction of 90 degrees in Radiant definition (in 1.4 seconds). If you don't set any angles to an entity in Radiant, it considers itself to point to 0 (=360) degrees, and so it would turn 90 degrees. In effect this script turns it 90 degrees, waits for 3 seconds, and returns it to point to 0 degrees, that is, to the original orientation. Save the script with a name hingeddoor, compile it and copy the .ibi file to the appropriate folder.

Of course, at some point, you might want to add horrible, rusty grating sound to the door, but I'm sure you are quite famialiar with that kind of procedures already.

That should be it. Most likely I forgot something, but this should give you some impression of the deeds needed to do the trick.

11-16-2003, 11:05 AM
thank you so much! i am a complete noob to scripting, and had no idea what to do.