Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Scripting woes...

Page: 1 of 1
 Marius Fett
01-27-2009, 11:48 AM
#1
Ahoy fellow modders!

Being the scripting failure that I am, I have a problem. :(

I have a dialog, and at the end of the dialog, I use this script to spawn an NPC at a waypoint and the end of the conversation:

void main()
{

object oPC = GetPCSpeaker();

object oTarget;
object oSpawn;
location lTarget;
oTarget = GetWaypointByTag("nindenstand");

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "ninden", lTarget);

}

That works fine.

But what I want, is for the NPC to start his own conversation with me after he spawns.

I've tried several ways to do this, and none of them seem to work. :(

Any of you scripting guru's...

I'd appreciate some help.. :D
 zbyl2
01-27-2009, 12:03 PM
#2
After "object oSpawn = Cre..." add line:
AssignCommand(oSpawn,ActionStartConversation(GetFi rstPC(),"put_dlg_name_here",CONVERSATION_TYPE_CINEMATIC));
I'm always doing it that way and it always works ;)
 Marius Fett
01-27-2009, 12:52 PM
#3
Just tried that, and still no luck... :(
 Stream
01-27-2009, 3:01 PM
#4
Try this;

void main()
{

object oPC = GetPCSpeaker();

object oTarget;
object oSpawn;
location lTarget;
oTarget = GetWaypointByTag("nindenstand");

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "ninden", lTarget);

object oNinden = GetObjectByTag("ninden", 0);
AssignCommand(oNinden, ActionStartConversation(oPC, "", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));

}


--Stream
 Marius Fett
01-27-2009, 3:22 PM
#5
Argh, still nothing...

The guy just spawns and stands there like a fool...
 Stream
01-27-2009, 3:42 PM
#6
Sorry my bad;

void main()
{

object oPC = GetPCSpeaker();

object oTarget;
object oSpawn;
location lTarget;
oTarget = GetWaypointByTag("nindenstand");

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "ninden", lTarget);

object oNinden = GetObjectByTag("ninden", 0);
ActionStartConversation(oPC, "ninden_dialog_ref", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0);

}

I think that'll work.

--Stream
 stoffe
01-27-2009, 3:53 PM
#7
But what I want, is for the NPC to start his own conversation with me after he spawns.

Make sure the script is run from the very last node in the conversation so the player isn't in dialog mode any more when the script has been run.

void main() {
object oPC = GetFirstPC();
location lTarget = GetLocation(GetWaypointByTag("nindenstand"));
object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "ninden", lTarget);
NoClicksFor(1.0);
DelayCommand(1.0, AssignCommand(oSpawn, ClearAllActions()));
DelayCommand(1.0, AssignCommand(oSpawn, ActionStartConversation(oPC, "", FALSE, CONVERSATION_TYPE_CINEMATIC, TRUE)));
}


(Alternatively you can just use your existing conversation to continue talking with the new NPC instead of starting a new one. Might be easier, depending on the circumstances.)
 Marius Fett
01-27-2009, 5:02 PM
#8
Make sure the script is run from the very last node in the conversation so the player isn't in dialog mode any more when the script has been run.

It is. It's on a blank node at the end of the dialog.

I'll try your script now. :)

EDIT:

Ok, the script works. He starts talking when he spawns.

But he starts on the wrong dialog node!

I't's supposed to be a talk - fight - talk sequence (based on tk's tutorial) but he ALWAYS starts on the "after fighting" node. (Yes i've tried switching the node order around.)

This isnt my lucky day.. :p
 Star Admiral
01-27-2009, 6:41 PM
#9
Do you have a conditional script on one of the branches? If so, could you post it here so we can give a look at it?

- Star Admiral
 Marius Fett
01-28-2009, 11:01 AM
#10
Like I said, I followed tk's tutorial to give me an idea of what I was doing, so I used the one he posted:

int StartingConditional() {
int nResumeTalk = GetLocalBoolean(OBJECT_SELF,0);
return nResumeTalk;
}
 Exile007
01-28-2009, 3:17 PM
#11
Like I said, I followed tk's tutorial to give me an idea of what I was doing, so I used the one he posted:

int StartingConditional() {
int nResumeTalk = GetLocalBoolean(OBJECT_SELF,0);
return nResumeTalk;
}

Did you set the local boolean on the object true in some other script? If yes then that's the problem, trying changing the 0 to a 1 in your conditional script and in the user-define portion of the talk-fight-talk sequence.
 Marius Fett
01-28-2009, 4:44 PM
#12
w00t!

Problem solved. :D

For now... But I have a feeling something else may go wrong. :p

So thanks everyone for the help so far. :)
Page: 1 of 1