Page 1 of 1

Create New Spell

Posted: Fri Dec 27, 2013 9:57 am
by Mysterious
Hi to the Community

I am trying to create a new Spell and am having no luck . :)

What I tried to do is when the Player cast the Spell they are teleported somewhere eg:

cloneSpell{
name = "Velentiar",
baseObject = "Shock",
skill = "air_magic",
level = 1,
runes = "C",
manaCost = 15,

spawn("teleport",8,15,13,1,"q5") --teleport renamed here--

end
}

Its not working and II don't know why. I have tried for hours on this and it wont even load the Dungeon in the Editor??

Re: Create New Spell

Posted: Mon Dec 30, 2013 8:34 am
by Mysterious
Hi all.... sigh....

I figured out most of it after 4 days of brain drain....This is what I have.. I cant believe I figured this out by looking at like... I lost count of the posts on this site... Man. So what do you think?

defineObject{
name = "teleport_open",
baseObject = "scroll",
uiName = "Grave Yard Gate Spell",
class = "Item",
model = "assets/models/items/scroll.fbx",
gfxIndex = 30,
---consumable = true, --- Don't need, I think it has something to do the (return true statement) ---
scroll = true,
weight = 0.3,

description = "To open a Magic Gate one only has to know how..",

onUseItem = function(self, champion)
playSound("lightning_bolt_hit")
spawn("fx",8,17,16, 1):setParticleSystem("lightning_bolt_hit")

--- I can Spawn teleport here as well ---

gravedoor1:open()
party:shakeCamera(1.5,2)

hudPrint("You use the Scroll and Grave Yard Gate opens")
hudPrint("")
hudPrint("Gain 150 XP")

for i = 1,4 do party:getChampion(i):gainExp(150) end
return true --- This function makes the Scroll be used I think, Disappear. --- REM THIS ---
end
}

PS: I could not create a New Spell to do this Code. :evil:

Re: Create New Spell

Posted: Mon Dec 30, 2013 8:51 pm
by JohnWordsworth
Hi Mysterious, very strange that nobody answered this but with XMas and New Year frivolities I guess it just got overlooked! You cannot clone a spell, but you can define a whole new one from scratch. The syntax would be something like...

Code: Select all

defineSpell{
  name = "velentair",
  uiName = "Velentair",
  skill = "air_magic",
  level = 1,
  runes = "C",
  manaCost = 15,
  onCast = function(champion, x, y. direction, skill)
    -- Some Lua Methods
  end
}
Your code would then go into the onCast function to do whatever you need. You can find more about this from the Modding link at the top right and then I think on the 'Asset Definitions' page you can see the exact syntax for this and things like recipies.

Re: Create New Spell

Posted: Wed Jan 01, 2014 4:40 am
by Mysterious
Oh Hi john. :)

Thank you for looking at my post. That's what I was after. I have found the Grimrock Assets Pack ver2 on a web site, and it has tons of awesome stuff. Slowly shifting through it all..LOL. Now I have the Scroll to match the Spell you gave me. Just shows player what Runes to use.

So yeah thanks again. :)

This is now what I have thanks to you:

--- Your Code ---
defineSpell{
name = "velentair",
uiName = "Velentair",
skill = "air_magic",
level = 1,
runes = "C",
manaCost = 15,
onCast = function(champion, x, y, direction, skill)
-- Some Lua Methods

--- Here I will have to put the name of the Gate the Spell opens --- :)
end
}

--- What I learnt from the Assets Pack. Oh it took me 1 day to figure this out :oops: ---

defineObject{
name = "velentair",
class = "Item",
uiName = " Open Gate",
model = "assets/models/items/scroll_spell.fbx",
gfxIndex = 113,
scroll = true,
spell = "velentair",
weight = 0.3,
}