Jump to content
  • 0

Where can i add trigger for my custom label? (OnUseSkillEvent)


luizragna

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  107
  • Reputation:   27
  • Joined:  02/12/14
  • Last Seen:  

Hello guys!

I'm creating a custom label, OnUseSkillEvent

I need add this trigger: (probabily in the skill.c)

npc_script_event(sd, NPCE_USESKILL);

I added in the skill especify cases (for exmple: case: MG_FIREBOLT) but i want for all skills.

 

i already created the code for others files.

npc.hpp:

NPCE_USESKILL,

script.c

"OnUseSkillEvent";

and script.h

const char *useskill_event_name;

 

Test script:

-	script	OnUseTest	FAKE_NPC,{

OnUseSkillEvent:

mes "Do you used a skill!";
close;


}

 

Edited by luizragna
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  236
  • Reputation:   189
  • Joined:  11/27/11
  • Last Seen:  

Hi,

Go in npc.cpp :

after that :

	case NPCE_LOGIN:
		return script_config.login_event_name;

Add that :

	case NPCE_USESKILL:
		return script_config.useskill_event_name;

 

Go in skill.cpp :

after that :


	if( sd && sd->autobonus3[0].rate ) {
		for( i = 0; i < ARRAYLENGTH(sd->autobonus3); i++ ) {
			if( rnd()%1000 >= sd->autobonus3[i].rate )
				continue;
			if( sd->autobonus3[i].atk_type != skill_id )
				continue;
			pc_exeautobonus(sd,&sd->autobonus3[i]);
		}
	}

add :

		npc_script_event(sd, NPCE_USESKILL);

 

 

It should be enough.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...