Difference between revisions of "LeveledItem"
Jump to navigation
Jump to search
Add information about scripted items with OnAdd blocks
imported>SnakeChomp (Document iLevItemLevelDifferenceMax behavior) |
imported>SnakeChomp (Add information about scripted items with OnAdd blocks) |
||
Line 40: | Line 40: | ||
* 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 by a leveled list directly into an actor's inventory when the actor is spawned (by being present in the actor's inventory in the GECK), any OnAdd blocks for the item script will not execute. There is a workaround for this, and it is to use a GameMode block like this. | |||
<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> | |||
[[Category:Items]] | [[Category:Items]] | ||
[[Category:Leveled Lists]] | [[Category:Leveled Lists]] |