- 15
- Posts
- 6
- Years
- Seen Aug 22, 2021
I want to be able to set/change map specific data so I added a custom Metadata type.
Changes made to the script Misc_Data
I added a custom script PBDefaultTerrain which has the same format as PBEnvironment
Calling the method pbGetMetadata($game_map.map_id,MetadataDefaultTerrain) returns an integer and I've testing that everything works as intended.
My question is what other script changes do I need to make to be able to edit my added metadata type using debug inside the information editor. The list of metadata that you can edit ends with Environment and follows the order of defined metadata. The only way I can define "DefaultTerrain" is manually typing it out in the metadata PBS which while doable, is very prone to misspelling and overall slower. (DefaultTerrain = ElectricT) I tried looking through the editor scripts but didn't find a clear solution. Maybe it has something to do with how I defined the metadata because there are strings that have an unclear purpose [MetadataMapSize, "us"] <- "us" in this example. I used "e" hoping to be able to edit in the same manner as PBEnvironment.
It's fine if this doesn't get resolved but it would be helpful for quality of life purposes.
If anyone's curious why I added a new metadata type called default terrain
Inspired by Reborn and Rejunivation, I wanted to add custom terrains / field effects. I wasn't sure how to set up a default terrain in the same way those games do but upon looking through scripts I discovered a method
that sets up a permanent terrain in a similar way to R&R. All I did was find where that was called and add some conditions that change the default terrain based on metadata. R&R change the battle background depending on terrain but I'm adding animations to show that a terrain is in effect, similar to how weather displays. I wanted my terrains to not overtake the background but instead similar to how SWSH treats the terrain visual as an accessory.
Changes made to the script Misc_Data
Code:
#===============================================================================
# Global and map metadata
#===============================================================================
MetadataHome = 1
...
MetadataMapSize = 19
MetadataEnvironment = 20
MetadataDefaultTerrain = 21 #My Change
module PokemonMetadata
GlobalTypes = {
...
}
NonGlobalTypes = {
...
"MapSize" => [MetadataMapSize, "us"],
"Environment" => [MetadataEnvironment, "e", :PBEnvironment],
"DefaultTerrain" => [MetadataDefaultTerrain, "e", :PBDefaultTerrain] #My Change
}
end
I added a custom script PBDefaultTerrain which has the same format as PBEnvironment
Code:
begin
module PBDefaultTerrain
None = 0
ElectricT = 1
GrassyT = 2
MistyT = 3
PsychicT = 4
def self.maxValue; return 4; end
end
rescue Exception
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
raise $!
end
end
Calling the method pbGetMetadata($game_map.map_id,MetadataDefaultTerrain) returns an integer and I've testing that everything works as intended.
My question is what other script changes do I need to make to be able to edit my added metadata type using debug inside the information editor. The list of metadata that you can edit ends with Environment and follows the order of defined metadata. The only way I can define "DefaultTerrain" is manually typing it out in the metadata PBS which while doable, is very prone to misspelling and overall slower. (DefaultTerrain = ElectricT) I tried looking through the editor scripts but didn't find a clear solution. Maybe it has something to do with how I defined the metadata because there are strings that have an unclear purpose [MetadataMapSize, "us"] <- "us" in this example. I used "e" hoping to be able to edit in the same manner as PBEnvironment.
It's fine if this doesn't get resolved but it would be helpful for quality of life purposes.
If anyone's curious why I added a new metadata type called default terrain
Spoiler:
Inspired by Reborn and Rejunivation, I wanted to add custom terrains / field effects. I wasn't sure how to set up a default terrain in the same way those games do but upon looking through scripts I discovered a method
Code:
battle.defaultTerrain