UW2_PRC8/_module/nss/nw_g0_confuse2.nss
Jaysyn904 5197ad9a4d Initial upload
Initial upload
2023-09-25 20:24:01 -04:00

50 lines
1.7 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Confusion Heartbeat Support Script
//:: NW_G0_Confuse
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This heartbeat script runs on any creature
that has been hit with the confusion effect.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Sept 27, 2001
//:://////////////////////////////////////////////
void main()
{
//Make sure the creature is commandable for the round
AssignCommand(OBJECT_SELF, SetCommandable(TRUE));
//Clear all previous actions.
AssignCommand(OBJECT_SELF, ClearAllActions());
int nRandom = d10();
//Roll a random int to determine this rounds effects
if(nRandom == 1)
{
object enemy = GetFactionWorstAC(OBJECT_SELF, TRUE);
if (enemy == OBJECT_INVALID) {
GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE,OBJECT_SELF);
}
AssignCommand(OBJECT_SELF, ActionAttack(enemy));
}
else if (nRandom >= 2 && nRandom <= 6)
{
object enemy = GetFactionWeakestMember(OBJECT_SELF, TRUE);
if (enemy == OBJECT_INVALID) {
GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE,OBJECT_SELF);
}
AssignCommand(OBJECT_SELF, ActionAttack(enemy));
}
else if(nRandom >= 7 && nRandom <= 10)
{
object enemy = GetFactionMostDamagedMember(OBJECT_SELF, TRUE);
if (enemy == OBJECT_INVALID) {
GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE,OBJECT_SELF);
}
AssignCommand(OBJECT_SELF, ActionAttack(enemy));
}
DelayCommand(0.1, AssignCommand(OBJECT_SELF, SetCommandable(FALSE)));
}