Jump to content
  • 0

check if you have any armor in your inventory


powkda

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  89
  • Reputation:   1
  • Joined:  11/11/17
  • Last Seen:  

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

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  924
  • Reputation:   166
  • Joined:  04/05/13
  • Last Seen:  

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

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  89
  • Reputation:   1
  • Joined:  11/11/17
  • Last Seen:  

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

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  924
  • Reputation:   166
  • Joined:  04/05/13
  • Last Seen:  

Ah I see you problem, you need to enchant something into equipment that was equipped.

Please use delequip instead of delitem.

Ignore my code above it useless now.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  89
  • Reputation:   1
  • Joined:  11/11/17
  • Last Seen:  

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

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  924
  • Reputation:   166
  • Joined:  04/05/13
  • Last Seen:  

Go to doc/script_command

See how delequip syntax works.

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2341
  • Joined:  10/28/11
  • Last Seen:  

unequip EQI_ARMOR;   <--------
delitem 30063,1;
delequip .@item,1;

you aren't suppose to unequip the equipment when you trying to delete it.

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