qwerty12345 Posted February 12, 2014 Share Posted February 12, 2014 Suppose I want to make a script that would enable a thief automatically disarm any found trap and automatically pick any lock in sight. What's my best bet to do that? The issue is that I don't see a way to determine the state of the object: locked (yes/no), trap armed (yes/no). The closest thing I could find is OpenState(), but it doesn't seem to work on containers. Link to comment
HerrSvensson Posted February 18, 2014 Share Posted February 18, 2014 I've made a script like that. It was a bit tedious, because you need to know exactly which traps are detected and trapped beforehand. What I did was to create global variables for each trap and each lock in the trap scripts and used the triggers Detected, Disarmed and Opened in that script. Then when I knew the global variables, I could check what their value was in a normal script. For example, in when you start a new game, there is a chest called "Picture 1" which is trapped with a script called GDARTS. So what you could do is edit gdarts.bcs with Near Infinity like this: ... ... IF OnCreation() THEN RESPONSE #100 SetGlobal("Picture 1 trap","AR0602",2) SetGlobal("Picture 1 lock","AR0602",1) END IF Detected([ANYONE]) AreaCheck("AR0602") Name("Picture 1",Myself) !Global("Picture 1 trap","AR0602",1) THEN RESPONSE #100 SetGlobal("Picture 1 trap","AR0602",1) END IF Disarmed([ANYONE]) AreaCheck("AR0602") Name("Picture 1",Myself) !Global("Picture 1 trap","AR0602",0) THEN RESPONSE #100 SetGlobal("Picture 1 trap","AR0602",0) END IF Unlocked([ANYONE]) AreaCheck("AR0602") Name("Picture 1",Myself) !Global("Picture 1 lock","AR0602",0) THEN RESPONSE #100 SetGlobal("Picture 1 lock","AR0602",0) END Then you could disarm (or unlock) the trap in a custom script. // Very close to "Picture 1", start searching IF Class(Myself,THIEF_ALL) Range("Picture 1",10) !ModalState(DETECTTRAPS) // !DETECTTRAPS in the last round? Global("Picture 1 trap","AR0602",2) // Is trapped but not detected THEN RESPONSE #100 DisplayString(Myself,52376) // "There is something here.. just let me - Hold! It moves!" ClearActions(Myself) FindTraps() END // "Picture 1" trap detected (detect skill: 50) IF Range("Picture 1",10) Global("Picture 1 trap","AR0602",1) // Is detected Class(Myself,THIEF_ALL) CheckStatGT(Myself,39,TRAPS) // Can disarm THEN RESPONSE #100 ClearActions(Myself) RemoveTraps("Picture 1") PickLock("Picture 1") Continue() END Link to comment
HerrSvensson Posted February 18, 2014 Share Posted February 18, 2014 Locks that are not trapped are a little more difficult, but here's what you can do: Create a Lock script (bsc format) similar to the gdarts example above. Let's call it lock1.bcs Edit the area files for the area where the lock exists, for example AR0602 to unlock "Chest 6". Then start the script lock1.bcs by adding ActionOverride("Chest 6",ChangeAIScript("LOCK1",AREA)) in AR0602.baf after OnCreation(). Link to comment
qwerty12345 Posted February 19, 2014 Author Share Posted February 19, 2014 I figured something like that. Tedious indeed. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.