Page 1 of 1

Custom Poison Cloud spell-No Xp gain

Posted: Mon May 18, 2015 12:10 pm
by Dunkler
Hello

i made a custom poison cloud spell. but it does not give party xp if the monster is killed by it.

I know this has been solved in the past, but i cant find anything about it.

Can someone help me what i have to do to give the party xp?

Thanks!

Re: Custom Poison Cloud spell-No Xp gain

Posted: Mon May 18, 2015 3:13 pm
by JohnWordsworth
I assume you are using the "damageTile" function to dish out the damage from the poison cloud?

If so, then I think you just need to make sure you pass in suitable "DamageFlags" for parameter 6 which are basically a bunch of switches that give you some extra options. When you cast the spell, you will need to figure out the champion that cast it (there might be a handy function to do this for you?) and then set the appropriate flag(s).

Re: Custom Poison Cloud spell-No Xp gain

Posted: Tue May 19, 2015 10:48 pm
by bongobeat
this is what I use to get xp, Minmay posted it on the forum:

you have to put the

Code: Select all

			-- Award experience.
			self:setDamageFlags(DamageFlags.Champion1)
			end
in the tileDamager class.

like this custom spell:
SpoilerShow

Code: Select all

defineObject{
	name = "magma_meteor_blast2bow",
	baseObject = "base_spell",
	components = {
		{
			class = "Particle",
			particleSystem = "magma_blast",
			destroyObject = true,
		},
		{
			class = "Light",
			color = vec(0.25, 0.5, 1),
			brightness = 40,
			range = 10,
			fadeOut = 0.5,
			disableSelf = true,
			fillLight = true,
		},
		{
			class = "TileDamager",
			name =  "damager1",
			attackPower = 300,
			damageType = "physical",
			sound = "fireball_hit",
			onInit = function(self)
			-- Award experience.
			self:setDamageFlags(DamageFlags.Champion1)
			end
		},
	},
}

Re: Custom Poison Cloud spell-No Xp gain

Posted: Tue May 19, 2015 11:38 pm
by minmay
you don't need to set it in the onInit hook, you can just add damageFlags = DamageFlags.Champion1 to the component definition

Re: Custom Poison Cloud spell-No Xp gain

Posted: Wed May 20, 2015 8:37 am
by Dunkler
Ah thank you!
That was easier then i thought :)

Re: Custom Poison Cloud spell-No Xp gain

Posted: Sun Aug 30, 2015 9:46 am
by Dunkler
Sorry for necro-ing this thread

But testing my mod after a long time i saw that the

damageFlags = DamageFlags.Champion1

works on the tile damager class but not on the "CloudSpell" class.

So the poison cloud spell still does not give xp. Is there a way to set up a poison cloud with the "TileDamager" class? So that i can use the damageflag?

Or is there another way to give the "CloudSpell" class a damage flag that works?

This is the script without a damage flag

Code: Select all

defineObject{
	name = "giftwolkeklein",
	baseObject = "base_spell",
	components = {
		{
			class = "Particle",
			particleSystem = "poison_cloud_small",
			offset = vec(0, 1.5, 0),
		},
		{
			class = "Light",
			offset = vec(0, 1.5, 0),
			color = vec(0.5, 0.5, 0.25),
			brightness = 7,
			range = 5,
			fadeOut = 13,
			disableSelf = true,
		},		
		{
			class = "CloudSpell",			
                        attackPower = 5,
			damageInterval = 1,
			damageType = "poison",
			duration = 6,
			sound = "poison_cloud",                       
		},
	},
}
If i use

onInit = function(self)
self:setDamageFlags(DamageFlags.Champion1)
end

it gives an error when i cast the spell


If i use

damageFlags = DamageFlags.Champion1

It does nothing. But this works on other spells.

Re: Custom Poison Cloud spell-No Xp gain

Posted: Sun Aug 30, 2015 10:08 am
by minmay

Re: Custom Poison Cloud spell-No Xp gain

Posted: Sun Aug 30, 2015 10:48 am
by Dunkler
Thanks minmay. That worked now :)