- Pokémon Essentials Version
- v18.1 ➖
This script lets the player use Camouflage to become invisible in the overworld! While invisible, enemy trainers won't see the player or challenge them to battles!
This script is almost but not quite plug and play!
In PField_FieldMoves, add this at the bottom:
Ruby:
#===============================================================================
# Camouflage
#===============================================================================
def pbVanish
if $game_player.transparent==false
pbMoveRoute($game_player,[
PBMoveRoute::Opacity,205,
PBMoveRoute::Wait,5,
PBMoveRoute::Opacity,155,
PBMoveRoute::Wait,5,
PBMoveRoute::Opacity,105,
PBMoveRoute::Wait,5,
PBMoveRoute::Opacity,55,
PBMoveRoute::Wait,5,
PBMoveRoute::Opacity,5,
PBMoveRoute::Wait,5,
PBMoveRoute::Opacity,0
])
pbWait(30)
$game_player.transparent=true
else
pbMoveRoute($game_player,[
PBMoveRoute::Opacity,5,
PBMoveRoute::Wait,5,
PBMoveRoute::Opacity,55,
PBMoveRoute::Wait,5,
PBMoveRoute::Opacity,105,
PBMoveRoute::Wait,5,
PBMoveRoute::Opacity,155,
PBMoveRoute::Wait,5,
PBMoveRoute::Opacity,205,
PBMoveRoute::Wait,5,
PBMoveRoute::Opacity,255
])
$game_player.transparent=false
end
end
HiddenMoveHandlers::CanUseMove.add(:CAMOUFLAGE,proc { |move,pkmn,showmsg|
if $game_player.pbHasDependentEvents?
pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
next false
end
next true
})
HiddenMoveHandlers::UseMove.add(:CAMOUFLAGE,proc { |move,pokemon|
if $game_player.transparent==true
if pbConfirmMessage(_INTL("Camouflage is already being used. Reappear?"))
else
next false
end
end
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!",pokemon.name,PBMoves.getName(move)))
end
pbVanish
if $game_player.transparent==true
pbMessage(_INTL("{1} helped {2} turn invisible!",pokemon.name,$Trainer.name))
end
next true
})
In Game_Event, find:
Ruby:
def pbCheckEventTriggerAfterTurning
return if $game_system.map_interpreter.running? || @starting
if @event.name[/trainer\((\d+)\)/i]
distance = $~[1].to_i
if @trigger==2 && pbEventCanReachPlayer?(self,$game_player,distance)
start if !jumping? && !over_trigger?
end
end
end
Change "if @event.name[/trainer\((\d+)\)/i]" to:
Ruby:
if @event.name[/trainer\((\d+)\)/i] && !$game_player.transparent==true
In Game_Player, find:
Ruby:
def pbTriggeredTrainerEvents(triggers,checkIfRunning=true)
result = []
# If event is running
return result if checkIfRunning && $game_system.map_interpreter.running?
# All event loops
for event in $game_map.events.values
next if !event.name[/trainer\((\d+)\)/i]
distance = $~[1].to_i
# If event coordinates and triggers are consistent
if pbEventCanReachPlayer?(event,self,distance) and triggers.include?(event.trigger)
# If starting determinant is front event (other than jumping)
result.push(event) if not event.jumping? and not event.over_trigger?
end
end
return result
end
Just like before, change "next if !event.name[/trainer\((\d+)\)/i]" to
Ruby:
next if !event.name[/trainer\((\d+)\)/i] || $game_player.transparent==true
Finally, still in Game_Player, find:
Ruby:
def check_event_trigger_touch(x, y)
result = false
# If event is running
return result if $game_system.map_interpreter.running?
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
next if event.x != x || event.y != y
if event.name[/trainer\((\d+)\)/i]
distance = $~[1].to_i
next if !pbEventCanReachPlayer?(event,self,distance)
elsif event.name[/counter\((\d+)\)/i]
distance = $~[1].to_i
next if !pbEventFacesPlayer?(event,self,distance)
end
next if ![1,2].include?(event.trigger)
# If starting determinant is front event (other than jumping)
next if event.jumping? || event.over_trigger?
event.start
result = true
end
return result
end
And just like the rest, change "if event.name[/trainer\((\d+)\)/i] " to
Ruby:
if event.name[/trainer\((\d+)\)/i] && !$game_player.transparent==true
Using this script
Events triggered by player touch will still be affected, so there's no need to worry about those becoming broken! However, it will look a bit awkward for NPCs to chat with the invisible player- I'd suggest running an event with this check:
Ruby:
if $game_player.transparent==true
pbVanish
Similar to my Bounce script, I'd suggesting making Camouflage a later-game move, so you don't have to do this for most of your story events.
This script currently doesn't ignore wild encounters, because I thought that'd be too overpowered. If you want to do that to get around the awkwardness of suddenly being visible for a battle, I might try to whip up something to fix it.
Looking for more field moves?
- Weather-summoning moves
- Extreme Speed
- Bounce
- Recovery moves
- Sketch
- Move Reminder Field Move
- Future Sight
- Credits
- Credit to TechSkylander1518, please!