How can I make a friendly NPC that follows you around and attacks enemies?

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
Chilly14
Snifit
Snifit
Posts: 230
Joined: Thu Jul 18, 2019 10:28 pm
Flair: wash your hands and stay at home
Pronouns: he/him

How can I make a friendly NPC that follows you around and attacks enemies?

Postby Chilly14 » Thu Nov 21, 2019 10:42 am

I'd like to have some kind of Toad that does the thing I said in the title.

Cedur
Raccoon Mario
Raccoon Mario
Posts: 7073
Joined: Tue Jun 28, 2016 10:14 am
Flair: semi-retired user, only interested in post ranks
Pronouns: he/him

Re: How can I make a friendly NPC that follows you around and attacks enemies?

Postby Cedur » Thu Nov 21, 2019 11:18 am

This will quite surely require high-level coding.

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

Re: How can I make a friendly NPC that follows you around and attacks enemies?

Postby Enjl » Thu Nov 21, 2019 12:35 pm

If you don't know how to approach the code for this I cannot help you with the details. This is a mix of all the lunalua fundamentals applied in a logically sound manner (NPC scripting, state machines, colliders, interaction with environment, edge cases like the player climbing throughout an entire level), and the fine details depend on exactly what kind of code you have in mind.


Return to “LunaLua Help”

Who is online

Users browsing this forum: cato and 2 guests