Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Decrease maximum HP

Page: 1 of 1
 Mindtwistah
06-15-2007, 8:42 AM
#1
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, 9:30 AM
#2
Just what you'd expect:void main() {
object oUnluckyChap=GetObjectByTag("sometag");
SetMaxHitPoints(oUnluckyChap, 5);
}
 Mindtwistah
06-15-2007, 9:36 AM
#3
Two questions, is this for K1 and what should I write in sometag?
 Master Zionosis
06-15-2007, 9:42 AM
#4
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, 3:52 PM
#5
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, 4:36 PM
#6
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, 4:44 PM
#7
Thank you all for the scripts.
 stoffe
06-15-2007, 4:49 PM
#8
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, 5:22 PM
#9
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.
Page: 1 of 1