. . . Posted May 16, 2016 Share Posted May 16, 2016 Hello, I need your help... So, I would like when my character's insane to give other player characters (that are kinda close to my character) a 50% speed boost but I really have no clue how I would do this ... I feel so ashamed I ask for so much help but it's all I can do ... Any kind of help makes me super happy & thanks for reading as always ! Link to comment Share on other sites More sharing options...
DarkXero Posted May 17, 2016 Share Posted May 17, 2016 if GLOBAL.TheNet:GetIsMasterSimulation() then local SPEED_RADIUS = 15 local SPEED_MULTIPLIER = 1.5 local function SpeedUp(inst, guy) guy.components.locomotor:SetExternalSpeedMultiplier(inst, "sparkspeed", SPEED_MULTIPLIER) guy.sparkspeedgiver = inst end local function SlowDown(inst, guy) guy.components.locomotor:RemoveExternalSpeedMultiplier(inst, "sparkspeed") guy.sparkspeedgiver = nil end local function UpdateSlowness(inst) for i, v in ipairs(GLOBAL.AllPlayers) do if v.sparkspeedgiver == inst then SlowDown(inst, v) end end end local function CheckAndSpeedUp(inst) for i, v in ipairs(GLOBAL.AllPlayers) do if v ~= inst then if inst:IsNear(v, SPEED_RADIUS) then if not v.sparkspeedgiver then SpeedUp(inst, v) end else if v.sparkspeedgiver == inst then SlowDown(inst, v) end end end end end local function ApplyFearSpeed(inst) if inst.fearspeedtask == nil then inst.fearspeedtask = inst:DoPeriodicTask(1, CheckAndSpeedUp) end end local function RemoveFearSpeed(inst) if inst.fearspeedtask ~= nil then inst.fearspeedtask:Cancel() inst.fearspeedtask = nil end UpdateSlowness(inst) end local function AddSpeedStimulator(inst) inst:ListenForEvent("goinsane", ApplyFearSpeed) inst:ListenForEvent("gosane", RemoveFearSpeed) inst:ListenForEvent("onremove", UpdateSlowness) end AddPrefabPostInit("wilson", AddSpeedStimulator) end Goes in modmain. Replace "wilson" for your character. Multiple characters like you won't stack multipliers. Also, the multiplier doesn't apply to your character. Link to comment Share on other sites More sharing options...
. . . Posted May 17, 2016 Author Share Posted May 17, 2016 You're so godly DarkXero, thank you so, so, 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