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

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
bolly
Retired
Posts: 389
Joined: Mon Sep 21, 2009 3:03 pm
Location: Leeds, UK

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

Post by bolly » Sun Dec 06, 2009 9:35 am

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?
Last edited by bolly on Mon Dec 07, 2009 6:52 am, edited 1 time in total.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

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

Post by LethalEncounter » Sun Dec 06, 2009 11:35 am

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.

bolly
Retired
Posts: 389
Joined: Mon Sep 21, 2009 3:03 pm
Location: Leeds, UK

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

Post by bolly » Sun Dec 06, 2009 6:24 pm

Omg sweet! Can't wait for the co tommorow

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

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

Post by LethalEncounter » Sun Dec 06, 2009 6:32 pm

Its in tonights release as well although I haven't tested it yet :P It *should* work though if you want to try it.

bolly
Retired
Posts: 389
Joined: Mon Sep 21, 2009 3:03 pm
Location: Leeds, UK

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

Post by bolly » Sun Dec 06, 2009 6:53 pm

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

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

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

Post by LethalEncounter » Sun Dec 06, 2009 7:01 pm

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?

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

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

Post by LethalEncounter » Sun Dec 06, 2009 7:28 pm

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

bolly
Retired
Posts: 389
Joined: Mon Sep 21, 2009 3:03 pm
Location: Leeds, UK

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

Post by bolly » Sun Dec 06, 2009 7:43 pm

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!

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

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

Post by John Adams » Mon Dec 07, 2009 6:38 am

My question is, how come Bolly can get so many spells working and we cannot?

~grin~

~runs~

~hides~


Nice work, both of ya.

bolly
Retired
Posts: 389
Joined: Mon Sep 21, 2009 3:03 pm
Location: Leeds, UK

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

Post by bolly » Mon Dec 07, 2009 6:51 am

kick some ass john!!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest