Difference between revisions of "Create story script"

From XStoryPlayer Wiki
Jump to: navigation, search
Line 3: Line 3:
 
<ol>
 
<ol>
 
<li>We don't want the doors to open automatically. We need to make the doors objects that can be driven by the script.<br>
 
<li>We don't want the doors to open automatically. We need to make the doors objects that can be driven by the script.<br>
Open the <code>/init/story/scenes.dat</code> file and add:
+
Open the <code>/init/story/scenes.dat</code> file and add under <code>data {...}</code> :
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
 
door_objecti CELL1
 
door_objecti CELL1

Revision as of 14:22, 12 January 2015

In this tutorial we will add some scripting: Give feedback to player, make the doors open when a specific event occurs, let female alien walk by.

  1. We don't want the doors to open automatically. We need to make the doors objects that can be driven by the script.
    Open the /init/story/scenes.dat file and add under data {...} :
    door_objecti CELL1
    {
      rotate   = false; // Door translates
     
      q        = 4.5;  // Open height
      q_min    = 0.0;  // Min height
      q_max    = 6.0;  // Max height
      q_spring = 20.0; // Spring used for opening door
     
      open = true; // Door status
     
      obj_name = "cell1"; // Object in scene that is the door
    }
     
    door_objecti CELL2
    {
      rotate   = false;
     
      q        = 4.5;
      q_min    = 0.0;
      q_max    = 6.0;
      q_spring = 20.0;
     
      open = false;
     
      obj_name = "cell2";
    }

    This will make a door object from the scene object. Now we can also open the door using a script.