New Lua Function: Charm(Spawn, Spawn)

Discussions on development of both the EQ2Emulator LUA Script Engine and Script specifications

Moderator: Team Members

Post Reply
Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

New Lua Function: Charm(Spawn, Spawn)

Post by Jabantiz » Wed Oct 03, 2012 5:03 pm

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

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: New Lua Function: Charm(Spawn, Spawn)

Post by John Adams » Thu Oct 04, 2012 9:03 am

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... ?

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

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

Post by Jabantiz » Thu Oct 04, 2012 3:33 pm

Wikia says it has a recurring chance to break, I am unsure of how to handle this at the moment.

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: New Lua Function: Charm(Spawn, Spawn)

Post by John Adams » Thu Oct 04, 2012 4:09 pm

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.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

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

Post by Jabantiz » Thu Oct 04, 2012 5:21 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests