Jump to content
  • 0
Sign in to follow this  
snowflake1963

Need a @sleep script for Hercules

Question

Hello All ^^

 

I have a script for @sleep that I used with rAthena and tried it here and failed :(

I really like this command and would like to use it still.

 

Here is my script:

 


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

ACMD_FUNC(sleep){

  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(sd,807));
  return -1;
  }
  if(sd->sc.opt1 != OPT1_SLEEP){
sc_start(NULL,&sd->bl, SC_TRICKDEAD, 100, 1, 1000);
sd->sc.opt1 = OPT1_SLEEP;
//sc_start(NULL,&sd->bl, SC_COMA,100,1,skill_get_time2(185,1));
clif_displaymessage(fd, msg_txt(sd,805)); // sleeping
  } else {
sd->sc.opt1 = 0;
clif_emotion(&sd->bl,45);
status_change_end(&sd->bl, SC_TRICKDEAD, -1);
//sc_start(NULL,&sd->bl, SC_COMA,100,1,skill_get_time2(185,1));
clif_displaymessage(fd, msg_txt(sd,806)); // awake
  }

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

 

Can anyone PLEASE help me to make this work?

Share this post


Link to post
Share on other sites

36 answers to this question

Recommended Posts

  • 0

try again

plugin is the way that you don't have to edit the source code

its kinda hard to install, but once get used to it, its quite convenient

http://herc.ws/wiki/Building_HPM_Plugin_for_MSVC

Share this post


Link to post
Share on other sites
  • 0

I did what you suggested and the compiler gave the following errors:

 

  atcommand.cc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(3646): warning C4013: 'intif_broadcast' undefiniert; Annahme: extern mit Rückgabetyp intc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8392): error C2065: 'agit_flag': nichtdeklarierter Bezeichnerc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8394): warning C4013: 'clif_displaymessage' undefiniert; Annahme: extern mit Rückgabetyp intc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8397): warning C4013: 'gettick' undefiniert; Annahme: extern mit Rückgabetyp intc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8399): warning C4002: Zu viele übergebene Parameter für das Makro 'msg_txt'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8399): warning C4047: 'Funktion': Anzahl der Dereferenzierungen bei 'int' und 'map_session_data *' unterschiedlichc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8399): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 1c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8403): warning C4002: Zu viele übergebene Parameter für das Makro 'sc_start'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8403): error C2440: 'Funktion': 'block_list *' kann nicht in 'sc_type' konvertiert werdenc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8403): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 2c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8406): warning C4002: Zu viele übergebene Parameter für das Makro 'msg_txt'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8406): warning C4047: 'Funktion': Anzahl der Dereferenzierungen bei 'int' und 'map_session_data *' unterschiedlichc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8406): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 1c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8409): warning C4013: 'clif_emotion' undefiniert; Annahme: extern mit Rückgabetyp intc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8412): warning C4002: Zu viele übergebene Parameter für das Makro 'msg_txt'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8412): warning C4047: 'Funktion': Anzahl der Dereferenzierungen bei 'int' und 'map_session_data *' unterschiedlichc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8412): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 1c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8415): warning C4013: 'clif_changeoption' undefiniert; Annahme: extern mit Rückgabetyp intc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8418): warning C4002: Zu viele übergebene Parameter für das Makro 'msg_txt'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8418): warning C4047: 'Funktion': Anzahl der Dereferenzierungen bei 'int' und 'map_session_data *' unterschiedlichc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8418): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 1  atcommand.cc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(3646): warning C4013: 'intif_broadcast' undefiniert; Annahme: extern mit Rückgabetyp intc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8392): error C2065: 'agit_flag': nichtdeklarierter Bezeichnerc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8394): warning C4013: 'clif_displaymessage' undefiniert; Annahme: extern mit Rückgabetyp intc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8397): warning C4013: 'gettick' undefiniert; Annahme: extern mit Rückgabetyp intc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8399): warning C4002: Zu viele übergebene Parameter für das Makro 'msg_txt'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8399): warning C4047: 'Funktion': Anzahl der Dereferenzierungen bei 'int' und 'map_session_data *' unterschiedlichc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8399): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 1c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8403): warning C4002: Zu viele übergebene Parameter für das Makro 'sc_start'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8403): error C2440: 'Funktion': 'block_list *' kann nicht in 'sc_type' konvertiert werdenc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8403): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 2c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8406): warning C4002: Zu viele übergebene Parameter für das Makro 'msg_txt'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8406): warning C4047: 'Funktion': Anzahl der Dereferenzierungen bei 'int' und 'map_session_data *' unterschiedlichc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8406): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 1c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8409): warning C4013: 'clif_emotion' undefiniert; Annahme: extern mit Rückgabetyp intc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8412): warning C4002: Zu viele übergebene Parameter für das Makro 'msg_txt'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8412): warning C4047: 'Funktion': Anzahl der Dereferenzierungen bei 'int' und 'map_session_data *' unterschiedlichc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8412): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 1c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8415): warning C4013: 'clif_changeoption' undefiniert; Annahme: extern mit Rückgabetyp intc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8418): warning C4002: Zu viele übergebene Parameter für das Makro 'msg_txt'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8418): warning C4047: 'Funktion': Anzahl der Dereferenzierungen bei 'int' und 'map_session_data *' unterschiedlichc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8418): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 1

Share this post


Link to post
Share on other sites
  • 0

Thank you for your help :)

 

I put in the code and i still have 3 errors when recompiling:

c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8403): warning C4002: Zu viele übergebene Parameter für das Makro 'sc_start'c:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8403): error C2440: 'Funktion': 'block_list *' kann nicht in 'sc_type' konvertiert werdenc:usersuserdesktopro server trunkssnow3 - hercules trunksrcmapatcommand.c(8403): warning C4024: 'Funktionszeiger': Unterschiedliche Typen für formalen und übergebenen Parameter 2

This points to line 8403 which is:

sc_start(NULL,&sd->bl, SC_TRICKDEAD, 100, 1, 1000);

Can you please explain?

 

mfg

Snowflake

Share this post


Link to post
Share on other sites
  • 0

@afk will kick the player offline, but the player will still be vulnerable

			clif->chsys_quit(sd);			clif->authfail_fd(sd->fd, 15);
.

.

this @sleep will just make the player invulnerable by using novice's trick dead skill, but doesn't kick the player offline

quite good if you want to idle(go to toilet hahaha) inside a dungeon where aggressive monsters around

Share this post


Link to post
Share on other sites
  • 0

Followed your hint and the guide. Sadly my compiler give a fatal error now:

 

c:transfersnowhercules serversnow3 - hercules trunksrcpluginsat_sleep.c(10): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "../common/HPMDataCheck.h": No such file or directory

 

mfg

Snowflake

Share this post


Link to post
Share on other sites
  • 0

how old is your hercules ?

at least update to the latest one

 

 

if you are using outdated hercules then use the patch

Share this post


Link to post
Share on other sites
  • 0

Followed your hint and used GIT update. Compile was fine. 0 errors.

 

BUT now i have millions of errors pointing to the mob_db. I think the server forgot how to read mob_db2, cause all errors say non-existing mob with my custom mobid's.

 

Really need HELP with that

 

mfg

Snowflake

 

 

The Mob error is gone, it was a setting in mob.h. Sorry was extrem confused in that moment.

 

Will test @sleep now :)

 

mfg

Snowflake

Share this post


Link to post
Share on other sites
  • 0

 

@afk will kick the player offline, but the player will still be vulnerable

			clif->chsys_quit(sd);			clif->authfail_fd(sd->fd, 15);
.

.

this @sleep will just make the player invulnerable by using novice's trick dead skill, but doesn't kick the player offline

quite good if you want to idle(go to toilet hahaha) inside a dungeon where aggressive monsters around

I see, Thank you

Share this post


Link to post
Share on other sites
  • 0

I just found a bug on my plugin

my test server has prevent_logout defaulted to 0 inside my import folder, makes me forget to change this

 

change this line

if ( !battle_config.prevent_logout || DIFF_TICK( timer->gettick(), sd->canlog_tick) > battle_config.prevent_logout ) {
into
if ( !battle->bc->prevent_logout || DIFF_TICK( timer->gettick(), sd->canlog_tick) > battle->bc->prevent_logout ) {
then add this below
	battle = GET_SYMBOL("battle");
.

.

.

the patch is unaffected

 

.... just redownload the plugin will do, I've changed that

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

you type @sleep and then your character lays down ( looks like Novice Skill Trickdead ) and sleeps ( zZzZzZ ~ over your head ).

Type @sleep again to wake up. While you sleep you can not be attacked.

Usefull to go pee or poo in real life while your charcter is on a field or in a dungeon with agressive mobs. :)

 

mfg

Snowflake

Edited by snowflake1963

Share this post


Link to post
Share on other sites
  • 0

The command worked great on our test server (windows) but when we went to put Hercules to our root (linux) we get the message:

file at_sleep.so can not be found. How to get this file?

 

Thank you in advance :)

Share this post


Link to post
Share on other sites
  • 0

Tried that but somehow my Linux gets stuck at compiling HPMHooking.c. I waited almost 2 hrs but nothing happend. Not even an error message.

 

Mfg

Snowflake

Edited by snowflake1963

Share this post


Link to post
Share on other sites
  • 0

HPMHooking.c

I completely remove the one default in hercules and rebuilt it from clean

also this particular plugin doesn't need to have HPMHooking anyways

Share this post


Link to post
Share on other sites
  • 0

Its disabled in plugins.conf. So where to disable that ?

Maybe here ?

# Plugins that will be built through 'make plugins' or 'make all'PLUGINS = sample db2sql HPMHooking $(MYPLUGINS)

like that ?

# Plugins that will be built through 'make plugins' or 'make all'PLUGINS = $(MYPLUGINS)

 

Mfg

Snowflake

Edited by snowflake1963

Share this post


Link to post
Share on other sites
  • 0

Hello Annie, its me again :)

 

I updated my server around the 10th of August 2014 and got this error messages from my compiler

3>  at_sleep.c3>c:transfersnowhercules serverhercules trunksrcpluginsat_sleep.c(30): warning C4013: 'DIFF_TICK' undefiniert; Annahme: extern mit Rückgabetyp int3>c:transfersnowhercules serverhercules trunksrcpluginsat_sleep.c(30): error C2065: 'timer': nichtdeklarierter Bezeichner3>c:transfersnowhercules serverhercules trunksrcpluginsat_sleep.c(30): error C2223: Der linke Teil von '->gettick' muss auf eine Struktur/Union zeigen3>c:transfersnowhercules serverhercules trunksrcpluginsat_sleep.c(57): error C2065: 'timer': nichtdeklarierter Bezeichner3>c:transfersnowhercules serverhercules trunksrcpluginsat_sleep.c(57): warning C4047: '=': Anzahl der Dereferenzierungen bei 'int' und 'void *' unterschiedlich

Sorry for the german text, its just what my compiler gives me, cause my computer has a german windows.

 

How can I fix this problem ?

 

I am using the plugin you gave me.

 

Thanks in advance

 

Snowflake

Share this post


Link to post
Share on other sites
  • 0

Hello Annie, its me again :)

 

I updated my server around the 10th of August 2014 and got this error messages from my compiler

3>  at_sleep.c3>c:transfersnowhercules serverhercules trunksrcpluginsat_sleep.c(30): warning C4013: 'DIFF_TICK' undefiniert; Annahme: extern mit Rückgabetyp int3>c:transfersnowhercules serverhercules trunksrcpluginsat_sleep.c(30): error C2065: 'timer': nichtdeklarierter Bezeichner3>c:transfersnowhercules serverhercules trunksrcpluginsat_sleep.c(30): error C2223: Der linke Teil von '->gettick' muss auf eine Struktur/Union zeigen3>c:transfersnowhercules serverhercules trunksrcpluginsat_sleep.c(57): error C2065: 'timer': nichtdeklarierter Bezeichner3>c:transfersnowhercules serverhercules trunksrcpluginsat_sleep.c(57): warning C4047: '=': Anzahl der Dereferenzierungen bei 'int' und 'void *' unterschiedlich

Sorry for the german text, its just what my compiler gives me, cause my computer has a german windows.

 

How can I fix this problem ?

 

I am using the plugin you gave me.

 

Thanks in advance

 

Snowflake

try to add a line  #include "../common/timer.h"  on the header

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.