Scripts under BGT/BWP enviroment
#1
Posted 19 April 2009 - 02:53 PM
I'm trying to code a few PC's AI scripts to better satisfy my needs. I'm running then in the Trilogy-BWP enviroment, and I'm aware that only BP series are compatible. Neverthless, and since I want really simple scripts, I decided to make an attempt, instead of trying to adaptate bpseries scripts.
Of course, I'm experiencing regular Crash To Desktops (when AI is on), and wondering if my scripts can be fixed. I'm actually trying to debug them, but I'm new on this "scripting thing".
Also, I observed that another annoying problem happens with all the standard bg2 scripts (if AI is on): the charaters are constantly interrupting actions. They stop in the middle when walking to a clicked point, interrupt casting (as if another order was given, although they don't really "DO" nothing). Instead, they stand there with that "on-guard" animation sequence (fast breathing).
That happens a lot, but not all the time.
Now, this is strange: I run a test with the "None" script (without giving scripts to the PCs).
Even without scripts, the same happens, if the AI button is on.
That's bugging me...
About my scripts
I made this one to the protagonist:
There are some custom spells (all them are okay, since I run a test on each one).
As far as I know, the HPLT is uncompatible with BWP (so I removed that line on all the scripts).
Does anybody know any reasons why the mentioned issues are occuring?
//////////////////////////////////////////
// * Check HP and ForceCast unconciousness*
//////////////////////////////////////////
IF
TookDamage()
HPPercentLT(Myself,15)
CheckStatGT(Myself,20,MAXHITPOINTS)
Exists(NearestEnemyOf())
!StateCheck(Myself,STATE_INVISIBLE)
!StateCheck(Myself,STATE_SLEEPING)
THEN
RESPONSE #100
ForceSpellRES("ZOUTCMB2",Myself)
VerbalConstant(Myself(),DYING)
AttackReevaluate(NearestEnemyOf(Myself),10)
END
IF
TookDamage()
HPPercentLT(Myself,30)
Exists(NearestEnemyOf())
!StateCheck(Myself,STATE_INVISIBLE)
!StateCheck(Myself,STATE_SLEEPING)
THEN
RESPONSE #100
ForceSpellRES("ZOUTCMB2",Myself)
AttackReevaluate(NearestEnemyOf(Myself),10)
END
IF
TookDamage()
HPPercentLT(Myself,50)
THEN
RESPONSE #100
ApplySpellRES("ZCMBT",Myself)
END
////////////////
// *DETECTTRAPS
////////////////
IF
ActionListEmpty()
!Exists(NearestEnemyOf())
!ModalState(DETECTTRAPS)
!AreaType(CITY)
!AreaType(OUTDOOR)
!AreaType(FOREST)
THEN
RESPONSE #100
FindTraps()
END
////////////////
// * Gather Party // this one was taken from a script tuto
////////////////
IF
ActionListEmpty()
HotKey(G)
THEN
RESPONSE #5
VerbalConstant(Myself(),LEADER)
GlobalShout(1001)
Wait(2)// seconds
RESPONSE #95 // reduced verbal because it's annoying
GlobalShout(1001)
Wait(2)// seconds
END
//
// Module#2, Respond to GlobalShout or Shout
// heard 1001 = COME_TO_ME
IF
ActionListEmpty()
Heard([PC],1001)
!See(NearestEnemyOf(Myself))
!Range(LastHeardBy(),10)
THEN
RESPONSE #100
SetInterrupt(FALSE)
AttackReevaluate(NearestEnemyOf(Myself),10)
SetInterrupt(TRUE)
MoveToObject(LastHeardBy())
Continue()
END
/////////////
// *ZATHTOME // this one works fine (it starts a container when an object is used)
the object creates ZTOM1 in the inventory for a few instants and removes it. is OK.
/////////////
IF
ActionListEmpty()
Delay(200)
!StateCheck(Myself,STATE_STUNNED)
THEN
RESPONSE #100
ForceSpellRES("ZREGSPEL",Myself)
END
IF
ActionListEmpty()
HasItem("ZTOM1",Myself)
THEN RESPONSE #100
StartStore("zathtom1",Myself)
END
---------------------------------------------------------------------------------------
#2
Posted 19 April 2009 - 11:51 PM
I would use this structure://///////////
// *ZATHTOME // this one works fine (it starts a container when an object is used)
the object creates ZTOM1 in the inventory for a few instants and removes it. is OK.
/////////////
/* plah plah plah plah */As that quotes out everything inside it, not just the one line the // marks do.
Now, why in the unheaven would you wish the computer to play against itself with two AIs? Unless you are a geek...
Deactivated account. The user today is known as The Imp.
#3
Posted 23 April 2009 - 09:05 AM
I would use this structure://///////////
// *ZATHTOME // this one works fine (it starts a container when an object is used)
the object creates ZTOM1 in the inventory for a few instants and removes it. is OK.
//////////////* plah plah plah plah */As that quotes out everything inside it, not just the one line the // marks do.
Now, why in the unheaven would you wish the computer to play against itself with two AIs? Unless you are a geek...
Imp, thanks for answering.
I was thing anything after "//" wasn't even compiled in bs, so I wasn't worried about ////////.
about beying a geek, I think the problem is exactly the oposite, since if I was one I would have noticed my mistake before >: ) I was wrong about having no scripts assigned to characters: In a matter of fact I still had an experimental script running on one of the NPC, that was clearing ALL actions, instead of "ClearActions(Myself)", so the problem is corrected, and now everything makes sense again.
One more thing, about the slashes (////), I still think they are not affecting anything (problem is fixed, and the scripts are still full of "///////////", But thanx again for this observation. I'll look further into this.
#4
Posted 23 April 2009 - 10:04 AM
Will result in an error or bugs ingame... since one line is not commented out./////////////
// *ZATHTOME // this one works fine (it starts a container when an object is used)
the object creates ZTOM1 in the inventory for a few instants and removes it. is OK.
/////////////