Help with constructing spells?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Help with constructing spells?

Post by LordGarth »

Hello,

I made a new spell but there is no visual of the spell traveling and no hit effect either.

Can I see a typical normal script for the onCast command.

Here is my script so far.

defineSpell{
name = "chain_lightning",
class = "ProjectileSpell",
uiName = "Chain Lightning",
particleSystem = "lightning_bolt",
hitParticleEffect = "lightning_bolt_hit",
lightColor = vec(0.25, 0.5, 1),
lightBrightness = 15,
lightRange = 7,
lightHitBrightness = 40,
lightHitRange = 10,
castShadow = true,
launchSound = "lightning_bolt_launch",
projectileSound = "lightning_bolt",
hitSound = "lightning_bolt_hit_small",
projectileSpeed = 15,
attackPower = 60,
runes = "CDH",
skill = "air_magic",
level = 1,
manaCost = 10,
damageType = "shock",
--cameraShake = true,
tags = { "spell" },
onCast = function(champ, x, y, direction, skill)
end
}

Thx,

LG
Dungeon Master and DOOM will live forever.
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Help with constructing spells?

Post by LordGarth »

Can spells be given muliple damage types?

Thx,

LordGarth
Dungeon Master and DOOM will live forever.
flatline

Re: Help with constructing spells?

Post by flatline »

You are trying to define a spell but using defineobject-commands, which won't work. A spell is made of two parts:
The defineSpell-part which rules manacost, type of spell and so on, and the defineObject part which you spawn from the onCast-command in the defineSpell:

So you need both of these:

Code: Select all

defineSpell{
	name = "chain_lightning_spell",
	uiName = "Chain Lightning",
	runes = "CDH",
	skill = "air_magic",
	level = 0,
	manaCost = 10,
	onCast = function(champ, x, y, direction, skill)
		if party.facing == 0 then
            	spawn("chain_lightning", party.level, party.x, party.y-1, party.facing)
         	end
		if party.facing == 1 then
		spawn("chain_lightning", party.level, party.x+1, party.y, party.facing)
		end
		if party.facing == 2 then
		spawn("chain_lightning", party.level, party.x, party.y+1, party.facing)
		end
		if party.facing == 3 then
		spawn("chain_lightning", party.level, party.x-1, party.y, party.facing)
         end
	end
}

defineObject{
	name = "chain_lightning",
	class = "ProjectileSpell",
	uiName = "Chain Lightning",
	particleSystem = "lightning_bolt",
	hitParticleEffect = "lightning_bolt_hit",
	lightColor = vec(0.25, 0.5, 1),
	lightBrightness = 15,
	lightRange = 7,
	lightHitBrightness = 40,
	lightHitRange = 10,
	castShadow = true,
	launchSound = "lightning_bolt_launch",
	projectileSound = "lightning_bolt",
	hitSound = "lightning_bolt_hit_small",
	projectileSpeed = 15,
	attackPower = 60,
	damageType = "shock",
	--cameraShake = true,
	tags = { "spell" }
}
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Help with constructing spells?

Post by LordGarth »

Hello,

Great and thx for the script example. I never would have guess all of that.

Also I would like to give some spells more than one damage type. Is that possible.

The Meteor spell would be earth and fire. So I guess poison and fire damage.

Thx,

LG
Dungeon Master and DOOM will live forever.
flatline

Re: Help with constructing spells?

Post by flatline »

LordGarth wrote:Hello,

Great and thx for the script example. I never would have guess all of that.

Also I would like to give some spells more than one damage type. Is that possible.

The Meteor spell would be earth and fire. So I guess poison and fire damage.

Thx,

LG
I think you'd have to make one spell that releases two separate objects.

So, onCast will need to launch two identical objects with separate damage types.
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Help with constructing spells?

Post by LordGarth »

I cant seem to apply new textures for the new spells.

Not sure what format to save the textures for spells when the blend mode is additive. I change blend mode to opaque and that fixes that but then I get

bad argument #2 to '__newindex' (invalid enum)

Do I have to assign new indexes for the new texture for spell hit and so on.

I made my own particle system and just changed the path of one of the textures

defineParticleSystem{
name = "chainlightning_bolt_hit",
emitters = {
-- sparks
{
emissionRate = 80,
emissionTime = 1,
maxParticles = 50,
boxMin = {-0.5, -0.5, -0.5},
boxMax = { 0.5, 0.5, 0.5},
sprayAngle = {0,360},
velocity = {0,0},
objectSpace = false,
texture = "mod_assets/textures/chainlightning01.tga",
frameRate = 4,
frameSize = 256,
frameCount = 4,
lifetime = {0.2,0.4},
color0 = {2.5,2.5,2.5},
opacity = 1,
fadeIn = 0.1,
fadeOut = 0.3,
size = {0.1, 1.5},
gravity = {0,0,0},
airResistance = 1,
rotationSpeed = 0,
blendMode = "Opaque",
},

-- 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.25, 0.5, 1},
opacity = 0.7,
fadeIn = 0.1,
fadeOut = 0.3,
size = {1, 2},
gravity = {0,0,0},
airResistance = 0.5,
rotationSpeed = 1,
blendMode = "Additive",
},

-- glow
{
spawnBurst = true,
emissionRate = 1,
emissionTime = 0,
maxParticles = 1,
boxMin = {0,0,-0.1},
boxMax = {0,0,-0.1},
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 = {1, 1},
gravity = {0,0,0},
airResistance = 1,
rotationSpeed = 2,
blendMode = "Additive",
}
}
}
Dungeon Master and DOOM will live forever.
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Help with constructing spells?

Post by LordGarth »

I can assign new sounds to new spells but new textures dont work.

LG
Dungeon Master and DOOM will live forever.
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Help with constructing spells?

Post by LordGarth »

Still cant get new textures to work inside new particle systems for new spells.

LG
Dungeon Master and DOOM will live forever.
flatline

Re: Help with constructing spells?

Post by flatline »

post deleted
Last edited by flatline on Mon Oct 08, 2012 9:31 am, edited 1 time in total.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Help with constructing spells?

Post by petri »

That's strange, particle system textures should work like other textures.
Post Reply