my first spell to work on

Creating the Spells and Abilities for EQ2Emulator

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

my first spell to work on

Post by Ememjr » Wed Mar 06, 2019 7:08 am

Please correct me if i am wrong

Code: Select all

--[[
    Script Name    : Spells/Scout/Rogue/Swashbuckler/Bladeweaver.lua
    Script Author  : Jabantiz
    Script Date    : 2013.12.16 01:12:03
    Script Purpose : 
                   : 
--]]

function cast(Caster, Target,STA,AGI,BA,MvP,resists)
    -- Increases STA of caster by 0.7
    AddSpellBonus(Target, 1, STA)

    -- Increases AGI of caster by 15.0
    AddSpellBonus(Target, 2, AGI)

    -- Adds 14.0% to base avoidance.
    AddSpellBonus(Target, 696, BA)

    -- Increases Mitigation of caster vs physical damage by 82
    AddSpellBonus(Target, 200, MvP)

    -- Increases Mitigation of caster vs elemental, noxious and arcane damage by 183
    AddSpellBonus(Target, 201, resists)
    AddSpellBonus(Target, 202, resists)
    AddSpellBonus(Target, 203, resists)

end

function remove(Caster, Target)
    RemoveSpellBonus(Target)
end
i modified the above spell script since it did not have the data for the spell passed to it by adding STA,AGI,BA,MvP,resists
problems i noticed
1. when tracing through the lua addspellbonus, for STA ,0 was passed to value instead of .7 i am guessing cuz this line

Code: Select all

sint32 value = lua_interface->GetSInt32Value(state, 3);
only accepts whole numbers and not decimal??
2. same thing for STA passed 0 but when i add manually(ie replace the AGI with 20) my AGI does increase
3. still testing BA and MvP (possible struct issue for displaying
4. resists updated correctly on character sheet

if i am correct about

Code: Select all

sint32 value = lua_interface->GetSInt32Value(state, 3);
only getting 0 from a .7 value cuz its an int then we should change that because there are many stats that increase by decimal .7, 1.2,78.5 etc

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

Re: my first spell to work on

Post by Jabantiz » Wed Mar 06, 2019 5:18 pm

It is going to be more then just that as I believe every where a stat like that (str/agi/sta/int/wis) is involved we only store an int and not a float.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: my first spell to work on

Post by Ememjr » Wed Mar 06, 2019 6:22 pm

i am going to start converting the code for those to be a float

tyrbo
Team Member
Posts: 271
Joined: Thu Feb 18, 2016 12:33 pm

Re: my first spell to work on

Post by tyrbo » Thu Mar 07, 2019 9:51 am

I think I ended up just rounding those values.

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

Re: my first spell to work on

Post by Jabantiz » Thu Mar 07, 2019 4:10 pm

If I remember correct the packet struct needs to be a sint16 so all the code probably followed that, so at some point the value will either need to be rounded or truncated when sent to the client.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: my first spell to work on

Post by Ememjr » Thu Mar 07, 2019 5:50 pm

yes it is rounded when sent to the client, but the server needs to handle the .2 etc cuz that can make alot of difference in stat calues etc later in game

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest