Author Topic: Noogies!  (Read 649 times)

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Noogies!
« on: February 12, 2012, 10:24:59 pm »


                <firmly planting...>

Background: Trying to build a little ambient behavior into the Rogues demo mod. In this case, the Mistress of Mischief will choose a random target (from an eligible list), go into stealth mode, walk to a position directly behind them (which was a real pita, btw. pathfinding to locations sucks). Then she executes this little gem.
Originally, this script fired from onEnter when she entered a specific trigger placed behind the target. But targets move/get moved. Didn't like that. So I have a dynamically generated WP drop on the location and she moves to object instead. Works great.

Problem: When the script was fired from trigger, it worked correctly as long as target was within 3m of trigger. Specifically, the target spoke his lines and spasmed. Now, with the exact same code on those lines, only 2 out of 5 targets spasm. They all speak their lines, so I know the oTarget is valid and correct. But on the dwarf, elf and ogre, no spasm. On the half-elf and dragon, spasm.

Eh?


// Executing a noogie
void main()
{
  // Get Mistress
  object oOwner = GetObjectByTag("Mistress");
  object oTarget = GetLocalObject(oOwner,"oTarget");
  if (GetDistanceBetween(oOwner, oTarget)<=3.0f) // Noogie if close enough
  {
     // Make Owner yell "Noogie!" and stop hiding
     AssignCommand(oOwner, SpeakString("NOOGIE!",TALKVOLUME_SHOUT));
     SetActionMode(oOwner,ACTION_MODE_STEALTH,FALSE);

     // Make target spasm and say "Stop that!"
     AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_LOOPING_SPASM,1.0f,2.0f));
     AssignCommand(oTarget, SpeakString("Gah! STOP that!",TALKVOLUME_TALK));

     // Make Owner giggle
     AssignCommand(oOwner, SpeakString("Teehee!",TALKVOLUME_TALK));
     AssignCommand(oOwner, PlaySound("as_pl_laughingf3"));
  }

  // Make run back to POST_(owner)
  string sTagName = "POST_"+GetTag(oOwner);
  AssignCommand(oOwner, ActionMoveToObject(GetObjectByTag(sTagName),TRUE, 1.0f));
}

I had hoped to put in some variation (different responses, an opposed spot-check to stop the noogie, a couple other little things), but I simply can't spend any more time on this :-(

Can anyone tell me why the ActionPlayAnimation is inconsistent?

Edit: And even cut and pasted from the NwN script editor, this board still mangles it. Now I have a headache <yes?>
No, I mean a real headache. <oh, sorry, boss>

Edit 2: Moved the "Abandon Stealth" bit above the distance check. She'll abandon stealth regardless of success and run back to POST.

<...his hat on his head>
               
               

               


                     Modifié par Rolo Kipp, 12 février 2012 - 10:40 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Noogies!
« Reply #1 on: February 12, 2012, 11:14:20 pm »


               <confused...>

Changed ActionPlayAnimation to PlayAnimation. All targets spasm now.

Did those three misbehavers have some action in their que blocking the anim from playing? They are (all 5) just standing on their POST waiting to interact...

<...but... *shrug*>
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Noogies!
« Reply #2 on: February 12, 2012, 11:38:06 pm »


               <picking at...>

I still want to know *why*.

Something clogging the built-in action queue may have implications for implementing a multi-queue behavioral AI.

Which actually branches into another subject - is there a way to capture the action queue? Specifically, if you were going to interrupt the primary queue, could you store the actions already queued up for later (evaluation for) resumption?

<...the scab>
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Noogies!
« Reply #3 on: February 12, 2012, 11:44:10 pm »


               // Make Owner yell "Noogie!" and stop hiding
    AssignCommand(oOwner, SpeakString("NOOGIE!",TALKVOLUME_SHOUT));
    SetActionMode(oOwner,ACTION_MODE_STEALTH,FALSE);

I'd change those two lines around, to make sure the rogue is out of stealth before saying the line.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Noogies!
« Reply #4 on: February 12, 2012, 11:44:57 pm »


               

Rolo Kipp wrote...

<picking at...>

I still want to know *why*.

Something clogging the built-in action queue may have implications for implementing a multi-queue behavioral AI.

Which actually branches into another subject - is there a way to capture the action queue? Specifically, if you were going to interrupt the primary queue, could you store the actions already queued up for later (evaluation for) resumption?

<...the scab>


For custom AI it is often standard fare to run ClearAllActions(TRUE).  What you could try is ClearAllActions(FALSE) to see if it is combat related (likely not).
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Noogies!
« Reply #5 on: February 13, 2012, 12:06:51 am »


               <confidently lifting the coconut shells...>

Failed.Bard wrote...

// Make Owner yell "Noogie!" and stop hiding
    AssignCommand(oOwner, SpeakString("NOOGIE!",TALKVOLUME_SHOUT));
    SetActionMode(oOwner,ACTION_MODE_STEALTH,FALSE);

I'd change those two lines around, to make sure the rogue is out of stealth before saying the line.

Hehe, yelling in someone's ear isn't very stealthy? <nope> Good catch.
(Did that about an hour ago - edit 2 on first post)

Also replaced all the (trigger related) oOwner handles with OBJECT_SELF, which is another step toward generic "action modules" in the multi-queue AI I dream of :-)

This action just happens to be ActionNoogie!

<...to reveal that there is *no* pebble. oops.>
               
               

               


                     Modifié par Rolo Kipp, 13 février 2012 - 12:07 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Noogies!
« Reply #6 on: February 13, 2012, 12:12:20 am »


               <sticking...>

@ WhiZard: Boolean search. That would at least confirm or deny half the possibilities. :-)
I've put in a reminder in my AI ToDo (*my* behavioral queue?) to try that later. Any other ideas will also (unfortunately) be postponed... but greatly appreciated!

<...a sticky on the thread>
               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
Noogies!
« Reply #7 on: February 13, 2012, 01:36:55 am »


               Gee thanks Mrs. Lugner.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Noogies!
« Reply #8 on: February 13, 2012, 02:02:29 am »


               <just a bit...>

ehye_khandee wrote...

Gee thanks Mrs. Lugner.

*muttering "google this, google that..."*
...
"loud, wealthy and vulgar"?
Hey!
*I'm* not wealthy!

<...puzzled>
               
               

               


                     Modifié par Rolo Kipp, 13 février 2012 - 02:04 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Noogies!
« Reply #9 on: February 13, 2012, 02:30:46 am »


               

They all speak their lines, so I know the oTarget is valid and correct. But on the dwarf, elf and ogre, no spasm. On the half-elf and dragon, spasm.

 

The Above does not really give me much to go off of for where to look for the problem at.  It could be scripting or it could be that the models do not have the spasm animantion.    I know that most of the dragons have the Spasm animation, ant that the Half-Elf PC modle does.   So that leaves the question what appearance are you using for the Dwarf and Elf, Is it the PC models Appearances 0 and 1, Or one of the less complex appearance types?

Would also need to know the appearance # for the ogre to test the Animation, before I even tryed to look for a scripting problem.  
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Noogies!
« Reply #10 on: February 13, 2012, 02:43:32 am »


               <holding up a finger...>

Ah! But they *did* spasm when the script was running off a trigger. Well, 4 of them did. The ogre didn't spasm until I changed it to PlayAnimation.

Appearances... ogre elite and prismatic dragon (with purple aura). The half-elf? Elf? Erfs from the victims, er, contributors, and I have to go so I'm not opening the toolset tonight. :-/

All appearances are NPC models, none are dynamic.

They *all* spasm now, off script on creature using PlayAnimation instead of ActionPlayAnimation. That's the part that was throwing me, the only difference I can see is that APA puts the animation in the queue and PA puts it at the head of the queue. So, on those three models, there must have been some lurking action that was not completing.

<...actually, a thumb>
               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
Noogies!
« Reply #11 on: February 13, 2012, 06:36:03 pm »


               

Rolo Kipp wrote...

<just a bit...>

ehye_khandee wrote...

Gee thanks Mrs. Lugner.

*muttering "google this, google that..."*
...
"loud, wealthy and vulgar"?
Hey!
*I'm* not wealthy!

<...puzzled>



http://snltranscript.../77pnerds.phtml

^^^ some noogie history for ya ^^^


Lol, the character always spoke in such a suppressed voice and kinda nasally so I thought the spelling was diff (Lugner vs Loopner). *shrugs* It's all fun.
               
               

               


                     Modifié par ehye_khandee, 13 février 2012 - 06:37 .