Try something like this ... I didn't really understand what you were doing in your code.
PHP Code:
function warpToHosptial()
{
this.locations = {
{ "level1.nw", x, y },
{ "level2.nw", x, y },
{ "level3.nw", x, y }
};
temp.ran = random( 0, this.locations.size() );
temp.coords = this.locations[temp.ran];
player.setlevel2( temp.coords[0], temp.coords[1], temp.coords[2] );
}