Need help turning off a dialogue option from another dialogue (Solved)

Started by Fluxpuppy, Wed 24/12/2014 04:42:22

Previous topic - Next topic

Fluxpuppy

Hi, I'm working on my first game and I've made a lot of progress, I think i'm starting to understand scripting and my game is nearly complete.
I just can't get my head around this one thing.
I have it so the player can ask an npc about an item, it then changes to another dialogue about the item where you can convince him to part with it.
I've made it so that this makes the item in the room pickupable, that's fine.. but now i need the starting point of this conversation tree in the original dialogue to vanish so you can't ask about the item now you already have it.

I've tried 3 different guides and searched the forum, I've seen dialog_request mentioned but I can't seem to work out how to use it and I'm not sure it's even
still in the current AGS?

Help would be greatly appreciated.

edit: let me know if I'm not being very clear, I'll rephrase question. thankyou.
I eat a lot of garlic to be honest

Mandle

You need to set a Global Variable, probably a bool (true/false), something like "WasObjectTaken" and turn this to "true" after the object is taken.

Then you need to set an "If WasObjectTaken == true" condition on your dialogs to control them.


monkey0506

You said that the dialog option should be turned off when the player picks up an item from the room, yes? There's a number of ways you could do this. Probably the most sensible, though, would be just to add it to the same function where the player picks the item up. Presumably you have an object (or maybe character) in the room, and when the player does the pick up interaction, it turns off and they are given the inventory item. So, something like this should do it:

Code: ags
function oMysteriousItem_Pickup()
{
  oMysteriousItem.Visible = false; // turn the object off
  player.AddInventory(iMysteriousItem); // add the inventory item
  dMysteriousNPC.SetOptionState(4, eOptionOffForever); // hide the dialog option, whichever option number it is
}


You should probably already have the first few lines of that for picking up the item, what you need is the Dialog.SetOptionState function to turn off the relevant option in the dialog tree. You can also call this function within dialog scripts, or pretty much anywhere else you want.

Fluxpuppy

Yesss monkey, that solved it! So much simpler than I'd thought! I think the guides I've been reading are incredibly out of date. thanks so much. :-D
I eat a lot of garlic to be honest

Mandle

And I have also learnt here how to not do anything more complicated than it needed to be.

Cassiebsg

Quote from: Mandle on Wed 24/12/2014 09:07:42
And I have also learnt here how to not do anything more complicated than it needed to be.

+1
(nod)
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk