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
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

:getResistance() expects an argument; it returns nil if there is no resistance to the given string.

Try:

Code: Select all

function onDamageMonster(self, damage, damageType)
	print(self:getResistance("poison"))
	print(self:getEvasion())
end
User avatar
7Soul
Posts: 209
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul »

Zo Kath Ra wrote: Sun Jan 06, 2019 10:15 pm getResistance() needs a string argument, even if the Scripting Reference doesn't say so
Isaac wrote: Sun Jan 06, 2019 10:18 pm :getResistance() expects an argument; it returns nil if there is no resistance to the given string.
Sweet! Thanks
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
User avatar
7Soul
Posts: 209
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul »

Hm I ran into another similar issue

I can't seem to get 'getPierce()' to work with thrown weapons. I added 50 pierce to the throwing knives and it works, but getPierce() returns the same error as if I try to use it on a missile weapon (which can't have pierce)

The scripting reference doesn't mention getPierce() for it but I've seen multiple forum posts saying it works so I must be doing something wrong

Stuff like getAttackPower() and getCooldown() works so the item reference is right

Image
the item definitionShow

Code: Select all

defineObject{
	name = "throwing_knife",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/knife.fbx",
		},
		{
			class = "Item",
			uiName = "Throwing Knife",
			gfxIndex = 47,
			impactSound = "impact_blade",
			stackable = true,
			sharpProjectile = true,
			weight = 0.5,
			projectileRotationSpeed = -20,
			projectileRotationX = 90,
			projectileRotationY = 90,
			traits = { "throwing_weapon" },
		},
		{
			class = "ThrowAttack",
			attackPower = 9,
			cooldown = 4,
			pierce = 50,
		},
	},
	tags = { "weapon", "weapon_throwing" },
}
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

It's not really possible to help you with your script error if you don't post the actual script.

Anyway, ThrowAttackComponent doesn't expose a getPierce() method to the user scripting interface. Anyone who said it does is just mistaken.
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.
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

I cant get this to work. See picture:
I want to create an indoor heightmap ... , why does the mine grass one work , and my own one not?
And where can I find the heightmapmaterial: swamp_ground_02 .... <- it is the only heightmap material reference thing I find in the scripts under tilesets folder of grimrock 2. why does the above one tile (used the beach ground material) and the other runs smooth?

Image

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

Can you post the tile definition?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

here is the definition

Basically what I want to achieve is a mine tileset with hightmap (indoors) but then with dungeon walls (Ill have to make the wall models taller) ... but as it is now , i cant get the floor to work like it should
SpoilerShow
defineTile{
name = "dm_floor_grass",
editorIcon = 192,
color = {50,140,50,255},
builder = "dungeon",
heightmapMaterial = "swamp_ground_02",
floor = {
"beach_ground_01", 1,
},
ceiling = {
"rock_cave_brown_ceiling_01", 1,
"rock_cave_brown_ceiling_02", 1,

},
wall = {
"dm_wall_01", 35,
},
pillar = {
"dm_pillar_stone_grunge_01", 1,
},
moveSound = "party_move_grass",
}
lostsol
Posts: 86
Joined: Mon Apr 02, 2018 4:51 pm

Re: Ask a simple question, get a simple answer

Post by lostsol »

A floor model won't play nice with the Heightmap. Try removing:
floor = { "beach_ground_01", 1, },
and change heightmapMaterial to any material you want.

I'm pretty sure that will work, don't know what effect this will have on your ceiling, pillars and walls though...
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

lostsol wrote: Thu Jan 10, 2019 12:41 am A floor model won't play nice with the Heightmap. Try removing:
floor = { "beach_ground_01", 1, },
and change heightmapMaterial to any material you want.

I'm pretty sure that will work, don't know what effect this will have on your ceiling, pillars and walls though...
It doesnt work. If I remove the beach ground it leaves me with a black void floor...

I cant seem to find out what the difference is between the two pictures ... why does it work with swamp grass but not with beach ground....
lostsol
Posts: 86
Joined: Mon Apr 02, 2018 4:51 pm

Re: Ask a simple question, get a simple answer

Post by lostsol »

I've had success with this in the past, and I can look into my stuff a bit later on, if you don't find a solution before then. In the meantime:

Try copying the forest ground tile definition and change the heightmapMaterial to the material you want to use. Make sure it is the name of a material (not an object) and make sure the material you are using is defined (defineMaterial). And of course, place a heightmap object on the level you are working on.

If all goes well, then try adding in the ceiling, pillar and wall to the definition.
Post Reply