Jump to content

New spells? Custom spells?


Celtic Minstrel

Recommended Posts

Over the last day or two or three, I've been going through the spell system, replacing all the magic numbers with nice readable spell names, and I've noticed there seems to be a lot of space for inserting new spells into the engine. (This refers mainly to spells castable by items or similar; altering the player's spell list is a different matter.) Skip to the "-----" if you're not interested in my summary about how the spell system actually works.

 

The system is currently a little convoluted, with different spells being handled by different functions, but the vast majority of spells sort of work like this (combat mode; town and outdoors is a bit simpler):

 

First, the game calls combat_cast_mage_spell or combat_cast_priest_spell. These functions are very similar in general layout (the main difference I can see is whether encumbrance is checked). This function checks the spell's "refer" setting, which can be "yes", "target", " If the spell requires targets, it calls the appropriate function (start_spell_targeting or start_fancy_spell_targeting) to set up targeting mode. (Fancy targeting is when you choose multiple targets.) I think the setting is called "refer" because one of the values causes the game to continue by casting the spell just as if you were not in combat. Otherwise, it simply continues with an implementation of the spell right there in the function.

 

When setting up targeting mode, it selects the spell effect shape and, if fancy targeting, the number of targets. There are eight effect shapes (single space, plus shape, small 2x2 square, 3x3 square, open 3x3 square, radius 2 circle, radius 3 circle, and the rotatable wall shape). The open square is not used by any spell, and defining new effect shapes is pretty trivial. The protective circle spell also use a custom effect shape. Generally a shape is simply a two-dimensional 9x9 bit field, but the protective circle leverages its extended capability, which is to specify exactly which effect goes on which space. The effects aren't limited to field effects, either; they also include dispelling and direct damage.

 

If casting outside of combat, or if the spell's "refer" setting is set to "yes", the game then calls do_priest_spell or do_mage_spell. These functions are pretty much identical in general layout, so it doesn't really matter which of them is actually called. (The only real difference I can see is the sound they play. An interesting detail to note is that do_mage_spell does not check for encumbrance, implying that you can cast mage spells while encumbered if you leave combat mode; I haven't tested this though.) For some spells (those that require targets), these functions call start_town_targeting (which I renamed from set_town_spell) to initiate targeting mode (this should only be done in town; the only check for this is the via spell's "when cast" setting). Town targeting mode is far simpler than combat targeting, only allowing a single target (but does support area patterns). It might be possible to expand that to any spell effect shape; I haven't looked closely.

 

Otherwise, once you've finished with target selection, the game calls do_combat_cast, which contains all the code for the remaining spells. Some spells (mainly summoning spells) are both in do_{mage,priest}_spell and do_combat_cast, meaning that they function differently when cast in combat than when cast outside of combat. Item spells hook into this same system, by calling one of the three "start targeting mode" spells. They also set a special flag to prevent the whole system from deducting spell points.

 

Monster spellcasting is a completely different beast and (currently) doesn't even use the same magic numbers for its spells. I haven't gone through it yet; I intend to compare the monster spells with the corresponding PC spells to see if their effects are identical. (Apart from the two that don't have an equivalent, of course.) If they are, I'll probably work on merging the two spell repertoires. The monster repertoire is actually extremely limited compared to the PC repertoire, though granted there are several that just don't make sense for monsters to cast, but I'd like to look at creating options for customizing the spells a monster knows to some extent.

 

------

 

So basically, what I was thinking was that there could be some way to use special nodes to hook into this system. I'm not entirely sure what form that would take, but here's one possibility:

 

Add a special node to apply an area spell effect, allowing you to select the shape and the type of effect. This could get pretty complicated; in particular, allowing custom shapes would be impossible with just a single node (I dunno if there's a good way to do that). Also, this would work best only for "binary" effects - so maybe not the protective circle effect. (Though it's not entirely out of the question.) It would be possible to add to the repertoire of possible effects, which is currently all fields (not barriers), direct damage (was originally limited to magic/cold/fire, but I recently added poison/undead/demon), and dispels. Perhaps one new effect could be "call scenario node X", passing the target location as the special location; for multi-target effects, the special would be called once for each target.

 

Actually, there could be two nodes, one which triggers targeting mode and one which just applies the spell pattern immediately.

 

Such a special node would only work in combat, of course. It could also be possible to have a simpler targeting node which asks for a single target and then calls a node on that space; this would work both in town and in combat. As for spells that don't require targets... I'm pretty sure those are already possible in the node system. :p

 

(Keep in mind that none of this involves altering the list of spells the player can cast - it would be for spells cast by items or special items, or perhaps spells cast by monsters as their special ability.)

 

On a side note, there are a few unused spells in the code (like Ravage Enemies, Summon Rat, or Large Sleep Cloud); I intend to eventually generalize item abilities to make it possible to create items that cast these spells, and also the monster-only spells (Wrack and Unholy Ravaging). I would be tentatively open to suggestions for adding additional specific spells that can be cast by items, with a preference towards any that can't be implemented by special nodes. (Which just suddenly made me realize... can special nodes affect monsters in an area? Other than the "explosion" node? I don't think they can.)

Link to comment
Share on other sites

  • 4 weeks later...

Dunno if by design and serving some needed or logical purpose or what, but notice monsters who die from poison, or summoned monsters don't yield xp. So I never use poison or summoned monsters unless bored or dealing with neglible xp type things anyway. But shouldn't an archer using poisoned arrows get xp for their kills just like a finger waggler who summons something to deal with his foe?

Link to comment
Share on other sites

Dunno if by design and serving some needed or logical purpose or what, but notice monsters who die from poison, or summoned monsters don't yield xp. So I never use poison or summoned monsters unless bored or dealing with neglible xp type things anyway. But shouldn't an archer using poisoned arrows get xp for their kills just like a finger waggler who summons something to deal with his foe?

 

It's not that easy to attribute poison damage to a particular character. For example, it's possible for levels of poison to be applied to a single enemy by multiple different characters. In any case, the game engine doesn't currently keep track of who applied poison or who summoned a particular creature, so it'd require fairly significant changes in the way creatures and status effects are defined in order to make that possible at all.

 

Also, for what it's worth, the documentation at least claims that enemies that die of poison damage yield XP that's distributed evenly across the whole party, although I haven't actively tested this and it's been quite a while since I played BoE.

Link to comment
Share on other sites

 

 

It's not that easy to attribute poison damage to a particular character. For example, it's possible for levels of poison to be applied to a single enemy by multiple different characters. In any case, the game engine doesn't currently keep track of who applied or who summoned a particular creature, so it'd require fairly significant changes in the way creatures and status effects are defined in order to make that possible at all.

 

Also, for what it's worth, the documentation at least claims that enemies that die of poison damage yield XP that's distributed evenly across the whole party, although I haven't actively tested this and it's been quite a while since I played BoE.

 

Play daily atm and have confirmed the zero xp watching and testing it. It's weird how into this game I am. I mean it's old. :) Reminds me though of the Ultima series the whole top-down view and games I grew up playing like the Wizardry series and Bard's Tale (still have those on cd somewhere...) Always been into the whole D&D type genre so despite 5 years of Everquest addiction, sometimes older is better. And with something like Blades where users are maing content ala NWN, and p&p D&D, the allure is even more pronounced.

Link to comment
Share on other sites

  • 2 weeks later...

So, I've added three new special node types in this vein:

  • Start targeting mode - This initiates targeting mode by specifying a range, spell pattern, and max number of targets. It works in town mode provided the number of targets is 1. It's a dead-end node, like the shopping node - it doesn't call any other node. The jumpto node is called after targeting is completed, and if there were multiple targets (like the arrow spells or Spray Fields), it's called once for each target.
  • Place spell pattern (fields) - Places fields according to a specified spell pattern. It doesn't need to be called as a result of the above node, but if it is, you can specify that it use the same pattern that was used for targeting.
  • Place spell pattern (booms) - Deals damage according to a specified spell pattern. There's an option to use simple booms instead of animated booms, in which case I think it would be kind of like area effect spells in Exile II.

 

It supports all eight basic spell patterns (single space, plus shape, small 2x2 square, 3x3 square, open 3x3 square, radius 2 circle, radius 3 circle, and the rotatable wall shape) with the small caveat that the rotateable wall is only supported in combat mode with a single target (not with multiple targets, nor in town mode). I think this list of basic patterns could perhaps be expanded, though the only idea I really have is to add a triangular pattern. It could also be nice to have a custom pattern, but I'm not sure how that would be done - patterns are too complicated to specify within the special node structure in a way that's understandable; a binary pattern could be made to fit, but it would be arcane and confusing.

 

I'm unsure of the utility of the other idea I mentioned in the previous post - a pattern that calls a special node on every one of its affected spaces. I'm not going to add it for now, but I might consider it later.

 

Does anyone have other ideas related to this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...