Jump to content

Interesting findings regarding state.ids & BG:ToTSC


plainab

Recommended Posts

while not exhaustive per se, I found some interesting things regarding checking the states in state.ids

 

Ran the following tp2 component code which resulted in a party ai script that when hotkey pressed the selected character would display a string stating what state(s) they were currently in. if left active new states would be displayed as they were applied to the character. pressing hotkey again would turn off and reset variables so that it could be used again.

 

BEGIN ~States Test~
OUTER_INNER_PATCH ~12~ BEGIN
WRITE_BYTE 1 0x0a
READ_ASCII 1 lnl(1)
WRITE_BYTE 0 0x0d
READ_ASCII 0 mnl(1)
READ_ASCII 0 nl(2)
END


<<<<<<<< test.baf
IF
Hotkey(F)
Global("teststuff","LOCALS",0)
THEN
RESPONSE #100
DisplayString(Myself,~Checking states...~)
SetGlobal("teststuff","LOCALS",1)
END
IF
Hotkey(F)
Global("teststuff","LOCALS",1)
THEN
RESPONSE #100
DisplayString(Myself,~Stopped checking states...~)
SetGlobal("teststuff","LOCALS",2)
END
>>>>>>>>
<<<<<<<< guts.baf
IF
Global("teststuff","LOCALS",1)
Global("checked%x%","LOCALS",0)
StateCheck(Myself,%x%)
THEN
RESPONSE #100
DisplayString(Myself,~Currently in State # %x% %z%~)
SetGlobal("checked%x%","LOCALS",1)
END
>>>>>>>>
<<<<<<<< reset.baf
IF
Global("teststuff","LOCALS",2)
THEN
RESPONSE #100
DisplayString(Myself,~Resetting Variables...~)
SetGlobal("teststuff","LOCALS",0)
END
>>>>>>>>

COPY ~test.baf~ ~override\test.bs~
COMPILE_BAF_TO_BCS


OUTER_SPRINT action ~SetGlobal("checked%x%","LOCALS",1)~

COPY_EXISTING ~state.ids~ ~override~
COUNT_2DA_ROWS 2 ~rows~
FOR (y = 0; y < %rows%; y += 1) BEGIN
 READ_2DA_ENTRY %y% 0 2 %x%
 READ_2DA_ENTRY %y% 1 2 %z%
 INNER_ACTION BEGIN
  EXTEND_BOTTOM ~test.bs~ ~guts.baf~
EVALUATE_BUFFER
 END
END
BUT_ONLY

COPY ~reset.baf~ ~test\reset.baf~

COPY_EXISTING ~state.ids~ ~override~
COUNT_2DA_ROWS 2 ~rows~
FOR (y = 0; y < %rows%; y += 1) BEGIN
 READ_2DA_ENTRY %y% 0 2 %x%
 READ_2DA_ENTRY %y% 1 2 %z%
 INNER_ACTION BEGIN
  COPY ~test\reset.baf~ ~test\reset.baf~
REPLACE_EVALUATE ~END~ BEGIN END ~SetGlobal("checked%x%","LOCALS",0)
 END~
 END
END
BUT_ONLY
EXTEND_BOTTOM ~test.bs~ ~test\reset.baf~


COPY ~override\test.bs~ ~scripts\test.bs~

 

I then used SwordCoast Keeper to add in various potions which would affect the character and used the hotkey to see what state if any the character was in.

 

potn30 - Potion of Infravision as expected causes STATE_INFRAVISION to trigger

potn14 - Oil of Speed as expected causes STATE_HASTED to trigger

potn10 - Potion of Invisibility as expected causes STATE_INVISIBLE to trigger

potn48 - Vial of mysterious liquid did not cause STATE_POISONED to be triggered

abpotn - modified potn48 which also applied opcode 78 Disease did not trigger either STATE_POISONED or STATE_DISEASED

 

However using SwordCoast Keeper to apply STATE_POISONED to a character results in a positive check by the script and when an antidote is used the STATE_POISONED is removed.

I'm wishing that there were a ToTSCex so that opcode 25 Poison (or it's communication to the exe file) can be corrected to properly trigger STATE_POISONED. Tho I know that I shouldn't get my hopes up.

 

The code could be ran safely on any IE game to check for functionality of any of the states listed in state.ids

 

Does anyone know a way to utilize detectable spells technology on BG & BG:ToTSC to detect the status of broken states like STATE_POISONED?

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...