Catching Melee Attacks

Questions, Explanations, Howtos

Temple Termagant

Posts: 8

Joined: Friday, 23rd December 2016, 12:45

Post Monday, 9th January 2017, 03:46

Catching Melee Attacks

Can anyone tell me an easy way to run code whenever the player is hit by a melee attack? I'd also need the attacker's id and how much damage was done. I've been trying to follow the combat code, but it's still not crystal clear to me.

Crypt Cleanser

Posts: 720

Joined: Friday, 6th September 2013, 09:17

Post Tuesday, 10th January 2017, 10:35

Re: Catching Melee Attacks

Run with a debugger (for example: gdb crawl), set a breakpoint in player::hurt (b player::hurt in gdb), then go and fight. "amount" variable is the amount of damage. Note that it can get modified later in the Attack class functions and by "fineff" effects.

Ziggurat Zagger

Posts: 5303

Joined: Friday, 25th November 2011, 07:36

Post Tuesday, 11th April 2017, 20:52

Re: Catching Melee Attacks

Looks like that file has been changed and the correct line for hurt is now here:;a=bl ... HEAD#l6458 (about 200 lines up)

Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.