Ok here's my basic problem.Ã, I've made a topic that consists of five options, one of which I dont want to display unless the user has a certain inventory item, #3 in my case.Ã, Here's what the dialog script looks like
// dialog script file
@SÃ, // dialog startup entry point
EGO: "Hello";
MERC: "Welcome";
option-off 4
return
@1Ã, // option 1
MERC: "I'm a man of the wilderness";
return
@2Ã, // option 2
MERC: "Hunt for things to give to me, perhaps we can make a deal";
return
@3Ã, // option 3
MERC: "If you find an item I may trade you."
return
@4Ã, // option 4
MERC: "Lets trade, take this"
@5Ã, // option 5
MERC: "Bye";
stop
Notice how i disabled option 4, that works but I'm thinking it will reset every time I enter the conversation.Ã, The big problem though is there doesnt seem to be a way to check the players inventory within dialog scripts.Ã, The only solution I can see to this would be to make 2 topics which are almost identical, except for topic 2 has one more option.Ã, You run topic 2 if the player does have the item and 1 if they dont.Ã, This seems incedibly inefficient however, so I was wondering if I've got the wrong spin on how to execute conversations which change depending on game events.
Basicly I want one option to be available only if the player has a certain item in his inventory.
ps.Ã, After you click the new option button is there a way to get rid of the blank space if you dont need it?Ã, Its a pain because every time i edit my dialog script i have to delete the @6 thing.
-edit opps, I want them to first have to do option 3, and have the item before option 4 will appear.
Quote from: Mr_Threepwood on Wed 28/09/2005 02:00:42The big problem though is there doesnt seem to be a way to check the players inventory within dialog scripts.
That's what the "run-script" dialog script command is for. Try this:
// dialog script file
@S // dialog startup entry point
run-script 21
//...
@3 // option 3
run-script 87
//...
// global script
function dialog_request(int parameter) {
if (parameter == 21) { // if "run-script 21" used (topic 1 startup entry point)
if (player.InventoryQuantity[3] == 0) { // if player doesn't have inv item #3 (anymore)
SetDialogOption(1, 4, eOptionOff); // disable option 4 in topic 1
}
}
else if (parameter == 87) { // if "run-script 87" used (topic 1, option 3)
if (player.InventoryQuantity[3] > 0) { // if player has inv item #3
SetDialogOption(1, 4, eOptionOn); // enable option 4 in topic 1
}
}
//else if (parameter == xx) { // and so on, for other run-script commands
}
Not sure how/when/if you want what dialog options to dis/appear so you may have to tweak it a bit.
Thanks a ton Strazer, your the AGS guru.
Glad I could help. :)
Quote from: Mr_Threepwood on Wed 28/09/2005 02:46:29
Thanks a ton Strazer, your the AGS guru.
lol yea , it seems that this guy always knows an awnser, he must be smart :P
Quote from: Corey on Wed 28/09/2005 07:53:11
lol yea , it seems that this guy always knows an awnser, he must be smartÃ, :P
We all can see strazer is one of the sharpest knives in this shed. But please stop spamming the tech forums, your help is appreciated, but irrelevant posts are not, ok? :)
(I know, shut it.)