Jump to content
  • 0

Guild Ranker By Conquer Calculations


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

Is it possible to make a Guild based on how many times you have conquered a castle?

like if guild A conquered alde_cas01 then they gained + 1 guild rank

then after 10 minutes the Guild B conquered the castle so the Guild B gains + 1 Guild Rank

and after 10 minutes again the Guild A conquers the Castle so they gained + 1 again .... so the total would be 2.............

something like this......

but if Guild A Break the guild then the rank of the guild would also be deleted on the rank page.......

Edited by caspa
Link to comment
Share on other sites

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

SQL

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

In npc/guild/agit_main.txt under OnAgitBreak: add

query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);

Ref this post

*If you want to display guild 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;
}

Edited by Capuche
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

thank you capuche!! i have not tested it yet since im not on my house yet...... but this script is not something attach to the breaker right? i mean if

juanito from the demigodz guild breaks the emp!! then that guild gains the +1 so theyre part of the rank now....... but then the player suddenly decides to leave the guild!! the +1 that the guild earned will stay right there right? and not disappear and would only disappear unless the guild is being /breakguild......

Edited by caspa
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

the +1 that the guild earned will stay right there right? and not disappear and would only disappear unless the guild is being /breakguild......

Yeah it's attached to the guild not to players.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

How qbout in the npc if you want to reset the rankings?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

It's easy to reset by sql no need this option I guess.

prontera,155,181,5    script    Woe Points    100,{
   if( getgmlevel() > 1 ) {
       if( select( "Reset ?", "Continue" ) == 1 ) {
           query_sql "UPDATE `guild` SET `woe_points` = '0' WHERE `woe_points` > 0";
           close;
       }
   }
   .@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;
}

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

Thank you.... [ PROBLEM SOLVED ]

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  01/10/13
  • Last Seen:  

how can i see the rankings ofthe guild?

 

[EDIT]... 

 

i already saw it,, 


thx

Edited by nazdecoco
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  04/02/12
  • Last Seen:  

@Capuche - I want to use the script in a certain map only.

How?

And there is no agit_main.txt in npc/guild/

 

Thanks!

Edited by heartfilia
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

@Capuche - I want to use the script in a certain map only.

How?

And there is no agit_main.txt in npc/guild/

 

Thanks!

 

The file's name is agit_template on eathena.

 

Under OnAgitBreak: add

	if ( strcharinfo(3) == "Your Castle Map Name" )
		query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);

and replace "Your Castle Map Name" by the map name of the castle

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  04/02/12
  • Last Seen:  

@Capuche - I want to use the script in a certain map only.

How?

And there is no agit_main.txt in npc/guild/

 

Thanks!

 

The file's name is agit_template on eathena.

 

Under OnAgitBreak: add

	if ( strcharinfo(3) == "Your Castle Map Name" )
		query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);

and replace "Your Castle Map Name" by the map name of the castle

Thanks for that. /no1 BTW

I tried this on eathena

 

It's easy to reset by sql no need this option I guess.

 

prontera,155,181,5    script    Woe Points    100,{
    if( getgmlevel() > 1 ) {
        if( select( "Reset ?", "Continue" ) == 1 ) {
            query_sql "UPDATE `guild` SET `woe_points` = '0' WHERE `woe_points` > 0";
            close;
        }
    }
    .@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;
}

 

But there is an error in Line 8. Not working in eathena/3CeAM?

Edited by heartfilia
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

-    .@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++ ) {
+    set .@nb, query_sql( "select name, woe_points from guild order by woe_points desc limit 3", .@guild_name$, .@points );
+    for ( set .@i, 0; .@i < .@nb; set .@i, .@i +1 ) {

Not working in eathena/3CeAM?

these emu don't support direct variable assignment like in C

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  226
  • Reputation:   11
  • Joined:  01/09/12
  • Last Seen:  

SQL

alter table guild add column woe_points int(11) default 0 after emblem_data, add index (woe_points);
In npc/guild/agit_main.txt under OnAgitBreak: add

	query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);
Ref this post

*If you want to display guild 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;
}

How about on guild2/agit_main_se.txt? nothing to change? just the guild/agit_main.txt?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

About woe 2, in agit_main_se add the sql update under OnStartArena

OnStartArena:
	query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  226
  • Reputation:   11
  • Joined:  01/09/12
  • Last Seen:  

About woe 2, in agit_main_se add the sql update under OnStartArena

OnStartArena:
	query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);

Thank you Capuche

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

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

Should i run this on the mysql database?

Edited by Fresh prince
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Yes, you only have to do it once, Fresh Prince.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Im sorry to ask again, but how can I exclude 1 castle on breaks being counted?

Say i do not want for prtg_cas01 to be included?

Thanks!!

Under OnAgitBreak:

if (!strcharinfo(3) == "prtg_cas01" )

query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);

-is this correct?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

OnAgitBreak:

if ( strcharinfo(3) != "prtg_cas01" )

query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Hello, what about if i want to exclude 3 castles?

Should i do = "prtg_cas01", "prtg_cas02", "prtg_cas03") ?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


if ( preg_match( "prtg_cas0[123]",strcharinfo(3) ) )

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Thanks Mr. Capuche, these are prontera castles. What if i want to include payg_cas04?

 

payg_cas04,prtg_cas05, and aldeg_cas02?

 

Thank you so much!

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

I misread, you want to exclude the castle.. in the previous post it should be

if ( preg_match( "prtg_cas0[123]",strcharinfo(3) ) == 0 )
    query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);
.@map$ = strcharinfo(3);
if ( preg_match( "prtg_cas0[123]",.@map$ ) == 0 && preg_match( "payg_cas0[45]",.@map$ ) == 0 && preg_match( "aldeg_cas0[2]",.@map$ ) == 0 )
	query_sql "update guild set woe_points = woe_points +1 where guild_id = "+ getcharid(2);

prtg_cas0[123] to exclude prtg_cas01, prtg_cas02, prtg_cas03

payg_cas0[45] to exclude castle 4, 5 etc..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Thank you Sir!

Link to comment
Share on other sites

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...