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
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 »

Does this solution work for saving and reloading? Or is the new colour setting lost because of the minimalSaveState of the trees (in this example)?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I will apply all possible ways and export my mod and let you know.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

In all possible variations, the colors are indeed lost :)

Minimal savestate has to be disabled for the trees in the custom asset script file for the autumn and winter trees :)
And a define object has to be added for the original forest oak tree cluster

And I will probably just do that. The change in variation and overall looks is subtle but very nice to look at :)

EDIT: So I managed to put the autumn/winter trees on minimal savestate false.
I just need some help defining a new object for the default forest oak cluster so I can color them in as well.

Would this be the right way? :)

Code: Select all

defineObject{
	name = "forest_oak_cluster_color",
	baseObject = "base_obstacle",
	components = {
		{
			class = "Model",
			model = "assets/models/env/forest_oak_cluster.fbx",
			material = "forest_oak_cluster",
			dissolveStart = 2,
			dissolveEnd = 5,
			shadowLod = 1,
			staticShadow = true,
			--debugDraw = true,
			-- bounding box fix: automatically computed bounding box is too small because the model is built incorrectly
			-- (without skinning all the trees in the cluster are in one place)
			boundBox = { pos = vec(0, 5, 0), size = vec(8, 10, 8) },
		},
		{
			class = "Animation",
			animations = {
				sway = "assets/animations/env/forest_oak_cluster_idle.fbx",
			},
			playOnInit = "sway",
			loop = true,
			maxUpdateDistance = 5,
		},
	},
	editorIcon = 168,
	automapTile = "trees",
	minimalSaveState = false,
}
Edit2: deleting the material line did the trick
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 »

Alternatively...

Define this object, and place it on the map somewhere:

Code: Select all

defineObject{
	name = "touch_up_trigger",
	baseObject = "base_floor_decoration",
	minimalSaveState = true,
	components = {
		{
			class = "Null",
			onInit = function(self) 
			 if touch_ups and touch_ups.script and touch_ups.script.touchUps
			  then touch_ups.script:touchUps() end end,
		}
	}
}
For the example, add five forest_oak_clusters to the map.

Create a script_entity, and set the id to: touch_ups, and put your changes in the touchUps function.

Code: Select all

-- set id to touch_ups

function touchUps()
	--volatile changes
	
	forest_oak_cluster_1.model:setEmissiveColor(vec(-.025))
	forest_oak_cluster_2.model:setEmissiveColor(vec(-.01,-.005,-.05))
	forest_oak_cluster_3.model:setEmissiveColor(vec(0,0,-.01))
	forest_oak_cluster_4.model:setEmissiveColor(vec(-.025,-.01))
	forest_oak_cluster_5.model:setEmissiveColor(vec(-.01,-.025,-.06))
		 
end
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

That's even more helpful :)

All good stuff I can use to have a cleaner and more diversed look.

Next question,

A script to use Component:setOffset() and Component:setRotationAngles() based on Time.currentTime() so that my boats in my mod "animate" in sync with the water shader's waves.

it's an idea Minmay pitched a couple of years ago. And i'm quite interested in :)
User avatar
Curunir
Posts: 332
Joined: Fri Mar 30, 2012 11:19 pm

Re: Ask a simple question, get a simple answer

Post by Curunir »

Hey, guys! Been a while but I finally sat down to wrap up this mod I was making.

I dropped in four golden treasures from a G1 asset pack to have as a little extra treasure hunt.

However, I'm not sure how to keep track of how many of the items the player has collected across different maps. What would be the most sensible way to do this?

When trying to do this, I realized I really don't know how to track anything across levels...
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Easiest way: surface component to a counter.
As soon the treasure is picked up from a surface, the counter increases.
Make sure to .surface:disable() after the treasure has been picked up. You now have a tracker.

If you want to do it properly, Check out Minmay's DM example dungeon Artifacts of Might.
User avatar
Curunir
Posts: 332
Joined: Fri Mar 30, 2012 11:19 pm

Re: Ask a simple question, get a simple answer

Post by Curunir »

For some reason I had assumed counters don't work if you unload one level and load another, which is stupid because that's exactly how teleports work...

Thank you!
User avatar
Zo Kath Ra
Posts: 937
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

How does BrainComponent:dropItemOn(string, string) work?
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

That reminds me. I haven't dabbled into scripted monster movement yet :)
Are there example dungeon editor files i can use?
Post Reply