Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Aug 2014
M
MAHak Offline OP
member
OP Offline
member
M
Joined: Aug 2014
So I want to make a NCP join my party after a dialog and I'm trying to make the right script to do so. Looking through the story editor, I found several commands(?) that seems they should do the job, but none of them was accepted for a built.

I tried the following scripts.

IF
DialogEnded("NPC_Roylin",_)
THEN
CharacterAddToParty(e3366c01-766f-43a7-86a5-e2e877c1dfe5);

IF
DialogEnded("NPC_Roylin",_)
THEN
CharacterMakeCompanion(e3366c01-766f-43a7-86a5-e2e877c1dfe5)

I'm not sure what the PROC statement do, I'm guessing it means something like "Just do this, no IF's"
So the idea for the code below was to add a local flag to the 3 end nodes of the dialog that the NPC was (she is meant to join on all of them) and then all 3 nodes will force her to join my party.

PROC
DialogGetLocalFlag(9492ea15-ddab-4f4a-b255-03a362d60a5a,53fd350f-288d-4c43-92e6-81e8678df82b,53fd350f-288d-4c43-92e6-81e8678df82b(CharacterMakeCompanion(e3366c01-766f-43a7-86a5-e2e877c1dfe5))


Is this totally wrong or am I on the right track?

Joined: Dec 2013
old hand
Offline
old hand
Joined: Dec 2013
Hi MAHak,

Looks like your GUID is missing the type cast and name at the beginning and you are missing the target player to whom the NPC is being added. Here is an example from Origins when adding Lohse to the party:

Code
CharacterAddToParty(CHARACTERGUID_S_Player_Lohse_bb932b13-8ebf-4ab4-aac0-83e6924e4295,(CHARACTERGUID)_Player);


If you want to use the GUID of the NPC you are adding, you can find it using auto-completion in the story editor. Make sure you generate definitions, and then when it's time to enter the GUID just start typing in the name of the NPC and then CTRL+SPACEBAR. You will get a drop down menu of matches and you can pluck the right GUID from the list. However, this doesn't help the issue of finding your _Player handle.

With the caveat of not having tested this and trying to go by memory of how I got this to work, I would try something like:

Code
IF
DialogEnded("NPC_Roylin", _instance)
AND
DialogGetInvolvedPlayer(_instance, 1, (CHARACTERGUID)_player)
AND
DialogGetInvolvedNPC(_instance, 1, (CHARACTERGUID)_npc)
THEN
CharacterMakePlayer(_npc);
CharacterAddToParty(_npc, _player);


You may also want to consider setting a flag on the player in your dialog that indicates whether or not this NPC will join the character, unless you always want him to join regardless of the outcome or choices of the conversation. If you add a flag, add another query in the frame after DialogGetInvolvedPlayer() with something like:

Code
AND
ObjectGetFlag(_player, "Roylin_AddToParty", 1);


Finally, last bit of advice is that when you are trying to use a new Osiris call for the first time, consider looking at examples from Origins. You can either open up Origins directly or create a test sandbox with a dependency on Origins and build the story. Then you can simply press CTRL+SHIFT+F in the story editor and enter the function of interest in the search box. It will show every occurrence of that function in the story and you can double click each row in the search results to open the script and location of that call.


DOS2 Mods: Happily Emmie After and The Noisy Crypt

Steam Workshop
Nexus Mods
Joined: Aug 2014
M
MAHak Offline OP
member
OP Offline
member
M
Joined: Aug 2014
Hey Windemere. Thanks for the advice, I'll give it try once I have some time tonight.

Joined: Aug 2014
M
MAHak Offline OP
member
OP Offline
member
M
Joined: Aug 2014
Hhhhmmmm... the builder really don't like my player character's GUID. Evertime I try to build it gives an error on the GUID that I put in the line.
I really don't know about the PC anyway, it seems that if I try to make one and switch to gamemode it will spawn an origin character anyway.
Guess I'll read up some more on the story scripter and Osiris.


Moderated by  Larian_KVN 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5