Codelyy Posted July 17, 2015 Share Posted July 17, 2015 I'm just trying to create a simple code for testing reasons that will cause spiders to set fire during the day. I created this: local function dayfire(inst)if GetClock():IsDay() and notinst.components.burnable == nil then dotarget.components.burnable:Ignite(true) endendend With a listener to call the function:inst:ListenForEvent("daytime", dayfire) I don't get a error or anything when testing this code, just doesn't do what i want. The spider doesn't set on fire. Anyone know what's wrong? Link to comment https://forums.kleientertainment.com/forums/topic/56229-whats-wrong-with-my-code/ Share on other sites More sharing options...
Mobbstar Posted July 17, 2015 Share Posted July 17, 2015 "daytime" fires from the world instance ("GetWorld()", or in Together it's "TheWorld"). You can change the source by simply adding a third argument to the listener: inst:ListenForEvent("bla",function,GetWorld()) Keep in mind that "inst" in the function becomes the world and not the spider. You can cheat that by constructing the function (without parameters) in the listener, since "inst" is already declared then. On a side note, "not nil" is a double negative. In lua, any existing object that isn't boolean already equals "true" if no logic operations are performed. Link to comment https://forums.kleientertainment.com/forums/topic/56229-whats-wrong-with-my-code/#findComment-655055 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