Fixes quest icon lingering on map transfers

This commit is contained in:
chardub
2025-03-24 13:11:02 -04:00
parent 91449316d5
commit 4ea80c50da
8 changed files with 30 additions and 6 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -81,6 +81,14 @@ class Scene_Map
$game_switches[SWITCH_ILEX_FOREST_SPOOKED_POKEMON] = false $game_switches[SWITCH_ILEX_FOREST_SPOOKED_POKEMON] = false
end end
def clear_quest_icons()
for sprite in $scene.spriteset.character_sprites
if sprite.is_a?(Sprite_Character) && sprite.questIcon
sprite.removeQuestIcon
end
end
end
def transfer_player(cancelVehicles = true) def transfer_player(cancelVehicles = true)
reset_switches_for_map_transfer() reset_switches_for_map_transfer()
$game_temp.player_transferring = false $game_temp.player_transferring = false
@@ -88,6 +96,7 @@ class Scene_Map
autofade($game_temp.player_new_map_id) autofade($game_temp.player_new_map_id)
pbBridgeOff pbBridgeOff
@spritesetGlobal.playersprite.clearShadows @spritesetGlobal.playersprite.clearShadows
clear_quest_icons()
if $game_map.map_id != $game_temp.player_new_map_id if $game_map.map_id != $game_temp.player_new_map_id
$MapFactory.setup($game_temp.player_new_map_id) $MapFactory.setup($game_temp.player_new_map_id)
end end

View File

@@ -508,3 +508,13 @@ def new_spritepack_was_released()
end end
return false return false
end end
def get_spritecharacter_for_event(event_id)
for sprite in $scene.spriteset.character_sprites
if sprite.character.id == event_id
return sprite
end
end
end

View File

@@ -107,7 +107,7 @@ QUESTS = {
11 => Quest.new(11, "Powering the Lighthouse", "Catch some Voltorb to power up the lighthouse", QuestBranchHotels, "BW (43)", "Vermillion City", HotelQuestColor), 11 => Quest.new(11, "Powering the Lighthouse", "Catch some Voltorb to power up the lighthouse", QuestBranchHotels, "BW (43)", "Vermillion City", HotelQuestColor),
"vermillion_3" => Quest.new("vermillion_3", "Seafood Cocktail ", "Get some steamed Krabby legs from the S.S. Anne's kitchen and bring them back to the hotel before they get cold", QuestBranchHotels, "BW (36)", "Vermillion City", HotelQuestColor), "vermillion_3" => Quest.new("vermillion_3", "Seafood Cocktail ", "Get some steamed Krabby legs from the S.S. Anne's kitchen and bring them back to the hotel before they get cold", QuestBranchHotels, "BW (36)", "Vermillion City", HotelQuestColor),
"vermillion_field_1" => Quest.new("vermillion_field_1", "Building Materials ", "Get some wooden planks from Viridian City and some Bricks from Pewter City.", QuestBranchField, "BW (36)", "Vermillion City", FieldQuestColor), "vermillion_field_1" => Quest.new("vermillion_field_1", "Building Materials ", "Get some wooden planks from Viridian City and some Bricks from Pewter City.", QuestBranchField, "BW (36)", "Vermillion City", FieldQuestColor),
64 => Quest.new(64, "Waiter on the Water", "The S.S. Anne waiter wants you to take restaurant orders while he went to get a replacement cake.", QuestBranchField, "BW (53)", "S.S. Anne", FieldQuestColor), "vermillion_field_2" => Quest.new("vermillion_field_2", "Waiter on the Water", "The S.S. Anne waiter wants you to take restaurant orders while he went to get a replacement cake.", QuestBranchField, "BW (53)", "S.S. Anne", FieldQuestColor),
#Celadon City #Celadon City
14 => Quest.new(14, "Sun or Moon", "Show the Pokémon that Eevee evolves when exposed to a Moon or Sun stone to help the scientist with her research.", QuestBranchHotels, "BW (82)", "Celadon City", HotelQuestColor), 14 => Quest.new(14, "Sun or Moon", "Show the Pokémon that Eevee evolves when exposed to a Moon or Sun stone to help the scientist with her research.", QuestBranchHotels, "BW (82)", "Celadon City", HotelQuestColor),
@@ -203,6 +203,8 @@ def pbAcceptNewQuest(id, bubblePosition = 20, show_description=true)
title = QUESTS[id].name title = QUESTS[id].name
description = QUESTS[id].desc description = QUESTS[id].desc
showNewQuestMessage(title,description,show_description) showNewQuestMessage(title,description,show_description)
character_sprite = get_spritecharacter_for_event(@event_id)
character_sprite.removeQuestIcon if character_sprite
pbAddQuest(id) pbAddQuest(id)
end end
@@ -238,6 +240,9 @@ def finishQuest(id, silent=false)
pbSetQuest(id, true) pbSetQuest(id, true)
character_sprite = get_spritecharacter_for_event(@event_id)
character_sprite.removeQuestIcon if character_sprite
# character_sprite = $scene.spriteset.character_sprites[@event_id] # character_sprite = $scene.spriteset.character_sprites[@event_id]
# echoln character_sprite # echoln character_sprite
# if character_sprite # if character_sprite

View File

@@ -9,9 +9,9 @@ class Sprite_Character
alias questIcon_init initialize alias questIcon_init initialize
def initialize(viewport, character = nil) def initialize(viewport, character = nil)
questIcon_init(viewport,character) questIcon_init(viewport,character)
@quest_switch = detectQuestSwitch(character) quest_id = detectQuestSwitch(character)
if @quest_switch if quest_id
echoln "balablbi #{@quest_switch}" echoln "balablbi #{quest_id}"
addQuestMarkerToSprite addQuestMarkerToSprite
end end
end end
@@ -20,7 +20,7 @@ class Sprite_Character
def update def update
questIcon_update questIcon_update
positionQuestIndicator if @questIcon positionQuestIndicator if @questIcon
removeQuestIcon if @questIcon && isQuestAlreadyAccepted?(@quest_switch) #removeQuestIcon if @questIcon && isQuestAlreadyAccepted?(@quest_switch)
end end
# Event name must contain questNPC(x) for a quest icon to be displayed # Event name must contain questNPC(x) for a quest icon to be displayed

Binary file not shown.