Comments (2)
A small part of the stat system is already available in the game, actually, but it's not 100% polished, thus why it's hidden.
If you want to enable it, put this in the Javascript script of your story (Click on the name of your story on the bottom-left, then "Edit story Javascript"):
window.config = {
"enableStats": true,
"stats": [
{
name: "Strength"
},
{
name: "Dexterity"
},
{
name: "Intelligence"
}
]
};
You can of course change the list of available stats by adding or removing elements in the list.
You have access to those methods to interact with the stats (keep in mind that a stat cannot be lower than 0
):
character.addStat("Strength", 4); // Add 4 to the `Strength` stat
character.removeStat("Intelligence", 10); // Removes 10 to the `Intelligence` stat (not lower than 0)
character.setStat("Intelligence", 10); // Set the `Intelligence` stat to 10
character.getStat("Strength"); // Returns the amount of points in the `Strength` stat
character.hasStat("Dexterity", 8); // Returns `true` if the character has at least 8 in the `Dexterity` stat, `false` otherwise
For example:
The merchant must have sold a lot of goods today, as his purse looked full
<% if (character.hasStat("Dexterity", 6)) { %>
[[Steal the purse of the merchant|Steal]]
<% } else { %>
It'd be too hard to steal without being seen.
<% } %>
from adventures.
The stats are working, but always appear to be 0, can you fix it ? Thanks.
from adventures.
Related Issues (14)
- can't install format HOT 7
- Can't install story format
- Shop is broken HOT 3
- Can't specify two function in story config HOT 1
- UTF-8 support HOT 1
- Item Hover Text Not Working HOT 1
- Reduce the size of format.js
- List of required image assets? HOT 5
- Cant load external images ? HOT 6
- character.inventory.hasItem not defined HOT 3
- removeItem() not working? HOT 2
- very very small question HOT 2
- Races and Max Health (suggestions)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adventures.