|
taohuazhen.lua
主要涉及以下几个函数
1.替换
- function thz_steps()
- if _dir == 'north' then
- return checkWait(thz_south,0.2)
- elseif _dir == 'south' then
- return checkWait(thz_west,0.2)
- elseif _dir == 'west' then
- return checkWait(thz_east,0.2)
- elseif _dir == 'east' then
- return checkWait(find_min_count_and_variable,0.5)
- end
- end
复制代码
2下方新增函数
- function find_min_count_and_variable()
- local minValue = math.huge
- local minCount = 0
- local minVariables = {}
- local variables = {n_cnt, s_cnt, e_cnt, w_cnt}
- local variableNames = {'n_cnt', 's_cnt', 'e_cnt','w_cnt'}
- for i, v in ipairs(variables) do
- if v <= minValue then
- if v < minValue then
- minValue = v
- minCount = 1
- minVariables = {variableNames[i]}
- else
- minCount = minCount + 1
- table.insert(minVariables, variableNames[i])
- end
- end
- end
- if minCount > 1 then
- randomIndex = math.random(minCount)
- direction = minVariables[randomIndex]
- else
- direction = minVariables[1]
- end
- return checkWait(thz_act3,0.2)
- end
复制代码
3.替换
- function thz_act3()
- EnableTrigger('thzact1',true)
- EnableTrigger('thzact3',false)
- checkWait(thz_random,0.5)
- end
复制代码
4.替换
- function thz_random()
- if direction == "n_cnt" then
- print("北,"..direction)
- return exe('north')
- elseif direction == "s_cnt" then
- print("南,"..direction)
- return exe('south')
- elseif direction == "w_cnt" then
- print("西,"..direction)
- return exe('west')
- else
- print("东,"..direction)
- return exe('east')
- end
- end
复制代码
|
|