Page 1 of 1

how to define a custom bomb?

Posted: Mon Feb 16, 2015 2:27 pm
by bongobeat
Hey all,
(continuing with the disintegrate things, humm...)
is their a way to define a custom bomb, which give physical damage, and after hit, it shows the disintegrate effect?

I did not find any particle system related to the disintegrate spell, where can it be find?

Actually I have done this with a new base_spell object: it works, but the particle effect is based on a blob particle and it don't give xp.
SpoilerShow

Code: Select all

defineObject{
	name = "star_bomb",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/shock_bomb.fbx",
		},
		{
			class = "Item",
			uiName = "Stars Bomb",
			gfxIndex = 90,
			gfxAtlas = "mod_assets/textures/oliveitem.tga",
			impactSound = "impact_blunt",
			stackable = true,
			projectileRotationSpeed = 10,
			projectileRotationZ = -30,
			weight = 0.8,
			traits = { "throwing_weapon" },
                        convertToItemOnImpact = "greater_blob_blast",
		},
		{
			class = "ThrowAttack",
			cooldown = 4,
		},
--		{
--			class = "BombItem",
--			bombType = "shock",
--			bombPower = 1000,
--		},
	},
	tags = { "weapon", "weapon_throwing" },
}

defineObject{
	name = "greater_blob_blast",
	baseObject = "base_spell",
	components = {
		{
			class = "Particle",
			particleSystem = "greater_blob_hit",
			destroyObject = true,
		},
		{
			class = "Light",
			color = vec(0.4, 0.5, 0.6),
			brightness = 60,
			range = 10,
			fadeOut = 0.5,
		},
		{
			class = "Sound",
			sound = "blob_hit",
		},
		{
			class = "TileDamager",
			name =  "damager1",
			attackPower = 1000,
			damageType = "physical",
			woundChance = 100,
		},
	},
}

defineParticleSystem{
	name = "greater_blob_hit",
	emitters = {
		-- sparks
		{
			spawnBurst = true,
			maxParticles = 80,
			boxMin = { 0.0, 0.5, 0.0},
			boxMax = { 0.0,  1.0, 0.0},
			sprayAngle = {0,360},
			velocity = {4,6},
			objectSpace = false,
			texture = "assets/textures/particles/teleporter.tga",
			lifetime = {0.2,0.6},
			color0 = {4.0,3.0,3.0},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.3,
			size = {1.0, 4.0},
			gravity = {0,-6,0},
			airResistance = 1,
			rotationSpeed = 2,
			blendMode = "Additive",
		},

		-- fog
		{
			spawnBurst = true,
			maxParticles = 30,
			sprayAngle = {0,360},
			velocity = {0,3},
			objectSpace = true,
			texture = "assets/textures/particles/fog.tga",
			lifetime = {0.4,0.6},
			color0 = {0.4, 0.5, 0.6},
			opacity = 0.7,
			fadeIn = 0.1,
			fadeOut = 0.3,
			size = {2, 4},
			gravity = {0,0,0},
			airResistance = 0.5,
			rotationSpeed = 1,
			blendMode = "Additive",
		},

		-- glow
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = { 0.0, 0.5, 0.0},
			boxMax = { 0.0,  1.0, 0.0},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/glow.tga",
			lifetime = {0.5, 0.5},
			colorAnimation = false,
			color0 = {1, 1, 1},
			opacity = 1,
			fadeIn = 0.01,
			fadeOut = 0.5,
			size = {3, 6},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 2,
			blendMode = "Additive",
		}
	}
}
By the way, is there any other way to make a custom bomb which gives physical damage, without doing this?

Re: how to define a custom bomb?

Posted: Mon Feb 16, 2015 2:39 pm
by Dr.Disaster
This should be rather easy. "recipes.lua" in the scripts folder let's you add your own recipe for a custom bomb (within mortar limits) and "throwing_weapons.lua" in items subfolder let's you add your custom bomb definition which includes the damage type (bombType).

Re: how to define a custom bomb?

Posted: Mon Feb 16, 2015 3:00 pm
by bongobeat
do you realy need to make a new recipe for that?

I ve already try adding physical to the definition,
SpoilerShow

Code: Select all

		{
			class = "BombItem",
			damageType = "physical",
			bombPower = 1000,
		},
this don't work.

Re: how to define a custom bomb?

Posted: Mon Feb 16, 2015 3:08 pm
by Dr.Disaster
bongobeat wrote:do you realy need to make a new recipe for that?
It's only needed if you want to give the player the ability to make (more of) them.
bongobeat wrote:I ve already try adding physical to the definition,
SpoilerShow

Code: Select all

		{
			class = "BombItem",
			damageType = "physical",
			bombPower = 1000,
		},
this don't work.
I don't think "damageType" is a supported variable here. Looking at the modding section info it has to be "bombType".

Re: how to define a custom bomb?

Posted: Mon Feb 16, 2015 3:58 pm
by Frenchie
If it wasn't a spell, what exactly would this bomb be? A hand grenade that looks like any of elemental flasks or is a cannonball with a fuse? If the latter is true, then it's a new ammo for the hand cannon. The bomb could also be a small barrel with a long trail of gunpowder used to blow up caved in passages.

Re: how to define a custom bomb?

Posted: Mon Feb 16, 2015 8:54 pm
by minmay
bongobeat wrote:I did not find any particle system related to the disintegrate spell, where can it be find?
It's in assets/scripts/monsters/wizard.lua.
bongobeat wrote:Actually I have done this with a new base_spell object: it works, but the particle effect is based on a blob particle and it don't give xp.
Here's one that has the disintegrate particle effect and sound and should give XP:

Code: Select all

defineObject{
	name = "greater_blob_blast",
	baseObject = "base_spell",
	components = {
		{
			class = "Particle",
			particleSystem = "wizard_explosion",
			offset = vec(0, 1.3, 0),
		},
		{
			class = "Light",
			color = vec(0.5, 0.75, 1.2),
			brightness = 10,
			range = 12,
			offset = vec(0, 1.3, 0),
			fadeOut = 1.5,
			destroyObject = true,
		},
		{
			class = "Sound",
			sound = "force_field_cast",
		},
		{
			class = "TileDamager",
			name =  "damager1",
			attackPower = 1000,
			damageType = "physical",
			woundChance = 100,
			onInit = function(self)
				-- Award experience.
				self:setDamageFlags(DamageFlags.Champion1)
			end
		},
	},
}
bongobeat wrote:By the way, is there any other way to make a custom bomb which gives physical damage, without doing this?
No, BombItemComponent is very limited.

Re: how to define a custom bomb?

Posted: Mon Feb 16, 2015 11:21 pm
by bongobeat
Frenchie wrote:If it wasn't a spell, what exactly would this bomb be? A hand grenade that looks like any of elemental flasks or is a cannonball with a fuse? If the latter is true, then it's a new ammo for the hand cannon. The bomb could also be a small barrel with a long trail of gunpowder used to blow up caved in passages.
It's a bomb, just more powerful. But your new ammo is a good idea :)
it's same thing than the death bomb by Daveyx0, it just do only physical damage. It's an idea inspired by the disintegrate spell, but not as fatal as the spell.

seems that there is no other way to make custom bomb or spells

Re: how to define a custom bomb?

Posted: Mon Feb 16, 2015 11:21 pm
by bongobeat
minmay wrote:
bongobeat wrote:I did not find any particle system related to the disintegrate spell, where can it be find?
It's in assets/scripts/monsters/wizard.lua.
bongobeat wrote:Actually I have done this with a new base_spell object: it works, but the particle effect is based on a blob particle and it don't give xp.
Here's one that has the disintegrate particle effect and sound and should give XP:

Code: Select all

defineObject{
	name = "greater_blob_blast",
	baseObject = "base_spell",
	components = {
		{
			class = "Particle",
			particleSystem = "wizard_explosion",
			offset = vec(0, 1.3, 0),
		},
		{
			class = "Light",
			color = vec(0.5, 0.75, 1.2),
			brightness = 10,
			range = 12,
			offset = vec(0, 1.3, 0),
			fadeOut = 1.5,
			destroyObject = true,
		},
		{
			class = "Sound",
			sound = "force_field_cast",
		},
		{
			class = "TileDamager",
			name =  "damager1",
			attackPower = 1000,
			damageType = "physical",
			woundChance = 100,
			onInit = function(self)
				-- Award experience.
				self:setDamageFlags(DamageFlags.Champion1)
			end
		},
	},
}
bongobeat wrote:By the way, is there any other way to make a custom bomb which gives physical damage, without doing this?
No, BombItemComponent is very limited.
thanks a lot! :D

Re: how to define a custom bomb?

Posted: Wed Feb 18, 2015 10:29 am
by petri
This will be possible with 2.2.3:

Code: Select all

defineObject{
	name = "bio_bomb",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/poison_bomb.fbx",
		},
		{
			class = "Item",
			uiName = "Bio Bomb",
			gfxIndex = 138,
			impactSound = "impact_blunt",
			stackable = true,
			projectileRotationSpeed = 10,
			projectileRotationZ = -30,
			weight = 0.8,
			traits = { "throwing_weapon" },
		},
		{
			class = "ThrowAttack",
			cooldown = 4,
		},
		{
			class = "BombItem",
			onExplode = function(self, level, x, y, facing, elevation)
				spawn("herder_small", level, x, y, facing, elevation)
				return false
			end,
		},
	},
	tags = { "weapon", "weapon_throwing" },
}

Re: how to define a custom bomb?

Posted: Wed Feb 18, 2015 5:45 pm
by bongobeat
this looks cool! :lol: