Silveredge9 Posted June 14, 2006 Share Posted June 14, 2006 What do I need to change in order to make Enemies attack you as soon as you are fairly close to them and are recognised as enemies? Like when you encounter Darth Bandon or Calo Nord and they charge you, or attack from a distance. Link to comment Share on other sites More sharing options...
stoffe Posted June 14, 2006 Share Posted June 14, 2006 What do I need to change in order to make Enemies attack you as soon as you are fairly close to them and are recognised as enemies? Like when you encounter Darth Bandon or Calo Nord and they charge you, or attack from a distance. I'm not sure I understand what you mean, as far as I know enemies attack you if they perceive you already with the standard combat AI? If you want to make an NPC attack using the AI from a script, include the k_inc_generic include file in your script and call the GN_DetermineCombatRound() function with the desired target as parameter. Link to comment Share on other sites More sharing options...
Silveredge9 Posted June 14, 2006 Author Share Posted June 14, 2006 At the moment I have a section where there are 3 enemies in front of me and 4 or so near by, after a certain conversation choice I added a script to turn them all from neutral and non-attacking to Hostile. The enemies, that are looking pretty much my direction and are just in front of the PC when the change occurs attack me fine, but the ones slightly further away turn to hostile but don't attack until I attack them. I can even run around in circles in front of them without them attacking, despite them showing up as red. Link to comment Share on other sites More sharing options...
stoffe Posted June 14, 2006 Share Posted June 14, 2006 At the moment I have a section where there are 3 enemies in front of me and 4 or so near by, after a certain conversation choice I added a script to turn them all from neutral and non-attacking to Hostile. The enemies, that are looking pretty much my direction and are just in front of the PC when the change occurs attack me fine, but the ones slightly further away turn to hostile but don't attack until I attack them. I can even run around in circles in front of them without them attacking, despite them showing up as red. Strange. If they are all the same faction the front row should shout to the others that they are attacking, and the back row should thus join in even if they don't see you. As long as at least one of them sees you a shout would be emitted and nearby friendlies (to them) should run their combat AI as well. Are they all using the default "k_def_*" AI scripts? How far is the back row of enemies? Have you tried increasing their perception range and seen if that makes a difference? Are there any placeables or rocky terrain where they are? The line of sight checking in the game(s) is terrible, sometimes a small bump in the ground is enough to break their perception of someone standing right in front of them. Enemies also cant "see" over many pleaceables even if you as a player readily can do so. You could also issue an attack order directly after turning them hostile, and see if that makes a difference... Add... #include "k_inc_generic" ...at the top of your script, and then... AssignCommand(oNPC, GN_DetermineCombatRound(GetFirstPC())); ...right after changing their faction. Link to comment Share on other sites More sharing options...
Silveredge9 Posted June 14, 2006 Author Share Posted June 14, 2006 Ok I fixed the problem, I compared it to a UTC file of an NPC that did work and spotted some differences. Either the fact that the OnEndDialogu script was missing or the fact that the challenge rating had to be around 6ish (whist before it was 2) was causing the problem, or both. The problem is solved now, thanks for your help. Link to comment Share on other sites More sharing options...
stoffe Posted June 14, 2006 Share Posted June 14, 2006 Ok I fixed the problem, I compared it to a UTC file of an NPC that did work and spotted some differences. Either the fact that the OnEndDialogu script was missing That would likely explain it. The OnEndDialogue script makes the NPC attack any hostiles when the game exits dialog mode. Otherwise creatures only get into combat mode when they perceive an enemy, or someone attacks them directly. The perception events only trigger once when the NPC first sees or hears a character, and when they lose perception of them. Since they had already perceived you prior to becoming hostile they did not get put into combat mode this way, as is normal with NPCs that start out hostile. If their OnDialogue script was missing as well that would explain why they didn't get put into combat mode by shouts from their allies who did attack your character. The OnDialogue script intercepts and handles any AI shouts the character hears. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.