Regen/hunger/"game over" questions (WAS Altering Playr Coold

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Regen/hunger/"game over" questions (WAS Altering Playr Coold

Post by SpiderFighter »

(PLEASE NOTE: Thread was originall titled: "[QUESTION] Altering Player Cooldown?" I just didn't want to throw more threads up on the board, when all of my questions involve altering the party setup in some way.)

[Original post:] Is it possible to alter the length of time it takes for the player character to cooldown after an attack, or is this hard-coded into the game?
Last edited by SpiderFighter on Wed Nov 14, 2012 9:07 pm, edited 3 times in total.
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: [QUESTION] Altering Player Cooldown?

Post by cromcrom »

Its coded into the various weapons definitions. However, I believe it is hardcoded.
A trip of a thousand leagues starts with a step.
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: [QUESTION] Altering Player Cooldown?

Post by msyblade »

Im pretty sure you can define a weapon instead of clone it, and just set the "coolDownTime = " to whatever you like. Look at examples in the items.lua asset to get an idea of what you want.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Re: [SOLVED] Altering Player Cooldown?

Post by SpiderFighter »

Thanks guys! It never occured to me to check the weapons...that did the trick nicely.
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Regen/hunger/"game over" questions (WAS Altering Playr Coold

Post by SpiderFighter »

I've hit a couple more potential roadblocks, so I'm going to lay this all out on the table.

I've come up with an idea for a mod that I think would be pretty fun and a bit different, but it all hinges on getting the player character setup correctly from the start. If certain qualities aren't met, the entire mod would become pointless. Being the kinesthetic learner that I am, I'm having a difficult time working my way through threads like viewtopic.php?f=14&t=3201 and getting anything in return except errors, so I'm hoping someone out there will be able to help with some answers.

First, I need to ensure the character (there is only one, and I already have him setup correctly), never regenerates health on his own. If there isn't a way to turn off regereation, is there a way to start the game off immediately hungry? I have no need for food in this mod, and being hungry should produce the effect I need (in that he won't regenerate health without potions or a healing crystal). I see in the assets that there is a way to call Energy Regeneration Rate and Food Consumption Rate, but I'm not sure about a global call function for these, nor how to actually script such a thing.

Second, I need the game to not end. If the player reaches zero HP, I need to be able to teleport him back to an earlier level (if that's hard-coded, as I suspect it is, maybe there's a way to do this if the player reaches 1 hp?).

There are a couple more things that need to be worked out, but these would be the game-breakers. If these can be worked out, then I think the rest can be managed. I'd definitely like to take a partner on in this (who knows lua). If anyone is interested, please PM me and I'll tell you exactly what I'm working on (and can send you the source files if you're interested). Once these few things are written, nothing new should pop up.

Please forgive my covertness; I simply don't want to shout this thing out if it's not possible.

[EDIT to add: I realized after re-reading this that Energy Regeneration Rate is moot; my concern is health regeneration.]
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Regen/hunger/"game over" questions (WAS Altering Playr C

Post by Xanathar »

If there isn't a way to turn off regereation, is there a way to start the game off immediately hungry?
You can also set him as diseased with an unbelievably high duration and reset his disease from time to time (say, check that he's diseased and set so otherwise in onTurn and onMove party hooks - just to prevent healing crystals to heal the disease). If you want to go the food route, there is champion:consumeFood, but I never used it.
If the player reaches zero HP, I need to be able to teleport him back to an earlier level (if that's hard-coded, as I suspect it is, maybe there's a way to do this if the player reaches 1 hp?).
Maybe in the onDie party hook, you can return false (to prevent death, this would heal him completely afaik) and teleport him where you want (you can use my teleporter script : viewtopic.php?f=14&t=3764)

If you need more help revealing details, PM me :)
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Re: Regen/hunger/"game over" questions (WAS Altering Playr C

Post by SpiderFighter »

Xanathar wrote:
If there isn't a way to turn off regereation, is there a way to start the game off immediately hungry?
You can also set him as diseased with an unbelievably high duration and reset his disease from time to time (say, check that he's diseased and set so otherwise in onTurn and onMove party hooks - just to prevent healing crystals to heal the disease). If you want to go the food route, there is champion:consumeFood, but I never used it.
If the player reaches zero HP, I need to be able to teleport him back to an earlier level (if that's hard-coded, as I suspect it is, maybe there's a way to do this if the player reaches 1 hp?).
Maybe in the onDie party hook, you can return false (to prevent death, this would heal him completely afaik) and teleport him where you want (you can use my teleporter script : viewtopic.php?f=14&t=3764)

If you need more help revealing details, PM me :)
Thanks Xanathar; I appreciate your time. I'm hoping their is a cleaner way to do this than to have to go the diseased route. I'm sure there's a way to access health regeneration, just not sure how yet. :)

That teleporter script is interesting...I actually had that one pretty well figured out (but a bit differently than your setup), but the trick was in how to tie that it dwindling HP. My problem is that my creativity is always ten steps ahead of my ability! :D

Well, the maps are underway at least. I have to clone pretty much everything in the game with new stats, so that will keep me busy for a while, as well.
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: Regen/hunger/"game over" questions (WAS Altering Playr C

Post by cromcrom »

I'm sure there's a way to access health regeneration, just not sure how yet.
I already foraged into this, I wouldn't be so sure if I were you, although I would love to be proved wrong. The best I could come with was to damage the champion every x seconds, so that its health wouldn't regen, but it's far from convenient.
A trip of a thousand leagues starts with a step.
Ancylus
Posts: 50
Joined: Thu Oct 11, 2012 5:54 pm

Re: Regen/hunger/"game over" questions (WAS Altering Playr C

Post by Ancylus »

You can make a character instantly hungry with champion:modifyFood(-1000).

Another alternative is to manage health directly. A bit of experimentation showed that regeneration happens in increments of 0.2 or 0.4, at intervals of no less than one second. Thus, the following script should work, with checkHealth called from a timer with an interval of around 0.5 divided by the number of levels in the dungeon (to account for slower updates of distant levels).

Code: Select all

ord = party:getChampion(1):getOrdinal()
true_hp = party:getChampion(1):getStatMax("health")

function checkHealth()
	local champion
	for i = 1, 4 do
		champion = party:getChampion(i)
		if champion:getOrdinal() == ord then
			break
		end
	end
	
	local hp = champion:getStat("health")
	if hp == true_hp + 0.2 or hp == true_hp + 0.4 then
		champion:setStat("health", true_hp)
	else
		true_hp = hp
	end
end
Two problems are that other sources of healing that work in those increments are also nullified, and a tick of regen can get through if the champion is simultaneously damaged or healed. A faster timer makes the second one less likely to occur, though. I could probably fix those issues if needed, though it would make the script rather more cumbersome.
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Re: Regen/hunger/"game over" questions (WAS Altering Playr C

Post by SpiderFighter »

Ancylus wrote:You can make a character instantly hungry with champion:modifyFood(-1000).
That's it! That's exactly what I was looking for. And it has the added bonus of not being affected by healing crystals. Thanks, Ancylus...this is now starting to look possible.

@cromcrom (your name always cracks me up for some reason :) ): Modifying the food like above will ensure your champion does not regen health. Handy, that!
SpiderFighter wrote:Second, I need the game to not end. If the player reaches zero HP, I need to be able to teleport him back to an earlier level (if that's hard-coded, as I suspect it is, maybe there's a way to do this if the player reaches 1 hp?).
Now all I need to do is figure this part out, and it's a go.
Post Reply