User Tools

Site Tools


lua:scripting:examples:astarkspank

Place 100 random Astarks in luai:

for i=1,100 do
    getrandomroom():mload(4849)
end
Name:        [commander astar]
Area:        [  142] Special Gear
Act:         [npc sentinel no_track trigger_always no_quest safe traveller]
Vnum:        [ 4849]         Sex: [male   ]     Race: [minotaur]
Level:       [  0]         Align: [   0]
Hitroll:     [100%=    0] Damage: [100%=    2] Dam Type: [none]
Hitpoints:   [100%=   50]   Mana: [100%=   50]     Move: [100%=   50]
Armor:       [100%=  100]  Saves: [100%=    0]
Affected by: [dark_vision]
Form:        [edible sentient biped mammal]
Parts:       [head arms legs heart brains guts hands feet fingers ear eye tail horns]
Imm:         [summon]
Res:         [bash cold]
Vuln:        [disease]
Off:         [none]
Size:        [huge]
Start pos.   [standing]
Default pos  [standing]
Wealth:      [100%=0]
Stance:      [default]
Short descr: Commander Astark
Long descr:
Commander Astark is here with a swollen behind
Description:
It's the BIRTHDAY BOY.
Comments:
Astark's bday quest mob.
MOBPrograms for [ 4849]:
 Number Vnum Trigger Phrase
 ------ ---- ------- ------
[    0] 4849   TIMER 300
[    1] 4849  SOCIAL spank
-- astark's bday mob (4849)
if trigtype=="social" then
    local tbl=loadtbl("astark_bday") or {}
 
    local cnt =  tbl[ch.name] or 0
 
    if cnt >= 27 then
        say("You've reddened my butt quite enough!")
        emote("disappears!")
        goto("wrandom")
        return
    end
 
    cnt=cnt+1
 
    tbl[ch.name]=cnt
    savetbl( "astark_bday", tbl)
 
    if cnt < 27 then
        emote("giggles happily.")
        say("Oh you rascal!")
        reward(ch, "qp", randnum(1,3))
        emote("disappears!")
        goto("wrandom")
        return
    else
        say("Alright, enough, enough! You win!")
        reward(ch, "qp", 25)
        emote("disappears!")
        goto("wrandom")
        return
    end
 
elseif trigtype=="timer" then
    say("I'm outta here!")
    emote("disappears!")
    goto("wrandom")
 
elseif trigtype=="call" then -- mprun 4849 to show status
    local tbl=getmobproto(4849).area:loadtbl("astark_bday") or {}
 
    for k,v  in pairs(tbl) do
        sendtochar( mob, ("%-15s %d\n\r"):format(k,v) )
    end
end
lua/scripting/examples/astarkspank.txt · Last modified: 2014/12/24 05:19 by vodur