nolanri Posted June 7, 2016 Share Posted June 7, 2016 http://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.TorchInfo.html how can I use this class to say. make there be a cone of light in front of the player as if he was holding a flashlight, even though hes not using a flashlight? I dont understand how to use this type of class. I tired: player:TorchInfo.strength = 20; player.TorchInfo.strength = 20; local torch = isoGameCharacter.TorchInfo.new(); local torch = isoGameCharacter.TorchInfo(); player.TorchInfo:set(player); player:TorchInfo:set(player); but each of those lines cause instant error Link to comment Share on other sites More sharing options...
EasyPickins Posted June 7, 2016 Share Posted June 7, 2016 That class isn't exposed to Lua; it can't be called from Lua. Link to comment Share on other sites More sharing options...
nolanri Posted June 8, 2016 Author Share Posted June 8, 2016 Is there a way to put a cone of light in front of a player without actually using a flash light or other torch item in lua? Link to comment Share on other sites More sharing options...
tommysticks Posted September 3, 2016 Share Posted September 3, 2016 (edited) On 6/7/2016 at 10:32 PM, nolanri said: Is there a way to put a cone of light in front of a player without actually using a flash light or other torch item in lua? Little late on this one, here's the stuff I've messed around with light. It works on any item, haven't tried making it come from other things. local player = getPlayer(); local primary = player:getPrimaryHandItem(); primary:setTorchCone(true); -- makes light thinner, unneccessary to actually ahve light primary:setLightDistance((primary:getLightDistance()) + 1); primary:setLightStrength((primary:getLightStrength()) + 1); This code was used with a function to increase light output by pressing a button. It can be used without setTorchCone(true), which would cause the light to emit in all directions. Been a while since I've fucked with it. So you could just do: primary:setLightDistance(10); primary:setLightStrength(10); Edited September 3, 2016 by tommysticks Forgot how to do spoiler Link to comment Share on other sites More sharing options...
nolanri Posted September 5, 2016 Author Share Posted September 5, 2016 (edited) I actually did discover exactly this a while after posting this questions. However it was very temperamental. I believe I came to the conclusion that this only works if you have had a flashlight in your hand and turned on at least once since you loaded the game. Suggesting that some kind of initialization happens when using a real light source that is required before doing this. which was a crying shame because doing this without "primary:setTorchCone(true);" looked great with the car mod as headlights. Edited September 5, 2016 by nolanri Link to comment Share on other sites More sharing options...
tommysticks Posted September 5, 2016 Share Posted September 5, 2016 2 hours ago, nolanri said: I actually did discover exactly this a while after posting this questions. However it was very temperamental. I believe I came to the conclusion that this only works if you have had a flashlight in your hand and turned on at least once since you loaded the game. Suggesting that some kind of initialization happens when using a real light source that is required before doing this. which was a crying shame because doing this without "primary:setTorchCone(true);" looked great with the car mod as headlights. Ah, that sounds sweet. I don't think it's accurate, though, about having to have used a flashlight. I have added light sources to weapons in my mods. I think you only need to have an item in your hand and you can add light to it. So for headlights you could just make an item with light properties appear in your hand when you get in the vehicle and disappear when you get out. Or make a key-press add/remove the item to simulate turning on and off the light. Link to comment Share on other sites More sharing options...
nolanri Posted September 5, 2016 Author Share Posted September 5, 2016 21 minutes ago, tommysticks said: Ah, that sounds sweet. I don't think it's accurate, though, about having to have used a flashlight. I have added light sources to weapons in my mods. I think you only need to have an item in your hand and you can add light to it. So for headlights you could just make an item with light properties appear in your hand when you get in the vehicle and disappear when you get out. Or make a key-press add/remove the item to simulate turning on and off the light. Yeah thats exactly what I did. It was working, I pushed an update with it. then I noticed it wasnt working when I went into a new game. Tried it with a flashlight in hand, it worked. put the flashlight away and tried again. then it worked. Repeated this whole test process a few times before drawing said above conclusion. 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