SphereCommunity
+9 dagger - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: +9 dagger (/Thread-9-dagger)

Pages: 1 2


RE: +9 dagger - x77x - 04-26-2019 09:13 AM

this seems to work for me...

Code:
ON=@ItemClick
if <act.amount> > 1
   return 0
endif

local.message = <act.name>
if <act.tag0.rare> == 1
    local.hue = 042//045 < -2 TO GET THE COLOR I WANT
  elseif <act.tag0.rare> == 2
    local.hue = 060//062
  elseif <act.tag0.rare> == 3
    local.hue = 06f//071
  elseif <act.tag0.rare> == 4
    local.hue = 029//02b
endif

if <act.attr>&attr_magic
  if <act.isweapon>
   local.message = +<ddef.wpn_magic_morey_<act.morey>> <act.name>
  elseif <act.isarmor>
    local.message = +<ddef.arm_magic_morey_<act.morey>> <act.name>
  endif
endif

  if !<local.hue>
   act.message <local.message>
  elseif <local.hue>>0
   local.hue = (<local.hue>+3)//TO MATCH COLORS
   act.message @<local.hue> <local.message>
   else
     act.message @<local.hue> <local.message>
  endif

  IF <act.attr>&attr_newbie
    act.message @035 [newbied]
  ENDIF

  IF (<EVAL <ACT.TAG0.MILITARY>>==1)
    act.message @07d6 [military property]
  ENDIF

RETURN 1



RE: +9 dagger - ShiryuX - 05-20-2019 03:01 AM

I would recommend using @AfterClick. Or use MESSAGEUA instead of MESSAGE, with 6 as message type. This way, the message will display as "You see:" on the journal, instead of a normal message from the item (which would look like if someone was speaking).


RE: +9 dagger - x77x - 05-21-2019 09:02 PM

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)


RE: +9 dagger - Coruja - 05-26-2019 06:17 AM

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


RE: +9 dagger - ShiryuX - 05-28-2019 08:19 PM

The locals are good if you only have to send ONE message.
Otherwise, as I said, you can use MESSAGEUA.

Code:
[TYPEDEF t_Enhanced_Item]
ON=@AfterClick
local.color = <qval <color> ? <color> : 944>
if !(<attr>&attr_identified)
    messageua <local.color>,6,3,esp <name>
    messageua 946,6,3,esp [Magica]
    return 1
endif

The message will follow the item (as you will see in the journal "You see: name, You see: [Magica]")