Post here for help and support regarding LunaLua and SMBX2's libraries and features.
Moderator: Userbase Moderators
|
|
|
|
-
DrMekar
- Eerie

- Posts: 787
- Joined: Sat Apr 08, 2017 7:16 am
- Flair: CUSTOM CHARACTER CREATOR
-
Contact:
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.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9891
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » 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.
|
|
|
|
|
|
|
|
|
-
DrMekar
- Eerie

- Posts: 787
- Joined: Sat Apr 08, 2017 7:16 am
- Flair: CUSTOM CHARACTER CREATOR
-
Contact:
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.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9891
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » 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.
|
|
|
|
|
|
|
|
|
-
DrMekar
- Eerie

- Posts: 787
- Joined: Sat Apr 08, 2017 7:16 am
- Flair: CUSTOM CHARACTER CREATOR
-
Contact:
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?

|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9891
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Tue May 12, 2020 8:15 am
Why do you have two "end"s? You only open one scope.
|
|
|
|
|
|
|
|
|
-
DrMekar
- Eerie

- Posts: 787
- Joined: Sat Apr 08, 2017 7:16 am
- Flair: CUSTOM CHARACTER CREATOR
-
Contact:
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:

|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9891
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » 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.
|
|
|
|
|
|
|
|
|
-
DrMekar
- Eerie

- Posts: 787
- Joined: Sat Apr 08, 2017 7:16 am
- Flair: CUSTOM CHARACTER CREATOR
-
Contact:
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.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9891
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » 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.
|
|
|
|
|
|
|
|
|
-
DrMekar
- Eerie

- Posts: 787
- Joined: Sat Apr 08, 2017 7:16 am
- Flair: CUSTOM CHARACTER CREATOR
-
Contact:
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'.

|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9891
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » 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'.
As you can see in the example you copypasted into your code, the example uses the variable name myNPC instead.
|
|
|
|
|
|
|
|
|
-
DrMekar
- Eerie

- Posts: 787
- Joined: Sat Apr 08, 2017 7:16 am
- Flair: CUSTOM CHARACTER CREATOR
-
Contact:
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'.
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.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9891
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » 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.
|
|
|
|
|
|
|
|
|
-
DrMekar
- Eerie

- Posts: 787
- Joined: Sat Apr 08, 2017 7:16 am
- Flair: CUSTOM CHARACTER CREATOR
-
Contact:
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.
I of course removed the Speed Line given in the Code.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9891
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Tue May 12, 2020 9:23 am
Yet you still have v.ai1 in the code. Notice anything wrong with that?
|
|
|
|
|
|
|
|
|
-
DrMekar
- Eerie

- Posts: 787
- Joined: Sat Apr 08, 2017 7:16 am
- Flair: CUSTOM CHARACTER CREATOR
-
Contact:
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
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9891
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » 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.
|
|
|
|
|
|
|
|
|
-
DrMekar
- Eerie

- Posts: 787
- Joined: Sat Apr 08, 2017 7:16 am
- Flair: CUSTOM CHARACTER CREATOR
-
Contact:
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?
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9891
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » 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.
|
|
|
|
|
Return to “LunaLua Help”
Users browsing this forum: No registered users and 4 guests
|