Difference between revisions of "LeveledItem"

From GECK

m (Leveled Item Options)
m (Moved Tes4 link down to the bottom under see also. Added AddItemToLeveledList.)
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
Link to TES4 Construction Set Wiki: [http://cs.elderscrolls.com/constwiki/index.php/Leveled_Item Leveled Item]
 
 
 
A leveled item is an example of a [[:Category:Leveled Lists|leveled list]].
 
A leveled item is an example of a [[:Category:Leveled Lists|leveled list]].
  
Line 9: Line 7:
 
These are the various settings that can be chosen on a leveled list of items:
 
These are the various settings that can be chosen on a leveled list of items:
  
*'''Calculate from all levels <= PC's level:''' If checked, the level list will use any item at or below the player's level in the list. If not checked, it uses the closest item or items to the player's level, but not exceeding it. The lower threshhold is governed by the [[iLevItemLevelDifferenceMax]] setting.
+
*'''Calculate from all levels <= PC's level:''' If checked, the level list will use any item at or below the player's level in the list. If not checked, it uses the closest item or items to the player's level, but not exceeding it. The lower threshhold is governed by the [[#Game_Settings|iLevItemLevelDifferenceMax]] setting.
 
*'''Calculate for each item in count:''' If this list is in another leveled list with a count greater than zero, this checkbox determines if each item in the count is the same, or is recalculated.
 
*'''Calculate for each item in count:''' If this list is in another leveled list with a count greater than zero, this checkbox determines if each item in the count is the same, or is recalculated.
 
*'''Use All:''' All the items on the list are added to the container or actor. If marked, this checkbox supercedes the other two.
 
*'''Use All:''' All the items on the list are added to the container or actor. If marked, this checkbox supercedes the other two.
Line 22: Line 20:
 
*'''Preview level:''' The assumed level of the player for the Preview Calculated Result button.
 
*'''Preview level:''' The assumed level of the player for the Preview Calculated Result button.
 
*'''Preview Count:''' The number of times the list should be generated for the Preview Calculated Result button.
 
*'''Preview Count:''' The number of times the list should be generated for the Preview Calculated Result button.
 +
 +
== Game settings ==
 +
 +
{{Setting
 +
|Name = iLevItemLevelDifferenceMax
 +
|Default = 0
 +
|Description = When this setting has a non zero value, it specifies the maximum level range that will be considered when selecting items from leveled lists which have the "Calculate from all levels <= PC's level" option enabled. It is not so easy to understand the behavior of this setting, so consider this example.
 +
 +
You have a leveled list with an item at level 1, an item at level 10, an item at level 20, and "Calculate from all levels <= PC's level" is checked. When the setting is 0 and the player is level 20, actors given items using this list have a 33% chance to select each item, or in other words all items from all levels are considered. If the setting is changed to 1, then only the level 20 item is considered (because the difference between the level 20 item and the level 10 item is more than 1). If the setting is changed to 10, there is a 50% chance to select the level 10 item and the level 20 item.
 +
 +
That example is fairly straightforward, but can be misleading. Change the player's level to 19, so that the level 20 item will no longer be considered. If the setting is still 10, there is now a 50% chance to select the level 10 item and the level 1 item! This is counterintuitive, but it is how the game works. It is considering the highest level item it can select from the list (which is level 10) and comparing it with items lower level than that in the list. In this case, 10 - 1 is 9, and because the setting is 10, the level 1 item is considered. If the setting is changed to 8, the level 1 item will no longer be considered.
 +
}}
  
 
== Notes ==
 
== Notes ==
Line 28: Line 38:
 
* Leveled items cannot be placed directly in the world. They can only be put into containers or actors.
 
* Leveled items cannot be placed directly in the world. They can only be put into containers or actors.
  
 +
== Scripted items with OnAdd blocks ==
 +
If a scripted item is added directly into an actor's inventory when the actor is spawned (by being present in the actor's inventory in the GECK or by being selected from a leveled list which is in the actor's inventory), the OnAdd block in the item script will not execute. There is a workaround for this, and it is to use a GameMode block and an OnAdd block.
 +
 +
<pre>short doonce
 +
 +
; gamemode block to execute on NPCs that spawn with this item
 +
begin GameMode
 +
  if doonce == 0
 +
      set doonce to 1
 +
 +
      ; Do what you would have done in the OnAdd block here too...
 +
  endif
 +
end
 +
 +
;conventional onadd block for when actors pick up the item after they are spawned
 +
begin OnAdd
 +
  if doonce == 0
 +
      set doonce to 1
 +
 +
      ; Stuff...
 +
  endif
 +
end
 +
</pre>
 +
 +
==See Also==
 +
*[[AddItemToLeveledList]]
 +
*Link to TES4 Construction Set Wiki: [http://cs.elderscrolls.com/constwiki/index.php/Leveled_Item Leveled Item]
  
 
[[Category:Items]]
 
[[Category:Items]]
 
[[Category:Leveled Lists]]
 
[[Category:Leveled Lists]]

Latest revision as of 10:36, 13 April 2009

A leveled item is an example of a leveled list.

Selecting an Item from the List

In a container, a leveled list chooses its item based on player level - depending on the settings (described below), either the item nearest in level to the player, or randomly any item at the player's level or lower. On an actor, however, things are more complicated. Here, the equipment that an actor gets is chosen based on the actor's level.

Leveled Item Options

These are the various settings that can be chosen on a leveled list of items:

  • Calculate from all levels <= PC's level: If checked, the level list will use any item at or below the player's level in the list. If not checked, it uses the closest item or items to the player's level, but not exceeding it. The lower threshhold is governed by the iLevItemLevelDifferenceMax setting.
  • Calculate for each item in count: If this list is in another leveled list with a count greater than zero, this checkbox determines if each item in the count is the same, or is recalculated.
  • Use All: All the items on the list are added to the container or actor. If marked, this checkbox supercedes the other two.
  • Chance None: The chance that the leveled list will not generate an item.
    • Use Global Allows you to select a Global to use for calculating the chance.
  • Object: New items are added by dragging them into the window. Selected items in the list are modfied with this pull down.
  • Level: The selected item's associated level is altered here.
  • Count: The number of items created if this item is chosen.
  • Owner: The owner of the object, overriding ownership by the container or actor.
  • Health: The health of the object as a percent.
  • Preview Calculated Result: Generates an example list of items that this list might generate.
  • Preview level: The assumed level of the player for the Preview Calculated Result button.
  • Preview Count: The number of times the list should be generated for the Preview Calculated Result button.

Game settings

iLevItemLevelDifferenceMax
Default value 0
Description When this setting has a non zero value, it specifies the maximum level range that will be considered when selecting items from leveled lists which have the "Calculate from all levels <= PC's level" option enabled. It is not so easy to understand the behavior of this setting, so consider this example.

You have a leveled list with an item at level 1, an item at level 10, an item at level 20, and "Calculate from all levels <= PC's level" is checked. When the setting is 0 and the player is level 20, actors given items using this list have a 33% chance to select each item, or in other words all items from all levels are considered. If the setting is changed to 1, then only the level 20 item is considered (because the difference between the level 20 item and the level 10 item is more than 1). If the setting is changed to 10, there is a 50% chance to select the level 10 item and the level 20 item.

That example is fairly straightforward, but can be misleading. Change the player's level to 19, so that the level 20 item will no longer be considered. If the setting is still 10, there is now a 50% chance to select the level 10 item and the level 1 item! This is counterintuitive, but it is how the game works. It is considering the highest level item it can select from the list (which is level 10) and comparing it with items lower level than that in the list. In this case, 10 - 1 is 9, and because the setting is 10, the level 1 item is considered. If the setting is changed to 8, the level 1 item will no longer be considered.

Notes

  • The Leveled List itself cannot have a script
    • Scripted items can be placed in a leveled list, however.
  • Leveled items cannot be placed directly in the world. They can only be put into containers or actors.

Scripted items with OnAdd blocks

If a scripted item is added directly into an actor's inventory when the actor is spawned (by being present in the actor's inventory in the GECK or by being selected from a leveled list which is in the actor's inventory), the OnAdd block in the item script will not execute. There is a workaround for this, and it is to use a GameMode block and an OnAdd block.

short doonce

; gamemode block to execute on NPCs that spawn with this item
begin GameMode
   if doonce == 0
      set doonce to 1

      ; Do what you would have done in the OnAdd block here too...
   endif
end

;conventional onadd block for when actors pick up the item after they are spawned
begin OnAdd
   if doonce == 0
      set doonce to 1

      ; Stuff...
   endif
end

See Also

Personal tools