- 1,224
- Posts
- 11
- Years
- Omnipresence
- Seen Aug 8, 2023
This is a simple two part script that will allow you to apply tones to all events withing specified maps, as well as choosing whether or not to apply this tone to the player as well. This is done by editing the map metadata.
Use this script to account for different color palettes on your tileset, to mimic a lighting effect without having to have multiple npc sheets or having to edit every event.
Firstly, add this script above your Compiler section, but below the Editor section
Then, go into your editor scripts ((broken link removed)), and place the following script above the Compiler section, but below the Editors sections
Over-exaggerated example to prove it works:
Use this script to account for different color palettes on your tileset, to mimic a lighting effect without having to have multiple npc sheets or having to edit every event.
Firstly, add this script above your Compiler section, but below the Editor section
Spoiler:
Code:
MetadataMapTone = 19
module PokemonMetadata
NonGlobalTypes["MapTone"]=[MetadataMapTone,"iiib"]
end
class LimitProperty
alias old_init initialize
def initialize(maxvalue,minvalue=0)
@maxvalue=maxvalue
@minvalue=minvalue
end
alias old_set set
def set(settingname,oldsetting)
oldsetting=1 if !oldsetting
params=ChooseNumberParams.new
params.setNegativesAllowed(true)
params.setRange(@minvalue,@maxvalue)
params.setDefaultValue(oldsetting)
ret=Kernel.pbMessageChooseNumber(
_INTL("Set the value for {1}.",settingname),params)
return ret
end
end
module MapToneProperty
def self.set(settingname,oldsetting)
oldsetting=[0,0,0,false] if !oldsetting
properties=[
[_INTL("Red"),LimitProperty.new(255,-255),
_INTL("The red value of this tone")],
[_INTL("Green"),LimitProperty.new(255,-255),
_INTL("The green value of this tone")],
[_INTL("Blue"),LimitProperty.new(255,-255),
_INTL("The blue value of this tone")],
[_INTL("Apply To Player"),BooleanProperty,
_INTL("If set to true, the tone will apply to the player's sprite on this map as well.")]
]
pbPropertyList(settingname,oldsetting,properties,false)
return oldsetting
end
def self.format(value)
return value.inspect
end
end
class MapScreenScene
LOCALMAPS.push(
["Map Tone",MapToneProperty,
_INTL("Apply a tone to the Events on this map.")
]
)
end
class Spriteset_Map
alias old_init initialize
def initialize(map=nil)
old_init(map)
npctone = pbGetMetadata($game_map.map_id,MetadataMapTone)
if npctone==nil
npctone=[0,0,0,false]
end
for i in @map.events.keys.sort
if !pbEventCommentInput(@map.events[i], 0, "No Tone")
if @character_sprites[i] && (@character_sprites[i]!=$game_player || npctone[3])
@character_sprites[i].tone.set(npctone[0],npctone[1],npctone[2])
end
end
end
end
end
alias old_pbDayNightTint pbDayNightTint
def pbDayNightTint(object)
if !$scene.is_a?(Scene_Map)
return
else
if ENABLESHADING && $game_map && pbGetMetadata($game_map.map_id,MetadataOutdoor)
tone=PBDayNight.getTone()
if pbGetMetadata($game_map.map_id,MetadataMapTone)
applyToPlayer = (pbGetMetadata($game_map.map_id,MetadataMapTone))[3]
else
applyToPlayer=false
end
if object.is_a?(Sprite_Character) && (object.character!=$game_player || applyToPlayer)
npctone = pbGetMetadata($game_map.map_id,MetadataMapTone)
if npctone==nil
npctone=[0,0,0,false]
end
else
npctone= [0,0,0,false]
end
object.tone.set(tone.red+npctone[0],tone.green+npctone[1],tone.blue+npctone[2],tone.gray)
else
if pbGetMetadata($game_map.map_id,MetadataMapTone)
applyToPlayer = (pbGetMetadata($game_map.map_id,MetadataMapTone))[3]
else
applyToPlayer=false
end
if object.is_a?(Sprite_Character) && (object.character!=$game_player || applyToPlayer)
npctone = pbGetMetadata($game_map.map_id,MetadataMapTone)
if npctone==nil
npctone=[0,0,0,false]
end
else
npctone= [0,0,0,false]
end
object.tone.set(npctone[0],npctone[1],npctone[2],0)
end
end
end
Then, go into your editor scripts ((broken link removed)), and place the following script above the Compiler section, but below the Editors sections
Spoiler:
Code:
MetadataMapTone = 19
module PokemonMetadata
NonGlobalTypes["MapTone"]=[MetadataMapTone,"iiib"]
end
class LimitProperty
alias old_init initialize
def initialize(maxvalue,minvalue=0)
@maxvalue=maxvalue
@minvalue=minvalue
end
alias old_set set
def set(settingname,oldsetting)
oldsetting=1 if !oldsetting
params=ChooseNumberParams.new
params.setNegativesAllowed(true)
params.setRange(@minvalue,@maxvalue)
params.setDefaultValue(oldsetting)
ret=Kernel.pbMessageChooseNumber(
_INTL("Set the value for {1}.",settingname),params)
return ret
end
end
module MapToneProperty
def self.set(settingname,oldsetting)
oldsetting=[0,0,0,false] if !oldsetting
properties=[
[_INTL("Red"),LimitProperty.new(255,-255),
_INTL("The red value of this tone")],
[_INTL("Green"),LimitProperty.new(255,-255),
_INTL("The green value of this tone")],
[_INTL("Blue"),LimitProperty.new(255,-255),
_INTL("The blue value of this tone")],
[_INTL("Apply To Player"),BooleanProperty,
_INTL("If set to true, the tone will apply to the player's sprite on this map as well.")]
]
pbPropertyList(settingname,oldsetting,properties,false)
return oldsetting
end
def self.format(value)
return value.inspect
end
end
class MapScreenScene
LOCALMAPS.push(
["Map Tone",MapToneProperty,
_INTL("Apply a tone to the Events on this map.")
]
)
end
Over-exaggerated example to prove it works:
Spoiler:
![[PokeCommunity.com] Apply Tone to Events [PokeCommunity.com] Apply Tone to Events](https://gyazo.com/f90ac826cb633551f6981b094674335e.png)
Last edited: