Jump to content
  • 0

Trigger when you receive/inflict damage to/from Boss Monsters


Lord Ganja

Question


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

I'm trying to modify the warpgodelay. I only wanted it to work on BOSS monsters and players. 

A delay timer will tick whenever you inflict or received damage from boss monsters and players only.

But I couldn't make it to work for boss monsters.

PS: The warpgodelay for players is already fully working. The only problem here is the trigger for Boss monsters.

 

I'm still trying to modify it to work but im really noob at src mod. But I think i'm almost there. Can anyone give me tips for this?

 

I think this part is only the problem: 

    if( src->type == BL_PC || src->type == BL_MOB && is_boss(src) ) {
        sd->warpgodelay_tick = tick + warpgodelaycd; //This is the timer
        md->warpgodelay_tick = tick + warpgodelaycd; //This is the timer
    }

 

Whenever I used this part  src->type == BL_MOB && is_boss(src) , it somehow works, but not fully working.

warpgodelay is ONLY triggered when im attacked. And even the mobs like Salamander, Necromancer attacked me, it is triggered.

I only wanted it to work for boss only.

 

Should I just change this part "src->type == BL_MOB && is_boss(src)"? or I still need to add something?

 

my main purpose for this is to avoid the Champion MVP Hunting while warping after casting Asura Strike.

 

Here's the part of the script:

/*==========================================
 * 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 = 5000; //This is the delay in milliseconds you can set what ever delay you want 
	struct map_session_data *md = (struct map_session_data *)src;
	
	if (sp) clif_updatestatus(sd,SP_SP);
	if (hp) clif_updatestatus(sd,SP_HP);
	else return;

	if( !src || src == &sd->bl )
		return;
	
	if( src->type == BL_PC || src->type == BL_MOB && is_boss(src) ) {
		sd->warpgodelay_tick = tick + warpgodelaycd; //This is the timer 
		md->warpgodelay_tick = tick + warpgodelaycd; //This is the timer 
	}

	if( pc_issit(sd) ) {
		pc_setstand(sd, true);
		skill_sit(sd,0);
	}

	if( sd->progressbar.npc_id )
		clif_progressbar_abort(sd);

	if( sd->status.pet_id > 0 && sd->pd && battle_config.pet_damage_support )
		pet_target_check(sd->pd,src,1);

	if( sd->status.ele_id > 0 )
		elemental_set_target(sd,src);

	sd->canlog_tick = gettick();
}

I'm willing to pay if it's needed. Just drop me a message here. Thank you!

Edited by Lord Ganja
Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

the header comment says it all:

/*==========================================
* Invoked when a player has received damage
*------------------------------------------*/

anyway,

your issue about salamander and necromancer still triggering it is that because these monsters are considered as bosses.
if you don't want that to happen you can manually change their "mode" in your mob_db sql tables by checking

https://rathena.org/wiki/Custom_Mobs#Database_Structure

by the way

src->type == BL_MOB && is_boss(src)

try using only

is_boss(src)

since a boss types can only be related to mobs.



not sure about the part where a player is the one attacking though.
 

Edited by jezznar
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

the header comment says it all:

/*==========================================
* Invoked when a player has received damage
*------------------------------------------*/
anyway,

your issue about salamander and necromancer still triggering it is that because these monsters are considered as a boss.

if you don't want that to happen you can manually change their "mode" in your mob_db sql tables by checking

https://rathena.org/wiki/Custom_Mobs#Database_Structure
by the way
src->type == BL_MOB && is_boss(src)
try using only
is_boss(src)
since a boss types can only be related to mobs.

not sure about the part where a player is the one attacking though.

//edit

If I were you i'd go and add my modification in the atcommand.c

And i think you can detect attacks by checking the session data -> target_id

Im out somewhere so I can't check it right now xD

 

Thanks for your reply Jezznar. Anyway, I don't wan't to mess up anything in mob_db when I change the mode. I want it to stay the same..

Btw, the one that you're telling me about the modification in the atcommand.c, can you help me through it? im really bad at src. I can only do slight/easy modifcations but not the complicated ones. LOL I was thinking about using the OnPCStatCalcEvent so I can specify which monster's while being attacked will trigger the script. But I don't know how to create a 'target' variable so I can filter the target.

 

Example:

OnPCStatCalcEvent:

   if( target == <monster id> ) {

 // I will put the script here that will trigger the warpgodelay

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

I'm not really good at source too, just thought of using my knowledge on logical statements from what you presented :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

I'm not really good at source too, just thought of using my knowledge on logical statements from what you presented :)

What about the one that you suggested, the mod on atcommand.c?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

Yeah but when I looked at the src for mapmove and didn't find anything juicy. >_<

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

Yeah but when I looked at the src for mapmove and didn't find anything juicy. >_<

That's sad  /sob  /sob

maybe i'll just wait. hope someone can help me with this. anyway, thank you.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  513
  • Reputation:   83
  • Joined:  08/11/12
  • Last Seen:  

no problem :)

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