• Re: How to Level up and Gaine EXP in Inform 7?

    From Robin Horneman@21:1/5 to All on Mon Jan 23 07:01:54 2023
    torsdag 3 juni 2010 kl. 16:58:06 UTC+2 skrev cunningjames:
    On Jun 2, 7:40 pm, Roger <roger.helge...@gmail.com> wrote:
    On May 31, 6:59 pm, TJ Weston <olp...@gmail.com> wrote:

    How to make NPC and Player gain exp?
    Help plz, Thanks

    a) Implement a system similar to the built-in scoring system, or...
    b) Just use the built-in scoring system.and reference it as
    "EXPERIENCE" to the end user, instead of "SCORE"

    That's a simplistic answer, but honestly I would just do a searching
    in the documentation for the keywords "score' or "scoring" and read up
    on that system. I'm assuming you want to award experience points after certain actions, and awarding score points works exactly that way.

    As for "levels" you can also do something like that using a scoring
    table, which is also kind of built into Inform 7. Refer to chapter 9.3 ("Introducing tables: rankings") in the documentation.
    He says that he would like "NPC"s to be able to gain experience and
    levels, so I'm not sure the built-in system would be precisely what he
    wants. If the author wished to make his own system, he could very
    simply do something like the following:
    <code>
    "Lurking"
    Level is a kind of value. The levels are novice, apprentice,
    journeyman, and master. Each person has a level. The level of a person
    is usually novice.
    Each person has a number called experience. The experience of a person
    is usually 0.
    When play begins:
    change the left hand status line to "Experience: [experience of the
    player]".
    To provide (character - a person) with (n - a number) experience
    points:
    increment the experience of the character by n;
    possibly level up the character.
    To possibly level up (character - a person):
    if the level of the character is not master:
    let the next level be the level after the level of the character;
    let the target be the threshold corresponding to the rank of next
    level in the Table of Thresholds;
    if the target is not greater than the experience of the character:
    say "Congrats[if the player is not the character] to [character]
    [end if] for a level gained!!";
    change the level of the character to the next level.
    Table 1 - Thresholds
    rank threshold
    novice 0
    apprentice 10
    journeyman 20
    master 30
    The bedroom is a room. "Desk, computer, all that stuff."
    Lurking is an action applying to nothing. Understand "lurk" as
    lurking.
    Carry out lurking: provide the player with 5 experience points. Report lurking: say "You find yourself with a greater proficiency in their
    ways."
    Carry out a person lurking: provide the person asked with 10
    experience points. Report a person lurking: say "You feel that [the
    actor] continues to gain proficiency in their ways."
    TJ is a man in the bedroom. The description of TJ is "[experience of
    TJ]". Every turn: try TJ lurking.
    </code>
    Best,
    James
    Very old thread but I couldn't make this code work in the latest version of Inform 7.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)