Jump to content

Water Exchange Code Check


Recommended Posts

Working on getting a dialog choice to work. I understand the format now that I rooted around in the scripts from... I think it was VoDT. But I have a condition to start my dialog choice, and I think that something there is stopping the condition that regulates the actions from the choice from working...

 

Code:
 beginstate 20;	if (has_special_item(1) >= 1) {		reset_dialog();		add_dialog_str(0,"Fill up your empty waterskins?",0);		add_dialog_choice(0,"Fill");		add_dialog_choice(1,"Leave");		water_choice = run_dialog(0);		if (water_choice == 0) {			has_special_item(1) == empty_skins;			change_spec_item(0,empty_skins);			empty_skins == 0;			print_str_color("Skins filled.",2);			}		} 
Could also be the fact that I try to equate the number of special item 1 (empty waterskins) to the variable empty_skins, so I can carry the variable over for the number of special item 2 (full waterskins) to be added. Pick it apart, if you would. :-)
Link to comment
Share on other sites

Two things:

 

empty_skins == 0;

 

This doesn't work. You need only one equals sign ("empty_skins = 0;").

 

has_special_item(1) == empty_skins;

 

This doesn't work for two reasons, one of which is described above. The other is that you can't set a short the way you can set a variable. Use an SDF or another variable to hold this value if you need to hold it.

Link to comment
Share on other sites

I'm pretty sure he was trying to set the variable, not the short, but put them the wrong way round.

 

EDIT: Come to think of it, there should probably be a line in there somewhere to remove the empty skin special items, or it's possible to continue getting full skins indefinitely.

 

Also, there's one more problem with your script that comes from BoA's terminally brain-damaged handling of the run_dialog call. Choice number zero returns 1, choice number one returns 2, and so on.

 

A modified script with all suggested corrections implemented is below.

 

Code:
 beginstate 20;	if (has_special_item(1) >= 1) {		reset_dialog();		add_dialog_str(0,"Fill up your empty waterskins?",0);		add_dialog_choice(0,"Fill");		add_dialog_choice(1,"Leave");		water_choice = run_dialog(0);		if (water_choice == 1) {			empty_skins = has_special_item(1);			change_spec_item(0,empty_skins);			change_spec_item(1,(empty_skins * -1));			empty_skins = 0;			print_str_color("Skins filled.",2);			}		}
Link to comment
Share on other sites

Here's what I ended up doing, synthesizing Kelandon and Sagieuleaux's suggestions...

 

Code:
 beginstate 20;	if (has_special_item(1) >= 1) {		reset_dialog();		add_dialog_str(0,"Fill up your empty waterskins?",0);		add_dialog_choice(0,"Fill");		add_dialog_choice(1,"Leave");		water_choice = run_dialog(0);		if (water_choice == 1) {			set_flag(0,20,has_special_item(1));			change_spec_item(0,get_flag(0,20));			change_spec_item(1,(get_flag(0,20) * -1));			set_flag(0,20,0) = 0;			print_str_color("Skins filled.",2);			}		}		break; 
Incidentally, my playtesting in Blades now says that I have a missing semicolon... I don't suppose you see where I need one, in there? I don't see it, but I was only working on this section, except for the variables section, where I deleted "empty_skins" in favor of that SDF.

 

EDIT: The missing semicolon might, for some strange reason, be in the "print" statement near the very end, since when I test, it won't print that message.

Link to comment
Share on other sites

All right, all right, this is me committing all sorts of etiquette breaches... I do apologize for the double post, but this is exciting and relevant, for me.

 

I have playtested the empty/full waterskin system. I'm using Dahak & Kelandon's dehydration routine... I've pushed my party to the point where I get damage, before, and now I've made the complete exchange, using the code I posted in this thread. I can now proceed with building the rest of my scenario, having safely navigated this key system!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...