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!
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Leaving the line out will make it inherit its minimalSaveSate value from its baseObject (if any). Perhaps you defined base_door with minimalSaveState = true?
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
Lorial
Posts: 91
Joined: Sat Dec 29, 2018 12:27 pm

Re: Ask a simple question, get a simple answer

Post by Lorial »

minmay wrote: Sun Jan 24, 2021 8:28 am Leaving the line out will make it inherit its minimalSaveSate value from its baseObject (if any). Perhaps you defined base_door with minimalSaveState = true?
No, I did not define the base_door nor gratings or any other base game object so it should all refer to the original ones. The code below is directly taken from the asset pack which I now copy&pasted to manually define it for the mod. Not sure if this will suffice, though.

The aforementioned gates and alcoves were set to "minimalSaveState = true" once which caused the issues, however, the lines are removed and the problem solved with these. The question is why any door/fence/grate works as intended without the minimalSaveState added or manually added definitions for the base objects while this particular one does not.

If the line "secretDoor = true" were the problem (not manually defined as its own object), wouldn't all secret doors from other tile sets close themselves upon re-entering levels as well?

Code: Select all

defineObject{
	name = "forest_ruins_secret_door",
	baseObject = "base_door",
	components = {
		{
			class = "Model",
			model = "assets/models/env/forest_ruins_wall_02.fbx",
			staticShadow = true,
		},
		{
			class = "Door",
			openVelocity = 1,
			closeVelocity = -1,
			openingDirection = "down",
			maxHeight = 2.88,
			killPillars = false,
			secretDoor = true,
			openSound = "wall_sliding",
			closeSound = "wall_sliding",
			lockSound = "wall_sliding_lock",
		},
	},
	editorIcon = 120,
	automapIcon = -1,
}
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

Quick Question: Is there a way to scale a model ingame ?
User avatar
7Soul
Posts: 209
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul »

kelly1111 wrote: Sun Jan 24, 2021 11:31 am Quick Question: Is there a way to scale a model ingame ?

Code: Select all

local m = entity:getWorldRotation()
local scale = 0.5
m.x = m.x * scale
m.y = m.y * scale
m.z = m.z * scale
m.w = m.w * scale
entity:setWorldRotation(m)
If the entity has animations though, this wont work most of the time
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
User avatar
ratman
Posts: 159
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman »

7Soul wrote: Sun Jan 24, 2021 3:25 pm
kelly1111 wrote: Sun Jan 24, 2021 11:31 am Quick Question: Is there a way to scale a model ingame ?

Code: Select all

local m = entity:getWorldRotation()
local scale = 0.5
m.x = m.x * scale
m.y = m.y * scale
m.z = m.z * scale
m.w = m.w * scale
entity:setWorldRotation(m)
If the entity has animations though, this wont work most of the time
Does this work on items? (I've noticed if you shrink an altar the items on it shrink as well!)
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

7Soul wrote: Sun Jan 24, 2021 3:25 pm
kelly1111 wrote: Sun Jan 24, 2021 11:31 am Quick Question: Is there a way to scale a model ingame ?

Code: Select all

local m = entity:getWorldRotation()
local scale = 0.5
m.x = m.x * scale
m.y = m.y * scale
m.z = m.z * scale
m.w = m.w * scale
entity:setWorldRotation(m)
If the entity has animations though, this wont work most of the time
Thanks alot
User avatar
ratman
Posts: 159
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman »

In my mod the scrolls are a one-time use to cast a powerful spell, like a scroll of meteor storm, but when I use the champion:castSpell function, it takes away energy and requires the champion to have the skill levels for the actual spell. So I tried defining my own meteor storm with no requirments and energy cost of zero, but whatever I put the gesture as, the party can cast it even if it is set to hidden. So I tried with the gesture as zero, and the spell just fizzles and this would never work with multiple scrolls because they would all summon the same spell. So how would I either make a spell that the party can't cast, or make the base meteor storm spell have no requirements but only for the scroll?
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 »

ratman wrote: Sat Jan 30, 2021 4:45 pm ...but whatever I put the gesture as, the party can cast it even if it is set to hidden.
Use a valid, but impossible gesture.

eg. "12321"

Code: Select all

defineSpell{
	name = "spell_scroll_meteor_storm",
	uiName = "Scroll of Meteor Storm",
	gesture = 12321,
	manaCost = 0,
	onCast = "meteorStorm",
	skill = "fire_magic",
	icon = 99,
	hidden = true,
	spellIcon = 8,
	description = "Unleashes a devastating storm of meteors on your foes.",
}

defineObject{
	name = "spell_scroll_meteor_storm",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/scroll.fbx",
		},
		{
			class = "Item",
			uiName = "Scroll of Meteor Storm",
			gfxIndex = 112,
			weight = 0.1,
		},	
		{
			class = "UsableItem",
			uiName = "Scroll of Meteor Storm",
			onUseItem = function(self, champion) champion:castSpell(12321) end,
		},	
	},
}
User avatar
ratman
Posts: 159
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman »

is there a relatively easy way to make a sky object so that it is the orange-ish color like at sunrise and sunset the whole day, but still has a nightime?
User avatar
Cerv
Posts: 2
Joined: Tue Feb 16, 2021 6:38 pm

Re: Ask a simple question, get a simple answer

Post by Cerv »

Hello all,
I am new in modding here and have to say you are doing great jobs with all the advices and tutorials. There is my question. Is there any call I can make inside of game to outside? Reason is simple. I did made shop to my mod and want to know if I can put table with shop items outside of dat file...
This is first question, but i am afraid lot more will follow...

Cerv
Post Reply