Aller au contenu

Photo

SOLVED: Idle NPC's during combat, Post Combat Commands unreliable, NPC's idle after AOE attack


  • Veuillez vous connecter pour répondre
33 réponses à ce sujet

#1
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
I have tried multiple means to get NPC's to move to certain locations (in some cases hitting triggers to start other actions) following three waves of combat. I have 50/50 luck - meaning, sometimes it works, sometimes it doesn't. I have tried WR_AddCommand, UT_QuickMove, and UT_QuickMoveObject. I have the most success with UT_TeamMove, but even that is flakey sometimes. Warning - I am not a programmer, but I have worked with computers for a couple of decades, mostly either doing technical support, or running support centers - so my approach to programming is more trial & error (process of elimination), so don't laugh too loud if I am doing silly things...area script follows - see the post combat cleanup at the end for my latest approach in trying to get consistent results....arrrggggghhh!!! (all the trigger scripts are working fine):

== REMOVED SCRIPT, SEE RECENT POSTS ==

Modifié par RecklezzRogue, 08 mai 2010 - 09:26 .


#2
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
ps - forgot to mention, baiscally everything BEFORE the post combat clean-up section is working AOK. I get the expected results...

#3
Magic

Magic
  • Members
  • 187 messages
Wow. How many creatures are we talking about? And are you sure that it's only the movement which is failing? I.e. the corresponding script is actually assigning the command to the creatures but those don't move, instead of the command not being assigned in half the cases? Can you say which creatures are not always moving? Or is this random?

#4
Magic

Magic
  • Members
  • 187 messages
I don't understand your separation with

    // Trigger first responder thug encounter

and

    // Post Combat Clean-up

This is an area script only, and not a trigger script, correct?

Are Anna and Lynn moving at all? I see you used a capital in GetObjectByTag(). Not sure if that works.

#5
Magic

Magic
  • Members
  • 187 messages
               UT_TeamMove(21,"dmo001_WP_talia_2", TRUE, 5.0, TRUE);
              
UT_TeamMove(25, "dmo001_WP_wolf_2", TRUE, 5.0, TRUE);
                UT_TeamMove(21, "dmo001_WP_Talia_0", TRUE, 5.0, TRUE);
               
UT_TeamMove(25, "dmo001_WP_wolf_0", TRUE, 5.0, TRUE);

have a capital as well. In my test, this does not return any valid object. Please check.

#6
Magic

Magic
  • Members
  • 187 messages
Another one, line 290:
                    UT_TeamMove (21,"dmo001_WP_talia_3", FALSE, 5.0,
TRUE);                  

The plot flow logic seems to be correct, as far as I can tell. I hope that helped a bit.

#7
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
Magic - thanks - you know, it was Talia being tricky that really confounded me....it was the damn cap "T" - THANK YOU - I should have caught that.

As for the number of creatures, there are quite a few, pushing the envelope slightly, but, for this particular set of encounters, it is important to show some numbers...I am still tuning a little bit.

Things are working now - I think - I need to run a few more scenarios. Another change I made was was to spell out the waypoints for for the quickmoves....not sure what I am doing wrong there, but it's fixed and I am moving on.

Once I get a few more things sorted, I am going to post this into my project for testing....I think it's pretty cool when everyhting is working...(don't we all think our babies rock?).

Here's the fixed script - and yes - it is an Area sript. I also have about 6 triggers and scripts, all working AOK. Thanks for your quick help...sorry it was something I should have caught....cap T...arrrgggh....hours and hours chasing that down...

== REMOVED SCRIPT, SEE RECENT POSTS ==

Modifié par RecklezzRogue, 12 avril 2010 - 05:47 .


#8
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
ps - the cap "WP" is correct...I was still working through naming conventions when I started this area.


#9
Magic

Magic
  • Members
  • 187 messages

RecklezzRogue wrote...

(don't we all think our babies rock?).

:lol:

I want to add I liked that you commented your script, especially for the plot flags. It's one thing to look at the code and to see what is done, but another entirely to understand what is intended. I can only encourage others to do the same. [smilie]../../../images/forum/emoticons/smile.png[/smilie] (Georg's scripting comments are best, though. ^^)

#10
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
Thanks - I'll look at some of his and try to improve...dang - I'd go insane without comments ;-)

ps - bugger...one scenario is not working (talia and her wolf standing on the hill, not extiing after combat...I might add the clear commands back in just in case, but I am also going to double check all my waypoint tags and such...but you've given me a good push...the general 'population' is now behaving.

Modifié par RecklezzRogue, 06 avril 2010 - 09:30 .


#11
Magic

Magic
  • Members
  • 187 messages
Georg's comments are best in a funny way. My favorite is in SetCombatState(). :P
** If you are not Georg and you are using this function, you're in trouble!**

I just wanted to note that capitals do not work for me as any tag, including waypoints. The are converted to lowercase right after typing. Pretty sure all team moves with capitals are failing.

#12
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
I've wiped out all the caps...I am now wondering - how deep is the engine command queue? I think I will break it up with an EVENT_TYPE_COMMAND_COMPLETE or something else...I am getting some random NPC's now not following orders, but most are...hmmm..given that I missed that capitol T, I need to go through and check everything before I ask for more help...



ps - yep - that comment is cool..... ;-)


#13
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages

Magic wrote...

I don't understand your separation with

    // Trigger first responder thug encounter

and

    // Post Combat Clean-up

This is an area script only, and not a trigger script, correct?

Are Anna and Lynn moving at all? I see you used a capital in GetObjectByTag(). Not sure if that works.





Magic - originally, it was all in the same switch. I decided to break it up during troubleshooting. I don't think it is bad, is it? I sort of like it being in a different switch for ease of editing and diagnostics - but that's a human thing....you think I should put it all under another 'if' following a break; from the else if's?

Anna and Lynn are better now - no caps, etc...still have some random NPC's goofing off instead of doing their chores. I did muck around with Talia's variables, and found that AMBIENT_SYSTEM_STATE was 0, now that I made it a 2, she is behaving....I did not think I needed to do that since I am issuing explicit commands, but I want her to crouch before combat, so two birds so-to-speak...

Modifié par RecklezzRogue, 07 avril 2010 - 06:29 .


#14
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
With regards to NPC's that stop fighting, I've just figured out what triggers that --- Talia is out-of-bounds, fighting a couple of thug archers (for show), once she deals with them, she attacks the inside-of-bounds thugs, occasionally hitting the merchants via friendly fire - literally fire ball. This is the desired effect - she has no love for the merchants, but is really only attacking the thugs (who she deeply resents). Problem - once the merchant NPC's get knocked down by the fireball, they just stand up and that's the end of that - they just stand there...hrmph. They are _FRIENDLY, and I have tried _PC - no impact.



I have also noticed similar behvaiour with UT_TeamMove - for example, when I cast an area of affect spell (like blizzard) and hit NPC's completing a UT_TeamMove command while they are still _NUETRAL, when they get up, they just stand.



I must be missing something very basic to handle this as I am sure it must be a common scenario....help?

#15
Magic

Magic
  • Members
  • 187 messages
Haha, thanks for letting me know that my NPCs are also standing around after being hit by a fireball ... It's so hard to get the ambient system work meaningfully if the NPCs should to more than idling. :(

It seems to me that the best way to get it done is by reapplying the ambient behavior after EVENT_TYPE_COMMAND_COMPLETE. So if you're using event redirection or overriding rules_core.nss, that's an option. This event is fired very often naturally, so the check to reapply the movement will need to be strict. Maybe check for AMBIENT_SYSTEM_ENABLED? I'm not redirecting events, so I'll use the custom ai, I guess. I wanted to avoid that, too, doh.

It's not bad to have a separate switch. It's a bit less efficient but that bit is so tiny, it wasn't basically worth mentioning. I would avoid it because dealing with the same event at different places might confuse - but this is a human thing as well. :) I assumed you had it there for another reason:

Both calls of WR_SetPlotFlag(PLT_DMO001_DAFL001D_PLOT, 6, TRUE, TRUE);
will trigger the post combat clean-up within the same script call, and this something you want. I'm not sure what you had in mind with "another 'if' following a break;" - maybe show it?

Okay, just noticed something. :lol: All "break;"s in your second switch except the last one need to be removed. "break" exists "switch", "for", and "while", so nobody except Nausica will move. Let's see this first. Probably there is no problem with too many commands at all.

There's more to say on the ambient system - later.

#16
Magic

Magic
  • Members
  • 187 messages
The ambient system is turned off on combat, so AMBIENT_SYSTEM_STATE = 0 is normal. How did you get other results with setting it to 2, however, I wonder. When did you set it to 2? After the fight?

If you have access to EVENT_TYPE_COMMAND_COMPLETE, the following at the end of the event worked for me.

[dascript]
if (GetCommandType(GetCurrentCommand(OBJECT_SELF))==COMMAND_TYPE_INVALID
  && GetCommandQueueSize(OBJECT_SELF)==0) {
    if (!GetCombatState(OBJECT_SELF)
      && GetDistanceBetweenLocations(GetLocation(OBJECT_SELF),Rubber_GetHome())>1.0) {
        Rubber_GoHome();
    }
    if (GetLocalInt(OBJECT_SELF,AMBIENT_SYSTEM_STATE) & AMBIENT_SYSTEM_ENABLED) {
        Ambient_Start();
    }
}
[/dascript]

It worked against fireballs and cone of colds. I suggest to use more strict checks if possible. By the way, it looks ridiculously awesome if the NPCs eat some fireballs and then continue their ambient behavior. :lol:

This might actually also help get your NPCs moving again if you intercepted them with conversation during their ambient behavior. However, that's worth an own topic. I wasn't able to rely on EVENT_TYPE_COMMAND_COMPLETE for that.

Edit: Bugfix! Forgot to check for the current command. Checking for RUBBER_HOME_ENABLED is already in Rubber_GoHome(), so another check was redundant.

Modifié par Magic, 08 avril 2010 - 09:41 .


#17
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
ok - now I can't wait to get out of the office and tweak my script --- I am relieved to know that you have seen similar behaviors with area affects, and the AMBIENT_STATE being switched to "0" during combat really explains a lot (but I am still a bit confused as to whether or not the ambient system needs to be enabled for explicit commands). M breaks - I thought the breaks were for the 'IF' statements, but I see now that {} handles that. Ya know - this is liking doing brakes (no pun intended) on a car, the first one takes the longest.....of course, I refuse to start simple, it's just not my way... ;-)



regarding Talia's setting - I changed her template, which was zero (that worked fine before I added complexity)...and I was wrong, it did not make a difference, I still have the random loitering. Also, I know I am getting to my post combat clean-up because I added floaty messages...so - the AMBIENT_STATE with the rubber home settings - I think you may have it there...more to come in a few hours...



ps - I decided to tweak SetCombatState - and came accross Georg's finger prints...lol....if you're not Georg....btw - it didn't do anything for me setting the combat state to zero...




#18
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
Ok - your code definately improved things, with the exception of NPC's not being aggresive after a fireball knocks them down (in fact the whole team, not just the ones that got knocked down).

So then, my Archer Patrol regroup trigger stopped working...so...I did some more tweaking trying to tighten up the EVENT_TYPE_COMMAND_COMPLETE conditional, and now I'm back to the same problems...once I get some of that sorted, I'll post the script that get's everyone where they need to go, but still leaves them dumbfounded after an AOE attack.

the good news - once I put in your code, unconditionally, everyone went where I wanted them to go...it's just that the archers are now not leaving the regroup trigger and resuming their patrols.

I have conditional triggers designed for two patrols of two archers, they are independent & unique down to the creature & waypoints, but the waypoints for each destination are grouped inside of triggers which make the first archer to enter wait for the other archer (same patrol) to arrive before moving on (plus a 2 second wait, which ends up syncing them nicely almost side by side).. This is done with plot flags set when one enters a trigger.

The regroup trigger brings them all to same place before resuming patrols after combat to make sure that they are going to the same waypoint/trigger. Each patrol of two has a common trigger script surrounding each ap_ path waypoint, if one member of a patrol dies, the trigger is destroyed such that the remaining patrol'er now just loops through the waypoints alone. So - when the patrol flags are set blindly by whichever patrol trigger is being entered, i've already made sure the patrols are heading for the same trigger after combat via the regroup trigger/waypoints. With your code - the regroup trigger stopped functioning - they all just stay at that waypoint (which is now Rubber Home....). Like you said, command complete fires a lot :-\\\\\\\\\\\\\\\\

Here's the regroup trigger script:

== REMOVED SCRIPT, SEE RECENT POSTS ==

Modifié par RecklezzRogue, 12 avril 2010 - 05:48 .


#19
Magic

Magic
  • Members
  • 187 messages
Okay, now I see that you don't like it simple. :lol: I won't be able help you with all the details, however, since I've an own project ongoing. :) You will do well, no problem.

The ambient system does not need to be enabled explicitly. You're doing it with the AMBIENT_SYSTEM_ENABLED parameter in the Ambient_Start () call.

Not sure what you intended with SetCombatState(). If you set it to true, you'll notice the creature will be crouching and always run. I'm not sure if setting it to false works that simple in combat as well. It's definately possible to break the system easily, so probably Georg was right. :)

Using an area effect will not make creatures hostile. You'll need to call something like UT_CombatStart() explicitly if you want this. The few lines I wrote were actually not for initiating combat. All they do is, if the command queue is empty after the last command completed, the creature will go home and start ambient behavior, if these are enabled. RUBBER_HOME_ENABLED is true per default, by the way. So unless you turn it off, creatures will return to their home location eventually.

I'm lost what your last script should do. Keep in mind that every entering creature will run through the entire script, possibly triggering all lines. For example, any creature will set all plots 21-24 in the second switch, as long as the corresponding creatures are not dead.

#20
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
Thanks --- my last script (the regroup trigger script) is just collecting the archers before sending them off on their respective patrols again...it keeps them side by side (relatively speaking). I see though that you are correct about creatures entering, I need to tighten up the conditionals to include checking for 'who' is entering....

Anyway - thanks for all your help. I am tracking the lessons learned here and will post a summary and the final working script when it gets there. I am a lot closer now than before you came along!



Yes - your code get's everyone moving after combat. I was hoping it might help with the AOE issue. To re-iterate, the only problem I am having with AOE impact on the _FRIENDLY NPC's is that they stop doing whatever they were doing when they hit with the AOE. Even if it was combat. The only thing that gets them moving again is either being attacked by someone _HOSTILE, or, your Rubber script at the end of combat. Tonight I will play with UT_CombatStart.

I tried to tweak combat state prior to you giving me your rubber code - it was just process of elimination and you solved the problem I was attempting to address, so, mute point, but cool comments by Georg.
Posted ImagePosted Image

Modifié par RecklezzRogue, 09 avril 2010 - 08:09 .


#21
Magic

Magic
  • Members
  • 187 messages
I see now what you mean but I don't know what's happening with the friendly NPCs. First, I didn't realize at all that your description was about during combat. Does it matter if the party is casting the fireball? I had to tweak my scripts quite a lot myself. Changing the system is ... trouble. I'm now checking for command 32 which is for "performing" fireball effect. Maybe you can try something like

if (GetEventInteger(ev,0)==32) { // Creature finished the ExecuteEffect command

ClearAllCommands(OBJECT_SELF,FALSE);

AI_DetermineCombatRound();

}

at the end of the command complete event. It's all very brute-force, though. Probably changing something here will break something there and so on.

#22
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
I was wondering if there was an event that indicated an object(NPC) got knocked down, or frozen, then trigger AI_DetermineCombatRound to get them going again...as an OBJECT_SELF scenario...I guess that is what 32 means for fireballs, but what about other AOE's?

I don't believe it matters who is tossing the fireball, but worth a check...to rule things out. I know that when I cast a fireball on the bad guys which are heading to a trigger to be switched from _NUETRAL to _HOSTILE, they stop travelling when the get up, so to cover that scenario, I just set the 'GoesHostileonPerceivePC' variable (or whatever it's called - in the office right now). That worked well enough...clearly - that does not help with the _FRIENDLY npc's.

Modifié par RecklezzRogue, 09 avril 2010 - 11:31 .


#23
Magic

Magic
  • Members
  • 187 messages
Have you tried the command 32? It works well for me now, and it's for effects which affect the command queue in general, so I assume. At least, the NPCs now continue their ambient behavior unimpressed after knockdowns, freezing, and paralysis.

#24
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
Hey Magic - have virtually everything working, I am adding the check for 32 now...I think I am overdoing it right now checking for EVENT_TYPE_ALLY_ATTACKED, then doing AI_DetermineCombatRound(), which appears to be working for the allies, but I still have a couple of thugs that don't recover from the fireball specifically. I avoided doing the check for 32 at first becuase I am trying to cover all the weird scenarios with less restrictive calls to AI_DetermineCombatRound().



The good news is, I found several little errors here and there, thanks to your guidance on caps and such, and I am down to a couple of minor problems...the overal mechanics are working great, and it is very cool to see the merchants move from one side of the camp to the other and take up new positions for each battle. ;-)



Almost back to the storyline.....yikes.....I will hopefully post the final working script today with a recap of the issues I found...

#25
RecklezzRogue

RecklezzRogue
  • Members
  • 193 messages
With the following, everything appears to be working, but I am still testing all the scenarios. Major problems resolved:

-- Restarting NPC's after AOE attack (AI_DetermineCombatRound() help from magic)
-- Getting NPC's moving after combat (Rubber_Home code segment from magic)
-- Keeping NPC's in the battle (Update threat table code segment from magic)
-- Waypoint tags cannot have capitols
-- Max number of total combatants is 24.

This is generally solved, but I suspect I will still have some anomalies to chase down. Thanks Magic!

======= AREA SCRIPT BELOW ========

SEE LATER POST FOR FINAL SCRIPTS & FIXES - 5/5/10

Modifié par RecklezzRogue, 06 mai 2010 - 02:12 .