Jump to content
  • 0

Warp NPC Request item


kasim03

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  03/27/17
  • Last Seen:  

Hi Guy, i already create this script, but this script have bug and i need help to fix it...

prontera,149,189,4    script    Event NPC    859,{

    if (countitem(501) > 0)    goto    callfunc    ("E_Warp1");
    if (countitem(502) > 0)    goto    callfunc    ("E_Warp2");
    else    
    mes    "you dont have item A to use Event NPC";    end;
}
function    script    E_Warp1    {

    if (countitem(501) > 0)    goto    warp ("prontera",151,185);
    end;
}
function    script    E_Warp2    {

    if (countitem(502) > 0)    goto    warp ("prontera",151,185);
    end;
}

i want make script can send you to different warp with different items, this script work but have bug.. i already use other script but have error... if you guy have script more simpler then this i like to try it...

Desktop-1-7-2020-11-37-08-AM-571.png

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

5 hours ago, kasim03 said:

Hi Guy, i already create this script, but this script have bug and i need help to fix it...


prontera,149,189,4    script    Event NPC    859,{

    if (countitem(501) > 0)    goto    callfunc    ("E_Warp1");
    if (countitem(502) > 0)    goto    callfunc    ("E_Warp2");
    else    
    mes    "you dont have item A to use Event NPC";    end;
}
function    script    E_Warp1    {

    if (countitem(501) > 0)    goto    warp ("prontera",151,185);
    end;
}
function    script    E_Warp2    {

    if (countitem(502) > 0)    goto    warp ("prontera",151,185);
    end;
}

i want make script can send you to different warp with different items, this script work but have bug.. i already use other script but have error... if you guy have script more simpler then this i like to try it...

Desktop-1-7-2020-11-37-08-AM-571.png

Untested but should work..

// How to use F_Warp?
// F_Warp(<item_id>,<item_amount>,"<mapname>"{,<x>{,<y>}});
prontera,150,180,0	script	Toll Warp	123,{
function F_Warp;
	mes "Where would you like to warp?";
	next;
	switch(select(
		"Prontera", 	// Case 1
		"Geffen", 		// Case 2
		"Payon" 		// Case 3 -- no "," since this is the last in the lst..
	)) {
	case 1: // Prontera
		F_Warp(501,5,"prontera",150,160);
		break;
	case 2: // Geffen
		F_Warp(502,3,"geffen",50,100);
		break;
	case 3: // Payon
		F_Warp(503,1,"payon",145,170);
		break;
	}
	end;

	function	F_Warp	{
		.@item = getarg(0);
		.@amount = getarg(1);
		.@map$ = getarg(2,"");
		.@x = getarg(3,0);
		.@y = getarg(4,0);
		if ( countitem(.@item) < .@amount ) {
			mes "You dont have enough "+getitemname(.@item)+" to warp in this map.";
			close;
		}
		delitem .@item, .@amount;
		warp .@map$, .@x, .@y;
		return;
	}
}

Read how F_Warp works..

You should know the basic on how to add menu..

If you are still confused, refer to script_commands.txt

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

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  03/27/17
  • Last Seen:  

Good script you give, but I don't want to have a menu or 'mes' on the script, I just want the npc warp script to send players to different locations according to different items, just one click on npc it continues to send to the destination according to items owned by the player.?

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  03/27/17
  • Last Seen:  

prontera,149,189,4    script    Event NPC    859,{
function F_Warp;

    if (countitem(501) > 0)    goto    case_1;
    if (countitem(502) > 0)    goto    case_2;
    if (countitem(503) > 0)    goto    case_3;
 {
    case_1:
        F_Warp(501,1,"prontera",150,160);
        end;
    case_2:
        F_Warp(502,1,"prontera",150,160);
        end;
    case_3:
        F_Warp(503,1,"prontera",150,160);
        end;
    }
    end;

    function    F_Warp    {
        .@item = getarg(0);
        .@amount = getarg(1);
        .@map$ = getarg(2,"");
        .@x = getarg(3,0);
        .@y = getarg(4,0);
        if ( countitem(.@item) < .@amount ) {
            mes "You dont have enough item A to use Event NPC.";
            close;
        }
        delitem .@item, .@amount;
        warp .@map$, .@x, .@y;
        return;
    }
}

I tried to edit the script a little bit and this is the result.

 

I think this is the solution, if there is a better script than this you can share it with me here.

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