Water and thirst!

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
crisman
Posts: 305
Joined: Sat Sep 22, 2012 9:23 pm
Location: Italy

Water and thirst!

Post by crisman »

I'm working on thirsty and water stuff, and right now my party needs water from time to time, otherwise they dies. I also made a "temperature variable", you can set the "temperature" of a floor or various ambient, rooms and so on. Rise it and your party will sweat more, consuming more water :mrgreen:
I've made a fountain where you can fill flasks, and drink them. That is working like a charm - still need more testing thought.
But since flasks are a bit space consuming, I've created a gourd, where you can store more water!
Image
And you can use it! You can see the charges lowered.
Image

Right now the gourd is still buggy (actually it's working really fine, but consuming all the water in the gourd will not change it's icon, and right now I haven't scripted the refill yet)
I still have some work to do, for example I need a way to telling who's thirsty and whoi's not (thought I made a hudprint when water reaches some critical values), so I thought to make a list when hovering the mouse on the guard, but now I don't know how this can be accomplished yet.
I wanted to change the weight of the guard based on how much water contains. tried it but with no success.
And do some balancing. Right now, with lower-normal temperature (...) a party can survive 60 minutes wityhout touching water. in really hot places up to 36 minutes, cold places 72 minutes (are just example, but I really think I'll modify these times...)
I'll need some help on this tasks!
If you are interested let me know, I'll post something when I'll make some progress!
Lmaoboat
Posts: 359
Joined: Wed Apr 11, 2012 8:55 pm

Re: Water and thirst!

Post by Lmaoboat »

To show the thirst, you could have a scroll for each person, and modify the text with a variable for thirst, like:
thirstscroll1:setScrollText("Hydration: "..T.."%")
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Water and thirst!

Post by Batty »

Nice work!
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Water and thirst!

Post by Komag »

That's really cool, I like the concept if done right and not made too annoying or something :)
Finished Dungeons - complete mods to play
Lilltiger
Posts: 95
Joined: Sun Sep 16, 2012 1:12 am

Re: Water and thirst!

Post by Lilltiger »

you could also use it as an stacking item, like arrows, to handle the charges.
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: Water and thirst!

Post by Neikun »

Stacking would work better, because as charges, the item does not lose weight after use. :o
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
Kuningas
Posts: 268
Joined: Wed Apr 11, 2012 10:29 pm
Location: Northern Finland

Re: Water and thirst!

Post by Kuningas »

Or just make a different item for each charge, with a different weight. This doesn't sound too economic to me, though, and I know very little about the coding side.
BASILEUS
User avatar
crisman
Posts: 305
Joined: Sat Sep 22, 2012 9:23 pm
Location: Italy

Re: Water and thirst!

Post by crisman »

Stack is not a bad idea, but right now I'm a bit confused on how to manage it.
Well, I guess if I'm not able to come up with the stacking, I'll do what Kuningas suggested.
Why weight doesn't accept a simple equation, why? :roll:
Anyway my thirsty script should be fine now, I just need to test it a little bit and so some balancing. Even if right now I'm working on something else: when somone dies, it will lay down a skeleton, and must be brought to a special altar in order to be resurrected. I already did some script, and if you close an eye on some... 'small' flaws it's working fine :mrgreen:
Anyway, I also came up with an idea, like fallout: new vegas did:
Let the player choose whether or not thirsty is on/off! :mrgreen:
So everyone should be fine! ;)
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Water and thirst!

Post by LordGarth »

what is the actually script for thirst
Dungeon Master and DOOM will live forever.
User avatar
crisman
Posts: 305
Joined: Sat Sep 22, 2012 9:23 pm
Location: Italy

Re: Water and thirst!

Post by crisman »

Right now it's just an in-game timer linked to a script. I'll give you the script of thirst, and the water gourds script.
in game script - called needWater:
SpoilerShow
function waterLoss()

for i = 1, 4 do

if party:getChampion(i):isAlive() then
findEntity("water"..i):decrement()
end

if findEntity("water"..i):getValue() == 100 then
hudPrint(party:getChampion(i):getName(i).." is thirsty")
elseif findEntity("water"..i):getValue() == 20 then
hudPrint(party:getChampion(i):getName(i).." is really thirsty")
elseif findEntity("water"..i):getValue() == 0 then
hudPrint(party:getChampion(i):getName(i).." is dying of thirst")
elseif findEntity("water"..i):getValue() < 0 then
healthLoss(i)
end
end
end

function waterAdd(n)

local x = findEntity("water"..n):getValue()
w = findEntity("water"..n)

race = party:getChampion(n):getRace()

if race == "Human" then
w:setValue(x+18)
if w:getValue() > 144 then
w:setValue(144)
end
elseif race == "Minotaur" then
w:setValue(x+12)
if w:getValue() > 200 then
w:setValue(200)
end
elseif race == "Lizardman" then
w:setValue(x+37)
if w:getValue() > 250 then
w:setValue(250)
end
elseif race == "Insectoid" then
w:setValue(x+250)
if w:getValue() > 500 then
w:setValue(500)
end
end
end



function healthLoss(i)

party:getChampion(i):modifyStat("health", -(math.random()*10+1))
if findEntity("water"..i):getValue() <-5 then
findEntity("water"..i):setValue(-5)
end
end

function fill(item)

if item == "flask" then
smallFlask = spawn ("water_small_flask")
setMouseItem(smallFlask)
elseif item == "empty_gourd" or
item == "water_gourd" then
smallGourd = spawn ("water_gourd")
setMouseItem(smallGourd)
elseif item == "big_empty_gourd" or
item == "big_water_gourd" then
bigGourd = spawn ("big_water_gourd")
setMouseItem(bigGourd)
end
return false
end
water gourds
SpoilerShow
cloneObject{
name = "water_small_flask",
baseObject = "water_flask",
uiName = "Small Water Flask",
onUseItem = function(self, champion)
needWater.waterAdd(champion:getOrdinal())
playSound("consume_potion")
return true
end
}

cloneObject{
name = "empty_gourd",
baseObject = "flask",
uiName = "Empty Gourd",
weight = 0.3,
}

cloneObject{
name = "big_empty_gourd",
baseObject = "flask",
uiName = "Empty Big Gourd",
weight = 0.6,
}

defineObject{
name = "big_water_gourd",
uiName = "Big Water Gourd",
class = "Item",
model = "assets/models/items/flask.fbx",
emptyItem = "big_empty_gourd",
gfxIndex = 144,
charges = 12,
weight = 3.6,
onUseItem = function(self, champion)
if self:getCharges() > 1 then
needWater.waterAdd(champion:getOrdinal())
self:setCharges(self:getCharges()-1)
playSound("consume_potion")
return false
else
needWater.waterAdd(champion:getOrdinal())
playSound("consume_potion")

return true
end

end,

}

defineObject{
name = "water_gourd",
uiName = "Water Gourd",
class = "Item",
model = "assets/models/items/flask.fbx",
gfxIndex = 144,
emptyItem = "empty_gourd",
charges = 4,
weight = 1.3,
onUseItem = function(self, champion)
if self:getCharges() > 1 then
needWater.waterAdd(champion:getOrdinal())
self:setCharges(self:getCharges()-1)
playSound("consume_potion")
return false
else
needWater.waterAdd(champion:getOrdinal())
playSound("consume_potion")

return true
end

end,

}
The fountain
SpoilerShow
defineObject{
name = "water_fountain",
class = "Alcove",
model = "assets/models/env/wall_fountain.fbx",
placement = "wall",
replaceWall = false,
editorIcon = 92,
anchorPos = vec(0, 1, 0),
targetPos = vec(0, 1, 0),
targetSize = vec(0.2, 0.2, 0.2),
baseObject = "dungeon_alcove",
onInsertItem = function (self, item)
local bottle = item.name
if bottle == "flask" or
bottle == "empty_gourd" or
bottle == "water_gourd" or
bottle == "big_empty_gourd" or
bottle == "big_water_gourd" and
self:getItemCount() == 0 then
item:destroy()
needWater.fill(bottle)
end
end,


}
Should have copied everything.

How it works:
Every amount of time, the script decrement by 1 the value of 4 counters (one for each champions).
When the counter reaches the 0, the champion will suffer for dehidration, and will receive damage. The counter will continue to decrement until -5
The water will increase the value of the counter. The temperature stuff it's just a hidden pressure plate located in front of a stair, wich will modify the timer interval for every floor. If you are good in placing this plate you can also modify the 'temperature' just for certain rooms.
I've also made a racial aspect. Minotaurs will need a lot of water to quench their thirst, while a insectoid just need little water and will be enough for very long.
The only thing I haven't implemented is that touching the fountain will replenish the counters. I'll work on it later thought.
Note: all the values I gave are completly RANDOM, and I'll try to find a good balance for them.
the only thing I know is just Humans can survive 1h in normal condition without drinking...

How to make this works:
Create a timer and rename it thirsty1 - I'm pretty sure you can call this as you wish without modify the scripts. Timer interval = 25. Of course, this timer must be set to running.
Create four counter, and give it the name water1, water2, water3 and water4 with a starting value of whatever you want - 50 for esample -
Connect the timer to the script and run the function waterLoss()
Now your party should suffer water loss.
Place water fountain for fill your gourds - you can fill flasks too.
Hope I was clear! Otherwise ask me. If you find any issue or suggestions please tell me! :D
Also I'm looking for more thirsty description:
Thirsty
Really thirsty
Diyng of thirst
What else I can use?
Post Reply