Jump to content
  • 0
powkda

check if you have any armor in your inventory

Question

Good morning, how are you?
How do I check if there is any Armor in the inventory?
I tried this way but it is detecting the one that is equipped too, I want you to check only the one in the inventory.

getinventorylist;
    while ( .@i < @inventorylist_count && getiteminfo( @inventorylist_id[ .@i ] ,5 ) != 16 && getiteminfo( @inventorylist_id[ .@i ] ,5 ) != 2 ) .@i++;
    if ( .@i < @inventorylist_count ) {
        mes "Você deve guardar todas as Armaduras do seu inventário antes de continuar.";
        close;
    }

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
getinventorylist;
	
freeloop(1);
	
for(.@i = @inventorylist_count - 1; .@i >= 0; .@i--){
	if(!@inventorylist_equip[.@i]
       && (getiteminfo(@inventorylist_id[.@i],ITEMINFO_LOCATIONS) == Armor))
{
}
}
	
freeloop(0);

 

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

  • 0
29 minutes ago, Start_ said:
getinventorylist;
	
freeloop(1);
	
for(.@i = @inventorylist_count - 1; .@i >= 0; .@i--){
	if(!@inventorylist_equip[.@i]
       && (getiteminfo(@inventorylist_id[.@i],ITEMINFO_LOCATIONS) == Armor))
{
}
}
	
freeloop(0);

 

I'm wanting you to check if you have any armor in the inventory in this scrip

case 1:
	if(callfunc("checkencht",30062) == 0)
	{ mes "Sua Armadura precisa estar encantada com ["+getitemname(30063)+"] para continuar, volte quando tiver!"; close; }
if(countitem(30063)<1)goto noitem;
set .@item, getequipid(EQI_ARMOR);
set .@rand_bonus, rand(30063,30063);
set .@refine, getequiprefinerycnt(EQI_ARMOR);
set .@cardid, getequipcardid(EQI_ARMOR,0);
set .@cardid1, getequipcardid(EQI_ARMOR,1);
set .@cardid2, getequipcardid(EQI_ARMOR,2);
if(getequipisequiped(EQI_ARMOR)==0)goto noarmo;
unequip EQI_ARMOR;
delitem 30063,1;
delitem .@item,1;
getitem2 .@item,1,1,.@refine,0, .@cardid, .@cardid1, .@cardid2, .@rand_bonus;
specialeffect(EF_MAPPILLAR, AREA, playerattached());
next;
announce "[PowkRO] "+strcharinfo(0)+" encantou "+getitemname(.@item)+" com ["+getitemname(30063)+"] !",bc_all;
mes "^FF0000["+strnpcinfo(1)+"]^000000";
mes "Parabéns, Seu item foi encantado com Sucesso!";
close;

I tried this way, ams is blocking the one that is equipped too

getinventorylist;
	
freeloop(1);
	
for(.@i = @inventorylist_count - 1; .@i >= 0; .@i--){
	if(!@inventorylist_equip[.@i]
       && (getiteminfo(@inventorylist_id[.@i],ITEMINFO_LOCATIONS) == Armor)){

	if(callfunc("checkencht",30062) == 0)
	{ mes "Sua Armadura precisa estar encantada com ["+getitemname(30063)+"] para continuar, volte quando tiver!"; close; }
if(countitem(30063)<1)goto noitem;
set .@item, getequipid(EQI_ARMOR);
set .@rand_bonus, rand(30063,30063);
set .@refine, getequiprefinerycnt(EQI_ARMOR);
set .@cardid, getequipcardid(EQI_ARMOR,0);
set .@cardid1, getequipcardid(EQI_ARMOR,1);
set .@cardid2, getequipcardid(EQI_ARMOR,2);
if(getequipisequiped(EQI_ARMOR)==0)goto noarmo;
unequip EQI_ARMOR;
delitem 30063,1;
delitem .@item,1;
getitem2 .@item,1,1,.@refine,0, .@cardid, .@cardid1, .@cardid2, .@rand_bonus;
specialeffect(EF_MAPPILLAR, AREA, playerattached());
next;
announce "[PowkRO] "+strcharinfo(0)+" encantou "+getitemname(.@item)+" com ["+getitemname(30063)+"] !",bc_all;
mes "^FF0000["+strnpcinfo(1)+"]^000000";
mes "Parabéns, Seu item foi encantado com Sucesso!";
close;

}
mes "Você precisa guardar todas as Armaduras que estão no inventário.";
close;
}
freeloop(0);

I want it to only have the armor equipped on the character and none on the inventory

Link to comment
Share on other sites

  • 0

I put it like this, but it bugs when you remove the item, the npc does not continue

 

	if(callfunc("checkencht",30062) == 0)
	{ mes "Sua Armadura precisa estar encantada com ["+getitemname(30063)+"] para continuar, volte quando tiver!"; close; }
if(countitem(30063)<1)goto noitem;
set .@item, getequipid(EQI_ARMOR);
set .@rand_bonus, rand(30063,30063);
set .@refine, getequiprefinerycnt(EQI_ARMOR);
set .@cardid, getequipcardid(EQI_ARMOR,0);
set .@cardid1, getequipcardid(EQI_ARMOR,1);
set .@cardid2, getequipcardid(EQI_ARMOR,2);
if(getequipisequiped(EQI_ARMOR)==0)goto noarmo;
unequip EQI_ARMOR;
delitem 30063,1;
delequip .@item,1;
getitem2 .@item,1,1,.@refine,0, .@cardid, .@cardid1, .@cardid2, .@rand_bonus;
specialeffect(EF_MAPPILLAR, AREA, playerattached());
next;
announce "[PowkRO] "+strcharinfo(0)+" encantou "+getitemname(.@item)+" com ["+getitemname(30063)+"] !",bc_all;
mes "^FF0000["+strnpcinfo(1)+"]^000000";
mes "Parabéns, Seu item foi encantado com Sucesso!";
close;

 

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.