Difference between revisions of "Scripting Tutorial: Updating your leveled items"

m
Additional minor fixes.
imported>Qazaaq
m (some minor changes)
imported>ZuTheSkunk
m (Additional minor fixes.)
Line 131: Line 131:
player.additem IDofBetterItemOrLeveledList 1
player.additem IDofBetterItemOrLeveledList 1
endif
endif
endif
elseif ( player.getitemcount IDofAnotherLowLevelItem > 0 && LVL >= NumberOfLevelWhenPlayerShouldn'tHaveThisItem )
elseif ( player.getitemcount IDofAnotherLowLevelItem > 0 && LVL >= NumberOfLevelWhenPlayerShouldn'tHaveThisItem )
(...)
(...)
endif
endif
Line 185: Line 184:
player.additem IDofBetterItemOrLeveledList 1
player.additem IDofBetterItemOrLeveledList 1
endif
endif
endif
elseif ( player.getitemcount IDofAnotherLowLevelItem > 0 && LVL >= NumberOfLevelWhenPlayerShouldn'tHaveThisItem )
elseif ( player.getitemcount IDofAnotherLowLevelItem > 0 && LVL >= NumberOfLevelWhenPlayerShouldn'tHaveThisItem )
(...)
(...)
else
else
Line 196: Line 194:
</pre>
</pre>


Remember that in this version, this script will replace your item ONLY if you are currently possessing it while gaining a new level, because we have forced the script to block itself after completing his task and to not run again unless you have reached another level.
Remember that in this version, this script will replace your item ONLY if you are currently possessing it while gaining a new level, because we have forced the script to block itself after completing his task and to not run again unless you have reached another level (and this is only true if you added the part which checks player's level).


* To avoid this, you should also add this script to the '''item''':
* To avoid this, you should also add this script to the '''item''':
Line 210: Line 208:


"IDofTheQuest" is a ID name of the quest you have just created. This script will cause game to make quest script running whenever you add the item to your inventory.
"IDofTheQuest" is a ID name of the quest you have just created. This script will cause game to make quest script running whenever you add the item to your inventory.
<blockquote>If the item already has a script, you will have to append the above script. (Do not copy the first line "scn <Name of this script>", as the original script already has a name.) Note that this is not always a viable option, as only one mod can modify an item's script.</blockquote>


And this is all. Below you will find my example of complete script, to be absolutely sure that you have understood everything correctly.
And this is all. Below you will find my example of complete script, to be absolutely sure that you have understood everything correctly.
<blockquote>If the item already has a script, you'll have to append the above script. (Don't copy the first line "scn <Name of this script>", as the original script already has a name.) Note that this is not always a viable option, as only one mod can modify an item's script.</blockquote>
== Example of completed script ==
== Example of completed script ==


Anonymous user