Skip to content

[MOD] (WIP) Remove Specialist Restrictions (does not work)

NicolBluetoothNicolBluetooth Member Posts: 48
edited July 2023 in PST:EE Mods
Alright, so six years ago, I started working on a mod to try to make the class specialization requirements of certain shop items and trainers also available to players with high enough levels in those classes, so you didn't have to choose between them.
I looked at aquadrizzt's mods and asked around on the forums to try to figure out how to do that. I gave up, then tried again a year later, then gave up again. I haven't touched this mod in almost five years now. As it is now, it does nothing; the best I could do was get it to compile without fatal errors.
I still want it to work, and I'm still willing to make it work, I just don't know how. I've purchased three separate versions of Planescape: Torment on GOG and Steam, but I haven't finished playing any of them yet because I had hoped to finish this first.
Now, I think I just need to figure out how to do two things I currently don't know how to do in order to make this work:
1. How to give the dialog response triggers syntactically correct boolean OR arguments.
2. How to make the sales triggers replacements work, because as they're scripted now, they currently do not.

If anyone feels willing and able to help in any way, or just wants to peruse my currently non-functioning code for one's own purposes, I've uploaded the tp2 script to this web address:
https://github.com/Mirrorman95/RemoveSpecialistRestrictions/blob/master/RemoveSpecialistRestrictions/Setup-RemoveSpecialistRestrictions.tp2

Comments

  • argent77argent77 Member Posts: 3,476
    I can certainly give you some pointer to fix the scripting issues.

    1) Updating STO item sale triggers
    PHP_EACH tattoos AS int => tt_off BEGIN 
      PATCH_IF (~%itmres%~ STRING_EQUAL_CASE ~QDTTPR1~) BEGIN
        WRITE_LONG (tt_off + 0x1c) RESOLVE_STR_REF(~Global("QD_PRIEST_SPEC_7","GLOBAL",1) || ClassLevelGT(Protagonist,CLERIC,6)~)
      END
    
    "itmres" has never been read from the resource, so it will always fail the IF-conditions.

    The "or" operator in the script doesn't work like this. Instead there is a special script trigger OR(x) which instructs the interpreter to take the next x triggers into account for the OR operation. One notable exception is the NextTriggerObject() trigger which is ignored by the OR() counter.

    Optional: To make the line a bit simpler you could also replace WRITE_LONG/RESOLVE_STR_REF with SAY which does the same as WRITE_LONG but automatically converts the given string into a strref.

    2) Use dialog-specific WeiDU operations to manipulate dialog content
    COPY_EXISTING ~DRAVEL.DLG~ ~override~
    	DECOMPILE_AND_PATCH BEGIN
    		REPLACE_TEXTUALLY ~Global("Specialist","GLOBAL",3)
    ~ ~(Global("Specialist","GLOBAL",3) || ClassLevelGT(Protagonist,MAGE,6))
    ~
    
    DECOMPILE_AND_PATCH is a bit overkill if you just want to modify a couple of response triggers. Instead place dialog-specific commands into a separate .d file and use COMPILE in the tp2 script to apply the dialog changes.

    The command to indiscriminately replace all matching response triggers is REPLACE_TRIGGER_TEXT ~dialog-name~ ~regexp-to-find~ ~replacement-string~

    Example:
    REPLACE_TRIGGER_TEXT ~DRAVEL~ ~[^!]\(Global("Specialist","GLOBAL",3)\)~ ~OR(2) \1 ClassLevelGT(Protagonist,MAGE,6)~
    
    This command uses a regular expression for the search-string. The first expression in square brackets is used to skip matching instances of Global() with a negation operator (!) in front of it.
    The backslash-escaped parentheses in the search-string are used to group strings, so that they can be referenced in the replacement-string with "\1", "\2", ... placeholders. This will replace the placeholders with the grouped text in the search-string.
  • NicolBluetoothNicolBluetooth Member Posts: 48
    argent77 wrote: »
    I can certainly give you some pointer to fix the scripting issues.

    1) Updating STO item sale triggers
    PHP_EACH tattoos AS int => tt_off BEGIN 
      PATCH_IF (~%itmres%~ STRING_EQUAL_CASE ~QDTTPR1~) BEGIN
        WRITE_LONG (tt_off + 0x1c) RESOLVE_STR_REF(~Global("QD_PRIEST_SPEC_7","GLOBAL",1) || ClassLevelGT(Protagonist,CLERIC,6)~)
      END
    
    "itmres" has never been read from the resource, so it will always fail the IF-conditions.

    The "or" operator in the script doesn't work like this. Instead there is a special script trigger OR(x) which instructs the interpreter to take the next x triggers into account for the OR operation. One notable exception is the NextTriggerObject() trigger which is ignored by the OR() counter.

    Optional: To make the line a bit simpler you could also replace WRITE_LONG/RESOLVE_STR_REF with SAY which does the same as WRITE_LONG but automatically converts the given string into a strref.

    2) Use dialog-specific WeiDU operations to manipulate dialog content
    COPY_EXISTING ~DRAVEL.DLG~ ~override~
    	DECOMPILE_AND_PATCH BEGIN
    		REPLACE_TEXTUALLY ~Global("Specialist","GLOBAL",3)
    ~ ~(Global("Specialist","GLOBAL",3) || ClassLevelGT(Protagonist,MAGE,6))
    ~
    
    DECOMPILE_AND_PATCH is a bit overkill if you just want to modify a couple of response triggers. Instead place dialog-specific commands into a separate .d file and use COMPILE in the tp2 script to apply the dialog changes.

    The command to indiscriminately replace all matching response triggers is REPLACE_TRIGGER_TEXT ~dialog-name~ ~regexp-to-find~ ~replacement-string~

    Example:
    REPLACE_TRIGGER_TEXT ~DRAVEL~ ~[^!]\(Global("Specialist","GLOBAL",3)\)~ ~OR(2) \1 ClassLevelGT(Protagonist,MAGE,6)~
    
    This command uses a regular expression for the search-string. The first expression in square brackets is used to skip matching instances of Global() with a negation operator (!) in front of it.
    The backslash-escaped parentheses in the search-string are used to group strings, so that they can be referenced in the replacement-string with "\1", "\2", ... placeholders. This will replace the placeholders with the grouped text in the search-string.
    Thank you for all of this advice. I really appreciate your help. As soon as I have time to, I will try to use your insights to finish the mod. I would have responded sooner, but as far as I know, the forum doesn't have a "Like" button for that sort of thing.
Sign In or Register to comment.