|
Post by xkcdapostle on Sept 12, 2012 7:43:11 GMT -5
I'm sure that everyone here on the server is quite happy with how NWN does it's stuff. So far as most people on here would be concerned, much of NWN is handled by the computer and there's no need to look under the bonnet.
Others, who delve deeper, would know that much of NWN is handled by scripts; spells, some feats, abilities and even the creation of potions, items and traps.
Those who look a bit further would realise that these scripts don't fully have all the information they need to completely implement themselves. This is where the 2das come in to add all the extra details that allow you to determine your Fireball spell's maximum range and whether you can scribe the scroll.
That is as far I have looked, and I'm looking to delve deeper. Like the Dwarves of Moria, I'm greedy for the gold, though I'm after the nuggets of information that let me fully understand how the game works behind the curtain.
Now, 2das can affect many aspects of the game, parts which no one cares to look at and others we see every time we load up the game. What I am looking for is an answer to this question:
How does the system add spells to my caster's spellbook?
I'm not looking for suggestions of dials to let me know that twisting the spells.2da knob upside-down clockwise will remove the spells from the book. I'm looking to see who else is interested in this game as I am, and to explore more questions to get under the bonnet and truly understand the game's hidden aspects.
If nothing else, this may encourage a healthy inquisitiveness or perhaps may help you and others when you decide to play around with your own module, perhaps even your own haks...
|
|
|
Post by colpoj on Sept 13, 2012 4:29:11 GMT -5
The file which controls every spell in the NWN spellbook is named spells.2da
The first thing you need before you do anything is a program that allows you to read a .2da file.
The components that are required for a spell are as follows: -Spell ID (This is for the benifit if the editor. The game engine ignores the value in this field instead generating sequential row numbers as the file is read) -Name (A single StringRef indicating a string that will be desplayed in the game as the name of the spell) -IconResRef (A text value ResRef specifying the file name of the icon displayed in the game for this spell) -School (A letter value specifying the spell school for the spell. A = Abjuration etc.) -Range (A letter value specifying the range at which targets may be selected. P=Personal etc) -VS (A combination value of letters specifying whether the spell has verbal, somatic components or both. V= Verbal. S=Somatic. VS=Both) -MetaMagic (A hex number value which determines which metamagic feats may be used with this spell. 0x01=empower, 0x02 extend, 0x04 maximise, ox08 quicken, 0x10 silent, 0x20 still) -TargetType (A hex number value which determines the target which may be selected for this spell. 0x01=self, 0x02=creature, 0x04=area/ground, 0x08=items, 0x10=doors, 0x20=placeables) -ImpactScript (The name of the script file that is run when the spell is cast.) -Bard/Cleric/Druid etc. - (The spell level at which this spell is available to these classes. E.g. 'Bard 1'. The value 'Cleric ****' means it is not usually available but could be available via a domain) -Innate- The innate level of the spell -ConjTime- The amount of time in milliseconds the Conj visuals and sounds specified in the following columbs will play. -ConjAnim- Specifies the location on the casting object where the visuals will be played. Value is either head or hand -ConjHeadVisual- ResRef of the visual model to be used on the caster's head -ConjHandVisual- see above, will be used on casters hands instead. -ConjSoundMale- ResRef of the sound played for male caster -ConjSoundFemale- ResRef of the sound played for female caster. -CastAnim- A text value specifying the animation the caster names when finishing the spell. Values are self, touch, out, area and up -CastTime- Amount of times in milliseconds that the cast columb play. These fire when the Conj section completes. The spell script triggers when this starts -CastHeadVisual- See above -CastHandVisual- See above -CastGrndVisua- ResRef of grand visual mode -CastSound- ResRef of sound played -Proj- 0 or 1. Specifies whether this spell uses a prohectile model during CastTime -ProjModel- ResRef of the model -ProjType- Behaviour of this spell's projectile. This ban be one of accellerating, ballistic, bounce, burst, highballistic, homing, linked, spiral or test. Values are written in italics -ProjSpwnPoint- The value 'hand' is used for 99% of spells, though monster0/1/2/3 and monster4 can be used. It is the point on the caster that the projectile leaves from -ProjSound- ResRef of the sound file for the projectile -ProjOrientation- Orientation of this spell's projectile when it is in fight. All standard spells use 'path' (projectile faces the direction it is traveling), but target is another possible value (projectile faces the target) -ImmunityType- Specifies an immunity type for this spell. Values are Acid,Cold,Death,Divine,Desease,Electricity,Fear,Fire,Mind_Affecting,Negative,Poison,Possitive or sonic -ItemImmunity- value 0 (false) or 1 (true) -SubRadSpell1/2/3/4/5- If a spell has different possible variations these fields contain the ID values for the subspells. These subspells then appear as a submenue off the main spell in the radial menus. -Catagory- Used for the AI, this column contains the ID value of the category specified in the categories.2da -Master- if this spell is a subspell, this field contains the ID value for the spell it is a subspell for. -UserType- specifies what type of spell this is. Values are: 1=spell, 2=creature ability, 3=feat, 4=item power. -SpellDesc- A stringRef indicating a string that will be displayed in the game as the spell discription -UseConcentration- Value 0 or 1. If true (1), the spell can be interupted by getting hit in combat. -SpontaneouslyCast- Value 0 or 1. If true (1), the spell may be cast without having been previously memorised. -AltMessage- a stringref -HostileSetting- Value 0 or 1 deturmines whether a spell is considered hostile when being cast on other creatures. -FeatID- ID Value of the associated feat, if there is one -Counter1/2- Spell ID's of the specific counter spells, if any exist -HasProjectile- Value 0 or 1, states whether or not the spell has a projectile.
|
|
|
Post by xkcdapostle on Sept 13, 2012 5:21:13 GMT -5
This is a step forward toward the answer, yet what uses this to give access to spells in the spellbook for casters?
2da files do not control anything, they are databases. The information they contain is used by the systems to implement features, for spells.2da it specifies the parameters of spells and the other details for when they are needed, i.e. Spell Description when you click the ? in the Spellbook).
Another key to working out how this works, is to see where the User Interface is described, since NWN is an event driven program (most games are) any 2das or other files that describe what is called when an event happens (mouse click) would give us more information to work out for where to then look.
|
|
|
Post by colpoj on Sept 13, 2012 5:24:35 GMT -5
If you download a 2da file viewer (http://nwvault.ign.com/View.php?view=NWN2Tools.Detail&id=52 is an apsolutely brilliant find if you want to view, though I cant seem to find a decent editor anywhere. Shout if you know where to get one.) you can quite easilly view, and even edit .2da spell files.
Example - Fireball.
ID- 58 Label- Fireball Name- 808 IconResRef- is_Fireball School- V (Envocation) Range- L (Large) VS- vs Metamagic- 0x3d (Right... This bit is complicated. XKCD, I am relying on you to understand it. They are hexidecimal bitflag toggles. e.g. 0x3f is 63, meaning it is 111 111, meaning all metamagics are toggled) Target Type- 0x3E (Again, this is up to XKCD to understand and me to just hope for the best with) ImpactScript- nw_s0_fireball (Yay! An easy bit!) Bard/Cleric/Druid/Paladin/Ranger- **** Wiz_Sorc- 3 Innate- 3 ConjTime- 1500 ConjAnim- hand ConjHeadVisual- **** (None) ConjHandVisual- vco_mehanfire03 (If anyone can find a java-based animation viewer i'd appreciate it. Never got the chance to look at the nwn animations in much detail) ConjGrndVisual- **** ConjSoundVFX- sco_mehanfire03 ConjSoundMale- vs_chant_evoc_lm ConjSoundFemale- vs_chant_evoc_lf CastAnim- Area CastTime- 1000 Cast head/hand/grnd Visual- **** CastSound - **** Proj- 1 ProjModel- vpr_fireball ProjType- Homing ProjSpawnPoint- hand ProjSound- spr_fireball ProjOrientation- spr_fireball ImmunityType- Fire ItemImmunity- 1 SubRadSpell1/2/3/4/5- **** Category- 11 Master- **** UserType- 1 SpellDesc- 6155 UseConcentration- 1 SpontainiouslyCast- 0 AltMessage- **** HostileSetting- 1 FeatID- **** Counter1/2- **** HasProjectile- 1
|
|
|
Post by colpoj on Sept 13, 2012 5:25:55 GMT -5
Uggh... What uses this.
Why do you have to come up with a question I dont know the answer to? I presume nwn.exe runs the file when it starts up.
You place an entry into spells.d2a, you make an impact script, models and sound effects, then you run the game and the came collects the information from the NWN folder on your computer and places the elements together to allow you to cast a spell.
As for the placement of specific files... I can only presume they end up in the .bif files located in the data folder? They are the only large enough files that appear to be in the nwn folders (appart from hak files, of course) That'd be capeable of housing 3d models?
textures_02.bif is most likely to contain the texture files for the models used in spells. Impact scripts are easilly findable via the toolset. Sounds can be used by editing sounds.bif? Or music.bif? Animations would need to be made via a 3d editing softwear. Blender? 3d studio max? After that, you pretty much have what you need
Spell descriptions are held in the 2da as four digit numbers. Such as fireball's '6155'. These appear to be conversation keys like the ones used in toolset that allow you to make an NPC know the players name, or call them Sir/Madam. I presume these can be changed in the convo.bif file.
Obviously a lot of what I have said is pure guess work. But I dont see a reason why it would be overly complex to find and add to or change these database files.
|
|
|
Post by xkcdapostle on Sept 13, 2012 6:20:35 GMT -5
I ask this question since no one else has, at least to my knowledge. After all, I want to know how levelling up and learning from scrolls allows a character to be taught spells. After this is sorted, we can look at other features. A tool I've found allows me to get at the GUI objects for NWN, it is called NWN Explorer. (here's the link to the Explorer: nwvault.ign.com/View.php?view=Other.Detail&id=1369 ) I find it interesting that the GUI panels we have have resref's like any other ingame object. They even have tags. It makes me wonder if the scripts can refer to them and play with them. Sadly, I could not find the gui file that is the spellbook. Character Creation is there, but the spellbook eludes me. Nonetheless these gui files don't tell you what they call up...
|
|
|
Post by colpoj on Sept 13, 2012 10:40:12 GMT -5
Yeesh...
Looking through the GUI files really brings it home to me how much information there is, and how much i've not bothered to learn on the assumption mere script editing will be enough.
From looking through the GUI files, it seems to me that cg_spells.gui located in the user interface section (NWN-SotU main- data/xp1-game user interface- cg_spells.gui) controls the spellbook, but... Well... What is it? It appears to be a variable, I dont understand what it means or what it does.
If you look at the files that control character classes it shows you exactly how an NPC Will level up and how they will pick their spell slots, but it doesen't give you anything other than the name of the spell they're picking and its spell level.
All of the separate components of the spellbook are reasonably accessable. The impact scripts, the models for the projectiles, the sounds the spells make, the sound the character makes etc., but the spellbook itself and the part scrolls/leveling up play seem to elude us both.
|
|
|
Post by xkcdapostle on Sept 13, 2012 11:53:18 GMT -5
I thought that cg_ stood for Character Generation, so I looked at it briefly then moved on to look at the others, since you have one for Domains as well. PS: Judging by what spells.gui has in it, you could probably put the epic spells in the spell book... PPS: The GUI files seem to be not much different to the files you look at in LETO for altering characters and NPCs. This leads me to assume that the gui may be treated as objects, just like an item, NPC, placeable and Player Controlled character (including DMs). Problem is, that there's little to no documentation on gui files... So there's no way to be certain yet. There's something you should know: Using NWN Explorer, I extracted a haks contents to get a new gui, it helped a bit to understand how one may alter it. I grabbed the Baldur's Gate Gui Alteration from the Vault after getting the links from NWN Wiki at this link: nwn.wikia.com/wiki/GUI_alteration
|
|
|
Post by BALLS OF STEEL on Sept 14, 2012 4:31:25 GMT -5
The system writes your spells into your .bic character file, in order to access them you would need to export a copy of Vesur from the servervault to your computer.
Classes.2da may provide you with more information on spells per day and from which list a given class may draw their spells from, and in what manner they are allowed to cast them (Spontaneously or otherwise), whether they know all their spells by default (Clerics, Druids & Paladins) or whether they have to select them.
As far as I know this information is hard-coded, my experience with the PRC pack shows me that its easier to simply add new 'spells' in the form of feats much like the Pale master and Blackguard spell-like abilities (as this is what the PRC pack does) rather than create a proper spell list.
I ask myself the question 'If they could do this, why didnt they?' the answer being that you can't and I dont think its possible to script any changes to players spell lists without a modified game client that allows expanded script functions (See: NWNX)
|
|
|
Post by xkcdapostle on Sept 14, 2012 8:54:43 GMT -5
NWNX is just an API. So it does mean that someone was able to find a means of public access to the Game. Since spells are hardcoded into the character file, it does assist us in building up a picture of where the data goes and is taken from. Bringing us closer to the answer of how the process proceeds. Nonetheless, the scribe scroll feat was added in HOTU (1.59 update), was learning from scrolls already implemented before you could scribe them?
If so, then damn, if not, then we can compare the updated version to the original to see any differences in NWN explorer.
|
|
|
Post by BALLS OF STEEL on Sept 14, 2012 10:16:49 GMT -5
Wizards could indeed learn from scrolls, from the very beginning of NWN
|
|