Keep NPC unconscious

I'm not scripting correctly after my players knocks out a NPC. I already have the fight COMMANDS , but once the NPC is down how do I stop the fight commands and just have the(you already did that message) so you can't keep inputting fight commands on a downed foe?
This is for a texted based game. Thanks.


Hello.

Have you completed the tutorial?

http://docs.textadventures.co.uk/quest/tutorial/tutorial_introduction.html


It teaches us how to do exactly what you're inquiring about.


Just a guess here but something like..

Put object flag on NPC when they are knocked out. Then put fight command in IF table that checks for object flag?

Or swap NPC for different object ‘unconscious NPC’ and set different command/s for that object.


Or swap NPC for different object ‘unconscious NPC’ and set different command/s for that object.

I second this. Nice and easy.


Thanks for the help so quickly folks. I went through the tutorial, I think it's just me(user error).
I found a way around it using the FIRST script. I'm just having problems with the IF script. It may be how I am setting up the Commands or something.
I LOVE the program though. Been wanting to do interactive gaming for sometime.


I like to use the IF script and do IF object has flag (name), then do xyz. Else do abc.

Use this in conjunction with a set flag script and your good to go!

Ask if you’ve got questions!

Happy gaming!


You’re welcome, good luck with the game!


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


a "simple" example:

<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>

</object>

<object name="orc_1_npc">

  <inherit name="editor_object" />

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

  <attr name="alias" type="string">orc</attr>

  <attr name="condition" type="string">normal</attr>

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

    if (this.condition = "unconscious") {

      msg ("The " + this.alias + " is " + this.condition + ", silly")

    } else {

      // you'll want your combat scripting stuff here, instead of my simple 'msg' script below:
      msg ("You attack the " + this.alias + ", killing it")

      this.condition = "unconscious" // setting the orc as being 'unconscious'

    }

  </attr>

</object>

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

<command name="fight_command">

  <pattern>fight #object#</pattern>

  <script>

    objectlist_variable = NewObjectList ()

    if (object = null) {
      string_variable = ToString (object)
      foreach (object_variable, ScopeReachable ())
        if (object_variable.alias = string_variable) {
          list add (objectlist_variable, object_variable)
        }
      }
    } else {
      list add (objectlist_variable, object)
    }

    if (ListCount (object_variable) = 0) {
      do (this, "unresolved")
    } else {
      integer_variable = 0
      foreach (object_variable, objectlist_variable) {
        if (HasScript (object_variable, "attack")) {
          integer_variable = integer_variable + 1
          string_variable = object_variable.alias
          ask ("Attack the " + string_variable + "?") {
            if (result) {
              do (object_variable, "attack")
            }
          }
        }
      }
      on ready {
        if (integer_variable = 0) {
          msg ("Wrong input: you can't fight that")
        }
      }
    }

  </script>

  <unresolved>Wrong input: can't find inputted object within the current room</unresolved>

</command>

Thanks! That's great !


Log in to post a reply.

Support

Forums