Page 1 of 3

TeaScript Help Thread

Posted: 15 Aug 2016, 4:16
by Yoshi021
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.

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

Posted: 19 Aug 2016, 23:25
by Super Mario Player
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).

Posted: 19 Aug 2016, 23:29
by Yoshi021
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.

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

Posted: 20 Aug 2016, 5:15
by MarioKirby101
I'm trying to make a custom power-up but the NPC that Mario throws doesn't kill NPCs it hits...

Posted: 20 Aug 2016, 5:24
by Yoshi021
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?

Posted: 20 Aug 2016, 5:26
by MarioKirby101
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.

Posted: 20 Aug 2016, 5:27
by Yoshi021
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?

Posted: 20 Aug 2016, 5:42
by MarioKirby101
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...

Posted: 20 Aug 2016, 6:01
by Yoshi021
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.

Posted: 20 Aug 2016, 7:15
by MarioKirby101
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.

Posted: 20 Aug 2016, 9:50
by Super Mario Player
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!

Posted: 20 Aug 2016, 22:06
by MarioKirby101
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...

Posted: 20 Aug 2016, 22:15
by Yoshi021
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.

Posted: 21 Aug 2016, 5:15
by MarioKirby101
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.

Changing Global variables to that of a Local variable?

Posted: 6 Sep 2016, 7:05
by MarioKirby101
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!

Posted: 7 Sep 2016, 2:35
by Yoshi021
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?

Posted: 14 Sep 2016, 5:50
by MarioKirby101
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.

Posted: 10 Oct 2016, 15:58
by BolanoGustavo
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

LSpin angular speed measurement unit?

Posted: 16 Oct 2016, 3:00
by ctrl_void
What is the measurement unit for the angular speed in LSpin(layerName, cx, cy, angularSpeed)?

Example, radians/sec

Posted: 29 Jun 2017, 21:19
by andreepika1336
How do I make the scripted npc to spawn these npcs but they are not in Spawned NPCs Layers?