OTG
Sun, 15th Oct '06, 7:16pm
I've spent some adapting and adding to some of the default scripts to customise them to work better with my playing style, and I've encountered a problem which is really bugging me.
Jaheira's script is based on the Spellcaster Attack script (fighter3), with spellcasting I've added in, and a small component at the end to check the range to the party leader and move towards them if too far away (useful for when she runs off chasing enemies). My problem is this... While there's still enemies around, Jaheira gets all caught up in the fray and ends up battering Aerie. I can't see anywhere in fighter3 where this should happen. It only seems to be Jaheira and Aerie who are affected, and it's only with weapons that Jaheira lashes out. None of my other party members hate one another so much. Any clues as to where I should look?
Gastong
Sun, 15th Oct '06, 8:13pm
Maybe you could show us the script.
OTG
Sun, 15th Oct '06, 8:39pm
Doh!
// * For Jaheira and other Fighter / Druids
// * Heal the party, heal yourself
// * Attack enemies with spells
// * Attack enemy spellcasters with ranged weapons
// * Attack enemy spellcasters with melee weapons
// * Attack other enemies
// * Return to the party leader if idle
// * Based on (and borrowing heavily from) Brent Knowles' scripts - fighter3.baf, cleric3.baf
//*Assistance*
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_SLOW_POISON)
See([PC])
StateCheck(LastSeenBy(Myself),STATE_POISONED)
THEN
RESPONSE #100
Spell(LastSeenBy(Myself),CLERIC_SLOW_POISON)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_NEUTRALIZE_POISON)
See([PC])
StateCheck(LastSeenBy(Myself),STATE_POISONED)
THEN
RESPONSE #100
Spell(LastSeenBy(Myself),CLERIC_NEUTRALIZE_POISON)
END
// *Heal Others*
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_MASS_CURE)
See([PC])
OR(2)
HPPercentLT(Player1,80)
HPPercentLT(Player3,80)
OR(2)
HPPercentLT(Player2,80)
HPPercentLT(Player5,80)
OR(2)
HPPercentLT(Player4,80)
HPPercentLT(Player6,80)
THEN
RESPONSE #100
Spell(LastSeenBy(Myself),CLERIC_MASS_CURE)
END
IF
ActionListEmpty()
HPPercentLT(LastSeenBy(Myself),10)
HaveSpell(CLERIC_HEAL)
!StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
THEN
RESPONSE #100
Spell(LastSeenBy(Myself),CLERIC_HEAL)
END
IF
ActionListEmpty()
HPPercentLT(MostDamagedOf(),60)
!StateCheck(MostDamagedOf(),STATE_INVISIBLE)
HaveSpell(CLERIC_CURE_SERIOUS_WOUNDS)
THEN
RESPONSE #100
Spell(MostDamagedOf(),CLERIC_CURE_SERIOUS_WOUNDS)
END
IF
ActionListEmpty()
HPPercentLT(MostDamagedOf(),50)
!StateCheck(MostDamagedOf(),STATE_INVISIBLE)
HaveSpell(CLERIC_CURE_LIGHT_WOUNDS)
THEN
RESPONSE #100
Spell(MostDamagedOf(),CLERIC_CURE_LIGHT_WOUNDS)
END
IF
ActionListEmpty()
HPPercentLT(MostDamagedOf(),50)
!StateCheck(MostDamagedOf(),STATE_INVISIBLE)
HaveSpell(CLERIC_AID)
THEN
RESPONSE #100
Spell(MostDamagedOf(),CLERIC_AID)
END
// *Defensive*
// * if see Vampires...
// * ...protect companions
IF
ActionListEmpty()
See([0.0.VAMPIRE])
!CombatCounter(0)
HaveSpell(CLERIC_NEGATIVE_PLANE_PROTECTION)
See([PC])
!StateCheck(LastSeenBy(Myself),STATE_INVISIBLE)
CheckStat(LastSeenBy(Myself),0,SCRIPTINGSTATE3)
THEN
RESPONSE #100
Spell(LastSeenBy(Myself),CLERIC_NEGATIVE_PLANE_PRO TECTION)
END
// * ...protect self
IF
ActionListEmpty()
See([0.0.VAMPIRE])
!CombatCounter(0)
HaveSpell(CLERIC_NEGATIVE_PLANE_PROTECTION)
CheckStat(Myself,0,SCRIPTINGSTATE3)
THEN
RESPONSE #100
Spell(Myself,CLERIC_NEGATIVE_PLANE_PROTECTION)
END
//* Keep protective spells active
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_IRONSKIN)
HPGT(LastSeenBy(Myself),20)
CheckStatLT(Myself,1,STONESKINS)
THEN
RESPONSE #100
Spell(Myself,CLERIC_IRONSKIN)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_PHYSICAL_MIRROR)
HPGT(LastSeenBy(Myself),20)
!HasBounceEffects(Myself)
THEN
RESPONSE #100
Spell(Myself,CLERIC_PHYSICAL_MIRROR)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_REGENERATE)
HPGT(LastSeenBy(Myself),20)
HPPercentLT(Myself,60)
THEN
RESPONSE #100
Spell(Myself,CLERIC_REGENERATE)
END
//* Offensive druid spells
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_CREEPING_DOOM)
HPGT(LastSeenBy(Myself),20)
THEN
RESPONSE #100
Spell(NearestEnemyOf(Myself),CLERIC_CREEPING_DOOM)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_CONFUSION)
HPGT(LastSeenBy(Myself),20)
!StateCheck(LastSeenBy(Myself),STATE_CONFUSED)
THEN
RESPONSE #100
Spell(NearestEnemyOf(Myself),CLERIC_CONFUSION)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_ENTANGLE)
HPGT(LastSeenBy(Myself),20)
NumCreatureVsPartyGT([ENEMY],4)
AreaCheck(OUTDOOR)
THEN
RESPONSE #100
Spell(LastSeenBy(Myself),CLERIC_ENTANGLE)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_INSECT_PLAGUE)
HPGT(LastSeenBy(Myself),20)
THEN
RESPONSE #100
Spell(NearestEnemyOf(Myself),CLERIC_INSECT_PLAGUE)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_CALL_LIGHTNING)
HPGT(LastSeenBy(Myself),20)
AreaCheck(OUTDOOR)
THEN
RESPONSE #100
Spell(NearestEnemyOf(Myself),CLERIC_CALL_LIGHTNING )
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_SUMMON_INSECTS)
HPGT(LastSeenBy(Myself),20)
THEN
RESPONSE #100
Spell(NearestEnemyOf(Myself),CLERIC_SUMMON_INSECTS )
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_NATURE_BEAUTY)
HPGT(LastSeenBy(Myself),20)
THEN
RESPONSE #100
Spell(Myself,CLERIC_NATURE_BEAUTY)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_FINGER_OF_DEATH)
HPGT(LastSeenBy(Myself),20)
HPLT(LastSeenBy(Myself),50)
THEN
RESPONSE #100
Spell(NearestEnemyOf(Myself),CLERIC_FINGER_OF_DEAT H)
END
//*Heal Myself (lower-priority)*
IF
ActionListEmpty()
HPPercentLT(Myself,10)
HaveSpell(CLERIC_HEAL)
THEN
RESPONSE #100
Spell(Myself,CLERIC_HEAL)
END
IF
ActionListEmpty()
HPPercentLT(Myself,60)
HaveSpell(CLERIC_CURE_SERIOUS_WOUNDS)
THEN
RESPONSE #100
Spell(Myself,CLERIC_CURE_SERIOUS_WOUNDS)
END
//*Combat*
//*target spell-casters first, first with ranged weapons (if at range)
// * and then with melee weapons
IF
ActionListEmpty()
OR(4)
See(NearestEnemyOfType([0.0.0.MAGE_ALL]))
See(NearestEnemyOfType([0.0.0.CLERIC_ALL]))
See(NearestEnemyOfType([0.0.0.DRUID_ALL]))
See(NearestEnemyOfType([0.0.0.BARD_ALL]))
!Range(LastSeenBy(Myself),10)
THEN
RESPONSE #100
EquipRanged()
AttackReevaluate(LastSeenBy(Myself),30)
END
IF
ActionListEmpty()
OR(4)
See(NearestEnemyOfType([0.0.0.MAGE_ALL]))
See(NearestEnemyOfType([0.0.0.CLERIC_ALL]))
See(NearestEnemyOfType([0.0.0.DRUID_ALL]))
See(NearestEnemyOfType([0.0.0.BARD_ALL]))
THEN
RESPONSE #100
EquipMostDamagingMelee()
AttackReevaluate(LastSeenBy(Myself),30)
END
// * standard combat
// * Combat*
IF
ActionListEmpty()
Help([PC])
THEN
RESPONSE #100
AttackReevaluate(LastAttackerOf(LastHelp(Myself)), 60)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
!Range(NearestEnemyOf(Myself),10)
THEN
RESPONSE #100
EquipRanged()
AttackReevaluate(NearestEnemyOf(Myself),30)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
THEN
RESPONSE #100
EquipMostDamagingMelee()
AttackReevaluate(NearestEnemyOf(Myself),30)
END
// * don't stray too far from the party leader if not fighting
IF
ActionListEmpty()
!Range(LeaderOf(), 20)
!See(NearestEnemyOf(Myself))
THEN
RESPONSE #100
MoveToObject(LeaderOf(Myself))
ENDAs you can see, it's mostly just bits copied from other scripts, but until I clear this bug, I'm reticent to try to be too clever.