RPG Mechanics

I'm trying to create a Battle Menu in my game AdventureBound.

However, I am having issues with the structural coding necessary to make this menu functionable.

Could somebody please provide me some assistance?


With love,
RougeofMind612


you can study/use some combat code/libraries/games:

Pixie's 'deeper' game (uses his combat 3.0 library)

my old and poor/bad (this was back when I was first learning how to do combat myself) combat code (using Pertex' combat code):

https://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread#22485 (you'll have to download it, it's the 'text.aslx' hyperlink in pertex' post, as this is Pertex' work at/in cleaning up my code, as my own old code, in my post above his post, is very faulty-confusing, lol)

and here's the key/legend for my combat code (I've learned to never ever to use abrevs ever again, lol):

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

ask if you need help with anything


the is a "simple" way/design of doing it (though I do use some more advanced features of quest), an example:

using 'show menu' and 'switch' Scripts/Functions:
( http://docs.textadventures.co.uk/quest/scripts/show_menu.html )
( http://docs.textadventures.co.uk/quest/scripts/switch.html )

<delegate name="combat_delegate" parameters="target_object_parameter" />

<game name="example_game">

  <attr name=start" type="script">

    rundelegate (combat_object, "combat_script_attribute", orc)
    on ready {
      rundelegate (combat_object, "combat_script_attribute", ogre)
    }

  </attr>

</game>

<object name="room">

  <inherit name="editor_room" />

</object>

<object name="player">

  <inherit name="editor_object" />
  <inherit name="editor_player" />

  <attr name="parent" type="object">room</attr>

  <!-- blah ATTRIBUTES, example below -->

  <attr name="current_life_integer_attribute" type="int">999</attr>

  <attr name="damage_integer_attribute" type="int">50</attr>

</object>

<object name="orc">

  <inherit name="editor_object" />

  <attr name="parent" type="object">room</attr>

  <!-- blah ATTRIBUTES, example below -->

  <attr name="dead_boolean_attribute" type="boolean">false</attr>

  <attr name="current_life_integer_attribute" type="int">100</attr>

  <attr name="damage_integer_attribute" type="int">10</attr>

</object>

<object name="ogre">

  <inherit name="editor_object" />

  <attr name="parent" type="object">room</attr>

  <!-- blah ATTRIBUTES, example below -->

  <attr name="dead_boolean_attribute" type="boolean">false</attr>

  <attr name="current_life_integer_attribute" type="int">200</attr>

  <attr name="damage_integer_attribute" type="int">20</attr>

</object>

<object name="combat_object">

  <attr name="combat_action_stringlist_attribute" type="stringlist">

    <value>attack</value>
    <value>defend</value>
    <value>special</value>
    <value>cast</value>
    <value>item</value>
    <value>plant</value>
    <value>steal</value>
    <value>escape/value>

  </attr>

  <attr name="combat_script_attribute" type="combat_delegate">

    <!-- you'd use the 'target_object_parameter' PARAMETER VARIABLE (which is first storing the 'orc' Object, and then the 'ogre' Object) of the 'combat_delegate' DELEGATE  in the scripting below -->

    <!-- example below -->

    <![CDATA[

      show menu ("Combat Action?", this.combat_action_stringlist_attribute, false) {
        switch (result) {
          case ("attack") {
            // blah scripting
            // for example:
            // check if target is dead or not:
            // if (target_object_parameter.dead_boolean_attribute) {
            //  msg ("The " + target_object_parameter.name + " is already dead, silly")
            // } else {
            //   you attack the orc first:
            //   target_object_parameter.current_life_integer_attribute = target_object_parameter.current_life_integer_attribute - game.pov.damage_integer_attribute
            //   check if target is killed (and set to being dead if killed):
            //   if (target_object_parameter.current_life_integer_attribute < 1) {
            //     target_object_parameter.dead_boolean_attribute = true
            //   } else {
            //     the target attacks you:
            //     game.pov.current_life_integer_attribute = game.pov.current_life_integer_attribute - target_object_parameter.damage_integer_attribute
            //     check if you're killed (if killed, game over):
            //     if (game.pov.current_life_integer_attribute < 1) {
            //       msg ("You were killed by the " + target_object_parameter.name)
            //       msg ("GAME OVER")
            //       finish
            //     } else {
            //       // combat continues (loops/do-run-this-combat-script-again) until one of you dies:
            //       rundelegate (this, "combat_script_attribute", target_object_parameter)
            //     }
            //   }
            // }
          }
          case ("defend") {
            // blah scripting
          }
          case ("special") {
            // blah scripting
          }
          case ("cast") {
            // blah scripting
          }
          case ("item") {
            // blah scripting
          }
          case ("plant") {
            // blah scripting
          }
          case ("steal") {
            // blah scripting
          }
          case ("escape") {
            // blah scripting
          }
        }
      }

    ]]>

  </attr>

</object>

Considering remaking my entire game after reading your reply....maybe make it into the new AdventureBound ?

Would like your opinion. The game's right here: https://textadventures.co.uk/games/view/msooqljxcki3zxdrydwm3w

Please give it a quick playthrough and see what I mean when you try to attack the enemies...

With Love,
RougeofMind612


Would you mind giving me a basic walk through of how to enter this info into the "Command" Menu?

With Love,
RougeofMind612


Log in to post a reply.

Support

Forums