Product Chat / Path Indices?

Author
Message
PartTimeCoder
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location:
Posted: 22nd Mar 2016 22:44
I'm setting up a situation where I have many paths for npc's and I need each one to follow his/her specific path depending on there job or task, from time to time each npc may need to leave its path and rejoin it again later...... this is where I'm getting a little lost as many of the paths cross each other or have points very close to each other and using the standard ai path code the npc grabs the closest point of any path and joins it, not ideal, I need my npc's to be able to find the nearest point of his own path

I know all this has to be custom coded but before I start tearing apart ai code I need to be sure about path Indices

with "AIGetTotalPaths()" is index 1 the first path I create, 2 the 2nd ... and can I be sure GG will asign path Indices in the order that I create them, also I would assume that "AIPathGetPointX/Y" also return each point on the path in the order they was created?

I thinking of a virtual map mimicking each path in a Lua table so all I have to do is asign the npc a table and he has all his path info, but I'm relying on GG being consistent with assigning Indices, this is the only clean method I can think of.
PM
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 22nd Mar 2016 23:43 Edited at: 23rd Mar 2016 00:10
My solution here would be to custom name the scripts and attach them individually to each NPC

Civilian_Waypoint1.....For one NPC
Civilian_Waypoint2.....For another

That way the NPC should only go to their waypoint ..... I think
Sounds Credible

PS ... Don't forget to make the name changes in the script as well
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 23rd Mar 2016 09:14
The paths are stored when they are first found so you can just use that again, there's 2 settings, 1 for the actual path number and one for the waypoint number along that path.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Jerry Tremble
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 22nd May 2016 04:40 Edited at: 22nd May 2016 04:41
Quote: "I'm setting up a situation where I have many paths for npc's and I need each one to follow his/her specific path depending on there job or task, from time to time each npc may need to leave its path and rejoin it again later....."


This is where I'm at right now. Thanks for the info!
MAME Cab PC: i7 4770@3.4Ghz (passmark 9945), 12GB RAM, Win 10/64, GeForce GTX645 (passmark 1898); Shiny new laptop: i7 4800MQ@2.7Ghz (passmark 8586), 16GB RAM, Win 10/64, GeForce GTX870M (passmark 3598); Old laptop: i5@2.3Ghz, 8GB RAM, Win 7/64, Intel 3000 graphics
PM
PartTimeCoder
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location:
Posted: 22nd May 2016 18:27
GG does assign indexes in the order they were created I found it pretty reliable and it worked very well from a single script for 50 odd civilians wandering round 10 paths with a nice randomness to it
PM

Login to post a reply

Server time is: 2024-11-25 02:44:58
Your offset time is: 2024-11-25 02:44:58