Jump to content
  • 0

Event that is triggered when a specific mob attack or get attacked?


Lord Ganja

Question


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

Is there any src or script that is triggered when a specific mob (specified by GID) is being attacked(received any kind of damage physical or magic type) ? or is attacking(attack players)?

Edited by Lord Ganja
Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

I suppose you already know how to get a monster GID, so, you can try to use this method for specific monsters after it's summoned.

  • Upvote 1
Link to comment
Share on other sites

  • 0

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

I suppose you already know how to get a monster GID, so, you can try to use this method for specific monsters after it's summoned.

Damn. Haven't think of that. Thanks.

 

Anyway it uses Timer before comparing the current hp of the monster.

I was thinking about creating an event "OnMobDamaged" and insert it on mob.c under mob_damage  which is called when a mob received damage,

but I don't want it to be triggered on all mobs. So I came up with an idea to filter the mob's attached event(e.g strnpcinfo(0)+"::OnThisMob)..

All mobs that has an event label of "OnThisMob" will ONLY trigger the script. The thing is, I don't know how to filter the event name that is currently attached to a monster.

 

I was trying to do it like this, but I knew it that it will fail since im noob at src. :mellow:  :mellow:  :mellow:

mob.c under mob_damage

if( compare(npc_event,"OnThisMob") )
	npc_script_event( md, NPCE_MOBDAMAGED );

can you help me how to filter and compare the event attached to the mob?  /hmm

Thanks in advance! /thx  /thx

Edited by Lord Ganja
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

<map name>,<x>,<y>,<xs>,<ys>%TAB%monster%TAB%<monster name>%TAB%<mob id>,<amount>,<delay1>,<delay2>,<event>{,<mob size>,<mob ai>}

See the <event> field, that's what you are looking for.

Link to comment
Share on other sites

  • 0

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

 

<map name>,<x>,<y>,<xs>,<ys>%TAB%monster%TAB%<monster name>%TAB%<mob id>,<amount>,<delay1>,<delay2>,<event>{,<mob size>,<mob ai>}

See the <event> field, that's what you are looking for.

 

Hi. clydelion, I was trying to filter the EVENT NAME that is currently attached to the monster but Idk how to do it. :(

I was about to create an npcevent that is triggered when a mob received damage. OnMobDamagedEvent, just like OnNPCKillEvent but this time when the mob only receive damage.

 

And I don't want all mobs to trigger it coz it might cause server lag. So I was trying to create that event to only trigger to the monsters that has attached

OnThisMob event label to trigger OnMobDamagedEvent..

 

e.g

monster "prontera",150,150,"Poring",1002,1,"Test::OnThisMob";

when this poring received any damage, the OnMobDamagedEvent will be triggered.

but for the normal porings without OnThisMob event label, it won't be triggered.

 

Can you give me ideas how to make this work?

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

<map name>,<x>,<y>,<xs>,<ys>%TAB%monster%TAB%<monster name>%TAB%<mob id>,<amount>,<delay1>,<delay2>,<event>{,<mob size>,<mob ai>}
See the <event> field, that's what you are looking for.

Hi. clydelion, I was trying to filter the EVENT NAME that is currently attached to the monster but Idk how to do it. :(

I was about to create an npcevent that is triggered when a mob received damage. OnMobDamagedEvent, just like OnNPCKillEvent but this time when the mob only receive damage.

And I don't want all mobs to trigger it coz it might cause server lag. So I was trying to create that event to only trigger to the monsters that has attached

OnThisMob event label to trigger OnMobDamagedEvent..

e.g

monster "prontera",150,150,"Poring",1002,1,"Test::OnThisMob";

^ when this poring received any damage, the OnMobDamagedEvent will be triggered.

but for the normal porings without OnThisMob event label, it won't be triggered.

Can you give me ideas how to make this work?

You would have to replace all your proings with ones that have this label its not hard

Link to comment
Share on other sites

  • 0

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

You would have to replace all your proings with ones that have this label its not hard

 

Hi. Stolao, what do you mean by replace all porings?

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

disable mob spawns for poring and add versions that have your event label attached..

Link to comment
Share on other sites

  • 0

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

disable mob spawns for poring and add versions that have your event label attached..

I mean, the event will be triggered after the poring is killed right? I need an event npc that is triggered when the mob received damage or got hit/attacked(physical or magical damage)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

Clue:

npc_event(mvp_sd,md->npc_event,0);

What I would do if I were you:

 

1. Make a new scriptcommand so you don't have to edit every script that uses *monster script command.

 

2. Add a new char in mob_data struct, or just a flag to indicate that it is a OnMobAttacked event.

 

3. Look into battle.c to force run the script everytime it encounters a flagged attack.

Link to comment
Share on other sites

  • 0

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

Clue:

npc_event(mvp_sd,md->npc_event,0);

What I would do if I were you:

 

1. Make a new scriptcommand so you don't have to edit every script that uses *monster script command.

 

2. Add a new char in mob_data struct, or just a flag to indicate that it is a OnMobAttacked event.

 

3. Look into battle.c to force run the script everytime it encounters a flagged attack.

Can you give me more clue about this? /hmm

I'm just actually bad at src. I can create some scripts but just based from other scripts. So kinda like copy paste stuff XD

Thanks btw.

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