lfnetwork.com mark read register faq members calendar

Thread: looking for two scripts...
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 05-31-2007, 09:12 PM   #1
Vox Kalam
Rookie
 
Vox Kalam's Avatar
 
Join Date: Apr 2005
Location: NYC
Posts: 112
looking for two scripts...

one to make an npc move to a specified point, another to make one convo fire immediately after another.
Vox Kalam is offline   you may: quote & reply,
Old 06-01-2007, 01:24 AM   #2
Master Zionosis
Relax On Air
 
Master Zionosis's Avatar
 
Join Date: Sep 2006
Location: High In The Sky
Posts: 1,280
Current Game: TR 8: Underworld
Contest winner - Modding 
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:

Code:
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:

Quote:
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:

Quote:
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.

Master Zionosis is offline   you may: quote & reply,
Old 06-01-2007, 02:31 PM   #3
Vox Kalam
Rookie
 
Vox Kalam's Avatar
 
Join Date: Apr 2005
Location: NYC
Posts: 112
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?
Vox Kalam is offline   you may: quote & reply,
Old 06-01-2007, 02:43 PM   #4
Master Zionosis
Relax On Air
 
Master Zionosis's Avatar
 
Join Date: Sep 2006
Location: High In The Sky
Posts: 1,280
Current Game: TR 8: Underworld
Contest winner - Modding 
Quote:
Originally Posted by Vox Kalam
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.

Master Zionosis is offline   you may: quote & reply,
Old 06-01-2007, 02:52 PM   #5
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by Vox Kalam
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).
stoffe is offline   you may: quote & reply,
Old 06-01-2007, 04:05 PM   #6
Vox Kalam
Rookie
 
Vox Kalam's Avatar
 
Join Date: Apr 2005
Location: NYC
Posts: 112
Ah...so how do I do that last one, making sure it's when the PC enters? The OnClientEnter slot? Something else?
Vox Kalam is offline   you may: quote & reply,
Old 06-01-2007, 04:32 PM   #7
Pavlos
Scruffy Englishman
 
Pavlos's Avatar
 
Join Date: Sep 2005
Location: The real world/ivory towers
Posts: 1,974
Current Game: Viking Warrior Poets
Quote:
Originally Posted by Vox Kalam
Ah...so how do I do that last one, making sure it's when the PC enters? The OnClientEnter slot? Something else?
Code:
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.
Pavlos is offline   you may: quote & reply,
Old 06-01-2007, 06:54 PM   #8
Vox Kalam
Rookie
 
Vox Kalam's Avatar
 
Join Date: Apr 2005
Location: NYC
Posts: 112
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?
Vox Kalam is offline   you may: quote & reply,
Old 06-02-2007, 05:18 AM   #9
Pavlos
Scruffy Englishman
 
Pavlos's Avatar
 
Join Date: Sep 2005
Location: The real world/ivory towers
Posts: 1,974
Current Game: Viking Warrior Poets
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().
Pavlos is offline   you may: quote & reply,
Old 06-02-2007, 10:48 PM   #10
Vox Kalam
Rookie
 
Vox Kalam's Avatar
 
Join Date: Apr 2005
Location: NYC
Posts: 112
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...
Vox Kalam is offline   you may: quote & reply,
Old 06-03-2007, 05:01 AM   #11
Pavlos
Scruffy Englishman
 
Pavlos's Avatar
 
Join Date: Sep 2005
Location: The real world/ivory towers
Posts: 1,974
Current Game: Viking Warrior Poets
Quote:
Originally Posted by Vox Kalam
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 should help you with this.
Pavlos is offline   you may: quote & reply,
Old 06-03-2007, 10:54 AM   #12
Vox Kalam
Rookie
 
Vox Kalam's Avatar
 
Join Date: Apr 2005
Location: NYC
Posts: 112
%()$#&%()^...
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...
#@%#@$
Vox Kalam is offline   you may: quote & reply,
Old 06-03-2007, 12:15 PM   #13
Pavlos
Scruffy Englishman
 
Pavlos's Avatar
 
Join Date: Sep 2005
Location: The real world/ivory towers
Posts: 1,974
Current Game: Viking Warrior Poets
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 .
Pavlos is offline   you may: quote & reply,
Old 06-03-2007, 01:28 PM   #14
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by Vox Kalam
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.
stoffe is offline   you may: quote & reply,
Old 06-03-2007, 02:24 PM   #15
Vox Kalam
Rookie
 
Vox Kalam's Avatar
 
Join Date: Apr 2005
Location: NYC
Posts: 112
The OnEnter script I'm using:
Quote:
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:
Quote:
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:
Quote:
void main() {
ActionStartConversation(GetFirstPC(),"taris");
}
And NOTHING is over sixteen characters. I think the longest name any of them has is eleven...
Vox Kalam is offline   you may: quote & reply,
Old 06-03-2007, 03:47 PM   #16
Pavlos
Scruffy Englishman
 
Pavlos's Avatar
 
Join Date: Sep 2005
Location: The real world/ivory towers
Posts: 1,974
Current Game: Viking Warrior Poets
Quote:
Originally Posted by Vox Kalam
The OnEnter script I'm using
You're best off assigning that command to a certain object. For example:

Code:
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.

Quote:
Originally Posted by Vox Kalam
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:

Code:
void main () 
{

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

    AssignCommand(oT3M4, ActionMoveToLocation(lLoc));

}
Quote:
Originally Posted by Vox Kalam
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.

Code:
void main() 
{
    object oT3M4 = GetObjectByTag("t3ebotar");
    DelayCommand(0.2, AssignCommand(oT3M4, ActionStartConversation(GetFirstPC(),"taris")));
}
Pavlos is offline   you may: quote & reply,
Old 06-03-2007, 04:03 PM   #17
Vox Kalam
Rookie
 
Vox Kalam's Avatar
 
Join Date: Apr 2005
Location: NYC
Posts: 112
Okay, the two small ones compiled easily, the big one didn't, line 16, syntax error at ")"
Vox Kalam is offline   you may: quote & reply,
Old 06-03-2007, 04:05 PM   #18
Pavlos
Scruffy Englishman
 
Pavlos's Avatar
 
Join Date: Sep 2005
Location: The real world/ivory towers
Posts: 1,974
Current Game: Viking Warrior Poets
I'm not getting any such error on my end.... Line 16 is a blank line.
Pavlos is offline   you may: quote & reply,
Old 06-03-2007, 04:25 PM   #19
Vox Kalam
Rookie
 
Vox Kalam's Avatar
 
Join Date: Apr 2005
Location: NYC
Posts: 112
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...

Last edited by Vox Kalam; 06-03-2007 at 05:05 PM.
Vox Kalam is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > looking for two scripts...

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:47 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.