See if this does what you're looking for...
Assumptions made:
1) By 20 feet you meant 20 meters or two tiles.
2) Only creatures with the proper tag that are also inside the search radius should get hasted, not all in the area.
3) The haste should be permanent.
[nwscript]
// OnDamaged script
//::///////////////////////////////////////////////////
const string SEARCH_TAG = "random tag"; // the tag to look for goes here.
const float SEARCH_RADIUS = 20.0; // size of the search radius (in meters) goes here.
const int HASTE_THRESHOLD = 4; // number that must be within the radius to trigger haste.
void main()
{ ExecuteScript( "x2_def_ondamage", OBJECT_SELF );
object oDamager = GetLastDamager();
if( !GetIsPC( oDamager )) return;
location lDamager = GetLocation( oDamager );
effect eHaste = EffectHaste();
int iCount = 0;
object oFound = GetFirstObjectInShape( SHAPE_SPHERE, SEARCH_RADIUS, GetLocation( oDamager ));
while( GetIsObjectValid( oFound ))
{ if( (GetObjectType( oFound ) == OBJECT_TYPE_CREATURE) && (GetTag( oFound ) == SEARCH_TAG ))
SetLocalObject( OBJECT_SELF, "Hasted_" +IntToString( ++iCount ), oFound );
oFound = GetNextObjectInShape( SHAPE_SPHERE, SEARCH_RADIUS, GetLocation( oDamager ));
}
int bHasteHim = (iCount >= HASTE_THRESHOLD);
while( iCount > 0 )
{ string sVarname = "Hasted_" +IntToString( iCount-- );
if( bHasteHim ) ApplyEffectToObject( DURATION_TYPE_PERMANENT, eHaste, GetLocalObject( OBJECT_SELF, sVarname ));
DeleteLocalObject( OBJECT_SELF, sVarname );
}
}
[/nwscript]
Modifié par Axe_Murderer, 20 juillet 2011 - 01:28 .