RATDOG/_module/nss/ra_wererat_att2.nss
Jaysyn904 86a7f54ed3 Added DoA models
Added DoA models, Added ProjectQ lycanthropes & tails.  Added Colored Dyes.  Converted Ant Tunnels over to dynamic spawning.  Made PnP Giant Ants & Wererats.
2021-10-03 00:43:55 -04:00

72 lines
2.3 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name ra_wererat_att2
//:: Copyright (c) 2021 Project RATDOG
//:://////////////////////////////////////////////
/*
Wererat onAttack script. Changes from Dire
Rat for into Hybrid form.
*/
//:://////////////////////////////////////////////
//:: Created By: Jaysyn
//:: Created On: 2021-10-02
//:://////////////////////////////////////////////
#include "nw_i0_generic"
void main()
{
object oAttacker = GetLastHostileActor();
// if (!GetIsPC(oAttacker)) return; // removed for testing
object oRat;
oRat = OBJECT_SELF;
int iType = GetLocalInt(oRat, "WERERAT_TYPE");
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
int nInt;
nInt = GetObjectType(oRat);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), oRat);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), GetLocation(oRat));
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
nInt = GetObjectType(oRat);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_CHUNK_RED_MEDIUM), oRat);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_CHUNK_RED_MEDIUM), GetLocation(oRat));
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
nInt = GetObjectType(oRat);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_UNLOAD_MODEL), oRat);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_UNLOAD_MODEL), GetLocation(oRat));
object oSpawn;
object oTarget;
object oHybrid;
location lTarget;
oTarget = GetNearestObjectByTag("RA_WERERAT002"); // Gets location of wererat in animal form.
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "ra_wererat004", lTarget); // Spawns wererat in hybrid form.
oHybrid = oSpawn;
SetIsTemporaryEnemy(oAttacker, oHybrid);
AssignCommand(oHybrid, ActionAttack(oAttacker));
AssignCommand(oHybrid, DetermineCombatRound(oAttacker));
DestroyObject(oRat, 0.1f);
}