Using Task Data To Count NPC Deaths
See example on the bottom of page: http://www.aardwolf.com/lua/lua-mud-goals.html
Part 1:
Program checks for taskdata, is it complete? Example shows for tracking 2 mob deaths
if taskopen(ch,goal#,task#) then --- are we done? if taskdata(ch,goal#,task#1) == 0 and taskdata(ch,goal#,task#2) == 0 then sayto(ch,"You did it! Congratulations "..ch.name.."!")
Part 2:
Program opens tasks that is checking data
addtask(ch,6,0) addtask(ch,6,1) taskdata(ch,6,0,50) taskdata(ch,6,1,50) sayto(ch,"Thank you, "..ch.name..".
Part 3:
Program added to mobs that give credit
if taskopen(ch,goal#,task!) then local tstat = taskdata(ch,goal#,task#) if tstat > 0 then taskdata(ch,goal#,task#,tstat-1) end
Part 4:
Qedit Goal# Choose Task# C Flags: showstatus Q B -modify description