• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Common Code Examples

This will probably work in either version -

Say you have a piece of gear that gives you a particular Strength when equipped (for example is a d12+1)
Code:
Pre-Traits/5100
var strdiff as number
var curr as number

if (field[grIsEquip].value <> 0) then
  ~ get current values
  curr = #traitbonus[attrStr] + #traitcreation[attrStr] + #traituser[attrStr]
  ~ set strength to d12+1
  strdiff = 7 - curr
  #traitinplay[attrStr] += strdiff
  endif
 
Okay, just something I have been working on for awhile. If you like to make the creatures from your source-books or just new ones and you want more oomph to Natural Weapons. This will give you the ability to add a Natural Weapon that includes the fields for Armour Piercing and Weapon Reach. And will reflect properly on the printed character sheet.

So make a new version of abWeapon (Natural Weapon) like this with the following code:

abXXWeapon

Initialization 2000
Code:
~if we have a weapon die, we must forward it immediately (before it's used)
if (tagis[WeaponDie.?] <> 0) then
perform hero.child[wpUnarmed].pushtags[WeaponDie.?]
endif

Effects 5000
Code:
~customize the Unarmed Attack pick with the appropriate name
~Note: Do this BEFORE modifying our name below to use an undecorated name.
perform hero.child[wpUnarmed].setfocus
focus.field[livename].text = field[name].text

~set Reach to 1
focus.field[wpReach].value = field[abilValue].value

~set AP to 1
focus.field[wpPiercing].value = field[abilText].text

~get our ability text; if we have none, assume "Str"
~Note: This handles the case of a natural weapon with no additional die.
var ability as string
ability = field[abilText].text
if (empty(ability) <> 0) then
ability = "Str"
endif

~if we don't have a weapon die, assign the damage text
if (tagis[WeaponDie.?] = 0) then
focus.field[wpDamage].text = ability
endif

~if our live name is currently empty, use our default name
if (field[livename].isempty <> 0) then
field[livename].text = field[name].text
endif

~update our name appropriately for display
if (tagis[WeaponDie.?] <> 0) then
var die as number
die = tagvalue[WeaponDie.?] * 2
field[livename].text &= " (Str+d" & die & ")"
else
field[livename].text &= " (" & ability & ")"
endif

This is your cheat sheet to remember:
Fields:
livename = Attack type name
abilValue = Reach value
abilText = Armor Piercing value

Tags:
WeaponDie #
 
Back
Top