[3.3.5a][Eluna][TrinityCore]How to edit player phasemask on accepting a quest menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Togggy's Avatar Member
    Reputation
    1
    Join Date
    May 2021
    Posts
    8
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [3.3.5a][Eluna][TrinityCore]How to edit player phasemask on accepting a quest

    Hello, I'm working on a quest, and i am trying to learn how to edit the players phasemask. I have been looking through the dbc for the last week and cant seem to find anything.
    If someone could point me to the right direction on what files to edit and how its done that would be much appreciated.

    [3.3.5a][Eluna][TrinityCore]How to edit player phasemask on accepting a quest
  2. #2
    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)
    There are multiple ways to achieve this, but I see you are using Eluna from the tags on your title. You can achieve this with a very simple Lua script:

    Code:
    local NPC_QUEST_GIVER = 10581 -- npc ID that gives the quest
    
    local function QuestGiverEvents(event, plr, pUnit, quest, _)
        plr:SetPhaseMask(2) -- Change the players phase to 2 on quest accept
    end
    
    RegisterCreatureEvent(NPC_QUEST_GIVER, 31, QuestGiverEvents)
    
    -- CREATURE_EVENT_ON_QUEST_ACCEPT                    = 31  -- // (event, player, creature, quest) - Can return true
    Blizzlike generally a spell will be cast that changes the players phase, often the aura is invisible client side.

  3. Thanks Togggy (1 members gave Thanks to stoneharry for this useful post)
  4. #3
    Togggy's Avatar Member
    Reputation
    1
    Join Date
    May 2021
    Posts
    8
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and to change it back after the quest is complete?

  5. #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)
    Originally Posted by Togggy View Post
    and to change it back after the quest is complete?
    Code:
    CREATURE_EVENT_ON_QUEST_REWARD                    = 34  -- // (event, player, creature, quest, opt) - Can return true
    So something like:

    Code:
    local NPC_QUEST_GIVER = 10581 -- npc ID that gives the quest
    
    local function QuestGiverEvents(event, plr, pUnit, quest, _) 
        --if quest:GetId() == 1 then -- can change to your quest ID
            if event == 31 then
                plr:SetPhaseMask(2) -- Change the players phase to 2 on quest accept
            elseif event == 34 then
                plr:SetPhaseMask(1)
            end
        --end
    end
    
    RegisterCreatureEvent(NPC_QUEST_GIVER, 31, QuestGiverEvents)
    RegisterCreatureEvent(NPC_QUEST_GIVER, 34, QuestGiverEvents)
    
    -- CREATURE_EVENT_ON_QUEST_ACCEPT                    = 31  -- // (event, player, creature, quest) - Can return true
    -- CREATURE_EVENT_ON_QUEST_REWARD                    = 34  -- // (event, player, creature, quest, opt) - Can return true
    But then bear in mind the quest can be abandoned too, so you also need to handle that:
    Code:
    local NPC_QUEST_GIVER = 10581 -- npc ID that gives the quest
    local QUEST_ID = 10851 -- your quest ID
    
    local function QuestGiverEvents(event, plr, pUnit, quest, _) 
        if quest:GetId() == QUEST_ID then
            if event == 31 then
                plr:SetPhaseMask(2) -- Change the players phase to 2 on quest accept
            elseif event == 34 then
                plr:SetPhaseMask(1)
            end
        end
    end
    
    RegisterCreatureEvent(NPC_QUEST_GIVER, 31, QuestGiverEvents)
    RegisterCreatureEvent(NPC_QUEST_GIVER, 34, QuestGiverEvents)
    
    -- CREATURE_EVENT_ON_QUEST_ACCEPT                    = 31  -- // (event, player, creature, quest) - Can return true
    -- CREATURE_EVENT_ON_QUEST_REWARD                    = 34  -- // (event, player, creature, quest, opt) - Can return true
    
    local function PLAYER_EVENT_ON_QUEST_ABANDON(event, plr, questId)
        if questId == QUEST_ID then
            plr:SetPhaseMask(1)
        end
    end
    
    RegisterPlayerEvent(38, PLAYER_EVENT_ON_QUEST_ABANDON)

  6. #5
    Togggy's Avatar Member
    Reputation
    1
    Join Date
    May 2021
    Posts
    8
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    Code:
    CREATURE_EVENT_ON_QUEST_REWARD                    = 34  -- // (event, player, creature, quest, opt) - Can return true
    So something like:

    Code:
    local NPC_QUEST_GIVER = 10581 -- npc ID that gives the quest
    
    local function QuestGiverEvents(event, plr, pUnit, quest, _) 
        --if quest:GetId() == 1 then -- can change to your quest ID
            if event == 31 then
                plr:SetPhaseMask(2) -- Change the players phase to 2 on quest accept
            elseif event == 34 then
                plr:SetPhaseMask(1)
            end
        --end
    end
    
    RegisterCreatureEvent(NPC_QUEST_GIVER, 31, QuestGiverEvents)
    RegisterCreatureEvent(NPC_QUEST_GIVER, 34, QuestGiverEvents)
    
    -- CREATURE_EVENT_ON_QUEST_ACCEPT                    = 31  -- // (event, player, creature, quest) - Can return true
    -- CREATURE_EVENT_ON_QUEST_REWARD                    = 34  -- // (event, player, creature, quest, opt) - Can return true
    But then bear in mind the quest can be abandoned too, so you also need to handle that:
    Code:
    local NPC_QUEST_GIVER = 10581 -- npc ID that gives the quest
    local QUEST_ID = 10851 -- your quest ID
    
    local function QuestGiverEvents(event, plr, pUnit, quest, _) 
        if quest:GetId() == QUEST_ID then
            if event == 31 then
                plr:SetPhaseMask(2) -- Change the players phase to 2 on quest accept
            elseif event == 34 then
                plr:SetPhaseMask(1)
            end
        end
    end
    
    RegisterCreatureEvent(NPC_QUEST_GIVER, 31, QuestGiverEvents)
    RegisterCreatureEvent(NPC_QUEST_GIVER, 34, QuestGiverEvents)
    
    -- CREATURE_EVENT_ON_QUEST_ACCEPT                    = 31  -- // (event, player, creature, quest) - Can return true
    -- CREATURE_EVENT_ON_QUEST_REWARD                    = 34  -- // (event, player, creature, quest, opt) - Can return true
    
    local function PLAYER_EVENT_ON_QUEST_ABANDON(event, plr, questId)
        if questId == QUEST_ID then
            plr:SetPhaseMask(1)
        end
    end
    
    RegisterPlayerEvent(38, PLAYER_EVENT_ON_QUEST_ABANDON)
    thanks so much!

  7. #6
    Togggy's Avatar Member
    Reputation
    1
    Join Date
    May 2021
    Posts
    8
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry to bug you lol but how would i incorporate this code to spawn a creature on quest accept inside of the script WorldObject:SpawnCreature( 43284, -13214.386, 262.45575, 21.857578, 1.983495 )

  8. #7
    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)
    Originally Posted by Togggy View Post
    sorry to bug you lol but how would i incorporate this code to spawn a creature on quest accept inside of the script WorldObject:SpawnCreature( 43284, -13214.386, 262.45575, 21.857578, 1.983495 )
    WorldObject is a superclass of Unit, which in turn is a superclass of Player and Creature. So you can call the SpawnCreature method on any WorldObject: WorldObject:SpawnCreature - Eluna

    So your quest accept function may look something like:
    Code:
    local function QuestGiverEvents(event, plr, pUnit, quest, _) 
        if quest:GetId() == QUEST_ID then
            if event == 31 then
                plr:SetPhaseMask(2) -- Change the players phase to 2 on quest accept
                local npc = pUnit:SpawnCreature(43284, -13214.386, 262.45575, 21.857578, 1.983495)
                if npc then
                    npc:SetPhaseMask(2) -- assuming you want to set the spawned npcs phase to 2
                end
            elseif event == 34 then
                plr:SetPhaseMask(1)
            end
        end
    end

  9. #8
    DewmGuy's Avatar Member
    Reputation
    1
    Join Date
    Sep 2023
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @stoneharry you seem like you know a ton about Eluna. I'm just getting into it. I was interested in playing around with phasing and adding some depth to some old quests. I found this thread and your advice looked awesome but from what I can tell these functions don't exist anymore or something. player:SetPhaseMask(x) just breaks, and it's not contained in the Eluna API documentation. Is there a reason for this?

  10. #9
    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)
    Originally Posted by DewmGuy View Post
    @stoneharry you seem like you know a ton about Eluna. I'm just getting into it. I was interested in playing around with phasing and adding some depth to some old quests. I found this thread and your advice looked awesome but from what I can tell these functions don't exist anymore or something. player:SetPhaseMask(x) just breaks, and it's not contained in the Eluna API documentation. Is there a reason for this?
    WorldObject:SetPhaseMask - Eluna

  11. #10
    DewmGuy's Avatar Member
    Reputation
    1
    Join Date
    Sep 2023
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    No, I know. You misunderstand me. I’ve read and reference the API documentation regularly.

    I tried implementing this in a similar script, based on the code you provided to the other user and it failed at that line every time (player:SetPhaseMask(x))

    I’ve had this issue a lot with other commands as well, like player:GetName() just crashes whatever script I put it in like if I’m trying to assign it to a variable. But then I see it in scripts like yours and others that are much more generally experienced with lua and it seemingly works great in their scripts which as far as I can tell is used in functionally identical ways.

  12. #11
    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)
    Originally Posted by DewmGuy View Post
    No, I know. You misunderstand me. I’ve read and reference the API documentation regularly.

    I tried implementing this in a similar script, based on the code you provided to the other user and it failed at that line every time (player:SetPhaseMask(x))

    I’ve had this issue a lot with other commands as well, like player:GetName() just crashes whatever script I put it in like if I’m trying to assign it to a variable. But then I see it in scripts like yours and others that are much more generally experienced with lua and it seemingly works great in their scripts which as far as I can tell is used in functionally identical ways.
    You said it's not in the Eluna documentation so I linked to it being in the documentation.

    Hard to know what advise to give when all you say is it 'breaks'. Need more information.

    Calling Lua methods shouldn't be crashing the server, have you looked at the crash dump?

  13. #12
    DewmGuy's Avatar Member
    Reputation
    1
    Join Date
    Sep 2023
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    You said it's not in the Eluna documentation so I linked to it being in the documentation.

    Hard to know what advise to give when all you say is it 'breaks'. Need more information.

    Calling Lua methods shouldn't be crashing the server, have you looked at the crash dump?
    It’s hard to know how it’s breaking when all I get for output is %s when the script stops on a line with an error. Btw I didn’t say it’s crashing the server. All I can do is reference peoples scripts to see that they’re doing something and most of the time when I’m trying to implement that function in a similar way I’m doing it wrong and there isn’t enough information in the API reference guide for me to know that worldobject:SetPhaseMask is the same thing as player:SetPhaseMask. So when I say that I am not seeing it in the API doc that’s the distinction I’m making. Did I mention that I’m new at this? Yeah.

  14. #13
    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)
    Originally Posted by DewmGuy View Post
    It’s hard to know how it’s breaking when all I get for output is %s when the script stops on a line with an error. Btw I didn’t say it’s crashing the server. All I can do is reference peoples scripts to see that they’re doing something and most of the time when I’m trying to implement that function in a similar way I’m doing it wrong and there isn’t enough information in the API reference guide for me to know that worldobject:SetPhaseMask is the same thing as player:SetPhaseMask. So when I say that I am not seeing it in the API doc that’s the distinction I’m making. Did I mention that I’m new at this? Yeah.
    If you give a lot more information I may be able to help.

    The emulator is implemented in a OOP (Object Orientated Programming) manner where inheritence takes place.

    Player and Creature both extend Unit.

    Unit extends WorldObject.

    When you extend something, you inherit all its functionality.

  15. #14
    DewmGuy's Avatar Member
    Reputation
    1
    Join Date
    Sep 2023
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, let me tell you where I wanted to end up initially. I was experimenting with phasing, applying phasing to a couple of NPCs based on a couple of quest criteria, and using the examples you had already written for OP. So that's all of the information I can give you about the script I was using because it was essentially copy and paste, with just a couple of modifications for the NPCs and quests that OP was using in his request. Each time, the script was getting hung up on the line `player:SetPhaseMask(2)` after having changed the `phasemask` property of the NPCs in question to `2`.

    Two specific examples I had in mind:
    - Phase out NPC Mor'Ladim (522) when the player has completed quest A Daughter's Love (231).
    - Phase out NPC The Defias Traitor (467) until the player accepts quest The Defias Brotherhood (142) and phase out NPC The Defias Traitor (467) when the player has completed quest The Defias Brotherhood (155)

  16. #15
    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)
    Originally Posted by DewmGuy View Post
    Well, let me tell you where I wanted to end up initially. I was experimenting with phasing, applying phasing to a couple of NPCs based on a couple of quest criteria, and using the examples you had already written for OP. So that's all of the information I can give you about the script I was using because it was essentially copy and paste, with just a couple of modifications for the NPCs and quests that OP was using in his request. Each time, the script was getting hung up on the line `player:SetPhaseMask(2)` after having changed the `phasemask` property of the NPCs in question to `2`.

    Two specific examples I had in mind:
    - Phase out NPC Mor'Ladim (522) when the player has completed quest A Daughter's Love (231).
    - Phase out NPC The Defias Traitor (467) until the player accepts quest The Defias Brotherhood (142) and phase out NPC The Defias Traitor (467) when the player has completed quest The Defias Brotherhood (155)
    Do you want to share your full script and the output of Eluna please?

Page 1 of 2 12 LastLast

Similar Threads

  1. How to edit bosses HP and change loot settings
    By murdock666 in forum World of Warcraft Guides
    Replies: 13
    Last Post: 09-08-2016, 07:49 AM
  2. [Question] How to edit your title on live servers?
    By Galadius in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 05-09-2009, 05:04 AM
  3. <inser belt name> .blp, how to edit it properly?
    By Diclonius in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 04-29-2007, 06:14 PM
  4. REQUEST- Someone tell me how to Edit models on a mac version!
    By karlov in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 03-07-2007, 05:21 PM
  5. How to edit your WoW Models
    By Cush in forum World of Warcraft Model Editing
    Replies: 27
    Last Post: 02-27-2007, 07:31 PM
All times are GMT -5. The time now is 05:58 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