viewing paste Capture the Flag | Athena

Posted on the
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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
//Author        Goddameit
//Version       2012/06/08
//Web       http://bit.ly/Ja4udH
guild_room,236,283,4    script  CTF-Reward  100,{
    getitem 607,1;
    warp "prontera",150,180;
    end;
}
prontera,150,185,4  script  CTF 100,{
    if(getgmlevel())
        goto OnStart;
    function    c_flagon    {
        while(set(.@i,.@i+1)<=6)
        {
            if(getd("$@flag"+.@i+"_a")==getarg(0))
                return .@i;
        }
        return 0;
    }
    function    bx  {
        switch(getarg(0))
        {
            case 1: return 90;
            case 2: return 97;
            case 3: return 104;
            case 4: return 91;
            case 5: return 98;
            case 6: return 105;
        }
    }
    function    by  {
        switch(getarg(0))
        {
            case 1:
            case 2:
            case 3: return 178;
            case 4:
            case 5:
            case 6: return 18;
        }
    }
    if(!.game)
    {
        mes "No game now.";
        close;
    }
    if(.game==2)
    {
        mes "Starting.";
        close;
    }
    select("Join");
    mes "OK";
    set @ctf_tid,.join==0?1:.join==1?2:.join%2;
    setd ".join_j"+.join,getcharid(3);
    set .join,.join+1;
    close;
 
OnTimer120000:
    set .w,0;
    if(.ctf_tp1!=.ctf_tp2)
    {
        announce "[CTF] Team "+set(.w,(.ctf_tp1>.ctf_tp2?1:2))+" win.",0;
        for(set .@io,0;.@io<=.join;set .@io,.@io+1)
        {
            if(attachrid(getd(".join_j"+.@io)))
            {
                getmapxy(@cm$,@cx,@cy,0);
                if(@cm$=="prt_maze02")
                {
                    if(.w==@ctf_tid)
                    {
                        warp "guild_room",236,283;
                    }else
                        warp "prontera",150,180;
                }
                setd ".join_j"+.@io,0;
            }
        }
        set .join,0;
    }
    mapwarp "prt_maze02","prontera",150,180;
    announce "[CTF] Game Over",0;
    end;
OnStart:
    set .game,1;
    set .join,0;
    set .ctf_tn1,0;
    set .ctf_tn2,0;
    set .ctf_tp1,0;
    set .ctf_tp2,0;
    sleep2(10000);
    set .game,2;
    setmapflag "prt_maze02",mf_pvp;
    announce "[CTF]!!!",0;
    for(set .@io,0;.@io<=.join;set .@io,.@io+1)
    {
        if(attachrid(getd(".join_j"+.@io)))
        {
            warp "prt_maze02",bx(@ctf_tid*3),by(@ctf_tid*3);
        }
    }
    initnpctimer;
    initnpctimer "CTF-Point#1";
    initnpctimer "CTF-Point#2";
    end;
OnPCDieEvent:
    getmapxy(@cm$,@cx,@cy,0);
    if(@cm$!="prt_maze02"||.game!=2||!@ctf_tid)
        end;
    addtimer 5000,"CTF-Point#"+@ctf_tid+"::OnDie";
OnPCEnd:
OnPCLogoutEvent:
    set @ctf_tu,0;
    set @CTF,0;
    if(set(.@i,c_flagon(getcharid(0))))
    {
        deltimer "FlagTimer::OnTimerStart";
        callfunc "CTF_LimitSkillWhenCareFlag",0;
        getmapxy(.@cm$,.@cx,.@cy,0);
        hideoffnpc "Flag#"+.@i;
        stopnpctimer "Flag#"+.@i;
        setd "$@flag"+.@i+"_a",0;
        movenpc "Flag#"+.@i,.@cx,.@cy;
        if(@ctf_xt&&@ctf_tid)
        {
            specialeffect2 666;
            set @ctf_xt,0;
            mapannounce "prt_maze02","[CTF] Team "+@ctf_tid+" +1",0;
            setd ".ctf_tp"+@ctf_tid,getd(".ctf_tp"+@ctf_tid)+1;
            mapannounce "prt_maze02","[Sorce] "+.ctf_tp1+" : "+.ctf_tp2,0;
            movenpc "Flag#"+.@i,bx(.@i),by(.@i);
            getmapxy(getvariableofnpc(.cm$,"Flag#"+.@i),getvariableofnpc(.cx,"Flag#"+.@i),getvariableofnpc(.cy,"Flag#"+.@i),1,"Flag#"+.@i);
        }
        end;
    }
    set @ctf_xt,0;
    end;
}
prt_maze02,90,178,4 script  Flag#1  722,{
    if(getvariableofnpc(.game,"CTF")!=2||!@ctf_tid)
        end;
    function    bx  {
        switch(getarg(0))
        {
            case 1: return 90;
            case 2: return 97;
            case 3: return 104;
            case 4: return 91;
            case 5: return 98;
            case 6: return 105;
        }
    }
    function    by  {
        switch(getarg(0))
        {
            case 1:
            case 2:
            case 3: return 178;
            case 4:
            case 5:
            case 6: return 18;
        }
    }
    function    flag_tid    {
        if(getarg(0)<4)
            return 1;
        else
            return 2;
    }
    set .k,atoi(strnpcinfo(2));
    if(@ctf_tid!=flag_tid(.k))
    {
        getmapxy(.cm$,.cx,.cy,1);
        getmapxy(.@cm$,.@cx,.@cy,0);
        if(pow(.cx-.@cx,2)>9||pow(.cy-.@cy,2)>9)
        {
            message strcharinfo(0),"Too far!!"+rand(1000)+""+rand(1000);
            end;
        }
        if(@CTF)
            end;
        set @CTF,1;
        setd "$@flag"+.k+"_a",getcharid(0);
        hideonnpc strnpcinfo(0);
        callfunc "CTF_LimitSkillWhenCareFlag",1;
        addtimer 500,"FlagTimer::OnTimerStart";
        end;
    }else{
        getmapxy(.@cm$,.@cx,.@cy,1);
        if(.@cx==bx(.k)&&.@cy==by(.k))
            end;
        callfunc "CTF_LimitSkillWhenCareFlag",0;
        movenpc strnpcinfo(0),bx(.k),by(.k);
        set @CTF,1;
        end;
    }
}
-   script  FlagTimer   -,{
 
OnTimerStart:
    set @ctf_tu,@ctf_tu+1;
    if(@ctf_tu>120)
    {
        unitskilluseid getcharid(3),173,1;
        doevent "CTF::OnPCEnd";
        end;
    }
    specialeffect2 589;
    addtimer 500,"FlagTimer::OnTimerStart";
    end;
}
 
prt_maze02,97,178,4 duplicate(Flag#1)   Flag#2  722
prt_maze02,104,178,4    duplicate(Flag#1)   Flag#3  722
prt_maze02,91,18,4  duplicate(Flag#1)   Flag#4  722
prt_maze02,98,18,4  duplicate(Flag#1)   Flag#5  722
prt_maze02,105,18,4 duplicate(Flag#1)   Flag#6  722
 
prt_maze02,97,182,4 script  CTF-Point#1 111,3,3,{
    end;
 
OnDie:
    warp "prt_maze02",@ctf_tid==1?97:98,@ctf_tid==1?182:15;
    end;
OnTouch:
    if(getvariableofnpc(.game,"CTF")!=2||!@ctf_tid)
        end;
    if(@ctf_tid!=atoi(strnpcinfo(2)))
        end;
    set @ctf_xt,1;
    doevent "CTF::OnPCEnd";
    end;
 
OnTimer500:
    specialeffect 225;
    sleep(500);
    specialeffect 236;
    sleep(500);
    specialeffect 237;
    sleep(500);
    specialeffect 238;
    initnpctimer;
    end;
}
function    script  CTF_LimitSkillWhenCareFlag  {
    if(getarg(0,0))
    {
        setarray .@limit,51,135,264,150,426,420,356,249,290,462,464,465;
        set .@n,getarraysize(.@limit);
        set .@j,0;
        for(set .@i,0;.@i<.@n;set .@i,.@i+1)
        {
            if(getskilllv(.@limit[.@i]))
            {
                set @ctf_limit_id[.@j],.@limit[.@i];
                set @ctf_limit_lv[.@j],getskilllv(.@limit[.@i]);
                skill .@limit[.@i],0,0;
                set .@j,.@j+1;
            }
        }
    }else
    {
        set .@n,getarraysize(@ctf_limit_id);
        for(set .@i,0;.@i<.@n;set .@i,.@i+1)
        {
            skill @ctf_limit_id[.@i],@ctf_limit_lv[.@i],0;
        }
        deletearray @ctf_limit_id[0],128;
        deletearray @ctf_limit_lv[0],128;
        
    }
    return;
}
prt_maze02,98,15,4  duplicate(CTF-Point#1)  CTF-Point#2 45,3,3
prt_maze02  mapflag nowarpto
prt_maze02  mapflag nosave
prt_maze02  mapflag nobranch
prt_maze02  mapflag nopenalty
prt_maze02  mapflag noreturn
prt_maze02  mapflag nowarp
prt_maze02  mapflag noicewall
prt_maze02  mapflag nomemo
prt_maze02  mapflag pvp
Viewed 1096 times, submitted by Guest.