PVP ZONES & REALMS 2019.101

Add various PVP types to your game and limit the regions where PVP combat can take place!

You can also add Realms to your Entities and create allied or hostile nations that way. When setup properly, you can create guards that defend one realm but attack others and many more interesting things.


Additional Requirements

Some UCE AddOns require other AddOns to be installed first in order to work properly:

This AddOn requires the following AddOns(s):

UCE Tools

Scripting Defines

Most UCE AddOns use "Scripting Defines" that are added automatically on import. Sometimes you might be required to manually add or remove such a define. In that case, locate your defines list and remove the define (including the semicolon ; at the end). You find defines in your project here: Edit -> Project Settings -> Player - > Scripting Define Symbols (you can learn more about Defines HERE).

This AddOn uses the following define(s):

_FHIZPVP

Core Changes

Many AddOns require changes to the uMMORPG3d core scripts in order to function. The most common core changes are listed in a extra ReadMe contained in the UCE Tools AddOn (see HERE). The changes for this AddOn are repeated below as well:

This AddOn requires the following core change(s):

[Click] Player.cs (ca. line 1561)

EXCHANGE this code block:


// CanAttack check
// we use 'is' instead of 'GetType' so that it works for inherited types too
public override bool CanAttack(Entity entity)
{
	return base.CanAttack(entity) &&
		   (entity is Monster ||
			entity is Player ||
			(entity is Pet && entity != activePet) ||
			(entity is Mount && entity != activeMount));
}     
...COMPLETELY with the code block below:

// CanAttack check
// we use 'is' instead of 'GetType' so that it works for inherited types too
public override bool CanAttack(Entity entity)
{
	return UCE_CanAttack(entity);
}          

[Click] Monster.cs (ca. line 547)

EXCHANGE this code block:


// CanAttack check
// we use 'is' instead of 'GetType' so that it works for inherited types too
public override bool CanAttack(Entity entity)
{
    return base.CanAttack(entity) &&
           (entity is Player ||
            entity is Pet ||
            entity is Mount);
}
...COMPLETELY with the code block below:

// CanAttack check
// we use 'is' instead of 'GetType' so that it works for inherited types too
public override bool CanAttack(Entity entity)
{
    return UCE_CanAttack(entity);
}


INSTALLATION PROCESS

Integration Steps

  1. [Required] Add the "UCE_Area_PVPZone" to your scene, edit it in the inspector. PvP combat is only possible within such an area from now on.
  2. [Note] Players, Pets and Monsters now have a Realm as well as allied Realm (Ally).
  3. [Required] You have to set a different Realms for Monsters and Players or they will not be able to attack each other.
  4. [Optional] EXAMPLE: Set the bandit prefab to "Elf", the skeleton prefab to "Undead" and the players to "Human" to test. You can leave all allied realms empty for now.
  5. [Optional] EXAMPLE: To add NPC guards of a specific realm, use a monster as a base and set both of it's Realms to the same as the players of that realm.
  6. [Required] Go to: File -> Player -> Physics
    See the Layer Collission Matrix and check the box on row "Monster" at column "Ignore Raycast"
    Monsters attack each other now when set to Aggressive and of non-matching realms.

Additional Information


Videos (not fully up to date)


(c) iMMO - for personal and commercial game projects, not for sharing or re-sale