Jump to content
  • 0

Capture the flag bug ineed help no join event


XrichiX

Question


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  01/30/14
  • Last Seen:  

//Author        Goddameit
//Version        2012/06/09    -    ''flag_event'' map
//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())
        if(select("Activate","Join")==1)
        {
            initnpctimer;
            close;
        }
    function    c_flagon    {
        while(set(.@i,.@i+1)<=6)
        {
            if(getd("$@flag"+.@i+"_a")==getarg(0))
                return .@i;
        }
        return 0;
    }
    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$=="flag_event")
                {
                    if(.w==@ctf_tid)
                    {
                        warp "guild_room",236,283;
                    }else
                        warp "prontera",150,180;
                }
                setd ".join_j"+.@io,0;
                deltimer "FlagTimer::OnTimerStart";
            }
        }
        set .join,0;
    }
    mapwarp "flag_event","prontera",150,180;
    announce "[CTF] Game Over",0;
    end;
OnTimer1:
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 "flag_event",mf_pvp;
    setmapflag "flag_event",mf_pvp_noguild;
    removemapflag "flag_event",mf_gvg;
    announce "[CTF]!!!",0;
    for(set .@io,0;.@io<=.join;set .@io,.@io+1)
    {
        if(attachrid(getd(".join_j"+.@io)))
        {
            if(@ctf_tid==2)
                warp "flag_event",180,87;
            else
                warp "flag_event",33,93;
        }
    }
    initnpctimer "CTF-Point#1";
    initnpctimer "CTF-Point#2";
    end;
OnPCDieEvent:
    getmapxy(@cm$,@cx,@cy,0);
    if(@cm$!="flag_event"||.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 "flag_event","[CTF] Team "+@ctf_tid+" +1",0;
            setd ".ctf_tp"+@ctf_tid,getd(".ctf_tp"+@ctf_tid)+1;
            mapannounce "flag_event","[Sorce] "+.ctf_tp1+" : "+.ctf_tp2,0;
            movenpc "Flag#"+.@i,107,90;
            getmapxy(getvariableofnpc(.cm$,"Flag#"+.@i),getvariableofnpc(.cx,"Flag#"+.@i),getvariableofnpc(.cy,"Flag#"+.@i),1,"Flag#"+.@i);
        }
        end;
    }
    set @ctf_xt,0;
    end;
}
flag_event,107,90,4    script    Flag#1    722,{
    if(getvariableofnpc(.game,"CTF")!=2||!@ctf_tid)
        end;
    function    flag_tid    {
        if(getarg(0)<4)
            return 1;
        else
            return 2;
    }
    set .k,atoi(strnpcinfo(2));
    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;
}
-    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;
}

flag_event,33,93,4    script    CTF-Point#1    111,3,3,{
    end;
OnDie:
    if(@ctf_tid==2)
        warp "flag_event",180,87;
    else
        warp "flag_event",33,93;
    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;
}
flag_event,180,87,4    duplicate(CTF-Point#1)    CTF-Point#2    45,3,3
flag_event    mapflag    nowarpto
flag_event    mapflag    nosave
flag_event    mapflag    nobranch
flag_event    mapflag    nopenalty
flag_event    mapflag    noreturn
flag_event    mapflag    nowarp
flag_event    mapflag    noicewall
flag_event    mapflag    nomemo
flag_event    mapflag    pvp

 

Edited by Emistry
codebox
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...