Ran into some of OE/Bioware's code for these while hunting through their default script handlers for on_spawn() - they have things set up for a number of options in addition to the scripted waypoints- there are also "mobile animations" or "immobile animations" which keep your mobs or townsfolk from standing like statuaries. It would be pretty easy to adapt these to our purposes, but at what level do we want to have the builder specify it?
1. On the spawn point, as Local Variable settings, along with the other settings like spawn times and such.
2. On the spawn point, by choosing a particular spawn_in script which applies the animations to the spawned children.
3. On the creature blueprint itself, as local variables defined in the toolset.
Thinking about it again, we could make all of these work, though we should have an order of precedence for them, in case they disagree.
I'd also like to make flocking an option, though I've not had a chance to look at that code yet. That will be on my list of "if we have time" for this update.
NPC behaviours / animations
Moderators: ALFA Administrators, Staff - Technical
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
- Teric neDhalir
- Githyanki
- Posts: 1495
- Joined: Mon Jan 05, 2004 10:04 pm
- Location: Manchester UK
Well at the moment, with the default spawn-in script inside a wrapper of the ACR default spawn-in it's a bit tricky altering any of the settings. Unless adding lines from the default into a script based on the alfa default works?
I would prefer variables on the creature blueprint, personally, because I don't spawn everything.
TnD
I would prefer variables on the creature blueprint, personally, because I don't spawn everything.
TnD
- AcadiusLost
- Chosen of Forumamus, God of Forums
- Posts: 5061
- Joined: Tue Oct 19, 2004 8:38 am
- Location: Montara, CA [GMT -8]
- Contact:
For the update I'm pulling some of the default AI code out of our events- the question is which parts to leave in, in one way or another. Currently as I remember it, the default scripts all check for variables on the blueprint anyway- potentially you could set those in a customized version of the acf_cre_onspawn or on the blueprint itself, though you have to hunt for their (very minimal) documentation to do so currently.
Is it worth coding some handling to offer greater ease of use? ex: commented settings inside the acf_cre_onspawn which get applied to the creature by the ACR's functions?
For that matter, is having builders make alternate versions of acf_cre_onspawn.nss for use with some of their blueprints going to be our recommended method of setting AI & behaviour preferences (as we did in NWN1), or are we trying to keep the default acf_cre_onspawn in place, and have builders define a local string on the blueprint to point at their customizing script?
Is it worth coding some handling to offer greater ease of use? ex: commented settings inside the acf_cre_onspawn which get applied to the creature by the ACR's functions?
For that matter, is having builders make alternate versions of acf_cre_onspawn.nss for use with some of their blueprints going to be our recommended method of setting AI & behaviour preferences (as we did in NWN1), or are we trying to keep the default acf_cre_onspawn in place, and have builders define a local string on the blueprint to point at their customizing script?
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
With the HotU expansion, Bioware finally got smart and converted all their AI behavior options into a single integer bitmask. It's a vastly more effective way to implement boolean spawn in options than requiring custom script sets for every creature. The latter can lead to enormous clutter in the toolset and module bloat. IMO, it would be wise not to go down that road again.
That would be my preference..1. On the spawn point, as Local Variable settings, along with the other settings like spawn times and such.
Putting stuff like animations automatically in onspawn scripts leads to oddities and immersion breaking when DMing..
Having the ability to turn on looping and fireforget animations on your NPCs with a DM wand/GUI function would be awesome though.
Every time your PCs logged in to sit around in the inn and RP (which, lets face it is at least 30-50% of ALFA PCs behaviour) you could have completely new NPCs talking, a new bard on stage, that sort of thing..
On indefinite real life hiatus
[22:52] <Veilan> obviously something sinister must be afoot if a DM does not have his social security number in his avatar name!
[22:52] <Veilan> obviously something sinister must be afoot if a DM does not have his social security number in his avatar name!
- ç i p h é r
- Retired
- Posts: 2904
- Joined: Fri Oct 21, 2005 4:12 pm
- Location: US Central (GMT - 6)
I currently get persistent animation the following way:
Load gb_heartbeat_sp into the onSpawn
Then add this to your OnUserdefined:
Place down 2 waypoints and set them as walkable for the PC. Now put the 2 waypoints directly on top of each other.
The NPC will spawn in and perform their animation on the spot for as long as they are spawned.
This is the only way I could get animations to work,
Load gb_heartbeat_sp into the onSpawn
Then add this to your OnUserdefined:
Add sAnim1 to your NPC's variables and then include the animation name: forge01 (I've got a full list I'll post later).#include "ginc_wp"
const int EVENT_USER_DEFINED_PRESPAWN = 1510;
const int EVENT_USER_DEFINED_POSTSPAWN = 1511;
void main()
{
string sAnim1 = GetLocalString(OBJECT_SELF, "sAnim1");
int nUser = GetUserDefinedEventNumber();
if(nUser == EVENT_HEARTBEAT ) //HEARTBEAT
{
int iCurrentWP = GetCurrentWaypoint();
//ActionSpeakString("Debug", TALKVOLUME_TALK);
FaceAndPause(iCurrentWP, 10.0);
PlayCustomAnimation(OBJECT_SELF, sAnim1, 1, 0.5);
}
}
Place down 2 waypoints and set them as walkable for the PC. Now put the 2 waypoints directly on top of each other.
The NPC will spawn in and perform their animation on the spot for as long as they are spawned.
This is the only way I could get animations to work,

NPC Activities doesn't work in NWN2 and probably won't be updated given the author's other commitments (no longer working on NWN stuff at all). We've got scripted waypoints though:ç i p h é r wrote:There was a system called NPC Activities which allowed a builder to configure NPC behaviors (fire animations, scripts, etc) at various waypoints. It was a really neat system that I thought OE was going to package in with NWN2, but I forgot about it until now.
http://nwn2forums.bioware.com/forums/vi ... &forum=114
