Drugs

From Virtual World Web Wiki
Jump to: navigation, search

Scripts

Drug.js Stores the animations, UI, names and descriptions of the drug. This is the parent for the other components of the drug.

DrugEffect.js Stores the effects of the drug. Drug Effects references this to apply to overall drug effect.

DrugEffects.js Checks for all the Drug Effect scripts attached to the player and combines them into an overall drug effect. This script is cloned onto the player the first time they take a drug, and is used as a mangager for other effects.

Drugs.js Action provider for anything that can give drugs to the player.

DrugDealer.js Action agent for dealing drugs to the player.

Dependencies

DOM Structure

  • Dealer Object (Cash, Potted Plant, etc.)
    • DrugDealer Script
    • Drugs Script
      • Drug Object (e.g. Blunt)
        • Drug Script (e.g. Weed)
        • DrugEffects Script (For initial cloning)
        • Extra Effect (e.g. Smoke Particle)
        • Drug Effect Parent Object (e.g. Stoned)
          • DrugEffect Script

Object Types

Drug

Stores the animations, UI, names and descriptions of the drug. This is the parent for the other components of the drug.

Configuration

Property Type Description
DropDrugDescription String The tooltip description for dropping the drug
DropDrugIcon Resource The icon to display for dropping the drug
DrugEffectName String The name of the child DrugEffect (This must match the name of the child DOM Object)
DrugIdleAnimationName String The name of the animation to play while idling with the drug
DrugTakenAnimationEvent String The name of the event call when you start taking a hit of the drug
DrugTakenFinishedAnimationEvent String The name of the event call when you are done taking a hit of the drug
DrugUseEffectAnimationEvent String The name of the event call for when any extra effects should play (i.e. particles)
NumHitsAvailable Int32 The number of hits that are available before the drug is all used up
TakeDrugAnimationName String The name of the animation to play when you take a hit of the drug
TakeDrugDescription String The tooltip description for taking a hit of the drug
TakeDrugIcon Resource The icon to display for taking a hit of the drug
UIScript Resource The UI script that will be sent to the player when they first receive the drug
UseEffectDuration Single How long the base drug effect lasts for
UseEffectName String The name of the effect to use when taking the drug (Must match the name of the child DOM Object)

DrugEffect

Stores the effects of the drug. Drug Effects references this to apply to overall drug effect. This script is stored as a child to a DOM Object on the drug. The following values are stored on the parent of this script.

Configuration

Property Type Description
Bloom Single The level of bloom per hit
BlurredCorners Single The level of blurred corners per hit
ComeDownTimeSeconds Single The amount of time it takes to come down per hit (start from when you are done coming up)
ComeUpTimeSeconds Single The amount of time it takes to come up per hit
ContrastEnhance Single The level of contrast enhance per hit
Fisheye Single The level of fisheye per hit
IsDrugEffect Boolean A failsafe for when DrugEffects is looking for these values (should always be true)
MotionBlur Single The level of motion blur per hit
Noise Single The level of noise per hit
NumHitsAvailable Single The number of hits available for this drug
Saturation Single The level of saturation per hit
Shake Single The level of camera shake per hit
Vignette Single The level of vignette per hit
Wobble Single The level of wobble per hit
Wobble Single The speed of the wobble for this drug (will use the highest wobble speed of all drug effects)

DrugEffects

Checks for all the Drug Effect scripts attached to the player and combines them into an overall drug effect.

Configuration

Property Type Description
UIScript Resource The UI script used to apply to camera effects
UpdateIntervalSeconds Single The time it takes for the drug effects to update (in seconds)

Drugs

Action provider for anything that can give drugs to the player.

Configuration

Property Type Description
AppID String The name of the app id for saving free sample data (if the drug has a free sample offer)
IdleAnimation String The initial idle animation after receiving drugs from the dealer (TODO: This is fairly dependant on Weed, needs more generalization)
PickupAnimation String The animation to play when you are first receiving the drug
PickupAnimationEventName String The name of the event that is called when you are picking up the drug (used to clone the drug in the character's hand)

Current Functionality

When set up, The user should be able to:

  • Target anything that has the DrugDealer script on it and has the Property "DrugDealer"
  • Be presented with the opportunity to buy (or otherwise obtain) the drugs that are available
  • When a drug is selected, they will play an animation of receiving the drug, then a new UI will be added to perform actions with the drug
  • If the player chooses to take a hit of the drug, it will run through the animations of taking it, add the effect, and play any extra effects that come with the drug
  • If the player chooses to drop the drug, they will get rid of the drug, and lose any UI actions associated with that drug
  • If the drug is shareable, and they offer it to another player, it will prompt that player to take the drug. If they accept, the drug will be passed, otherwise nothing will happen
  • If the drug is shareable, and another player requests the drug, a prompt will appear to pass the drug. If it's accepted, the drug will be passed, otherwise nothing will happen

Future Functionality

  • Overall, the drugs system is a bit too specialized towards Weed. It would be nice to make it more generalized, or at least split the scripts into different drug types (smoke, pill, food, etc.)