GM Spells and Abilities

Discussion concerning lmarkus' campaign framework for D&D3.x and Pathfinder.

Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice, lmarkus001

Forum rules
Discussion regarding lmarkus001's framework only. Other posts deleted without notice! :)
User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: GM Spells and Abilities

Post by aliasmask »

I believe it is described several pages back, but I don't recall off hand. Are you using the latest version of the FW? I'll see if I can find the reference as well and then maybe post it.

Found it: http://forums.rptools.net/viewtopic.php ... 10#p153808

neofax
Great Wyrm
Posts: 1694
Joined: Tue May 26, 2009 8:51 pm
Location: Philadelphia, PA
Contact:

Re: GM Spells and Abilities

Post by neofax »

I don't know how to get this to work using the Mod Set, but here is code(blatantly stolen from Lindsay's post) to set a note for the Equipment modifier like the Jump MOD:

Code: Select all

[H: tNote = "" ]
[H: system = getLibProperty("System", "Lib:GlobalsSRDPF")]
<!-- Set applicable skill into sSkill variable. -->
[H: sSkill = "Acrobatics" ]
[H: tJmod = 4 ]
[H: tSpMod = 5 ]
<!-- Obtain tskID. -->
[H: numSkills = json.length(SkillsJ)]
[H, FOR(i, 0, numSkills), CODE: {
   [cSkill = json.get(SkillsJ, i)]
   [IF(json.contains(cSkill, "fullname")): skN = json.get(cSkill, "fullname"); skN = json.get(cSkill, "name")]
   [ foundSkill = if( skN == sSkill, 1, 0 )]
   [IF(foundSkill): tskID = i]
}]
<!-- Set applicable skill to the correct amount. -->
[SWITCH(system), CODE: 
  case "Pathfinder": {
        [H: tNote = " ((Equipment MOD: " + tSpMod + " )) " ]
        [H: tSkill = json.get(SkillsJ, tskID) ]
        [H: tNotes = json.get(tSkill, "notes") ]
        [H: tid = strfind( tNotes, "\\(\\(Equipment MOD \\(Speed\\)\\: \\-*[0-9]* \\)\\)" ) ]
        [H, IF(getFindCount( tid ) != 0):  tNotes = substring( tNotes, 0, getGroupStart( tid, 1, 0 ) ) + substring( tNotes, getGroupEnd( tid, 1, 0 ) ) ]
        [H: tNotes = tNotes + tNote ]
        [H: SkillsJ = json.set(SkillsJ, tskID, json.set( tSkill, "notes", tNotes ) ) ]
  };
  case "D&D3.5": {
        [H: SkillsJ = json.set(SkillsJ, tskID, json.set( json.get(SkillsJ, tskID), "speedmod", tSpMod ) ) ]
  };
  default: {  }
]
Notice that I set tSpMod = 5. So if your modifier does more or less, you will need to change that. I am wondering if I could put a macro call in globalMod to retrieve the modifier from this could would work. Probably not as SkillsJ is not exposed to the Mod Set.

neofax
Great Wyrm
Posts: 1694
Joined: Tue May 26, 2009 8:51 pm
Location: Philadelphia, PA
Contact:

Re: GM Spells and Abilities

Post by neofax »

Okay, I am trying to use the above code along with some other code I grabbed from "subSkillCheck" to basically make a tmSkills macro that will update the "equip" item on the skill in the JSON SkillsJ once a PC equips an item. i.e. Boots of Elvenkind However, when I place tmSkills@this in globalMod while using Edit Items/Equip Items, it does not work as I either get an error stating "Unable to evaluate expression tmSkills@this" or "Unable to evaluate expression tmSkills@Lib:libDnD35Pathfinder". So, how would I go about accomplishing this?

Code: Select all

[H, IF( json.type( macro.args ) == "UNKNOWN" ): targSkill = 0; targSkill = lower( json.get( macro.args, "targSkill" ) ) ]
[H: gTok = "Lib:GlobalsSRDPF"]

[H: TokenList = getSelected()]
[H: numTList = listCount(tokenList)]
[H: abort(numTList)]

[H: tToken = listGet(tokenList,0)]
[H: switchToken(tToken)]

[H: sysVars = table("SysVars", 0)]
[H: sizeList = table("SysVars", json.get(sysVars, "sizeList"))]

[H: gSkillsSys = getLibProperty("SkillsSys", gTok)]
[H: gSystem = getLibProperty("System", gTok)]
[H: gSkillsIndex = json.get(getLibProperty("SkillsIndex", gTok), gSystem)]
[H: gSysSkillTemplate = json.get(json.get(gSkillsSys, gSystem), "sysSkillTemplate")]
[R: gSkills = json.get(json.get(gSkillsSys, gSystem), "sysSkills")]
[H, SWITCH(gSystem), CODE:
  case "Pathfinder": {
    [H: systext = "Pathfinder"]
    [H: classBonus = 3]
  };
  case "D&D3.5": {
    [H: systext = "DnD35"]
    [H: classBonus = 0]
  };
  default: {
    [H: systext = "DnD35"]
    [H: classBonus = 0]
  }
]

[H: skillList = ""]
[H: tSkillsJ = "[]"]
[H, FOREACH(s, gSkills), CODE: {
   [H: skLocN = table("SysLocale",  json.get(s, "locID"))]
   [H: skUntrain = json.get(s, "untrain")]
   [H, IF(skUntrain): skillList = listAppend(skillList, skLocN)]
   [H, IF(skUntrain): tSkillsJ = json.append(tSkillsJ, s)]
}]
<!-- Set applicable skill into tempSkill variable. -->
[H, IF( targSkill == "" ): targSkill = listFind( skillList, targSkill ) ]
[H: cancel = input(
   "tempSkill | " + skillList + " | Select a skill | LIST |SELECT=" + listFind( skillList, targSkill ),
   "tempBonus | 0 | Temporary bonus",
   "tip|This only lists Untrained useable skills.|Note|LABEL"
)]
[H: abort(cancel)]
[ pause( "tempSkill", 
[C(numTList,""), CODE:  {

   [H: tToken = listGet(tokenList,roll.count)]
   [H: switchToken(tToken)]

   [H: sizeID =  listFind(sizeList, getSize())]

   [H: tSkill = json.get(tSkillsJ, tempSkill)]
   [H: skN = json.get(tSkill, "name")]

   [H: tnumSkills =  json.length(SkillsJ)]
   [H: tfound = 0]
   [H: tcnt = 0]
   [H, WHILE(tfound == 0 && tcnt < tnumSkills), CODE: {
      [H: cSkillJ = json.get(SkillsJ, tcnt)]
      [H: tKey = json.get(cSkillJ, "name")]
      [H, IF(tKey == skN): tfound = 1]
      [H: tcnt = tcnt + 1]
   }]
   [H, IF(tfound): tSkill = json.merge(cSkillJ, tSkill); assert(tfound, "Skill " + skN + " not found on token " + token.name, 0)]

<!-- Obtain tskID. -->
[H: numSkills = json.length(SkillsJ)]
[H, FOR(i, 0, numSkills), CODE: {
   [cSkill = json.get(SkillsJ, i)]
   [IF(json.contains(cSkill, "fullname")): skN = json.get(cSkill, "fullname"); skN = json.get(cSkill, "name")]
   [ foundSkill = if( skN == tempSkill, 1, 0 )]
   [IF(foundSkill): tskID = i]
}]
<!-- Set applicable skill to the correct amount. -->
[SWITCH(system), CODE: 
  case "Pathfinder": {
        [H: tSkill = json.get(SkillsJ, tskID) ]
        [H: SkillsJ = json.set(SkillsJ, tskID, json.set( tSkill, "equip", tempBonus ) ) ]
  };
  case "D&D3.5": {
        [H: SkillsJ = json.set(SkillsJ, tskID, json.set( json.get(SkillsJ, tskID), "equip", tempBonus ) ) ]
  };
  default: {  }
]

Post Reply

Return to “D&D 3.5/Pathfinder 1e Campaign Macros”