代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。

原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html


 1
 2三二0.猪守卫不主动攻击主角
 3
 4	MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/pigman.lua文件
 5
 6	1.return guy:HasTag("character") and not guy:HasTag("guard")替换为return guy:HasTag("character") and not guy:HasTag("guard") and not guy:HasTag("player")
 7
 8
 9	2.删除下列内容:
10
11		if not GetClock():IsDay() and home and home.components.burnable and home.components.burnable:IsBurning() then
12			local lightThief = FindEntity(home, home.components.burnable:GetLargestLightRadius(), function(guy)
13				return guy:HasTag("player")
14					   and guy.LightWatcher:IsInLight()
15					   and not (defenseTarget.components.trader and defenseTarget.components.trader:IsTryingToTradeWithMe(guy) ) 
16					   and not (inst.components.trader and inst.components.trader:IsTryingToTradeWithMe(guy) ) 
17			end)
18			if lightThief then
19				return lightThief
20			end
21		end
22
23	即可让猪守卫不主动攻击主角