kyleflow 35 Report post Posted December 20, 2023 Known as an example that a cleric spiritual bolt is the only dmg skill that affected by Spirit stats. Can anyone guide me on how to change other buff to be affected by Spirit stats also. In the function for spiritual bolt, is this indicate spirit level ? function Skill_Xlcz_End ( ATKER , DEFER , sklv ) if ValidCha(ATKER) == 0 then LG ( "luascript_err" , "function Skill_Xlcz_End : ATKER as null" ) return end if ValidCha(DEFER) == 0 then LG ( "luascript_err" , "function Skill_Xlcz_End : DEFER as null" ) return end -- local atkdmg = Atk_Dmg ( ATKER , DEFER ) local lv_atker = Lv ( TurnToCha ( ATKER ) ) local lv_defer = Lv ( TurnToCha ( DEFER ) ) local sta_atker = Sta(ATKER) -- IS THIS THE Spirit STATS or IS THIS SP AMOUNT? local sta_defer = Sta(DEFER) local lv_dif = math.max ( ( - 1 ) * 10 , math.min ( 10 , lv_atker - lv_defer ) ) local AddStateLv = 0 AddStateLv = GetChaStateLv ( ATKER , STATE_MLCH ) hpdmg = math.floor (( 10 + sta_atker * 2 ) * ( 1 + sklv * 0.25 ) * ( 1 + lv_dif * 0.025 )) local map_name_ATKER = GetChaMapName ( ATKER ) local map_name_DEFER = GetChaMapName ( DEFER ) local agi_atker = Agi(ATKER) local Can_Pk_Garner2 = Is_NormalMonster (DEFER) if map_name_ATKER == "garner2" or map_name_DEFER == "garner2" then if Can_Pk_Garner2 == 0 then local dmg = MAGIC_Atk_Dmg(ATKER,DEFER) hpdmg = math.floor (dmg * ( 1 + sklv * 0.1 ) ) -- Notice ( "statetime="..statetime) end end local dmg_fin = Cuihua_Mofa ( hpdmg ,AddStateLv ) local dmg_ElfSkill = ElfSkill_MagicAtk ( hpdmg , ATKER ) dmg_fin = dmg_fin + dmg_ElfSkill Hp_Endure_Dmg ( DEFER, dmg_fin ) -- LG( "xlcz", "Spiritual Bolt Skill Level=" , sklv ,"Attacker sta=", sta ,"Normal attack damage=", atkdmg , "Skill Damage= " , dmg , "\n" ) end Is this the part for Spirit Stats or is it SP amount? local sta_atker = Sta(ATKER) Quote Share this post Link to post Share on other sites
mkhzaleh 132 Report post Posted December 20, 2023 47 minutes ago, kyleflow said: local sta_atker = Sta(ATKER) function Sta(a) --LuaPrint("Obtain character attribute sta") local sta=GetChaAttr(a,ATTR_STA) --[[ȡsta]]-- return sta end spr values Quote Share this post Link to post Share on other sites
kyleflow 35 Report post Posted December 21, 2023 11 hours ago, mkhzaleh said: function Sta(a) --LuaPrint("Obtain character attribute sta") local sta=GetChaAttr(a,ATTR_STA) --[[ȡsta]]-- return sta end spr values I tried to change the way it calculate harden buff with Sta in play but it just not working out. Can you check why its not working based on this code. function State_Shpf_Add ( role , statelv ) --LG("state", "function State_Shpf_Add : " , " role = ", role, "statelv = " , statelv , "\n" ) local sta_buff = Sta(ATKER) * 0.5 -- tarik stats spr local def_dif = 10 + sta_buff + statelv * 4 -- asal 10 + statelv * 4 local def = DefSb(role) + def_dif SetCharaAttr( def , role , ATTR_STATEV_DEF ) ALLExAttrSet(role) end function State_Shpf_Rem ( role , statelv ) -- LG("state", "function State_Shpf_Rem : " ,"statelv = " , statelv , " role = ", role, "\n" ) local sta_buff = Sta(ATKER) * 0.5 local def_dif = 10 + sta_buff + statelv * 4 local def = DefSb(role) - def_dif SetCharaAttr( def , role , ATTR_STATEV_DEF ) ALLExAttrSet(role) end I tried it multiple time, simply adding a check for Sta also fails the skill. not including the Sta call up inside the def_dif calculation for that trial. But in the code I include it and it also fail. it wont change the value from the before buff value. Quote Share this post Link to post Share on other sites
mkhzaleh 132 Report post Posted December 21, 2023 5 hours ago, kyleflow said: I tried to change the way it calculate harden buff with Sta in play but it just not working out. Can you check why its not working based on this code. function State_Shpf_Add ( role , statelv ) --LG("state", "function State_Shpf_Add : " , " role = ", role, "statelv = " , statelv , "\n" ) local sta_buff = Sta(ATKER) * 0.5 -- tarik stats spr local def_dif = 10 + sta_buff + statelv * 4 -- asal 10 + statelv * 4 local def = DefSb(role) + def_dif SetCharaAttr( def , role , ATTR_STATEV_DEF ) ALLExAttrSet(role) end function State_Shpf_Rem ( role , statelv ) -- LG("state", "function State_Shpf_Rem : " ,"statelv = " , statelv , " role = ", role, "\n" ) local sta_buff = Sta(ATKER) * 0.5 local def_dif = 10 + sta_buff + statelv * 4 local def = DefSb(role) - def_dif SetCharaAttr( def , role , ATTR_STATEV_DEF ) ALLExAttrSet(role) end I tried it multiple time, simply adding a check for Sta also fails the skill. not including the Sta call up inside the def_dif calculation for that trial. But in the code I include it and it also fail. it wont change the value from the before buff value. not sure what are you trying to do but you already call none exist role in your code local sta_buff = Sta(ATKER) * 0.5 -- tarik stats spr its role not atker Quote Share this post Link to post Share on other sites
kyleflow 35 Report post Posted December 21, 2023 2 hours ago, mkhzaleh said: not sure what are you trying to do but you already call none exist role in your code local sta_buff = Sta(ATKER) * 0.5 -- tarik stats spr its role not atker I tried to include the value of Spirit into the calculation of def_dif so that it can be add and remove. Is it not ATKER role? weird since I check the one for heal. it seem like it. but the one on heal seem be complicated and I don't know how to properly align it with the harden. Quote Share this post Link to post Share on other sites
kyleflow 35 Report post Posted December 21, 2023 @mkhzaleh i tried simply change it into this local sta_buff = Sta(role) This actually work but the stats its calculated is based on the target Spirit not the buffer. Probably that is why in heal, it used ATKER instead of other role. now need to think on how to ensure the buffer Spirit is used for the def calculation Quote Share this post Link to post Share on other sites
mkhzaleh 132 Report post Posted December 22, 2023 16 hours ago, kyleflow said: @mkhzaleh i tried simply change it into this local sta_buff = Sta(role) This actually work but the stats its calculated is based on the target Spirit not the buffer. Probably that is why in heal, it used ATKER instead of other role. now need to think on how to ensure the buffer Spirit is used for the def calculation you have to store buffer spr inside Skill_Xlcz_End inside table then use them later on inside states, that's only way, as addstates have info only about current player 1 Quote Share this post Link to post Share on other sites
kyleflow 35 Report post Posted December 22, 2023 Okay thanks @mkhzaleh. Figured it out. Working as expected. Quote Share this post Link to post Share on other sites