Jump to content

Patskie

Members
  • Posts

    1702
  • Joined

  • Last visited

  • Days Won

    18

Posts posted by Patskie

  1. //===== rAthena Script =======================================
    //= Battleground: Emperium
    //===== Description: =========================================
    //= A simple battleground script:
    //= Destroy the opponent's Emperium to win the match.
    //===== Changelogs: ==========================================
    //= 1.0 First version, edited. [Euphy] [AnnieRuru]
    //= 1.1 Use up to date battleground script commands [AnnieRuru]
    //= 1.2 Fix player can be kill multiple times within 250ms time frame [AnnieRuru]
    //============================================================
    
    -	script	bg_emp#control	-1,{
    OnInit:
    	.minplayer2start = 5;      // minimum players to start (ex. if 3vs3, set to 3)
    	.eventlasting    = 20*60;  // event duration before auto-reset (20 minutes * seconds)
    	setarray .rewarditem[0],   // rewards for the winning team: <item>,<amount>,...
    		7829, 30;
    	end;
    OnStart:
    	if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start )
    		end;
    
    	// create Battleground and teams
    	.red = waitingroom2bg( "-", 0,0, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead", .rednpcname$ );
    	.blue = waitingroom2bg( "-", 0,0, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead", .bluenpcname$ );
    	delwaitingroom .rednpcname$;
    	delwaitingroom .bluenpcname$;
    	setwall "bat_a01", 164,347, 6, 4, 0, "bg_emp_town_red";
    	setwall "bat_a01", 154,51, 6, 4, 0, "bg_emp_town_blue";
    	bg_warp .red, "bat_a01", 171,346;
    	bg_warp .blue, "bat_a01", 162,50;
    
    	// delay before match begins
    	sleep 6000;
    	mapannounce "bat_a01", "The rules are simple. The first team to break the opponent's Emperium wins!", bc_map;
    	sleep 3000;
    	for ( .@i = 5; .@i > 0; --.@i ) {
    		mapannounce "bat_a01", "["+ .@i +"]", bc_map;
    		sleep 1000;
    	}
    	mapannounce "bat_a01", "Start!", bc_map;
    
    	// spawn Emperiums
    	bg_monster .red,"bat_a01",171,346, "--ja--",1915, strnpcinfo(3)+"::OnRedDown";
    	bg_monster .blue,"bat_a01",162,50, "--ja--",1914, strnpcinfo(3)+"::OnBlueDown";
    	delwall "bg_emp_town_red";
    	delwall "bg_emp_town_blue";
    
    	// match duration
    	sleep .eventlasting * 1000;
    
    	// end match, destroy Battleground, reset NPCs
    	killmonster "bat_a01", strnpcinfo(3)+"::OnRedDown";
    	killmonster "bat_a01", strnpcinfo(3)+"::OnBlueDown";
    	if ( .winside ) {
    		mapannounce "bat_a01", "- "+( (.winside == .red)? "Red" : "Blue" )+" Team is victorious! -", bc_map;
    		bg_get_data .winside, 1;
    		for ( .@i = 0; .@i < $@arenamemberscount; ++.@i )
    			getitem .rewarditem[0], .rewarditem[1], $@arenamembers[.@i];
    		bg_get_data .loseside, 1;
    		for ( .@i = 0; .@i < $@arenamemberscount; ++.@i )
    			getitem 7829, 15, $@arenamembers[.@i];
    	} else
    		mapannounce "bat_a01", "- The match has ended in a draw! -", bc_map;
    	sleep 5000;
    	bg_warp .red, "prontera", 155,182;
    	bg_warp .blue, "prontera", 158,182;
    	bg_destroy .red;
    	bg_destroy .blue;
    	.winside = 0;
    	donpcevent .rednpcname$ +"::OnStart";
    	donpcevent .bluenpcname$ +"::OnStart";
    	end;
    
    // Emperium destroyed
    OnRedDown:  callsub L_EmpDown, "Red", .blue;
    OnBlueDown: callsub L_EmpDown, "Blue", .red;
    L_EmpDown:
    	mapannounce "bat_a01", strcharinfo(0) +" has destroyed "+ getarg(0) +" Team's Emperium.", bc_map;
    	.winside = getarg(1);
    	.loseside = .winside == .red ? .blue : .red;
    	awake strnpcinfo(0);
    	end;
    
    // "OnDeath" event
    OnRedDead:  callsub L_Dead, 157,347;
    OnBlueDead: callsub L_Dead, 142,51;
    L_Dead:
    	warp "bat_a01", getarg(0), getarg(1);
    	percentheal 100,100;
    	end;
    
    // "OnQuit" event
    OnRedQuit:  callsub L_Quit, .red, "Red";
    OnBlueQuit: callsub L_Quit, .blue, "Blue";
    L_Quit:
    	percentheal 100, 100;
    	if ( !bg_get_data( getarg(0), 0 ) )
    		mapannounce "bat_a01", "All "+ getarg(1) +" team members have quit!", bc_map, 0xff3333;
    	end;
    }
    
    bat_room,138,136,6	script	Red Team#bg_emp	413,{
    	end;
    OnInit:
    	sleep 1;
    	set getvariableofnpc( .rednpcname$, "bg_emp#control" ), strnpcinfo(0);
    OnStart:
    	waitingroom "Red Team", getvariableofnpc( .minplayer2start, "bg_emp#control" ) +1, "bg_emp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_emp#control" );
    	end;
    }
    
    bat_room,144,136,4	script	Blue Team#bg_emp	417,{
    	end;
    OnInit:
    	sleep 1;
    	set getvariableofnpc( .bluenpcname$, "bg_emp#control" ), strnpcinfo(0);
    OnStart:
    	waitingroom "Blue Team", getvariableofnpc( .minplayer2start, "bg_emp#control" ) +1, "bg_emp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_emp#control" );
    	end;
    }
    
    bat_room,141,135,6	script	BG EMP	858,{
    mes "BG EMP 5 VS 5";
    mes "Premio Equipo Ganador:";
    mes "30 <ITEM>Valor Badge<INFO>7828</INFO></ITEM>";
    mes "Premio Equipo Perdedor:";
    mes "15 <ITEM>Valor Badge<INFO>7828</INFO></ITEM>";
    end;
    }
    
    bat_a01	mapflag	battleground
    bat_a01	mapflag	nosave	SavePoint
    bat_a01	mapflag	nowarp
    bat_a01	mapflag	nowarpto
    bat_a01	mapflag	noteleport
    bat_a01	mapflag	nomemo
    bat_a01	mapflag	nopenalty
    bat_a01	mapflag	nobranch
    bat_a01	mapflag	noicewall
    bat_a01	mapflag	hidemobhpbar

     

    • MVP 1
  2. Try below

    prontera,150,150,6	script	Gold Room Warper	100,{
    	warp "ordeal_3-1", 149, 149;
    	end;
    
    	OnPCDieEvent:
    		if (strcharinfo(3) != "ordeal_3-1" || !countitem(.item) || killerrid == getcharid(3)) end;
    		getmapxy .@map$, .@x, .@y;
    		.@i = countitem(.item) / 10;
    		if (!.@i) end;
    		delitem .item, .@i;
    		makeitem .item, .@i, .@map$, .@x, .@y;
    		end;
    	
    	OnInit:
    		.item = 969; // Gold
    		end;
    }
    
    ordeal_3-1,0,0	monster	Dokebi	1110,50,5000

     

  3. Change 

    if (getequiprefinerycnt(.@part) >= 7)
    announce "[Hollgrehenn]: "+strcharinfo(0)+" has successfully refined "+getequipname(.@part)+" to +"+getequiprefinerycnt(.@part)+"!",0;

    To

    switch (getiteminfo(getequipid(.@part), 13)) {
    	case 1: .@asd = 9; break;
    	case 2: .@asd = 8; break;
    	case 3: .@asd = 6; break;
    	case 4: .@asd = 5; break;
    	default: break;
    }
    if (getequiprefinerycnt(.@part) >= .@asd)
    announce "[Hollgrehenn]: "+strcharinfo(0)+" has successfully refined "+getequipname(.@part)+" to +"+getequiprefinerycnt(.@part)+"!",0;

     

  4. 9 hours ago, Mabuhay said:
    
    -	script	asdahjhla	-1,{
    OnPCKillEvent:
    	if ( inarray(.map$, strcharinfo(3)) != -1 ) {
    		if ( rand(100) <= .chance ) {
    			getitem 501, 10;
    			#CASHPOINTS += 1; // I forgot to add this
    			dispbottom "You earned 1 Cash Point. Total : "+ #CASHPOINTS;
    		}
    	}
    	end;
    
    OnInit:
    	.chance = 50; // chance to get something
    	setarray .map$, "prontera", "payon"; // map list
    }

     

    This can be exploited if you do a suicide mission (paladin casting grand cross for instance)

    @Mizore 

    Change 

    if ( rand(100) <= .chance ) {

    to

    if ( rand(100) <= .chance && killedrid != getcharid(3) ) {

     

    • Upvote 1
  5. *guildgetexp <amount>;
    
    This will give the specified amount of guild experience points to the guild the
    invoking character belongs to. It will silently fail if they do not belong to
    any guild.

     

    • Upvote 1
  6. Your script will already check if the invoking player is in party or not 

    if (getcharid(1) == 0){
       mes "^ff0000To enter, you must create or join a party of 1 or more members.^000000";
       close;
    }
    *getcharid(<type>{,"<character name>"})
    
    This function will return a unique ID number of the invoking character, or, if a
    character name is specified, of that player.
    
    Type is the kind of associated ID number required:
    
     0 - Character ID
     1 - Party ID
     2 - Guild ID
     3 - Account ID
     4 - Battle Ground ID
     5 - Clan ID

     

  7. You could try below

    prontera,150,150,6	script	Gold Room Manager	2_M_OLDBLSMITH,{
    	function CheckRoom;
    	.@guild = getcharid(2);
    	if (!.@guild) {
    		mes .npc$;
    		mes "You are not in guild";
    		close;
    	}
    	if (strcharinfo(0) != getguildmaster(.@guild)) {
    		mes .npc$;
    		mes "Only guild leader can talk to me";
    		close;
    	}
    	if (Zeny < .zeny) {
    		mes .npc$;
    		mes "You need " + (callfunc ("F_InsertComma", .zeny)) + " zeny in order to rent a room.";
    		close;
    	}
    	mes .npc$;
    	mes "Which map do you want to rent?";
    	next;
    	while (.@i < .size) {
    		if (CheckRoom(.@i) && getd(".Room"+.@i) == getcharid(2))
    			.@owned++;
    		.@menu$ += .Maps$[.@i] + " - [" + (CheckRoom(.@i) ? "Unavailable" : "Available") + "]:";
    		.@i++;
    	}
    	.@s = select(.@menu$) - 1;
    	if (CheckRoom(.@s)) {
    		mes .npc$;
    		mes "I told you it's unavailable!";
    		close;
    	}
    	if (.@owned) {
    		mes .npc$;
    		mes "You already owned a room! Make room for others!";
    		close;
    	}
    	mes .npc$;
    	mes "Are you sure you want to rent " + .Maps$[.@s] + "?";
    	next;
    	if (select("Yes:No") - 1) end;
    	Zeny -= .zeny;
    	setd ".Room"+.@s, .@guild;
    	announce "Guild " + getguildname(.@guild) + " has occupied gold room " + .Maps$[.@s], 0;
    	close;
    	
    	// true = occupied | false = available
    	function CheckRoom {
    		.@rn = getarg(0, 0);
    		return getd(".Room"+.@rn) ? true : false;
    	}
    	
    	// Release rooms every 2 hours
    	OnMinute00:
    		if (gettime(DT_HOUR) % 2) end;
    		while (.@i < .size) {
    			setd ".Room"+.@i, 0;
    			.@i++;
    		}
    		announce "Gold rooms are now available again for rent!", 0;
    		end;
    	
    	OnGuildRoom:
    		if (!getcharid(2)) end;
    		while (.@i < .size) {
    			if (getd(".Room"+.@i) == getcharid(2)) {
    				warp .Maps$[.@i], 0, 0;
    				break;
    			}
    			.@i++;
    		}
    		end;
    	
    	OnInit:
    		.npc$ = "[" + strnpcinfo(1) + "]";
    		setarray .Maps$[0], "ordeal_3-1", "ordeal_3-2";
    		.size = getarraysize(.Maps$);
    		while (.@i < .size) {
    			setmapflag .Maps$[.@i], MF_NOWARPTO;
    			.@i++;
    		}
    		.zeny = 5000;
    		bindatcmd "guildroom", strnpcinfo(1) + "::OnGuildRoom";
    		end;
    }
    
    -	script	GRBuff	FAKE_NPC,{
    	if (@delay > gettimetick(2)) {
    		emotion ET_ANGER;
    		npctalk "Use me after " + (@delay - gettimetick(2)) + " second(s).";
    	} else {
    		specialeffect2 EF_HEAL2;
    		percentheal 100,100;
    		specialeffect2 EF_INCAGILITY;
    		sc_start SC_INCREASEAGI,240000,10;
    		specialeffect2 EF_BLESSING;
    		sc_start SC_BLESSING,240000,10;
    		@delay = gettimetick(2) + 3; // 3 seconds delay
    	}
    	end;
    }
    
    // Add more npc on every room
    ordeal_3-1,149,149,6	duplicate(GRBuff)	Kiddo#ord31	4W_KID
    ordeal_3-2,153,153,6	duplicate(GRBuff)	Kiddo#ord32	4W_KID
    
    // Monsters
    ordeal_3-1,0,0	monster	Dokebi	1110,50,5000
    ordeal_3-2,0,0	monster	Dokebi	1110,50,5000

     

    • Upvote 1
×
×
  • Create New...