I'm using Inform7 and I would like some help please

Well my first question is, how do I make something I can fight? Like, I enter a room and theres some hideous monster, how do I create and defeat him? :smiley:

I’ll be asking more questions as I move along.

I now how to make enemies now. Can some one help me with adding a description of an item. So that when I pick it up it will give me some info on it. Thanks for the help so far guys. :smiley:

You might find these previous threads useful: https://intfiction.org/t/5-programming-queries/1662/1.

Ian, it would help if you have more specific questions. We could give you the code for a monster that can be fought and defeated, but it wouldn’t be useful because (a) there are a thousand ways to implement this, and the author should think about how he wants to do it, and (b) you don’t learn anything from it.

Here are some basic things you probably want to do. Try to figure out how to do them using the Inform 7 documentation, and post here if you get stuck at something. A question like “I’ve made a monster that can be dead or alive, but I don’t understand how to make sure that the player can only move north when the monster is dead” is going to be much more useful than the overly broad question you started the topic with. :slight_smile:

(1) Make an object that is the monster. (It should probably be a person.)
(2) Make a dead/alive property such that every person will be either dead or alive.
(3) Make a rule that fires when the player types “attack monster”, and which turn the monster dead.
(4) Make a rule that ensures the player cannot do X (with X being whatever you want the monster to stop the player from doing) when the monster is alive.

Have fun!

Victor’s observation is worth thinking about. I would add this:

Quite often, when people decide to try writing something in Inform, they start right off with something that sounds as if it will be interesting and fun. And it would be! But most of the interesting, fun things you can do in writing interactive fiction are NOT the easiest things to write.

In order to reach the point where you’ll be able to do interesting, fun things, you’ll most likely have to spend weeks learning to do basic things that are somewhat less interesting and somewhat less fun. You have to crawl before you can walk.

–JA

Based on some help I got the other night, I came up with this (a dog is guarding a doorway, it has hit points, and it won’t let you go north until you kill it with one of the weapons available, which also have damage points assigned to them):

[code]Section 1 - Hit Points

A person has a number called maximum hit points. A person has a number called current hit points.

An animal has a number called maximum hit points. An animal has a number called current hit points.

The maximum hit points of the player is 35. The maximum hit points of the animal is 5.

When play begins:
repeat with victim running through people:
now the current hit points of the victim is the maximum hit points of the victim.

Definition: a person is dead if his current hit points are less than 0.

Section 1.1 - Diagnosis

Diagnosing is an action applying to one visible thing. Understand “diagnose [something]” as diagnosing.

Check diagnosing:
if the noun is not a person, say “Only people can have diagnoses.” instead.

Carry out diagnosing:
say “[if the noun is the player]You have[otherwise][The noun] has[end if] [current hit points of the noun] out of a possible [maximum hit points of the noun] hit points remaining.”

Section 1.2 - Weapons

A weapon is a kind of thing. A weapon has a number called the maximum damage. The maximum damage of a weapon is usually 4.

The player carries a weapon called a mace. The maximum damage of the mace is 3.

Understand the commands “attack” and “punch” and “destroy” and “kill” and “murder” and “hit” and “thump” and “break” and “smash” and “torture” and “wreck” as something new.

Attacking it with is an action applying to one visible thing and one carried thing. Understand “attack [someone] with [something preferably held]” as attacking it with.

Understand the commands “punch” and “destroy” and “kill” and “murder” and “hit” and “thump” and “break” and “smash” and “torture” and “wreck” as “attack”.

The attacking it with action has a number called the damage inflicted.

Setting action variables for attacking something with something:
let the maximum attack be the maximum damage of the second noun;
now the damage inflicted is a random number between 1 and the maximum attack.

Check an actor attacking something with something (this is the can’t attack with something that isn’t a weapon rule):
if the second noun is not a weapon:
if the actor is the player, say “[The second noun] does not qualify as a weapon.”;
stop the action.

Check an actor attacking something with something (this is the can’t attack a non-person rule):
if the noun is not a person:
if the actor is the player, say “[The noun] has no life to lose.”;
stop the action.

Carry out an actor attacking something with something (this is the standard attacking it with a weapon rule):
decrease the current hit points of the noun by the damage inflicted;
if the noun is dead, remove the noun from play.

Report attacking a dead person with something (this is the death-report priority rule):
say “You attack with [the second noun], killing [the noun]!” instead.

Report attacking someone with something (this is the normal attacking report rule):
say “You attack [the noun] with [the second noun], causing [damage inflicted] point[s] of damage!” instead.

Section 2 - Scene

The Courtyard is a room. The Palace is north of the Courtyard.

The guard dog is a male animal in the Courtyard. The description is “He looks mean and nasty.”

There is a club in the Courtyard. “There’s a gnarled old club here studded with thorns.” Understand “stick” as club. The club is a weapon.

Instead of going north in the Courtyard:
if the dog is in the Courtyard:
say “The dog snarls at you and won’t let you through the door!”;
otherwise:
continue the action.

[/code]

It works for me, and is one way of doing it…

Note: I should add that the dog doesn’t fight back, because I don’t need it to in the context I’m using this code for - but in the example I copied this code from, Lanista 2 from the Recipe Book Chapter 16.3, its designed to have the monster (or whatever) attack you back, using its own weapons. Its worth checking out and learning how to adapt it to your own needs.