查看: 377|回复: 0

[引擎的各个功能] 13.创建 Decorator 节点

[复制链接]

1

主题

342

帖子

7万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
75866
发表于 2017-4-8 07:16:46 | 显示全部楼层 |阅读模式

13.创建 Decorator 节点



       
     
     
     Unreal Engine 4.9

       
     
         



            
            
Previous Step


        
            
        
Next Step


   
            
        
Quick Start Home


   
   
Decorators 即为其他行为树系统中的条件语句,附着于一个 Composite
或 Task
节点,并定义树中的一个分支或单个节点是否能被执行。


AI Pawn 接近目标时,Decorator 将停止执行行为树中的 Rapid Move To 分支。利用 Rapid Move To 或 Move To Task 节点也可执行该操作,但 decorator 可接收任何 Actor 并阻止任何分支的执行。在许多情况下均可重复利用。

步骤


在 内容浏览器 中 双击 打开 FollowerBT 行为树。


点击 New Decorator 按钮。


它将创建于和行为树相同的文件夹中。


在 内容浏览器 中将其重命名为 “CloseEnough”。


编辑器应已将其打开以便编辑。如尚未打开,在 内容浏览器 中 双击 打开。


在 My Blueprint 标签下的 Functions 部分中,“覆盖” PerformConditionCheck。


13.创建 Decorator 节点



在新功能中创建以下图表:


     p').length != 0) { copyToClipboard($('#fullgraphBTService13_snippet > p').html()); } else { copyToClipboard($('#fullgraphBTService13_snippet').html()); }">Copy Example
   
       
13.创建 Decorator 节点
13.创建 Decorator 节点





   
  1. Begin Object Class=K2Node_FunctionEntry Name="K2Node_FunctionEntry_232"
  2.    Begin Object Class=EdGraphPin Name="EdGraphPin_2024"
  3.    End Object
  4.    Begin Object Class=EdGraphPin Name="EdGraphPin_2025"
  5.    End Object
  6.    Begin Object Name="EdGraphPin_2024"
  7.       PinName="then"
  8.       Direction=EGPD_Output
  9.       PinType=(PinCategory="exec")
  10.       LinkedTo(0)=EdGraphPin'K2Node_DynamicCast_1392.EdGraphPin_6389'
  11.    End Object
  12.    Begin Object Name="EdGraphPin_2025"
  13.       PinName="OwnerActor"
  14.       PinToolTip="Owner Actor/nActor Reference"
  15.       Direction=EGPD_Output
  16.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Actor')
  17.       LinkedTo(0)=EdGraphPin'K2Node_DynamicCast_1392.EdGraphPin_6392'
  18.    End Object
  19.    SignatureClass=Class'/Script/AIModule.BTDecorator_BlueprintBase'
  20.    SignatureName="PerformConditionCheck"
  21.    Pins(0)=EdGraphPin'EdGraphPin_2024'
  22.    Pins(1)=EdGraphPin'EdGraphPin_2025'
  23.    NodePosX=-528
  24.    NodePosY=128
  25.    NodeGuid=0A0113274C6A45583FC0029DF5C0B42A
  26. End Object
  27. Begin Object Class=K2Node_FunctionResult Name="K2Node_FunctionResult_0"
  28.    Begin Object Class=EdGraphPin Name="EdGraphPin_2018"
  29.    End Object
  30.    Begin Object Class=EdGraphPin Name="EdGraphPin_2019"
  31.    End Object
  32.    Begin Object Name="EdGraphPin_2018"
  33.       PinName="execute"
  34.       PinType=(PinCategory="exec")
  35.       LinkedTo(0)=EdGraphPin'K2Node_VariableSet_421.EdGraphPin_2031'
  36.    End Object
  37.    Begin Object Name="EdGraphPin_2019"
  38.       PinName="ReturnValue"
  39.       PinToolTip="Return Value/nBoolean"
  40.       PinType=(PinCategory="bool")
  41.       DefaultValue="false"
  42.       AutogeneratedDefaultValue="false"
  43.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_39752.EdGraphPin_2117'
  44.    End Object
  45.    SignatureClass=Class'/Script/AIModule.BTDecorator_BlueprintBase'
  46.    SignatureName="PerformConditionCheck"
  47.    Pins(0)=EdGraphPin'EdGraphPin_2018'
  48.    Pins(1)=EdGraphPin'EdGraphPin_2019'
  49.    NodePosX=928
  50.    NodePosY=128
  51.    NodeGuid=DD04EA414F688EBF13F8C4AF7F135206
  52. End Object
  53. Begin Object Class=K2Node_DynamicCast Name="K2Node_DynamicCast_1392"
  54.    Begin Object Class=EdGraphPin Name="EdGraphPin_6389"
  55.    End Object
  56.    Begin Object Class=EdGraphPin Name="EdGraphPin_6390"
  57.    End Object
  58.    Begin Object Class=EdGraphPin Name="EdGraphPin_6391"
  59.    End Object
  60.    Begin Object Class=EdGraphPin Name="EdGraphPin_6392"
  61.    End Object
  62.    Begin Object Class=EdGraphPin Name="EdGraphPin_6393"
  63.    End Object
  64.    Begin Object Class=EdGraphPin Name="EdGraphPin_6394"
  65.    End Object
  66.    Begin Object Name="EdGraphPin_6389"
  67.       PinName="execute"
  68.       PinType=(PinCategory="exec")
  69.       LinkedTo(0)=EdGraphPin'K2Node_FunctionEntry_232.EdGraphPin_2024'
  70.    End Object
  71.    Begin Object Name="EdGraphPin_6390"
  72.       PinName="then"
  73.       Direction=EGPD_Output
  74.       PinType=(PinCategory="exec")
  75.       LinkedTo(0)=EdGraphPin'K2Node_VariableSet_421.EdGraphPin_2030'
  76.    End Object
  77.    Begin Object Name="EdGraphPin_6391"
  78.       PinName="CastFailed"
  79.       Direction=EGPD_Output
  80.       PinType=(PinCategory="exec")
  81.    End Object
  82.    Begin Object Name="EdGraphPin_6392"
  83.       PinName="Object"
  84.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/CoreUObject.Object')
  85.       LinkedTo(0)=EdGraphPin'K2Node_FunctionEntry_232.EdGraphPin_2025'
  86.    End Object
  87.    Begin Object Name="EdGraphPin_6393"
  88.       PinName="AsFollower AI CON"
  89.       Direction=EGPD_Output
  90.       PinType=(PinCategory="object",PinSubCategoryObject=BlueprintGeneratedClass'/Game/Blueprints/AI/Follower_AI_Con.Follower_AI_CON_C')
  91.       LinkedTo(0)=EdGraphPin'K2Node_VariableSet_421.EdGraphPin_2032'
  92.    End Object
  93.    Begin Object Name="EdGraphPin_6394"
  94.       PinName="bSuccess"
  95.       Direction=EGPD_Output
  96.       PinType=(PinCategory="bool")
  97.       bHidden=True
  98.    End Object
  99.    TargetType=BlueprintGeneratedClass'/Game/Blueprints/AI/Follower_AI_Con.Follower_AI_CON_C'
  100.    Pins(0)=EdGraphPin'EdGraphPin_6389'
  101.    Pins(1)=EdGraphPin'EdGraphPin_6390'
  102.    Pins(2)=EdGraphPin'EdGraphPin_6391'
  103.    Pins(3)=EdGraphPin'EdGraphPin_6392'
  104.    Pins(4)=EdGraphPin'EdGraphPin_6393'
  105.    Pins(5)=EdGraphPin'EdGraphPin_6394'
  106.    NodePosX=-192
  107.    NodePosY=144
  108.    NodeGuid=735B1F0141DBFBCA06C2CEB84A6936B4
  109. End Object
  110. Begin Object Class=K2Node_VariableSet Name="K2Node_VariableSet_421"
  111.    Begin Object Class=EdGraphPin Name="EdGraphPin_2030"
  112.    End Object
  113.    Begin Object Class=EdGraphPin Name="EdGraphPin_2031"
  114.    End Object
  115.    Begin Object Class=EdGraphPin Name="EdGraphPin_2032"
  116.    End Object
  117.    Begin Object Class=EdGraphPin Name="EdGraphPin_2033"
  118.    End Object
  119.    Begin Object Class=EdGraphPin Name="EdGraphPin_2034"
  120.    End Object
  121.    Begin Object Name="EdGraphPin_2030"
  122.       PinName="execute"
  123.       PinType=(PinCategory="exec")
  124.       LinkedTo(0)=EdGraphPin'K2Node_DynamicCast_1392.EdGraphPin_6390'
  125.    End Object
  126.    Begin Object Name="EdGraphPin_2031"
  127.       PinName="then"
  128.       Direction=EGPD_Output
  129.       PinType=(PinCategory="exec")
  130.       LinkedTo(0)=EdGraphPin'K2Node_FunctionResult_0.EdGraphPin_2018'
  131.    End Object
  132.    Begin Object Name="EdGraphPin_2032"
  133.       PinName="AI_CON_Ref"
  134.       PinType=(PinCategory="object",PinSubCategoryObject=BlueprintGeneratedClass'/Game/Blueprints/AI/Follower_AI_Con.Follower_AI_CON_C')
  135.       LinkedTo(0)=EdGraphPin'K2Node_DynamicCast_1392.EdGraphPin_6393'
  136.    End Object
  137.    Begin Object Name="EdGraphPin_2033"
  138.       PinName="Output_Get"
  139.       PinToolTip="Retrieves the value of the variable, can use instead of a separate Get node"
  140.       Direction=EGPD_Output
  141.       PinType=(PinCategory="object",PinSubCategoryObject=BlueprintGeneratedClass'/Game/Blueprints/AI/Follower_AI_Con.Follower_AI_CON_C')
  142.    End Object
  143.    Begin Object Name="EdGraphPin_2034"
  144.       PinName="self"
  145.       PinFriendlyName="Target"
  146.       PinType=(PinCategory="object",PinSubCategoryObject=BlueprintGeneratedClass'/Game/Blueprints/AI/CloseEnough.CloseEnough_C')
  147.       bHidden=True
  148.    End Object
  149.    VariableReference=(MemberName="AI_CON_Ref",bSelfContext=True)
  150.    Pins(0)=EdGraphPin'EdGraphPin_2030'
  151.    Pins(1)=EdGraphPin'EdGraphPin_2031'
  152.    Pins(2)=EdGraphPin'EdGraphPin_2032'
  153.    Pins(3)=EdGraphPin'EdGraphPin_2033'
  154.    Pins(4)=EdGraphPin'EdGraphPin_2034'
  155.    NodePosX=80
  156.    NodePosY=144
  157.    NodeGuid=38C59DC54CFF01BBAA134EA5044A5015
  158. End Object
  159. Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_123506"
  160.    Begin Object Class=EdGraphPin Name="EdGraphPin_2045"
  161.    End Object
  162.    Begin Object Class=EdGraphPin Name="EdGraphPin_2046"
  163.    End Object
  164.    Begin Object Name="EdGraphPin_2045"
  165.       PinName="self"
  166.       PinFriendlyName="Target"
  167.       PinToolTip="Target/nController Reference"
  168.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Controller')
  169.       LinkedTo(0)=EdGraphPin'K2Node_VariableGet_624.EdGraphPin_2051'
  170.    End Object
  171.    Begin Object Name="EdGraphPin_2046"
  172.       PinName="ReturnValue"
  173.       PinToolTip="Return Value/nPawn Reference"
  174.       Direction=EGPD_Output
  175.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Pawn')
  176.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_30834.EdGraphPin_2057'
  177.    End Object
  178.    bIsPureFunc=True
  179.    bIsConstFunc=True
  180.    FunctionReference=(MemberParentClass=Class'/Script/Engine.Controller',MemberName="K2_GetPawn")
  181.    Pins(0)=EdGraphPin'EdGraphPin_2045'
  182.    Pins(1)=EdGraphPin'EdGraphPin_2046'
  183.    NodePosX=-240
  184.    NodePosY=384
  185.    NodeGuid=431AF3184AEF62590716B7AFBC166188
  186. End Object
  187. Begin Object Class=K2Node_VariableGet Name="K2Node_VariableGet_624"
  188.    Begin Object Class=EdGraphPin Name="EdGraphPin_2051"
  189.    End Object
  190.    Begin Object Class=EdGraphPin Name="EdGraphPin_2052"
  191.    End Object
  192.    Begin Object Name="EdGraphPin_2051"
  193.       PinName="AI_CON_Ref"
  194.       Direction=EGPD_Output
  195.       PinType=(PinCategory="object",PinSubCategoryObject=BlueprintGeneratedClass'/Game/Blueprints/AI/Follower_AI_Con.Follower_AI_CON_C')
  196.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_123506.EdGraphPin_2045'
  197.    End Object
  198.    Begin Object Name="EdGraphPin_2052"
  199.       PinName="self"
  200.       PinFriendlyName="Target"
  201.       PinType=(PinCategory="object",PinSubCategoryObject=BlueprintGeneratedClass'/Game/Blueprints/AI/CloseEnough.CloseEnough_C')
  202.       bHidden=True
  203.    End Object
  204.    VariableReference=(MemberName="AI_CON_Ref",bSelfContext=True)
  205.    Pins(0)=EdGraphPin'EdGraphPin_2051'
  206.    Pins(1)=EdGraphPin'EdGraphPin_2052'
  207.    NodePosX=-416
  208.    NodePosY=384
  209.    NodeGuid=D0D08EBC43D0D16966A4379430CA4038
  210. End Object
  211. Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_30834"
  212.    Begin Object Class=EdGraphPin Name="EdGraphPin_2057"
  213.    End Object
  214.    Begin Object Class=EdGraphPin Name="EdGraphPin_2058"
  215.    End Object
  216.    Begin Object Name="EdGraphPin_2057"
  217.       PinName="self"
  218.       PinFriendlyName="Target"
  219.       PinToolTip="Target/nActor Reference"
  220.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Actor')
  221.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_123506.EdGraphPin_2046'
  222.    End Object
  223.    Begin Object Name="EdGraphPin_2058"
  224.       PinName="ReturnValue"
  225.       PinToolTip="Return Value/nVector "
  226.       Direction=EGPD_Output
  227.       PinType=(PinCategory="struct",PinSubCategoryObject=ScriptStruct'/Script/CoreUObject.Object:Vector')
  228.       DefaultValue="0, 0, 0"
  229.       AutogeneratedDefaultValue="0, 0, 0"
  230.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_31029.EdGraphPin_2089'
  231.    End Object
  232.    bIsPureFunc=True
  233.    bIsConstFunc=True
  234.    FunctionReference=(MemberParentClass=Class'/Script/Engine.Actor',MemberName="K2_GetActorLocation")
  235.    Pins(0)=EdGraphPin'EdGraphPin_2057'
  236.    Pins(1)=EdGraphPin'EdGraphPin_2058'
  237.    NodePosX=16
  238.    NodePosY=384
  239.    NodeGuid=07C3199047638F25D389BCB6D5AA4B65
  240. End Object
  241. Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_30917"
  242.    Begin Object Class=EdGraphPin Name="EdGraphPin_2081"
  243.    End Object
  244.    Begin Object Class=EdGraphPin Name="EdGraphPin_2082"
  245.    End Object
  246.    Begin Object Name="EdGraphPin_2081"
  247.       PinName="self"
  248.       PinFriendlyName="Target"
  249.       PinToolTip="Target/nActor Reference"
  250.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Actor')
  251.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_26123.EdGraphPin_2129'
  252.    End Object
  253.    Begin Object Name="EdGraphPin_2082"
  254.       PinName="ReturnValue"
  255.       PinToolTip="Return Value/nVector "
  256.       Direction=EGPD_Output
  257.       PinType=(PinCategory="struct",PinSubCategoryObject=ScriptStruct'/Script/CoreUObject.Object:Vector')
  258.       DefaultValue="0, 0, 0"
  259.       AutogeneratedDefaultValue="0, 0, 0"
  260.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_31029.EdGraphPin_2088'
  261.    End Object
  262.    bIsPureFunc=True
  263.    bIsConstFunc=True
  264.    FunctionReference=(MemberParentClass=Class'/Script/Engine.Actor',MemberName="K2_GetActorLocation")
  265.    Pins(0)=EdGraphPin'EdGraphPin_2081'
  266.    Pins(1)=EdGraphPin'EdGraphPin_2082'
  267.    NodePosX=16
  268.    NodePosY=288
  269.    NodeGuid=895F88654C27F0C5BCA2E2A8F868C28C
  270. End Object
  271. Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_31029"
  272.    Begin Object Class=EdGraphPin Name="EdGraphPin_2087"
  273.    End Object
  274.    Begin Object Class=EdGraphPin Name="EdGraphPin_2088"
  275.    End Object
  276.    Begin Object Class=EdGraphPin Name="EdGraphPin_2089"
  277.    End Object
  278.    Begin Object Class=EdGraphPin Name="EdGraphPin_2090"
  279.    End Object
  280.    Begin Object Name="EdGraphPin_2087"
  281.       PinName="self"
  282.       PinFriendlyName="Target"
  283.       PinToolTip="Target/nKismet Math Library Reference"
  284.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.KismetMathLibrary')
  285.       DefaultObject=Default__KismetMathLibrary
  286.       bHidden=True
  287.    End Object
  288.    Begin Object Name="EdGraphPin_2088"
  289.       PinName="A"
  290.       PinToolTip="A/nVector "
  291.       PinType=(PinCategory="struct",PinSubCategoryObject=ScriptStruct'/Script/CoreUObject.Object:Vector')
  292.       DefaultValue="0, 0, 0"
  293.       AutogeneratedDefaultValue="0, 0, 0"
  294.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_30917.EdGraphPin_2082'
  295.    End Object
  296.    Begin Object Name="EdGraphPin_2089"
  297.       PinName="B"
  298.       PinToolTip="B/nVector "
  299.       PinType=(PinCategory="struct",PinSubCategoryObject=ScriptStruct'/Script/CoreUObject.Object:Vector')
  300.       DefaultValue="0, 0, 0"
  301.       AutogeneratedDefaultValue="0, 0, 0"
  302.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_30834.EdGraphPin_2058'
  303.    End Object
  304.    Begin Object Name="EdGraphPin_2090"
  305.       PinName="ReturnValue"
  306.       PinToolTip="Return Value/nVector "
  307.       Direction=EGPD_Output
  308.       PinType=(PinCategory="struct",PinSubCategoryObject=ScriptStruct'/Script/CoreUObject.Object:Vector')
  309.       DefaultValue="0, 0, 0"
  310.       AutogeneratedDefaultValue="0, 0, 0"
  311.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_31141.EdGraphPin_2100'
  312.    End Object
  313.    bIsPureFunc=True
  314.    FunctionReference=(MemberParentClass=Class'/Script/Engine.KismetMathLibrary',MemberName="Subtract_VectorVector")
  315.    Pins(0)=EdGraphPin'EdGraphPin_2087'
  316.    Pins(1)=EdGraphPin'EdGraphPin_2088'
  317.    Pins(2)=EdGraphPin'EdGraphPin_2089'
  318.    Pins(3)=EdGraphPin'EdGraphPin_2090'
  319.    NodePosX=240
  320.    NodePosY=352
  321.    NodeGuid=5A8D334A4D575676CD7D149EB17AFD8B
  322. End Object
  323. Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_31141"
  324.    Begin Object Class=EdGraphPin Name="EdGraphPin_2099"
  325.    End Object
  326.    Begin Object Class=EdGraphPin Name="EdGraphPin_2100"
  327.    End Object
  328.    Begin Object Class=EdGraphPin Name="EdGraphPin_2101"
  329.    End Object
  330.    Begin Object Name="EdGraphPin_2099"
  331.       PinName="self"
  332.       PinFriendlyName="Target"
  333.       PinToolTip="Target/nKismet Math Library Reference"
  334.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.KismetMathLibrary')
  335.       DefaultObject=Default__KismetMathLibrary
  336.       bHidden=True
  337.    End Object
  338.    Begin Object Name="EdGraphPin_2100"
  339.       PinName="A"
  340.       PinToolTip="A/nVector "
  341.       PinType=(PinCategory="struct",PinSubCategoryObject=ScriptStruct'/Script/CoreUObject.Object:Vector')
  342.       DefaultValue="0, 0, 0"
  343.       AutogeneratedDefaultValue="0, 0, 0"
  344.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_31029.EdGraphPin_2090'
  345.    End Object
  346.    Begin Object Name="EdGraphPin_2101"
  347.       PinName="ReturnValue"
  348.       PinToolTip="Return Value/nFloat"
  349.       Direction=EGPD_Output
  350.       PinType=(PinCategory="float")
  351.       DefaultValue="0.0"
  352.       AutogeneratedDefaultValue="0.0"
  353.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_39752.EdGraphPin_2115'
  354.    End Object
  355.    bIsPureFunc=True
  356.    FunctionReference=(MemberParentClass=Class'/Script/Engine.KismetMathLibrary',MemberName="VSize")
  357.    Pins(0)=EdGraphPin'EdGraphPin_2099'
  358.    Pins(1)=EdGraphPin'EdGraphPin_2100'
  359.    Pins(2)=EdGraphPin'EdGraphPin_2101'
  360.    NodePosX=352
  361.    NodePosY=352
  362.    NodeGuid=82F21A114631FECA2AE22AA74D0DF02D
  363. End Object
  364. Begin Object Class=K2Node_VariableGet Name="K2Node_VariableGet_151"
  365.    Begin Object Class=EdGraphPin Name="EdGraphPin_2108"
  366.    End Object
  367.    Begin Object Class=EdGraphPin Name="EdGraphPin_2109"
  368.    End Object
  369.    Begin Object Name="EdGraphPin_2108"
  370.       PinName="AcceptableDistance"
  371.       Direction=EGPD_Output
  372.       PinType=(PinCategory="float")
  373.       DefaultValue="0.0"
  374.       AutogeneratedDefaultValue="0.0"
  375.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_39752.EdGraphPin_2116'
  376.    End Object
  377.    Begin Object Name="EdGraphPin_2109"
  378.       PinName="self"
  379.       PinFriendlyName="Target"
  380.       PinType=(PinCategory="object",PinSubCategoryObject=BlueprintGeneratedClass'/Game/Blueprints/AI/CloseEnough.CloseEnough_C')
  381.       bHidden=True
  382.    End Object
  383.    VariableReference=(MemberName="AcceptableDistance",bSelfContext=True)
  384.    Pins(0)=EdGraphPin'EdGraphPin_2108'
  385.    Pins(1)=EdGraphPin'EdGraphPin_2109'
  386.    NodePosX=368
  387.    NodePosY=432
  388.    NodeGuid=7CDE1FD54D772AEF57C5F693ED511A8E
  389. End Object
  390. Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_39752"
  391.    Begin Object Class=EdGraphPin Name="EdGraphPin_2114"
  392.    End Object
  393.    Begin Object Class=EdGraphPin Name="EdGraphPin_2115"
  394.    End Object
  395.    Begin Object Class=EdGraphPin Name="EdGraphPin_2116"
  396.    End Object
  397.    Begin Object Class=EdGraphPin Name="EdGraphPin_2117"
  398.    End Object
  399.    Begin Object Name="EdGraphPin_2114"
  400.       PinName="self"
  401.       PinFriendlyName="Target"
  402.       PinToolTip="Target/nKismet Math Library Reference"
  403.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.KismetMathLibrary')
  404.       DefaultObject=Default__KismetMathLibrary
  405.       bHidden=True
  406.    End Object
  407.    Begin Object Name="EdGraphPin_2115"
  408.       PinName="A"
  409.       PinToolTip="A/nFloat"
  410.       PinType=(PinCategory="float")
  411.       DefaultValue="0.0"
  412.       AutogeneratedDefaultValue="0.0"
  413.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_31141.EdGraphPin_2101'
  414.    End Object
  415.    Begin Object Name="EdGraphPin_2116"
  416.       PinName="B"
  417.       PinToolTip="B/nFloat"
  418.       PinType=(PinCategory="float")
  419.       DefaultValue="0.0"
  420.       AutogeneratedDefaultValue="0.0"
  421.       LinkedTo(0)=EdGraphPin'K2Node_VariableGet_151.EdGraphPin_2108'
  422.    End Object
  423.    Begin Object Name="EdGraphPin_2117"
  424.       PinName="ReturnValue"
  425.       PinToolTip="Return Value/nBoolean"
  426.       Direction=EGPD_Output
  427.       PinType=(PinCategory="bool")
  428.       DefaultValue="false"
  429.       AutogeneratedDefaultValue="false"
  430.       LinkedTo(0)=EdGraphPin'K2Node_FunctionResult_0.EdGraphPin_2019'
  431.    End Object
  432.    bIsPureFunc=True
  433.    FunctionReference=(MemberParentClass=Class'/Script/Engine.KismetMathLibrary',MemberName="GreaterEqual_FloatFloat")
  434.    Pins(0)=EdGraphPin'EdGraphPin_2114'
  435.    Pins(1)=EdGraphPin'EdGraphPin_2115'
  436.    Pins(2)=EdGraphPin'EdGraphPin_2116'
  437.    Pins(3)=EdGraphPin'EdGraphPin_2117'
  438.    NodePosX=544
  439.    NodePosY=384
  440.    NodeGuid=D75D724E47942AC9F4D77F987B81AD57
  441. End Object
  442. Begin Object Class=K2Node_CallFunction Name="K2Node_CallFunction_26123"
  443.    Begin Object Class=EdGraphPin Name="EdGraphPin_2126"
  444.    End Object
  445.    Begin Object Class=EdGraphPin Name="EdGraphPin_2127"
  446.    End Object
  447.    Begin Object Class=EdGraphPin Name="EdGraphPin_2128"
  448.    End Object
  449.    Begin Object Class=EdGraphPin Name="EdGraphPin_2129"
  450.    End Object
  451.    Begin Object Name="EdGraphPin_2126"
  452.       PinName="self"
  453.       PinFriendlyName="Target"
  454.       PinToolTip="Target/nBTFunction Library Reference"
  455.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/AIModule.BTFunctionLibrary')
  456.       DefaultObject=Default__BTFunctionLibrary
  457.       bHidden=True
  458.    End Object
  459.    Begin Object Name="EdGraphPin_2127"
  460.       PinName="NodeOwner"
  461.       PinToolTip="Node Owner/nBTNode Reference"
  462.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/AIModule.BTNode')
  463.       bHidden=True
  464.    End Object
  465.    Begin Object Name="EdGraphPin_2128"
  466.       PinName="Key"
  467.       PinToolTip="Key/nBlackboard Key Selector Structure (by ref)"
  468.       PinType=(PinCategory="struct",PinSubCategoryObject=ScriptStruct'/Script/AIModule.BehaviorTreeTypes:BlackboardKeySelector',bIsReference=True,bIsConst=True)
  469.       LinkedTo(0)=EdGraphPin'K2Node_VariableGet_111.EdGraphPin_2138'
  470.       bDefaultValueIsIgnored=True
  471.    End Object
  472.    Begin Object Name="EdGraphPin_2129"
  473.       PinName="ReturnValue"
  474.       PinToolTip="Return Value/nActor Reference"
  475.       Direction=EGPD_Output
  476.       PinType=(PinCategory="object",PinSubCategoryObject=Class'/Script/Engine.Actor')
  477.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_30917.EdGraphPin_2081'
  478.    End Object
  479.    bIsPureFunc=True
  480.    FunctionReference=(MemberParentClass=Class'/Script/AIModule.BTFunctionLibrary',MemberName="GetBlackboardValueAsActor")
  481.    Pins(0)=EdGraphPin'EdGraphPin_2126'
  482.    Pins(1)=EdGraphPin'EdGraphPin_2127'
  483.    Pins(2)=EdGraphPin'EdGraphPin_2128'
  484.    Pins(3)=EdGraphPin'EdGraphPin_2129'
  485.    NodePosX=-256
  486.    NodePosY=288
  487.    ErrorType=1
  488.    ErrorMsg="Error Default value /'/' for  Key  is invalid: /'Literal values are not allowed for pass-by-reference parameters./'"
  489.    NodeGuid=FF6A2DB4475BFE05D0CA1EB0D698BB0A
  490. End Object
  491. Begin Object Class=K2Node_VariableGet Name="K2Node_VariableGet_111"
  492.    Begin Object Class=EdGraphPin Name="EdGraphPin_2138"
  493.    End Object
  494.    Begin Object Class=EdGraphPin Name="EdGraphPin_2139"
  495.    End Object
  496.    Begin Object Name="EdGraphPin_2138"
  497.       PinName="TargetToFollow"
  498.       Direction=EGPD_Output
  499.       PinType=(PinCategory="struct",PinSubCategoryObject=ScriptStruct'/Script/AIModule.BehaviorTreeTypes:BlackboardKeySelector')
  500.       LinkedTo(0)=EdGraphPin'K2Node_CallFunction_26123.EdGraphPin_2128'
  501.    End Object
  502.    Begin Object Name="EdGraphPin_2139"
  503.       PinName="self"
  504.       PinFriendlyName="Target"
  505.       PinType=(PinCategory="object",PinSubCategoryObject=BlueprintGeneratedClass'/Game/Blueprints/AI/CloseEnough.CloseEnough_C')
  506.       bHidden=True
  507.    End Object
  508.    VariableReference=(MemberName="TargetToFollow",bSelfContext=True)
  509.    Pins(0)=EdGraphPin'EdGraphPin_2138'
  510.    Pins(1)=EdGraphPin'EdGraphPin_2139'
  511.    NodePosX=-416
  512.    NodePosY=288
  513.    NodeGuid=7E75B438413B960D40E5A68DECD346A2
  514. End Object
复制代码

     p').length != 0) { copyToClipboard($('#fullgraphBTService13_snippet > p').html()); } else { copyToClipboard($('#fullgraphBTService13_snippet').html()); }">

点击图片将其展开,或点击 此处13.创建 Decorator 节点

在窗口中打开。


13.创建 Decorator 节点



该蓝图的变量名、类型和数值:


       


       
                AI_CON_Ref
               
               
                Follower_AI_CON_C
               
               
                无
               
       

       
                AcceptableDistance
               
               
                Float
               
               
                0.0 - 但此变量的“可编辑”标记为 True,因此可在行为树中根据实例进行变更。
               
       

       
                TargetToFollow
               
               
                BlackboardKeySelector
               
               
                无 - 但此变量的“可编辑”标记为 True,因此可在行为树中根据实例进行变更。
               
       



       
因其为功能图表,如使用上方图表图片中的 Code Snippet,只能获取图表的中央部分,首尾两端的节点将不会被连接。只需依据图片所示连接节点便可正常执行。



当行为树根据条件命中一个节点时,事件 Receive Condition Check 将被发送至该蓝图。


保存 AI 控制器以便日后轻松参考。


获取需要追踪的 Actor(玩家 Pawn)。


获取该 Actor 和 AI Pawn 之间的距离。


如距离大于可配置量,则条件将返回 True。如小于可配置量,则返回 False,并阻止其所在行为树部分的执行。


这可使其正常工作,避免行为树不断循环至 RapidMoveTo,导致 AI 反复行动。基本上而言,AI 抓住玩家后便会停止行动。


            
            
Previous Step


        
            
        
Next Step


   
            
        
Quick Start Home


   
   




                                       
                                       
完整内容索引
                                       
                               
                       
                       
            

            
            

     2004-2017, Epic Games, Inc. 版权所有。Unreal 及相关的商标是 Epic 在美国和其他国家的注册商标。


    使用条款 | 隐私政策

            
        
               
       
   
回复

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | enginedx注册

本版积分规则

 
 



邮件留言:


 
返回顶部