Jump to content
  • 0

Question

Posted (edited)

Hi,

I would like to request a script that will give a point to whoever has the castle on a specific time

Example:

I have set a 2hours WoE time (7pm to 9pm)

Whoever guild has the castle during 7:30pm scores 1point, at 8:00pm, scores another 1 point.. Every 30minutes until end of WoE (9pm)

Every break of the Emperium will also give the guild 1 point.

and there will be an NPC Ladder to show the Top 3 Guilds with most points..

I'm using Euphy's WoE Controller: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk/npc/custom/woe_controller.txt

Thank you in advance to whoever will make this..

Edited by MikzDawson

20 answers to this question

Recommended Posts

  • 0
Posted

@Capuche hello sir? would you please check this post again, i'm kinda interested on having this kind of script but with more options like, if its possible if only the active castle will be registered during woe time? like we can have the rest of maps in the arrays but it wont count except the active one.

 

TIA

Posted

Whoever guild has the castle during 7:30pm scores 1point, at 8:00pm, scores another 1 point.. Every 30minutes until end of WoE (9pm)

Every break of the Emperium will also give the guild 1 point.

and there will be an NPC Ladder to show the Top 3 Guilds with most points..

Like you asked. Every time a guild break the emp, gains 1 point. Every 30 min atfer woe start, the guild who owns the castle get 1 point.

You must load the table in your sql.

If your woe have just 1 castle, delete other castle map in OnInit.

In guild/agit_main.txt add

// Add one points in rank guild
// ----------------------------
   callfunc( "gpoints_woe", .@GID, 1 );
//-----------------------------

after

OnAgitBreak:
   set .@GID,getcharid(2);


/*
CREATE TABLE IF NOT EXISTS `guild_points` (
 `guild_id` int(11) unsigned NOT NULL default '0',
 `guild_name` varchar(255) NOT NULL DEFAULT 'NULL',
 `total_points` int(11) unsigned NOT NULL default '0',
 `woe_points` int(11) unsigned NOT NULL default '0',
 PRIMARY KEY  (`guild_id`)
) ENGINE=MyISAM;
*/

prontera,160,164,5    script    Guild Points    90,{

// Configurations
// --------------
   function displaypoints;
   .@guild_cID = getcharid(2);
   .@npc$ = "[^7600CC Guild Points ^000000]";
   .@GM = getgmlevel();

L_main:
// Unavailable during WOE
// ----------------------
   if( ( agitcheck() || agitcheck2() ) && !.@GM ) {
       mes .@npc$;
       mes "Hello,",
           "I'm busy there is a WOE now, can you come back later ?.";
       close;
   }

// Main menu
// ---------
   mes .@npc$;
   mes "Hello "+ ( .@GM ? "^FF0000[ GM ] "+ strcharinfo(0) +"^000000," : strcharinfo(0) +"," );
   mes " ";
   mes "What can I do for you ?";
   next;

   switch( select( "^777777~ Top 3 Guild^000000", "^777777~ Last WOE statistics^000000", ( !.@guild_cID ? "" : "^777777~ My Guild Points^000000" ), "^777777~ Leave^000000" ) ) {
       case 1:
       case 2:
           if( !displaypoints( ( @menu -1 ? 0 : 1 ), 1 ) ) {
               mes .@npc$;
               mes " ";
               mes "There is no result sorry.";
               emotion e_swt;
               next;
           }
           break;
       case 3:
           query_sql( "SELECT `total_points` FROM `guild_points` WHERE `guild_id` = '"+ .@guild_cID +"'", .@total_points );
           mes .@npc$;
           mes " ";
           mes "Your guild have "+ .@total_points +" total points.";
           next;
           break;
       case 4:
           mes .@npc$,
               " ",
               "Then Goodbye !";
               close;
   }
   goto L_main;


OnAgitStart:
   initnpctimer;
   .timetick = gettimetick(2) + 1500;    // display an announce every 1500 secs ~ 25 min
   query_sql( "UPDATE `guild_points` SET `woe_points` = '0'" );
   end;

// give points every 30 min
// ------------------------
OnTimer1799000:
   if( gettimetick(2) > .timetick ) {
       .timetick = gettimetick(2) + 1500;
       displaypoints( 0,0 );
   }
   for( .@i = 0; .@i < .size_c; .@i++ ) {
       .@owned_by = getcastledata( .castle$[ .@i ],1 );
       if( .@owned_by )
           callfunc( "gpoints_woe", .@owned_by, 1 );
   }
   initnpctimer;
   end;

OnAgitEnd:
   displaypoints( 0,0 );
   stopnpctimer;
   sleep 5000;
   displaypoints( 1,0 );
   end;


// Display guild point to all / self
// ---------------------------------
function displaypoints {
   if( getarg(0) )
       .@nb = query_sql( "SELECT `guild_name`, `total_points` FROM `guild_points` WHERE `total_points` > 0 ORDER BY `total_points` DESC LIMIT 10", .@guild_name$, .@points );
   else
       .@nb = query_sql( "SELECT `guild_name`, `woe_points` FROM `guild_points` WHERE `woe_points` > 0 ORDER BY `woe_points` DESC LIMIT 10", .@guild_name$, .@points );

   if( !.@nb ) return 0;

   announce ( getarg(0) ? "~~~~~ Guild POINTS ~~~~~" : "~~~~~ Woe POINTS ~~~~~" ), ( getarg(1) ? bc_self : bc_all );
   for( .@i = 0; .@i < .@nb; .@i++ )
       announce .@points[ .@i ] +" points : "+ .@guild_name$[ .@i ], ( getarg(1,0) ? bc_self : bc_all );
   return 1;
}


OnInit:
// Castle list - 1 point for each castle owned
// -------------------------------------------
   setarray .castle$, "aldeg_cas01",    "aldeg_cas02",    "aldeg_cas03",    "aldeg_cas04",    "aldeg_cas05",
                       "gefg_cas01",    "gefg_cas02",    "gefg_cas03",    "gefg_cas04",    "gefg_cas05",
                       "payg_cas01",    "payg_cas02",    "payg_cas03",    "payg_cas04",    "payg_cas05",
                       "prtg_cas01",    "prtg_cas02",    "prtg_cas03",    "prtg_cas04",    "prtg_cas05",
                       "nguild_alde",    "nguild_gef",    "nguild_pay",    "nguild_prt",
                       "schg_cas01",    "schg_cas02",    "schg_cas03",    "schg_cas04",    "schg_cas05",
                       "arug_cas01",    "arug_cas02",    "arug_cas03",    "arug_cas04",    "arug_cas05";

   .size_c = getarraysize( .castle$ );
   end;
}

// Update guild_points table
// -------------------------
function    script    gpoints_woe    {
   .@guild_id = getarg(0);

   if( !query_sql( "SELECT `guild_id` FROM `guild_points` WHERE `guild_id` = '"+ .@guild_id +"' ", .@guild_id ) )
       query_sql( "INSERT INTO `guild_points` (`guild_id`, `guild_name`, `total_points`, `woe_points`) VALUE ('"+ .@guild_id +"', '"+ getguildname( .@guild_id ) +"', '0', '0')" );

   .@value = getarg(1);
   query_sql( "UPDATE `guild_points` SET `total_points` = ( total_points + ("+ .@value +") ), `woe_points` = ( woe_points + ("+ .@value +") ) WHERE `guild_id` = '" + .@guild_id + "'" );
   return;
}

Posted

This will only add points to the castle that is active on that day? I mean, it should not add points to those guild that owns a castle that is not active during the WoE on that day.

Example

Monday = Kriemhild and Fad

Guild A owns Hohen, the points will be added only to the guild that owns Kriemhild and Fad.

Posted (edited)

This will only add points to the castle that is active on that day? I mean, it should not add points to those guild that owns a castle that is not active during the WoE on that day.

Example

Monday = Kriemhild and Fad

Guild A owns Hohen, the points will be added only to the guild that owns Kriemhild and Fad.

No you didn't specify this I will make an edit... wait

Edited by Capuche
Posted (edited)

prontera,155,181,5    script    Woe Points    100,{
   .@nb = query_sql( "select * from woe_point order by points desc limit 3", .@guild_id, .@points );
   if ( !.@nb ) {
       mes "no record yet";
       close;
   }
   for ( .@i = 0; .@i < .@nb; .@i++ )
       mes ( .@i +1 )+". "+ getguildname( .@guild_id[.@i] ) +" -> "+ .@points[.@i];
   close;
OnClock1930:
OnClock2000:
OnClock2030:
OnClock2100:
   for ( .@i = 0; .@i < 30; .@i++ ) {
       .@castle_guild_id = getcastledata( getvariableofnpc( .Castles$[.@i], "WOE_CONTROL" ), 1 );
       if ( getvariableofnpc( .Active[0], "WOE_CONTROL" ) & 1 << .@i && .@castle_guild_id )
           query_sql "insert into woe_point values ( "+ .@castle_guild_id +", 1 ) on duplicate key update points = points +1";
   }
   end;
OnBreakEmp: // put doevent under OnAgitBreak ...
   query_sql "insert into woe_point values ( "+ getcharid(2) +", 1 ) on duplicate key update points = points +1";
   end;
}

why make things so hard ?

EDIT: ops, forgot the SQL create

create table woe_point (
guild_id int(11) unsigned primary key,
points int(11)
) engine = myisam;


EDIT2 ... wait a moment, I change the layout

ok here, I think better use existing table because if the guild gets deleted,

the row will also be deleted from the source itself

alter table guild add column woe_points int(11) default 0 after emblem_data, add index (woe_points);

prontera,155,181,5    script    Woe Points    100,{
   .@nb = query_sql( "select name, woe_points from guild order by woe_points desc limit 3", .@guild_name$, .@points );
   for ( .@i = 0; .@i < .@nb; .@i++ ) {
       if ( !.@points[.@i] ) break;
       mes ( .@i +1 )+". "+ .@guild_name$[.@i] +" -> "+ .@points[.@i];
   }
   close;
OnClock1930:
OnClock2000:
OnClock2030:
OnClock2100:
   for ( .@i = 0; .@i < 30; .@i++ ) {
       .@castle_guild_id = getcastledata( getvariableofnpc( .Castles$[.@i], "WOE_CONTROL" ), 1 );
       if ( getvariableofnpc( .Active[0], "WOE_CONTROL" ) & 1 << .@i && .@castle_guild_id )
           query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ .@castle_guild_id;
   }
   end;
OnBreakEmp: // put doevent under OnAgitBreak ...
   query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);
   end;
}

Edited by AnnieRuru
  • Upvote 1
Posted

prontera,155,181,5	script	Woe Points	100,{
.@nb = query_sql( "select * from woe_point order by points desc limit 3", .@guild_id, .@points );
if ( !.@nb ) {
	mes "no record yet";
	close;
}
for ( .@i = 0; .@i < .@nb; .@i++ )
	mes ( .@i +1 )+". "+ getguildname( .@guild_id[.@i] ) +" -> "+ .@points[.@i];
close;
OnClock1930:
OnClock2000:
OnClock2030:
OnClock2100:
for ( .@i = 0; .@i < 30; .@i++ ) {
	.@castle_guild_id = getcastledata( getvariableofnpc( .Castles$[.@i], "WOE_CONTROL" ), 1 );
	if ( getvariableofnpc( .Active[0], "WOE_CONTROL" ) & 1 << .@i && .@castle_guild_id )
		query_sql "insert into woe_point values ( "+ .@castle_guild_id +", 1 ) on duplicate key update points = points +1";
}
end;
OnBreakEmp: // put doevent under OnAgitBreak ...
query_sql "insert into woe_point values ( "+ getcharid(2) +", 1 ) on duplicate key update points = points +1";
end;
}

why make things so hard ?

EDIT: ops, forgot the SQL create

create table woe_point (
guild_id int(11) unsigned primary key,
points int(11)
) engine = myisam;


EDIT2 ... wait a moment, I change the layout

ok here, I think better use existing table because if the guild gets deleted,

the row will also be deleted from the source itself

alter table guild add column woe_points int(11) default 0 after emblem_data, add index (woe_points);

prontera,155,181,5	script	Woe Points	100,{
.@nb = query_sql( "select name, woe_points from guild order by woe_points desc limit 3", .@guild_name$, .@points );
for ( .@i = 0; .@i < .@nb; .@i++ ) {
	if ( !.@points[.@i] ) break;
	mes ( .@i +1 )+". "+ .@guild_name$[.@i] +" -> "+ .@points[.@i];
}
close;
OnClock1930:
OnClock2000:
OnClock2030:
OnClock2100:
for ( .@i = 0; .@i < 30; .@i++ ) {
	.@castle_guild_id = getcastledata( getvariableofnpc( .Castles$[.@i], "WOE_CONTROL" ), 1 );
	if ( getvariableofnpc( .Active[0], "WOE_CONTROL" ) & 1 << .@i && .@castle_guild_id )
		query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ .@castle_guild_id;
}
end;
OnBreakEmp: // put doevent under OnAgitBreak ...
query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);
end;
}

Hi Annie,

This will work even if on the same day there's 2 castles active on WoE?

Example:

Sunday (7-9pm) prtg_cas01 and prtg_cas02 are active..

then Monday to Friday I have 1 castle enabled which is Second Edition castle :)

Thank you for the script Annie <3

Posted

		.@castle_guild_id = getcastledata( getvariableofnpc( .Castles$[.@i], "WOE_CONTROL" ), 1 );
	if ( getvariableofnpc( .Active[0], "WOE_CONTROL" ) & 1 << .@i && .@castle_guild_id )
		query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ .@castle_guild_id;

yes it will, can't read these 3 lines ?

in euphy's woe controller script, many variables are already preset there

I just have to use some getvariableofnpc retrieve the value directly from there

  • Upvote 1
Posted
.@castle_guild_id = getcastledata( getvariableofnpc( .Castles$[.@i], "WOE_CONTROL" ), 1 );
		if ( getvariableofnpc( .Active[0], "WOE_CONTROL" ) & 1 << .@i && .@castle_guild_id )
			query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ .@castle_guild_id;
yes it will, can't read these 3 lines ?

in euphy's woe controller script, many variables are already preset there

I just have to use some getvariableofnpc retrieve the value directly from there

 

OnBreakEmp: // put doevent under OnAgitBreak ...
    query_sql "insert into woe_point values ( "+ getcharid(2) +", 1 ) on duplicate key update points = points +1";
    end;

 

where to add this one?

or will i just let this inside the script? sorry for a newbie question

Posted

where to add this one?

or will i just let this inside the script? sorry for a newbie question

OnBreakEmp: // put doevent under OnAgitBreak ...
    query_sql "insert into woe_point values ( "+ getcharid(2) +", 1 ) on duplicate key update points = points +1";
    end;

Leave this alone in the script

 

 

In guild/agit_main.txt add after OnAgitBreak:

doevent "Woe Points::OnBreakEmp";
  • Upvote 1
Posted

How can i make a shop for this script that will make WOE Points as the currency and it is a shop for the guild master only?


 

 

where to add this one?


or will i just let this inside the script? sorry for a newbie question

OnBreakEmp: // put doevent under OnAgitBreak ...
    query_sql "insert into woe_point values ( "+ getcharid(2) +", 1 ) on duplicate key update points = points +1";
    end;

Leave this alone in the script

 

 

In guild/agit_main.txt add after OnAgitBreak:

doevent "Woe Points::OnBreakEmp";

Bump

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...