- 155
- Posts
- 9
- Years
- Age 31
- Seen Jun 11, 2021
I'm trying to modify the AI to where Trainers can use items like Revives and Max Revives in battle, but I'm not having a lot of luck with that.
This code was what I changed in PokeBattle_Battle.
And this was what I changed in PokeBattle_AI. Does anyone have any suggestions to help me fix this?
Code:
if fullhp
pbDisplay(_INTL("{1} became healthy!",battler.pbThis))
else
pbDisplay(_INTL("{1}'s HP was restored.",battler.pbThis))
end
[B][COLOR=Red]elsif isConst?(item,PBItems,:REVIVE)
pokemon.status=0
pokemon.hp=(pokemon.totalhp/2).floor
pbDisplay(_INTL("{1} was revived.",pokemon.name))
elsif isConst?(item,PBItems,:MAXREVIVE)
pokemon.status=0
pokemon.hp=(pokemon.totalhp).floor
pbDisplay(_INTL("{1} was fully revived.",pokemon.name))[/COLOR][/B]
elsif isConst?(item,PBItems,:FULLHEAL)
battler.status=0; battler.statusCount=0
battler.effects[PBEffects::Confusion]=0
pbDisplay(_INTL("{1} became healthy!",battler.pbThis))
elsif isConst?(item,PBItems,:XATTACK)
if battler.pbCanIncreaseStatStage?(PBStats::ATTACK,battler)
battler.pbIncreaseStat(PBStats::ATTACK,1,battler,true)
end
Code:
elsif isConst?(i,PBItems,:POTION) ||
isConst?(i,PBItems,:SUPERPOTION) ||
isConst?(i,PBItems,:HYPERPOTION) ||
isConst?(i,PBItems,:MAXPOTION)
return i if battler.hp<=battler.totalhp/4
return i if battler.hp<=battler.totalhp/2 && pbAIRandom(10)<3
[B][COLOR=Red]elsif isConst?(i,PBItems,:MAXREVIVE) ||
isConst?(i,PBItems,:REVIVE)
return i if (battler.isFainted?)[/COLOR][/B]
elsif isConst?(i,PBItems,:FULLHEAL)
return i if !hashpitem &&
(battler.status>0 || battler.effects[PBEffects::Confusion]>0)