Basic Gameobject Script Structure (C++) menu

User Tag List

Results 1 to 7 of 7
  1. #1
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Basic Gameobject Script Structure (C++)

    This is the basic structure to make GameObject scripts.
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    class GONAME : public GameObjectAIScript
    {
    public:
    	GONAME(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
    	static GameObjectAIScript *Create(GameObject * GO) { return new GONAME(GO); }
    
    	void OnActivate(Player * pPlayer)
    	{
    		//do stuff here
    	}
    };
    
    void SetupGONAME(ScriptMgr * mgr)
    {
    	mgr->register_gameobject_script(ENTRY, &GONAME::Create);
    }
    So, for instance, if you want to make a GO open only if player has a certain item, do this:
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    class GONAME : public GameObjectAIScript
    {
    public:
    	GONAME(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
    	static GameObjectAIScript *Create(GameObject * GO) { return new GONAME(GO); }
    
    	void OnActivate(Player * pPlayer)
    	{
    		if(pPlayer->GetItemInterface()->GetItemCount(KEYENTRY,false))
    			this->_gameobject->Activate(pPlayer->GetMapMgr());
    		else
    			pPlayer->GetSession()->SendNotification("You need a key to open this.");
    	}
    };
    
    void SetupGONAME(ScriptMgr * mgr)
    {
    	mgr->register_gameobject_script(ENTRY, &GONAME::Create);
    }

    Basic Gameobject Script Structure (C++)
  2. #2
    2dgreengiant's Avatar ★ Elder ★


    Reputation
    1192
    Join Date
    Feb 2007
    Posts
    7,129
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Spidey i love your work man keep it up.
    If you need me you have my skype, if you don't have my skype then you don't need me.

  3. #3
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks mate, appreciate it.

  4. #4
    z3ro379's Avatar Active Member
    Reputation
    27
    Join Date
    Aug 2006
    Posts
    31
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much - you are the best

  5. #5
    soul02's Avatar Active Member
    Reputation
    33
    Join Date
    Mar 2008
    Posts
    168
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for sharing Spidey

  6. #6
    мιяаgє's Avatar Member
    Reputation
    42
    Join Date
    Jan 2008
    Posts
    210
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks loads Spidey.


  7. #7
    z3ro379's Avatar Active Member
    Reputation
    27
    Join Date
    Aug 2006
    Posts
    31
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is there a way to open the door just for the person with the key?

Similar Threads

  1. [ArcEmu] Gameobject Script
    By choweyiii in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 11-20-2011, 04:38 AM
  2. [C++ Script] Updating a new Script to old script structure (Trinity)
    By Nic03 in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 01-14-2011, 03:16 PM
  3. [ArcEmu] [Development][PHP]Basic Useful Scripts w/ Login System
    By bsod-staff14 in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 06-19-2010, 06:25 PM
  4. Basic lua script break down (for new lua users =P)
    By Chrispl57 in forum WoW EMU Guides & Tutorials
    Replies: 5
    Last Post: 06-12-2010, 05:45 AM
  5. Basic SQL Scripting Guide
    By R0flz0r in forum WoW EMU Guides & Tutorials
    Replies: 7
    Last Post: 04-17-2008, 06:34 PM
All times are GMT -5. The time now is 12:39 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