The coding for my spell casting I have written to accept two ways to cast a spell:
The first way to do this is to use the name of the spell as the action – i.e. frotz something:
frotzing is an action applying to one thing. understand "Frotz [something]" as frotzing.
the other way is to cast the spell on something:
Casting is an action applying to two things. understand "Cast [something] on [something]" as casting.
But I have a spell (levitating hand) that doesn’t need a second noun, the player would just type “cast levitating hand”. But there is no second noun needed.
The other way would be to treat levitating hand as a verb, which doesn’t really work either, no direct object is needed.
How to code something that uses the same action “cast” but with no direct object ([noun] or [second noun])?
It is possible? Is there a way that I’m not seeing?
I think the easiest way is to just define a new action with a single object that uses the same grammar. Like:
Monocasting is an action applying to one thing. Understand "cast [something]" as monocasting.
This can potentially get a little confusing though, so defining sub-kinds of spells and altering the understand grammar accordingly might be a good idea (like, defining monocast and dual-cast spells as kinds of spell and then making clear which goes where). I admit I haven’t messed around with same-grammar actions in a bit so possibly it’ll work fine out of the box!
@kamineko built a spellcasting system in his first game and later wrote a lot about doing that that may be helpful to you. I couldn’t find the exact posts to link to now though. And I did try reasonably hard! I will send a potted history of my failed attempts to kaminenko so he may be able to make it easier to get at. In the meantime, I hope by dinging him in this post he or someone else can share the link.
Hi! The posts are about some pretty messy design in Repeat the Ending, and how I hope to improve upon it. They are related to your question (I’m also interested in dropping a second noun), but the design is quite different from yours. Still, it might be interesting to see how somebody else approached dealing with nouns and magic.
Magic systems are fun. I look forward to checking out your game!