Help with world lighting #149
-
|
Hi folks, With the help of the tutorials, I've implemented a torch (American). It uses what I know as a turnscript in Quest 5 to decrement the fuel of the torch each turn, and provide light when lit. I did manage to get this to function as intended, but I am having a bit of trouble applying the same logic to another item. The main issue is that, unlike the torch, the item will disappear once eaten, meaning the code can't be on the item itself. So I figured the way to deal with this would be to create a turnscript that should run once the consumable is ingested. The eating sets the time and starts the turnscript, while the turnscript does all the heavy lifting. In all my testing, however, I haven't figured out how to light the current location. The torch has a lightSource function that returns world.LIGHT_FULL, and I assume that functions properly because the torch is always in the current location, while the 'lichen_timer' turnscript doesn't have a location. So the biggest issue is that I need to figure out the best way to pass on the lighting status to the current location. I suspect the lightSource function just needs to go somewhere else (maybe the player?), but in that case, I'm not sure how to trigger a function that exists in the player object within another function within the turnscript, and then how to trigger that each time the turnscript is active. I've attached my current code here: I've considered a couple different ways of going about this. I'm using the RPG library, so I thought maybe using the 'Light giver' effect would be easy enough, but I'm not sure how to set the effect flag for a player, and I still have some questions about that system that I'm looking into. I also considered moving the turnscript to the current location when it's active, and setting it as scenery, but that seems like it might be more complex and resource-intensive than is necessary. I feel like I'm close. I just need to know how to best implement that last bit of functionality. Any help would be greatly appreciated. Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
You were very close with your original code! I think you could get it working just by moving everything you have on the The key change is putting the |
Beta Was this translation helpful? Give feedback.
You were very close with your original code! I think you could get it working just by moving everything you have on the
lichen_timerobject to theplayerobject, maybe tweaking some values. You mentioned the RPG library, so here's an answer using that system, for variety.