PSTEE Engine Quirks
Aquadrizzt
Member Posts: 1,069
As I work on my various Planescape mods, I come across pieces of information about the functionality of the engine. Here are some interesting things I have discovered
I'm curious to see what interesting engine behavior other people have found.
- Unused Opcodes That Work: Timestop, Use Any Item
- Unused Opcodes That Don't Work: Find Traps, Improved Alacrity, Haste, Create Magical Weapon, Fist Thac0 Bonus, Fist Damage Bonus, Modify Visual Range
- The engine does support the addition of new Mage and Priest spells as long as you remember to ADD_SPELL_EX them and update spells.2da.
- The trigger condition for items in store files (offset 0x001c in the Items for Sale extended header) cannot contain an Or() statement.
- The store interface will place conditionally available items above unconditionally available items. The order of these within the .sto file is respected within these two groups.
I'm curious to see what interesting engine behavior other people have found.
Post edited by Aquadrizzt on
0
Comments
The SpellCast*() triggers don't seem to work in PST:EE, which includes
You can avoid this by having the damage effect applied via a sub resource and having the save be placed on the 177/326 effect that applies the sub resource.
All invisibility is removed upon attack.
Many of the existing projectiles are hardcoded, although there are a few ones that can be modified. (Thanks to Bubb for getting the list of hardcoded projectiles indices.)
An updated version of PROJECTL.ids is copied here.
EDIT: The CLAB files of interest are CLABFI01.2da (Fighter), CLABTH01.2da (Thief), CLABMA01.2da (Mage), and CLABPR01.2da (Priest).
Note that Planescape's default special abilities menu does NOT allow for special abilities to be added to creatures it doesn't expect (e.g. you couldn't give Morte's Litany of Curses to TNO, or Sensory Touch to anyone but TNO or Grace). This can be fixed with the following code.
Be aware that this will disable access to Thief abilities (Stealth, Thieving, Find Traps) without further hacking, such as the following, which has the dialog button on the default interface open up a Thief action bar.
Yes, what you're observing stems from the same engine behavior. Most resources are only defined for the default classes of TNO and the companions. Thus, Thieves (TNO) and Fighter/Thieves (Annah) have the correct access to thieving abilities in their Special bar, but a modded Mage/Thief or Fighter/Mage/Thief would not. You could use my ability menu workaround to fix this, but it isn't the cleanest implementation - I'm not good at UI modding.
I believe you can (with the above hack to get access to Thief abilities), make Fighter/Mage/Thief work almost exactly as expected on an engine side with some fixes to clastext.2da, thiefscl.2da, and thiefskl.2da. The Mage spellbook appears to work fine, as does thief skill allocation upon level up.
Most things you want to apply to TNO on game launch can be done by modifying CHARBASE.cre, but specifying the class occurs around line 13278 of the ui.menu (see below). The value in OnClassSelectButtonClick(#) defines the starting class based on the class id number from class.ids. 10 is the number for a F/M/T.
Note that if you want to get the right number of thief points to spend upon level up, you'll want to set your initial levels (in CHARBASE.cre) to 1/0/0. This would allow your character to instantly level up once loading in. Again, not the best implementation (there's probably a UI way to pick thief skills and then begin the game) but it will work.
Cleric/Mage and F/M/C also appear to work properly (other than a missing "spellbook flip" button like from BG2).
EDIT: One big thing that I'll make a note to investigate later is that item usability flags do not work for multiclasses. A F/M/T would be able to use an item that says "priests only", even though none of the constituent classes would be able to. NI doesn't list a usability flag that checks for F/M/T, but I'll play around.
EDIT2: Yep, the Indep unusability flag also prevents use by F/M/T.
It seems that using F/M/T normally is impossible.
I try to modify the ui.menu to add the thief abilities in the special abilities bar, but it didn't work.
The attachment is the three 2da files that I have modified.
EDIT: Okay so I have the base line functionality of TNO as a FMT working. He can scribe and cast spells, use thief skills, and equip any weapon. The game properly splits his XP amongst the three classes. The game currently does not award attribute points or proficiency points on any level up, which I am working to address.
There is still some minor jank here or there, but overall not bad for a few hours of effort. I am currently working on fixing the interactions with class specialization, the various NPC trainers, and the aforementioned ability score issue.
EDIT2: Okay well that took substantially more effort than I expected but I am pretty sure I have it in as good as a state as it's going to be. I'll package it up and type up a readme tomorrow.
opcodes:
- Portrait icon opcode does nothing and statdesc.2da file also isn't used for anything.
- for THAC0 bonus, the status screen only shows opcode 54 (base thac0) bonuses. The other main one (op278) probably still works, but you won't see the bonus amount in the status screen.
- Opcode 301 (Critical hit bonus) adds "Better critical hits" to the status screen even if it's giving a penalty.
- Opcode 12 (damage): mode 3 (percentage damage) floats the damage number above the avatar if feedback is enabled, though it doesn't get written to the combat log. In the other games, it doesn't show the damage number anywhere (at least not that I could figure out).
- Delayed timing modes 3 and 4 count by ticks, instead of seconds. Delayed timing modes 6 and 7 are instant (for other games, these ones count by ticks).
- Opcode 17 (healing) can't heal negative HP.
--
misc:
- Current HP checks don't work when added to splprot.2da (at least not with the same lines as bgee/iwdee). Those games use 0x000 under the STAT column, so possibly some other stat can work.
- ITM drop/pick up sounds: Setting either of these offsets will block the default sounds for the weapon type, so if either is set, the other must also be set or have no sound. Note that these are used for other things in the other games (Pick up sound is description image). (I misread my notes. The sounds can be set individually. If not set will play the default sound. The main thing is to be careful if making an item mod compatible with both BGEE and PSTEE. Make sure the PST versions of the items leave those offsets empty if not using custom sounds.
- All display strings float above the head if feedback is enabled, so using an opcode or script action with floating text makes 2 strings float.
- a useful scripting thing: ForceSpellRESNoFeedback. This casts a spell with no string message, even if spell cast feedback is enabled in the options. Useful with item abilities. Other than quick items, the only non-glitchy way to use item abilities is from an item dialog. This script action lets you cast an ability from dialog without it floating the "Casts" message above the head. You can still show a message by casting a shell spell, which then casts the real ability. If the spell is a special/innate, this will show the name without "Casts".
--
weapon colors:
- Weapons have only 1 opcode 7 (color) with the parameter2 location set to 21. There are also less colors to choose from. Weapons will have black heads/blades if set to an invalid color.
- Opcode 8 (glow solid) makes the whole avatar glow.
- Opcode 9 (glow pulse) works on items as equipped effects. Only the weapon glows. Location 21 works. Base-game items also use different numbers for location, but I don't see a difference from 21. The speed setting doesn't seem to do anything.
- Opcode 9, when cast from a spell, makes the whole avatar glow/pulse. Can't seem to make it only affect the weapon. The speed setting DOES work for full body pulsing.
--
projectl.ids
This part is just adding to what was already posted on projectl.ids.
The only thing needed to get custom projectiles to work is to add the 456 line at the end (obviously if not already added). The weidu ADD_PROJECTILE seems to just add the next projectile as the next number after the last one. If last line is the 456 one, you'll have no chance of using one of the hardcoded projectiles.
I used this for a mod and it works (added the last 4 lines because it looks better than just adding one line).
Alternatively, you can do something simpler like this:
Both of these are compatibility friendly with other mods that might edit this file.
I also noticed attack rate seemed off from what was listed, so did some timing tests.
This is tested at the default 40 fps. Speed factor 1 on all weapons.
- At 1 apr, you attack 8 times per 20 seconds.
- At 2 apr, you attack 16 times per 20 seconds.
- At 5 apr, you attack 24 times per 20 seconds. (anything 3+ is 24 attacks)
- At 0.5 APR, you attack 4 times per 20 seconds.
"Attacks" here is defined as making an attack roll in the combat log. So either:
- attack rate is too fast at low APR
- or higher APR is limited by the animation speed
Note that the animation for Nameless One will always swing continuously. At 0.5 APR, he attacks every 4th swing. At 1 APR, it's every second swing. At 2, it's every swing. At 3+ APR, it's also every swing, but swings faster. As stated above, it can't swing faster than the 3 APR amount.
Just for comparison, if you put an on-hit effect that sets APR to 0 for 5 seconds on the wielder, then you attack 4 times in 20 seconds if you make all hits. So the max hit rate is about the same as 0.5 APR, except the animation stops swinging in between hits. If you miss an attack, the next attack will come faster though.