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.

scripting (adding hp to enemies)

Page: 1 of 1
 smith11j
11-16-2006, 8:22 PM
#1
Since I can't use KOTOR TOOL to adjust enemies hp (i don't want the weird bugs to occur) I guess I will have to script it then. Here is what I would like to do.

In KOTOR TOOL the location of this enemy is
KOTOR 2 > Rims > Modules > 101PER_s.rim > g_assassindrd002.utc (3746).

He has a Base HP of 9, Current HP of 9 and a Max HP of 8.
I would like to change this to 20 HP.

How would I do this?
 tk102
11-16-2006, 8:31 PM
#2
If you are having trouble using KotOR Tool, I would suggest using a GFF editor to modify the .utc. As you'd expect the field is named HitPoints. Once you make your changes, you can save the .utc to your override. Please note that this would affect all such assassin droids that are named g_assassindrd002.utc (as found in 101PER, 102PER, 103PER, 105PER, and 106PER.)
 stoffe
11-16-2006, 9:21 PM
#3
You can use the SetMaxHitPoints() script command to adjust the health an NPC/creature have.

However, keep in mind that for anyone with an autobalancer MultiplierSet higher than 0 the health set in the template is not what they will get in-game, but what will be used as multiplier in the autobalancer calculations. If you set it to 20 for an autobalanced creature they may end up with a lot more health in-game.
 smith11j
11-16-2006, 9:29 PM
#4
I have already set my autobalancer to 0 on everything. I was using KOTOR TOOL to adjust health but ran into problems. (like the droids that came in to kill COORTA, after the movie was playing they were actually there right next to me, but they didn't do anything. I thought I had to script to make sure that kind of thing doesn't happen.

So if I do use the SetMaxHitPoints() script command where do I put it?
In KOTOR TOOL under the g_assassindrd002.utc (3746)/scripts under the OnSpawn part. Or somewhere else?
 smith11j
11-17-2006, 8:49 PM
#5
I put in SetMaxHitPoints (20) on g_assassindrd002.utc (3746) under the OnSpawn part but it didn't seem to work. What am I doing wrong?
 stoffe
11-18-2006, 4:35 PM
#6
I put in SetMaxHitPoints (20) on g_assassindrd002.utc (3746) under the OnSpawn part but it didn't seem to work. What am I doing wrong?

You'll have to put it in a script that applies it to the droids in question. This can either be a script run from a dialog or a trigger that loops through all the droids in the area and makes the changes, or you can modify the onspawn AI event script of the droids to add that line.

If you want to handle them all from a single script you could do something like:
void main() {
object oNPC = GetFirstObjectInArea();
while (GetIsObjectValid(oNPC)) {
if (GetTag(oNPC) == "g_assassindrd01") {
SetMaxHitPoints(oNPC, 20);
}

oNPC = GetNextObjectInArea();
}
}


If you want to do it from the OnSpawn scripts you'll have to do something like this and save the script named exactly k_def_spn_t_none in order for it to be used by the droids:

void main() {
if ((GetModuleFileName() == "101PER") && (GetTag(OBJECT_SELF) == "g_assassindrd01")){
SetMaxHitPoints(OBJECT_SELF, 20);
}

ExecuteScript("k_def_spn_t_none", OBJECT_SELF);
}
Page: 1 of 1