Jump to content
  • 0

No warping on setcells?


johnbond

Question


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

Hello,

 

Is there a way to prohibit warp portal skills of priests on a specific cell(s)? Because the closest I can think of is using the cell_landprotector setcell (because actual land protector skill really does prohibit warping) but it seems to not work, players can still cast warp on a cell with this setcell enabled and other players are still successfully warped out.

 

Sample:

setcell "payon",156,195,156,195,cell_landprotector,1;

May I ask somebody who can make me a code that I can use so that the setcell...cell_landprotector  can also block warp skills or prohibit from being warped when within the specified cell(s)? Its either the warp skill would fail or no warping will be done, either will be fine.

 

I hope you could give me enlightenment on the matter.

 

Thank you guys in advance!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


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

Anyone help me on this coding?

 

You can charge me for the service.

 

Thank you guys. :)

Link to comment
Share on other sites


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

Try this. It adds a new Cell which is called cell_nowarpportal. You can't cast warp portals onto those cells. 

diff --git a/db/const.txt b/db/const.txt
index 76926dc..9320e38 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -388,6 +388,7 @@ cell_basilica 4
 cell_landprotector 5
 cell_novending 6
 cell_nochat 7
+cell_nowarpportal 10
 
 //cell_gettype 0
 cell_chkwall 1
diff --git a/src/map/map.c b/src/map/map.c
index 2c8bf35..176d2d1 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2664,6 +2664,8 @@ int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk)
  return (cell.maelstrom);
  case CELL_CHKICEWALL:
  return (cell.icewall);
+ case CELL_CHKNOWARPPORTAL:
+ return (cell.nowarpportal);
 
  // special checks
  case CELL_CHKPASS:
@@ -2718,6 +2720,8 @@ 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_NOWARPPORTAL:  map[m].cell[j].nowarpportal = 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..56bd72c 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -460,6 +460,7 @@ typedef enum {
  CELL_NOCHAT,
  CELL_MAELSTROM,
  CELL_ICEWALL,
+ CELL_NOWARPPORTAL,
 
 } cell_t;
 
@@ -484,6 +485,7 @@ typedef enum {
  CELL_CHKNOCHAT,
  CELL_CHKMAELSTROM,
  CELL_CHKICEWALL,
+ CELL_CHKNOWARPPORTAL,
 
 } cell_chk;
 
@@ -503,7 +505,8 @@ struct mapcell
  novending : 1,
  nochat : 1,
  maelstrom : 1,
- icewall : 1;
+ icewall : 1,
+ nowarpportal : 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..d5ff5bd 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -13397,6 +13397,12 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
  clif_displaymessage(sd->fd, output); //"Duel: Can't use %s in duel."
  return 0;
  }
+ if (map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOWARPPORTAL)) {
+ char output[128];
+ sprintf(output, msg_txt(sd, 1404), skill_get_name(AL_WARP));
+ clif_displaymessage(sd->fd, output); //"Warpportal failed."
+ return 0;
+ }
  break;
  case MO_CALLSPIRITS:
  if(sc && sc->data[SC_RAISINGDRAGON])
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:  

Nice. Seems to recompile nicely without errors.

 

Though I will test further.


 

Try this. It adds a new Cell which is called cell_nowarpportal. You can't cast warp portals onto those cells. 

diff --git a/db/const.txt b/db/const.txt
index 76926dc..9320e38 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -388,6 +388,7 @@ cell_basilica 4
 cell_landprotector 5
 cell_novending 6
 cell_nochat 7
+cell_nowarpportal 10
 
 //cell_gettype 0
 cell_chkwall 1
diff --git a/src/map/map.c b/src/map/map.c
index 2c8bf35..176d2d1 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2664,6 +2664,8 @@ int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk)
  return (cell.maelstrom);
  case CELL_CHKICEWALL:
  return (cell.icewall);
+ case CELL_CHKNOWARPPORTAL:
+ return (cell.nowarpportal);
 
  // special checks
  case CELL_CHKPASS:
@@ -2718,6 +2720,8 @@ 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_NOWARPPORTAL:  map[m].cell[j].nowarpportal = 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..56bd72c 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -460,6 +460,7 @@ typedef enum {
  CELL_NOCHAT,
  CELL_MAELSTROM,
  CELL_ICEWALL,
+ CELL_NOWARPPORTAL,
 
 } cell_t;
 
@@ -484,6 +485,7 @@ typedef enum {
  CELL_CHKNOCHAT,
  CELL_CHKMAELSTROM,
  CELL_CHKICEWALL,
+ CELL_CHKNOWARPPORTAL,
 
 } cell_chk;
 
@@ -503,7 +505,8 @@ struct mapcell
  novending : 1,
  nochat : 1,
  maelstrom : 1,
- icewall : 1;
+ icewall : 1,
+ nowarpportal : 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..d5ff5bd 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -13397,6 +13397,12 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
  clif_displaymessage(sd->fd, output); //"Duel: Can't use %s in duel."
  return 0;
  }
+ if (map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOWARPPORTAL)) {
+ char output[128];
+ sprintf(output, msg_txt(sd, 1404), skill_get_name(AL_WARP));
+ clif_displaymessage(sd->fd, output); //"Warpportal failed."
+ return 0;
+ }
  break;
  case MO_CALLSPIRITS:
  if(sc && sc->data[SC_RAISINGDRAGON])

 

 

Working. But not entirely correct.

 

I think the code only checked and prohibited where the "caster" is standing and not exactly on where the warp portal skill is casted.

 

I tested it with my script to enable nowarpportal setcells and it works but when the casters moves away from the setcell coordinates he can again cast the warp skill even on the cells with the setcell nowarpportal is enabled.

 

Maybe we can edit  that warp skill will fail if casted on cells within the nowarpportal setcell is enabled and not on where the caster is standing?

 

Thanks!

Link to comment
Share on other sites


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

Revert the diff I gave you (but only for the skill.c) and apply this one:

diff --git a/src/map/skill.c b/src/map/skill.c
index 117c0a7..7d3a586 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -11176,6 +11176,12 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
  wx = sd->menuskill_val>>16;
  wy = sd->menuskill_val&0xffff;
 
+ // check whether it's allowed to cast AL_WARP there
+ if (map_getcell(sd->bl.m, wx, wy, CELL_CHKNOWARPPORTAL)) {
+ skill_failed(sd);
+ return 0;
+ }
+
  if( lv <= 0 ) return 0;
  if( lv > 4 ) lv = 4; // crash prevention
 
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:  

 

Revert the diff I gave you (but only for the skill.c) and apply this one:

diff --git a/src/map/skill.c b/src/map/skill.c
index 117c0a7..7d3a586 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -11176,6 +11176,12 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
  wx = sd->menuskill_val>>16;
  wy = sd->menuskill_val&0xffff;
 
+ // check whether it's allowed to cast AL_WARP there
+ if (map_getcell(sd->bl.m, wx, wy, CELL_CHKNOWARPPORTAL)) {
+ skill_failed(sd);
+ return 0;
+ }
+
  if( lv <= 0 ) return 0;
  if( lv > 4 ) lv = 4; // crash prevention
 

 

 

Oh nice its working! Thanks Mr. Jonne!

 

Btw, how much do I owe you for the service? Hehe you can pm me.

 

Thank you again!

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