skuray Posted December 19, 2018 Posted December 19, 2018 hello rathena. I need a npc warp that asks for an item in return. Only 1 warp map. Obrigado Quote
0 Emistry Posted December 20, 2018 Posted December 20, 2018 prontera,155,181,5 script Sample 4_F_KAFRA1,{ mes "Warp to "+.map$+" ?"; if (.item_id_size) { for (.@i = 0; .@i < .item_id_size; .@i++) { mes "> "+.item_qty[.@i]+"x "+getitemname(.item_id[.@i]); if (countitem(.item_id[.@i]) < .item_qty[.@i]) .@failed++; } } if (select("Warp", "Cancel") == 1) { if (.@failed) { mes "You didnt have enough items."; } else { if (.item_id_size) for (.@i = 0; .@i < .item_id_size; .@i++) delitem .item_id[.@i], .item_qty[.@i]; warp .map$, 0, 0; } } close; OnInit: .map$ = "prontera"; setarray .item_id, 501, 502, 503; setarray .item_qty, 100, 200, 300; .item_id_size = getarraysize(.item_id); end; } 2 Quote
1 Radian Posted December 20, 2018 Posted December 20, 2018 (edited) prontera,150,150,4 script Warpme! 999,{ .@itemreq = 501; .@itemamt = 10; mes "What do you want?"; next; if(select("Warp me!","Cancel") == 2) close; if(countitem(.@itemreq) < .@itemamt){ mes "Im sorry you dont have enough items in your inventory."; end; } delitem .@itemreq,.@itemamt; warp "payon",0,0; // change this to you map end; } Edited December 20, 2018 by Radian 1 Quote
0 LearningRO Posted December 19, 2018 Posted December 19, 2018 (edited) mes "warp me"; next; switch(select("Yes:No"){ case 1: if (countitem(item_id) < 1){ mes "You need XXX item to use our service"; close; } warp "prontera",156,182; end; case 2: close; } Edited December 19, 2018 by melv0 1 Quote
0 crossworld Posted December 19, 2018 Posted December 19, 2018 1 hour ago, melv0 said: mes "warp me"; next; switch(select("Yes:No"){ case 1: if (countitem(item_id) < 1){ mes "You need XXX item to use our service"; close; } warp "prontera",156,182; end; case 2: close; } Hey melv0 how would you make this script look for multiple items before warping the player 1 Quote
0 skuray Posted December 19, 2018 Author Posted December 19, 2018 (edited) 8 horas atrás, melv0 disse: não funciona Edited December 19, 2018 by skuray Quote
0 LearningRO Posted December 20, 2018 Posted December 20, 2018 18 hours ago, crossworld said: Hey melv0 how would you make this script look for multiple items before warping the player if (countitem(item_id) < 1 || countitem(item_id) < 1) 11 hours ago, skuray said: não funciona can u tell me what error on console? 1 Quote
0 crossworld Posted December 20, 2018 Posted December 20, 2018 13 minutes ago, skuray said: not the sequence of errors, just does not work prontera,145,199,5 script Game of Thrones 485,{ switch(select("Game of Thrones"){ case 1: if (countitem(8966) < 1){ mes "your mes!"; close; } warp "verus03",248,170; end; case 2: close; } its be cause you only have 1 case when its made for 2 1 Quote
0 skuray Posted December 20, 2018 Author Posted December 20, 2018 3 minutes ago, crossworld said: its be cause you only have 1 case when its made for 2 how could be the casa 2? Quote
0 crossworld Posted December 20, 2018 Posted December 20, 2018 17 minutes ago, skuray said: how could be the casa 2? prontera,145,199,5 script Game of Thrones 485,{ switch(select("Game of Thrones"){ <---------------HERE ONE CASE case 1: if (countitem(8966) < 1){ mes "your mes!"; close; } warp "verus03",248,170; end; case 2: <----------------HERE SECOND CASE close; } 1 Quote
0 skuray Posted December 20, 2018 Author Posted December 20, 2018 4 minutes ago, crossworld said: prontera,145,199,5 script Game of Thrones 485,{ switch(select("Game of Thrones"){ <---------------HERE ONE CASE case 1: if (countitem(8966) < 1){ mes "your mes!"; close; } warp "verus03",248,170; end; case 2: <----------------HERE SECOND CASE close; } thank u!!! can u help me in the this script pls? Quote
0 iwillnot Posted December 20, 2018 Posted December 20, 2018 2 hours ago, skuray said: not the sequence of errors, just does not work prontera,145,199,5 script Game of Thrones 485,{ switch(select("Game of Thrones"){ case 1: if (countitem(8966) < 1){ mes "your mes!"; close; } warp "verus03",248,170; end; case 2: close; } You're having problems because (1) You're using a select function with only one menu option "Game of Thrones", and (2), you do not have balanced braces. Syntax error, expected ) switch(select("Game of Thrones"){ Has 2 open braces ( and only one close brace ) switch(select("Game of Thrones", "Option 2")){ Checking for multiple conditions You can check for multiple conditions using the conditional operators AND or OR. if (countitem(501) > 0 && countitem(601) > 0) { mes "You have red potion AND fly wing at the same time!"; } if (countitem(501) > 0 || countitem(601) > 0) { mes "You have red potion or a fly wing... or BOTH!"; } See doc/script_commands for a full guide on NPC and item scripting. 1 Quote
0 skuray Posted December 20, 2018 Author Posted December 20, 2018 7 hours ago, iwillnot said: Você está tendo problemas porque (1) você está usando uma função de seleção com apenas uma opção de menu "Game of Thrones", e (2), você não tem chaves equilibradas. Erro de sintaxe, esperado) Tem 2 chaves abertas (e apenas uma chave fechada ) Verificando várias condições Você pode verificar várias condições usando os operadores condicionais AND ou OR . Veja doc / script_commands para um guia completo sobre NPC e scripts de itens. Thank u s2 6 hours ago, Radian said: Thank U Quote
-1 skuray Posted December 20, 2018 Author Posted December 20, 2018 (edited) 21 minutes ago, melv0 said: can u tell me what error on console? not the sequence of errors, just does not work prontera,145,199,5 script Game of Thrones 485,{ switch(select("Game of Thrones"){ case 1: if (countitem(8966) < 1){ mes "your mes!"; close; } warp "verus03",248,170; end; case 2: close; } Edited December 20, 2018 by skuray Quote
Question
skuray
hello rathena.
I need a npc warp that asks for an item in return.
Only 1 warp map.
Obrigado
13 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.