So, I'll keep this simple. Is there a way to do ranged combat in a text adventure?
It is difficult. And I mean in a text adventure at all, but specific to Quest.
The problem (to me anyway) is that it depends on where the attacker and target are in a way that melee combat does not.
For melee, you are stood face to face with the target. Simple.
For ranged, you really need to know how far away the target is, what cover he is behind. And traditional text adventures just do not bother with that detail; you are just in the room. What if the target is in the next room, or three rooms away? Can you still shoot him?
Of course you can just keep it simple, treat it the same as melee...
One example I can think of would need a turn script on a room and an attribute on the NPC.
onenter:
NPC.proximity = 3
turn script:
NPC.proximity = NPC.proximity -1
if (NPC.proximity>3) {
NPC.proximity = 3
}
else if (NPC.proximity<1) {
NPC.proximity = 1
}
switch (NPC.proximity) {
case (3) {
NPC.attack => {
if (33) {
msg ("You shoot and it grazes the NPC!")
// do attribute stuff here
}
else {
msg ("You missed!")
}
}
NPC.alias = CapFirst(NPC.article)+" is all the way across the room."
}
case (2) {
NPC.attack => {
if (66) {
msg ("You shoot and it connects!")
// do attribute stuff here
}
else {
msg ("You missed!")
}
}
NPC.alias = CapFirst(NPC.article)+" is halfway across the room."
}
case (1) {
NPC.attack => {
msg ("You shoot at point blank range and get a direct hit!")
// do attribute stuff here
}
NPC.alias = CapFirst(NPC.article)+" is within reach."
}
}
Maybe something like that...
I can imagine ranged combat being done, but not actually keeping track of range.
For example, you could say that once you have attacked someone (or they attacked you) with a sword or fist, you're "in combat" with them, so attempting to do anything else provokes an attack of opportunity. So you could have one character standing at the back taking pot shots, while their friends keep the enemy tied up.
Or it could be just that melee and ranged combat use different stats/skills. There are ways it could make sense without needing an actual battle map. It depends on your reason for including it.
(Hey, you could even have an actual map for where each character in the room is during a battle; just not shown to the player. A couple of lines of description, representing that during the chaos of combat you don't have time to properly estimate distances)
well.. it depends on whether it's true ranged combat (handling distance-reach-range/timing/attack-firing-speed/etc) or just the illusion of ranged combat (ranged combat is the same as melee combat)
distance-reach-range coding it's too difficult... nor is weapon-attack-firing speed too difficult... hard but not impossible...
it's not that much difference than grid/coordinate coding and/or just simple arithmetic (such as simple damage/defense/accuracy-attack-rating/armor-rating-class/etc) coding... in general anyways.... a good design of it though is probably (as always) much more difficult...
P.S.
this game has one of the best and flawless combat systems/machanics that I've ever encountered... if interested... look it up (like using gamefaqs dot com guides or whatever, to read up on it's combat system/mechanics/features/etc): Grandia (1) (for PS1)
and another cool game with good and unique ranged combat is: Parasite Eve (1) (for PS1)
and of course you got the Fallout games (1+2 anyways, as I've not played 3+4, so don't know what they're like) that has an advanced ranged combat system and mechanics
and there's always the TES games (arena, daggerfall, morrowind, oblivion, skyrim, etc) that you can study and/or get ideas from, having good ranged combat system (well, I've only played morrowind, so don't know what ranged combat is like in the other TES games)
I can actually recommend a ton of games for ideas/studying... as I love RPGs... and have played lots of games... lol...
Okay, I suppose I should clarify. I've realized there is a major problem for some of my classes that I needed to address, and I thought maybe ranged combat could help with it.
Some of my Race/Class combos result in HP anywhere from 5-15, while other combos result in 150 :/
The low ones aren't MEANT to be good in combat, and instead have stats that can help them avoid combat as long as they aren't stupid, but they should still have an option that lets them do SOMETHING if they get stuck in a fighting situation. Being able to attack from a distance is perhaps the best option I've come up with so far.
Sounds like you are making a game with a party of adventurers, typical for DnD based games... Instead of a single player game, which is typical for text adventure games..
Range attacks would be hard with out the graphics layout of graphic games...
For a party adventure, you would need to know how many people can fight the target hand-2-hand without everyone hitting each other...
4: one from each side...
2 maybe, then you are blocking any advance by the target... picture the combat in a hallway or at a door...
Everyone else cannot attack because they cannot get close enough. So now, you have someone shooting arrows over the backs of their friends...
With this idea, every attack can be counted as melee because you are not counting shooting at a target 3 rooms away.
It's not being made as a party of adventurers. It's 1 character, but it has character customization, which results in very different characters depending on your choices.
OK... things to hide behind...
Something to keep between the attacker and the player, like a table, or boxes, something to keep the player out of melee range while he shoots back with a ranged weapon...
Higher dodge skill...
A skill to avoid combat until cornered...
But without some sort of room map, keeping out of melee range may be hard to determine.
It basically sounds like the best I can do is have higher "evasion", unless I want to spend a year on each room.
You could have a combat option/choice of 'hiding', (depending on how complex you want it...) which can check if there's anything to hide behind in the room, and will last until your next turn, similar to a 'defend' combat option/choice, but instead you don't take any damage (as you're hidden), unless you want some attacks to be able to damage you even as you're hidden... ya, we can make this very complex... lol...
for brief example:
<attr name="combat_actions_list" type="stringlist">
<value>attack</value>
<value>special</value>
<value>defend</value>
<value>parry</value>
<value>block</value>
<value>hide</value>
<value>evade</value>
<value>steal</value>
<value>cast</value>
<value>item</value>
<value>flee</value>
</attr>
in the 7th Saga (SNES) game, they have a cool mechanic:
the 'defend' halves damage until next turn (like 'defend' normally does in RPGs), (but differently) and if you choose to attack the next turn, you do double damage (if you hit), which makes defend actually have a tactical/strategic use in combat... lol
just something to think about, which the concept could be applied to 'hiding' too... in whatever creative idea you might have.