Tuesday, August 8, 2017

Converting Lone Wolf to Twine and SugarCube - part 3 - Finishing Disciplines


    I'm back :) For me it's the day after the last post - for you it's the week of waiting. Before I get to my 'discoveries' let me stop and talk about this series for a second.
    Why am I doing this? Well, I love role-playing games, love the Lone Wolf books, like to learn new programs and ways to make games, have no friends so I need solo games I can play, and I've got waaayyy too much free time.
    So this is not a professional tutorial.
    I also want to remember what I've gone through. All the code and ideas start to blur after a while, so I like the idea of having a history of how this project develops. Going down the wrong path sucks, but it also teaches, and I don't want to forget any of the lessons.
    So I'm going to show you something I did wrong. Well, in a way. And how I kind of fixed it (actually, re-did it).

    Even though these next steps are going to be a mistake, I'm going to keep presenting all the code and screenshots - it's something of a before and after to compare. If, by some chance you have been copying and playing with my code yourself just be mindful that these aren't quite going to work right (at least they didn't for me).

    Now, yesterday as I started looking into 'boxes of all types, I had a thought: what if I kept the same text list I had just worked on and simply added a counter for each discipline chosen - couldn't I keep the user from going crazy and just re-use what I had? Might be a bit simpler than adding a new kind of user input. Also, again, the documentation and tutorials online are not always the easiest for me to understand - which made the idea of using what I had more attractive. It did go a bit wonky though.

I had this list that the player could click on...



The clicks were built on this code...
<span id="ak_choose">
<<click "Learn Animal Kinship.">>
<<set $Disciplines to {"Animal Kinship": true}>>
<<replace #ak_choose>>You know the Animal Kinship discipline.<</replace>>
<</click>>
</span>

Easy, click on the text, set the variable, text goes to plain (non-click). What, I thought, if I added a variable tracking how many disciplines the player had clicked on, and then check that number before setting the variable. Also, I could put a message if the player went over their allotted 5 disciplines...
<<set _chosen to 0>>

You may now choose the 5 disciplines that you have learned during your training...

<span id="choose_warn"></span>

<span id="ak_choose">
<<click "Learn Animal Kinship.">>
<<if _chosen lt 5>>
<<set $Disciplines to {"AnimalKinship": true}>>
<<replace #ak_choose>>You know the Animal Kinship discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>>
<</click>>
</span>

Okay, so I set a variable for the number of choices made, check that it is less than 5, set the discipline and increment (add to) the count by 1 if it is - or print a warning if it isn't (without setting the choice).



Which works, and pretty well. You can't click on more than 5 disciplines, which fixes that problem, and it uses the nice, simple code I already had instead of me having to learn how to do something new (which I should, but I was feeling lazy).

Here's the final code for that page.

<<nobr>><<set $Disciplines to {"Camouflage": false, "Hunting": false,
"SixthSense": false, "Tracking": false,
"Healing": false, "Weaponskill-Dagger": false,
"Weaponskill-Spear": false, "Weaponskill-Mace": false,
"Weaponskill-ShortSword": false, "Weaponskill-Warhammer": false,
"Weaponskill-Sword": false, "Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false, "Weaponskill-Broadsword": false,
"Mindshield": false, "Mindblast": false,
"AnimalKinship": false, "MindOverMatter": false}>>
<<set _i to random (1, 9)>>
<<set _chosen to 0>>
<</nobr>>You may now choose the 5 disciplines that you have learned during your training...
<span id="choose_warn"></span>

<span id="ak_choose"><<click "Learn Animal Kinship.">>
<<if _chosen lt 5>>
<<set $Disciplines to {"AnimalKinship": true}>>
<<replace #ak_choose>>You know the Animal Kinship discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="c_choose"><<click "Learn Camouflage.">>
<<if _chosen lt 5>>
<<set $Disciplines to {"Camouflage": true}>>
<<replace #c_choose>>You know the Camouflage discipline.<</replace>><<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="h_choose"><<click "Learn Healing.">>
<<if _chosen lt 5>>
<<set $Disciplines to {"Healing": true}>>
<<replace #h_choose>>You know the Healing discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="hn_choose"><<click "Learn Hunting.">>
<<if _chosen lt 5>>
<<set $Disciplines to {"Hunting": true}>>
<<replace #hn_choose>>You know the Hunting discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="mb_choose"><<click "Learn Mindblast.">>
<<if _chosen lt 5>>
<<set $Disciplines to {"Mindblast": true}>>
<<replace #mb_choose>>You know the Mindblast discipline.<</replace>><<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="ms_choose"><<click "Learn Mindshield.">>
<<if _chosen lt 5>>
<<set $Disciplines to {"Mindshield": true}>>
<<replace #ms_choose>>You know the Mindshield discipline.<</replace>><<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="mom_choose"><<click "Learn Mind Over Matter.">>
<<if _chosen lt 5>>
<<set $Disciplines to {"MindOverMatter": true}>>
<<replace #mom_choose>>You know the Mind Over Matter discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="ss_choose"><<click "Learn Sixth Sense.">>
<<if _chosen lt 5>>
<<set $Disciplines to {"SixthSense": true}>>
<<replace #ss_choose>>You know the Sixth Sense discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="t_choose"><<click "Learn Tracking.">>
<<if _chosen lt 5>>
<<set $Disciplines to {"Tracking": true}>>
<<replace #t_choose>>You know the Tracking discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
Choose the <span id="wpn_choose"><<click "Weaponskill discipline.">>
<<if _chosen lt 5>>
<<replace #wpn_choose>>Weaponskill discipline.<</replace>>
<<if _i == 1>>
<<set $Disciplines to {"Weaponskill-Dagger": true}>>
<<replace #wpn_prof>> You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines to {"Weaponskill-Spear": true}>>
<<replace #wpn_prof>> You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines to {"Weaponskill-Mace": true}>>
<<replace #wpn_prof>> You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines to {"Weaponskill-ShortSword": true}>>
<<replace #wpn_prof>> You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines to {"Weaponskill-Warhammer": true}>>
<<replace #wpn_prof>> You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines to {"Weaponskill-Sword": true}>>
<<replace #wpn_prof>> You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines to {"Weaponskill-Axe": true}>>
<<replace #wpn_prof>> You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>
<<replace #wpn_prof>> You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines to {"Weaponskill-Broadsword": true}>>
<<replace #wpn_prof>> You are proficient with the Broadsword<</replace>>
<</if>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span><span id="wpn_prof"></span>

[[Review and Continue->discipline verify]]

    The next thing I wanted was to have a page where you could kind of review your choices and make sure you were happy with them. Why? Well, for the heck of it really. You can see the choices already on this Passage, so I could have just added a ‘Reset’ button or the like. I don't know, it sounded like a good idea at the time.
    So on the next Passage I wanted to go through the list of all the disciplines and check each one with an <<if>> to print the ones you knew - then have a way to reset all the variables if you wanted to go back and choose something different (huh, maybe I was channeling the old days of rolling D&D scores set after set trying to get a good combination). The check seemed like a really simple <<if>>, the same one I used in the Passage before to check for the “Sixth Sense.”

Here are the disciplines that you are proficient with...

<<if $Disciplines["AnimalKinship"]>><br>You know the Animal Kinship discipline<</if>>
<<if $Disciplines["Camouflage"]>><br>You know the Camouflage discipline<</if>>
<<if $Disciplines["Healing"]>><br>You know the Healing
...

Simple, so you click 5 disciplines on the first passage...


And then you see them listed on the next Passage...



    Ummm.... what? I did click on 5 right, why am I only seeing 1 listed on the next Passage?
    So here's where I started looking over my code, playing with it, wondering where I was going wrong and not seeing it. I added all the variable definitions to the second Passage that's supposed to print them out - and it worked perfect; as soon as I moved the variables back to the first Passage the print was down to only 1 again. Saved it to a file and it did the same thing (in case it was from me being in ‘writing mode’ and not ‘playing mode’ so to speak). No idea what was wrong (still don't know). If you're curious, here's the full code for the second Passage...

Here are the disciplines that you are proficient with...

<<nobr>><<if $Disciplines["AnimalKinship"]>><br>You know the Animal Kinship discipline<</if>>
<<if $Disciplines["Camouflage"]>><br>You know the Camouflage discipline<</if>>
<<if $Disciplines["Healing"]>><br>You know the Healing discipline<</if>>
<<if $Disciplines["Hunting"]>><br>You know the Hunting discipline<</if>>
<<if $Disciplines["Mindblast"]>><br>You know the Mindblast discipline<</if>>
<<if $Disciplines["Mindshield"]>><br>You know the Mindshield discipline<</if>>
<<if $Disciplines["MindOverMatter"]>><br>You know the Mind Over Matter discipline<</if>>
<<if $Disciplines["SixthSense"]>><br>You know the Sixth Sense discipline<</if>>
<<if $Disciplines["Tracking"]>><br>You know the Tracking discipline<</if>>
<<if $Disciplines["Weaponskill-Dagger"]>><br>You are proficient with the Dagger<</if>>
<<if $Disciplines["Weaponskill-Spear"]>><br>You are proficient with the Spear<</if>>
<<if $Disciplines["Weaponskill-Mace"]>><br>You are proficient with the Mace<</if>>
<<if $Disciplines["Weaponskill-ShortSword"]>><br>You are proficient with the Short Sword<</if>>
<<if $Disciplines["Weaponskill-Warhammer"]>><br>You are proficient with the Warhammer<</if>>
<<if $Disciplines["Weaponskill-Sword"]>><br><br>You are proficient with the Sword<</if>>
<<if $Disciplines["Weaponskill-Axe"]>><br>You are proficient with the Axe<</if>>
<<if $Disciplines["Weaponskill-Quarterstaff"]>><br>You are proficient with the Quarterstaff<</if>>
<<if $Disciplines["Weaponskill-Broadsword"]>><br>You are proficient with the Broadsword<</if>><</nobr>>

Do you want to keep these disciplines?
Yes
No
    I decided to start doing some research and see what other ways I could write this (without starting over from the beginning). After a while I found something - but I need to go back again to explain it.

    The disciplines seemed really simple, there is just a list of 10 (-ish) that either you have or don't. Before I even started on this documentation I had seen something somewhere about how to define the whole group of them - which I adapted to produce my variable...

<<set $Disciplines to {"Camouflage": false,
"Hunting": false,
"SixthSense": false,
"Tracking": false,
"Healing": false,
"Weaponskill-Dagger": false,
"Weaponskill-Spear": false,
"Weaponskill-Mace": false,
"Weaponskill-ShortSword": false,
"Weaponskill-Warhammer": false,
"Weaponskill-Sword": false,
"Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false,
"Weaponskill-Broadsword": false,
"Mindshield": false,
"Mindblast": false,
"AnimalKinship": false,
"MindOverMatter": false}>>

    Using the same (now forgotten) source I had found, I had my way to check for a discipline in the list...

<<if $Disciplines["SixthSense"]>>

    And my way to add a discipline to the list, changing it to ‘true’ from ‘false’...

<<set $Disciplines to {"SixthSense": true}>>

    All of which had seemed to be working just fine. But as I was researching (again) I found that there might be an even easier way to do this.
    I think, if my limited understanding is right, what I was doing was creating a JavaScript Object, that list of every discipline and it's true/false flag. Which, looking at it the second time, kind of seemed like overkill. I only really cared about the disciplines that the character actually had, the ones they didn't was basically irrellevent. So all I needed was some container for the known disciplines. Which, my research suggested, was best handled with an array.
    I already kind of had an array, the list of disciplines, but with a second array, the true/false bits. All I needed was just one of those. So I changed my code(s) to this..

    Again, I need to set the array, but this time to something blank (after all, the player hasn't chosen any disciplines yet)...

<<set $Disciplines to []>>

    Then, to add a discipline is just a ‘push’...

<<set $Disciplines.push ("AnimalKinship")>>

    And to check for one is a ‘contains’...

<<if $Disciplines.contains("AnimalKinship")>>

    All of which seemed pretty easy, so I changed the code of those last two pages to...

<<nobr>><<set $Disciplines to []>>
<<set _i to random (1, 9)>>
<<set _chosen to 0>>
<</nobr>>You may now choose the 5 disciplines that you have learned during your training...
<span id="choose_warn"></span>

<span id="ak_choose"><<click "Learn Animal Kinship.">>
<<if _chosen lt 5>>
<<set $Disciplines.push ("AnimalKinship")>>
<<replace #ak_choose>>You know the Animal Kinship discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="c_choose"><<click "Learn Camouflage.">>
<<if _chosen lt 5>>
<<set $Disciplines.push ("Camouflage")>>
<<replace #c_choose>>You know the Camouflage discipline.<</replace>><<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="h_choose"><<click "Learn Healing.">>
<<if _chosen lt 5>>
<<set $Disciplines.push ("Healing")>>
<<replace #h_choose>>You know the Healing discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="hn_choose"><<click "Learn Hunting.">>
<<if _chosen lt 5>>
<<set $Disciplines.push ("Hunting")>>
<<replace #hn_choose>>You know the Hunting discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="mb_choose"><<click "Learn Mindblast.">>
<<if _chosen lt 5>>
<<set $Disciplines.push ("Mindblast")>>
<<replace #mb_choose>>You know the Mindblast discipline.<</replace>><<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="ms_choose"><<click "Learn Mindshield.">>
<<if _chosen lt 5>>
<<set $Disciplines.push ("Mindshield")>>
<<replace #ms_choose>>You know the Mindshield discipline.<</replace>><<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="mom_choose"><<click "Learn Mind Over Matter.">>
<<if _chosen lt 5>>
<<set $Disciplines.push ("MindOverMatter")>>
<<replace #mom_choose>>You know the Mind Over Matter discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="ss_choose"><<click "Learn Sixth Sense.">>
<<if _chosen lt 5>>
<<set $Disciplines.push ("SixthSense")>>
<<replace #ss_choose>>You know the Sixth Sense discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
<span id="t_choose"><<click "Learn Tracking.">>
<<if _chosen lt 5>>
<<set $Disciplines.push ("Tracking")>>
<<replace #t_choose>>You know the Tracking discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>
Choose the <span id="wpn_choose"><<click "Weaponskill discipline.">>
<<if _chosen lt 5>>
<<replace #wpn_choose>>Weaponskill discipline.<</replace>>
<<if _i == 1>>
<<set $Disciplines.push ("Weaponskill-Dagger")>>
<<replace #wpn_prof>> You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines.push ("Weaponskill-Spear")>>
<<replace #wpn_prof>> You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines.push ("Weaponskill-Mace")>>
<<replace #wpn_prof>> You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines.push ("Weaponskill-ShortSword")>>
<<replace #wpn_prof>> You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines.push ("Weaponskill-Warhammer")>>
<<replace #wpn_prof>> You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines.push ("Weaponskill-Sword")>>
<<replace #wpn_prof>> You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines.push ("Weaponskill-Axe")>>
<<replace #wpn_prof>> You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines.push ("Weaponskill-Quarterstaff")>>
<<replace #wpn_prof>> You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines.push ("Weaponskill-Broadsword")>>
<<replace #wpn_prof>> You are proficient with the Broadsword<</replace>>
<</if>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span><span id="wpn_prof"></span>

[[Review and Continue->disciplines 2 verify]]



And to print the ones chosen...


Here are the disciplines that you are proficient with...

<<nobr>><<if $Disciplines.contains("AnimalKinship")>><br>You know the Animal Kinship discipline<</if>>
<<if $Disciplines.contains("Camouflage")>><br>You know the Camouflage discipline<</if>>
<<if $Disciplines.contains("Healing")>><br>You know the Healing discipline<</if>>
<<if $Disciplines.contains("Hunting")>><br>You know the Hunting discipline<</if>>
<<if $Disciplines.contains("Mindblast")>><br>You know the Mindblast discipline<</if>>
<<if $Disciplines.contains("Mindshield")>><br>You know the Mindshield discipline<</if>>
<<if $Disciplines.contains("MindOverMatter")>><br>You know the Mind Over Matter discipline<</if>>
<<if $Disciplines.contains("SixthSense")>><br>You know the Sixth Sense discipline<</if>>
<<if $Disciplines.contains("Tracking")>><br>You know the Tracking discipline<</if>>
<<if $Disciplines.contains("Weaponskill-Dagger")>><br>You are proficient with the Dagger<</if>>
<<if $Disciplines.contains("Weaponskill-Spear")>><br>You are proficient with the Spear<</if>>
<<if $Disciplines.contains("Weaponskill-Mace")>><br>You are proficient with the Mace<</if>>
<<if $Disciplines.contains("Weaponskill-ShortSword")>><br>You are proficient with the Short Sword<</if>>
<<if $Disciplines.contains("Weaponskill-Warhammer")>><br>You are proficient with the Warhammer<</if>>
<<if $Disciplines.contains("Weaponskill-Sword")>><br><br>You are proficient with the Sword<</if>>
<<if $Disciplines.contains("Weaponskill-Axe")>><br>You are proficient with the Axe<</if>>
<<if $Disciplines.contains("Weaponskill-Quarterstaff")>><br>You are proficient with the Quarterstaff<</if>>
<<if $Disciplines.contains("Weaponskill-Broadsword")>><br>You are proficient with the Broadsword<</if>><</nobr>>

Do you want to keep these disciplines?
Yes
No


    And now everything worked !
    I did wrap everything in a <<nobr>> macro with a <br> HTML tag for the print page, that way there weren't blank lines for the disciplines that the player didn't choose.

    Okay, so how can we let the player change his mind and reset his discipline choices? Well, really easy at the moment. I declared the empty array for the disciplines on the last page, so if I just back up and reload the last page everything will go back to being squeaky clean. Which is a simple macro...

<<back "No">>

    Again, the click-able text is in the macro itself. All this does is go back one Passage. Now, if I decide to move the variable declaration for the $Disciplines array to another page, then I will need to just re-declare it as being empty. I can remove elements, but I don't need to worry about that for now - once the player chooses their disciplines I'm not going to change them again anywhere in the story. I might try to work out some more options and a better system after I get done figuring out how to implement the book itself.

    Let's do one more random thing here, just to take a break from all the data. Back on that Passage that lets the player choose their disciplines there was a warning if they chose more than the allotted 5...


Why don't we make that a little more prominent? Like this...


    What we need is called CSS (short for Cascading Style Sheets). There are 3 big things that make up Twine / SugarCube - HTML is the code that displays a webpage, CSS is the code that handles how that page looks, and JavaScript (which SugarCube is, ifI understand right) handles how that page acts/ moves/ changes. So we can use some CSS of our own to change the default way that things look.
    CSS is pretty easy, really it is just 3 things - what you want to change, what you're changing about it, and what the new look should be. First we need 'what to change' or as I believe it is properly called, a 'selector.' Looking at our code for that page, we already have one...

<</nobr>>You may now choose the 5 disciplines that you have learned during your training...
<span id="choose_warn"></span>

<span id="ak_choose"><<click "Learn Animal Kinship.">>
<<if _chosen lt 5>>
<<set $Disciplines.push ("AnimalKinship")>>
<<replace #ak_choose>>You know the Animal Kinship discipline.<</replace>>
<<set _chosen++>>
<<else>>
<<replace #choose_warn>>You have already chosen the maximum number of disciplines!<</replace>>
<</if>><</click>></span>

    Okay, so we have two selectors in the code I copied above, both in bold. They are the <span> HTML tags, and the id=" name" element. We use the #name to target those selectors with our <<replace>> code (in italics).
    The code for the Passage all goes here, but the CSS is in a different place. If we click on the title of our story at the bottom-left we get a menu, with the option to ‘Edit Story Stylesheet’...


And that opens where we put our CSS..


And this is going to be our code..

#choose_warn { says what we are going to change. The ‘Cascading’ part of CSS means that one ‘style sheet’ will overwrite the ones before it. So Twine (or, SugarCube I think) has styled everything for us (the dark grey background, white text, all that stuff) in their own CSS style sheet. Now, we can make changes to this one, that I've opened, and our changes will overwrite SugarCube's default CSS. This is great, since SugarCube made the CSS for us we have something to start with that we don't have to worry about - but we can still change anything that we want to look different.

background-color: red; means put a dark red color behind out text (and only where the text is, you'll notice it doesn't cover the whole line - we could do that though if we wanted to)

color: white; means to change the text color to white, which it already is - I'm just putting that to show you some of the different parts that we can change

} and the final curly-brace just says that we're finished with our changes.

    There are a ton of different things that we can do to change how the story looks, from the smallest to the largest elements. I'm not going to go into all of it right now, or any of it really - this was just a little break for me to talk about something else. When I'm done writing all this code, however, I am going to go through the story and change how some things look. I just think it's easier to wait until I have everything working to worry about how pretty it is.

    Okay, so now we know all the disciplines we have to deal with, we know how to check for them, and we got the player to choose them. We should have a pretty good handle on that. Using them is going to come a bit later, when we finish the rest of the rules and start actually working on Passages/ story. Now there are just two sections of the rules left to work out, Equipment and Combat. I have a feeling our arrays and all the macros we've been using are going to get used again in those sections - along with some new tricks.

Friday, August 4, 2017

Converting the “Lone Wolf” adventure book to Twine and SugarCube - Part 2 - Setting Skills / Abilities


    Okay, so the Combat Skill and Endurance values are going to get used during combat and in general (there are some Passages that will damage Endurance). Along with them, there are 10 ‘Disciplines’ that are going to get checked throughout the story. All Passages will have default choices, like “go left” or “go right,” but in some Passages your disciplines will give extra choices, or extra information about the choices.
    Complicating things though, some disciplines will also effect combat, and have other uses. So first we need to set them up, and then look at all the ways they need to be referenced.

Here are the disciplines from the book... (note, the ‘Action Chart’ is just your character sheet)

Kai Disciplines

Over the centuries, the Kai monks have mastered the skills of the warrior. These skills are known as the Kai Disciplines, and they are taught to all Kai Lords. You have learnt only five of the skills listed below. The choice of which five skills these are, is for you to make. As all of the Disciplines may be of use to you at some point on your perilous quest, pick your five with care. The correct use of a Discipline at the right time can save your life.
When you have chosen your five Disciplines, enter them in the Kai Disciplines section of your Action Chart.

Camouflage

This Discipline enables a Kai Lord to blend in with his surroundings. In the countryside, he can hide undetected among trees and rocks and pass close to an enemy without being seen. In a town or city, it enables him to look and sound like a native of that area, and can help him to find shelter or a safe hiding place.
If you choose this skill, write ‘Camouflage’ on your Action Chart.

Hunting

This skill ensures that a Kai Lord will never starve in the wild. He will always be able to hunt for food for himself except in areas of wasteland and desert. The skill also enables a Kai Lord to be able to move stealthily when stalking his prey.
If you choose this skill, write ‘Hunting: no need for a Meal when instructed to eat’ on your Action Chart.

Sixth Sense

This skill may warn a Kai Lord of imminent danger. It may also reveal the true purpose of a stranger or strange object encountered in your adventure.
If you choose this skill, write ‘Sixth Sense’ on your Action Chart.

Tracking

This skill enables a Kai Lord to make the correct choice of a path in the wild, to discover the location of a person or object in a town or city and to read the secrets of footprints or tracks.
If you choose this skill, write ‘Tracking’ on your Action Chart.

Healing

This Discipline can be used to restore ENDURANCE points lost in combat. If you possess this skill you may restore 1 ENDURANCE point to your total for every numbered section of the book you pass through in which you are not involved in combat. (This is only to be used after your ENDURANCE has fallen below its original level.) Remember that your ENDURANCE cannot rise above its original level.
If you choose this skill write ‘Healing: +1 ENDURANCE point for each section without combat’ on your Action Chart.

Weaponskill

Upon entering the Kai Monastery, each initiate is taught to master one type of weapon. If Weaponskill is to be one of your Kai Disciplines, pick a number in the usual way from the Random Number Table, and then find the corresponding weapon from the list below. This is the weapon in which you have skill. When you enter combat carrying this weapon, you add 2 points to your COMBAT SKILL.
The fact that you are skilled with a weapon does not mean you set out on the adventure carrying that particular weapon. However, you will have opportunities to acquire weapons in the course of your adventures. If you pick the axe, you are lucky enough to be skilled in the one weapon Lone Wolf is carrying from the start of the adventure. (This will be explained fully in the Equipment section.)

You cannot carry more than 2 weapons. If you choose this skill, write ‘Weaponskill in _______ +2 COMBAT SKILL points if this weapon carried’ on your Action Chart.

Mindshield

The Darklords and many of the evil creatures in their command have the ability to attack you using their Mindforce. The Kai Discipline of Mindshield prevents you from losing any ENDURANCE points when subjected to this form of attack.
If you choose this skill, write ‘Mindshield: no points lost when attacked by Mindblast’ on your Action Chart.

Mindblast

This enables a Kai Lord to attack an enemy using the force of his mind. It can be used at the same time as normal combat weapons and adds two extra points to your COMBAT SKILL. Not all the creatures encountered on this adventure will be harmed by Mindblast. You will be told if a creature is immune.
If you choose this skill, write ‘Mindblast: +2 COMBAT SKILL points’ on your Action Chart.

Animal Kinship

This skill enables a Kai Lord to communicate with some animals and to be able to guess the intentions of others.
If you choose this skill, write ‘Animal Kinship’ on your Action Chart.

Mind Over Matter

Mastery of this Discipline enables a Kai Lord to move small objects with his powers of concentration.
If you choose this skill, write ‘Mind Over Matter’ on your Action Chart.

If you successfully complete the mission as set in Book 1 of Lone Wolf, you may add a further Kai Discipline of your choice to your Action Chart in Book 2. This additional skill, together with your five other skills and any Special Items that you have picked up in Book 1, may then be used in the next adventure of the Lone Wolf series which is called Fire on the Water.


    Okay, so 10 disciplines as a base. Player chooses 5. Complicating things, one of them, Weaponskill, is random - the player chooses to take the discipline, but which weapon is randomly determined from a list of 9.
    Alright, starting with the basics, we need to initialize the disciplines. They are going to be binary, either you have them or you don't. So, I can create a dataset (which I think it's properly called) that will have each discipline and a true/false flag together. Then I can check that true/false really easily.
Weaponskill is a funny one, since there are 9 sub-types. I'm sure there are several ways to do it, but I'm going to just keep the true/false and make each sub-type have it's own name. So, that gives me this code to set my variables...

<<set $Disciplines to {"Camouflage": false,
"Hunting": false,
"Sixth Sense": false,
"Tracking": false,
"Healing": false,
"Weaponskill-Dagger": false,
"Weaponskill-Spear": false,
"Weaponskill-Mace": false,
"Weaponskill-ShortSword": false,
"Weaponskill-Warhammer": false,
"Weaponskill-Sword": false,
"Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false,
"Weaponskill-Broadsword": false,
"Mindshield": false,
"Mindblast": false,
"Animal Kinship": false,
"Mind Over Matter": false}>>


I can use spaces in the names, which will make them more readable (though you'll notice as I'm working on the code I forget to :).
Now that I have a big list of disciplines, I can check them with a simple if-then macro. In fact, the first passage in the book has you check for the ‘Sixth Sense’ discipline...

At the foot of the hill, the path splits into two directions, both leading into a large wood.

If you wish to use your Kai Discipline of Sixth Sense, turn to 141.
If you wish to take the right path into the wood, turn to 85.
If you wish to follow the left track, turn to 275.

Okay, so a few things here. First, we're finally getting into making and linking Passages. In Twine making a new Passage is easy, just put [[ ]] around the part you want the player to click on - and as a bonus, if that Passage doesn't exist, Twine will make a blank one for you. SoI can make the bottom two regular options like so...

At the foot of the hill, the path splits into two directions, both leading into a large wood.

If you wish to use your Kai Discipline of Sixth Sense, turn to 141.
If you wish to [[take the right path into the wood, turn to 85.]]
If you wish to [[follow the left track, turn to 275.]]

Thing is though, making them that way means my new Passages are going to be titled “take the right path into the wood, turn to 85” and such. Since this is all going to be handled by Twine, I don't think my players need the passage numbers, I just want the text to be visible. I do want to keep the passage numbers, to use as the titles of my Passages. You can change around the text displayed and the Passage titles with an arrow, like so...

At the foot of the hill, the path splits into two directions, both leading into a large wood.

If you wish to use your Kai Discipline of Sixth Sense, turn to 141.
If you wish to [[take the right path into the wood->85]]
If you wish to [[follow the left track->275]]

Which will look like this.


Or, I can keep the original and put the link in the middle of the text, targeting the same Passage names.


    None of which is that important, this is just to illustrate that you have several options when it comes to what you want to display on the screen and what titles you want to give your Passages. Just remember the left of the arrow is what the player sees, right of the arrow is the name of the Passage.   Also remember that case matters in Passage titles, “ThisPassage” and “thispassage” are two different ones.

So, what does happen if you have the discipline?

Your Sixth Sense has warned you that some of the creatures that attacked the monastery are searching the two paths for any survivors of their raid, but you can avoid both tracks by making your way through the undergrowth of the woods.

If you wish to head south, turn to 56.

Or if you wish to cut through the heavier foliage towards the northeast, turn to 333.

    Okay, so now I need to write the code check for the discipline. And of course, there are a couple of ways to do this and things to consider.
    First, this was written in a physical book, so the reader had to determine if they had the ability and turn to that page/passage - hopefully being honest. I'm going to have the program handle everything though, so I don't need to jump to another Passage, I can add the code right here. Again, not a big difference, just a question of how you want things to look.
    Second, the wording also implies that you can choose weather or not you want to use your ability. It doesn't say “if you have...” it says “if you wish to...” Looking at this section, your discipline is warning you that there are enemies, and giving you 2 new options to avoid them. But what if you don't want to? What if you're willing to fight? (granted, tht might not be a great idea) I'm going to have to keep in mind 2 possibilities - 1) the ability adds or expands on the regular, non-ability, options and 2) the ability replaces the regular options. They are not a big difference, but the code wording and order might be just a little different for each.

    So let's write some code.
    I've got two options, you have the discipline or you don't. So an <<if>> macro will check for the discipline and display that text, and an <<else>> macro added on will display the text if you don't have the discipline.

<<if $Disciplines["SixthSense"]>>
Your Sixth Sense has warned you that some of the creatures that attacked the monastery are searching the two paths for any survivors of their raid, but you can avoid both tracks by making your way through the undergrowth of the woods.

If you wish to [[head south->56]], turn to 56.

Or if you wish to [[cut through the heavier foliage towards the northeast->333]], turn to 333.

You can choose to follow one of the paths, if you are willing to risk combat...
<<else>>
If you wish to [[take the right path into the wood->85]], turn to 85.

If you wish to [[follow the left track->275]], turn to 275.
<</if>>


Let's take a look.



Perfect, I initialized all my disciplines to ‘false,’ so I'm seeing the no discipline version. Let's change that...
<<set $Disciplines to {"SixthSense": true}>>



Okay, it's working, but there is a lot of empty space. I'm going to throw in some <<nobr>> macros again and tighten things up a bit. which gives me this for my final code...

<<nobr>><<set $Disciplines to {"Camouflage": false, "Hunting": false,
"SixthSense": false, "Tracking": false,
"Healing": false, "Weaponskill-Dagger": false,
"Weaponskill-Spear": false, "Weaponskill-Mace": false,
"Weaponskill-ShortSword": false, "Weaponskill-Warhammer": false,
"Weaponskill-Sword": false, "Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false, "Weaponskill-Broadsword": false,
"Mindshield": false, "Mindblast": false,
"AnimalKinship": false, "MindOverMatter": false}>>

<</nobr>>At the foot of the hill, the path splits into two directions, both leading into a large wood.

<<if $Disciplines["SixthSense"]>>
Your Sixth Sense has warned you that some of the creatures that attacked the monastery are searching the two paths for any survivors of their raid, but you can avoid both tracks by making your way through the undergrowth of the woods.

If you wish to [[head south->56]], turn to 56.

Or if you wish to [[cut through the heavier foliage towards the northeast->333]], turn to 333.

You can choose to follow one of the paths, if you are willing to risk combat...

If you wish to [[take the right path into the wood->85]], turn to 85.

If you wish to [[follow the left track->275]], turn to 275.

<<else>>
If you wish to [[take the right path into the wood->85]], turn to 85.

If you wish to [[follow the left track->275]], turn to 275.
<</if>>


And without discipline...


With discipline...



    Okay, that makes it pretty easy to initialize and check for the disciplines. But now the slightly tricky part - the player needs to choose 5 of the 10 disciplines to start with. So I need to list them and let the player choose from the list, keeping them from choosing the same one twice, and remembering that Weaponskill is a random choice. How to go about that?

    Well, my first thought was how to deal with the Weaponskill. The others are easy enough in theory, click and set the variable - but with Weaponskill I'm going to have to click, generate a random number, and then set the variable. Since it seemed like the hardest, it sounded like a good idea to try to figure that one out first.
    The variable part seemed easy enough, I just had to generate a (pseudo-)random number and check it against the Weaponskill sub-types. Something that should be easy with an <<if>> macro, like this:

<<set _i to random (1, 9)>>

<<if _i == 1>><<set $Disciplines to {"Weaponskill-Dagger": true}>>You are proficient with Dagger
<<elseif _i == 2>><<set $Disciplines to {"Weaponskill-Spear": true}>>You are proficient with Spear
<<elseif _i == 3>><<set $Disciplines to {"Weaponskill-Mace": true}>>You are proficient with Mace
<<elseif _i == 4>><<set $Disciplines to {"Weaponskill-ShortSword": true}>>You are proficient with Short Sword
<<elseif _i == 5>><<set $Disciplines to {"Weaponskill-Warhammer": true}>>You are proficient with Warhammer
<<elseif _i == 6>><<set $Disciplines to {"Weaponskill-Sword": true}>>You are proficient with Sword
<<elseif _i == 7>><<set $Disciplines to {"Weaponskill-Axe": true}>>You are proficient with Axe
<<elseif _i == 8>><<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>You are proficient with Quarterstaff
<<elseif _i == 9>><<set $Disciplines to {"Weaponskill-Broadsword": true}>>You are proficient with Broadsword
<</if>>


Which works...



Looking at it again, I should have said "You are proficient with the Dagger." Have to fix that. Anyways, so this works just fine. Thing is, it triggers as soon as the page loads it. I want it to trigger only if the player chooses the Weaponskill. So I thought I would just wrap it in a <<click>> and <<replace>> like I did with the Combat Skill/ Endurance and everything would be cool. Like so...

<<set _i to random (1, 9)>>

Choose the <<click "Weaponskill discipline.">>
<<if _i == 1>>
<<set $Disciplines to {"Weaponskill-Dagger": true}>>
<<replace #wpn_prof>>You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines to {"Weaponskill-Spear": true}>>
<<replace #wpn_prof>>You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines to {"Weaponskill-Mace": true}>>
<<replace #wpn_prof>>You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines to {"Weaponskill-ShortSword": true}>>
<<replace #wpn_prof>>You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines to {"Weaponskill-Warhammer": true}>>
<<replace #wpn_prof>>You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines to {"Weaponskill-Sword": true}>>
<<replace #wpn_prof>>You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines to {"Weaponskill-Axe": true}>>
<<replace #wpn_prof>>You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>
<<replace #wpn_prof>>You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines to {"Weaponskill-Broadsword": true}>>
<<replace #wpn_prof>>You are proficient with the Broadsword<</replace>>
<</if>>
<</click>>

<span id="wpn_prof"></span>

Pre-click...



And post-click...



    Now with this one, you can click on the link all you want and nothing will change. Different from the Combat Skill/ Endurance in the last section. Because here I defined the variable number at the start of the page <<set _i to random (1, 9)>> unlike the last time when the random number was added after the click. I also put an underscore for my random number, _i, instead of the dollar sign of all my other variables, $i - because the underscore means that this is a local variable, Twine is going to forget it existed after I leave this passage, the dollar sign variables will persist throughout the story.
    I can still go ahead and change the text to plain from the link anyways, just another <span> around the <<click>> and a <<replace>> before the <<if>> triggers. And while I'm formatting things, I'm not sure I like having the text saying what weapon you are proficient in so far under the link, maybe I can get them a little more cozy...



There, that looks nice - like I want it to at least, which makes my final code for this section look like...

<<set _i to random (1, 9)>>

Choose the <span id="wpn_choose"><<click "Weaponskill discipline.">>
<<replace #wpn_choose>>Weaponskill discipline.<</replace>>
<<if _i == 1>>
<<set $Disciplines to {"Weaponskill-Dagger": true}>>
<<replace #wpn_prof>> You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines to {"Weaponskill-Spear": true}>>
<<replace #wpn_prof>> You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines to {"Weaponskill-Mace": true}>>
<<replace #wpn_prof>> You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines to {"Weaponskill-ShortSword": true}>>
<<replace #wpn_prof>> You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines to {"Weaponskill-Warhammer": true}>>
<<replace #wpn_prof>> You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines to {"Weaponskill-Sword": true}>>
<<replace #wpn_prof>> You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines to {"Weaponskill-Axe": true}>>
<<replace #wpn_prof>> You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>
<<replace #wpn_prof>> You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines to {"Weaponskill-Broadsword": true}>>
<<replace #wpn_prof>> You are proficient with the Broadsword<</replace>>
<</if>>
<</click>>
</span><span id="wpn_prof"></span>


    Okay, so I can choose the tricky Weaponskill discipline/ sub-discipline, we if we did all the rest in exactly the same way, a list of basic links for the player to click on? Let's see what it would look like as code...

<<nobr>><<set $Disciplines to {"Camouflage": false, "Hunting": false,
"SixthSense": false, "Tracking": false,
"Healing": false, "Weaponskill-Dagger": false,
"Weaponskill-Spear": false, "Weaponskill-Mace": false,
"Weaponskill-ShortSword": false, "Weaponskill-Warhammer": false,
"Weaponskill-Sword": false, "Weaponskill-Axe": false,
"Weaponskill-Quarterstaff": false, "Weaponskill-Broadsword": false,
"Mindshield": false, "Mindblast": false,
"AnimalKinship": false, "MindOverMatter": false}>>
<<set _i to random (1, 9)>>

<</nobr>><span id="ak_choose"><<click "Learn Animal Kinship.">>
<<set $Disciplines to {"Animal Kinship": true}>>
<<replace #ak_choose>>You know the Animal Kinship discipline.<</replace>><</click>></span>
<span id="c_choose"><<click "Learn Camouflage.">>
<<set $Disciplines to {"Camouflage": true}>>
<<replace #c_choose>>You know the Camouflage discipline.<</replace>><</click>></span>
<span id="h_choose"><<click "Learn Healing.">>
<<set $Disciplines to {"Healing": true}>>
<<replace #h_choose>>You know the Healing discipline.<</replace>><</click>></span>
<span id="hn_choose"><<click "Learn Hunting.">>
<<set $Disciplines to {"Hunting": true}>>
<<replace #hn_choose>>You know the Hunting discipline.<</replace>><</click>></span>
<span id="mb_choose"><<click "Learn Mindblast.">>
<<set $Disciplines to {"Mindblast": true}>>
<<replace #mb_choose>>You know the Mindblast discipline.<</replace>><</click>></span>
<span id="ms_choose"><<click "Learn Mindshield.">>
<<set $Disciplines to {"Mindshield": true}>>
<<replace #ms_choose>>You know the Mindshield discipline.<</replace>><</click>></span>
<span id="mom_choose"><<click "Learn Mind Over Matter.">>
<<set $Disciplines to {"Mind Over Matter": true}>>
<<replace #mom_choose>>You know the Mind Over Matter discipline.<</replace>><</click>></span>
<span id="ss_choose"><<click "Learn Sixth Sense.">>
<<set $Disciplines to {"Sixth Sense": true}>>
<<replace #ss_choose>>You know the Sixth Sense discipline.<</replace>><</click>></span>
<span id="t_choose"><<click "Learn Tracking.">>
<<set $Disciplines to {"Tracking": true}>>
<<replace #t_choose>>You know the Tracking discipline.<</replace>><</click>></span>
Choose the <span id="wpn_choose"><<click "Weaponskill discipline.">>
<<replace #wpn_choose>>Weaponskill discipline.<</replace>>
<<if _i == 1>>
<<set $Disciplines to {"Weaponskill-Dagger": true}>>
<<replace #wpn_prof>> You are proficient with the Dagger<</replace>>
<<elseif _i == 2>>
<<set $Disciplines to {"Weaponskill-Spear": true}>>
<<replace #wpn_prof>> You are proficient with the Spear<</replace>>
<<elseif _i == 3>>
<<set $Disciplines to {"Weaponskill-Mace": true}>>
<<replace #wpn_prof>> You are proficient with the Mace<</replace>>
<<elseif _i == 4>>
<<set $Disciplines to {"Weaponskill-ShortSword": true}>>
<<replace #wpn_prof>> You are proficient with the Short Sword<</replace>>
<<elseif _i == 5>>
<<set $Disciplines to {"Weaponskill-Warhammer": true}>>
<<replace #wpn_prof>> You are proficient with the Warhammer<</replace>>
<<elseif _i == 6>>
<<set $Disciplines to {"Weaponskill-Sword": true}>>
<<replace #wpn_prof>> You are proficient with the Sword<</replace>>
<<elseif _i == 7>>
<<set $Disciplines to {"Weaponskill-Axe": true}>>
<<replace #wpn_prof>> You are proficient with the Axe<</replace>>
<<elseif _i == 8>>
<<set $Disciplines to {"Weaponskill-Quarterstaff": true}>>
<<replace #wpn_prof>> You are proficient with the Quarterstaff<</replace>>
<<elseif _i == 9>>
<<set $Disciplines to {"Weaponskill-Broadsword": true}>>
<<replace #wpn_prof>> You are proficient with the Broadsword<</replace>>
<</if>>
<</click>>
</span><span id="wpn_prof"></span>


(That ends up being quite the wall of text) And on the page, pre-click...


Then, after clicking 5 disciplines...


    Now, this is a workable way to use what we already know to let the player choose their disciplines. It has that problem that we need to trust the player, they can click on all of the links - but I honestly don't know how to ‘turn off’ the <<click>> macro on a link. So this is not perfect, but it would work.
    Of course, if you're going to do something you might as well do it right - so how else could we do this, and how to keep the player from clicking on too many? Also, I'd like to give them an “are you sure” moment so they can back out if they want before finalizing the choices. But if our list of links won't work, what will? Or might?

Well, two things come to my mind.

  • Checkboxes - what if we put all 10 as checkboxes, then make sure the player can only choose 5. I don't think we can stop the player from clicking on 6+, but I do believe that before we finalize/ send the boxes we can check for how many were checked (so to speak). Not sure how that will combine with the Weaponskill macro though.
  • Dropboxes - we could make 5 drop-down boxes, populated with all 10 disciplines in the first box, then the remining 9 in the next box, and so on. That'll keep everything under control. Again, not sure how it will handle the Weaponskill, but we can see.

Those come from my (admittedly limited) knowledge of HTML/ JavaScript, is there something else? Some super-special super-secret Twine/ SugarCube way of doing things? I don't know. Let me go research this...

Wednesday, August 2, 2017

Military LOLs

Found the first image at random, which triggered getting the others...








Tuesday, August 1, 2017

Combat Capabilities Map

    A few things I read recently got me thinking about combat.  In most RPGs each character has combat abilities, which they use together with the other players to create a combat strategy. Also, in a lot of RPGs this tends to devolve to "I hit it with my axe."  But while I never played Dungeons and Dragons 4th edition, I was reading about how it created "combat roles" of the striker, leader, defender and controller (think I'm quoting them right).  This is a good idea in my opinion since it gives the player some direction as to what they should be doing in a fight, and it encourages players to work together since they have different specialties.  What looks bad about it thought, is that it seems to assume each character is only good for one thing.  Really dynamic combat - the kind players have to stay awake for - requires that each character has options, and of course that monsters also have options, all of which can/ should change during the fight.
    Which is what got me thinking: we use a map to show where all the characters are on the field (and move them 5' squares at a time) - what if there was a map of "combat capabilities" that we placed every character on instead?  If we mapped the intent of the character instead of (or along with) their position?

    Well, first we'd need a list of those "combat capabilities."  Roles are too general, I'm thinking of something more specific, that defines a single action and not a general strategy.  There needs to be several, and they need to be flexible enough to map all the different kinds of abilities and options in a fight.  I came up with 10 groups.  I thought about trying to tie this to a specific game system but instead it seems like it might need it's own rules.  This is all a very rough idea right now, but here are the categories:
  • Grappling - is directly touching the enemy, "man-to-man" so to speak.  By default this reduces the effectiveness of everything the enemy is trying to do (since you're getting in the way of their attacking or defending or even thinking by being (possibly literally) on top of them).  There could also (and should) be special abilities that can trigger when a character does this type of combat action.
  • Striking - is trying to hit the enemy with a melee weapon (or fist, other natural weapon, etc).  It's the up-close-and-personal side of fighting, focused on doing damage.
  • Protecting - is defense, trying to avoid being hit. This could be either for oneself or an ally, and each action is aimed at a specific enemy (the one you're protecting from).
All three of the above actions are taken from the front ranks, those closest to the line between the two opposing forces.  The next three are a little further back (generally speaking):
  • Skirmishing - covers throwing weapons, attacking with a reach weapon (thus, over the shoulders of the Strikers and Protectors), or maneuvering yourself outside the battle to get into a better position (ie, to set up a backstab).  This is kind of like Striking in that usually you're doing or going to do damage to the enemy, but space/ distance/ positioning is playing an important part of that action.
  • Buff/ Aid/ Assist - simply means trying to help an ally with whatever they are doing.
  • Spoiler/ Debuff - focuses on hindering an enemy's action (from yelling curses as a distraction to throwing a Tanglefoot Bag at them).
The final 4 abilities are usually in the back rank, farthest from the center of the fight, so they can use their superior vantage point on the fight.
  • Ranged/ Archer/ Artillery - the guys who shoot from the farthest distance, with the attendant issues of shooting into melee/ around everybody else.
  • Leader/ Teamwork - help focus the efforts of their allies on a specific enemy (calling out maneuvers, or weakness).
  • Strategist/ Tactician - watch the battle unfold, seeing what is going to happen in advance - thus reducing the uncertainty of the fight.
  • Controller - directs the enemy's actions, or rather re-directs, making the enemy target or do something they did not intend (like hit their buddy).
From these basic capabilities (which everyone could do, to some degree of success, and some better than others) I made a map - which on the table would be 2 sheets of paper joined together (the good guys are the light colored side, bad guys the darker side).

So we place our combatants on their respective sides...

Each character has a different number of dice (depending on how good they are at fighting), they also use different colored dice...

Now, each character would have different sized dice for each capability (since different characters will be good at different things) - but all I had on hand was the graphic for the d10, so imagine those are actually 4s, 6s, 8s, 10s and 12s (potentially)...

We could even put the miniatures or tokens on the map to show space as well as intent (though, granted, it does crowd the map)...

Above we have our Goblins trying to Grapple with the Axeman while the Hobgoblin makes 2 attacks against the Armored Guy, and puts 1 Protecting die against the Armored Guy's attacks.  The Hobgoblin figures the Goblins will be able to bring down the Axeman's attacks enough to make him no threat.
Armored Guy is putting 1 die in Striking and 1 die in Protecting both vs the Hobgoblin, the Axeman is making 2 Striking attacks, both at one Goblin (hoping to take it out).  The Mage is warming up a Magic Missile or other ranged attack.

At the end of Round 1 (above), one Goblin is killed, which causes a "Morale Hit" - since for good tactical combat we need to track morale and group cohesion.  Someday I'll think of some rules for that :)

Round 2 sees some shifts. The Mage decides to cast a "Shield" or other protective spell on the Armored Guy, the Hobgoblin is fighting with just a longsword, he's going to use his free hand (and great strength) to try to pull the Armored Guy's shield out of the way (Spoiler/Debuff targeting Protection) to deliver a killing blow before the Axeman finishes the last Goblin.  Since the Goblin is just cannon fodder, it's going to keep doing the same thing as last turn.

    And thus combat would continue.  I don't have any solid rules yet, this was a recent idea.  But I have to admit, looking at it I kind of like it.  I like the way it explicitly lays out what can be done in the fight, where everybody stands in relation to each other.  Sure, this kind of thing does exist anyways in how the abilities work - but it can be easy to lose sight of the tactical forest for the action economy trees (at least, it was in the games I GM'd/ Played).

    Well, what do you think?  Is this an idea that I should work on?  Would you like to have something like this for your table?  Or am I just being crazy?  Please comment below, if anybody wants I'll try to develop this further.