[C++] How to make OnEnterArea menu

User Tag List

Results 1 to 14 of 14
  1. #1
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++] How to make OnEnterArea

    In lua they have the OnEnterArea activation stuff but for some reason even after searching in the Lua engine i could not find out how to do do this

    can anyone explain it to me or give me an example
    Lunar Gaming - Reaching For The Stars

    [C++] How to make OnEnterArea
  2. #2
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    void example(Player * plr)
    {
           if (plr->GetMapId()  == 1) // for mapid 1
             {
                    // do stuff here
             }
    }
    
    
    
    void Setupexample(ScriptMgr * mgr)
    {  
           mgr->register_hook(SERVER_HOOK_EVENT_ON_ZONE, (void*)example);
    }
    this might have some errors in it since I did this out of the top of my head. just ask and i'll check them later
    also it might be that the function is called GetZoneId instead of GetMapId

    but overall it should work
    Last edited by Aznex; 02-01-2009 at 01:50 PM.

  3. #3
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that could work possibly but im trying to make it work for on enter area of a monster
    Lunar Gaming - Reaching For The Stars

  4. #4
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by mager1794 View Post
    that could work possibly but im trying to make it work for on enter area of a monster
    so basically instead of a player u wanna do this with a creature?
    if so:

    instead of using a Player pointer use a creature pointer:
    Creature * pCreature and then do
    pCreature->GetMapId



    or am I still understanding u wrong?
    Last edited by Aznex; 02-01-2009 at 01:57 PM.

  5. #5
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    your understanding wrong lol......

    i want it when the player enters the creatures area like the lua event OnEnterArea
    Lunar Gaming - Reaching For The Stars

  6. #6
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by mager1794 View Post
    your understanding wrong lol......

    i want it when the player enters the creatures area like the lua event OnEnterArea
    Never used that function in lua but expand a little on it, how big is the monsters area? is it like a whole instance, or just a little area like lets say within 100 yards ??

  7. #7
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    probably within like 50 yards
    Lunar Gaming - Reaching For The Stars

  8. #8
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could probably use something like
    pCreature->GetPositionX()
    get pos y, get pos z and get map id and then expand that area by the amount u want and then check if a player enters that certain area by using while loops
    but i'm not totally sure about that. AFK now tho but u can play around with it =]

  9. #9
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    k thanks for the helps +Rep
    Lunar Gaming - Reaching For The Stars

  10. #10
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by mager1794 View Post
    k thanks for the helps +Rep
    theres also a function in the TerrainMgr called GetAreaID but it seems like you have to lookup stuff in the Dbc to get the areaID from that so u might have to do dbc edititng to use that one.

  11. #11
    Sounddead's Avatar Contributor
    Reputation
    160
    Join Date
    Sep 2007
    Posts
    1,126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look in scriptmgr, (header file most likely) it should have all of the server hooks there.

    I live in a shoe

  12. #12
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Sounddead View Post
    Look in scriptmgr, (header file most likely) it should have all of the server hooks there.

    Yh but the only one that seems of any use in there is the ON_ZONE one which I explained in an above posts

  13. #13
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think i got it sorta?? i used the old ascent announce script where it checks if your in range and i made a small system of checks to make sure it doesn't over do anything but thanks for the help guys
    Lunar Gaming - Reaching For The Stars

  14. #14
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by mager1794 View Post
    i think i got it sorta?? i used the old ascent announce script where it checks if your in range and i made a small system of checks to make sure it doesn't over do anything but thanks for the help guys
    might be worth posting incase someone needs it

Similar Threads

  1. How to Make a Character with Cool Letters
    By Cyboi in forum World of Warcraft Guides
    Replies: 62
    Last Post: 08-21-2007, 01:52 PM
  2. How to make a WoW Video!
    By Amedis in forum World of Warcraft Guides
    Replies: 6
    Last Post: 12-09-2006, 10:23 PM
  3. How to make Macro's
    By oninuva in forum World of Warcraft Guides
    Replies: 21
    Last Post: 11-20-2006, 01:02 PM
  4. How to make good Pick-Up Groups (PUG's)
    By Krazzee in forum World of Warcraft Guides
    Replies: 0
    Last Post: 06-10-2006, 07:28 PM
  5. How to make the darkmoon card: blue dragon proc without casting
    By Matt in forum World of Warcraft Guides
    Replies: 1
    Last Post: 04-17-2006, 05:17 AM
All times are GMT -5. The time now is 09:26 PM. 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