Search the Community
Showing results for tags 'local'.
-
Method No.1: Placing files in respective folders within your mod doesn't change whatever you have changed in the files when activating the mod in-game! So, lets say I change total_day_time (total amount of segments) from 16 to 24 (and subsequently change day_segs, night_segs and dusk_segs to correspond to this amount) in a copied tuning.lua file, which I place in [my mod]/scripts folder. Why are no changes applied to my hosted server when I host with the said mod enabled? Is there any code I need to apply in modmain.lua or elsewhere so that the tuning.lua from my mod directly replaces tuning.lua while the mod is enabled? And yes, I know, I've heard it multiple times that file-replacement method isn't optimal for modding, but quite frankly, that's quite fine for the kind of mod that I'm making here. Although, not replacing files via modding and getting it done with a different method is preferable. Method No.2: So, aparently this mod was able to achieve the unachievable; changing local variables (or SOMETHING, somehow) to global. And it flipping works! From my understanding, this is what it in modmain to do so (this isn't the exact code of course, I just took the bits that were relevant): seg_dtime = GetModConfigData("dspeed") * 30 / 8 --Timer segment local total_day_time = seg_dtime * 16 local day_segs = 10 local dusk_segs = 4 local night_segs = 2 GLOBAL.TUNING.SEG_TIME = seg_dtime GLOBAL.TUNING.TOTAL_DAY_TIME = total_day_time GLOBAL.TUNING.DAY_SEGS_DEFAULT = day_segs GLOBAL.TUNING.DUSK_SEGS_DEFAULT = dusk_segs GLOBAL.TUNING.NIGHT_SEGS_DEFAULT = night_segs However, when I put the same code, with just the seg_dtime change to seg_time (and declaring seg_time to what I want, i.e. 60) like this: local seg_time = 60--30 local total_day_time = seg_time*24--16 local day_segs = 12--10 local dusk_segs = 6--4 local night_segs = 6--2 GLOBAL.TUNING.SEG_TIME = seg_time GLOBAL.TUNING.TOTAL_DAY_TIME = total_day_time GLOBAL.TUNING.DAY_SEGS_DEFAULT = day_segs GLOBAL.TUNING.DUSK_SEGS_DEFAULT = dusk_segs GLOBAL.TUNING.NIGHT_SEGS_DEFAULT = night_segs NOTHING changes within the game when I enable my mod. Why? And as a result, how do I achieve this result? I believe there was another mod that changed day time. However, strangely, segment time has not been touched by any mods and I really wonder why, considering segment time, just like total day time (amount of segments) are both local variables declared in tuning.lua.
- 9 replies
-
- day time
- day segments
-
(and 5 more)
Tagged with:
-
Local variables, local table, anything local, really, be it inside a function or not. I might need to learn first how to make modmain read a different file within the mod and apply it to the game where necessary, but this is really bugging me and is a block of wall right in my face. I really need to know ways of editing information placed within local variables or local tables which are located in the original game, so that I can change the game with my mods the way I want it to be, otherwise I'm extremely limited. I've handled the most basic of things and learn some bit about taking global variables/tables and editing them as necessary from just the modmain, so I think I'm ready to move on a little bit. So, is there anyone who can help me get past this wall that is blocking me from, say, editing the loot tables of certain things (e.g. rock boulders, mini glaciers) or changing segment time and total amount of day segments, as all of those are assigned to local variables. Even if it means I have to take the original file, make a copy of it in my mod and edit it respectively, it's something I really need to be able to change.
-
I'm too terrified to experiment. The darn hounds always call me off-guard and I always end up dying. I can't carry the bagpack and wear armor at the same time which is pretty lame and rather inconvenient.