rictus135 Posted March 28, 2008 Share Posted March 28, 2008 I am trying to make a script that gets an NPC to walk up and talk to me after a delay of 3 seconds. I am using KotorTool and some of the scripts in the Scripting forum, but for some reason it won't compile without errors. If someone can show me exactly how the DelayCommand line should look for a 3 second delay, it would be very useful. Link to comment Share on other sites More sharing options...
stoffe Posted March 28, 2008 Share Posted March 28, 2008 I am trying to make a script that gets an NPC to walk up and talk to me after a delay of 3 seconds. I am using KotorTool and some of the scripts in the Scripting forum, but for some reason it won't compile without errors. If someone can show me exactly how the DelayCommand line should look for a 3 second delay, it would be very useful. If you want those two actions delayed by 3 seconds you could do it something like this. TagofNPC in the script should be replaced with the tag of the NPC who should do the walking and talking. void WalkAndTalk(object oTarget); [color=PaleGreen]// ST: Main function[/color] void main() { object oPC = GetFirstPC(); object oNPC = GetObjectByTag("[color=Yellow]TagofNPC[/color]"); DelayCommand(3.0, AssignCommand(oNPC, WalkAndTalk(oPC))); } [color=PaleGreen]// ST: Delayed function for moving and talking to an object.[/color] void WalkAndTalk(object oTarget) { ClearAllActions(); ActionMoveToObject(oTarget); ActionStartConversation(oTarget); } Link to comment Share on other sites More sharing options...
rictus135 Posted March 28, 2008 Author Share Posted March 28, 2008 That got it. Thanks. I am now having a problem with my recruit script however. Most of it works properly, but when the party gui pops up, my recruit is not available for selection. void main() { object oGoodbye; oGoodbye = GetObjectByTag("n_larissa"); SetGlobalFadeOut(1.0, 0.5); DelayCommand(1.0, DestroyObject(oGoodbye)); DelayCommand(1.0,SetGlobalFadeIn(0.7,0.0)); AddPartyMember(NPC_HANDMAIDEN,GetObjectByTag("p_larissa")); DelayCommand(1.0,ShowPartySelectionGUI()); } Any ideas on what is wrong? Link to comment Share on other sites More sharing options...
stoffe Posted March 28, 2008 Share Posted March 28, 2008 That got it. Thanks. I am now having a problem with my recruit script however. Most of it works properly, but when the party gui pops up, my recruit is not available for selection. (snip) AddPartyMember(NPC_HANDMAIDEN,GetObjectByTag("p_larissa")); (snip) Any ideas on what is wrong? The AddPartyMember() function does not add an NPC to the party table/roster of available party members. It adds an already existing party member to the active 3 man party. You'll have to use the AddAvailableNPCByObject() function instead to add an NPC existing in the game world to the party table, or AddAvailableNPCByTemplate() if you want to add it directly from an UTC template. Like: void main() { object oGoodbye = GetObjectByTag("n_larissa"); SetGlobalFadeOut(1.0, 0.5); AddAvailableNPCByTemplate(NPC_HANDMAIDEN, "p_larissa"); DelayCommand(1.0, DestroyObject(oGoodbye)); DelayCommand(1.0, SetGlobalFadeIn(0.7,0.0)); DelayCommand(1.0, ShowPartySelectionGUI()); } Link to comment Share on other sites More sharing options...
rictus135 Posted March 29, 2008 Author Share Posted March 29, 2008 That seems like something I should have spotted. *Sigh* I doubt I'll ever get the hang of this scripting thing. My puny male brain is too crammed full of dirty jokes and miscelanious information. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.