Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[GUIDE] How to add delay to @WARP & @GO
#1
Go to: trunk/src/map/pc.h

FIND:
Quote:unsigned int canuseitem_tick; // [Skotlex]

 
then add below:

Quote:unsigned int warpgodelay_tick;

 
then go to: trunk/src/map/pc.c


Find:

Quote:sd->canuseitem_tick = tick;

then add below:

Quote:sd->warpgodelay_tick = tick;

 
then now, this is still in: src/map/pc.c

FINDSadIn the description it says this function is invoked when the player is receiving)


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

 
 
inside the function add this:

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

then go to:  map/atcommand.c

FIND:

Quote:ACMD_FUNC(go)
then add this inside the function:
unsigned int tick = gettick();

this is still in the (go) function
find below:

Quote: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:
Quote:ACMD_FUNC(mapmove)
 
then add this inside the function:

Quote:unsigned int tick = gettick();

Find this again:

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

 
add this below:

Quote: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:

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

then again, 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:

Quote: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:

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


Forum Jump:


Users browsing this thread: 1 Guest(s)