Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: The Riddler - A Workshop that asks riddles and gives rewards for correct answers  (Read 3089 times)

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Title says it all. I thought its a neat idea. I saw IndigoFenix Sphinx mod, which uses riddles in interactions, but unfortunately its one rare creature that uses it in adv.mode. Later I saw Putnams HackWish script, which allows specific items to be created if you enter a string in a textbox, all ingame, called by a reaction in a workshop.

Both could be combined. A dwarf runs a reaction, a textbox pops up showing one of several riddles that have been put into the script, and the player has to type the answer, then press enter. If its wrong, he gets nothing, or something bad (dwarf dies, spawn enemy unit, start a fire, something like that). If its right, he gets either to pick an item, or get a predefined rewards, which is declared in the script before. (lets say "solve riddle 1, get steel armor")

Now, I do know how to write riddles, and/or steal them from riddle collections from the internet. I can also make workshops, reactions, inorganics, and come up with costs and rewards. Putnam also told me that the hackwish script could easily be modified to fit these needs.

This is the current hackwish.lua
Spoiler (click to show/hide)

I had a good long look at it, but I cant figure out which parts to change to get the usage out of it that I described above. So why not ask the community? In the end the product will be a workshop that can work in vanilla DF or any mod, and people can add different riddles. For example I can see a hacking minigame for the Fallout mod, where a vault dweller has to hack a computer terminal to get blueprints and intel. :) Or the atronach riddles from Morrowind for the TES mod. You answer wrong, you spawn a hostile atronach, you get it right, you spawn a friendly atronach. :)

I am just putting it out here. If anyone can come up with the script, just a template that uses placeholders like 'riddle1' 'answer1,2,3', 'reward1' 'punishment1', we would be all set.

I hope you guys like the idea. :)
« Last Edit: January 12, 2014, 05:00:29 pm by Meph »
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile

Here's a newer version of hackwish. It should be easier to edit, as it's less than 40% as large as the old one.

Basically, you want something like this:

Code: [Select]
function riddle(question,answer)
    local script=require('gui/script')
    local ok,givenAnswer=script.showInputPrompt('A riddle',question,COLOR_LIGHTGREEN)
    return givenAnswer:lower():gsub('%W',''):find(answer:lower():gsub('%W',''))
end

That function has a question and an answer. It will display an input prompt with the question at the top and will check if the answer given contains the answer. It could be a bit difficult, so multiple choice should also be possible.
« Last Edit: January 12, 2014, 11:41:41 pm by Putnam »
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Now to figure out how to make it pick one of the riddles at random when called. ^^
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile

Now to figure out how to make it pick one of the riddles at random when called. ^^
What about this?
http://www.bay12forums.com/smf/index.php?topic=134774.0
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Now to figure out how to make it pick one of the riddles at random when called. ^^
What about this?
http://www.bay12forums.com/smf/index.php?topic=134774.0
That would work. Good thinking.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::