Hi guys,
does anyone know how to make AI:
1) follow player? ( eg: a partner in game )
2) chase player on foot/car/boat/helicopter
i tried to play around with the flowgraph but i didn't succeed.
thank you ,
Re: how to make AI chase player via cars/boats??
#2I think you need to use c++ but I'll search for ya
Re: how to make AI chase player via cars/boats??
#3Hi,
you could do something like this in Flowgraph:
This Flowgraph is for demonstration purposes to give you an idea on how you could set it up.
Just copy paste this into your Flowgraph.
Have you had a look already at the getting started guide with Flowgraph?
Just in case you have not, here are some useful getting started videos:
Flowgraph with AI:
https://www.cryengine.com/tutorials/des ... sing-paths
Flowgraph video:
https://www.cryengine.com/tutorials/des ... /flowgraph
Documentation:
http://docs.cryengine.com/display/SDKDO ... ence+Nodes
Keep in mind that AISequence nodes always have to start with AISequence:Start and end with AISequence:End.
If you try to do something in between not "AISequence:" related you might get an error or it will not work.
you could do something like this in Flowgraph:
Code: Select all
<Graph Description="" Group="FG">
<Nodes>
<Node Id="59" Class="AISequence:Start" pos="-252,659.4361,0" EntityGUID="62b176c2-1b68-3824-9bf4-0f0f60f1668f">
<Inputs entityId="0" Interruptible="1" ResumeAfterInterruption="1"/>
</Node>
<Node Id="60" Class="AISequence:End" pos="378,666,0" EntityGUID="62b176c2-1b68-3824-9bf4-0f0f60f1668f">
<Inputs entityId="0"/>
</Node>
<Node Id="61" Class="AISequence:Move" pos="72,659.4361,0" EntityGUID="62b176c2-1b68-3824-9bf4-0f0f60f1668f">
<Inputs entityId="0" Speed="1" Stance="0" DestinationEntity="0" Position="0,0,0" Direction="0,0,0" EndDistance="5"/>
</Node>
<Node Id="62" Class="Entity:GetPos" pos="72,864,0">
<Inputs entityId="0" CoordSys="1"/>
</Node>
<Node Id="63" Class="Actor:LocalPlayer" pos="72,828,0">
<Inputs />
</Node>
<Node Id="64" Class="Game:Start" pos="-900,720,0">
<Inputs InGame="1" InEditor="1"/>
</Node>
<Node Id="65" Class="Logic:Any" pos="-666,720,0" InHideMask="1021">
<Inputs />
</Node>
<Node Id="66" Name="Follow_player" Class="_commentbox" pos="-972,594.27332,0">
<Inputs TextSize="1" Color="0.27451,0.352941,0.705882" DisplayFilled="1" DisplayBox="1" SortPriority="16"/>
<ResizeBorder X="0" Y="0" Width="1620" Height="504"/>
<NodeSize Width="1620" Height="541.04211"/>
</Node>
<Node Id="67" Name="Use_gate_to_enable/disable_following_player" Class="_comment" pos="-558,702,0"/>
<Node Id="69" Class="Logic:Gate" pos="-486,720,0">
<Inputs Closed="0"/>
</Node>
<Node Id="70" Name="Start_following_player_for_the_first_time" Class="_comment" pos="-936,702,0"/>
<Node Id="76" Class="Logic:Any" pos="522,1026,0" InHideMask="1022">
<Inputs />
</Node>
<Node Id="78" Class="Logic:Any" pos="-774,1008,0" InHideMask="1023" OutHideMask="1">
<Inputs />
</Node>
</Nodes>
<Edges>
<Edge nodeIn="61" nodeOut="59" portIn="Start" portOut="Link" enabled="1"/>
<Edge nodeIn="76" nodeOut="60" portIn="in1" portOut="Done" enabled="1"/>
<Edge nodeIn="60" nodeOut="61" portIn="End" portOut="Done" enabled="1"/>
<Edge nodeIn="61" nodeOut="62" portIn="Position" portOut="Pos" enabled="1"/>
<Edge nodeIn="62" nodeOut="63" portIn="entityId" portOut="entityId" enabled="1"/>
<Edge nodeIn="65" nodeOut="64" portIn="in1" portOut="output" enabled="1"/>
<Edge nodeIn="69" nodeOut="65" portIn="In" portOut="out" enabled="1"/>
<Edge nodeIn="59" nodeOut="69" portIn="Start" portOut="Out" enabled="1"/>
<Edge nodeIn="62" nodeOut="69" portIn="Get" portOut="Out" enabled="1"/>
<Edge nodeIn="78" nodeOut="76" portIn="in1" portOut="out" enabled="1"/>
<Edge nodeIn="65" nodeOut="78" portIn="in2" portOut="out" enabled="1"/>
</Edges>
</Graph>
Just copy paste this into your Flowgraph.
Have you had a look already at the getting started guide with Flowgraph?
Just in case you have not, here are some useful getting started videos:
Flowgraph with AI:
https://www.cryengine.com/tutorials/des ... sing-paths
Flowgraph video:
https://www.cryengine.com/tutorials/des ... /flowgraph
Documentation:
http://docs.cryengine.com/display/SDKDO ... ence+Nodes
Keep in mind that AISequence nodes always have to start with AISequence:Start and end with AISequence:End.
If you try to do something in between not "AISequence:" related you might get an error or it will not work.
Re: how to make AI chase player via cars/boats??
#4Quick and dirty way to do it would be to send the AI to the player's current position via the Entity:GetPos node and a and loop it using a timer or other means, similar to what Chris recommended. It works, but it can eat up memory in some cases.
Pursuing the player in a vehicle is basically the same, your just send the AI to the vehicle before you initiate the pursuit.
Pursuing the player in a vehicle is basically the same, your just send the AI to the vehicle before you initiate the pursuit.