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!
Imperator
Posts: 2
Joined: Fri Jun 19, 2015 4:15 pm

Re: Ask a simple question, get a simple answer

Post by Imperator »

I'm trying to make Skeletons in my first level. However, I want to name them "dead guard"s and I want them to drop nothing.

I created a new object in monsters.lua and inherited from skeleton_tropper. The new object does show up in the editor, and I can add it without any bugs. However, none of my code does anything - it's just a skeleton trooper, and drops the items that I don't want it to drop. I've also tried changing other values like the amount of xp granted and those changes don't take effect either.

What am I doing wrong?

Code: Select all

defineObject 
{
	name = "dead_guard",
	baseObject = "skeleton_trooper",
	components = 
		{
			class = "Monster",
			meshName = "skeleton_warrior_mesh",
			footstepSound = "skeleton_footstep",
			hitSound = "skeleton_hit",
			dieSound = "skeleton_die",
			hitEffect = "hit_dust",
			capsuleHeight = 0.7,
			capsuleRadius = 0.25,
			collisionRadius = 0.6,
			health = 120,
			protection = 5,
			immunities = { "poisoned", "sleep", "blinded" },
			resistances = { ["poison"] = "immune" },
			traits = { "undead" },
			exp = 90,
			lootDrop = {},
		},
}
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

It's because you inherit from Skeleton_trooper; you get everything with that.
You need to redefine (or omit) the lootDrop.

**BTW, I see that you've done that. ;)
My test dropped nothing when killed, but I will look closer, when I get back.

Code: Select all

defineObject{
	name = "boogie_knight",
	baseObject = "skeleton_trooper",
	components = {
	
	{
				class = "Monster",
				meshName = "skeleton_knight_trooper_mesh",
				footstepSound = "skeleton_footstep",
				hitSound = "skeleton_hit",
				dieSound = "skeleton_die",
				hitEffect = "hit_dust",
				capsuleHeight = 0.7,
				capsuleRadius = 0.25,
				collisionRadius = 0.6,
				health = 150,
				immunities = { "sleep", "blinded" },
				resistances = {
					["poison"] = "immune",
					["shock"] = "weak",
				},
				traits = { "undead" },
				evasion = 0,
				protection = 5,
				exp = 100,
				--lootDrop = { 50, "skullcleave", 50, "skeleton_knight_helmet", 50, "skeleton_knight_shield" },
				onUnlinkMonsterGroup = function(self)
					self.go.turn:setTurnLeftAnimation("turnLeftNormal")
					self.go.turn:setTurnRightAnimation("turnRightNormal")
				end,
			},
	
	},
}
Update:

There is something very peculiar here. When I use my example, and add an item to lootDrop, it works; they drop that item when killed. But when I use your example, they do not drop the item, and only drop standard knight's equipment, like the helmet, ax, and shield.
I haven't yet discovered any significant difference between the two Monster components; but there must be some reason for this.
Last edited by Isaac on Fri Jun 19, 2015 8:52 pm, edited 2 times in total.
Imperator
Posts: 2
Joined: Fri Jun 19, 2015 4:15 pm

Re: Ask a simple question, get a simple answer

Post by Imperator »

Thanks, Isaac.

Strangely, my code still doesn't work. Yours does.

I don't see the difference! Is there something I have to over-write that I didn't?

EDIT - I fixed it ... I was missing a set of brackets. Forgot that each component needs it's own set, even if only making one. Works just like yours now. Thanks so much for the help :)
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Hidden in plain sight. :shock: (I missed it too.)
Thollanhar
Posts: 1
Joined: Mon Jun 29, 2015 12:42 pm

Re: Ask a simple question, get a simple answer

Post by Thollanhar »

Hey Guys,

is there any possibility to change the Damage of a monster? I'd like to put some Undeads in the first level, but they one-shot me nearly :lol:
User avatar
THOM
Posts: 1280
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

Have a look at the monster definition-file.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Kuro01
Posts: 36
Joined: Tue Jun 23, 2015 2:05 pm

Re: Ask a simple question, get a simple answer

Post by Kuro01 »

How would I get this to work if I wanted to use a teleporter instead of a door. Instead of open and close I want to use activate and deactivate?

Code: Select all

function testlock()
   if counter_1.counter:getValue() == 1 and
   counter_2.counter:getValue() == 0 and
   counter_3.counter:getValue() == 1 and
   counter_4.counter:getValue() == 0 and
   counter_5.counter:getValue() == 1 then

   test_door.door:open()
   
   else

   test_door.door:close()

   end
end
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Kuro01 wrote:How would I get this to work if I wanted to use a teleporter instead of a door. Instead of open and close I want to use activate and deactivate?
Additionally, or instead? (Are you using this code for an existing door as well?)

If not, then just change the open & close commands to activate & deactivate commands for your teleporter

Code: Select all

teleporter_1.controller:activate()
else
teleporter_1.controller:deactivate()

Otherwise, you need to [first] make a new set of counters for the new teleporter.

Code: Select all

function testlock()
   if tCounter_1.counter:getValue() == 1 and
   tCounter_2.counter:getValue() == 0 and
   tCounter_3.counter:getValue() == 1 and
   tCounter_4.counter:getValue() == 0 and
   tCounter_5.counter:getValue() == 1 then

teleporter_1.controller:activate()
else
teleporter_1.controller:deactivate()
   end
end
User avatar
Kuro01
Posts: 36
Joined: Tue Jun 23, 2015 2:05 pm

Re: Ask a simple question, get a simple answer

Post by Kuro01 »

Thanks
User avatar
THOM
Posts: 1280
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

I have a timer, that runs every 30 seconds (to check, if it is nighttime and the lanterns have to be switched on).

Is it enough to set this timer to "on current level only" or will this 30-second-check break the game sooner or later?

It is a bit complicate to stop and start again this timer, while avoiding to have it started more than once at the same time...
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Post Reply