Difference between revisions of "Abducted story"

From XStoryPlayer Wiki
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 105: Line 105:
 
The funnel task ends in coughing so we will use that here. We will never end the funnel task so she keeps coughing.<br>
 
The funnel task ends in coughing so we will use that here. We will never end the funnel task so she keeps coughing.<br>
 
Using the <code>SendBaseEvent</code> function we will notify the player.<br>
 
Using the <code>SendBaseEvent</code> function we will notify the player.<br>
This will result in a callback to the player in the <code>ref.dat</code> with function <code>ALIEN.cough1</code>.
+
This will result in a callback to the player in the <code>ref.dat</code> with function <code>ALIEN.cough1</code>.</li>
</li>
+
<li>Because we want to skip the funnel part of the funnel task we also added some code to the <code>COUGH</code> state:
 +
<syntaxhighlight lang="cpp">
 +
[state.dyn.me.task.funnel.state == WAIT_FUNNEL]
 +
{     
 +
  loc.ses.state = CLOSED;
 +
  loc.ses.dur  = 5.0;
 +
  SetEyeState(loc.ses);
 +
   
 +
  state.dyn.me.task.funnel.state = FLUID_CHOKE;
 +
}
 +
</syntaxhighlight>
 +
So here we skip the waiting for the funnel part of the task. The eyes are closed and she is put into the choke mode.</li>
 
</ol>
 
</ol>
  

Latest revision as of 15:53, 21 January 2015

We added some extra code to finish the abducted story. We will walk over the important parts of the code in this chapter.
It is not really a tutorial, but it is worth reading to gain more knowledge about modding.
It for example describes how to get the character to do a (sexual) task.

Abducted story1.jpg

What was added to the story

  1. First copy the complete pack_abducted directory from the 'Tutorial resource pack' to your ./pack directory.
    You may want to rename your own pack directory from the previous tutorials in order to keep the results.
    Now start the story from the beginning and play it to the end.
  2. You will notice that several elements have been added:
    • The alien girl reacts to your penis being shown.
    • The alien girl opens the door.
    • The alien girl gets into a blowjob pose.
    • The alien girl start coughing when you eject in her mouth.
    • It is detected when you escape.
  3. Most (90%) of the code has been added to the run.dat files for both the player and the alien girl.
    There are also some small changes to some other files, but if you followed the previous tutorials it should be pretty clear what these changes are.

The alien girl reacts to your penis being shown

  1. Open the /init/story/alien/brain/run.dat file.
  2. Take a look at the WAIT_REACTION state.
    [state.dyn.me.avatar.penis_mode > 0]
    {      
      SetFocusElem(PENIS);
     
      do_set_timer(5);
     
      state.dyn.me.do.state2 = SEE_PENIS;
      return;
    }

    When the avatar (player) its penis_mode is larger than 0 (3 = erected), the alien girl focuses on the penis and goes into SEE_PENIS state.

The alien girl opens the door

  1. Open the /init/story/alien/brain/run.dat file.
  2. Take a look at the START1 state.
    loc.so.obj = SPACESHIP1:CELL2;
    loc.so.par = DOOR_SET_STATUS;
    loc.so.val = DOOR_SETVAL_STATUS_OPEN;	    
    SetObject(loc.so);

    After the alien girl made a bow like gesture the doors opens using this code. It is the same code we tested at the start of the tutorials.

The alien girl gets into a blowjob pose

  1. Open the /init/story/alien/brain/run.dat file.
  2. Take a look at the START_BLOWJOB state.
    loc.task.waypoint = SPACESHIP1:INCELL_WP1;
    loc.task.mood     = DISGUSTED;
    start_task_blowjob(loc.task);

    A task is a subroutine that allows you to perform a complex task without much programming.
    The task can often be started using several startup parameters. In this case we want the girl to perform the blowjob at waypoint SPACESHIP1:INCELL_WP1.
    Also we want the girl to look somewhat disgusted at your penis during the blowjob.

    The task code can be found in the standard libraries of the brain (/init/std/base/char/brain/code/task/task_blowjob.dat).
  3. Because normally the disgusted mode of the blowjob task starts with nodding to the penis, we need to skip that part.
    That is why in the GIVING_BLOWJOB state we added the code:
    [state.dyn.me.task.blowjob.state == MOVEAWAY]
    {
      set_task_blowjob_state(GIVEHEAD); 
    }

    This will skip the move-away part of the blowjob and directly spring into action. The girl will however look somewhat angry/disgusted.

The alien girl start coughing when you eject in her mouth

  1. Open the /init/story/alien/brain/run.dat file.
  2. Take a look at the state_run1_check_cough function.
    [state.dyn.me.coll.mouth_pen.obj_type != PENIS_OBJ] return;
    [state.dyn.me.coll.mouth_deep.obj_par == 0] return;
    [state.dyn.me.avatar.fluid_type == 0] return;
     
    stop_task_blowjob();
     
    loc.task.mood = DISGUSTED;
    start_task_funnel(loc.task);
     
    loc.be.obj    = PLAYER;
    loc.be.id     = state.this;
    loc.be.action = "cough1";
    SendBaseEvent(loc.be);

    When the girl has your penis in her mouth and you eject, the blowjob task is stopped. Then the funnel task is started.
    The funnel task ends in coughing so we will use that here. We will never end the funnel task so she keeps coughing.
    Using the SendBaseEvent function we will notify the player.

    This will result in a callback to the player in the ref.dat with function ALIEN.cough1.
  3. Because we want to skip the funnel part of the funnel task we also added some code to the COUGH state:
    [state.dyn.me.task.funnel.state == WAIT_FUNNEL]
    {      
      loc.ses.state = CLOSED;
      loc.ses.dur   = 5.0;
      SetEyeState(loc.ses);
     
      state.dyn.me.task.funnel.state = FLUID_CHOKE;
    }
    So here we skip the waiting for the funnel part of the task. The eyes are closed and she is put into the choke mode.

It is detected when you escape

  1. Open the /init/story/player/brain/run.dat file.
  2. Take a look at the state_run1_check_escaped function.
    loc.go.obj  = "PLAYER_VIEWRB";
    loc.go.info = "info1";
    loc.res = GetObjInfo(loc.go);
    [!loc.res] return;

    We have added an info box 'info1' to the scene. This is a rigid body that does not collide and is not rendered. We can use it to check if we are out of the cell.
    When the player and the infobox intersect the GetObjInfo function returns true. So when this is the case we go to the RUN2 state.

Final note

We hope you like the tutorials and had fun creating this small story. If you have any questions about the tutorials or modding, feel free to ask them at:
admin (AT) xmoonproductions (DOT) org.