Welpx Posted December 5, 2016 Share Posted December 5, 2016 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 More sharing options...
Serpens Posted December 5, 2016 Share Posted December 5, 2016 what did you typed in in console? I would guess it should be something like TheWorld.components.hounded:ForceNextWave() ? Link to comment Share on other sites More sharing options...
Welpx Posted December 5, 2016 Author Share Posted December 5, 2016 Thank you very much! I'm still learning and I had no idea what "self" refers to. Link to comment Share on other sites More sharing options...
Serpens Posted December 5, 2016 Share Posted December 5, 2016 (edited) 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 December 5, 2016 by Serpens Link to comment Share on other sites More sharing options...
Welpx Posted December 6, 2016 Author Share Posted December 6, 2016 Oh, I see. Thanks for the explanation, it helped me a lot. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now