Quote:
Originally Posted by Mashirosakura
Ok, as I see my previous edit didn't really get an answer, I'll double-post (though I don't want to).
So what I got given when I asked for help getting an alternative (in item form) for Flash was the base code for it. I must have been misunderstood then so I'm clearing it up. Now, can anyone help me with the code for a working Flash item?
|
I tested right now and the method is equals to Cut one. It's even easier, since Flash can't be used outside menu.
The code:
Code:
605,LANTERN,Lantern,Lanterns,8,0,"A lantern that illuminate caves.",2,0,6
I copied the two HiddenMoveHandlers below (these are in base Essentials):
Code:
HiddenMoveHandlers::CanUseMove.add(:FLASH,proc{|move,pkmn|
if !$DEBUG &&
!(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORFLASH : $Trainer.badges[BADGEFORFLASH])
Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
return false
end
if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
Kernel.pbMessage(_INTL("Can't use that here."))
return false
end
if $PokemonGlobal.flashUsed
Kernel.pbMessage(_INTL("This is in use already."))
return false
end
return true
})
HiddenMoveHandlers::UseMove.add(:FLASH,proc{|move,pokemon|
darkness=$PokemonTemp.darknessSprite
return false if !darkness || darkness.disposed?
if !pbHiddenMoveAnimation(pokemon)
Kernel.pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
end
$PokemonGlobal.flashUsed=true
while darkness.radius<176
Graphics.update
Input.update
pbUpdateSceneMap
darkness.radius+=4
end
return true
})
For making the two methods below. I added after the handlers:
Code:
def canUseMoveFlash?
if !$DEBUG &&
!(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORFLASH : $Trainer.badges[BADGEFORFLASH])
Kernel.pbMessage(_INTL("Sorry, a new Badge is required."))
return false
end
if !pbGetMetadata($game_map.map_id,MetadataDarkMap)
Kernel.pbMessage(_INTL("Can't use that here."))
return false
end
if $PokemonGlobal.flashUsed
Kernel.pbMessage(_INTL("This is in use already."))
return false
end
return true
end
def useMoveFlash
darkness=$PokemonTemp.darknessSprite
return false if !darkness || darkness.disposed?
if !pbHiddenMoveAnimation(nil)
Kernel.pbMessage(_INTL("{1} used {2}!",$Trainer.name,"Flash"))
end
$PokemonGlobal.flashUsed=true
while darkness.radius<176
Graphics.update
Input.update
pbUpdateSceneMap
darkness.radius+=4
end
return true
end
And I added at PokemonItemEffects script section:
Code:
ItemHandlers::UseFromBag.add(:LANTERN,proc{|item|
next canUseMoveFlash? ? 2 : 0
})
ItemHandlers::UseInField.add(:LANTERN,proc{|item|
useMoveFlash if canUseMoveFlash?
})