Page 2 of 2

Re: Scripting: Monster only gets damaged by one special weap

Posted: Sun May 31, 2015 3:45 am
by Isaac
THOM wrote:The suggestion of Isaac makes me feel silly. Don't know how to use this. If I copy this to the monster definition the result is still nothing.
Sorry, it's two part... The above goes in the monster definition, but the weapon must be defined as giving "vorpal" damage.

Like this:
SpoilerShow

Code: Select all

defineObject{
	name = "vorpal_blade",
	baseObject = "ethereal_blade",
	components = {
		{
			class = "MeleeAttack",
			attackPower = 20,
			accuracy = 15,
			cooldown = 4,
			damageType = "vorpal",
			swipe = "horizontal",
		},
	},
}	

Code: Select all

defineObject{
	name = "Invulnerable_crowern",
	baseObject = "crowern",
	components = {
		{
			class = "Model",
			model = "assets/models/monsters/crowern01.fbx",
			storeSourceData = true,
			material = "ghost_crowern"
		},
		
		{
			class = "Monster",
			meshName = "crowern_mesh",
			footstepSound = "crowern_footstep",
			hitSound = "crowern_hit",
			dieSound = "crowern_die",
			hitEffect = "hit_blood",
			capsuleHeight = 0.5,
			capsuleRadius = 0.2,
			collisionRadius = 0.7,
			health = 120,
			evasion = 10,
			flying = true,
			exp = 90,
			traits = { "animal" },
			onDamage = function(self, damage, damageType)
						 local result = (damageType == "vorpal")
						 
						 if not result then
							playSound("goromorg_shield_hit")
							hudPrint("") hudPrint("") hudPrint("") hudPrint("")
							hudPrint("Weapon Ineffective!")
						 end
						 return result
						end,
		},
	}
}
As used in this video example: https://www.dropbox.com/s/uz7a4w6777eum ... t.avi?dl=0

Re: Scripting: Monster only gets damaged by one special weap

Posted: Sun May 31, 2015 9:15 am
by THOM
Oh, great boys.

Isaac, I will test this. Seems to be perfect. (I like your flying ghost, BTW, hehe...)
minmay wrote:That works fine for me. The monster takes 0 damage from all fire, cold, poison, shock, and physical attacks, and doesn't get hit by dispel at all since it lacks the "elemental" trait.
I am confused... Will have a look again.
minmay wrote:
THOM wrote:I still do not know, why it is a problem to use my original approach.
Because it stops the action entirely instead of making the monster take no damage. You don't want players to be able to hurt the monster with spells and spike traps, do you? And you do want players to be able to attempt attacks, don't you?
I still don't see the problem. My approach doesn't do any damage to the monster - that's the important thing. It also can't be hurt by spells. The only thing was, it could be hurt by bar hand attacks. But if Isaacs approach is better (and more easy to implement) I will take his solution.

I will look at all this - but later on. I'm on a trip through the eastern parts of germany for a week now. If you want to go on this dicussion, do it. But, please, don't be angry when I do not respond - I think I won't be online the next days...

Re: Scripting: Monster only gets damaged by one special weap

Posted: Fri Jun 05, 2015 11:35 pm
by THOM
Alright - I'm back from my trip.

I've tested Isaacs script and it works perfect. Thank you!!

Still do not know, why mimays addition didn't work properly - but anyway.