Scripting help with quests/missions on my new game.

Started by HereComeDatBoi, Sun 28/12/2008 00:48:46

Previous topic - Next topic

HereComeDatBoi

I have a question for some1 a little bit more  experienced than me (not that hard to be more experienced than me).

I have just started making my first game and I wanted my guy to complete a quest I have scripted this for went my quest is finished:

function cGloriana_UseInv()
{
player.Walk (139, 233, eBlock);
dQuestSwFin.Start();
player.LoseInventory(iAConcoct);
player.AddInventory (iAxe);
Display ("NEW INVENTORY ITEM ACQUIRED!");
dQuestSwFin2.Start();
cGloriana.Walk (254, 4, eBlock);
}

I wanted it so that my guy walks to her then, he says a few things to her, then the item gets taken out of the inventory and then a neww 1 gets put in. Then it says that i have aquired a new item then another conversation starts and then the quest giver walks off in that order.  

But what happens is it is all muddled in no peticular order. So what happens is: he walks up to her then the  NEW INVENTORY ITEM AQUIRED text comes up then the items are switched and then the lady just starts walking off until she is far away and then the dialog comes up last...

Is there a way to fix this???

Khris

As stated in the manual, dialogs aren't started until the end of the function.
If you're using the latest release, you can call script commands within dialog scripts.

Although, from your description, this seems to be more like a cutscene; does the player actually choose different options in the two dialogs? If not, you can simply use the .Say command.

Apart from that, you'll probably want to check for the correct item at the start of the function:
Code: ags
function cGloriana_UseInv() {
  if (player.ActiveInventory != iAConcoct) {
    player.Say("She wants something else.");
    return;
  }
  // rest of code

HereComeDatBoi

Ohh ok thanks that helped. I have read the Manual btw but I find parts hard to understand so thanks :)

SMF spam blocked by CleanTalk