Attaching weapons to a spawned Guardian creature menu

Shout-Out

User Tag List

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

    Attaching weapons to a spawned Guardian creature

    Hey,

    I've just completed most of a simple script that im making. Basically it spawns a unit which act's like your personal guard/party member for 10 minutes. Well after a lot of trial and error I've gotten the script in a mostly-working order, but their is still one dilemma facing me. I cannot figure out how to attach weapons to the npc that is spawned by the script.

    I have tried doing the usual (:EquipWeapons(12282, 0, 0) ) but it wont work for some reason. Below is the script im working on, if anyone knows how to fix this problem the help is appreciated.

    Code:
    local NPCID = 900005
    
    function Quest_OnAccept(player, pUnit, event)
        player:CreateGuardian(900005, 600000, 0, 2)
    	player:EquipWeapons(12282, 0, 0) 
    end
    
    RegisterQuestEvent(900001, 1, Quest_OnAccept)
    Additional Information:

    The unit being spawned is a Dwarf npc set to the same faction as the player (They are both on faction 21 for certain reasons.)
    The script activates when the player accepts the quest from NPC 900001 (The quest ID is also 900001, due to numbering reasons.) The quest allows the player to use the guardian NPC to help him/her defeat an elite monster.

    Attaching weapons to a spawned Guardian creature
  2. #2
    AlienCCL's Avatar Active Member
    Reputation
    28
    Join Date
    Aug 2008
    Posts
    444
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    insert in SQL by offline through navicat ore heidi , not by ingame.
    Yes , I sit right now in front of the monitor in a cap with ear-flaps with a balalaika, a nested doll, vodka and a comrad Lenin. And behind my window dancing bears with jingles in hands .

  3. #3
    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)
    The EquipWeapons function works perfectly. The problem I guess is that the weapon is appearing sheathed/invisible until it enters combat, you need to change bytes2 to 1 but I have no idea how to do this within Lua since the syntex for bytes is: SetBytes(x,x,x).

    Also make sure your using the itemids and not the displayids (or is it the other way round? I forget).

    Example script of me using EquipWeapons() function:

    Code:
    function Alliance_squad_attacking_onspawn(pUnit, Event)
        pUnit:RegisterEvent("delay_for_slackers_XD", 1000, 1)
    end
    
    function delay_for_slackers_XD(pUnit, Event)
        pUnit:SetFaction(1)
        pUnit:SetPhase(2)
        pUnit:SetMovementFlags(1)
        pUnit:EquipWeapons(1482,6320,0)
        if math.random(1,2) == 1 then
        pUnit:MoveTo(-7198, -1964, 313, 2.811485)
        else
        pUnit:MoveTo(-7205, -1968, 312, 2.850754)
        end
        pUnit:RegisterEvent("LetsMoveIntoTheActualBase_Squad", 4000, 1)
    end
    
    function LetsMoveIntoTheActualBase_Squad(pUnit, Event)
        if math.random(1,6) == 3 then
        pUnit:SendChatMessage(14, 0, "For the Alliance!")
        else
            if math.random(1,6) == 4 then
            pUnit:SendChatMessage(14, 0, "The Horde shall fall!")
            end
        end
        if pUnit:IsInCombat() == false then
            pUnit:SetMovementFlags(1)
            if math.random(1,2) == 1 then
            pUnit:MoveTo(-7217, -1960, 314, 2.744725)
            else
            pUnit:MoveTo(-7218, -1963, 313, 2.811484)
            end
        end
    end
    
    RegisterUnitEvent(151081, 18, "Alliance_squad_attacking_onspawn")
    Last edited by stoneharry; 08-25-2010 at 02:23 AM.

  4. #4
    AlienCCL's Avatar Active Member
    Reputation
    28
    Join Date
    Aug 2008
    Posts
    444
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    The EquipWeapons function works perfectly. The problem I guess is that the weapon is appearing sheathed/invisible until it enters combat, you need to change bytes2 to 1 but I have no idea how to do this within Lua since the syntex for bytes is: SetBytes(x,x,x).

    Also make sure your using the itemids and not the displayids (or is it the other way round? I forget).

    Example script of me using EquipWeapons() function:

    Code:
    function Alliance_squad_attacking_onspawn(pUnit, Event)
        pUnit:RegisterEvent("delay_for_slackers_XD", 1000, 1)
    end
    
    function delay_for_slackers_XD(pUnit, Event)
        pUnit:SetFaction(1)
        pUnit:SetPhase(2)
        pUnit:SetMovementFlags(1)
        pUnit:EquipWeapons(1482,6320,0)
        if math.random(1,2) == 1 then
        pUnit:MoveTo(-7198, -1964, 313, 2.811485)
        else
        pUnit:MoveTo(-7205, -1968, 312, 2.850754)
        end
        pUnit:RegisterEvent("LetsMoveIntoTheActualBase_Squad", 4000, 1)
    end
    
    function LetsMoveIntoTheActualBase_Squad(pUnit, Event)
        if math.random(1,6) == 3 then
        pUnit:SendChatMessage(14, 0, "For the Alliance!")
        else
            if math.random(1,6) == 4 then
            pUnit:SendChatMessage(14, 0, "The Horde shall fall!")
            end
        end
        if pUnit:IsInCombat() == false then
            pUnit:SetMovementFlags(1)
            if math.random(1,2) == 1 then
            pUnit:MoveTo(-7217, -1960, 314, 2.744725)
            else
            pUnit:MoveTo(-7218, -1963, 313, 2.811484)
            end
        end
    end
    
    RegisterUnitEvent(151081, 18, "Alliance_squad_attacking_onspawn")

    as i know . for NPC you must use display id of weapon , not its entry?
    Yes , I sit right now in front of the monitor in a cap with ear-flaps with a balalaika, a nested doll, vodka and a comrad Lenin. And behind my window dancing bears with jingles in hands .

  5. #5
    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 AlienCCL View Post
    as i know . for NPC you must use display id of weapon , not its entry?
    Nope you use the itemid, I just went and checked.

  6. #6
    AlienCCL's Avatar Active Member
    Reputation
    28
    Join Date
    Aug 2008
    Posts
    444
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    stoneharry to the flurry
    Yes , I sit right now in front of the monitor in a cap with ear-flaps with a balalaika, a nested doll, vodka and a comrad Lenin. And behind my window dancing bears with jingles in hands .

  7. #7
    tyeeeee1's Avatar Member
    Reputation
    6
    Join Date
    Feb 2008
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all the replies, but the script still refuses to work. The NPC no matter if the weapon's are sheathed should still show the 2h axe on his back, I did go and check in-game again just to make sure the axe didn't appear on-combat.. (On-combat just gave me the idea to make a 2nd script to make the guardian equip the axe on-combat!)

    Anyways I'm starting to think that the script isn't targeting the spawned npc. (I'm not sure if this helps at all >.<)

    @StoneHarry------Thx for the replie with the script StoneHarry, It's helping me out with a patrol quest that I was planning to make.
    @AlienCCL------For some reason the DB im using (WhyDB) doesn't have the columns for weapon equipping through Heidisql.

  8. #8
    AlienCCL's Avatar Active Member
    Reputation
    28
    Join Date
    Aug 2008
    Posts
    444
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HeidiSQL is sux. use Navicat.
    Yes , I sit right now in front of the monitor in a cap with ear-flaps with a balalaika, a nested doll, vodka and a comrad Lenin. And behind my window dancing bears with jingles in hands .

  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)
    That's because you're targetting the player to equip the weapons not the guardian. The CreateGuardian() should return the guardian spawned, thus you could do it like this:
    Code:
    local NPCID = 900005
    
    function Quest_OnAccept(player, pUnit, event)
        local guardian =player:CreateGuardian(900005, 600000, 0, 2)
        guardian:EquipWeapons(12282, 0, 0) 
    end
    
    RegisterQuestEvent(900001, 1, Quest_OnAccept)
    Ignorance is bliss.

  10. #10
    tyeeeee1's Avatar Member
    Reputation
    6
    Join Date
    Feb 2008
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for not replying, it's all fixed now. Thanks for the help!

Similar Threads

  1. Attaching Weapons to Creatures
    By Fellow in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 04-16-2008, 07:02 PM
  2. [HELP] Creature Spawn Problems
    By Matis02 in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 11-23-2007, 07:32 AM
  3. [Question/Request] Remove weapons for creatures?
    By Andrige in forum WoW ME Questions and Requests
    Replies: 7
    Last Post: 11-23-2007, 07:11 AM
  4. No Creeps(creatures) spawned
    By sadgonewild in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 11-18-2007, 07:39 AM
  5. [Ascent] List of Class Trainers and Weapon Masters NPC spawn ID's
    By mkenzi in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 10-21-2007, 11:41 AM
All times are GMT -5. The time now is 07:46 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