Page 279 of 396

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 03, 2019 11:34 am
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)?

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 03, 2019 12:40 pm
by Pompidom
I will apply all possible ways and export my mod and let you know.

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 03, 2019 1:28 pm
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

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 04, 2019 12:06 pm
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

Re: Ask a simple question, get a simple answer

Posted: Tue Feb 05, 2019 12:16 am
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 :)

Re: Ask a simple question, get a simple answer

Posted: Tue Feb 05, 2019 7:11 pm
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...

Re: Ask a simple question, get a simple answer

Posted: Tue Feb 05, 2019 7:33 pm
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.

Re: Ask a simple question, get a simple answer

Posted: Tue Feb 05, 2019 7:35 pm
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!

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 07, 2019 11:30 pm
by Zo Kath Ra
How does BrainComponent:dropItemOn(string, string) work?

Re: Ask a simple question, get a simple answer

Posted: Fri Feb 08, 2019 12:35 am
by Pompidom
That reminds me. I haven't dabbled into scripted monster movement yet :)
Are there example dungeon editor files i can use?