PDA

View Full Version : how to prevent npc attacks


jdoran
01-02-2014, 05:15 PM
I have been trying to create an NPC which will aggro the player, but never attack. My intent is that nearby npcs on the same faction will assist the passive mob.

(This is a variation on destructible items)

The faction is working fine (FYI faction 914 is perfect: indiff until attack, no faction changes). However, in order to have nearby npcs assist the passive mob I cannot have the special attack "H" set.

My reason for wanting to use H is that I do not want the passive mob to attack the player. Having an item/object fight back doesn't look right.

I could spend hours on this, but hopefully someone can save me the time. I have tried to set mindmg/maxdmg to 0, attack_count to 0, and both melee types to 0. The object still wants to go hand-to-hand with the player!

The full set of flags I'm using: fUCNIDo

I would welcome any suggestions.

sorvani
01-02-2014, 10:08 PM
Use event_enter and have him send a signal to add aggro.
Set him to 0 movement and do not give him an attack damage

Mariomario
01-03-2014, 12:08 AM
Probably not the best suggestion as this would trigger the entire time during combat against the passive object, but it would do exactly as needed. Your passive object would start with the needed flags fUCNIDo then inside of a script:


sub EVENT_COMBAT
{
if($combat_state == 1)
{
quest::modifynpcstat("special_attacks",fUCNIDoH);
$npc->WipeHateList();
}
}


This would allow the aggressive mobs to assist the passive object upon initial attack, then sets the passive object back to non-aggro and wipes the hate list stopping it from attacking the original toon who attacked it. Again probably not the best suggestion, but it achieves what you're looking for.

jdoran
01-03-2014, 04:50 AM
Use event_enter and have him send a signal to add aggro.
Set him to 0 movement and do not give him an attack damage

I've already tried 0 movement and no attack damage. The thing keeps swinging at me if I'm in range. It doesn't do any damage, but I get the attack messages.

Adding aggro isn't the problem: Since the mobs are on the same faction they assist.

I might look into adding another special attack. Not attacking doesn't sound that hard to implement... I wanted to make sure there wasn't some solution I was overlooking.

jdoran
01-03-2014, 04:57 AM
Probably not the best suggestion as this would trigger the entire time during combat against the passive object, but it would do exactly as needed. Your passive object would start with the needed flags fUCNIDo then inside of a script:


sub EVENT_COMBAT
{
if($combat_state == 1)
{
quest::modifynpcstat("special_attacks",fUCNIDoH);
$npc->WipeHateList();
}
}


This would allow the aggressive mobs to assist the passive object upon initial attack, then sets the passive object back to non-aggro and wipes the hate list stopping it from attacking the original toon who attacked it. Again probably not the best suggestion, but it achieves what you're looking for.

An interesting idea. I'm pretty sure that I would need to maintain aggro on the passive mob, or nearby NPCs would not join in. I'm imagining a wandering mob passing by in mid-fight, and not aggroing the player because of the H flag.

Still, I had not considered modifying the flags mid-fight. While I don't think it will help in this case, I bet I will find a use for this technique elsewhere.

jsr
01-08-2014, 08:06 AM
Personal recommendation is to use a different approach and add aggro via perl/lua, but if you want to stick with the current approach perhaps increasing the NPC's weapon delay will hide the problem a little :)

Lowering the player's faction for the duration of the event might also do the trick.

Kayen
01-08-2014, 09:01 AM
Kayen: Implemented Perl MOB Quest Object SetDisableMelee(1=Disabled) - Prevents the ability to auto attack.
Kayen: Implemented Perl MOB Quest Object IsMeleeDisabled()

So you would use
$npc->SetDisableMelee(1);

NPC will do all its regular functions but it won't be able to auto attack

Kayen

roonibrice
02-23-2014, 03:56 AM
A mod that I'd like to see is one that gives any "dead" NPC a 75% chance (or so) to be moved to a temple for healing.