Page 314 of 396

Re: Ask a simple question, get a simple answer

Posted: Sat Jun 15, 2019 3:00 pm
by Zo Kath Ra
Khollik wrote: Sat Jun 15, 2019 12:22 pm I'm trying to create a new item which produces light only in one direction (like a torchlight).
Just off the top of my head, I'd say:
You need to set the light's type
type = "spot",

Also:
viewtopic.php?f=22&t=14711&p=110343#p110343

Re: Ask a simple question, get a simple answer

Posted: Sat Jun 15, 2019 3:23 pm
by Pompidom
if anyone manages to create a beam of light that spreads out in the distance like a flashlight, that would be ace.

I'm looking for something like this to make a beam for my lighthouse in my docks and then attach a movement script to it.

Re: Ask a simple question, get a simple answer

Posted: Sat Jun 15, 2019 5:38 pm
by Khollik
Thanks Zo Kath Ra for redirecting me to Minmay's post, that worked EXACTLY as I wanted!!

Code: Select all

{
			class = "Light",
			type = "spot",
			range = 12,
			color = vec(1.3, 0.68, 0.35),
			brightness = 8,
			spotAngle = 60,
			spotSharpness = 0.4,
			castShadow = true,
			staticShadows = true,
			destroyObject = true,
			shadowMapSize = 256,
			offset = vec(0, 1.5, -0.4),
			onUpdate = function(self)
				local noise = math.noise(Time.currentTime()*3 + 123) * 0.5 + 0.9
				self:setBrightness(noise * 6)
			end,
		},
I kept the variation of the noise for the cool atmosphere it gives :geek:

Re: Ask a simple question, get a simple answer

Posted: Sun Jun 16, 2019 11:55 pm
by Pompidom
Is it possible to create an object from this? And can anyone post the defineObject code then?

Re: Ask a simple question, get a simple answer

Posted: Mon Jun 17, 2019 4:43 pm
by Khollik
Hello actually adding the "light" component to the "party" object wasn't the most difficult part:

Code: Select all

defineObject{
	name = "party",
	baseObject = "party",
	components = {
		{
		class = "Party",
		
		onDrawGui = function(party, g)
					
		end,  			

		{
			class = "Light",
			type = "spot",
			range = 12,
			color = vec(1.3, 0.68, 0.35),
			brightness = 8,
			spotAngle = 60,
			spotSharpness = 0.4,
			castShadow = true,
			staticShadows = true,
			destroyObject = true,
			shadowMapSize = 256,
			offset = vec(0, 1.5, -0.4),
			onUpdate = function(self)
				local noise = math.noise(Time.currentTime()*3 + 123) * 0.5 + 0.9
				self:setBrightness(noise * 6)
			end,
		},
	  },
}

Re: Ask a simple question, get a simple answer

Posted: Thu Jun 27, 2019 8:32 pm
by Zo Kath Ra
From assets/scripts/monsters/wizard.lua in the Asset Pack:
for i=-1,1,2 do
obj.brain:performAction("warp", x, y, i + 2)

What is the 3rd parameter?
My guess would be movement speed, but I'm not sure.

Re: Ask a simple question, get a simple answer

Posted: Fri Jun 28, 2019 12:42 am
by minmay
It's the direction of the edge extrusion visual effect.

Re: Ask a simple question, get a simple answer

Posted: Tue Jul 02, 2019 9:45 pm
by Badgert
Good day!
Today I ran into such a problem -
"preview: 97556: main function has more than 65536 constants
stack traceback:"
What does it mean? Is it possible to continue working on the mod somehow or is this the limiting limitation of the file?
Help!!!

Re: Ask a simple question, get a simple answer

Posted: Wed Jul 03, 2019 11:57 am
by kelly1111
badgert. what were you doing that caused this problem ?

Re: Ask a simple question, get a simple answer

Posted: Wed Jul 03, 2019 5:42 pm
by Zo Kath Ra
Badgert wrote: Tue Jul 02, 2019 9:45 pm Good day!
Today I ran into such a problem -
"preview: 97556: main function has more than 65536 constants
stack traceback:"
What does it mean? Is it possible to continue working on the mod somehow or is this the limiting limitation of the file?
Help!!!
1.
Have you googled, duckduckgoed or even binged:
main function has more than 65536 constants

Can't say I understand any of the explanations, though.

2.
Are you using the 4 GB patch?
(just putting this out here so that someone will come and say "this has nothing to do with the 4 GB" and then proceed to explain what it does have to do with)

3.
I wonder if this is caused by tables you've defined yourself, or by the maps in your dungeon, or something else entirely.
Are they all 32x32?
How many maps are there?