Monday 25 March 2013

Player Health

In this post I will be explaining how to use health. I will only be explaining for the player, in later posts I will show you how to give healh to an npc, character.

You must first explain the properties of health heres how you do it.

A person has a number called max health.
A person has a number called present health.
A person can be hostile or docile.
A person is usually docile.


This defines that a person has health points and current health points. Simple right.


Next we must define what your players health is, we simply type in.

The max health of a person is usually 100.
The max health of the player is usually 100.
Definition: a person is dead if his present health is less than 1.

This tells inform 7 the max health overall of most people. We can change this for crtain players if needs be. As below.

The max health of the player is 100.
The present health of the player is 100.

This just tells inform that we have a maximum health of the player 100. In other words the player starts with 100 health, and can only go to 100 health. If attacked by another npc, I will explain in later posts how to create an enemy. The player will lose health, it will be desplayed when attacked.

We now need to include this rule.

After printing the name of a dead person (this is the I see dead people rule):
 if the person is dead for at least 1 turn, say "[apostrophe]s dead body" instead.


If you happen do die during your adventure this quote will appear. If you are a beginner at inform, I dont suggest changing the rule to what quote you want to desplay as it needs correct punctuation.

This only works for the players health, dont try to code an npc, it might decode the following above. In the upcoming posts I will show you how to do so.

Thanks,
danielfrogs

1 comment:

  1. Health of the player is a difficult task to pull off. IF you ask me, How did I learn this?

    Well it took me many months to find it out, and when I did I nearly killed myself to see how simple it actually was.

    Health of the player need properties, explained above.

    It is even harder to code combat, this alone took me months never mind npc's.

    In the near future I will be showing you how to code npc's, trading, and combat. But first we need to cover the basics.

    ReplyDelete