Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

RPG Character Sheet

Does anyone have any idea or perhaps an already working code for an RPG stat style character sheet I can put in the storymenu?
«13

Comments

  • I have about three turn-based RPG's going right now. I made a very rough one from scratch in about four hours for the Twine 23 Challenge: http://twinery.org/forum/index.php/topic,1474.0.html

    If you're making an RPG, you'll want to know about JS objects: http://twinery.org/forum/index.php/topic,1516.0.html

    Here's my current level one PC:
    <<set $player = {
    name: "Player",
    ID: Math.random(),
    maxHP: 50,
    HP: 50,
    maxMP: 10,
    MP: 10,
    AC: 6,
    attack: 1,
    damage: 0,
    speed: 10,
    gold: 60,
    XP: 0,
    level: 1,
    levelUp: 100,
    }>>
    So, to print the character's current hit points, you'd do: <<print $player.HP>>. To set the player's current hit points to full, you'd do: <<set $player.HP = $player.maxHP>>.

    All that said, here's a suggestion for an always-visible character sheet:
    Name: <<print $player.name>>
    Level: <<print $player.level>>
    HP: <<print $player.HP>>
    MP: <<print $player.MP>>
    XP: <<print $player.XP>>
    Gold: <<print $player.gold>>
  • I suggest learning how to create objects which are essential for rpg games and stats etc and use them for your character sheets with a passage for each character perhaps. Unless your question meant the more visual aspects such as the look and layout as with css etc?

    http://twinery.org/forum/index.php/topic,1516.0.html

    http://twinery.org/forum/index.php/topic,679.msg901.html#msg901

    *Dang Sharpe beat me to it lol
  • I started learning code a week ago.  I'm slowly picking it up.  Thanks for all your help .. I'm reading up on everything.  I don't know the lingo well yet.
  • If you wanted to use the always visible option, how would you put it.. say in the top right corner instead of over with the text?
  • Sharpe wrote:

    I have about three turn-based RPG's going right now. I made a very rough one from scratch in about four hours for the Twine 23 Challenge: http://twinery.org/forum/index.php/topic,1474.0.html

    If you're making an RPG, you'll want to know about JS objects: http://twinery.org/forum/index.php/topic,1516.0.html

    Here's my current level one PC:
    <<set $player = {
    name: "Player",
    ID: Math.random(),
    maxHP: 50,
    HP: 50,
    maxMP: 10,
    MP: 10,
    AC: 6,
    attack: 1,
    damage: 0,
    speed: 10,
    gold: 60,
    XP: 0,
    level: 1,
    levelUp: 100,
    }>>
    So, to print the character's current hit points, you'd do: <<print $player.HP>>. To set the player's current hit points to full, you'd do: <<set $player.HP = $player.maxHP>>.

    All that said, here's a suggestion for an always-visible character sheet:

    Name: <<print $player.name>>
    Level: <<print $player.level>>
    HP: <<print $player.HP>>
    MP: <<print $player.MP>>
    XP: <<print $player.XP>>
    Gold: <<print $player.gold>>


    Few Questions. 

    1.  What is the Math.Random?  Whats that do?  I learned the variables and tags.  Basically I look through these forums and try to find someone who is working on something similar and read the code they post and then try it out.

    2.  If I wanted to add a set or choosable profile picture would that be possible also?  I know you have to embed the imagine in a sub directory of the output location.
  • Sharpe wrote:

    I have about three turn-based RPG's going right now. I made a very rough one from scratch in about four hours for the Twine 23 Challenge: http://twinery.org/forum/index.php/topic,1474.0.html

    If you're making an RPG, you'll want to know about JS objects: http://twinery.org/forum/index.php/topic,1516.0.html

    Here's my current level one PC:
    <<set $player = {
    name: "Player",
    ID: Math.random(),
    maxHP: 50,
    HP: 50,
    maxMP: 10,
    MP: 10,
    AC: 6,
    attack: 1,
    damage: 0,
    speed: 10,
    gold: 60,
    XP: 0,
    level: 1,
    levelUp: 100,
    }>>
    So, to print the character's current hit points, you'd do: <<print $player.HP>>. To set the player's current hit points to full, you'd do: <<set $player.HP = $player.maxHP>>.

    All that said, here's a suggestion for an always-visible character sheet:

    Name: <<print $player.name>>
    Level: <<print $player.level>>
    HP: <<print $player.HP>>
    MP: <<print $player.MP>>
    XP: <<print $player.XP>>
    Gold: <<print $player.gold>>


    Ok - so I'm going to test this code out because I have no idea what this will look like.  I assume there is more to the top code than this because it doesn't seem like by itself it'd work.
  • Slow down, Hoss! No need to make a new post every minute. Use the edit function. ;)

    Wraithbane wrote:

    If you wanted to use the always visible option, how would you put it.. say in the top right corner instead of over with the text?


    This is not simple, nor is it the best for beginners to attempt right away. You probably had the right idea putting it in StoryMenu, though that has limitations and issues.

    Otherwise, like I say, my RPG is a worked example.

    Wraithbane wrote:
    Few Questions. 

    1.  What is the Math.Random?  Whats that do?  I learned the variables and tags.  Basically I look through these forums and try to find someone who is working on something similar and read the code they post and then try it out.


    Well, Math is an object and random is a function/method, but that doesn't tell you anything.

    Check this out: http://www.w3schools.com/jsref/jsref_random.asp

    Also, my RPG. It is a worked example of creating random numbers with Math.random().

    Wraithbane wrote:
    2.  If I wanted to add a set or choosable profile picture would that be possible also?  I know you have to embed the imagine in a sub directory of the output location.


    You can set an imported image to a variable like so:

    <<set $playerImage = "[img[player]]">>

    Then, to show it:

    <<print $playerImage>>

    Wraithbane wrote:
    Ok - so I'm going to test this code out because I have no idea what this will look like.  I assume there is more to the top code than this because it doesn't seem like by itself it'd work.


    Actually, it will. You can put it all in one passage and it will print. Again, my RPG uses this.

    Suggestion: don't ask any more questions that are answered in my worked example RPG before downloading and viewing it.
  • Thanks.  I'm downloading and studying and reading all the links.  Thanks for all your help.
  • No problem! After a bit of reading, let us know if you have any more questions! :)
  • Sharpe,

    I downloaded your RPG and went to play through it.  I click the first link and get an error that says  - Error: macro <<textinput>> does not exist.  I'm using Twine 1.4.1 with Sugarcube header 3050.
  • It's written for the vanilla headers (probably Sugarcane), not SugarCube, so it would require some minor conversion to make it work in SugarCube.

    Actually, let me give that a shot.  And here, I've attached a bare-bones conversion for SugarCube (bare-bones meaning that I only did the bare minimum to get it working, there are lots of things that could be improved with a proper SugarCube conversion, e.g. most/all of the Math library cruft could be replaced).  I also had to fix a bug that was, at least somewhat, hidden by the auto-initialize-to-zero misfeature of the vanilla headers.

    [EDIT] Updated the attachment for the just published SugarCube release, so the <<textbox>> can directly set $player.name.  (Been meaning to do that for a while, I just kept forgetting.  Derp.)
  • You rock Exile! =)
  • TheMadExile wrote:
    I also had to fix a bug that was, at least somewhat, hidden by the auto-initialize-to-zero misfeature of the vanilla headers.


    Cool!

    What was the bug so I can fix it in the vanilla version? I abuse the heck out of the "auto-initialize-to-zero misfeature." XD
  • Sharpe wrote:

    What was the bug so I can fix it in the vanilla version?


    In the Monster Turn passage, you reference the non-existent property $monster.damage during the damage calculation.  Based on the similar damage calculation in the player combat code and from a read of the Encounter passage, it looks like that should have been $monster.attack.

    In other words, in the Monster Turn passage, this:

    <<set $damage = ($monster.damage + $damageRoll) - $player.armor>>
    Should be this:

    <<set $damage = ($monster.attack + $damageRoll) - $player.armor>>
    Auto-initialization-to-0 was allowing the expression to still function, though the monster's base attack damage was always 0, thus hiding the error.
  • Thanks! :)

    I need to get a (much) better generic example RPG out. The one I'm making now has grown far beyond that original goal.

    Maybe I'll use your update as an excuse to learn SugarCube! :)
  • I updated the attachment (on the previous page) for the latest SugarCube release.
  • So I've looked through the RPG extensively today.  I've played through the game a dozen times at least now and I had a good time.  Obviously this was just an example piece, but as far as learning things goes, I loved it.  I have a few questions about how things work.

    You make some calls and perhaps its just formatting and I don't know how to find what I'm looking for so maybe that will help.  You call Place and you call Purchace and I can't find how those functions work.  Is there something built in or did you create those?  If there is a list of these things and how they are used somewhere I'll read up.

  • More than the fact that the game is far from a balanced, fun playagain, I wrote it in about four hoursthe fact that it adheres to the Twine 23 Challenge limit of 23 passages is one thing that needs changed most.

    I'll download TME's newest version and take a look. It's been so long that I don't even remember what all was in it, I just remember that some may find it hard to figure out the purchasing system since it runs in a loop.

    Here's a thread on loops while I'm at it: http://twinery.org/forum/index.php?topic=759.0

    I'll update and re-post the RPG here in a bit to make it more legible.
  • Wraithbane wrote:

    You make some calls and perhaps its just formatting and I don't know how to find what I'm looking for so maybe that will help.  You call Place and you call Purchace and I can't find how those functions work.  Is there something built in or did you create those?  If there is a list of these things and how they are used somewhere I'll read up.


    Place and (the unfortunately misspelled) Purchace are just passages (directly beneath Town in the story map).

    The Place passage contains all of the locations within the town that can be visited, so it's acting somewhat like a router here (though it handles all locations itself).  It's linked to from the Town passage multiple times, each link setting the $location variable which Place uses to serve up the correct town location.

    The Purchace passage contains all of the purchasing logic for the shops.  It's linked to from the Place passage multiple times (once for each item in each shop), each link setting the variables which Purchace uses to handle the purchase of an item or service.

    Tangentially, there's some unnecessary repetition going on between the two with both $location and $place, which serve the same function.  At least, I couldn't see a reason why Purchace couldn't simply reference $location, rather than using another variable ($place) to handle the exact same value.
  • I'm making it a more legible example now (and I fixed the spelling error).

    The whole reason I used loops was to avoid the passage limitation.
  • Alright. Attached is a more legible version (pre-alpha 0.3) of my generic RPG in SugarCube. Still boring, monotonous, unbalanced game play. ;D
  • Awesome.  I hope you guys don't mind me picking your brains.  I swear I'm sifting through everything I can before I ask questions.

    1.  I tried the example sugarcube widget code for pronouns and it errors out.  I put it in my stylesheet, copy and pasted and it gives me the Error: macro <<he>> does not exist.  What am I doing wrong? 

    2.  I am using the following to color things. 
    .limegreen { font-style:italic; color:#A9F5A9;}
    ]
    However, it colors an entire passage.  I want to be able to insert different colors on some text within that.  For instance like in Sharpe's #box if the entire thing was wrapped in that code it'd all be green.  Except I'd want the left of the colon on XP to be green and the right to be gold or something.

    3.  In your box code you use the word "right" to put the box to the right.  I tried "left" and got one left as well.  What are all of the options for defining location like that?

    4.  If I had 3 passages to link, but as they are clicked the options are removed from being there to be clicked the next time, how would I code that?
  • Wraithbane wrote:

    1.  I tried the example sugarcube widget code for pronouns and it errors out.  I put it in my stylesheet, copy and pasted and it gives me the Error: macro <<he>> does not exist.  What am I doing wrong? 


    I assume you mean the one from the docs?  Regardless, widgets do not go in stylesheet tagged passages.

    [quote="SugarCube basic reference docs Macros <<widget>>"]
    Widgets should always be defined within non-story-path passages tagged with widget, as any widgets that are not may be lost on page reload (i.e. treat widgets similarly to how you would normal custom macros, which should always be in script tagged passages).


    Create a new passage, name it whatever you want (My Widgets, whatever), tag it with widget, put your widgets in there, and you're done.


    Wraithbane wrote:

    2.  I am using the following to color things. 
    .limegreen { font-style:italic; color:#A9F5A9;}
    ]
    However, it colors an entire passage.  I want to be able to insert different colors on some text within that.  For instance like in Sharpe's #box if the entire thing was wrapped in that code it'd all be green.  Except I'd want the left of the colon on XP to be green and the right to be gold or something.


    What are you sticking that class on?
  • 1.  Thanks.  I read "scripts" as meaning put it with other complicated looking code... hahah sorry about that.

    2. 


    <span id="box"><b><span class="limegreen">
    Name: <<print $player.name>><br>
    Level: <<print $player.level>><br>
    HP: <<print $player.HP>><br>
    XP: <<print $player.XP>><br>
    Gold: <<print $player.gold>><br>
    </span></b></span>
    and I have this for limegreen.
    .limegreen { font-style:italic; color:#A9F5A9;}
  • If that's all you're doing, then it should be working (and by that I mean only changing the foreground color of the stuff in the box, not the whole passage).

    Attach your source file?
  • Wraithbane wrote:
    3.  In your box code you use the word "right" to put the box to the right.  I tried "left" and got one left as well.  What are all of the options for defining location like that?

    4.  If I had 3 passages to link, but as they are clicked the options are removed from being there to be clicked the next time, how would I code that?


    3. Take a look at my beginner's guide to CSS: http://twinery.org/forum/index.php/topic,1528.0.html

    Also, you can Google "CSS float" or "CSS align" and find a number of helpful pages.

    4. <<if $i eq 0>>[[Here is an option!][$i +=1]]<<endif>>

    Like TME said, at this point, you'll need to upload a TWS so we can see the problem with the CSS.
  • I'll get something up in a bit.  Thanks for your help Sharpe.
  • Sent you a PM on here Exile.
  • Wraithbane wrote:

    Sent you a PM on here Exile.


    Hmm.  I don't have anything from you in my inbox.
  • Check now.
Sign In or Register to comment.