local find = string.find local sub = string.sub g_qname = {} g_qnum = {} g_qsteps = {} g_qtype = {} g_qpoints = {} g_qid = 1 g_qscore = 0 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 local args = {} function simplequest_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_qtype [ e ] = tonumber( myArgs[ 4 ] ) g_qpoints [ e ] = tonumber( myArgs[ 5 ] ) g_qid = 1 g_multicurrent = 0 g_multiflag = 0 g_qscore = 0 end function simplequest_main( e ) local PlayerDist = GetPlayerDistance( e ) --------------------------------------------------------------- Handles the flag for multiple step quests if g_qnum[e] == g_qid and g_multiflag == 0 then g_multiflag = 1 g_multimax = g_qsteps[ e ] g_multicurrent = 0 end --------------------------------------------------------------- Pickup Quests (1) if g_qnum[e] == g_qid and g_qtype[e] == 1 then if PlayerDist < 80 and g_PlayerHealth > 0 then Prompt ( "Press E To collect the " .. g_qname[ e ] ) if g_KeyPressE == 1 then if g_multicurrent < g_multimax then PlaySound( e, 0 ) g_multicurrent = g_multicurrent + 1 g_qscore = g_qscore + g_qpoints[ e ] g_qupdate = 1 Destroy( e ) elseif g_multicurrent == g_multimax then PlaySound( e, 0 ) g_qid = g_qid + 1 g_qscore = g_qscore + g_qpoints[ e ] g_multicurrent = 0 g_multiflag = 0 g_qupdate = 1 Destroy( e ) end end end end --------------------------------------------------------------- Collect Quests (2) if g_qnum[e] == g_qid and g_qtype[e] == 2 then if PlayerDist < 80 and g_PlayerHealth > 0 then if g_multicurrent < g_multimax then PlaySound( e, 0 ) g_multicurrent = g_multicurrent + 1 g_qupdate = 1 Destroy( e ) elseif g_multicurrent == g_multimax then PlaySound( e, 0 ) g_qid = g_qid + 1 g_qscore = g_qscore + g_qpoints[ e ] g_multicurrent = 0 g_multiflag = 0 g_qupdate = 1 Destroy( e ) end end end --------------------------------------------------------------- Quest Trigger Zone (3) if g_qnum[e] == g_qid and g_qtype[e] == 3 then if g_Entity[e].plrinzone == 1 then if g_multicurrent < g_multimax then PlaySound( e, 0 ) g_multicurrent = g_multicurrent + 1 g_qscore = g_qscore + g_qpoints[ e ] g_qupdate = 1 Destroy(e) ActivateIfUsed(e) elseif g_multicurrent == g_multimax then PlaySound( e, 0 ) g_qid = g_qid + 1 g_qscore = g_qscore + g_qpoints[ e ] g_multicurrent = 0 g_multiflag = 0 g_qupdate = 1 Destroy( e ) end end end --------------------------------------------------------------- Quest Win Zone (4) if g_qnum[e] == g_qid and g_qtype[e] == 4 then if g_Entity[e].plrinzone ==1 then if g_multicurrent < g_multimax then g_multicurrent = g_multicurrent + 1 g_qscore = g_qscore + g_qpoints[ e ] g_qupdate = 1 Destroy(e) elseif g_multicurrent == g_multimax then JumpToLevelIfUsed(e) g_qid = g_qid + 1 g_qscore = g_qscore + g_qpoints[ e ] g_multicurrent = 0 g_multiflag = 0 g_qupdate = 1 end end end end