Advertisement
Guest User

ZRP controller kill function for AMK/ZoA

a guest
Aug 6th, 2012
2,888
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.63 KB | None | 0 0
  1. -- ZRP's debug mode allows killing online controllers to avoid the animation crash listed here:
  2. -- http://www.metacognix.com/stlkrsoc/CrashesStillInTheGame.html
  3.  
  4. -- This "patch" ports the ZRP kill function to AMK or any other mod that is not compatible with ZRP.
  5. -- Hit ESC + K in game to kill all online controllers.
  6.  
  7. -- Add this to main_menu:OnKeyboard(dik, keyboard_action) in scripts\ui_main_menu.script (e.g., on line 291 in AMK):
  8.  
  9.         if dik == DIK_keys.DIK_K then
  10.         if level.present() and (db.actor ~= nil) and db.actor:alive() then
  11.                 console:execute("main_menu off")
  12.                 local kill_count = 0
  13.                 for id_ = 0, 65534, 1 do
  14.                     local lobj = level.object_by_id(id_)
  15.                     if lobj ~= nil then
  16.                         if lobj:clsid() == clsid.controller_s then
  17.                             if lobj:alive() then
  18.                                 lobj:kill(lobj)
  19.                                 kill_count = kill_count + 1
  20.                             end
  21.                         end
  22.                     end
  23.                 end
  24.                 local msg_text
  25.                 if kill_count > 0 then
  26.                     msg_text = "Controllers killed:  " .. tostring(kill_count)
  27.                 else
  28.                     msg_text = "No online controllers found"
  29.                 end
  30.                 local hud = get_hud()
  31.                 hud:AddCustomStatic("main_task", true)
  32.                 hud:GetCustomStatic("main_task"):wnd():SetTextST(msg_text)
  33.                 hud:GetCustomStatic("main_task").m_endTime = time_global()/1000 + 7
  34.             end
  35.         end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement