Chapter 7: Other Characters
7.5. Combat and Death

Not all characters are friendly, and there are times when we may want to include a fight sequence. There are a number of ways to approach this, depending on whether we want to offer the player a random outcome, a predetermined one, or a combat sequence that depends partly on strategy or on having the proper equipment.

Lanista 1 demonstrates randomized combat in the style of a role-playing game. The player has a partially random chance of doing any given amount of damage; both the player and his opponent have hit points, and whichever one runs out first dies. Lanista 2 continues this idea, but includes weapons that affect the amount of of damage done. Red Cross by itself implements a command that we might use to find out how strong characters are at the moment.

A word of warning about designing such sequences: a player who gets a roll he doesn't like always has the option of UNDOing a turn and re-rolling. This means that he can always win a random battle sooner or later; bad luck only means that it takes him longer (so he gets more bored and irritated as he plays through). It is possible to turn off UNDO implementation with

Use UNDO prevention.

...but there is a good chance that this will irritate players in itself. Role-playing-style combat scenarios need careful design, lest they actively make a game less fun.

In a slightly more realistic setting, combat leaves physical remains behind, unless we're wielding some kind of futuristic weapon that evaporates our opponents entirely: Puff of Orange Smoke demonstrates characters who leave corpses behind when they die, while Technological Terror more tamely explodes robots into numerous component parts.

Finally, we can imagine some scenarios in which, instead of allowing characters to strike at each other for random damage, we want to introduce an element of strategy. Don Pedro's Revenge shows the rudiments of a system in which the characters can make different kinds of attack depending on where they are in a room filled with perches, barrels, and other swashbuckler props.

* See Saving and Undoing for more discussion of handling random behavior in games


191
* Example  Red Cross
A DIAGNOSE command which allows the player to check on the health of someone.

WI
130
* Example  Lanista 1
Very simple randomized combat in which characters hit one another for a randomized amount of damage.

WI
282
** Example  Lanista 2
Randomized combat in which the damage done depends on what weapons the characters are wielding, and in which an ATTACK IT WITH action is created to replace regular attacking. Also folds a new DIAGNOSE command into the system.

WI
201
** Example  Puff of Orange Smoke
A system in which every character has a body, which is left behind when the person dies; attempts to do something to the body are redirected to the person while the person is alive.

WI
127
*** Example  Technological Terror
A ray gun which destroys objects, leaving their component parts behind.

WI

"Technological Terror"

The Decomposition Ray Gun is a thing carried by the player.

First we need to define our shooting action:

Shooting it with is an action applying to two things.

Check shooting something with something:
    if the player is not carrying the Ray Gun, say "You are pathetically unarmed!" instead;
    if the second noun is not the Ray Gun, say "[The second noun] does not fire." instead;
    if the noun is the Ray Gun, say "Nice trick if you can do it!" instead;
    if the noun is the player, say "That would be disastrous!" instead.

Next, some grammar to allow the player to use this action:

Understand "shoot [gun] at [something ungunlike]" as shooting it with (with nouns reversed).

Definition: a thing is ungunlike if it is not the gun.

Understand "shoot [something ungunlike] with [gun]" as shooting it with. Understand "shoot [something] with [something]" as shooting it with.

Understand "shoot [something] at [something]" as shooting it with (with nouns reversed). Understand "fire [gun] at [something ungunlike]" as shooting it with (with nouns reversed). Understand "fire at [something ungunlike] with [gun]" as shooting it with. Understand "fire at [something] with [something]" as shooting it with.

Strictly speaking, we only need these last grammar lines (with "understand shoot something...") in order to define an action that the player can take. Adding more grammar lines means that Inform will try to match the most specific ones first, which is useful when the player types something ambiguous and there is one choice that obviously fits this action better than the others. See the chapter on Understanding for a further discussion.

Here we get to use "now..." to give it its destructive effect:

Carry out shooting something with something:
    say "ZAP! [The noun] twinkles out of existence! [if something is part of the noun][The list of things which are part of the noun] clatter to the ground! [end if][paragraph break]";
    now every thing which is part of the noun is in the location;
    remove the noun from play.

The Deathbot Assembly Line is a room. "Here is the heart of the whole operation, where your opponents are assembled fresh from scrap metal and bits of old car." The dangerous robot is a thing in the Assembly Line. "One dangerous robot looks ready to take you on!" A robotic head, a drill arm, a needle arm, a crushing leg and a kicking leg are parts of the dangerous robot.

Instead of examining something when something is part of the noun:
    say "[The noun] consists of [a list of things which are part of the noun]."

Test me with "x robot / shoot robot / fire at kicking leg / shoot gun at drill arm / look".

113
*** Example  Don Pedro's Revenge
Combat scenario in which the player's footing and position changes from move to move, and the command prompt also changes to reflect that.

WI


PreviousContentsNext