Page 275 of 396

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 10:18 pm
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

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 10:35 pm
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

Re: Ask a simple question, get a simple answer

Posted: Mon Jan 07, 2019 12:44 am
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" },
}

Re: Ask a simple question, get a simple answer

Posted: Mon Jan 07, 2019 6:31 am
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.

Re: Ask a simple question, get a simple answer

Posted: Wed Jan 09, 2019 11:21 pm
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

Re: Ask a simple question, get a simple answer

Posted: Wed Jan 09, 2019 11:46 pm
by THOM
Can you post the tile definition?

Re: Ask a simple question, get a simple answer

Posted: Wed Jan 09, 2019 11:51 pm
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",
}

Re: Ask a simple question, get a simple answer

Posted: Thu Jan 10, 2019 12:41 am
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...

Re: Ask a simple question, get a simple answer

Posted: Thu Jan 10, 2019 6:13 pm
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....

Re: Ask a simple question, get a simple answer

Posted: Thu Jan 10, 2019 8:17 pm
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.