• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Camouflage as a field move

v19 Camouflage as a field move N/A

This resource pertains to version 19 of Pokémon Essentials.
Pokémon Essentials Version
v18.1 ➖
vanish.gif

invisible movement.gif

reveal.gif

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:
Expand Collapse Copy
#===============================================================================
# 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:
Expand Collapse Copy
  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:
Expand Collapse Copy
    if @event.name[/trainer\((\d+)\)/i] && !$game_player.transparent==true

In Game_Player, find:
Ruby:
Expand Collapse Copy
  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:
Expand Collapse Copy
      next if !event.name[/trainer\((\d+)\)/i] || $game_player.transparent==true

Finally, still in Game_Player, find:
Ruby:
Expand Collapse Copy
  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:
Expand Collapse Copy
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:
Expand Collapse Copy
if $game_player.transparent==true
    pbVanish
That'll make the player visible if they weren't before!

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?​

You may also be interested in Lucidious89's Improved Field Skills.
Credits
Credit to TechSkylander1518, please!
Author
TechSkylander1518
Views
2,555
First release
Last update

Ratings

5.00 star(s) 1 ratings

More resources from TechSkylander1518

Latest reviews

Your field move resources are always so creative and interesting! They give me ideas for future projects and I could see this one being used as a way to sneak past some evil team grunts and into their base.
TechSkylander1518
TechSkylander1518
Thank you so much, that's really kind of you to say!
Back
Top