Page 1 of 1
Scripting - am I finding traps?
Posted: Mon Apr 19, 2004 10:03 am
by glenfar
I've setup a script for my thief so that if no enemies are around, he'll automatically search for traps (by calling FindTraps()).
This is working, there's just a slight nuisance though. It seems everytime I call FindTraps(), it first STOPS looking for traps, and then starts looking again. You see this come up over and over again in the message area.
Is there a trigger I can use that'll tell me if I'm already looking for traps?
Posted: Mon Apr 19, 2004 4:39 pm
by glenfar
Guess I'll answer my own question! It's not perfect, but I did manage to get something I'm happy with:
IF
See(NearestEnemyOf(Myself))
THEN
RESPONSE #100
SetGlobal("LOOKING","LOCALS",0)
Continue()
END
IF
ActionListEmpty()
!See(NearestEnemyOf(Myself))
Global("LOOKING","LOCALS",0)
THEN
RESPONSE #100
SetGlobal("LOOKING","LOCALS",1)
FindTraps()
END
IF
HotKey(F)
THEN
RESPONSE #100
SetGlobal("LOOKING","LOCALS",1)
FindTraps()
END
Basically, when I start searching for traps, I set a local flag so I know I've done it. This stops me from repeating the command over and over again ...
Then just made sure the flag is cleared when entering combat (so I'll start searching again automatically when the combat is over). Then since other actions can also stop my search, I also added a hotkey.
Posted: Wed Apr 21, 2004 10:39 pm
by Ekental
question for you glenfar... do you by any chance also do general programming... i.e. C++, java, perl? maybe COBAL?
Posted: Thu Apr 22, 2004 10:16 am
by glenfar
Originally posted by Ekental
do you by any chance also do general programming
Yes I do - primarily VB, but also C++. One of the things I enjoy about games like the BG series is seeing what I can do with the scripting.
Posted: Tue May 11, 2004 10:33 am
by glenfar
Figured out how to do it properly now - this will make sure you're detecting traps whenever there's no enemies around:
IF
ActionListEmpty()
!See(NearestEnemyOf(Myself))
!ModalState(DETECTTRAPS)
THEN
RESPONSE #100
FindTraps()
END
Although I've actually paired up a Monk with my Thief now - makes a great combo. My Monk is now the one detecting traps, which leaves my thief free to hide in shadows (and therefore is ready to backstab at the start of every combat).