Jump to content

Home

Heal whole party script


StrangeJ

Recommended Posts

How would you heal the whole party from a script?

 

I looked at the force heal script, but couldn't get my head round it (haven't been scripting for more than a day :)) Also I guess it would be relative, while I need to heal the party fully...

Link to comment
Share on other sites

something like this maybe:

 

void main()
{
int i;
object oPartyMember;
for (i = 0; i<3;i++)
{
	oPartyMember = GetPartyMemberByIndex(i);
	if ( GetIsObjectValid(oPartyMember))
	{
		ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oPartyMember)),oPartyMember);
	}
}
}

Originally posted by StrangeJ

Also I guess it would be relative, while I need to heal the party fully...

 

Uh.. what do you mean?

Link to comment
Share on other sites

I meant, by relative, it would e.g +10 instead of setting it to 10...

 

Thanks, I'll try later (at the moment pc is going so s l o w :( )

 

Edit:

 

How would I change this line (from above) to give max force?

 

ApplyEffectToObject(DURATION_TYPE_INSTANT,  EffectHeal(GetMaxHitPoints(oPartyMember)),oPartyMember);

Link to comment
Share on other sites

Originally posted by StrangeJ

I change this line (from above) to give max force?

 

like this:

 

ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHealForcePoints(GetMaxForcePoints( oPartyMember)), oPartyMember);

 

(btw.. it's one line text. )

 

Edit tk102: Xcom, if you put spaces after paranthesis and commas, then these forums won't be as likely to linebreak your code in mid-word. That's a trick that took me awhile to realize. Also using the [ size=1] tag can help.

Link to comment
Share on other sites

You're welcome. :)

 

Edit tk102: Xcom, if you put spaces after paranthesis and commas, then these forums won't be as likely to linebreak your code in mid-word. That's a trick that took me awhile to realize. Also using the [ size=1] tag can help.

 

Ah! Good to know. Thanks for the info, tk.

Link to comment
Share on other sites

I think this should work also:

 

 

// a_healparty

// This script heals everyone in the current party.

void main() {

 

object obj = GetFirstPC();

while( GetIsObjectValid( obj ) ) {

ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(obj) - GetCurrentHitPoints(obj)),obj);

obj = GetNextPC();

}

}

 

 

Darthy

Link to comment
Share on other sites

Can I ask something?

Is it possible to make a frce power that would heal all non-hostiles in your vicinity?

 

Like for instance in the mandalorian camp - that battle with the Sith asasins.

A power that would heal any party member or mandalorian in a given radius.

Link to comment
Share on other sites

Originally posted by Ellderon

Can I ask something?

Is it possible to make a frce power that would heal all non-hostiles in your vicinity?

 

Like for instance in the mandalorian camp - that battle with the Sith asasins.

A power that would heal any party member or mandalorian in a given radius.

 

I believe a script like this should do the trick if attached to a force power in spells.2da. It will heal all non-hostiles within a 30m radius.

 

// ST: st_healnoenemies.nss

// ----------------------------------------------------------
// ST: Heal all non-hostiles within selection range (30 m).
//     Amount to heal is equal to half of the force user's
// 	level plus cha/wis modifiers plus Treat Injury skill.
// ----------------------------------------------------------
void main() {
int nDiff;
int nHealAmount = GetHitDice(OBJECT_SELF) / 2;
nHealAmount += GetAbilityModifier(ABILITY_WISDOM);
nHealAmount += GetAbilityModifier(ABILITY_CHARISMA);
nHealAmount += GetSkillRank(SKILL_TREAT_INJURY, OBJECT_SELF);

location lLoc = GetLocation(OBJECT_SELF);

effect eHeal;
effect eVis =  EffectVisualEffect(VFX_IMP_HEAL);

object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, 30.0, lLoc, FALSE, OBJECT_TYPE_CREATURE);

while (GetIsObjectValid(oTarget)) {
	if (!GetIsEnemy(oTarget) && (GetRacialType(oTarget) != RACIAL_TYPE_DROID)) {
		nDiff = GetMaxHitPoints(oTarget) - GetCurrentHitPoints(oTarget);
		if (nDiff > 0) {
			eHeal = EffectHeal((nHealAmount > nDiff ? nDiff : nHealAmount));

			SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE));
			ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget);
			ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
		}
	}
	oTarget = GetNextObjectInShape(SHAPE_SPHERE, 30.0, lLoc, FALSE, OBJECT_TYPE_CREATURE);
}
} 
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...