Jump to content

Recommended Posts

Posted

OnPCAttackEvent


This event triggers when a player character attacks another entity. And it registers the damage and other information about the attack.

Example usage:

// @damage holds the amount of damage dealt.
// @damagegid holds the GID of the target (account ID if the target is a player).
// @damagerid holds the rid of the mob
OnPCAttackEvent:
	dispbottom "You've dealt "+@damage+" to target with GID "+@damagegid+" and RID "+@damagerid;

 


 

  • Upvote 1
  • 2 months later...
Posted (edited)

Hi! Good day! I tried manually adding your code, but I am getting this error:

 

Spoiler

CXX    battle.cpp
battle.cpp: In function ‘void battle_calc_attack_gvg_bg(Damage*, block_list*, block_list*, uint16, uint16)’:
battle.cpp:5060:4: error: ‘do_battle_events’ was not declared in this scope
    do_battle_events(src, target, wd->damage); // OnPcAttackEvent [Mastagoon]
    ^~~~~~~~~~~~~~~~
battle.cpp:5060:4: note: suggested alternative: ‘mobskill_event’
    do_battle_events(src, target, wd->damage); // OnPcAttackEvent [Mastagoon]
    ^~~~~~~~~~~~~~~~
    mobskill_event
battle.cpp:5068:4: error: ‘do_battle_events’ was not declared in this scope
    do_battle_events(src, target, wd->damage2); // OnPcAttackEvent [Mastagoon]
    ^~~~~~~~~~~~~~~~
battle.cpp:5068:4: note: suggested alternative: ‘mobskill_event’
    do_battle_events(src, target, wd->damage2); // OnPcAttackEvent [Mastagoon]
    ^~~~~~~~~~~~~~~~
    mobskill_event
battle.cpp:5080:4: error: ‘do_battle_events’ was not declared in this scope
    do_battle_events(src, target, wd->damage); // OnPcAttackEvent [Mastagoon]
    ^~~~~~~~~~~~~~~~
battle.cpp:5080:4: note: suggested alternative: ‘mobskill_event’
    do_battle_events(src, target, wd->damage); // OnPcAttackEvent [Mastagoon]
    ^~~~~~~~~~~~~~~~
    mobskill_event
battle.cpp: In function ‘Damage battle_calc_magic_attack(block_list*, block_list*, uint16, uint16, int)’:
battle.cpp:6424:2: error: ‘do_battle_events’ was not declared in this scope
  do_battle_events(src, target, ad.damage);
  ^~~~~~~~~~~~~~~~
battle.cpp:6424:2: note: suggested alternative: ‘mobskill_event’
  do_battle_events(src, target, ad.damage);
  ^~~~~~~~~~~~~~~~
  mobskill_event
battle.cpp: In function ‘Damage battle_calc_misc_attack(block_list*, block_list*, uint16, uint16, int)’:
battle.cpp:6822:2: error: ‘do_battle_events’ was not declared in this scope
  do_battle_events(src, target, md.damage);
  ^~~~~~~~~~~~~~~~
battle.cpp:6822:2: note: suggested alternative: ‘mobskill_event’
  do_battle_events(src, target, md.damage);
  ^~~~~~~~~~~~~~~~
  mobskill_event
make[1]: *** [Makefile:84: obj/battle.o] Error 1

 

Edited by sotf
Posted (edited)

Yes it's not really complicated. U can check if the killed mob is a boss monster or a monster of a list/an array. Save the mob ID of the latest monster u've attacked and the dealt damage in an array. Than OnPCKillEvent check if this monster u've killed is the monster u've attacked before. Than u can save ur dealt damage in a database. Later u can sort the damage by "highest first" and u have ur ranking. U can update a database entry which structure is like: "Char ID, Latest Mob ID, Latest Dealt Dmg, Total Dealt Dmg, Create Date, Latest Update Date" or u can use the account ID to combine the Dmg of all characters of an account. 

 

Rynbef~

Edited by Rynbef
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...