Page 316 of 396

Re: Ask a simple question, get a simple answer

Posted: Fri Jul 12, 2019 9:35 pm
by kelly1111
Does anyone have some custum particles that look like foam from a waterfall.. of fog around a waterfall ?
And are they willing to share the code?

Re: Ask a simple question, get a simple answer

Posted: Sat Jul 13, 2019 6:22 pm
by Skuggasveinn
kelly1111 wrote: Fri Jul 12, 2019 9:35 pm Does anyone have some custum particles that look like foam from a waterfall.. of fog around a waterfall ?
And are they willing to share the code?
Have you checked this out ?
https://www.nexusmods.com/legendofgrimrock2/mods/111

It's just the smoke particle reused where the waterfalls hits the river.
Perhaps you had something more specific in mind ?

kind regards.
Skuggasveinn.

Re: Ask a simple question, get a simple answer

Posted: Tue Jul 16, 2019 11:03 pm
by Zo Kath Ra
What values am I allowed to pass as parameters to delayedCall(receiver, delay, msg) ?

Script entity:

Code: Select all

function test(a, b, c, d)
	print(a, b, c, d)
	delayedCall(self.go.id, 1, "test", nil, nil, nil, true)
end

delayedCall(self.go.id, 1, "test", true, true, true, true)
When "test" is called for the first time, it correctly prints:
true true true true

When "test" is called for the second time, it should print:
nil nil nil true

But it prints:
nil nil nil nil

Re: Ask a simple question, get a simple answer

Posted: Tue Jul 16, 2019 11:49 pm
by Isaac
AFAIK it should just be strings, booleans and numbers; no vectors, or tables—no objects.

Code: Select all

function test(...)
	print(...)
	delayedCall(self.go.id, 1, "test", ...)
end

test(1,2,3,true, false,'six', 'seven', tostring(8) + tonumber("8"), 0xff12e4, 3.1415926535, starting_location_1.id)

Re: Ask a simple question, get a simple answer

Posted: Thu Jul 18, 2019 4:18 pm
by ders360
Is there a limit to how big your mod is
Like the size of the world or number of entitys and tiles

Re: Ask a simple question, get a simple answer

Posted: Thu Jul 18, 2019 7:00 pm
by Isaac
I think [? —read this somewhere here, a couple of days ago] that it might have a maximum of 65536 objects on a map.

As far as size goes... many hundred megabyte maps will work fine, but in practice... any Grimrock mod intended to be released on Steam needs to be around 98 MB at the most.

Re: Ask a simple question, get a simple answer

Posted: Thu Jul 18, 2019 11:33 pm
by minmay
You could have more than 65536 objects on a map, although the performance would be horrible. What you can't have is more than 65536 constants in a Lua function, including the main function of your dungeon.lua. This does effectively limit the number of objects you can place in the editor, since each object has a unique id, though in practice this limit is going to be somewhat lower than 65536 since ids aren't the only unique strings and numbers in the dungeon.lua.

However, this does not limit the number of objects you can create by other means; if you run into this issue you can just move some spawn() calls from your dungeon.lua to another file and use it as an external ScriptComponent script. You could even manually split your dungeon.lua into multiple functions, but that is not very practical since the dungeon editor will just overwrite it.

Re: Ask a simple question, get a simple answer

Posted: Sat Jul 20, 2019 12:48 am
by Zo Kath Ra

Code: Select all

defineObject{
	name = "seeking_fireball",
	baseObject = "fireball_large",
	components = {
		{
			class = "Projectile",
			spawnOffsetY = 1.5,
			velocity = 5,
			radius = 0.1,
			collisionMask = bit.bor(2^4, 2^0), -- Collide with seeking_fireball_spinner (bit 4) and everything else (bit 0)
			destroyOnImpact = false,
			onProjectileHit = function(self, what, entity)
				seeking_fireball_script.script.onProjectileHit(self, what, entity)
			end,
		},
	},
}
Calling a script entity function from ProjectileComponent.onProjectileHit(self, what, entity) works sometimes, and sometimes the mod crashes with the error "seeking_fireball_script is a nil value".

When I remove onProjectileHit from the definition and use this code to create the seeking_fireball, it always works:

Code: Select all

local seeking_fireball = spawn("seeking_fireball", casterEntity.level, casterEntity.x, casterEntity.y, casterEntity.facing, casterEntity.elevation, "seeking_fireball")
seeking_fireball.projectile:addConnector("onProjectileHit", self.go.id, "onProjectileHit")

Re: Ask a simple question, get a simple answer

Posted: Thu Jul 25, 2019 1:31 pm
by bongobeat
is that possible to play the same animation for 2 same model in this object?
SpoilerShow

Code: Select all

defineObject{
	name = "forest_spruce_sapling_pillar_2x1",
--	baseObject = "base_pillar",
	components = {
		{
			class = "Model",
			model = "assets/models/env/forest_spruce_sapling_02.fbx",
			staticShadow = true,
		},
		{
			class = "Animation",
			animations = {
				sway = "assets/animations/env/forest_spruce_sapling_02_idle.fbx",
			},
			playOnInit = "sway",
			loop = true,
		},
		{
			class = "Model",
			name = "pil2",
			model = "assets/models/env/forest_spruce_sapling_02.fbx",
			offset = vec(0, 0, -3),
			staticShadow = true,
		},
	},
	placement = "pillar",
	editorIcon = 108,
	minimalSaveState = true,
}

Re: Ask a simple question, get a simple answer

Posted: Thu Jul 25, 2019 4:00 pm
by Skuggasveinn
bongobeat wrote: Thu Jul 25, 2019 1:31 pm is that possible to play the same animation for 2 same model in this object?
yes but, offsetting a model doesn't offset the animation, so when the animation plays on the second model it will "jump" into the original position.
What you want is to offset the animation in blender and save it out for the second model.

kind regards.
Skuggasveinn.