Digidragon Posted May 3, 2016 Share Posted May 3, 2016 Hello, I'm new to the world of character modding (and coding in general) and have no clue on how to do this, I'm currently using Dleowolf's blank template mod to try and create a character for a friend's birthday gift. ( ) I would like it if someone could help or teach me how to me write the code that when the character, Jubilee, has x0 player nearby - 0.8 * the strength of wilson (already done due to the templete mod) x1 player nearby - 1.2 * the strength of wilson x2 players nearby - 1.5 * the strength of wilson x3 players nearby - 2 * the strength of wilson Please and thank you in advance! Link to comment Share on other sites More sharing options...
Aquaterion Posted May 3, 2016 Share Posted May 3, 2016 (edited) --put this anywhere above common and master postinit functions in ur character.lua local function getstrength(inst) local x,y,z = inst.Transform:GetWorldPosition() local radius = 10--change the radius to whatever you want local players = TheSim:FindEntities(x, y, z, radius, {"player"}, {"playerghost"}) --get all players in radius, but not ghosts local playercount = #players - 1 -- remove your self from the player count local dmgmult = 0.8 if playercount >= 3 then dmgmult = 2 elseif playercount == 2 then dmgmult = 1.5 elseif playercount == 1 then dmgmult = 1.2 end inst.components.combat.damagemultiplier = dmgmult --wilsons damage multiplier is 1 I believe, so there's not point of multiplying by 1. end --put this in the masterpostinit function inst:DoPeriodicTask(1, getstrength) This should work just fine, it checks every second Edited May 3, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
Digidragon Posted May 3, 2016 Author Share Posted May 3, 2016 Thank you 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