Jump to content

My ListenForEvent isn't working and I'm not sure why.


Recommended Posts

Forgot to even post the actual problem, haha....  Nothing changes when the time of day changes.  Whenever I log in, it will check for the current time of day, but other than that it won't change at all.  The problem is getting the ListenForEvent to actually listen for something.

Link to comment
Share on other sites

You can check for world state changed like this:

 

changing:

inst.ListenForEvent("daytime", function() updatestats(inst) end, GetWorld())inst.ListenForEvent("dusktime", function() updatestats(inst) end, GetWorld())inst.ListenForEvent("nighttime", function() updatestats(inst) end, GetWorld())

to

inst:WatchWorldState("phase", updatestats)

unless you wanted to to be a ListenForEvent only..
I think you can still use but I'm not sure about this one..

inst:ListenForEvent("phasechanged", updatestats)
Link to comment
Share on other sites

inst.ListenForEvent("daytime", function() updatestats(inst) end, GetWorld())inst.ListenForEvent("dusktime", function() updatestats(inst) end, GetWorld())inst.ListenForEvent("nighttime", function() updatestats(inst) end, GetWorld())

The GetWorld part is invaild in dst. It is now TheWorld. Thats what i was told

Edited by DarkCrafter
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...