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.

Conditional script please

Page: 1 of 1
 harIII
01-24-2010, 8:10 PM
#1
I need a script to find what level an NPC is, would anybody know of something that would work?
 moda
01-24-2010, 9:42 PM
#2
getlevelcreature command should be able to find the level of whoever it is used on
 harIII
01-24-2010, 11:12 PM
#3
Could I see some actual syntax, I can script all day long but only so long as I have a template to work with
 Star Admiral
01-25-2010, 12:19 AM
#4
Not too sure about the GetLevelCreature command. moda, could you tell me where you saw that? It isn't an in-game function.

harIII, you can use the GetHitDice() function. Something simple like this:

void main() {
object oTarget = GetFirstPC();
int nLevel = GetHitDice( oTarget );
// Do stuff...
}

- Star Admiral
 harIII
01-25-2010, 1:06 AM
#5
Does the "GetHitDice()" make a randomly generated number?
 moda
01-25-2010, 6:19 AM
#6
its what force powers such as Force storm use to set the levelcap to prevent the power from becoming one hit kill on everything when you go beyond level 10.
so i would assume that every level adds 1 to your hit dice which is then used as part of damage calculation or some such operation.


oh there is no getcreaturelevel, i must have misread setcreatureailevel sorry about that
 Darth_Rurik
01-25-2010, 8:50 AM
#7
Hit dice is actually a remnant from the D20 system that both Knights of the Old Republic and Dungeons and Dragons based games, like Neverwinter Nights, which of course shares the same basic game engine, use. When a character is created in D&D you're assigned a certain type of die based on your class, for instance a four sided die for wizards, and a ten sided die for barbarians.

These dice will determine your character's base hit points, which of course increase with constitution bonuses and levels, at first level you get the full possible amount, then at each level up you roll the dice to determine how many more hit points you earn.

That's where the term hit dice comes from, and why it's basically another way of saying level, because a level one creature would only have one hit die worth of HP, while a level ten creature would have ten.
 harIII
01-25-2010, 10:12 AM
#8
Ok, got it chief, I'll see if this does the trick.
Page: 1 of 1