Sign in to follow this  
Red Hessian

[K1] A Scripting Question

Recommended Posts

Hey everyone!

I have a couple of questions regarding a particular script:

1. What script is used by the Echani Mercenary on Manaan (man26_echmerc002.utc) talking with the Republic Negotiator that makes him leave at the end of their conversation?

2. Can that script be edited so that he can be interacted with after he leaves? Because in vanilla he can't be clicked on/talked to when he leaves.

Thanks!

Share this post


Link to post
Share on other sites

The related DLG is man26_repneg.dlg and the script responsible is k_pman_reprec01 that fires on R12 (exit node of the initial scene). The source is here:

https://github.com/KOTORCommunityPatches/Vanilla_KOTOR_Script_Source/blob/master/K1/Modules/M26AA_Manaan_Ahto_West_manm26aa/k_pman_reprec01.nss

which just signals a UserDefine event to the merc. So you check the merc's UTC and look at his script list to find his UserDefine script, which is k_pman_merc_d, the source for which is here:

https://github.com/KOTORCommunityPatches/Vanilla_KOTOR_Script_Source/blob/master/K1/Modules/M26AA_Manaan_Ahto_West_manm26aa/k_pman_merc_d.nss

The event itself is

case 10:
	ActionForceMoveToObject(GetObjectByTag("man28aa_nilko_exit", 0));
	ActionDoCommand(DestroyObject(OBJECT_SELF));
	SetCommandable(FALSE, OBJECT_SELF);
break;

This is a pretty standard exit script. It adds a move command and a destroy command to his action stack, and a SetCommandable command immediately. This is why he is non-interactive. If you comment out or delete the SetCommandable (or change it to TRUE) and recompile the script then you'll be able to interrupt him.

Share this post


Link to post
Share on other sites

Thanks DP! But now when I interrupt him and talk to him, he just stands there. How can I make him continue with his walk after that? To clarify a bit, I'm trying to set up this Echani merc to be the same as the merc (man26_merc2) in M26AB talking to the Sith Negotiator, so that you can talk to him and interrupt him at any time before he disappears.

Sorry for the newb questions, scripts were never my forte. 

Share this post


Link to post
Share on other sites

Edit his DLG (man26_echmerc1.dlg) and set k_pman_reprec01 as the script in the exit node (R1). Although that script was intended for a DLG with a different owner. Not sure what happens when you try to grab the nearest object to an NPC with the NPC's own tag. If it doesn't work you'll need to make a custom script, like so:

void main() {
	
	SignalEvent(OBJECT_SELF, EventUserDefined(10));
}

Although possibly it might also need a small delay. Alternatively, the script could go in the EndConversation slot of the root node instead of in the exit node. Check out some other ambient NPCs for how this sort of thing works, like in Taris Upper City.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this