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!
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post 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?
User avatar
Skuggasveinn
Posts: 562
Joined: Wed Sep 26, 2012 5:28 pm

Re: Ask a simple question, get a simple answer

Post 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.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
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 »

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

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)
ders360
Posts: 13
Joined: Thu Jul 11, 2019 7:29 pm

Re: Ask a simple question, get a simple answer

Post by ders360 »

Is there a limit to how big your mod is
Like the size of the world or number of entitys and tiles
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 »

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

Re: Ask a simple question, get a simple answer

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

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")
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Ask a simple question, get a simple answer

Post 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,
}
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
Skuggasveinn
Posts: 562
Joined: Wed Sep 26, 2012 5:28 pm

Re: Ask a simple question, get a simple answer

Post 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.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
Post Reply