A Crab King with (5x Yellow Gem) or with (2x Yellow Gem + 1x Pearl) will freeze the server in any case due to an endless loop in the coding:
local function freezefx(inst) local function spawnfx() local MAXRADIUS = inst.crab and inst.crab:IsValid() and getfreezerange(inst.crab) or (TUNING.CRABKING_FREEZE_RANGE * 0.75) local x,y,z = inst.Transform:GetWorldPosition() local theta = math.random()*2*PI local radius = 4+ math.pow(math.random(),0.8)* MAXRADIUS local offset = Vector3(radius * math.cos( theta ), 0, -radius * math.sin( theta )) local prefab = "crab_king_icefx" local fx = SpawnPrefab(prefab) fx.Transform:SetPosition(x+offset.x,y+offset.y,z+offset.z) end local MAXFX = Remap(( inst.crab and inst.crab:IsValid() and inst.crab.countgems(inst.crab).blue or 0),0, 9,5,15) local fx = Remap(inst.components.age:GetAge(),0,TUNING.CRABKING_CAST_TIME_FREEZE - (inst.crab and inst.crab:IsValid() and math.floor(inst.crab.countgems(inst.crab).yellow) or 0/2),1,MAXFX) for i=1,fx do if math.random()<0.2 then spawnfx() end end dofreezefz(inst) end
Answer:
As we can see, the local variable fx is the Remap of the time of how long you did fight against the Crab King, scaled from the values
- 0
- TUNING.CRABKING_CAST_TIME_FREEZE - (inst.crab and inst.crab:IsValid() and math.floor(inst.crab.countgems(inst.crab).yellow) or 0/2)
to
- 1
- MAXFX
In this case, it's from
- 5 - 'amount of yellow gems'
- 0
to
- 1
- "MAXFX"
Since we got 5x Yellow Gem, the lower scale becomes from 0 to 0 and in that case, inst.components.age:GetAge() is infinite times as big as the first scale and thus it becomes infinite once rescaled to the second scale. The local variable fx will become infinite!
If used in the following code
for i=1,fx do if math.random()<0.2 then spawnfx() end end
you'll get a for loop from i=1 to infinity without having any break command inside which will cause an endless loop! It will start but never ever stop and the game won't continue not until the Crab King finishes his action. In other words: It will freeze the whole game forever, until the game is restarted.
Another note: 0 divided by 2 equals 0 in any case, you either need to remove the /2 in the following code
(inst.crab and inst.crab:IsValid() and math.floor(inst.crab.countgems(inst.crab).yellow) or 0/2)
making it to
(inst.crab and inst.crab:IsValid() and math.floor(inst.crab.countgems(inst.crab).yellow) or 0)
or just use brackets
(inst.crab and inst.crab:IsValid() and (math.floor(inst.crab.countgems(inst.crab).yellow) or 0)/2)
but that won't fix the bug.
Place (5x Yellow Gem + 4x Red Gem) or (1x Pearl, 2x Yellow Gem, 6x Red Gem) in the Crab King and wait till he makes his freezing attack. Close DST afterwards.
- 1
- 3
A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.
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