Page 1 of 1

New Lua Function: Charm(Spawn, Spawn)

Posted: Wed Oct 03, 2012 5:03 pm
by Jabantiz
Charms the selected mob, the first Spawn is the caster, the second is the NPC that is to be charmed

Code: Select all

function cast(Caster, Target)
	Charm(Caster, Target)
end

Re: New Lua Function: Charm(Spawn, Spawn)

Posted: Thu Oct 04, 2012 9:03 am
by John Adams
Awesome, Jab. Suggestion, maybe impractical. Can we send a param for "length of charm", or "percent chance to break"? or does EQ2 Charm spells never break randomly? If not, then don't worry about it.. tho it might make a neat custom feature.

Alternately, I guess we could make a global Rule for Pets::Charmed that applies to everything... ?

Re: New Lua Function: Charm(Spawn, Spawn)

Posted: Thu Oct 04, 2012 3:33 pm
by Jabantiz
Wikia says it has a recurring chance to break, I am unsure of how to handle this at the moment.

Re: New Lua Function: Charm(Spawn, Spawn)

Posted: Thu Oct 04, 2012 4:09 pm
by John Adams
Throwing out a suggestion, use the function tick()? Set the duration high, and every tick, calc if it breaks or not. No extra code needed. Though I still think an adjustable Rule (maybe as an offset) would add value.

Re: New Lua Function: Charm(Spawn, Spawn)

Posted: Thu Oct 04, 2012 5:21 pm
by Jabantiz
Currently on the emu a tick can be resisted, and if it is resisted the spell script doesn't get called. For almost all spells that was wrong as ticks shouldn't be resisted for DoT's. If that is fixed we need to probably add a resist check lua function to see if the spell would be resisted again for charm spells and a way to remove a maintained spell from lua (break the charm if resisted).

The idea of an additional value for chance to break would be the easiest to code but wouldn't be like live, also wouldn't have to change the function as the value can be put in the db and it would be passed to the tick function where it could be checked there. We would still need a way to remove a maintianed spell from lua (not sure if we have that now or not).

I also may be over thinking all this and there could be a far simpler solution.