viewing paste topic/10996 - recreate_instance | Athena

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
prontera,160,178,5  script  debug   1_F_MARIA,{
    $floorclear = 0;
    dispbottom "reset";
}
 
prontera,156,178,5  script  SAO??NO 1_F_MARIA,{
    mes "No. of stage beaten : "+( $floorclear +1 == .totalfloor ? "ALL" : $floorclear +" stage" );
    mes "Which floor do you want to challenge ?";
    next;
    for ( .@i = 0; .@i <= $floorclear; .@i++ )
        .@menu$ = .@menu$ +"Floor No. "+( .@i +1 )+":";
    .@s = select( .@menu$ );
    if ( has_instance2("guild_vs2") >= 0 )
        instance_destroy has_instance2("guild_vs2");
    if ( ( .@ins = instance_create( "Challenge Floor No."+ .@s, getcharid(3), IOT_CHAR ) ) < 0 ) {
        mes "error : "+ .@ins;
        close;
    }
    if ( !getstrlen( instance_attachmap( "guild_vs2", .@ins, 1, ( getcharid(3) - 2000000 )+"SAO"+ .@s ) ) ) {
        mes "error : 5";
        instance_destroy .@ins;
        close;
    }
    instance_set_timeout 3600, 15, .@ins; // 1 hour to kill, 15 seconds to destroy
    instance_attach .@ins;
    'floor = .@s;
    instance_init .@ins;
    warp ( getcharid(3) - 2000000 )+"SAO"+ .@s, 50,50;
    end;
OnInit:
    setarray .floor,
        OSIRIS, // 1st floor
        BAPHOMET, // 2nd floor
        DOPPELGANGER; // 3rd floor
    .totalfloor = getarraysize(.floor);
    end;
}
 
guild_vs2,50,50,5   script  portal  WARPNPC,2,2,{
    if ( 'floor == getvariableofnpc( .totalfloor, "SAO??NO" ) ) {
        mes "no more";
        close2;
        warp "Save", 0,0;
        instance_destroy has_instance( "guild_vs2" );
        end;
    }
    if ( 'floor > $floorclear ) {
        announce "[SAO Instance???] Floor No. "+ 'floor +" has open !", bc_all;
        $floorclear = 'floor;
    }
    .@floor = 'floor +1;
    instance_destroy has_instance( "guild_vs2" );
    if ( ( .@ins = instance_create( "Challenge Floor No."+ .@floor, getcharid(3), IOT_CHAR ) ) < 0 ) {
        mes "error : "+ .@ins;
        close;
    }
    if ( !getstrlen( instance_attachmap( "guild_vs2", .@ins, 1, ( getcharid(3) - 2000000 )+"SAO"+ .@floor ) ) ) {
        mes "error : 5";
        warp "Save", 0,0;
        instance_destroy .@ins;
        close;
    }
    instance_set_timeout 3600, 15, .@ins; // 1 hour to kill, 15 seconds to destroy
    instance_attach .@ins;
    'floor = .@floor;
    instance_init .@ins;
    warp ( getcharid(3) - 2000000 )+"SAO"+ .@floor, 50,50;
    end;
OnInstanceInit:
    monster strnpcinfo(4), 50,50, "--ja--", getelementofarray( getvariableofnpc( .floor, "SAO??NO" ), 'floor -1 ), 1, instance_npcname( strnpcinfo(0) )+"::OnFloorBossDead";
    hideonnpc instance_npcname( strnpcinfo(0) );
    end;
OnFloorBossDead:
    announce "Floor No. "+( 'floor )+" cleared ! Select an item from the drop list as your reward.", bc_map;
    mes "Select an item for your reward";
    next;
    getmobdrops getelementofarray( getvariableofnpc( .floor, "SAO??NO" ), 'floor -1 );
    for ( .@i = 0; .@i < $@MobDrop_count -1; .@i++ )
        .@menu$ = .@menu$ + getitemname( $@MobDrop_item[.@i] ) +" - "+ $@MobDrop_rate[.@i] / 100 +"."+ $@MobDrop_rate[.@i] % 100 +"%:";
    copyarray .@itemid, $@MobDrop_item, $@MobDrop_count -1;
    .@s = select( .@menu$ ) -1;
    getitem .@itemid[.@s], 1;
    hideoffnpc instance_npcname( strnpcinfo(0) );
    close;
}
Viewed 1423 times, submitted by AnnieRuru.