Files
HeroesStone_PRC8/_module/nss/tw_deer_wander.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

75 lines
2.6 KiB
Plaintext

/*
+= SCRIPT BY: John Cook =+
+= SUBMITTED BY: John Cook =+
I am submitting this script to make Deer or other animals wander around randomly. They will Flee from
all PCs or NPCs except Druids and Rangers (non-multiclass). to make it work:
Put this script in your onuserdefined event section on the model.
****************************************************************************
**********************************************************************
*/
//::///////////////////////////////////////////////
//:: Custom User Defined Event
//:: FileName
//:: Copyright (c) 2001 Bioware Corp. //:://////////////////////////////////////////////
/* Script to make Deer wander and flee from
Non-Druid or Ranger Class
*/
//:://////////////////////////////////////////////
//:: Created By: John Cook
//:: Created On: June 23, 2002 //:://////////////////////////////////////////////
//:: Good/Evil add by Thorsten Willert
void main()
{
int nUser = GetUserDefinedEventNumber();
int isFriend;
int Num;
float Distance;
location Loc;
object oPlayer;
int isEvil = GetAlignmentGoodEvil(oPlayer);
oPlayer = GetLastPerceived();
if(nUser == 1001) //HEARTBEAT EVENT
{
Num = Random(50);
Distance = IntToFloat(Num); //Distance to walk from location
Num = Random(10);
Loc = GetLocation(OBJECT_SELF);
if(Num >= 7)
{
ActionMoveAwayFromLocation(Loc,FALSE,Distance);
}
}
else if(nUser == 1002) // PERCEIVE EVENT
{
isFriend = GetClassByPosition(1,oPlayer);
if(isFriend != CLASS_TYPE_DRUID)
if(isFriend != CLASS_TYPE_RANGER)
if(isEvil = ALIGNMENT_EVIL)
{
ActionMoveAwayFromObject(oPlayer,TRUE,50.0f);
}
}
}
/*
****************************************************************************
**********************************************************************
The in the OnSpawn Event you MUST uncomment the following 2 Lines:
SetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT); //OPTIONAL
BEHAVIOR - Fire User Defined Event 1001
SetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT); //OPTIONAL
BEHAVIOR - Fire User Defined Event 1002
You will find these in the // CUSTOM USER DEFINED EVENTS section of the OnSpawn Event. just delete the 2 // in front of those lines to activate those events. Now you have a deer who will lazily wander around the forest and flee from approcahing PC's who are not of the woodland variety. (Druid or Ranger). I am working on more scripts and will submit some as I write them. Hope everyone finds this one useful.
John Cook
jvcomp@bellsouth.net
*/