it's not wrong get the bonus value based on static MOREY values (10, 250, 500, ...) but you can replace this with an dynamic formula (same formula used intenally) which can return any value (+1, +2, +3, +4, +5, ...) instead only these pre-defined values (+1, +3, +5, ...)
Code:
[EVENTS e_magicwpn]
ON=@ItemAfterClick
IF (<ACT.ATTR> & attr_magic)
IF (<ACT.ISWEAPON>)
LOCAL.Bonus=<GetOldMagicBonus <ACT.MOREY>>
LOCAL.ClickMsgText="+<dLOCAL.Bonus> <LOCAL.ClickMsgText>"
LOCAL.ClickMsgHue=<DEF0.WeaponMagicColor.<dLOCAL.Bonus>>
ELIF (<ACT.ISARMOR>)
LOCAL.Bonus=<GetOldMagicBonus <ACT.MOREY>>
LOCAL.ClickMsgText="+<dLOCAL.Bonus> <LOCAL.ClickMsgText>"
ENDIF
ENDIF
[FUNCTION GetOldMagicBonus]
ARGS=<SERV.SPELL.s_enchant.EFFECT>
return <eval <ARGV0> + (((<ARGV1> - <ARGV0>) * <MOREY>) / 1000)>
[DEFNAME WeaponMagicColor]
WeaponMagicColor.1 0a37
WeaponMagicColor.2
WeaponMagicColor.3 07be
WeaponMagicColor.4
WeaponMagicColor.5 067a
WeaponMagicColor.6
WeaponMagicColor.7 09de
WeaponMagicColor.8
WeaponMagicColor.9 04e9
PS: note that the bonus value is based on EFFECT value of s_enchant spell (by default is EFFECT=1,9) and the weapon MOREY will indicate which value between 1,9 should be returned. So you must make sure that EFFECT value on s_enchant is properly set, and also make sure that armors/weapons have MOREY between 0.0 ~ 100.0 (which is the same as 0% ~ 100%). If you want go over > 100.0 you must increase EFFECT value on s_enchant spell instead set MOREY > 100.0 on the weapon
(05-21-2019 09:02 PM)x77x Wrote: example?
also... anyway you can get the message stationary?
when you click on the item, then move the item, the text stays in the original spot...
(because it is using message)
using SAY/MESSAGE will make sphere send an say/message packet, so using
Code:
ON=@Click
MESSAGE something
return 1
it will drop the internal packet (return 1) and create another one to do the same thing, which doesn't make much sense. So you can replace this code with
Code:
ON=@AfterClick
LOCAL.ClickMsgText="something"
//LOCAL.ClickMsgHue=123
which will use the same internal packet and just override its text/color