Anti-Jump Code for Mouser?

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Anti-Jump Code for Mouser?

Postby DrMekar » Tue May 12, 2020 7:21 am

Would it be possible to stop Mouser from jumping via a Lua Code without
making him from Scratch?

He's problably the Legacy Boss with the best customize potential, so his
Jump is still an annoying thing for Plattform based Battles.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8734
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Anti-Jump Code for Mouser?

Postby Enjl » Tue May 12, 2020 7:44 am

Monitor the values v.ai1 thru v.ai5 to see what they do, and then set them to prevent them from going where they trigger a jump.
Ideas are useless if you can't make them real.
Image

User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Re: Anti-Jump Code for Mouser?

Postby DrMekar » Tue May 12, 2020 7:51 am

Enjl wrote:
Tue May 12, 2020 7:44 am
Monitor the values v.ai1 thru v.ai5 to see what they do, and then set them to prevent them from going where they trigger a jump.
How would I do this? There is No Mouser AI included, like it is for some other NPCs.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8734
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Anti-Jump Code for Mouser?

Postby Enjl » Tue May 12, 2020 7:54 am

In onTick or onDraw:
Text.print(v.ai1, 100, 100)
for all 5. (maybe a smart idea to not print all 5 to the same coordinates)
Then just some thinking work to figure out what each one does.
Ideas are useless if you can't make them real.
Image

User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Re: Anti-Jump Code for Mouser?

Postby DrMekar » Tue May 12, 2020 8:11 am

Enjl wrote:
Tue May 12, 2020 7:54 am
In onTick or onDraw:
Text.print(v.ai1, 100, 100)
for all 5. (maybe a smart idea to not print all 5 to the same coordinates)
Then just some thinking work to figure out what each one does.
Okay, Thanks, though what do I miss here?

Image
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8734
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Anti-Jump Code for Mouser?

Postby Enjl » Tue May 12, 2020 8:15 am

Why do you have two "end"s? You only open one scope.
Ideas are useless if you can't make them real.
Image

User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Re: Anti-Jump Code for Mouser?

Postby DrMekar » Tue May 12, 2020 8:17 am

Enjl wrote:
Tue May 12, 2020 8:15 am
Why do you have two "end"s? You only open one scope.
I already tried removing one. It resulted in a even larger Error Message:
Image
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8734
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Anti-Jump Code for Mouser?

Postby Enjl » Tue May 12, 2020 8:20 am

That's because v is undefined. You need to actually GET the NPC instance.
There's a small sample on it below the "instance functions" header here:
https://wohlsoft.ru/pgewiki/NPC_(class)
I urge you to actually read the error messages. They're in english, so it's not difficult to understand them.
Ideas are useless if you can't make them real.
Image

User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Re: Anti-Jump Code for Mouser?

Postby DrMekar » Tue May 12, 2020 8:28 am

Enjl wrote:
Tue May 12, 2020 8:20 am
That's because v is undefined. You need to actually GET the NPC instance.
There's a small sample on it below the "instance functions" header here:
https://wohlsoft.ru/pgewiki/NPC_(class)
I urge you to actually read the error messages. They're in english, so it's not difficult to understand them.
So I use NPC.get(), right?
I can easily read them, though it lacks in the understanding what they mean for me. I will finally have the time
to get more into Lua when my last Final Exam is through which is tomorow, so this might have been atleast
my last "Beginner's" Question I hope.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8734
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Anti-Jump Code for Mouser?

Postby Enjl » Tue May 12, 2020 8:31 am

You make a for loop, looping over all the mouser npcs in your level, correct. The page I linked above has more information on how to limit that loop to just mousers, if you're interested.

I brought up reading the error messages becuase length of error message has nothing to do with how relevant it is. it has to be fixed regardless of length by addressing the contents.
Ideas are useless if you can't make them real.
Image

User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Re: Anti-Jump Code for Mouser?

Postby DrMekar » Tue May 12, 2020 9:04 am

Enjl wrote:
Tue May 12, 2020 8:31 am
You make a for loop, looping over all the mouser npcs in your level, correct. The page I linked above has more information on how to limit that loop to just mousers, if you're interested.

I brought up reading the error messages becuase length of error message has nothing to do with how relevant it is. it has to be fixed regardless of length by addressing the contents.
Okay, I'll defenitly keep it open then. I tried out the Example Function given, so
it still throws an Error saying it can't find the 'v'.

Image
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8734
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Anti-Jump Code for Mouser?

Postby Enjl » Tue May 12, 2020 9:09 am

DrMekar wrote:
Tue May 12, 2020 9:04 am
Enjl wrote:
Tue May 12, 2020 8:31 am
You make a for loop, looping over all the mouser npcs in your level, correct. The page I linked above has more information on how to limit that loop to just mousers, if you're interested.

I brought up reading the error messages becuase length of error message has nothing to do with how relevant it is. it has to be fixed regardless of length by addressing the contents.
Okay, I'll defenitly keep it open then. I tried out the Example Function given, so
it still throws an Error saying it can't find the 'v'.

Image
As you can see in the example you copypasted into your code, the example uses the variable name myNPC instead.
Ideas are useless if you can't make them real.
Image

User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Re: Anti-Jump Code for Mouser?

Postby DrMekar » Tue May 12, 2020 9:17 am

Enjl wrote:
Tue May 12, 2020 9:09 am
DrMekar wrote:
Tue May 12, 2020 9:04 am
Enjl wrote:
Tue May 12, 2020 8:31 am
You make a for loop, looping over all the mouser npcs in your level, correct. The page I linked above has more information on how to limit that loop to just mousers, if you're interested.

I brought up reading the error messages becuase length of error message has nothing to do with how relevant it is. it has to be fixed regardless of length by addressing the contents.
Okay, I'll defenitly keep it open then. I tried out the Example Function given, so
it still throws an Error saying it can't find the 'v'.

Image
As you can see in the example you copypasted into your code, the example uses the variable name myNPC instead.
I saw it thought that led to the same result. I guess I need to write cervenka a second time into the Code.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8734
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Anti-Jump Code for Mouser?

Postby Enjl » Tue May 12, 2020 9:18 am

I doubt that lead to the same result, but I can't say for certain because I don't know what your code is.
Ideas are useless if you can't make them real.
Image

User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Re: Anti-Jump Code for Mouser?

Postby DrMekar » Tue May 12, 2020 9:22 am

Enjl wrote:
Tue May 12, 2020 9:18 am
I doubt that lead to the same result, but I can't say for certain because I don't know what your code is.
Image

I of course removed the Speed Line given in the Code.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8734
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Anti-Jump Code for Mouser?

Postby Enjl » Tue May 12, 2020 9:23 am

Yet you still have v.ai1 in the code. Notice anything wrong with that?
Ideas are useless if you can't make them real.
Image

User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Re: Anti-Jump Code for Mouser?

Postby DrMekar » Tue May 12, 2020 9:34 am

Enjl wrote:
Tue May 12, 2020 9:23 am
Yet you still have v.ai1 in the code. Notice anything wrong with that?
Okay, it works now.

None of the AI's did what I wanted though. I changed the 100's you gave me to the
starting coordinates of the NPC.

Code: Select all

function onTick()
    for index,myNPC in ipairs(NPC.get()) do
        Text.print(myNPC.ai5, -199288, -200190)
	end
end
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8734
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Anti-Jump Code for Mouser?

Postby Enjl » Tue May 12, 2020 9:51 am

Text.print prints text relative to the screen coordinates. You're now printing text where noone will ever see it. The ai values are what redigit uses to code his NPC behaviours, so analyzing a combination of the 5 will help you in determining what ai values you need to manipulate to stop mouser from jumping.
Ideas are useless if you can't make them real.
Image

User avatar
DrMekar
Koopa Shell
Koopa Shell
Posts: 663
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Current Project: Mario Heroes: The First Chapter Remade (MH1.5)
Chat Username: Doc
Contact:

Re: Anti-Jump Code for Mouser?

Postby DrMekar » Tue May 12, 2020 10:01 am

Enjl wrote:
Tue May 12, 2020 9:51 am
Text.print prints text relative to the screen coordinates. You're now printing text where noone will ever see it. The ai values are what redigit uses to code his NPC behaviours, so analyzing a combination of the 5 will help you in determining what ai values you need to manipulate to stop mouser from jumping.
In all honesty. I have no idea how that would help me. Couldn't I just set the Y-Speed of Mouser to 0?
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8734
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Anti-Jump Code for Mouser?

Postby Enjl » Tue May 12, 2020 10:09 am

That is a possibility. Permanent speedY of 0 has fairly obvious side-effects, but it's a possibility.

It would help you insofar that if you put your head to understanding mouser ai you would be able to catch the point in the AI loop where a jump occurs and prevent the ai values from ever reaching that point.
Ideas are useless if you can't make them real.
Image


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest