[Help][Lua] Npc Targeting Another Npc menu

User Tag List

Results 1 to 7 of 7
  1. #1
    Zudrik's Avatar Member
    Reputation
    52
    Join Date
    Dec 2008
    Posts
    169
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Help][Lua] Npc Targeting Another Npc

    How is this possible. I've tried so many damn commands to do this, but all I can come u with is either, nothing happens or the spell gets casted on itsself.

    I've tried using a :GetRandomFriend() (When I had them standing close)

    Tried using a :GetName() == Svala then

    It seems like all the commands are only for targeting players.

    If anyone can shed some light on this issue, I owuld greatly appreciate it.

    [Help][Lua] Npc Targeting Another Npc
  2. #2
    Vindicated's Avatar Contributor
    Reputation
    226
    Join Date
    Aug 2008
    Posts
    1,067
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would use a combination of GetRandomFriend & GetName to ensure it is selecting the correct NPC. (Idk if you have tried them together or separate)


  3. #3
    Zudrik's Avatar Member
    Reputation
    52
    Join Date
    Dec 2008
    Posts
    169
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's just like it won't target another NPC. But it worked fine for targeting a player.

    I've also tried using something like


    Code:
    local clonpc = pUnit:GetCreatureNearestCoords(295.95991, -356.325989, 90.948097, 29281)
    if clonpc ~= nil then
    pUnit:FullCastSpellOnTarget(54142, clonpc)
    end

    I don't know if that would be like the right setup, but within this one, he just casts it on himself.

  4. #4
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    *sigh* It is really easy to do.

    Code:
    local TheStarter = 319781
    local YourTeamGuy = 319782
    local BadGuy = 319783
    local ControllNpc = 319784
    
    local RockOn = 11803 -- If you want your event to be more blizzlike, set   this to 0
       pUnit:GossipCreateMenu(50121, player, 0)
       pUnit:GossipMenuAddItem(9, "Start the Arena Event!", 1, 0)
       pUnit:GossipMenuAddItem(0, "Wait a bit longer.", 2, 0)
       pUnit:GossipSendMenu(player)
    end
    function aggMedivh_OnGossipSelect(pUnit, event, player, id, intid, code)
    if (intid == 1) then
       player:SendBroadcastMessage("Get inside the arena!")
       player:SendAreaTriggerMessage("Get inside the arena!")
       pUnit:CastSpell(47820)
       pUnit:SpawnCreature(YourTeamGuy, -13216, 247, 22, 1.126259, 35, 0);
       pUnit:Despawn(2,0)
       pUnit:GossipComplete(player)
    end
    if (intid == 2) then
       pUnit:GossipComplete(player)
       player:SendBroadcastMessage("Take your time.")
       player:SendAreaTriggerMessage("Take your time.")
    end
    end
    
    RegisterUnitGossipEvent(TheStarter, 1, "aggMedivh_OnGossipTalk")
    RegisterUnitGossipEvent(TheStarter, 2, "aggMedivh_OnGossipSelect")
    
    
    RegisterUnitEvent(TheStarter, 18, "GossipTalk")
    
    function GossipTalk(pUnit, Event)
           pUnit:RegisterEvent("TalkerTalk", 15000, 0)
    end
    function TalkerTalk(pUnit, Event)
           pUnit:RegisterEvent("TalkTalkTalkTalk", 30000, 0)
    end
    function TalkTalkTalkTalk(pUnit, Event)
           pUnit:RemoveEvents()
           pUnit:RegisterEvent("TalkTalkTalkTalkTalk", 8000, 0)
           pUnit:SendChatMessage(14, 0, "Welcome to the Gurubashi Arena!")
    end
    function TalkTalkTalkTalkTalk(pUnit, Event)
           pUnit:RemoveEvents()
           pUnit:RegisterEvent("TalkTalkTalkTalkTalkTalk", 10000, 0)
           pUnit:SendChatMessage(12, 0, "There are a few things you need to know. First, when you start the event, monsters will attack you in the arena. You must kill them all, if you do, you get a prize!")
    end
    function TalkTalkTalkTalkTalkTalk(pUnit, Event)
           pUnit:RemoveEvents()
           pUnit:RegisterEvent("TalkTalkTalkTalkTalkTalkTalk", 8000, 0)
           pUnit:SendChatMessage(12, 0, "If you lose the event, there will be a long wait before you can start again.")
    end
    function TalkTalkTalkTalkTalkTalkTalk(pUnit, Event)
           pUnit:RemoveEvents()
           pUnit:RegisterEvent("TalkTalkTalkTalk", 30000, 0)
           pUnit:SendChatMessage(12, 0, "I hope you have a good time! The last person who tried ended up with twenty Murlocs eating his crotch!")
    end
    
    
    function zzzServant_Start(pUnit, Event)
           Friend=pUnit;
           pUnit:PlaySoundToSet(12825)
           pUnit:SendChatMessage(14, 0, "Come on; get in the arena you idiots!")
           pUnit:RegisterEvent("AppearAppear", 5000, 0)
    end
    function AppearAppear(pUnit, Event)
           pUnit:RemoveEvents()
           pUnit:SpawnCreature(BadGuy, -13203, 281, 22, 5.936259, 35, 0);
           pUnit:SpawnCreature(ControllNpc, -13203, 281, 22, 4.326259, 35, 5000);
           pUnit:RegisterEvent("ThreatenHim", 5000, 0)
    end
    function ThreatenHim(pUnit, Event)
           pUnit:RemoveEvents()
           pUnit:SendChatMessage(12, 0, "You know I am here to finish you off.")
           pUnit:MoveTo(-13212.1, 259.282990, 21.857899, 1.201352)
           pUnit:RegisterEvent("AttackHimBack", 1000, 0)
    end
    function AttackHimBack(pUnit, Event)
           pUnit:RemoveEvents()
           pUnit:FullCastSpellOnTarget(37992, Foe)
    end
    
    function ServantLeave(pUnit, Event)
           pUnit:Despawn(2,0)
    end
    
    RegisterUnitEvent(YourTeamGuy, 18, "zzzServant_Start")
    RegisterUnitEvent(YourTeamGuy, 4, "ServantLeave")
    
    
    
    function zzzBoss_Start(Unit, Event)
           Unit:SetScale(0.01)
           Unit:RegisterEvent("GetBig", 1000, 0)
    end
    function GetBig(Unit, Event)
           Unit:RemoveEvents()
           Unit:SetScale(1)
           Foe=Unit;
           Unit:SendChatMessage(14, 0, "Why have I been called?")
           Unit:CastSpell(28524)
           Unit:MoveTo(-13204.5, 278.282990, 21.857899, 4.377660)
           Unit:RegisterEvent("HostileA", 12000, 0)
    end
    function HostileA(Unit, Event)
           Unit:RemoveEvents()
           Unit:SendChatMessage(12, 0, "You shall die then!")
           Unit:RegisterEvent("HostileB", 1000, 0)
           Unit:RegisterEvent("HostileC", 5000, 0)
    end
    function HostileB(Unit, Event)
           Unit:FullCastSpellOnTarget(31984, Friend)
    end
    See if you can understand this.
    Basically he defines pUnit as Foe, then for the other npc it casts spell then Foe, for example "pUnit:CastSpell(11, Foe) like you would do for if you got a player.

  5. #5
    Zudrik's Avatar Member
    Reputation
    52
    Join Date
    Dec 2008
    Posts
    169
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tried it like that, no luck.

    Have it setup like this.

    Code:
    function Svala_Aggro(pUnit, Event)
    	Friend=pUnit;
    	pUnit:SetCombatCapable(1)
    	pUnit:PlaySoundToSet(13856)
    	pUnit:SendChatMessage(14, 0, "My liege! I have done as you asked, and now beseech you for your blessing!")
    	pUnit:RegisterEvent("ImageLichKing_Spawn", 7000, 1)
    	pUnit:RegisterEvent("Svala_Changing", 20000, 0)
    	end
    And the other like this
    Code:
    function ImageLichKing_Cast(Unit, Event)
    	Unit:RemoveEvents()
    	Unit:FullCastSpellOnTarget(54142, Friend)
    	Unit:RegisterEvent("ImageLichKing_Order", 19000, 0)
    	end
    =\

  6. #6
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I think it's the spell your trying to use. Test with id 11 instead of "Arthas Transforming Svala" (54142)

  7. #7
    Zudrik's Avatar Member
    Reputation
    52
    Join Date
    Dec 2008
    Posts
    169
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Meh, yeah it works. I guess I can't have that little cinematic event between them then.

Similar Threads

  1. [HELP] Warp NPC missing Locations / LUA
    By thegame240 in forum WoW EMU Questions & Requests
    Replies: 9
    Last Post: 10-26-2008, 09:28 PM
  2. Can I get some help on .NPC export?
    By Ebon in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 11-22-2007, 09:12 PM
  3. Help with NPC Teleporters
    By KnownReason in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 09-11-2007, 05:22 PM
  4. Help!! my npc's are green
    By SuperNinjaBob in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 07-10-2007, 11:44 AM
  5. Help Changing NPC "escort" paths
    By Omnia in forum World of Warcraft General
    Replies: 4
    Last Post: 07-03-2007, 09:51 PM
All times are GMT -5. The time now is 01:33 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