Characters and NPCs

Characters

Characters are controlled by Character and CharacterExist classes in PyRYO, former is used in initial creation wherehas CharacterExist should be used to ‘load’ an existing character. A character consists of its:

  • Name
  • Skills
    • Fighting
    • Scholarship
    • Stealth
  • Health
  • Class
    • Weaponsmaster
    • Explorer
    • Riflesmaster

Creating a character

To create a character in PyRYO, one can use:

character= rpgModular.Character(name="CharacterName", fighting=25, scholarship=25
                                stealth=25, health=500, weapons="Explorer")

If you don’t provide the weapons variable, character will be created as a Weaponsmaster All classes start with a default weapon:

Class Default Weapon
Weaponsmaster Conscript’s Saber
Riflesmaster Conscript’s Rifle
Explorer Explorer’s Machette

Then, a file known as <charname>.inventory will be created in Character Inventories folder to keep this character’s inventory. Wherhas his health and stats will be written to a database

Loading a character

Loading an existing character is easy, it is done via character = rpgModular.CharacterExist("charname"), this lets you to interract with the character. This gives access to folowing methods:

character.showSkills()
Returns the skills of the character
character.showStats()
Returns health, level and dps of the character
character.showInventory()
Returns character inventory
character.addInventory(item)
Adds item to character inventory, item is str
character.takeDamage(damage)
Substracts damage from current health value, damage must be int
character.die()
Kills the character

NPCs

NPCs are non-player entities that is controlled by NPC class they have the following values:

  • Name
  • Stats
    • Health
    • DPSYield
  • Player based values
    • LevelOfThePlayer
    • agressionFlag
    • flag

LevelOfPlayer and DPSYield go into an algorthim to create the DPS value of the NPC, agressionFlag takes the values “Enemy”, “Neatural” and “Friendly” wherhas flag takes “Active” or “Inactive”. NPCs are defined with:

npc = NPC("npcName", health=400, DPSYield=25, LevelOfPlayer=3, agressionFlag="Friendly", flag="Active")

NPC class caries the methods:

npc.takeDamage(damage)
Substracts damage from current health value, damage must be int
npc.die()
Kills the NPC