Assigning 'roles' to accounts

22 views
Skip to first unread message

DrTurquoise

unread,
Feb 16, 2021, 5:29:52 PM2/16/21
to Evennia

Hi, I am trying to implement a social deduction game similar to mafia/vampire/werewolf. At the beginning, after all players tell they are ready, randomly roles should be assigned. This is will be a turn based game and at each turn some additional powers will be assigned to players. I can make characters for each different role. What I am confused about:

- How to assign (randomly assigned) characters to accounts (by engine) after all accounts are logged in.
- How to give special abilities (commands) to select players at each turn.

Thanks!

Quilnux

unread,
Feb 16, 2021, 8:22:13 PM2/16/21
to Evennia
You could probably put all the roles into an array:

example = ["role1", "role 2", "Another Role"]

then use the random utility to select one.

from evennia.utils import random

selectedrole = random.choice (example)

as for the cmds. Are they always the same for every round but different for each role or is each round going to be different regardless of the role the player plays?

If it's the first, you can probably type the cmds to a typeclass that re-presents the role and assign the typeclass dynamically to the character object once a role is assigned.

If it's the latter, someone else should probably take to answering that one. I'm still pretty new myself.

Reply all
Reply to author
Forward
0 new messages