Plusheh Posted December 6, 2018 Share Posted December 6, 2018 (edited) I am currently creating a character who transforms when they drop below a certain temperature, but I'm not sure how to set the "ListenForEvent" so it triggers the transformation. I'd also like the transformation to trigger during a full moon, similar to Woodie. I would greatly appreciate any help on this! I'd also like to change raw food so that it gives the same amount of hunger points as cooked food, as well as extra sanity. And finally, I'd like to program clockworks to be neutral towards my character, similar to how spiders react to Webber, however without the ability to befriend them. If anyone has information or advice on adding these features I'd really appreciate it! Edit - I managed to find out how to make Clockworks neutral towards my character Edited December 7, 2018 by Plusheh Link to comment Share on other sites More sharing options...
Ultroman Posted December 6, 2018 Share Posted December 6, 2018 What is it exactly you need help with? Is it triggering the transformation, or is it doing the actual transformation? Because it sounds like you already know about ListenForEvent. inst:ListenForEvent("eventname", function(all event parameters) Do what you want end) Link to comment Share on other sites More sharing options...
Plusheh Posted December 7, 2018 Author Share Posted December 7, 2018 On 12/6/2018 at 3:56 PM, Ultroman said: What is it exactly you need help with? Is it triggering the transformation, or is it doing the actual transformation? Because it sounds like you already know about ListenForEvent. inst:ListenForEvent("eventname", function(all event parameters) Do what you want end) I realize I wasn't very clear with that, sorry! I am aware of the "ListenForEvent" function, however I do not know what the events I can use are. What I need help with is either finding the event name for dropping below certain temperatures, or how to create that event so I could use it. Thank you for replying and asking for clarification, I appreciate that you're willing to help! Link to comment Share on other sites More sharing options...
Ultroman Posted December 8, 2018 Share Posted December 8, 2018 (edited) It's really easy, and might seem stupid, but this is the best way I've found. 1. In the game folder, find the file scripts.zip and unzip it somewhere outside the game folder. 2. Get Notepad++ 3. The searching: If you know which file you want to look at, just open it in Notepad++. You need to be looking at temperature.lua in the "components" folder in the unzipped files. Search this file (CTRL-F in Notepad++) for "PushEvent" without quotation marks. When using the search function, always consider whether you need "Match Case" on or off, as it is infinitely important in some cases. Now, say you've looked in temperature.lua and found that it pushes the event "temperaturedelta", so now you know which data it sends. But how would you properly listen to this event, and use that data? If you DON'T know which files to look in, but you know what you're looking for, open Notepad++ (no particular file, just open the program). Hit CTRL-SHIFT-F and select the folder with all the game files you unzipped. Switch between searching in the whole scripts folder, or just the components folder, or just the prefabs folder, depending on what you want to find. In this case, just start by searching in the whole scripts folder. Search for the event name. Sometimes it makes sense to search for it WITH quotation marks e.g. "temperaturedelta", since that's how it's used in the game code, but if you also want to see any comments about it or functions named after it, you can leave out the quotations marks. Click "Find", and wait for it to finish. You should now have a full list of every single occurrence of your event in the entire game. Where it's pushed, what data is pushed with it, and where it is listened for, and how they read and react to the event-data. If it says inst:ListenForEvent("temperaturedelta", ontempdelta) ...that means they have a function called "ontempdelta" which is called when the event is pushed. You can go look at the parameters they've chosen to give this function and the code in it, which should give you a good idea of how to do the same. CAREFUL THOUGH: The lenient nature of LUA means, that they don't always have to include all parameters etc. for functions, so I always make it a point to look at all the found occurrences in the game files, since you are some times surprised by how they do things. If you want to learn how all of this fits together, search for "ListenForEvent" and wait for it to finish. Then search for "PushEvent" and grab yourself a cup of something. When you come back, you should have the results of both searches, so you can poke around the game files by double-clicking on the lines in the search results, and get a good idea about how things fit together. Just remember, with each new update to the game, you need to unzip their new scripts.zip Edited December 8, 2018 by Ultroman Link to comment Share on other sites More sharing options...
Plusheh Posted December 8, 2018 Author Share Posted December 8, 2018 (edited) 11 hours ago, Ultroman said: It's really easy, and might seem stupid, but this is the best way I've found. 1. In the game folder, find the file scripts.zip and unzip it somewhere outside the game folder. 2. Get Notepad++ 3. The searching: If you know which file you want to look at, just open it in Notepad++. You need to be looking at temperature.lua in the "components" folder in the unzipped files. Search this file (CTRL-F in Notepad++) for "PushEvent" without quotation marks. When using the search function, always consider whether you need "Match Case" on or off, as it is infinitely important in some cases. Now, say you've looked in temperature.lua and found that it pushes the event "temperaturedelta", so now you know which data it sends. But how would you properly listen to this event, and use that data? If you DON'T know which files to look in, but you know what you're looking for, open Notepad++ (no particular file, just open the program). Hit CTRL-SHIFT-F and select the folder with all the game files you unzipped. Switch between searching in the whole scripts folder, or just the components folder, or just the prefabs folder, depending on what you want to find. In this case, just start by searching in the whole scripts folder. Search for the event name. Sometimes it makes sense to search for it WITH quotation marks e.g. "temperaturedelta", since that's how it's used in the game code, but if you also want to see any comments about it or functions named after it, you can leave out the quotations marks. Click "Find", and wait for it to finish. You should now have a full list of every single occurrence of your event in the entire game. Where it's pushed, what data is pushed with it, and where it is listened for, and how they read and react to the event-data. If it says inst:ListenForEvent("temperaturedelta", ontempdelta) ...that means they have a function called "ontempdelta" which is called when the event is pushed. You can go look at the parameters they've chosen to give this function and the code in it, which should give you a good idea of how to do the same. CAREFUL THOUGH: The lenient nature of LUA means, that they don't always have to include all parameters etc. for functions, so I always make it a point to look at all the found occurrences in the game files, since you are some times surprised by how they do things. If you want to learn how all of this fits together, search for "ListenForEvent" and wait for it to finish. Then search for "PushEvent" and grab yourself a cup of something. When you come back, you should have the results of both searches, so you can poke around the game files by double-clicking on the lines in the search results, and get a good idea about how things fit together. Just remember, with each new update to the game, you need to unzip their new scripts.zip Thank you so much, this was really helpful! I'm still poking around a bit, but I will hopefully figure this out pretty quickly. Again, thank you!!! Edited December 8, 2018 by Plusheh 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