Advertisement
EmuDevs

EmuDevs - GameObjectScript GameObjectAI Template

Mar 30th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. /*
  2.     EmuDevs - (http://emudevs.com)
  3.     Use this as your template. Make sure to point credits towards ED.
  4. */
  5.  
  6. class go_tut_ai : public GameObjectScript // go_tut_ai - Class constructor, name this anything that doesn't conflict with another name
  7. {
  8. public:
  9.     go_tut_ai() : GameObjectScript("go_tut_ai") { } // go_tut_ai, should be the same as class go_tut_ai -- GameObjectScript("go_tut_ai") - This is your 'ScriptName' that you will assign in your database
  10.  
  11.     struct go_tutAI : public GameObjectAI // go_tutAI - Structure name. This can be anything that doesn't conflict with your class constructor. 'public GameObjectAI', We're using GameObjectAI, so we call it
  12.     {
  13.         go_tutAI(GameObject* go) : GameObjectAI(go) { } // Setting up
  14.  
  15.         void Reset() override // Called when a go just spawns or resets in general
  16.         {
  17.         }
  18.  
  19.         void UpdateAI(uint32 diff) override // This function updates every 1000 (I believe) and is used for the timers, etc
  20.         {
  21.         }
  22.     };
  23.  
  24.     GameObjectAI* GetAI(GameObject* go) const override // We then return new 'go_tutAI' so the script will load and work ingame
  25.     {
  26.         return new go_tutAI(go);
  27.     }
  28. };
  29.  
  30. void AddSC_ai_tutorial() // This is your ScriptLoader.cpp setup function
  31. {
  32.     new go_tut_ai; // Call any new classes here as 'new classname;'
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement