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

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).

Pages

AuthorTopic: Water in the Desert? (Attn. Big Guys!!!)
Warrior
Member # 1250
Profile #0
All right... this is completely foreign to me... this probably screws around with the game engine itself...

I've had suggestions about water depletion in a desert scenario. Is it possible to tie an item, *any* item, besides food, into the requirements for rest?
Posts: 93 | Registered: Saturday, June 1 2002 07:00
Agent
Member # 2820
Profile #1
I don't think so. But you don't need to at all. The necessity for water could be a scenario wide dilemna for the player.

But I am reminded of how Jeff made those poisonous mushroom patches in Avernum 2, so I don't know.

--------------------
Thuryl: I mean, most of us don't go around consuming our own bodily fluids, no matter how delicious they are.
====
Alorael: War and violence would end if we all had each other's babies!
====
Drakefyre: Those are hideous mangos.
Posts: 1415 | Registered: Thursday, March 27 2003 08:00
Off With Their Heads
Member # 4045
Profile Homepage #2
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.

[ Wednesday, August 04, 2004 19:50: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Apprentice
Member # 4564
Profile #3
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.

--------------------
Right!
Posts: 17 | Registered: Wednesday, June 16 2004 07:00
Off With Their Heads
Member # 4045
Profile Homepage #4
The disadvantage of that (or possibly advantage, depending on your intention) is that special items weigh 0. Regular items can have actual weight. In real life, enough water to last for a while in the desert would would be very heavy.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
...b10010b...
Member # 869
Profile Homepage #5
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.)

[ Wednesday, August 04, 2004 20:47: Message edited by: Thuryl ]

--------------------
The Empire Always Loses: This Time For Sure!
Posts: 9973 | Registered: Saturday, March 30 2002 08:00
Warrior
Member # 1250
Profile #6
*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.
Posts: 93 | Registered: Saturday, June 1 2002 07:00
BoE Posse
Member # 15
Profile Homepage #7
I know this won't translate directly, but check out "Making the party dependent on some Substance" at the

1st Annual BoE Programming Contest
.

The logic might give you some ideas.

--------------------
All that we see, or seem, is but a dream within a dream.

Visit the Louvre, the BoA Graphics Database at http://www.personal.psu.edu/bxb11/boa/louvre/
Visit Alexandria, the BoE Scenario Database at http://www.personal.psu.edu/bxb11/boe/alexandriajs/
Posts: 653 | Registered: Thursday, September 27 2001 07:00
Warrior
Member # 250
Profile #8
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.

[ Thursday, August 05, 2004 04:50: Message edited by: Linthar ]
Posts: 61 | Registered: Saturday, November 3 2001 08:00
Lifecrafter
Member # 4682
Profile #9
Using the special item idea, what if when you got water, you had a penelty for what you could carry. It's probably more work than what it's worth, but it's an idea.

--------------------
Do not underestimate the power of the mechanical pencil.

Join the Dark side. We have cookies.

Played in:
Fiddler on the Roof
Bye Bye Birdie

"Hey, Patrick, feel this random pipe. It's squishy"-Nils
Posts: 834 | Registered: Thursday, July 8 2004 07:00
Off With Their Heads
Member # 4045
Profile Homepage #10
Just FYI, some people never rest. I don't, for one.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Shake Before Using
Member # 75
Profile #11
I was still resting in VoDT. Then I realized that it's sort of useless in most cases. :P
Posts: 3234 | Registered: Thursday, October 4 2001 07:00
Mongolian Barbeque
Member # 1528
Profile #12
Dang blast it! I was going to use this idea of water depletion in the desert in my scenario! And I'd started planning this over a year ago!
Posts: 907 | Registered: Monday, July 15 2002 07:00
Shake Before Using
Member # 75
Profile #13
Water depletion was first done in Spidweb games with Destiny of the Spheres for BoE, anyway.
Posts: 3234 | Registered: Thursday, October 4 2001 07:00
Infiltrator
Member # 148
Profile #14
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.

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;


[ Thursday, August 05, 2004 12:11: Message edited by: Dahak ]

--------------------
My ego is bigger than yours.
Posts: 480 | Registered: Thursday, October 11 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #15
If I understand your code correctly, there is no need to use SDFs. The call tick_difference will keep track of the ticks anyway.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Infiltrator
Member # 148
Profile #16
I never read the whole appendix. I've been focusing on the graphics side of things. I wrote the code after a quick 5 minutes of searching the document.

--------------------
My ego is bigger than yours.
Posts: 480 | Registered: Thursday, October 11 2001 07:00
Mongolian Barbeque
Member # 1528
Profile #17
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.
Posts: 907 | Registered: Monday, July 15 2002 07:00
Warrior
Member # 1250
Profile #18
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.
Posts: 93 | Registered: Saturday, June 1 2002 07:00
Infiltrator
Member # 148
Profile #19
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...)

[ Saturday, August 14, 2004 12:40: Message edited by: Dahak ]

--------------------
My ego is bigger than yours.
Posts: 480 | Registered: Thursday, October 11 2001 07:00
Warrior
Member # 1250
Profile #20
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.)
Posts: 93 | Registered: Saturday, June 1 2002 07:00
Off With Their Heads
Member # 4045
Profile Homepage #21
Here we go. Streamlined code, written in Lyceum format.

// 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;


[ Wednesday, August 18, 2004 14:34: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Infiltrator
Member # 148
Profile #22
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.

--------------------
My ego is bigger than yours.
Posts: 480 | Registered: Thursday, October 11 2001 07:00
Off With Their Heads
Member # 4045
Profile Homepage #23
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.

[ Wednesday, August 18, 2004 14:35: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Warrior
Member # 1250
Profile #24
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?
Posts: 93 | Registered: Saturday, June 1 2002 07:00

Pages