Skip to content

My "Roaming Monsters" Project - Creatures moving between areas

So wanting my PW to feel alive, I want monsters to be able to randomly and freely roam in and between areas. The movement algorithm is something I'm still thinking about, but my biggest concern at the moment is how to make them move between areas. If they will just go to the coordinates where the transition is, they won't transition, would they?

So how do I make them transition between areas?


Comments

  • ProlericProleric Member Posts: 1,316
    It's built in to the WalkWayPoints function. The waypoints, post, night post etc can be in different areas. The areas need to be connected by transition doors or default transition triggers, though.

    IIRC comments in the script itself provide even more information than the Lexicon.
  • ValeriyaValeriya Member Posts: 57
    Hmm, I see; thanks for that info!

    I wanted it to be random; that a creature could be roaming anywhere randomly. Problem is that the ActionCruise script I found online that lets creatures roam about randomly uses the OnHeartBeat and I'm a tad worried that would create some strain on the CPU (though I wonder if such an old game can still easily strain a CPU? Did Beamdog change the infrastructure to make more uses of CPU cores? I doubt it... )

    But I think I'll take you on your advice; maybe do a combo of activating ActionCruise with the WalkWayPoints system.... thank you.
  • ValeriyaValeriya Member Posts: 57
    edited February 2019
    I'm a bit confused though, if I create a waypoint by simply right clicking on the creature and choose "create waypoint", what's the difference between this and WalkWayPoints? They both have the same waypoint format: WP_CREATURENAME_01
  • meaglynmeaglyn Member Posts: 151
    Those way points (created by right clicking) are the ones that are used by walkwaypoints, although you can also just paint them (and tag them correctly yourself).  Also walkwaypoints and anything else (the ActionCruise you found etc) that causes NPCs to do different things is going to be using the heartbeat most likely.  That's what it's there for. If you are concerned about load you could use a spawn system that only keeps the NPCs around in areas with PCs in them.  For moving between areas of course you won't be able to do that. In that case you will likely need to increase the AI level of the NPCs as well since by default they will stop when there is no PC in the area. So maybe you'll want to limit the number of such creatures.   Walkwaypoints is built in to the default AI scripts. 
  • ValeriyaValeriya Member Posts: 57
    edited February 2019
    I think I'll use ActionCruise for starters and see how much strain it creates on the CPU. I want the PW to be "living and breathing", and have creatures roam around even without players. Waypoint system is a bit constrained and if I expand it to be as random as ActionCruise it might as well require more CPU power.
      
    But regardless, I can't figure out how to use area transition with waypoints as Proleric claims is possible. Even if I don't use it I'd like to learn it. I made 2 default areas with 2 very big and connected area transitions but the creature with the waypoints refuses to transition despite the fact his next waypoint is at the other area. Anything I'm missing?
  • ValeriyaValeriya Member Posts: 57
    edited February 2019
    Nevermind, figured it out:
    From
    https://nwn.fandom.com/wiki/Waypoints_used_with_walkwaypoints

    To allow for cross-area transitions, e.g. Barracks in one area, patrol the route in another area, set the global int X2_SWITCH_CROSSAREA_WALKWAYPOINTS to "one" (1) on the module.To do this:
    • In module properties, click the advanced tab, then click variables.
    • Enter X2_SWITCH_CROSSAREA_WALKWAYPOINTS as an int and the value to 1.

    Note that initially I added X2_SWITCH_CROSSAREA_WALKWAYPOINTS with a space after the last "S" character and that made it not work, so mind that as well
  • HimmelweissHimmelweiss Member Posts: 72
    For more complex spawning and roaming stuff, even for cross-areas i use the NESS spawning system.
Sign In or Register to comment.