SetWaterTransparency

Definition

SetWaterTransparency(string waterName, float transparency)

Description

This function sets the transparency of water object waterName to transparency.

Parameters

waterName
Specifies the water name. You can also use the name “this” for this parameter. In this case, “this” string refers to the name of the water to which this script is attached.

transparency
Specifies the transparency of water object waterName. This value must be in the range [0.0,1.0]

Example 1

function Init()
    SetWaterTransparency("water1", 0.4)
end

function Update()

end
In this script, we set the transparency of water “water1” to 0.4.

Example 2

--Name of script is SetWaterTransparency2.lua

function Init()
    SetWaterTransparency("this", 0.34)
end

function Update()

end
Assume that the above script named SetWaterTransparency2.lua is attached to a water object named “water1”. In this case, string “this”  in the SetWaterTransparency function will be equal to “water1”. In our example, the function SetWaterTransparency sets the transparency of current water, which is “water1”, to 0.34.
adminSetWaterTransparency