PDA

View Full Version : War of the Dead: Slow Shamblers



Timbo1974
May 16th, 2012, 08:44
Howdy,

I'm looking at running a War of the Dead campaign some time on the future and in attempt to learn a little about creating modules I've been working my way through getting chapter one into FG.

One thing I've added but I'd like to automate in the combat tracker is the "Slow" special ability. Basically all I want to do is make sure that any character/personality with Slow gets redealt cards until their card is 5 or less.

I've found the references for Quick in the main SW files and I think I could just hack Slow along side it in there but I'd rather put it in a seperate module.

So where would I begin to do this? I don't expect anyone to give me all the code, in fact I'd much prefer to work through this myself. I'd just rather not stumble around in the dark for a month or two only to have someone eventually say "nah that won't work: do it this way." Just a reference to an xml file node or lua file line number would be a great help.

Additionally if there's another module out there that has already implemented something like this could you let me know what it is and I'll grab that and start digging.

Thanks in advance,

Timbo

phantomwhale
May 16th, 2012, 12:00
Excellent project - esp. as I made combat tracker edges nice and extensible to support exactly this !

You'll need a directory in your extensions folder called "MyWarOfTheDeadExtension" or anything you like. You'll zip up all the files in this folder and put a .ext extension on it eventually, but for now just having that directory will let you play with it.

Inside there you'll first need an extension.xml file - this is the "base" file that bootstraps everything. It should look something like this :


<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Copyright SmiteWorks USA, LLC., 2011 -->
<root version="2.8">

<properties>
<name>My awesome extension</name>
<version>1.0</version>

<author>My Name</author>
<description>Adds Slow support and stuff</description>

<ruleset>
<name>SavageWorlds3</name>
<minrelease>3.2</minrelease>
</ruleset>
</properties>

<base>
<includefile source="an_xml_file.xml" />
<script name="NameOfScriptThatIsntTooImportant" file="scripts/my_script_name.lua" />

</base>
</root>

You'll need one line for each XML file, and one line for each "standalone" script (e.g. a script that does stuff without being used as part of a windowclass). You can happily scan the SavageWorlds ruleset for lots of examples of these (the file is called base.xml in the ruleset - extension.xml is for extensions, but they look the same).

Then, you'll need to write some actual code and make sure you reference the files in this file ! You can actually define windowclasses in the extension.xml file, but best practice suggests keeping windowclass definitions in separate files (how they are organised beyond that is probably more a matter of taste than convention).

It might just be one script file you need, thinking about it - that was probably overkill advice ! I would expect it to have an onInit() method like so :


function onInit()
InitiativeManager.registerAbilityHandler("slow", "SLOW", slowHandler)
end

function slowHandler(wActorGroup, tCard, fDraw)
-- Left as exercise for reader ;)
end

Better stop myself here before I give away the answer :D

Any questions, just shout. Don't forget to post the solution up on the forums (as an .ext file) - I know a couple of people asked about this a while back...

Doswelk
May 16th, 2012, 17:03
Don't forget to post the solution up on the forums (as an .ext file) - I know a couple of people asked about this a while back...

Indeed I know Weird War II has a similar hindrance and I think Necropolis does as well, I know two GMs who would be very happy to see this...

Timbo1974
May 17th, 2012, 10:41
Firstly I have to say a HUGE thanks to phantomwhale for your help, it's greatly appreciated and I'll make sure to post the results here ASAP.

As for the code well it's done... almost.

I've got the extension working with the following code but I'm getting an error on the msg.text = wCombatantGroup.getName() line. I suspect this is a global variable or scope issue, which may not be fixable.

I come from a Delphi/Powershell background so this whole thing is a bit of a crash course in LUA. I've looked through a few of the other lua files and put my (limited) Google-fu to task but couldn't find any hints on how to solve this sooooo I thought I'd once again ask for help. If it's not do-able then I can easily change the line to state something like "Dealt an X and redealing due to Slow" or something like that.


function slowHandler(wActorGroup, tCard, fDraw)
local msg = {font = "systemfont"}
if OptionsManager.isOption("ARIN", "on") then
while tCard.getValue().getOrder() > CardLib.Value.five.getOrder() do
msg.text = wCombatantGroup.getName() .. " was dealt the " .. tCard.displayName() .. "; redealing"
ChatManager.deliverMessage(msg)
tCard = fDraw()
end
elseif tCard.getValue().getOrder() > CardLib.Value.five.getOrder() then
msg.text = wCombatantGroup.getName() .. " was dealt the " .. tCard.displayName() .. " and may redraw"
ChatManager.deliverMessage(msg)
end
return tCard
end

phantomwhale
May 17th, 2012, 12:50
Ah - when I gave you the sample code, it was from my latest, greatest version of the software, where clearly I have decided the "Combatants" are actually "Actors" (as sometimes it's not a combat, it might be a chase or a social dillema).

Details aside, the error is a simple one. One of the parameters passed into the slowHandler function is called "wActorGroup" - that is the "window contained the actor group". If you change that parameter name to "wCombatantGroup", then it should work.

Timbo1974
May 17th, 2012, 13:51
One of the parameters passed into the slowHandler function is called "wActorGroup" - that is the "window contained the actor group". If you change that parameter name to "wCombatantGroup", then it should work.
Aha I was looking back over the code for the quickHandler earlier and noticed that... and then promptly forgot all about it *sigh* My youngest hasn't been too well and I've had very little sleep over the last two days so not probably the best time to pick up another coding project.

Anyway thanks again phantomwhale.

Even though my total input in this process has been nothing more than replacing a ">=" with a "<" I think I can say I've got bug. FG is an amazing piece of software as it is but the ability to write some code and extend it just helps us get one step closer to the ultimate RPG dream: rules without (too much) paperwork.

So without further ado here it is, version 1.0 of the extension: 2495.

Mask_of_winter
May 17th, 2012, 14:05
I'm running a game this weekend so I'm gonna grab this extension and let you know how it went. Thanks in advance!

Mask_of_winter
May 21st, 2012, 13:54
We playtested the extension this weekend. It worked as intended. Thanks Timbo!

Timbo1974
May 21st, 2012, 15:28
We playtested the extension this weekend. It worked as intended. Thanks Timbo!
Ah that's fantastic, I'm just glad someone found it useful.

Timbo

ShotGun Jolly
May 23rd, 2012, 19:23
I would very much like to get this extension.. As I too play WoTD :) Where can I find it *Edit* in the module?

Doswelk
May 23rd, 2012, 22:01
I would very much like to get this extension.. As I too play WoTD :) Where can I find it?

about three posts up the extension is included in the post

ShotGun Jolly
May 24th, 2012, 11:40
Sorry


I wasnt clear when I asked. Where do I find the slow option inside extension?

I load it up, and I cant seem to find it...

Timbo1974
May 24th, 2012, 11:52
Sorry


I wasnt clear when I asked. Where do I find the slow option inside extension?

I load it up, and I cant seem to find it...

I put the reference entry for Slow in my WotD GM book which I can't share, sorry :(. Just type in the entry manually, it's case insensitve so "Slow", "SLOW" and "slow" will all work.

Timbo

ShotGun Jolly
May 24th, 2012, 11:59
No worries,

Ill figure it out. Although I been using FG for awhile now, I never really learned how to really use it.

So create it, like I would a mod or an item?

phantomwhale
May 24th, 2012, 12:09
Nope, you literally just have to type "slow" in as the value of a hindrance (for PCs) or a special ability (for NPCs). You can even put it in as an edge.

The code will just look for anything (case-insensitive) matching slow, and apply the rules during combat. Same for "quick", "level-headed" and "improved level-headed" in the core ruleset.

So, to be clear, there is nothing you "create" really, it just works by string matching magic.

Timbo1974
May 24th, 2012, 12:13
So create it, like I would a mod or an item?
Exactly, I add it directly to the personality/creature in the "Special" list on the Combat tab.

Doswelk
May 24th, 2012, 17:27
Nope, you literally just have to type "slow" in as the value of a hindrance (for PCs) or a special ability (for NPCs). You can even put it in as an edge.

The code will just look for anything (case-insensitive) matching slow, and apply the rules during combat. Same for "quick", "level-headed" and "improved level-headed" in the core ruleset.

So, to be clear, there is nothing you "create" really, it just works by string matching magic.

When testing this it only seemed to work for PCs when added as an edge for me.

ShotGun Jolly
May 25th, 2012, 00:25
Got it working!... this is fantastic! this is gonna speed up my WoTD game now!

Timbo1974
May 25th, 2012, 04:10
When testing this it only seemed to work for PCs when added as an edge for me.
Hmmm same here, I'd only ever tested it with personalities and never thought of trying it as a PC hindrance. I'll look into getting that fixed.

phantomwhale
May 25th, 2012, 06:39
Hmmm same here, I'd only ever tested it with personalities and never thought of trying it as a PC hindrance. I'll look into getting that fixed.

Ah yeah - sorry - thinking about it the core code says "get abilities", which translates as special abilities for NPCs and Edges for PCs. There is currently no hindrance that affects initiative, so no easy way to check them

Might not be a simple extension fix (but don't let that stop you trying !) - will try and add a hook in to include hindrances for next release.

All said, may I suggest as a workaround, you simply put Slow down as an Edge for your PCs. From memory, War of the Dead uses it as a special ability on zombies, and I really can't see a PC taking it as a hindrance (might be wrong), so I suspect what's written is most likely going to meet 95% of peoples needs.

All total assumptions there, of course, feel free to shoot them down :)

Timbo1974
May 25th, 2012, 06:55
All said, may I suggest as a workaround, you simply put Slow down as an Edge for your PCs. From memory, War of the Dead uses it as a special ability on zombies, and I really can't see a PC taking it as a hindrance (might be wrong), so I suspect what's written is most likely going to meet 95% of peoples needs.

All total assumptions there, of course, feel free to shoot them down :)

No shooting required, entering it as an Edge is the simplest solution.

In my game I put the Slow hindrance in the GM's book thereby making it unavailable to PC's. Can't see why they'd ever take it... but then again players tend to do the darnedest things.

ShotGun Jolly
June 1st, 2012, 15:58
Timbo,

Wanna say thanks for this, this one little file has added new life to my WoTD campaign. With out this file, I use to dread having mobs of zombies on the table, now it all works SWEET!!

My players are also very grateful for it as well...

Jolly

Timbo1974
June 2nd, 2012, 01:09
Timbo,

Wanna say thanks for this, this one little file has added new life to my WoTD campaign. With out this file, I use to dread having mobs of zombies on the table, now it all works SWEET!!

My players are also very grateful for it as well...

Jolly
No worries at all, I'm just really glad someone found it useful.