Jump to content
  • 0

NPC Script


Zeke

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  12/05/13
  • Last Seen:  

Hi, I need a script as follows

1. A Npc should spawn before every WOE i.e 30 mins before the woe starts till the woe gets over. to provide woe supplies to players by clicking on it.

2. The Npc should give items according to the player class as specified.

    a. A Sniper will get traps, pots and etc as specified

    b. A Creator will get acid bottles, pots etc as specified 

etc as to all chars of trans 99 class only. 

3. The Npc should reappear before every woe and should give the items only once before every woe.

4. And the npc should give supplies only to players in guild approved by a GM.

5. Server WOE Timings.

Sunday 1700 hours  - 1900 hours and

WEDNESDAY 1800 hours - 2000 hours.

 

 

Can Anyone help with this script?

Edited by Zeke
Link to comment
Share on other sites

Recommended Posts


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  179
  • Reputation:   17
  • Joined:  04/24/14
  • Last Seen:  

Another small oversight on my part. It's fixed in the post above.

 

Guild Master gets the item now. (working)

 

Can you slightly change it for Guild Master like onwednesday - item1, onsunday - item2?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

 

Another small oversight on my part. It's fixed in the post above.

 

Guild Master gets the item now. (working)

 

Can you slightly change it for Guild Master like onwednesday - item1, onsunday - item2?

 

 

Done...

 

http://rathena.org/board/topic/93077-npc-script/page-2#entry256484

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  179
  • Reputation:   17
  • Joined:  04/24/14
  • Last Seen:  

 

tested again, working perfectly!

many thanks!!!!  /no1

Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  63
  • Topics Per Day:  0.05
  • Content Count:  172
  • Reputation:   1
  • Joined:  11/16/20
  • Last Seen:  

On 5/23/2014 at 5:07 AM, Skorm said:

 

Yeah some things still haven't been tested like the next and back buttons when there are more than 10 guilds in the list but it should work.

-	script	SupplyTrigger	-1,{
OnWed1700:
OnSun1600: 
	enablenpc "WoE Supply";
	end;

OnAgitEnd:
OnAgitEnd2:
	disablenpc "WoE Supply";
	end;
}


prontera,100,200,3	script	WoE Supply	78,{
	function sf {
		function s;
		.@a = getarg(2);
		.@len = getarg(3);
		return (
			sprintf( getarg(0),
				s(.@a, .@len, getarg(1)), s(.@a++, .@len, getarg(1)),
				s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)),
				s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)), 
				s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)), 
				s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1))
			)
			+(( .@a+1 < .@len )?":Next":":")
			+(( .@a-11 > 0 )?":Back":":")
			+":Cancel"
		);
		function s {
			if( getarg(0) >= getarg(1) ) return "";
			else {
				.@name$ = getguildname(getelementofarray(getarg(2),getarg(0)));
				return .@name$=="null"?"":.@name$;
			}
		};
	};
	function nex { return((getarg(0)+10)<getarg(1)?getarg(0)+10:getarg(1)-(getarg(1)%10)); };
	function bac { return((getarg(0)-10)>=0?getarg(0)-10:0); };

	if( getgmlevel()>=80 ) {
		mes .Npc_Name$;
		mes "Hello Mr. GM what would you like to do?";
		next;
		switch( select("Add/Remove Guilds:Clear Guild Data:Player Menu:Cancel") ) {
			case 1:
				mes .Npc_Name$;
				mes "Would you like to add or remove a guild?";
				.@a_len = getarraysize($App_Guilds);
				.@format$ = "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s";
				next;
				if( select("Remove:Add") == 1 ) {
					while( .@a != 9999 ) {
						select( sf( .@format$, $App_Guilds, .@a, .@a_len ) );
						switch( @menu ) {
							case 11: .@a = nex( .@a, .@a_len ); break;
							case 12: .@a = bac( .@a ); break;
							case 13: end;
							
							default:
								.@select = .@a+@menu-1;
								mes .Npc_Name$;
								mes "You've selected ^0000FF["+getguildname($App_Guilds[.@select])+"]^000000 guild. Would you like to remove them from the accepted guilds?";
								next;
								if( select("Yes:No") == 1 ) {
									deletearray($App_Guilds[.@select],1);
									mes .Npc_Name$;
									mes "The guild has been removed!";
								}
								close;
						}
					}
				} else {
					mes .Npc_Name$;
					mes "Please input guild name or masters name.";
					next;
					input(.@input$);
					.@len = query_sql( "Select `guild_id` from `guild` where `name` like '%"+escape_sql(.@input$)+"%' or `master` like '%"+escape_sql(.@input$)+"%';",.@guild_id );
					while( .@a != 9999 ) {
						select( sf( .@format$, .@guild_id, .@a, .@len ) );
						switch( @menu ) {
							case 11: .@a = nex( .@a, .@len ); break;
							case 12: .@a = bac( .@a ); break;
							case 13: end;
							
							default:
								.@select = .@a+@menu-1;
								.@a_len = getarraysize($App_Guilds);
								for(.@b=0;.@b<.@a_len;.@b++)
									if( $App_Guilds[.@b]==.@guild_id[.@select] ) {
										mes .Npc_Name$;
										mes "You've selected ^0000FF["+getguildname(.@guild_id[.@select])+"]^000000 guild. I'm sorry but that guild has already been added to the accepted list."; close;
									}
								mes .Npc_Name$;
								mes "You've selected ^0000FF["+getguildname(.@guild_id[.@select])+"]^000000 guild. Would you like to add them to the accepted guilds?";
								next;
								if( select("Yes:No") == 1 ) {
									.@a_len = getarraysize($App_Guilds);
									if( .@a_len>=128 ) {
										mes .Npc_Name$;
										mes "I'm sorry but the accepted list is full please make some room and try again...";
									} else {
										mes .Npc_Name$;
										mes "The guild was successfully added!";
										$App_Guilds[.@a_len] = .@guild_id[.@select];
									}
								}
								close;
						}
					}
				}
			case 2:
				mes .Npc_Name$;
				mes "Guild data cleared!";
				deletearray($App_Guilds);
				close;
				
			case 3: break;
			
			case 4:
				mes .Npc_Name$;
				mes "Alright, have a nice day!";
				close;
		}
	}

	mes .Npc_Name$;
	mes "I'm here to give you supplies for WoE!";
	next;
	mes .Npc_Name$;

	for( set .@i,0; .@i <= getarraysize($App_Guilds); set .@i, .@i+1 ) {
		if( getcharid(2) == $App_Guilds[.@i] )
			set .@Guild_Check, .@Guild_Check+1;
	}
	if( .@Guild_Check < 1 ) {
		mes "Your guild has not yet been approved, please contact the GMs";
		close;
	}
	if( !getcharid(2) ) {
		mes "Sorry only members of a guild may use this npc.";
		close;	
	}
	if( BaseLevel < 99 || Class > 4022 ) {
		mes "Sorry this is for Lvl 99 Trans Class only";
		close;	
	}
	if( gettimetick(2) < #delay ) {
		mes "Sorry, you can only claim this once every WoE";
		close;
	}
	switch( Class ) {
		case 4012: //Sniper class
			getitem 1065,10; //10 Traps
			getitem 504,20; //20 White potions
			break;
		case 4019: //Creator class
			getitem 7136,10; //10 Acid Bottles
			getitem 504,20; //20 White potions
			break;
		//Add more cases for all classes
		default: break;
	}

	set #delay, gettimetick(2)+10800;
	mes "Here you go, goodluck!";
	close;

OnInit:
    set .Npc_Name$, "[^0000FF WoE Supply ^000000]";
    disablenpc "WoE Supply";
    end;
}

Great Work...!! was looking for this and found this ..!!

  • Upvote 1
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...