Sunday, 4 November 2012

Controlling water flow direction

In the CK under "Static" you will find the "Water Cell Current marker", which you can place once per cell and depending on the rotation changes the flow direction.

For more detailed control, in the object window, under WorldData\WaterType there are many different water types listed. Adjust the water properties settings, specifically "Linear Velocity" (bottom left) to set the current. If you need a strong current look at RiverWaterFlowNE (used at riverwood) and adjust/copy those settings.

While in the water properties, under the "Noise Properties" you can also adjust the flow graph to change the visual appearance of the current. This is done via the "Wind Direction", which is specified in degrees from 0 to 360. You will need to change the settings for all three "Noise Layers" to achieve a nice-looking result (vary each noise layer by a few degrees for best results)

Degrees with corresponding flow direction:
0 = south
90 = West
180 = north
270 = East

Once you have adjusted the water to your liking, you will need to use it on a water activator, found under WorldObjects\Activator\Water.

A small script to change the calendar date when traveling

GlobalVariable Property GameYear  Auto
GlobalVariable Property GameDay  Auto  
GlobalVariable Property GameHour  Auto  
GlobalVariable Property GameMonth  Auto  
;amount of travel time, with fixed component and random element added, 
;change as you see fit;this will break for really big values, you should add checks 
;if you're traveling longer than a month
int traveldays = 14 + Utility.RandomInt(-3, 3)

int currentday = gameday.GetValue() as int
int currentmonth = gamemonth.GetValue() as int
int currentyear = gameyear.GetValue() as int

;define array with number of days in each month
int[] montharray = new int[12]
montharray[0] = 31
montharray[1] = 28
montharray[2] = 31
montharray[3] = 30
montharray[4] = 31
montharray[5] = 30
montharray[6] = 31
montharray[7] = 31
montharray[8] = 30
montharray[9] = 31
montharray[10] = 30
montharray[11] = 31

;how many days in current month
int currentmonthdays = montharray[currentmonth]

; add travel days to current date
int dayaftertravel = (currentday + traveldays)

;check if we've passed over into the next monthif dayaftertravel > currentmonthdays
dayaftertravel = (dayaftertravel - currentmonthdays)
currentmonth = (currentmonth + 1)
;check if we've passed over into the next year
        if currentmonth > 11
        currentmonth = 0
        gameyear.setvalue(currentyear+1)
        endif
endif

; set the month
gamemonth.setvalue(currentmonth)

; and set the new date
gameday.setvalue(dayaftertravel)

; set the game hour to a random number because why not
gamehour.setvalue(Utility.RandomInt(0, 23))
Debug.Notification("You have been at sea for " + traveldays + " days")