[NEW YEAR 2019] Adding Custom Skills

Joined
Apr 10, 2010
Messages
191
Reaction score
45
Hi, I'm Wanger@MNDT from Taiwan.

So far the only way most people know to add(not replace the skin) custom skills had been posted a long time ago through adding the skill composite property like Mercedes' skills did.

This method, however, is only viable for the version after GMS 117, and it isn't so smooth to active the custom skills since you need to actuate trigger skills first.

If you have tried to add new skills, they will appear in the skill UI but have no responses when you click or press them because NEXON specifies each skill's function in UserLocal::DoActiveSkill. The skill which doesn't be placed in the code there would have no function. For example, a snippet code of UserLocal::DoActiveSkill from TWMS 147 is as follow:

Code:
	if (v10 <= 2111004)
	{
		if (v10 == 2111004)
			goto LABEL_807;
		if (v10 <= 2101002)
		{
			if (v10 != 2101002)
			{
				if (v10 == 1321012)
					goto LABEL_658;
                         ....
	}

The assembly code:
Code:
Address1:  cmp     edi, 142834h //1321012
Address2:  jz      ActiveAttackSkillAddr
Address3:  cmp     edi, 1E8869h
Address4:  jle     ....

The code above designate the skill 1321012 as an attack skill and will redirect it to corresponding DoActiveSkill function which sends the packet with opcode CLOSE_RANGE_ATTACK (OdinMS).

Now if we want to put a new attack skill 1321013 into game, we NEED TO modify the code as follow(instructive):
Code:
	if (v10 <= 2111004)
	{
		if (v10 == 2111004)
			goto LABEL_807;
		if (v10 <= 2101002)
		{
			if (v10 != 2101002)
			{
				if (v10 == 1321012 || v10 == 1321013) // << we need to modify the code here
					goto LABEL_658;
                         ....
	}

I will show a simple instructive code by injecting the dll to patch the client, you can, of course, patch the following code in the available section in client and jmp to correct address. Yet I don't actually recommend you patch the code in the client directly.

Code:
	int activeAttackSkillAddr = ActiveAttackSkillAddr;
	int jumpBack1 = Address3;
	void __declspec(naked) DispatchActiveSkill()
	{
		__asm
		{
			cmp edi, 0x142834 //1321012 
			jz JumpToAttackSkillAddr
			cmp edi, 0x142835 //1321013
			jz JumpToAttackSkillAddr
			jmp [jumpBack1] //If the skill id doesn't match skill ids above, jump back to next check.

		JumpToAttackSkillAddr: 
			jmp[activeAttackSkillAddr]
		}
	}

        //You need to modify the instruction in client

Address1:  jmp DispatchActiveSkill // You can patch here to jump to our own dispatch function.
Address2:  ?? ?? // the code will be broken here since jmp instruction would fill with cmp, but NVM.
Address3:  cmp     edi, 1E8869h //Keep checking other skills
Address4:  jle     ....

The result is here:
nf1CLeQ - [NEW YEAR 2019] Adding Custom Skills - RaGEZONE Forums


The problem is that the versions before ZERO JOB been introduced(I guess, not test yet) have messy skills designation paths. It may be somehow painful to patch every job. The newer versions, however, use switch-case(jump table), it would be easier to patch each job.

Hope you guys can have brand new GMS 117/83/62 OR TWMS 113 btw LOL.
 
:ott:Good job, I'm just starting on this ...
:blush:I have a question what programs should I use to achieve this?

... I need inject dll?? :/:
 


Creds to MiLin because it wouldn't work when I tried adding it to 4th job, and somehow magically worked in 1st job
 
Last edited:


Creds to MiLin because it wouldn't work when I tried adding it to 4th job, and somehow magically worked in 1st job

Wow how did you do to enlarge your screen in that way?
 
Some client editing, it'll never be fully implemented though since I can't make it perfect. Just for testing purposes I guess

Either way, that's awesome! Both the widescreen edit and custom skill. Good work.

I need to git gud at that stuff. (I'm such a newbie)
 
Has anyone tried modifying the logic of added skills? Projectile behavior, speed, direction, and targeting? I'd like to try my hand at "porting" a newer skill into an older version, but I think I'd be better off trying to recreate the skill rather than port it directly.
 
Back