Hello all,
I am working on a text-based RPG for a few friends and myself, currently meant only to be single player. It is supposed to be simple, mostly text, with hack and slash thrown in the mix.
However, I am having problems with my actual battle engine, and was looking for help. Particularly on how to have the game actually detect which weapon the player has; so it can understand how much damage to do.
I am a Dungeons & Dragons player, pen & paper style; and have borrowed the engine ideas from D&D, as far as attacking.
So for example, if the player chooses their weapon to be a 'bow' they would have the following type loaded.
They do 1d8 (1 die 8, an 8 sided die) of damage. So randomly, 1-8 damage, + any additional modifiers from bonuses in the weapon itself.
Here is the problem:
If they choose one of those weapons, how would I have the game understand which type they chose, to know how much damage is done. That way, later on in a fight against a goblin it would say something like:
In theory, that should say how much damage they did. It adds the WEAPON's damage (it has to know which weapon it is, to know how much damage that weapon gets, i.e some have 1-6) to the player level, for additional damage.
However, I do not know how to actually have the game understand which weapon it is and how much damage it does.
Anyone have a suggestion for game engines/battle engines? Should I use types & fields?
I could have it so when they "Equip Bow" or "Equip Shortsword" it *sets variable dmg to 1d8 or 1d6*. How, though, would I 'set' the variable 'dmg' to a specific number according to the weapon? Thanks!
I am working on a text-based RPG for a few friends and myself, currently meant only to be single player. It is supposed to be simple, mostly text, with hack and slash thrown in the mix.
However, I am having problems with my actual battle engine, and was looking for help. Particularly on how to have the game actually detect which weapon the player has; so it can understand how much damage to do.
I am a Dungeons & Dragons player, pen & paper style; and have borrowed the engine ideas from D&D, as far as attacking.
So for example, if the player chooses their weapon to be a 'bow' they would have the following type loaded.
Type Bow damage = SeedRnd(1,8);the amount of damage done (1-8)
They do 1d8 (1 die 8, an 8 sided die) of damage. So randomly, 1-8 damage, + any additional modifiers from bonuses in the weapon itself.
Here is the problem:
Print "What weapon would you like? <Bow, Dagger, Shortsword, Longsword, Rapier, Axe>
If they choose one of those weapons, how would I have the game understand which type they chose, to know how much damage is done. That way, later on in a fight against a goblin it would say something like:
Print "You use your " + weapon$ + " to slash at the goblin, for a total of " + dmg + level + "."
In theory, that should say how much damage they did. It adds the WEAPON's damage (it has to know which weapon it is, to know how much damage that weapon gets, i.e some have 1-6) to the player level, for additional damage.
However, I do not know how to actually have the game understand which weapon it is and how much damage it does.
Anyone have a suggestion for game engines/battle engines? Should I use types & fields?
I could have it so when they "Equip Bow" or "Equip Shortsword" it *sets variable dmg to 1d8 or 1d6*. How, though, would I 'set' the variable 'dmg' to a specific number according to the weapon? Thanks!