Jump to content
  • 0

Custom Command @sleep


ZelosAvalon

Question


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  181
  • Reputation:   33
  • Joined:  11/11/12
  • Last Seen:  

could someone explain to me how I add a custom command?

@ sleep for example would like to implement, but do not know how!

i see this topic but dont understand: http://www.eathena.ws/board/index.php?showtopic=93866

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  118
  • Reputation:   6
  • Joined:  12/20/12
  • Last Seen:  

This is the src mod =)

/*===================================
* Sleep (@sleep)
*-----------------------------------
*/

int atcommand_sleep(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
   if (agit_flag) // skill not useable in WOE [A17kaliva]
   {
    clif_displaymessage(fd, "Cannot use this command during WOE.");
    return -1;
   }
   if(!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > 10) {
   if(sd->sc.opt1 != 0 && sd->sc.opt1 != OPT1_SLEEP){
    clif_displaymessage(fd, msg_txt(807));
	    return -1;
   }
   if(sd->sc.opt1 != OPT1_SLEEP){
    sc_start(&sd->bl, SC_TRICKDEAD, 100, 1, 1000);
    sd->sc.opt1 = OPT1_SLEEP;
    sc_start(&sd->bl,SC_COMA,100,1,skill_get_time2(185,1));
    clif_displaymessage(fd, msg_txt(805));
   } else {
    sd->sc.opt1 = 0;
    clif_emotion(&sd->bl,45);
    status_change_end(&sd->bl, SC_TRICKDEAD, -1);
    sc_start(&sd->bl,SC_COMA,100,1,skill_get_time2(185,1));
    clif_displaymessage(fd, msg_txt(806));
   }

    clif_changeoption(&sd->bl);
	    return 0;
   }
    clif_displaymessage(fd, msg_txt(807));
	    return -1;
}

I suggest that change my displaymessages n_nU cause the newest versions have that messages busy n_nU ~~

  • Upvote 3
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Adding a commands with a NPC script

(doc/script_commands.txt)

*bindatcmd "command","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};

This command will bind a NPC event label to an atcommand. Upon execution of the

atcommand, the user will invoke the NPC event label. Each atcommand is only allowed

one binding. If you rebind, it will override the original binding.

The following variables are set upon execution:

.@atcmd_command$ = The name of the @command used.

.@atcmd_parameters$[] = Array containing the given parameters, starting from an index of 0.

.@atcmd_numparameters = The number of parameters defined.

Example:

When a user types the command "@test", an angel effect will be shown.

- script atcmd_example -1,{

OnInit:

bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";

end;

OnAtcommand:

specialeffect2 338;

end;

}

Otherwise it seems you want @afk command... then there is this release.

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  181
  • Reputation:   33
  • Joined:  11/11/12
  • Last Seen:  

This is the src mod =)

/*===================================
* Sleep (@sleep)
*-----------------------------------
*/

int atcommand_sleep(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
if (agit_flag) // skill not useable in WOE [A17kaliva]
{
	clif_displaymessage(fd, "Cannot use this command during WOE.");
	return -1;
}
if(!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > 10) {
if(sd->sc.opt1 != 0 && sd->sc.opt1 != OPT1_SLEEP){
	clif_displaymessage(fd, msg_txt(807));
		return -1;
}
if(sd->sc.opt1 != OPT1_SLEEP){
	sc_start(&sd->bl, SC_TRICKDEAD, 100, 1, 1000);
	sd->sc.opt1 = OPT1_SLEEP;
	sc_start(&sd->bl,SC_COMA,100,1,skill_get_time2(185,1));
	clif_displaymessage(fd, msg_txt(805));
} else {
	sd->sc.opt1 = 0;
	clif_emotion(&sd->bl,45);
	status_change_end(&sd->bl, SC_TRICKDEAD, -1);
	sc_start(&sd->bl,SC_COMA,100,1,skill_get_time2(185,1));
	clif_displaymessage(fd, msg_txt(806));
}

	clif_changeoption(&sd->bl);
		return 0;
}
	clif_displaymessage(fd, msg_txt(807));
		return -1;
}

I suggest that change my displaymessages n_nU cause the newest versions have that messages busy n_nU ~~

i put but dont work =/ where i need to put it ? i need to change more .conf ? or just atcommand ? help me please and this messages you can post for me what messages is : 806, 807 ... for i can change ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  118
  • Reputation:   6
  • Joined:  12/20/12
  • Last Seen:  

In atcommand.c, if you have a newest version just change

int atcommand_sleep(const int fd, struct map_session_data* sd, const char* command, const char* message)

{

for

ACMD_FUNC(sleep)

{

and it should work

remember add this in

AtCommandInfo atcommand_base[] = {

ACMD_fUNC(sleep),

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  4
  • Reputation:   0
  • Joined:  11/21/12
  • Last Seen:  

What line do we insert the script?

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...