+ Rispondi alla Discussione
Risultati da 1 a 4 di 4
  1. #1
    heXen
    ospite

    Predefinito [Tutorial DooM III] : Gravity Floor Puzzle

    Questo sembra ancora più intrigante

    Indirizzo


    "DoV_Tomas"
    The Gravity Floor Puzzle - Tutorial

    The Scenario

    In your never ending quest to defeat the forces of evil, you come across a room that looks like this (well this is a test map but yours will be much more pretty).



    The objective is to get up on that tier, but as indicated by the pistol and shield brandishing marine - placed there for scale - the tier seems inaccessible. Wait a second, no ladder, no hidden passages, just three immovable panels strewn on a funky looking floor. What gives? As any good marine would do you explore that mysterious nearby panel.



    Hmmm, gravity control...You click on the panel and punch in the code 666. Suddenly the Strewn panels on the floor come to life and float into the air creating a stairway to the tier! Well done!



    While this tutorial doesn't make any earth shattering discoveries- most of the procedures are already documented in other tutorials- it does provide a convenient process that lets you add just another creative way of moving through your level. If nothing else the little bit of spline and gui code is already written for you, and placing movers and func-statics takes just a few minutes. I also created my second slightly modified gui through experimenting with the hackers' greatest tool: the cut and paste. This gui creating process shows the steps and file saving conventions that let you alter existing assets to give your conversions an added touch of continuity with respect to guis. Best of all it takes just a few minutes. There are basically three aspects to building this gravity puzzle: the quasi-custom gui (code), the movers and splines, and the spline routine code. We'll look at each step separately. Note, this tutorial assumes you know Radiant basics, including how to make splines.

    The GUI

    The door code gui in Doom3's CPU map caught my eye so that became the basis of my quasi-custom gui. This gui exists in the form of code and its location and name are "Doom3/pak000/guis/doors/areakeypad.gui". If you haven't already done so you'll have to unpack the .pak file, and open the code in Notepad or even better a text editor such as Crimson Editor. We are only going to alter one line of code - thanks goodness ID has already given us the basis for a usable gui. The only problem with the areakeypad/gui is line 237 of the code, which looks like this:

    text "#str_03445"

    If you look at the "Doom3/pak000/strings/english.lang" file you'll notice "#str_03445" translates into the line, "Security Access Code Door" which is totally wrong for our gravity floor control panel. So, we change this line to:

    text "Security Gravity Activation"

    =========Edited======== March 19/05

    In addition to setting up the custom gui as described below, you can use this easier alternative:

    1. Create a guis folder in your D3/base
    2. Create a guis folder in the D3/base/guis folder as per above
    3. Save your custome guis with the name xxx.guis where xxx is a name of your chosing. You will end up calling your custom guis with this map key/val:

    key: gui
    val: guis/guis/xxx.gui

    Otherwise you make a pak using this method:

    ======================================== =

    Once you've altered the code, save your file anywhere for now and rename it. I named my new gui file, "areakeypadTom.gui". I wanted my new gui to show up in the guis menu in the entity window in Radiant so it's convenient to retrieve, so you'll have to set up the following file structure.

    1. Create a folder and name it anything you want. I named mine keyTom.
    2. Inside the keyTom folder create another folder called guis.
    3. Put your new gui into this gui sub-folder so you end up with this folder/file structure: keyTom/guis/areakeypadTom.gui.

    Next zip this file, change the file extension to .pk4 and place the file in your Doom3/base folder. The gui file now shows up in your entity list ready to be placed in your map.



    At this point we can go to our map, place a func-static and change the entity information to the following. Of course you can use any monitor model or you can use the one I did. Note that my entity parameters as depicted below specify a target1 and target2. You only include these if you have more than one floating step. If you're creating only one floating step, just specify the key/val target:trigger_relay_1.



    This particular gui, as constructed by ID, has four gui parameters we can mess with, with gui_parm1 - gui_parm3 being the key code we desire. Since I want a keycode of 666 (any will do as long as there's no more than three digits), I put the key/vals to :gui_parm1/6, gui_parm2/6 and gui_parm3/6. The original code for this gui as ID wrote it allows us to specify a line of text for gui_parm4 using the entity window, and in the CPU map gui_parm4 calls the text string, "#str_02967 which translates into "CPU Lab A". This line doesn't meet our needs so we type in whatever line of text we desire, and in this case I typed in the phrase "Gravity Switch" in the monitor's entity window. Again, refer to the image just above and make sure you input the same information.

    That covers the gui portion of this project so let's move on to creating our movers and splines.

    Movers and Splines

    I'll describe the process for placing one "moving step set" set which is comprised of a func_mover (the actual step that floats) and a func_static with a spline, then it's just a matter of repeating the process for as many floating stairs as we want. So, place a func_mover on your map; this will be the actual strewn panel or floating step.Size and texture it as you want, place it in its first position (at rest) and add the following key/vals using the entity window:

    name: step1
    cinematic: 1
    solid: 1
    solidForTeam:1

    If you were to add more steps, for my code to work, you'll have to name the other steps, "step2", "step3"...."stepn".

    Next, add a func_static and all you have to change is its name, which I've named "anchorg_spline". You can name the func_static - and indeed the stair above - to anything, but the code I've written uses the names I've chosen here so either name your elements the same as I have, or you'll have to change the code (that follows) to take into account the names you
    chose. If you have more than one step/spline, to work with my code, you'll have to name subsequent splines, anchorg2_spline, anchorg3_spline, anchorgn_spline.

    Now, select the func_static and add a spline to it. This will define the path that our floating step will take. You'll have to experiment with the shape of the spline since the movers kind of follow splines in a weird way. I'm sure with another set up and more intricate code you can make the mover do anything you want, however, with my limited knowledge I try to keep things simple. Anyway, I won't go into a lengthy description of how movers follow splines, but in order to make the step rise up and orient itself with its long sides facing parallel to the floor and ceiling, the spline has to take on a particular shape. Refer to the image below to see how I drew my spline and you should make your splines the same shape.



    Again, once you've got everything set up, you can experiment with different shaped splines to get more intricate movements. Save and compile your map using the name "cam1". You can use any name but your script call (as described below) must match your map name. Alright, so now we have our func_mover step, our func_static with a spline and our gui console. In order for our step to come to life when the code 666 is input on the gui panel, we'll add a trigger_relay and add the key/val, "call/camera_script" to the trigger_relay. You can name the value anything you want but again it must match the code you'll write. In this case, if you want to keep it simple, just use the "camera_script" value for the call. Next select the console with the gui, then shift-select the trigger_once and connect them using the ctrl-k connect command. Your map will look something like this:



    Note, if you want to control three steps, you'll have to add a trigger relay for each step and use the key/val pair:

    trigger_relay_2: call/camera_script2
    trigger_relay_3: call/camera_script3
    trigger_relay_n: call/camera_scriptn

    Let's move on to the camera_script code.

    Spline Routine Code

    Here is the code to make a single step float. You can copy and paste it into any text editor, and save it using the file name that you used for your map with the extension ".script". For example I saved my map using the name "cam1" so I will save my spline code using this name: "cam1.script". Place this script file into the Doom3/base/maps folder. Below is the script for a single step, and below that is a script sample for three steps.

    Script for Moving One Step

    Quote:
    void start_anchorg_spline()
    {
    $step1.time(10); //How many seconds it will take to follow the spline from start to finish
    $step1.accelTime(1); //How long it takes to get up to speed
    $step1.decelTime(1); //How long it takes to decelerate
    $step1.startSpline($anchorg_spline); //Start the func_mover "anchorg" moving along the spline
    }
    void camera_script()
    {
    start_anchorg_spline(); //calls the script above

    }


    Script for Moving Three Steps

    Quote:
    void start_anchorg_spline()
    {
    $step1.time(10); //How many seconds it will take to follow the spline from start to finish
    $step1.accelTime(1); //How long it takes to get up to speed
    $step1.decelTime(1); //How long it takes to decelerate
    $step1.startSpline($anchorg_spline); //Start the func_mover "anchorg" moving along the spline
    }

    void start_anchorg2_spline()

    {
    $step2.time(10); //How many seconds it will take to follow the spline from start to finish
    $step2.accelTime(1); //How long it takes to get up to speed
    $step2.decelTime(1); //How long it takes to decelerate
    $step2.startSpline($anchorg2_spline); //Start the func_mover "anchorg" moving along the spline

    }

    void start_anchorg3_spline()

    {
    $step3.time(10); //How many seconds it will take to follow the spline from start to finish
    $step3.accelTime(1); //How long it takes to get up to speed
    $step3.decelTime(1); //How long it takes to decelerate
    $step3.startSpline($anchorg3_spline); //Start the func_mover "anchorg" moving along the spline

    }


    void camera_script()
    {
    start_anchorg_spline(); //calls the script above

    }

    void camera_script2()
    {
    start_anchorg2_spline(); //calls the script above

    }

    void camera_script3()
    {
    start_anchorg3_spline(); //calls the script above
    }
    Conclusion

    Now all that's left is to do is to start Doom3, load your map, input the code 666 into the gui console and watch your steps float into position. You'll have to mess around with the original position of the strewn panels, the shape of the splines, their relative position to the tier and other variables, but it doesn't take long to get the hang of it. A word of caution: my set up makes the steps do kinda weird things at first before they settle into their final position. For example the steps sort of sink into the floor before they start following the spline. While I am sure more experimentation will solve this, I don't really mind since it’s so satisfying to watch the steps float into position to form a floating staircase. Also, once the steps are in their floating position, they remain static. I am working on making them bob once they're in mid-air but if anyone knows the coding to do this I will update the camera_spline scripts in this tutorial. Still, even in their floating static state they look pretty cool. Also, add that weird floor beneath the steps to conclude the illusion that it is a gravity floor. You could also add some smoke, coloured lights, sound effects and even a rag doll on the floor so it too floats when the "gravity effect" is triggered. This further "sells" the illusion and adds some humour. Add eye candy and I am sure the gag will enrich any level.

    Have fun and we'll see you around the mod forums.

  2. #2
    Lo Zio L'avatar di mattoxo
    Data Registrazione
    12-09-02
    Località
    Roma
    Messaggi
    3,158

    Predefinito Re: [Tutorial DooM III] : Gravity Floor Puzzle

    ho dovuto modificare perchè sformattava hexen

  3. #3
    heXen
    ospite

    Predefinito Re: [Tutorial DooM III] : Gravity Floor Puzzle

    no problem,errore mio


    scusate

  4. #4
    Lo Zio L'avatar di mattoxo
    Data Registrazione
    12-09-02
    Località
    Roma
    Messaggi
    3,158

    Predefinito Re: [Tutorial DooM III] : Gravity Floor Puzzle

    Hexen Third ha scritto mar, 20 giugno 2006 alle 10:56
    no problem,errore mio


    scusate
    ci mancherebbe

+ Rispondi alla Discussione

Permessi di Scrittura

  • Tu non puoi inviare nuove discussioni
  • Tu non puoi inviare risposte
  • Tu non puoi inviare allegati
  • Tu non puoi modificare i tuoi messaggi
  • Il codice BB è Attivato
  • Le faccine sono Attivato
  • Il codice [IMG] è Attivato
  • Il codice HTML è Disattivato