| Author |
Sticky: Post
Working Scripts Here |
| Knox Promethean
|
Posted: Wednesday, 10 July 03:17AM |
1. SummonLastHostileActor
2. Summons the last hostile actor to the mob so that the mob can attack
them with melee. I know, I know, I play too much EQ, but this was a fun
first script to write. Want to have some fun, and add a little shocker
for those rangers and wizards that like to attack from a distance? Call
this baby in your OnDamaged event script. BE SURE to leave your script
that makes the mob determine what to do, just call this to let the mob
get someone in close to beat on.
3. Just to make it fair, the attacker does get a WillSave of type Chaos
so that they hve a chance at possibly not getting summoned. So call the
function with the DC for the WillSave...the script explains it more in
the comments.
4. The script itself
NWScript: #include "NW_I0_GENERIC"
void SummonLastHostileActor(int nDC)
{
object oMe = OBJECT_SELF;
object oHostileMob;
string sSummonString;
effect eVis;
if(GetIsObjectValid(oMe))
{
oHostileMob = GetLastHostileActor(oMe);
if(GetIsObjectValid(oHostileMob))
{
if(GetDistanceToObject(oHostileMob) > 5.0)
{
if(nDC < 0) nDC = 0;
if(WillSave(oHostileMob, nDC, SAVING_THROW_TYPE_CHAOS, oMe) == 0)
{
sSummonString = "Get over here " + GetName(oHostileMob);
SpeakString(sSummonString);
eVis = EffectVisualEffect(VFX_FNF_SMOKE_PUFF);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis,
GetLocation(oHostileMob));
AssignCommand(oHostileMob, JumpToObject(oMe));
}
}
}
}
}
void main()
{
if(!GetFleeToExit())
{
if(!GetSpawnInCondition(NW_FLAG_SET_WARNINGS))
{
SummonLastHostileActor(d20(2));
if(!GetIsObjectValid(GetAttemptedAttackTarget()) && !GetIsObjectValid(GetAttemptedSpellTarget()))
{
if(GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL))
{
DetermineSpecialBehavior(GetLastDamager());
}
else if(GetIsObjectValid(GetLastDamager()))
{
DetermineCombatRound();
if(!GetIsFighting(OBJECT_SELF))
{
object oTarget = GetLastDamager();
if(!GetObjectSeen(oTarget) && GetArea(OBJECT_SELF) == GetArea(oTarget))
{
ActionMoveToLocation(GetLocation(oTarget), TRUE);
ActionDoCommand(DetermineCombatRound());
}
}
}
}
else if (!GetIsObjectValid(GetAttemptedSpellTarget()))
{
object oTarget = GetAttackTarget();
if(!GetIsObjectValid(oTarget))
{
oTarget = GetAttemptedAttackTarget();
}
object oAttacker = GetLastHostileActor();
if (GetIsObjectValid(oAttacker) && oTarget != oAttacker && GetIsEnemy(oAttacker) &&
(GetTotalDamageDealt() > (GetMaxHitPoints(OBJECT_SELF) / 4) ||
(GetHitDice(oAttacker) - 2) > GetHitDice(oTarget) ) )
{
DetermineCombatRound(oAttacker);
}
}
}
}
if(GetSpawnInCondition(NW_FLAG_DAMAGED_EVENT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1006));
}
}
|
|