You have extra brackets in there. I recoded it to be simpler and cleaner.
void main() {
object oWay, oPC=GetEnteringObject();
if (!GetIsPC(oPC))
return;
if( GetObjectbytag("morella",0) != OBJECT_INVALID)
return;
switch (Random(2)) {
case 0:
oWay = GetWaypointByTag("morella_01");
CreateObject(OBJECT_TYPE_CREATURE,"morella",GetLocation(oWay));
break;
case 1:
oWay = GetWaypointByTag("morella_02");
CreateObject(OBJECT_TYPE_CREATURE,"morella",GetLocation(oWay));
break;
}
}
My inclination is to get rid of oWay altogether and just stick the GetWaypoint in the GetLocation, but I want to make sure you understand what's going on here. A few notes:
Random(X) returns a number between 0 (zero) and X-1. In this case, 0 or 1. Random(5) would be 0-4, Random(30) would be 0-29. Get used to beginning a count with zero, as this is VERY commonly done in coding.
CreateObject doesn't need a B = in front of it. You can declare an object for it if you're going to do something else to that object, but this code isn't doing that, so it's useless clutter.
Please feel free to ask any questions you might have - learning to code can be frustrating, but it can also be immensely fun and rewarding.
Funky