Game objects menu

Shout-Out

User Tag List

Thread: Game objects

Results 1 to 12 of 12
  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)

    Game objects

    Hey guys i'm working on scripting Ulduar currently and it's going pretty well however I would like to know how to activate a game object (example a door closing on combat and re opening on leave combat/ defeat)

    I learn best when it's shown to me rather then told so if anyone can link a script they have made before or a script that uses the activate/ deactivate functions please link it!

    Game objects
  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)
    You need to set the unsigned integer value (32), bytes, to activated (1) or deactivated (0).

  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
    You need to set the unsigned integer value (32), bytes, to activated (1) or deactivated (0).
    I have no idea what that means could u show me a example from a script? What would i need to define at the start of it?

  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
    I have no idea what that means could u show me a example from a script? What would i need to define at the start of it?
    I don't know what emulator you are using or what, you could look at code examples from the currently scripted dungeons.

    Here is a code snippet from the TrinityCore Black Temple script:

    Code:
                    instance->SetData(DATA_ILLIDANSTORMRAGEEVENT, NOT_STARTED);
    
                    IllidanGUID = instance->GetData64(DATA_ILLIDANSTORMRAGE);
                    GateGUID = instance->GetData64(DATA_GAMEOBJECT_ILLIDAN_GATE);
                    DoorGUID[0] = instance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_R);
                    DoorGUID[1] = instance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_L);
    
                    if (JustCreated) // close all doors at create
                    {
                        instance->HandleGameObject(GateGUID, false);
    
                        for (uint8 i = 0; i < 2; ++i)
                            instance->HandleGameObject(DoorGUID[i], false);
                    }
                    else // open all doors, raid wiped
                    {
                        instance->HandleGameObject(GateGUID, true);
                        WalkCount = 1; // skip first wp
    
                        for (uint8 i = 0; i < 2; ++i)
                            instance->HandleGameObject(DoorGUID[i], true);
                    }
    Or in ArcEmu, this is the Lua approach I have used:

    Code:
    local OBJECT_END = 0x0006
    local GAMEOBJECT_BYTES_1 = OBJECT_END + 0x000B
    
    ...
    
    local gate = pUnit:GetGameObjectNearestCoords(x, y, z, gameObjectId)
    if gate then
      gate:SetByte(GAMEOBJECT_BYTES_1,0,0) -- open door
      gate:SetByte(GAMEOBJECT_BYTES_1,0,1) -- close door
    end
    The C++ code is pretty much the same.

  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
    I don't know what emulator you are using or what, you could look at code examples from the currently scripted dungeons.

    Here is a code snippet from the TrinityCore Black Temple script:

    Code:
                    instance->SetData(DATA_ILLIDANSTORMRAGEEVENT, NOT_STARTED);
    
                    IllidanGUID = instance->GetData64(DATA_ILLIDANSTORMRAGE);
                    GateGUID = instance->GetData64(DATA_GAMEOBJECT_ILLIDAN_GATE);
                    DoorGUID[0] = instance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_R);
                    DoorGUID[1] = instance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_L);
    
                    if (JustCreated) // close all doors at create
                    {
                        instance->HandleGameObject(GateGUID, false);
    
                        for (uint8 i = 0; i < 2; ++i)
                            instance->HandleGameObject(DoorGUID[i], false);
                    }
                    else // open all doors, raid wiped
                    {
                        instance->HandleGameObject(GateGUID, true);
                        WalkCount = 1; // skip first wp
    
                        for (uint8 i = 0; i < 2; ++i)
                            instance->HandleGameObject(DoorGUID[i], true);
                    }
    Or in ArcEmu, this is the Lua approach I have used:

    Code:
    local OBJECT_END = 0x0006
    local GAMEOBJECT_BYTES_1 = OBJECT_END + 0x000B
    
    ...
    
    local gate = pUnit:GetGameObjectNearestCoords(x, y, z, gameObjectId)
    if gate then
      gate:SetByte(GAMEOBJECT_BYTES_1,0,0) -- open door
      gate:SetByte(GAMEOBJECT_BYTES_1,0,1) -- close door
    end
    The C++ code is pretty much the same.
    Thanks so much harry it worked! I only have one more question how to i make it non selectable?

  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 Xmaily View Post
    Thanks so much harry it worked! I only have one more question how to i make it non selectable?
    You need to set UNIT_FIELD_FLAGS to UNIT_FLAG_NOT_SELECTABLE.

    Code:
    local OBJECT_END = 0x0006
    local UNIT_FIELD_FLAGS = OBJECT_END + 0x0035
    local UNIT_FLAG_NOT_SELECTABLE = 0x02000000 -- this is the same as going in game and doing .mod flag 33554432
    
    ...
    
    pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) -- unselectable
    
    ...

  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)
    thanks ^-^

  8. #8
    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)
    So i have been using opening and closing game objects like mad! But today i tired to make one unslectable from ur post above. However i'm confused. If my game object has been spawning already without a script where would i put pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE). Would i be like this...

    local gate = Ruag:GetGameObjectNearestCoords(-10461, -3219, 20, 215223)
    if gate then
    gate:SetByte(GAMEOBJECT_BYTES_1,0,0) :SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)

  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
    So i have been using opening and closing game objects like mad! But today i tired to make one unslectable from ur post above. However i'm confused. If my game object has been spawning already without a script where would i put pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE). Would i be like this...

    local gate = Ruag:GetGameObjectNearestCoords(-10461, -3219, 20, 215223)
    if gate then
    gate:SetByte(GAMEOBJECT_BYTES_1,0,0) :SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
    Note it says "UNIT_FIELD_FLAGS". Units are creatures or players.

    GameObjects have their own set of flags. ID 1 is untargetable in the database, need to look up how to do it in code but you can look in the documentation just as well as I can.

  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)
    Originally Posted by stoneharry View Post
    Note it says "UNIT_FIELD_FLAGS". Units are creatures or players.

    GameObjects have their own set of flags. ID 1 is untargetable in the database, need to look up how to do it in code but you can look in the documentation just as well as I can.
    I know this is a stupid question but how what would i look for in the database i have no clue!

  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)
    Originally Posted by Xmaily View Post
    I know this is a stupid question but how what would i look for in the database i have no clue!
    They are defined in the emulator.

    Code:
    GAMEOBJECT_DISPLAYID =                     OBJECT_END + 0x0002 -- Size: 1, Type: INT, Flags: PUBLIC
    GAMEOBJECT_FLAGS =                         OBJECT_END + 0x0003 -- Size: 1, Type: INT, Flags: PUBLIC
    GAMEOBJECT_PARENTROTATION =                OBJECT_END + 0x0004 -- Size: 4, Type: FLOAT, Flags: PUBLIC
    GAMEOBJECT_DYNAMIC =                       OBJECT_END + 0x0008 -- Size: 1, Type: TWO_SHORT, Flags: DYNAMIC
    GAMEOBJECT_FACTION =                       OBJECT_END + 0x0009 -- Size: 1, Type: INT, Flags: PUBLIC
    GAMEOBJECT_LEVEL =                         OBJECT_END + 0x000A -- Size: 1, Type: INT, Flags: PUBLIC
    GAMEOBJECT_BYTES_1 =                       OBJECT_END + 0x000B -- Size: 1, Type: BYTES, Flags: PUBLIC
    GAMEOBJECT_END =                           OBJECT_END + 0x000C
    So if you try setting GAMEOBJECT_FLAGS to the value 1, it might work:

    Code:
    gate:SetUInt32Value(GAMEOBJECT_FLAGS, 1)
    Remember to define OBJECT_END, GAMEOBJECT_END and GAMEOBJECT_FLAGS.

  12. #12
    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
    I don't know what emulator you are using or what, you could look at code examples from the currently scripted dungeons.

    Here is a code snippet from the TrinityCore Black Temple script:

    Code:
                    instance->SetData(DATA_ILLIDANSTORMRAGEEVENT, NOT_STARTED);
    
                    IllidanGUID = instance->GetData64(DATA_ILLIDANSTORMRAGE);
                    GateGUID = instance->GetData64(DATA_GAMEOBJECT_ILLIDAN_GATE);
                    DoorGUID[0] = instance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_R);
                    DoorGUID[1] = instance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_L);
    
                    if (JustCreated) // close all doors at create
                    {
                        instance->HandleGameObject(GateGUID, false);
    
                        for (uint8 i = 0; i < 2; ++i)
                            instance->HandleGameObject(DoorGUID[i], false);
                    }
                    else // open all doors, raid wiped
                    {
                        instance->HandleGameObject(GateGUID, true);
                        WalkCount = 1; // skip first wp
    
                        for (uint8 i = 0; i < 2; ++i)
                            instance->HandleGameObject(DoorGUID[i], true);
                    }
    Or in ArcEmu, this is the Lua approach I have used:

    Code:
    local OBJECT_END = 0x0006
    local GAMEOBJECT_BYTES_1 = OBJECT_END + 0x000B
    
    ...
    
    local gate = pUnit:GetGameObjectNearestCoords(x, y, z, gameObjectId)
    if gate then
      gate:SetByte(GAMEOBJECT_BYTES_1,0,0) -- open door
      gate:SetByte(GAMEOBJECT_BYTES_1,0,1) -- close door
    end
    The C++ code is pretty much the same.
    I' dont mean to be a bother. I just simply understand it better like that ^-^ the way u but it in last post doesn't make much scene to me >.<

Similar Threads

  1. How To: Add Game Objects anywhere, everywhere!
    By CSOM in forum WoW EMU Guides & Tutorials
    Replies: 5
    Last Post: 09-05-2024, 04:07 AM
  2. Game object ids.
    By Xx Killjoy xX in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 08-30-2010, 09:54 PM
  3. How to make a Game Object teleport u some were with out a spell
    By Illidan1 in forum WoW EMU Guides & Tutorials
    Replies: 29
    Last Post: 01-01-2008, 06:46 PM
  4. How do I keep game objects forever. PLZ HELP!
    By chocodog in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 10-01-2007, 09:20 PM
  5. Custom Game objects
    By Possum in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 09-27-2007, 10:53 PM
All times are GMT -5. The time now is 05:21 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