Newest info at top moving forward.
0.4 Demo module released: The latest file download has some fixes and working demo bits to illustrate some of the Pathway usage. I fixed a script issue where if an NPC takes too long to get to their destination, they would teleport directly there. Which, if you set up the Duergar and Dwarf spawners will find that issue caused the enemy top just appear at your castle gate. This doesn't happen anymore.
Pathway logic: If you see issues in how your NPCs are using the Pathways you create, it helps to understand that the math is linear, and has no understaning of how the tileset might block your wandering NPCs. In my example I have winding routes to get from one end of an area to the next. The NPCs would find their way without Pathways, but would use more CPU to do so. But in the 0.4 demo module I used barrier waypoints and a gate set off waypoints to coral the NPC along it's open route and through the alleyway, where default NWN pathing would attempt to walk through the buildings of the city in the way, be blocked, then eventually go around. This gets really messy if you have NPCs wanting to travel both ways. It's still a bit messy, but it's better than a logjam of creatures unable to move to where they are told to go.
This is effectively Deva Winblood and PK Busby's NPC Activities 6.2 beta (making this effectively NPC Activities 6.2) taken from his actingFenora module, which uses Deva Winblood's NPC Activities 6.1 as a base. PK has fallen off the earth, so I'm posting this in order to inform people of the features PK has added to this system. I label it beta because I have not tested it extensively, though I can vouch for a bunch of fixes to some of the logic. :D
Original acting Fenora submission by PK Busby: http://nwvault.ign.com/View.php?view=Modules.Detail&id=6144
Note that this module does NOT require any Haks, as acting Fenora does (though only for thematic reasons, not the logic of NPC Activites or Pathways features. I simply exported the scripts from actingFenora and dumped them into this demo module.
File is compressed using 7-zip(.org, free!) for much better compression.
EDIT: I forgot the doc included with actingFenora.
UPDATE: This version has some enhancements for random appearances for my spawns. Also, most times giving a new command to a travelling unit will actually cause that unit to follow your new command. This is not always the case, but mostly.
What is Pathways? Pathways is a new feature added to the NPC Activities 6.1 scripts that allow creatures to more easily and efficiently traverse a module. This is done by creating a series of linked waypoints that form line segments which the creatures traverse.
How is this different than simple WalkWaypoints?
PK Busby created logic to link these line segments across an area, and then link these pathways per area to other areas. The mapping is done from one end of a module to another, and allows you to more carefully choose how your creatures walk around squirrely areas and between obstacles.
Disclaimer: This careful method is not followed during combat. Creatures will continue to fight as long as alive and with a valid target. Pathing resumes when combat ends and the creature will travel to the last Junction or Address in the creatures list.
NPC Activities 6.2 also has the benefit of all of the features and logic a builder can use to create custom creature behavior without as much (or very little) scripting knowledge. Change a creatures Tag with virtual Tags (vTags) to cause them to go off and perform new logic (or even random events).
Liven up your population centers, give your city lively looking NPCs that perform duties and functions. Or just wander and interact with PCs and eachother.
What is this module for?
I have created this module to both prototype a dynamic RTS type battlefield (VERY simple) and illustrate how to create pathways using NPC Activities' new Pathways feature by PK Busby. I'm sort of trying to recreate the Harvest of Souls dynamic warfare with simplified and controlled behavior.
I hope you will excuse the clutter, I was testing some toolset ideas and left some characters from a Dwarven story based module in this set of modules. This module is an updated, cleaner version of the same module posted on NWVault.ign.com. I have removed the scripts for the NPC Activities - Dynamic Lairs addon, which were problematic, since I didn't understand how to use them. I will readd this feature later, but I wanted to focus on a good demo sample of Pathways. It is also likely that the current NPC Activities functionality provided by Deva and PK can duplicate this logic in a cleaner fashion.
The Pathways are illustrated in the NPC Act test area. Pathways (line segments) are highlighted by light effects marking the waypoint objects used to mark the pathway. Each area has a "PW_Pathways" waypoint which stores each line segment/pathway for that area. All Pathways are link across the module using PK's special logic allowing the pathing logic of creatures to be reduced to moving from one waypoint to the next instead of all attempting to taverse all of the twists and turns between two waypoints at once, effectively breaking down the pathway between two points to something you can control explicitly.
Pathing can be interrupted by combat, waypoints can include references to scripts (ala Activites features), as well as resumed.
Green lights mark Junction waypoints, which act as the end points for the line segments the AI uses for pathing. Consider these major roads or streets, though they can be off into the mountains or through a virgin forest.
The Pathing system uses an ingenious system of line segments allowing a builder to create clear lines of sight or more simple pathways clear of clutter to allow AI creatures to more easily navigate the landscape. These routes create a network of navigable paths from one place to another, across areas (in theory, I'll be adding more areas on to this module).
I have not tested more than two areas, but I plan to expand on the Stonegate area for a more labyrinthine setup for the Duergar.
Blue lights mark Address waypoints, these waypoints mark addresses you can designate as smaller pathways. This could be considered the "offramp" for a particular spot, like the local Tavern or someone's house or farm in the middle of the road.
I use the light effects to more easily illustrate how the AI creatures will move from point to point, and if you're building a new pathway and see odd behavior you can see what points they are travelling to (or NOT!) quite clearly. You can use other objects, too, I was just keeping it simple during my study of the system. These objects can be removed once your pathway is causing the desired effect.
I'll only state one more tidbit for now, I hope to add documentation later. That is; Odd behavior can be seen when certain Junction points are too close together, or they are close together and blocked by someone thing in the area from the tileset. This might require some finesse in how you place particular Junctions to get your creatures to move as you expect and not get stuck.
For an example, see the walking pattern when you send a creature from one station to the northern most archer station near the castle. the creature will walk to the ramp, then outside of the walls, only to get stuck not being able to scale the wall. The creature will then reroute back up the ramp and to the station you have assigned (using vTags). This can be troublesome when you are attempting to defend against an enemy wave marching from the Stonegate area.
I had planned to expand on this to create a somewhat dynamic back and forth series of battles, but due to rather dramatic RL events I was forced to abandon everything not work related. I hope to start some additions to this module soon.
Simply pull some levers near the castle doors to spawn a Dwarven Commander, or the lever next to it to spawn a Duergar Captain to get the (bloody) ball rolling. It's still very rudimentary, but I hope to add spawn and spawn limit logic in an expanding module using more areas.
I tend to spawn 2 of each to keep the combat going. As I add and tweak the spawns and creatures this should allow for more refined timeing and creature wave sizes. Sapwns continue while any of these creatures is alive, as they spawn their own groups and send them off towards the spawner of the other side.
Also note that I am designing this module for lower level PCs, so creatures aren't over level 5 ATM. this is due to me prototyping for a beginning adventure for a Dwarven youngster just heading out on an exploratory mission with grownups for the first time to examine a new seam of minerals for the clan. Respawn causes you to simply respawn at the Start Point.
I also disabled treasure drops, as I need to sometimes run it on a server for prolonged periods of time.
This sample module has a simple AI tweak I was hoping would smooth out AI behaviors when the PC is not present, and it appears to do so somewhat (spawning all creatures with "SetAILevel(oMe,AI_LEVEL_NORMAL);".
My reason for the tweak is AI behavior when there is no PC present (I may add a pause setup someone else created that pauses the module when no PCs are present).
One other issue is the reliable following of creatures of their leader using features in NPC Activities. I might need help to overcome this hurdle if it is even possible... Currently I'll probably spawn followers for an invisible non-combative AI creature and have AI responses for folowers come from this invisible leader. We'll see if I'm up to this scripting change.
You can simply search for "qlippoth" (all files in module) in the scripting tool (ctrl-alt-s) to see what I've done, which isn't much. I've only changed or added scripts to create the behavior that operates the simple two sided war.
I have a forum but will start a subject on this project here for better organization of this community. Otherwise I will try and check back every so often and look for comments.
- Qlippoth
I've updated the usage terms, allowing usage in all Neverwinter Nights 1 and 2 non-commercial projects (non-commercial is required by Atari, for that matter). Anyone is prohibited from using the Pathways code outside of Neverwinter Nights 1 and 2 for any reason without PKBusby's consent.
Just an update, this system is GREAT if you stick to a large single area. I'm still trying to find time, to try to fix the issue. Seems there is a reference to some code to check for whether the area has changed, but no code to actually do anything if the area does change. So it like, Are we in a different area? YES... ... nothing. So maybe someone can help me work this out, I've only a few months of coding experience myself...
Some new stuff, snazzy randomization of heads, hair and skin color and phenotype.
UPDATE: This version has some enhancements for random appearances for my spawns. Also, most times giving a new command to a travelling unit will actually cause that unit to follow your new command. This is not always the case, but mostly.
I've set a goal for myself; to create a simple demo module that explains how to use Peak's "new" Pathways features from scratch. NPC Activities by Deva) did something like this WAAAY back when he released each version. I will include the module already posted as well, since it is more complex and has some ideas on how to use it to order creatures around.
I thought it would be useful to explain how to set up Pathways from scratch and any pitfalls I've found along the way (usully user error/typos).
NPC Activities already has good examples of how to cause creature activities, behaviors, etc. Peak's module, ActingFenora, models a village with activities and creature/object creation. https://neverwintervault.org/project/nwn1/module/acting-fenora
Deva's latest NPC Activities also has something I requested from Deva way back, Lairs (https://neverwintervault.org/project/nwn1/script/npc-activities-61). I haven't as thoroughly studied that system as much, so that may end up being a seperate module.
I use this 6.2 version in my basemodule. The Pathways and updated Professions are well done. I guess I actually pulled it from actingFenora, but this is great too!
I'm feeling like working on this some more, so I thought I'd add some now old observations I don't think I shared or shared clearly.
Note that my earlier complaints (or confusion) about pathing and other areas was a user error:
My example uses a long winding path, which is very obtuse as far as a human interpretation is concerned. So when I observed my little dwarves veering off my expected path I thought it was a bug. The issue is that the winding path is convoluted, and the pathing logic is simple (2D calculations). So if a creature using pathways exits combat or is otherwise interrupted, it will reevaluate how to get to where it is supposed to go. In my case I needed to add BARs (barrier) and a GAT (gateway) to my path so that when my NPCs start up pathing again near the Duergar side of the main area, these edge case rules for my weird area are taken into account. There are still some edge cases, but thet issue was entirely mine, using an incomplete understanding of how I thought the NPCs/Pathway code would interpret my area, and a bewildering (at least to me) set of simple rules I should have thought out first.
So just be sure to think about pathways from a 2D perpective, maybe even plot out complex area designs on paper. It will save you a lot of headache and head scratching.
Thank you for the improvements and updating this useful system