Jump to content
Sign in to follow this  
Petey Pablo

[Tulong]@go delay when hit

Recommended Posts

bkt kpag nag skill may delay dn na 10 seconds? salamat sa tutulong po.

Rathena Wiki - http://rathena.org/wiki/@go_delay_when_hit

This source snippet is for putting a delay in @go when a player receives a damage.

open src/map/pc.h

  • find:unsigned int canuseitem_tick; // [skotlex]
  • then add below: unsigned int warpgodelay_tick;

open src/map/pc.c

  • find: sd->canuseitem_tick = tick;
  • then add below:sd->warpgodelay_tick = tick;

open src/map/pc.c

  • find: void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp)
  • then add this inside the function:

unsigned int tick = gettick(); int warpgodelaycd = 5000; //This is the delay in milliseconds you can set what ever delay you want sd->warpgodelay_tick = tick+warpgodelaycd; //This is the timer

open src/map/atcommand.c

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

We are still in the @go function

  • scroll down until you find this inside the function:nullpo_retr(-1, sd);
  • then add below:

if(DIFF_TICK(sd->warpgodelay_tick,tick)>0) { //This is for computing the delay if the cooldown or delay is not yet finish restrict using @go clif_displaymessage(fd,"There is a 5 seconds delay in using @go command"); return 0; }

Edited by WillRO

Share this post


Link to post
Share on other sites

Post mo buong modification na ginawa mo

Share this post


Link to post
Share on other sites

src/map/pc.h

int invincible_timer;
  unsigned int canlog_tick;
  unsigned int canuseitem_tick; // [skotlex]
+ unsigned int warpgodelay_tick;
  unsigned int canusecashfood_tick;
  unsigned int canequip_tick; // [inkfish]
  unsigned int cantalk_tick;
  unsigned int cansendmail_tick; // [Mail System Flood Protection]
  unsigned int ks_floodprotect_tick; // [Kill Steal Protection]

src/map/pc.c

sd->canuseitem_tick = tick;
+ sd->warpgodelay_tick = tick;
  sd->canusecashfood_tick = tick;
  sd->canequip_tick = tick;
  sd->cantalk_tick = tick;
  sd->cansendmail_tick = tick;

src/map/pc.c

/*==========================================
* Invoked when a player has received damage
*------------------------------------------*/
void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp)
{
+ unsigned int tick = gettick();
+ int warpgodelaycd = 10000; //This is the delay in milliseconds you can set what ever delay you want
+ 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

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

  nullpo_retr(-1, sd);

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

  if (!message || !*message ||
  (sscanf(message, "%15s %hd %hd", map_name, &x, &y) < 3 &&
  sscanf(message, "%15[^,],%hd,%hd", map_name, &x, &y) < 1)) {

  clif_displaymessage(fd, "Please, enter a map (usage: @warp/@rura/@mapmove <mapname> <x> <y>).");
  return -1;
}
+ if(DIFF_TICK(sd->warpgodelay_tick,tick)>0)
{
  //This is for computing the delay if the cooldown or delay is not yet finish restrict using @warp
+ clif_displaymessage(fd,"There is a 10 seconds delay in using @warp command");
  return 0;
}

/*==========================================
* @go [city_number or city_name] - Updated by Harbin
*------------------------------------------*/
ACMD_FUNC(go)
{
+ unsigned int tick = gettick();
int i;
int town;
char map_name[MAP_NAME_LENGTH];
int m;

const struct {
char map[MAP_NAME_LENGTH];
int x, y;
} data[] = {
{ MAP_PRONTERA,	156, 191 }, //  0=Prontera
{ MAP_MORROC,	  156,  93 }, //  1=Morroc
{ MAP_GEFFEN,	  119,  59 }, //  2=Geffen
{ MAP_PAYON,	   162, 233 }, //  3=Payon
{ MAP_ALBERTA,	 192, 147 }, //  4=Alberta
{ MAP_IZLUDE,	  128, 114 }, //  5=Izlude
{ MAP_ALDEBARAN,   140, 131 }, //  6=Al de Baran
{ MAP_LUTIE,	   147, 134 }, //  7=Lutie
{ MAP_COMODO,	  209, 143 }, //  8=Comodo
{ MAP_YUNO,		157,  51 }, //  9=Yuno
{ MAP_AMATSU,	  198,  84 }, // 10=Amatsu
{ MAP_GONRYUN,	 160, 120 }, // 11=Gonryun
{ MAP_UMBALA,	   89, 157 }, // 12=Umbala
{ MAP_NIFLHEIM,	 21, 153 }, // 13=Niflheim
{ MAP_LOUYANG,	 217,  40 }, // 14=Louyang
{ MAP_NOVICE,	   53, 111 }, // 15=Training Grounds
{ MAP_JAIL,		 23,  61 }, // 16=Prison
{ MAP_JAWAII,	  249, 127 }, // 17=Jawaii
{ MAP_AYOTHAYA,	151, 117 }, // 18=Ayothaya
{ MAP_EINBROCH,	 64, 200 }, // 19=Einbroch
{ MAP_LIGHTHALZEN, 158,  92 }, // 20=Lighthalzen
{ MAP_EINBECH,	  70,  95 }, // 21=Einbech
{ MAP_HUGEL,		96, 145 }, // 22=Hugel
{ MAP_RACHEL,	  130, 110 }, // 23=Rachel
{ MAP_VEINS,	   216, 123 }, // 24=Veins
{ MAP_MOSCOVIA,	223, 184 }, // 25=Moscovia
{ MAP_MELLINA,	  86,  32 }, // 26=Mellina
};

nullpo_retr(-1, sd);
+if(DIFF_TICK(sd->warpgodelay_tick,tick)>0)
{
//This is for computing the delay if the cooldown or delay is not yet finish restrict using @go
+ clif_displaymessage(fd,"There is a 10 seconds delay in using @go command");
return 0;
}

ung may mga (+) po add ko yan.

Share this post


Link to post
Share on other sites

Hi! Sorry for the late reply.

can you search at unit.c coz as far as I remember i put sd->warpgodelay_tick there to put a delay on @go when using a skill. If you find it try to put it in a comment ex: //sd->warpgodelay_tick

Share this post


Link to post
Share on other sites

wala ko makita na ganyan sa unit.c ko sir jaypee. gamit ko po revision 14986.

Share this post


Link to post
Share on other sites

wala ko makita na ganyan sa unit.c ko sir jaypee. gamit ko po revision 14986.

Hmm thats weird i only put the @go delay when the player is receiving a damage not using skill.

Share this post


Link to post
Share on other sites

wala ko makita na ganyan sa unit.c ko sir jaypee. gamit ko po revision 14986.

Hmm thats weird i only put the @go delay when the player is receiving a damage not using skill.

try mo yang nasa rathena wiki sir jaypee. walang errors sa pag compile. 100% tama pagkakalagay ko. di ko makita kung san part ang problem kc ganito po yan. ok sya sa receiving damage na may delay then pag gumamit ka naman ng skill like echant deadly poison ksma sya sa delay 5 seconds.

Edited by WillRO

Share this post


Link to post
Share on other sites
On 1/11/2012 at 3:37 PM, JayPee said:

Hmm thats weird i only put the @go delay when the player is receiving a damage not using skill.

sakin din po may delay kapag gumagamit ng skill, baka po ma help nyo kami na gawing delay lang sya kapag na hihit ng player, hindi ng monster at hindi sa pag skill, salamat po ng madami

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
Reply to this topic...

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

Sign in to follow this  

×
×
  • Create New...

Important Information

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