I’m very sorry, I’m not a programmer, I’m an artist, basically, I’m trying do make my own Pokémon prototype (because I’m way to hyped for Legends and can’t wait…) based on scripts from a friend of mine, this friend is very busy with college so I absolutely don’t wanna bother them, this is my first day of changing the original scripts for my needs.
The original scripts were going for sprite animations, I wanna do 3D, so I commented all references to sprites out in the script that defines a species, and added new Serializations for Game Objects instead: (Most relevant lines: 46-51, 84-86)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
//*** 14.1.2021, basiert auf "ARCreatureBase"
[System.Serializable]
public class AbilityLearnInfo : IComparable<AbilityLearnInfo> {
[SerializeField] private int level = 0;
[SerializeField] private Ability ability = null;
public int Level { get => level; }
public Ability Ability { get => ability; }
public int CompareTo(AbilityLearnInfo other)
{
if(other == null || other.Level == this.Level)
return 0;
if(this.Level > other.Level)
return 1;
if(this.Level < other.Level)
return -1;
return 0;
}
}
/*A scriptable Object created from this class contains all info about one ar monster species
- NOT current battle stats like level or hp, only shared stats like sprites*/
[CreateAssetMenu(menuName = "AR-Creatures/AR-Creature Species", order = 1)]
public class ARCreatureSpecies : ScriptableObject, IComparable<ARCreatureSpecies>
{
[HideInInspector][SerializeField] private int uniqueID; //used for save and load
[Header("Name, ID, ...")]
[SerializeField] private int creatureIndexNumber = 0;
[SerializeField] private string creatureName = "";
[SerializeField] private CreatureType creatureType = null;
[Tooltip("Description is shown in the Creature Dex Menu if this creature was scanned")]
[SerializeField][TextArea(5, 15)] private string description = "No description yet.";
// [Header("Sprites")]
// [SerializeField] private Sprite modelFrontView = null;
// [SerializeField] private Sprite modelBackView = null;
[Header("Prefab Model")]
[SerializeField] UnityEngine.GameObject creatureModel;
[Header("Combat Base Stats")]
[SerializeField] private int baseMaxHealth = 10;
[Tooltip("XP needed to go from level 98 to 99")]
[SerializeField] private float maxLevelUpXP = 1000;
[Tooltip("XP needed to go from level 0 to 1")]
[SerializeField] private float minLevelUpXP = 10;
[Tooltip("Curve describing how required XP grows between min and max value")]
[SerializeField] private AnimationCurve xpCurve = null;
[Header("Ability Learnset")]
[SerializeField] private AbilityLearnInfo[] abilityLearnset = null;
[Header("Animations")]
[SerializeField] private AnimationClip idleAnimationClipFront = null;
[SerializeField] private AnimationClip idleAnimationClipBack = null;
[SerializeField] private AnimationClip attackAnimationClipFront = null;
[SerializeField] private AnimationClip attackAnimationClipBack = null;
[Header("Sounds")]
[SerializeField] private AudioClip creatureSound = null;
public int CreatureIndexNumber { get => creatureIndexNumber; }
public string CreatureName { get => creatureName; }
public CreatureType CreatureType { get => creatureType; }
public CreatureModel CreatureModel { get => Model; }
// public Sprite ModelFrontView { get => modelFrontView; }
// public Sprite ModelBackView { get => modelBackView; }
public AudioClip Sound { get => creatureSound; }
// public AnimationClip IdleAnimationClipFront { get => idleAnimationClipFront; }
// public AnimationClip IdleAnimationClipBack { get => idleAnimationClipBack; }
// public AnimationClip AttackAnimationClipFront { get => attackAnimationClipFront; }
// public AnimationClip AttackAnimationClipBack { get => attackAnimationClipBack; }
public int UniqueID { get => uniqueID; }
public string Description { get => description; }
public int MaxHPForLevel (int level) {
return baseMaxHealth * level;
}
public Ability LevelupAbility(int level) {
foreach(AbilityLearnInfo learninfo in abilityLearnset) {
if(learninfo.Level == level)
return learninfo.Ability;
}
return null;
}
public List<Ability> GetAllLearnedAbilities(int level) {
List<Ability> abilities = new List<Ability>();
foreach(AbilityLearnInfo learninfo in abilityLearnset) {
if(learninfo.Level <= level)
abilities.Add(learninfo.Ability);
}
return abilities;
}
public Ability[] GetLatestAbilities(int currentLevel, int amount) {
List<AbilityLearnInfo> latestAbilityLearnInfo = new List<AbilityLearnInfo>();
//get all learninfos for current or lower level
foreach(AbilityLearnInfo learnInfo in abilityLearnset) {
if(learnInfo.Level > currentLevel)
latestAbilityLearnInfo.Add(learnInfo);
}
//Sort and remove abilities from the beginning until count = amount
latestAbilityLearnInfo.Sort();
while(latestAbilityLearnInfo.Count > amount) {
latestAbilityLearnInfo.RemoveAt(0);
}
//collect abilities in array
Ability[] latestAbilities = new Ability[latestAbilityLearnInfo.Count];
for(int i = 0; i < latestAbilities.Length; i++) {
latestAbilities[i] = latestAbilityLearnInfo[i].Ability;
}
return latestAbilities;
}
public int GetXPForNextLevel(int nextLevel) {
float curvePoint = (float)nextLevel / (float)ARCreature.MaxCreatureLevel;
float curveValue = xpCurve.Evaluate(curvePoint); //between 0 and 1
float xp = minLevelUpXP + curveValue * (maxLevelUpXP - minLevelUpXP); //scale curve value to be between min and max xp
Debug.Log("XP for next Level is " + (int)xp);
return (int)xp;
}
public bool HasAnimations() {
if(!attackAnimationClipBack || !attackAnimationClipBack || !idleAnimationClipFront|| !idleAnimationClipBack)
return false;
else
return true;
}
public int CompareTo(ARCreatureSpecies other)
{
if(this.creatureIndexNumber > other.creatureIndexNumber)
return 1;
if(this.creatureIndexNumber < other.creatureIndexNumber)
return -1;
return 0;
}
#if UNITY_EDITOR
//Called every time the asset is edited or refreshed
public void OnValidate() {
if(ARLookup.Instance != null && !ARLookup.Instance.IsRegistered(this)) {
RegisterInLookup();
}
}
private void RegisterInLookup() {
Debug.Log("Registering " + this.creatureName + " in Lookup");
uniqueID = creatureIndexNumber; //try with creatureId first
while(!ARLookup.Instance.Register(this)) {
uniqueID = Mathf.RoundToInt(UnityEngine.Random.Range(1, 999)); //generate random id if creature id doesnt work
}
}
#endif
}
The problem is, even after changing the script, when I go Create > Creatures > Create New Species, it still has the old sprites serializations:
I guess I’m missing something?
Sorry for my noobness, thanks for anyone that is inclined to help