I’m sorry I have to ask for help yet again. The thing with removing effects is something I still doesn’t understand that well when it comes to scripting. So, I have these creatures that I don’t want to die in a fight, thus I create a permanent knockdown effect when they have less then 15 hp left (and make them immortal). One of you guys here helped me with that when I was doing my second module, so I reused that script. I place code like this on OnDamage. They are all part of the same team so I gave them tags like “crew1” and “crew2”…
Here’s how the code for OnDamage looks at the moment, and it seems to work well:
int iHp = GetCurrentHitPoints(OBJECT_SELF);
object oCrew = OBJECT_SELF;
string sTag = GetTag(oCrew);
if (iHp < 15)
{
AssignCommand(oCrew, ClearAllActions(TRUE));
effect eFX = EffectKnockdown();
DelayCommand(1.f, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eFX, oCrew));
}
Then through a conversation I want the characters to rise up again, if they have been knocked down. I made a script like this (trying to look at other help I’ve had through the 2 years of me working with my modules) and it compiles but it doesn’t work, and I’m honestly not sure if the script does what I intend it to do:
void main()
{
effect eFX = EffectKnockdown();
object oCrew;
int nCrew = 1;
effect eSearch = GetFirstEffect(oCrew);
while (nCrew <= 5)
{
oCrew = GetObjectByTag("crew" + IntToString(nCrew));
while(GetIsEffectValid(eSearch))
{
RemoveEffect(oCrew,eFX);
eSearch = GetNextEffect(oCrew);
}
nCrew = nCrew + 1;
}
}
Last time I asked about this, but in another context and for my first module, people talked about giving the effect I used then a unique spell ID. Even though this is no spell, maybe I just need to do something like that? When looking at the explanation you guys gave of how to implement that, I still get confused, I’m sorry to say.