![]() |
Lowering Stats with Hits - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Lowering Stats with Hits (/Thread-Lowering-Stats-with-Hits) |
Lowering Stats with Hits - Nachtmusique - 03-04-2015 03:05 PM Hello, I feel like this should be a simple thing, but for some reason I can't seem to wrap my mind around it. I would like to lower a character's stats (STR, DEX, and INT) as his hits are lowered as a percentage. For example: If a character has the following stats: 100 Maxhits 100 STR 50 DEX 75 INT and he takes 20 damage, it should drop his stats to: 80 STR 40 DEX 60 INT This would be easy to do in isolation, however I need Bless and curse spells to still operate correctly and I need the stats to rise incrementally as the Hits regenerate. I'm not asking anyone to script this FOR me, just help point me in the right direction. Thanks RE: Lowering Stats with Hits - Artyk - 03-04-2015 10:58 PM What i would do: Use MODDEX, MODINT, MODSTR to set the changes to the stats (always add or subtract, do not directly set them beacause those are used by spells too) Use @GetHit to modify stats as hits go down Use @RegenStat to change stats as hits are regened Use @Death to reset stats modifiers Remember to store initial max hits as it will change on str change RE: Lowering Stats with Hits - Nachtmusique - 03-05-2015 04:00 AM Thanks a bunch, this seems to have worked: [events e_wounds_combat] on=@statchange //say change! <ARGN1> IF (<ARGN1>==0)||(<ARGN1>==2)||(<ARGN1>==8)||(<ARGN1>==10) timerf 0 fixmaxstam ENDIF on=@regenstat IF (<LOCAL.STATID>==0) LOCAL.POH=<eval ((<HITS> + <local.Value>)*100)/<MAXHITS>> //HP as a % of MAXHITS //STR LOCAL.HBSTR = <eval (<OSTR>*<local.POH>)/100> IF !(<tag.HBSTR>==<LOCAL.HBSTR>) MODSTR=<eval (<MODSTR> + (<local.hbstr>-<TAG.HBSTR>))> TAG.HBSTR=<LOCAL.HBSTR> ENDIF //DEX LOCAL.HBDEX = <eval (<ODEX>*<local.POH>)/100> IF !(<tag.HBDEX>==<LOCAL.HBDEX>) MODDEX=<eval (<MODDEX> + (<local.hbdex>-<TAG.HBDEX>))> TAG.HBDEX=<LOCAL.HBDEX> ENDIF //INT LOCAL.HBINT = <eval (<OINT>*<local.POH>)/100> IF !(<tag.HBINT>==<LOCAL.HBINT>) MODINT=<eval (<MODINT> + (<local.hbint>-<TAG.HBINT>))> TAG.HBINT=<LOCAL.HBINT> ENDIF WAKECHECK ENDIF on=@gethit IF (<FLAGS> & statf_stone) RETURN 1 ENDIF LOCAL.POH=<eval ((<HITS> - <argn1>)*100)/<MAXHITS>> //HP as a % of MAXHITS //STR LOCAL.HBSTR = <eval (<OSTR>*<local.POH>)/100> IF !(<tag.HBSTR>==<LOCAL.HBSTR>) MODSTR=<eval (<MODSTR> - (<TAG.HBSTR>-<local.hbstr>))> TAG.HBSTR=<LOCAL.HBSTR> ENDIF //DEX LOCAL.HBDEX = <eval (<ODEX>*<local.POH>)/100> IF !(<tag.HBDEX>==<LOCAL.HBDEX>) MODDEX=<eval (<MODDEX> - (<TAG.HBDEX>-<local.hbdex>))> TAG.HBDEX=<LOCAL.HBDEX> ENDIF //INT LOCAL.HBINT = <eval (<OINT>*<local.POH>)/100> IF !(<tag.HBINT>==<LOCAL.HBINT>) MODINT=<eval (<MODINT> - (<TAG.HBINT>-<local.hbint>))> TAG.HBINT=<LOCAL.HBINT> ENDIF |