Jump to content
  • 0

Need Help sa CTF Event


Scotch

Question


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  118
  • Reputation:   0
  • Joined:  09/19/12
  • Last Seen:  

Hello guys cnu pde mkatulong sken d2 sa CTF event...

 

 

 

1. when they click the CTF NPC they will warp in the event map and they will put in a random team.

2. when the event activated they will join the event they will only warp when both team are full.

3. if its full it will announce that the team are already full before they warp in the map

 

 

how to put a script on announcing the event is not yet available because the team are not yet full? i set it in 10 member each team.

 

sorry for my bad eng :)

//Author		Goddameit
//Version		2012/06/09	-	''flag_event'' map
//Web		http://bit.ly/Ja4udH
guild_room,236,283,4	script	CTF-Reward	100,{
	getitem 7711,1;
	warp "prontera",150,180;
	end;
}
prontera,164,170,4	script	CTF	100,{
	if(getgmlevel())
		if(select("Activate Event","Join Event")==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 available right now.";
		close;
	}
	if(.game==2)
	{
		mes "Starting the Event.";
		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;
	end;

OnTimer3000000:
	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;
	close;
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;
	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";
	close;
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","[Score] "+.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);
		}
		close;
	}
	set @ctf_xt,0;
	close;
}
flag_event,107,90,4	script	Flag#1	722,{
	if(getvariableofnpc(.game,"CTF")!=2||!@ctf_tid)
		close;
	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);
		close;
	}
	if(@CTF)
		close;
	set @CTF,1;
	setd "$@flag"+.k+"_a",getcharid(0);
	hideonnpc strnpcinfo(0);
	callfunc "CTF_LimitSkillWhenCareFlag",1;
	addtimer 500,"FlagTimer::OnTimerStart";
	close;
}
-	script	FlagTimer	-,{

OnTimerStart:
	set @ctf_tu,@ctf_tu+1;
	if(@ctf_tu>120)
	{
		unitskilluseid getcharid(3),173,1;
		doevent "CTF::OnPCEnd";
		close;
	}
	specialeffect2 589;
	addtimer 500,"FlagTimer::OnTimerStart";
	close;
}

flag_event,33,93,4	script	CTF-Point#1	111,3,3,{
	close;

OnDie:
	if(@ctf_tid==2)
		warp "flag_event",180,87;
	else
		warp "flag_event",33,93;
	close;
OnTouch:
	if(getvariableofnpc(.game,"CTF")!=2||!@ctf_tid)
		close;
	if(@ctf_tid!=atoi(strnpcinfo(2)))
		close;
	set @ctf_xt,1;
	doevent "CTF::OnPCEnd";
	close;

OnTimer500:
	specialeffect 225;
	sleep(500);
	specialeffect 236;
	sleep(500);
	specialeffect 237;
	sleep(500);
	specialeffect 238;
	initnpctimer;
	close;
}
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
flag_event	mapflag	pvp_noguild 

this is the special function

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;
}

I hope someone help me on this script...thanks in advance


Hello guys cnu pde mkatulong sken d2 sa CTF event...

 

 

 

1. when they click the CTF NPC they will warp in the event map and they will put in a random team.

2. when the event activated they will join the event they will only warp when both team are full.

3. if its full it will announce that the team are already full before they warp in the map

 

 

how to put a script on announcing the event is not yet available because the team are not yet full? i set it in 10 member each team.

 

sorry for my bad eng :)

//Author		Goddameit
//Version		2012/06/09	-	''flag_event'' map
//Web		http://bit.ly/Ja4udH
guild_room,236,283,4	script	CTF-Reward	100,{
	getitem 7711,1;
	warp "prontera",150,180;
	end;
}
prontera,164,170,4	script	CTF	100,{
	if(getgmlevel())
		if(select("Activate Event","Join Event")==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 available right now.";
		close;
	}
	if(.game==2)
	{
		mes "Starting the Event.";
		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;
	end;

OnTimer3000000:
	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;
	close;
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;
	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";
	close;
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","[Score] "+.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);
		}
		close;
	}
	set @ctf_xt,0;
	close;
}
flag_event,107,90,4	script	Flag#1	722,{
	if(getvariableofnpc(.game,"CTF")!=2||!@ctf_tid)
		close;
	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);
		close;
	}
	if(@CTF)
		close;
	set @CTF,1;
	setd "$@flag"+.k+"_a",getcharid(0);
	hideonnpc strnpcinfo(0);
	callfunc "CTF_LimitSkillWhenCareFlag",1;
	addtimer 500,"FlagTimer::OnTimerStart";
	close;
}
-	script	FlagTimer	-,{

OnTimerStart:
	set @ctf_tu,@ctf_tu+1;
	if(@ctf_tu>120)
	{
		unitskilluseid getcharid(3),173,1;
		doevent "CTF::OnPCEnd";
		close;
	}
	specialeffect2 589;
	addtimer 500,"FlagTimer::OnTimerStart";
	close;
}

flag_event,33,93,4	script	CTF-Point#1	111,3,3,{
	close;

OnDie:
	if(@ctf_tid==2)
		warp "flag_event",180,87;
	else
		warp "flag_event",33,93;
	close;
OnTouch:
	if(getvariableofnpc(.game,"CTF")!=2||!@ctf_tid)
		close;
	if(@ctf_tid!=atoi(strnpcinfo(2)))
		close;
	set @ctf_xt,1;
	doevent "CTF::OnPCEnd";
	close;

OnTimer500:
	specialeffect 225;
	sleep(500);
	specialeffect 236;
	sleep(500);
	specialeffect 237;
	sleep(500);
	specialeffect 238;
	initnpctimer;
	close;
}
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
flag_event	mapflag	pvp_noguild 

this is the special function

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;
}

I hope someone help me on this script...thanks in advance

I solve it already....hehehe

Edited by Scotch
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...