Discussion:
How to Level up and Gaine EXP in Inform 7?
(too old to reply)
TJ Weston
2010-05-31 22:59:23 UTC
Permalink
How to make NPC and Player gain exp?
Help plz, Thanks
cunningjames
2010-05-31 23:33:38 UTC
Permalink
Post by TJ Weston
How to make NPC and Player gain exp?
Help plz, Thanks
Well, you could do something as simple as:

<code>Each person has a number called experience. The experience of
the a person is usually 0.</code>

and when the player has done something experience-worthy:

<code>increment the experience of the player by 1.</code>

Best,
James
Roger
2010-06-02 23:40:15 UTC
Permalink
Post by TJ Weston
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.
cunningjames
2010-06-03 14:58:06 UTC
Permalink
Post by Roger
Post by TJ Weston
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
Robin Horneman
2023-01-23 15:01:54 UTC
Permalink
Post by cunningjames
Post by Roger
Post by TJ Weston
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
<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.
change the left hand status line to "Experience: [experience of the
player]".
To provide (character - a person) with (n - a number) experience
increment the experience of the character by n;
possibly level up the character.
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;
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.
Loading...