Skip to content

A Guvner's guide to hex editing the Android version of Planescape: Torment EE

Rump_Of_VecnaRump_Of_Vecna Member Posts: 2
edited December 2018 in PST:EE Mods
This guide is for members of the Fraternity of Order without access to console commands, who wish to tinker with some of the simpler mechanics of the Planes.

Alternatively, one could simply transfer a saved game file from your Android device to a PC and use an editing tool, but where's the fun in that?

You should play through an unmodified game of Planescape: Torment at least once.

My reason for altering saved game data was to experience certain dialog options or quests normally impossible to achieve because of mutual exclusion (for example, remaining a member of a faction but setting the flag for membership in a different faction to explore options from a person in the Smoldering Corpse Bar and one of the "residents" in the Bones of the Night). If you make TNO an invulnerable demi-Power, I don't think you'll find the game to be as enjoyable. Getting killed by a pack of Cranium Rats or Lesser Vargouilles is just a part of the experience!

First of all, you will need to find where the saved game folders are located.

On my Android 7 device, the path is:
Internal Storage / Android / data / com.beamdog.pstee / files / save

You will be editing the BALDUR.gam file in each saved game folder.

Always make a backup!

I prefer to edit a quick save, or create an entirely new save called EXPERIMENT. Once you have verified that you haven't screwed anything up and the results are as intended, you can then continue on from there, or overwrite the original save, if desired.

*****************************************************************************

The basics of Android hex editing Infinity Engine games (by Trasd):

https://forums.beamdog.com/discussion/39935/game-data-editing-tutorial-hex-style-android-friendly/p1

If you are not familiar with the lore in the link above, the rest of this guide won't be of much use.

*****************************************************************************

Additional information:

This is the overall structure of a .GAM file:

  • Header
  • Party member character stats (Number of kills, exp from kills, favorite weapons/spells, etc.)
  • TNO and party member CRE file data
  • Global Variables
  • Kill variables
  • Journal entries
  • Modron Maze
  • Modron Maze Entry
  • Bestiary

The size of the file changes over the course of a playthrough, as party members and Global Variable flags, and the TNO updates his journal.

Therefore, the addresses of values that you may want to edit will change as the .GAM file expands.

The Header remains fairly stable.

  • Game Time is at address 0008. This is a 4-byte block, in "little-endian" format. 1 unit = 12 seconds, 5 units = 1 minute, 300 units = 1 hour. The time recorded here is the displayed game time (e.g. the time recorded on saved games) + 2100 units (7 hours).
  • Gold is at address 0018. A 4-byte block, little-endian. (e.g. 50,000 decimal is C350 hex, the value would be stored at this address as 50 C3.)

Character stats are a block of data that records the following information:

https://gibberlings3.github.io/iesdp/file_formats/ie_formats/gam_v1.1.htm#GAMEV1_1_Stats

As you scroll down the file, you'll see text entries for each party member's favorite weapon and spell. For example, Morte's block will start with "*ORTE" (hex 2A 4F 52 54 45), and within it will be SPIN101 (Litany of Curses) and SPIN102 (Skull Mob) as his favorite spells. Shortly after that, you'll find the resource names of his bite weapons (MBITE for his default bite, VTEETH for Teeth of the Viper, etc.). TNO's block will always be first, and will be labelled *HARBASE.

Each character's four most-used weapons and spells will be listed. Following the names, there will be four 2-byte blocks corresponding to the number of times each spell has been cast, or the time each weapon was used in combat.

CRE Data

The overall structure of an Infinity Engine CRE data block:
https://gibberlings3.github.io/iesdp/file_formats/ie_formats/cre_v1.2.htm


Each character's CRE block will be prefaced with the text "CRE V1.0" (hex 43 52 45 20 56 31 2E 30)
Shortly after that, you will see text indicating the portraits used for the character. They will be AMP(whatever) and WMP(whatever), with (whatever) being an abbreviation of the character's name. For TNO they are AMPNM1 and WMPNAM1, for Morte AMPMRT and WMPMRT, for Dakkon AMPDKK and WMPDKK, etc.

Using these as a landmark, you can now find the addresses that correspond to values that you can edit.

Please remember that the addresses in the following screenshots will most likely NOT correspond to the saved game you are editing. The location of data within a CRE block remains stable relative to the starting location (offset) of the block, but the actual addresses within the saved game file will change because new information is added as you recruit or remove party members, add or remove inventory items, add spells to your Spellbook and acquire additional slots for Memorized spells, trigger Global Variable flags, and so forth.

Here is a screenshot of The Nameless One's CRE data, immediately after waking up on the slab in the Mortuary at the start of the game. I've colored data of interest.

Editing Experience, Armor Class, Attacks per Round, Saving Throws, Resistances, Thief Skills, etc.


The data in red is TNO's experience points as a fighter. At the start of the game, this is 6000 decimal, which is 1770 hex. In "little-endian" format, the data is recorded as 70 17.

The four bytes in orange are TNO's current and maximum hit points, in this case 20 decimal (14 hex), listed in the format 14 00 14 00. If TNO had been damaged and reduced to 7 hit points, this block would be 07 00 14 00.

The four bytes in yellow are TNO's base and effective armor class, in this case 10 and 10 (0A 00 0A 00). In AD&D, a lower armor class is better: AC 10 (Armor Class 10) is unprotected, AC8 is equivalent to leather armor, AC5 is equivalent to chain mail, etc. The game calculates your current armor class from a base value, plus bonuses for Dexterity and magical enhancements from spells or items. Some effects change the base value (e.g. the Armor spell and Magus Guard item set base Armor Class to 6), some add/subtract to the base value (e.g. the various protective rings, spells like Black Barbed Shield or Greater Embalming that buff AC). When you learn "The Way of Stone" from Qui-Sai and receive a permanent improvement to armor class, this is the value that is changed, to 09.

Negative values here are rendered thusly: FF FF = (-1), FE FF = (-2), FD FF = (-3), FC FF = (-4), FB FF = (-5), etc.

The bytes in green are modifications to Armor Class vs various physical attacks. Morte has inherent -2 AC modifiers to Slashing, Piercing, and Missile attacks; this is where these are recorded . Remember, in AD&D lower Armor Class is better, so negative modifiers here are desired. There are four two-byte blocks; the order is Slashing, Piercing, Missile, and Crushing. Positive and negative modifiers have a maximum of +20/-20. Negative values here are rendered in the same format as for base/effective Armor Class.

The two values in blue are TNO's THAC0 and base number of attacks per round (here, THAC0 is 18, and base APR is 1). THAC0 appears to be calculated dynamically in-game, and modifying this value in the saved game file doesn't seem to do anything. It appears that a character cannot attack more than FIVE times per round (even with added weapon proficiency and Fighter specialization bonuses), so setting the base APR value to more than 05 is futile. Sorry, I had dreams of turning Nordom into a mobile Gatling gun, too.

The values in purple are saving throw values, in the order of
  • Paralyze/Poison/Death
  • Rod/Staff/Wand
  • Petrify/Polymorph
  • Breath Weapon
  • Spell

These are recalculated in-game and overwritten in the saved game file every time the character gains a level.

Now, on to the next screenshot:



The values in red are resistances (in percentage values) to Fire, Cold, Electricity, and Acid elemental damage, with a range of 0-255 (00 to FF). Values higher than 100 will actually heal the character; sustaining 10 points of Fire damage with a Fire resistance of 150% (96 hex) will heal 5 hit points.

The value in orange is Magic Resistance (%)

The values in yellow are Magic Fire and Magic Cold Resistance (0-255%)

The values in green are resistance to Physical Damage, in the order of Slashing, Crushing, Piercing, and Missile.

The value in blue is base Lore (which is modified by Intelligence and Wisdom)

The values in purple are base Thief Skills, in the order Open Locks, Detect/Disarm Traps, Hide in Shadows, and Pick Pockets. The base values are modified by Dexterity.

The value in pink is base Luck. This is the value improved by the Thief second specialization bonus.

The value in light blue is the number of unused Weapon Proficiency pips.

The value in gold is TNO's experience points as a Thief (two bytes, little-endian). To instantly qualify for 7th level, you would need 40,000 xp, which is 9C40 hex, so the value here would be 40 9C.

The value in silver is TNO's experience points as a Mage (same format as Thief).

This is a screenshot after some editing.
  • Experience = 60000 decimal = EA60 hex; entered as 60 EA
  • Hitpoints current/max = 30/30, 1E/1E (1E 00 1E 00)
  • Base/effective armor class = 5
  • AC adjustments to Slashing, Piercing, Missile, and Crushing = (-2), (-3), (-4), (-5) = FBFF, FCFF, FDFF, FEFF
  • Attacks per Round = 04
  • Saving Throws (P/P/D, R/S/W, P/P, Breath, Spell) = 05, 06, 07, 08, 09
  • Resistances to Fire (50% = 32), Cold (50% = 32), Electricity (25% = 19), and Acid (35% = 21)
  • Magic Resistance = 75/4B
  • Resistance to Magical Fire (10/0A) and Magical Cold (10/0A)
  • Resistances to Slashing (50% = 32), Crushing (51% = 33), Piercing (52% = 34), and Missile (53% = 35)
  • Base Lore = 50 (32 hex)
  • Base Thief Skills all set to 35 x 4 (23 hex)
  • Base Luck = 05
  • Unused Weapon Proficiency pips = 07
  • Thief EXP = 35,000 decimal = 88B8 hex; entered as B8 88
  • Mage EXP = 55,000 decimal = D6D8 hex; entered as D8 D6



Editing Ability Scores and Inventory

Scroll down until you see text strings containing the character's name, or an approximation of the name. These are a landmark for the character's ability scores and class.

The screenshots here are for TNO, at the start of the game.





The three bytes in red indicate The Nameless One's highest attained levels as a Fighter, a Mage, and a Thief.

The seven bytes in orange are TNO's ability scores.
  • Strength (here, 09)
  • Exceptional Strength (here, 00). In AD&D, Fighters with 18 Strength roll d100 for bonus Exceptional Strength, while non-Fighters are limited to 18 Strength. 18/00 Strength would be represented as 12 64. If STR is any value but 18 (12 hex), this value does nothing.
  • Intelligence (here, 18 decimal 12 hex)
  • Wisdom (here, 18 decimal 12 hex)
  • Dexterity (here, 09)
  • Constitution (here, 09)
  • Charisma (here, 12 decimal 0C hex)


The byte in yellow is TNO's current class
  • 01 = Mage
  • 02 = Fighter
  • 04 = Thief
  • 03 = Priest (playing TNO as a Priest is highly sub-optimal, in case you're wondering)

Here's a screenshot after editing TNO's ability scores to
  • Strength 18/51 (12 hex for STR, 33 for Exceptional Strength)
  • Intelligence 18 (12 hex)
  • Wisdom 19 (13 hex)
  • Dexterity 10 (0A hex)
  • Constitution 11 (0B hex)
  • Charisma 16 (10 hex)

In this screenshot, I've left TNO's class (the blue byte) as Fighter (02), but for the next section (spell editing) it will be changed to Mage (01).



The next data in the CRE data block is the characters Spellbook (list of known spells), the spell slots available to the character based upon Mage/Priest level, magical enhancements (i.e. items that grant bonus spell slots), and bonus Priest spells slots for high Wisdom scores.

At this point in the tutorial, TNO is a lowly Fighter, and has no Spellbook, nor any memorized spells. Ordinarily, you'd have to make your way out of the Mortuary, find Mebbeth, and do her annoying quest chain before becoming a novice mage. Well, not if you're a Guvner, cutter!

Changing class to Mage is easy - simply edit the value in the CRE block (to 01). In order for Dakkon to be able to change TNO's class back and forth to Mage, you will *still* have to do those Mebbeth quests to set a Global Variable, but for the sake of this tutorial, we'll gloss over that for now.

In order to acquire spells, our mutated Mage TNO must learn them from scrolls, so we might as well take this opportunity to learn how to edit inventory items.

Editing Items:


The length of the BALDUR.gam file cannot be changed.

Therefore, items cannot be created or deleted from a game file, and items already existing in a character's inventory must be hex edited to "transmute" them into a different item.

Items are each represented by a block of data, which is 20 bytes in length.
  • The first 8 bytes are the name of the item. There is a list of items attached to this post with the item resource names. (e.g. LORE = Charm of Infinite Recall, RING02 = Twisted Ring, HEARCHRM = Heart Charm). If the name is less than 8 letters/bytes long, the remaining bytes in this block must be filled with values of 00.
  • The next two bytes are time flags for temporary items that expire after a certain duration, like the weapons created by the Shillelagh or Black Blade of Disaster spells in Baldur's Gate.
  • The next two bytes (3rd and 4th after the name block) indicate the QUANTITY of a stackable item, or the number of charges/uses for a non-stackable item's primary function (such as spells cast by the item when it is equipped in a quick slot, or effects which are invoked from the inventory screen). This value does nothing if an item is non-stackable and has no use/invoke function.
  • The next two bytes (5th and 6th after the name block) indicate the number of charges for an item's secondary function (for example, a wand that can cast two different spell effects)
  • The next two bytes (7th and 8th after the name block) indicate the number of charges for an item's tertiary function. (I'm not aware of any items in PS:T that have three functions)
  • The last four bytes in the block are for item status, such as whether the item is cursed/undroppable, or the identity status. If the last byte is 00, the item is unidentified. If the last byte is 01, the item is identified.

It is potentially hazardous to obtain quest items by hex editing, as quest flags may not be properly triggered, thereby altering or preventing storyline progress. I have "created" all of the special items in Mistress Vrischika's shop (including the Modron Cube), without any adverse effects. It is also OK to obtain any of the special items that Master Lothar desires in this manner.

Items will be listed in order of the slot occupied on the character's inventory screen:
https://gibberlings3.github.io/iesdp/file_formats/ie_formats/cre_v1.2.htm#CREV1_2_ItemSlots

Here is a screenshot of TNO's inventory after acquiring a Bandage from the starting room. The only other item listed is the default EYEBALL.

The character's default weapon (the always-available default weapon listed when you click the Quick Weapon button on the user interface) is always the last item listed in inventory, but does not actually occupy an in-game inventory slot. In this screenshot, TNO's default FIST weapon is displayed. For Morte it would be MBITE, Dakkon's entry would have some variant of his Karach blade, Annah would have ANNAHDAG, etc. You can change this to a different weapon, as long as its name has the same number of letters! So you could replace TNO's default FIST with EDAG (Entropic Dagger), Morte's MBITE with IRON3 (Assassin's Knuckles), Annah's ANNAHDAG with OGRGAUNT or CELESTI2 (Celestial Fire in sword form), or M3PTEETH (Ingress' Teeth, upgraded to level 3, Piercing variant).



The dark blue byte is the number of items in the stack or charges remaining. Currently it is 01, because I only picked up one Bandage. Editing this value to 63 hex will turn this into a stack of 99 Bandages.

In this screenshot, I've moved the stack of 99 Bandages to a Quick Item slot, and filled the inventory slots with single Bandages (picked off of the stack by double clicking and selecting "1" item each time).



Now you know how to duplicate items!

Editing an inventory item's 8-letter name block will change it to something else. Remember that the item resource name takes up EIGHT bytes, and if the name is less than 8 letters you need to fill the rest of the bytes with values of 00. For example, you might want to change a BANDAGE (42 41 4E 44 41 47 45) to a Lim-Lim (LIMLIM). You can use a hex editor to overwrite BANDAGE with LIMLIM (4C 49 4D 4C 49 4D), but because the name is shorter, the "E" (45) on the end will need to be changed to the hex value 00, or the game will read the item name block as LIMLIME (4C 49 4D 4C 49 4D 45 00), which is invalid.

Editing Weapon Proficiencies

As long as we're at the Inventory section of the CRE data, we may as well look at Weapon Proficiencies.

There are up to five data blocks for Weapon Proficiencies, which are located after a character's Inventory. Each block corresponds to Edged, Fist, Club/Mace, Hammer, and Axe proficiencies.

Each Weapon Profciency block will have a LOT of padding, the important part will have the structure:
E9 00 00 00 0? 00 00 00 00 00 00 00 XX 00 00 00 WW 00 00 00 09 00 00 00 00 00 00 00 64 00

I am not sure what the fifth byte signifies. At the start of the game, TNO's proficiency blocks for Edged and Fist weapons have this byte set as 01, but subsequent proficiencies added by weapon trainers (Porphiron, Qui-Sai, Korur, Marquez) have this byte set as 00. Changing the value doesn't seem to do anything that I can tell.

XX = Weapon proficiency level (number of pips)
  1. Proficient
  2. Specialized
  3. Mastery
  4. High Mastery
  5. Grand Mastery

Higher levels of proficiency yield bonuses to hit, extra damage, and additional attacks per round:
http://baldursgate.wikia.com/wiki/Weapon_Proficiency#Effects

WW = A flag indicating the proficiency type
  • 60 = Edged
  • 59 = Fist
  • 5C = Axe
  • 61 = Hammer
  • 73 = Club


As with items and spells, you cannot delete or add weapon proficiency data blocks, you must edit an already existing one.

The screenshot demonstrates the Edged weapon proficiency (60, in green), which is currently at ONE pip (01, in red). If desired, you could change it to Club by editing the value 60 to 73.

(Inventory is above the highlighted weapon proficiency data block; at the time the screenshot was taken, TNO only had his default eyeball. FIST is listed at the end of the Inventory block, as TNO's always-available, default weapon).



Scrolling further down would display the only other weapon proficiency the TNO has, which would be Fist (59), set at one pip (01).

If desired, one could start a new game with TNO's Fist weapon Grand Mastery (05 pips), and also set base Attacks per Round to 5, making TNO a quasi-Kenshiro. Why not, he's already dead...
Post edited by Rump_Of_Vecna on

Comments

  • Rump_Of_VecnaRump_Of_Vecna Member Posts: 2
    edited December 2018
    After all that hex editing, here's the in-game status screen, before TNO has left the starting room in the Mortuary:






    Editing Known and Memorized Spells:


    When viewing the Spellbook in-game, the spells known to the character are the always-lit icons on the right side.

    Priests automatically learn all spells of the highest level (s)he can access, and do not need to obtain them from scrolls or items.

    A Mage learns new spells from scrolls or items (like the Circles of Zerthimon), or by directly receiving knowledge of a spell by special circumstances. Intelligence dictates the highest spell level a Mage can access, as well as the number of spells per level that can be learned.
    Some Mage spells do not have a scroll from which they can be learned. Most of these require a special item to learn the spell. Some of them cannot be learned by TNO, Dak'kon, or Ignus at all, and are only available to NPCs. All of these spells can be edited into the list of known spells.
    • For example, let us say you want to learn Howl of Pandemonium (SPWI603). This cannot be learned from any scroll or item.
    • "Create" a scroll of Chain Lightning Storm (SPWI604). For convenience, create a stack of 2.
    • Learn SPWI604 from the scroll. It is now listed as a known spell in the character's spellbook, under the 6th level spells page. Save the game.
    • By hex editing, overwrite the SPWI604 entry in the character's spellbook with SPWI603
    • Chain Lightning Storm is no longer in the character's spell book, as it has been replaced by Howl of Pandemonium. You will have to learn SPWI604 again from a scroll (which you already have if you originally created a stack of 2).

    In Planescape: Torment, a Mage can learn a spell and inscribe it in his spellbook even if his level is too low to actually memorize and cast the spell; Intelligence is the sole determinant.

    Also, there is a 100% chance to learn spells which a Mage character can access based upon Intelligence, so there is no need to save scum to avoid spell inscription failure. (In other Infinity Engine games there is a chance that learning a spell can fail depending upon a Mage's Intelligence score.)
    Intelligence and Mage Spells Table

    The list of Memorized Spells is on the left side of the Spellbook page. The number of spell slots available to a character depends upon the character's level, bonus slots from magic items, or Wisdom bonuses for Priests (Mages receive no bonus spell slots for high Intelligence).
    Mage spell slots by level
    Priest spell slots by level
    Wisdom spell slot bonuses for Priests

    Empty slots can be filled with spells from the pool of known spells. Newly-added spells or spells that have been memorized and already cast appear as dark icons. Memorized spells that are ready to be cast appear as lit icons. Resting converts "spent" spells to "ready" status.

    The number of spell slots per spell level can be hex edited, but spell slots are recalculated by the game to the standard allotment whenever a character gains a level.

    Editing Known and Memorized Spells:

    Spells cannot be inserted or deleted from a character's list of known and memorized spells by hex editing, just like items in the character's inventory. All spells have seven-letter names. A list of spells is attached below.

    Mage spells are SPWIxyz (WI-zard), Priest spells are SPPRxyz (PR-iest). The three-digit number indicates the spell, with the first digit being the spell level. The 1st level Mage spell Chromatic Orb is SPWI101, the 1st level Mage spell Armor is SPWI102, the 2nd level Mage spell Adder's Kiss is SPWI201, the 2nd level Priest spell Aid is SPPR201, the 3rd level Mage spell Ball Lightning is SPWI301, the 3rd level Priest spell Call Lightning is SPPR301, etc.

    Some characters have Innate abilities. The game treats these as a separate spell category, SPINxyz (IN-nate). They are not displayed in the in-game Spellbook, but are shown under the "Special Powers" button on the user interface.

    The Nameless One can have Raise Dead, Stories-Bones-Tell (Speak With Dead), and Sensory Touch. Morte can have Litany of Curses and Skull Mob. Fall-From-Grace has Sensory Touch and Kiss (Vampiric Touch). Here is a list of the Innate ability names:
    • SPIN101 - Litany of Curses (Morte)
    • SPIN102 - Skull Mob (Morte)
    • SPIN103 - Stories-Bones-Tell (TNO)
    • SPIN104 - Sensory Touch (TNO, FFG)
    • SPIN107 - Kiss (FFG)
    • SPIN108 - Raise Dead (TNO)

    These are keyed to specific characters, so hex editing won't allow, for example, The Nameless One to learn Litany of Curses, which is a darn shame.

    In this next series of screenshots, I'll demonstrate how to use item manipulation to create scrolls in order to learn new spells, and how to edit a character's spellbook and memorized spells. I've run around the Mortuary and collected an assortment of items, and entered the room with Deionarra's bier.

    In this screenshot, I've spoken to Deionarra and learned the Raise Dead ability. This grants TNO knowledge of SPIN108 in his Spellbook, and three Inherent Ability slots (SPIN108 x 3). This screenshot demonstrates editing one of the instances of SPIN108 to SPIN103 in the memorized spell data block.



    After doing this, scroll up to TNO's Spellbook and find SPIN108 (Raise Dead). Edit this to SPIN103. We're going right back to re-learn SPIN108 so it's okay that it's absent from the Spellbook for now.

    After learning Raise Dead from Deionarra, the game sets a Global Variable Flag called DEIONARRA_RAISE_DEAD to a value of 01. Using the text search function in the hex editor, you can find this Global Variable in the saved game file. Set the value to 00, and the game forgets that TNO's learned Raise Dead from Deionarra, allowing him to learn it again via dialog.



    Hello again, My Love! Now I know Stories-Bones-Tell!








    Now, TNO has five uses of Raise Dead (SPIN108) and one use of Stories-Bones-Tell (SPIN103)



    Let's edit those to five uses of Sensory Touch (SPIN104), and one use of Stories-Bones-Tell (SPIN103). The order doesn't matter.



    Scroll up to TNO's Spellbook. Now it displays two known "spells", SPIN108 and SPIN103. Edit SPIN108 to SPIN104 (Sensory Touch).

    Set the DEIONARRA_RAISE_DEAD flag back to 00, and save the game file. Load the game, and learn Raise Dead again. Here is the result:






    Theoretically, you could repeat this process and acquire the ability to cast Sensory Touch and Raise Dead hundreds of times a day. In practice, this isn't useful. A character can only benefit from a Sensory Touch once per day, and if you need to use Raise Dead more than a few times in a day it's probably best to reload from a prior save anyway. Stories-Bones-Tell can already be used without limit.

    Now we can use a similar process to learn and cast Priest spells as a Mage.

    Using the knowledge acquired previously, I've changed TNO's class to Mage. This screenshot demonstrates editing Bandages into scrolls - in this case, the scrolls for SPWI101 (Chromatic Orb), SPWI102 (Armor), SPWI103 (MinorEmbalming), SPWI104 (Fist of Iron), SPWI105 (Identify), and SPWI107 (Magic Missile). In the first screenshot, I've highlighted the byte for item amount - you will want to have two of each scroll for the purposes of this tutorial.




    Here's TNO's (blank) Spellbook before learning any Mage spells. Pathetic! Note there are two empty slots on the left, which are the two 1st level spells that a 1st level Mage can memorize. Those spell slots cannot be filled, because TNO doesn't know any spells yet.



    This is the Spellbook after using the scrolls to learn the spells listed above. Chromatic Orb and Fist of Iron have been memorized, but their entries on the left are dark, because TNO hasn't rested yet.



    After the game is saved, it's time to edit TNO's spellbook!

    The character's Spellbook (i.e. known spells) is located after the location of the character's attributes, and before inventory. After that is another cluster of spell names, which are the spells currently memorized.



    Here is screenshot of editing TNO's spellbook, to change the list of Mage spells just learned above into Priest spells - SPPR101 - SPPR106.



    Now back to the in-game Spellbook. Note that the two memorized spell slots on the left are empty. I didn't change them in the saved game file, the game doesn't list the two Mage spells in those slots because the game engine recognizes that I don't know them (i.e. they're not in my Spellbook).



    Well, now I'll just learn those Mage spells again, because I still have those scrolls in my inventory.






    Editing Spell Slots



    Spell Slots are the number of spells per spell level a character can prepare to cast.

    This information is stored between the character's Spellbook (known spells) and Memorized Spells.

    Each spell level has an entry, in this format:
    https://gibberlings3.github.io/iesdp/file_formats/ie_formats/cre_v1.2.htm#CREV1_2_MemSpellInfo

    Innate Abilities are listed after 9th level spells.



    In the above screenshot:
    • The byte in red indicates the Spell Level, minus 1. (Here, for 1st level spells, 01 - 1 = 00).
    • The byte in blue is the base number of spells of this level that the character can memorize.
    • The byte in green indicates the number of spells of this level that can be memorized, with effects (e.g. bonus spell slots from items such as Dakkon's Karach Blade, Amber Earrings, Bell's Shield, etc.)
    • The byte in purple indicates the spell type (00 = Priest, 01 = Mage, 02 = Innate)
    • The byte in gold is the number of currently memorized spell entries of this spell type and level (If you removed all of the memorized spells on the left side of the in-game Spellbook, this would be 00)

    The top highlighted block indicates the entry is 1st level spells, TNO can memorize two spells of this level (with and without effects), the entry is for Mage spells (01), and TNO currently has two 1st level spells memorized.

    The block highlighted at the bottom indicates the entry is 1st level spells, TNO can memorize nine spells of this level, the entry is for the "Innate" spell type (02), and TNO currently has nine 1st level Innate spells memorized (in this case, 5x Sensory Touch, 3x Raise Dead, 1x Stories-Bones-Tell).

    This screenshot demonstrates changing the allotment of 1st level spells slots from 02 to 08



    Loading this game and viewing the 1st level page in the Spellbook now looks like this:



    Might as well fill those empty slots! I'll choose Cure Light Wounds x 3, and Magic Missile x 3



    The list of memorized spells in the saved game file now looks like this:



    Note the second byte after the spell name in each entry, highlighted in blue (I've only highlighted the first four spells).
    • 00 = memorized spell is NOT available to cast (character must rest to ready this spell)
    • 01 = memorized spell is available to cast
    If you've run out of spells and can't rest, you can save the game and edit this byte from 00 to 01 for any spells you want to regain. Spells edited in this manner will be available to cast again immediately, as though you had rested.

    After making all eight 1st level spells ready, here's the result:



    When a character gains a level in a spellcasting class, the game recalculates spell slots according to the class and level, and overwrites any changes you might have made to the spell slot table. Edits to Innate Abilities will not change, because none of these are tied to character level.
    Mage spell slots by level
    Priest spell slots by level



    Global Variables:



    Global variables record the status of things like quest status (if it's available, and if it's been completed or not), TNO's alignment (the other party members' alignments do not change), whether or not conversations with NPCs have occurred, whether or not a creature is displayed in the Bestiary, and so forth.

    Cutters playing the Android version of PS:T cannot modify Global Variables in-game with console commands, and must settle for hex editing them in the .GAM file.

    Global Variables are often simply a no/yes flag for whether a condition is met or not (00 = No, 01 = Yes). Sometimes, a Global Variable is a counter for a value that can change during the course of a game, such as the number of times Morte has learned new taunts (which affects a target's saving throw vs. Litany of Curses).

    To find and edit a Global Variable, you will have to know the name of the desired variable, and use the Search (text) function of your hex editor app to find it in the .GAM file. Find the address of the first letter of the variable, and add 2B hex (40 decimal) for the address of the value of that particular variable.

    If you're feeling daring, you could scroll down through the contents of a .GAM file with your hex editor, and change the status of variables with interesting names.

    Here are a few interesting Global Variables:

    ADAHN
    The number of times you have taken his name in vain. There will be consequences.
    In this screenshot, I've mentioned him 03 times.
    The addresses are highlighted in black: 28C0 as the starting address, and 28E8 (28C0 + 2B) as the location of the flag.



    LAW
    This is the Lawful/Chaotic axis of TNO's Alignment. A value of -21 (EB FF) is needed for Chaotic, and +15 (0F 00) for Lawful.
    To maximally convince a certain Mercykiller that you follow JUSTICE!!!, your LAW value will have to be 23 hex/35 decimal.
    In this screenshot, the flag is set to negative 21 decimal = EB FF FF FF hex




    GOOD
    This is the Good/Evil axis of TNO's Alignment. A value of -21 (EB FF) is Evil, +15 (0F 00) is Good.
    In this screenshot, the flag is set to +15 decimal = 0F hex




    MEBBETH_ART_ANSWER
    When Mebbeth asks TNO why he wishes to learn The Art, he can give one of three answers. This value records which one he gave (01, 02, or 03). This will affect a conversation much later in the game.

    BD_DAKKON_MORALE
    The properties of Dakkon's Zerth Blade change depending upon his level and morale. Higher morale is better.

    Faction Membership:
    • JOIN_ANARCHISTS True = 01, False = 00
    • JOIN_CHAOSMEN True = 01, False = 00
    • JOIN_DUSTMEN True = 01, False = 00
    • JOIN_GODSMEN True = 06, False = 00
    • JOIN_SENSATES True = 01, False = 00

    The process of getting to where you are offered membership usually involves completing quests, with rewards and experience that you may not want to miss. Performing these quests may set other Global Variable flags, which you may have to hunt down and set manually if you decide to instantly join a Faction by hex editing.

    Joining or renouncing a Faction through in-game dialog will recalculate all of these Faction membership Global Variables, so be careful: you may lose access to Faction stores and become unable to use items keyed to Faction membership.

    CURST_COUNTER
    You'll know what this tracks when you get there. A low value makes an opponent stronger, a high value weakens him. I had attained a high value, but wanted a tougher fight so I changed the value. There are minor changes to dialog from your opponent depending upon a low/medium/high value, as well.

    RAT_EATER
    The number of Creeden's delicious ratsies you have eaten.

    GRACE_RING_EQUIPPED
    The first time you have Fall-From-Grace equip a Ring, she makes a flirtatious comment, which is different for the right hand slot than it is for the left hand slot. She only says this once.
    This Global Variable is set to 01 after she says it. Set it to 00, and she will say it again, and the value will be set to 01. Reset it to 00 as desired.

    (Not all of these Global Variables are especially useful.)
    Post edited by Rump_Of_Vecna on
  • TressetTresset Member, Moderator Posts: 8,264
    edited December 2018
    @Rump_Of_Vecna Your thread was caught in the forum's spam filter. I have restored it and verified you so that this should not happen again. It looks like you put quite a bit of work into this too, so I will give it a sticky, at least for now.
Sign In or Register to comment.