View Single Post
Old 06-04-2012, 01:53 PM   #258
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 555
Quote:
Originally Posted by Darth InSidious View Post
trying to eliminate an issue whereby if the player loses, the set of enemies who were in the arena before remain there in the next round.
(This is for KOTOR2, not sure if it works for KOTOR1, not sure why it shouldn't)
Try opening the module.ifo or the area, then under Mod_OnPlrDeath add a custom script.
In that script handle resurection and deletion of enemies.
Modified slightly from Visas training in TSLRCM, and untested, but you'll get the idea from it what I am intending;
(Also note the script counts for the entire area, so if it's used outside of the arena, add in a check the area fight is undergo. In this example the > and < global checks.)
Code:
void ST_PartialHeal(object oTarget, float fHealPercent=1.0, int bRes=TRUE);
void ST_RemoveHarmfulEffects(object oTarget=OBJECT_SELF);

void main() {
	if ((GetGlobalNumber("000_TATARENA") > 0) && GetGlobalNumber("000_TATARENA") < 4) {
		ST_PartialHeal(GetLastPlayerDied());
		if (GetGlobalNumber("000_TATARENA") == 1) {
			DestroyObject("ArenaTug1", 0.0, 0, 0.0, 0);
			DestroyObject("ArenaTug2", 0.0, 0, 0.0, 0);
			DestroyObject("ArenaTug3", 0.0, 0, 0.0, 0);
		}
		elseif (GetGlobalNumber("000_TATARENA") == 2) {
			DestroyObject("ArenaTug4", 0.0, 0, 0.0, 0);
			DestroyObject("ArenaTug5", 0.0, 0, 0.0, 0);
			DestroyObject("ArenaTug6", 0.0, 0, 0.0, 0);
		}
		else {
			DestroyObject("ArenaTug7", 0.0, 0, 0.0, 0);
			DestroyObject("ArenaTug8", 0.0, 0, 0.0, 0);
			DestroyObject("ArenaTug9", 0.0, 0, 0.0, 0);
		}
		ExecuteScript("k_nextwave", GetArea(GetFirstPC()), 201);
	}
}

void ST_PartialHeal(object oTarget, float fHealPercent=1.0, int bRes=TRUE) {
    if (bRes)
        ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(100), oTarget);
        
    int iHeal = FloatToInt(IntToFloat(GetMaxHitPoints(oTarget)) * fHealPercent);
    int iForce = FloatToInt(IntToFloat(GetMaxForcePoints(oTarget)) * fHealPercent);
    
    ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(iHeal), oTarget);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHealForcePoints(iForce), oTarget);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_HEAL), oTarget);
    
    ST_RemoveHarmfulEffects(oTarget);
}

void ST_RemoveHarmfulEffects(object oTarget=OBJECT_SELF) {
    effect eEff = GetFirstEffect(oTarget);
    int nType;
    
    while (GetIsEffectValid(eEff)) {
        nType = GetEffectType(eEff);
        if ((nType == EFFECT_TYPE_POISON)   
            || (nType == EFFECT_TYPE_PARALYZE)
            || (nType == EFFECT_TYPE_STUNNED)
            || (nType == EFFECT_TYPE_FRIGHTENED)
            || (nType == EFFECT_TYPE_SLEEP)
            || (nType == EFFECT_TYPE_ABILITY_DECREASE)
            || (nType == EFFECT_TYPE_ATTACK_DECREASE)
            || (nType == EFFECT_TYPE_AC_DECREASE)
            || (nType == EFFECT_TYPE_MOVEMENT_SPEED_DECREASE)
            || (nType == EFFECT_TYPE_SAVING_THROW_DECREASE)
            || (nType == EFFECT_TYPE_DAMAGE_DECREASE)
            || (nType == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE)
            || (nType == EFFECT_TYPE_FORCE_RESISTANCE_DECREASE)
            || (nType == EFFECT_TYPE_SKILL_DECREASE)
            || (nType == EFFECT_TYPE_BLINDNESS)
            || (nType == EFFECT_TYPE_ENTANGLE)
            || (nType == EFFECT_TYPE_CONFUSED)
            || (nType == EFFECT_TYPE_DROID_CONFUSED)
            || (nType == EFFECT_TYPE_DROIDSCRAMBLE)
            || (nType == EFFECT_TYPE_MINDTRICK))
        {
            DelayCommand(0.1, RemoveEffect(oTarget, eEff));
        }
        eEff = GetNextEffect(oTarget);
    }
}
Hassat Hunter is offline   you may: quote & reply,