Jump to content

Recommended Posts

This topic will cover the following subjects...

1. Spawn AI randomly in an Area.

2. Spawn AI Way points.

a. Follow way point's in specific order.

b. Randomize order.

c. Cycle way points.

 

I decided to post about this because I am having issues getting AI to go where I want them using way points. I figured out what was going on, and how to fix it. You can use this when creating patrols that need to follow a specific route, like a road, or you are setting a ambush, and need AI to walk by your position.

First item is spawning AI randomly in an Area using the scenario framework without any scripting.

1. Place an area.et (PatrolArea) on the world.

2. Set the radius to the area you want to cover. This is not required. But it is helpful for visualization and "trigger activation on area" if needed.

3. Place a layer.et (Patrols) in the area.et, near the center of the area.et. I set coordinates to all zeros so the are on top of each other.

4. Place a several slotAI.et (PatrolA, PatrolB, PatrolC, etc.) in the area.et. Make sure the ground is open, relatively flat, not a lot of trees and rocks. Not required, but helps.

TOP LAYER

|_Area.et (PatrolArea)

             |

             |

             |_Layer.et (Patrols)

                           |

                           |_SlotAI.et (PatrolA)

                           |_SlotAI.et (PatrolB)

 

5. Select the layer.et. Set Children -->Spawn Children --> Random One. This will select 1 random slotAI.et from the layer.et, and spawn it at the position placed on map.

NOTE: 3 Randomized choices.... RANDOM_ONE, RANDOM_MULTIPLE, and RANDOM_BASED_ON_PLAYER_COUNT. See the SF wiki for more info on these choices. From experience I don't use based on player count because sometimes it doesn't spawn any group.

6. Select the SlotAI.et. Go to Asset --> Object To Spawn. Click on the 2 dots button, and find a character or group you want to spawn in.

7. Set Activation Type to the desired method. Only use one of the first 4 choices from the drop down. Custom doesn't work yet, and you don't want "ON_TASKS_INT"

8. If you want to balance the amount of AI based on player count, check the box in Misc.

 

Next is assigning way points the spawned group

1. Place a layer.et in the same area.et used above, and zero the coordinates.

2. Place several slot.et inside the layer.et. Place as many as you need. These are the way points. Don't worry about exact placement at this time. For our example I will use a rectangle as my patrol area.

3. Perform the same as step 6 above. Search "AIWay" and the list of way points will populate the browser.

 

TOP LAYER

|_Area.et (PatrolArea)

    |

    |

    |_Layer.et (Patrols)

    |             |

    |             |_SlotAI.et (PatrolA)

    |             |_SlotAI.et (PatrolB)

    |

    |_Layer.et (PatrolWayPoints)

                  |_Slot.et (WP1)

                  |_Slot.et (WP2)

                  |_Slot.et (WP3)

                  |_Slot.et (WP4)

 

Patrol Area....

WP1-------------------------------WP2

    |                                           |

    |                P1                      |

    |                                           |

WP4-------------------------------WP3

 

4. Now here is where things go wrong. You would think that the patrol  (P1) would go WP1, WP2, WP3, WP4. But they don't, they go WP4, WP3, WP2, and WP1. I don't know why, but I tested this several times, and finally figured out they go in reverse order of the way points. SO if you want them to go clockwise around the square, you have to set your way points as follows.

 

WP4-------------------------------WP3

    |                                           |

    |                P1                      |

    |                                           |

WP1-------------------------------WP2

 

5. This is important when placing your way points in their final position. Once you figure out how many points you need, start with the last way point first, and place it at the start of your patrol.

6. If you are using "Select Random Waypoints" then the patrol will pick one of the way points and move to it.

7. If you are using "Cycle Waypoints" the patrol will continue until some action interrupts them.

8. ANY way point that is not on ground level will cause the patrol not to move. Make sure all way points are "Snap to Ground", and not in trees or below terrain.

9. To follow roads, use lots of way points. AI will cut the corner, and go beeline to the next way points.

10. When the AI reach the last way point, they will go straight line back to the first one when cycling way points. They do not follow the line back to the first way point.

 

Good luck in your scenarios creations...... you're going need it. Hope this helps. I am sure that you can script all this, but at this point I don't know how, and this is for the beginner starting out.

 

TIPS:

For randomized way points I use a 5 pointed star pattern. You can use 10 points, and 2 star pattern. One pointed North, and one pointed south for good distribution of points.

 

 

 

 

 

 

 

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Is this method still usable? Because I couldn't get the spawn to work. 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×