Jump to content
  • 0

Monster Attack Base on Target's level.


senatin

Question


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  03/04/15
  • Last Seen:  

Help! I want to edit the behavior of monster.

 

I want the monster to attack base on target level. the monster will only attack player above lvl 49.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

From what I know there is no such mode for mob, only MD_TARGETWEAK

 

Target Weak: Allows aggressive monsters to only be aggressive against
    characters that are five levels below it's own level.
    For example, a monster of level 104 will not pick fights with a level 99.

but you can add a new mode

diff --git a/src/map/mob.c b/src/map/mob.c
index 0e2b177..848b9ce 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1071,6 +1071,9 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
 	if ((mode&MD_TARGETWEAK) && status_get_lv(bl) >= md->level-5)
 		return 0;
 
+	if ((mode&MD_TARGETSTRONG) && status_get_lv(bl) <= md->level)
+		return 0;
+
 	if(battle_check_target(&md->bl,bl,BCT_ENEMY)<=0)
 		return 0;
diff --git a/src/map/status.h b/src/map/status.h
index 251e5ad..dd03334 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1562,6 +1562,7 @@ enum e_mode {
 	MD_MVP					= 0x080000,
 	MD_IGNOREMISC			= 0x100000,
 	MD_KNOCKBACK_IMMUNE		= 0x200000,
+	MD_TARGETSTRONG			= 0x400000,
 };
 #define MD_MASK 0x00FFFF
 #define ATR_MASK 0xFF0000

MD_TARGETSTRONG mode : monster lvl >= player lvl --> monster passive

 

refer to mode in mob_db.txt

// ID,Sprite_Name,kROName,iROName,LV,HP,SP,EXP,JEXP,Range1,ATK1,ATK2,DEF,MDEF,STR,AGI,VIT,INT,DEX,LUK,Range2,Range3,Scale,Race,Element,Mode,Speed,aDelay,aMotion,dMotion,MEXP,MVP1id,MVP1per,MVP2id,MVP2per,MVP3id,MVP3per,Drop1id,Drop1per,Drop2id,Drop2per,Drop3id,Drop3per,Drop4id,Drop4per,Drop5id,Drop5per,Drop6id,Drop6per,Drop7id,Drop7per,Drop8id,Drop8per,Drop9id,Drop9per,DropCardid,DropCardper

and the docs https://github.com/rathena/rathena/blob/master/doc/mob_db.txt

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  03/04/15
  • Last Seen:  

Thank you so much Capuche for the help!!!

 

I tried to apply the if statement and MD_TARGETSTRONG to its location, and I'm still figuring out how Skotlex work. Skotlex is the one to be inserted in the mode at mob_db.txt isn't that right?

Edited by senatin
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

I don't understand. Skotlex was a core dev..

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  03/04/15
  • Last Seen:  

to apply the  MD_TARGETSTRONG into a monster, I should edit mob_db.txt Mode right? the thing I dont know is, what should i change it for. As I look around I end up with Skotlex's hexing.

 

I edited one of the monster mode in mob_db.txt and nothing change in game, I even tried to copy the mode of poring which is 0x83 still the behavior of monster doesnt change.

but other options works.

 

I also tried editing in my sql database the mode of a monster but with no result. Am I missing something?

Edited by senatin
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Did you add the mode in the src?

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  03/04/15
  • Last Seen:  

yes I added in status.h and mob.c and recompile the map server via visual c++!

yes It worked! I tried converting hexadecimal to binary and compared poring, isis, familiar and zombie. And i figured out why they all acted weird.

 

i made my binary and converted it to hexadecimal and everything worked as I wanted it!

thank you so much Capuche for everything.

Edited by senatin
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...