TeaScript Help Thread

Description: Internal scripting system of SMBX-38A Engine based on the simple VB-like language
Moderators: Lx Xzit, Yoshi021, 5438A38A, Moderators, Semi-moderatos

Yoshi021 M
Topic author, Moderator
Moderator
Avatar
Yoshi021 M
Topic author, Moderator
Moderator
Age: 18
Reputation: 120
Posts: 667
Joined: 15 Feb 2016
Location: Yoshi's Island

Post #1by Yoshi021 » 15 Aug 2016, 4:16

This is the thread where you ask questions regarding code you are making. It can be from errors that you can't solve in your code or asking about system values. Make sure when responding to a question, you quote the person you're helping that way people know who are being helped.
Links
ImageImageImage
Image
Image
"Going to University is FUN!" :pardon:

Super Mario Player M
Duke
Duke
Avatar
Super Mario Player M
Duke
Duke
Reputation: 25
Posts: 135
Joined: 23 Jun 2016
Location: The sewers (fixing teh pipes)
Tencent QQ

Glitch with the .Ysp and .Xsp for NPCs and players

Post #2by Super Mario Player » 19 Aug 2016, 23:25

I've noticed that when I put either of these six lines of code in a script:

Code: Select all

NPC(sysval(param1)).Xsp=0
NPC(sysval(param1)).Ysp=0
Char(1).Xsp=0
Char(1).Ysp=0
Char(2).Xsp=0
Char(2).Ysp=0

It doesn't work perfectly, the NPCs still move a bit downwards if they're in the air and the players are still able to move (with reduced speed though).
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

Yoshi021 M
Topic author, Moderator
Moderator
Avatar
Yoshi021 M
Topic author, Moderator
Moderator
Age: 18
Reputation: 120
Posts: 667
Joined: 15 Feb 2016
Location: Yoshi's Island

Post #3by Yoshi021 » 19 Aug 2016, 23:29

Super Mario Player wrote:I've noticed that when I put either of these six lines of code in a script:

Code: Select all

NPC(sysval(param1)).Xsp=0
NPC(sysval(param1)).Ysp=0
Char(1).Xsp=0
Char(1).Ysp=0
Char(2).Xsp=0
Char(2).Ysp=0

It doesn't work perfectly, the NPCs still move a bit downwards if they're in the air and the players are still able to move (with reduced speed though).

I think in order to make an npc levitate and not fall you have to put like ~ .3 in the Yspeed.
If you want the players to stop moving, Go to Events -> Others -> Player Controls and lock the controls from there.
Remember that Xsp=0 Ysp=0 does not override the current speed, instead it adds to the current speed.
Links
ImageImageImage
Image
Image
"Going to University is FUN!" :pardon:

MarioKirby101
Honourable citizen
Honourable citizen
Avatar
MarioKirby101
Honourable citizen
Honourable citizen
Reputation: 6
Posts: 38
Joined: 8 Aug 2016

Making a thrown NPC kill NPCs it comes into contact with other NPCs

Post #4by MarioKirby101 » 20 Aug 2016, 5:15

I'm trying to make a custom power-up but the NPC that Mario throws doesn't kill NPCs it hits...

Yoshi021 M
Topic author, Moderator
Moderator
Avatar
Yoshi021 M
Topic author, Moderator
Moderator
Age: 18
Reputation: 120
Posts: 667
Joined: 15 Feb 2016
Location: Yoshi's Island

Post #5by Yoshi021 » 20 Aug 2016, 5:24

MarioKirby101 wrote:I'm trying to make a custom power-up but the NPC that Mario throws doesn't kill NPCs it hits...
What NPC are you using?
Links
ImageImageImage
Image
Image
"Going to University is FUN!" :pardon:

MarioKirby101
Honourable citizen
Honourable citizen
Avatar
MarioKirby101
Honourable citizen
Honourable citizen
Reputation: 6
Posts: 38
Joined: 8 Aug 2016

Post #6by MarioKirby101 » 20 Aug 2016, 5:26

Yoshi021 wrote:
MarioKirby101 wrote:I'm trying to make a custom power-up but the NPC that Mario throws doesn't kill NPCs it hits...
What NPC are you using?
I'm using the NPC Mario throws with the Hammer Suit.
The script only affects the NPC's movement, it's moving fine but has no collision at all.

Yoshi021 M
Topic author, Moderator
Moderator
Avatar
Yoshi021 M
Topic author, Moderator
Moderator
Age: 18
Reputation: 120
Posts: 667
Joined: 15 Feb 2016
Location: Yoshi's Island

Post #7by Yoshi021 » 20 Aug 2016, 5:27

MarioKirby101 wrote:
Yoshi021 wrote:
MarioKirby101 wrote:I'm trying to make a custom power-up but the NPC that Mario throws doesn't kill NPCs it hits...
What NPC are you using?
I'm using the NPC Mario throws with the Hammer Suit.
The script only affects the NPC's movement, it's moving fine but has no collision at all.
What is the code exactly?
Links
ImageImageImage
Image
Image
"Going to University is FUN!" :pardon:

MarioKirby101
Honourable citizen
Honourable citizen
Avatar
MarioKirby101
Honourable citizen
Honourable citizen
Reputation: 6
Posts: 38
Joined: 8 Aug 2016

Post #8by MarioKirby101 » 20 Aug 2016, 5:42

Yoshi021 wrote:
MarioKirby101 wrote:
Yoshi021 wrote:
MarioKirby101 wrote:I'm trying to make a custom power-up but the NPC that Mario throws doesn't kill NPCs it hits...
What NPC are you using?
I'm using the NPC Mario throws with the Hammer Suit.
The script only affects the NPC's movement, it's moving fine but has no collision at all.
What is the code exactly?

With npc(sysval(Param1))
.Ysp = 0
NKill(-1,1,1,16,8,0,1,1)
End with

It moved fine with just the .Ysp = 0, but since it wasn't hurting anything I added the only thing I could find on killing... also, for the 2nd and 3rd values I tried using .X and .Y but it got an error, same with the current one. I can't figure out some stuff in this help file...

Yoshi021 M
Topic author, Moderator
Moderator
Avatar
Yoshi021 M
Topic author, Moderator
Moderator
Age: 18
Reputation: 120
Posts: 667
Joined: 15 Feb 2016
Location: Yoshi's Island

Post #9by Yoshi021 » 20 Aug 2016, 6:01

MarioKirby101 wrote:With npc(sysval(Param1))
.Ysp = 0
NKill(-1,1,1,16,8,0,1,1)
End with

It moved fine with just the .Ysp = 0, but since it wasn't hurting anything I added the only thing I could find on killing... also, for the 2nd and 3rd values I tried using .X and .Y but it got an error, same with the current one. I can't figure out some stuff in this help file...
That is weird, what are the exact modifications you want to do with the hammer, since it automatically kills enemies by default.
Links
ImageImageImage
Image
Image
"Going to University is FUN!" :pardon:

MarioKirby101
Honourable citizen
Honourable citizen
Avatar
MarioKirby101
Honourable citizen
Honourable citizen
Reputation: 6
Posts: 38
Joined: 8 Aug 2016

Post #10by MarioKirby101 » 20 Aug 2016, 7:15

Yoshi021 wrote:
MarioKirby101 wrote:With npc(sysval(Param1))
.Ysp = 0
NKill(-1,1,1,16,8,0,1,1)
End with

It moved fine with just the .Ysp = 0, but since it wasn't hurting anything I added the only thing I could find on killing... also, for the 2nd and 3rd values I tried using .X and .Y but it got an error, same with the current one. I can't figure out some stuff in this help file...
That is weird, what are the exact modifications you want to do with the hammer, since it automatically kills enemies by default.
Just it's movement. It also doesn't collide with blocks even with npc texts.

Super Mario Player M
Duke
Duke
Avatar
Super Mario Player M
Duke
Duke
Reputation: 25
Posts: 135
Joined: 23 Jun 2016
Location: The sewers (fixing teh pipes)
Tencent QQ

Post #11by Super Mario Player » 20 Aug 2016, 9:50

Yoshi021 wrote:
Super Mario Player wrote:I've noticed that when I put either of these six lines of code in a script:

Code: Select all

NPC(sysval(param1)).Xsp=0
NPC(sysval(param1)).Ysp=0
Char(1).Xsp=0
Char(1).Ysp=0
Char(2).Xsp=0
Char(2).Ysp=0

It doesn't work perfectly, the NPCs still move a bit downwards if they're in the air and the players are still able to move (with reduced speed though).

I think in order to make an npc levitate and not fall you have to put like ~ .3 in the Yspeed.
If you want the players to stop moving, Go to Events -> Others -> Player Controls and lock the controls from there.
Remember that Xsp=0 Ysp=0 does not override the current speed, instead it adds to the current speed.
Thanks!
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

MarioKirby101
Honourable citizen
Honourable citizen
Avatar
MarioKirby101
Honourable citizen
Honourable citizen
Reputation: 6
Posts: 38
Joined: 8 Aug 2016

Post #12by MarioKirby101 » 20 Aug 2016, 22:06

Super Mario Player wrote:
Yoshi021 wrote:
Super Mario Player wrote:I've noticed that when I put either of these six lines of code in a script:

Code: Select all

NPC(sysval(param1)).Xsp=0
NPC(sysval(param1)).Ysp=0
Char(1).Xsp=0
Char(1).Ysp=0
Char(2).Xsp=0
Char(2).Ysp=0

It doesn't work perfectly, the NPCs still move a bit downwards if they're in the air and the players are still able to move (with reduced speed though).

I think in order to make an npc levitate and not fall you have to put like ~ .3 in the Yspeed.
If you want the players to stop moving, Go to Events -> Others -> Player Controls and lock the controls from there.
Remember that Xsp=0 Ysp=0 does not override the current speed, instead it adds to the current speed.
Thanks!
That's not my problem...

Yoshi021 M
Topic author, Moderator
Moderator
Avatar
Yoshi021 M
Topic author, Moderator
Moderator
Age: 18
Reputation: 120
Posts: 667
Joined: 15 Feb 2016
Location: Yoshi's Island

Post #13by Yoshi021 » 20 Aug 2016, 22:15

MarioKirby101 wrote:That's not my problem...
What? This is the Help Thread, on your problem, what movement modifications are you trying to do because hammers kill enemies by default.
Links
ImageImageImage
Image
Image
"Going to University is FUN!" :pardon:

MarioKirby101
Honourable citizen
Honourable citizen
Avatar
MarioKirby101
Honourable citizen
Honourable citizen
Reputation: 6
Posts: 38
Joined: 8 Aug 2016

Post #14by MarioKirby101 » 21 Aug 2016, 5:15

Yoshi021 wrote:
MarioKirby101 wrote:That's not my problem...
What? This is the Help Thread, on your problem, what movement modifications are you trying to do because hammers kill enemies by default.
It's moving exactly how I want it to, nut it's not hitting anything. It's supposed to move forward and kill enemies, but all it's doing is moving forward.

MarioKirby101
Honourable citizen
Honourable citizen
Avatar
MarioKirby101
Honourable citizen
Honourable citizen
Reputation: 6
Posts: 38
Joined: 8 Aug 2016

Changing Global variables to that of a Local variable?

Post #15by MarioKirby101 » 6 Sep 2016, 7:05

Here's the code I'm using...
If val(CurrentHighScore) > gval(HighScore) then
gval(HighScore) = val(CurrentHighScore)
End If
Seems like that would work but it doesn't change the high score global variable at all. Please help!

Yoshi021 M
Topic author, Moderator
Moderator
Avatar
Yoshi021 M
Topic author, Moderator
Moderator
Age: 18
Reputation: 120
Posts: 667
Joined: 15 Feb 2016
Location: Yoshi's Island

Post #16by Yoshi021 » 7 Sep 2016, 2:35

I recreated what you said in this test level.

Code: Select all

if val(HighScore) < val(Score) then
val(HighScore) = val(Score)
end if

Did you make an event that runs the script whenever your minigame si finished?
Attachments
Score.lvl
(13.85 KiB) Downloaded 56 times
Links
ImageImageImage
Image
Image
"Going to University is FUN!" :pardon:

MarioKirby101
Honourable citizen
Honourable citizen
Avatar
MarioKirby101
Honourable citizen
Honourable citizen
Reputation: 6
Posts: 38
Joined: 8 Aug 2016

Post #17by MarioKirby101 » 14 Sep 2016, 5:50

Yes, my problem is that [yes, yours works] it doesn't seem to work with global variables. I need to set the value of an in level variable to that of a global variable so that it saves and crosses over to other levels.
Sorry for late response.

BolanoGustavo
Our friend
Our friend
BolanoGustavo
Our friend
Our friend
Reputation: 7
Posts: 58
Joined: 18 Aug 2016

Post #18by BolanoGustavo » 10 Oct 2016, 15:58

someone can help me with these scripts to the ground pound koopa

Code: Select all

With npc(sysval(Param1))
If .health < .ivalc Then
.ivalb = 5
.ivalc = 0
.advset = 1
End if
If .advset = 0 Then
If .ivala mod 6 = 0 Then
Select case .ivalb
case 1
.ivalb = 2
case 2
.ivalb = 1
case 0
.ivalb = 1
End Select
End if
If .ivala = 0 Then
Select case Rnd
case 0 to 0.5
.Xsp = 1.2
case else
.Xsp = -1.2
End Select
End if
.Ysp = .Ysp + 0.26
If .Ysp >= 8 Then
.Ysp = 8
End if
.ivalc = .health
.ivala = .ivala + 1
.curframe = .ivalb
If .Ysp = 0.26 Then
End if
If .ivala => 50 Then
If .ivala = 50 Then
.Ysp = -3
If .facing = 1 Then
Elseif .facing = 0 Then
End if
End if
.curframe = 3
.Xsp = 0
If .Ysp = 0.26 Then
Call FXCreate(10,.X,.Y+42,5,0,15,4,0,1,0)
Call FXCreate(10,.X,.Y+42,-5,0,15,4,0,1,0)
Select case Rnd
case 0 to 0.5
.Xsp = 1.2
case else
.Xsp = 1.2
End Select
.curframe = 1
.ivala = 0
End if
End if
Elseif .advset > 0 Then
If .advset = 1 Then
.advset = .ivala
End if
.Ysp = 0
.Xsp = 0
.curframe = .ivalb
.ivala = .ivala + 1
If .ivala mod 3 = 0 Then
Select case .ivalb
case 4
.ivalb = 5
case 5
.ivalb = 4
case else
.ivalb = 4
End Select
End if
If .ivala > .advset + 30 Then
.ivala = .advset
.ivalb = 1
.ivalc = 0
Select case Rnd
case 0 to 0.5
.Xsp = -1.2
case else
.Xsp = 1.2
End Select
.advset = 0
End if
End if
End With

Prado M
Honourable citizen
Honourable citizen
Avatar
Prado M
Honourable citizen
Honourable citizen
Age: 18
Reputation: 2
Posts: 49
Joined: 14 Sep 2015
Location: Brazil

LSpin angular speed measurement unit?

Post #19by Prado » 16 Oct 2016, 3:00

What is the measurement unit for the angular speed in LSpin(layerName, cx, cy, angularSpeed)?

Example, radians/sec
Discord server to play SMBX online via Parsec!

https://discord.gg/FftYYMv

andreepika1336
Our friend
Our friend
andreepika1336
Our friend
Our friend
Reputation: 8
Posts: 71
Joined: 2 Jun 2015

Post #20by andreepika1336 » 29 Jun 2017, 21:19

How do I make the scripted npc to spawn these npcs but they are not in Spawned NPCs Layers?


Return to “TeaScript”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest