# Advanced

Feels boring with normal guns?\
Ok I will show you how to make unique guns and make the game funnier!

## 1. Gun's Effects

### 1.1. How to add a new effects?

Effects can be added through 'special' section of any gun

For example:

```
  special: 
    can-pierce: <false/true>
    effect: <replaceme>
    hit-sound: <replaceme>
    droppable: <false/true>
    can-knockback: <false/true>
    effects:
    - '<replaceme>'
    ...
```

### 1.2. How to build an effect?

<details>

<summary>Format</summary>

```
<event>:<type>:<target>:<somethingrequired>
```

</details>

#### 1. Event

{% tabs %}
{% tab title="Introduce" %}
First, I will introduce about effect's event\
This help you determine in which situation this effect will be called!\
Currently available event: ON\_HIT, ON\_SHOOT, ON\_HOLDING
{% endtab %}

{% tab title="ON\_HIT" %}
Called while the bullet hit an entity (must be vulnerable)!

Available target:

* SELF
* ENEMY
* TEAMMATES\_IN\_RADIUS
* ENEMIES\_IN\_RADIUS
  {% endtab %}

{% tab title="ON\_SHOOT" %}
Called while player shoot a bullet!

Available target:

* SELF
* TEAMMATES\_IN\_RADIUS
* ENEMIES\_IN\_RADIUS
  {% endtab %}

{% tab title="ON\_HOLDING" %}
Called every 2 ticks while the player is holding this gun! (This mean you should not add too much "ON\_HOLDING" effects)

Available target:

* SELF
* TEAMMATES\_IN\_RADIUS
* ENEMIES\_IN\_RADIUS
  {% endtab %}
  {% endtabs %}

#### 2. Type

{% tabs %}
{% tab title="STATUS\_EFFECT" %}
This give the target some status, maybe negative, maybe positive!

Requirements (can be added after \<target>):

* Status
* Duration (in seconds)

Currently available status:

* FIRE

**Example**: ON\_HIT:STATUS\_EFFECT:ENEMY:FIRE:5\
**Explaination**: It will ignite the enemy 5 seconds on bullet hit.
{% endtab %}

{% tab title="POTION\_EFFECT" %}
This give the target some potion effects such as speed, haste!

Requirements (can be added after \<target>):

* Potion effect type
* Duration (in ticks)
* Amplifier
* Ambient (boolean)
* Particles (boolean)

Currently available Potion effects type:

* [1.8.8](https://helpch.at/docs/1.8.8/index.html?org/bukkit/potion/PotionEffectType.html)
* [1.12.2](https://helpch.at/docs/1.12.2/index.html?org/bukkit/potion/PotionEffectType.html)

**Example**: ON\_HIT:POTION\_EFFECT:SELF:SPEED:20:1:false:false\
**Explaination**: You will gain SPEED II for 20 ticks (1 sec) with no ambient and no particles on bullet hit.

{% hint style="info" %}
The seventh argument is ambient while the eighth is particles
{% endhint %}
{% endtab %}

{% tab title="INCREASE\_DAMAGE" %}
**INCREASE\_DAMAGE** is a special type exclusive for **ON\_HIT** event and it have different structure.

Structure: ON\_HIT:INCREASE\_DAMAGE:\<mode>:\<amplifier>

Available **mode**:

* DISTANCE

**Example**: ON\_HIT:INCREASE\_DAMAGE:DISTANCE:2\
**Explaination**: On bullet hit, damage will be increase by 2% per block
{% endtab %}
{% endtabs %}

#### 3. Target

{% tabs %}
{% tab title="SELF" %}
The effect will be applied only for **player** that execute this effect!
{% endtab %}

{% tab title="ENEMY" %}
Can only be used in **ON\_HIT** event!\
The effect will be applied for enemy!
{% endtab %}

{% tab title="AOE" %}
The effect will be applied for group of target in a radius!

Available:

* TEAMMATES\_IN\_RADIUS
* ENEMIES\_IN\_RADIUS

But this is just the start, AOE target require some more efforts\
You have to determine:

* Radius
* Center (Available: **SELF**)
* Target's Exception

For "**TEAMMATES\_IN\_RADIUS":**

It will look like: TEAMMATES\_IN\_RADIUS\_\<radius>\_\<center>\_\<include self (true/false)>\_\<include despawnable (true/false)>

**Example**: TEAMMATES\_IN\_RADIUS\_3\_SELF\_false\_false\
**Explaination**: All teammates in radius 3 around executor will be affected by this effect. (not include despawnable and executor too.)

For "**ENEMIES\_IN\_RADIUS":**

It will look like: ENEMIES\_IN\_RADIUS\_\<radius>\_\<center>\_\<include despawnable (true/false)>

**Example**: ENEMIES\_IN\_RADIUS\_3\_SELF\_false\
**Explaination**: All enemies in radius 3 around executor will be affected by this effect. (not include despawnable)
{% endtab %}
{% endtabs %}

{% hint style="info" %}
You cannot skip any effect's argument or that effect will not work!
{% endhint %}

### 1.3. Example

You think the guide above is quite complicated to understand? I will provide you some example:

<details>

<summary><strong>You want a gun that will slowdown when holding:</strong></summary>

```
ON_HOLDING:POTION_EFFECT:SELF:SLOW:2:1:false:false
```

</details>

<details>

<summary><strong>You want a gun that the farther the bullet flies, the less damage it does:</strong></summary>

Step 1: Set the gun damage to the maximum damage this gun can deal

```
damage: 20
```

Step 2: Add this effect

```
ON_HIT:INCREASE_DAMAGE:DISTANCE:-9
```

By doing so, if you shoot an enemy 5 blocks away, the damage will be reduced by 45%. And the damage now is 11.\
If the enemy is so far away and if the damage reduction value exceeds 100%, the damage will be set to 0.

</details>

## 2. Gun's particle (bullet's trail)

Advance particles include: REDSTONE, BLOCK\_CRACK, BLOCK\_DUST, ITEM\_CRACK (all of them were added since BETA-1.0.4!)

These particles require a new option called: particles-option (You can add it below 'particles'!)

{% tabs %}
{% tab title="REDSTONE" %}
Normally you only need 4 argument separated by a space to make it work!\
Format: 'false \<R> \<G> \<B>'\
But if you set the first argument to 'true', it require 7:\
Format: 'true \<R1> \<G1> \<B1> \<R2> \<G2> \<B2>' (Use this if you need transitional particles!)

**Example**:

```
particles: REDSTONE
particles-option: 'false 16 1 1'
```

{% hint style="info" %}
You can go to this [site](https://www.rapidtables.com/web/color/RGB_Color.html) for RGB color
{% endhint %}
{% endtab %}

{% tab title="Others" %}
Include **BLOCK\_CRACK, BLOCK\_DUST, ITEM\_CRACK**

Format: \<material> \<data>

**Example**:

```
particles: BLOCK_CRACK
particles-option: 'DIRT 0'
```

{% endtab %}
{% endtabs %}
