minty1 Posted May 31, 2022 Share Posted May 31, 2022 (edited) I am developing a character mod right now and I plan to have one of their abilities trigger when they are nearby the ocean in Vanillia, RoG and Hamlet, as of now I plan that when they are nearby the ocean, they gain a speed boost and dapperness bonus. Trouble is, I have no damn idea how to make the code to work. What I had tried to do is go through the code of the game looking for some effect that was similar to what I wanted so that I could use it/rework it. I found that Penguins had a function that triggers when a player goes nearby the ocean, which was the closest thing I could find. Issue is I cannot figure out if I can fit it into working in a character file and having it trigger something else other than Penguin spawning. So far I have been unsuccessful. So, I need some code that triggers an effect when the player goes nearby the ocean. Anyone think that they can help me out? I would be super thankful! Cheers fellas. Edited May 31, 2022 by minty1 Link to comment https://forums.kleientertainment.com/forums/topic/140593-how-can-i-have-a-function-that-triggers-when-you-walk-nearby-the-ocean/ Share on other sites More sharing options...
Leonidas IV Posted June 5, 2022 Share Posted June 5, 2022 On 5/31/2022 at 4:26 PM, minty1 said: I am developing a character mod right now and I plan to have one of their abilities trigger when they are nearby the ocean in Vanillia, RoG and Hamlet, as of now I plan that when they are nearby the ocean, they gain a speed boost and dapperness bonus. Trouble is, I have no damn idea how to make the code to work. What I had tried to do is go through the code of the game looking for some effect that was similar to what I wanted so that I could use it/rework it. I found that Penguins had a function that triggers when a player goes nearby the ocean, which was the closest thing I could find. Issue is I cannot figure out if I can fit it into working in a character file and having it trigger something else other than Penguin spawning. So far I have been unsuccessful. So, I need some code that triggers an effect when the player goes nearby the ocean. Anyone think that they can help me out? I would be super thankful! Cheers fellas. I use this for one of my mods: local function IsHole(x,y,z) return GetGroundTypeAtPosition(Vector3(x,y,z)) == GROUND.IMPASSABLE end local function IsPointNearHole(x,y,z) local ground = GetWorld() local radius = .5 for i = -radius, radius, 1 do if IsHole(x - radius, y, z + i) or IsHole(x + radius, y, z + i) then return true end end for i = -(radius - 1), radius - 1, 1 do if IsHole(x + i, y, z -radius) or IsHole(x + i, y, z + radius) then return true end end return false end Change the radius for the distance. This checks if is near a hole (ocean, vacum in caves), of cource you can check if the GetWorld().prefab = "forest" for checking for surface. Link to comment https://forums.kleientertainment.com/forums/topic/140593-how-can-i-have-a-function-that-triggers-when-you-walk-nearby-the-ocean/#findComment-1575301 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