Jump to content
  • 0

npc warp using item


GoldRoger

Question


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   0
  • Joined:  03/19/18
  • Last Seen:  

Quote

lhz_dun03,239,78,4    script    Bio Entrance    651,{
function F_Warp;

    if (countitem(501) > 0)    goto    case_1;
 {
    case_1:
        F_Warp(501,1,"lhz_dun04",244,61);
        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 this warp.";
            close;
        }
        delitem .@item, .@amount;
        warp .@map$, .@x, .@y;
        return;
    }
}

how can i make this npc shows 6 item requirements to enter this warp

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  212
  • Reputation:   94
  • Joined:  06/02/12
  • Last Seen:  

Make the function support more items, using arrays and loops.

lhz_dun03,239,78,4	script	Bio Entrance	651,{
function F_Warp;

    if (countitem(501) > 0) goto case_1;
	end;

case_1:
	//F_Warp("<map>",<x>,<y>,<item 1 ID>,<item 1 amount>{,<item 2 ID>,<item 2 amount>{...}}
	F_Warp("lhz_dun04",244,61,501,1,971,1,6471,1,7347,2,7345,3,6470,1);
	end;

	function    F_Warp    {
		.@map$ = getarg(0,"");
		.@x = getarg(1,0);
		.@y = getarg(2,0);

		//This loop fills a array with all the needed items
		for(.@i = 3; .@i < getargcount(); .@i += 2) {
			.@items[.@i2] = getarg(.@i);
			.@amount[.@i2] = getarg(.@i + 1);
			.@i2++;
		}

		//This loop checks for each item needed
		for (.@i = 0; .@i < getarraysize(.@items); .@i++) {
			if (countitem(.@items[.@i]) < .@amount[.@i]) {
				if (!.@header) {
					mes "I don't have enough items to use this warp. I still need:";
					.@header = true; 
				}
				mes .@amount[.@i] + " " + mesitemlink(.@items[.@i]);
				.@missing = true;
			}
		}
		if (.@missing) return;

		//This loop removes each item needed
		for (.@i = 0; .@i < getarraysize(.@items); .@i++)
			delitem .@items[.@i], .@amount[.@i];

		warp .@map$, .@x, .@y;
		return;
	}
}

 

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   0
  • Joined:  03/19/18
  • Last Seen:  

Can you help me put anything item id on that script..im not really understand to put where the item id..thank sir

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  212
  • Reputation:   94
  • Joined:  06/02/12
  • Last Seen:  

25 minutes ago, GoldRoger said:

Can you help me put anything item id on that script..im not really understand to put where the item id..thank sir

Find and edit this line.

F_Warp("lhz_dun04",244,61,501,1,971,1,6471,1,7347,2,7345,3,6470,1);

Each value is separated by "," (comma).

The 1st value is for which map to teleport. In this case "lhz_dun04".
The 2nd value is the x coordenate to warp the player in the map: 244.
The 3rd value is the y coordenate to warp the player in the map: 61.
The 4th value is the ID of the item requirement: 501 (Red Potion)
The 5th value is the amount of the item in the previous parameter: 1 (need 1 Red Potion)
The following values are for other items. This is where you put any item you want.
 6th: 971 (Detrimindexta)
7th: 1 (need 1 Detrimindexta)
8th: 6471 (Goast_Chill)
9th: 1 (need 1 Goast_Chill)
10th: 7347 (Research Chart)
11th: 2 (need 2 Research Chart)

 

Example: I want to make a warp to Geffen, the player need 15 Jellopy (item ID 909) and 84 Coals (item ID 1003).

F_Warp("geffen",50,40,909,15,1003,84);

 

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   0
  • Joined:  03/19/18
  • Last Seen:  

Nice..how can i make the npc just need that requirement item just one time..next time no need the item..thank sir ..u really awesome with good explanation

Edited by GoldRoger
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  2
  • Reputation:   1
  • Joined:  08/08/24
  • Last Seen:  

To modify your script so that the NPC checks for 6 different item requirements before allowing the player to use the warp, you need to enhance the F_Warp function to handle multiple items and their respective quantities. Here is a modified version of your script that checks for 6 different items and their amounts before warping the player:

lhz_dun03,239,78,4 script Bio Entrance 651,{
function F_Warp;

if (countitem(501) > 0 && countitem(502) > 0 && countitem(503) > 0 && countitem(504) > 0 && countitem(505) > 0 && countitem(506) > 0) goto case_1;
else {
    mes "You do not have the required items to use this warp.";
    close;
}

case_1:
    F_Warp([501, 502, 503, 504, 505, 506], [1, 1, 1, 1, 1, 1], "lhz_dun04", 244, 61);
    end;

end;

function F_Warp {
    .@items = getarg(0);
    .@amounts = getarg(1);
    .@map$ = getarg(2, "");
    .@x = getarg(3, 0);
    .@y = getarg(4, 0);

    for (.@i = 0; .@i < getarraysize(.@items); .@i++) {
        if (countitem(.@items[.@i]) < .@amounts[.@i]) {
            mes "You do not have enough of item " + .@items[.@i] + " to use this warp.";
            close;
        }
    }

    for (.@i = 0; .@i < getarraysize(.@items); .@i++) {
        delitem .@items[.@i], .@amounts[.@i];
    }

    warp .@map$, .@x, .@y;
    return;
}
}
fireboy and watergirl

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  212
  • Reputation:   94
  • Joined:  06/02/12
  • Last Seen:  

6 hours ago, GoldRoger said:

Nice..how can i make the npc just need that requirement item just one time..next time no need the item..thank sir ..u really awesome with good explanation

Use a variable to track when the player delivers all the items.
Put a if statement for said variable so that the NPC skips the whole items code and teleport the player directly.

if (my_variable == 0) {
	mes "You don't have the variable...";
	mes "You didn't do the quest!";
	mes "Let's do the quest now.";
	my_variable = 1;
	close;
}
//Player can only get to this part if they have my_variable set.
mes "You did the quest!";
mes "Go ahead.";

 

lhz_dun03,239,78,4	script	Bio Entrance	651,{
function F_Warp;

    if (countitem(501) > 0) goto case_1;
	end;

case_1:
	//F_Warp("<map>",<x>,<y>,<item 1 ID>,<item 1 amount>{,<item 2 ID>,<item 2 amount>{...}}
	F_Warp("lhz_dun04",244,61,501,1,971,1,6471,1,7347,2,7345,3,6470,1);
	end;

	function    F_Warp    {
		.@map$ = getarg(0,"");
		.@x = getarg(1,0);
		.@y = getarg(2,0);

		if (bio_entrance_unlocked == false) {
			//This loop fills a array with all the needed items
			for(.@i = 3; .@i < getargcount(); .@i += 2) {
				.@items[.@i2] = getarg(.@i);
				.@amount[.@i2] = getarg(.@i + 1);
				.@i2++;
			}

			//This loop checks for each item needed
			for (.@i = 0; .@i < getarraysize(.@items); .@i++) {
				if (countitem(.@items[.@i]) < .@amount[.@i]) {
					if (!.@header) {
						mes "I don't have enough items to use this warp. I still need:";
						.@header = true; 
					}
					mes .@amount[.@i] + " " + mesitemlink(.@items[.@i]);
					.@missing = true;
				}
			}
			if (.@missing) return;

			//This loop removes each item needed
			for (.@i = 0; .@i < getarraysize(.@items); .@i++)
				delitem .@items[.@i], .@amount[.@i];
			bio_entrance_unlocked = true; //warp unlocked!
		}
		warp .@map$, .@x, .@y;
		return;
	}
}

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   0
  • Joined:  03/19/18
  • Last Seen:  

Quote
if (my_variable == 0) {
	mes "You don't have the variable...";
	mes "You didn't do the quest!";
	mes "Let's do the quest now.";
	my_variable = 1;
	close;
}
//Player can only get to this part if they have my_variable set.
mes "You did the quest!";
mes "Go ahead.";

this one i just put at the last of script line?

how to make that npc highlight item already have..example poring card required 3..but i have 2 pcs..that npc highlight with red color on 2pcs not enough requirement

sir..sorry for make trouble
 

Edited by GoldRoger
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  08/12/24
  • Last Seen:  

För att NPC

 
ska kräva 6 olika objekt för att använda denna warp, kan du modifiera skriptet så här:
 
plaintext
Sao chép mã
if (countitem(501) > 0 && countitem(502) > 0 && countitem(503) > 0 && countitem(504) > 0 && countitem(505) > 0 && countitem(506) > 0) { goto case_1; }

Den här ändringen kollar att spelaren har alla 6 nödvändiga objekt innan de kan använda warden. För att lära dig mer om skript och objektkontroll, kanske du hittar inspiration på Pokerogue och Pokerogue wiki!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  37
  • Reputation:   7
  • Joined:  03/07/23
  • Last Seen:  

On 8/8/2024 at 9:01 AM, GoldRoger said:

this one i just put at the last of script line?

how to make that npc highlight item already have..example poring card required 3..but i have 2 pcs..that npc highlight with red color on 2pcs not enough requirement

sir..sorry for make trouble
 

You can use an "if" condition checking if the player has the specific amount of items, if he doesn't he shows the name of the item in red, if he does he shows it in green. If you don't know how to use colors in NPCs, here's an example:

"[^03fc0fAlekinho^000000]";

^hexColor<name of npc>^000000

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   0
  • Joined:  03/19/18
  • Last Seen:  

On 8/12/2024 at 4:50 PM, EmmanuelRippin said:

För att NPC

 
ska kräva 6 olika objekt för att använda denna warp, kan du modifiera skriptet så här:
 
plaintext
Sao chép mã
if (countitem(501) > 0 && countitem(502) > 0 && countitem(503) > 0 && countitem(504) > 0 && countitem(505) > 0 && countitem(506) > 0) { goto case_1; }

Den här ändringen kollar att spelaren har alla 6 nödvändiga objekt innan de kan använda warden. För att lära dig mer om skript och objektkontroll, kanske du hittar inspiration på Pokerogue och Pokerogue wiki!

I dont understand sir

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   0
  • Joined:  03/19/18
  • Last Seen:  

4 hours ago, emundus said:

You can use an "if" condition checking if the player has the specific amount of items, if he doesn't he shows the name of the item in red, if he does he shows it in green. If you don't know how to use colors in NPCs, here's an example:

"[^03fc0fAlekinho^000000]";

^hexColor<name of npc>^000000

Where should i put this sir?..anyway thanks reply

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  37
  • Reputation:   7
  • Joined:  03/07/23
  • Last Seen:  

38 minutes ago, GoldRoger said:

Where should i put this sir?..anyway thanks reply

Give me the code that do you have until now, and I will do for you and edit here.

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   0
  • Joined:  03/19/18
  • Last Seen:  

Quote

lhz_dun03,239,78,4    script    Bio Entrance    651,{
function F_Warp;

    if (countitem(4359) > 0) goto case_1;
    end;

case_1:
    //F_Warp("<map>",<x>,<y>,<item 1 ID>,<item 1 amount>{,<item 2 ID>,<item 2 amount>{...}}
    F_Warp("lhz_dun04",244,61,4359,5,4357,5,4367,5,4365,5,4363,5,4361,5);
    end;

    function    F_Warp    {
        .@map$ = getarg(0,"");
        .@x = getarg(1,0);
        .@y = getarg(2,0);

        //This loop fills a array with all the needed items
        for(.@i = 3; .@i < getargcount(); .@i += 2) {
            .@items[.@i2] = getarg(.@i);
            .@amount[.@i2] = getarg(.@i + 1);
            .@i2++;
        }

        //This loop checks for each item needed
        for (.@i = 0; .@i < getarraysize(.@items); .@i++) {
            if (countitem(.@items[.@i]) < .@amount[.@i]) {
                if (!.@header) {
                    mes "I don't have enough items to use this warp. I still need:";
                    .@header = true; 
                }
                mes .@amount[.@i] + " " + mesitemlink(.@items[.@i]);
                .@missing = true;
            }
        }
        if (.@missing) return;

        //This loop removes each item needed
        for (.@i = 0; .@i < getarraysize(.@items); .@i++)
            delitem .@items[.@i], .@amount[.@i];

        warp .@map$, .@x, .@y;
        return;
    }
}

this the code sir..

 

https://pastebin.com/AiV2m8dE

Edited by GoldRoger
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  37
  • Reputation:   7
  • Joined:  03/07/23
  • Last Seen:  

I made a basic script just to show you how it works, here is YOUR updated script and attachment showing how it works:

image.png.68004599ab08cdb3c56469d1c0198fb8.png

 

lhz_dun03,239,78,4    script    Bio Entrance    651,{
function F_Warp;

    if (countitem(4359) > 0) goto case_1;
    end;

case_1:
    //F_Warp("<map>",<x>,<y>,<item 1 ID>,<item 1 amount>{,<item 2 ID>,<item 2 amount>{...}}
    F_Warp("lhz_dun04",244,61,4359,5,4357,5,4367,5,4365,5,4363,5,4361,5);
    end;

    function    F_Warp    {
        .@map$ = getarg(0,"");
        .@x = getarg(1,0);
        .@y = getarg(2,0);

        //This loop fills a array with all the needed items
        for(.@i = 3; .@i < getargcount(); .@i += 2) {
            .@items[.@i2] = getarg(.@i);
            .@amount[.@i2] = getarg(.@i + 1);
            .@i2++;
        }

        //This loop checks for each item needed
        for (.@i = 0; .@i < getarraysize(.@items); .@i++) {
            if (countitem(.@items[.@i]) < .@amount[.@i]) {
                if (!.@header) {
                    mes "I don't have enough items to use this warp..";
                    mes "I still need: "+mesitemlink(.@items[.@i])+"^FF0000"+countitem(.@items[.@i])+"^000000/^27FF00"+.@amount[.@i]+"^000000.";
                    .@header = true; 
                }
                mes .@amount[.@i] + " " + mesitemlink(.@items[.@i]);
                .@missing = true;
            }
        }
        if (.@missing) return;

        //This loop removes each item needed
        for (.@i = 0; .@i < getarraysize(.@items); .@i++)
            delitem .@items[.@i], .@amount[.@i];

        warp .@map$, .@x, .@y;
        return;
    }
}

 

Edited by emundus
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  78
  • Reputation:   0
  • Joined:  03/19/18
  • Last Seen:  

image.png.229eff99778a19815172c33e3217c3c2.png

Quote

the npc shows remaining item not complete..but if i dont have all those card..i click npc ,nothing happen..how can make this npc shows all those item?

btw thanks help 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...