Hi all. After some help I got from Tchos and KevL to complete this script, I now ask all of you
. The script compiles, and seems to be running good. Except the damage section. What it does: Another script spawns a SEF as warning. Then this one, which runs from hb, spawns another SEF like lightning, and if after the warning a member of the party didn't go away, should get some damage. All SEFs and hb running fine, but I don't know why I cannot make the damage to apply. It looks for distance between the OBJECT_SELF, which is the ipoint spawning the lightning SEF and a Faction Member. Or so I think I did...
#include "ginc_effect"
void main()
{
int bAlreadyCast = GetLocalInt(OBJECT_SELF, "CAST");
if(!bAlreadyCast)
{
//Applying SEF and sound.
ApplySEFToObject("sp_lightning_hit", OBJECT_SELF, 2.0f);
PlaySound("sff_electricexp", FALSE);
object oPC = GetFirstPC();
object oFM = GetFirstFactionMember(oPC, FALSE);
//Here we loop through party to see if anyone is near the lightning.
while (GetIsObjectValid(oFM))
{
if (!GetIsOwnedByPlayer(oFM))
{
float fDistance = GetDistanceBetween(OBJECT_SELF, oFM);
if (fDistance <= 3.0f)
{
effect eDamage = EffectDamage(12, DAMAGE_TYPE_ELECTRICAL,DAMAGE_POWER_ENERGY, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oFM);
}
}
oFM = GetNextFactionMember(oPC, FALSE);
}
SetLocalInt(OBJECT_SELF, "CAST", TRUE);
DestroyObject(OBJECT_SELF, 4.0f, FALSE);
}
}





Retour en haut







