g_qname = {} g_qnum = {} g_qsteps = {} g_qid = 1 g_multimax = 1 g_multicurrent = 0 local function GetArgs( str, sep ) local sep = sep or ',' local pos = 1 local list = {} local length = #str while pos < length + 1 do local nextPos = find( str, sep, pos + 1 ) or length if nextPos < length then list[ #list + 1 ] = sub( str, pos, nextPos - 1 ) else list[ #list + 1 ] = sub( str, pos, nextPos ) break end pos = nextPos + 1 end return list end function simplequestcollect_init_name(e,name) args[e] = GetArgs( name ) local myArgs = args[e] g_qname[e] = myArgs[ 1 ] g_qnum[e] = tonumber(myArgs[ 2 ]) g_qsteps[e] = tonumber(myArgs[ 3 ]) g_qid = 1 g_multicurrent = 0 g_multiflag = 0 end function simplequestcollect_main(e) PlayerDist = GetPlayerDistance(e) if g_qnum[e] == g_qid then args[e] = GetArgs( name ) g_multiflag = 1 g_multimax = g_qsteps[e] g_multicurrent = 0 if PlayerDist < 80 and g_PlayerHealth > 0 then Prompt ("Press E To collect the "..g_qname[e]) if g_KeyPressE == 1 and g_multicurrent < g_multimax then PlaySound(e,0) g_multicurrent = g_multicurrent+1 Destroy(e) end if g_KeyPressE == 1 and g_multicurrent == g_multimax then PlaySound(e,0) g_qid = g_qid+1 g_multicurrent = 0 g_multiflag = 0 Destroy(e) end end end end