Difference between revisions of "Unplayable Items"

155 bytes added ,  07:50, 24 June 2012
Byline removed
imported>GuidoBot
(+comment: Tokens in containers)
imported>QQuix
(Byline removed)
 
(6 intermediate revisions by 6 users not shown)
Line 1: Line 1:
==<font size=4>'''UNPLAYABLE ITEMS - AKA TOKENS'''</font>==


 
<!--Search words: tokens-->
By [[User:GuidoBot|GuidoBot]]




Line 14: Line 12:


===Properties of unplayable items===
===Properties of unplayable items===
How unplayable items are actually intended to be used in the CS is unclear. They could be used to prevent the player taking items off of bodies but it is unclear whether any actors actually have such items in the standard game(?). Certainly a base object marked unplayable cannot be placed in game for the player (or actor) to pickup.


The only real point of unplayable items is that they are not seen by the player, either in an actor's or player's inventory. Some other points about using an unplayable item on the player will be noted later. However, beyond this unplayable items behave pretty much like any other [non-persistant] item.
In the default game, unplayable items such as the Emperor's Robe and the Imperial Palace Guard armour are not checked as "playable", preventing the player from taking these items from the person when they are killed. Another example of armour which is flagged as unplayable is the armour belonging to Glenroy and Captain Renault in the original dungeon.  When Renault is killed, you can take her sword, but if you examine your corpse you are likely only to find a steel shortsword; you won't be able to take her Blades Armour, as this would unbalance the early game.


This is accomplished because unplayable items are not seen by the player, either in an actor's or player's inventory. Some other points about using an unplayable item on the player will be noted later. However, beyond this unplayable items behave pretty much like any other [non-persistant] item.


From here on unplayable items will be referred to as tokens. Here's a list of important token properties with respect to scripting:
From here on unplayable items will be referred to as tokens. Here's a list of important token properties with respect to scripting:


# 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.
# 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).
# Token variables are persistant, unlike scripted spells and abilities (which reset when the actor comes into scope (same cell) as the player, meaning any local variables are re-instantiated to 0).
# You can add a token remotely - i.e. to an actor not even in your cell, so long as it is a persistant ref.
# You can add a token remotely - i.e. to an actor not even in your cell, so long as it is a persistant ref.
# 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.
# 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).


===Creating an unplayable item===
===Creating an unplayable item===
# Choose any item in the game that has the Playable switch. These are  essentially clothing and weapons. Most favored choice seems to be a 0-value ring. It is unclear whether actors can equip an unplayable item but if you use a ring it probably will not matter and making it worth 0 gold means they will not be inclinded to put it on.
# Choose any item in the game that has the Playable switch. These are  essentially clothing and weapons. Most favored choice seems to be a 0-value ring. Actors can equip an unplayable item, but if you use a ring it probably will not matter and making it worth 0 gold means they will not be inclinded to put it on.
# Copy your choice by saving with a new unique ID. You probably want to use the actual name as a comment as to what the token effect will do, etc.
# Copy your choice by saving with a new unique ID. You probably want to use the actual name as a comment as to what the token effect will do, etc.
# Uncheck the Playable option.
# Uncheck the Playable option.
Line 154: Line 149:
'''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)
'''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)


'''Tokens in Containers''': It turns out that '''Unequip <item> 1''' does not appear to work when applied to actors to force them to not equip an item, even if they have it currently equipped. This means you cannot ensure that any ''valuable'' wearable item added to merchant will be available for sale (although it should always be available for pick-pocketing). The safest way to ensure such items show up for sale is to add them to a nearby vendor chest instead. Fortunately, this is an example of where adding a token to a container is more useful than adding it to an actor. [[User:GuidoBot|GuidoBot]] 15:00, 30 November 2006 (EST)
'''Tokens in Containers''': It turns out that '''Unequip <item> 1''' does not appear to work when applied to actors to force them to not equip an item, even if they have it currently equipped. This means you cannot ensure that any ''valuable'' wearable item added to merchant will be available for sale (although it should always be available for pick-pocketing). The safest way to ensure such items show up for sale is to add them to a nearby vendor chest instead. Fortunately, this is an example of where adding a (vendor) token to a container is more useful than adding it to an actor. [[User:GuidoBot|GuidoBot]] 15:00, 30 November 2006 (EST)


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