Character disappears before I give him an item. Help?

Started by techie775, Wed 23/07/2008 20:34:39

Previous topic - Next topic

techie775

Hi. I was making a basic game where you have to give people objects and then they go on their way. Unfortunately what happens is I click the item on the character, ego walks up to the character, the character disappears, and then it goes to the dialog with no viable character present. I wanted the character to disappear after the dialog, not before.

Here's the code:
function cGraham_UseInv()
{
if (player.ActiveInventory == iSupplies)
  {
    player.Walk(160, 175,  eBlock);
  cEgo1.FaceCharacter(cGraham);
dDialog9.Start();
cEgo1.LoseInventory(iSupplies);
cEgo1.AddInventory(iSpray);
StopDialog();
FadeOut(30);
cGraham.ChangeView(14);
Wait(40);
FadeIn(10);
}
}

View 14 is a blank view that I read on the forum to get rid of the character I just wonder how to order it correctly... I added the StopDialog() line afterwards and it made no difference. Thanks again.

Khris

Quote from: manualDialog.Start()

Starts a conversation from the specified topic.

NOTE: The conversation will not start immediately; instead, it will be run when the current script function finishes executing.

Before v3.x, it was possible to add a second function to an event and one would simply put in there what's supposed to happen after the dialog.

Unfortunately, this didn't make it to 3.0 and there's no convenient alternative.

Makeout Patrol

Quote from: techie775 on Wed 23/07/2008 20:34:39
Hi. I was making a basic game where you have to give people objects and then they go on their way. Unfortunately what happens is I click the item on the character, ego walks up to the character, the character disappears, and then it goes to the dialog with no viable character present. I wanted the character to disappear after the dialog, not before.

Here's the code:
function cGraham_UseInv()
{
if (player.ActiveInventory == iSupplies)
  {
    player.Walk(160, 175,  eBlock);
  cEgo1.FaceCharacter(cGraham);
dDialog9.Start();
cEgo1.LoseInventory(iSupplies);
cEgo1.AddInventory(iSpray);
StopDialog();
FadeOut(30);
cGraham.ChangeView(14);
Wait(40);
FadeIn(10);
}
}

View 14 is a blank view that I read on the forum to get rid of the character I just wonder how to order it correctly... I added the StopDialog() line afterwards and it made no difference. Thanks again.

The problem is that dialog.Start() doesn't get run until all of the other commands have already been completed. There are two ways that I get around this:
1) I might have a run-script command in the dialog that gets triggered at the end which includes the stuff that I want to happen after the dialog.
2) I might have a global int that represents whether or not to continue a cutscene; if I'm using global int 5, I will have it set to 0 normally, and set it to 1 when the dialog ends. I will then put an if(GetGlobalInt(5) == 1) command in the room's 'repeatedly execute' function with the rest of the commands that you want run placed in it, making sure that I set global int 5 to 0 again somewhere before the end.

techie775

Well thanks for both your replies, I don't know alot about getGlobalINT yet I'm trying to keep it simple,  but I figured out how to turn a message topic off which accomplishes the same goal since I don't want Character A whining about needing a key after I've already given it to him.

SMF spam blocked by CleanTalk