Implemented script after catch or defeat roamer

This commit is contained in:
JappaWakka 2024-04-02 11:06:33 +02:00
parent 9ffa127999
commit 88d72bb451
5 changed files with 28 additions and 5 deletions

View File

@ -1276,6 +1276,9 @@ nextIndex:
'Shift the Roaming Pokemon. 'Shift the Roaming Pokemon.
If RoamingBattle = True Then If RoamingBattle = True Then
If FieldEffects.RoamingFled = False AndAlso Battle.Fled = False AndAlso Battle.Caught = True Or OppPokemon.HP <= 0 Or OppPokemon.Status = Pokemon.StatusProblems.Fainted Then If FieldEffects.RoamingFled = False AndAlso Battle.Fled = False AndAlso Battle.Caught = True Or OppPokemon.HP <= 0 Or OppPokemon.Status = Pokemon.StatusProblems.Fainted Then
If RoamingPokemonStorage.ScriptPath <> "" Then
CType(SavedOverworld.OverworldScreen, OverworldScreen).AfterRoamingBattleScript = RoamingPokemonStorage.ScriptPath
End If
Core.Player.RoamingPokemonData = RoamingPokemon.RemoveRoamingPokemon(RoamingPokemonStorage) Core.Player.RoamingPokemonData = RoamingPokemon.RemoveRoamingPokemon(RoamingPokemonStorage)
Else Else
Core.Player.RoamingPokemonData = RoamingPokemon.ReplaceRoamingPokemon(RoamingPokemonStorage) Core.Player.RoamingPokemonData = RoamingPokemon.ReplaceRoamingPokemon(RoamingPokemonStorage)

View File

@ -24,6 +24,7 @@ Public Class OverworldScreen
''' The delay until the XBOX buttons get shown since the player last pressed a button. ''' The delay until the XBOX buttons get shown since the player last pressed a button.
''' </summary> ''' </summary>
Private ShowControlsDelay As Single = 4.0F Private ShowControlsDelay As Single = 4.0F
Public AfterRoamingBattleScript As String = ""
#End Region #End Region
@ -468,6 +469,10 @@ Public Class OverworldScreen
MusicManager.Play(theme, True) 'remove when debugging music MusicManager.Play(theme, True) 'remove when debugging music
End If End If
End If End If
If AfterRoamingBattleScript <> "" Then
ActionScript.StartScript(AfterRoamingBattleScript, 0,,, "AfterRoamingBattleScript")
AfterRoamingBattleScript = ""
End If
End Sub End Sub
''' <summary> ''' <summary>

View File

@ -4,6 +4,7 @@ Public Class RoamingPokemon
Public LevelFile As String = "" Public LevelFile As String = ""
Public MusicLoop As String = "" Public MusicLoop As String = ""
Public PokemonReference As Pokemon = Nothing Public PokemonReference As Pokemon = Nothing
Public ScriptPath As String = ""
Public Sub New(ByVal DataLine As String) Public Sub New(ByVal DataLine As String)
Dim data() As String = DataLine.Split(CChar("|")) Dim data() As String = DataLine.Split(CChar("|"))
@ -13,6 +14,10 @@ Public Class RoamingPokemon
Me.WorldID = CInt(data(2)) Me.WorldID = CInt(data(2))
Me.LevelFile = data(3) Me.LevelFile = data(3)
Me.MusicLoop = data(4) Me.MusicLoop = data(4)
If data.Length = 8 Then
ScriptPath = data(7)
End If
End Sub End Sub
Public Function CompareData() As String Public Function CompareData() As String
@ -53,9 +58,14 @@ Public Class RoamingPokemon
If nextIndex > levelList.Count - 1 Then If nextIndex > levelList.Count - 1 Then
nextIndex = 0 nextIndex = 0
End If End If
If data.Length = 7 Then
'PokémonID,Level,regionID,startLevelFile,MusicLoop,Shiny,PokemonData,ScriptPath
newData &= data(0) & "|" & data(1) & "|" & CInt(data(2)).ToString() & "|" & levelList(nextIndex) & "|" & data(4) & "|" & data(5) & "|" & data(6) & "|"
Else
'PokémonID,Level,regionID,startLevelFile,MusicLoop,Shiny,PokemonData,ScriptPath
newData &= data(0) & "|" & data(1) & "|" & CInt(data(2)).ToString() & "|" & levelList(nextIndex) & "|" & data(4) & "|" & data(5) & "|" & data(6) & "|" & data(7)
End If
'PokémonID,Level,regionID,startLevelFile,MusicLoop,Shiny,PokemonData
newData &= data(0) & "|" & data(1) & "|" & CInt(data(2)).ToString() & "|" & levelList(nextIndex) & "|" & data(4) & "|" & data(5) & "|" & data(6)
Else Else
newData &= line newData &= line
End If End If
@ -98,7 +108,7 @@ Public Class RoamingPokemon
If line.StartsWith(compareData) = False Then If line.StartsWith(compareData) = False Then
newData &= line newData &= line
Else Else
newData &= p.PokemonReference.Number & "|" & p.PokemonReference.Level & "|" & p.WorldID.ToString() & "|" & p.LevelFile & "|" & p.MusicLoop & "|" & p.PokemonReference.IsShiny & "|" & p.PokemonReference.GetSaveData() newData &= p.PokemonReference.Number & "|" & p.PokemonReference.Level & "|" & p.WorldID.ToString() & "|" & p.LevelFile & "|" & p.MusicLoop & "|" & p.PokemonReference.IsShiny & "|" & p.PokemonReference.GetSaveData() & "|" & p.ScriptPath
End If End If
Next Next

View File

@ -108,7 +108,7 @@ Public Class Spawner
Dim possibleEncounters As New List(Of String) Dim possibleEncounters As New List(Of String)
For Each cLine As String In roamingData For Each cLine As String In roamingData
If cLine <> "" And cLine.CountSeperators("|") = 6 Then If cLine <> "" And cLine.CountSeperators("|") >= 6 Then
possibleEncounters.Add(cLine) possibleEncounters.Add(cLine)
End If End If
Next Next

View File

@ -682,11 +682,16 @@
p.IsShiny = CBool(data(5)) p.IsShiny = CBool(data(5))
End If End If
Dim ScriptPath As String = ""
If data.Length > 6 AndAlso data(6) <> "" Then
ScriptPath = data(6)
End If
If Core.Player.RoamingPokemonData <> "" Then If Core.Player.RoamingPokemonData <> "" Then
Core.Player.RoamingPokemonData &= Environment.NewLine Core.Player.RoamingPokemonData &= Environment.NewLine
End If End If
Core.Player.RoamingPokemonData &= data(0) & "|" & data(1) & "|" & data(2) & "|" & data(3) & "|" & data(4) & "|" & p.IsShiny & "|" & p.GetSaveData() Core.Player.RoamingPokemonData &= data(0) & "|" & data(1) & "|" & data(2) & "|" & data(3) & "|" & data(4) & "|" & p.IsShiny & "|" & p.GetSaveData() & "|" & ScriptPath
Case "evolve" Case "evolve"
Dim args() As String = argument.Split(CChar(",")) Dim args() As String = argument.Split(CChar(","))
Dim triggerStr As String = "level" Dim triggerStr As String = "level"