viewing paste topic/4723- dungeon-event | 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
prontera,158,183,4  script  dungeon event   100,{
    mes "dungeon event blahblah";
    next;
    if ( !getcharid(1) ) {
        mes "you don't have a party";
        close;
    }
    getpartymember getcharid(1), 1;
    getpartymember getcharid(1), 2;
    if ( $@partymembercount != .register_count ) {
        mes "you need to form a party of "+ .register_count;
        close;
    }
    .@today = gettimestr("%Y%m%d", 9);
    .@origin = getcharid(3);
    for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
        if ( isloggedin( $@partymemberaid[.@i] , $@partymembercid[.@i] ) ) {
            attachrid $@partymemberaid[.@i];
            if ( strcharinfo(3) == strnpcinfo(4) )
                .@online++;
            if ( dungeon_ev_deny[ .@today ] >= .enterperday ) {
                .@denyname$[.@denycount] = strcharinfo(0);
                .@denycount++;
            }
        }
    }
    attachrid .@origin;
    if ( .@online != .register_count ) {
        mes "your party needs "+ .register_count +" party members online on "+ strnpcinfo(4) +" map";
        close;
    }
    if ( .@denycount ) {
        mes "There are a few party members that just enter this dungeon "+ .enterperday +" times today";
        for ( .@i = 0; .@i < .@denycount; .@i++ )
            mes ( .@i +1 ) +". "+ .@denyname$[.@i];
        close;
    }
    if ( ( .@ins = instance_create( "Dungeon event", getcharid(1), IOT_PARTY ) ) < 0 ) {
        mes "error : "+ .@ins;
        close;
    }
    if ( !getstrlen( instance_attachmap( "guild_vs2", .@ins, 1, getcharid(1)+"Dun_ev" ) ) ) {
        mes "error : 5";
        instance_destroy .@ins;
        close;
    }
    instance_set_timeout 0, 1, .@ins;
    instance_init .@ins;
    instance_attach .@ins;
    for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
        if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
            attachrid $@partymemberaid[.@i];
            if ( strcharinfo(3) == strnpcinfo(4) ) {
                warp has_instance("guild_vs2"), 0,0;
                if ( !dungeon_ev_deny[ .@today ] )
                    deletearray dungeon_ev_deny;
                dungeon_ev_deny[ .@today ]++;
            }
        }
    }
    end;
OnInit:
    setarray .round1, 1002,30, 1090,1; // 30 poring , 1 mastering
    setarray .round2, 1002,40, 1090,2; // 40 poring , 2 mastering
    setarray .round3, 1002,50, 1090,2; // 50 poring , 2 mastering
    setarray .round4, 1002,60, 1090,2; // 60 poring , 2 mastering
    setarray .round5, 1090,3; // 3 mastering
    .totalround = 5;
 
    .register_count = 5; // how many party members needed
    .enterperday = 3; // how many times can enter per day
 
    getmapxy .map$, .x, .y, 1;
    end;
}
 
guild_vs2,0,0,0 script  dun_ev  -1,{
OnInstanceInit:
    sleep 2000; // delay abit
Ondead:
    if ( 'round ) 'killed++;
    if ( 'killed < 'total ) end;
    .@main$ = "dungeon event"; // main npc name
    'round++;
    'killed = 0;
    if ( 'round == getvariableofnpc( .totalround, .@main$ ) +1 ) {
        instance_announce -1, "Congratulations !", bc_all;
        getpartymember getcharid(1), 1;
        getpartymember getcharid(1), 2;
        for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
            if ( isloggedin ( $@partymemberaid[.@i] , $@partymembercid[.@i]  ) ) {
                attachrid $@partymemberaid[.@i];
                if ( strcharinfo(3) == has_instance("guild_vs2") )
                    getitem 7227,30; // reward here
            }
        }
        sleep 2000;
        instance_warpall getvariableofnpc( .map$, .@main$ ), getvariableofnpc( .x, .@main$ ), getvariableofnpc( .y, .@main$ );
        end;
    }
    instance_announce -1, "Prepare for Level "+ 'round +" Mobs...", bc_all;
    sleep 2000;
    .@size = getarraysize( getvariableofnpc( getd( ".round"+ 'round ), .@main$ ) );
    'total = 0;
    for ( .@j = 0; .@j < .@size; .@j += 2 ) {
        monster has_instance( "guild_vs2" ), 49,49, "--ja--", getvariableofnpc( getelementofarray( getd( ".round"+ 'round ), .@j ), .@main$ ), getvariableofnpc( getelementofarray( getd( ".round"+ 'round ), .@j +1 ), .@main$ ), instance_npcname( strnpcinfo(0) )+"::Ondead";
        'total = 'total + getvariableofnpc( getelementofarray( getd( ".round"+ 'round ), .@j +1 ), .@main$ );
    }
    end;
}
 
guild_vs2   mapflag nowarp
guild_vs2   mapflag nowarpto
guild_vs2   mapflag nomemo
guild_vs2   mapflag nosave  SavePoint
guild_vs2   mapflag partylock
guild_vs2   mapflag src4instance
Viewed 1324 times, submitted by AnnieRuru.