Coding the story

From XStoryPlayer Wiki
Jump to: navigation, search

Coding the story

<<Adding characters and basic code

Part 9

In this part we will add in our pizzabox

and give Saiko her storyline

First we need to add the model so in Maya create a box around the same size of a pizza box and call it "Pizzabox"

When you are happy with it duplicate it and call that "PizzaboxColl"

Then in the scene.ini

Add in

rb "PizzaboxShape"
{
  dynamic = true; // Object is dynamic
 
  render {}
 
  physics
  {
    density = 10; // 200 kg per cubic meter
    fc      = 0.1; // Low friction
 
    elem[0] {mesh = "PizzaboxCollShape";}
  }
    interact {} // Can open door by hand
	pick
  {
    usage_type = HAND;
 
    orient = (0,0,0);
  }
}


rb "PizzaboxShape"
{
  dynamic = true; // Object is dynamic 
 
  render {}
 
  physics
  {
    density = 10; // 10 kg per cubic meter
    fc      = 0.1; // Low friction, Might want to change this to a higher number but I left it as 0.1
 
    elem[0] {mesh = "PizzaboxCollShape";}
  }
    interact {} // Can open door by hand
	pick <--- When you click on it you hold it
  {
    usage_type = HAND; <--- When you click on it you hold it
 
    orient = (0,0,0); <---- When you pick it up it will snap to that orientation
  }
}

Next open the tutorial.dat

And add in

  dyn_objecti PIZZABOX
{
  pos = (6.024,0.196,1.228); // Position
 obj_name = "Pizzabox";
}
  dyn_objecti PIZZABOX
{
  //scene_id = TUTORIAL1; // We would need to add this if we referenced this outside of the scene dat
 
  pos = (6.024,0.196,-1.724); // Position use the xyz of the object inside of maya
 // rot = (0,0,0);  // Rotation
 obj_name = "Pizzabox";
 // file_name = "scenes/object/benchShape.obj"; // We can reference the object like this but since its already in the Maya file we will just use obj_name
}

Now save everything and run the filemaker

Go see your pizzabox

It's boring and untextured but that’s not my job

Next is we need to set up Saiko like we did with Monica

So place Saiko's waypoint like we did with Monica's facing the door entrance

Next open up Saiko's basic_ref

add in

TUTORIAL1:DOORBELL1.hit =
{
[state.dyn.me.do.state2 == NONE]
{
 state.dyn.me.do.state2 = START;
 }
}

If there is already a TUTORIAL1 line then just replace the whole thing


Now open Saiko's run0_state and we are going to use the same code from Monica

[NONE]
  {
  }
 
     [START]
  {
  talk.s = "Be there in a sec";
  do_set_timer(10);
  state.dyn.me.do.state2 = WALK_TO_DOOR;
  state.dyn.me.do.offended = WAITFOROFF;
  }

This will give us a 10 second timer just in case the player has rang Monica's doorbell so she will close her door and go dormant before Saiko opens her door

Next is to open the door

[WALK_TO_DOOR]
  {
 
    loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
 
    // Open door
		loc.so.obj = TUTORIAL1:DOOR1;
		loc.so.par = DOOR_SET_STATUS;
		loc.so.val = DOOR_SETVAL_STATUS_OPEN;	    
		SetObject(loc.so);
 
		// Let door be open from now on
		loc.so.status = loc.so.val;
	  SetObjState(loc.so);
 
		// Can see,hear from now on
		loc.state.can_see  = true;
    loc.state.can_hear = true;
    SetCharState(loc.state); 
		SetCanSee(true);
		SetCanHear(true);
 
		// I am in alerted state
		set_main_focus(STARE);
 
	  do_set_timer(3);
	  state.dyn.me.do.state2 = OPENING_DOOR;
 
  }

Once the door is open we need to add in some dialogue


 [OPENING_DOOR]
  {
    // Wait for door to open
 
    loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
 
		// If main not in view
		[!state.dyn.me.avatar.in_view] return;
 
 
		// Say hello
		talk.s     = "Hi, That was quick";//add what you want
		talk.delay = 500;
 
		do_set_timer(2);
 
		state.dyn.me.do.state2 = STANDING_IN_DOOR;
  }

And then more dialogue

[STANDING_IN_DOOR]
  {
    // Wait for door to open
 
    loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
 
		// If main not in view
		[!state.dyn.me.avatar.in_view] return;
 
				loc.be.obj    = PLAYER;
		loc.be.id     = state.this;
		loc.be.action = "firstsee";
		SendBaseEvent(loc.be);
		// Say hello
		talk.s     = "Anyway come in and put the pizza on the bench";
		talk.dur = 2000;
		talk.rem.s = "And i will go get the money";
 
 
		do_set_timer(2);
 
		state.dyn.me.do.state2 = OPENDOOR;
  }

Open up the players base_ref and add in




	SAIKO.firstsee =
{
 
 
    feedback.s         = "Damn she is cute.";
    feedback.delay     = 1000;
		feedback.dur       = 6000;
		feedback.rem.s     = "mmmmmm"; 
		feedback.rem.delay = 2000;
		feedback.rem.dur   = 8000;
}

This will add in a feedback to the top left corner when Saiko opens the door

This will be the only one i add in but its easy just add in the event to any innercase you want to have feedback for

				loc.be.obj    = PLAYER;
		loc.be.id     = state.this;
		loc.be.action = "firstsee";
		SendBaseEvent(loc.be);

Then reference it in the players base_ref using the npc's name and the action

Before we continue we need to make another waypoint for Saiko

So special duplicate Saiko's spawn waypoint and call it “SaikoStand” and make sure the 2nd box is “waypointShape”

Then position it somewhere as if Saiko is waiting for you to put the pizza on the bench

Then we can add in the next part

[OPENDOOR]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
 
		// Slam Door
		loc.so.obj = TUTORIAL1:DOOR1;
		loc.so.par = DOOR_SET_Q;
		loc.so.val = 0;
		SetObject(loc.so);
 
		loc.so.par = DOOR_SET_QMIN;
    loc.so.val = -360;  
		SetObject(loc.so);
 
		loc.so.par = DOOR_SET_QMAX;
		loc.so.val = 360;  
		SetObject(loc.so);
 
		loc.so.par = DOOR_SET_QSPRING;
		loc.so.val = 0.1;
		SetObject(loc.so);
 
		// Let door be closed from now on
		loc.so.door_state_q       =  0;
	  loc.so.door_state_qmin    = -360;
	  loc.so.door_state_qmax    =  360;
	  loc.so.door_state_qspring =  0.1;
	  SetObjState(loc.so);
 
	  loc.state.pose_type = STAND;
    loc.state.waypoint = "SaikoStand";
		loc.state.exact = 0;
		SetPose(loc.state);
 
		state.dyn.me.do.state2 = WAITFORPIZZA;
  }

This will open the door so the player can go through it and also move Saiko out of the way while we put the pizza on the bench

Now to do that we need to know when the pizza is on the bench so we need to make a zone

in Maya create a box the same size as the kitchen bench but a bit taller and sunk a bit into the bench

and call it "PizzaArea"


ESKZone.png


Next in the scene.ini add in

  rb "PizzaAreaShape"
{
  info {}
}

This makes that box an information area

Now we can check to see if the pizza is inside of the area

Back in Saiko's base_ref add

[WAITFORPIZZA]
	{
 
res = false;
[state.dyn.me.pose.result == NONE] return;
// Check if pizza on bench
loc.go.obj  = "TUTORIAL1:PIZZABOX";
loc.go.info = "PizzaArea";
loc.res = GetObjInfo(loc.go);
[!loc.res] return;
 
talk.s = "the pizza has landed";
 
 
		state.dyn.me.do.state2 = GETMONEY;
	}

When the pizza is on the bench it will continue to the next innercase but only if the npc is not moving so we don’t skip ahead

Save everything then run the filemaker and test it out

ring the doorbell then put the pizza on the bench

But we will leave that there for a moment and add in some other code for when Saiko is offended

Now we come to a bit of a problem which we will see in a second

Add this in under the last one making sure the brackets{} are correct

[OFFENDED]
	{
 	  loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return; 
 
 
				loc.be.obj    = PLAYER;
		loc.be.id     = state.this;
		loc.be.action = "offended";
		SendBaseEvent(loc.be);
		state.dyn.me.do.state2 = END;
		state.dyn.me.do.offended = END;
	}
  }
 case (state.dyn.me.do.offended)
{
 [WAITFOROFF]
  {
  [grel.offended != NONE]
{
	do_set_timer(1);
      state.dyn.me.do.state2 = OFFENDED;
	  state.dyn.me.do.offended = OFFENDED;
	  }
	  return; 
	}
 }

This will make Saiko send an event to the player which we can make the player respond to in their run and ref

Now open up the players base_ref

pack_tutorial\init\stories\tutorial\mains\player\brain\code\ref

And add

SAIKO.offended =
	{
			loc.pw.s  = "You offended Saiko and she kicked you out";
		loc.pw.id = 0;
		ShowPopupWnd(loc.pw);
 
		// Cannot move
		loc.state.allow_city = false;
		loc.state.can_move   = false;
		loc.state.can_rotate = false;
		SetMainState(loc.state);
 
		// Save non-moving state
		SetCanMove(false);
		SetCanRotate(false);
	}

Now save everything then run the game and press the doorbell and straight away press p to pull out the penis and offend Saiko the second she opens the door

This works well and she gets offended and locks the player

Restart the game and try pressing p when she is moving away

See the problem

She does not send the event to the player which means they are not locked and the placing the pizza still works but the moment you do that she remembers that she was offended and sends the event


Also running into the npc while moving will break them as well

So lets add the code that will let saiko be offended while still moving


In[OPENDOOR]

Replace the line

state.dyn.me.do.state2 = WAITFORPIZZA;

With

state.dyn.me.do.upto = WAITFORPIZZA;
state.dyn.me.do.state2 = PREOFFENDEDCHECK;

Then add

	[PREOFFENDEDCHECK]
	{
	[state.dyn.me.pose.result == NONE] return;
 
	  [grel.offended != NONE]
	  {
		state.dyn.me.do.state2 = OFFENDED;
		do_set_timer(1);
		}
		else
		{
		do_set_timer(2);
		state.dyn.me.do.state2 = state.dyn.me.do.upto;
		}
	}

This is saying after she’s finish walking check to make sure she is not offended

If she is not offended go to whatever up to state is in this case its [WAITFORPIZZA]


Now save everything and try again pressing p while she is walking

When she stops or get interrupted she will trigger the event

But if she is not offended she will continue like usual

Next we need Saiko to go into the bedroom so in Maya add a new waypoint called "SaikoStandBedroom" and place it in the bedroom

Save the Maya scene

Then add in




	    [GETMONEY]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
			[state.dyn.me.pose.result == NONE] return;
		talk.s = "ok i will go get the money, wait here";
	  loc.state.pose_type = STAND;
    loc.state.waypoint = "SaikoStandBedroom";
		loc.state.exact = 0;
		SetPose(loc.state);
 
state.dyn.me.do.upto = RETURNNOMONEY;
 
state.dyn.me.do.state2 = PREOFFENDEDCHECK;
  }

This will make Saiko walk into the bedroom

And add

[RETURNNOMONEY]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
			[state.dyn.me.pose.result == NONE] return;
		talk.s = "I dont have enough money";
		talk.rem.s = "would you accept something else?";
	  loc.state.pose_type = STAND;
    loc.state.waypoint = "SaikoStand";
		loc.state.exact = 0;
		SetPose(loc.state);
 
state.dyn.me.do.upto = WAITFORANSWER;
 
state.dyn.me.do.state2 = PREOFFENDEDCHECK;
 
  }

This will make Saiko walk back out saying she has no money to pay

And one more

   [WAITFORANSWER]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
			[state.dyn.me.pose.result == NONE] return;
		talk.s = "Something sexual perhaps?";
 
state.dyn.me.do.state2 = WAITFORANSWER1;
  }

WAITFORANSWER1 is now our waiting stage which we will reference now

Save everything and run the filemaker

Follow the story until she asks "Something sexual perhaps?"

then say

"yes"

"no"

And check the trace file

basic.yes.answer

basic.no.answer

we will use these 2

Open up Saiko's run0_ref.dat

and add

basic.yes.answer =
				{
[state.dyn.me.do.state2 == WAITFORANSWER1]
				      state.dyn.me.do.state2 = SAIDYES;
				}
 
				basic.no.answer =
				{
[state.dyn.me.do.state2 == WAITFORANSWER1]
				      state.dyn.me.do.state2 = SAIDNO;
				}

Now we need another waypoint called "SaikoDance" and place that infront of the couch near the outside door

Save and run the filemaker

Now we need to add to Saiko's run0_state

[SAIDYES]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
			[state.dyn.me.pose.result == NONE] return;
		talk.s = "Thats good, Come sit on the couch";
	  loc.state.pose_type = STAND;
    loc.state.waypoint = "SaikoDance";
		loc.state.exact = 0;
		SetPose(loc.state);
	 do_set_timer(2);
	 state.dyn.player.relation.sex = ALLOWED;
			state.dyn.me.do.state2 = SAIKODANCEWAIT;
 
 
  }
  [SAIDNO]
	{
 	  loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return; 
 
			talk.s = "Fine leave then and take your stupid pizza with you";
		//talk.s = "offended";
				loc.be.obj    = PLAYER;
		loc.be.id     = state.this;
		loc.be.action = "no";
		SendBaseEvent(loc.be);
		state.dyn.me.do.state2 = END;
		state.dyn.me.do.offended = END;
	}

If the player says yes then we run SAIDYES

state.dyn.player.relation.sex = ALLOWED; Means we cant offend her any more no matter what we do in the advanced tutorial i will be adding in a lot more options instead of can and cant be offended


And if the player says no then we run SAIDNO

Open the players base_ref and add

	SAIKO.no =
	{
			loc.pw.s  = "You did not accept Saiko's offer";
		loc.pw.id = 0;
		ShowPopupWnd(loc.pw);
 
		// Cannot move
		loc.state.allow_city = false;
		loc.state.can_move   = false;
		loc.state.can_rotate = false;
		SetMainState(loc.state);
 
		// Save non-moving state
		SetCanMove(false);
		SetCanRotate(false);
	}

Save everything run the filemaker and check it ingame

Try both answers out

Now we need to get Saiko dancing when the player is ready


back in Saiko's run0_state add


  	[SAIKODANCEWAIT]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
			[state.dyn.me.pose.result == NONE] return;
		talk.s = "Tell me when to start dancing";
 
 
			state.dyn.me.do.state2 = SAIKODANCEWAIT1;
 
 
  }

Save everything then run the game and when Saiko can hear say

"dance"

"start dancing"


dance.you.get

start.you.get

go.you.get

Open Saiko's run0_ref

And add

dance.you.get =
{
[state.dyn.me.do.state2 == SAIKODANCEWAIT1]
				      state.dyn.me.do.state2 = STARTSAIKODANCE;
				}
				go.you.get = dance.you.get;
				start.you.get = dance.you.get;
 
we can also add
 
					 [state.dyn.me.do.state2 == SAIKODANCEWAIT1]
				      state.dyn.me.do.state2 = STARTSAIKODANCE;

To yes.answer so the player can say yes as well

Now that we can tell her to dance we need her to actually dance

Back to saikos run0_state add in

[STARTSAIKODANCE]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
			[state.dyn.me.pose.result == NONE] return;
		talk.s = "Ok enjoy the show";
	  loc.state.pose_type = DANCE;
    loc.state.waypoint = "SaikoDance";
		loc.state.exact = 0;
		SetPose(loc.state);
	 do_set_timer(40);
			state.dyn.me.do.state2 = SAIKODANCE1;
  }

This will make Saiko start dancing for 40 seconds and do a 360 then stop


    [SAIKODANCE1]
  {
  loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return; 
 
		talk.s = "How about you take this dress off";
	  loc.state.pose_type = STAND;
    loc.state.waypoint = "SaikoDance";
		loc.state.exact = 0;
		SetPose(loc.state);
 do_set_timer(2);
			state.dyn.me.do.state2 = SAIKODANCEDRESS;  
  }

This will make Saiko stand after 40 seconds and ask the player to take her dress off

  [SAIKODANCEDRESS]
  {
     loc.ts = GetTs();  
    [loc.ts < state.dyn.me.do.ts] return;
 
loc.cs.item = 0;  
loc.cs.y    = GetClothState(loc.cs);
[loc.cs.y < 1]
{
		talk.s = "Thats better now go sit back down";
 
 do_set_timer(6);
 
			state.dyn.me.do.state2 = SAIKODANCEDRESS1;
			}
  }


This says when the item which is found in her init 0 = dress 1 = bra 2 = panties

So when dress is down tell the player to sit back down and start dancing again




 [SAIKODANCEDRESS1]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
		talk.s = "Keep watching";
	  loc.state.pose_type = DANCE;
    loc.state.waypoint = "SaikoDance";
		loc.state.exact = 0;
		SetPose(loc.state);
	 do_set_timer(40);
			state.dyn.me.do.state2 = SAIKODANCE2;
  }

Start dancing for another 40 sec

 [SAIKODANCE2]
  {
  loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return; 
 
		talk.s = "Now take my bra off, Do the zipper first";
	  loc.state.pose_type = STAND;
    loc.state.waypoint = "SaikoDance";
		loc.state.exact = 0;
		SetPose(loc.state);
 do_set_timer(2);
 
			state.dyn.me.do.state2 = SAIKODANCEBRA;
 
 
  }

Tell the player to take off her bra

[SAIKODANCEBRA]
  {
     loc.ts = GetTs();  
    [loc.ts < state.dyn.me.do.ts] return;
loc.cs.item = 1;  
loc.cs.y    = GetClothState(loc.cs);
[loc.cs.y < 1]
{
		talk.s = "Thats better now go sit back down";
 
 do_set_timer(6);
 
			state.dyn.me.do.state2 = SAIKODANCEBRA1;
			}
  }

After the bra is off tell the player to sit down and start dancing again

 [SAIKODANCEBRA1]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
		talk.s = "Keep watching";
	  loc.state.pose_type = DANCE;
    loc.state.waypoint = "SaikoDance";
		loc.state.exact = 0;
		SetPose(loc.state);
	 do_set_timer(40);
			state.dyn.me.do.state2 = SAIKODANCE3;
  }


after 40 seconds tell the player to take off her panties

  [SAIKODANCE3]
  {
  loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return; 
 
		talk.s = "Now take my panties off";
	  loc.state.pose_type = STAND;
    loc.state.waypoint = "SaikoDance";
		loc.state.exact = 0;
		SetPose(loc.state);
 do_set_timer(2);
 
			state.dyn.me.do.state2 = SAIKODANCEPANTIES;
 
 
  }


And then take off her panties

 [SAIKODANCEPANTIES]
  {
     loc.ts = GetTs();  
    [loc.ts < state.dyn.me.do.ts] return;
loc.cs.item = 2;  
loc.cs.y    = GetClothState(loc.cs);
[loc.cs.y < 1]
{
		talk.s = "Thats better now go sit back down";
 
 do_set_timer(6);
 
			state.dyn.me.do.state2 = SAIKODANCEPANTIES1;
			}
  }


Then do the final dance

[SAIKODANCEPANTIES1]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
		talk.s = "Keep watching";
	  loc.state.pose_type = DANCE;
    loc.state.waypoint = "SaikoDance";
		loc.state.exact = 0;
		SetPose(loc.state);
	 do_set_timer(40);
	state.dyn.me.do.state2 = SAIKOFOLLOW;
  }

After we have finished dancing we need to get Saiko into the bedroom again

So make another waypoint called "SaikoBlowjob"

And place it near the right side of the bed

Now i have to do this a little differently then what i would like to do because i'm not too sure how to use a custom bed at this point in time

EDIT i now know how to make other beds work and that will be in another tutorial

So delete the bed but don’t delete the collision box

just move that out of the scene

otherwise we have to change the names and numbers in the scene.ini

And by out of the scene i don’t mean up or down because its collision will still effect the area

Then make another waypoint called

"bed_wp"

And place it with the npc face away from the window

around 1m from the back wall

This will be where our new bed spawns

Make another waypoint called

"bed_wp1"

And place that right of the "bed_wp"

With the npc side facing away from the window

Then make another waypoint called

"dildo_wp"

And place it above the bed but more towards the house


ESKWaypoints.png


TopLeft dildo

Middleleft bed

Middleright bed1

Right blowjob

The blue faces are the npc faces

Next we need to open up

pack_tutorial\init\stories\tutorial\chars\saiko\brain\state stat.dat

And add at the bottom

game
{
 
  location
  {
    bed     = "bed_wp1";
  }
  }

This will tell the orgasm task that this is the waypoint to use then in the tutorial.dat we need to add



vibrator_objecti:VIBRATOR VIBRATORC1
	{
	  waypoint ="dildo_wp";
	}
 
 
		mat_objecti BEDC1
	{
	  file_name = "scenes/apartment3/bedShape.obj";
	  waypoint = "bed_wp";
	}

This will spawn in the vibrator we need and the bed

Now that that is all done we need to go back to Saiko's run0_state

And make her go to that waypoint after she has finished dancing and is naked

[SAIKOFOLLOW]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
		talk.s = "Enough teasing follow me";
	  loc.state.pose_type = STAND;
    loc.state.waypoint = "SaikoBlowjob";
		loc.state.exact = 0;
		SetPose(loc.state);
	 do_set_timer(3);
			state.dyn.me.do.state2 = SAIKOBLOWJOBSTART;
  }

Save everything and run the filemaker then test it out

After she is in position we need her to start her blowjob

 [SAIKOBLOWJOBSTART]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
					[state.dyn.me.pose.result == NONE] return;
		talk.s = "Give me your cock";
	 start_task_blowjob(EAGER);
 
 
	 do_set_timer(3);
 
	 		  state.dyn.me.do.ts2 = null;
		  state.dyn.me.task.blowjob.oob_count2 = 0;
			state.dyn.me.do.state2 = GIVING_BLOWJOB;
  }

Then we need to be able to control what happens

This code is taken from tentacle dreams Saiko's blowjob scene

I encourage you to look at how Xmoon have done things to figure stuff out


[GIVING_BLOWJOB]
  { 
    //state.dyn.me.task.blowjob.oob_count = 4;
 
    // If penis in mouth then reset timeout
    [state.dyn.me.coll.mouth_deep.obj_par != null]
    {
      do_set_timer(60);
    }
 
    // If we got a out of breath
    [state.dyn.me.task.blowjob.oob_count2 != state.dyn.me.task.blowjob.oob_count]
    {
      // Say something timer
      do_set_timer2(8);
 
      state.dyn.me.task.blowjob.oob_count2 = state.dyn.me.task.blowjob.oob_count;
    }
 
    // If say something
    loc.ts = GetTs();  
	  [loc.ts >= state.dyn.me.do.ts2]
	  {
	    loc.count = state.dyn.me.task.blowjob.oob_count2;
	    [loc.count > 4] loc.count = 4;
 
	    case(loc.count)
	    {
	      [1] loc.s = "ooh yes, please let me suck your penis again!";
	      [2] loc.s = "this is so good, do that again please...";
	      [3] loc.s = "I am starting to feel a lot better, please one more time...";
	      [4] loc.s = "My turn now";
	    }
	    task_blowjob_talk(loc.s);
 
 
 
      // We are finished
      [loc.count >= 4]
			{
			  // Stop blowjob task
			  stop_task_blowjob();
 
			  do_set_timer(4);
			  state.dyn.me.do.state2 = PRESAIKOLAYDOWN;
			  return;
      }
 
	    state.dyn.me.do.ts2 = null;
	    do_set_timer(20);
	  }
 
	  [loc.ts < state.dyn.me.do.ts] return;
 
    loc.v = Rnd(4);
	  case(loc.v)
	  {
	    [0] loc.s = "Put it in my mouth, it smells so good...";
	    [1] loc.s = "Please let me suck your penis";
	    [2] loc.s = "The smell is so nice, please put it in my mouth";
	    [3] loc.s = "Fill my mouth please...";
	  }
	  task_blowjob_talk(loc.s);
 
		do_set_timer(60);
  }

This says run one of the bottom comments every 60 seconds by passing the strings to the task_blowjob_talk inside of the blowjob task

Then after she gags add another number to oob count using += and oob2 = oob then do the corresponding text using the talk_blowjob_talk

and when we get to oob 4 then continue with our story by stopping the blowjob task and going to the next innercase


After she is done sucking we want her to lay on the bed

But first save and test it out

Now if you are sick of having to go through all of that just to test this little part then go way back up to [WAITFORPIZZA]

and add this in overriding the getmoney that is there

	 state.dyn.player.relation.sex = ALLOWED;
state.dyn.me.do.state2 = SAIKOFOLLOW;
	//	state.dyn.me.do.state2 = GETMONEY;

This will allow you to skip the whole undress part Just remember to uncomment the getmoney and comment the allowed and saikofollow when you are finished testing

you can also skip part of the blowjob by changing

// We are finished
      [loc.count >= 4]

to

[loc.count >= 1]

Just remember to put it back

All these things make it easier to test without break our entire story just to do it or sitting there for 5 minutes to test one part


Now we need to change Saiko's orientation because she will walk backwards until she finds the bed and right now she will just walk into the wall


[PRESAIKOLAYDOWN]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
	  loc.state.pose_type = STAND;
    loc.state.waypoint = "bed_wp1";
		loc.state.exact = 0;
		SetPose(loc.state);
	 do_set_timer(3);
			state.dyn.me.do.state2 = SAIKOLAYDOWN;
  }

Now that she is facing the right direction we need her to start laying down


[SAIKOLAYDOWN]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
					[state.dyn.me.pose.result == NONE] return;
		talk.s = "Me now";
		state.dyn.me.do.tool = 2;
		state.dyn.me.do.org = WAITFORORGASM;
	  start_task_orgasm(EAGER);
 
 
		state.dyn.me.do.state2 = END;
  }

The tool and org are both referenced inside of the task_orgasm

Tool refers to the object Saiko wants

2 is vibrator and 1 is cock

And the org is what state we want to have start when this task finishes

then we go to state2 END because we don’t need any state2's running while We have our task_orgasm running

We are using EAGER so we can customise the responses

[WAITFORORGASM]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
					[state.dyn.me.pose.result == NONE] return;
		talk.s = "Oh wow";
	  stop_task_orgasm(EAGER);
	   loc.state.pose_type = SIT;
	   do_set_timer(6);
 
 
		state.dyn.me.do.state2 = SAIKOLAYDOWN2;
  }

After we finish the orgasm task we want Saiko to stop her orgasm task and sit up so we can start it again


[SAIKOLAYDOWN2]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
					[state.dyn.me.pose.result == NONE] return;
		talk.s = "I think its your turn again";
		state.dyn.me.do.tool = 1;
		state.dyn.me.do.org = WAITFORORGASM2;
	  start_task_orgasm(NEUTRAL);
 
 
		state.dyn.me.do.state2 = END;
  }

Then we swap the vibrator for cock and the ending location

As well as use NEUTRAL for the mood so i can customise the responses

[WAITFORORGASM2]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
					[state.dyn.me.pose.result == NONE] return;
		talk.s = "That was wonderful";
	  stop_task_orgasm(EAGER);
	   loc.state.pose_type = SIT;
	   do_set_timer(3);
 
 
		state.dyn.me.do.state2 = ENDOSTORY;
  }

After we finish this time we want to go to ENDOSTORY because we are finished with this tutorial

[ENDOSTORY]
  {
 loc.ts = GetTs();  
		[loc.ts < state.dyn.me.do.ts] return;
					[state.dyn.me.pose.result == NONE] return;
				loc.be.obj    = PLAYER;
		loc.be.id     = state.this;
		loc.be.action = "end";
		SendBaseEvent(loc.be);
 
	   do_set_timer(3);
 
 
		state.dyn.me.do.state2 = END;
  }

Now we need to add in the final player event

Open up the players base_ref and add in

SAIKO.end =
	{
			loc.pw.s  = "Congrats you fucked Saiko and completed the basic tutorial";
		loc.pw.id = 0;
		ShowPopupWnd(loc.pw);
 
		// Cannot move
		loc.state.allow_city = false;
		loc.state.can_move   = false;
		loc.state.can_rotate = false;
		SetMainState(loc.state);
 
		// Save non-moving state
		SetCanMove(false);
		SetCanRotate(false);
	}

I did change the base task_orgasm file so you will have to replace that now pack_tutorial\init\std\base\char\brain\code\task

And replace

task_orgasm

With the one in the Part9 folder

The changes I made was added the vagina area to the rub clit area

so both now work

Changed a bit of dialogue

And added in those references to make the first time use the vibrator and the second the cock

Save everything and run the filemaker to be sure then go test it out make sure you uncomment those skiplines

If you missed anything all the files are in the FINAL folder


Then feel free to mess around with it

Add in different dialogue and more feedbacks

Have fun with it

The best way to learn is to tinker with the files


I'm going to cover how to add in other sex positions

But i will go into this more in another tutorial

There are a few that we can use and they are located in


pack_tutorial\init\std\base\char\brain\code\task

task_backass Is them standing up leaning over

task_backvag Is them standing up leaning over

task_blowjob Is them kneeling

task_machine Is them in doggy

task_orgasm Is them laying down on their backs

task_pole Is them going up and down on the pole

task_stocks Is them in the stocks

There are a few more in the dungeon folder


Now backass, backvag and blowjob do not require props and can be added whenever and they will simply do that task wherever they are currently standing

The best way to get them to do those tasks is to have them activated by the player speech by adding


me.fuck.you.get me.blowjob.you.get me.anal.you.get

In their refs

Then making in the run

[vag]

start_task_backvag(); //we can add the mood inside the () if we want

[anal]

start_task_backass();

[blowjob]

start_task_blowjob();


With stand.you.get

[stand]

if [vag] stop_task_backvag();

if [anal]

stop_task_backass();

if [blowjob]

stop_task_blowjob();

To stop their actions

Or add them in as part of a storyline like we just did



The others like

task_machine

task_orgasm

task_pole

task_stocks

Require props to work

Machine requires the fuck machine

Orgasm requires a bed and must walk backwards until they find it

Pole requires the pole

Stocks requires a stocks


All these objects can be found in

init\std\base\object\sex init.dat

Then all we have to do is reference them into our scene and add the correct waypoints

You can find the waypoint names and locations by running a scene with the object in it then pressing ctrl + d to see the waypoint names and where they are

We can reference them in our scene.dat

sex_objecti:BLACK_DILDO BLACK_DILDOC1 <--- name of the object in the object init file then the name we want to give it
	{
	  waypoint = "ontable1_wp7"; <--- where it will spawn
	}

This is the same for the machine and beds we just need to change the object type which is located in the object init.dat


then we can change some important stuff in the charaters

dungeon\chars\saiko\brain\state state.dat

to align the machine and set the waypoints

game
{
  cloth_pose
  {
    dress_item = 0;
    pants_item = 2;
 
    dress_down = 0.2;
 
    pants_up   = 0.94;
    pants_down = 0.72;
 
    pants_max = 0.85;
    pants_min = 0.85;
  }
 
  machine_pose
  {
    object = MACHINE1;
 
    pole_height  = 0.06;  
    pole_angle   = 0.15;  
    pole_slide   = 0.53;  
 
    pole_height2 = 0.46;  
    pole_angle2  = 0.38; 
    pole_slide2  = 0.64;  
  }
 
  stocks_pose
  {
    object = DUNGEON1:STOCKS1;
  }
 
  dance_pose
  {
    object = DUNGEON1:PSCREEN1;
  }
 
  location
  {
    bed     = "bed_wp1";
    toilet  = "toilet_wp1";
    dildo   = "dildo_wp1";
    machine = "machine_wp1";
    dance   = "dance_wp1";
    stocks  = "stocks_wp1";
  }
}

Monica will have different aligns but the same waypoints

This is the basics of adding in the other sex tasks and their objects



The advanced tutorial will cover a lot more like


Adding in each touch point and making each of them respond when needed

Editing the sex tasks to have dialogue at different points and be dynamic

when the player cums with custom responses at each stage and cum location

Will make a septate clothing tutorial at some point

Making multiple scenes interchangeable

And a few more but ill leave them as a surprise

These tutorials will have very little pictures and will consist of some insanely complex code with tonnes of references


With all that out of the way you should now be able to make some basic scenes from scratch

GOODLUCK