How many different regents are there in the game?
How long can a DB identifier name be in the NWNx DB?
Im treating any item in game, as a potential reagent. The recipie list is on-going.
For time being, I am using the ID Column in the mysql database, as the recipie id, and the way of selecting it, is based on the tag of the first recipie reagent added to the cauldron.
(When recipies, spells, or rituals are added, they go into my online spell book - here
http://nwn.azmodan.net/magic/)
I guess I kinda opted for a more complex solution for my system.
I have made it possible for players to summon cauldrons to themselves - via the verbal ritual system I made.
They basically speak the phrase
'Gond, Lord of Crafting'
'Mystra, Diety of Magic'
'Bless me'
'As I work'
then some nice visuals, and a cauldron appears.
(A Red Circle 5ft in radius appears around the cauldron - if the player steps out of it, the cauldron vanishes)
Using the onDisturbed event of the cauldron, I have done the following.
Split the disturbed event into 3
1. Items Added
2. Items Removed
3. Items Stolen
When an Item is added- it checks to see if it is currently working on a recipie already.
If not - it then scans the database via sql query, for any recipie that begins with the reagent that was just entered - it queries on the tag of the item
(since tags are things that are now changeable via nwnx - its a fair enough way to do things, since I can make rituals to do special things to the tags - to transform items into other items that can be used in other recipies etc)
If it finds a recipie that begins with that reagent, it locks the cauldron into that recipie.
Subsequent reagents added, will increment the 'step' variable, which will tell the cauldron to query the 'step2' reagent for that recipie - if it matches the reagent that was entered = Good - nice visual, and progresses the step variable again.
When the Step variable is equal to the amount of populated steps/reagents required for the recipie, it considers the recipie complete.
I also have it set up in such a way that I can specify whether an item is to be created in the cauldron, as the product of the recipie, or whether a specific script should run.
Which allows me to make recipies that do fantastical effects, and not just create items.
On Removed/On Steal side of disturbed event, causes the recipie to reset, and tells the player to start from scratch.
The only downside to my system, is that only one recipie, can have a specific reagent as its step 1.
eg
If I had 2 recipies
One required Virgins Blood + Fairy Dust = Level Up or something
One requires Virgins Blood + Dragon Blood = Invulnerability for 2 minutes
I would need to be creative with how I put them in the database.
eg- Virgins Blood + Fairy Dust
Dragon Blood + Virgins Blood
or - If I wanted, I could make the product of one of the recipies, be a reagent in the second recipie.
Its a complex system sure, but I can live with it.
Recipies are added basically via phpmyadmin (mysql database)
Good combo with resman - never need to reboot.
Modifié par Baaleos, 24 juin 2012 - 10:51 .