The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.


Advertise here

Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old September 11th, 2013, 09:06 AM
BadSamaritan's Avatar
BadSamaritan
Its time for overtime
 
Join Date: May 2009

Advertise here
Hi guys, there is something that's been bugging me for a while that I haven't found either here nor in the wikia, and that is how to "add" metadata(other then adding extra characters). Let me explain...

In the game I'm working on, we have a new HM enabling "flight"(just dive copied for all intensive purposes). The problem is that I obviously have to separate it so you are on a fish in dive and on a bird while flying.

Now what I'm confused about is where this all takes place. I know large parts of it are in the editor, but even then I don't know how to "map" it to the particular action I'm doing. Or if its mapped to it via the HM's code and I just didn't see it.

Any knowledge is appreciated.
Reply With Quote
  #2    
Old September 12th, 2013, 11:55 AM
Nickalooose
--------------------
 
Join Date: Mar 2008
Gender: Female
Code:
def Kernel.pbUpdateVehicle
  meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
  if meta
    if $PokemonGlobal.diving
      $game_player.character_name=meta[5] && meta[5]!="" ? meta[5] : meta[1] # Diving graphic
    elsif $PokemonGlobal.surfing
      $game_player.character_name=meta[3] && meta[3]!="" ? meta[3] : meta[1] # Surfing graphic
    elsif $PokemonGlobal.bicycle
      $game_player.character_name=meta[2] && meta[2]!="" ? meta[2] : meta[1] # Bicycle graphic
    else
      $game_player.character_name=meta[1] # Regular graphic
    end
  end
end
This is where your new code will go... Copy this and change to accommodate.
Reply With Quote
  #3    
Old September 12th, 2013, 04:30 PM
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
This kind of information isn't written down anywhere because (practically) no one will ever need to know how to do what you're asking, so it's pointless writing it down formally. And what you're asking is very much a multi-faceted beast, of which Nickalooose's response is just one small part.

You want to clone the Dive feature. This involves three main aspects:
  • Transfer between the ground map and the corresponding sky map when using a field move.
  • Change the player's graphic whilst flying.
  • Make "the player is flying" an actual state the player can be in (like "the player is surfing" already is).
Now, the first two points would ideally require metadata, namely a new map-specific metadata FlyMap (the analogue of DiveMap), and a tweak to the global metadata PlayerA to include an extra player charset which depicts them flying.

This sounds complicated. Well, it should - you're wanting to change some of the data structure. Fortunately, thanks to some of my more recent work on Essentials, it may well not be as complex nor time-consuming as it could be.

Hop into the script section PokemonMap and look around line 275 and the next 75 lines after it. It'll look like what's below, once you've added in the red parts:
Code:
MetadataHome             = 1
MetadataWildBattleBGM    = 2
MetadataTrainerBattleBGM = 3
MetadataWildVictoryME    = 4
MetadataTrainerVictoryME = 5
MetadataSurfBGM          = 6
MetadataBicycleBGM       = 7
MetadataPlayerA          = 8
MetadataPlayerB          = 9
MetadataPlayerC          = 10
MetadataPlayerD          = 11
MetadataPlayerE          = 12
MetadataPlayerF          = 13
MetadataPlayerG          = 14
MetadataPlayerH          = 15

MetadataOutdoor             = 1
MetadataShowArea            = 2
MetadataBicycle             = 3
MetadataBicycleAlways       = 4
MetadataHealingSpot         = 5
MetadataWeather             = 6
MetadataMapPosition         = 7
MetadataDiveMap             = 8
MetadataDarkMap             = 9
MetadataSafariMap           = 10
MetadataSnapEdges           = 11
MetadataDungeon             = 12
MetadataBattleBack          = 13
MetadataMapWildBattleBGM    = 14
MetadataMapTrainerBattleBGM = 15
MetadataMapWildVictoryME    = 16
MetadataMapTrainerVictoryME = 17
MetadataMapSize             = 18
MetadataFlightMap           = 19



module PokemonMetadata
  GlobalTypes={
     "Home"=>[MetadataHome,"uuuu"],
     "WildBattleBGM"=>[MetadataWildBattleBGM,"s"],
     "TrainerBattleBGM"=>[MetadataTrainerBattleBGM,"s"],
     "WildVictoryME"=>[MetadataWildVictoryME,"s"],
     "TrainerVictoryME"=>[MetadataTrainerVictoryME,"s"],
     "SurfBGM"=>[MetadataSurfBGM,"s"],
     "BicycleBGM"=>[MetadataBicycleBGM,"s"],
     "PlayerA"=>[MetadataPlayerA,"essssssss",:PBTrainers],
     "PlayerB"=>[MetadataPlayerB,"essssssss",:PBTrainers],
     "PlayerC"=>[MetadataPlayerC,"essssssss",:PBTrainers],
     "PlayerD"=>[MetadataPlayerD,"essssssss",:PBTrainers],
     "PlayerE"=>[MetadataPlayerE,"essssssss",:PBTrainers],
     "PlayerF"=>[MetadataPlayerF,"essssssss",:PBTrainers],
     "PlayerG"=>[MetadataPlayerG,"essssssss",:PBTrainers],
     "PlayerH"=>[MetadataPlayerH,"essssssss",:PBTrainers]
  }
  NonGlobalTypes={
     "Outdoor"=>[MetadataOutdoor,"b"],
     "ShowArea"=>[MetadataShowArea,"b"],
     "Bicycle"=>[MetadataBicycle,"b"],
     "BicycleAlways"=>[MetadataBicycleAlways,"b"],
     "HealingSpot"=>[MetadataHealingSpot,"uuu"],
     "Weather"=>[MetadataWeather,"eu",["","Rain","Storm","Snow","Sandstorm","Sunny"]],
     "MapPosition"=>[MetadataMapPosition,"uuu"],
     "DiveMap"=>[MetadataDiveMap,"u"],
     "DarkMap"=>[MetadataDarkMap,"b"],
     "SafariMap"=>[MetadataSafariMap,"b"],
     "SnapEdges"=>[MetadataSnapEdges,"b"],
     "Dungeon"=>[MetadataDungeon,"b"],
     "BattleBack"=>[MetadataBattleBack,"s"],
     "WildBattleBGM"=>[MetadataMapWildBattleBGM,"s"],
     "TrainerBattleBGM"=>[MetadataMapTrainerBattleBGM,"s"],
     "WildVictoryME"=>[MetadataMapWildVictoryME,"s"],
     "TrainerVictoryME"=>[MetadataMapTrainerVictoryME,"s"],
     "MapSize"=>[MetadataMapSize,"us"],
     "FlightMap"=>[MetadataFlightMap,"u"],
  }
end
Convenient, right? So long as you never edit the metadata via the in-game editor again, I think that's all you need to do for this part. If you do want to use the editor, you'll have to add some options to the PokemonEditor script section - search for "DiveMap" and Surf-Fishing for the two areas you'll need to add stuff to (copy the DiveMap entry and Diving entry respectively, putting them both at the end of their arrays).



Now, the third part: cloning the diving functionality. You'll need to make a new boolean in $PokemonGlobal which indicates that the player is in flight, so search for attr_accessor :diving and stick in an attr_accessor :flight next to it. Scroll down to the def initialize and add @flight=false.

Now you want to find (pretty much) every reference to $PokemonGlobal.diving and add in $PokemonGlobal.flight next to it in one way or another as a clone of whatever diving is doing there. Things to pay attention to are:
  • In pbGetEnvironment, you'll probably want to make flight cause the battle environment to be a new environment rather than underwater. If it was cosmetic there wouldn't actually be a problem making it underwater, but the effects of Dive Ball and a couple of move effects depend on the environment. Making a new battle environment is beyond the scope of this question; if you don't want the hassle (or you won't have any battles in the air), you can just ignore the diving reference in this def.
  • In Kernel.pbUpdateVehicle (the method Nickalooose mentioned), you'll want flight to change the player's character_name to meta[8].
  • All the usage-of-diving code is in the script section PokemonHiddenMoves, and it's up to you to copy-paste it and adapt whichever parts are relevant (the move required for flight, the messages, the required badges if any, etc.).

Usage:

The PlayerA= lines in metadata.txt section 0 now have an extra "comma filename" on the end, which is the filename of the player's flight charset. Each ground-based map can now also have a FlightMap=42 line in its metadata section, where the number is the sky map associated with that ground map (as with dive maps, you don't need/shouldn't have this line for sky maps).

The phrase is "intents and purposes", not "intensive purposes", by the way.
__________________
Reply With Quote
  #4    
Old September 12th, 2013, 06:07 PM
BadSamaritan's Avatar
BadSamaritan
Its time for overtime
 
Join Date: May 2009
Wow Maruno, I really wish you didn't type all that up....I really just wanted to have a general idea of what script sections I'm looking at.

Anyways, I really appreciate all this, I'll definitely use all of it.(it's worth noting I've already had the HM part of it done for a while now)

I have a side question though, one that could prevent all this massive amount of work...

If I were to add strictly the part Nickalooose mentioned(along with the new $PokemonGlobal.flying parts), BUT instead of a new picture, use the same diving picture, and use the "open" 8 directions to the right of it.......essentially if I could just tell it that when the player's vehicle is "flying" to have the x values of the image+64 or whatever.

Does this sound plausible?
Reply With Quote
  #5    
Old September 13th, 2013, 04:21 AM
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
Well, the instructions are there now, if anyone wants to find them in the future.

Quote:
Originally Posted by Rickyboy View Post
I have a side question though, one that could prevent all this massive amount of work...

If I were to add strictly the part Nickalooose mentioned(along with the new $PokemonGlobal.flying parts), BUT instead of a new picture, use the same diving picture, and use the "open" 8 directions to the right of it.......essentially if I could just tell it that when the player's vehicle is "flying" to have the x values of the image+64 or whatever.

Does this sound plausible?
In theory you could do that, but then you'd have to edit the way the auto-animation (the "bobbing") works to make sure it uses the correct frames, which I think is more effort than what I've described.

You can always hardcode the flight charset filenames, though - replace meta[8] with "boyflying", for example. You'd need to make sure you use the appropriate filename for the player's trainer type (i.e. gender).

You can also hardcode the relationships between ground-based maps and sky maps. Doing both these hardcode things means you wouldn't need to muck around with metadata, although it's a bit less user-friendly to work with afterwards. I described how to modify the metadata because, actually, it's not a huge task once you have instructions, and you can more directly copy the Dive code for it.
__________________
Reply With Quote
  #6    
Old September 13th, 2013, 03:04 PM
LenSho's Avatar
LenSho
 
Join Date: Sep 2012
Gender: Male
Nature: Modest
Ohhh, I wanted to do the same, but I had no idea how, so I gave up on it. Thanks so much for this! =D
__________________
Reply With Quote
Reply
Quick Reply

Sponsored Links


Advertise here
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 07:12 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.