PDA

View Full Version : looking for two scripts...


Vox Kalam
05-31-2007, 09:12 PM
one to make an npc move to a specified point, another to make one convo fire immediately after another.

Master Zionosis
06-01-2007, 01:24 AM
Ok, you can use this script to make the NPC move to a desired location, but you will need to get the coordinates for where you want the NPC to move to first, i beleive this should work, it is similar to TK102's NPC Move to a location and vanish script:

void main () {

// moveloc.nss

// This script will make any NPC
// move to a desired location.

object oNPC=GetObjectByTag("Carth"); // insert NPC's tag here

float x=93.77; // do a whereami cheat
float y=141.06; // to get x, y, and z
float z=0.0;

int bRun=FALSE; // you can set this to TRUE
// if you want the NPC to run


vector vExit=Vector(x,y,z);
location lExit=Location(vExit,0.0f);
ActionDoCommand(SetCommandable(TRUE,oNPC));
AssignCommand (oNPC,ActionForceMoveToLocation(lExit,bRun));

}

Your second script is pretty simple, you can attach this next script to the end of the first dialog and this script will begin the next:

void main() {
ActionStartConversation(GetFirstPC(),"dlg_filenamehere");
}

Or if the second dialog's NPC speaker is further away from the PC you could use this script to make the NPC walk up to the PC and start a conversation, you will need to edit the NPC's .UTC file and put the .dlg name in the conversation box for this script to fire though as it doesn't specify the .dlg:

void main() {
object oNPC=GetObjectByTag("npc_tag");
location lMe=GetLocation(GetFirstPC());
ActionDoCommand(SetCommandable(TRUE,oNPC));
AssignCommand (oNPC,ActionForceMoveToLocation(lMe,FALSE));
AssignCommand (oNPC, ActionStartConversation(GetFirstPC()));
}

Hope these help you, and that I've finaly posted scripts that work, lol.

Vox Kalam
06-01-2007, 02:31 PM
Nothing is working. I mean, NOTHING. I'm using the module editor for these, and I used the 001EBO template. I deleted all triggers, and put the first convo in a new "onenter" script, which I attatched to Module Propeties > Area > Events > OnEnter.

No scripts, I repeat, NO scripts are working
Where, oh where did I go wrong? :(

Master Zionosis
06-01-2007, 02:43 PM
Nothing is working. I mean, NOTHING. I'm using the module editor for these, and I used the 001EBO template. I deleted all triggers, and put the first convo in a new "onenter" script, which I attatched to Module Propeties > Area > Events > OnEnter.

No scripts, I repeat, NO scripts are working
Where, oh where did I go wrong? :(

I'm not sure why that is happening, but i do know that the OnEnter slot does cause problems sometimes I'm not sure why, perhaps someone who has had this problem can answer, but I've never encountered it.

stoffe
06-01-2007, 02:52 PM
Nothing is working. I mean, NOTHING. I'm using the module editor for these, and I used the 001EBO template. I deleted all triggers, and put the first convo in a new "onenter" script, which I attatched to Module Propeties > Area > Events > OnEnter.

No scripts, I repeat, NO scripts are working
Where, oh where did I go wrong? :(

I'd check the ARE file by hand with a GFF editor to see if the script has been set properly, just in case. The KT module editor is not entirely bug-free.

Other than that, check that the .NCS file with your script is in the module data (_s.rim or .mod file, depending on how you package things) and that it has a valid name.

If your OnEnter script starts a conversation I'd delay it slightly to give the player time to properly load into the area. Delay the conversation start by a second or so and see if it makes any difference. Further, make sure your OnEnter script checks so it only does its thing when the entering object is the player transitioning to the area: The OnEnter event triggers when any creature enters the area (the player transitioning there, the player loading a savegame i the area, any NPC or monster being spawned into the area).

Vox Kalam
06-01-2007, 04:05 PM
Ah...so how do I do that last one, making sure it's when the PC enters? The OnClientEnter slot? Something else?

Pavlos
06-01-2007, 04:32 PM
Ah...so how do I do that last one, making sure it's when the PC enters? The OnClientEnter slot? Something else?

void main()
{

// Is the PC the entering object and make sure we're not loading the area from a save
if (GetEnteringObject() == GetFirstPC() && !GetLoadFromSaveGame())
{

// FooBar
ActionDoMyStuff();

}

}

If you have that then there shouldn't be a problem. I've never seen any need to place a delay in there.

Vox Kalam
06-01-2007, 06:54 PM
Bah, I can't open it with a gff editor, and the script still won't fire...Also, when I spawn in, the "Prologue: Garage Access" quest still reappears in my journal. Is there still some element of the area I need to get rid of or change? A waypoint?

Pavlos
06-02-2007, 05:18 AM
1) Clear the .git file completely. Remove everything from it.
2) Make sure that the script you want is in the OnEnter.
3) Make sure your files share the same names as their ResRefs.
4) Ensure that no file name/ResRef is over sixteen characters long.
5) When editing the .are and the .git and placing them in a .mod make sure that your character has never been in the module beforehand - the save games override the stock module data.
6) Try debugging the script with SendMessageToPC().

Vox Kalam
06-02-2007, 10:48 PM
Great. Now the module editor won't open the module I saved because it's "unable to read beyond end of stream." I have to start from scratch.
This particular tool is a real pain in the petootie...

Pavlos
06-03-2007, 05:01 AM
Great. Now the module editor won't open the module I saved because it's "unable to read beyond end of stream." I have to start from scratch.
This particular tool is a real pain in the petootie...

I think that means the .git is corrupted (i.e. the Module Editor has decided to wipe it of all data). If you don't trust the Module Editor - and it's not without its bugs - to edit things properly then you can do things the old fashioned way, with K-GFF and the whereami armband.

Edit: While a little behind the times, Doom_Dealer's tutorial (http://www.lucasforums.com/showthread.php?p=1552754#post1552754) should help you with this.

Vox Kalam
06-03-2007, 10:54 AM
%()$#&%()^...
I did it by hand with kgff...went through every struct in the gif file...then made it all into a .mod file with ktool...STILL, as soon as I spawn in, garage access appears in my journal...the script I attatched does NOT fire...
#@%#@$

Pavlos
06-03-2007, 12:15 PM
Right click on the .rim of the module in KotOR Tool and select Extract for module editing and only extract the Dynamic Module Info, the Static Module Info, the Module.ifo, and the Path info. When asked if you would like to clear the .git of all non-extracted entries, say yes. Open up the .ifo and the .are and remove all the scripts referenced there.

That should ensure that no other scripts are firing when they shouldn't be and that there are no triggers causing havoc.

Please check that your script file name is no longer than sixteen characters long and post the exact script you are using here, along with the data for the NPC which will be moving to a certain point and then starting a conversation :).

stoffe
06-03-2007, 01:28 PM
STILL, as soon as I spawn in, garage access appears in my journal...the script I attatched does NOT fire...

Also check that you don't have a GIT file with that name (or any GIT file for that matter) in the override folder. If you do it would be used instead of the one in the MOD/RIM files.

Vox Kalam
06-03-2007, 02:24 PM
The OnEnter script I'm using:
void main()
{

if (GetEnteringObject() == GetFirstPC() && !GetLoadFromSaveGame())
{
ActionStartConversation(GetFirstPC(),"tarisarrival");

}

}

This script is SUPPOSED to make T3 move to the indicated coordinates during a specific node in a convo:
void main () {

object oNPC=GetObjectByTag("t3ebotar");

float x=48.0;
float y=45.0;
float z=1.81404;

int bRun=FALSE;

}

And last but not least, I attatched this lovely script to the last node in the first of two convos:
void main() {
ActionStartConversation(GetFirstPC(),"taris");
}

And NOTHING is over sixteen characters. I think the longest name any of them has is eleven...

Pavlos
06-03-2007, 03:47 PM
The OnEnter script I'm using
You're best off assigning that command to a certain object. For example:

void main()
{

// I'm using T3 as an example because I'm presuming he's the one you're talking to
object oT3M4 = GetObjectByTag("t3ebotar");

SendMessageToPC(GetFirstPC(), "I am running my script");

/*
Is the PC the entering object and make sure we're not loading the area from a save
I'm also presuming that you only want this to fire once so it's probably best
to create a new Global Boolean in globalcat.2da. If you want it to fire every
time you enter then just remove "!GetGlobalBoolean("MY_GLOBAL")" and
"SetGlobalBoolean("MY_GLOBAL", TRUE);"
*/

if (GetEnteringObject() == GetFirstPC() && !GetLoadFromSaveGame() && !GetGlobalBoolean("MY_GLOBAL"))
{

SendMessageToPC(GetFirstPC(), "I am starting a conversation! WEEE!");
AssignCommand(oT3M4, ActionStartConversation(GetFirstPC(),"tarisarrival"));
SetGlobalBoolean("MY_GLOBAL", TRUE);

}

}
The messages sent to the PC should be on the feedback/message log screen. If the script isn't working properly, it should tell you if it is firing at all, or if there is a problem elsewhere.

This script is SUPPOSED to make T3 move to the indicated coordinates during a specific node in a convo
This script won't actually work because there are no actions:

void main ()
{

object oT3M4 = GetObjectByTag("t3ebotar");
location lLoc = Location([48.0, 45.0, 1.81404], 0.0);

AssignCommand(oT3M4, ActionMoveToLocation(lLoc));

}

And last but not least, I attatched this lovely script to the last node in the first of two convos
Again, you're best off assigning the command to an object (in this case, your T3-M4) and just in case it messes a few things up, delay the command so that we will know that the conversation has finished before the game tries to start a new one.

void main()
{
object oT3M4 = GetObjectByTag("t3ebotar");
DelayCommand(0.2, AssignCommand(oT3M4, ActionStartConversation(GetFirstPC(),"taris")));
}

Vox Kalam
06-03-2007, 04:03 PM
Okay, the two small ones compiled easily, the big one didn't, line 16, syntax error at ")"

Pavlos
06-03-2007, 04:05 PM
I'm not getting any such error on my end.... Line 16 is a blank line.

Vox Kalam
06-03-2007, 04:25 PM
Huh. Now it compiled. I must have accidentally his a key when I pasted it, sorry...lemme see if it works now...

TEN GRUELING MINUTES LATER...
I hate my life...T3 all of a sudden isn't showing up in-game in the module. The utc file is clearly in the module editor...I tried using the generic T3 file, renaming and retagging random utc files to be identical to the T3 utc file...I'll keep trying.

EDIT: Ah-HA! I got him to show up...not sure how...but I did. Everything is working EXCEPT the script that fires the second dialogue...I had to start it manually...