Page 1 of 1

If an NPC is falling, then?

Posted: Tue Dec 27, 2016 11:59 pm
by ivanmegafanboy
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.

Re: If an NPC is falling, then?

Posted: Wed Dec 28, 2016 4:58 am
by Emral
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.

Re: If an NPC is falling, then?

Posted: Wed Dec 28, 2016 9:28 pm
by ivanmegafanboy
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?