Jump to content
  • 0

REQUEST: Custom setcell like cell_basilica


johnbond

Question


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

Like in cell_basilica setcell. Players cannot damage you while inside the cells but the problem is in cell_basilica the players inside cannot skill or use potions. What I want is cannot be attacked while inside but can still use skills, talk to NPC, or use potions while inside cells.

 

I would like to request for a custom setcell code that is omewhat similar to cell_basilica (players cannot be attacked inside) but this time players inside the cell(s) can cast skills, talk to NPCs and use potions while avoiding damage from attacks from outside the cell(s) . I will use it as like a "safe zone" for towns pvp.

 

Thank you for all your support guys.

 

 

 

 

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  149
  • Reputation:   33
  • Joined:  12/24/11
  • Last Seen:  

Try this. You also should add the cell to your const.txt for easier script usage. Here it would be cell number 10, but if you added another cell, it might be higher. Check the CELL_* enum in map.h

diff --git a/src/map/battle.c b/src/map/battle.c
index 6b7cf4b..63c1c4b 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -763,6 +763,9 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
  if( battle_config.ksprotection && mob_ksprotected(src, bl) )
  return 0;
 
+ if (map_getcell(bl->m, bl->x, bl->y, CELL_CHKSAFECELL))
+ return 0;
+
  if( map_getcell(bl->m, bl->x, bl->y, CELL_CHKMAELSTROM) && skill_get_type(skill_id) != BF_MISC
  && skill_get_casttype(skill_id) == CAST_GROUND )
  return 0;
diff --git a/src/map/map.c b/src/map/map.c
index 2c8bf35..ced139c 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2718,6 +2718,7 @@ void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag)
  case CELL_NOCHAT:        map[m].cell[j].nochat = flag;        break;
  case CELL_MAELSTROM:  map[m].cell[j].maelstrom = flag;   break;
  case CELL_ICEWALL:  map[m].cell[j].icewall = flag;   break;
+ case CELL_SAFECELL:  map[m].cell[j].safecell = flag;   break;
  default:
  ShowWarning("map_setcell: invalid cell type '%d'\n", (int)cell);
  break;
diff --git a/src/map/map.h b/src/map/map.h
index c584671..26f8b52 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -460,6 +460,7 @@ typedef enum {
  CELL_NOCHAT,
  CELL_MAELSTROM,
  CELL_ICEWALL,
+ CELL_SAFECELL
 
 } cell_t;
 
@@ -484,6 +485,7 @@ typedef enum {
  CELL_CHKNOCHAT,
  CELL_CHKMAELSTROM,
  CELL_CHKICEWALL,
+ CELL_CHKSAFECELL
 
 } cell_chk;
 
@@ -503,7 +505,8 @@ struct mapcell
  novending : 1,
  nochat : 1,
  maelstrom : 1,
- icewall : 1;
+ icewall : 1,
+ safecell : 1;
 
 #ifdef CELL_NOSTACK
  unsigned char cell_bl; //Holds amount of bls in this cell.
diff --git a/src/map/skill.c b/src/map/skill.c
index 117c0a7..efb1aab 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2247,6 +2247,8 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in
  break;
  case BL_PC: {
  struct map_session_data *sd = BL_CAST(BL_PC, target);
+ if (map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKSAFECELL))
+ return 0;
  if( sd->sc.data[SC_BASILICA] && sd->sc.data[SC_BASILICA]->val4 == sd->bl.id && !is_boss(src))
  return 0; // Basilica caster can't be knocked-back by normal monsters.
  if( !(flag&0x2) && src != target && sd->special_state.no_knockback )
 
Edited by Jonne
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

Thank you my friend!

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