Page 1 of 1

[Request] Lua Function: Cast(Target, SpellID) [Working]

Posted: Sun Dec 06, 2009 9:35 am
by bolly
Cast(Target, SpellID) - Casts a spell on the target

We need to be able to have effects on items that can take use of spells remove() at the end of the spell duration. Ie to remove the effect that the item has placed on them. Spells seem like the best way to implement this to me?

Re: [Request] Lua Function: Cast(Target, SpellID)

Posted: Sun Dec 06, 2009 11:35 am
by LethalEncounter
Added as CastSpell(Target, SpellID, SpellTier, Caster), spell tier and caster are optional but if not given spell tier will default to 1 and caster will default to the target.

Re: [Request] Lua Function: Cast(Target, SpellID)

Posted: Sun Dec 06, 2009 6:24 pm
by bolly
Omg sweet! Can't wait for the co tommorow

Re: [Request] Lua Function: Cast(Target, SpellID)

Posted: Sun Dec 06, 2009 6:32 pm
by LethalEncounter
Its in tonights release as well although I haven't tested it yet :P It *should* work though if you want to try it.

Re: [Request] Lua Function: Cast(Target, SpellID)

Posted: Sun Dec 06, 2009 6:53 pm
by bolly
Works!!! Sweet!

I tested it out with flaming embrace from the other thread and it works a charm but for some bizarre reason it needed a target still. Which is great cause I was wondering how the item was going to get the target for non-self only spells.

The question now is why did it want a target if CastSpell had Player as the target?! I don't care as this will work nice for me but I thought i'd mention it :-D

Thanks again LE you rock to give us both these two functions in one update

Code: Select all

function used(Item, Player)
	CastSpell(Player, 12)
end

Re: [Request] Lua Function: Cast(Target, SpellID)

Posted: Sun Dec 06, 2009 7:01 pm
by LethalEncounter
bolly wrote:Works!!! Sweet!

I tested it out with flaming embrace from the other thread and it works a charm but for some bizarre reason it needed a target still. Which is great cause I was wondering how the item was going to get the target for non-self only spells.

The question now is why did it want a target if CastSpell had Player as the target?! I don't care as this will work nice for me but I thought i'd mention it :-D
Hmm, that is strange. Did it not cast at all or did it give you an error message? If so, what message did it say?

Re: [Request] Lua Function: Cast(Target, SpellID)

Posted: Sun Dec 06, 2009 7:28 pm
by LethalEncounter
Nevermind, I got it fixed. It was just trying to use the caster's target regardless. Btw to answer your previous question, to proc an item's spell on the players target (or himself if no target) you could do something like this:

Target = GetTarget(Spawn)
if Target ~= nil then
CastSpell(Target, 12, 1, Spawn)
else
CastSpell(Spawn, 12)
end

Re: [Request] Lua Function: Cast(Target, SpellID)

Posted: Sun Dec 06, 2009 7:43 pm
by bolly
That's wonderful mate cheers for the heads up on GetTarget()!

This opens so many possibilities its unreal! My levitation spell and hp buffs are working perfectly!

Re: [Request] Lua Function: Cast(Target, SpellID)

Posted: Mon Dec 07, 2009 6:38 am
by John Adams
My question is, how come Bolly can get so many spells working and we cannot?

~grin~

~runs~

~hides~


Nice work, both of ya.

Re: [Request] Lua Function: Cast(Target, SpellID)

Posted: Mon Dec 07, 2009 6:51 am
by bolly
kick some ass john!!