Jump to content

Home

scripting (adding hp to enemies)


smith11j

Recommended Posts

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?

Link to comment
Share on other sites

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.)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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);
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...