Skip to content

Commit 4943d1e

Browse files
committed
Update README.md and makecharacter.py
Accidentally missed some important README points in the last commit and changed some variable names for clarity in the `makecharacter.py`.
1 parent 0186e45 commit 4943d1e

File tree

2 files changed

+36
-41
lines changed

2 files changed

+36
-41
lines changed

README.md

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ python manage.py runserver
4747

4848
# Using CharacterCreator
4949

50-
Now you are ready for the extra cool part, automatic character generation. It is currently achieved with a Python script called `setup.py`. You'll need to edit a few numbers in the `setup.py` script and then you'll be ready to start.
50+
Now you are ready for the extra cool part, automatic character generation. It is currently achieved with two Python scripts called `setup.py` and `makecharacter.py`. You'll need to edit a few numbers in the `makecharacter.py` script to be ready for the character generation portion, described in detail below.
5151

5252
Make sure you already started your server. If you just did your setup you are fine, but if you have restarted your computer or shut down your server you will need to run the following command again. In a terminal navigated to the same folder from the "Getting Set Up" section above, type:
5353

5454
```
5555
python manage.py runserver
5656
```
5757

58-
## The first run of `setup.py`
58+
## First run `setup.py` once
5959

6060
The first time you will need to have your YAML files ready and edit the `setup.py` to point to the absolute paths to those files on your computer or the relative paths from the code repository, like this:
6161

@@ -64,7 +64,7 @@ skillstats_yaml = 'Examples/system_stats_skills.yaml'
6464
history_yaml = 'Examples/system_history.yaml'
6565
```
6666

67-
You can make sample characters at the same time if you want, but don't have to. The important part is to only run `setup.py` once this way to initialize your database's history rolling and roles, stats, and skills.
67+
Only run `setup.py` once to initialize your database's history rolling and roles, stats, and skills.
6868

6969
In another different terminal navigated to the same folder from the "Getting Set Up" section above, type:
7070

@@ -76,36 +76,27 @@ It will print out a few messages about setting things up in your database.
7676

7777
## From then on
7878

79-
You need to open up the `setup.py` and comment out the two lines that are only supposed to run once:
80-
81-
```python
82-
# ONE-TIME roles, stats, and skills definitions ONLY HAPPENS ONCE
83-
# This should only be run once
84-
# If it fails somehow, you should empty your database, adjust your YAML's, and try again
85-
setup_skillstats(skillstats_yaml) # comment this out when you're done with it
86-
87-
# ONE-TIME history events and rolls definitions ONLY HAPPENS ONCE
88-
# This should only be run once
89-
# If it fails somehow, you should empty your database, adjust your YAML's, and try again
90-
setup_history(history_yaml) # comment this out when you're done with it
91-
```
92-
93-
You can choose to create any number of characters with any amount of stat and skill points by editing these variables at the top of the `main` function:
79+
You can choose to create any number of characters with any amount of stat and skill points by editing these variables at the top of the `makecharacter.py` `__main__` function:
9480

9581
```python
9682
if __name__ == '__main__':
83+
# character count to make per run
9784
character_count = 5
98-
center_stat_points = 50
99-
center_role_points = 40
100-
center_other_points = 10
85+
86+
# mean (a.k.a. average) point values
87+
mean_stat_points = 50
88+
mean_role_points = 40
89+
mean_other_points = 10
10190
```
10291

103-
Now you can run `setup.py` the same way every time you want more characters:
92+
You can run `makecharacter.py` the same way every time you want more characters:
10493

10594
```
106-
python setup.py
95+
python makecharacter.py
10796
```
10897

98+
Currently, by default, you enter `stat`, `role`, and `other` points as a mean which characters actual points are sampled from a normal distribution with 20% of the mean variance.
99+
109100
Now open a web browser and go to [`http://localhost:8000/cc/`](http://localhost:8000/cc/) to see all of your characters.
110101

111102
Enjoy!

makecharacter.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,17 @@ def roll_skills(c):
9393

9494

9595
if __name__ == '__main__':
96+
# character count to make per run
9697
character_count = 5
97-
center_stat_points = 40
98-
center_role_points = 0
99-
center_other_points = 20
98+
99+
# mean (a.k.a. average) point values
100+
mean_stat_points = 40
101+
mean_role_points = 0
102+
mean_other_points = 20
103+
104+
# percentage of mean variance
105+
mean_percentage = 20/100
106+
100107
history_yaml = 'Examples/classless_cyberpunk_test/classless_cyberpunk_test_history.yaml'
101108
history_start, npc_start = get_history_starts(history_yaml)
102109

@@ -113,22 +120,22 @@ def roll_skills(c):
113120

114121
# set points based on a normal distribution with a center mean and 20% mean variance
115122
# and don't let any points go below zero
116-
if center_stat_points > 0:
117-
sp = round(random.normalvariate(center_stat_points, center_stat_points/5))
123+
if mean_stat_points > 0:
124+
sp = round(random.normalvariate(mean_stat_points, mean_stat_points*mean_percentage))
118125
if sp < 0:
119126
sp = 0
120127
else:
121128
sp = 0
122129

123-
if center_role_points > 0:
124-
rp = round(random.normalvariate(center_role_points, center_role_points/5))
130+
if mean_role_points > 0:
131+
rp = round(random.normalvariate(mean_role_points, mean_role_points*mean_percentage))
125132
if rp < 0:
126133
rp = 0
127134
else:
128135
rp = 0
129136

130-
if center_other_points > 0:
131-
op = round(random.normalvariate(center_other_points, center_other_points/5))
137+
if mean_other_points > 0:
138+
op = round(random.normalvariate(mean_other_points, mean_other_points*mean_percentage))
132139
if op < 0:
133140
op = 0
134141
else:
@@ -202,25 +209,22 @@ def roll_skills(c):
202209

203210
# set points based on a normal distribution with a center mean and 20% mean variance
204211
# and don't let any points go below zero
205-
if center_stat_points > 0:
206-
sp = round(random.normalvariate(
207-
center_stat_points, center_stat_points/5))
212+
if mean_stat_points > 0:
213+
sp = round(random.normalvariate(mean_stat_points, mean_stat_points*mean_percentage))
208214
if sp < 0:
209215
sp = 0
210216
else:
211217
sp = 0
212218

213-
if center_role_points > 0:
214-
rp = round(random.normalvariate(
215-
center_role_points, center_role_points/5))
219+
if mean_role_points > 0:
220+
rp = round(random.normalvariate(mean_role_points, mean_role_points*mean_percentage))
216221
if rp < 0:
217222
rp = 0
218223
else:
219224
rp = 0
220225

221-
if center_other_points > 0:
222-
op = round(random.normalvariate(
223-
center_other_points, center_other_points/5))
226+
if mean_other_points > 0:
227+
op = round(random.normalvariate(mean_other_points, mean_other_points*mean_percentage))
224228
if op < 0:
225229
op = 0
226230
else:

0 commit comments

Comments
 (0)