Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Alundaio & SadBlackFox
- function on_game_start()
- RegisterScriptCallback("npc_on_update",npc_on_update)
- end
- local current_restrictions = {}
- function npc_on_update(npc,st)
- -- current IN restrictions
- empty_table(current_restrictions)
- for name in string.gmatch(npc:in_restrictions(),"([%w_%-.\\]+)%p*") do
- current_restrictions[name] = true
- end
- -- iterate 10 indices each update
- for jj=1,10 do
- st.anomaly_evade_index = st.anomaly_evade_index and st.anomaly_evade_index+1 or 1
- local anomaly = bind_anomaly_field.fields_all[st.anomaly_evade_index]
- if not (anomaly) then
- st.anomaly_evade_index = 1
- return
- end
- local anomaly_name = anomaly:name()
- if (anomaly:position():distance_to_sqr(npc:position()) < 225) then
- if not (current_restrictions[anomaly_name]) then
- npc:add_restrictions("",anomaly_name)
- end
- else
- if (current_restrictions[anomaly_name]) then
- npc:remove_restrictions("",anomaly_name)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement