Quote:
Originally Posted by Mad head Trip
Other than whats stated works pretty well! Im just wondering what the follower bot does to choose what skill to use. im using it to power level my wammo in pre. ive noticed it will attack sometimes other times it wont. with that being said is there a certain order i should put skills, if not what can i do to make sure it self heals. i know there is certain checks that i can make to where if HP drops below say 50% use X skill. Ive been looking into coding and reading functions to get a better understanding, so i can maybe start coding and/or be able to fix simple issues some public bots have. To help myself and give back to the community.
|
It is always a good first step to just open the bot and look at the script - concerning this bot you will find following "fight" function in which you can see how the bot acts if in battle.
Code:
Func Fight($x, $s = "enemies")
local $TimerToGetOut = TimerInit()
Do
$useSkill = -1
$target = GetNearestEnemyToAgent(-2)
$distance = GetDistance($target, -2)
If DllStructGetData($target, 'ID') <> 0 AND $distance < $x Then
ChangeTarget($target)
RndSlp(150)
CallTarget($target)
RndSlp(150)
Attack($target)
RndSlp(150)
ElseIf DllStructGetData($target, 'ID') = 0 OR $distance > $x Then
exitloop
EndIf
For $i = 0 To $totalskills
$targetHP = DllStructGetData(GetCurrentTarget(),'HP')
if $targetHP = 0 then ExitLoop
$distance = GetDistance($target, -2)
if $distance > $x then ExitLoop
$TargetAllegiance = DllStructGetData(GetCurrentTarget(),'Allegiance')
if $TargetAllegiance = 0x1 OR $TargetAllegiance = 0x4 OR $TargetAllegiance = 0x5 OR $TargetAllegiance = 0x6 Then ExitLoop
$TargetIsDead = DllStructGetData(GetCurrentTarget(), 'Effects')
If $TargetIsDead = 0x0010 Then ExitLoop
$TargetItem = DllStructGetData(GetCurrentTarget(),'Type')
if $TargetItem = 0x400 then ExitLoop
$energy = GetEnergy(-2)
$recharge = DllStructGetData(GetSkillBar(), "Recharge" & $i+1)
$adrenaline = DllStructGetData(GetSkillBar(), "Adrenaline" & $i+1)
If $recharge = 0 And $energy >= $intSkillEnergy[$i] And $adrenaline >= ($intSkillAdrenaline[$i]*25 - 25) Then
$useSkill = $i + 1
$variabletosort = 0
UseSkill($useSkill, $target)
RndSlp($intSkillCastTime[$i]+500)
EndIf
$target = GetNearestEnemyToAgent(-2)
Attack($target)
RndSlp(150)
if $i = $totalskills then $i = -1 ; change -1
Next
$TargetAllegiance = DllStructGetData(GetCurrentTarget(),'Allegiance')
$TargetIsDead = DllStructGetData(GetCurrentTarget(), 'Effects')
$targetHP = DllStructGetData(GetCurrentTarget(),'HP')
$TargetItem = DllStructGetData(GetCurrentTarget(),'Type')
Until DllStructGetData($target, 'ID') = 0 OR $distance > $x OR $TargetAllegiance = 0x1 OR $TargetAllegiance = 0x4 OR $TargetAllegiance = 0x5 OR $TargetAllegiance = 0x6 OR $TargetIsDead = 0x0010 OR $targetHP = 0 OR $TargetItem = 0x400 OR TimerDiff($TimerToGetOut) > 240000
EndFunc
So you can see here: "For $i = 0 To $totalskills" and in the following lines that the bot will more or less cast randomly if energy/rechargetime & adrenaline is there
you are definitly able to add something to tell the bot to help himself at f.e. 50% hp
You can choose 2 approches here:
1: order the skills for the bot or load a certain template so the healing skill is always skill nr.1
2: order skill-Ids and put all selfhealingskills in an array and let the bot use an random healing spell if the spell in in the current build no matter where so skill 1-8 (this approach makes it easier in the long run but is obviously harder work since you have to get a bunch of ID's etc.)
So to keep it simple here is the approach by having the self healing skill in slot nr.1
Code:
$lMe = GetAgentByID(-2)
If DllStructGetData($lMe, 'HP') < 0.5 Then
UseSkillEx(1, -2)
EndIf