Difference between revisions of "SetLevel"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Scanner
m
imported>Vswe
m (Added Search Terms)
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''Syntax:'''
'''Syntax:'''
  SetLevel iNewLevel, LevelToPCFlag, MinLevel (optional), MaxLevel (optional)
  SetLevel iNewLevel, LevelToPCFlag, MinLevel (optional), MaxLevel (optional)
'''Example:'''
SetLevel 10    ; sets the actor's level to 10
SetLevel 2, 1  ; sets the actor's level to PC+2
SetLevel 0, 1, 6, 0    ; sets the actor's level to PC+0, min 6, no maximum


For NPCs and Creatures, this function allows you to completely change their level as well as whether they are leveled to the player or not.
For NPCs and Creatures, this function allows you to completely change their level as well as whether they are leveled to the player or not.
Line 11: Line 7:
* LevelToPCFlag == 0 means that level is a straight level (also that Min and Max params are meaningless)
* LevelToPCFlag == 0 means that level is a straight level (also that Min and Max params are meaningless)


In Case an actor is auto-scaled via PCOffset-Flag set, the LevelToPCFlag == 0 is meaningless (doesn't work) and the level is always offset to the player's level.
If an actor has PCOffset-Flag set in the editor, the LevelToPCFlag == 0 is meaningless (doesn't work) and the level is always offset to the player's level.


MinLevel and MaxLevel correspond to the Calc Min and Calc Max settings on the NPC and Creature tabs in the editor.
MinLevel and MaxLevel correspond to the Calc Min and Calc Max settings on the NPC and Creature tabs in the editor.
Line 17: Line 13:
Calling SetLevel will also immediately recalc an actor's stats and equipment (as if the player just leveled up).
Calling SetLevel will also immediately recalc an actor's stats and equipment (as if the player just leveled up).


NOTE: This function can be called on the player and will change the player's level, but not any of his stats (and the world will not "level up" with the player until he goes through a loading door, or changes cells), so this is not recommended. Use [[AdvancePCLevel]] instead.
'''Example:'''
SetLevel 10    ; sets the actor's level to 10
SetLevel 2, 1  ; sets the actor's level to PC+2
SetLevel 0, 1, 6, 0    ; sets the actor's level to PC+0, min 6, no maximum


IMPORTANT: This function can cause crashes and is not considered safe ! It's just a matter of time or number of uses (prabability based) until it produces a crash. The best way to crash is to use it on an actor that is equipped with a bow. The other way is to use it very frequently.
==Notes==
*This function can be called on the player and will change the player's level, but not any of his/her stats (and the world will not "level up" with the player until he goes through a loading door, or changes cells), so this is not recommended. Use [[AdvancePCLevel]] instead.
*Although called on a reference, this function actually changes the value on the base actor (thus the base value on all references of that base actor).
*Using setlevel on an actor who carries a bow results in a CTD for both as a console command and in a script.
**To prevent this, first remove all bows, then use '''SetLevel''', then add the bows back. (see [[Walking through Items in an Inventory]] for more information)


==See Also==
==See Also==
[[AdvancePCLevel]]
* [[AdvancePCLevel]]
 


[[Category: Functions]]
[[Category: Functions]]
[[Category:Functions (CS)]]
[[Category: Functions (CS 1.0)]]
[[Category: Actor State Functions]]
[[Category: Actor State Functions]]
[[Category: Actor State Functions (CS 1.0)]]
[[Category:Actor Functions]]
[[Category:Actor Functions]]
[[Category:Actor Functions (CS 1.0)]]
<!-- Begin Search Terms
Set
level
End Search Terms -->

Latest revision as of 14:56, 20 June 2008

Syntax:

SetLevel iNewLevel, LevelToPCFlag, MinLevel (optional), MaxLevel (optional)

For NPCs and Creatures, this function allows you to completely change their level as well as whether they are leveled to the player or not.

  • LevelToPCFlag == 1 means that level is an offset to the player's level
  • LevelToPCFlag == 0 means that level is a straight level (also that Min and Max params are meaningless)

If an actor has PCOffset-Flag set in the editor, the LevelToPCFlag == 0 is meaningless (doesn't work) and the level is always offset to the player's level.

MinLevel and MaxLevel correspond to the Calc Min and Calc Max settings on the NPC and Creature tabs in the editor.

Calling SetLevel will also immediately recalc an actor's stats and equipment (as if the player just leveled up).

Example:

SetLevel 10     ; sets the actor's level to 10
SetLevel 2, 1   ; sets the actor's level to PC+2
SetLevel 0, 1, 6, 0    ; sets the actor's level to PC+0, min 6, no maximum

Notes[edit | edit source]

  • This function can be called on the player and will change the player's level, but not any of his/her stats (and the world will not "level up" with the player until he goes through a loading door, or changes cells), so this is not recommended. Use AdvancePCLevel instead.
  • Although called on a reference, this function actually changes the value on the base actor (thus the base value on all references of that base actor).
  • Using setlevel on an actor who carries a bow results in a CTD for both as a console command and in a script.

See Also[edit | edit source]