Jump to content
  • 0

Guild Level Check


Nokia

Question


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  150
  • Reputation:   5
  • Joined:  12/28/11
  • Last Seen:  

Hi there, i want to make a "guild reward" npc, the npc should warp all members in a lvl 50 guild to a map. like this:

mes hi bla

if guild lvl is not 50

mes you cant use this service

close

else

warp bla

end

but i cant find any script function in eathena to check the guild lvl via scripts, or i missed something?

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

I don't believe you can actually check guild level via a script command (single command) you can get the name of the guild, if they are in one, and then read the SQL DB for the level value :P

Link to comment
Share on other sites


  • Group:  Development Manager
  • Topic Count:  56
  • Topics Per Day:  0.01
  • Content Count:  732
  • Reputation:   525
  • Joined:  12/13/11
  • Last Seen:  

As Z3R0 said, there is no actual scripting command to get the level of a guild, but this is a simple NPC to get it without having to make an actual command.

prontera,150,150,3    script    Guild Level    100,{
   set .@guild_id,strcharinfo(2);
   if ( !.@guild_id ) {
       mes "You aren't in a guild!";
       close;
   }

   query_sql "SELECT `guild_lv` FROM `guild` WHERE `guild_id` = '"+ .@guild_id +"'",.@guild_lv;

   mes "Your guild level is "+ .@guild_lv +"!";
   close;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  150
  • Reputation:   5
  • Joined:  12/28/11
  • Last Seen:  

hmm, the sql part isent working for me, the npc always says im not in a guild and if i cut the script into this:

prontera,150,150,3	script	Guild Level	100,{
query_sql "SELECT `guild_lv` FROM `guild` WHERE `guild_id` = '"+ .@guild_id +"'",.@guild_lv;
mes "Your guild level is "+ .@guild_lv +"!";
close;
}

then the npc always says your guild lvl is 0, but its not.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

prontera,155,188,0	script	GuildLevel50	910,{
query_sql "SELECT guild_lv FROM guild WHERE guild_id = "+getcharid(2), .@guild_lv;
mes "hi bla";
if (getcharid(2) == 0) {
	mes "You are not in a guild.";
} else if (.@guild_lv < 50) {
	mes "you cant use this service";
	mes "Your guild must be level 50.";
} else {
	warp "bla",0,0;
}
close;
}

@Nokia: your example isn't working because .@guild_id isn't set, so it's 0.

Then your 'query_sql' looks up the guild_lv for guild_id 0 (which doesn't exist).

Try the full script Aleos posted, or the example I posted above.

Edited by Brian
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  150
  • Reputation:   5
  • Joined:  12/28/11
  • Last Seen:  

ah thanks, but now the npc always says my guild is not lvl 50, but my guild is lvl 50 :/

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Did you recently level up to 50? since we are querying SQL, there is a slight delay.

The map-server saves guild info every 60 seconds (or whatever you have autosave_time set to).

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  150
  • Reputation:   5
  • Joined:  12/28/11
  • Last Seen:  

ah i see, i changed my glvl with @glvl, it works if i wait 60 seconds, thanks :P

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  206
  • Reputation:   11
  • Joined:  12/06/11
  • Last Seen:  

Hello, Brian how about this?

I wanted to 'check guild' name and 'no guild' also.

prontera,155,188,0    script    Check Guild    910,{

   query_sql "SELECT guild FROM guild WHERE guild_id = "+getcharid(2), .@guild;
   mes "hi bla";
   if (getcharid(2) == 0) {
       mes "Guilde: None Guild";
   }
   // Other    
   else {
       mes "Guild:";
       warp "bla",0,0;
   }
   close;
}

Thank you :3

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

For guild name, there is a script command: getguildname :)

mes "Guild name:";
mes getguildname(getcharid(2));

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