Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

I'm doing a fighting sim in my spare spare time (Two spares intended) when I can't think of anything to write anywhere else. I've been thinking of using a Mana stat that increases your damage but lowers your accuracy as it goes down. (I.E. your attack does 2d6 damage normally, but 1d60 damage when the variable reaches zero, that wide damage range representing the uncertain accuracy.) Also, is there any way to do this in Twine, so I can distribute downloadable versions to my friends and their friends' friends and shit without risking that one annoying guy at the party having the game suggested to him and discovering our forums?... Where do I find Twine anyway?

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

I see no reason you can't do that kind of thing in Twine, which you can download at twinery.org. ^_^

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

Wow... Tutorial Please? Confusion and the unshakable feeling that I just made a Faustian bargain with a malevolent supernatural entity doesn't mix well.

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

Muahahahaha! *ahem* I mean, of course, I'd be delighted to help a new convert user. ^_^

It's actually really pretty simple, but Auntie Pixelante probably can explain it better than me. I'd be happy to answer any specific questions you have, though!

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

Hmm... looks like her tutorial skips something I think is pretty important: Setting variables via links. The syntax for that is this:

[[Link Text|Passage Title][$variable = "foo"]]

That creates a link that will look like Link Text, lead to a passage called Passage Title, and sets a variable called 'variable' to the string "foo."

You could also do something like: $health = $health - $damage, if you've already set both $health and $damage elsewhere.

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

How do you make maximum health and maximum mana, and their effects, vary between protagonist you choose to play as, and what links and such will be availiable to you at different amounts? More specifically, death pages, since that's beyond world-endingly important for a fighting sim of any kind.

As far as setting variables through links, I could hardly understand that*. Must have been thrown off by the Foo. I'd just like something like CYS's system that adds and subtracts certain displayed variables with different links, with the dice option, if posssible.

*[insert link to XKCD's "explain it to me like I'm 5" joke.]

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

Well, I recommend setting up all the variables you're going to use in a great big block in your first passage, like so:

<<silently>>
<<set $maxhealth = 0>>
<<set $maxmana = 0>>
[etc]
<<endsilently>>

THEN, say you've got a passage with links that you choose what character you are:

[["I'm a fighter!"|fighter][$maxhealth = 100, $maxmana = 0]]

[["I'm a mage!"|mage][$maxhealth = 50, $maxmana = 50]]

Basically, you can stuff variable changes into links, by putting them in square brackets after the main part of the link (the link text and link passage title).

You can also do things like:

[["Health Down!"|nextpage][$health = $health - 1]]

[["Health Up!"|nextpage][$health = $health + 1]]

For dice, you need to use the random function. random(x,y) will give you a number between x and y, inclusive.

So:

[["Health Down!"|nextpage][$health = $health - random(1,5)]]

will subtract anywhere from 1 to 5 from your health.

Of course, at this point, nothing will change if you go below 0, or above $maxhealth. But this should give you something to play with while I'm thinking about the best way to handle those two contingencies. XD

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

I've played a while, the only real solution I can come up with is forcing players to click certain links to maintain their shit properly.

I.E. You go above maxhealth: health is bigger than maximum, make all other links dissappear and make this one appear, "You got liver poisoning from saturated health potion content and lost everything extra." Back  into the fray!

The same goes for death pages, except they send you back to the beginning. No saves and shit either, I want people who beat this game to be able to wear it like a badge of honor. And since it's ball-bustingly difficult to make a mechanic like this ball-bustingly difficult without OPping an enemy and giving the player a weird variety of ball-bustingly-difficult-to-program potions, it's the least I can do. *Realizes there's a bookmark option* Alright, shit...

I guess the point of this post is, is there any better way to handle those variables? And why is it Maxhealth as opposed to just health?

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

You can disable the bookmark option. Don't ask me how, but I've definitely seen it done. Google probably knows. XD

I think you're doing it right. "MaxHealth" is, well, maximum health. A fighter has a bigger virtual health bar than a mage (or whatever). "Health" is where you're at right now -- anywhere from maxHealth down to 0, if you've implemented the appropriate checks. XD

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

I don't see why I'd need Maxhealth particularly though. It can be done without a distinct variable in different story paths just by making the links in different paths appear on different conditions. That way normal health and mana, as a variable, won't need to do anything other than fluctuate because the links told it to, and the scripts on the pages will just use health and mana to determine which links to use and affect it at the current time.

Also, how do you randomize text on attack pages to change up the verbal events, like in Hunter and nmelssx's decent scripty thing? It'd be excuseable to repeatedly throw the same punch if this were a Street Fighter clone, but I have neither the skill, nor the work ethic to turn my game into one of those.

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

You're the one who said you wanted to vary maximum health in the first place:

"How do you make maximum health and maximum mana, and their effects, vary between protagonist you choose to play as?"

To randomize displayed text, use the random function to set a variable, then use conditionals (if/else if) to display the text.

...sorry, that's not super intelligible. I'll write up a real example once I'm on my computer. >_<

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

Well, I should have set different amounts of mana. That was needlessly complex.

And, as for the last part, yeah, I'm pretty iffy with if statements.

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

Okay, sorry for the delay, I'm just not enough of a Twine expert to trust my code without testing it. Here, paste this into the Start passage of a new Twine to see it in action:

<<set $num to random(1,3)>>
<<if $num is 1>>
You punch him!
<<elseif $num is 2>>
You kick him!
<<elseif $num is 3>>
You punch him AND kick him!
<<endif>>

[[Hit him again!|Start]]

If you need more options, just be sure to increase the maximum value (currently 3) in the random function call.

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

Twine. Why are you asking a twine question, not on twine?

...Just curious. 

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

Don't think he knew what the Twine website URL was.

Fighting Sim! (I'm a yellowbellied traitor!)

10 years ago

Oh, lots of reasons.

1. I didn't know where the site was, finding something on google whose name is more commonly used for something entirely different when google is an evil bastard whore who won't let you scroll or click for an hour after it says it's finished loading is a pain in the ass.

2. Asking a specific question to a site with no visible forum or help section is a pain in the ass.

3. Signing up for a site, even if it does have a forum that can answer my urgent questions, is a pain in the ass.

4. Morgan seems to have a pretty good idea as to how Twine works, a few other heathens on this site used it once or twice as well.