| Author |
Sticky: Post
Working Scripts Here |
| Iruyun
|
Posted: Monday, 29 July 01:22AM |
Script Name: CannonDefense(Beta)
What it does; This script causes a placeable object with this script in
the "OnUsed" area, to fire flaming ball at the nearest enemy. If no
enemies are near, the script tells the player there aren't any enemies
near.
Bugs / Issues:
I don't know how to set the radius of this object, so if you have a 32
by 32 area, and you have an enemy 25 miles away, it will fire at it.
Thanks
Iruyun
NWScript: void main()
{
effect eFireball = EffectDamage(20, DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_NORMAL);
object oMonster = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, -1, -1, -1, -1);
if (GetIsEnemy (oMonster, OBJECT_SELF) == TRUE)
{
ActionCastSpellAtObject(SPELL_FIREBALL, oMonster, METAMAGIC_ANY, TRUE, 10, PROJECTILE_PATH_TYPE_BALLISTIC, FALSE);
ActionWait( 3.0);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eFireball, oMonster, 0.0f);
}
if (GetIsEnemy (oMonster, OBJECT_SELF) == FALSE)
{
ActionSpeakString("There are no enemies in the area.");
}
}
|
|