Jump to content
  • 0

Modify @warp @go delay


FallenOne

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

Hi! This is from eA and I am hoping rA can help as well.

@warp/@go delay: http://www.eathena.ws/board/index.php?showtopic=263936&st=0

How do we make this snippet to work when attacked or used a skill? So, atm, there is just a cool down for using @warp or @go. How about it resets when attacked or used a skill?

Thank You~

Link to comment
Share on other sites

Recommended Posts


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  12/17/11
  • Last Seen:  

I like this stuff. this is really good for PK Mode Servers, and an additional Mod like this is great..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

Update on what I need:

I want the players to be able to @warp/@go when they are NOT getting attacked or using a skill. But it will work when they are being attacked or used a skill.

Thank You~

Edited by FallenOne
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

in src/map/pc.h

find

  unsigned int canuseitem_tick; // [skotlex]

then add below

unsigned int warpgodelay_tick;

then go to the src/map/pc.c

find

sd->canuseitem_tick = tick;

then add below

sd->warpgodelay_tick = tick;

then

this is still in src/map/pc.c

find:(In the description it says this function is invoked when the player is receiving)

void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp)

inside the function add this:

 unsigned int tick = gettick();
 int warpgodelaycd = 5000; //This is the delay in milliseconds
 sd->warpgodelay_tick = tick+warpgodelaycd; //This is the timer

then go now in map/atcommand.c

find

 ACMD_FUNC(go)

then add this inside the function

unsigned int tick = gettick();

this is still in the (go) function

find below

nullpo_retr(-1, sd);

This is just below the list of maps in @go

then add below

if(DIFF_TICK(sd->warpgodelay_tick,tick)>0)
{
clif_displaymessage(fd,"There is a 5 seconds delay in using @go command");
return 0;
}

now for the @warp

find:

ACMD_FUNC(mapmove)

then add this inside the function

  unsigned int tick = gettick();

now below

memset(map_name, '0', sizeof(map_name));

add this below

if(DIFF_TICK(sd->warpgodelay_tick,tick)>0)
{
clif_displaymessage(fd,"There is a 5 seconds delay in using @warp command");
return -1;
}

for the skill

edit src/map/unit.c

find:

int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, short skill_lv, int casttime, int castcancel)

then

add this inside the function

int warpgodelaycd = 5000; //This is a delay in miliseconds

then scroll down to the end of the function

you will see this



if( casttime > 0 )
{
ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 );
if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )
status_calc_bl(&sd->bl, SCB_SPEED);
}
else
skill_castend_id(ud->skilltimer,tick,src->id,0);

add this code above

sd->warpgodelay_tick= tick+warpgodelaycd ;//The delay when they use skill

Hope it helps. Merry XMAS

Edited by JayPeeMateo
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

Merry Xmas to you too~

Based on your src edits, I don't have to implement Vengeance's @warp and @go delay since you made the "warpgodelaycd" thing, right?

Oh yeah, Im using eA's SVN 14843... It will still work?

Edited by FallenOne
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

Yes. But Venegeances @warp and @go does need compiling again when changing the delay. And warpgodelaycd is the variable name i use to store the delay

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  392
  • Reputation:   47
  • Joined:  11/18/11
  • Last Seen:  

Yes. But Venegeances @warp and @go does need compiling again when changing the delay. And warpgodelaycd is the variable name i use to store the delay

Actually I think Vengeance's one doesn't need compiling for changing the delay, because the variable is stored in conf/battle/misc.conf. So you could simply do a @reloadbattleconf

// Delay using @commands in seconds [Vengeance]
warp_delay: 5
go_delay: 5

However, Jaypee's one works better, since it resets the timer after being attacked (Not sure if Vengeance's one does, since I didn't read the whole thing, but I already tested Jaypee's one and it works).

You can simply change the timer of jaypee's

int warpgodelaycd = 5000; //This is a delay in miliseconds

5000 = 5 seconds, just change it to whatever you want, then compile, and it's ready.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

Nice! I will go ahead and take out Vengeance's version on my SVN and try out Jaypee's...

Thanks guys!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

Hi!

What was changed from the last time I replied to this thread? I see that you updated your post in 12/26/11.

warp-src-edit-updated.jpg

Update: I added and tried to test your src edit. I turned off my test server, recompiled, turned on my test server. No errors showed up via putty. But the problem is my map server does not turn on for some reason. Login and Character servers are only on.

I am not a coder and I might have messed up every time you say, "add this inside the function." When I read that instruction, I just try to add it to the first line after " { " like for example:

void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp)
{
 if (sp) clif_updatestatus(sd,SP_SP);
 if (hp) clif_updatestatus(sd,SP_HP);
 else return;

And it becomes like:

void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp)
{
 unsigned int tick = gettick();
 int warpgodelaycd = 5000; //This is the delay in milliseconds
 sd->warpgodelay_tick = tick+warpgodelaycd; //This is the timer
 if (sp) clif_updatestatus(sd,SP_SP);
 if (hp) clif_updatestatus(sd,SP_HP);
 else return;

I don't know if I did it right. If I did, nice! But I might have messed up in the other parts. I am more accurate in adding src edits manually if it was in diff version since I can see the exact tabs and location of where it should be.

Edited by FallenOne
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

Did you add the warpgodelay_tick in the pc.c?

Also please post the things you editted

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

Did you add the warpgodelay_tick in the pc.c?

Also please post the things you editted

I added everything. But I might have added some of them in a wrong way. So, I reversed all the edit with my back-up. I will try to implement it again and if I experience the same problem, I will post all of my edits.

Edited by FallenOne
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

Update: Here are my edits that made my Map Server not to turn on so, I cannot really test the edit:

src/map/pc.h

 unsigned int canuseitem_tick; // [skotlex]
 unsigned int canusecashfood_tick;

Becomes like this:

 unsigned int canuseitem_tick; // [skotlex]
 unsigned int warpgodelay_tick;
 unsigned int canusecashfood_tick;

src/map/pc.c

  sd->canuseitem_tick = tick;
  sd->canusecashfood_tick = tick;

Becomes like this:

  sd->canuseitem_tick = tick;
  sd->warpgodelay_tick = tick;
  sd->canusecashfood_tick = tick;

src/map/pc.c

void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp)
{
 if (sp) clif_updatestatus(sd,SP_SP);
 if (hp) clif_updatestatus(sd,SP_HP);
 else return;

Becomes like this:

void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp)
{
 unsigned int tick = gettick();
 int warpgodelaycd = 5000; //This is the delay in milliseconds
 sd->warpgodelay_tick = tick+warpgodelaycd; //This is the timer
 if (sp) clif_updatestatus(sd,SP_SP);
 if (hp) clif_updatestatus(sd,SP_HP);
 else return;

src/map/atcommand.c

ACMD_FUNC(go)
{
 int i;
 int town;
 char map_name[MAP_NAME_LENGTH];
 int m;

Becomes like this:

ACMD_FUNC(go)
{
 unsigned int tick = gettick();
 int i;
 int town;
 char map_name[MAP_NAME_LENGTH];
 int m;

src/map/atcommand.c

 };

 nullpo_retr(-1, sd);

 if( map[sd->bl.m].flag.nogo && battle_config.any_warp_GM_min_level > pc_isGM(sd) ) {
 clif_displaymessage(sd->fd,"You can not use @go on this map.");
 return 0;
 }

Becomes like this:

 };

 nullpo_retr(-1, sd);
 if(DIFF_TICK(sd->warpgodelay_tick,tick)>0)
 {
 clif_displaymessage(fd,"There is a 5 seconds delay in using @go command");
 return 0;
 }
 if( map[sd->bl.m].flag.nogo && battle_config.any_warp_GM_min_level > pc_isGM(sd) ) {
 clif_displaymessage(sd->fd,"You can not use @go on this map.");
 return 0;
 }

src/map/atcommand.c

ACMD_FUNC(mapmove)
{
 unsigned int tick = gettick();
 char map_name[MAP_NAME_LENGTH_EXT];
 unsigned short mapindex;
 int x = 0, y = 0;
 int m = -1;

Becomes like this:

ACMD_FUNC(mapmove)
{
 unsigned int tick = gettick();
 char map_name[MAP_NAME_LENGTH_EXT];
 unsigned short mapindex;
 int x = 0, y = 0;
 int m = -1;

src/map/atcommand.c

 nullpo_retr(-1, sd);

 memset(map_name, '0', sizeof(map_name));


 if (!message || !*message ||

Becomes like this:

 memset(map_name, '0', sizeof(map_name));
 if(DIFF_TICK(sd->warpgodelay_tick,tick)>0)
 {
 clif_displaymessage(fd,"There is a 5 seconds delay in using @warp command");
 return -1;
 }
 if (!message || !*message ||

src/map/unit.c

int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, short skill_lv, int casttime, int castcancel)
{
 struct unit_data *ud;
 struct status_data *tstatus;

Becomes like this:

int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, short skill_lv, int casttime, int castcancel)
{
 int warpgodelaycd = 5000; //This is a delay in miliseconds
 struct unit_data *ud;
 struct status_data *tstatus;

src/map/unit.c

	  if (!src->prev) return 0; //Warped away!
 }
 if( casttime > 0 )
 {
 ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 );
 if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )

Becomes like this:

	  if (!src->prev) return 0; //Warped away!
 }
 sd->warpgodelay_tick= tick+warpgodelaycd ;//The delay when they use skill
 if( casttime > 0 )
 {
 ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 );
 if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

It seems nothing is wrong. Did you try it compiling in your local computer and test it in your local computer?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

It seems nothing is wrong. Did you try it compiling in your local computer and test it in your local computer?

Yes, I have. I typed these:

./athena-start stop

make clean && ./configure --with-pcre && make sql

./athena-start start

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

I mean in your Windows OS. I cant see anything wrong with the code it works fine on my test server(rAthena).

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

I mean in your Windows OS. I cant see anything wrong with the code it works fine on my test server(rAthena).

My Test Server is on a VPS using Linux OS. And it's eAthena 14843 with other src edits so, that could be the problem then?

Edited by FallenOne
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

I guess it can be a problem since I coded them in rAthena

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  12/31/11
  • Last Seen:  

weird thing is , i also tested this and it works localy, but when i upload this to my host and recompile using 'make sql' , then run server, map crashes

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  67
  • Reputation:   23
  • Joined:  11/14/11
  • Last Seen:  

Update: Here are my edits that made my Map Server not to turn on so, I cannot really test the edit:

src/map/unit.c

	  if (!src->prev) return 0; //Warped away!
 }
 if( casttime > 0 )
 {
 ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 );
 if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )

Becomes like this:

	  if (!src->prev) return 0; //Warped away!
 }
 sd->warpgodelay_tick= tick+warpgodelaycd ;//The delay when they use skill
 if( casttime > 0 )
 {
 ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 );
 if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )

Try change this:

	  if (!src->prev) return 0; //Warped away!
 }
 sd->warpgodelay_tick= tick+warpgodelaycd ;//The delay when they use skill
 if( casttime > 0 )
 {
 ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 );
 if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )

to:

	  if (!src->prev) return 0; //Warped away!
 }
 if (sd)
	sd->warpgodelay_tick= tick+warpgodelaycd ;//The delay when they use skill
 if( casttime > 0 )
 {
 ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 );
 if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  12/31/11
  • Last Seen:  

man, you are my savior ! thank you!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

man, you are my savior ! thank you!

It worked! JayPee, Slim and FatalError, you are our savior... hehe!

Edited by FallenOne
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   1
  • Joined:  12/21/11
  • Last Seen:  

help please, my mapserv crash...

[error] delete_timer_error: funtion mismatch 0053AC20<connect_check_clear> !=0051FFF8<pc_endautobonus>

[error] delete_timer_error: funtion mismatch 0053AC20<connect_check_clear> !=0051FFF8<pc_endautobonus>

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

are you using rAthena?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   1
  • Joined:  12/21/11
  • Last Seen:  

No sir, Im using eathena SVN 14993.This is always the error in my mapserv then it will crash. All I want is they cant use @warp/@go for atleast 5 seconds when hit by player. I also tried this http://rathena.org/w..._delay_when_hit but same error that I get.I hope you can help me.Thanks sir.

[error] delete_timer_error: funtion mismatch 0053AC20<connect_check_clear> !=0051FFF8<pc_endautobonus>

[error] delete_timer_error: funtion mismatch 0053AC20<connect_check_clear> !=0051FFF8<pc_endautobonus>

Edited by maynard
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

I coded it using rAthena SVN i dunno why it doesnt work in eAthena

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  11/23/11
  • Last Seen:  

No sir, Im using eathena SVN 14993.This is always the error in my mapserv then it will crash. All I want is they cant use @warp/@go for atleast 5 seconds when hit by player. I also tried this http://rathena.org/w..._delay_when_hit but same error that I get.I hope you can help me.Thanks sir.

[error] delete_timer_error: funtion mismatch 0053AC20<connect_check_clear> !=0051FFF8<pc_endautobonus>

[error] delete_timer_error: funtion mismatch 0053AC20<connect_check_clear> !=0051FFF8<pc_endautobonus>

Did you try changing this file: http://rathena.org/board/topic/56318-solved-modify-warp-go-delay/page__view__findpost__p__67799

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