The best way to implement interactive story type "events" within the "rooms layout"?

I really like how much efforts are put into this engine but when I need to do something unusual I sometimes think it would be easier to write from scratch... though I am probably mistaken anyway!

So I want to create a network of rooms, like in a good old MUD, but then implement combat using a series of events. As in where you are given three choices to five what to do (and these three choices are not constant, but it feels more like an interactive story. What is the best way of doing it? I tried creating a new room for each dialogue, but thinking about it, it's probably not the best idea after all! The namespace gets really clunky and hard to work with, to start with, and the thing is a bit hard to debug. How would you recommend going about it?

I guess I should try some dialogue system?


(filler for getting my edited post, updated/posted)


this gets into a bit of "advanced" code handling/using... so, it might be a bit difficult if you're totally new to coding... we can help if you want to learn to code, which will make all of this easier for you to understand and eventually do yourself, but we'll help with getting this game design setup for you regardless of whether you want to learn to code or not, lol, so fear not, we're a small community, but large in friendliness and helping others with anything quest related, including coding, hehe.

if you just want global (as in it doesn't matter what room/location you're at) random events, then using a global (as in: not within a Room Object) Turnscript, along with the scripting/coding for doing your random events within it, is probably the best/"easiest" method

if you want specific random events, depending on which Room Object (location) you're at, then there's a bit more good options for methods of doing it... (you can use the same Turnscript usage method, and jsut have them be local Turnscripts, as in: you have the Turnscripts within the specific rooms, along with the coding/scripting for your random events within the Turnscript for that room/location. But there's other good methods you can use too)

and/or do you want the random list/menu of choices to be 'path-ed' as well, as in: selecting 'A' as you first choice/option, leads to X,Y,Z choices/options as your second choice/option list/menu, whereas selecting 'B' as your first choice/option, leads to U,V,W choices/options as your second choice/option list/menu, whereas selecting 'C' as your first choice/option, leads to R,S,T choices/options as your second choice/option list/menu???


a list/menu of choices involves using 'List/Dictionary' Attributes, along with working well with randomization usage too.


do you want the combat to be purely choices/options driven, or do you want it to be (RPG) mechanics driven (equations/formulas/calculations: life/hp, damage, defense, etc), or both (choices/options + mechanics) ???


I was thinking more about interactive style combat, but of course it wouldnt hurt to have additional variables in there.

I am somewhat decent with coding, just new to Quest.. I guess I could have come up wit something on my own, but I just ask in case there is a simple solution ^^'


K.V.

Something like this (although this has nothing random)?

EDITED (version 4)

<!--Saved by Quest 5.7.6606.27193-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Arena">
    <gameid>aa5981db-96fc-4d48-8145-c05f0957abfa</gameid>
    <version>1.0</version>
    <firstpublished>2018</firstpublished>
    <attr name="autodescription_youarein_useprefix" type="boolean">false</attr>
    <showhealth />
    <onhealthzero type="script"><![CDATA[
      msg ("You have been defeated!")
      if (game.pov.potion_count>0) {
        msg ("<br/>You had "+game.pov.potion_count+" potion{if game.pov.potion_count>0:s}!")
      }
      finish
    ]]></onhealthzero>
    <start type="script">
      msg ("Welcome to the Arena!")
    </start>
  </game>
  <object name="Arena">
    <inherit name="editor_room" />
    <usedefaultprefix type="boolean">false</usedefaultprefix>
    <beforefirstenter type="script">
      NewEnemy
    </beforefirstenter>
  </object>
  <verb>
    <property>attack</property>
    <pattern>attack</pattern>
    <defaultexpression>"You can't attack " + object.article + "."</defaultexpression>
  </verb>
  <turnscript name="game_options_turnscript">
    <enabled />
    <script>
      if (game.pov.parent = Arena) {
        ArenaOptions
      }
      else {
        MainOptions
      }
    </script>
  </turnscript>
  <object name="green_room">
    <inherit name="editor_room" />
    <object name="Skeleton">
      <inherit name="editor_object" />
      <inherit name="enemy" />
    </object>
    <object name="Warrior">
      <inherit name="editor_object" />
      <inherit name="enemy" />
    </object>
    <object name="Assassin">
      <inherit name="editor_object" />
      <inherit name="enemy" />
    </object>
    <object name="Zombie">
      <inherit name="editor_object" />
      <inherit name="enemy" />
    </object>
  </object>
  <object name="Just Outside the Arena">
    <inherit name="editor_room" />
    <firstenter type="script">
      MainOptions
    </firstenter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
      <attr name="attack_damage" type="int">50</attr>
      <attr name="potion_count" type="int">3</attr>
      <attr name="potion_heal_amount" type="int">30</attr>
      <attr name="potion_drop_chance" type="int">50</attr>
    </object>
  </object>
  <type name="enemy">
    <attr name="max_health" type="int">75</attr>
    <attr name="attack_damage" type="int">25</attr>
    <hp type="int">0</hp>
    <usedefaultprefix type="boolean">false</usedefaultprefix>
    <prefix>the</prefix>
    <attack type="script"><![CDATA[
      game.enemy.damage_dealt = GetRandomInt(0,game.pov.attack_damage)
      game.pov.damage_taken = GetRandomInt(0,game.enemy.attack_damage)
      game.enemy.hp = game.enemy.hp - game.enemy.damage_dealt
      game.pov.health = game.pov.health - game.pov.damage_taken
      msg ("You attack {=GetDisplayName(game.enemy)}, dealing "+game.enemy.damage_dealt+" damage points!")
      if (game.enemy.hp<1) {
        msg (CapFirst(GetDisplayName(game.enemy))+" has been defeated!")
        RemoveObject (game.enemy)
        NewEnemy
        msg (CapFirst(GetDisplayName(game.enemy))+" has entered the Arena!")
      }
      else {
        msg (CapFirst(GetDisplayName(game.enemy))+" retaliates, dealing "+game.pov.damage_taken+" damage points!")
      }
    ]]></attack>
  </type>
  <function name="NewEnemy">
    game.enemy = CloneObjectAndMoveHere(PickOneChild(green_room))
    game.enemy.hp = GetRandomInt(0,100)
  </function>
  <function name="ArenaOptions">
    ShowMenu ("What would you like to do?", Split("Attack;Drink a health potion;Run!"), false) {
      switch (LCase(result)) {
        case ("attack") {
          do (game.enemy, "attack")
        }
        case ("drink a health potion") {
          DrinkPotion
        }
        case ("run!") {
          msg ("You run away from {=GetDisplayName(game.enemy)}!")
          RemoveObject (game.enemy)
          game.enemy = null
          MoveObject (game.pov, Just Outside the Arena)
        }
        default {
          Options
        }
      }
    }
  </function>
  <function name="DrinkPotion"><![CDATA[
    if (game.pov.potion_count<1) {
      msg ("You have no potions!  Defeat enemies for a chance to acquire them!")
    }
    else {
      game.pov.potion_count = game.pov.potion_count -1
      game.pov.health = game.pov.health + game.pov.potion_heal_amount
      msg ("Done.<br/><b>Health: "+game.pov.health+"<br/>Potions: "+game.pov.potion_count+"</b>")
    }
  ]]></function>
  <function name="MainOptions">
    firsttime {
      opts = Split("Enter the Arena;Quit")
    }
    otherwise {
      opts = Split("Enter the Arena;Drink a health potion;Quit")
    }
    ShowMenu ("What would you like to do?", opts, false) {
      switch (LCase(result)) {
        case ("enter the arena") {
          MoveObject (game.pov, Arena)
        }
        case ("drink a health potion") {
          DrinkPotion
        }
        case ("quit") {
          request (Quit, "")
        }
        default {
          Options
        }
      }
    }
  </function>
</asl>

If you think outside the box, you might be surprised how easy it could be...
If you put a series of "attack" commands (verbs) on the person / creature you are fighting, then it would not be combat based on the room, but instead based on the target.


Oh looks like Show Menu is exactly what I need!


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

Support

Forums