Thought this might be of interest to some.
Some time ago I did a tree shade script that was terribly clunky and long. I did a rewrite that exhibits a 90% performance increase and is triggered only if the player moves. While doing it I also investigated the benefits of water in a "harsh Australian outback" scenario including ambient temperature and water immersion.
I put together this little video to show it in operation. At the moment I cannot package the entire script for use because it is tied to a global but if there is enough interest I could at least show how some of it is done.
I've included the water script (thought this was a funky yet simple piece of code) that utilises a zone drawn around a "billabong" and detects depth to simulate cooling effects.
waterPlane is 535 (I presume it's the same for all maps at this stage?)
Simply draw and resize a trigger zone around your water with the center as close to the deepest middle as possible and attach the water script. (see image below)
Note this code is not for resale as a script but I am more than happy if it is used/modified to be included in a Game Guru project non commercial and commercial.
local modBase = 0.5 -- lower = less
local depBase = 3.75
local waterDist = 0
local done = 0
local highnum = 0
-- global vars to access. return is assumed as celcius so may need modification if using F
waterBenefit = 0
depthBenefit = 0
-- NOTE - pY MUST be obtained or simply use
-- pY = g_PlayerPosY
function tt_waterzone_init(e)
waterPlane = 535
end
function tt_waterzone_main(e)
waterBenefit = 0
if GetPlayerInZone(e) == 1 then
waterDist = GetPlayerDistance(e)
if done == 0 then
highnum=waterDist
done = 1
end
waterDepth = (waterPlane - pY) * 2.54 -- convert to cm
if waterDepth > 145 then -- average neck height?
TextCenterOnXColor(50,50,1,"CAREFUL. You'll drown if you go any deeper!",255,0,0)
end
if waterDepth > 0 then
depthBenefit = (waterDepth/100) * depBase
else
depthBenefit = 0
end
waterBenefit = ((highnum-waterDist)/100) * modBase
else
done = 0
end
end
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD