Verifying Actor Pre-Requisites (Savage)

From HLKitWiki
Jump to: navigation, search

Context: HL KitAuthoring Examples … Savage Worlds Walk-Through 

Overview

Before we can successfully implement hindrances and edges, there are a few facets of the actor that must be tracked. These facets behave as pre-requisites and are tested by certain hindrances and edges, so they need to be managed properly.

Character Rank

Every edge specifies the minimum rank required for a character to select it, and the rank is based on the number of experience points earned by the character during play. This rank needs to be calculated and tracked for the actor so that the edges can verify compliance properly. In order to do this, we need to add a new field to the "Actor" component that represents the rank and auto-calculates itself. We use a numeric value to represent the rank, since numbers are easily compared, so the five character ranks defined in the rulebook are assigned a value from 0-4, with zero representing a Novice (starting) character and four indicating a Legendary character.

Open the file "actor.str" and the first component is the "Actor" component. Towards the end of the list of fields, add a new field for the rank. Define a suitable Calculate script for the field and it should be all set. The resulting new field should look similar to the following:

<field
  id="acRank"
  name="Current Rank"
  type="derived">
  <calculate phase="Final" priority="1000"><![CDATA[
    var xp as number
    xp = hero.child[resXP].field[resMax].value
    if (xp < 80) then
      @value = round(xp / 20,0,-1)
    else
      @value = 4
      endif
    ]]></calculate>
  </field> 

Wild Cards

Quite a few edges are only applicable to characters that are designated as "wild cards". As such, this state also needs to be tracked within the "Actor" component. We need to allow the user to control this state, so it needs to be a "user" field. To keep things simple, we consider a value of zero to indicate the character is not a wild card, while a non-zero value indicates the character is a wild card. Since the majority of characters that users will create will be wild cards, we assume a value of one as our default. In the end, the field should look a lot like the following:

<field
  id="acIsWild"
  name="Is Wild Card?"
  type="user"
  defvalue="1">
  </field>