Jump to content

Horn to call hound attacks


Recommended Posts

I was trying to make a simple horn that instantly calls for a hound wave (and later boss attacks, worm attacks, etc). In hounded.lua there is a function

self:ForceNextWave()

but I can't make it work (at least in console). How can I spawn them via console and by horn call?

Link to comment
Share on other sites

1 hour ago, Welpx said:

Thank you very much! I'm still learning and I had no idea what "self" refers to.

self refers to the class in which this function is used. So in this case it refers to "hounded".
And hounded is added as a component to the world.
Eg. "health" component is added to players, therefore to call any player health function you do ThePlayer.components.health:Function, while ThePlayer is always the player from the pc which is calling ThePlayer.

In addition to that "components" do only exist at server, not at clients. So you should test you mod also as a client (most of the time it is enough to play at a world with caves active).
If it crashed at worlds with caves, with "components is nil", you have to make sure, that either the component call is only made at server, or you have to use a workaround to call it also for clients (sometimes a component has "replicas" which can be accessed by ThePlayer.replica.health)

Edited by Serpens
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...