Page 1 of 1

Help needed with custom spells

Posted: Thu Aug 28, 2014 1:52 pm
by WaspUK1966
I know how to clone and define new spells, but I want to create a custom spell that uses the lightning bolt spell as its base, but doesn't have as many damage points (sort of a mini lightning bolt with a third of the damage). I've checked everywhere in the assets scripts (items, spells etc.) but no-where does it tell you what damage this spell (or any other for that matter) actually does. How can I clone the spell (or define a new one) and then change its damage value? Is it possible? If not, how is the damage calculated?
Thanks
George

Re: Help needed with custom spells

Posted: Thu Aug 28, 2014 6:49 pm
by Isaac
Here is a custom mini-lightning spell. This is not a perfect copy of the real lightning spell; it might have unintended issues that I haven't foreseen.
Noteably, it does not simulate the dynamic lighting effect of a normal lightning spell; but it works well enough.

Image

https://www.dropbox.com/s/a8rjxtxjex091 ... 1.avi?dl=0

Place this model in your models folder. [I wish there was a blank model in the default game files, but I don't know of one.]
https://www.dropbox.com/s/bkjqeibv5hgwo ... model?dl=0

Place this code in your spells.lua script.

Code: Select all

            defineSpell{
           name = "mini-lightning_bolt",
           uiName = "Mini-Lightning Bolt",
           skill = "air_magic",
           level = 10,
           runes = "CDE",
           manaCost = 20,
           onCast = function(champion)
                    local dx,dy = getForward(party.facing)
--~                     local damage = 10
                    local Xoffset = -0.5
                    local Yoffset = 0.5
                    if champion:getOrdinal() == party:getChampion(2):getOrdinal() or champion:getOrdinal() == party:getChampion(4):getOrdinal() then
                       Yoffset = -0.5
                    end

                    if champion:getOrdinal() == party:getChampion(3):getOrdinal() or champion:getOrdinal() == party:getChampion(1):getOrdinal() then
                       Xoffset = 0.5
                    end
                    playSoundAt("lightning_bolt_launch", party.level, party.x, party.y)
                    shootProjectile("mini-lightning_bolt", party.level, party.x+dx, party.y+dy, party.facing, 9, 0, 0, Xoffset, 0.2, Yoffset,  0, nil, true, champion:getOrdinal())
                    end,

        }

        cloneObject{
           name = "mini-lightning_bolt",
           baseObject = "shock_bomb",
           uiName = "na",
           impactSound = "lightning_bolt_hit",
           stackable = false,
		   bombPower = 25,
           model = "mod_assets/models/Isaac_empty_space.fbx",
           glitterEffect = "mini-lightning_bolt",
        }

        defineParticleSystem{
           name = "mini-lightning_bolt",
           emitters = {
              {
                 emissionRate = 15,
                 emissionTime = 10,
                 maxParticles = 1000,
                 boxMin = { 0,0,0 },
                 boxMax = { 0,0,0 },
                 sprayAngle = {0,360},
                 velocity = {0,0},
                 objectSpace = true,
                 texture = "assets/textures/particles/lightning01.tga",
                 frameRate = 4,
                 frameSize = 256,
                 frameCount = 4,
                 lifetime = {20.1,20.3},
                 color0 = {1.5,1.5,1.5},
                 opacity = 1,
                 fadeIn = 0.1,
                 fadeOut = 0.1,
                 size = {0.075, 0.5},
                 gravity = {0,0,0},
                 airResistance = 5,
                 rotationSpeed = 1,
                 blendMode = "Additive",
              },

        -- glow
              {
                 spawnBurst = true,
                 emissionRate = 1,
                 emissionTime = 0,
                 maxParticles = 1,
                 boxMin = {0,0,0.0},
                 boxMax = {0,0,0.0},
                 sprayAngle = {0,30},
                 velocity = {0,0},
                 texture = "assets/textures/particles/glow.tga",
                 lifetime = {1000000, 1000000},
                 colorAnimation = false,
                 color0 = {0.25,0.32,0.5},
                 opacity = 0.3,
                 fadeIn = 0.1,
                 fadeOut = 0.1,
                 size = {0.075, 0.5},
                 gravity = {0,0,0},
                 airResistance = 1,
                 rotationSpeed = 2,
                 blendMode = "Additive",
                 objectSpace = true,
              }
           }
        }




Re: Help needed with custom spells

Posted: Mon Sep 01, 2014 3:07 pm
by trancelistic
Nice, I have a question. How to prevent casting spells if you didn't found the scrol yet with the spell described on it?

Re: Help needed with custom spells

Posted: Mon Sep 01, 2014 4:54 pm
by Skuggasveinn
trancelistic wrote:Nice, I have a question. How to prevent casting spells if you didn't found the scrol yet with the spell described on it?
This was talked about some time ago, this thread will give you some ideas and scripts to use, I haven't tried this myself but this will get you in the right direction I think.
viewtopic.php?f=14&t=4629&hilit=learning+spells

Re: Help needed with custom spells

Posted: Tue Sep 02, 2014 11:13 am
by trancelistic
THanks alot. THat was indeed what I was looking for, sadly I didn't get it to work so far:(