Jump to content

asamjawa

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by asamjawa

  1. thanks and btw @AnnieRuru how to make it twice a week like tuesday and thursday start at 10 pm end at 11 pm sorry i am really newbie in scripting.
     
    edit this is my script am i do it right is on tuesday and thursday start at 8.30 pm end on 9.30 am i doing it right ?

    -	script	KoE	-1,{
    OnInit:
    	disablenpc "The King#KoE";
    	disablenpc "Exit#KoE";
    	bindatcmd "koe", strnpcinfo(0)+"::OnCommand", 99,99;
    	end;
    OnCommand:
    	if ( compare( .@atcmd_parameters$, "on" ) ) goto L_start;
    	else if ( compare( .@atcmd_parameters$, "off" ) ) goto L_end;
    	else {
    		dispbottom "type - '@koe on' to start the event";
    		dispbottom "type - '@koe off' to end the event";
    	}
    	end;
    OnTue2030:
    OnThu2030:
    L_start:
    	if ( .start ) end;
    	gvgon "guild_vs1";
    	announce "The King of Emperium Hill has begun!", bc_all;
    	.start = 1;
    	enablenpc "The King#KoE";
    	disablenpc "Exit#KoE";
    	$koegid = 0;
    	donpcevent "::OnRevKoE";
    	maprespawnguildid "guild_vs1", $koegid, 7;
    	monster "guild_vs1",49,49,"EMPERIUM",1288,1,"KoE::OnEmpDead";
    	end;
    OnTue2130:
    OnThu2130:
    L_end:
    	gvgoff "guild_vs1";
    	announce "The King of Emperium Hill is over!", bc_all;
    	.start = 0;
    	enablenpc "Exit#KoE";
    	disablenpc "The King#KoE";
    	killmonsterall "guild_vs1";
    //	maprespawnguildid "guild_vs1", $koegid, 6;
    	end;
    OnEmpDead:
    	$koegid = getcharid(2);
    	announce "The current King of Emperium Hill is the ["+ strcharinfo(2) +"] guild.", bc_all;
    	donpcevent "::OnRevKoE";
    	maprespawnguildid "guild_vs1", $koegid, 6;
    	sleep 500;
    	if ( .start )
    		monster "guild_vs1",49,49,"EMPERIUM",1288,1,"KoE::OnEmpDead";
    	end;
    }
    
    // KoE Entrance
    gonryun,159,107,4	script	The King#KoE	58,{
        mes "[The King]";
    	if ( !getcharid(2) ) {
    		mes "You must have a guild to participate in the ^FF0000King of Emperium Hill Tournament^000000.";
    		close;
    	}
        mes "Hello.";
        mes "Would you like to participate in the ^FF0000King of Emperium Hill Tournament^000000?";
    	if ( select ( "Yes", "No" ) == 2 ) close;
        switch( rand(1,4) ){
            case 1:	warp "guild_vs1", 50, 88; end;
            case 2:	warp "guild_vs1", 88, 50; end;
            case 3:	warp "guild_vs1", 50, 11; end;
            case 4:	warp "guild_vs1", 11, 50; end;
    	}
    }
    
    // KoE Exit
    guild_vs1,49,56,5	script	Exit#KoE	51,{
    	mes "[Exit]";
    	mes "See ya.";
    	if ( getcharid(2) == $koegid )
    		getitem 13550, 100;
    	close2;
    	warp "Save",0,0;
    	end;
    }
    
    // Flags
    guild_vs1,49,38,4	script	King of Emperium Hill#1::koe_flag	722,{
    	if ( !$koegid ) end;
    	mes "[King of Emperium Hill]";
    	mes "The Current King of Emperium Hill is the ["+ getguildname($koegid) +"] guild.";
    	close;
    OnRevKoE:
    	flagemblem $koegid;
    	end;
    }
    guild_vs1,61,49,6	duplicate(koe_flag)	King of Emperium Hill#2	722
    guild_vs1,38,49,2	duplicate(koe_flag)	King of Emperium Hill#3	722
    guild_vs1,49,61,0	duplicate(koe_flag)	King of Emperium Hill#4	722
    
    guild_vs1	mapflag	nobranch
    guild_vs1	mapflag	nomemo
    guild_vs1	mapflag	nopenalty
    guild_vs1	mapflag	noreturn
    guild_vs1	mapflag	nosave	SavePoint
    guild_vs1	mapflag	noteleport
    guild_vs1	mapflag	gvg_noparty
    guild_vs1	mapflag	nowarp
    guild_vs1	mapflag	nowarpto
    guild_vs1	mapflag	guildlock
    
  2.  db/castle_db.txt | 2 ++
     src/map/battle.c | 7 +++++++
     src/map/battle.h | 1 +
     3 files changed, 10 insertions(+)
    
    diff --git a/db/castle_db.txt b/db/castle_db.txt
    index 12e222e..29bca74 100644
    --- a/db/castle_db.txt
    +++ b/db/castle_db.txt
    @@ -72,3 +72,5 @@
     31,arug_cas03,Horn,Manager#arug_cas03,1               // kRO : Horn
     32,arug_cas04,Gefn,Manager#arug_cas04,1               // kRO : Gefn
     33,arug_cas05,Bandis,Manager#arug_cas05,1             // kRO : Bandis
    +
    +100,guild_vs1,King of Emperium Hill,koe,1
    \ No newline at end of file
    diff --git a/src/map/battle.c b/src/map/battle.c
    index 1a04aef..f461be3 100644
    --- a/src/map/battle.c
    +++ b/src/map/battle.c
    @@ -5901,6 +5901,13 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
     	if( (s_bl = battle->get_master(src)) == NULL )
     		s_bl = src;
     
    +	if ( s_bl->type == BL_PC && t_bl->type == BL_MOB ) {
    +		TBL_PC *sd = BL_CAST( BL_PC, s_bl );
    +		if ( ( ( (TBL_MOB*)target )->class_ == 1288 && !strcmp( mapindex_id2name(sd->mapindex), "guild_vs1" ) ) &&
    +			( sd->status.guild_id == mapreg->readreg( script->add_str("$koegid") ) || battle_getcurrentskill(src) > 0 ) )
    +		return 0;
    +	}
    +
     	if ( s_bl->type == BL_PC ) {
     		switch( t_bl->type ) {
     			case BL_MOB: // Source => PC, Target => MOB
    diff --git a/src/map/battle.h b/src/map/battle.h
    index 0fcef72..8d93cac 100644
    --- a/src/map/battle.h
    +++ b/src/map/battle.h
    @@ -7,6 +7,7 @@
     
     #include "../common/cbasetypes.h"
     #include "map.h" //ELE_MAX
    +#include "mapreg.h"
     
     /**
      * Declarations
    
    

    Sorry my English was really bad ... so the problem is when i'm applying this patch and compile i'm getting error on the console and the player still can hit/attack the emperium, is this the correct patch/code for rathena, cause i took it at Hercules forum or do i need to change it or modify it ?

×
×
  • Create New...