Senior Member
Join Date: Nov 2010
Location: Metairie, LA, USA
Posts: 1,819
|
I thought I would consolidate a list of things that get used over and over again in the Editor, or that I have otherwise found to be very useful. Hopefully this will be helpful for those, like me, who work best from having lots and lots of examples.
First I have found it very useful to go through the documentation found in Hero Lab by going to Help -> Savage Worlds Manual and from within that Manual there is a link to "Creating Custom Material" that also has some useful, although maybe a little confusing, stuff in it. But probably the most useful section I found was a little more buried. Go to Help -> Savage Worlds Manual, then click on "Adding Custom Content" then hit the "Click here" part of the sentence that says "Click here for more information on using the Editor with Savage Worlds." That information and the Tutorials section there on creating a Race is something I found to be really helpful. Finally I found the Expressions at http://hlkitwiki.wolflair.com/index....ag_Expressions to be very useful as well. I would also add that Mathias has written some really useful posts on the Pathfinder forum which he links here. Some of his examples may look Pathfinder specific, but they're still very relevant for coding in Savage Worlds files, too. Now on to the examples. Remember that in most cases we might list Edges or Skills below, but those really could be anything, where appropriate, so Hindrances or Equipment or Racial Abilities, whatever it is you have the UniqueID for. Also remember that for Savage Worlds the die type numbers are half the actual die type for our purposes in the program. So a d4 is 2, a d6 is 3, d8 is 4, a d12 is 6 and then anything higher than 6 turns into d12+(your number-6), so 7 is d12+1, 10 is d12+4 and so on. So on to some specific code things I've found useful. ----- To grant a specific skill at d6 (we use Healing in this example): Bootstrap: skHealing Eval Script: Pre-Traits/5000 Code:
~This will offset the cost: perform #resspent[resSkill,-,1,"Chaplain"] ~This will increase the Skill foreach pick in hero where "thingid.skHealing" eachpick.field[trtBonus].value += 1 nexteach To do that for a set Knowledge skill, let's use Knowledge (Latin) for this example: Bootstrap: skKnow Fields...: FieldID: domDomain, Value: Latin Code:
~This will offset the cost: perform #resspent[resSkill,-,1,"Latin"] ~This will increase Latin foreach pick in hero where "thingid.skKnow" if (compare(lowercase(eachpick.field[domDomain].text),"latin") = 0) then perform eachpick.field[trtBonus].modify[+,1,"Latin"] endif nexteach To modify a skill (or other trait,in this case we'll use Guts) roll, adding a +2 bonus to the roll rather than the die type, use (the thing in quotes is just a way of saying what it was that provided the bonus, in this case we're saying it's something called "Gutsy", maybe that's an Edge or a Racial Ability, what it is doesn't matter much, just make it understandable for why the bonus was given.): Eval Script: Pre-Traits/5000 Timing: Before: Calc trtFinal Code:
perform #traitroll[skGuts,+,2,"Gutsy"] ----- To modify a skill (again, we'll use Guts) by adding one die type use: Eval Script: Pre-Traits/5000 Timing: Before: Calc trtFinal Code:
perform #traitadjust[skGuts,+,1,"Gusto"] To search for an appropriate Knowledge skill (in this case Astronomy) of d10 or higher: Pre-reqs: Message: Knowledge (Astronomy) d10 required. Code:
foreach pick in hero where "thingid.skKnow" if (compare(lowercase(eachpick.field[domDomain].text),"astronomy") = 0) then validif (eachpick.field[trtFinal].value >= 5) endif nexteach To find a Knowledge field (in this case Arcane) and then add a bonus (+2) to the roll: Eval Script: Pre-Traits/5000 Timing: Before: Calc trtFinal Code:
~go through all knowledge skills and find an "Arcane" one foreach pick in hero where "thingid.skKnow" if (compare(lowercase(eachpick.field[domDomain].text),"arcane") = 0) then perform #traitroll[skKnow,+,2,"Highest Clearance"] endif nexteach ----- How about doing the reverse of that by finding a Knowledge field (in this case Arcane) and only adding a +2 bonus to everything that is NOT that version: Eval Script: Pre-Traits/5000 Timing: Before: Calc trtFinal Code:
~go through all knowledge skills and find an "Arcane" one foreach pick in hero where "thingid.skKnow" if (compare(lowercase(eachpick.field[domDomain].text),"arcane") <> 0) then perform eachpick.field[trtRoll].modify[+,1,"Smarty Pants"] endif nexteach To check if any one of a particular thing exists, like you would use in a Pick-req, but where we're not just looking for a single Edge to exist but rather if any one of a list of Edges exist. For this example we have Edges for both NCO and Officer and I just want to check that the character has either one of those edges: Expr-reqs: Message: Rank (NCO or Officer) Edge required. Code:
hero.tagis[Edge.edgTDNCO] + hero.tagis[Edge.edgTDOffic] <> 0 To check if any one of different criteria exist. This one is a bit more complicate. Let's say you wanted to check for if a character has either a Spirit of d8 OR a particular Edge (we'll use Nepotism for this, from Necropolis): Pre-reqs: Message: Spirit d8 required. Code:
validif (hero.child[attrSpi].field[trtFinal].value >= 4) validif (hero.tagis[Edge.edgNCNepot] <> 0) if (@ispick <> 0) then altpick.linkvalid = 0 endif Code:
foreach pick in hero where "thingid.skKnow" if (compare(lowercase(eachpick.field[domDomain].text),"artillery") = 0) then validif (eachpick.field[trtFinal].value >= 3) endif nexteach validif (hero.tagis[Edge.edgNCNepot] <> 0) if (@ispick <> 0) then altpick.linkvalid = 0 endif The "if (@ispick <> 0) then" part of that code is primarly just an error trap, so it seems it should be good practice to use it in this instance. (See http://forums.wolflair.com/showthread.php?t=33096 for more details.) ----- To level up a character, like the Veteran of the Wierd West Edge does in Deadlands: Eval Script: Pre-Traits/5000 Timing: Before: Calc trtFinal Code:
#resmax[resXP] += 20 #resmax[resAdvance] +=4 ----- For Expr-reqs it's important to note that if you are looking to check against a Trait that you KNOW every character has, like any of the Attributes (say, Spirit of d6 or higher) you an use something like: Code:
#trait[attrSpi] >= 3 Code:
#traitfound[skBoating] >= 3 To add an extra wound level: Eval Scripts: Setup/10000 Code:
herofield[acMaxWound].value += 1 To have the program ignore some amount of wound penalties (like for the Nerves of Steel Edge): Eval Scripts: Setup/10000 Code:
herofield[acIgnWound].value += 2 To perform different actions based on the existence of a certain Edge. In this example I have a derived trait called Fame (trPMFame) and if this character has the Noble edge (edgPMNoble) I want to add 15 points to the Fame trait, but if they don't have the Edge I want to give them 10 points of fame instead. Eval Script: Pre-Traits/5000 Timing: Before: Calc trtFinal Code:
if (hero.tagis[Edge.edgPMNoble] <> 0) then perform #traitadjust[trPMFame,+,15,"Admiral"] else perform #traitadjust[trPMFame,+,10,"Admiral"] endif To add extra damage onto a weapon, in this case jbearwillis asked for (and CapedCrusader provided the code) the ability to add an extra 1/2 Agility die modifier to damage for a weapon: Eval Script: Traits/5000 Timing: Before: Calc trtFinal Code:
var DamagePlus as number DamagePlus = hero.childfound[attrAgi].field[trtFinal].value - 1 field[wpDmgBonus].value += DamagePlus To create a drop-down "pick list", let's say to apply a +1 roll bonus to one of three skills (the Scholar Edge is another example worth looking at): Menu #1 Source: All Picks on Hero (this will make sure you don't get an error for trying to modify a skill that doesn't exist on the character) Menu #1 Tag Expression: thingid.skBoating | thingid.skDriving | thingid.skPiloting Eval Scripts: Pre-Traits/5000 - Before: Calc trtFinal Code:
~apply the +1 modifier to selected skill if (field[usrChosen1].ischosen <> 0) then perform field[usrChosen1].chosen.field[trtRoll].modify[+,1,"Ordo Novus Templum"] endif To create a weapon that doesn't use up your "hand slots", like you might use for a shoulder mounted weapon in power armor, or retractable claws: Eval Script Phase: Pre-Traits/5000 Code:
if (field[grIsEquip].value <> 0) then herofield[acHands].value += 1 endif Phase: Validation/8000 Code:
~if we have no more than three hands of gear equipped, we're good validif (hero.tagcount[Hero.Hand] <= herofield[acHands].value) ~mark associated tabs as invalid container.panelvalid[armory] = 0 Lenny Zimmermann Metairie, LA, USA Data files authored (please let me know if you see any issues with any of these if you have/use them): Official (In the downloader) 50 Fathoms, Deadlands: Hell On Earth, Deadlands: Noir, East Texas University, Necessary Evil (requires Super Powers Companion), Pirates of the Spanish Main, Space 1889 (original file by Erich), Tour of Darkness, Weird War II, Weird Wars: Rome Coming Eventually Evernight (LWD has completed their review but I have some fixes to make first... although Pinnacle mentioned this might get an overhaul to SWADE so I may just wait for that first. If you just HAVE to have this now, though, just PM me) Last edited by zarlor; September 3rd, 2013 at 08:03 AM. |
#1 |
|
|