PDA

View Full Version : Decrease maximum HP


Mindtwistah
06-15-2007, 09:42 AM
Is there a script to decrease the maximum HP of the PC with 5?
If it is, can someone write it down here?

tk102
06-15-2007, 10:30 AM
Just what you'd expect:void main() {
object oUnluckyChap=GetObjectByTag("sometag");
SetMaxHitPoints(oUnluckyChap, 5);
}

Mindtwistah
06-15-2007, 10:36 AM
Two questions, is this for K1 and what should I write in sometag?

Master Zionosis
06-15-2007, 10:42 AM
Two questions, is this for K1 and what should I write in sometag?

Yes the script will work for K1, most scripts do, only a few new functions introduced with K2 don't mwork in K2, and you replace "dometag" with the tag of the NPC ;)

stoffe
06-15-2007, 04:52 PM
Two questions, is this for K1 and what should I write in sometag?

If you want to reduce the max VP of the player character by 5 you can use GetFirstPC() instead of GetObjectByTag(), like:


void main() {
object oPC = GetFirstPC();
SetMaxHitPoints(oPC, GetMaxHitPoints(oPC) - 5);
}

swfan28
06-15-2007, 05:36 PM
If you want to make it a temporary effect use the script:
void main()
{
object oPC = GetFirstPC();
int iHP = GetMaxHitPoints(oPC) - 5;
int iDuration = "whateveryouwant";
effect eTempHP = EffectTemporaryHitpoints(iHP);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTempHP, oPC, iDuration);
}

Mindtwistah
06-15-2007, 05:44 PM
Thank you all for the scripts.

stoffe
06-15-2007, 05:49 PM
If you want to make it a temporary effect use the script:
void main()
{
object oPC = GetFirstPC();
int iHP = GetMaxHitPoints(oPC) - 5;
int iDuration = "whateveryouwant";
effect eTempHP = EffectTemporaryHitpoints(iHP);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eTempHP, oPC, iDuration);
}

This script would nearly double the hitpoints of the characters it is applied to though, not reduce it by 5, since you add a bonus of (MaxVP-5) to them for the duration of the effect.

(Also, duration needs to be a float value and not an integer.)

swfan28
06-15-2007, 06:22 PM
Originally Posted by stoffe
This script would nearly double the hitpoints of the characters it is applied to though, not reduce it by 5, since you add a bonus of (MaxVP-5) to them for the duration of the effect.

(Also, duration needs to be a float value and not an integer.)
Umm okay. I thought that the EffectTemporaryHitpoints() would set the hitpoints to a specified value, not add a bonus. The effect can't be used to decrease hitpoints then because it won't accept negative integers.