Jump to content

Is there a simple code for walkspeed increase in total darkness?


Recommended Posts

You can use the function CanEntitySeeTarget to see if you can see yourself in the darkness (how most things usually do it I think).

If yes, give them speed.

if no, remove speed if its there.

Giving/removing speed modifiers is tricky, since it changes based on what version of the game you are running (base, rog, sw, hamlet).

Link to comment
Share on other sites

Hi
@BillTheCipher

At the first glance this might work, but I haven't ran the complex test. You need to copy and paste everything under "master_postinit".

 

local function lanuit(inst)
	if TheWorld.state.isnight then 
		inst.components.locomotor:SetExternalSpeedMultiplier(inst, "ilya_speed_mod", 5)
	else
		inst.components.locomotor:SetExternalSpeedMultiplier(inst, "ilya_speed_mod", 1.25)		
	end
end	
	
	inst:DoPeriodicTask(30, lanuit, nil, inst)

You need to replace "YOURCHARACTER'SNAME_speed_mod" to something like "billy_speed_mod" or whatever your character name is.
Value of "5" is the night speed and the other one (1.25) is the default speed of your characer.

Your mod will check time every 30 seconds thus "inst:DoPeriodicTask(30...". And that means your character might be running on high octane fuel till the next morning.

Cheers!
 

Link to comment
Share on other sites

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.

×
  • Create New...