Character Stats Rework | Making a Simple RPG - Unity 5 Tutorial (Part 14)

preview_player
Показать описание
Support the channel with the new Patreon campaign!

Questions?
Create an account, create a discussion:

In this episode of the Simple RPG series we refactor a bit of our stat system (woo). We set it up to allow for per-character stat definitions, as well as make it easier to create and query stat data.

Project Repo

In this series we'll be creating an ARPG-style movement system, a world full of interactable objects, NPCs with dialogue, enemies and attacking, an inventory system, portals, and maybe even a questing system.

Learn how to create camera controller that follows the player with simple camera zooming.

Low Poly Asset Pack:

Unity 5:

Making an RPG is a pretty daunting task, but Unity allows us to create all of the basic systems of an RPG without much hassle. This unity tutorial covers creating an RPG-esque inventory item that you can consume by "using" it.

Roar.

Credits:
Created by Austin Gregory
Рекомендации по теме
Комментарии
Автор

For the sake of everyone's sanity... here is the missing secret sauce in the video. I spent 4 hours figuring this out... when you attack the slime and you get a NullReferenceException Error. Adding these two lines of code will fix your error so you can move on.

IWeapon.cs looks like this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public interface IWeapon {
List<BaseStat> Stats { get; set; }
//THIS IS THE MISSING LINE OF CODE!
CharacterStats characterStats { get; set; }
//MISSING LINE OF CODE END
void PerformAttack();
void PerformSpecialAttack();
}


PlayerWeaponController.cs looks like this:


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerWeaponController : MonoBehaviour {
public GameObject playerHand;
public GameObject EquippedWeapon { get; set; }

Transform spawnProjectile;
IWeapon equippedWeapon;
CharacterStats characterStats;

void Start()
{
spawnProjectile =
characterStats =
}

public void EquipWeapon(Item itemToEquip)
{
if (EquippedWeapon != null)
{


}


EquippedWeapon = + itemToEquip.ObjectSlug), playerHand.transform.position,
equippedWeapon =
//THIS IS THE MISSING LINE OF CODE!
equippedWeapon.characterStats = characterStats;
//MISSING LINE OF CODE END
if != null)
= spawnProjectile;
equippedWeapon.Stats = itemToEquip.Stats;




}

void Update()
{
if (Input.GetKeyDown(KeyCode.X))
PerformWeaponAttack();
if (Input.GetKeyDown(KeyCode.Z))
PerformWeaponSpecialAttack();
}

public void PerformWeaponAttack()
{

}

public void PerformWeaponSpecialAttack()
{

}

}

patrickkrebs
Автор

literally just started this tutorial so it's cool to see it updated

SomewhatMade
Автор

yesss!!! im so excited for this episode! keep it up. also quests could be very cool :D

linushaga
Автор

you are awesome teacher! please, keep making tutorials

roiiam
Автор

thank you so much for this awesome tutorials, im so excited about it .
because of sanctions im not able to donate and its a shame for politicians.
you have our respect (me and my team we are beginners), and when the time comes we do not forget who encouraged us to do big things.
again thank thank you from bottom of my hurt.

mohammadcyberman
Автор

awesome man keep it up..
dont stop like previously you did
you are one of the best teacher😎😎

jinkazam
Автор

i always got NullReferenceException: Object reference not set to an instance of an object Item Database.GetItem (System.String itemSlug) (at .cs:29) which causes my inventory to be empty, the sword and potion won't appear. please help me fix this :'/

meepmeep
Автор

Why do your videos come in my subscription videos list so late?
I get the email notification, but when I go to subscriptions it's not there until 3-4 days pass.

SparkeyAvalon
Автор

I'm getting a NullReferenceException when I try to attack the slime. It's saying that CharacterStats on the Sword class is null when it tries to use CharacterStats.GetStat(). I thought it was supposed to get that from PlayerWeaponController, which will get it from Player.

marshalbiggs
Автор

does map design i mean model and texture compatible in mobile without lag?

johnsmith-sgut
Автор

project repo don't run in unity 5.6?

edped
Автор

Hi!

What is causing this: 'sword(Clone)' AnimationEvent 'CastProjectile' has no receiver! Are you missing a component?

artohaapanen
Автор

I have double checked everything i can think of but when i equip the sword and attack the slime it says
NullReferenceException: Object reference not set to an instance of an object
Sword.OnTriggerEnter (UnityEngine.Collider col) (at Assets/Scripts/Sword.cs.33)
I have tried to Debug the issue and when i put in

instead of

i dont get an error and the slime dies....
im using unity 2017 3of3...
any suggestions???

TrengoveN
Автор

This line here, is giving me a nightmare. I can't make the system recognize the itemToEquip.Stats no matter what I try. Any suggestions?

timbrunettopersonaltrainin
Автор

new tutorial of inventory system with hotbar please <3<3<3

jogandoa
Автор

make trap . when hero step on teap . hp down

kopkop