[Script Help] Hunter Pet Script with Error Provided menu

Shout-Out

User Tag List

Results 1 to 4 of 4
  1. #1
    BanzBoyz77's Avatar Contributor
    Reputation
    83
    Join Date
    Aug 2010
    Posts
    258
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Script Help] Hunter Pet Script with Error Provided

    Its pretty basic, I am creating a hunter pet that will spawn, follow and protect the hunter from level 1 to level 10. So far I have tried parts of the script to work but that didn't even work. Heres the script:
    function On_Quest_Accept(event, pPlayer, questId, pQuestGiver)
    if (player:GetPlayerClass() == "Hunter") then
    print("class Hunter is valid")
    if (player:GetPlayerRace() == "Human") then
    print("race Human is valid")
    if player:GetLevel() < 10 then
    pPlayer:SpawnCreature(85600, -1268.229980, -5504.678223, 5.145780, pPlayer:GetO(0.00000), 71, 0)
    pPlayer:CreateGuardian(85600, 0, 90, 1)
    end
    end

    RegisterServerHook(14, "On_Quest_Accept")
    And the error
    scripts\Pets.lua:17: 'end' expected <to close 'if' at line 2> near '<eof>'
    If anyone can, can you add to the script so that the npc follows the player around and despawns once player hits 10?

    [Script Help] Hunter Pet Script with Error Provided
  2. #2
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,555
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Indentation, indentation, indentation!

    You had a missing end.

    Also fixed the 'logic' of the script.

    Code:
    function SERVER_HOOK_ENTER_WORLD_2(event, player)
    	if (player:GetPlayerClass() == "Hunter") then
    	print("class Hunter is valid")
    		if (player:GetPlayerRace() == "Human") then
    		print("race Human is valid")
    		if player:GetLevel() < 10 then
    			print("Valid level")
    			player:CreateGuardian(85600, 0, 90, pPlayer:GetLevel()) -- ID duration angle level
    		end
    	end
    end
    
    RegisterServerHook(19, "SERVER_HOOK_ENTER_WORLD_2") -- Using this we can use each mapID, so it won't spawn multiple npc's for each quest and just have the 1 always
    
    function SERVER_HOOK_POST_LEVELUP(event, player)
    	if player:GetLevel() == 10 then
    	local guard = player:GetCreatureNearestCoords(player:GetX(), player:GetY(), player:GetZ(), 85600) -- x y z id
    		if guard ~= nil then
    			guard:Despawn(1,0)
    		end
    	end
    end
    
    RegisterServerHook(27, "SERVER_HOOK_POST_LEVELUP") -- When player levels up

  3. #3
    BanzBoyz77's Avatar Contributor
    Reputation
    83
    Join Date
    Aug 2010
    Posts
    258
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh crap,I did on quest accept as hook, my bad. Thanks Stoneharry, for every fix in this script. +rep if I can, I've repped you so much Idk if i can rep you anymore.

    ---------- Post added at 10:53 AM ---------- Previous post was at 10:48 AM ----------

    One sec, now I get an error that says scripts\Pets.lua:29: 'end' expected <to close 'function' at line 1> near '<eof>', so where would the end go?

    ---------- Post added at 11:06 AM ---------- Previous post was at 10:53 AM ----------

    Fixed that, New problem. It only printed that it's a hunter, not that its a human or below level 10. Meaning it's not reading that it's a human or below level 10. What now???

  4. #4
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,555
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Whops, I missed an end.

    What you can do is this:

    local race = player:GetPlayerRace()
    print(race)

    So you can see what it is returning and alter the script to correctly work.

Similar Threads

  1. [ArcEmu] Need help with hunter pet please
    By spoon089 in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 11-19-2010, 05:20 PM
  2. Make Hunter Pets Dance with Grenades
    By TheAquarian in forum World of Warcraft Exploits
    Replies: 14
    Last Post: 01-11-2009, 05:29 PM
  3. [Help Plzzzz] LUA Problem with KJ Script
    By Arthas117 in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 08-16-2008, 05:25 PM
  4. [Need help] What's wrong with this script?
    By Arthas117 in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 01-10-2008, 02:04 PM
All times are GMT -5. The time now is 02:28 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search