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

83 lines
2.4 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Werewolf Actions
//:: WW_ACTIONS
//:://////////////////////////////////////////////
/*
Makes the beast act crazy, wander, attack
return to where they were infected.
*/
//:://////////////////////////////////////////////
//:: Created By: 69_Jeremy_69
//:: Created On: April 27, 2003
//:://////////////////////////////////////////////
//////////////////////
//:: Werewolf Sounds
//////////////////////
//:: Howl
//:: c_werewolf_bat2
//:: Growl
//:: c_werewolf_slct
//:: Bark
//:: c_werewolf_dead
//:: Bark, Howl
//:: c_werewolf_bat1
//:: Attack Barks
//:: c_werewolf_atk1
//:: c_werewolf_atk2
//:: c_werewolf_atk3
///////////////////////
void main()
{
// Get variables to store
string sID = GetName(OBJECT_SELF) + GetPCPublicCDKey(OBJECT_SELF);
// Check for werewolf effects
effect eWolf = GetFirstEffect(OBJECT_SELF);
effect eBug;
int nWolf = 0;
while(GetIsEffectValid(eWolf))
{
if(GetEffectType(eWolf) == EFFECT_TYPE_POLYMORPH ||
GetEffectType(eWolf) == EFFECT_TYPE_SILENCE)
{
nWolf++;
}
//if(GetEffectType(eWolf) == EFFECT_TYPE_DAMAGE_REDUCTION) eBug = eWolf;
eWolf = GetNextEffect(OBJECT_SELF);
}
//Make sure the creature is commandable for the round
SetCommandable(TRUE);
eWolf = EffectPolymorph(POLYMORPH_TYPE_WEREWOLF);
eWolf = EffectLinkEffects(eWolf, EffectSilence());
eWolf = SupernaturalEffect(eWolf);
// Do they still have the 2 effects? if not
if(nWolf != 2)
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eWolf, OBJECT_SELF);
}
// See who is in Command, if player is stop after this
int nCtrl = GetLocalInt(GetModule(), "WERE_CONTROL"+sID);
if(nCtrl) return;
//Clear all previous actions.
ClearAllActions();
int nRandom = d10();
//Roll a random int to determine this rounds effects
if(nRandom == 1 || nRandom == 10)
{
// Return to where they were bit
location loc = GetLocalLocation(OBJECT_SELF, "WEREWOLF");
ActionMoveToLocation(loc,TRUE);
PlaySound("c_werewolf_bat1");
}else if(nRandom >= 2 && nRandom <= 5){
ActionRandomWalk();
//PlaySound("c_werewolf_dead");
}else if(nRandom >= 6 && nRandom <= 9){
PlaySound("c_werewolf_slct");
ActionAttack(GetNearestObject(OBJECT_TYPE_CREATURE));
}
SetCommandable(FALSE);
}