Page 1 of 2

How to make allies that will follow the player and kill the enemies?

Posted: Tue Apr 17, 2018 10:35 am
by redstranger
How to make allies that will follow the player and kill the enemies, similar video lessons I saw on cryengine2, but there in FG used the cut-out nodes that did not live up to cryengine 3.8 and 5, now I don `t know how to do them?
P.s sorry for my bad english, i'm using google translate

Re: How to make allies that will follow the player and kill the enemies?

Posted: Thu Apr 19, 2018 11:06 am
by Cry-Chris
How do you want to set it up?

I just imagined a simple scenario where you have to free someone to become your ally.
You could use a switch that opens a gate where the AI (faction: Civilian) becomes your ally (faction:Player) then follows you.
Check the flowgraph below:

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="450,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="65" Class="Logic:Any" pos="-666,720,0" InHideMask="1017"> <Inputs /> </Node> <Node Id="66" Name="Follow_player" Class="_commentbox" pos="-1116,593.55261,0"> <Inputs TextSize="1" Color="0.27451,0.352941,0.705882" DisplayFilled="1" DisplayBox="1" SortPriority="16"/> <ResizeBorder X="0" Y="0" Width="1764" Height="504"/> <NodeSize Width="1764" Height="550.39197"/> </Node> <Node Id="67" Name="Use_gate_to_enable/disable_following_player" Class="_comment" pos="-558,684,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="-1098,702,0"/> <Node Id="76" Class="Logic:Any" pos="522,1026,0" InHideMask="1022"> <Inputs /> </Node> <Node Id="78" Class="Logic:Any" pos="-774,1026,0" InHideMask="1023" OutHideMask="1"> <Inputs /> </Node> <Node Id="1083" Class="Time:Delay" pos="-144,1026,0"> <Inputs delay="0.5" resetOnInput="0"/> </Node> <Node Id="1094" Class="AI:BehaviorTree" pos="-1062,936,0"> <Inputs entityId="0"/> </Node> <Node Id="1096" Class="Entity:EntityId" pos="-1062,882,0" EntityGUID="62b176c2-1b68-3824-9bf4-0f0f60f1668f"> <Inputs entityId="0"/> </Node> <Node Id="1104" Class="AI:BodyCount" pos="-1062,810,0"> <Inputs /> </Node> <Node Id="1111" Class="Time:Delay" pos="-1062,990,0"> <Inputs delay="1" resetOnInput="0"/> </Node> <Node Id="1113" Name="Reset_behaviour_tree_after_kill" Class="_comment" pos="-1062,792,0"/> <Node Id="1116" Name="(still_needs_an_extra_input_signal)" Class="_comment" pos="-522,702,0"/> <Node Id="1118" Class="Logic:Any" pos="-972,720,0" InHideMask="1023" OutHideMask="1"> <Inputs /> </Node> <Node Id="1135" Class="Entity:PropertySet" pos="-1098,1188,0" EntityGUID="62b176c2-1b68-3824-9bf4-0f0f60f1668f"> <Inputs entityId="0" entityProperties_Property="Properties2:esFaction" Value="Players" perArchetype="1"/> </Node> <Node Id="1141" Class="entity:Switch" pos="-1404,558,0" EntityGUID="bb3d7b7b-9791-ec4d-52cc-f05a4ba88088"> <Inputs entityId="0" Destroyed="0" Disable="0" Enable="0" Hide="0" Hit="0" Switch="0" TurnedOff="0" TurnedOn="0" Unhide="0"/> </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="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="1083" nodeOut="76" portIn="in" portOut="out" enabled="1"/> <Edge nodeIn="65" nodeOut="78" portIn="in2" portOut="out" enabled="1"/> <Edge nodeIn="78" nodeOut="1083" portIn="in1" portOut="out" enabled="1"/> <Edge nodeIn="1111" nodeOut="1094" portIn="in" portOut="Done" enabled="1"/> <Edge nodeIn="1094" nodeOut="1096" portIn="entityId" portOut="Id" enabled="1"/> <Edge nodeIn="1094" nodeOut="1104" portIn="Reset" portOut="Total" enabled="1"/> <Edge nodeIn="65" nodeOut="1111" portIn="in3" portOut="out" enabled="1"/> <Edge nodeIn="65" nodeOut="1118" portIn="in1" portOut="out" enabled="1"/> <Edge nodeIn="1104" nodeOut="1118" portIn="Enable" portOut="out" enabled="1"/> <Edge nodeIn="1118" nodeOut="1141" portIn="in1" portOut="UsedBy" enabled="1"/> </Edges> </Graph>
Enjoy :)

Re: How to make allies that will follow the player and kill the enemies?

Posted: Sun Apr 22, 2018 8:36 am
by redstranger
I do not work, I everywhere put my ally in FG, maybe I did something wrong, so if that screenshot, specify where I need to put my ally, and where the enemy in FG?

Re: How to make allies that will follow the player and kill the enemies?

Posted: Mon Apr 23, 2018 12:44 pm
by Cry-Chris
You need to copy paste the code into your FG.

Then in game:
1. Create Object > Legacy Entity > Other > Switch and place it somewhere.
2. Click on the switch and then in FG right-click on the "entity:Switch" and Assign selected entity.
3. Create Object > Legacy Entity > AI > Characters > Human and place him somewhere. (change his faction to Civilian in the properties)
4. Click on the Character you have just created and assign him in the FG to all the nodes marked with a Yellow dot. (same as in step 2)
5. connect also the "Entity: Switch Used By" port to Entity: PropertySet Set same as on picture
Image

Now when you use the switch the Human will become your ally and shoot the members of the grunt faction.

You can find very helpful Flowgraph tutorials under the following link:
https://www.cryengine.com/tutorials/edi ... navigation

Hope this helps!

Re: How to make allies that will follow the player and kill the enemies?

Posted: Mon Apr 23, 2018 5:10 pm
by OrkhanAliyev
Wouldn't achieving it be easier by using behavior tree?

Re: How to make allies that will follow the player and kill the enemies?

Posted: Sat Apr 28, 2018 1:35 pm
by OrkhanAliyev
BTW, Cry-Chris, i can't see reset behavior tree flow-node, where is it? I'm using 5.3.

Re: How to make allies that will follow the player and kill the enemies?

Posted: Wed May 02, 2018 2:31 pm
by Cry-Flare
The white boxes are comments rather than nodes. If you are talking about the Behavior Tree Reset node, you can find it by going to: AI -> Behavior Tree.
You can then link to the entity and activate the Reset input when desired.

Re: How to make allies that will follow the player and kill the enemies?

Posted: Thu May 03, 2018 2:11 pm
by Cry-Chris
You could achieve this with the Modular Behavior Tree as well.
I found it easier to make the Flowgraph instead.
Also if for some reason I wanted to make an enemy out of the ally the FG could simply be interrupted with the gate provided within it and the faction changed to grunts
instead of loading another behavior tree. There are many ways of achieving many things. This is only what I came up with.
Feel free to drop your Modular behavior tree here if you got one. It will help out the ppl looking for the same topic.
As for the Flownode AI:BehaviourTree it is unfortunately not available in 5.3 but in 5.4 and above.
5.5 Preview 2 just came out.
May want to give that a go ;)

Re: How to make allies that will follow the player and kill the enemies?

Posted: Thu May 03, 2018 11:07 pm
by OrkhanAliyev
Thanks guys!

Re: How to make allies that will follow the player and kill the enemies?

Posted: Tue Nov 13, 2018 5:01 pm
by Cry-Chris
AISequence:Move End Distance doesn't work very well if you keep triggering AISequence:Move
So here is an improved version of the Flowgraph.
viewtopic.php?f=68&t=11349&p=23125&sid= ... 7e5#p23125