• 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

M&M 2nd ed. Custom output

Duggan

Well-known member
So... I decided to finally get cracking, and I'm partway through an output script for 2E files that does some additional bits like showing the cost of individual powers. There are parts that are more difficult than I thought and parts that were far easier than expected. Right now, I only show the name, skills, saves, abilities, and powers, and the last is a bit rough.

Sample Output:
Whiplash

Power Level: 10 Power Points Spent: 150/150

Str: +0/+5(10/20) Dex: +3(16) Con: +2/+7(14/24) Int: +1(12) Wis: +2(14) Cha: +0/+7(10/24)

Tough: +7/+11 (Imp: +4) Fort: +7 Ref: +10 Will: +7
Skills:
  • Acrobatics 12 (+15) [3 PP] - You can flip, dive, roll, tumble, and perform other acrobatic maneuvers, and you're also adept at keeping your balance under difficult circumstances.
  • Bluff 0 (+7) [0 PP] - Bluff is the skill of making the outlandish seem credible. It covers acting, fast-talk, trickery, and subterfuge.
  • Climb 0 (+5) [0 PP] - You're skilled in scaling angled and uneven surfaces.
  • Concentration 4 (+6) [1 PP] - You can focus your mind and concentrate despite difficult conditions, including taking damage.
  • Diplomacy 0 (+7) [0 PP] - You're skilled in dealing with people, from etiquette and social graces to a way with words and public speaking. Use this skill to make a good impression, negotiate, and win people over.
  • Disguise 0 (+7) [0 PP] - You can use makeup, costumes, and other props to change your appearance.
  • Escape Artist 6 (+9/+12) [1.5 PP] - You're trained in escaping bonds and other restraints.
  • Gamble 0 (+2) [0 PP] - Use this skill to win games involving both skill and luck. Games based solely only luck - such as flipping a coin - or skill - such as chess - don't involve Gamble checks, unless the character cheats.
  • Gather Information 0 (+7) [0 PP] - You know how to make contacts, collect gossip and rumors, question informants, and otherwise get information from people.
  • Handle Animal 0 (+7) [0 PP] - You know how to handle, care for, and train various types of animals.
  • Intimidate 12 (+19) [3 PP] - You know how to use threats (real or implied) to get others to cooperate.
  • Medicine 2 (+4) [0.5 PP] - You're trained in treating injuries and illness.
  • Navigate 0 (+1) [0 PP] - You're trained in finding directions and plotting courses from place to place.
  • Notice 8 (+10) [2 PP] - Use this skill to notice things.
  • Profession (Librarian) 2 (+4) [0.5 PP] - You're trained in a profession such as accountant, doctor, engineer, game designer, lawyer, police officer, reporter, teacher, writer, and so forth.
  • Search 4 (+5) [1 PP] - You can search an area for clues, hidden items, traps, and other details. Notice allows you to immediately notice things, Search allows you to pick up on details with some effort. Search works in conjunction with all accurate senses (sight is the only accurate sense for normal humans).
  • Sense Motive 6 (+8) [1.5 PP] - You can tell someone's true intentions by paying attention to body language, inflection, and intuition.
  • Stealth 10 (+13) [2.5 PP] - You're skilled at going unnoticed.
  • Survival 2 (+4) [0.5 PP] - You use this skill to survive in the wilderness, including finding food and shelter, and safely guiding others.
  • Swim 0 (+5) [0 PP] - You can swim and maneuver underwater.
Powers:
  • Jaded (Immunity 5) (interaction skills) - [5 PP]
  • Leaping 1 (Jumping distance: x2) - [1 PP]
  • Leather Catsuit (Container, Passive 2) () - [10 PP]
    • Immunity 2 (environmental condition: Heat, environmental condition: Cold) - [2 PP]
    • Protection 4 (+4 Toughness; Impervious) - [8 PP]
  • Magically Enhanced Traits (Enhanced Trait 40) (Traits: Constitution +10 (24, +7), Strength +10 (20, +5), Charisma +14 (24, +7), Dodge Focus 6 +4 (+6), Feats: Attractive 2 (+8)) - [40 PP]
  • Speed 1 (Speed: 10 mph, 88 ft./rnd) - [1 PP]
  • Whip Powers (Container, Passive 6) () - [30 PP]
    • Elongation 3 (Elongation: 25 ft., range incr 30 ft., +3 Escape & Grapple; Projection; Limited (Limited to whip)) - [3 PP]
    • Enhanced Trait 11 (Feats: Attack Specialization 3 (Grapple), Chokehold, Defensive Throw, Fascinate (Intimidate), Improved Disarm, Improved Grab, Improved Grapple, Improved Pin, Improved Trip) - [11 PP]
    • Strike 6 (DC 26; Mighty) - [10 PP]
      • Blinding Strike (Dazzle 7) (affects: visual senses, DC 17; Range (touch)) - [1 PP]
      • Gimp (Paralyze 7) (DC 17; Alternate Save (Fortitude); Slow) - [1 PP]
      • Trip 5 (Knockback; Range (touch); Custom (Mighty - Add Strength bonus to trip attempt), Custom (Up in the Air (Choose direction of Knockback))) - [1 PP]
    • Super-Movement 3 (slow fall, swinging, wall-crawling 1 (half speed)) - [6 PP]

Python code:
Code:
import sys
import xml.etree.ElementTree as ET

def printPowers (powers):
   if powers is not None and len(powers) > 0:
      print ('[list]')
      for power in powers:
         print ('[*][b]' + power.attrib['name'], '[/b](' + power.attrib['summary'] + ') - [i][' + power.find('cost').attrib['text'] + '][/i]')

         otherpowersEl = power.find('otherpowers')
         printPowers(otherpowersEl)

         alternatePowersEl = power.find('alternatepowers')
         printPowers(alternatePowersEl)
      print('[/list]')   
      

xmlfile = open(sys.argv[1], 'r')
tree = ET.parse(xmlfile)
xmlfile.close()

root = tree.getroot()

for character in root.findall("./*/character"):
   role = character.attrib['role']
   
   name = character.attrib.get('name')
   if name is None:
      name = "Unnamed Hero"

   print ('[SIZE=150]' + character.attrib['name'] + '[/SIZE]')
   print ()

   resources = character.find('resources')
   if resources is not None:
      currentPL = resources.attrib['currentpl']
      totalPP = resources.attrib['totalpp']

      # Next step is to pull in the resources themselves.
      totalPPSpent = 0
      resourceVals = resources.findall('resource')
      for resource in resourceVals:
        totalPPSpent += int(resource.attrib['spent'])

      print ('Power Level: ' + str(currentPL) + ' Power Points Spent: ' + str(totalPPSpent), end='')

      if role == 'pc':
         print ('/' + str(totalPP))
      else:
         print ()

      print ()
   #print the attributes
   attributesEl = character.find('attributes')

   if attributesEl is not None:
      attributes = attributesEl.findall('attribute')

      for attribute in attributes:
         print ('[b]' + attribute.attrib['name'][0:3] + ': ', end='')

         attrvalue = attribute.find('attrvalue')
         attrbonus = attribute.find('attrbonus')

         if attrbonus is not None:
            print (attrbonus.attrib['text'] + '[/b]', end='')
         else:
            print ('[/b]', end='')

         if attrvalue is not None:
            print ('(' + attrvalue.attrib['text'] + ')', end='')

         print (' ', end='')
      print ()
      print ()

   #Saves
   savesEl = character.find('saves')

   if savesEl is not None:
      saves = savesEl.findall('save')

      print ('[b]', end='')
      for save in saves:
         print (save.attrib['abbr'] + ': ' + save.attrib['text'] + ' ', end='')

         if int(save.attrib['impervious']) > 0:
            print ('[i](Imp: ' + save.attrib['impervious'] + ')[/i] ', end='')
      print ('[/b]')

   #Skills
   skillsEl = character.find('skills')
   if skillsEl is not None:
      skills = skillsEl.findall('skill')
      print ('[b]Skills: [/b][list]')
      
      for skill in skills:
         userRanks = int(skill.attrib['user'])
         if userRanks > 0 or skill.attrib.get('trainedonly') != 'yes':
           print ('[*]', skill.attrib['name'], userRanks, '([b]' + skill.attrib['value'] + '[/b])',
                  '[i][' + skill.find('cost').attrib['text'] + '][/i] - ', skill.find('description').text)
                                                   
      print ('[/list]')

   #Powers
   powersEl = character.find('powers')
   if powersEl is not None:
      print ('[B]Powers:[/B]')
      printPowers(powersEl)
 
It exports all of the fields I can access (there are some odd items not present such as dodge bonus / flat-footed defense, "multiple powers" entries in arrays, and personalizations) in a reasonably clear format. I'm going to call that good enough for now:

Hosea "Ace" Skaggs

Power Level: 8 Power Points Spent: 120/120

Str: +3 (16) Dex: +4 (18) Con: +3 (16) Int: +1 (12) Wis: +1 (12) Cha: +1 (12)

Tough: +3/+7 Fort: +8 Ref: +9 Will: +5

Skills:
Acrobatics +4 (+8), Bluff +0 (+1), Climb +2 (+5), Concentration +6 (+7), Diplomacy +0 (+1), Disable Device +4 (+5), Disguise +0 (+1), Drive +2 (+6), Escape Artist +3 (+7), Gamble +0 (+1), Gather Information +0 (+1), Handle Animal +0 (+1), Intimidate +6 (+7), Investigate +2 (+3), Knowledge (current events) +1 (+2), Knowledge (popular culture) +1 (+2), Knowledge (streetwise) +1 (+2), Knowledge (tactics) +6 (+7), Knowledge (technology) +2 (+3), Medicine +2 (+3), Navigate +0 (+1), Notice +6 (+7), Profession (Agent) +2 (+3), Search +2 (+3), Sense Motive +7 (+8), Stealth +7 (+11), Survival +6 (+7), Swim +8 (+11)

Feats:
All-Out Attack, Attack Focus (ranged) 2, Attack Specialization (Assault Rifle), Benefit (FBI Agent), Chokehold, Diehard, Dodge Focus 4, Equipment 5, Favored Opponent 2 2 (Aces) (+2), Fighting Style: Krav Maga, Grappling Finesse, Improved Aim, Improved Block, Improved Critical (Assault Rifle), Improved Disarm, Improved Grapple, Improved Sunder, Improved Trip, Luck 2, Move-by Action, Power Attack, Precise Shot, Quick Draw 2, Startle, Swift

Powers:
  • Parkour (Super-Movement 3) (training, sure-footed 3 (75% penalty reduction)) - [6 PP]

Equipment:
  • Arsenal[19 ep]
    • Assault Rifle[16 ep]
    • Flash-Bang[1 ep*]
    • Fragmentation Grenade[1 ep*]
    • Taser[1 ep*]
  • FBI Standard issue [No Cost][free!]
    • Commlink[1 ep*]
    • Handcuffs[1 ep*]
    • ID Card(Enhanced Trait 1[Feats: Benefit (FBI Agent)])[1 ep*]
    • Light Pistol[1 ep*]
    • Stun Gun[14 ep]
    • Undercover Shirt[1 ep*]
  • Multi-Tool[1 ep]
  • Night Vision Goggles[1 ep]
  • Tactical Vest[4 ep]

Attack Bonus: +5 (Ranged: +7, Melee: +5, Grapple: +9)

Attacks: Assault Rifle, +9 (DC 20) Crit: 19-20 [50ft. range incr.]; Flash-Bang, +7 (DC 14) [20ft. Radius]; Fragmentation Grenade, +7 (DC 15) [50ft. Radius]; Light Pistol, +7 (DC 18) [30ft. range incr.]; Stun Gun, +5 (DC 17); Taser, +7 (DC 15) [5ft. range incr.]; Unarmed Attack, +5 (DC 18)

Defense: +9 (Flat-footed: ?), Knockback: -3

Initiative: +4

Encumbrance: Light: 76 lbs, Medium: 153 lbs, Heavy: 230 lbs, Maximum: 460 lbs, Push / Drag: 1.2k lbs

Gender: Male Age: 25
Eyes: Hair:
Height: 5' 8" Weight: 175 lb.

Totals: Abilities 26 + Skills 20 + Feats 34 + Powers 6 + Combat 20 + Saves 14 + Drawbacks 0 = 120
 
Huh... apparently, the code tags don't block BBCode being processed. The script is attached in a ZIP file. The first parameter is the XML file to be processed. The script does not have much error-checking as I mainly just wanted to get it done.
 

Attachments

Last edited:
here's the C# / Window thingamajig for taking in the Custom XML files for 2E and exporting the BBCode. I'm going to try to knock out 3E tonight, as well as add the ability to simply select a portfolio and export one or more characters from it.

The executable can take paths to XML files on the command line, or you can invoke it without any parameters and it will prompt you to select what files you will (it supports multi-select). Once the files are processed, it pops up a window with the BBCode displayed and selected.

It's bare-bones, but hopefully enough for those wishing to extend it. There are also some areas not covered due to items not exported into the XML such as dodge bonus, array slots with "multiple powers", and Features of Vehicles and HQs.
 

Attachments

Back
Top