New User! Lazy Question :<

Hey! Just found this program today and have been hard at work during down time to make a quick Fighting Fantasy style gamebook for my eldest son who has just started reading chapter books.

I am at the part where I need to make combat happen. I obviously started looking for tutorials but so far they are all teaching way more than I need. The combat libraries I have found are too complex looking as well.

I want a very basic combat system. You get items that change stats like HP, ATK + DEF and a few that set flags that allow new combat options like 'Throw Potion' but outside of that it is really just click attack, add a little RNG on top of the value and continue clicking until you or the monster is dead. Nothing deep or tactical.

I have a background in programming so I am comfortable trying to make it myself, though it would be nice to have something to work off of.

If anyone would be so kind as to point me in the right direction I'd be super grateful.

Thanks!


easiest/quickest is to use tail-recursive Functions for your combat, which you can either put into your 'Verbs' (on individual Objects, or you can put them into 'Object Types: quest's user-level classes' and inherit them via giving your Objects their 'inherited' Attribute, or into a 'Command' (universal/global/general way of using typed-in input) Element

if you've not seen this, and if you can understand/follow/grasp it (warning: the code is a bit bad as this was back when I was first learning to do combat scripting), you can take a look at this:

http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread#22483
or
https://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread#22483

and the key/legend for it (I've learned since to never use abrevs ever again, lol):

http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread#22486
or
https://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread#22486


as for manipulating (adding/removing) Verbs' displayment/use, they're controlled via built-in 'displayverbs' and 'inventoryverbs' Stringlist Attributes:

http://docs.textadventures.co.uk/quest/guides/display_verbs.html

and jsut about Verb usage in general:

http://textadventures.co.uk/forum/samples/topic/4953/how-to-use-verbs (on Verb usage in general)

and if you need to learn quest's language and syntax:

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk
http://textadventures.co.uk/forum/samples/topic/5137/list-and-dictionary-extensive-guide-by-hk


Awesome, thanks so much!


Based on your post, you are making an RPG game with fighting elements using the gamebook mode?

Make sure you let us know if this doesn't work out too well. Text adventures are much more versatile when working with these elements. You can even use the text adventure versatility AND make it look and play like a gamebook.

Best of luck and welcome!!


A lot of the stuff I have seen has been for Text Adventure but not Gamebook , I wish there wasn't such a big difference between the two:<

Right now I am stuck on getting an inline menu to appear for combat - the function ShowMenu() does not seem to exist. I went into a text adventure to test it and I got it work there without any trouble. I tried to look for the code for ShowMenu to steal it and bring it to my gamebook but
A) Not familiar with the systems yet
B) Am VERY rusty with actual programming

The thing is, outside of a few more ideas, getting ShowMenu to work will get me close to my destination. I really don't need much to get combat to work as it is so stripped down and barebones. The bulk of the book is just reading text and choosing what page you want to go. The combat is a very tiny part of it.

Once again, if anyone can help I'd be super happy.

@XanMag - I really don't want to give up on this project of mine, so if I can't get combat to work in the way I want I may just have to downgrade it to simply clicking on different pages (like in actual game books). I mean if that's my only option with my limited skill then so be it.


If you have not done much yet, I would recommend changing to doing it as a text adventure that is set up to look like a game book, rather than as an actual game book. Text adventures have more functionality, better documentation, a world model (vital to an RPG game) and much better knowhow on the forum.


if you're (set on) using Game Book, I guess there is no built-in in-line menu for it (no ShowMenu(PROMPT, LIST, BOOLEAN:TRUE/FALSE_FOR_IF_ABLE_TO_CANCEL_OUT_OF_MENU_OR_NOT)), so you'll have to manually create your own in-line menu...

for example:

(edited: fixed up as I forgot to do the '-1' for getting item via the list index number)

<function name="custom_menu_function" parameters="menu_prompt_string_parameter, menu_options_list_parameter">
  msg (menu_prompt_string_parameter + " (type in the number of your choice)")
  numbering_integer_variable = 0
  foreach (menu_option_string_variable, menu_options_list_parameter) {
    numbering_integer_variable = numbering_integer_variable + 1
    msg (numbering_integer_variable + ". " + menu_option_string_variable)
  }
  get input {
    if (IsInt (result) and ToInt (result) > 0 and ToInt (result) <= ListCount (menu_options_list_parameter)) {
      selected_choice_string_variable = StringListItem (menu_options_list_parameter, ToInt (result) -1)
      // then do whatever you want to do with your selected choice (selected_choice_string_variable)
    } else {
      custom_menu_function (menu_prompt_string_parameter, menu_options_list_parameter)
    }
  }
</function>

// -------------------------------------------------------------------------

<function name="custom_menu_function" parameters="menu_prompt_string_parameter, menu_options_list_parameter">
  msg (menu_prompt_string_parameter + " (type in the number of your choice)")
  numbering_integer_variable = 0
  foreach (menu_option_string_variable, menu_options_list_parameter) {
    numbering_integer_variable = numbering_integer_variable + 1
    msg (numbering_integer_variable + ". " + menu_option_string_variable)
  }
  get input {
    if (IsInt (result) and ToInt (result) > 0 and ToInt (result) <= ListCount (menu_options_list_parameter)) {
      selected_choice_string_variable = StringListItem (menu_options_list_parameter, ToInt (result) - 1)
      player.race = selected_choice_string_variable
      msg ("(testing msg) your race is: " + player.race)
    } else {
      custom_menu_function (menu_prompt_string_parameter, menu_options_list_parameter)
    }
  }
</function>

// example of using ("calling") the Function:

<game name="example">
  <attr name="race_list" type="simplestringlist">human;dwarf;elf;gnome;halfling;giant</attr>
</game>

// 'Page_1' Page Object -> 'Page' Tab -> Page Type: [script] or [script+text] -> (see below)

custom_menu_function ("Choose your race", game.race_list)

// result/output/displayment:

Choose your race (type in the number of your choice)
1. human
2. dwarf
3. elf
4. gnome
5. halfling
6. giant
// let's say you typed in: 5
(testing msg) your race is: halfling

P.S.

the Game Book was created for a non-code/scripting/RPG-heavy CYOA game, so that's why the Game Book is very limited in functionality/capability.


Thanks so much! I will play around with it. I am going to stick with the gamebook, so if I can't get combat to work the way I wanted, I will just opt for a pretend combat system that the gamebook definitely supports.

You guys are amazing, and thanks a BUNCH hegemonkhan! If I have any other questions I know where to ask, but I think I am in a good place now.


I hope you know coding better than I do. Otherwise, you're going to be working on it for a while.

The best, simplest combat I know of is "Enter room, run attack function, run away."
Even a basic "Defense, Attack, etc." combat is complex and takes a lot of work.


P.S. Please see my thread on Final Fantasy and leveling: http://textadventures.co.uk/forum/general/topic/l-1sm78sb0yg1onejxaiwq/hypothetical-q-could-you-make-a-game-with-a-10-000-level-rpg-and-1-000-000-hp

"continue clicking until you or the monster is dead"
Oh. It sounds like you want that combat timer. Just try The Pixie's (link https://github.com/ThePix/quest/wiki/The-Zombie-Apocalypse-(on-the-web-version)) code, and change a few things. (I was able to make a level system for it.) http://textadventures.co.uk/games/view/kmwqh7zyrkcrseuqrzuigg/zombie-2
(And if you quickly figure out how to do a combat system without that weird timer, doesn't matter what it is but RPG preferably, email and send it to me. [email protected])

Here's a sneak peak at my level function if you want.
if (player.exp >= player.level * 110 + 100) {
player.plevel = 1 + player.plevel
msg ("You are level " + player.plevel + ".")
}
Just set that on your "dead" (SpawnZombie) function, or whatever your
"
obj.dead = false
obj.changedhitpoints => {
if (this.hitpoints < 1) {
msg ("It is dead!")
this.dead = true
player.exp = player.exp + 20
love
}
}
"
is, and you're all set.
Edit, 4/25. I added a '=' to the level function.


Sorry, domai36, I made one mistake:

I forgot to do the 'your typed in number - 1', as list's index number starts at 0, so, here's the corrected code:

<function name="custom_menu_function" parameters="menu_prompt_string_parameter, menu_options_list_parameter">
  msg (menu_prompt_string_parameter + " (type in the number of your choice)")
  numbering_integer_variable = 0
  foreach (menu_option_string_variable, menu_options_list_parameter) {
    numbering_integer_variable = numbering_integer_variable + 1
    msg (numbering_integer_variable + ". " + menu_option_string_variable)
  }
  get input {
    if (IsInt (result) and ToInt (result) > 0 and ToInt (result) <= ListCount (menu_options_list_parameter)) {
      selected_choice_string_variable = StringListItem (menu_options_list_parameter, ToInt (result) - 1) // <----- here's the fix
      player.race = selected_choice_string_variable
      msg ("(testing msg) your race is: " + player.race)
    } else {
      custom_menu_function (menu_prompt_string_parameter, menu_options_list_parameter)
    }
  }
</function>

// example of using ("calling") the Function:

<game name="example">
  <attr name="race_list" type="simplestringlist">human;dwarf;elf;gnome;halfling;giant</attr>
</game>

// 'Page_1' Page Object -> 'Page' Tab -> Page Type: [script] or [script+text] -> (see below)

custom_menu_function ("Choose your race", game.race_list)

// result/output/displayment:

Choose your race (type in the number of your choice)
1. human
2. dwarf
3. elf
4. gnome
5. halfling
6. giant
// let's say you typed in: 5
(testing msg) your race is: halfling

What kind of Final Fantasy game are you making anyways? A whole game, or just part of one?

I suspect you can use the "Choose your race" thing for the job classes. Unless you have your own plan. I don't think Hegemonkhan knows about Final Fantasy.


Actually, see here. http://textadventures.co.uk/games/view/xb0ge9kzbewhodrtmxnnqw/monster-fighter-2
It's a proof in concept really, but I tried to make a game with combat, without functions.... except the leveling and things.
(If you don't want those complicated tutorials.)
It's simple combat, I think.
(Actually, I think it's possible to hook up The Pixie's zombie game pretty easily if I wanted to spawn enemies... I wouldn't recommend trying it unless you know what you're doing.)

I took a picture with all the important stuff and uploaded it to imgur.
Just ignore all the excess commands and functions. I was playing around with everything for a bit.
http://imgur.com/Wpp344O
http://imgur.com/OKQ3M3t
http://imgur.com/YZeYVZA
http://imgur.com/lB0EHjZ
http://imgur.com/G9cNpDv
http://imgur.com/ZmO0ni3
http://imgur.com/SGcpekn
http://imgur.com/3fZJ1hn
http://imgur.com/jaKS9hW

You don't need that WeaponUpdate thing. Again, I was messing around.

I suppose it's possible to mess with the Monsters' stats by giving them certain objects. If you want different stats.
For instance:
if (Contains (Monster,coat)) {
Monster.health = Monster.health + 10
}


I love RPGs, and I've played FF: 1-8, excluding 3 and 4 (and I only played a tiny bit of 2), as I stopped with consoles at PS1, as I was getting too old to play/busy with real life, and they were getting to expensive as well. Now I just maybe get a computer game that really interests me, but I've not gotten anything new for awhile now. Not a kid anymore where I can play games 24/7 and parents buy the games/consoles/platforms for you. I don't have the money or time to game anymore, sighs.

FF5, I think, was the first time there was a 'job-class system' in games, but it never got licenced to the U.S. for SNES, back then.


I'm trying to make a skyrim (TES) RPG ambitious game, lol, but it's been on hiatus for awhile, due to school / school work, sighs.


here's all the RPGs that I've played:

NES:

Willow
Crystalis
Metroid (1)
Fester's Quest
Maniac Mansion
Shadowgate
The Legend of Zelda (1), Zelda 2: The Adventures of Link
Final Fantasy 1, Final Fantasy 2
Dragon Warrior 1 (US), Dragon Warrior 2 (US)

GB:

Metroid 2
The Legend of Zelda (3 or 4): Link's Awakening

SNES:

7th Saga (1/2)
Earth Bound
Robotrek
Secret of Evrmore
Paladin's Quest
Secret of Mana (US) (Seiken Densetsu 2, JP), Seiken Densetsu 3 (JP)
Lufia (1) and the Fortress of Doom, Lufia 2: Rise of the Sinistrals
Breath of Fire 1, Breath of Fire 2
Chrono Trigger
Super Metroid (2 or 3)
EVO: Search for Eden
Tales of Phantasia (?/?)
Soul Blazer (1/3) (hadn't plated SB yet), Illusion of Gaia (2/3), Terranigma (3/3)
Ogre Battle (?/?): The March of the Black Queen
Final Fantasy 5, Final Fantasy 6 (JP) (Final Fantasy 3: US)
The Legend of Zelda (3 or 4): A Link to the Past
Jurassic Park

N64:

The Legend of Zelda (5?): Ocarina of Time, The Legend of Zelda (6?): Majora's Mask (not played MM yet)

PS1:

Parasite Eve (1)
Grandia (1)
Tactics Ogre (Ogre Battle: ?/?): Let Us Cling Together
Breath of Fire 3, Breath of Fire 4
Final Fantasy 7, Final Fantasy 8

Computer:

MIght and Magic (4+5): World of Xeen
Wizards and Warriors
Myst, Riven
TES: Morrowind (Mornhold+Solsteim)
Fallout 1, Fallout 2
Heroes of Might and Magic 3 (+Armaggeddon's Blade)


and more... but meh... this is good enough list for this post, lol


just quick code example on how you can use Object Attributes and Objectlist Attributes:

(incomplete below, as there's so much more that can be done, but this is to jsut give you some ideas on some of this stuff that you can do)

<object name="room">
</object>

<object name="player">
  <inherit name="playable_character_type" />
  <attr name="parent" type="object">room</atr>
  <attr name="current_life" type"int">999</attr>
  <attr name="maximum_life" type"int">999</attr>
  <attr name="weapon_list" type="objectlist">unarmed;claw;power_fist;spiked_knuckles;katana;claymore</attr>
</object>

<object name="orc">
  <inherit name="monster_type" />
  <attr name="parent" type="object">room</atr>
  <attr name="current_life" type"int">500</attr>
  <attr name="maximum_life" type"int">500</attr>
</object>

<object name="item_item_data_object">
  <object name="item_data_object">
    <object name="healing_item_data_object">
    </object>
    <object name="battle_item_data_object">
    </object>
    <object name="event_item_data_object">
    </object>
  </object>
  <object name="equipment_data_object">
    <object name="weapon_data_object">
      <object name="unarmed_data_object">
        <object name="unarmed">
          <inherit name="weapon_type" />
        </object>
        <object name="claw">
          <inherit name="weapon_type" />
        </object>
        <object name="power_fist">
          <inherit name="weapon_type" />
        </object>
        <object name="spiked_knuckles">
          <inherit name="weapon_type" />
        </object>
      </object>
      <object name="sword_data_object">
        <object name="katana">
          <inherit name="weapon_type" />
          <attr name="damage" type="int">50</attr>
        </object>
        <object name="claymore">
          <inherit name="weapon_type" />
          <attr name="damage" type="int">50</attr>
        </object>
      </object>
      <object name="axe_data_object">
      </object>
      <object name="spear_data_object">
      </object>
      <object name="staff_data_object">
      </object>
      <object name="dagger_data_object">
      </object>
      <object name="whip_data_object">
      </object>
      <object name="throwing_data_object">
      </object>
      <object name="mace_data_object">
      </object>
      <object name="flail_data_object">
      </object>
      <object name="scepter_data_object">
      </object>
      <object name="wand_data_object">
      </object>
      <object name="hammer_data_object">
      </object>
    </object>
  </object>
</object>

<type name="character_type">
  <attr name="condition" type="string">normal</attr>
  <attr name="weapon" type="object">unarmed</attr>
  <attr name="current_life" type="int">1</attr>
  <attr name="maximum_life" type="int">1</attr>
  <attr name="life" type="string">unknown</attr>
  <attr name="changedcurrent_life" type="script">
    this.life = this.current_life + "/" + this.maximum_life
  </attr>
  <attr name="changedmaximum_life" type="script">
    this.life = this.current_life + "/" + this.maximum_life
  </attr>
</type>

<type name="playable_character_type">
  <inherit name="character_type" />
  <attr name="statusattributes" type="simplestringdictionary">life = Life: !;condition = Condition: !</attr>
</type>

<type name="monster_type">
  <inherit name="character_type" />
  <attr name="displayverbs" type="listextend">attack</attr> // or: <attr name="displayverbs" type="extend">attack</attr>
  <attr name="attack" type="script">
    if (not this.condition = "dead") {
      this.current_life = this.current_life - player.weapon.damage // you'll do the damage of your 'held weapon' (player.weapon)
    }
  </attr>
</type>

<type name="equipment_type">
  <attr name="displayverbs" type="listextend">equip;unequip</attr> // or (forgot its syntax): <attr name="displayverbs" type="extend">equip;unequip</attr>
  <attr name="inventoryverbs" type="listextend">equip;unequip</attr> // or (forgot its syntax): <attr name="inventoryverbs" type="extend">equip;unequip</attr>
  <attr name="equip" type="script">
  </attr>
  <attr name="unequip" type="script">
  </attr>
</type>

<type name="weapon_type">
  <inherit name="equipment_type" />
  <attr name="damage" type="int">1</attr>
  <attr name="equip" type="script">
    show menu ("Weapon?", player.weapon_list, false) {
      player.weapon = result
    }
  </attr>
  <attr name="unequip" type="script">
    player.weapon = unarmed
  </attr>
</type>

<type name="armor_type">
</type>

<type name="clothing_type">
</type>

<command name="attack_command">
  <pattern>attack #object_parameter#</pattern>
  <script>
    if (DoesInherit (object_parameter, "monster_type") and not object_parameter.condition = "dead") {
      object_parameter.current_life = object_parameter.current_life - player.weapon.damage // you'll do the damage of your 'held weapon' (player.weapon = unarmed/katana/claymore/claw/power_fist/spiked_knuckles)
    }
  </script>
</command>

<verb>
  <property>attack</property>
  <pattern>attack</pattern>
  <defaultexpression>You can't attack that!</defaultexpression>
</verb>

ask if you got any questions about any of this, or if anything doesn't work, and I'll help you with whatever you need with it.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums