lua:scripting:examples:olcscripts
This is an old revision of the document!
Table of Contents
Various OLC scripts
Edit all wands and staffs to have 50/50 charges
do for _,area in pairs(getarealist()) do for _,op in pairs(area.objprotos) do if op.otype=="wand" or op.otype=="wand" then if not(op.chargesleft==50) or not(op.chargestotal==50) then mdo("oedit "..op.vnum) olc("v1 50") olc("v2 50") olc("done") end end end end end
Shop wands/staffs have 50/50 charges, otherwise set to -1/50
-1 makes the # of charges randomize then item pops.
do local cnter=0 local reset_check = {} for _,area in pairs(getarealist()) do for _,room in pairs(area.rooms) do local shop=false for i,reset in ipairs(room.resets) do clearloopcount() local cmd=reset.command if cmd == "M" then if getmobproto(reset.arg1).shop then shop=true else shop=false end elseif cmd == "G" then if shop==true then reset_check[reset.arg1]=true elseif reset_check[reset.arg1]==nil then reset_check[reset.arg1]=false end end end end end for _,area in pairs(getarealist()) do for _,op in pairs(area.objprotos) do if op.otype=="wand" or op.otype=="staff" then local chargesleft_target local chargestotal_target if reset_check[op.vnum]==true then chargesleft_target=50 chargestotal_target=50 else chargesleft_target=-1 chargestotal_target=50 end if not(op.chargesleft==chargesleft_target) or not(op.chargestotal==chargestotal_target) then mdo("oedit "..op.vnum) olc("v1 "..chargestotal_target) olc("v2 "..chargesleft_target) olc("done") end end end end end
for i=1,10 do everything() end
lua/scripting/examples/olcscripts.1426463183.txt.gz · Last modified: 2015/03/15 23:46 by vodur