Tipologie server: -
*Resursă folosită: -
*ServerFiles utilizat: -
*Syserr:
SYSERR: Jan 12 14:20:28 :: RunState: LUA_ERROR: [string "mount"]:9: attempt to call field `get_mount' (a nil value) SYSERR: Jan 12 14:20:28 :: WriteRunningStateToSyserr: LUA_ERROR: quest mount.start clickPoză: -
*Detalii suplimentare: Tin sa precizez ca totul este perfect functional, doar ca ma streseaza eroarea asta.
Quest :
quest mount begin
state __FUNC__ begin
function data()
return{
-- mounts
[71114]={20110,20110},
[71116]={20111,20111},
[71118]={20112,20112},
[71120]={20113,20113},
[71121]={20114,20114},
[71125]={20115,20115},
[71126]={20116,20116},
[71127]={20117,20117},
[71128]={20118,20118},
[71137]={20120,20120},
[71138]={20121,20121},
[71139]={20122,20122},
[71140]={20122,20123},
[71141]={20123,20124},
[71142]={20124,20125},
[71161]={20224,20224},
[71171]={20227,20227},
[71172]={20226,20226},
-- pets
[53001]={0,34001},
[53002]={0,34002},
[53003]={0,34003},
[53005]={0,34004},
[53006]={0,34004},
[53007]={0,34010},
[53009]={0,34012},
[53010]={0,34008},
[53011]={0,34007},
[53012]={0,34005},
[53013]={0,34006},
[53015]={0,34014},
[53016]={0,34015},
[53017]={0,34016},
[53018]={0,34022},
[53019]={0,34023},
}
end
function get_timer_sec() return 2 end -- bug check time
function is_spam_check() return true end
function get_ride_sec() return 1800 end -- how much seconds you want to be mounted, best time is 30 minute (1800s), after the time is finished player is unmounted automatic
function npc_to_item(vnum)
for k,v in pairs(mount.data()) do
if v[1] == vnum then
return k
end
end
return 0
end
function check_map() if pc.get_map_index() == 113 then return true end return false end
function summon_pet(vnum)
pet.summon(vnum, string.format("'s %s",mob_name(vnum)), false)
end
function mount(data,vnum)
if pc.is_polymorphed() then syschat("You can't ride while polymorphed") return end
if horse.is_riding() == true then syschat("You already ride a mount") return end
if horse.is_summon() then horse.unsummon() end
pc.mount(data[1], mount.get_ride_sec())
-- bonus give
for i=0,2 do
aType=item.get_apply_type(vnum,i)
aValue=item.get_apply_value(vnum,i)
if aType > 0 and aValue > 0 then
--chat(string.format("[%d] type %d value %d",i,item.get_apply_type(vnum,i),item.get_apply_value(vnum,i)))
pc.mount_bonus(aType,aValue,mount.get_ride_sec())
end
end
end
end
state start begin
-- ## OPTIONAL
when 20110.click or 20111.click or 20112.click or 20113.click or 20114.click or 20115.click or 20116.click or 20117.click or 20118.click or 20120.click or 20121.click or 20122.click or 20123.click or 20124.click or 20125.click or 20224.click or 20226.click or 20227.click begin -- when click on the NPC
local msgs={
"You are my Boss",
"[SA]Sami is the best Owner",
}
chat(string.format("|cffffc8c8%s:|r %s",npc.get_name(),msgs[math.random(1,table.getn(msgs))]))
end
-- add your vnums here too ...
when 53001.use or 53002.use or 53003.use or 53005.use or 53006.use or 53007.use or 53009.use or 53010.use or 53011.use or 53012.use or 53013.use or 53015.use or 53016.use or 53017.use or 53018.use or 53019.use with mount.data()[item.vnum] begin
if mount.check_map() then return end
-- ## SPAM CHECK
if mount.is_spam_check() then
if not lastPulse then lastPulse = get_time() end
if (not lastPulseNumber and lastPulseNumber != 0) then lastPulseNumber = 0 end
if (get_time() - lastPulse <= 1) then
if lastPulseNumber >= 5 then chat(string.format("%s: Anti spam system has blocked your action.",item_name(item.vnum))) return end
lastPulseNumber = lastPulseNumber + 1
else lastPulseNumber = lastPulseNumber - 1 end
lastPulse = get_time()
end
-- ## SPAM CHECK END
local itemVnum = item.vnum
local data = mount.data()[itemVnum]
local name = pc.get_name()
local limit = 0
if NEW_MOUNT_STATES[name] and pet.is_summon(NEW_MOUNT_STATES[name][2]) then
limit = 1
end
if not pet.is_summon(data[2]) then
if pet.count_summoned()-limit >= 1 then
chat("You cannot summon more animals")
return
end
if data[2] == 0 then return end -- fix
mount.summon_pet(data[2])
if not NEW_PET_STATES[name] then
table.insert(NEW_PET_STATES,name)
end
NEW_PET_STATES[name] = {data[1],data[2],itemVnum,item.get_id(),"follow"}
else
pet.unsummon(data[2])
if NEW_PET_STATES[name] then NEW_PET_STATES[name][5] = "away" end
end
end
when 71114.use or 71116.use or 71118.use or 71120.use or 71121.use or 71125.use or 71126.use or 71127.use or 71128.use or 71137.use or 71138.use or 71139.use or 71140.use or 71141.use or 71142.use or 71161.use or 71171.use or 71172.use with mount.data()[item.vnum] begin
if mount.check_map() then return end
-- ## SPAM CHECK
if mount.is_spam_check() then
if not lastPulse then lastPulse = get_time() end
if (not lastPulseNumber and lastPulseNumber != 0) then lastPulseNumber = 0 end
if (get_time() - lastPulse <= 1) then
if lastPulseNumber >= 5 then chat(string.format("%s: Anti spam system has blocked your action.",item_name(item.vnum))) return end
lastPulseNumber = lastPulseNumber + 1
else lastPulseNumber = lastPulseNumber - 1 end
lastPulse = get_time()
end
-- ## SPAM CHECK END
if horse.is_riding() then syschat("Deja calaresti") return end
local itemVnum = item.vnum
local data = mount.data()[itemVnum]
local name = pc.get_name()
if not NEW_MOUNT_STATES[name] then
table.insert(NEW_MOUNT_STATES,name)
end
if NEW_MOUNT_STATES[name] then
if (pc.is_mount() or pet.is_summon(NEW_MOUNT_STATES[name][2])) and item.vnum != NEW_MOUNT_STATES[name][3] then
itemVnum = NEW_MOUNT_STATES[name][3]
data = mount.data()[itemVnum]
end
end
if not pc.is_mount() and not pet.is_summon(data[2]) then
mount.summon_pet(data[2])
if horse.is_summon() then horse.unsummon() end
chat(string.format("|cffffc8c8%s's %s:|r I am here my master!",pc.get_name(),mob_name(data[2])))
NEW_MOUNT_STATES[name] = {data[1],data[2],itemVnum,item.get_id(),"follow"}
cleartimer("bugcheck")
loop_timer("bugcheck", mount.get_timer_sec())
return
end
if not pc.is_mount() and pet.is_summon(data[2]) then
pet.unsummon(data[2])
mount.mount(data,itemVnum)
NEW_MOUNT_STATES[name] = {data[1],data[2],itemVnum,item.get_id(),"mount"}
return
end
if pc.is_mount(data[1]) then
pc.unmount()
mount.summon_pet(data[2])
NEW_MOUNT_STATES[name] = {data[1],data[2],itemVnum,item.get_id(),"follow"}
cleartimer("bugcheck")
loop_timer("bugcheck", mount.get_timer_sec())
return
end
end
when login begin
if mount.check_map() then return end
local name = pc.get_name()
--chat(tostring(NEW_MOUNT_STATES[name]))
if NEW_MOUNT_STATES[name] and NEW_MOUNT_STATES[name][5] == "follow" then
item.select(NEW_MOUNT_STATES[name][4])
mount.summon_pet(NEW_MOUNT_STATES[name][2])
cleartimer("bugcheck")
loop_timer("bugcheck", mount.get_timer_sec())
elseif NEW_MOUNT_STATES[name] then
cleartimer("bugcheck")
loop_timer("bugcheck", mount.get_timer_sec())
end
if NEW_PET_STATES[pc.get_name()] then
item.select(NEW_PET_STATES[name][4])
mount.summon_pet(NEW_PET_STATES[name][2])
end
end
when logout begin
if mount.check_map() then return end
local name = pc.get_name()
if NEW_PET_STATES[name] and not pet.is_summon(NEW_PET_STATES[name][2]) then
NEW_PET_STATES[name][5] = "away"
end
end
when bugcheck.timer begin
local name = pc.get_name()
--chat("checking")
if NEW_MOUNT_STATES[name] and horse.is_riding() == true and pet.is_summon(NEW_MOUNT_STATES[name][2]) then
horse.unride()
pet.unsummon(NEW_MOUNT_STATES[name][2])
end
if NEW_MOUNT_STATES[name] and pet.is_summon(NEW_MOUNT_STATES[name][2]) and horse.is_summon() then
horse.unsummon()
end
if pc.is_mount() and pc.count_item(mount.npc_to_item(pc.get_mount())) == 0 then
pc.unmount()
cleartimer("bugcheck")
end
--if NEW_MOUNT_STATES[name] then
-- chat(NEW_MOUNT_STATES[name][5])
--end
if NEW_MOUNT_STATES[name] and pet.is_summon(NEW_MOUNT_STATES[name][2]) == false then
NEW_MOUNT_STATES[name][5] = "away"
--chat("away")
cleartimer("bugcheck")
end
end
end
end
