Custom Poison Cloud spell-No Xp gain

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!
Post Reply
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Custom Poison Cloud spell-No Xp gain

Post 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!
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Custom Poison Cloud spell-No Xp gain

Post 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).
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Custom Poison Cloud spell-No Xp gain

Post 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
		},
	},
}
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
minmay
Posts: 2789
Joined: Mon Sep 23, 2013 2:24 am

Re: Custom Poison Cloud spell-No Xp gain

Post by minmay »

you don't need to set it in the onInit hook, you can just add damageFlags = DamageFlags.Champion1 to the component definition
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Re: Custom Poison Cloud spell-No Xp gain

Post by Dunkler »

Ah thank you!
That was easier then i thought :)
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Re: Custom Poison Cloud spell-No Xp gain

Post 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.
minmay
Posts: 2789
Joined: Mon Sep 23, 2013 2:24 am

Re: Custom Poison Cloud spell-No Xp gain

Post by minmay »

Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Re: Custom Poison Cloud spell-No Xp gain

Post by Dunkler »

Thanks minmay. That worked now :)
Post Reply