# Addiction

{% tabs %}
{% tab title="Overview" %}
Introducing the twh\_addiction script, an advanced and customizable Drug Addiction System designed for use with the VORP framework. This script offers a comprehensive solution to simulate drug addiction and its effects within your game world. Unlock a wide array of features that can be tailored to your specific requirements.

**Key Features:**

1. **Full API Integration:** Seamlessly integrate the twh\_addiction script with other scripts to create a cohesive experience.
2. **Admin Commands:** Easily manage the script using the built-in admin commands.
3. **Customizable Addiction-Types:** Create your own addiction-types to cater to various in-game scenarios.
4. **Custom Drug Items and Animations:** Customize drug items and their associated animations for an immersive experience.
5. **Separated Addictions and Drugs:** Maintain flexibility and freedom by separating addictions and drugs from one another.
6. **Time-Modifier Configuration:** Adjust time-modifiers for each addiction type, allowing for potential reduced work times in future twh scripts.
7. **Effect Duration and Usage Settings:** Configure the duration of effects and the number of usages needed before an effect triggers for each addiction.
8. **Addiction Reset Upon Death:** Addictions will automatically reset after a player's character dies, offering a fresh start.

With the twh\_addiction script, you can provide your players with a realistic and engaging drug addiction experience. Create the perfect environment with custom items, addictions, and effects to suit your unique game world.
{% endtab %}

{% tab title="API" %}

#### Initialization

```lua
local AddictAPI = exports['twh_addiction'].AddictionAPI()
```

#### Usage

```lua
local addictCounter = AddictAPI.getCounter(addiction)
local allAddictCounter = AddictAPI.getAllCounter()
local onAddiction = AddictAPI.getOnAddiction(addiction)
local isOnDrug = AddictAPI.getIsOnDrug() -- returns the current drug
```

```lua
AddictAPI.setAddiction(addiction)                        -- set counter to config amount needed
AddictAPI.removeAddiction(addiction)                     -- set counter to 0
AddictAPI.removeIsOnDrug(addiction)                      -- remove drug effect
AddictAPI.setIsOnDrug(addiction)                         -- trigger drug effect
AddictAPI.increaseAddictionCounter(addiction,amount)     -- increase consumed counter with specific amount
AddictAPI.itemUsed(addiction,amount)                     -- if you config other items you can use this to define what addiction should be increased
```

#### Admin Commands

* setAddiction \[id]\[addiction]&#x20;
* removeAddiciton \[id]\[addiction]&#x20;
* removeOnDrug \[id]\[addiction]&#x20;
* setOnDrug \[id]\[addiction]
  {% endtab %}

{% tab title="Buy" %}
{% embed url="<https://twh-scripts.tebex.io/package/5296621>" %}
{% endtab %}
{% endtabs %}

## Instruction manual

### Installation

First execute the sql file which is in the zip folder (Will be changed in the future)

Add following line to your server.cfg or ressource.cfg:

* `ensure twh_addiction`

### Usage

The twh\_addiction script is designed primarily as a powerful resource for developers. To fully harness the potential of the twh\_addiction script, simply refer to the API documentation provided above. The API enables you to access various functionalities, customize addiction types, drug items, animations, and effects, and configure time-modifiers, effect durations, and other parameters as needed. By leveraging the twh\_addiction API, you can create unique and engaging gameplay scenarios that cater to your specific requirements and the needs of your players.
