nope. ShopFinder was inheriting from Shop, and CraftingFinder was inheriting from the Crafting Table, both of which inherit from ‘RangeFinder’, and T was the mentioned scripts above (‘Shop’ and ‘CraftingTable’). I wanted Banker to inherit from ‘OtherInventory’, but… that didn’t work well
Take a look at Shop’s declaration, and at AIConversant’s declaration, and at CraftingFinder’s declaration… is there anything all three implement? Say an interface that I might have pointed out in RangeFinder’s restrictions?
“CraftingFinder.cs” is literally an empty class that just inherits from RangeFinder lel… is it ‘ITarget’? lol this is getting really confusing from the get go
lol I’ve been blinking at both that screenshot and my code for 10 minutes, and my brain can’t analyze what I’m looking at…
Is there something I should be hunting for? I’m so lost
This is my latest attempt of ‘BankFinder.cs’:
using System.Collections;
using System.Collections.Generic;
using GameDevTV.Inventories;
using RPG.Core;
using UnityEngine;
namespace RPG.Bank {
public class BankFinder : RangeFinder<OtherInventory>
{
}
}
What this does is say that any class that inherits from RangeFinder must declare the type of T (You’ve got that, except that it should be OtherInventory) and that T (OtherInventory) must implement the ITarget Interface. Does your OtherInventory implement the ITarget interface??
ahh, that’s the little devil… - anyway, we fixed that now. I’ll go add it to the item underneath the player
OK so let me get this straight, because the more I code this project, the crazier it seems to get (because when I thought I knew something, turns out I didn’t…):
RangeFinder’s script opening class Inheritance line mentions that “T” must inherit from ‘MonoBehaviour’ and ‘ITarget’, which means that if whatever we’re calling does not have whatever ‘ITarget’ needs (be it an interface, an abstract class or anything else…), then we must go back and add it to whatever ‘T’ is, and the same goes if MonoBehaviour was an interface, abstract or any other type of script… right? (I’m trying so hard to understand all of this, but this is really hard)
Yes. In this case, it’s pretty much a given that it’s a MonoBehaviour, because colliders must live on a GameObject, and this whole thing relies on a collider on the OtherInventory winding up in range of the RangeFinder, but by including the MonoBehaviour restriction, we ensure we can get hold of the Transform.
So a class can inherit from one other class, in this case MonoBehaviour, and can implement as many interfaces as it wants (in this case, ITarget).
Which is why it’s important not to rush through things… if it took you 1/2 as many hours to go through the content as I spent writing it, there’s a good chance you may have missed things. At this point, setting up a RangeFinder should be 2nd nature going forward, but remember you can always look back at the RangeFinder lesson.
I’m trying so hard, but without getting too deep into the details of a guy who randomly loses focus more frequently than he can focus, let’s just say that I’ll keep trying until I understand what in the world am I doing
public void GainExperience(float deltaTime)
{
experience += practice * deltaTime;
}
throw new ImTryingLah();
// 'Lah' is what you naturally end your sentence with, when you've been in Malaysia for 7 years >:D<
anyway, time for me to go have a look at how to set the State Machine up
safe to say that I’m really confused regarding how to even start coding the State Machine for the bank? The code is everywhere (any hints, please?)
Edit: I tried something, just not sure if it’s right or wrong:
using System.Collections;
using System.Collections.Generic;
using GameDevTV.Inventories;
using RPG.States.Player;
using UnityEngine;
public class PlayerBankingState : PlayerBaseState
{
private OtherInventory target;
public PlayerBankingState(PlayerStateMachine stateMachine, OtherInventory otherInventory) : base(stateMachine)
{
target = otherInventory;
}
public override void Enter()
{
// Create a 'BankClosed' function to get the next line to work:
target.BankClosed += OnBankClosed;
// Figure out which function opens up the Bank UI here
}
public override void Tick(float deltaTime)
{
}
public override void Exit()
{
target.BankClosed -= OnBankClosed;
}
private void OnBankClosed()
{
SetLocomotionState();
}
}
Hmmm… I actually had to go back to read the complete setup… (it’s been a while, I wrote this in '20). I don’t have time to work through this tonight.
The rough pass is that the BankingState will need to take in the OtherInventory as a parameter, and it will need to get hold of the other ui, activate the other ui and the inventory ui, and also find a way to know when the otherui closes (so that’ll need an event). Since we’re not using the ShowHideUI anymore, there will be some refactoring, I just don’t have time for it till this weekend at the earliest, so I’ll need to choose between:
- Writing the next lesson in the tutorial proper
- Adapting a saving system for an asset that I don’t own and that I initially said I could not help you with but you roped me into it anyways
- Making this work…
Bank can wait for a bit. It still has a few optimization issues anyway
we can organize the other two. I’ll ping you sometime during the weekend for the saving system (I’m trying it out on my own in the meanwhile. At one point, I actually had something that worked between the main menu and game scene, but then I lost it in an accident…)
heya Brian. For the moment, can we also please have a side tutorial for the bank, whenever possible?
while you’re at it, you might also want to test the bank for long periods of withdrawal and depositing, because mine suffers significant performance drops in the bank itself after about 5 minutes of continuous use (that was one of my issues when I was still using the Point-and-click system, and I’m guessing it’s still going to be around after we get it to work again)
Edit: the new Enemy Controller scripts look like they’re about to be the next big headache for the next 2-3 months , mainly because there’s probably a lot that I’ll want to add back, like the random patrol points, aggrogroups (this one recently became a headache all over again, although frankly speaking, I am considering converting it to a dynamic spawner around the game. So let’s say if we have a police chase, we can have them dynamically spawn, instead of relying on distance and all that…), dwelling time, etc… you know, all the functions we once had (and the fact that my ‘RespawnManager.cs’, an external system we once added to make enemies respawnable, relies on ‘AIController.cs’, the script we recently deleted, is making things really tricky…). Suddenly deleting the ‘AIController.cs’ really unleashed hell on me when it comes to functionality… a lot of stuff won’t work for a while now
Quick question on the fly… Why is the Quest Giver NPC not playing any movement animations, even when I put the ‘ThirdPersonHumanoid’ animator on him?
I’ll follow along with one of my prefabs, and if that works, then I’ll set everyone back up again using that knowledge
At the momement, he should only be idle…
You can’t have the AIController fighting against the Enemy State Machine. This will rebuild things from the ground up.
It won’t. This is part of the joys of refactoring, and why I strongly recommended against doing this in anything but the course project
he’s still patrolling lel, but with the idle animation, even when I replaced the controlling animator with our new ThirdPersonHumanoid Animator
oh dear god, the roadbumps in this project (ain’t complaining though, I have some ideas I would like to try someday lel… Hopefully these NPC and Boss fights will be epic)
too late lel, I just went for the main project (but I got backups, JUST IN CASE I do anything stupid by accident)
I may not be able to help you fix the damage…
HOW is he still patrolling? Patrolling is done in the AI Controller, which should be removed. When we get to AI Patrolling state (SOON) , this will be fixed.
For the time being, I’m assuming errors till the end. Hopefully everything will be fixable
Probably something I forgot in ‘Mover.cs’… for now I’m just tagging along, and working (trying) on an integration between my construction and saving system, xD
It shouldn’t matter… the only place in the existing course code that handles patrolling is the AI Controller. It shouldn’t be on anymore, or things are not going to work as you add states, and you’ll be left wondering why they’re still in idle when they’re moving even though I haven’t introduced moving to the merger.
and… I forgot to delete the AI Controller off of him… now he’s no longer moving around lel. I’ll miss that script, I remember how hard it was back then to add new stuff to it (and my AggroGroup and RespawnManagers recently became a bit of a disaster as well recently…)
ANYWAY, please do give the bank a shot sometime (for now I’ll be back to finding the code responsible for my Circular UI)
@Brian_Trotter don’t forget to update the right hand side topic picker on your gitlab page