FANDOM


Here you will find various tutorials related to Emerald. This goes for system setups, implementation of other system (such as UFPS), setting up your NavMesh, and more. If you need any help, or would like to suggest a tutorial, you can contact us via our support email. See our contact section of our website for our contact information.

Implementing RFPS with Emerald AI

This quick tutorial will get Emerald AI working with RFPS. This will allow users to use RFPS to damage, both ranged and melee, Emerald AI agents as well as have Emerald AI damage the RFPS player. This functionality will also allow users to block incoming attacks from Emerald AI agents. Note: This tutorial requires adding a few lines to a couple RFPS scripts and some basic understanding of minor editing of scripts.


Setting up the Emerald AI Agent

Step 1) To start off, you will need to set all your Emerald AI agents to the Flesh tag and the NPCs layer 

EmeraldAILayerAndTag(RFPS)


Step 2) Set your Emerald System Tag, located under the Tag Options, to Flesh. Make sure you set Player uses Separate Layer to true (Aggressive and Defensive Only). This needs to be done with all Emerald AI agents. 

EmeraldAISystemTag(RFPS)-0


Step 3) Set your Emerald Layer, located under the Tag Options, to NPCs. This needs to be done for all Emerald AI agents.

EmeraldAIEmeraldLayer(RFPS)


Step 4) (Aggressive and Defensive Only) Set your Player Layer, located under the Tag Options, to Player. This needs to be done for all Emerald AI agents.

EmeraldAIPlayerLayer(RFPS)


Step 5) Press the Add Tag button and add the tag Player to the Target/Flee Tags list, located at the bottom of the Tag Options. This needs to be done for all Emerald AI agents that interact with the Player.

EmeraldAIAddTag(RFPS)


Step 6) Open the Emerald_Animal_AI script, press Ctrl+F to bring up the search tool, and search for the line:

currentAnimal.SendMessage(SendMessageForPlayerDamage, attackDamage);


Step 7) Once you've found the above line, comment it out like shown below using // This makes it easy to undo the RFPS implementation if needed.

//currentAnimal.SendMessage(SendMessageForPlayerDamage, attackDamage);


Step 8) Underneath the commented line above, add the following line. This will allow Emerald AI agents to send damage to the RFPS player. This will also allow the Player to block incoming damage.

currentAnimal.GetComponent<FPSPlayer>().ApplyDamage((float)attackDamage, this.transform, true);



Setting up the RFPS Player with Emerald AI

Step 1)  Open the WeaponBehavior script, press Ctrl+F to bring up the search tool, and search for the line:

case 13://hit object is an NPC


Step 2) Once you've found the line, you will see a switch statement. Add the following code to case 13 under the last if statement within case 13:

if(hit.collider.gameObject.GetComponent<Emerald_Animal_AI>()){
				hit.collider.gameObject.GetComponent<Emerald_Animal_AI>().Damage((int)damageAmt);
				hit.collider.gameObject.GetComponent<Emerald_Animal_AI>().MakeFlee(FPSPlayerComponent.gameObject);
				hit.collider.gameObject.GetComponent<Emerald_Animal_AI>().MakeAttack(FPSPlayerComponent.gameObject);
			}


Step 3) Open the ArrowObject script, press Ctrl+F to bring up the search tool, and search for the line:

case 13://hit object is an NPC

Step 5) Once you've found the line, you will see a switch statement. Add the following code to case 13 under the last if statement within case 13:

if(hitCol.gameObject.GetComponent<Emerald_Animal_AI>()){
					hitCol.gameObject.GetComponent<Emerald_Animal_AI>().Damage((int)damage + (int)damageAddAmt);
					hitCol.gameObject.GetComponent<Emerald_Animal_AI>().MakeFlee(FPSPlayerComponent.gameObject);
					hitCol.gameObject.GetComponent<Emerald_Animal_AI>().MakeAttack(FPSPlayerComponent.gameObject);
					Destroy(this.gameObject); //This is optional so that the arrow doesn't stick into the AI
				}


The concludes the tutorial with implementing RFPS and Emerald AI. Test your scene to make sure things are working properly. If things aren't working right, you most likely made a mistake during one of the steps. This has been tested and confirmed to work. If you need further help, you can visit the Emerald AI Forums.



Implement UFPS with Emerald AI

This quick tutorial will get Emerald AI working with UFPS. This will allow users to use UFPS to damage, both ranged and melee, Emerald AI agents as well as have Emerald AI damage the UFPS player. Note: This tutorial requires adding a few lines to one UFPS scripts and some basic understanding of minor editing of scripts.


Setting up the Emerald AI Agent

Step 1) To start off, you will need to set all your Emerald AI agents to the Emerald AI tag and the Enemy layer. Note: The layer has nothing to do with whether an AI is an enemy or not. It's used because it's the layer that's included and usable with UFPS.

EmeraldAITagAndLayer(UFPS)


Step 2) Set your Emerald System Tag, located under the Tag Options, to Emerald AI. This needs to be done with all Emerald AI agents.

EmeraldAISystemTag(UFPS)


Step 3) Set your Emerald Layer, located under the Tag Options, to Enemy. Make sure you set Player uses Separate Layer to true (Aggressive and Defensive Only). This needs to be done for all Emerald AI agents.

EmeraldAILayer-0


Step 4) Set your Player Layer, located under the Tag Options, to LocalPlayer. This needs to be done for all Emerald AI agents.

EmeraldAIPlayerLayer(UFPS)


Step 5) Press the Add Tag button and add the tag Player to the Target/Flee Tags list, located at the bottom of the Tag Options. This needs to be done for all Emerald AI agents that interact with the Player.

EmeraldAIAddTag


Step 6) Finally, go to your AI's Attack Options and change the Player Damage Function Call to "Damage".

EmeraldAIDamageCall(UFPS)



Setting up the UFPS Player and Bullets

Step 1) Find all the UFPS bullets and select them. Make sure the Damage Method Name is Damage and the Damage Mode is set to Unity Message.

BulletSetup(UFPS)


Step 2) Open the vp_FXBullet script, press Ctrl+F to open up the search tool, and find the line:

m_Transform.position = m_Hit.point;


Step 3) Underneath the line above, add the following code:

if (m_Hit.collider.gameObject.tag == "Emerald AI")
		{
			if (m_Hit.collider.gameObject.GetComponent<Emerald_Animal_AI>().currentAnimal == null)
			{
				m_Hit.collider.gameObject.GetComponent<Emerald_Animal_AI>().MakeFlee(m_Source.gameObject);
				m_Hit.collider.gameObject.GetComponent<Emerald_Animal_AI>().MakeAttack(m_Source.gameObject);
			}
		}


Step 4) This last step is needed to help convert UFPS's damage calculations so they work properly with Emerald's. Go to your UFPS Player, find the Vp_Simple HUD, and change the Health Multiplier to 1. Next, find the Vp_FP Player Damage Handler, and change the Max Health to 100.

PlayerSettings(UFPS)


The concludes the tutorial with implementing UFPS and Emerald AI. Test your scene to make sure things are working properly. If things aren't working right, you most likely made a mistake during one of the steps. This has been tested and confirmed to work. If you need further help, you can visit the Emerald AI Forums.


Setting up Unity's NavMesh

For a great guide on setting up your NavMesh, see Untiy's tutorial here: http://docs.unity3d.com/Manual/nav-BuildingNavMesh.html


Creating separate areas for different kinds of animals

If you want to create different areas for your animals, such as animals that can go both in water and out, but keep land animals out of that areas, than follow this tutorial. This same thing applies for different kinds of animals and their types, you just need some type of object to mask it. Make sure this object is marked as Static. It can be found in the top right corner of the Inspector of that GameObject.

1) Create new Area and call it lets say Don't walk on Water

Custom Area

2) Set your water object to the area Don't walk on Water that you just created

Set Water

3) Go to your AI's NavMeshAgent, that you don't want walking on/in the water, and uncheck Don't walk on Water from theArea Mask 

Set Custom Area

4) Rebake your scene.

The AI you don't want walking on the water will have the water area marked as unwalkable and the ones that can walk on/in the water will be able to.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.