Difference between revisions of "Create story script"

From XStoryPlayer Wiki
Jump to: navigation, search
(Created page with "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. <ol> <li>We don't want the d...")
 
Line 5: Line 5:
 
Open the <code>/init/story/scenes.dat</li> file and add:
 
Open the <code>/init/story/scenes.dat</li> file and add:
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
door_objecti DOOR1
+
door_objecti CELL1
 
{
 
{
   q        =  0;
+
  rotate  = false; // Door translates
   q_min    = -150;
+
 
   q_max    = 150;
+
   q        = 4.5; // Open height
   q_spring = 1.33;
+
  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;
 
   open = false;
+
 
   obj_name = "cell1"; //
+
   obj_name = "cell2";
 
}
 
}
</syntaxhighlight>
+
</syntaxhighlight><br>
 +
This will make a door object from the scene object. Now we can also open the door using a script.
 +
</li>
 
</ol>
 
</ol>

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</li> file and add:
    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. </li> </ol>