I am trying to clean up my assets a bit, by making the same editor object spawn different versions of a sprite.
I want to control the choice of which version to take via the Editor Keys
Here is one version of this:
Code: Select all
class Villager: Actor
{
Default
{
//$Sprite VILFA1
//$Arg0 "Type"
//$Arg0Type 11
//$Arg0Enum {0="Version 1"; 1="Version 2"; 2="Version 3";}
}
States
{
Spawn:
VILF A 0 {
switch(args[0]) {
case 0:
return ResolveState("Type1");
break;
case 1:
return ResolveState("Type2");
break;
case 2:
return ResolveState("Type3");
break;
default:
return ResolveState("Type1");
break;
}
}
Stop;
Type1:
VILF A -1;
Type2:
VILF B -1;
Type3:
VILF C -1;
}
}
Code: Select all
Script warning, "WN.pk3:acs/npcs.zs" line 87:
Incorrect number of return values. Got 0, but expected 1
Script error, "WN.pk3:acs/npcs.zs" line 87:
Return type mismatch
I was following this wiki page: https://zdoom.org/wiki/Switch/Case and examples discussed in this thread: viewtopic.php?t=76337
Does anyone know what is going wrong here?
From my testing (see also below), it seems like the switch statement (or the generic function) cannot deal with returning ResolveState, but I am not sure how to work around that.
Thanks so much in advance!
*edit: changed class inheritance to "actor" to make it more easily reproducible.