VikingII Posted May 16, 2012 Share Posted May 16, 2012 I have several NPC with the 'wander' behavior, but one of them needs to wander in the deck of a ship ho turns 'inactive' if I travel to other location. For example, when I push the trigger to travel, the deck (and all parts of the ship) turns inactive in Anvil, and turns active in Waterfront. I added 2 AI Packages to that NPC, one with target in the deck on Anvil, and other with target on the deck on Waterfront at the same time. But the NPC chooses randomly and when the ship is in Waterfront, and the NPC chooses the AI to wander in Anvil, the NPC starts to walk his way to the road to Anvil (I followed him, haha!), and in the middle of his path, when the AI package ends, he turns back to the ship (I was not checked the ‘must reach location’ box). I think I can add conditions on both AI packages that they only start if the deck of the ship is active. I appreciate if someone tells me how to do that. (by the way, excuse my english, is not my native language, I speak spanish) Link to comment Share on other sites More sharing options...
evenstargw Posted May 17, 2012 Share Posted May 17, 2012 On the conditions tab of a package, you can add conditions. If you have a scriptvariable somewhere that keeps track of which deck is active, you can use the getScriptVariable or getQuestVariable conditions, depending on whether the variable is on an objectscript or a questscript. I would also suggest to add [NPCref].evp to the script that switches the decks, so they update their AI immediately when it switches. If the NPC is already in the cell, you may need to do a moveto on the NPC to get him to the other deck. Link to comment Share on other sites More sharing options...
VikingII Posted May 18, 2012 Author Share Posted May 18, 2012 I already had a quest with two variables and it works fine, the NPC only patrol on the active deck. I am interested in the next step that you describe: I would also suggest to add [NPCref].evp to the script that switches the decks, so they update their AI immediately when it switches. If the NPC is already in the cell, you may need to do a moveto on the NPC to get him to the other deck. What would be the syntax of this part? This is the quest:scn A1Sailshort AB ;variable for Anvil Bayshort IC ;variable for Imperial City Thanks! Link to comment Share on other sites More sharing options...
evenstargw Posted May 19, 2012 Share Posted May 19, 2012 You already have a trigger that moves the ship, right? With an onActivate block. Now your NPC needs a specific reference ID. Doubleclick him in the render window and Type a reference name, I'll go with MyNPCRefIn the onActivate block, add this:MyNPCRef.evpIt has to be after you changed the variables that control his package. He will immediately check the variables again and change his package if needed. You can add conditions to only do this if the wander package is already active, but since it is a trigger and not a gamemode script, it is hardly worth the effort.For the moveto part, you would have to check if he is already on deck. You could use getincell, or getdistance. Need a marker on both of the decks. Say you're going from IC to Anvil.if MyNPCRef.getdistance ICDeckMarker < 2000 MyNPCRef.moveto AnvilDeckMarkerNow, if he is withing 2000 units from the marker on the deck in IC, he will get moved to the deck in Anvil. Link to comment Share on other sites More sharing options...
VikingII Posted May 19, 2012 Author Share Posted May 19, 2012 This is just what I need, I am adding a new port on Leyawiin, and I tweaking this system out, if I get new doubts I will ask. Thank you. :) Link to comment Share on other sites More sharing options...
Recommended Posts