I'm not very good with creating scripts and I have been trying to implement disguise into my game. If anyone has created the script and could give me a hand with implementing it, it would be much appreciated. Thanks!
If you know how to do it the first way, I would prefer itDo you still want the animation of the move to play and the damaging effect but just have it do 0 damage, (as in the original game) or do you want it to fail right away? If the latter, you can add it to "def pbSuccessCheck"
[COLOR=Red]@effects[PBEffects::Disguise] = false
[/COLOR][COLOR=Red][COLOR=Red][COLOR=Green] # Disguise causes the ability-suppressing effect to fade[/COLOR][/COLOR][COLOR=Green]
# if it was passed on through Baton Pass[/COLOR]
if isConst?(self.ability,PBAbilities,:DISGUISE)
@effects[PBEffects::GastroAcid] = false
end
[COLOR=Black]if isConst?(self.ability,PBAbilities,:ILLUSION) #Illusion
[email protected](@index)
party=party.find_all {|item| item && !item.egg? && item.hp>0 }
if party[party.length-1] != @pokemon
@effects[PBEffects::Illusion] = party[party.length-1]
else
@effects[PBEffects::Illusion] = nil
end
else
@effects[PBEffects::Illusion] = nil
end [COLOR=Green]#Illusion[/COLOR]
[/COLOR][/COLOR]
[COLOR=Green]# Mimikyu[/COLOR]
[COLOR=Red]if self.hasWorkingAbility(:DISGUISE) &&
isConst?(self.species,PBSpecies,:MIMIKYU) &&
!self.isFainted?
if self.form!=1
self.form=1
self.type1=getID(PBTypes,:GHOST)
self.type2=getID(PBTypes,:FAIRY)
end
end[/COLOR]
if onactive
[COLOR=Green] # weather ability scripts[/COLOR]
[COLOR=Red]if self.hasWorkingAbility(:DISGUISE) && onactive
@effects[PBEffects::Disguise]=true
end
[COLOR=Black]
if opponent.effects[PBEffects::Substitute]>0 && (!attacker || attacker.index!=opponent.index) &&
!attacker.hasWorkingAbility(:INFILTRATOR) && !isSoundBased?
PBDebug.log("[#{opponent.pbThis}'s substitute took the damage]")
damage=opponent.effects[PBEffects::Substitute] if damage>opponent.effects[PBEffects::Substitute]
opponent.effects[PBEffects::Substitute]-=damage
opponent.damagestate.substitute=true
@battle.scene.pbDamageAnimation(opponent,0)
@battle.pbDisplayPaused(_INTL("The substitute took damage for {1}!",opponent.name))
if opponent.effects[PBEffects::Substitute]<=0
opponent.effects[PBEffects::Substitute]=0
@battle.pbDisplayPaused(_INTL("{1}'s substitute faded!",opponent.name))
PBDebug.log("[#{opponent.pbThis}'s substitute faded]")
end
opponent.damagestate.hplost=damage
damage=0
else
opponent.damagestate.substitute=false
[COLOR=Red]if opponent.effects[PBEffects::Disguise] && !attacker.hasBypassingAbility()
@battle.pbDisplayEffect(opponent)
@battle.pbDisplay(_INTL("Its disguise served it as a decoy!"))
opponent.effects[PBEffects::Disguise]=false
opponent.form=1
opponent.pbCheckForm
@battle.pbDisplay(_INTL("{1}'s disguise was busted!"))
damage=0
end[/COLOR]
@effects[PBEffects::HyperBeam] = 0
[COLOR="Red"]@effects[PBEffects::Disguise] = false
if isConst?(self.ability,PBAbilities,:DISGUISE)
@effects[PBEffects::GastroAcid] = false
end[/COLOR]
@effects[PBEffects::Illusion] = nil
# Mimikyu
if self.hasWorkingAbility(:DISGUISE) &&
isConst?(self.species,PBSpecies,:MIMIKYU) && !self.isFainted?
if self.form==1
self.type1=getID(PBTypes,:GHOST)
self.type2=getID(PBTypes,:FAIRY)
transformed=true
end
if transformed
pbUpdate(true)
@battle.scene.pbChangePokemon(self,@pokemon)
end
end
# Mimikyu
if self.hasWorkingAbility(:DISGUISE) && onactive && self.form==0
@effects[PBEffects::Disguise]=true
end
else
opponent.damagestate.substitute=false
[COLOR="red"]if opponent.effects[PBEffects::Disguise] && !attacker.hasMoldBreaker
@battle.scene.pbDamageAnimation(opponent,0)
@battle.pbDisplay(_INTL("Its disguise served it as a decoy!"))
opponent.effects[PBEffects::Disguise]=false
opponent.form=1
opponent.pbCheckForm
@battle.pbDisplay(_INTL("#{opponent.pbThis}'s disguise was busted!"))
damage=0
end[/COLOR]
if damage>=opponent.hp
Yeah, I have some ideas on how I might approach fixing it, but I think I'm okay with giving Mimikyu that buff in my game too, so I'll probably leave it.Although I don't so much mind that being the way disguise works in my game haha.
yeah because when you think about it the only way to exploit it in a battle is by continuing to switch it out, which just damages your other pokemon, so while it may give mimikyu a buff, exploiting it just hurts everything else. so it seems decently balanced to me.Yeah, I have some ideas on how I might approach fixing it, but I think I'm okay with giving Mimikyu that buff in my game too, so I'll probably leave it.
Here's the version of this script I have assembled for v17.2, which is working alright.
As in the original suggestion, I added a new effect called "Disguise", right below Yawn
Next, in the PokeBattle_Battler script section, I added Disguise to the pbInitEffects:
Code:@effects[PBEffects::HyperBeam] = 0 [COLOR="Red"]@effects[PBEffects::Disguise] = false if isConst?(self.ability,PBAbilities,:DISGUISE) @effects[PBEffects::GastroAcid] = false end[/COLOR] @effects[PBEffects::Illusion] = nil
and Mimikyu to pbCheckForm script:
Code:# Mimikyu if self.hasWorkingAbility(:DISGUISE) && isConst?(self.species,PBSpecies,:MIMIKYU) && !self.isFainted? if self.form==1 self.type1=getID(PBTypes,:GHOST) self.type2=getID(PBTypes,:FAIRY) transformed=true end if transformed pbUpdate(true) @battle.scene.pbChangePokemon(self,@pokemon) end end
and to the bottom of the pbAbilitiesOnSwitchIn script below that:
Code:# Mimikyu if self.hasWorkingAbility(:DISGUISE) && onactive && self.form==0 @effects[PBEffects::Disguise]=true end
Finally, in the PokeBattle_Move script section, I added disguise to pbReduceHPDamage:
Code:else opponent.damagestate.substitute=false [COLOR="red"]if opponent.effects[PBEffects::Disguise] && !attacker.hasMoldBreaker @battle.scene.pbDamageAnimation(opponent,0) @battle.pbDisplay(_INTL("Its disguise served it as a decoy!")) opponent.effects[PBEffects::Disguise]=false opponent.form=1 opponent.pbCheckForm @battle.pbDisplay(_INTL("#{opponent.pbThis}'s disguise was busted!")) damage=0 end[/COLOR] if damage>=opponent.hp
All of this is pretty close to the original solution, just with some tweaks to get it to work more smoothly.
The only problem with it currently is that if Mimikyu is switched out and switched back in, Disguise resets. I haven't yet figured out a way to maintain its Busted form.
def getUnmegaForm
return -1 if !isMega?
dexdata = pbOpenDexData
pbDexDataOffset(dexdata,self.fSpecies,37)
unmegaform = dexdata.fgetb
dexdata.close
return unmegaform # form number
end
def hasMegaForm?
mf = self.getMegaForm
return mf>0 && mf!=self.species
end
def isMega?
mf = self.getMegaForm
return mf!=self.species && mf==self.fSpecies
end
def makeMega
fsp = self.getMegaForm
if fsp>0
f = pbGetSpeciesFromFSpecies(fsp)[1]
self.form = f
end
end
def makeUnmega
newf = self.getUnmegaForm
self.form = newf if newf>=0
end
def megaName
formname = pbGetMessage(MessageTypes::FormNames,self.fSpecies)
return (formname && formname!="") ? formname : _INTL("Mega {1}",PBSpecies.getName(@species))
end
def megaMessage
dexdata = pbOpenDexData
pbDexDataOffset(dexdata,self.getMegaForm,58)
message = dexdata.fgetb
dexdata.close
return message # 0=default message, 1=Rayquaza message
end
def hasPrimalForm?
v=MultipleForms.call("getPrimalForm",self)
return v!=nil
end
def isPrimal?
v=MultipleForms.call("getPrimalForm",self)
return v!=nil && v==@form
end
def makePrimal
v=MultipleForms.call("getPrimalForm",self)
self.form=v if v!=nil
end
def makeUnprimal
v=MultipleForms.call("getUnprimalForm",self)
if v!=nil; self.form=v
elsif isPrimal?; self.form=0
end
end
end
Yeah, that's sort of what I had in mind to try. At this point, I still don't have a thorough understanding of all the code involved in mega evolution, but there are some key differences in what triggers it compared to disguise (and power construct and battle bond) that prevent it from being a simple task of replicating their structure. It's still a good place to look though.So, maybe if we create a 'makeUnForm' or something to them (Mimikyu, Zygarde, Greninja etc), it will works....