Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. -- Alundaio & SadBlackFox
  2.  
  3. function on_game_start()
  4. RegisterScriptCallback("npc_on_update",npc_on_update)
  5. end
  6.  
  7. local current_restrictions = {}
  8. function npc_on_update(npc,st)
  9. -- current IN restrictions
  10. empty_table(current_restrictions)
  11. for name in string.gmatch(npc:in_restrictions(),"([%w_%-.\\]+)%p*") do
  12. current_restrictions[name] = true
  13. end
  14.  
  15. -- iterate 10 indices each update
  16. for jj=1,10 do
  17. st.anomaly_evade_index = st.anomaly_evade_index and st.anomaly_evade_index+1 or 1
  18.  
  19. local anomaly = bind_anomaly_field.fields_all[st.anomaly_evade_index]
  20. if not (anomaly) then
  21. st.anomaly_evade_index = 1
  22. return
  23. end
  24.  
  25. local anomaly_name = anomaly:name()
  26. if (anomaly:position():distance_to_sqr(npc:position()) < 225) then
  27. if not (current_restrictions[anomaly_name]) then
  28. npc:add_restrictions("",anomaly_name)
  29. end
  30. else
  31. if (current_restrictions[anomaly_name]) then
  32. npc:remove_restrictions("",anomaly_name)
  33. end
  34. end
  35. end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement