Jump to content
  • 0

Request Notification NPC


Dolphin86

Question


  • Group:  Members
  • Topic Count:  257
  • Topics Per Day:  0.06
  • Content Count:  708
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

hello, could someone show me script example for this situation:

1. player bring item (multiple item) to the npc

2. npc will check for item requirement.

3. player will have to wait at least 1 minute before player can receive the item, while waiting the npc will have a text notification (crafting) and no other player can use the npc while its crafting

4. when the item craft is completed there will be a text notification completed (it will stay until the player who craft it or any other player take out the item (kinda stealing)

 

here is my my script... 

Spoiler
new_1-3,90,35,6	script	Public Workbench	665,{
				
if(BeginnerQuest == 2) goto BeginnerQuest2;
if(BeginnerQuest == 3) goto BeginnerQuest3;
if(BeginnerQuest == 6) goto BeginnerQuest6;
if(BeginnerQuest == 7) goto BeginnerQuest7;

BeginnerQuest7:
				mes "I should ask Training Instructor.";
				close;			

BeginnerQuest6:
				mes "[Workbench]";
				mes "Craft-";
				menu "Rope",Rope,"Cancel",cancel1;
				
				Rope:
					mes "[Workbench]";
					mes "Item requirement:";
					mes "4x Stalk";
					next;
					mes "[Workbench]";
					if(select("-Craft:Cancel")==2) goto cancel;
					if(countitem(40008) < 4 ) {
					mes "^ff0000 Not enough Stalk ^000000";
					close;
				
					} else {
					delitem 40008,4;
					specialeffect2 610;
					mes "^30ff00 Success ! ^000000";
					getitem 40007,1;
					getitem 40014,1;
					set BeginnerQuest,7;
					close;
					}
				
				cancel1:
					mes "[Workbench]";
					mes "cancel";
					close;


BeginnerQuest3:
				mes "I should ask Training Instructor.";
				close;
			
BeginnerQuest2:				
				mes "[Workbench]";
				mes "Craft-";
				menu "Stone Dagger",stonedagger,"Cancel",cancel2;	
				
					stonedagger:
						next;
						mes "[Workbench]";
						mes "Item Requirement";
						mes "Rock [2 pcs]";
						next;
				
						if(select("-Craft:Cancel")==2) goto cancel;
						if(countitem(40005) < 2 ) {
						next;
						mes "^ff0000 Not enough Rock ^000000";
						close;
				
						} else {
						delitem 40005,2;
						specialeffect2 610;
						mes "^30ff00 Success ! ^000000";
						getitem 40007,1;
						getitem 40009,1;
						set BeginnerQuest,3;
						close;
						}
					cancel2:
						next;
						mes "[Workbench]";
						mes "Cancel";
						close;

}

 

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   87
  • Joined:  06/30/18
  • Last Seen:  

prontera,155,177,5	script	Request Notification NPC	100,{
    if($rn_crafting_state == 1) end;

    if($rn_crafting_state == 2) {
        mes .npc_name$;
        mes "Here is the crafting result.";
        getitem(.crafted_item[0], .crafted_item[1]);
        $rn_crafting_state = 0;
        delwaitingroom;
        close;
    }

    for(.@i = 0; .@i < getarraysize(.required_items); .@i += 2) {
        if(countitem(.required_items[.@i]) < .required_items[.@i + 1]) {
            mes .npc_name$;
            mes "You are missing " + .required_items[.@i + 1] + " x " + getitemname(.required_items[.@i]) + ".";
            close;
        }
    }

    for(.@i = 0; .@i < getarraysize(.required_items); .@i += 2)
        delitem(.required_items[.@i], .required_items[.@i + 1]);

    $rn_crafting_state = 1;
    waitingroom("CRAFTING", 0);
    initnpctimer;
    end;

    OnTimer60000:
        delwaitingroom;
        waitingroom("CRAFTING COMPLETED", 0);
        $rn_crafting_state = 2;
    end;

    OnInit:
        .npc_name$ = strnpcinfo(1);
        setarray(.required_items, 501, 1, 502, 1, 503, 1);
        setarray(.crafted_item, 504, 1);
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  102
  • Reputation:   6
  • Joined:  03/02/18
  • Last Seen:  

you can make it on your own, using countitem, gettimetick, dispbottom or its up to you if you make it announce, like what i did in my hero quest script, Goodluck.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  257
  • Topics Per Day:  0.06
  • Content Count:  708
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

2 hours ago, Winterfox said:
prontera,155,177,5	script	Request Notification NPC	100,{
    if($rn_crafting_state == 1) end;

    if($rn_crafting_state == 2) {
        mes .npc_name$;
        mes "Here is the crafting result.";
        getitem(.crafted_item[0], .crafted_item[1]);
        $rn_crafting_state = 0;
        delwaitingroom;
        close;
    }

    for(.@i = 0; .@i < getarraysize(.required_items); .@i += 2) {
        if(countitem(.required_items[.@i]) < .required_items[.@i + 1]) {
            mes .npc_name$;
            mes "You are missing " + .required_items[.@i + 1] + " x " + getitemname(.required_items[.@i]) + ".";
            close;
        }
    }

    for(.@i = 0; .@i < getarraysize(.required_items); .@i += 2)
        delitem(.required_items[.@i], .required_items[.@i + 1]);

    $rn_crafting_state = 1;
    waitingroom("CRAFTING", 0);
    initnpctimer;
    end;

    OnTimer60000:
        delwaitingroom;
        waitingroom("CRAFTING COMPLETED", 0);
        $rn_crafting_state = 2;
    end;

    OnInit:
        .npc_name$ = strnpcinfo(1);
        setarray(.required_items, 501, 1, 502, 1, 503, 1);
        setarray(.crafted_item, 504, 1);
}

 

thanks, this is much more cleaner version

Question: where is the timer part where i can set the time for waiting ? @Winterfox

Edited by Dolphin86
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   87
  • Joined:  06/30/18
  • Last Seen:  

17 hours ago, Dolphin86 said:

thanks, this is much more cleaner version

Question: where is the timer part where i can set the time for waiting ? @Winterfox

The script uses a npc timer, that calls labels based on their time suffix.
In the case of this script, the label is OnTimer60000 the 60000 means 60 seconds, since the time is given in milliseconds so 1 second = 1000 milliseconds.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  257
  • Topics Per Day:  0.06
  • Content Count:  708
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

2 minutes ago, Winterfox said:

The script uses a npc timer, that calls labels based on their time suffix.
In the case of this script, the label is OnTimer60000 the 60000 means 60 seconds, since the time is given in milliseconds so 1 second = 1000 milliseconds.

owhhhh understood, but can u check my other post, its almost similar to this

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