Installing and fixing Hateffect

What is hateffect? gravity not to occupy a visual slot that was already 100% occupied, so he decided to create the hateffect possible to call it through a simple script and it will be permanent, great for auras, effects that are meant to be in infinite loop.

Installing a hateffect is very simple, first we need to remove some restrictions

(this change is only required once)
Open your rathena emulator and search for src/map/script.cpp and search for:

BUILDIN_FUNC(hateffect){

and comment out the lines:

if( effectID <= HAT_EF_MIN || effectID >= HAT_EF_MAX ){
ShowError( "buildin_hateffect: unsupported hat effect id %d\n", effectID );
return SCRIPT_CMD_FAILURE;
}

and it will be:

after doing this open script.hpp and search for:

EF_SPRITEMABLE,
EF_TUNAPARTY,
EF_MAX
};

enum e_hat_effects {

and add:

EF_SPRITEMABLE,
EF_TUNAPARTY,
EF_MAX
 = 9999
};

enum e_hat_effects {

After that you can compile your emulator!

Now for the client part:

To install hateffect we now remove the restriction that would be necessary every time you add hateffect, also add to script_constant.hpp (but no longer needed)

Open the hateffectinfo.lub in data/luafiles514/lua files/hateffectinfo/

and you will see this:

go to the last number (my is numero 217), it always follows a single pattern:

mine goes up to number 217 because I have several custons, so probably yours will have less. but the quantity doesn’t matter, the important thing is this in the right sequence.

HAT_NAME_DO_EFFECT = sequential number,
HAT_NAME = 111,

* Very important: the number cannot jump, it must be sequential, for example:

Error:

HAT_EF1 = 110,
HAT_EF2 = 120,


The correct is:

HAT_EF1 = 110,
HAT_EF2 = 111,

Next, let’s create HAT_EF_CUSTOM_FROST = 218,

now we go to the end of hatEffectTable = { in the same file.

I used:

--- Exemple:
[HatEFID.HAT_EF_CUSTOM_FROST] = { resourceFileName = "custom\exemplo\aura.str", isIgnoreRiding = true, isRenderBeforeCharacter = true, hatEffectPos = -4, hatEffectPosX = 0},


Blue = comment (--- exemple:)
Orange= name of the variable we choose is the ID( HAT_EF_CUSTOM_FROST)
Yellow= path that will be found the effect .str ( "custom\exemplo\aura.str" )


*Some of the features mentioned below may only work with hexed 2018+ or 2020+

IsIgnoreRiding: if true when mounting a mount or asking for hateffect will not go up, it will ignore this action

isRenderBeforeCharacter: If true when using hateffect it will be over the character.

hatEffectPos: Position the Y anchor (up and down) of the hateffect
hatEffectPosX: Positions hateffect X anchor (left right)

After you have done this added to the file hateffectinfo.lub we will add the files in the folder data/texture/effect/custom/exemplo/

Here is my effect, after that I go into the game and use a basic script to test it

prontera,155,179,5	script	frost_teste	810,{
end;
	
OnMy:
	input .@number;
	hateffect .@number,true;
	end;
	
OnMy2:
hateffect 218,true;
end;
	
OnInit:
	bindatcmd "efc",strnpcinfo(3)+"::OnMy";
	bindatcmd "ef",strnpcinfo(3)+"::OnMy2";
	
}


When using @ef I will have hateffect 218 active, if I use @efc I will have to enter a number to activate it. (very good for testing)

ingame let’s see the effect:

Now let’s learn how to make it permanent even using /effect

Obs: hateffects are part of @effect 1241+ on my client, yours can be a little more if it has more effects on new clients;

you can use @effect 1241+ until you find, as I have 218 effects I know it’s @effect 1459 (1241 + 218)

After knowing the correct number and testing it ingame, I will luafiles514/lua files/effecttool and look for forcerendereffect.lub

Let’s find:


at the end of the file, add:

--- exemplo
1459,
}

Okay, now you can use /effect and you’ll never turn it off again.