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 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 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.