Jump to content

Home

[K1] Scripting Question


pablo_fett

Recommended Posts

Hi Master Modders,

 

I'm trying to set it up so when the PC hits the Trigger location, the PC will walk over to a specific location and start a conversation with the person there. But what happens is, when the PC hits the trigger, the dialog begins but the PC never moves. Here is the script I am trying to use. Please, let me know if you see anything silly in there.

 

void main() {

// 1. needs to test to see if the quest is in motion

if (GetJournalEntry("tar_albro")!=90 || GetJournalEntry("tar_adminbro")!=30) {

return;

}

 

object oEntered = GetEnteringObject();

 

if (GetIsPC(oEntered) == TRUE)

{

 

object oPc = GetFirstPC();

object oGorton = GetObjectByTag("GortonColu021", 0);

 

vector vPc=Vector(107.86,102.92,0.0);

location lPc=Location(vPc,0.0f);

ActionDoCommand(SetCommandable(TRUE,oPc));

ActionDoCommand(SetCommandable(TRUE,oGorton));

 

DelayCommand(1.0, AssignCommand(oPc,ActionForceMoveToLocation(lPc,FALSE)));

 

DelayCommand(1.0, AssignCommand(oGorton, ActionStartConversation(oEntered)));

 

}

}

 

Thanks for taking a look.

Link to comment
Share on other sites

I'm trying to set it up so when the PC hits the Trigger location, the PC will walk over to a specific location and start a conversation with the person there. But what happens is, when the PC hits the trigger, the dialog begins but the PC never moves. Here is the script I am trying to use.

 

The problem is that you are assigning the walk action and the converse action to the action queue of two different objects, and as such they will be performed simultaneously. You could try to make the player do the Converse action as well and queue it after the move action, like:


void main() {
   // 1. needs to test to see if the quest is in motion
   if ((GetJournalEntry("tar_albro") != 90) || (GetJournalEntry("tar_adminbro")) != 30)
       return;

   object oPC = GetFirstPC();
   object oEntered = GetEnteringObject();

   if (GetEnteringObject() == oPC) {
       object oGorton = GetObjectByTag("GortonColu021");
       location lPC = Location(Vector(107.86, 102.92, 0.0) ,0.0f);
       SetCommandable(TRUE, oPC);
       SetCommandable(TRUE, oGorton);

       NoClicksFor(2.0);
       AssignCommand(oPC, ClearAllActions());
       AssignCommand(oPC, ActionForceMoveToLocation(lPC, FALSE));
       AssignCommand(oPC, ActionStartConversation(oGorton, "TheDLG"));
   }
}

 

This is somewhat risky though since the player might try to override your move command, or get confused why their character is moving on their own. So I'd do the moving as part of the cutscene/dialog instead.

 

I.e. start the dialog immediately when the player trips the trigger, but have it begin with a blank entry with no text that has a script that causes the player to move up to the character, and then proceed with the dialog on the second entry when they've gotten there. This way the character will move in cutscene mode and behave more like the rest of the game.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...