Jump to content
  • 0
Sign in to follow this  
Guest Aurela

Claymore trap bugged

Question

Guest Aurela

Hello~


We used this http://herc.ws/board/topic/533-how-to-enable-multiple-hits-for-claymore-trap/ for our claymore trap.
 

It seems that every trap is hitting any number of monsters (even 1 monster) 9-10 times.
When the claymore ends, it leaves a trap (item) on the ground, which should not happen. Skill cost is 2 traps.

 

How it should work is that 1 trap will do splash damage on many grouped monsters that touch it.

It can still take 3-4 claymores to fully kill a mob. One monster vs claymore trap should be 1 hit, trap is gone.

 

Right now I can group even 5 monsters and kill them all because they get hitlocked by one trap.

Also I can group 20+ monsters and kill them with 1 claymore instead of 2-3.

 

Video how it should look (around 2:15): 

 

Thanks for every further help!

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

//Call skill->trap_splash for all monster in splash area mobCount times
map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick);

 

If you want all hits to be displayed, you need to send a different tick for each hit like for example:

 

//Call skill->trap_splash for all monster in splash area mobCount times
map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick+(50*i));

 

That would put a 50ms delay between each hit.

 

Hope it helps!

 

 

Also: I probably should mention this: When you test, don't just let mobs run on the trap. Spawn several immobile mobs on a 3x3 area, put Claymore trap next to them, then use Arrow Shower to knock the trap in the middle of the mobs. If it does multi-hit then, it works just like on official servers (before the 2011 fix).

Edited by Playtester

Share this post


Link to post
Share on other sites
  • 0

Yeah, the solution Malufett posted looks like it will just make it hit for a fixed amount of time in regular intervals based on level. Basically like Sanctuary works (but with damage instead of heal).

You get the trap back because the unit is never set to UNT_USED_TRAPS.

 

Also if you want the official implementation of the skill, then it should only count the mobs on a 3x3 area around the trap (trigger area) and not all mobs in the splash area (5x5). And it should also work for other traps actually (though I guess Claymore Trap is the only popular trap to be used for this).

 

 

You have to use something similar to Ind's original suggestion. I would even do it so it doesn't show multi hit... only causes lag anyway. But matter of taste I guess.

 

Current code is also a bit differerent now and looks like this:

	    case UNT_CLAYMORETRAP:			if( sg->unit_id == UNT_FIRINGTRAP || sg->unit_id == UNT_ICEBOUNDTRAP || sg->unit_id == UNT_CLAYMORETRAP )				map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick);			else				map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);			if (sg->unit_id != UNT_FIREPILLAR_ACTIVE)				clif->changetraplook(&src->bl, sg->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS);			sg->limit=DIFF_TICK32(tick,sg->tick)+1500 +				(sg->unit_id== UNT_CLUSTERBOMB || sg->unit_id== UNT_ICEBOUNDTRAP?1000:0);// Cluster Bomb/Icebound has 1s to disappear once activated.			sg->unit_id = UNT_USED_TRAPS; //Changed ID so it does not invoke a for each in area again.			break;
The idea to not set it to UNT_USED_TRAPS is nice, but it doesn't work because you will also need to remember which monster already triggered the trap in this case (aka each monster can only trigger it once). Also there needs to be a final condition that sets it to UNT_USED_TRAPS a few milliseconds after first activation.

Kind of difficult to code but not impossible.

 

Ind's solution is easier and should always work but I'd to it like on officials and only count 3x3 activation area monsters:

 

Y'know like this:

case UNT_CLAYMORETRAP:if( sg->unit_id == UNT_CLAYMORETRAP ) {  //Count total number of mobs in 3x3 range around trap  int mobcount = map->foreachinrange(skill->area_sub, &src->bl, 1, BL_CHAR, &src->bl, sg->skill_id, sg->skill_lv, tick, BCT_ENEMY, skill->area_sub_count);  if( mobcount <= 0 ) mobcount = 1; //Should never happen because something must have triggered the trap, but to make sure  for( int i = 0; i < mobCount; i++ ) {    //Call skill->trap_splash for all monster in splash area mobCount times    map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick);  }} else if( sg->unit_id == UNT_FIRINGTRAP || sg->unit_id == UNT_ICEBOUNDTRAP )  map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick);else  map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);if (sg->unit_id != UNT_FIREPILLAR_ACTIVE)  clif->changetraplook(&src->bl, sg->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS);sg->limit=DIFF_TICK32(tick,sg->tick)+1500 +  (sg->unit_id== UNT_CLUSTERBOMB || sg->unit_id== UNT_ICEBOUNDTRAP?1000:0);// Cluster Bomb/Icebound has 1s to disappear once activated.sg->unit_id = UNT_USED_TRAPS; //Changed ID so it does not invoke a for each in area again.break;
Edited by Playtester

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
Answer this question...

×   Pasted as rich text.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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