Player saying somthing menu

User Tag List

Results 1 to 11 of 11
  1. #1
    Xmaily's Avatar Master Sergeant
    Reputation
    14
    Join Date
    May 2013
    Posts
    115
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Player saying somthing

    If i wanted a player to say somthing on picking up a quest what would i do?

    I have

    function Carlosintro1(pUnit, event)
    local pla = pUnit:GetClosestPlayer()
    if pla == nil then
    else
    pla:SendChatMessage(14, 0, "What the f-")

    Anyone know how to make a player say somthing using LuA?

    It's giving me a msg saying player is a nill value

    Aswell my script won't make the npc follow...

    function OnQuestAccept1(event, pPlayer, questId, pQuestGiver)
    if (questId == 30002) then
    pUnit:SetUnitToFollow(player, 2, 1)
    player:GossipComplete(player)
    end
    end

    RegisterServerHook(14, "OnQuestAccept1")
    Last edited by Xmaily; 06-29-2013 at 12:32 AM.

    Player saying somthing
  2. #2
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function Carlosintro1(pUnit, event)
    	local pla = pUnit:GetClosestPlayer()
    	if pla then
    		pla:PlayerSendChatMessage(14, 0, "What the f-")
    	end
    end
    Code:
    function OnQuestAccept1(event, pPlayer, questId, pQuestGiver)
    	if (questId == 30002) then
    		pQuestGiver:SetUnitToFollow(pPlayer, 2, 1) -- pQuestGiver and pPlayer, not pUnit and player
    	end
    end
    
    RegisterServerHook(14, "OnQuestAccept1")

  3. #3
    Xmaily's Avatar Master Sergeant
    Reputation
    14
    Join Date
    May 2013
    Posts
    115
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    Code:
    function Carlosintro1(pUnit, event)
    	local pla = pUnit:GetClosestPlayer()
    	if pla then
    		pla:PlayerSendChatMessage(14, 0, "What the f-")
    	end
    end
    Code:
    function OnQuestAccept1(event, pPlayer, questId, pQuestGiver)
    	if (questId == 30002) then
    		pQuestGiver:SetUnitToFollow(pPlayer, 2, 1) -- pQuestGiver and pPlayer, not pUnit and player
    	end
    end
    
    RegisterServerHook(14, "OnQuestAccept1")
    Thank you so much!! 1 more quest in this quest i want the npc to follow the player and attack with the player. So he attacks but when he leaves combat the following drops

  4. #4
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Xmaily View Post
    Thank you so much!! 1 more quest in this quest i want the npc to follow the player and attack with the player. So he attacks but when he leaves combat the following drops
    Try setting the creature to guard type 2 in creature_proto.

  5. #5
    Xmaily's Avatar Master Sergeant
    Reputation
    14
    Join Date
    May 2013
    Posts
    115
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    Try setting the creature to guard type 2 in creature_proto.
    Just tried it but he still stops following when he leaves combat. I gave him ai_agents would those effect it at all?

    Also regarding the first post i just got to test the script after making the changes and the get the error:

    Player is nil value
    Pla is nil value

    Here is the script

    Code:
        local CarlosAEntryID = 90004
        local InvisAEntryID = 90005
        local OBJECT_END = 0x0006
        local GAMEOBJECT_BYTES_1 = OBJECT_END + 0x000B
         
        function CLO(pUnit, event)
                CarlosA = pUnit
        end
         
        function INS(pUnit, event)
                InvisA = pUnit
        end
         
        RegisterUnitEvent(CarlosAEntryID, 18, "CLO")
        RegisterUnitEvent(InvisAEntryID, 18, "INS")
         
        function OnQuestAccept(event, pPlayer, questId, pQuestGiver)
    	    if (questId == 30001) then
                        InvisA:RegisterEvent("Carlosintro1", 1000, 1)
                        player:GossipComplete(player)
                end
                if (intid == 2) then
                        player:GossipComplete(player)
                end
        end
         
        RegisterServerHook(14, "OnQuestAccept")
         
    function Carlosintro1(pUnit, event)
    	local pla = pUnit:GetClosestPlayer()
    	if pla then
    		pla:PlayerSendChatMessage(14, 0, "What the f-")
                InvisA:SpawnCreature(CarlosAEntryID, 2389.646484, 337.430756, 40.015667, 2.213526, 2, 0)
                InvisA:RegisterEvent("Carlosintro2", 2000, 1)
    	end
    end
    
        function Carlosintro2(pUnit, event)
                CarlosA:SetMovementFlags(1)
                CarlosA:CastSpell(38920)
    local gate = InvisA:GetGameObjectNearestCoords(2387.647705, 341.822815, 39.734871, 176594)
    if gate then
      gate:SetByte(GAMEOBJECT_BYTES_1,0,0) -- open door
                CarlosA:MoveTo(2381.572021, 346.992462, 38.104420, 2.264576)
                InvisA:RegisterEvent("Carlosintro3", 4000, 1)
        end
        end
         
        function Carlosintro3(pUnit, event)
                CarlosA:SendChatMessage(12, 0, "Hey Spanks, its me Carlos!")
                CarlosA:Emote(5, 4000)
                InvisA:RegisterEvent("Carlosintro4", 6000, 1)
        end
         
        function Carlosintro4(pUnit, event)
                pla:SendChatMessage(12, 0, "Oh for goodness sake...")
        end
    Last edited by Xmaily; 06-29-2013 at 10:05 AM.

  6. #6
    HelpzPlease's Avatar Member
    Reputation
    1
    Join Date
    Jun 2013
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Xmaily View Post
    Just tried it but he still stops following when he leaves combat. I gave him ai_agents would those effect it at all?

    Also regarding the first post i just got to test the script after making the changes and the get the error:

    Player is nil value
    Pla is nil value

    Here is the script

    Code:
        local CarlosAEntryID = 90004
        local InvisAEntryID = 90005
        local OBJECT_END = 0x0006
        local GAMEOBJECT_BYTES_1 = OBJECT_END + 0x000B
         
        function CLO(pUnit, event)
                CarlosA = pUnit
        end
         
        function INS(pUnit, event)
                InvisA = pUnit
        end
         
        RegisterUnitEvent(CarlosAEntryID, 18, "CLO")
        RegisterUnitEvent(InvisAEntryID, 18, "INS")
         
        function OnQuestAccept(event, pPlayer, questId, pQuestGiver)
    	    if (questId == 30001) then
                        InvisA:RegisterEvent("Carlosintro1", 1000, 1)
                        player:GossipComplete(player)
                end
                if (intid == 2) then
                        player:GossipComplete(player)
                end
        end
         
        RegisterServerHook(14, "OnQuestAccept")
         
    function Carlosintro1(pUnit, event)
    	local pla = pUnit:GetClosestPlayer()
    	if pla then
    		pla:PlayerSendChatMessage(14, 0, "What the f-")
                InvisA:SpawnCreature(CarlosAEntryID, 2389.646484, 337.430756, 40.015667, 2.213526, 2, 0)
                InvisA:RegisterEvent("Carlosintro2", 2000, 1)
    	end
    end
    
        function Carlosintro2(pUnit, event)
                CarlosA:SetMovementFlags(1)
                CarlosA:CastSpell(38920)
    local gate = InvisA:GetGameObjectNearestCoords(2387.647705, 341.822815, 39.734871, 176594)
    if gate then
      gate:SetByte(GAMEOBJECT_BYTES_1,0,0) -- open door
                CarlosA:MoveTo(2381.572021, 346.992462, 38.104420, 2.264576)
                InvisA:RegisterEvent("Carlosintro3", 4000, 1)
        end
        end
         
        function Carlosintro3(pUnit, event)
                CarlosA:SendChatMessage(12, 0, "Hey Spanks, its me Carlos!")
                CarlosA:Emote(5, 4000)
                InvisA:RegisterEvent("Carlosintro4", 6000, 1)
        end
         
        function Carlosintro4(pUnit, event)
                pla:SendChatMessage(12, 0, "Oh for goodness sake...")
        end
    I thought that WoW uses C++...there are some LUA involved?

  7. #7
    Xmaily's Avatar Master Sergeant
    Reputation
    14
    Join Date
    May 2013
    Posts
    115
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by HelpzPlease View Post
    I thought that WoW uses C++...there are some LUA involved?
    I depends on the Core your using for example Trinity is only C++ but Arcemu is LuA.

  8. #8
    HelpzPlease's Avatar Member
    Reputation
    1
    Join Date
    Jun 2013
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Xmaily View Post
    I depends on the Core your using for example Trinity is only C++ but Arcemu is LuA.
    Oh alright I use Arcemu.

  9. #9
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Xmaily View Post
    I depends on the Core your using for example Trinity is only C++ but Arcemu is LuA.
    TrinityCore with Eluna supports Lua.

  10. #10
    Xmaily's Avatar Master Sergeant
    Reputation
    14
    Join Date
    May 2013
    Posts
    115
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Harry i made a simple script to try and fix the problem but it says Unit is a nil value.

    Code:
    function carlosfollow_OnSpawn(Unit, Event)
    end
    
    function carlosfollow_OnCombat(Unit, Event, Plr)
    	Unit:RemoveEvents()
    end
    
    function carlosfollow_OnKilledPlayer(Unit, Event, Plr)
    end
    
    function carlosfollow_OnLeaveCombat(Unit, Event, Plr)
    target = Unit:GetClosestPlayer()
            Unit:SetUnitToFollow(pPlayer, 2, 1)
    	Unit:RemoveEvents()
    end
    
    function carlosfollow_OnDied(Unit, Event, Plr)
    	Unit:RemoveEvents()
    end
    
    RegisterUnitEvent(90004, 1, carlosfollow_OnCombat)
    RegisterUnitEvent(90004, 2, carlosfollow_OnLeaveCombat)
    RegisterUnitEvent(90004, 3, carlosfollow_OnKilledPlayer)
    RegisterUnitEvent(90004, 4, carlosfollow_OnDied)
    RegisterUnitEvent(90004, 18, carlosfollow_OnSpawn)
    Aswell just for future references how can i make him unfollow?

  11. #11
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Unit:SetUnitToFollow(pPlayer, 2, 1)

    What pPlayer? Where is that defined? You have a target, maybe you should follow that.

Similar Threads

  1. [C++ Script] [Trinity] How do i get a mob to say a player name?
    By controlsx2 in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 07-31-2011, 01:16 PM
  2. when i start DButilEx it says "Crittical error cant find file players.save"
    By Foxmandan in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 01-11-2008, 03:11 PM
  3. How do i make a Gameobject say Somthing
    By Illidan1 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 10-12-2007, 07:07 PM
  4. [Macro] Trick players to think your going a different way..
    By janzi9 in forum World of Warcraft Exploits
    Replies: 40
    Last Post: 08-14-2006, 03:46 PM
All times are GMT -5. The time now is 04:13 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search