Tutorial for adding animation commands

From XStoryPlayer Wiki
Revision as of 03:48, 12 January 2016 by Eskarn (Talk | contribs) (Created page with "'''Eskarn's tutorial for adding animation commands''' Part 2 of Tutorial for adding Animations This is the adding animations part 2 make sure you have finished part 1 fi...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Eskarn's tutorial for adding animation commands

Part 2 of Tutorial for adding Animations

This is the adding animations part 2 make sure you have finished part 1 first

Ok so we have our new pose but its overriding the jiggle what if we want to make a new pose

Well this largely depends on what mode we are doing either story or dungeon

Now if you know your way around this code then you may not need this next tutorial If you don't know your way around the code then check out this tutorial

Tutorial for code structure

You may need to rename the animation in the char_base file refer to part one Tutorial for adding Animations

STORY The code required also depends on the type of animation you are using

For basic single frame poses

case (state.dyn.me.do.state2)
{
	[DOANIMATION]
	{   	
		loc.state.pose_type = YOURANIMATION;
		SetPose(loc.state);	
		state.dyn.me.do.state2 = NEXT;
		do_set_timer(5);
	} 
	[NEXT]
	{
 
	}
 
}

For multi frame animations ill update this when someone asks and it depends alot on what animations is being used and what parameters it will need

That's really about it for story's just add your animation to the frame you want


DUENGONS Again depends on what type of animation used

For basic poses

We are going to use the jiggle file because its the best to use for a single frame pose

HERE COMES THE FUN PART

The way the dungeon is structured is modular-ish

(and you will see why we just said replace at first)

Navigate to pack_dungeon\init\std\template\char\brain\code

Open run.dat

In this file we see all the tasks and when we say a command it will run that task

The importance of this file is that it keeps running the task file every tick with out it it would only run it once to timers would not work etc


So im guessing you have a name picked out for your animation i don't so im gonna call mine "upsidedown"


Copy the [JIGGLE0] jiggle0_state(); go down 1 line and paste it then rename it to your animation


Esk AnimTut2 run.jpg



Now that that's done go to ref.dat


Looks similar right so do the same here copy the jiggle and rename it


Esk AnimTut2 ref.jpg


pack_dungeon\init\std\template\char\brain\code\ref

find jiggle0_ref.dat and copy it and rename it

"upsidedown0_ref.dat"

then open the renamed one




All this code is saying is when the player says stop then stand up and reset the pose but that's handled in another file


So we will leave this alone


pack_dungeon\init\std\template\char\brain\code\run


find jiggle0_state.dat and copy it and rename it


"upsidedown0_state.dat"


Then open the renamed one


This code is the same as jiggle and may still have the TEST animation in there or what ever you called the one in the char_base if not replace JIGGLE with your animation


Now we need to reference that file to

open

pack_dungeon\init\std\template\char\brain\code\run

state.dat

Find jiggle and copy and rename it #include "init/std/template/char/brain/code/run/upsidedown0_state.dat"

So many references but do it enough and its easy

Almost done now we need to get the words to make them do the action

In the settings.ini in the main folder

runtime
{
start_mode = FAST;
 
debug_sys = BASIC;//
debug_render = NONE;
debug_phys = NONE;
debug_brain = ENABLED;//this will write the words they hear to the trace file
 
save_key = "";
}

Run the dungeon scene

You got an error

Esk AnimTut2 error2.jpg


We get <jiggle0_state> already declared


This is because its already declared in the jiggle0_state.dat


We still have <jiggle0_state> and </jiggle0_state> at the top and bottom in our upsidedown0_state.dat


So change that to <upsidedown0_state> </upsidedown0_state> or whatever yours is called


We can also get

<upsidedown0_state> does not exist, in file 'init/story/duengon/init_saiko.dat' at line 9


If we open that file there's not much there but its a chain of references all the way down to upsidedown0_state.dat the main thing that gives it away is <upsidedown0_state>

This happens when we forget a reference


After changing the <jiggle0_state> and </jiggle0_state> re run the duengon


In my case im going to say "come here" "upside down" "flip" "handstand"


Then exit the game F9 and check the trace file in the main folder


Now for me i only get a response from "come here"


10:15:34 BRAIN: "state.code.ref.state.RUN0.come.you.set"


This is because saiko does not know any of the other words and we need to add them to the npl


I will not be covering the NPL in this tutorial instead have a look at this one for that

Tutorial for NLP

But if you just want to finish this tutorial we will just use "lost my cat" so go back into the dungeon and say "lost my cat" then exit F9


Open the trace file and look for "state.code.ref.basic.lose.word"


Now this is where it gets tricky



These will trigger in order and there is a response file that will use activity.get so if we were to use

basic.lose.get word then the activity.get would override it and she will say something instead of doing the action


10:32:55 BRAIN: "state.code.ref.state.RUN0.lose.word"

10:32:55 BRAIN: "state.code.ref.state.RUN0.lose.if"

10:32:55 BRAIN: "state.code.ref.state.RUN0.lose.get"

10:32:55 BRAIN: "state.code.ref.state.RUN0.activity.word"

10:32:55 BRAIN: "state.code.ref.state.RUN0.activity.if"

10:32:55 BRAIN: "state.code.ref.state.RUN0.activity.get"

10:32:55 BRAIN: "state.code.ref.state.RUN0.word.get"

10:32:55 BRAIN: "state.code.ref.basic.lose.word"

10:32:55 BRAIN: "state.code.ref.basic.lose.if"

10:32:55 BRAIN: "state.code.ref.basic.lose.get"

10:32:55 BRAIN: "state.code.ref.basic.activity.word"

10:32:55 BRAIN: "state.code.ref.basic.activity.if"

10:32:55 BRAIN: "state.code.ref.basic.activity.get"

Now we need to open pack_dungeon\init\std\template\char\brain\code\ref basic_ref_command.dat

This is where all the commands are handled

Look for jiggle

tit.jiggle.you.set = //this is the main words or translated player has said jiggle 
{
  loc.state = JIGGLE0;//this is the run.dat jiggle that we copied
  loc.level = 1;
  loc.res = react_start_command(loc);
  [!loc.res] return;
 
  loc.ss.state  = JIGGLE0;//this is the run.dat jiggle that we copied
	loc.ss.state2 = START1;//jiggle's first case is [START1} so run that
	loc.ss.state3 = NONE;
 
	set_state(loc.ss);//set all the above
}
tit.bounce.you.set = tit.jiggle.you.set;//if any of these are said make them run tit.jiggle.you.set
jiggle.you.set     = tit.jiggle.you.set;//
bounce.you.set     = tit.jiggle.you.set;//
tit.jiggle.you.if  = tit.jiggle.you.set;//
tit.bounce.you.if  = tit.jiggle.you.set;//
jiggle.you.if      = tit.jiggle.you.set;//
bounce.you.if      = tit.jiggle.you.set;//



So copy just this part and paste it above you.orgasm.me.set =

tit.jiggle.you.set = 
{
  loc.state = JIGGLE0;
  loc.level = 1;
  loc.res = react_start_command(loc);
  [!loc.res] return;
 
  loc.ss.state  = JIGGLE0;
	loc.ss.state2 = START1;
	loc.ss.state3 = NONE;
 
	set_state(loc.ss);
}

Then rename it mine would be

lose.word = 
{
  loc.state = UPSIDEDOWN0;
  loc.level = 1;
  loc.res = react_start_command(loc);
  [!loc.res] return;
 
  loc.ss.state  = UPSIDEDOWN0;
	loc.ss.state2 = START1;
	loc.ss.state3 = NONE;
 
	set_state(loc.ss);
}

Esk AnimTut2 command.jpg


Run the dungeon and say "lost my cat"

That's now you add in a new basic one frame pose if you want to do a whole new sex task... just ask i guess


Again if i missed anything or something is incorrect please let me know