The ruleset does the replacement - use [[A]], [[AA]], [[AAA]], [[R]] and [[F]] for one action, two actions, three actions, reaction and free action respectively.
Printable View
I'm actually just doing direct character code replacement, but it's good to know the replacement syntax:
s = s:gsub("%[one%-action%]", string.char(141));
s = s:gsub("%[two%-actions%]", string.char(143));
s = s:gsub("%[three%-actions%]", string.char(144));
s = s:gsub("%[reaction%]", string.char(157));
s = s:gsub("%[free%-action%]", string.char(129));
will do
any idea why the PFS npc's wont parse?
Script Error: [string "campaign/scripts/npc_parse.lua"]:34: attempt to index local 'sStatBlock' (a nil value)
this is the stat block im trying to parse and yes i know its alreadt in the SR beastairy but im just using this as an example as its in the srd
MITFLIT LEVEL –1
LE SMALL FEY GREMLIN
Perception +4; darkvision, scent (imprecise) 30 feet
Languages Undercommon
Skills Acrobatics +5, Diplomacy +1 (+7 vs. arthropods), Nature +3, Stealth +5, Thievery +5
Str –1, Dex +3, Con +0, Int –1, Wis +1, Cha –1
Self-Loathing (emotion, mental) A mitflit’s self-loathing makes it easy to influence. It takes a –4 penalty on its Will DC against checks to Coerce, Demoralize, Make an Impression, and Request.
Vermin Empathy Mitflits can use Diplomacy to Make an Impression on and Request things of arthropods (insects, spiders, scorpions, crabs, and similar invertebrate animals). Most arthropods have a starting attitude of indifferent to mitflits.
Items dart (10), shortsword
AC 15; Fort +2, Ref +7, Will +4
HP 10; Weaknesses cold iron 2
Speed 20 feet; climb 20 feet
[[A]]shortsword +8 (agile, finesse, versatile S), Damage 1d6–1 piercing
[[A]] dart +8 (agile, range increment 20 feet, thrown), Damage 1d4–1 piercing
Primal Innate Spells DC 16; 2nd speak with animals (at will;
arthropods only); 1st bane; Cantrips (1st) prestidigitation
Sneak Attack The mitflit sneak deals 1d6 extra precision damage to flat-footed creatures.
Vengeful Anger (emotion, mental) As long as it isn’t frightened, a mitflit gains a +2 status bonus to damage rolls against a creature that has previously damaged or tormented it.
The parser does not seem to like "LEVEL –1". Replace the first line with e.g. "MITFLIT CREATURE 1" (it at least parses for me that way).
Thanks
That's right. Level is not currently recognized on the first line. I'm pretty much going by the stat block format laid out in the Bestiary.
@Trenloe: I'm having a minor issue parsing spells, creating all the correct caster classes, and adding spells on the actions tab. The first time I parse a creature that has spells, I end up with the correct spell classes and levels, but no spells. Then, if I manually delete all the caster classes and parse again, it works fine. I'm manually creating the "spellset" node and spell classes if needed, but using SpellManager.addSpell to add spells once I have a spell class node.
I took a look in the ruleset, and two things caught my eye. I'm wondering if either of these might be related to my issue:
- The PC record adds a DB handler for the "spellset" node, but I don't see any such handler being set up for the NPC record. Since I'm creating "spellset" manually, is it possible I'm confusing something in the ruleset?
- SpellManager.addSpell returns nil if the level and "spells" node have not yet been created. Currently I'm only creating those nodes in the case that I can't find the spell in the rulebook module, which generally isn't the case when parsing bestiary entries. But those nodes are being created at some point. I haven't figured out how.
I'll keep investigating, but if you can think of any reason for this behavior, please let me know.
EDIT: Here are some screen shots to illustrate.
First here's the result after the first parse, followed by the console output after turning on globaldebug:
Attachment 28409
Code:Runtime Notice: Reloading ruleset
Runtime Notice: s'srting_traits_line.lua - onInit. sTraitType = creature'
Runtime Notice: s'SpellManager.addSpell. nodeSource, nodeSpellClass, nLevel = ' | databasenode = { reference.spells.command@Pathfinder Second Edition Core Rules } | databasenode = { npc.id-00030.spellset.id-00001 } | #1 | nil | nil | nil | nil | nil | nil | nil
Runtime Notice: s'SpellManager.addSpell. nodeSource, nodeSpellClass, nLevel = ' | databasenode = { reference.spells.detectalignment@Pathfinder Second Edition Core Rules } | databasenode = { npc.id-00030.spellset.id-00001 } | #1 | nil | nil | nil | nil | nil | nil | nil
Runtime Notice: s'SpellManager.addSpell. nodeSource, nodeSpellClass, nLevel = ' | databasenode = { reference.spells.mending@Pathfinder Second Edition Core Rules } | databasenode = { npc.id-00030.spellset.id-00001 } | #1 | nil | nil | nil | nil | nil | nil | nil
Runtime Notice: s'SpellManager.addSpell. nodeSource, nodeSpellClass, nLevel = ' | databasenode = { reference.spells.readomens@Pathfinder Second Edition Core Rules } | databasenode = { npc.id-00030.spellset.id-00001 } | #4 | nil | nil | nil | nil | nil | nil | nil
Hmm, I'm wondering if there's a different way I should be creating "spellset" and/or the spell class. Immediately after pushing the Parse button, the spell class looks like:
Only after switching to the Actions tab do the remainder of the spell class nodes (available levels, etc.) show up. I'm currently just using DB.createChild, is there a better way that will fully initialize the spell class?Code:<id-00001>
<availablelevel1 type="number">5</availablelevel1>
<availablelevel4 type="number">1</availablelevel4>
<cl type="number">1</cl>
<dc>
<misc type="number">7</misc>
</dc>
<label type="string">Divine Innate Spells</label>
<levels>
</levels>
<tradition type="string">divine</tradition>
</id-00001>
Code:function CreateSpellClass(sSpellClassName, nodeRecord)
-- Open or Create the root node for Spell Classes.
local nodeSpellset = DB.createChild(nodeRecord, "spellset");
-- Find any existing SpellClass.
local nodeSpellClass, nodeLabel;
for _,v in pairs(nodeSpellset.getChildren()) do
nodeLabel = v.getChild("label");
if nodeLabel and sSpellClassName == nodeLabel.getValue() then
nodeSpellClass = v;
break;
end
end
-- SpellClass was not found, create it.
if not nodeSpellClass then
nodeSpellClass = nodeSpellset.createChild();
DB.setValue(nodeSpellClass, "label", "string", sSpellClassName);
nodeSpellClass.createChild("levels");
end
return nodeSpellClass;
end