Peach climbing float bug and Peach & Toad climbing lifting fireballs bug fixed script

Description: You made a script? Submit it here to show your creation to the public, share, take reviews, provision of the help and support is here!
Moderators: Lx Xzit, Yoshi021, 5438A38A, Semi-moderatos, Moderators

HengShao M
Topic author, Our friend
Our friend
Avatar
HengShao M
Topic author, Our friend
Our friend
Age: 21
Reputation: 63
Posts: 63
Joined: 8 Jan 2016
Tencent QQ

Post #1by HengShao » 27 Sep 2021, 7:06

Did you know? In 1.4.5, because of unknown reason, Peach can't float at all after jumping out of vine or other climbable objects! And both Peach and Toad can lift a fireball or other weapons they could throw while climbing, at which time they will become transparent, which is abnormal.
Spoiler
This is what happen to Peach or Toad when they lift a fireball while climbing, which shouldn't happen in normal situation.
Image

To fix such bugs in the current version, I wrote this script. After using this script, Peach can float normally after jump out of vine or other climbable objects(Sorry because I don't know exact physic parameters of Peach's floating so Peach's floating may not be very accurate) and both Peach and Toad can't lift and throw fireballs or other weapons they could throw while climbing.
Spoiler
This is how Peach floating looks like after jumping out of vine after using this script.
Image

Just copy code as follows to a new script, and use an event that will start automatically when level begins to call this script. And above mentioned bugs can be fixed! ......Maybe.

Code: Select all

Dim Climb as integer
Dim Float as integer
Dim Judge as integer
Do
   If char(1).id = 2 or char(1).id = 3 Then
      If char(1).climbing = 1 Then
          Char(1).weapon = -1
      Else
         Char(1).weapon = 0
      End If
   End If
   If char(1).id = 2 Then
      If char(1).climbing = 1 Then
         Climb = 1
      End If
      If char(1).climbing = 0 and char(1).stand = 0 and Climb = 1 Then
         Climb = 2
      End If
      If char(1).climbing = 0 and char(1).stand = 1 Then
         Climb = 0
      End If
      If Climb = 2 and keypress(-16) = 0 Then
         Climb = 3
      End If
      If Climb = 3 and keypress(-16) or Judge = 1 Then
         Float += 1
      Elseif Climb = 2 and keypress(-15) and char(1).ysp > 0 or Climb = 3 and keypress(-15) and char(1).ysp > 0 Then
         Judge = 1
      End If
      If Float > 80 or keypress(-16) = 0 and keypress(-15) = 0 and Float > 0 and Float <= 80 or char(1).stand = 1 Then
         Float = 0
         Judge = 0
         If Climb >= 2 Then
             Climb = 0
         End If
      End If
      If Float > 0 and Float <= 80 Then
         char(1).ysp = 0.8*sin(Float*pi/20)
         char(1).ysp -= 0.4
      End If
   End If
    Call Sleep(1)
Loop
2333~ :huaji:
A SMBX-38A project I am working on:
Image

If you're interested in the project above, or just want to discuss SMBX, welcome to the Hel Studio Discord Server~ :
https://discord.gg/YS6bfysduC

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 30
Reputation: 493
Posts: 1747
Joined: 15 Feb 2014
English Pronouns: he/him
Location: Moscow, Russia
Website Youtube channel URL Skype Tencent QQ

Post #2by Wohlstand » 27 Sep 2021, 13:49

I slightly tuned the script making it a bit more accurate:

Code: Select all

Dim Climb as integer
Dim Float as integer
Dim Judge as integer
Do
   If char(1).id = 2 or char(1).id = 3 Then
      If char(1).climbing = 1 Then
         Char(1).weapon = -1
      Else
         Char(1).weapon = 0
      End If
   End If
   If char(1).id = 2 Then
      If char(1).climbing = 1 Then
         Climb = 1
      End If
      If char(1).climbing = 0 and char(1).stand = 0 and Climb = 1 Then
         Climb = 2
      End If
      If char(1).climbing = 0 and char(1).stand = 1 Then
         Climb = 0
      End If
      If Climb = 2 and keypress(-16) = 0 Then
         Climb = 3
      End If
      If Climb = 3 and keypress(-16) or Judge = 1 Then
         Float += 1
      Elseif Climb = 2 and keypress(-15) and char(1).ysp > 0 or Climb = 3 and keypress(-15) and char(1).ysp > 0 Then
         Judge = 1
      End If
      If Float > 65 or keypress(-16) = 0 and keypress(-15) = 0 and Float > 0 and Float <= 65 or char(1).stand = 1 Then
         Float = 0
         Judge = 0
         If Climb >= 2 Then
             Climb = 0
         End If
      End If
      If Float > 0 and Float <= 65 Then
         char(1).ysp = 0.6 * sin(Float * pi / 15)
         char(1).ysp -= 0.3
      End If
   End If
   Call Sleep(1)
Loop

HengShao M
Topic author, Our friend
Our friend
Avatar
HengShao M
Topic author, Our friend
Our friend
Age: 21
Reputation: 63
Posts: 63
Joined: 8 Jan 2016
Tencent QQ

Post #3by HengShao » 27 Sep 2021, 16:20

Wohlstand wrote:I slightly tuned the script making it a bit more accurate:

Code: Select all

Dim Climb as integer
Dim Float as integer
Dim Judge as integer
Do
   If char(1).id = 2 or char(1).id = 3 Then
      If char(1).climbing = 1 Then
         Char(1).weapon = -1
      Else
         Char(1).weapon = 0
      End If
   End If
   If char(1).id = 2 Then
      If char(1).climbing = 1 Then
         Climb = 1
      End If
      If char(1).climbing = 0 and char(1).stand = 0 and Climb = 1 Then
         Climb = 2
      End If
      If char(1).climbing = 0 and char(1).stand = 1 Then
         Climb = 0
      End If
      If Climb = 2 and keypress(-16) = 0 Then
         Climb = 3
      End If
      If Climb = 3 and keypress(-16) or Judge = 1 Then
         Float += 1
      Elseif Climb = 2 and keypress(-15) and char(1).ysp > 0 or Climb = 3 and keypress(-15) and char(1).ysp > 0 Then
         Judge = 1
      End If
      If Float > 65 or keypress(-16) = 0 and keypress(-15) = 0 and Float > 0 and Float <= 65 or char(1).stand = 1 Then
         Float = 0
         Judge = 0
         If Climb >= 2 Then
             Climb = 0
         End If
      End If
      If Float > 0 and Float <= 65 Then
         char(1).ysp = 0.6 * sin(Float * pi / 15)
         char(1).ysp -= 0.3
      End If
   End If
   Call Sleep(1)
Loop
Thank you very much! That can be a lot help!
2333~ :huaji:
A SMBX-38A project I am working on:
Image

If you're interested in the project above, or just want to discuss SMBX, welcome to the Hel Studio Discord Server~ :
https://discord.gg/YS6bfysduC


Return to “Script submission”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest