Jump to content

Water in the Desert? (Attn. Big Guys!!!)


Recommended Posts

You could not include any food in the scenario and have the water item be of variety 4, which is food (using it_variety in your custom objects script). I think this would mean that BoA would think the water was food. I haven't tried this, though, so I don't know if it would work or what the drawbacks would be. One I can think of is that the item description might be kind of weird ("Water bottle: this is food"). But I think technically it would work.

 

EDIT: An idea I like better is just using tick_difference to drain water every now and again, and subtract a significant amount of health if the party runs out, enough to be fatal after a short while.

Link to comment
Share on other sites

Would it not technically be possible to run a custom script in which you have "Water" As a special item, and every so often, the scenario searches to see if you have it. If you do, Then it takes one off the list of "Water" under special Items.

 

If you don't have it, then the scenario takes off health.. Etc.

Link to comment
Share on other sites

I think what the designer wants is to have resting consume extra water over and above what's normally consumed in the same amount of time -- he's already talked about implementing water itself in another thread. And while there are ways to check whether the party has been sitting on the same spot for a long time, none are particularly easy. (Basically, you need a timer and a script on every terrain that resets it when stepped on.)

Link to comment
Share on other sites

*Actually*...

 

I was thinking about having water consumed *only* when resting... Although I'll admit that that's not very realistic.

 

I'm in talks with another member on this board, named Dahak. I don't know if he's made any posts that you could read... I'll have to check on that.

 

Anyhow, he and I have a mutual interest in desert-type scenarios, right now. We've talked a bit about having a special item called a "flask"... the party can obtain "empty flasks" in dungeons/from NPC encounters, et cetera... And can fill the "empty flasks" at certain water holes. This makes it an interesting necessity to do some snooping around the beginning of the scenario to collect "empty flasks." Eventually someone will pound out a script piece that times consumption by movement outdoors, to be edited depending on the distances between watering holes in different scenarios.

 

I know that since special items have no weight, *that* aspect isn't realistic. But if the "full flask"/"empty flask" thing could be done with regular items, I guess that's acceptable. Being able to refill makes it feasible to have a weighty set of items, since a party doesn't have to carry a whole lot of them to get anywhere... so long as they plan wisely and refill at key points.

Link to comment
Share on other sites

This should be programable, as it was done in a boe scenario (Destiny of the Spheres) and while the capability of the two editors are not the same, the BOA editor can almost all of what the BOE editor could.

 

I never looked at the noding of that scenario, but the system worked with their being ten special items, repersenting you having between 1 to 10 units of water, and when you found more water it would change the special item to show you had more water, and a global timer would slowly change the special item to show you had less water. How to program that I can't help you with.

 

Edit: The above link looks to point to the same thing as it is by the same desinger as the scenario.

Link to comment
Share on other sites

Hey Guardian. I was flipping trough the docs to track/use water, and I came up with this. Anyone who wants to use/check it may feel free to so.

 

However, I cannot give back empty flasks, since all items slots may be full.

 

Code:
 beginscenarioscript;variables;   short sdf_water;body;beginstate START_SCEN_STATE   set_flag(0, 0, 0);   set_flag(0, 1, 0);   set_flag(0, 2, 0);break;beginstate START_STATE//SDF 00 and 01 keep track of the turns.  Since each SDF only goes to 255, and I need to go to 500...   sdf_water = (get_flag(0,0) + get_flag(0,1));//Has 500 turns passed?   if (sdf_water >= 500)   {      set_flag(0,0,0);      set_flag(0,1,0);      //Has = true, Not have = false      if(has_item(<water item# goes here>)      {         print_str("You drink some water");         take_item(<water item# goes here>);         if (get_flag(0,2))            inc_flag(0,2, -2);      }      else      {         //Check/do dehydration damage         if (get_flag(0,2) == 0)         {            set_flag (0,2, 1);            damage_char(1000, 10, 4);            print_str ("Something goes here");         }         else if (get_flag (0,2) == 1)         {            set_flag (0,2, 2);            damage_char(1000, 20, 4);            print_str ("Something goes here");         }         else if (get_flag (0,2) == 2)         {            set_flag (0,2, 3);            damage_char(1000, 30, 4);            print_str ("Something goes here");         }         else if (get_flag (0,2) == 3)         {            set_flag (0,2, 4);            damage_char(1000, 50, 4);            print_str ("Something goes here");         }         else if (get_flag (0,2) == 4)         {            set_flag (0,2, 5);            damage_char(1000, 70, 4);            print_str ("Something goes here");         }         else if (get_flag (0,2) == 5)         {            set_flag (0,2, 6);            damage_char(1000, 100, 4);            print_str ("Something goes here");         }         else if (get_flag (0,2) == 6)         {            set_flag (0,2, 7);            damage_char(1000, 150, 4);            print_str ("Something goes here");         }	       else         {            //Dead from lack of water.  Luck can help            kill_char(1000, 2, 1);            print_str ("Something goes here");         }      }   }   //Increment SDF's   if (get_flag(0,0) >= 255)   {      inc_flag(0,1, 1);   }   else   {      inc_flag(0,0, 1);   }break; 
Link to comment
Share on other sites

Quote:
Originally written by Imban:
Water depletion was first done in Spidweb games with Destiny of the Spheres for BoE, anyway.
Ah, well, that makes me feel better.

<sighs contentedly>

I never played BoE, but since so few people seem to be porting/adapting scenarios over to BoA, I may yet break down and get it.
Link to comment
Share on other sites

That's right... I'm bumping this back up to the top of the list, after it's been dead for a while... But in my scenario, I've finished the first town, and now have need for the outdoor water draining code to be used.

 

I've seen people pick on Dahak's code and such, but if you can do better, please post the revised code, or direct me to a page where it's been posted. I hate to make other people program for me, but in this instance, I'd rather see the pros demonstrate the code, and I can pick it apart to understand it when I fit it into my scenario.

 

A note: If possible, I'd like to have the water flasks be special items. I know that the weight business isn't realistic, but considering Dahak's trouble, (being unable to return an "empty flask" item, as there may be no more inventory room) and the fact that I'd like the discovery of more "empty flasks" to be the limiter on game progress (i.e. adventurers can't just skip across the desert to my final dungeon just after leaving the first town), I'll settle for "flasks" being special items.

 

Thanks in advance to anyone who can help me.

Link to comment
Share on other sites

I've not looked thorugh the docs for this, but I'm sure you can have multiple instances of a special item... You don't need a special item that is 1 flask, and another that is 2 flasks, and so on.

 

Instead you have 1, 2, 3, 4... of special item flask.. And ditto for special item empty flask.. No weight, but no worries eh?

 

Edit: According to docs you can give mul,tiple specials items, but only take away one (so use a loop), and check to see if they have (so 1 special item shoudl considered enough for the whole party, be it 1 or 6 peopl.. Although if you have 6 people you can accelerate the rate of water consumption...)

Link to comment
Share on other sites

Hate to keep doing this, perhaps my last bump was too quickly overwritten... I'd really appreciate it if someone took another crack at the code from Dahak... I'm picking apart his version now, but my understanding of the calls isn't superb... I'm still figuring out how to use the tick_difference commands to stand in for SDFs. If anyone can help, I, uh... encourage it? (Please help a struggling programmer.)

Link to comment
Share on other sites

Here we go. Streamlined code, written in Lyceum format.

 

Code:
// DAMMIT, THIS DOESN'T WORK. DON'T USE THIS SCRIPT. SEE BELOW.//// Dehydration v1.1.1// dehydration.txt// Originally written by Dahak.// Revised thoroughly by Kelandon (tomwatts@berkeley.edu).//// This general script checks if the party has a special item, water, and does// increasing amounts of damage to the party if they don't have it. This// simulates thirst, as in a desert.//// This script should probably go in the scenario script and be run in the// START_STATE, as depicted below.//variables; short last_drank = 0;short thirst_turns = 0;// Change the following variable to whatever special item the water is.short water = 0;// Change the following variable if you want the party to dehydrate slower or// faster. This is the number of turns between each water check.short dehyd_speed = 500; // Change the following variable if you want the party to die of dehydration// slower or faster. This times dehyd_speed equals the number of turns without// water after which the party will automatically die.short dead_of_thirst = 8;beginstate START_STATE;// Check if enough time has passed since the last water check. If so, proceed.if (tick_difference(last_drank,get_current_tick()) >= dehyd_speed) {	// Set this turn to have been the last water check.	last_drank = get_current_tick();		// If the party has water, drink it.	if(has_special_item(water)) {		print_str("You drink some water."); 		change_spec_item(water,-1); 		thirst_turns = 0;		} 		// If the party doesn't have water, do other things.	else {		// Damage them based on how long they've been thirsty (recorded in the		// variable thirst_turns).		thirst_turns = thirst_turns + 1;		damage_char(1000,(10 * thirst_turns) + get_ran(1,0,9),4); 		print_str ("You're thirsty!");				// Warn them if they're dying.		if (thirst_turns == dead_of_thirst - 1)			print_str_color("YOU ARE NEAR DEATH. YOU NEED WATER.",1);					// If they are too thirsty, kill them. 		if (thirst_turns == dead_of_thirst) {			message_dialog("You die of thirst!","");			kill_char(1000,2,0); 			}		}	}	break;  
Link to comment
Share on other sites

I believe that variables are wiped when the game is reloaded outdoors, or scripts are reloaded.

 

Also, variables are limited in scope to their scripts. SDF's are global.

 

If you used tick_difference, how would you record what the ealier time should be worth?

 

Tick_difference should not used when the chance of someone clearing the variables exists.

Link to comment
Share on other sites

Quote:
Originally written by Dahak:
I believe that variables are wiped when the game is reloaded outdoors, or scripts are reloaded.
Have you actually tested that? I've heard rumors both ways, but to the best of my knowledge, variables stay, even after the game is reloaded.

EDIT: Because I was curious, I just went and tested this code out. The new version works like a charm, except that Dahak is right: when the party reloads in the outdoors, something about the variables goes haywire, and the script fails. SDFs are necessary in this case. I guess I'll go re-write the script with that in mind.
Link to comment
Share on other sites

Hey, Kel, thank you a lot, even if this doesn't function quite correctly, yet. Between you and Dahak, I trust things will get worked out, eventually.

 

Incidentally, I feel kind of bad bugging other people to write code for me. I got the templates for custom items and creatures from other posts on this site, and I figure I can take a crack at some graphics, if I have to... So I've tried somewhat to make sure I'm not getting people to do *everything* for me. The real question: Am I cheating, asking other people to do code for me?

Link to comment
Share on other sites

Using other people's code is perfectly fine (and in fact preferred, wherever possible), as long as you give credit to the original authors. In a similar fashion, I "borrow" graphics incessantly, and the readme for my scenario will have a long chunk crediting each artist who created the graphics I'm using.

 

Here's the newest version. This seems to work, as far as I can tell. I think I'll post it in the Codex, too.

 

Code:
// Dehydration v1.2// dehydration.txt// Original version by Dahak.// Revised thoroughly by Kelandon (tomwatts@berkeley.edu).//// This general script checks if the party has a special item, water, and does// increasing amounts of damage to the party if they don't have it. This// simulates thirst, as in a desert.//// This script should probably go in the scenario script and be run in the// START_STATE, as depicted below.//// This script uses three SDFs. The default SDFs to use are (250,0), (250,1),// and (250,2). If you want to use others, replace the values in the variables// section. Several other values are editable, too.variables;// How many turns since the party last had water.short last_drank;// ALL OF THE FOLLOWING VARIABLES CAN BE EDITED TO SUIT WHATEVER YOUR SCENARIO'S// SPECIFIC NEEDS ARE. CHANGE THEIR VALUES TO WHATEVER YOU LIKE.// Change the following variable to whatever special item the water is.short water = 0;// Change the following variables to the coordinates of the SDFs keeping track// of the time between water checks. This works by using the SDFs as a two-digit// base-256 number. That is, the first SDF set to 5 and the second set to 2// means that 2 * 256 + 5 (equalling 517) turns have passed since the last water// check.short sdf_x = 250;short sdf_y1 = 0;short sdf_y2 = 1;// Change the following variables to the coordinates of the SDF keeping track// of how many consecutive times the party has failed a water check.short thirst_sdf_x = 0;short thirst_sdf_y = 2;// Change the following variable if you want the party to dehydrate slower or// faster. This is the number of turns between each water check. NOTE: This can// reasonably go up as high as sixty-five thousand. Any more than that, and you// will need to add more SDFs to keep track of the ticks in between water// checks.short dehyd_speed = 500; // Change the following variable if you want the party to die of dehydration// slower or faster. This times dehyd_speed equals the number of turns without// water after which the party will automatically die.short dead_of_thirst = 8;beginstate START_STATE;// Figure out how many turns it has been since the party drank water and save// that in last_drank.last_drank = (get_flag(sdf_x,sdf_y2) * 256) + get_flag(sdf_x,sdf_y1);// Check if enough time has passed since the last water check. If so, proceed.if (last_drank >= dehyd_speed) {		// If the party has water, drink it.	if(has_special_item(water)) {		print_str("You drink some water."); 		change_spec_item(water,-1); 				// Reset all flags and counters.		set_flag(thirst_sdf_x,thirst_sdf_y,0);		set_flag(sdf_x,sdf_y2,0);		set_flag(sdf_x,sdf_y1,0);		} 		// If the party doesn't have water, do other things.	else {		// Damage them based on how long they've been thirsty (recorded in the		// variable thirst_turns).		inc_flag(thirst_sdf_x,thirst_sdf_y,1);		damage_char(1000,(10 * get_flag(thirst_sdf_x,thirst_sdf_y)) + get_ran(1,0,9),4); 		print_str ("You're thirsty!");				// Reset flags.		set_flag(sdf_x,sdf_y2,0);		set_flag(sdf_x,sdf_y1,0);				// Warn them if they're dying.		if (get_flag(thirst_sdf_x,thirst_sdf_y) == dead_of_thirst - 1)			print_str_color("YOU ARE NEAR DEATH. YOU NEED WATER.",1);					// If they are too thirsty, kill them. 		if (get_flag(thirst_sdf_x,thirst_sdf_y) == dead_of_thirst) {			message_dialog("You die of thirst!","");			kill_char(1000,2,0); 			}		}	}		// Increment the SDFs keeping track of time. This works differently outdoors	// because although ten ticks pass for every step, the START_STATE is only	// called once per step.	if (get_flag(sdf_x,sdf_y1) < 255 - (9 * is_outdoor()))		inc_flag(sdf_x,sdf_y1,1 + (9 * is_outdoor()));	else {		inc_flag(sdf_x,sdf_y2,1);		set_flag(sdf_x,sdf_y1,0);		}		break;  
Link to comment
Share on other sites

Okay... when it comes to modifying this for my own purposes, I have a couple of small, dumb questions... a tick is one step, outdoors, unless there's some call like set_ticks_forward, or something similar, correct?

 

I had another question about the SDFs in the script, but I think I can answer that one myself...

 

EDIT: I was poking around in the code, and I'm going to have to add a bit... Where you put change_spec_item(water,-1), I'm adding, after that, change_spec_item(empty,1), and adding the appropriate short variable. Ideally, this will be a circular process, with the chance to fill empty water bags at watering holes, towns, et cetera. Let me know if you have any ideas on that... although filling will be far easier a code than dehydration.

Link to comment
Share on other sites

Oh, I forgot about that part, the empty water flasks. Yeah, that sounds like it would work just fine.

 

A tick is one step in town mode. I think it's a full turn in combat. One step in the outdoors is ten ticks, though. Everywhere but the outdoors, the START_STATE gets called once per tick, but outdoors, it only gets called once every ten ticks, which is the reason for the rather bizarre way of keeping track of time down at the bottom of that code.

Link to comment
Share on other sites

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