Difference between revisions of "Unplayable Items"

354 bytes added ,  16:09, 19 October 2006
Extra comment/minor edits
imported>GuidoBot
m
imported>GuidoBot
(Extra comment/minor edits)
Line 23: Line 23:




# Unlike standard items, the token is never seen in the target's/player's inventory. (This essentially makes up for the fact that inventory items cannot be disabled.) This feature can be useful in itself without any script attached. For example, you can tag an actor to see if you have already 'hit' them before.
# Tokens are always specific to the actor they are applied to, even if that actor was created by PlaceAtMe. In contrast, spells and abilities are added to the base model. (All [new] actor references of the same base model inherit these effects when they respawn.)
# Tokens are always specific to the actor they are applied to, even if that actor was created by PlaceAtMe. In contrast, spells and abilities are added to the base model. (All [new] actor references of the same base model inherit these effects when they respawn.)
# Local variables are persistant. Scripted spell effects and abilities reset when the actor comes into scope (same cell) as the player, meaning any local variables are re-instantiated (to 0).
# Local variables are persistant. Scripted spell effects and abilities reset when the actor comes into scope (same cell) as the player, meaning any local variables are re-instantiated (to 0).
Line 28: Line 29:
# Token effect scripts are always active and the OnActivate block can be called when the actor is out-of-scope. This is not true of scripts on actors themselves.
# Token effect scripts are always active and the OnActivate block can be called when the actor is out-of-scope. This is not true of scripts on actors themselves.
# When [the marked actor is] in scope the GameMode block activates every frame. When out of scope the GameMode block triggers about every 30 seconds (?). Additionally it will always fire when the token is first added - meaning that you have an effective OnAdd method.
# When [the marked actor is] in scope the GameMode block activates every frame. When out of scope the GameMode block triggers about every 30 seconds (?). Additionally it will always fire when the token is first added - meaning that you have an effective OnAdd method.
# Unlike standard items, the token is never seen in the target's/player's inventory. (This essentially makes up for the fact that inventory items cannot be disabled.)
# Like spells, tokens can remove themselves or be removed from a calling script (very handy for instant or 1-time effects).
# Like spells, tokens can remove themselves or be removed from a calling script (very handy for instant or 1-time effects).


Line 45: Line 45:




===Token Script Example===
===Token scripting (example)===


Here's a very useful example. This token effect allows a merchant to initially have one of a set of items in their inventory for sale the first time you visit. It is attached as the script to the token (you just made), called VendorToken.
Here's a very useful example. This token effect allows a merchant to initially have one of a set of items in their inventory for sale the first time you visit. It is attached as the script to the token (you just made), called VendorToken.
Line 105: Line 105:
# Equipping a token on the player will make it appear that the token is equipped and will unequip an item of the same type, even though the item will not show up rendered or in the player's inventory. This can be useful BUT it will produce the usual item-equipped message spam.
# Equipping a token on the player will make it appear that the token is equipped and will unequip an item of the same type, even though the item will not show up rendered or in the player's inventory. This can be useful BUT it will produce the usual item-equipped message spam.


To give a player a token without causing any messages it is necessary to first add this to a container. (See '''Discussion'''.) However, since you cant be sure one exist it is best to use your own persistant actor, or shadow (see [[Remote Activators]]).
To give a player a token without causing any messages it is necessary to first add this to a container. However, since you cant be sure one exists near the player it is better to use your own persistant actor, or ''shadow'' (see [[Remote Activators]]).


  scn ImporterScript
  scn ImporterScript
Line 146: Line 146:




===Token Abuse===
===Token abuse===
Because tokens are always active make sure you dont add them repeatedly or to almost very NPC you meet (in-game). Sometimes using a spell, ability or other method to get your active script going is more appropriate.
Because tokens are always active make sure you dont add them repeatedly or to almost very NPC you meet (in-game). Sometimes using a spell, ability or other method to get your active script going is more appropriate.


Line 155: Line 155:


[[User: JOG|JOG]] may have released the first tokens ever in his proofs-of-concept, [[User:JOG#The_Generous Giant_of_Tamriel|The Generous Giant of Tamriel]] and [[User:JOG#Dagger_Mould|Dagger Mould]].
[[User: JOG|JOG]] may have released the first tokens ever in his proofs-of-concept, [[User:JOG#The_Generous Giant_of_Tamriel|The Generous Giant of Tamriel]] and [[User:JOG#Dagger_Mould|Dagger Mould]].
'''Timing/persistance issues''': Tokens on actors that are engaged in major activity, e.g. fighting, may not get executed predictably every frame. [[User:GuidoBot|GuidoBot]] 16:09, 19 October 2006 (EDT)




[[Category: Useful Code]]
[[Category: Useful Code]]
Anonymous user