Versiones comparadas

Clave

  • Se ha añadido esta línea.
  • Se ha eliminado esta línea.
  • El formato se ha cambiado.
Comentarios: add missing headers, add override keyword, change tabs to spaces for consistency

...

Bloque de código
languagecpp
titleMy_script.cpp
linenumberstrue
#include "Define.h"
#include "ScriptMgr.h"
#include "SharedDefines.h"
#include "Unit.h"
// .. more includes


class my_script_class : UnitScript
{
public:
    my_script_class() : UnitScript("my_script") {}

   	 	void OnHeal(Unit* healer, Unit* reciever, uint32& gain)
	{
		 override
    {
        // this will make healer yell after healing spell is done
		
        healer->Yell("Healing done", LANG_UNIVERSAL);
    	}
};
 

void AddSC_my_script()
{
    new my_script_class();
}

The example script uses the function called AddSC_my_script to link it to the core code. You need to use an unique name for your function - otherwise the compiler will error as there are two identical functions. 

...