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
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

zimberzimber wrote:I don't have the time to experiment with it right now, but can it fade in/out?
I don't think so, I never found a way to do it myself...
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 »

AndakRainor wrote:You can see the onTick is used to read values and store them until the next frame. The previous value is substracted to get only the value without the previous contribution of might. When it's time for the next frame, all stat modifiers are cleared and all recomputes are redone, and during that process, at any time, might gives the value stored from the previous frame. So you could say, might is always one frame late when a stat changes. It is still better than my previous 1 second refresh interval and when trying to give bonuses to champions that also depend on other present bonuses, I think it is logically the best thing you can do. Again because, unless I'm proven wrong, when all recomputes are done, it is too late to add another modifier.
Cheers!! I do like your way of managing this issue ;)
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

stat recompute order:
1. items in inventory from 1 to BackpackFirst-1 in order
2. conditions in undefined order (pairs)
3. skills in undefined order (pairs)
4. traits in undefined order (pairs)
applied after all onRecomputeStats are called:
- protection is rounded to the nearest integer
- leadership and nightstalker
- light and heavy armor penalties
- strength, dexterity, vitality, willpower bonuses to max load, evasion, health and health regen, energy and energy regen, resistances
- after strength/dexterity/vitality/willpower are applied, resistances are clamped between 0 and 100, health is clamped at max_health, energy is clamped at max_energy
- when resting, evasion is decreased by 100
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
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

What does Nightstalker do?
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

increases vitality by 5 when time of day >= 1, and decreases vitality by 5 otherwise
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
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

Is there a way to get the games resolution settings? (What resolution the user is using)
I have a GUI ready, and while it looks nice with my resolution, I doubt it will on any other.
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Are GraphicsContext.width and GraphicsContext.height not enough?
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
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

minmay wrote:Are GraphicsContext.width and GraphicsContext.height not enough?
Couldn't find a way to get that value and use it where I need it.
I'm using grimtk, and I'm trying to modify the pre-defined templates to take up % of the screen instead of a set value. These two:

Code: Select all

dialogueTopForm = {
	name = dialogueTopFormName,
	type = "GWindow",
	size = {836*0.75, 386},
	bgImage = "gtk-dialogue-top",
	bgDrawMode = GTK.Constants.ImageDrawMode.Stretched,
	gravity = GTK.Constants.Gravity.NorthWest,
	offset = {0, 10},
	layout = {
		type = "GBoxLayout",
		direction = GTK.Constants.Direction.Horizontal,
		gravity = GTK.Constants.Gravity.NorthWest,			
		spacing = {10, 8},
		margin = {30, 40, 30, 30}
	},	
	children = 
	{
		{
			name = "mainImageView", 
			type = "GImageView",
			image = "gtk-dialogue-top",
			drawMode = GTK.Constants.ImageDrawMode.ShrinkToBox,
			imageGravity = GTK.Constants.Gravity.NorthWest,
			size = {380, 340},
			minSize = {380, 340},
			maxSize = {770, 900},			
		},
		{
			name = "mainMessageLabel", 
			type = "GLabel",
			text = "",
			size = {380, 340},
			minSize = {380, 340},
			maxSize = {770, 900},
			font = GTK.Constants.Fonts.Medium,
		}
	}
}

dialogueBottomForm = {
	name = dialogueBottomFormName,
	type = "GWindow",
	bgImage = "gtk-dialogue-bottom",
	size = {836*0.75, 302},
	gravity = GTK.Constants.Gravity.SouthWest,
	offset = {0, -10},
	lockKeyboard = true,
	freezeAI = true,
	layout = {
		type = "GBoxLayout",
		direction = GTK.Constants.Direction.Vertical,	
		spacing = {8, 12},
		margin = {24, 24, 24, 24}
	},		
	children = 
	{	
		{
			name = "speakerContainer",
			type = "GWidget",
			position = {0, 0},
			size = {770*0.75, 92},
			bgImage = "gtk-dialogue-bottom-speaker-box",
			minSize = {770*0.75, 92},
			maxSize = {770*0.75, 92},
			layout = {
				type = "GBoxLayout",
				direction = GTK.Constants.Direction.Vertical,	
				spacing = {2, 2},
				margin = {2, 10, 2, 10}
			},				
			children = 
			{
				{
					name = "speakerLabel", 
					type = "GLabel",
					text = "[Speaker]",
					position = {5, 4},
					size = {750*0.75, 30},
					minSize = {750*0.75, 30},
					maxSize = {750*0.75, 30},
					font = GTK.Constants.Fonts.Large,
					textColor = {255, 192, 64, 255}
				},
				{
					name = "messageLabel", 
					type = "GLabel",
					text = "[Message]",
					position = {5, 38},
					size = {750*0.75, 48},
					minSize = {750*0.75, 48},
					maxSize = {750*0.75, 86},
					font = GTK.Constants.Fonts.Medium,
					textColor = {255, 192, 64, 255}
				},	
			}
		},
		{
			name = "responseContainer", 
			type = "GWidget",
			position = {34, 124},
			size = {780*0.75, 140},
			minSize = {780*0.75, 100},
			maxSize = {780*0.75, 100},
			layout = {
				type = "GBoxLayout",
				direction = GTK.Constants.Direction.Vertical,
				gravity = GTK.Constants.Gravity.SouthWest,			
				hideOverflow = true,
				spacing = {4, 4},
				margin = {4, 4, 4, 4}
			},
			children = 
			{ 
		
			}
		},				
	}
}
My asset pack [v1.10]
Features a bit of everything! :D
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 »

minmay wrote:stat recompute order:
Much appreciated minmay, thankyou 8-)
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

minmay wrote:stat recompute order:
1. items in inventory from 1 to BackpackFirst-1 in order
2. conditions in undefined order (pairs)
3. skills in undefined order (pairs)
4. traits in undefined order (pairs)
applied after all onRecomputeStats are called:
- protection is rounded to the nearest integer
- leadership and nightstalker
- light and heavy armor penalties
- strength, dexterity, vitality, willpower bonuses to max load, evasion, health and health regen, energy and energy regen, resistances
- after strength/dexterity/vitality/willpower are applied, resistances are clamped between 0 and 100, health is clamped at max_health, energy is clamped at max_energy
- when resting, evasion is decreased by 100
Do you know where traits onComputeCooldown, onComputeCritChance and onComputeAccuracy functions should appear in this ordered list?
Post Reply