Jump to content

How to make a custom Instrument?


Recommended Posts

I'm trying to make a custom instrument. It is a horn that makes creatures (who are targetting the player) stop attacking/targetting at the player, or more ideally, stop attacking and get scared away like a rabbit (for like 3 seconds or something, I don’t want a spider to be scared at me all the time). As I have no idea how to code that function, I copied the codes from the panflute (since the result of sleeping is very similar to what I want, except making animals fall asleep using a horn doesn't really make any sense) and codes from the horn. It was sort of successful: my character can blow the horn and animals fall asleep. However, the animation is blowing the normal horn instead of my custom horn.

Problem: How do I make my character to blow my custom horn?

And also hoping someone can also help me with the function of the horn: How do I make attacking creatures stop targetting at players or get scared away like a bunny if possible?

 

Here's what I did:

For the files in the exported file, I was trying to create something similar to how the normal horn's sprite file was set up. However, in the normal horn's sprite file, it's only the image of the horn placing on the ground. I'm not sure where should I place the other image (the one that the character is holding the instrument).

Just in case the sprite file for (the normal) horn has some secret in it that I didn't see, I've also tried copying them into my character's file and changed the images to my custom horn. I didn't change the name of the images, only the name of the sprite file (cuz otherwise the sprite file is telling me cannot locate these images). And that didn't work as well.

 

Here are my codes:

astolfolablackluna.lua

 

Thank you.

Edited by menghuancat
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...