Forgive me this is probably really, really wrong. I was hoping to get some help with this.
This is my custom turn undead spell I have been working on. Basically what I’m trying to do is apply damage to the undead. The Damage increases by 5 each level for the cleric. So at level one it does 5 damage, at level two it does 10 at third level 15 so on and so on up to level 20. It stops at 20 because that is the max level for my server. There is no multi-classing on the server as well so I don’t think I need to check for cleric position. Also I can’t for the life of me figure out how this script is called from. Usually a script is called from on enter or an item or something. So I know this wrong in my script.
Any help with this would be greatly appreciated.
void main()
{
object A = GetFirstPC();
object B = GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,A);
SignalEvent(A, EventSpellCastAt(OBJECT_SELF, SPELLABILITY_TURN_UNDEAD));// not sure what this even does or whats its used for.But I saw it in the original turn undead script.
int P = GetHitDice( A);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(285), A);
if (P == 1)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(5 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 2)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(10 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 3)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(15 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 4)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(20 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 5)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(25 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 6)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(30 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 7)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(35 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P ==
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(40 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 9)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(45 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 10)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(50 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 11)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(55 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 12)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(60 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 13)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(65 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 14)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(70 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 15)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(75 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 16)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(80 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 17)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(85 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 18)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(90 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 19)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(95 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
if (P == 20)
{
location lTarget = GetLocation(B);
B = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(B))
{
if (GetIsEnemy(B, A)) AssignCommand(A,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(100 ,DAMAGE_TYPE_DIVINE),B,0.0));
if (GetIsEnemy(B, A)) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(50), B);
B = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_LARGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
}}}}}}}}}}}}}}}}}}}}}