kingtitan Posted February 12, 2013 Share Posted February 12, 2013 (edited) I have an idea for a small "escort" type package/script, but I wanted to post this topic to gather a bit of feedback from the community. Anyway, what I am trying to accomplish is to have an NPC "lead" the player character to a specific destination. My idea for this was to have a simple travel package with an important condition like so: Run on target: no, Get distance player <= 10 That way (in theory) the NPC would only make progress traveling to the destination if the player was close enough to them. This would of course give the appearance of the NPC leading the player. Would this approach work? Please give me feedback or even a better approach if you have one! Edited February 12, 2013 by kingtitan Link to comment Share on other sites More sharing options...
Striker879 Posted February 12, 2013 Share Posted February 12, 2013 That's how Emma and CDCooley have set up Vilja's 'lead the way' packages. Works well, especially if you add the ability to 'put it on hold' so the player can do something in the middle of the package execution. Link to comment Share on other sites More sharing options...
Lanceor Posted February 13, 2013 Share Posted February 13, 2013 Perhaps use an escort rather than a travel package instead? Default behaviour for an escort package is to lead when the player is within a certain distance, but to stand and wait if the player is too far. Keep in mind that one problem with conditions on packages is that by default, the NPC only evaluates their package once every few minutes unless a script forces them to re-evaluate what they're doing. For Vilja, a script is always running so that's probably fine, but you might not want to do that for a throwaway NPC. Link to comment Share on other sites More sharing options...
kingtitan Posted February 13, 2013 Author Share Posted February 13, 2013 (edited) Surprisingly enough, I had completely forgotten about the escort type package! Thank you for bringing that to my attention Lanceor. I have one (I think rhetorical) question: do I need to put the "travel" reference under the location tab or the target tab? I assume location (as that's what I would use for a travel package) and that the NPC would escort the player to that certain ref. Also, in light of your observations Lanceor, I may add a very simple script like: Begin Gamemode evaluatepackage End to the NPC to ensure that the package is being called at the relevant time. I also employ the use of global vars to make sure that packages are executed on time, so I may flesh out that script a bit more to work better for my uses with a relevant "if" statement. Edited February 13, 2013 by kingtitan Link to comment Share on other sites More sharing options...
Lanceor Posted February 13, 2013 Share Posted February 13, 2013 I wouldn't get it to evaluate the package every frame... it would make the NPC freeze in place as it continually decides what to do every frame. Ideally, use a quest script - every 5 seconds is frequent enough when not in combat. Add some conditions to the script like GetInSameCell to determine when an update is irrelevant, and use stuff like GetIsCurrentPackage to make sure the NPC isn't already using the correct package before updating it. Link to comment Share on other sites More sharing options...
kingtitan Posted February 13, 2013 Author Share Posted February 13, 2013 What might that quest script look like? I've never written a 'quest' script so I'm not really sure where to begin! Link to comment Share on other sites More sharing options...
Lanceor Posted February 13, 2013 Share Posted February 13, 2013 Create your script exactly the same way as an object script and then save it. Now create a new quest - press the Q button at the top, right-click on the list of quests on the left and select New. (Your're creating a dummy quest that does nothing except allow you to hang a script off it.) Make sure that "Start Game Enabled" is flagged, assign your new script to it and away you go! Link to comment Share on other sites More sharing options...
Recommended Posts