Jump to content

Home

"Sleeping" PC and changed camera?


Recommended Posts

I'm making a custom module, using the Ebon Hawk. The player spawns near a bed, in "Kreia's room".

I have a script that fires OnEnter, which starts a conversation with an NPC that is standing next to the PC.

 

I want the PC to "sleep" on one of the beds(sort of like the prologue "you lie in the medical bay, blah blah")... and for the dialogue, I want the camera to point at the PC the whole time(making it look like you're having a conversation with yourself :p).

 

 

Help would be appreciated. :)

Link to comment
Share on other sites

I don't quite follow you.

 

You say player spawns "near the bed" and then you say PC is supposed to sleep on the bunk. I assume PC and player are the same thing, not? Could you clarify?

 

Actually, I think this may be pretty tough to pull off, depending on some aspects. Is this module a replacement for tutorial (the one you get into after creating a character), or is this just a module which you can enter at some point, later in the game?

Link to comment
Share on other sites

Originally posted by Xcom

I don't quite follow you.

 

You say player spawns "near the bed" and then you say PC is supposed to sleep on the bunk. I assume PC and player are the same thing, not? Could you clarify?

 

Actually, I think this may be pretty tough to pull off, depending on some aspects. Is this module a replacement for tutorial (the one you get into after creating a character), or is this just a module which you can enter at some point, later in the game?

The PC spawns near the bed. ;)

 

The module is supposed to be separate from the main TSL story, so I'm currently trying to modify the prologue so that the player can pick either TSL or "mymod". :)

 

What I want:

PC lying on bed, dialogue comes up with the camera on the PC. You pick an option, and the PC "wakes up". Actual "wake up" animations might not be necessary... maybe it can be "camouflaged" with some fades?

Link to comment
Share on other sites

Originally posted by TemporaryTomato

PC lying on bed, dialogue comes up with the camera on the PC. You pick an option, and the PC "wakes up". Actual "wake up" animations might not be necessary... maybe it can be "camouflaged" with some fades?

 

Well, your conversation must originate from some NPC. I am guessing you have OnEnter script that looks something like this:

// onEnter
void main()
{
object oPC = GetEnteringObject();
if (GetIsPC(oPC))
{
	object oNPC = GetObjectByTag("some_npc");
	AssignCommand(oNPC, ActionStartConversation(oPC, "some_dialog");
}
}

 

This is just an example. I think you might also want to implement some conditional checks in order not to fire the cinematic every time you enter the area.

Anyway, next you can try attaching script like this to the 1st entry in the dialog:

 

// fired from first Entry in some_dialog.dlg
void main()
{
ActionPauseConversation();
SetGlobalFadeOut();	// fade to black

object oPC = GetFirstPC();

/*

	float x = x coordinate
	float y = y coordinate
	float z = z coordintae
	float r = orientation
	// coordinates of the bed
	// you need to obtain these.. somehow
	// just insert actual numbers below
*/ 
location lBed = Location(Vector(x,y,z), r);

AssignCommnad(oPC, ClearAllActions());
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_SLEEP, 1.0, -1.0);
DelayCommand(0.2, AssignCommand(oPC, JumpToLocation(lBed)));
DelayCommand(0.5, SetGlobalFadeIn(0.0,1.0)); //clear view
DelayCommand(1.5, ActionResumeConversation());

}

 

Big problem is that I have no idea if this will work at all. :D but if I were you, I would start with something like this. Make sure, however, that NPC is standing close to the bed where PC (hopefully) will be lying.

 

This thread contains some links and useful info regarding using of cameras.

http://www.lucasforums.com/showthread.php?s=&threadid=145924

Link to comment
Share on other sites

Originally posted by Xcom

I think you might also want to implement some conditional checks in order not to fire the cinematic every time you enter the area.

That wont be necessary, the module will only be used once. :)

Anyway, next you can try attaching script like this to the 1st entry in the dialog:

 

code

 

Big problem is that I have no idea if this will work at all. :D but if I were you, I would start with something like this. Make sure, however, that NPC is standing close to the bed where PC (hopefully) will be lying.

Hehehe... that was pretty funny. The PC slept... standing up. :D

 

This thread contains some links and useful info regarding using of cameras.

http://www.lucasforums.com/showthread.php?s=&threadid=145924

Hmm... I placed an invisible placeable and set it as the speaker. Seems to work ingame. :cool:

Link to comment
Share on other sites

I think a meditation animation would work(like in the apartment on Telos), and since it's a bit easier to get coordinates for, I'm going with that instead.

Looking through animations.2da, I found "Meditate_Loop" at row 24... sounds like a good place to start. However, the

AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_SLEEP, 1.0, -1.0));

thingy doesn't like me changing the animation(tried row number, name, and description)... so I decided to look through the source scripts for something else. I found this:

//  a_play_anim
/*
   Make an object play an animation
   sTag    - The tag of the object to play the animation (default is GetFirstPC()
             You can pass "OBJECT_SELF" as a string to get the caller of the script)
   iAnim   - The number of the animation (see Animations.2da)
   iSpeed  - The speed of the animation (default 1.0)
   iLength - The duration of the animation (default 0.0, if -1.0 it will loop)
   iDelay  - Delay in seconds before animation begins
   iAction - 0 = PlayAnimation
             1 = ActionPlayAnimation
*/
//  Created By:  Tony Evans 10/7/04

void main()
{
   string sTag = GetScriptStringParameter();
   int iAnim = GetScriptParameter(1);
   int iSpeed = GetScriptParameter(2);
   int iLength = GetScriptParameter(3);
   int iDelay = GetScriptParameter(4);
   int iAction = GetScriptParameter(5);

   object oTarg;

   if (sTag == "") oTarg = GetFirstPC();
   else if (sTag == "OBJECT_SELF") oTarg = OBJECT_SELF;
   else oTarg = GetObjectByTag(sTag);

   if (iSpeed == 0) iSpeed = 1;

   DelayCommand( IntToFloat(iDelay), AssignCommand(oTarg, PlayAnimation
       (10000 + iAnim, IntToFloat(iSpeed), IntToFloat(iLength))));
}

There's a problem with this, however...

Since I just started scripting, my "script understanding" isn't very good(I'm a scripting noob, basically). I can't figure out where the actual iSomething numbers are supposed to be(where to change the animation row number, for example). :o

GetScriptParameter... where is the script parameter? Or, more importantly, what IS a script parameter?:guybrush:

I tried googling and searching nwscript.nss...

From nwscript.nss

 

// DJS-OEI

// 768. GetScriptParameter

// This function will take the index of a script parameter

// and return the value associated with it. The index

// of the first parameter is 1.

int GetScriptParameter( int nIndex );

but I still can't figure it out. :rolleyes:

Link to comment
Share on other sites

Originally posted by TemporaryTomato

There's a problem with this, however...

Since I just started scripting, my "script understanding" isn't very good(I'm a scripting noob, basically). I can't figure out where the actual iSomething numbers are supposed to be(where to change the animation row number, for example). :o

GetScriptParameter... where is the script parameter? Or, more importantly, what IS a script parameter?:guybrush:

 

Script parameters are values passed to a script from a dialog file. Scripts using such parameters are run from dialog files either as action scripts or conditional scripts.

 

If you use the DLG Editor, there are fields called "Conditional #" (where you assign the script that determines if a dialog node is available) and "Script #" (where you assign the script the dialog node should run).

 

To the right of that are a number of fields labeled P1, P2, P3 and so on. Those values you set there are returned in the script by calling GetScriptParameter(1), GetScriptParameter(2) etc...

Link to comment
Share on other sites

Originally posted by stoffe -mkb-

Script parameters are values passed to a script from a dialog file. Scripts using such parameters are run from dialog files either as action scripts or conditional scripts.

 

If you use the DLG Editor, there are fields called "Conditional #" (where you assign the script that determines if a dialog node is available) and "Script #" (where you assign the script the dialog node should run).

 

To the right of that are a number of fields labeled P1, P2, P3 and so on. Those values you set there are returned in the script by calling GetScriptParameter(1), GetScriptParameter(2) etc...

Thanks! :monkey4:

I'm pretty sure it worked... The PC disappeared out of view. :p

Now... fades and camera changes... *goes back to modding*

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...