-- LUA Script - precede every function and global member with lowercase name of script + '_main' -- smallg's locked_item script for use with prerequisite_item.lua -- DESCRIPTION: [UNLOCKITEMNAME$=""] (the item to unlock this item) -- DESCRIPTION: [COLLECTRANGE=100] (the range you can pick this item up from) -- DESCRIPTION: [COLLECTANGLE=10] (the angle range you can pick up from) U = U or require "scriptbank\\utillib" g_locked_item = {} presse = 0 function locked_item_properties(e, unlockitemname, collectrange, collectangle) local li = g_locked_item[e] li.unlockitemname = unlockitemname li.collectrange = collectrange li.collectangle = collectangle end function locked_item_init(e) g_locked_item[e] = {} local li = g_locked_item[e] li.unlockitemname = "" li.collectrange = 100 li.collectangle = 10 SetActivated(e,1) end function locked_item_main(e) local li = g_locked_item[e] if U.PlayerLookingNear(e,li.collectrange,li.collectangle) == true then local astate = g_Entity[e]['activated'] if astate == 1 then PromptLocal(e,"You need to collect the "..li.unlockitemname.." to unlock this item") elseif astate == 2 then PromptLocal(e,"Unlock the "..GetEntityName(e).."? (E)") if g_KeyPressE == 1 then if presse == 0 then PlaySound(e,0) PromptDuration("Collected the "..GetEntityName(e),1000) ActivateIfUsed(e) Destroy(e) end presse = 1 else presse = 0 end end end end