ZyuX 670 Posted January 7, 2018 Share Posted January 7, 2018 Hello, I got a problem with get_mount function. It's added in queslua_pc.cpp and quest_function. SYSERR: Jan 7 15:36:31 :: RunState: LUA_ERROR: [string "mount"]:2: attempt to call field `get_mount' (a nil value) SYSERR: Jan 7 15:36:31 :: WriteRunningStateToSyserr: LUA_ERROR: quest mount.start click Quest: quest mount begin state __FUNC__ begin function data() return { -- mounts -- Note: Mounts have bonus from quest, make sure you remove their bonus from item_proto and they are type 18 -- [item vnum] = {first mob vnum,second mob vnum,bonus id,bonus value}, -- Note: You can find bonus variables in questlib.lua -- Note: Second mob vnum normally is the same with first but if you have errors in server syserr with pet motions for example lion you need to fix the folder with mob like I did and put different mob vnum like i did for lion (20212 - 29212) [71125] = {20209,20209, {{apply.ATTBONUS_MONSTER,20},}, }, [71126] = {20210,20210, {{apply.ATTBONUS_MONSTER,10},{apply.MAX_HP,1000},}, }, [71127] = {20211,20211, {{apply.ATTBONUS_MONSTER,10},{apply.IMMUNE_STUN,1},}, }, [71128] = {20212,29212, {{apply.ATTBONUS_MONSTER,10},{apply.STEAL_HP,10},}, }, -- pets -- Note: pets have bonus from item_proto -- [item vnum] = {leave this 0,mob vnum}, [53003] = {0,34003}, [53010] = {0,34008}, [53011] = {0,34007}, [53012] = {0,34005}, [53013] = {0,34006}, [53017] = {0,34016}, } end function get_timer_sec() return 2 end -- anti spam time 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 is_only_pet(arg1,arg2) if arg2 and arg1 == 0 then return true else return false end end function run_from_far() return false end function npc_to_item(vnum) local found = 0 for k,v in pairs(mount.data()) do if v[1] == vnum then found = k break end end return found end function check_map() if pc.get_map_index() == 113 then return true end return false end function summon_pet(data) if mount.check_map() then return end if data[2] and data[1] and data[2] != data[1] then if data[2] == 0 then return end -- fix pet.summon(data[2], string.format("'s %s",mob_name(data[2])), mount.run_from_far()) else if data[1] == 0 then return end -- fix pet.summon(data[1], string.format("'s %s",mob_name(data[1])), mount.run_from_far()) end end function mount(itemVnum,itemId) local data = mount.data()[itemVnum] -- mount begins if not mount.is_only_pet(data[1],data[2]) then if pc.is_polymorphed() then syschat("Nu poti calari in timp ce esti transformat") return end if horse.is_riding() == true then syschat("Deja calaresti") return end if horse.is_summon() then horse.unsummon() end if pc.is_mount(data[1]) == true then pc.unmount() cleartimer("bugcheck") if mount.check_map() then return end if pet.is_summon(data[1]) == false then mount.summon_pet(data) -- state save in cache if not NEW_MOUNT_STATES[pc.get_name()] then table.insert(NEW_MOUNT_STATES,pc.get_name()) end NEW_MOUNT_STATES[pc.get_name()] = {{data[1],data[2]},itemId} end return end if pc.is_mount() and pc.is_mount(data[1]) == false then --if pc.is_gm() then syschat(string.format("Schimbare %s -> %s",mob_name(pc.get_mount()),mob_name(data[1]))) --end pc.unmount() cleartimer("bugcheck") if pet.is_summon(pc.get_mount()) == true then pet.unsummon(pc.get_mount()) end -- state save in cache if NEW_MOUNT_STATES[pc.get_name()] then NEW_MOUNT_STATES[pc.get_name()] = {{0,0},0} end end if NEW_MOUNT_STATES[pc.get_name()] then if NEW_MOUNT_STATES[pc.get_name()][1][2] and pet.is_summon(NEW_MOUNT_STATES[pc.get_name()][1][2]) == true then pet.unsummon(NEW_MOUNT_STATES[pc.get_name()][1][2]) -- state save in cache if NEW_MOUNT_STATES[pc.get_name()] then NEW_MOUNT_STATES[pc.get_name()] = {{0,0},0} end end end if mount.check_map() then return end pc.mount(data[1], mount.get_ride_sec()) -- bonus give for each in data[3] do pc.mount_bonus(data[3][each][1],data[3][each][2],mount.get_ride_sec()) end cleartimer("bugcheck") loop_timer("bugcheck", mount.get_timer_sec()) else local limit = 0 if NEW_MOUNT_STATES[pc.get_name()] and NEW_MOUNT_STATES[pc.get_name()][1][2] and pet.is_summon(NEW_MOUNT_STATES[pc.get_name()][1][2]) then limit = 1 end -- pet begins if pet.is_summon(data[2]) == false and pet.count_summoned()-limit >= 1 then chat("Nu poti invoca mai multe animale") return end if pet.is_summon(data[2]) == false then if data[2] == 0 then return end -- fix pet.summon(data[2], string.format("'s %s",mob_name(data[2])), mount.run_from_far()) -- state save in cache if not NEW_PET_STATES[pc.get_name()] then table.insert(NEW_PET_STATES,pc.get_name()) end NEW_PET_STATES[pc.get_name()] = {item.get_id(),data[2]} return else pet.unsummon(data[2]) end end end end state start begin -- add your vnums here too ... when 71125.use or 71126.use or 71127.use or 71128.use or 53003.use or 53010.use or 53011.use or 53012.use or 53013.use or 53017.use with mount.data()[item.vnum] begin -- anti spam start if not lastPulse then lastPulse = get_time() end if not lastPulseNumber then lastPulseNumber = 0 end if (get_time() - lastPulse <= 1) then if lastPulseNumber >= 2 then chat("Anti spam blocked you my friend.") return end lastPulseNumber = lastPulseNumber + 1 else lastPulseNumber = lastPulseNumber - 1 end lastPulse = get_time() -- anti spam end mount.mount(item.vnum,item.get_id()) end when login begin if mount.check_map() then return end if NEW_MOUNT_STATES[pc.get_name()] and NEW_MOUNT_STATES[pc.get_name()][1][2] and NEW_MOUNT_STATES[pc.get_name()][2] then local enable_timer = true --syschat(string.format("%d %d",NEW_MOUNT_STATES[pc.get_name()][1][2],NEW_MOUNT_STATES[pc.get_name()][2])) if not mount.is_only_pet(NEW_MOUNT_STATES[pc.get_name()][1][1],NEW_MOUNT_STATES[pc.get_name()][1][2]) then --syschat(string.format("%d %d",NEW_MOUNT_STATES[pc.get_name()][2],NEW_MOUNT_STATES[pc.get_name()][1][2])) item.select(NEW_MOUNT_STATES[pc.get_name()][2]) mount.summon_pet(NEW_MOUNT_STATES[pc.get_name()][1]) enable_timer = true end if enable_timer then loop_timer("bugcheck", mount.get_timer_sec()) end end if NEW_PET_STATES[pc.get_name()] and NEW_PET_STATES[pc.get_name()][1] and NEW_PET_STATES[pc.get_name()][2] then item.select(NEW_PET_STATES[pc.get_name()][1]) mount.summon_pet(NEW_PET_STATES[pc.get_name()]) end end when logout begin if mount.check_map() then return end if NEW_PET_STATES[pc.get_name()] then if pet.is_summon(NEW_PET_STATES[pc.get_name()][2]) == false then NEW_PET_STATES[pc.get_name()] = {0,0} end end if NEW_MOUNT_STATES[pc.get_name()] then if pet.is_summon(NEW_MOUNT_STATES[pc.get_name()][1][2]) == false then NEW_MOUNT_STATES[pc.get_name()] = {{0,0},0} end end end when bugcheck.timer begin -- to check if player still have the item in inventory while mounted --chat("checking") if pc.is_mount() then if pc.count_item(mount.npc_to_item(pc.get_mount())) == 0 then pc.unmount() cleartimer("bugcheck") end else cleartimer("bugcheck") end end end end Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted January 7, 2018 Premium Share Posted January 7, 2018 pc.get_mount() doesn't exist, simple as that. 1 "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
ZyuX 670 Posted January 7, 2018 Author Share Posted January 7, 2018 Acum 15 minute, Syreldar a spus: pc.get_mount() doesn't exist, simple as that. And I should to add in quest_functions. Right? EDIT: pc.get_mount is already in quest_function. Link to comment Share on other sites More sharing options...
Vanilla 1455 Posted January 7, 2018 Share Posted January 7, 2018 can we see the implementation in questlua_pc? I guess you didn't add it properly. The error already states that it's added to quest_functions but there's no such called function implemented into the core! So either you misspelled or didn't add it to the core at all. 1 We are the tortured. We're not your friends. As long as we're not visible. We are unfixable. Link to comment Share on other sites More sharing options...
Premium Syreldar 1875 Posted January 7, 2018 Premium Share Posted January 7, 2018 3 hours ago, ZyuX said: And I should to add in quest_functions. Right? EDIT: pc.get_mount is already in quest_function. No i mean in the source XD 1 "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
ZyuX 670 Posted January 7, 2018 Author Share Posted January 7, 2018 This is the implementation in questlua_pc.cpp int pc_get_mount(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); lua_pushnumber(L, ch->GetMountVnum()); return 1; } Link to comment Share on other sites More sharing options...
Vanilla 1455 Posted January 7, 2018 Share Posted January 7, 2018 This is the whole implementation? I guess you're missing something. You need to add it to void RegisterPCFunctionTable(). In your case this should look like: { "get_mount", pc_get_mount }, 1 We are the tortured. We're not your friends. As long as we're not visible. We are unfixable. Link to comment Share on other sites More sharing options...
ZyuX 670 Posted January 7, 2018 Author Share Posted January 7, 2018 It's added { "get_mount", pc_get_mount }, Link to comment Share on other sites More sharing options...
Solution Vanilla 1455 Posted January 7, 2018 Solution Share Posted January 7, 2018 Maybe it's just a small mistake but did you recompile and replace the core with your new version? And did you double-check that it's added to the list before the NULL, NULL entry? And you saved everything and recompiled the core with the changes? Because it seems like something went wrong, the program can't find the function. 1 We are the tortured. We're not your friends. As long as we're not visible. We are unfixable. Link to comment Share on other sites More sharing options...
ZyuX 670 Posted January 7, 2018 Author Share Posted January 7, 2018 Yes, all yes. It's added before the NULL,NULL, and yes I saved all changes. Link to comment Share on other sites More sharing options...
ZyuX 670 Posted January 8, 2018 Author Share Posted January 8, 2018 Fixed. Thank you. Link to comment Share on other sites More sharing options...
Салом 20 Posted January 8, 2018 Share Posted January 8, 2018 Acum 8 ore, ZyuX a spus: Fixed. Thank you. tell us how Link to comment Share on other sites More sharing options...
ZyuX 670 Posted January 10, 2018 Author Share Posted January 10, 2018 I deleted #ifdef from questlua_pc.cpp and now work. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now