AutumnPingo Posted June 1, 2018 Share Posted June 1, 2018 (edited) I have a character who should get a speed boost while in swamps, while probably getting nerfed in other biomes as well. I know how to actually alter the movespeed, but I've searched all up and down the internet for any clues on biome checking. I could only find day,night based code. Thanks for any help. Edited June 1, 2018 by AutumnPingo Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted June 2, 2018 Share Posted June 2, 2018 Here: local function groundcheckfn(inst) local tile = TheWorld.Map:GetTileAtPoint(inst.Transform:GetWorldPosition()) if tile == GROUND.MARSH then inst.components.locomotor.walkspeed = 8 --higher speed inst.components.locomotor.runspeed = 10 else inst.components.locomotor.walkspeed = 4 --regular speed inst.components.locomotor.runspeed = 6 end end inst:DoPeriodicTask(1, groundcheckfn, nil, inst) all this goes into the master_postinit and the last part of code goes near the onload code. Can't take much credit besides modifying the code from @ksaab and @SuperDavid a bit back ago. Link to comment Share on other sites More sharing options...
AutumnPingo Posted June 2, 2018 Author Share Posted June 2, 2018 Wow thanks! Works right out of the box! You said you got this from somewhere else? Darn, I spent half a whole day looking for even a clue where to start, thanks so much! Link to comment 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