Jump to content
  • 0

compounded item check


Fresh prince

Question


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Hi Rathena,

 

 

Can you guys please help me with a script that will provide as follow:

 

If I talk to a npc, in order for me to get into a warp or continue to my quest, i need to put away my turtle general card in my inventory completely.

 

 

 

•Turtle general compounded with a bow in my inventory = mes "can't allow you to continue";

 

•Turtle general card only in inventory = mes "can't allow you to continue";

 

•Turtle general compounded with a bow(equipped) = mes "can't allow you to continue";

 

 

Thank you very much.

Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  93
  • Reputation:   14
  • Joined:  12/12/11
  • Last Seen:  

For the 2nd and third option you can use

 

// Checks if the Turtle General Card is inside your inventory by seeing if the item count for the Item ID 4305 ( Turtle General Card ) is greater than zero.

 

if(countitem(4305) > 0) {
         mes "Can't allow you to continue";
         close;
}

 

 

// Checks if Equiped item has the turtle general card equiped for each individual slot ( 1-4 )

// If the ID of CARD SLOT of Equiped Item Position (2 = Weapon I believe ) is equal to 4035 ( Turtle General Card ID )

// I made it check all four card positions, First, Second, Third, and Fourth

 

// If the the Equiped Item at Position 2 ( Weapon's Position ) Card Slot's Item ID is Equal to 4035

// I reworded this so that it matches the argument positions...

 

if(getequipcardid(2,0) == 4305 || getequipcardid(2,1) == 4305 || getequipcardid(2,2) == 4305 || getequipcardid(2,3) == 4305) {
         mes "Can't allow you to continue";
         close;
}

 

Script Command Information

 

 

*getequipcardid(<equipment slot>,<card slot>)

Returns value from equipped item slot in the indicated slot:

getequipcardid(num,slot)

where:
    num = equip position slot
    slot = 0,1,2,3 (Card Slot N)

This func returns CARD ID, 255,254,-255 (for card 0, if the item is produced) it's useful 
when you want to check item cards or if it's signed. Useful for such quests as 
"Sign this refined item with players name" etc;
    Hat[0] +4 -> Player's Hat[0] +4

 

For your first one, you'd have to do an inventory check by using getinventorylist and have it check each individual item to see any of them has the card inside them. I think you would want to use these predefined arrays to search for them though. I'll test it myself later when I have time to see if it works.

 

PREDEFINED ARRAYS

 

@inventorylist_card1[]     - These four arrays contain card data for the items.
@inventorylist_card2[]       These data slots are also used to store names
@inventorylist_card3[]       inscribed on the items, so you can explicitly check
@inventorylist_card4[]       if the character owns an item made by a specific 

 

---> Edit

 

I managed to find time and test the script for the getinventorylist

 

 

This will check all items in your inventory if they have a card inside the card slots that is a Turtle General Card ( Item ID 4305 )

 

// While .@i is less than the amount of items inside your inventory...

// Check if any of the items has the item ID 4305 inside card position 1;

// Same goes for the rest of the positions.

// set .@i, .@i +1 to increment by one in value every time the while loop is run. ( 1... 2... 3... until value is GREATER than inventory count )

// The maximum times it will run is the amount of items you have inside your inventory.

// Once the value of  .@i is GREATER than the amount of items inside your inventory,

// it'll break out of the loop and continue whatever additional script lines you add in.

    while ( .@i < @inventorylist_count ) {
        if (@inventorylist_card1[.@i] == 4305 || @inventorylist_card2[.@i] == 4305 || @inventorylist_card3[.@i] == 4305 || @inventorylist_card4[.@i] == 4305){
            mes "Can't allow you to continue.";
            close;
        }
    set .@i, .@i + 1;

    }
    // Once loop is finished, it will continue here.
    mes "Thank you Evelynn (:";
    close;

 

Sorry for making you read all this if you did. I am trying to explain to you what is going on inside the script so that you will be able to learn for future use. Other than that, good luck (:.

Edited by Evelynn
  • Upvote 2
Link to comment
Share on other sites


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

you can simply use isequipped

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Thank you so much evelyn for the time and effort explaining and helping me out here. I will try that asap when i get out of work. :)

Master emistry, i thing isequipped works only on equipped item no? It doesn't check if your turtle gen compounded to a bow sitting on your inventory. Ty also!

Link to comment
Share on other sites


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

it will work even for compounded items...

 

same trick using in my 

 
the wiki even show you the example ...
rv1ITGN.jpg
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Even if you're not equipped right? It will check if you compounded card and weapon is just sittin on your inventory? Thanks alot!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  93
  • Reputation:   14
  • Joined:  12/12/11
  • Last Seen:  

Thanks Emistry for showing another way to check compounded items on equiped items. I never knew about this script function x:...

 

I tested this script though and it only checks if the item that is EQUIPPED has the card compounded and NOT items that are sitting inside the inventory.

This is the better solution for Will Smith's 3rd request. However, it does not apply for his 1st and 2nd request.

 

He also wanted to check the items that are NOT-EQUIPPED if they too have a certain card compounded in their card slots.

Thus the reason why I used the getinventorylist was to help me check each individual item he has in his inventory.

 

----

 

The script function isequipped did NOT run when I only had it sitting in my inventory. When I equipped it, it ran perfectly fine.

Edited by Evelynn
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Haha will smith :D yes i agree Evelyn that the isequipped only works on compounded weapons and cards that were equipped by players.

When it sits on your inv, even if you have countitem, the nlc wont recognize the card's id but the weapon's id only i guess.

Im anxious to try your suggestion out, still waiting to get out of here. Thanks again!
 

Edited by Fresh prince
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  93
  • Reputation:   14
  • Joined:  12/12/11
  • Last Seen:  

I tested my script again just to ensure that it works.

It worked for me; The script ran "Can't allow you to continue" when I had my turtle general card compounded on any equipment in my inventory.

 

When I dropped the items, it ran "Thank you Evenlynn :)".

 

Can you send me what you did to your script so I can take a look at what you did?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Thanks for your help! Its actually working now, my friend walked me through and it's working just fine now. Thank you again!

Edited by Fresh prince
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  93
  • Reputation:   14
  • Joined:  12/12/11
  • Last Seen:  

Alright glad to hear that.

 

Good luck with your server.

Edited by Evelynn
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...