Jump to content
  • 0

Modifying Spider Web into like Ankle Snare behavior (I'm so close this time around)


Gidz Cross

Question


  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

I know that this has been posted several times. By me and some other rA people in the past. But until now it remains a mystery (at least for me LOL) Others might already solved it and just keeping quiet. But I am this close of achieving the perfect mod.

Here's what I'm trying to achieve.

 

As you can see. I can spam the spider web regardless of the ActiveInstance. The previous web will disappear once I set another web close to target. 

Now, I mentioned that I am super close. I manage to replicate everything except for the disappearance of the previous web. Please check the vid below.
 

 

 

As you can see. I was limited by the ActiveInstance. Thus I cannot spam it.


I need a way to remove the previous web if its already triggered.

Edited by Gidz Cross
Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  64
  • Reputation:   40
  • Joined:  03/26/12
  • Last Seen:  

Try to change this:

	if (unit->group->skill_id == PF_SPIDERWEB && unit->bl.id != srcunit->bl.id && unit->group->src_id == src->id) {
		//skill_delunitgroup(unit->group); // This one is instant Delete
		unit->limit = min(unit->limit,1000); // This one you can change "1000" to change the timing (lower number = faster deletion)
		unit->group->limit = unit->limit;
		return 1;
	}
	

to this:

	if (unit->group->skill_id == PF_SPIDERWEB && unit->bl.id != srcunit->bl.id && unit->group->src_id == src->id && unit->group->val2) {
		//skill_delunitgroup(unit->group); // This one is instant Delete
		unit->limit = min(unit->limit,1000); // This one you can change "1000" to change the timing (lower number = faster deletion)
		unit->group->limit = unit->limit;
		return 1;
	}
	

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  64
  • Reputation:   40
  • Joined:  03/26/12
  • Last Seen:  

in unit.cpp

Find:

	// SC_MAGICPOWER needs to switch states at start of cast
	skill_toggle_magicpower(src, skill_id);

Change To:

	// SC_MAGICPOWER needs to switch states at start of cast
	skill_toggle_magicpower(src, skill_id);

	if (sd && skill_id == PF_SPIDERWEB && !skill_pos_maxcount_check(src, skill_x, skill_y, skill_id, skill_lv, BL_PC, false)) {
		int oldweb = -1;
		int webid = 0;
		for (int i = 0; i < MAX_SKILLUNITGROUP && sd->ud.skillunit[i]; i++) {
			if (sd->ud.skillunit[i]->skill_id == skill_id) {
				if (webid == 0) {
					webid = sd->ud.skillunit[i]->group_id;
					oldweb = i;
				}
				else if (webid != 0 && sd->ud.skillunit[i]->group_id < webid) {
					webid = sd->ud.skillunit[i]->group_id;
					oldweb = i;
				}
			}
		}
		if (oldweb >= 0) {
			skill_delunitgroup(sd->ud.skillunit[oldweb]);
		}
	}

This will delete the oldest active spider web when you try to cast it while it is at max count.

You can change the maxcount in skill_db.txt to any number under 25 to raise the limit before web deletion.

Edit: Sorry I placed the code before requirement checks, but its fixed now. /no1

Edited by joecalis
Changed where to put the code
  • MVP 3
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

On 5/9/2023 at 11:46 AM, joecalis said:

in unit.cpp

Find:

	// SC_MAGICPOWER needs to switch states at start of cast
	skill_toggle_magicpower(src, skill_id);

Change To:

	// SC_MAGICPOWER needs to switch states at start of cast
	skill_toggle_magicpower(src, skill_id);

	if (sd && skill_id == PF_SPIDERWEB && !skill_pos_maxcount_check(src, skill_x, skill_y, skill_id, skill_lv, BL_PC, false)) {
		int oldweb = -1;
		int webid = 0;
		for (int i = 0; i < MAX_SKILLUNITGROUP && sd->ud.skillunit[i]; i++) {
			if (sd->ud.skillunit[i]->skill_id == skill_id) {
				if (webid == 0) {
					webid = sd->ud.skillunit[i]->group_id;
					oldweb = i;
				}
				else if (webid != 0 && sd->ud.skillunit[i]->group_id < webid) {
					webid = sd->ud.skillunit[i]->group_id;
					oldweb = i;
				}
			}
		}
		if (oldweb >= 0) {
			skill_delunitgroup(sd->ud.skillunit[oldweb]);
		}
	}

This will delete the oldest active spider web when you try to cast it while it is at max count.

You can change the maxcount in skill_db.txt to any number under 25 to raise the limit before web deletion.

Edit: Sorry I placed the code before requirement checks, but its fixed now. /no1

I knew it. The mod requires to add something on unit.c as I understand the code what it does was to remove the older web when you reached the limit. Just like ankle snare right?

 

** Edit

Didn't work for me. It says skill x and y is undeclared. Maybe because im using 2020 trunk. Anyway. If this behave like ankle snare (like deleting the oldest active trap) then its not the one im looking. But can be until the proper coding.

The first video i showed was its not ignoring the ActiveInstance. In that server the ActiveInstance istance is set to 5. I can still cast 5 spider web to the ground and will have skill failed when i deploy 5 spider webs.

 

Their spider web behavior is when the target was trapped. And for some reason the target moved to a different cell. The first web will vanished. Thats why I can spam the webs.

Maybe this is a bug but intended one.

Edited by Gidz Cross
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   26
  • Joined:  11/20/11
  • Last Seen:  

```

try to change 

if (sd && skill_id == PF_SPIDERWEB && !skill_pos_maxcount_check(src, skill_x, skill_y, skill_id, skill_lv, BL_PC, false)) {

to 

if (sd && skill_id == PF_SPIDERWEB && !skill_pos_maxcount_check(src, ud->skillx,ud->skilly, ud->skill_id, ud->skill_lv, BL_PC, false)){

```

Edited by Ice Bear
wrong
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

11 minutes ago, Ice Bear said:

```

try to change 

if (sd && skill_id == PF_SPIDERWEB && !skill_pos_maxcount_check(src, skill_x, skill_y, skill_id, skill_lv, BL_PC, false)) {

to 

if (sd && skill_id == PF_SPIDERWEB && !skill_pos_maxcount_check(src, ud->skillx,ud->skilly, ud->skill_id, ud->skill_lv, BL_PC, false)){

```

It works! Thanks bro. This will be my temporary solution.

Here's another video of the mod that i wanted to have.
 

 

MaxInstance still works. It can only be spam when you magnet another target since the first web that hit the target will vanish. XD

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   26
  • Joined:  11/20/11
  • Last Seen:  

I think you need to remove the max instance in the skill_db.yml ? did you check it ? 

```

REMOVE THE ACTIVE INSTANCE? DID U TEST

 - Id: 405
    Name: PF_SPIDERWEB
    Description: Fiber Lock
    MaxLevel: 1
    Type: Magic
    TargetType: Attack
    DamageFlags:
      NoDamage: true
    Range: 7
    Hit: Single
    HitCount: 1
-   ActiveInstance: 3
    Duration1: 16000
    Duration2: 8000
    Requires:
      SpCost: 30
      ItemCost:
        - Item: Spiderweb
          Amount: 1
    Unit:
      Id: Spiderweb
      Interval: -1
      Target: Enemy
      Flag:
        RemovedByFireRain: true
    Status: SpiderWeb
    
```

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

Just now, Ice Bear said:

I think you need to remove the max instance in the skill_db.yml ? did you check it ? 

```

REMOVE THE ACTIVE INSTANCE? DID U TEST

 - Id: 405
    Name: PF_SPIDERWEB
    Description: Fiber Lock
    MaxLevel: 1
    Type: Magic
    TargetType: Attack
    DamageFlags:
      NoDamage: true
    Range: 7
    Hit: Single
    HitCount: 1
-   ActiveInstance: 3
    Duration1: 16000
    Duration2: 8000
    Requires:
      SpCost: 30
      ItemCost:
        - Item: Spiderweb
          Amount: 1
    Unit:
      Id: Spiderweb
      Interval: -1
      Target: Enemy
      Flag:
        RemovedByFireRain: true
    Status: SpiderWeb
    
```

The thing is. I want the MaxInstace to work.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   26
  • Joined:  11/20/11
  • Last Seen:  

Just now, Gidz Cross said:

The thing is. I want the MaxInstace to work.

then what is the problem? sorry didnt get it

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   26
  • Joined:  11/20/11
  • Last Seen:  

I think the better approach you will do it replicate it as 

HT_ANKLESNARE
 
as a trap instead of using as unit instance?
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

Okay i found a new way to explain in a simple manner. You can spam the spider web to target. Because the previous web you used will be removed.

 

 

In the official behavior. yes you can stack the web as well but you will be limited by your ActiveInstance. Here's the video:

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  64
  • Reputation:   40
  • Joined:  03/26/12
  • Last Seen:  

Remove what ever code I sent before, and do this instead.

in skill.cpp

Find:

int skill_greed(struct block_list *bl, va_list ap);
static int skill_cell_overlap(struct block_list *bl, va_list ap);

Change To:

int skill_greed(struct block_list *bl, va_list ap);
static int skill_web_remover(struct block_list *bl, va_list ap);
static int skill_cell_overlap(struct block_list *bl, va_list ap);

Find:

		// Execute on all targets standing on this cell
		if (range == 0 && active_flag)
			map_foreachincell(skill_unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),1);

Change To:

		if (skill_id == PF_SPIDERWEB)
			map_foreachinarea(skill_web_remover, src->m, x - 1, y - 1, x + 1, y + 1, BL_SKILL, src, unit);

		// Execute on all targets standing on this cell
		if (range == 0 && active_flag)
			map_foreachincell(skill_unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),1);

Find:

/*==========================================
 * Check new skill unit cell when overlapping in other skill unit cell.
 * Catched skill in cell value pushed to *unit pointer.
 * Set (*alive) to 0 will ends 'new unit' check
 *------------------------------------------*/
static int skill_cell_overlap(struct block_list *bl, va_list ap)

Change To:

static int skill_web_remover(struct block_list* bl, va_list ap)
{
	struct block_list* src;
	struct skill_unit* srcunit;
	struct skill_unit* unit;

	src = va_arg(ap, struct block_list*);
	srcunit = va_arg(ap, struct skill_unit*);
	unit = (struct skill_unit*)bl;

	if (unit == NULL || unit->group == NULL)
		return 0;
	if (unit->group->skill_id == PF_SPIDERWEB && unit->bl.id != srcunit->bl.id && unit->group->src_id == src->id) {
		//skill_delunitgroup(unit->group); // This one is instant Delete
		unit->limit = min(unit->limit,1000); // This one you can change "1000" to change the timing (lower number = faster deletion)
		unit->group->limit = unit->limit;
		return 1;
	}
	return 0;
}

/*==========================================
 * Check new skill unit cell when overlapping in other skill unit cell.
 * Catched skill in cell value pushed to *unit pointer.
 * Set (*alive) to 0 will ends 'new unit' check
 *------------------------------------------*/
static int skill_cell_overlap(struct block_list *bl, va_list ap)

This line you can change depending on what you prefer.

		//skill_delunitgroup(unit->group); // This one is instant Delete
		unit->limit = min(unit->limit,1000); // This one you can change "1000" to change the timing (lower number = faster deletion)
		unit->group->limit = unit->limit;

If you want to make web instantly vanish remove the "//" before the skill_delunitgroup then put "//" before unit->limit and unit->group->limit

If you want to change the speed of when it disappears edit the "1000" to any number you want, it's in milliseconds.

This however deletes nearby webs even if you don't have a target and will only delete your own web

 

 

Edited by joecalis
added video
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

19 hours ago, joecalis said:

Remove what ever code I sent before, and do this instead.

in skill.cpp

Find:

int skill_greed(struct block_list *bl, va_list ap);
static int skill_cell_overlap(struct block_list *bl, va_list ap);

Change To:

int skill_greed(struct block_list *bl, va_list ap);
static int skill_web_remover(struct block_list *bl, va_list ap);
static int skill_cell_overlap(struct block_list *bl, va_list ap);

Find:

		// Execute on all targets standing on this cell
		if (range == 0 && active_flag)
			map_foreachincell(skill_unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),1);

Change To:

		if (skill_id == PF_SPIDERWEB)
			map_foreachinarea(skill_web_remover, src->m, x - 1, y - 1, x + 1, y + 1, BL_SKILL, src, unit);

		// Execute on all targets standing on this cell
		if (range == 0 && active_flag)
			map_foreachincell(skill_unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),1);

Find:

/*==========================================
 * Check new skill unit cell when overlapping in other skill unit cell.
 * Catched skill in cell value pushed to *unit pointer.
 * Set (*alive) to 0 will ends 'new unit' check
 *------------------------------------------*/
static int skill_cell_overlap(struct block_list *bl, va_list ap)

Change To:

static int skill_web_remover(struct block_list* bl, va_list ap)
{
	struct block_list* src;
	struct skill_unit* srcunit;
	struct skill_unit* unit;

	src = va_arg(ap, struct block_list*);
	srcunit = va_arg(ap, struct skill_unit*);
	unit = (struct skill_unit*)bl;

	if (unit == NULL || unit->group == NULL)
		return 0;
	if (unit->group->skill_id == PF_SPIDERWEB && unit->bl.id != srcunit->bl.id && unit->group->src_id == src->id) {
		//skill_delunitgroup(unit->group); // This one is instant Delete
		unit->limit = min(unit->limit,1000); // This one you can change "1000" to change the timing (lower number = faster deletion)
		unit->group->limit = unit->limit;
		return 1;
	}
	return 0;
}

/*==========================================
 * Check new skill unit cell when overlapping in other skill unit cell.
 * Catched skill in cell value pushed to *unit pointer.
 * Set (*alive) to 0 will ends 'new unit' check
 *------------------------------------------*/
static int skill_cell_overlap(struct block_list *bl, va_list ap)

This line you can change depending on what you prefer.

		//skill_delunitgroup(unit->group); // This one is instant Delete
		unit->limit = min(unit->limit,1000); // This one you can change "1000" to change the timing (lower number = faster deletion)
		unit->group->limit = unit->limit;

If you want to make web instantly vanish remove the "//" before the skill_delunitgroup then put "//" before unit->limit and unit->group->limit

If you want to change the speed of when it disappears edit the "1000" to any number you want, it's in milliseconds.

This however deletes nearby webs even if you don't have a target and will only delete your own web

 

 

Sweet! We are getting close. Since you managed to work on the vanishing thingy. But This should only work when you trap the target. But pretty much usable until i get what i want. Thank you so much!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

17 hours ago, joecalis said:

Try to change this:

	if (unit->group->skill_id == PF_SPIDERWEB && unit->bl.id != srcunit->bl.id && unit->group->src_id == src->id) {
		//skill_delunitgroup(unit->group); // This one is instant Delete
		unit->limit = min(unit->limit,1000); // This one you can change "1000" to change the timing (lower number = faster deletion)
		unit->group->limit = unit->limit;
		return 1;
	}
	

to this:

	if (unit->group->skill_id == PF_SPIDERWEB && unit->bl.id != srcunit->bl.id && unit->group->src_id == src->id && unit->group->val2) {
		//skill_delunitgroup(unit->group); // This one is instant Delete
		unit->limit = min(unit->limit,1000); // This one you can change "1000" to change the timing (lower number = faster deletion)
		unit->group->limit = unit->limit;
		return 1;
	}
	

 

Oh my goodness! YOU DA MENSH! ❤️

PERFECTION!

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