LUA Needs (a list)

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

Moderator: Team Members

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:

LUA Needs (a list)

Post by John Adams » Sun Aug 04, 2013 2:00 am

Handling Reactions in LUA --

Jab/Foof,

Do we currently have LUA functionality where the spell script itself can react to certain scenarios? Check out this spell Hold the Line.
"When damaged this spell has a 50% chance to cast Holding the Line on target's attacker. "
  • "Increases Threat to target by 49 "
"On a block this spell will cast Holding the Line on target's victim. "
  • "Increases Threat to target by 49 "
How would I know (in LUA) that my player blocked the incoming damage, so I could increase threat by 49? If I do not block and thus take damage, how do I know this so I can calc a 50% chance to increase threat?

If there are any current examples of this kind of magic, please let me know. Otherwise, I'm looking for another LUA function I suppose.

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: LUA Needs (a list)

Post by John Adams » Sun Aug 04, 2013 2:38 am

I'm going through Zcoretri's old spell scripts and seeing notes. Here's a few more:

Spell: Armored
Increases the caster's effectiveness of worn armor vs physical damage by 15%
Need to handle "Worn Armor" - as in, on the body, not worn out lol
AddSpellBonus(Target, 0, Stats) -- STR needs to fixed to allow 0
Has this been fixed yet? I am assuming this removes any existing STR bonus?
Increases Mitigation of caster vs noxious and arcane damage by 19
Increases Mitigation of caster vs elemental damage by 152
Is this just adding bonuses to these stats?


I guess while looking through LUA functions, I do not see anything for the blocking, avoidance, mitigation, etc. Guess I got some code to write! Unless of course these things do not yet exist in the core of the emu either heh... meanwhile, sleeping...
<more to come>

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

Re: LUA Needs (a list)

Post by Jabantiz » Sun Aug 04, 2013 12:08 pm

John Adams wrote:Handling Reactions in LUA --

Jab/Foof,

Do we currently have LUA functionality where the spell script itself can react to certain scenarios? Check out this spell Hold the Line.
"When damaged this spell has a 50% chance to cast Holding the Line on target's attacker. "
  • "Increases Threat to target by 49 "
"On a block this spell will cast Holding the Line on target's victim. "
  • "Increases Threat to target by 49 "
How would I know (in LUA) that my player blocked the incoming damage, so I could increase threat by 49? If I do not block and thus take damage, how do I know this so I can calc a 50% chance to increase threat?

If there are any current examples of this kind of magic, please let me know. Otherwise, I'm looking for another LUA function I suppose.
I had a plan for defensive procs like this but never fleshed it out. Basically a lua function would take a spell id spell tier and %chance to trigger and add it to a list in entity, when ever a entity takes damage it would cycle through the list doing checks on all the procs and casting them if need be.

The lua function would be something like this

Code: Select all

AddDefensiveProc(Spawn, spell_id, spell_tier, %chance)
We could also use this in item scripts that give the same type of proc. It would need to be expanded to handle blocks though, maybe add a type variable to handle it.

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

Re: LUA Needs (a list)

Post by Jabantiz » Sun Aug 04, 2013 12:19 pm

John Adams wrote:I'm going through Zcoretri's old spell scripts and seeing notes. Here's a few more:

Spell: Armored
Increases the caster's effectiveness of worn armor vs physical damage by 15%
Need to handle "Worn Armor" - as in, on the body, not worn out lol
I believe this is the ITEM_STAT_ARMORMITIGATIONINCREASE stat, which means we would just need to use a AddSpellBonus
John Adams wrote:
AddSpellBonus(Target, 0, Stats) -- STR needs to fixed to allow 0
Has this been fixed yet? I am assuming this removes any existing STR bonus?
This has been fixed.
John Adams wrote:
Increases Mitigation of caster vs noxious and arcane damage by 19
Increases Mitigation of caster vs elemental damage by 152
Is this just adding bonuses to these stats?
Yea this would just require a AddSpellBonus
John Adams wrote: I guess while looking through LUA functions, I do not see anything for the blocking, avoidance, mitigation, etc. Guess I got some code to write! Unless of course these things do not yet exist in the core of the emu either heh... meanwhile, sleeping...
<more to come>
Do you mean stats or something else?

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: LUA Needs (a list)

Post by John Adams » Sun Aug 04, 2013 12:30 pm

Jabantiz wrote:
John Adams wrote: I guess while looking through LUA functions, I do not see anything for the blocking, avoidance, mitigation, etc. Guess I got some code to write! Unless of course these things do not yet exist in the core of the emu either heh... meanwhile, sleeping...
<more to come>
Do you mean stats or something else?
There are 5 fields in the DB that appear to do nothing atm : mitigation/avoidaince/parry/deflection and block. These are what I mean. I guess they are "stats", and can be modified in LUA via AddSpellBonus? I do not ever see the data change in the character_details table, so I assumed this was never hooked up.
  • Sidenote: is that an odd name for a bonus to stats: Spell Bonus? or is it because it is achieved via a spell?

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

Re: LUA Needs (a list)

Post by Jabantiz » Sun Aug 04, 2013 12:37 pm

I assumed it was named that because the bonus came from spells, would have to ask LE about it.

The DB values are for base values I believe, armor and spells just add on top of that. Can blocking/avoidance/parry/deflection/block have a base value?

User avatar
xinux
Team Member
Posts: 680
Joined: Wed Mar 10, 2010 11:10 am
Location: Destroyer of Servers

Re: LUA Needs (a list)

Post by xinux » Sun Aug 04, 2013 1:39 pm

Jabantiz wrote:Can blocking/avoidance/parry/deflection/block have a base value?

Yes they have a base value
EQ II - Build=1360 (Orig) - Build=1360 (DoF) - Build=2654 (KoS) - Build=3375 (Classic) - Build=3554 (EoF)
EQ II - Build=4412 (RoK) - Build=5122 (TSO) - Build=6118 (SF) - Build=7628 (DoV) - Build=8295 (Aod)

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: LUA Needs (a list)

Post by thefoof » Sun Aug 04, 2013 3:29 pm

Yeah mitigation and other stats should be increased but it's in server side memory not a DB change from spells. I think we send base mit and increased mit as the same value which is just a cosmetic bug, where it appears as white in the character stats page instead of green like it should. (not that mit does anything yet)

We should probably also look at adding a function that gets called after the normal error checks, but before a player starts casting a spell as well. Some spells have specific reqs before a spell can be used (they aren't this way anymore, but off the top of my head the shield attacks used to require you have a shield equipped).

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:

Spells functionality needed

Post by John Adams » Wed Nov 20, 2013 5:20 pm

Going to start a post here in Scripting relating to Spell "requirements" we may need for implementing some of the tricky spells. This is the first one - a Level 1 Mez --
-- Info from spell_display_effects (remove from script when done)
-- Mesmerizes target
-- Prevents AOE (except when direct)
-- Dispelled when target takes damage
-- Epic targets gain an immunity to Mesmerize effects of 45.0 seconds and duration is reduced to 5.0 seconds.
-- Resistibility increases against targets higher than level 29.
Mesmerizes the target and removes them from being affected by area of effect spells for a short duration. Mesmerization breaks if the target receives any damage. This spell can be cast while stunned or stifled.
So, this protects the mezzed spawn from being affected by other AoE's.

I assume we already break Mez if we walk up and hit the mezzed spawn?

And what brought me here was the ability for the CASTER to be stunned or stifled, and still be able to cast. I imagine this will need to be another flag in the spells table? Or can we control that through the LUA script? Guess it depends where the "CanCast" check is done?

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

Re: Spells functionality needed

Post by Jabantiz » Wed Nov 20, 2013 5:52 pm

I never noticed there were spells that could be cast while stunned or stifled, we currently check that in the server core with no way to bypass it. As for prevents AOE, I think all mez spells add that so we could hardcode a check. We could also add some lua functions and a bool to spawns to make them immune to AOE's, this would allow us to have other spells block AOE.

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: LUA Needs (a list)

Post by John Adams » Wed Nov 20, 2013 9:25 pm

I just realized I already had "A List" of my LUA neediness, so I merged these topics :)

Here's a question, not a need... relating to AddSpellBonus().

A spell will do both of these --

Code: Select all

    -- Decreases Damage Per Second of target by 4.2
    AddSpellBonus(Target, 629, DPSAmt)

    -- Decreases Attack Speed of target by 3.6
    AddSpellBonus(Target, 617, AttackSpeed)
So do I still only need to do one of these?

Code: Select all

    RemoveSpellBonus(Target)

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: LUA Needs (a list)

Post by thefoof » Wed Nov 20, 2013 9:51 pm

Yup, you only need one call to RemoveSpellBonus(Target).

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: LUA Needs (a list)

Post by John Adams » Thu Nov 21, 2013 5:34 pm

Here's another LUA trigger we need (if it's not already there) -- a percentage chance to break the spell

Touch of the Grey, our first EQ2 Custom spell :D (/useability 5000)

Code: Select all

function cast(Caster, Target, SlowAmt)

    -- Applies Touch of the Grey.  Lasts for 10.0 seconds.
    --     Slows target by 30.2%
    --     5% chance to dispel when target receives hostile action (to do)
    --     5% chance to dispel when target takes damage (to do)

    AddSpellBonus(Target, 610, SlowAmt)

end

function remove(Caster, Target)
    RemoveSpellBonus(Target)
end
This is my script so far, about to test a spell calling another spell to see if custom spells work as we hope.

Note, I don't care if these trivialities don't work right now, just wanting to make a record of the things I think we need to consider.

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: LUA Needs (a list)

Post by John Adams » Thu Nov 21, 2013 9:28 pm

One more -
I have a spell that in order to cast, requires a Bow is equipped (Channeler). I was going to build a precast() for this, but couldn't find a GetItemEquippedByType() or something along those lines. Any ideas?

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

Re: LUA Needs (a list)

Post by Jabantiz » Thu Nov 21, 2013 10:11 pm


Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests