Jump to content


Photo

A spell with a custom name


  • Please log in to reply
No replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 09 December 2017 - 10:34 AM

Here is a freebie idea. Or frisbee? Not something I'm working on, so I can just send it out. While looking at the "Spell name" field of SPL files, it occurred to me that the name did not have to be a definite piece of text. It was just another string, so it could contain tokens. A modder who wants to let players do spell research and creation can let them name spells after themselves. Like "Agannazar's Scorcher" or "Mordenkainen's Lucubration." All it takes is an entry in the TRA file with the token <CHARNAME>, and more tokens if you want to let them customize the spell's name beyond, eh, "Spell."

 

The TRA would need an entry like this:

 

@X=~<CHARNAME>'s <ADJECTIVE> <NOUN>~

 

And you would also need entries for particular adjectives and nouns that you intend to use:

 

@Y=~Utilitarian~

 

Then you would get Weidu to resolve this string and assign it as the name of all of the SPL files that you are willing to let emerge at the end of the research process. Scrolls, too. For adjectives (and here I am not original but recalling how Fallout 2 let the player choose his boxing ring name) you could let players pick one from a series of choices in a dialogue, like "Magnificent" or "Useful" or "Pink." And the final noun, well, "Lucubration" shows just how far the creators of AD&D have ventured. When writing the selection dialogue, at the end of every choice you would put DO ~SetToken("ADJECTIVE",@Y)~, and at last compile.

 

It's a bit trickier to get the token words to stay. The referent of CHARNAME isn't going anywhere, but the other tokens will be voided the next time you load a game, which means they need to be inserted anew every time. You won't be able to avoid writing into BALDUR.BCS with this, but instead of keeping a whole lot of text there you can use my scripts-for-the-engine-creature idea and write the stuff you need once in a script for the engine's slots. In short, you would add this line to the top of BALDUR:

 

IF

 

Global("MY_BALDUR_SCRIPTS","GLOBAL",0)

 

THEN

 

RESPONSE #1

 

ChangeAIScript("BDEFAULT",DEFAULT)

SG("MY_BALDUR_SCRIPTS",1)

 

END

 

After this you can write to your heart's content in your BDEFAULT.BAF; you should probably do it in a BAF and then EXTEND_TOP of BDEFAULT.BCS during the installation instead of compiling the BAF. Leave the BAF uncompiled. Don't do COPY_EXISTING first either. Just extend the target script by name with your BAF. If there was no BCS with that name, the code you add will become that script. So:

 

EXTEND_TOP ~BDEFAULT.BCS~ ~Your Mod/BAF/BDEFAULT.BAF~

 

If there was no BDEFAULT.BCS, your BDEFAULT will be it. If there was, you'll add to the top. Just don't forget to finish your additions with Continue(). All this is so you won't overwrite any other modder's BDEFAULT. I am hoping modders will catch on to what great opportunities being able to assign scripts to the engine opens up and agree on scripts with standard names for the slots, like BDEFAULT here, so they can extend each other's.

 

But what to actually write in that BDEFAULT, which will now always be active in play, to keep tokens filled? Here you have to use globals. Before you create the dialogue for spell naming, make a little table for yourself with two columns, one for ADJECTIVE and the other for NOUN, and assign a number to each word that you'll let players pick. Then, in the dialogue branches, after the setting of the tokens, set the globals to that value. You now have two permanent anchors in the ice for the name of the new spell. Globals don't change, so at every reload and game start the engine is going to consult the information about token content you give it, what refers to what, and fill in the blanks. You would fill your BDEFAULT.BAF with blocks like this:

 

IF

 

OnCreation()

Global("ADJECTIVE","GLOBAL",19)

 

THEN

 

RESPONSE #1

 

SetToken("ADJECTIVE",@Y)

Continue()

 

END

 

Do this for the whole range of adjectives and nouns, and all parts of your name will be permanent (or, if you prefer, perennial). Naturally, you can use the same method to name anything in the game - pets, familiars, items, towns...