Howdy, Stranger!

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

Magic/Stamina usage in combat [Harlowe]

edited January 2016 in Help! with 2.0
I'm trying to create a story with a pretty basic turn based combat but I came to a halt when I realized I have no idea how to create a mana/stamina system.
Let's say I'm in combat [e.g. (set: $stamina to 10)] and some of my skills take stamina to use. How can I create a system that reduces stamina when I use skills and doesn't let me use skills that I don't have stamina for?

Comments

  • edited January 2016
    Hi
    This is incredibly simplistic, but should get you started
    (set: $Stamina to 10)
    <!-- define skill stamina requirements -->
    (Set: $Skill_A_Stamina to 2)
    (Set: $Skill_B_Stamina to 1)
    <!-- Input skill required e.g. A or B -->
    (set: $SkillRequired to (prompt: "Skill"))
    
    (if: $SkillRequired is "A")[
    	(if: $Stamina >= $Skill_A_Stamina)[
    		(set: $Stamina -= $Skill_A_Stamina)
    		(display: "SomePassage")](else:)[
    			(Alert: "Insufficient stamina")
    	]
    ]
    

    If you have a lot of skills then you would probably use a datamap for skills and stamina requirements
    e.g.
    Something like
    (set: $Skills to (datamap:"3", "Jump","5", "Fly","1", "Walk"))
    

    The prompt macro pops up an input box and the alert: macro displays a pop up message.
  • Hey thanks! Seems to be working fine :)
  • No worries. I got the datamap the wrong way round though

    it should be something like
    (set: $Skills to (datamap: "Jump","3", "Fly","5", "Walk","1"))
    
Sign In or Register to comment.