« Reply #4 on: August 01, 2004, 08:27:39 PM »
After trying to figure this out on my own for a few days, I give up! I need help!
Cailean comes equipped with a bow, some arrows, an axe and a short sword. After casting (or attempting to cast) Armor of Faith and quaffing a potion of speed, he eventually gets around to firing some arrows at BH2. BH1 comes up and back stabs him (a second time) and Cailean switches to axe. He then whittles away at BH1. He doesn't ever move away and switch back to bow. If he does manage to kill BH1, he just stands around occasionally switching between bow and axe while BH2 stabs him. This all happens pre-joining. Cailean is blue circled neutral and BH1 & 2 start blue circled and then after some dialog, turn to red circled enemey().
Here's the code that I'm using, a lot of it was quite shamelessly stolen from SimDing0.
IF
Global("FWCaileanBH1Fight","GLOBAL",2)
See(Player1)
Global("FWCaileanJoined","LOCALS",0)
GlobalGT("SPRITE_IS_DEADFWCaiBH1","GLOBAL",0)
GlobalGT("SPRITE_IS_DEADFWCaiBH2","GLOBAL",0)
CombatCounter(0)
THEN
RESPONSE #100
SetGlobal("FWCaileanJoined","LOCALS",1)
Dialogue(Player1)
END
IF
GlobalLT("FWCaileanBH1Fight","GLOBAL",2)
THEN
RESPONSE #100
NoAction()
END
IF
Global("FWCaileanBH1Fight","GLOBAL",2)
HaveSpell(CLERIC_ARMOR_OF_FAITH)
THEN
RESPONSE #100
Spell(Myself,CLERIC_ARMOR_OF_FAITH)
END
IF
HPPercentLT(Myself,40)
HasItem("POTN52",Myself) // ~Potion of Extra Healing~
THEN
RESPONSE #100
DisplayStringHead(Myself,46150) // ~quaffs a potion~
UseItem("POTN52",Myself) // ~Potion of Extra Healing~
END
IF
!StateCheck(Myself,STATE_HASTED)
HasItem("POTN14",Myself)
THEN
RESPONSE #100
DisplayStringHead(Myself,46150) // ~quaffs a potion~
UseItem("POTN14",Myself)
END
IF
Global("FWCaiEnemyNearby","LOCALS",0)
Range(NearestEnemyOf(Myself),10)
THEN
RESPONSE #100
SetGlobal("FWCaiEnemyNearby","LOCALS",1)
Continue()
END
IF
Global("FWCaiEnemyNearby","LOCALS",1)
!Range(NearestEnemyOf(Myself),10)
THEN
RESPONSE #100
SetGlobal("FWCaiEnemyNearby","LOCALS",0)
Continue()
END
IF
OR(3)
See(NearestEnemyOfType([EVILCUTOFF]))
See("FWCaiBH2")
See("FWCaiBH1")
False()
THEN
RESPONSE #100
END
IF
OR(4)
StateCheck(LastSeenBy(Myself),STATE_HELPLESS)
StateCheck(LastSeenBy(Myself),STATE_CONFUSED)
StateCheck(LastSeenBy(Myself),STATE_SLEEPING)
StateCheck(LastSeenBy(Myself),STATE_PANIC)
Allegiance(LastSeenBy(Myself),EVILCUTOFF)
THEN
RESPONSE #100
Attack(LastSeenBy(Myself))
END
IF
Allegiance(LastSeenBy(Myself),EVILCUTOFF) // Check the target is an enemy
Range(LastSeenBy(Myself),10) // If the target is nearby (no need to check for other nearby enemies if the target is near)
THEN
RESPONSE #100
EquipMostDamagingMelee() // Switch to a melee weapon
AttackReevaluate(LastSeenBy(Myself),45) // Attack the target
RESPONSE #10
EquipRanged() // Switch to a ranged weapon
RunAwayFrom(LastSeenBy(Myself),75)
END
// This block will execute if the target is far away, but an enemy is near
IF
Allegiance(LastSeenBy(Myself),EVILCUTOFF) // Check the target is an enemy
!Range(LastSeenBy(Myself),10) // If the target is far away
Global("FWCaiEnemyNearby","LOCALS",1) // If an enemy is nearby
THEN
RESPONSE #100
EquipRanged() // Equip a ranged weapon
RunAwayFrom(NearestEnemyOf(Myself),75) // Run away from the nearby enemy
RESPONSE #100
EquipMostDamagingMelee() // Equip a melee weapon
AttackReevaluate(LastSeenBy(Myself),45) // Attack the nearby enemy
RESPONSE #10
EquipRanged() // Equip a ranged weapon
AttackReevaluate(LastSeenBy(Myself),45) // Attack the target
END
// This block will execute if the target is far away, and there are no enemies nearby
IF
Allegiance(LastSeenBy(Myself),EVILCUTOFF) // Check the target is an enemy
!Range(LastSeenBy(Myself),10) // If the target is far away
HaveSpell(ARCHER_CALL_SHOT)
Global("FWCaiEnemyNearby","LOCALS",0) // If no enemy is nearby
THEN
RESPONSE #100
EquipRanged() // Equip a ranged weapon
Spell(Myself,ARCHER_CALL_SHOT)
AttackReevaluate(LastSeenBy(Myself),45) // Attack the target
RESPONSE #10
Continue() // Continue to the random walking block
END
IF
Allegiance(LastSeenBy(Myself),EVILCUTOFF) // Check the target is an enemy
!Range(LastSeenBy(Myself),10) // If the target is far away
!HaveSpell(ARCHER_CALL_SHOT)
Global("FWCaiEnemyNearby","LOCALS",0) // If no enemy is nearby
THEN
RESPONSE #100
EquipRanged() // Equip a ranged weapon
AttackReevaluate(LastSeenBy(Myself),45) // Attack the target
RESPONSE #10
Continue() // Continue to the random walking block
END
IF
True() // If nothing above has been executed
THEN
RESPONSE #100
EquipRanged() // Equip a ranged weapon
RandomWalkContinuous() // Move around
END
« Last Edit: August 01, 2004, 08:32:05 PM by icelus »
Logged
<Moongaze> Luckily BWL has a very understanding and friendly admin.