mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-03 23:56:43 +00:00 
			
		
		
		
	Did I understand right that guards trigger combat after refusing pay gold/go to jail via script?
This commit is contained in:
		
							parent
							
								
									9d40f2e196
								
							
						
					
					
						commit
						6da061fd96
					
				
					 1 changed files with 19 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1024,8 +1024,27 @@ namespace MWMechanics
 | 
			
		|||
    {
 | 
			
		||||
        ptr.getClass().getCreatureStats(ptr).getAiSequence().stack(MWMechanics::AiCombat(target), ptr);
 | 
			
		||||
        if (target == MWBase::Environment::get().getWorld()->getPlayerPtr())
 | 
			
		||||
        {
 | 
			
		||||
            ptr.getClass().getCreatureStats(ptr).setHostile(true);
 | 
			
		||||
 | 
			
		||||
            // if guard starts combat with player, guards pursuing player should do the same
 | 
			
		||||
            if (ptr.getClass().isClass(ptr, "Guard"))
 | 
			
		||||
            {
 | 
			
		||||
                for (Actors::PtrControllerMap::const_iterator iter = mActors.begin(); iter != mActors.end(); ++iter)
 | 
			
		||||
                {
 | 
			
		||||
                    if (iter->first.getClass().isClass(iter->first, "Guard"))
 | 
			
		||||
                    {
 | 
			
		||||
                        MWMechanics::AiSequence& aiSeq = iter->first.getClass().getCreatureStats(iter->first).getAiSequence();
 | 
			
		||||
                        if (aiSeq.getActivePackage()->getTypeId() == MWMechanics::AiPackage::TypeIdPursue)
 | 
			
		||||
                        {
 | 
			
		||||
                            aiSeq.stopPursuit();
 | 
			
		||||
                            aiSeq.stack(MWMechanics::AiCombat(target), ptr);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Must be done after the target is set up, so that CreatureTargetted dialogue filter works properly
 | 
			
		||||
        if (ptr.getClass().isNpc())
 | 
			
		||||
            MWBase::Environment::get().getDialogueManager()->say(ptr, "attack");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue