[Tea-Script] Boost Blocks

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: Yoshi021, Lx Xzit, 5438A38A, TepigFan101, Moderators

Super Mario Player M
Topic author, Duke
Duke
Avatar
Super Mario Player M
Topic author, Duke
Duke
Reputation: 21
Posts: 128
Joined: 23 Jun 2016
Location: Socialist Federative Soviet Republic of the Mushrooms
Tencent QQ

Post #1by Super Mario Player » 21 Sep 2016, 16:25

This script allows you to use the Boost Blocks from NSMBU.

Spoiler

Original link: https://vimeo.com/183651677



phpBB [youtube]

Original link: https://youtu.be/wrMI5KKsvlc


This is quite complex and it uses five scripts slots in total, 8 variables (2 of them can be given custom values) and one 'Click Script' liquid.
You need custom graphics for the Boost Blocks; you can use the ones I put in my example level, they were made by Squishy Rex. If you use custom ones, make sure to use the same NPCs as me and to set them the same way.

How to use it:
1- Create a new event called 'Sound FX' and in the 'Effects' tab of the Event editor, select in 'Play Sound' the SFX you want to be played when a Block is created.

2- Create 8 variables: blocks, blockstotal, timerred, timergreen, timerblue, timerpink, blockduration and blinkduration. The two variables that can be set are blockduration, which stands for the delay before the block vanishes (in frames), and blinkduration which stands for the time left when the block starts blinking before vanishing, e.g.: if you choose it to be equal to 150, then the block will start blinking 150 frames before it disappears.

3- Create five scripts and give them the titles you want. I personally called them respectively Block, RedBlock, GreenBlock, BlueBlock and PinkBlock.

4- In the Script "Block", type the following:

Code: Select all

if val(blockstotal)<4 then
Call TCreate(Sound FX,1)
val(blockstotal)=val(blockstotal)+1
'NCreate(id, x, y, sx, sy, advset, cdata)
if val(blocks)=0 then
Call NCreate(80,sysval(Player1scrX)+Keypress(-1)-48,sysval(Player1scrY)+Keypress(-2)-16,0,0,325,0)
val(blocks)=1
val(timerred)=val(blockduration)
elseif val(blocks)=1 then
Call NCreate(79,sysval(Player1scrX)+Keypress(-1)-48,sysval(Player1scrY)+Keypress(-2)-16,0,0,325,0)
val(blocks)=2
val(timergreen)=val(blockduration)
elseif val(blocks)=2 then
Call NCreate(67,sysval(Player1scrX)+Keypress(-1)-48,sysval(Player1scrY)+Keypress(-2)-16,0,0,325,0)
val(blocks)=3
val(timerblue)=val(blockduration)
elseif val(blocks)=3 then
Call NCreate(83,sysval(Player1scrX)+Keypress(-1)-48,sysval(Player1scrY)+Keypress(-2),0,0,325,0)
val(blocks)=0
val(timerpink)=val(blockduration)
end if
end if


In "RedBlock":

Code: Select all

'NKill(index, rx, ry, rw, rh, id, effect, score)
with npc(sysval(param1))
   if val(timerred)>0 then 'and .X>=sysval(Player1scrX)-96 and .Y>=sysval(Player1scrY)-32 and .X<sysval(Player1scrX)+800 and .Y<sysval(Player1scrY)+600 then
      val(timerred)=val(timerred)-1
      if val(timerred)<val(blinkduration) then
         select case .curframe
         case 1
            .curframe=2
         case else
            .curframe=1
         end select
      end if
   else
      val(blockstotal)=val(blockstotal)-1
      call NKill(-1,.X,.Y,2,2,.ID,0,0)
   end if
end with


In "GreenBlock":

Code: Select all

'NKill(index, rx, ry, rw, rh, id, effect, score)
with npc(sysval(param1))
   if val(timergreen)>0 then 'and .X>=sysval(Player1scrX)-96 and .Y>=sysval(Player1scrY)-32 and .X<sysval(Player1scrX)+800 and .Y<sysval(Player1scrY)+600 then
      val(timergreen)=val(timergreen)-1
      if val(timergreen)<val(blinkduration) then
         select case .curframe
         case 1
            .curframe=2
         case else
            .curframe=1
         end select
      end if
   else
      val(blockstotal)=val(blockstotal)-1
      call NKill(-1,.X,.Y,2,2,.ID,0,0)
   end if
end with


In "BlueBlock":

Code: Select all

'NKill(index, rx, ry, rw, rh, id, effect, score)
with npc(sysval(param1))
   if val(timerblue)>0 then 'and .X>=sysval(Player1scrX)-96 and .Y>=sysval(Player1scrY)-32 and .X<sysval(Player1scrX)+800 and .Y<sysval(Player1scrY)+600 then
      val(timerblue)=val(timerblue)-1
      if val(timerblue)<val(blinkduration) then
         select case .curframe
         case 1
            .curframe=2
         case else
            .curframe=1
         end select
      end if
   else
      val(blockstotal)=val(blockstotal)-1
      call NKill(-1,.X,.Y,2,2,.ID,0,0)
   end if
end with


And in "PinkBlock":

Code: Select all

'NKill(index, rx, ry, rw, rh, id, effect, score)
with npc(sysval(param1))
   if val(timerpink)>0 then 'and .X>=sysval(Player1scrX)-96 and .Y>=sysval(Player1scrY)-32 and .X<sysval(Player1scrX)+800 and .Y<sysval(Player1scrY)+600 then
      val(timerpink)=val(timerpink)-1
      if val(timerpink)<val(blinkduration) then
         select case .curframe
         case 1
            .curframe=2
         case else
            .curframe=1
         end select
      end if
   else
      val(blockstotal)=val(blockstotal)-1
      call NKill(-1,.X,.Y,2,2,.ID,0,0)
   end if
end with


5- Create a new Layer called "Att-Screen(*)", note that you can replace the "*" by any valid character.

6- Create a liquid of type 'Click Script' and set it to activate the script "Block". Make sure that it belongs to the layer "Att-Screen(*)".
EDIT: Forgot to mention: do not forget to resize it and to give it at least the size of the screen –at least 800x600 pixels!

7- Save your level, and put your GFX for the Boost Blocks, as well as the TXT files, where you normally would - in a folder with the same name and in the same directory as your level.

8- Finally, right-click the icons of the NPCs you used for the different-colored Boost Blocks and for each of them, go to the 'Behaviors' tab, and in 'Scripts' select "PinkBlock" for the pink block, "BlueBlock" for the blue one, etc.

I hope I explained correctly, if it doesn't work you can post your problem here, also make sure you have the last patch & the last version of SMBX 1.4.
Download the example level:
Boost Blocks.zip
(24.87 KiB) Downloaded 163 times


Almost forgot: don't create a Boost Block right where Mario is, or else it will kill him. :mad: And by the way, there are unused lines in scripts RedBlock, GreenBlock, BlueBlock and PinkBlock: it deletes the blocks whenever they get offscreen. It is disabled by default, to enable it, in line 3 in the concerned scripts, delete the then ' at the end of the line for each script.

Hope this is gonna be useful :) - BTW, I'll use it in my project, The Fortress of Challenges.
Last edited by Super Mario Player on 23 Oct 2016, 19:00, edited 3 times in total.
My current project:
Spoiler
The Legend of Zelda: The Curse of the Wise Men
Image

The Tower of Challenges

Languages I speak (if you want to PM me):
Spoiler
Image Image Image

Click to see my YouTube channel
Image

HugoMDM
Honourable citizen
Honourable citizen
Avatar
HugoMDM
Honourable citizen
Honourable citizen
Reputation: 10
Posts: 36
Joined: 17 Apr 2016

Post #2by HugoMDM » 30 Sep 2016, 3:23

don't work in custom size of the level, help me :SOS:
Visit my YouTube Channel: HugoMDM

Image

Super Mario Player M
Topic author, Duke
Duke
Avatar
Super Mario Player M
Topic author, Duke
Duke
Reputation: 21
Posts: 128
Joined: 23 Jun 2016
Location: Socialist Federative Soviet Republic of the Mushrooms
Tencent QQ

Post #3by Super Mario Player » 30 Sep 2016, 8:26

HugoMDM wrote:don't work in custom size of the level, help me :SOS:
What does not work, can you be a little more precise?
EDIT: Do you mean it works only in the first screen of the level? Then, make sure you have created a 'Click Script' type liquid and it is not in the 'Default' layer but in the layer 'Att-Screen(*)' (if it doesn't exist, create it; also, in the name of the layer 'Att-Screen(*)', you can replace the * by any valid character), then place it in the top-left corner of the start screen (the screen where the player is when the level starts). Then it should work.
Spoiler
Image
Last edited by Super Mario Player on 14 Jan 2017, 21:40, edited 1 time in total.
My current project:
Spoiler
The Legend of Zelda: The Curse of the Wise Men
Image

The Tower of Challenges

Languages I speak (if you want to PM me):
Spoiler
Image Image Image

Click to see my YouTube channel
Image

HugoMDM
Honourable citizen
Honourable citizen
Avatar
HugoMDM
Honourable citizen
Honourable citizen
Reputation: 10
Posts: 36
Joined: 17 Apr 2016

Post #4by HugoMDM » 2 Oct 2016, 5:27

I do not need help, I can already solve the problem, tanks :SOS:
Visit my YouTube Channel: HugoMDM

Image


Return to “Script submission”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest