Author Topic: cr.Stat vs cr.StatBase and cr.Param vs cr.ParamBase  (Read 2344 times)

cr.Stat vs cr.StatBase and cr.Param vs cr.ParamBase
« on: May 21, 2016, 12:13:53 am »
Can someone explain me what are the differences between Stat - StatBase, and Param - ParamBase. Which one to use in what situation?

I would also like to ask how can I add new stats or new skills to critters.

Thank you in advance for your helping.

Offline Wipe

  • Rotator
  • Random is god
Re: cr.Stat vs cr.StatBase and cr.Param vs cr.ParamBase
« Reply #1 on: May 22, 2016, 08:38:24 pm »
Taking #pragma crdata "Kill 260 282" as example (usually found in _defines) -- adds Critter::Kill and Critter::KillBase properties to scripts, which makes code a little more readable and always result in error if you try to set a param outside of specified range. Critter::Param and Critter::ParamBase [always added by engine] does not have such restriction.

In that case it may useful, as kills counter param is never set directly, but based on ST_BODY_TYPE; if, for any reason, killed critter would have this param set to >=40, and you'd use Critter::Param instead of Critter::Kills, attacker gets a free perk (their params start at 300) for killing something -- obvious bug easily prevented and reported in logs.

::*Base property is used to read/write "raw" values, whatever you set is stored in character file and sent to client, while other variant is is read-only and may be processed before returning value to scripts. SPECIAL params, on most servers, always return 1-10, no matter what base value is. If you set ST_STRENGTH to 1207, Critter::Stat[0] will always return 10, as value is limited by dlls before passed to scripts. If you set it to 0, you'll get 1. ST_PERCEPTION may return 1 if you have damaged eye. And so on, and so on ... one could say that Critter::ParamBase is 'expectations' and Critter::Param is 'reality' :P

I hope at least half of this post makes sense.
Games are meant to be created, not played...