I wouldn't swap out the script in the override
directory slot. extending to the bottom of to handle the hotkey block is fine, but changing the override script itself is asking for trouble with other mods. No the thief actions can be lower on the script priority, if you aren't providing a party ai script leave class open in case the player wants to use one. I'd say leave race open too if they wanna use my party ai script,
but I don't have a
BG2 version yet which swaps scripts around. That leaves General... but it's up to you, race or general to house the area based thief scripts to be swapped. Also override scripts for joinable NPCs are named differently...
IF
True()
THEN
ActionOverride(Myself,ChangeAIScript(%original_override%,OVERRIDE))
END
don't do that... True() always returns true and without anything to check against this block will be a script stopper and not allow any blocks following to be parsed ever...
I would combine the traps & locks together... more
weidu hieroglyphics
OUTER_SPRINT ie_file ~ar~
ACTION_IF (FILE_EXISTS_IN_GAME ~FW2600.are~) THEN BEGIN
OUTER_SPRINT ie_file ~fw~
END
<<<<<<<< inlined/thief_hk_trap.baf
IF
HotKey(%F2%)
Global("%cont_var%","LOCALS",0)
ActionListEmpty()
!Exists([ENEMY])
AreaCheck("%area%")
!Disarmed("%trigger%")
Range("%trigger%",10)
CheckStatGT(Myself,1,TRAPS)
THEN
RESPONSE #100
SetGlobal("%cont_var%","LOCALS",1)
RemoveTraps("%trigger%")
Continue()
END
>>>>>>>>
<<<<<<<< inlined/thief_hk_lock&trap.baf
IF
HotKey(%F2%)
Global("%cont_var%","LOCALS",0)
ActionListEmpty()
!Exists([ENEMY])
!See([NOTGOOD])
AreaCheck("%area%")
!Disarmed("%trigger%")
Range("%trigger%",10)
CheckStatGT(Myself,1,TRAPS)
CheckStatGT(Myself,1,LOCKPICKING)
THEN
RESPONSE #100
SetGlobal("%cont_var%","LOCALS",1)
RemoveTraps("%trigger%")
PickLock("%trigger%")
Continue()
END
>>>>>>>>
<<<<<<<< inlined/thief_hk_lock.baf
IF
HotKey(%F2%)
Global("%cont_var%","LOCALS",0)
ActionListEmpty()
!Exists([ENEMY])
AreaCheck("%area%")
Range("%trigger%",10)
CheckStatGT(Myself,1,LOCKPICKING)
THEN
RESPONSE #100
SetGlobal("%cont_var%","LOCALS",1)
PickLock("%trigger%")
Continue()
END
>>>>>>>>
<<<<<<<< inlined/thief_hk_lock_cant_disarm.baf
IF
HotKey(%F2%)
Global("%cont_var%","LOCALS",0)
ActionListEmpty()
!Exists([ENEMY])
!See([NOTGOOD])
AreaCheck("%area%")
Range("%trigger%",10)
CheckStatGT(Myself,1,LOCKPICKING)
THEN
RESPONSE #100
SetGlobal("%cont_var%","LOCALS",1)
PickLock("%trigger%")
Continue()
END
>>>>>>>>
PRINT @16
ACTION_READLN ~hk~
OUTER_WHILE ((%hk% != 1) AND (%hk% != 2)) BEGIN
PRINT @5
PRINT @16
ACTION_READLN ~hk~
END
OUTER_SPRINT F2 ~D~
ACTION_IF (%hk% = 1) THEN BEGIN
PRINT @17
ACTION_READLN ~F2~
OUTER_WHILE !(~%F2%~ STRING_COMPARE_REGEXP ~[A-Z]~ =0) BEGIN
PRINT @5
PRINT @17
ACTION_READLN ~F2~
END
END
PRINT @27
OUTER_PATCH ~this_is_not_a_variable~ BEGIN
FOR ("i1" = 0x0; "i1" < 0x100; "i1" += 0x1) BEGIN
WRITE_BYTE 0x0 "i1"
READ_ASCII 0x0 ~c~ (0x1)
SPRINT EVALUATE_BUFFER ~0t%i1%~ ~%c%~
END
END
COPY_EXISTING_REGEXP GLOB ~^%ie_file%.*\.are$~ ~override~
PATCH_IF (SOURCE_SIZE > 0x11b) THEN BEGIN
SPRINT area ~%SOURCE_RES%~
READ_SHORT 0x5a "tc"
READ_LONG 0x5c "to"
READ_LONG 0x70 "co"
READ_SHORT 0x74 "cc"
READ_LONG 0xa4 "dc"
READ_LONG 0xa8 "do"
FOR ("i1" = 0x00; "i1" < ("tc" * 0xc4); "i1" += 0xc4) BEGIN
SPRINT ~trigger~ ~~
SPRINT ~co_name~ ~~
READ_SHORT ("to" + "i1" + 0x68) "trap_detect"
READ_SHORT ("to" + "i1" + 0x6a) "trap_disarm"
READ_SHORT ("to" + "i1" + 0x6c) "trapped"
READ_SHORT ("to" + "i1" + 0x20) trig_type
READ_LONG ("to" + "i1" + 0x60) flag
PATCH_IF ( (%trig_type% = 0)
AND ("trap_detect" < 0x64)
AND ("trap_disarm" < 0x64)
AND ((%flag% BAND 0b1000) = 0b1000)
AND (("trapped" & 0x01) = 0x01) ) THEN BEGIN
FOR ("i2" = 0x00; "i2" < 0x20; "i2" += 0x01) BEGIN
READ_BYTE ("to" + "i1" + "i2") "char"
READ_ASCII ("to" + "i1" + "i2") "char2" (1)
PATCH_IF (~%char%~ = 32) AND (~%char2%~ STRING_COMPARE_REGEXP ~ ~ =0) BEGIN
SPRINT ~char2~ ~_~
END
PATCH_IF (%char% != 0) BEGIN
SPRINT ~co_name~ ~%co_name%%char2%~
END
PATCH_IF (("char" = 0x00) AND ("i2" = 0x00)) THEN BEGIN
SET "i2" = 0x20
END
ELSE
PATCH_IF (("char" = 0x00) AND ("i2" > 0x00)) THEN BEGIN
READ_ASCII ("to" + "i1" + 0x00) ~trigger~ ("i2")
SPRINT ~cont_var~ ~ab_%area%_%co_name%~
INNER_ACTION BEGIN
EXTEND_BOTTOM ~abparty.bs~ ~inlined/thief_hk_trap.baf~
EVALUATE_BUFFER
END
SET "i2" = 0x20
END
END
END
END
FOR ("i1" = 0x00; "i1" < ("cc" * 0xc0); "i1" += 0xc0) BEGIN
SPRINT ~trigger~ ~~
SPRINT ~co_name~ ~~
READ_SHORT ("co" + "i1" + 0x2c) "trap_detect"
READ_SHORT ("co" + "i1" + 0x2e) "trap_disarm"
READ_SHORT ("co" + "i1" + 0x30) "trapped"
READ_SHORT ("co" + "i1" + 0x26) "lock_dif"
READ_LONG ("co" + "i1" + 0x28) "flag"
PATCH_IF ( ("trap_detect" < 0x64)
AND ("trap_disarm" < 0x64)
AND (("trapped" & 0x01) = 0x01)
AND !((%flag% BAND 0b001) = 0b001) ) THEN BEGIN //trapped only
FOR ("i2" = 0x00; "i2" < 0x20; "i2" += 0x01) BEGIN
READ_BYTE ("co" + "i1" + "i2") "char"
READ_ASCII ("co" + "i1" + "i2") "char2" (1)
PATCH_IF (~%char%~ = 32) AND (~%char2%~ STRING_COMPARE_REGEXP ~ ~ =0) BEGIN
SPRINT ~char2~ ~_~
END
PATCH_IF (%char% != 0) BEGIN
SPRINT ~co_name~ ~%co_name%%char2%~
END
PATCH_IF (("char" = 0x00) AND ("i2" = 0x00)) THEN BEGIN
SET "i2" = 0x20
END
ELSE
PATCH_IF (("char" = 0x00) AND ("i2" > 0x00)) THEN BEGIN
READ_ASCII ("co" + "i1" + 0x00) ~trigger~ ("i2")
SPRINT ~cont_var~ ~ab_%area%_%co_name%~
INNER_ACTION BEGIN
EXTEND_BOTTOM ~abparty.bs~ ~inlined/thief_hk_trap.baf~
EVALUATE_BUFFER
END
SET "i2" = 0x20
END
END
END
PATCH_IF ( ("trap_detect" < 0x64)
AND ("trap_disarm" < 0x64)
AND (("trapped" & 0x01) = 0x01)
AND ((%flag% BAND 0b001) = 0b001)) THEN BEGIN //trapped & locked
FOR ("i2" = 0x00; "i2" < 0x20; "i2" += 0x01) BEGIN
READ_BYTE ("co" + "i1" + "i2") "char"
READ_ASCII ("co" + "i1" + "i2") "char2" (1)
PATCH_IF (~%char%~ = 32) AND (~%char2%~ STRING_COMPARE_REGEXP ~ ~ =0) BEGIN
SPRINT ~char2~ ~_~
END
PATCH_IF (%char% != 0) BEGIN
SPRINT ~co_name~ ~%co_name%%char2%~
END
PATCH_IF (("char" = 0x00) AND ("i2" = 0x00)) THEN BEGIN
SET "i2" = 0x20
END
ELSE
PATCH_IF (("char" = 0x00) AND ("i2" > 0x00)) THEN BEGIN
READ_ASCII ("co" + "i1" + 0x00) ~trigger~ ("i2")
SPRINT ~cont_var~ ~ab_%area%_%co_name%~
INNER_ACTION BEGIN
EXTEND_BOTTOM ~abparty.bs~ ~inlined/thief_hk_lock&trap.baf~
EVALUATE_BUFFER
END
SET "i2" = 0x20
END
END
END
PATCH_IF ( ("trap_detect" >= 0x64)
AND ("trap_disarm" >= 0x64)
AND (("trapped" & 0x01) = 0x01)
AND ((%flag% BAND 0b001) = 0b001)) THEN BEGIN //trapped but can't remove & locked
FOR ("i2" = 0x00; "i2" < 0x20; "i2" += 0x01) BEGIN
READ_BYTE ("co" + "i1" + "i2") "char"
READ_ASCII ("co" + "i1" + "i2") "char2" (1)
PATCH_IF (~%char%~ = 32) AND (~%char2%~ STRING_COMPARE_REGEXP ~ ~ =0) BEGIN
SPRINT ~char2~ ~_~
END
PATCH_IF (%char% != 0) BEGIN
SPRINT ~co_name~ ~%co_name%%char2%~
END
PATCH_IF (("char" = 0x00) AND ("i2" = 0x00)) THEN BEGIN
SET "i2" = 0x20
END
ELSE
PATCH_IF (("char" = 0x00) AND ("i2" > 0x00)) THEN BEGIN
READ_ASCII ("co" + "i1" + 0x00) ~trigger~ ("i2")
SPRINT ~cont_var~ ~ab_%area%_%co_name%~
INNER_ACTION BEGIN
EXTEND_BOTTOM ~abparty.bs~ ~inlined/thief_hk_lock_cant_disarm.baf~
EVALUATE_BUFFER
END
SET "i2" = 0x20
END
END
END
PATCH_IF (!(("trapped" & 0x01) = 0x01)
AND ((%flag% BAND 0b001) = 0b001)) THEN BEGIN //locked only
FOR ("i2" = 0x00; "i2" < 0x20; "i2" += 0x01) BEGIN
READ_BYTE ("co" + "i1" + "i2") "char"
READ_ASCII ("co" + "i1" + "i2") "char2" (1)
PATCH_IF (~%char%~ = 32) AND (~%char2%~ STRING_COMPARE_REGEXP ~ ~ =0) BEGIN
SPRINT ~char2~ ~_~
END
PATCH_IF (%char% != 0) BEGIN
SPRINT ~co_name~ ~%co_name%%char2%~
END
PATCH_IF (("char" = 0x00) AND ("i2" = 0x00)) THEN BEGIN
SET "i2" = 0x20
END
ELSE
PATCH_IF (("char" = 0x00) AND ("i2" > 0x00)) THEN BEGIN
READ_ASCII ("co" + "i1" + 0x00) ~trigger~ ("i2")
SPRINT ~cont_var~ ~ab_%area%_%co_name%~
INNER_ACTION BEGIN
EXTEND_BOTTOM ~abparty.bs~ ~inlined/thief_hk_lock.baf~
EVALUATE_BUFFER
END
SET "i2" = 0x20
END
END
END
END
FOR ("i1" = 0x00; "i1" < ("dc" * 0xc8); "i1" += 0xc8) BEGIN
SPRINT ~trigger~ ~~
SPRINT ~co_name~ ~~
READ_SHORT ("do" + "i1" + 0x6c) "trap_detect"
READ_SHORT ("do" + "i1" + 0x6e) "trap_disarm"
READ_SHORT ("do" + "i1" + 0x70) "trapped"
READ_LONG ("do" + "i1" + 0x28) "flag"
PATCH_IF ( ("trap_detect" < 0x64)
AND ("trap_disarm" < 0x64)
AND ((%flag% BAND 0b1000) = 0b1000)
AND (("trapped" & 0x01) = 0x01)) THEN BEGIN
FOR ("i2" = 0x00; "i2" < 0x20; "i2" += 0x01) BEGIN
READ_BYTE ("do" + "i1" + "i2") "char"
READ_ASCII ("do" + "i1" + "i2") "char2" (1)
PATCH_IF (~%char%~ = 32) AND (~%char2%~ STRING_COMPARE_REGEXP ~ ~ =0) BEGIN
SPRINT ~char2~ ~_~
END
PATCH_IF (%char% != 0) BEGIN
SPRINT ~co_name~ ~%co_name%%char2%~
END
PATCH_IF (("char" = 0x00) AND ("i2" = 0x00)) THEN BEGIN
SET "i2" = 0x20
END
ELSE
PATCH_IF (("char" = 0x00) AND ("i2" > 0x00)) THEN BEGIN
READ_ASCII ("do" + "i1" + 0x00) ~trigger~ ("i2")
SPRINT ~cont_var~ ~ab_%area%_%co_name%~
INNER_ACTION BEGIN
EXTEND_BOTTOM ~abparty.bs~ ~inlined/thief_hk_trap.baf~
EVALUATE_BUFFER
END
SET "i2" = 0x20
END
END
END
END
END
BUT_ONLY_IF_IT_CHANGES
COPY ~override/abparty.bs~ ~scripts/abparty.bs~
One thing to note, I have learned that even non-thieves (or those you don't want to have thief actions) will return true with a check stat of GT 1 and that is due to the race modifier and in some cases dexterity modifier. Since you won't be limiting thief actions by class, you'll need to include race checks and stat checks greater than that amount. here's an example for finding traps:
//-------------------------------------------------------------
//Thief Actions
//will look for traps when not in combat mode
IF
ActionListEmpty()
!See([ENEMY])
Global("ab_fight","GLOBAL",0)
!Race(Myself,DWARF)
!Race(Myself,GNOME)
!Race(Myself,HALFLING)
CheckStatGT(Myself,5,TRAPS)
!GlobalTimerNotExpired("ab_trap_look","LOCALS") //one turn timer expired
THEN
RESPONSE #100
SetGlobalTimer("ab_trap_look","LOCALS",ONE_TURN) //one turn timer - don't restart if another action takes precedence
// FloatMessage(Myself,@41)
DisplayString(Myself,@41)
FindTraps()
END
IF
ActionListEmpty()
!See([ENEMY])
Global("ab_fight","GLOBAL",0)
Race(Myself,HALFLING)
CheckStatGT(Myself,10,TRAPS)
!GlobalTimerNotExpired("ab_trap_look","LOCALS") //one turn timer expired
THEN
RESPONSE #100
SetGlobalTimer("ab_trap_look","LOCALS",ONE_TURN) //one turn timer - don't restart if another action takes precedence
// FloatMessage(Myself,@41)
DisplayString(Myself,@41)
FindTraps()
END
IF
ActionListEmpty()
!See([ENEMY])
Global("ab_fight","GLOBAL",0)
Race(Myself,GNOME)
CheckStatGT(Myself,15,TRAPS)
!GlobalTimerNotExpired("ab_trap_look","LOCALS") //one turn timer expired
THEN
RESPONSE #100
SetGlobalTimer("ab_trap_look","LOCALS",ONE_TURN) //one turn timer - don't restart if another action takes precedence
// FloatMessage(Myself,@41)
DisplayString(Myself,@41)
FindTraps()
END
IF
ActionListEmpty()
!See([ENEMY])
Global("ab_fight","GLOBAL",0)
Race(Myself,DWARF)
CheckStatGT(Myself,20,TRAPS)
!GlobalTimerNotExpired("ab_trap_look","LOCALS") //one turn timer expired
THEN
RESPONSE #100
SetGlobalTimer("ab_trap_look","LOCALS",ONE_TURN) //one turn timer - don't restart if another action takes precedence
// FloatMessage(Myself,@41)
DisplayString(Myself,@41)
FindTraps()
END
this is from my
bg1 script that I've been reverting from
IWD version
Edited by Sasha Al'Therin, 30 October 2011 - 04:53 PM.