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.
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 RoamingPokemonStorage.ScriptPath <> "" Then
CType(SavedOverworld.OverworldScreen, OverworldScreen).AfterRoamingBattleScript = RoamingPokemonStorage.ScriptPath
End If
Core.Player.RoamingPokemonData = RoamingPokemon.RemoveRoamingPokemon(RoamingPokemonStorage)
Else
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.
''' </summary>
Private ShowControlsDelay As Single = 4.0F
Public AfterRoamingBattleScript As String = ""
#End Region
@ -468,6 +469,10 @@ Public Class OverworldScreen
MusicManager.Play(theme, True) 'remove when debugging music
End If
End If
If AfterRoamingBattleScript <> "" Then
ActionScript.StartScript(AfterRoamingBattleScript, 0,,, "AfterRoamingBattleScript")
AfterRoamingBattleScript = ""
End If
End Sub
''' <summary>

View File

@ -4,6 +4,7 @@ Public Class RoamingPokemon
Public LevelFile As String = ""
Public MusicLoop As String = ""
Public PokemonReference As Pokemon = Nothing
Public ScriptPath As String = ""
Public Sub New(ByVal DataLine As String)
Dim data() As String = DataLine.Split(CChar("|"))
@ -13,6 +14,10 @@ Public Class RoamingPokemon
Me.WorldID = CInt(data(2))
Me.LevelFile = data(3)
Me.MusicLoop = data(4)
If data.Length = 8 Then
ScriptPath = data(7)
End If
End Sub
Public Function CompareData() As String
@ -53,9 +58,14 @@ Public Class RoamingPokemon
If nextIndex > levelList.Count - 1 Then
nextIndex = 0
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
newData &= line
End If
@ -98,7 +108,7 @@ Public Class RoamingPokemon
If line.StartsWith(compareData) = False Then
newData &= line
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
Next

View File

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

View File

@ -682,11 +682,16 @@
p.IsShiny = CBool(data(5))
End If
Dim ScriptPath As String = ""
If data.Length > 6 AndAlso data(6) <> "" Then
ScriptPath = data(6)
End If
If Core.Player.RoamingPokemonData <> "" Then
Core.Player.RoamingPokemonData &= Environment.NewLine
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"
Dim args() As String = argument.Split(CChar(","))
Dim triggerStr As String = "level"