Script for Dancing?

I’m working on a new module where there is a celebration. I want the NPCs in the background to dance about. I’ve seen this in several other modules and I used to have the script for it. But I’ve looked for it and can’t find it. Any help would be appreciated.

Maybe check the Additional Animations or Kemo Custom Animations.

https://neverwintervault.org/project/nwn1/hakpak/original-hakpak/additional-animations

https://neverwintervault.org/project/nwn2/script/kemo-custom-animations-v2

Tsongo

10d

And this is very important it makes people dance !

void main()
{
int nRandom=Random(2);
if (nRandom==0)
{
PlayCustomAnimation(OBJECT_SELF,"dance02",1);
}
else
{
PlayCustomAnimation(OBJECT_SELF,"dance01",1);
}
}

Goes on the heartbeat of an npc.

Does this work?

The script won’t work without custom animations. Try this.

This is from my Dark Energy module:

1 Like

Find a dancer with animation in Rogues of Quinn 5, in the Harbour Tavern. (It uses the same animation pack, but has different scripting).

While I very much appreciate everyone’s response - due to multiple bad experiences with haks in the past, I personally never use haks in my modules. (That’s just me. Nothing against the amazing work of many hak creators.)

The script I’m talking about was very simple and just used the standard animations - no Haks required. IIRC, it was an OnHeartbeat script, randomize, that used the ActionPlayAnimation (ANIMATION_FIREFORGET_) command with many of the various animations.

I mean the dancing wasn’t elegant - more like a mosh pit type of dance - but it worked. Like I said, it was a fairly simple script. I would try to recreate it, but I’m just not that good at scripting.

You can merely extract what you want out of any given hak (such as say, the scripts) using the hakpak editor, I’ve been doing this a fair bit myself as I pare down the CEP to just the things I think I will generally use.

1 Like

While that is true for some things, there are things that you can’t pull from a hak to your module and have them work. Models for example. You can merely extract what you want to your own hak but that doesn’t help the OP not have any haks :slight_smile:

Absolutely, but the context we were speaking in here is scripts.

Well, no… the stuff offered above requires animations hence haks. And the OP said no to haks so taking things out of haks to solve that problem doesn’t really work in the context above. In my opinion taking scripts out of haks should not be needed anyway as scripts in haks is an offense to nature…

For what it’s worth Olander’s AI has a stripper dance script that uses the base animations. If you put that in a HB script and pull out the stuff about creating and equipping different items of clothing it would approximate just dancing. A bit spasmodically maybe… I could not find a link to it though. Only to Olander’s Realistic systems which comes up in a search for olander or oai on the vault.

To quote the OP:

I honestly don’t know how you’d manage something like that with the standard animations but I’ve seen some pretty nuts stuff done on this engine so.

Ok - Imagine these animations strung together at random - Victory3 - Dodge_Duck - Spasm - Victory1 - Victory2 - Dodge_Side - and so on.

It looks more like someone just rocking out in a mosh pit rather than some elaborate dance. Which is what I want. In the module it is supposed to be a rowdy celebration, not an elegant ballroom waltz.

If you weren’t looking for a specific script but just how to do this @tfunke 's example there is a good starting point.

This was a specific script. I have seen it used in several different modules before. Although it has been some time and I couldn’t tell you which particular modules at this point. I did try to go back and find it - but had no luck.

And as I said earlier - I’m a pretty lousy scripter. It took me almost a week just to figure out how to have an NPC walk up and start a conversation. And that was done through pretty much trial and error.

Here is the function I was talking about with the stripping stuff removed. Although there are still some animations left over you may want to adjust. Put this above your main() in the NPCs HB and add
Dancing(OBJECT_SELF); near the bottom of the HB main routine. You can then adjust the various animations as you see fit. I have not tested this… I suspect it looks a bit … odd.

void Dancing(object oNPC)
{
	int nDance = GetLocalInt(oNPC,"DANCING");
  	if(nDance == 1) return;

	SetLocalInt(oNPC,"DANCING",1);

	ActionPlayAnimation(ANIMATION_FIREFORGET_TAUNT,1.0);
	ActionPlayAnimation(ANIMATION_FIREFORGET_BOW,1.0);

  	//continue dancing
	ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY2,1.0);
  	ActionPlayAnimation(ANIMATION_FIREFORGET_BOW,1.0);
  	//ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0);
  	ActionPlayAnimation(ANIMATION_LOOPING_CUSTOM19, 1.0, 5.0);
  	ActionPlayAnimation(ANIMATION_LOOPING_WORSHIP,1.0);

  	//continue dancing
  	ActionPlayAnimation(ANIMATION_LOOPING_WORSHIP,1.0);
  	ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0);
  	ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY2,1.0);
  	ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0);
  	//ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0);
  	ActionPlayAnimation(ANIMATION_LOOPING_CUSTOM19, 1.0, 5.0);

  	//continue dancing
  	ActionPlayAnimation(ANIMATION_LOOPING_TALK_FORCEFUL,1.0);
  	ActionPlayAnimation(ANIMATION_FIREFORGET_BOW,1.0);
  	//ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0);
  	ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0);
  	//ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0);
  	ActionPlayAnimation(ANIMATION_LOOPING_CUSTOM19, 1.0, 5.0);

	//more dancing
  	ActionPlayAnimation(ANIMATION_FIREFORGET_TAUNT,1.0);
  	ActionPlayAnimation(ANIMATION_LOOPING_WORSHIP,1.0);
  	ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY2,1.0);
  	ActionPlayAnimation(ANIMATION_LOOPING_CUSTOM19, 1.0, 5.0);
  	ActionPlayAnimation(ANIMATION_FIREFORGET_BOW,1.0);

   	ActionDoCommand(SetLocalInt(oNPC,"STRIPPING",0));
}

I do remember the dance script you are talking about but I’m not finding it. May try searching the Omnibus…

1 Like

I’m no scripter either. In case you don’t know how to add this script below to your module, I’ll explain the steps.

  1. Copy and paste what is inside the quoted box below and only what is inside of it.

  2. It has been 20+ years since I have seen the nwn1 toolset, but find in there where you can create a new script and copy the below into there. Then click “compile” to compile the script into your module. Also remember what name you gave the script.

  3. Click on your NPC that you want to dance and you should find somewhere in the properties tab for the NPC, a section called “on_heartbeat” or something like that.

  4. Add whatever you named the script above that compiled, into the “on_heartbeat” section.

  5. save and test it out to see if your NPC now dances.

EDIT: PS- when naming your script, I recommend using all lowercase, no spaces and less than 15 characters in length. Though this may not be essential, best do it to be safe. Perhaps something simple like “npc_dancing”

void main()
{
int nRandom=Random(2);
if (nRandom==0)
{
PlayCustomAnimation(OBJECT_SELF,"dance02",1);
}
else
{
PlayCustomAnimation(OBJECT_SELF,"dance01",1);
}
}

[/quote]

Don’t give up! There are a lot of people her who will help you.

Agreed. I can understand that bad experiences make the OP wary, but, really, almost everyone here uses haks, there are no significant problems these days, and they open up far more options for custom content without resorting to dodgy kludges like overrides.

Biggest problem in that regard is 2da collissions/having to merge 2das. Time consuming but not hard IME, but I can’t blame people whom don’t want to be bothered with it.

[edit]: Also it occurs to me it can be a fun challenge to see what you can accomplish with only vanilla NWN.