[SCRIPT] Simple hunger system

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: [SCRIPT] Simple hunger system

Post by Isaac »

Not off hand, but have you tried this yet? (to inspect it)

Code: Select all

party.party:addConnector("onMove", self.go.id, "foodCounter")
function foodCounter()
	local values = {}
	for x = 1,4 do
		values[x] = tostring(party.party:getChampion(x):getFood())	
	end
	hudPrint(values[2].." | "..values[2].." | "..values[3].." | "..values[4])
end
Food is an activity limit.

**Actually... I'm not exactly clear on why they should receive damage... They should all be able to go for days (perhaps weeks) without food without dieing from it.
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: [SCRIPT] Simple hunger system

Post by AndakRainor »

With very moderate damage it could be days or weeks... If I remember correctly, health does not regenerates when starving ? To be realistic, I think dehydration is a more immediate danger than starvation, but this is a little off-topic :) (the dungeon master mod for grimrock 1 had a water system, I never tried that yet but would it be possible to do the same with grimrock 2 ?)
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: [SCRIPT] Simple hunger system

Post by minmay »

Food doesn't only change when moving or resting. It's also changed by attacks and spells, and PartyComponent.onAttack doesn't get called for unarmed attacks, so...
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: [SCRIPT] Simple hunger system

Post by Isaac »

minmay wrote:Food doesn't only change when moving or resting. It's also changed by attacks and spells, and PartyComponent.onAttack doesn't get called for unarmed attacks, so...
But it would still show up on the next step they make.
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: [SCRIPT] Simple hunger system

Post by AndakRainor »

Ok may be a time based system is good enough after all !
Or starving people who don't mind having a punch fight, seems like a not so bad drawback :P
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: [SCRIPT] Simple hunger system

Post by Eleven Warrior »

Awesome issac bloody awesome bro thxs for the code :) Yeah people can survive without food for roughly 2 weeks depending on body mass if I rem correctly lol. Water on the other hand is less.
Post Reply