I am in a clean area now and the script runs every time, but doesn't work. It doesn't do what it's supposed to do, so I am going to check my conditional statements to figure out why.
I also noticed on my script that changes the factions, I had it using DetermineCombatRound instead of HenchDetermineCombat round. So that explains part of the problem with the first around issues.
What is the best way to customize a Creature's Combat AI?
Débuté par
ColorsFade
, mars 15 2013 08:29
#26
Posté 17 mars 2013 - 04:23
#27
Posté 17 mars 2013 - 04:36
don't forget that in *your* script you have to turn off the rest of the AI (when it returns from ExecuteScript)
Search around for 'x2_ai_demo.nss' -- that's the template to start working from
Search around for 'x2_ai_demo.nss' -- that's the template to start working from
#28
Posté 17 mars 2013 - 04:52
kevL wrote...
don't forget that in *your* script you have to turn off the rest of the AI (when it returns from ExecuteScript)
Search around for 'x2_ai_demo.nss' -- that's the template to start working from
That was the most crucial part of the script and I just figured it out before I saw your post.
You have to have this line in there to cause the rest of the script to stop:
SetLocalInt(OBJECT_SELF, "X2_SPECIAL_COMBAT_AI_SCRIPT_OK",TRUE);
I decided to look at the hench_o0_ai script where it calls the X2 script to see if maybe my script was supposed to return a TRUE/FALSE or something. Then I noticed that line and understood what it was doing. The HenchDetermineCombatRound will return if you set that "OK" variable to true. And that's what has to happen.
The second I changed it, the script worked (in the empty area).
So, now to change it over to the real area and see if that does it.
Wow.... if this works, this is gonna make my day.
#29
Posté 17 mars 2013 - 05:20
It works correctly now!
One thing I noticed in the real Area is that my SendMessageToPC messages are not happening and so at first I thought it was still not working. But watching the spells cast, they are being cast EXACTLY how I want them. I ran through it twice. Perfect both times.
Only the first batch of Messages get through and then they stop. Now, there are 3 PC's, the NPC and 10 skeletons all attacking simultaneously, so I figured that's the issue. And as I read the notes from NW Lexicon:
So clearly that's the issue. But I'm happy - it works. I can script my hostile attackers now... I'm elated.
One thing I noticed in the real Area is that my SendMessageToPC messages are not happening and so at first I thought it was still not working. But watching the spells cast, they are being cast EXACTLY how I want them. I ran through it twice. Perfect both times.
Only the first batch of Messages get through and then they stop. Now, there are 3 PC's, the NPC and 10 skeletons all attacking simultaneously, so I figured that's the issue. And as I read the notes from NW Lexicon:
If you attempt to send too many SendMessageToPC() commands at the same time the messages will begin to be dropped, causing some of the messages to not appear at all
So clearly that's the issue. But I'm happy - it works. I can script my hostile attackers now... I'm elated.
#30
Posté 17 mars 2013 - 05:28
well Good luck
( i'm trying to get my PC to stop auto-attacking (but am thinking more and more that it's hardcoded.) )
cheers CF.
( i'm trying to get my PC to stop auto-attacking (but am thinking more and more that it's hardcoded.) )
cheers CF.
#31
Posté 18 mars 2013 - 03:06
kevL wrote...
well Good luck
( i'm trying to get my PC to stop auto-attacking (but am thinking more and more that it's hardcoded.) )
cheers CF.
Thanks kevL. For all your help - you've been great.
I'm thrilled that this works. So much of what I wanted to do in this campaign is based around the idea of scripting enounters... Now that I know how, I'm jacked.





Retour en haut






