#SEQUENCE "stop";
# wait(.15);
# char_activate("player", 0);
  char_kill("hand_lvl_01");
  char_kill("hand_lvl_02");
  char_kill("hand_lvl_03");
 
  char_kill("arms_lvl_01");
  char_kill("arms_lvl_02");
  char_kill("arms_lvl_03");

  indicator_kill( "seagull", 0.01 );

  script_load("island/seagull");

  avar("island_free", 1);

  light_color("sun", .35, .35, .235);
# seq_jump(if(gvar("gfx_world_particles"), "particles", "check"));

#SEQUENCE "particles";
# var func = nop;
  func = if(geq(lvar("count"), 30), seq_jump, nop);
  func("check");
# particle_make( "mist_02", rand(0,150), rand(0,150), rand(9,24), rand(0.1,0.5), rand(-.1,.3), 0, 0 );
  particle_make( "mist_02", rand(0,150), rand(0,150), rand(9,24), rand(0.1,0.5), rand(-.1,.3), 0, 0 );
  particle_make( "mist_02", rand(0,150), rand(0,150), rand(9,24), rand(0.1,0.5), rand(-.1,.3), 0, 0 );
  particle_make( "mist_02", rand(0,150), rand(0,150), rand(9,24), rand(0.1,0.5), rand(-.1,.3), 0, 0 );
  particle_make( "mist_02", rand(0,150), rand(0,150), rand(9,24), rand(0.1,0.5), rand(-.1,.3), 0, 0 );
  particle_make( "mist_02", rand(0,150), rand(0,150), rand(9,24), rand(0.1,0.5), rand(-.1,.3), 0, 0 );
  particle_make( "mist_02", rand(0,150), rand(0,150), rand(9,24), rand(0.1,0.5), rand(-.1,.3), 0, 0 );
  particle_make( "mist_02", rand(0,150), rand(0,150), rand(9,24), rand(0.1,0.5), rand(-.1,.3), 0, 0 );
  particle_make( "mist_02", rand(0,150), rand(0,150), rand(9,24), rand(0.1,0.5), rand(-.1,.3), 0, 0 );
  particle_make( "mist_02", rand(0,150), rand(0,150), rand(9,24), rand(0.1,0.5), rand(-.1,.3), 0, 0 );
  lvar("count", add(lvar("count"), 10));
# wait( .0001 );

#SEQUENCE "check";
# var func = nop;
  func = if(eq(avar("island_01_loaded"), 1), seq_jump, nop);
  func("spawn_01");
# seq_jump("first");

#SEQUENCE "first";
# script_load("island/waves");
  script_load("island/boss_place");
  script_load("island/coconut_01");
  script_load("island/coconut_02");
  script_load("island/coconut_03");
  script_load("island/coconut_04");
  indicator_char_make( "island_telemus", 2, 0, "island_telemus", 1, colorRGB(0,0,1), .75, 1, 50, "indicator/talk.tga");
# wait(.1);
# seq_jump("spawn_01");

#SEQUENCE "spawn_01";
# char_make("monsters/hand_lvl_01", rand(500, 550), rand(500, 550), "hand_lvl_01", 1 );
  char_make("monsters/hand_lvl_02", rand(500, 550), rand(500, 550), "hand_lvl_02", 1 );
  char_make("monsters/hand_lvl_03", rand(500, 550), rand(500, 550), "hand_lvl_03", 1 );
  
  char_make("monsters/arms_lvl_01", rand(500, 550), rand(500, 550), "arms_lvl_01", 1 );
  char_make("monsters/arms_lvl_02", rand(500, 550), rand(500, 550), "arms_lvl_02", 1 );
  char_make("monsters/arms_lvl_03", rand(500, 550), rand(500, 550), "arms_lvl_03", 1 );

  //char_make("bosses/phemus", rand(500, 550), rand(500, 550), "phemus", 1 );

  script_load("island/seagull_01");

# char_clone("hand_lvl_01", 72, 98);
  char_clone("hand_lvl_01", 71, 42);

  //char_clone("phemus", 127, 123);

# seq_jump("x_02");

#SEQUENCE "x_02";
# lvar("x", "x_02");
  lvar("y", "y_02");
# var func = nop;
  func = if(eq(lvar("calc"), 0), seq_jump, nop);
  func("calc_vars");
# char_clone("arms_lvl_01", lvar("x_02"), lvar("y_02"));
# char_clone("arms_lvl_01", add(-2, lvar("x_02")), add(2, lvar("y_02")));
# char_clone("arms_lvl_01", add(-1, lvar("x_02")), add(2, lvar("y_02")));
# char_clone("arms_lvl_01", add(-2, lvar("x_02")), add(1, lvar("y_02")));
# char_clone("arms_lvl_02", add(1, lvar("x_02")),  add(-1, lvar("y_02")));
# lvar("calc", 0);
# seq_jump("x_03");

#SEQUENCE "x_03";
# lvar("x", "x_03");
  lvar("y", "y_03");
# var func = nop;
  func = if(eq(lvar("calc"), 0), seq_jump, nop);
  func("calc_vars");
# char_clone("arms_lvl_01", lvar("x_03"), lvar("y_03"));
# char_clone("arms_lvl_01", add(-2, lvar("x_03")), add(2, lvar("y_03")));
# char_clone("arms_lvl_01", add(-1, lvar("x_03")), add(2, lvar("y_03")));
# char_clone("arms_lvl_01", add(-2, lvar("x_03")), add(1, lvar("y_03")));
# char_clone("arms_lvl_02", add(1, lvar("x_03")),  add(-1, lvar("y_03")));
# lvar("calc", 0);
# seq_jump("check_title");

#SEQUENCE "calc_vars";
# lvar("temp_x", rand(10,75));
  lvar("temp_y", rand(10,75));
# var dx = sub( lvar("x_02"), lvar("temp_x") );
  var dy = sub( lvar("y_02"), lvar("temp_y") );
  var dist = add( mult(dx,dx), mult(dy,dy) );
  var func = nop;
  func = if( less( dist, 1600 ), seq_jump, nop );
  func( "calc_vars" );
# var dx = sub( lvar("x_03"), lvar("temp_x") );
  var dy = sub( lvar("y_03"), lvar("temp_y") );
  var dist = add( mult(dx,dx), mult(dy,dy) );
  var func = nop;
  func = if( less( dist, 1600 ), seq_jump, nop );
  func( "calc_vars" );
# seq_jump("set_vars");
# wait(.01);

#SEQUENCE "set_vars";
# lvar(lvar("x"), lvar("temp_x"));
  lvar(lvar("y"), lvar("temp_y"));
  lvar("calc", 1);
# seq_jump(lvar("x"));

#SEQUENCE "check_title";
# var func = nop;
  func = if(eq(avar("island_01_loaded"), 1), seq_jump, nop);
  func("kill");
# seq_jump("name");

#SEQUENCE "name";
# char_activate("player", 1);
  avar("island_01_loaded", 1);
  timer_make( "island_time", 600, "" );
  floating_text_make( "Island of Evil", 275, 20, 2, 0, 0, 1, 32, colorRGB(1.0, 1.0, 1.0), 7.5, .75, .75, 0 );
  screenFX_fade( "fade_black", 3, 0 );
  avar("loading", 0);
# kill_this();
# seq_jump("wait");

#SEQUENCE "kill";
# wait(1);
# char_activate("player", 1);
  floating_text_make( "Wishbone Waterfront", 10, 20, 2, 0, 0, 1, 24, colorRGB(1.0, 1.0, 1.0), 5.0, .5, .5, 0 );
  floating_text_make( "Island Southeast", 10, 50, 2, 0, 0, 1, 16, colorRGB(1.0, 1.0, 1.0), 5.0, .5, .5, 0 );
  screenFX_fade( "fade_black", .5, 0 );
  avar("loading", 0);
# kill_this();
# seq_jump("wait");

#SEQUENCE "wait";
# wait( 10000 );
