Bash And Slash Error codes CS1729, CS1502, CS1503. What is wrong?
- CS1729 You supplied too few or too many arguments to constructor.
- CS1502 You supplied wrong argument type(s) for the method (or constructor).
- CS1503 You supplied wrong argument type(s) for the method (or constructor).
It is the Under the melee offence bits all of it is errors
public void SetUpSkillModifiers() {
//Melee Offence
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));
//Melee Defence
GetSkill((int)SkillName.Melee_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed), .33f));
GetSkill((int)SkillName.Melee_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Constitution), .33f));
//Magic Offence
GetSkill((int)SkillName.Magic_Offence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration), .33f));
GetSkill((int)SkillName.Magic_Offence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.WillPower), .33f));
//Magic Defence
GetSkill((int)SkillName.Melee_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration), .33f));
GetSkill((int)SkillName.Melee_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.WillPower), .33f));
//Ranged Offence
GetSkill((int)SkillName.Ranged_Offence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration), .33f));
GetSkill((int)SkillName.Ranged_Offence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed), .33f));
//Ranged Defence
GetSkill((int)SkillName.Ranged_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed), .33f));
GetSkill((int)SkillName.Ranged_Defence).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int) AttributeName.Nimbleness), .33f));
}
Well, Mr. Curious, first off I'd recommend that you break off your insanely long statements into something more manageable, and maybe make a method so you don't have to repeat yourself.
AddSkillModifier(SkillName.Melee_Offence, AttributeName.Might, .33f);
And then create method
void AddSkillModifier(SkillName skillName, AttributeName attributeName, float value) {
// This seems ok.
Skill skill = GetSkill((int)skillName);
// This seems to return a System.Attribute, is this intended?
Attribute primary = GetPrimaryAttribute((int)attributeName);
// This probably cause CS1729 since it invokes a constructor.
// Check your constructor for that type.
// This could perhaps cause CS1502 and CS1503.
// Maybe you're passing System.Attribute where you expected something else?
ModifyingAttribute modifier = new ModifyingAttribute(primary, value);
// This could perhaps cause CS1502 and CS1503.
skill.AddModifier(modifier);
}
Note that you have imported System namespace. It contains an Attribute class. Perhaps you are having some ambiguity in your code because of this?
With this new method your code should be clearer:
public void SetUpSkillModifiers() {
// Check comments right side ->
float m = 0.33f;
AddSkillModifier(SkillName.Melee_Offence, AttributeName.Might , m);
AddSkillModifier(SkillName.Melee_Offence, AttributeName.Nimbleness , m);
AddSkillModifier(SkillName.Melee_Defence, AttributeName.Speed , m);
AddSkillModifier(SkillName.Melee_Defence, AttributeName.Constitution , m);
AddSkillModifier(SkillName.Magic_Offence, AttributeName.Concentration, m);
AddSkillModifier(SkillName.Magic_Offence, AttributeName.WillPower , m);
AddSkillModifier(SkillName.Melee_Defence, AttributeName.Concentration, m); // Melee? Bug?
AddSkillModifier(SkillName.Melee_Defence, AttributeName.WillPower , m); // Melee? Bug?
AddSkillModifier(SkillName.Ranged_Offence, AttributeName.Concentration, m);
AddSkillModifier(SkillName.Ranged_Offence, AttributeName.Speed , m);
AddSkillModifier(SkillName.Ranged_Defence, AttributeName.Speed , m);
AddSkillModifier(SkillName.Ranged_Defence, AttributeName.Nimbleness , m);
}
Could you post the actual errors? They make it far easier to work out what's wrong
If you can't take the time to phrase a good question you won't get any answers. Unity gives you a detailed error message which would be much better than posting error codes... You also get the line number where the error occurred. A short google: 1729 == Wrong constructor parameter count, 1502 == best overloaded function match have invalid arguments, 1503 == can't convert type into type. If you don't tell use where the error have been spotted we can't even say what class is involved. And without seeing the class implementations we can't help you.
BTW: what are those ***? did you try to highlight that part as bold and italic? Inside a code block you can't use any markup so you might remove it.
Zzzzz good example why you don't steal peoples code and use it as your own, because it shows you can't read code, therefore you can't write it, unlike if you take the time to learn, you can write your own, know how it works, and everything/everybody will be merry, but no... So, I suggest you rewrite/learn the code/to code, and THEN if you run in to problems, I'll help you =).
and i wasn't stealing the code i was actually working through a tutorial so help me learn!