How to make so a npc follow you? menu

Shout-Out

User Tag List

Results 1 to 10 of 10
  1. #1
    mariobox's Avatar Member
    Reputation
    1
    Join Date
    Feb 2010
    Posts
    76
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to make so a npc follow you?

    like this:

    function OnCasthgasdadas(event, plr,spellid)
    if (spellid == 61773) then
    plr:SpawnCreature(69999, plr:GetX() +2, plr:GetY(), plr:GetZ(), plr:GetO(), plr:GetFaction(), 10000, 10000)
    end
    end

    RegisterServerHook(10, "OnCasthgasdadas")


    is ther any command to make a spawned npc to follow you? like

    local plr = Unit:GetRandomPlayer(0)
    Unit:Follow(plr:GetX() - 2, plr:GetY() - 2, plr:GetZ())

    or anything?
    Last edited by stoneharry; 03-26-2011 at 10:38 AM. Reason: Changed prefix.

    How to make so a npc follow you?
  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:
    pUnit:SetUnitToFollow(player, 2, 1)
    pUnit = Unit that is following.
    Player = the person it is following.
    2 = Distance.
    1 = Yes, 0 = stop following (documented as angle, but it not used as angle...).

  3. #3
    bendaferi's Avatar Active Member
    Reputation
    34
    Join Date
    Jun 2008
    Posts
    111
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it's not necessary to open a new thread so I write my problem here:

    I made a simple script just to test if everything works. Whenever someone clicks on my NPC it starts to follow that player. The NPC starts following the "clicker" after 30 seconds. Shouldn't be this instant? After the click he just stays there, and after 30 seconds he follows perfectly. Anny suggestions?

  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 bendaferi View Post
    I think it's not necessary to open a new thread so I write my problem here:

    I made a simple script just to test if everything works. Whenever someone clicks on my NPC it starts to follow that player. The NPC starts following the "clicker" after 30 seconds. Shouldn't be this instant? After the click he just stays there, and after 30 seconds he follows perfectly. Anny suggestions?
    Sounds like lag or the distance is too great, if the distance is too big it will take a while before the player gets far enough away for the creature to start following.

  5. #5
    bendaferi's Avatar Active Member
    Reputation
    34
    Join Date
    Jun 2008
    Posts
    111
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I used this: Unit:SetUnitToFollow(player, 2, 1). But I'll edit the distance to 1 then. By the way I forgot to tell you something what's maybe important: So when I click on him, he comes to me, when he reached me he stops then stays there for 30 seconds and follows me w/o any problem after.

  6. #6
    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 bendaferi View Post
    Well I used this: Unit:SetUnitToFollow(player, 2, 1). But I'll edit the distance to 1 then. By the way I forgot to tell you something what's maybe important: So when I click on him, he comes to me, when he reached me he stops then stays there for 30 seconds and follows me w/o any problem after.
    In that case I have no idea, a distance of 2 should work fine. It sounds like a strange error that could only be affected by your revision. Try updating to a newer revision and see if that fixes it, else you might want to report it as a bug to ArcEmu.

  7. #7
    Dynashock's Avatar Contributor

    Reputation
    176
    Join Date
    Nov 2007
    Posts
    203
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I remember correctly, the 30 seconds delay after talking to the NPC is an ArcEmu thing. All movement is stopped for 30 seconds upon talking to a NPC, this was introduced to make NPCs act like they do on retail; they too stop moving if you talk to them. I'll see if I can find the specific code that causes this so that you may disable it if you'd like to.

    Found it in NPCHandler.cpp:

    Code:
    421	                //stop when talked to
    422	                if(qst_giver->GetAIInterface())
    423	                        qst_giver->GetAIInterface()->StopMovement(30000);
    Comment this out if you want to disable that a NPC's stopped for 30 seconds after talking to him.
    Last edited by Dynashock; 03-26-2011 at 11:54 AM.
    Ignorance is bliss.

  8. #8
    bendaferi's Avatar Active Member
    Reputation
    34
    Join Date
    Jun 2008
    Posts
    111
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you. That means if I rewrite it and let's say I tell the npc to follow the nearest player OnSpawn would work perfectly? I'll try it now, if that works I won't use the gossip one.

  9. #9
    Dynashock's Avatar Contributor

    Reputation
    176
    Join Date
    Nov 2007
    Posts
    203
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, that should work as long as the spawned NPC isn't interacted with through a gossip.
    Ignorance is bliss.

  10. #10
    bendaferi's Avatar Active Member
    Reputation
    34
    Join Date
    Jun 2008
    Posts
    111
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Disabled those lines and now works perfectly Thank you!

Similar Threads

  1. [GUIDE] How to make a Healer NPC!
    By kikpp in forum WoW EMU Guides & Tutorials
    Replies: 7
    Last Post: 06-10-2008, 10:45 AM
  2. [Guide] How To Make A Custom NPC With Pics!
    By Xtinction in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 05-18-2008, 01:30 PM
  3. [question] how to make an custom npc cast spells?
    By INS4N3K1LL in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 05-18-2008, 07:45 AM
  4. [HELP] How to make a tele npc +rep to helpers!
    By cooper101 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 03-24-2008, 01:41 PM
  5. (guide)How to make Lock boxes drop what you want
    By Dee2001 in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 01-12-2008, 11:35 PM
All times are GMT -5. The time now is 06:31 AM. 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