I like this idea!
One thing that could be improved - It wasn't really apparent from Unshey's dialog why she was giving the book. Also, triggering it on the specific character talking to her means you might not have the right character talk to her. I was thinking a new state. That way, it's apparent why she's giving you the book. Also, why give 800 experience points for having put on a cursed girdle?
//Restored unshey's dialogue
ACTION_IF !(GAME_IS ~bg1 totsc~) THEN BEGIN
APPEND ~stats.ids~ ~193 SEX_CHANGED~ UNLESS ~SEX_CHANGED~
<<<<<<<< .../bg1ub/ubunsh.d
ADD_STATE_TRIGGER ~%tutu_var%unshey~ 4 ~Global("UBHelpUnshey","GLOBAL",1)~
ADD_STATE_TRIGGER ~%tutu_var%unshey~ 5 ~Global("UBHelpUnshey","GLOBAL",1)~
REPLACE_STATE_TRIGGER ~%tutu_var%unshey~ 0 ~Global("UBHelpUnshey","GLOBAL",0) ReactionLT(LastTalkedToBy,NEUTRAL_LOWER)~
REPLACE_STATE_TRIGGER ~%tutu_var%unshey~ 1 ~Global("UBHelpUnshey","GLOBAL",0) ReactionGT(LastTalkedToBy,HOSTILE_UPPER)~
REPLACE_STATE_TRIGGER ~%tutu_var%unshey~ 2 ~Global("UBHelpUnshey","GLOBAL",1) !PartyHasItem("BELT04") !PartyHasItem("BELT05")~
REPLACE_STATE_TRIGGER ~%tutu_var%unshey~ 3 ~Global("UBHelpUnshey","GLOBAL",1) !PartyHasItem("BELT04") PartyHasItem("BELT05")~
REPLACE_STATE_TRIGGER ~%tutu_var%unshey~ 7 ~Global("UBHelpUnshey","GLOBAL",3)~
REPLACE_STATE_TRIGGER ~%tutu_var%unshey~ 8 ~Global("UBHelpUnshey","GLOBAL",2)~
ADD_TRANS_ACTION ~%tutu_var%unshey~ BEGIN 1 END BEGIN 0 END ~SetGlobal("UBHelpUnshey","GLOBAL",1)~
ADD_TRANS_ACTION ~%tutu_var%unshey~ BEGIN 4 5 END BEGIN 0 END ~SetGlobal("UBHelpUnshey","GLOBAL",2)~
ADD_TRANS_ACTION ~%tutu_var%unshey~ BEGIN 6 END BEGIN 0 END ~SetGlobal("UBHelpUnshey","GLOBAL",3) GiveItemCreate("BOOK03",LastTalkedToBy,0,0,0)~
APPEND %tutu_var%unshey
IF WEIGHT #-1 ~HasItemEquiped("%tutu_var%BELT05",[PC]) Global("UBHelpUnshey","GLOBAL",2)~ THEN BEGIN UBUnsheyGenderGirdle
SAY ~Thanks for all of your help with that girdle guy. Was there something else?~
IF ~~ THEN REPLY ~That ogre had another girdle, and one of us put it on. It, well, caused a *change*. Do you know what we can do about it?~ GOTO 6
IF ~~ THEN REPLY ~Umm... Nevermind.~ EXIT
END
END
>>>>>>>>
COMPILE EVALUATE_BUFFER ~.../bg1ub/ubunsh.d~
I used HasItemEquiped() instead of the SEX_CHANGED stat so that the dialog didn't trigger on, for example, a wild surge sex change. This trigger only works on BG2 engine games, so BG1/TotSC would be left out. But, I don't know if the sex change opcode in BG1 sets the SEX_CHANGED stat anyway (BG1's STATS.IDS only goes up to 70).