Ask a simple question, get a simple answer

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
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

Vanilla functions, done on the first screen after you select a dungeon toy play
Click "import party" and select a save file from another session.
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

...with the exception that no imported party has any equipment...
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Re: Ask a simple question, get a simple answer

Post by Mysterious »

Yes I know you can import a party that's not what I was looking for and as Thom said no equipment. I have played a Mod here or steam where the Author tells you to save a game with a certain name for the next part of his mod.

There has to be away surely?
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

I'm not aware of any mod that does that, but I went over how to do it here.
minmay wrote:No.

However, you can abuse the party import feature to store arbitrary information. E.g. use Champion:setName() to encode all champions' inventories, game statistics, and whatever else you want to transfer, then have the player import the party into the next mod. I tested with a 1 MB name and it saved and loaded just fine, so there is plenty of space available. So if you want players to be able to go back and forth between two or more dungeons and have arbitrary persistence, it can be done. Whether this would actually be a good design is debatable, however.
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
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Re: Ask a simple question, get a simple answer

Post by Mysterious »

Ty for the information on Loading a game into a new mod ahh well :(

Ok I can do: GameMode.setGameFlag("DisableMovement",true) no problem but, is there a way to Disable the Mouse Pointer? I have read the Bloggs etc... and have not found anything unless I missed it.
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

Code: Select all

GameMode.getGameFlag(flag) 
(possible flags are PauseGame, HideGui, DisableMovement, DisableMouseLook, DisableMonsterAI and DisableKeyboardShortcuts)

Code: Select all

GameMode.setEnableControls(boolean)
If enable controls is false, then the player cannot move, use mouse look, pick up or throw items using the mouse, open or close champion windows, or use keyboard shortcuts in general. The player can freely interact with champion windows that are already open.

Have a look here.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
lostsol
Posts: 86
Joined: Mon Apr 02, 2018 4:51 pm

Re: Ask a simple question, get a simple answer

Post by lostsol »

Hello,

I am nearing completion of a mod and looking for some help on a few scripting questions.

Health / Energy Regeneration: What is the proper way to prevent regeneration completely? I have tried several methods, I can't look at my script right now but the closest I have come is by using a trait with a recomputeStat hook that modifies regeneration rate by -100. While this greatly slows regeneration, it does not stop it like it would with certain injury conditions.

Also on conditions: Does anyone have the definitions for the conditions? I know how to make new ones but I would like to see the existing ones and just slightly adjust them.

Reload Firearm Secondary Action: I would like for this action to use ammo from the inventory instead of the hand. I could probably figure out a way eventually, but I thought I'd throw it out there in case someone knew a simple way to do this or already has a script for it and is willing to share.

Thanks !
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 »

lostsol wrote: Health / Energy Regeneration: What is the proper way to prevent regeneration completely? I have tried several methods, I can't look at my script right now but the closest I have come is by using a trait with a recomputeStat hook that modifies regeneration rate by -100. While this greatly slows regeneration, it does not stop it like it would with certain injury conditions.
Can you post the code you are using in your trait's onRecomputeStatistics hook?
If your regen rates do not completely stop it is likely you are not using the champ's actual regeneration rates...
For an example of what I mean - this hidden trait removes all the attribute based element resistance bonuses a champion recieves -after- party creation
SpoilerShow

Code: Select all

defineTrait{
	name = "correct_resistance",
	uiName = "Correct Resistance",
	iconAtlas = "mod_assets/textures/gui/blank_borders/blank64x80.tga",
	icon = 0,
	hidden = true,
	description = "",
	onRecomputeStats = function(champion, level)
		if level > 0 then
			local statResTab = {strength = "fire", dexterity = "shock", vitality = "poison", willpower = "cold"}
			for k,v in pairs(statResTab) do
				local currStat = champion:getCurrentStat(k)
				local diff = currStat - 10
				if diff >= 1 then	
					champion:addStatModifier("resist_"..v, - (diff * 2))
				end
			end
		end
	end,
}
lostsol wrote: Also on conditions: Does anyone have the definitions for the conditions? I know how to make new ones but I would like to see the existing ones and just slightly adjust them.
Not exactly at the moment - I am currently re-implementing the original conditions (AND their menu / attack panel Gui effects :roll: ) and am happy to repost these defs once finished
lostsol wrote: Reload Firearm Secondary Action: I would like for this action to use ammo from the inventory instead of the hand. I could probably figure out a way eventually, but I thought I'd throw it out there in case someone knew a simple way to do this or already has a script for it and is willing to share.
You will likely need to re-implement the effects of the RelaodFirearmComponent .... Ive got nothing to help here unfort :|
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

lostsol wrote:Hello,
Also on conditions: Does anyone have the definitions for the conditions? I know how to make new ones but I would like to see the existing ones and just slightly adjust them.
https://github.com/JKos/log2doc/wiki/As ... ditiondesc
lostsol
Posts: 86
Joined: Mon Apr 02, 2018 4:51 pm

Re: Ask a simple question, get a simple answer

Post by lostsol »

akroma222 wrote:
lostsol wrote: Health / Energy Regeneration: What is the proper way to prevent regeneration completely? I have tried several methods, I can't look at my script right now but the closest I have come is by using a trait with a recomputeStat hook that modifies regeneration rate by -100. While this greatly slows regeneration, it does not stop it like it would with certain injury conditions.
Can you post the code you are using in your trait's onRecomputeStatistics hook?
If your regen rates do not completely stop it is likely you are not using the champ's actual regeneration rates...
For an example of what I mean - this hidden trait removes all the attribute based element resistance bonuses a champion recieves -after- party creation
SpoilerShow

Code: Select all

defineTrait{
	name = "correct_resistance",
	uiName = "Correct Resistance",
	iconAtlas = "mod_assets/textures/gui/blank_borders/blank64x80.tga",
	icon = 0,
	hidden = true,
	description = "",
	onRecomputeStats = function(champion, level)
		if level > 0 then
			local statResTab = {strength = "fire", dexterity = "shock", vitality = "poison", willpower = "cold"}
			for k,v in pairs(statResTab) do
				local currStat = champion:getCurrentStat(k)
				local diff = currStat - 10
				if diff >= 1 then	
					champion:addStatModifier("resist_"..v, - (diff * 2))
				end
			end
		end
	end,
}
Hi Akroma, thank you for your reply.

Here is what I'm working with:
SpoilerShow

Code: Select all

defineTrait{
     name = "no_regen",
     uiName = "",
     icon = 0,
     description = "",
     hidden = true,
     onRecomputeStats = function(champion, level)
          if level > 0 then
               champion:addStatModifier("energy_regeneration_rate", -100)
               champion:addStatModifier("health_regeneration_rate", -100)
         end
     end,
}
Also, I did not mention this in my original post. Focusing on Energy, with a Willpower attribute score of 10, this function works perfectly. Below 10 and the champion actually slowly loses energy. Beyond 10 and regeneration starts happening again, although at a very slow rate, like 1 point every 1-2 minutes. I really, really hope I'm doing something boneheaded here..
Post Reply