Zeyn Posted August 27, 2015 Share Posted August 27, 2015 Hi everybody ! I am trying to make a mod which makes Spiderdens growing faster. I have found those lines interesting : at line 292 in dont_starve\data\DLC0001\scripts\prefabs\spiderden.lua file : local function GetSmallGrowTime(inst) return TUNING.SPIDERDEN_GROW_TIME[1] + math.random()*TUNING.SPIDERDEN_GROW_TIME[1]endlocal function GetMedGrowTime(inst) return TUNING.SPIDERDEN_GROW_TIME[2]+ math.random()*TUNING.SPIDERDEN_GROW_TIME[2]endlocal function GetLargeGrowTime(inst) return TUNING.SPIDERDEN_GROW_TIME[3]+ math.random()*TUNING.SPIDERDEN_GROW_TIME[3]endat line 437 in dont_starve\data\DLC0001\scripts\tuning.lua file : SPIDERDEN_GROW_TIME = {day_time*8, day_time*8, day_time*20},I have made a local function in modmain.lua that change SPIDERDEN_GROW_TIME values, without success . Please help ! ps : English is not my native language, as well as lua ! Please don't be unkind ! Link to comment Share on other sites More sharing options...
Mobbstar Posted August 27, 2015 Share Posted August 27, 2015 You made a function? That's unnecessary, you can change the value directly in a single line: GLOBAL.TUNING.SPIDERDEN_GROW_TIME = {1,2,3} Link to comment Share on other sites More sharing options...
Zeyn Posted August 27, 2015 Author Share Posted August 27, 2015 Thanks Mobbstar for your reply, The problem is : I would like to make it growing twice or three times faster, so i think i need to use the daytime variable to make it, but if i just write : GLOBAL.TUNING.SPIDERDEN_GROW_TIME = {day_time*16, day_time*16, day_time*40} Then i will have an error message that say daytime is a nill value. Link to comment Share on other sites More sharing options...
Mobbstar Posted August 27, 2015 Share Posted August 27, 2015 Thanks Mobbstar for your reply, The problem is : I would like to make it growing twice or three times faster, so i think i need to use the daytime variable to make it, but if i just write : Then i will have an error message that say daytime is a nill value. Because "daytime" is defined in tuning.lua as a local variable. I think there's a tuning variable that is literally the same though. Link to comment Share on other sites More sharing options...
Zeyn Posted August 27, 2015 Author Share Posted August 27, 2015 Ok, i have found in the tuning.lua file that the local variable day_time was just a constant equal to 300 local seg_time = 30local day_segs = 10local day_time = seg_time * day_segs So, i just try to divide this value by 3, and that works ! Some spiderdens was level 3 day 6, 7 and 8. Thanks a lot Mobbstar, you're the best Link to comment Share on other sites More sharing options...
Mobbstar Posted August 27, 2015 Share Posted August 27, 2015 Ok, i have found in the tuning.lua file that the local variable day_time was just a constant equal to 300 So, i just try to divide this value by 3, and that works ! Some spiderdens was level 3 day 6, 7 and 8. Lol I guess that works too Link to comment Share on other sites More sharing options...
Zeyn Posted August 29, 2015 Author Share Posted August 29, 2015 Hi there, it is me again ! Here is my problem : Spiderdens grow faster, that's cool , but spiderdens level 3 don't become spiderdens unless the player stay much time near it. I would like spiderdens become spiderqueens even if the player is not near to it. I have search in the tuning.lua file, but the solution don't seems to be there. Any ideas or advice ? Link to comment Share on other sites More sharing options...
Mobbstar Posted August 29, 2015 Share Posted August 29, 2015 Hi there, it is me again ! Here is my problem : Spiderdens grow faster, that's cool , but spiderdens level 3 don't become spiderdens unless the player stay much time near it. I would like spiderdens become spiderqueens even if the player is not near to it. I have search in the tuning.lua file, but the solution don't seems to be there. Any ideas or advice ? That's actually intentional or a bug, either of those You'd have to do some actual scripting to fix it, I think. Start by searching the part in spiderdens that spawns a spider queen. If that doesn't have hints, try backtracking. Link to comment Share on other sites More sharing options...
Zeyn Posted August 29, 2015 Author Share Posted August 29, 2015 SPIDER_HEALTH = 100, SPIDER_DAMAGE = 20, SPIDER_ATTACK_PERIOD = 3, SPIDER_TARGET_DIST = 4, SPIDER_INVESTIGATETARGET_DIST = 6, SPIDER_WAKE_RADIUS = 4, SPIDER_FLAMMABILITY = .33, SPIDER_SUMMON_WARRIORS_RADIUS = 12, SPIDER_EAT_DELAY = 1.5, SPIDER_WALK_SPEED = 3, SPIDER_RUN_SPEED = 5, SPIDER_WARRIOR_HEALTH = 200, SPIDER_WARRIOR_DAMAGE = 20, SPIDER_WARRIOR_ATTACK_PERIOD = 4, SPIDER_WARRIOR_ATTACK_RANGE = 6, SPIDER_WARRIOR_HIT_RANGE = 3, SPIDER_WARRIOR_MELEE_RANGE = 3, SPIDER_WARRIOR_TARGET_DIST = 10, SPIDER_WARRIOR_WAKE_RADIUS = 6, SPIDER_WARRIOR_WALK_SPEED = 4, SPIDER_WARRIOR_RUN_SPEED = 5, SPIDER_HIDER_HEALTH = 150, SPIDER_HIDER_DAMAGE = 20, SPIDER_HIDER_ATTACK_PERIOD = 3, SPIDER_HIDER_WALK_SPEED = 3, SPIDER_HIDER_RUN_SPEED = 5, SPIDER_HIDER_SHELL_ABSORB = 0.75, SPIDER_SPITTER_HEALTH = 175, SPIDER_SPITTER_DAMAGE_MELEE = 20, SPIDER_SPITTER_DAMAGE_RANGED = 20, SPIDER_SPITTER_ATTACK_PERIOD = 5, SPIDER_SPITTER_ATTACK_RANGE = 5, SPIDER_SPITTER_MELEE_RANGE = 2, SPIDER_SPITTER_HIT_RANGE = 3, SPIDER_SPITTER_WALK_SPEED = 4, SPIDER_SPITTER_RUN_SPEED = 5, SPIDERDEN_GROW_TIME = {day_time*8, day_time*8, day_time*20}, SPIDERDEN_HEALTH = {50*5, 50*10, 50*20}, SPIDERDEN_SPIDERS = {3, 6, 9}, SPIDERDEN_WARRIORS = {0, 1, 3}, -- every hit, release up to this many warriors, and fill remainder with regular spiders SPIDERDEN_SPIDER_TYPE = {"spider", "spider_warrior", "spider_warrior"}, SPIDERDEN_REGEN_TIME = 3*seg_time, SPIDERDEN_RELEASE_TIME = 5, SPIDERQUEEN_WALKSPEED = 1.75, SPIDERQUEEN_HEALTH = 1250, SPIDERQUEEN_DAMAGE = 80, SPIDERQUEEN_ATTACKPERIOD = 3, SPIDERQUEEN_ATTACKRANGE = 5, SPIDERQUEEN_FOLLOWERS = 16, SPIDERQUEEN_GIVEBIRTHPERIOD = 20, SPIDERQUEEN_MINWANDERTIME = total_day_time * 1.5, SPIDERQUEEN_MINDENSPACING = 20,I see nothing in tuning.lua that can solve the problem. I think this is intentionnal, like for lightning bolt, they don't fall out of the screen. I don't know what you mean when you say try backtracking. Link to comment Share on other sites More sharing options...
Mobbstar Posted August 29, 2015 Share Posted August 29, 2015 I see nothing in tuning.lua that can solve the problem. I think this is intentionnal, like for lightning bolt, they don't fall out of the screen. I don't know what you mean when you say try backtracking. That's scripted behaviour, not simply some values. You need to look at the script file for the spiderden prefabs. Link to comment Share on other sites More sharing options...
Zeyn Posted August 29, 2015 Author Share Posted August 29, 2015 I think i have found the good part, thanks Mobbstar ! In dont_starve\data\DLC0001\scripts\prefabs\spiderden.lua :local function AttemptMakeQueen(inst) if inst.data.stage == nil or inst.data.stage ~= 3 then -- we got here directly (probably by loading), so reconfigure to the level 3 state. SetLarge(inst) end local player = GetPlayer() if not player or player:GetDistanceSqToInst(inst) > 30*30 then inst.components.growable:StartGrowing(60 + math.random(60) ) return end local check_range = 60 local cap = 4 local x, y, z = inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x,y,z, check_range) local num_dens = 0 for k,v in pairs(ents) do if v:HasTag("spiderden") or v.prefab == "spiderqueen" then num_dens = num_dens + 1 end if num_dens >= cap then break end end local should_duplicate = num_dens < cap inst.components.growable:SetStage(1) inst.AnimState:PlayAnimation("cocoon_large_burst") inst.AnimState:PushAnimation("cocoon_large_burst_pst") inst.AnimState:PushAnimation("cocoon_small", true) inst.SoundEmitter:PlaySound("dontstarve/creatures/spiderqueen/legburst") inst:DoTaskInTime(5*FRAMES, function() inst.SoundEmitter:PlaySound("dontstarve/creatures/spiderqueen/legburst") end) inst:DoTaskInTime(15*FRAMES, function() inst.SoundEmitter:PlaySound("dontstarve/creatures/spiderqueen/legburst") end) inst:DoTaskInTime(35*FRAMES, function() local queen = SpawnPrefab("spiderqueen") local pt = Vector3(inst.Transform:GetWorldPosition()) local rad = 1.25 local angle = math.random(2*PI) pt = pt + Vector3(rad*math.cos(angle), 0, rad*math.sin(angle)) queen.Transform:SetPosition(pt:Get()) queen.sg:GoToState("birth") if not should_duplicate then inst:Remove() end end) inst.components.growable:StartGrowing(60)endI am now trying to understand what it meens ! Link to comment Share on other sites More sharing options...
Zeyn Posted August 30, 2015 Author Share Posted August 30, 2015 Ok, i don't understand all the function (for example, growable:StartGrowing in components folder ), but i could : - remove the part between line 19 and 25- change local should_duplicate = num_dens < cap by local should_duplicate = true How can i change this function by a new one write in the modmain.lua file ? Link to comment Share on other sites More sharing options...
Mobbstar Posted August 30, 2015 Share Posted August 30, 2015 You should use AddPrefabPostInit to manipulate a prefab file. [api docs] Copy the function, change it to your liking, and the set the changed one in the postinit function.local function newMakeQueen(inst) --copied and changed codeend local function UpdateDens(inst) --set the new function instead of the old oneend AddPrefabPostInit("spiderden3",UpdateDens)--WARNING: untested code Link to comment Share on other sites More sharing options...
Zeyn Posted August 31, 2015 Author Share Posted August 31, 2015 Hi, I need to access some values and functions : E:\Program Files\Steam\SteamApps\common\dont_starve\data\scripts\constants.lua Functions like SetStage() that are located in : E:\Program Files\Steam\SteamApps\common\dont_starve\data\scripts\prefabs\spiderden.lua I think i have to do something like GLOBAL.something to access to those values, but i don't know what. Link to comment Share on other sites More sharing options...
Zeyn Posted September 2, 2015 Author Share Posted September 2, 2015 I have tried :GLOBAL.require("constants")GLOBAL.require("prefabs/spiderden")andGLOBAL.require("constants")GLOBAL.require("prefabs")but that didn't work ! If someone can help, that would be very nice. 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.