# Invector Templates

## Asset Location

{% hint style="info" %}

## &#x20; [**Basic Template**](https://assetstore.unity.com/packages/templates/systems/third-person-controller-basic-locomotion-template-59332) **|** [**Melee Template**](https://assetstore.unity.com/packages/templates/systems/third-person-controller-melee-combat-template-44227) **|** [**Shooter Template**](https://assetstore.unity.com/packages/templates/systems/third-person-controller-shooter-template-84583?aid=1100lHT6)&#x20;

{% endhint %}

![](https://lh5.googleusercontent.com/pLVgq2-dNMHjq4BuVczgvrXRal3mnvMUrKbBvYbhmDkzvyCon_pB7EFPrSVZYVEWu_O838vpRMh8OrRNhqc5bJdUPDFWfvAmk0UN76Dn3AThwBXEfAYwLyyHf_zcPiiX9fQdpIp8)

{% hint style="info" %}

### Remember to have both packages on your project installed correctly. Use always the latest verions

{% endhint %}

## <mark style="color:orange;">**IMPORTANT CHANGES (Only version 4.4.9a HAP)**</mark>

New Settings to be Aware:&#x20;

&#x20;Change the Input Value from \[F] to \[E] to match the mounting UI&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FBoQny4fXMRuGQPCN3WT5%2FUnity_kWu9BTzCMx.png?alt=media&#x26;token=6f644412-292e-4cd1-884c-db69c020ab09" alt=""><figcaption></figcaption></figure>

Weapon Manager -> External -> Ignore Parent weapon to **True**. Invector is the one Parenting the Weapons, not me (Malbers scripts)

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FVEAPvf8lQKaiBQA9LxSk%2FUnity_pnTYFvmBCS.png?alt=media&#x26;token=8afaa61f-34e6-457d-9574-df4a4592f9a1" alt=""><figcaption></figcaption></figure>

Rider -> Set Collider Modifier to **is Trigger** and Right Click to **Internal Colliders -> Find Internal Colliders**

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FgQ134BG7Nihyx2CvewpF%2FUnity_kOkGGIwVNB.png?alt=media&#x26;token=5131af84-d80c-41df-8dd9-6063b00943fc" alt=""><figcaption></figcaption></figure>

***

## **Install the Integration Package**

**1.-** Download from the[ **Integration Drive Folder** ](https://drive.google.com/drive/folders/0B3A6xDqyh3aYcFBjRTBIdWVFU1E?resourcekey=0-AOW96xpkf053CSFX1gEJtw\&usp=sharing)the package of the Template you own (Basic, Melee, or Shooter).&#x20;

**2.-**  Install/Drop the **unitypackage** to your project.

{% hint style="success" %}
You can test the Integrations **Demo Scenes** on each Template Folder:&#x20;
{% endhint %}

<mark style="background-color:yellow;">**`Malbers Animations/Horse AnimSet Pro/Integrations/Invector`**</mark>

![](https://lh5.googleusercontent.com/uBDG7g42NiFIwJZ_0OiTM_MmMW9tNjDqO_F6_bp8eOqBvu0Sxe3y1Cph1wcMcmAJJzGemZ_FW60jWmRjPLnrwfMCOcf-0UQiyCCNEoBpRqfdeb5cLH0HHnaPEBqKisl8NJA6Rokq)

{% hint style="warning" %}
**IMPORTANT:**\
As part of the integration package all Invectors weapons **prefabs** that can be used with HAP, are modified and they have a **MWeapon** component; so they can be recognized by the Riding Combat System.
{% endhint %}

![](https://lh6.googleusercontent.com/NFsk8F-QZTT7Qcj53jEq9w98zXiBWT84dlZVr-ooEVmM5ghBlo0EeleaIZAlEuotaaxVp5_3Zo_zItWUV1RAOXifVdvOolWBIKdjmDwY4qzSZF5LnU9S_kzr1p9xuqQGjtL0JCsv)

## **General Integration Steps**

{% hint style="info" %}
If you want to check how the final integration with the **Basic Template**: open the Demo Scene: **v3rdPersonController - HAP**  on the HAP Integration Folder.
{% endhint %}

To create a new integration from scratch you need to do the following steps...&#x20;

#### These steps are also included in the **Melee Template** and the **Shooter Template**, but with small changes.

{% hint style="success" %}

#### Use emoji variation if you are using a different Template:

* :person\_walking: for **Basic** Template
* :crossed\_swords: for **Melee** Template
* :gun: for **Shooter** Template
  {% endhint %}

**1.-**  Open the Demo Scene on the Invector Demo folders:

* :person\_walking: **v3rdPersonConroller\_Demo**&#x20;
* :crossed\_swords: **vMeleeCombat\_DemoScene**
* :gun: **vShooterMelee\_DemoScene**&#x20;

**2.-** Drag to the scene the **Horse Realistic** Prefab.

![](https://lh6.googleusercontent.com/4biwoY0gG9VF0bMMjGQsst_g6qnv-c05qEjq6wZXXa5wVyfRj7RNToKqcmBBYITIUJxDgUibWXZYOOIAqSV4B95Wi5wglWsdJzlTZGvYKLzy8ZmKAZOwqaramZK08cfWQCmdNoes)

**3.-** Select the Character Controller Prefab:

* :person\_walking: **vBasicController**
* :crossed\_swords: **vMeleeController\_Inventory**
* :gun: **vShooterMeleeController**

**4.-**  Change the Animator Controller:

* :person\_walking: from **Invector\@BasicLocomotion** to   **Invector\@BasicLocomotion\_HAP**
* :crossed\_swords: from **Invector\@MeleeCombat\_Upperbody**   to   **Invector\@MeleeCombat\_HAP**
* :gun: from I**nvector\@ShooterMelee** to   **Invector\@ShooterMelee\_HAP**

{% hint style="info" %}
This Animator already has the **Mount Layer** and the Rider **Animator Parameters** added.  If you want to know how to add the **Mount Layer** to any Animator you can find out[ **HERE.**](https://malbersanimations.gitbook.io/animal-controller/annex/general-hap-integration#mounted-layer)&#x20;
{% endhint %}

![](https://lh6.googleusercontent.com/IIygX7zZMGRq85oCYd0TSy9oH2VQ0Hp9YbN6-bMuKtAGrHIf2_I2x0zOd3Krz2ZKJXi_ODoRUpIQVorf7scULIcnZKJiItqmQ7sjNLpzwokxegaBfJkXzToTIZNrdjUxh_M0RL7M)

{% hint style="warning" %}
Make sure your Character Controller has the Animator set to Animate physics
{% endhint %}

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M8WL2jiXvFnXZZ9WN8u%2F-M8XIAF2giazcioUbqzt%2Fimage.png?alt=media\&token=29575308-6b45-458a-9b15-6c9c6a7d54bc)

### Mounted and Combat Layer

If by any chance you have modified your Animator Controller, or you are using other Animator Controllers Provided by Invector. you can always add the Mount Layer and Rider Combat Layers provided for the Riding system.

{% embed url="<https://streamable.com/32rfti>" %}
Adding Mount and Combat Layers to a new Animator
{% endembed %}

### &#x20;Rider Component

**5.-**  Add the **MRider** script to your  Character controller.

![](https://lh5.googleusercontent.com/FjvlbtN9UqKt27IoQ_g1Rpqa2wKpvlL47egzNbaUI8daik3d0UgytiQr8nl5mI1-ZdsmrksXJKN3tL3ZWNARjvHGH_J5H01P6-IJ4n1nDP-cuIedO_oPnGowXmQukpieihsSGPJa)

**6.-**  If you are using a "Custom Input System"  you'll need to connect [**MRider.MountAnimal()**](https://malbersanimations.gitbook.io/animal-controller/riding/mrider/rider-mp#void-mountanimal) to your *Mount* Input, and [**MRider.DismountAnimal()**](https://malbersanimations.gitbook.io/animal-controller/riding/mrider/rider-mp#void-dismountanimal) to your *Dismount* Input. If you want to continue using my Malbers Input then use the Context Menu Create Mount Inputs.&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FIMnvs69sxvKSjfSDcGuS%2Fimage.png?alt=media&#x26;token=1b00b126-a38c-4ff1-8114-5d8037b3661d" alt=""><figcaption></figcaption></figure>

This will create a [**MInput** ](https://malbersanimations.gitbook.io/animal-controller/main-components/malbers-input)component with 3 Inputs for the Rider (Mount, Dismount and Call Mount); and connect the events of the inputs to the proper methods.&#x20;

You can change the *Type* from **Key** to **Input** and add those Inputs to the [**Unity Input Manager.**](https://docs.unity3d.com/Manual/class-InputManager.html)

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FpaAeoGcqb7E1VerELBZI%2Fimage.png?alt=media&#x26;token=db28e427-f512-4a50-a4d6-41c9347f9571" alt=""><figcaption><p><strong>Mount input connected to the method MRider.MountAnimal()</strong></p></figcaption></figure>

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F16WwMXKkRIBxMnbgfVum%2Fimage.png?alt=media&#x26;token=513fedf6-dfb4-418a-b9ca-7986027e14b2" alt=""><figcaption><p><strong>Dismount input connected to the method MRider.DismountAnimal()</strong></p></figcaption></figure>

**7.-**  On Disable Components add the scripts that interfere with the logic while riding. (Usually is used for scripts that are not supposed to be active while the character is Riding. Like scripts that move and rotate the character, Ragdoll scripts, etc. Also are used to disable Inputs that are only supposed to be active when the character is not riding: Ex: a Crouch Input).&#x20;

{% hint style="info" %}
In the case of Invector, it should be the **VFootStep**, **VRagdoll**, **VGenericAction**, **VLadder,**  or any other you feel is necessary. Components that may interfere with the Riding system
{% endhint %}

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FshKFAsC3PkyEP2dnLdZc%2Fimage.png?alt=media&#x26;token=c4383ffa-a0bc-4336-8be1-3d042f9bff9e" alt=""><figcaption></figcaption></figure>

### UI

**8.-**   Add the **Mount UI** prefab to your current UI Canvas.

![](https://lh5.googleusercontent.com/8jesHdB0rbzCIDuY24c6L03uUyi2htMmpWuQ6i3aGMN8e9ZMtPTVZNvCVJgXmVRjHyElI8yhvnFejtw_WGeMrFHuaHcQmFrZuAWO0cNjZthPCqo25pl605fPwp4gIQQEZy2aR97M)

{% hint style="info" %}
The **Mount UI** notifies you when you can press the **Mount** and **Dismount** Inputs&#x20;
{% endhint %}

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M0T1Y-ZlTpa3Xnxltn_%2F-M0T7H6gYw1GzLvHpFch%2FAwWLcu6r94.gif?alt=media\&token=db0fa6b1-1784-41c8-b978-9933030c165a)

**10.-**   If you like you can also add to the UI canvas the **Slider Stamina** prefab and the **Slider Health** prefab to check the **health** and **stamina** of the horse.

![](https://lh5.googleusercontent.com/hSbrVi1bavhQ9uZ3TUUh8hiCYHQ-iUnz7EZdJYLR8G9Q-GmpvWMslaNhm_muCR9GkT7igv-QDpAkn_XE5yxhwDmZwDi7LErh_InSLOGIaVSN0QJrQ6BYQDTM9av5LaPKEjuL3xys)

### **Link Script**

{% hint style="success" %}
The Link script is the bridge between the Rider Component and Invector's templates. Allows the Rider to communicate with Invector's core Character Controller components. Disable features via code while the character is riding the animals and enabling them back when the character is back on foot
{% endhint %}

**11.-**  Add the Invector **HAP Link** script to the Character.

* :person\_walking: With "Basic" Template add **Invector HAP Link** script

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FBqDcSH1rUuBTva4jwyOg%2Fimage.png?alt=media&#x26;token=f506e1bc-ff01-4041-9794-25826647cb70" alt=""><figcaption></figcaption></figure>

* :crossed\_swords: With "Melee" Template add **Invector HAP Melee Link** script

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FoEr7JDHAAADcSeLWmVfh%2Fimage.png?alt=media&#x26;token=eb0d5c59-b12e-4c76-b82a-b76359dee5b0" alt=""><figcaption></figcaption></figure>

* :gun: With "Shooter" Template add **Invector HAP Shooter** **Link** script.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FTDRksGPeSPV3vNZ5x3zn%2Fimage.png?alt=media&#x26;token=5df4f4b9-b4a0-4d87-af47-eb1efac56ae8" alt=""><figcaption></figcaption></figure>

### **Camera Settings**

**12.-**  Select the **ThirdPersonCamera** gameObject and change the *Camera State List* from:&#x20;

* :person\_walking:  **vBasicLocomotiont\@CameraState** to   **vBasicLocomotiont\@CameraState\_HAP**
* :crossed\_swords:  **vMeleeCombat\@CameraState**   to   **vMeleeCombat\@CameraState\_HAP**
* &#x20;:gun: **vShooterMelee\@CameraState**   to   **vShooterMelee\@CameraState\_HAP**

{% hint style="success" %}
This new state list contains the Camera State **Ride** used when the character is riding the horse.
{% endhint %}

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FdJ59hlMGviedCPjgxZOw%2Fimage.png?alt=media&#x26;token=bb540242-facf-4212-a304-90debf2a0c3d" alt=""><figcaption></figcaption></figure>

**13.-**  Add the [**MEventListener** ](https://malbersanimations.gitbook.io/animal-controller/scriptable-architecture/scriptables/mevent-listener)component to the **ThirdPersonCamera**.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fac18WfedFH2Br4jqC3Zj%2Fimage.png?alt=media&#x26;token=c0f24669-df75-48d9-a0c7-5374275e879a" alt=""><figcaption></figcaption></figure>

**14.-**   Create a new Event Listener and select the Event Set Camera Settings

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M0T7NG8EDasYi8aaNKh%2F-M0T9DYAHe1U-rrXNYWm%2FfWLumTkG5P.gif?alt=media\&token=202a5a69-1e96-4bc2-9b12-df792bc6fbce)

**15.-**  *Enable* the **Transform (T) Listener** and *disable* the **Void Listener.**  Create a new Unity Event Listener and drag the same game object to the Runtime Only Slot.&#x20;

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-M0T7NG8EDasYi8aaNKh%2F-M0T9ZAQM539chzxWhCY%2Fimage.png?alt=media\&token=66ff0eba-13ee-41c2-ae70-91f0499d8e26)

**16.-**  Add the \*dynamic  method `vThirdPersonCamera.Target()`  to the Listener.

![](https://lh5.googleusercontent.com/C259q8ZDI0Zaq_Wp_dCDZZUpZSo3u8Idfb2cqdkIwo-0RHmHaXLm3crcfYVFrQwc6QPP-AYSFKhzCU8Cm2aHTrM3R9iO6784lMj3uLkSwA9no_VWNywEUz0LnX7lgfhTM0EtFh3i)

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FKG4cIsZwgKSAYcW5ZPky%2Fimage.png?alt=media&#x26;token=3716ebc1-db60-4f98-80e5-dadb525aa1f7" alt=""><figcaption></figcaption></figure>

And that should be it… the basic controller should be able to ride the Horse.

## Melee Template&#x20;

**For integrating the Melee Template you should follow the same steps of the** [**Basic Template**](https://docs.google.com/document/d/138DpSb2L8BsSDljrv37lGNQ85lPO8JzhWAZQC0uCxfs/edit#heading=h.m7kh3a75xomh) **but follow the Melee Template Steps.**

{% hint style="info" %}
**i**f you want to check how the final integration should look like you can open the Demo Scene: **vMeleeCombat HAP4.**
{% endhint %}

**The Extra Steps you should follow to complete the Melee Integration are the following:**<br>

### Weapon Manager Component

Add the **Weapon Manager** Script.&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F7A19WZ7MfD1CcUKYCQ9L%2Fimage.png?alt=media&#x26;token=a6bddfd6-d16d-4ba1-bef9-d6580433b9e7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}

### Since we are using the **Animators** provided for the Integration package, is not necessary to Add the **\[**&#x43;ombat Layers].

{% endhint %}

**But, if you want to learn how to add the Combat Layers check this video:**

{% embed url="<https://streamable.com/vsq3ir>" %}

### Inputs

&#x20;If you are using a **Custom Input System**  you will need to connect:

* `MWeaponManager.Set_Aim(bool)` to your **Aim** Input.
* `MWeaponManager.MainAttack(bool)` to your **MainAttack** Input.
* `MWeaponManager.SecondAttack(bool)`  to your **SecondaryAttack** Input.
* `MWeaponManager.ReloadWeapon()`  to your **Reload** Input.

&#x20;But If you want to continue using [**Malbers Input** ](https://malbersanimations.gitbook.io/animal-controller/main-components/malbers-input)then use the Context Menu "Create Combat Inputs".&#x20;

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-MJ9Xebe0Uv2SLPSEr1f%2F-MJ9a7-1z_dJsjjnbcap%2Fimage.png?alt=media\&token=d53d50bc-a0d2-4ddf-98ae-35cf126af0be)

This automatically adds to the **MInput** Script, the Inputs needed for the Rider Combat and connects the inputs to the Weapon Manager methods.&#x20;

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FC7amlZIKflsdsL9puelJ%2Fimage.png?alt=media&#x26;token=2bea3881-f6b3-4e16-aa74-f57e192ca2b7" alt=""><figcaption></figcaption></figure>

You can change the *Type* from **Key** to **Input** and add those Inputs to the [**Unity Input Manager.**](https://docs.unity3d.com/Manual/class-InputManager.html)

### **Events**

Create the Combat  Event Listeners by using the Context menu "Create Event Listeners".

This will automatically add the[ MEventListener](https://malbersanimations.gitbook.io/animal-controller/scriptable-architecture/scriptables/mevent-listener) component with the Events needed for the Rider Combat system to communicate/listen to external scripts in a non-dependant way.

This is used for Mobile Input on all HAP Demo Scenes. Skip this part if you are not using Mobile

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-MJ9Xebe0Uv2SLPSEr1f%2F-MJ9aKrmdO6FbZarXc0m%2Fimage.png?alt=media\&token=b024a923-ef5c-4b7a-a93b-ab57c3d834de)

![](https://lh6.googleusercontent.com/Ju-j55VZnPF_SVQWhICdCLaoX0LD6phyQ6TZFnDgJ6l7z1bEQT0CzJ9_p0bB6dPdfJzLO5NHi_E7R6QWI2oWgZRvcGFkaG_8NCJWWs_6K05vdj56GDhNTfHTtsdombpsMaamnrNo)

### **No Equip Points**

In the **General** group -> **Weapons Equip Points;** Remove the **\[Left Hand]** and **\[Right Hand]** References and set to true the **\[Ignore Hand Offset]** Parameter.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F2CrpjKxKXGhlzLaDLovR%2Fimage.png?alt=media&#x26;token=cfaac906-674e-4125-bd95-174245c12bf4" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Invector System will be handling all the offsets and weapon parenting to the proper position.&#x20;
{% endhint %}

### **Use External**&#x20;

&#x20;Select the **Holsters/Use External** and set **\[Use External]**

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F3jCn5I4ZcjSl6xpW66Eh%2Fimage.png?alt=media&#x26;token=6568f430-5207-416e-af31-455352fddeb0" alt=""><figcaption></figcaption></figure>

**\[Instantiate On Equip] = false**  and  **\[Destroy On Unequip] = false**

{% hint style="info" %}
Invector System will be handling all the weapon instances.&#x20;
{% endhint %}

## Shooter Template

For integrating the **Shooter Template** you should follow the same steps as the [**General Steps**](#general-integration-steps) but follow the **Shooter Template** way.

Also, you need to follow the [**Melee Template**](#melee-template) Steps.

{% hint style="info" %}
If you want to check how the final integration should look like you can open the Demo Scene: **vShooterMelee Inventory HAP.**
{% endhint %}

**Make sure the Invector's Bow and Handgun have the Malbers Weapon component attached to it.**

Now the Controller should be able to use the pistol and the Bow weapons while riding the horse.&#x20;

#### Next:&#x20;

On the next page, check how the weapons are properly configured to be used with HAP

{% content-ref url="invector-templates/invector-weapon-settings" %}
[invector-weapon-settings](https://malbersanimations.gitbook.io/animal-controller/annex/integrations/invector-templates/invector-weapon-settings)
{% endcontent-ref %}

&#x20;&#x20;
