lua:scripting:examples:olcscripts
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| lua:scripting:examples:olcscripts [2015/03/15 23:48] – [Shop wands/staffs have 50/50 charges, otherwise set to -1/50] vodur | lua:scripting:examples:olcscripts [2016/10/02 03:26] (current) – [Reduce wealth of shops over 100%] vodur | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== OLC scripts ====== |
| ===== Edit all wands and staffs to have 50/50 charges ===== | ===== Edit all wands and staffs to have 50/50 charges ===== | ||
| Line 87: | Line 87: | ||
| ===== Surreal reset culling ===== | ===== Surreal reset culling ===== | ||
| - | http:// | + | [[http:// |
| <code lua> | <code lua> | ||
| - | <font 11.6999998092651px line-height: | + | do |
| - | <font 11.6999998092651px line-height: | + | local area=getroom(2031).area |
| - | <font 11.6999998092651px line-height: | + | for _,room in pairs(area.rooms) do |
| - | <font 11.6999998092651px line-height: | + | local edited=false |
| - | <font 11.6999998092651px line-height: | + | clearloopcount() |
| - | <font 11.6999998092651px line-height: | + | local finished |
| - | <font 11.6999998092651px line-height: | + | while not finished do |
| - | <font 11.6999998092651px line-height: | + | finished=true |
| - | <font 11.6999998092651px line-height: | + | local num_resets=# |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | |
| - | <font 11.6999998092651px line-height: | + | for i,reset in ipairs(room.resets) do |
| + | if reset.command==" | ||
| + | goto(room.vnum) | ||
| + | local rmax=reset.arg4 | ||
| + | local amax=reset.arg2 | ||
| + | local mvnum=reset.arg1 | ||
| + | |||
| + | if amax>25 then | ||
| + | local newmax=25 | ||
| + | rmax=math.min(rmax,newmax) | ||
| + | --local newmax=math.max(20, amax/2) | ||
| + | | ||
| + | edited=true | ||
| + | mdo(" | ||
| + | mdo(" | ||
| + | finished=false | ||
| + | break | ||
| + | end | ||
| + | end | ||
| + | end | ||
| + | end | ||
| + | if edited then mdo('reset') end | ||
| + | end | ||
| + | |||
| + | end | ||
| + | </ | ||
| + | ===== Burnproof flag removal / Nonmetal Weapon adjust ===== | ||
| + | |||
| + | <code lua> | ||
| + | function anti_burnproof() | ||
| + | local count = 0 | ||
| + | for _,area in pairs(getarealist()) do | ||
| + | if not area: | ||
| + | for _,op in pairs(area.objprotos) do | ||
| + | if op:extra(" | ||
| + | | ||
| + | mdo(" | ||
| + | olc(" | ||
| + | olc(" | ||
| + | count = count + 1 | ||
| + | end | ||
| + | end | ||
| + | end | ||
| + | end | ||
| + | sendtochar(mob, | ||
| + | end | ||
| + | |||
| + | function nonmetal_weapons() | ||
| + | local count = 0 | ||
| + | for _,area in pairs(getarealist()) do | ||
| + | if not area:flag(" | ||
| + | for _,op in pairs(area.objprotos) do | ||
| + | if op: | ||
| + | -- remove burnproof flag using olc | ||
| + | mdo(" | ||
| + | olc(" | ||
| + | olc(" | ||
| + | count = count + 1 | ||
| + | | ||
| + | end | ||
| + | end | ||
| + | end | ||
| + | sendtochar(mob, | ||
| + | end | ||
| + | </code> | ||
| + | ===== Reduce wealth of shops over 100% ===== | ||
| + | |||
| + | <code lua> | ||
| + | do | ||
| + | |||
| + | local cnt = 0 | ||
| + | |||
| + | for _,area in pairs(getarealist()) do | ||
| + | for _,mp in pairs(area.mobprotos) do | ||
| + | if mp.shop and mp.wealthpcnt> | ||
| + | mdo(" | ||
| + | olc(" | ||
| + | olc(' | ||
| + | cnt = cnt + 1 | ||
| + | |||
| + | end | ||
| + | end | ||
| + | end | ||
| + | local msg = " | ||
| + | log(msg, ' | ||
| + | end | ||
| </ | </ | ||
lua/scripting/examples/olcscripts.1426463304.txt.gz · Last modified: 2015/03/15 23:48 by vodur