I have an encounter where the spawn points are out of the line of sight of the player, and I then want the spawned creatures to move toward the party. A relatively simple way to do this is to take advantage of the "LastSeenOrHeard" object variable. I set the following script as the spawned creature's "SpawnScript" variable and add a local string variable on the creatures called "investigate" that contains a tag. (For example, a WayPoint tag.) The script looks for the nearest instance of that tag and sets the spawned creatures in motion toward that position.
/*
Obtain a tag variable from the subject called "investigate" and use
it to set the "LastSeenOrHeard" object. This should cause the subject
to move to investigate the location of the nearest object with that
tag.
*/
#include "hench_i0_ai"
void main()
{
object oPC = GetFirstPC();
string sInv = GetLocalString( OBJECT_SELF, "investigate" );
if ( GetStringLength( sInv ) ) {
object oInv = GetNearestObjectByTag( sInv );
if ( GetIsObjectValid( oInv ) ) {
SetEnemyLocation( oInv );
}
}
}
Anyway, it's a simple trick that seems to work. Once the spawned creatures begin combat the action is cleared.





Retour en haut







