yes ive posted about the same thing before, but this should be the last issue .
I have player charatcer with attribute Skills at value 3 to start
i then have (under npc's speak to options)
switch (Kurota.Skills) {
case (3) {
PrintCentered ("Dash & Slash {Blade} S dammade all enemies")
}
case (4) {
PrintCentered ("Breeze [Gust] S dammage all enemies")
}
However, it just results in this error:
"Error running script: Object reference not set to an instance of an object."
I copied that code (with the closing }
) into a new game, and it works fine.
Are you sure this is where the error is being generated?
switch
internally casts its parameters to strings before comparing them (why?), and the message is generated whenever you attempt to cast null
.
That's not really helpful; but I would call that a bug in Quest rather than your code.
Are you sure that Kurota's Skills attribute is set to 3? The only way I can get that error to appear in that code is if the attribute is set to null
(or isn't set, which is the same thing).
@mr.angel its definately set to 3 under attributes
can link to a screenshot
@Io That's one of the things I tried; it still matches.
switch
and case
convert their arguments to strings before comparing.