New RPGCore again…
mrangel
16 Feb 2022, 11:10Yet again, I'm trying to mess around with the parser to make RPG-ish combat a little easier to implement.
I noticed that turnscripts and commands both have a script
attribute, and that got me thinking. How about a system where there are different "phases". Basically, the game executes each of these in turn, running all active commands (NPCs have commands too) and turnscripts at each phase. So a turnscript with a resolve
script attribute will run before the player's action. You can also have "before_(phase)" and "after_(phase)" scripts; which run before or after the specified phase, only if something happened.
turn
phase: the player enters command(s), which are run in sequence.round
phase, is run once for each of the player's commandsresolve
- match the player's input to a command, resolve objects, and NPCs decide what to dofast
- some commands might run before the rest of the turnattack
- make attack rolls etcscript
- normal commands (such as "go", "lookat") which aren't an attackdefend
- apply damage to the target and display messagesslow
- actions which happen after everything else_interrupted
- if a player/NPC's "interrupt" flag is set, this phase runs instead of attack/script/slow phases. This could be used so that someone can't pick a lock while being attacked, for example; or you could have a fast "distract" command that can prevent an enemy attackingfinal
- cleaning up temporary variables, etc
In this setup, you would use after_round
for something like a turn counter, and after_turn
for updating the sidebar and similar things. Turnscripts could be repurposed as status effects; equipped to the player or NPCs, or to a room. Weapons/equipment could also have the same scripts, which would be run each turn. This makes it easy for the user to create a status effect that messes with a particular part of the turn sequence, without needing to adapt it for individual commands.
What do you think? I hope it's a little more streamlined than my last attempt, while still providing enough options to hang things on it.
Curt A. P.
17 Feb 2022, 08:47What do you think? I hope it's a little more streamlined than my last attempt, while still providing enough options to hang things on it.
It looks good. I would love to see an example of this. A turnscript is also an object. Is it a single turnscript(turnround
) with multiple script attributes attached? turnround.resolve => {
Because in some cases I have attributes attached to a command.
I would call it action
instead of attack
and the action can be an attack, using items, or running away, etc.
mrangel
17 Feb 2022, 10:57Is it a single turnscript(turnround) with multiple script attributes attached?
That's the idea. Any given effect can use some or all of them.
I would call it action instead of attack and the action can be an attack, using items, or running away, etc.
I separated attack
for attacks from script
for non-attack actions because I figure that status effects that affect the player's actions will most likely work differently for attacks. For example, the classic Final Fantasy style "confusion" status might have:
confuse.after_attack => {
targets = FilterByNotAttribute (ScopeReachable(), "hp", null))
targets = FilterByNotAttribute (targets, "hp", 0))
attack.target = PickOneObject (targets)
}
The attack
phase could also be used for non-physical attacks; but it seems sensible to distinguish between actions that target another character and actions that don't.
The idea is that with 'combat' actions, it runs the attack
phase for the attacker, and the defend
phase for the target (so status effects equipped on either character are handled sensibly).
If you can think of a better name, I'd appreciate it. But something generic like action
could lead to confusion with actions that don't target another character.
Curt A. P.
17 Feb 2022, 15:11I separated attack for attacks from script for non-attack actions because I figure that status effects that affect the player's actions will most likely work differently for attacks.
The attack phase could also be used for non-physical attacks; but it seems sensible to distinguish between actions that target another character and actions that don't.
I like the idea that both, non-attack and attack actions can or cannot affect one or more entities. Like, using a sçroll of fire or throwing a granade. In many cases I would assume you shouldn't have the attack and non-attack. That's why I think to put 'em together and distinguish afterwards.
If you can think of a better name, I'd appreciate it. But something generic like action could lead to confusion with actions that don't target another character.
I can't think of anything more suiting for this combined case, just thinking it is not confusing at all.