notsaying Posted November 8, 2016 Share Posted November 8, 2016 Hey I got a problem with my mod I tried to change my character's running speed each time a new day rises and I copied the "inst.components.locomotor.runspeed" so there won't be problems of typing or something and it just crashed when a new day started and told that "locomotor" is a nil value. Can someone help? here's the entire code of this part: inst:ListenForEvent( "daycomplete", function(inst, data) inst.components.locomotor.runspeed = 10 FireStat(inst) local DailyRandomElement = math.random(1,8) if DailyRandomElement == 1 then GetPlayer().components.talker:Say(GetString(GetPlayer().prefab, "ANNOUNCE_DEERCLOPS")) FireStat(inst) elseif DailyRandomElement == 2 then GetPlayer().components.talker:Say(GetString(GetPlayer().prefab, "ANNOUNCE_BOOMERANG")) WaterStat(inst) elseif DailyRandomElement == 3 then GetPlayer().components.talker:Say(GetString(GetPlayer().prefab, "DESCRIBE.YELLOWSTAFF")) WoodStat(inst) elseif DailyRandomElement == 4 then GetPlayer().components.talker:Say(GetString(GetPlayer().prefab, "DESCRIBE.MAXWELL")) MetalStat(inst) elseif DailyRandomElement == 5 then GetPlayer().components.talker:Say(GetString(GetPlayer().prefab, "DESCRIBE.RED_CAP")) EarthStat(inst) else GetPlayer().components.talker:Say(GetString(GetPlayer().prefab, "ANNOUNCE_CHARLIE")) NormalStat(inst) end end, GetWorld()) **Normally it should have a 12.5% chance of changing the running speed, but it doesn't work anyway. I really need help. Link to comment https://forums.kleientertainment.com/forums/topic/71533-changing-runspeed-in-my-mod/ 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