If an NPC is falling, then?

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
ivanmegafanboy
Flurry
Flurry
Posts: 175
Joined: Wed Aug 12, 2015 11:47 am

If an NPC is falling, then?

Postby ivanmegafanboy » Tue Dec 27, 2016 11:59 pm

I can't manage to make a Lua code where, if a Wart bubble is falling (a.k.a haves a speedY < 0) then the speed of that NPC is divided /2. My main question is how to make a functionOnTick that checks if the NPC 202 is moving downwards so it can trigger someting.
Also, a side question, what uses does the API "pncp" have, the one that comes with 2.0? I saw that is used in another API which is pretty interesting for me, the "moarRinkas" API.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9890
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: If an NPC is falling, then?

Postby Emral » Wed Dec 28, 2016 4:58 am

Modifying speedX and speedY for NPCs only works if SMBX itself isn't changing the values in that tick.
You caaaaan however check for speedY > 0 and then subtract half of speedY from the y-position. Bit hacky but does the job.

pnpc is for storing values beyond those in vanilla smbx. Stuff like NPC.data.isCarnivore = true or whatever you need.

ivanmegafanboy
Flurry
Flurry
Posts: 175
Joined: Wed Aug 12, 2015 11:47 am

Re: If an NPC is falling, then?

Postby ivanmegafanboy » Wed Dec 28, 2016 9:28 pm

Enjl wrote:Modifying speedX and speedY for NPCs only works if SMBX itself isn't changing the values in that tick.
You caaaaan however check for speedY > 0 and then subtract half of speedY from the y-position. Bit hacky but does the job.

pnpc is for storing values beyond those in vanilla smbx. Stuff like NPC.data.isCarnivore = true or whatever you need.
Ok, I'll see if I can manage to do that. It might be better to try something else, at least that is not the main gimmick of my level. Thanks.
By the way, is there some lunadll.lua document (like in a level or custom gfx) that you would recommend me to search for so I can watch more uses for pncp, as examples?


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 4 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari