• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This post has been wikified, any user with enough reputation can edit it.
avatar image
Question by derekwsparks · Jun 01, 2014 at 10:39 PM · errorscript error

base character script errors. Plz Help.

Having trouble with this script. Getting two errors.

The code excerpt is from lines 85 - 92 of the BaseCharacter.cs script. The full script is located below for review as well.

     private void SetupVitalModifiers() {
         //health
         GetVital ((int)VitalName.Health).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Constitution), .5f));
         //energy
         GetVital((int)VitalName.Energy).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((AttributeName.Constitution), 1)); 
         //mana
         GetVital((int)VitalName.Mana).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((AttributeName.WillPower), 1));                                               
     }

Two errors:

Assets/Scripts/Character Classes/BaseCharacter/.cs(89, 137): error CS1525: Unexpected symbol ';' , expecting ')' or ','

Assets/Scripts/Character Classes/BaseCharacter/.cs(91, 128): error CS1525: Unexpected symbol ';' , expecting ')' or ','

using UnityEngine; using System.Collections; using System; //added to access the enum class

 public class BaseCharacter : MonoBehaviour {
     private string _name;
     private int _level;
     private uint _freeExp;
 
     private Attribute[] _primaryAttribute;
     private Vital[] _vital;
     private Skill[] _skill;
 
     public void Awake() {
         _name = string.Empty;
         _level = 0;
         _freeExp = 0;
 
         _primaryAttribute = new Attribute[Enum.GetValues(typeof(AttributeName)).Length];
         _vital = new Vital[Enum.GetValues(typeof(VitalName)).Length];
         _skill = new Skill[Enum.GetValues(typeof(SkillName)).Length];
     
         SetupPrimaryAttributes ();
         SetupVitals ();
         SetupSkills();
     }
 
         public string Name {
         get{ return _name; }
         set{ _name = value; }
     }
 
     public int Level {
         get{ return _level; }
         set{ _level = value;}
     }
 
     public uint FreeExp {
         get{ return _freeExp; }
         set{ _freeExp = value; }
     }
 
     public void AddExp(uint exp) {
         _freeExp += exp;
 
         CalculateLevel ();
     }
 
 
     //Take the average of all of the players skills and assign that as the player level
     public void CalculateLevel() {
     }
 
 
     private void SetupPrimaryAttributes() {
         for(int cnt = 0; cnt < _primaryAttribute.Length; cnt++) {
             _primaryAttribute[cnt] = new Attribute();
         }
     }
 
     private void SetupVitals() {
         for(int cnt = 0; cnt < _vital.Length; cnt++) {
             _vital[cnt] = new vital();
         }
     }
 
     private void SetupSkills() {
         for(int cnt = 0; cnt < _skill.Length; cnt++) {
             _skill[cnt] = new skill();
         }
     }
     
     public Attribute GetPrimaryAttribute(int index) {
                 return _primaryAttribute[index];
     }
 
     public Vital GetVital(int index) {
                  return _vital[index];
     }
 
     public Skill GetSkill(int index) {
                  return _skill[index];
     }
 
     private void SetupVitalModifiers() {
         //health
         GetVital ((int)VitalName.Health).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Constitution), .5f));
         //energy
         GetVital((int)VitalName.Energy).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((AttributeName.Constitution), 1)); 
         //mana
         GetVital((int)VitalName.Mana).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((AttributeName.WillPower), 1));                                               
     }
 
     private void SetupSkillModifiers() {
         //melee offense
             GetSkill ((int)SkillName.Melee_Offence).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Might), .33f));
             GetSkill ((int)SkillName.Melee_Offence).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Nimbleness), .33f));
         
             GetSkill ((int)SkillName.Melee_Defense).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Speed), .33f));
             GetSkill ((int)SkillName.Melee_Defense).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Constitution), .33f));
 
             GetSkill ((int)SkillName.Magic_Offense).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Concentration), .33f));
             GetSkill ((int)SkillName.Magic_Offense).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.WillPower), .33f));
 
             GetSkill ((int)SkillName.Magic_Defense).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Concentration), .33f));
             GetSkill ((int)SkillName.Magic_Defense).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.WillPower), .33f));
 
             GetSkill ((int)SkillName.Ranged_Offense).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Concentration), .33f));
             GetSkill ((int)SkillName.Ranged_Offense).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Speed), .33f));
 
             GetSkill ((int)SkillName.Ranged_Defense).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Speed), .33f));
             GetSkill ((int)SkillName.Ranged_Defense).AddModifier (new ModifyingAttribute (GetPrimaryAttribute ((int)AttributeName.Nimbleness), .33f));                                                                                                    
     }
 
         public void StatUpdate() {
             for (int cnt = 0; cnt < _vital.Length; cnt++)
                 _vital [cnt].Update ();
 
             for (int cnt = 0; cnt < _skill.Length; cnt++)
                 _skill [cnt].Update ();
     }
 }
Comment
ffxz7ff

People who like this

-1 Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lovrenc · Jun 01, 2014 at 10:54 PM 0
Share

Unexpected symbol ';' , expecting ')' or ','

1 Reply

  • Sort: 
avatar image

Answer by yorgaraz · Jun 01, 2014 at 10:54 PM

I think you forgot to close the parentheses at the end of those two lines.

        //energy
        GetVital((int)VitalName.Energy).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((AttributeName.Constitution), 1)); 
        //mana
         GetVital((int)VitalName.Mana).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((AttributeName.WillPower), 1));   

I belive it should be

 //energy
        GetVital((int)VitalName.Energy).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((AttributeName.Constitution), 1))); 
        //mana
         GetVital((int)VitalName.Mana).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((AttributeName.WillPower), 1)));
Comment
Lovrenc

People who like this

1 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image derekwsparks · Jun 02, 2014 at 02:33 AM 0
Share

Did as you said and it cleared up those errors and gave me 7 more lol. It has to be on my end though either that or its a version issue as Petey from BergZerg Arcade on youtube made the video like 2 or more years ago. It is the hack and slash tutorials. The only reason why I asked on here is he doesn't seem to be active as of around 5 months ago. He made one Reboot video talking about how he was going to redo the whole thing for unity 4.5 but hasn't posted anything since and used to be it was once a week which would have been nice because the older version videos are the best extended tutorials I have found so far, being there is well over 200 something videos. Kinda hard to move on though when there are errors and continuing anyway will probably end in failure. It is the base Character number 3 video if you care to check it out. Your the first person to try to help and resolve my error. So thanks.

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

BCE0044 Error 1 Answer

ERROR unity expected. insert a semicolon at the end 2 Answers

Very new to scripting: Apparently I have a unexpected token? 1 Answer

please help NullReferenceException object 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges