-- LUA Script - precede every function and global member with lowercase name of script + '_main' g_foraged = g_foraged or {} local U = require "scriptbank\\utillib" local wZone = {} local wTimer = {} function collect_water_init( e ) end function collect_water_main( e ) local inZone = wZone[ e ] if inZone == nil then if ZonePointIn ~= nil then local Ent = g_Entity[e] local zName = ZonePointIn( Ent.x, Ent.z, 'Water' ) if zName ~= 'None' then wZone[e] = zName end end return end local timer = wTimer[ e ] if timer == nil then -- first check 1 second after start wTimer[ e ] = g_Time + 1000 return elseif g_Time > timer then -- thereafter check every half a second timer = g_Time + 500 if not PlayerIsInZone( inZone ) then return end local foraged = g_foraged if foraged[ 'Flask' ] ~= nil and foraged[ 'Flask' ].amount >= 1 then Text(35, 85, 1, "This area looks good for collecting water Press E to Collect.", 3000) else Text(35, 85, 1, "You need a flask to collect water!", 3000) return end if g_KeyPressE == 1 then local flasks = foraged[ 'Flask' ].amount if foraged[ 'Water' ] == nil then foraged[ 'Water' ] = { amount = flasks } else foraged[ 'Water' ].amount = flasks end PromptDuration("You have. " .. foraged[ 'Water' ].amount .. " Water. ", 2000) end end end