HoS_PRC8/_mod/_module/nss/cv_grth_givjrnl.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

32 lines
971 B
Plaintext

void fnDespawn()
{ // PURPOSE: Despawn if PC not in range
object oMe=OBJECT_SELF;
object oPC=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oMe,1,CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC);
if (GetIsObjectValid(oPC))
{ // move away
AssignCommand(oMe,ClearAllActions(TRUE));
AssignCommand(oMe,ActionMoveAwayFromObject(oPC,TRUE));
DelayCommand(10.0,fnDespawn());
} // move away
else
{ // despawn
DestroyObject(oMe);
} // despawn
} // fnDespawn()
void main()
{
object oPC=GetPCSpeaker();
object oMe=OBJECT_SELF;
object oBook=GetItemPossessedBy(oMe,"it_grubbins");
int nGold=500;
if (GetLocalInt(oPC,"nParm")>0) nGold=450;
CreateItemOnObject("it_grubbins",oPC);
DestroyObject(oBook);
SetAILevel(oMe,AI_LEVEL_NORMAL);
AssignCommand(oMe,TakeGoldFromCreature(nGold,oPC));
AssignCommand(oMe,ActionMoveAwayFromObject(oPC,TRUE,80.0));
DelayCommand(30.0,fnDespawn());
}