[crossfire] NPC Help

Kevin Zheng kevinz5000 at gmail.com
Sun Feb 20 00:57:50 CST 2022


On 2/19/22 5:59 PM, Preston Crow wrote:
> If I attack an NPC by standing next to it and attacking with something 
> like 'use_skill one' (or applying a sword and shift-arrow in the 
> direction of the monster), then the NPC will clear the unaggressive flag 
> and call monster_npc_call_help() to alert nearby monsters.  This is in 
> server/attack.c: hit_player() at about line 2072.  If I attack the 
> monster by running at it, then the code in server/move.c: push_obj() at 
> about line 481 does not call for help.
> 
> Is that intentional?
> 
> Also, in mosnter_npc_call_help(), it uses object_set_enemy() but does 
> not clear the unaggressive flag, which doesn't seem to make the NPCs 
> move and attack me in my testing.
> 
> Is that also intentional?

I remember looking nearby in that neighborhood of code, and so my guess 
is probably not. There are a lot of code paths that should result in a 
monster calling for help, so my guess is that there is some code 
duplication that makes this happen inconsistently.

(If I remember, I was looking at how monsters that are asleep, when 
attacked through a certain code path, call for help...)

If you have a fix, I would welcome it to be committed.

Regards,
Kevin


More information about the crossfire mailing list