PDA

View Full Version : [TSL] Sitting in Chair Script Help


EnderWiggin
04-11-2007, 04:27 PM
I did some searching and found this thread and I tried using Tupac's scripts. I didn't even get the spawn script to compile, it had an error list the size of my arm. I did get the user defined script to compile perfectly, however.

http://www.lucasforums.com/showpost.php?p=1912465&postcount=2

I am trying to make an NPC sit in the Nar Shadaa cantina area, (not the JJT) and I'm not as good as I used to be with scripts. I tried to use the script (the spawn one) from this post and change it up a bit but now it won't compile. The character occupies the 'quarrend' place in the cantina. The file is n_quarren002.utc. This NPC is sitting at an empty table. Unfortunately, he starts out sitting, but then stands up when I talk to him. He then sits when I come back to the module, facing backwards or sideways (oriented to the PC).

Could anyone help me correctly have my NPC sit at a table, in a chair, (drinking juma, preferably, but I can drop that animation if it makes it easier...) and then have him stay sitting when I talk to him and stay sitting when I am done, and keep him from orienting towards me?

TIA!

_EW_

EDIT: the spawn script for the NPC I have is k_bar. Maybe the Onderon Soldier that Tupac used as a base isn't the same spawn script for my NPC? The errors even had to do with the part that the notes said not to touch.



EDIT2: Thanks Stoffe, will try this and post if I have any more questions.

stoffe
04-11-2007, 04:38 PM
I did some searching and found this thread and I tried using Tupac's scripts. I didn't even get the spawn script to compile, it had an error list the size of my arm.

Make sure you have the correct include files available, and that the script includes them properly (the top seems to be missing from the first script posted in the thread you linked to). You need these lines at the top o the spawn script if they aren't there already:


#include "k_inc_generic"
#include "k_inc_treas_k2"


That the NPC doesn't face properly likely is caused by your broken spawn script, since it locks their conversation orientation.

As for the drinking part, replace...
ANIMATION_LOOPING_SIT_CHAIR
...with...
ANIMATION_LOOPING_SIT_CHAIR_DRINK
...instead in both scripts.

EnderWiggin
04-11-2007, 09:42 PM
My script looks as follows:

void main()
#include "k_inc_generic"
#include "k_inc_treas_k2"
{
GN_SetSpawnInCondition( SW_FLAG_EVENT_ON_DIALOGUE_END );

//****** BEGIN DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ******
GN_SetDayNightPresence();
// This function although poorly named sets up the listening patterns and other
// important data for the creature it should never be removed.
GN_SetListeningPatterns();
SetLocalNumber(OBJECT_SELF, 11, 6);// FAK - OEI default turret cooldown
//****** END DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ******

AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_LOOPING_SIT_CHAIR_DR INK, 1.0, -1.0));

vector vFacing = Vector(48.9228858947754, -38.4746131896973, 9.66571617126465);
AssignCommand(OBJECT_SELF, SetFacingPoint(vFacing));

SetLockOrientationInDialog(OBJECT_SELF, TRUE);
SetOrientOnClick(OBJECT_SELF, FALSE);
}


The error messages have changed.


They now read:

k_inc_gensupport.nss(13):Error: Syntax error at "int"
ew_sittingss.nss(4): Error: Syntax error at "{"
ew_sittingss.nss(18): Error: Syntax error at "AssignCommand"
Compilation aborted with errors.

Where am I going wrong?

TIA.

_EW_

stoffe
04-11-2007, 09:53 PM
My script looks as follows:
void main()
#include "k_inc_generic"
#include "k_inc_treas_k2"
{


You'll need to move the include lines up above the main() function implementation. It currently inserts those two scripts between the function header and the starting block, which will result in invalid syntax of the script.

EnderWiggin
04-11-2007, 10:08 PM
You'll need to move the include lines up above the main() function implementation. It currently inserts those two scripts between the function header and the starting block, which will result in invalid syntax of the script.

Ok, now this seems to be the last error.
I did what you said and this the response was thus:

ew_sittingss.nss(8): Error: Required argument missing in call to "GN_SetDayNightPresence"

Thanks again...

_EW_

stoffe
04-11-2007, 10:20 PM
Ok, now this seems to be the last error.
I did what you said and this the response was thus:


It's missing a parameter value in the GN_SetDayNightPresence() function call. Use the AMBIENT_PRESENCE_ALWAYS_PRESENT global as parameter value and it should work.

//****** BEGIN DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) ******
GN_SetDayNightPresence( AMBIENT_PRESENCE_ALWAYS_PRESENT );

Or, you can remove the call of the GN_SetDayNightPresence() function altogether since it's not used for anything any more. Just delete that line from your script. :)

EnderWiggin
04-11-2007, 10:27 PM
Thanks, worked like a charm!

_EW_