Page 77 of 400

Re: Ask a simple question, get a simple answer

Posted: Fri Jun 19, 2015 4:20 pm
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 = {},
		},
}

Re: Ask a simple question, get a simple answer

Posted: Fri Jun 19, 2015 5:19 pm
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.

Re: Ask a simple question, get a simple answer

Posted: Fri Jun 19, 2015 8:34 pm
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 :)

Re: Ask a simple question, get a simple answer

Posted: Fri Jun 19, 2015 10:05 pm
by Isaac
Hidden in plain sight. :shock: (I missed it too.)

Re: Ask a simple question, get a simple answer

Posted: Mon Jun 29, 2015 12:46 pm
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:

Re: Ask a simple question, get a simple answer

Posted: Mon Jun 29, 2015 1:36 pm
by THOM
Have a look at the monster definition-file.

Re: Ask a simple question, get a simple answer

Posted: Mon Jun 29, 2015 3:09 pm
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

Re: Ask a simple question, get a simple answer

Posted: Mon Jun 29, 2015 5:16 pm
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

Re: Ask a simple question, get a simple answer

Posted: Mon Jun 29, 2015 7:12 pm
by Kuro01
Thanks

Re: Ask a simple question, get a simple answer

Posted: Sun Jul 05, 2015 3:02 pm
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...