PvP Zone & Realms

You are here:
← All Topics
Version: 2019.200 Requirements:uMMORPG3d, ToolsScript Define:_IMMOPVP
Core Changes:YesTutorial Video:No

Description

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

  • Open PVP where everybody can attack anybody
  • Guild PVP where members of different guilds can attack each other
  • Realm PVP where members of different realms can attack each other
  • Or any mix of the above

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.


Core Changes

  1. [Required] Open the following script Player.cs. See Changes...

    Locate this line:
    // 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));
    }   

    Modify to match:

    // 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);
    }          
  2. [Required] Open the following script Monster.cs. See Changes...

    Locate this line:
    // 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);
    }

    Modify to match:

    // 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

  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.
    *Note: Players, Pets and Monsters now have a Realm as well as allied Realm (Ally).
  2. [Required] You have to set a different Realms for Monsters and Players or they will not be able to attack each other.
  3. [Optional] 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.
  4. [Optional] 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.
  5. [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.

Screenshot


Extra

  • By default, this AddOn will DISABLE all PVP combat. You have to place a PVPRegion Collider in your scene to make certain types of PVP combat available within that collider.
  • Both the Realm and the alliedRealm of Monsters and Players should be different, otherwise you won’t be able to attack them.
  • If you leave both Realm and Ally empty the Entity will be completely neutral and attackable by all / can attack all.
  • Only “aggressive” monster will attack on their own.
  • “Neutral” monsters will only strikeback but never attack on their on. They also do so only when attack by an enemy who is not of the same Realm ID.
  • “Pacifistic” monsters never attack and never strike back.
  • See that little “Captureable” option in the Monster inspector? Check that and when the monster is set to “respawn”, it will do so and convert to the Realm of the player who killed it. Combine that with a guard tower that rises again, allied to the player who dealt the final blow.
  • It is recommended to always corner-off your PVP Regions and connect them to other Regions in your scene via a teleporter. If you put a non-PVP region close to a PVP Region, weird things can happen. Players inside a PVP Region might be able to shoot at players outside the Region etc.

Support the IndieMMO Team Today!

Leave a reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.